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

unix.superglobalmegacorp.com

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