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