/* * execute: * Execute a single command */ void execute(PLAYER *pp) { char ch; ch = pp->p_cbuf[pp->p_ncount++]; #ifdef FLY if (pp->p_flying >= 0) { switch (ch) { case CTRL('L'): sendcom(pp, REDRAW); break; case 'q': (void) strcpy(pp->p_death, "| Quit |"); break; } return; } #endif switch (ch) { case CTRL('L'): sendcom(pp, REDRAW); break; case 'h': move_player(pp, LEFTS); break; case 'H': turn_player(pp, LEFTS); break; case 'j': move_player(pp, BELOW); break; case 'J': turn_player(pp, BELOW); break; case 'k': move_player(pp, ABOVE); break; case 'K': turn_player(pp, ABOVE); break; case 'l': move_player(pp, RIGHT); break; case 'L': turn_player(pp, RIGHT); break; case 'f': case '1': fire(pp, 0); /* SHOT */ break; case 'g': case '2': fire(pp, 1); /* GRENADE */ break; case 'F': case '3': fire(pp, 2); /* SATCHEL */ break; case 'G': case '4': fire(pp, 3); /* 7x7 BOMB */ break; case '5': fire(pp, 4); /* 9x9 BOMB */ break; case '6': fire(pp, 5); /* 11x11 BOMB */ break; case '7': fire(pp, 6); /* 13x13 BOMB */ break; case '8': fire(pp, 7); /* 15x15 BOMB */ break; case '9': fire(pp, 8); /* 17x17 BOMB */ break; case '0': fire(pp, 9); /* 19x19 BOMB */ break; case '@': fire(pp, 10); /* 21x21 BOMB */ break; #ifdef OOZE case 'o': fire_slime(pp, 0); /* SLIME */ break; case 'O': fire_slime(pp, 1); /* SSLIME */ break; case 'p': fire_slime(pp, 2); break; case 'P': fire_slime(pp, 3); break; #endif case 's': scan(pp); break; case 'c': cloak(pp); break; case 'q': (void) strcpy(pp->p_death, "| Quit |"); break; } }
/* * execute: * Execute a single command from a player */ void execute(PLAYER *pp) { char ch; ch = pp->p_cbuf[pp->p_ncount++]; /* When flying, only allow refresh and quit. */ if (pp->p_flying >= 0) { switch (ch) { case CTRL('L'): sendcom(pp, REDRAW); break; case 'q': (void) strlcpy(pp->p_death, "| Quit |", sizeof pp->p_death); break; } return; } /* Decode the command character: */ switch (ch) { case CTRL('L'): sendcom(pp, REDRAW); /* Refresh */ break; case 'h': move_player(pp, LEFTS); /* Move left */ break; case 'H': face(pp, LEFTS); /* Face left */ break; case 'j': move_player(pp, BELOW); /* Move down */ break; case 'J': face(pp, BELOW); /* Face down */ break; case 'k': move_player(pp, ABOVE); /* Move up */ break; case 'K': face(pp, ABOVE); /* Face up */ break; case 'l': move_player(pp, RIGHT); /* Move right */ break; case 'L': face(pp, RIGHT); /* Face right */ break; case 'f': case '1': fire(pp, 0); /* SHOT */ break; case 'g': case '2': fire(pp, 1); /* GRENADE */ break; case 'F': case '3': fire(pp, 2); /* SATCHEL */ break; case 'G': case '4': fire(pp, 3); /* 7x7 BOMB */ break; case '5': fire(pp, 4); /* 9x9 BOMB */ break; case '6': fire(pp, 5); /* 11x11 BOMB */ break; case '7': fire(pp, 6); /* 13x13 BOMB */ break; case '8': fire(pp, 7); /* 15x15 BOMB */ break; case '9': fire(pp, 8); /* 17x17 BOMB */ break; case '0': fire(pp, 9); /* 19x19 BOMB */ break; case '@': fire(pp, 10); /* 21x21 BOMB */ break; case 'o': fire_slime(pp, 0); /* SLIME */ break; case 'O': fire_slime(pp, 1); /* SSLIME */ break; case 'p': fire_slime(pp, 2); /* large slime */ break; case 'P': fire_slime(pp, 3); /* very large slime */ break; case 's': /* start scanning */ scan(pp); break; case 'c': /* start cloaking */ cloak(pp); break; case 'q': /* quit */ (void) strlcpy(pp->p_death, "| Quit |", sizeof pp->p_death); break; } }