]> git.cameronkatri.com Git - bsdgames-darwin.git/blob - battlestar/com5.c
time_t != long; fix minor type problem.
[bsdgames-darwin.git] / battlestar / com5.c
1 /* $NetBSD: com5.c,v 1.6 1997/10/11 02:07:06 lukem Exp $ */
2
3 /*
4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36 #include <sys/cdefs.h>
37 #ifndef lint
38 #if 0
39 static char sccsid[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95";
40 #else
41 __RCSID("$NetBSD: com5.c,v 1.6 1997/10/11 02:07:06 lukem Exp $");
42 #endif
43 #endif /* not lint */
44
45 #include "extern.h"
46
47 void
48 kiss()
49 {
50 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
51 if (wordtype[wordnumber] == NOUNS &&
52 testbit(location[position].objects, wordvalue[wordnumber])) {
53 pleasure++;
54 printf("Kissed.\n");
55 switch (wordvalue[wordnumber]) {
56 case NORMGOD:
57 switch (godready++) {
58 case 0:
59 puts("She squirms and avoids your advances.");
60 break;
61 case 1:
62 puts("She is coming around; she didn't fight it as much.");
63 break;
64 case 2:
65 puts("She's begining to like it.");
66 break;
67 default:
68 puts("She's gone limp.");
69
70 }
71 break;
72 case NATIVE:
73 puts("The lips are warm and her body robust. She pulls you down to the ground.");
74 break;
75 case TIMER:
76 puts("The old man blushes.");
77 break;
78 case MAN:
79 puts("The dwarf punches you in the kneecap.");
80 break;
81 default:
82 pleasure--;
83 }
84 } else
85 puts("I'd prefer not to.");
86 }
87
88 void
89 love()
90 {
91 int n;
92
93 while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount);
94 if (wordtype[wordnumber] == NOUNS && testbit(location[position].objects, wordvalue[wordnumber])) {
95 if (wordvalue[wordnumber] == NORMGOD && !loved)
96 if (godready >= 2) {
97 puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet.");
98 puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed.");
99 power++;
100 pleasure += 15;
101 ego++;
102 if (card(injuries, NUMOFINJURIES)) {
103 puts("Her kisses revive you; your wounds are healed.\n");
104 for (n = 0; n < NUMOFINJURIES; n++)
105 injuries[n] = 0;
106 WEIGHT = MAXWEIGHT;
107 CUMBER = MAXCUMBER;
108 }
109 printf("Goddess:\n");
110 if (!loved)
111 setbit(location[position].objects, MEDALION);
112 loved = 1;
113 ourtime += 10;
114 zzz();
115 } else {
116 puts("You wish!");
117 return;
118 }
119 if (wordvalue[wordnumber] == NATIVE) {
120 puts("The girl is easy prey. She peals off her sarong and indulges you.");
121 power++;
122 pleasure += 5;
123 printf("Girl:\n");
124 ourtime += 10;
125 zzz();
126 }
127 printf("Loved.\n");
128 } else
129 puts("It doesn't seem to work.");
130 }
131
132 int
133 zzz()
134 {
135 int oldtime;
136 int n;
137
138 oldtime = ourtime;
139 if ((snooze - ourtime) < (0.75 * CYCLE)) {
140 ourtime += 0.75 * CYCLE - (snooze - ourtime);
141 printf("<zzz>");
142 for (n = 0; n < ourtime - oldtime; n++)
143 printf(".");
144 printf("\n");
145 snooze += 3 * (ourtime - oldtime);
146 if (notes[LAUNCHED]) {
147 fuel -= (ourtime - oldtime);
148 if (location[position].down) {
149 position = location[position].down;
150 crash();
151 } else
152 notes[LAUNCHED] = 0;
153 }
154 if (OUTSIDE && rnd(100) < 50) {
155 puts("You are awakened abruptly by the sound of someone nearby.");
156 switch (rnd(4)) {
157 case 0:
158 if (ucard(inven)) {
159 n = rnd(NUMOFOBJECTS);
160 while (!testbit(inven, n))
161 n = rnd(NUMOFOBJECTS);
162 clearbit(inven, n);
163 if (n != AMULET && n != MEDALION && n != TALISMAN)
164 setbit(location[position].objects, n);
165 carrying -= objwt[n];
166 encumber -= objcumber[n];
167 }
168 puts("A fiendish little Elf is stealing your treasures!");
169 fight(ELF, 10);
170 break;
171 case 1:
172 setbit(location[position].objects, DEADWOOD);
173 break;
174 case 2:
175 setbit(location[position].objects, HALBERD);
176 break;
177 default:
178 break;
179 }
180 }
181 } else
182 return (0);
183 return (1);
184 }
185
186 void
187 chime()
188 {
189 if ((ourtime / CYCLE + 1) % 2 && OUTSIDE)
190 switch ((ourtime % CYCLE) / (CYCLE / 7)) {
191 case 0:
192 puts("It is just after sunrise.");
193 break;
194 case 1:
195 puts("It is early morning.");
196 break;
197 case 2:
198 puts("It is late morning.");
199 break;
200 case 3:
201 puts("It is near noon.");
202 break;
203 case 4:
204 puts("It is early afternoon.");
205 break;
206 case 5:
207 puts("It is late afternoon.");
208 break;
209 case 6:
210 puts("It is near sunset.");
211 break;
212 }
213 else
214 if (OUTSIDE)
215 switch ((ourtime % CYCLE) / (CYCLE / 7)) {
216 case 0:
217 puts("It is just after sunset.");
218 break;
219 case 1:
220 puts("It is early evening.");
221 break;
222 case 2:
223 puts("The evening is getting old.");
224 break;
225 case 3:
226 puts("It is near midnight.");
227 break;
228 case 4:
229 puts("These are the wee hours of the morning.");
230 break;
231 case 5:
232 puts("The night is waning.");
233 break;
234 case 6:
235 puts("It is almost morning.");
236 break;
237 }
238 else
239 puts("I can't tell the time in here.");
240 }
241
242 int
243 give()
244 {
245 int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
246
247 last1 = last2 = 0;
248 firstnumber = wordnumber;
249 while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount);
250 if (wordnumber <= wordcount) {
251 obj = wordvalue[wordnumber];
252 if (obj == EVERYTHING)
253 wordtype[wordnumber] = -1;
254 last1 = wordnumber;
255 }
256 wordnumber = firstnumber;
257 while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount);
258 if (wordtype[wordnumber] == NOUNS) {
259 person = wordvalue[wordnumber];
260 last2 = wordnumber;
261 }
262 wordnumber = last1 - 1;
263 if (person && testbit(location[position].objects, person))
264 if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET))
265 puts("The goddess won't look at you.");
266 else
267 result = drop("Given");
268 else {
269 puts("I don't think that is possible.");
270 return (0);
271 }
272 if (result != -1 && (testbit(location[position].objects, obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)) {
273 clearbit(location[position].objects, obj);
274 ourtime++;
275 ego++;
276 switch (person) {
277 case NATIVE:
278 puts("She accepts it shyly.");
279 ego += 2;
280 break;
281 case NORMGOD:
282 if (obj == RING || obj == BRACELET) {
283 puts("She takes the charm and puts it on. A little kiss on the cheek is");
284 puts("your reward.");
285 ego += 5;
286 godready += 3;
287 }
288 if (obj == AMULET || obj == MEDALION || obj == TALISMAN) {
289 win++;
290 ego += 5;
291 power -= 5;
292 if (win >= 3) {
293 puts("The powers of the earth are now legitimate. You have destroyed the Darkness");
294 puts("and restored the goddess to her thrown. The entire island celebrates with");
295 puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you");
296 puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus.");
297 puts("\nBut, as the year wears on and autumn comes along, you become restless and");
298 puts("yearn for adventure. The goddess, too, realizes that the marriage can't last.");
299 puts("She becomes bored and takes several more natives as husbands. One evening,");
300 puts("after having been out drinking with the girls, she kicks the throne particulary");
301 puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
302 clearbit(location[position].objects, MEDALION);
303 wintime = ourtime;
304 }
305 }
306 break;
307 case TIMER:
308 if (obj == COINS) {
309 puts("He fingers the coins for a moment and then looks up agape. `Kind you are and");
310 puts("I mean to repay you as best I can.' Grabbing a pencil and cocktail napkin...\n");
311 printf("+-----------------------------------------------------------------------------+\n");
312 printf("| xxxxxxxx\\ |\n");
313 printf("| xxxxx\\ CLIFFS |\n");
314 printf("| FOREST xxx\\ |\n");
315 printf("| \\\\ x\\ OCEAN |\n");
316 printf("| || x\\ |\n");
317 printf("| || ROAD x\\ |\n");
318 printf("| || x\\ |\n");
319 printf("| SECRET || ......... |\n");
320 printf("| - + - || ........ |\n");
321 printf("| ENTRANCE || ... BEACH |\n");
322 printf("| || ... E |\n");
323 printf("| || ... | |\n");
324 printf("| // ... N <-- + --- S |\n");
325 printf("| PALM GROVE // ... | |\n");
326 printf("| // ... W |\n");
327 printf("+-----------------------------------------------------------------------------+\n");
328 puts("\n`This map shows a secret entrance to the catacombs.");
329 puts("You will know when you arrive because I left an old pair of shoes there.'");
330 }
331 break;
332 }
333 }
334 wordnumber = max(last1, last2);
335 return (firstnumber);
336 }