Annotation of 43BSDReno/games/rogue/play.c, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.