1: /*
   2:  * play.c
   3:  *
   4:  * This source herein may be modified and/or distributed by anybody who
   5:  * so desires, with the following restrictions:
   6:  *    1.)  No portion of this notice shall be removed.
   7:  *    2.)  Credit shall not be taken for the creation of this source.
   8:  *    3.)  This code is not to be traded, sold, or used for personal
   9:  *         gain or profit.
  10:  *
  11:  */
  12: 
  13: #ifndef lint
  14: static char sccsid[] = "@(#)play.c	5.1 (Berkeley) 11/25/87";
  15: #endif /* not lint */
  16: 
  17: #include "rogue.h"
  18: 
  19: boolean interrupted = 0;
  20: char *unknown_command = "unknown command";
  21: 
  22: extern short party_room, bear_trap;
  23: extern char hit_message[];
  24: extern boolean wizard, trap_door;
  25: 
  26: play_level()
  27: {
  28:     short ch;
  29:     int count;
  30: 
  31:     for (;;) {
  32:         interrupted = 0;
  33:         if (hit_message[0]) {
  34:             message(hit_message, 1);
  35:             hit_message[0] = 0;
  36:         }
  37:         if (trap_door) {
  38:             trap_door = 0;
  39:             return;
  40:         }
  41:         move(rogue.row, rogue.col);
  42:         refresh();
  43: 
  44:         ch = rgetchar();
  45: CMCH:
  46:         check_message();
  47:         count = 0;
  48: CH:
  49:         switch(ch) {
  50:         case '.':
  51:             rest((count > 0) ? count : 1);
  52:             break;
  53:         case 's':
  54:             search(((count > 0) ? count : 1), 0);
  55:             break;
  56:         case 'i':
  57:             inventory(&rogue.pack, ALL_OBJECTS);
  58:             break;
  59:         case 'f':
  60:             fight(0);
  61:             break;
  62:         case 'F':
  63:             fight(1);
  64:             break;
  65:         case 'h':
  66:         case 'j':
  67:         case 'k':
  68:         case 'l':
  69:         case 'y':
  70:         case 'u':
  71:         case 'n':
  72:         case 'b':
  73:             (void) one_move_rogue(ch, 1);
  74:             break;
  75:         case 'H':
  76:         case 'J':
  77:         case 'K':
  78:         case 'L':
  79:         case 'B':
  80:         case 'Y':
  81:         case 'U':
  82:         case 'N':
  83:         case '\010':
  84:         case '\012':
  85:         case '\013':
  86:         case '\014':
  87:         case '\031':
  88:         case '\025':
  89:         case '\016':
  90:         case '\002':
  91:             multiple_move_rogue(ch);
  92:             break;
  93:         case 'e':
  94:             eat();
  95:             break;
  96:         case 'q':
  97:             quaff();
  98:             break;
  99:         case 'r':
 100:             read_scroll();
 101:             break;
 102:         case 'm':
 103:             move_onto();
 104:             break;
 105:         case ',':
 106:             kick_into_pack();
 107:             break;
 108:         case 'd':
 109:             drop();
 110:             break;
 111:         case 'P':
 112:             put_on_ring();
 113:             break;
 114:         case 'R':
 115:             remove_ring();
 116:             break;
 117:         case '\020':
 118:             do {
 119:                 remessage(count++);
 120:                 ch = rgetchar();
 121:             } while (ch == '\020');
 122:             goto CMCH;
 123:             break;
 124:         case '\027':
 125:             wizardize();
 126:             break;
 127:         case '>':
 128:             if (drop_check()) {
 129:                 return;
 130:             }
 131:             break;
 132:         case '<':
 133:             if (check_up()) {
 134:                 return;
 135:             }
 136:             break;
 137:         case ')':
 138:         case ']':
 139:             inv_armor_weapon(ch == ')');
 140:             break;
 141:         case '=':
 142:             inv_rings();
 143:             break;
 144:         case '^':
 145:             id_trap();
 146:             break;
 147:         case '/':
 148:             id_type();
 149:             break;
 150:         case '?':
 151:             id_com();
 152:             break;
 153:         case '!':
 154:             do_shell();
 155:             break;
 156:         case 'o':
 157:             edit_opts();
 158:             break;
 159:         case 'I':
 160:             single_inv(0);
 161:             break;
 162:         case 'T':
 163:             take_off();
 164:             break;
 165:         case 'W':
 166:             wear();
 167:             break;
 168:         case 'w':
 169:             wield();
 170:             break;
 171:         case 'c':
 172:             call_it();
 173:             break;
 174:         case 'z':
 175:             zapp();
 176:             break;
 177:         case 't':
 178:             throw();
 179:             break;
 180:         case 'v':
 181:             message("rogue-clone: Version III. (Tim Stoehr was here), tektronix!zeus!tims", 0);
 182:             break;
 183:         case 'Q':
 184:             quit(0);
 185:         case '0':
 186:         case '1':
 187:         case '2':
 188:         case '3':
 189:         case '4':
 190:         case '5':
 191:         case '6':
 192:         case '7':
 193:         case '8':
 194:         case '9':
 195:             move(rogue.row, rogue.col);
 196:             refresh();
 197:             do {
 198:                 if (count < 100) {
 199:                     count = (10 * count) + (ch - '0');
 200:                 }
 201:                 ch = rgetchar();
 202:             } while (is_digit(ch));
 203:             if (ch != CANCEL) {
 204:                 goto CH;
 205:             }
 206:             break;
 207:         case ' ':
 208:             break;
 209:         case '\011':
 210:             if (wizard) {
 211:                 inventory(&level_objects, ALL_OBJECTS);
 212:             } else {
 213:                 message(unknown_command, 0);
 214:             }
 215:             break;
 216:         case '\023':
 217:             if (wizard) {
 218:                 draw_magic_map();
 219:             } else {
 220:                 message(unknown_command, 0);
 221:             }
 222:             break;
 223:         case '\024':
 224:             if (wizard) {
 225:                 show_traps();
 226:             } else {
 227:                 message(unknown_command, 0);
 228:             }
 229:             break;
 230:         case '\017':
 231:             if (wizard) {
 232:                 show_objects();
 233:             } else {
 234:                 message(unknown_command, 0);
 235:             }
 236:             break;
 237:         case '\001':
 238:             show_average_hp();
 239:             break;
 240:         case '\003':
 241:             if (wizard) {
 242:                 c_object_for_wizard();
 243:             } else {
 244:                 message(unknown_command, 0);
 245:             }
 246:             break;
 247:         case '\015':
 248:             if (wizard) {
 249:                 show_monsters();
 250:             } else {
 251:                 message(unknown_command, 0);
 252:             }
 253:             break;
 254:         case 'S':
 255:             save_game();
 256:             break;
 257:         default:
 258:             message(unknown_command, 0);
 259:             break;
 260:         }
 261:     }
 262: }

Defined functions

play_level defined in line 26; used 1 times

Defined variables

sccsid defined in line 14; never used
unknown_command defined in line 20; used 7 times
Last modified: 1987-11-26
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2923
Valid CSS Valid XHTML 1.0 Strict