1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)play_level.c 5.5 (Berkeley) 06/01/90"; 10 #endif /* not lint */ 11 12 # include "robots.h" 13 14 /* 15 * play_level: 16 * Let the player play the current level 17 */ 18 play_level() 19 { 20 register COORD *cp; 21 register int y, x, bonus; 22 23 move(My_pos.y, My_pos.x); 24 addch(PLAYER); 25 refresh(); 26 for (cp = Robots; cp < &Robots[MAXROBOTS]; cp++) { 27 if (cp->y < 0) 28 continue; 29 move(cp->y, cp->x); 30 addch(ROBOT); 31 } 32 refresh(); 33 # ifdef DEBUG 34 standout(); 35 move(Min.y, Min.x); 36 addch(inch()); 37 move(Max.y, Max.x); 38 addch(inch()); 39 standend(); 40 # endif DEBUG 41 setjmp(End_move); 42 flush_in(); 43 while (!Dead && Num_robots > 0) { 44 move(My_pos.y, My_pos.x); 45 if (!jumping()) 46 refresh(); 47 get_move(); 48 if (Real_time) 49 alarm(0); 50 if (Field[My_pos.y][My_pos.x] != 0) 51 Dead = TRUE; 52 if (!Dead) 53 move_robots(FALSE); 54 if (Was_bonus) { 55 move(Y_PROMPT, X_PROMPT); 56 clrtoeol(); 57 move(Y_PROMPT + 1, X_PROMPT); 58 clrtoeol(); 59 Was_bonus = FALSE; 60 } 61 } 62 63 /* 64 * if the player didn't die, add on the possible bonuses 65 */ 66 67 if (!Dead) { 68 Was_bonus = FALSE; 69 70 if (Level == Start_level && Start_level > 1) { 71 move(Y_PROMPT, X_PROMPT); 72 printw("Advance bonus: %d", S_BONUS); 73 refresh(); 74 add_score(S_BONUS); 75 Was_bonus = TRUE; 76 } 77 78 if (Wait_bonus != 0) { 79 if (!Was_bonus) 80 move(Y_PROMPT, X_PROMPT); 81 else 82 move(Y_PROMPT + 1, X_PROMPT); 83 printw("Wait bonus: %d", Wait_bonus); 84 refresh(); 85 add_score(Wait_bonus); 86 Was_bonus = TRUE; 87 } 88 } 89 } 90