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