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

Defined functions

play_level defined in line 17; used 1 times

Defined variables

sccsid defined in line 8; never used
Last modified: 1985-11-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3071
Valid CSS Valid XHTML 1.0 Strict