121470Smckusick /*
2*60840Sbostic * Copyright (c) 1980, 1993
3*60840Sbostic * The Regents of the University of California. All rights reserved.
433690Sbostic *
542589Sbostic * %sccs.include.redist.c%
621470Smckusick */
721470Smckusick
821470Smckusick #ifndef lint
9*60840Sbostic static char sccsid[] = "@(#)play_level.c 8.1 (Berkeley) 05/31/93";
1033690Sbostic #endif /* not lint */
1121470Smckusick
1221470Smckusick # include "robots.h"
1321470Smckusick
1421470Smckusick /*
1521470Smckusick * play_level:
1621470Smckusick * Let the player play the current level
1721470Smckusick */
play_level()1821470Smckusick play_level()
1921470Smckusick {
2021470Smckusick register COORD *cp;
2121470Smckusick register int y, x, bonus;
2221470Smckusick
2321470Smckusick move(My_pos.y, My_pos.x);
2421470Smckusick addch(PLAYER);
2521470Smckusick refresh();
2621470Smckusick for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) {
2725019Smckusick if (cp->y < 0)
2825019Smckusick continue;
2921470Smckusick move(cp->y, cp->x);
3021470Smckusick addch(ROBOT);
3121470Smckusick }
3221470Smckusick refresh();
3321470Smckusick # ifdef DEBUG
3421470Smckusick standout();
3521470Smckusick move(Min.y, Min.x);
3621470Smckusick addch(inch());
3721470Smckusick move(Max.y, Max.x);
3821470Smckusick addch(inch());
3921470Smckusick standend();
4021470Smckusick # endif DEBUG
4121470Smckusick setjmp(End_move);
4221470Smckusick flush_in();
4321470Smckusick while (!Dead && Num_robots > 0) {
4421470Smckusick move(My_pos.y, My_pos.x);
4521470Smckusick if (!jumping())
4621470Smckusick refresh();
4721470Smckusick get_move();
4821470Smckusick if (Real_time)
4921470Smckusick alarm(0);
5021470Smckusick if (Field[My_pos.y][My_pos.x] != 0)
5121470Smckusick Dead = TRUE;
5221470Smckusick if (!Dead)
5321470Smckusick move_robots(FALSE);
5421470Smckusick if (Was_bonus) {
5521470Smckusick move(Y_PROMPT, X_PROMPT);
5621470Smckusick clrtoeol();
5721470Smckusick move(Y_PROMPT + 1, X_PROMPT);
5821470Smckusick clrtoeol();
5921470Smckusick Was_bonus = FALSE;
6021470Smckusick }
6121470Smckusick }
6221470Smckusick
6321470Smckusick /*
6421470Smckusick * if the player didn't die, add on the possible bonuses
6521470Smckusick */
6621470Smckusick
6721470Smckusick if (!Dead) {
6821470Smckusick Was_bonus = FALSE;
6921470Smckusick
7021470Smckusick if (Level == Start_level && Start_level > 1) {
7121470Smckusick move(Y_PROMPT, X_PROMPT);
7221470Smckusick printw("Advance bonus: %d", S_BONUS);
7321470Smckusick refresh();
7421470Smckusick add_score(S_BONUS);
7521470Smckusick Was_bonus = TRUE;
7621470Smckusick }
7721470Smckusick
7821470Smckusick if (Wait_bonus != 0) {
7921470Smckusick if (!Was_bonus)
8021470Smckusick move(Y_PROMPT, X_PROMPT);
8121470Smckusick else
8221470Smckusick move(Y_PROMPT + 1, X_PROMPT);
8321470Smckusick printw("Wait bonus: %d", Wait_bonus);
8421470Smckusick refresh();
8521470Smckusick add_score(Wait_bonus);
8621470Smckusick Was_bonus = TRUE;
8721470Smckusick }
8821470Smckusick }
8921470Smckusick }
90