Annotation of 43BSD/games/battlestar/com3.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California,
        !             3:  * All rights reserved.  Redistribution permitted subject to
        !             4:  * the terms of the Berkeley Software License Agreement.
        !             5:  */
        !             6: 
        !             7: #ifndef lint
        !             8: static char sccsid[] = "@(#)com3.c     1.2 4/24/85";
        !             9: #endif
        !            10: 
        !            11: #include "externs.h"
        !            12: 
        !            13: dig()
        !            14: {
        !            15:        if (testbit(inven,SHOVEL)){
        !            16:                puts("OK");
        !            17:                time++;
        !            18:                switch(position){
        !            19:                        case 144:               /* copse near beach */
        !            20:                                if (!notes[DUG]){
        !            21:                                        setbit(location[position].objects,DEADWOOD);
        !            22:                                        setbit(location[position].objects,COMPASS);
        !            23:                                        setbit(location[position].objects,KNIFE);
        !            24:                                        setbit(location[position].objects,MACE);
        !            25:                                        notes[DUG] = 1;
        !            26:                                }
        !            27:                                break;
        !            28: 
        !            29:                        default:
        !            30:                                puts("Nothing happens.");
        !            31:                }
        !            32:        }
        !            33:        else    
        !            34:                puts("You don't have a shovel.");
        !            35: }
        !            36: 
        !            37: jump()
        !            38: {
        !            39:        register int n;
        !            40: 
        !            41:        switch(position){
        !            42:                default:
        !            43:                        puts("Nothing happens.");
        !            44:                        return(-1);
        !            45: 
        !            46:                case 242:
        !            47:                        position = 133;
        !            48:                        break;
        !            49:                case 214:
        !            50:                case 215:
        !            51:                case 162:
        !            52:                case 159:
        !            53:                        position = 145;
        !            54:                        break;
        !            55:                case 232:
        !            56:                        position = 275;
        !            57:                        break;
        !            58:                case 3:
        !            59:                        position = 1;
        !            60:                        break;
        !            61:                case 172:
        !            62:                        position = 201;
        !            63:        }
        !            64:        puts("Ahhhhhhh...");
        !            65:        injuries[12] = injuries[8] = injuries[7] = injuries[6] = 1;
        !            66:        for (n=0; n < NUMOFOBJECTS; n++)
        !            67:                if (testbit(inven,n)){
        !            68:                        clearbit(inven,n);
        !            69:                        setbit(location[position].objects,n);
        !            70:                }
        !            71:        carrying = 0;
        !            72:        encumber = 0;
        !            73:        return(0);
        !            74: }
        !            75: 
        !            76: bury()
        !            77: {
        !            78:        int value;
        !            79: 
        !            80:        if (testbit(inven,SHOVEL)){
        !            81:                while(wordtype[++wordnumber] != OBJECT && wordtype[wordnumber] != NOUNS && wordnumber < wordcount);
        !            82:                value = wordvalue[wordnumber];
        !            83:                if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects,value) || value == BODY))
        !            84:                        switch(value){
        !            85:                                case BODY:
        !            86:                                        wordtype[wordnumber] = OBJECT;
        !            87:                                        if (testbit(inven,MAID) || testbit(location[position].objects,MAID))
        !            88:                                                value = MAID;
        !            89:                                        if (testbit(inven,DEADWOOD) || testbit(location[position].objects,DEADWOOD))
        !            90:                                                value = DEADWOOD;
        !            91:                                        if (testbit(inven,DEADGOD) || testbit(location[position].objects,DEADGOD))
        !            92:                                                value = DEADGOD;
        !            93:                                        if (testbit(inven,DEADTIME) || testbit(location[position].objects,DEADTIME))
        !            94:                                                value = DEADTIME;
        !            95:                                        if (testbit(inven,DEADNATIVE) || testbit(location[position].objects,DEADNATIVE))
        !            96:                                                value = DEADNATIVE;
        !            97:                                        break;
        !            98: 
        !            99:                                case NATIVE:
        !           100:                                case NORMGOD:
        !           101:                                        puts("She screams as you wrestle her into the hole.");
        !           102:                                case TIMER:
        !           103:                                        power += 7;
        !           104:                                        ego -= 10;
        !           105:                                case AMULET:
        !           106:                                case MEDALION:
        !           107:                                case TALISMAN:
        !           108:                                        wordtype[wordnumber] = OBJECT;
        !           109:                                        break;
        !           110: 
        !           111:                                default:
        !           112:                                        puts("Wha..?");
        !           113:                        }
        !           114:                if (wordtype[wordnumber] == OBJECT && position > 88 && (testbit(inven,value) || testbit(location[position].objects,value))){
        !           115:                        puts("Buried.");
        !           116:                        if (testbit(inven,value)){
        !           117:                                clearbit(inven,value);
        !           118:                                carrying -= objwt[value];
        !           119:                                encumber -= objcumber[value];
        !           120:                        }
        !           121:                        clearbit(location[position].objects,value);
        !           122:                        switch(value){
        !           123:                                case MAID:
        !           124:                                case DEADWOOD:
        !           125:                                case DEADNATIVE:
        !           126:                                case DEADTIME:
        !           127:                                case DEADGOD:
        !           128:                                        ego += 2;
        !           129:                                        printf("The %s should rest easier now.\n",objsht[value]);
        !           130:                        }
        !           131:                }
        !           132:                else
        !           133:                        puts("It doesn't seem to work.");
        !           134:        }
        !           135:        else
        !           136:                puts("You aren't holding a shovel.");
        !           137: }
        !           138: 
        !           139: drink()
        !           140: {
        !           141:        register int n;
        !           142: 
        !           143:        if (testbit(inven,POTION)){
        !           144:                puts("The cool liquid runs down your throat but turns to fire and you choke.");
        !           145:                puts("The heat reaches your limbs and tingles your spirit.  You feel like falling");
        !           146:                puts("asleep.");
        !           147:                clearbit(inven, POTION);
        !           148:                WEIGHT = MAXWEIGHT;
        !           149:                CUMBER = MAXCUMBER;
        !           150:                for (n=0; n < NUMOFINJURIES; n++)
        !           151:                        injuries[n] = 0;
        !           152:                time++;
        !           153:                zzz();
        !           154:        }
        !           155:        else
        !           156:                puts("I'm not thirsty.");
        !           157: }
        !           158: 
        !           159: shoot()
        !           160: {
        !           161:        int firstnumber, value;
        !           162:        register int n;
        !           163: 
        !           164:        if (!testbit(inven,LASER))
        !           165:                puts("You aren't holding a blaster.");
        !           166:        else {
        !           167:                firstnumber = wordnumber;
        !           168:                while(wordtype[++wordnumber] == ADJS);
        !           169:                while(wordnumber<=wordcount && wordtype[wordnumber] == OBJECT){
        !           170:                        value = wordvalue[wordnumber];
        !           171:                        printf("%s:\n", objsht[value]);
        !           172:                        for (n=0; objsht[value][n]; n++);
        !           173:                        if (testbit(location[position].objects,value)){
        !           174:                                clearbit(location[position].objects,value);
        !           175:                                time++;
        !           176:                                printf("The %s explode%s\n",objsht[value],(objsht[value][n-1]=='s' ? (objsht[value][n-2]=='s' ? "s." : ".") : "s."));
        !           177:                                if (value == BOMB)
        !           178:                                        die();
        !           179:                        }
        !           180:                        else
        !           181:                                printf("I dont see any %s around here.\n", objsht[value]);
        !           182:                        if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
        !           183:                                wordnumber++;
        !           184:                        else
        !           185:                                return(firstnumber);
        !           186:                }
        !           187:                            /* special cases with their own return()'s */
        !           188: 
        !           189:                if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS){
        !           190:                        time++;
        !           191:                        switch(wordvalue[wordnumber]){
        !           192:                        
        !           193:                                case DOOR:
        !           194:                                        switch(position){
        !           195:                                                case 189:
        !           196:                                                case 231:
        !           197:                                                        puts("The door is unhinged.");
        !           198:                                                        location[189].north = 231;
        !           199:                                                        location[231].south = 189;
        !           200:                                                        whichway(location[position]);
        !           201:                                                        break;
        !           202:                                                case 30:
        !           203:                                                        puts("The wooden door splinters.");
        !           204:                                                        location[30].west = 25;
        !           205:                                                        whichway(location[position]);
        !           206:                                                        break;
        !           207:                                                case 31:
        !           208:                                                        puts("The laser blast has no effect on the door.");
        !           209:                                                        break;
        !           210:                                                case 20:
        !           211:                                                        puts("The blast hits the door and it explodes into flame.  The magnesium burns");
        !           212:                                                        puts("so rapidly that we have no chance to escape.");
        !           213:                                                        die();
        !           214:                                                default:
        !           215:                                                        puts("Nothing happens.");
        !           216:                                        }
        !           217:                                        break;
        !           218: 
        !           219:                                case NORMGOD:
        !           220:                                        if (testbit(location[position].objects,BATHGOD)){
        !           221:                                                puts("The goddess is hit in the chest and splashes back against the rocks.");
        !           222:                                                puts("Dark blood oozes from the charred blast hole.  Her naked body floats in the");
        !           223:                                                puts("pools and then off downstream.");
        !           224:                                                clearbit(location[position].objects,BATHGOD);
        !           225:                                                setbit(location[180].objects,DEADGOD);
        !           226:                                                power += 5;
        !           227:                                                ego -= 10;
        !           228:                                                notes[JINXED]++;
        !           229:                                        } else if (testbit(location[position].objects,NORMGOD)){
        !           230:                                                puts("The blast catches the goddess in the stomach, knocking her to the ground.");
        !           231:                                                puts("She writhes in the dirt as the agony of death taunts her.");
        !           232:                                                puts("She has stopped moving.");
        !           233:                                                clearbit(location[position].objects,NORMGOD);
        !           234:                                                setbit(location[position].objects,DEADGOD);
        !           235:                                                power += 5;
        !           236:                                                ego -= 10;
        !           237:                                                notes[JINXED]++;
        !           238:                                                if (wintime)
        !           239:                                                        live();
        !           240:                                                break;
        !           241:                                        } else
        !           242:                                                puts("I don't see any goddess around here.");
        !           243:                                        break;
        !           244: 
        !           245:                                case TIMER:
        !           246:                                        if (testbit(location[position].objects,TIMER)){
        !           247:                                                puts("The old man slumps over the bar.");
        !           248:                                                power++;
        !           249:                                                ego -= 2;
        !           250:                                                notes[JINXED]++;
        !           251:                                                clearbit(location[position].objects,TIMER);
        !           252:                                                setbit(location[position].objects,DEADTIME);
        !           253:                                        }
        !           254:                                        else puts("What old timer?");
        !           255:                                        break;
        !           256:                                case MAN:
        !           257:                                        if (testbit(location[position].objects,MAN)){
        !           258:                                                puts("The man falls to the ground with blood pouring all over his white suit.");
        !           259:                                                puts("Your fantasy is over.");
        !           260:                                                die();
        !           261:                                        }
        !           262:                                        else puts("What man?");
        !           263:                                        break;
        !           264:                                case NATIVE:
        !           265:                                        if (testbit(location[position].objects,NATIVE)){
        !           266:                                                puts("The girl is blown backwards several feet and lies in a pool of blood.");
        !           267:                                                clearbit(location[position].objects,NATIVE);
        !           268:                                                setbit(location[position].objects,DEADNATIVE);
        !           269:                                                power += 5;
        !           270:                                                ego -= 2;
        !           271:                                                notes[JINXED]++;
        !           272:                                        } else puts("There is no girl here.");
        !           273:                                        break;
        !           274:                                case -1:
        !           275:                                        puts("Shoot what?");
        !           276:                                        break;
        !           277: 
        !           278:                                default:
        !           279:                                        printf("You can't shoot the %s.\n",objsht[wordvalue[wordnumber]]);
        !           280:                        }
        !           281:                }
        !           282:                else puts("You must be a looney.");
        !           283:        }
        !           284:        return(firstnumber);
        !           285: }

unix.superglobalmegacorp.com

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