1
2
3
4
5
6
7 #include <stdio.h>
8 #include <string.h>
9
10 #include <time.h>
11
12
13
14 int level[512], c[3][4], o[3], p[16], r[3], t[8], w[15][3];
15 int x_axis, y_axis, z_axis, temp, master_game, dd, ee, ff, fl, gg, hh, wc, new_game;
16 int ah, bf, ot, tt, vf, lf, tc, rf, of, bl, ss, pf, uu, vv, ww;
17 int attack, isfrog, gotfrog, startnewgame, alive, done, quit, escape;
18 extern long clock_ ();
19
20 struct room
21 {
22 char *contents;
23 char *id;
24 };
25
26 struct room dungeon[34];
27 char *cause[8], *effect[8], *species[4], *bad_response, *gold[14], *treasure[16];
28 char *frog[42], *hint[16], *royal[6], *curse[6], *sss[10], *monster[7], *noise[7];
29 char *command[52], *pad, *qpad, *dots;
30 char *strength, *intelligence, *dexterity;
31 char *dim, *bright, *bell, *clrs;
32 FILE *infile, *outfile;
33
34 main()
35 {
36 int index, index2, i, j, n, m, justfound = 0;
37 long tod;
38
39 system("if [wdc video_invoked] -then \"ioa_ NOTICE:^xCannot^xrun^xwith^xvideo^xinvoked.^xRevoking.;pause 1;wdc revoke\"");
40 fflush(stdout);
41
42 tod = clock_ ();
43 srand((unsigned) &tod);
44
45 dim = "";
46 bright = "";
47 bell = "";
48 clrs = "";
49
50
51 defines();
52 new_game = 0;
53
54 initialize();
55
56
57 while (quit == 0)
58 {
59
60 ++new_game;
61 if (master_game >= 2)
62 {
63 printf ("\n You are now entering the %sMASTER CLASS%s game!\n",bright,dim);
64
65
66
67
68
69
70
71 }
72
73 else
74 {
75 if (new_game <= 1)
76 {
77 splash();
78 intro();
79 }
80 }
81 for (index = 1; index <= 512; ++index)
82 {
83 level[index - 1] = 101;
84 }
85 level[3] = 2;
86 for (z_axis = 1; z_axis <= 7; ++z_axis)
87 {
88 for (n = 1; n <= 2; ++n)
89 {
90 index = 104;
91 setup_xy(index);
92 level[func_d() + 63] = 103;
93 }
94 }
95 for (z_axis = 1; z_axis <= 8; ++z_axis)
96 {
97 for (index = 113; index <= 124; ++index)
98 {
99 setup_xy(index);
100 }
101 for (n = 1; n <= 3; ++n)
102 {
103 for (index = 105; index <= 112; ++index)
104 {
105 if ((index != 108)|| (master_game != 2))
106 setup_xy(index);
107 }
108 index = 125;
109 setup_xy(index);
110 }
111 }
112 if (master_game != 0)
113
114 {
115 master_class();
116 }
117 else
118
119 {
120 beginner_class();
121 }
122
123 while (startnewgame == 0){
124 if (bl == 0) ident();
125
126 if ((master_game >= 2)&& (vv + ww <= 35))
127 {
128 for (n = 8; n <= 15; ++n)
129 {
130 if ((w[n - 1][0] == x_axis)&& (w[n - 1][1] == y_axis)&& (w[n - 1][2] == z_axis))
131 {
132 if (t[n - 8])
133 {
134 printf ("\n");
135 border ("-",52);
136 printf ("%s%s%s",pad,dungeon[roll_12()- 1].contents,bright);
137 printf (" just ripped off%s ",dim);
138 printf ("%s%s!%s\n",dungeon[17 + n].contents,bright,dim);
139 border ("-",52);
140 tc = tc - 1;
141 t[n - 8] = 0;
142 n = 16;
143 }
144 }
145 }
146 }
147
148 if ((gg >= 1)&& ((gg >= 20000 - master_game * 5000)|| (roll(80)== 1)))
149 {
150 n = roll(gg / 3);
151 gg = gg - n;
152 printf ("\n");
153 border ("-",52);
154 printf (" A THIEF just stole %s%d%s",bright,n,dim);
155 printf (" of your %sGOLD PIECES%s!!\n",bright,dim);
156 border ("-",52);
157 }
158
159 printf ("\n %s = %s%d%s",strength,bright,uu,dim);
160 printf (" %s = %s%d%s",intelligence,bright,vv,dim);
161 printf (" %s = %s%d%s\n",dexterity,bright,ww,dim);
162 printf (" Treasures = %s%d%s",bright,tc,dim);
163 printf (" Flares = %s%d%s",bright,fl,dim);
164 printf (" Gold pieces = %s%d%s\n",bright,gg,dim);
165 printf (" Weapon = %s%s%s",bright,cause[ff],dim);
166 printf (" Armor = %s%s%s",bright,cause[ee + 4],dim);
167 if (lf)
168 printf (" and a %sLAMP%s.\n",bright,dim);
169 else
170 printf ("\n");
171 n = c[0][3] + c[1][3] + c[2][3];
172 if (n)
173 {
174 printf (" Curses = %s.",bright);
175 for (m = 1; m <= 3; ++m)
176 {
177 index2 = 0;
178 if (t[m * 2 - 2])
179 index2 = 3;
180 if (c[m - 1][3])
181 printf (".%s",curse[m + index2 - 1]);
182 }
183 if (n)
184 printf (".%s\n",dim);
185 }
186 if (rf + of != 0)
187 {
188 printf (" Magic implements = %s",bright);
189 if (rf)
190 printf ("RUNESTAFF! ");
191 if (of)
192 printf ("***ORB OF ZOT***!");
193 printf ("\n%s",dim);
194 if (pf)
195 {
196 printf (" The %s%s PRINCE",bright,royal[3 * (ss - 1)- 1]);
197 printf ("%s%s is at your side!\n",sss[ss - 2],dim);
198 }
199 }
200 if (bl == 0)
201 {
202 i = y_axis;
203 j = x_axis;
204 printf ("\n");
205
206 for (n = i - 1; n <= i + 1; ++n)
207 {
208 y_axis = below_nine(n);
209 if (n == i)
210 printf ("%sHere you find: ",pad);
211 else
212 printf ("%s%s ",qpad,qpad);
213 for (m = j - 1; m <= j + 1; ++m)
214 {
215 x_axis = below_nine(m);
216 index = level[func_d() - 1];
217 if ((n == i)&& (m == j))
218 {
219 index = func_e();
220 index2 = index;
221 }
222 if (index >= 34)
223 {
224 index = 34;
225 printf ("%s",dim);
226 }
227 else printf ("%s",bright);
228 printf ("%s%s",dungeon[index - 1].id,dim);
229 printf (" ");
230 }
231 if (n == i)
232 printf (" %s.\n",dungeon[index2 - 1].contents);
233 else
234 printf ("\n");
235 }
236 y_axis = i;
237 x_axis = j;
238 }
239
240 if (tt - (tt/500)* 500 == 0)
241 {
242 printf ("\n");
243 border ("-",52);
244 printf ("%sYou hear a voice whisper%sZOT!%s\n",qpad,dots,bell);
245 border ("-",52);
246 }
247 wc = 0;
248 index = func_e();
249 level[func_d() - 1] = index;
250 isfrog = 0;
251 escape = 0;
252
253
254
255 if ((index == 1)&& (roll(9)== 1))
256 printf ("\n%sThere are some %s eggs here.\n",pad,monster[roll(7)- 1]);
257
258 if (((index <= 6)|| (index >= 11))&& (index <= 12))
259 {
260
261 if (roll(6)== 1)
262 {
263 n = roll(35);
264 isfrog = (n + 4) / 5;
265 printf ("\n%s%s%sOn the floor is a%s %s!%s\n",bell,pad,bright,frog[n - 1],frog[34 + isfrog],dim);
266 printf (" ");
267 border ("-",52);
268 }
269 }
270 if (index == 7)
271 {
272 printf ("\n%s They are %s.\n",qpad,gold[roll(14)- 1]);
273 index2 = index;
274 index = roll(z_axis * 50);
275 find_money(index);
276 gg = gg + index;
277 printf ("%sYou found %d gold pieces, you now have %d.\n",pad,index,gg);
278 index = index2;
279 level[func_d() - 1] = 1;
280 }
281 if (index == 8)
282 {
283 index2 = roll(5);
284 fl = fl + index2;
285 printf ("\n%sYou found %d flares, you now have %d.\n",pad,index2,fl);
286 level[func_d() - 1] = 1;
287 }
288 if (index == 9)
289 {
290 if ((o[0] == x_axis)&& (o[1] == y_axis)&& (o[2] == z_axis)&& (temp == 33)&& (of == 0))
291 {
292 printf ("\n");
293 border ("*",52);
294 printf ("%s GREAT UNMITIGATED ZOT!\n",qpad);
295 printf ("%s YOU JUST FOUND ***THE ORB OF ZOT***!\n",pad);
296 printf ("%sThe RUNESTAFF has disappeared!%s\n",qpad,bell);
297 justfound = 1;
298 rf = 0;
299 of = 1;
300 o[0] = 0;
301 border ("*",52);
302 level[func_d() - 1] = 1;
303 check_events();
304 }
305 else
306 {
307 if (rf)
308 {
309 printf ("\n%s You are protected by the RUNESTAFF!\n",pad);
310 }
311 else
312 {
313 x_axis = roll(8);
314 y_axis = roll(8);
315 z_axis = roll(8);
316 }
317 }
318 }
319 if (index == 10)
320 {
321 z_axis = below_nine(z_axis + 1);
322 }
323 if ((index > 25)&& (index < 34))
324 {
325 printf ("\n %s is now yours!\n",dungeon[index - 1].contents);
326 t[index - 26] = 1;
327 tc = tc + 1;
328 level[func_d() - 1] = 1;
329 }
330 if ((index > 12)&& (index < 26))
331 {
332 wc = 0;
333 attack = level[func_d() - 1] - 12;
334 if ((attack < 13)|| (vf == 1)) go_fight();
335 }
336 if ((index == 25)&& (vf == 0))
337 {
338 printf ("\nYou may (I)gnore, (A)ttack or (T)rade with VENDOR.\n");
339 printf ("\nCommand #%d? ",tt);
340 ++tt;
341 temp = fancy_input(3739);
342 if (temp == 39)
343 {
344 printf ("\n%sYOU'LL BE SORRY THAT YOU DID THAT!\n",pad);
345 vf = 1;
346 go_fight();
347 }
348 else
349 {
350 if (temp == 38) go_buy();
351 }
352 }
353 if ((escape == 0)&& (alive == 1))
354 {
355 if ((index != 10)&& (index != 9)) check_events();
356 if (justfound)
357 {
358 justfound = 0;
359 process_command();
360 }
361 if ((index != 10)&& ((index != 9)|| ((index == 9)&& (rf)))) process_command();
362 }
363 if (alive == 0) go_die();
364 }
365
366 }
367 return 0;
368 }
369
370 check_events()
371 {
372 int m, n, xtemp, ytemp, ztemp;
373
374 if (c[1][3] > t[2])
375 {
376 gg = gg - roll(5);
377 if (gg < 0) gg = 0;
378 }
379 if (c[2][3] > t[4])
380 {
381 xtemp = x_axis;
382 ytemp = y_axis;
383 ztemp = z_axis;
384 x_axis = roll(8);
385 y_axis = roll(8);
386 z_axis = roll(8);
387 level[func_d() - 1] = func_e() + 100;
388 x_axis = xtemp;
389 y_axis = ytemp;
390 z_axis = ztemp;
391 }
392 for (n = 1; n<= 3; ++n)
393 {
394 m = 0;
395 if ((x_axis == c[n - 1][0])&& (y_axis == c[n - 1][1])&& (z_axis == c[n - 1][2])&& (c[n - 1][3] == 0))
396 {
397 c[n - 1][3] = 1;
398 m = 1;
399 }
400 if (m)
401 {
402 printf("\n");
403 border ("-",52);
404 printf ("%sYou just received the curse of %s%s\n",pad,curse[n - 1],bell);
405 border ("-",52);
406 }
407 }
408 if ((master_game == 1)&& (tc == 8))
409 {
410 master_game = 2;
411 startnewgame = 1;
412 }
413 else
414 {
415 if (roll(5)== 1)
416 {
417 printf ("\n%sYou ",pad);
418 if (bl)
419 {
420 printf ("stepped on ");
421 if (roll(6)== 1) printf ("some %s eggs",monster[roll(7)- 1]);
422 else
423 {
424 n = roll(35);
425 printf ("a%s %s",frog[n - 1],frog[34 + (n + 4)/ 5]);
426 }
427 }
428 else
429 {
430 n = roll(10);
431 if (n < 6) printf ("hear ");
432 if (n < 8) printf ("%s",noise[n - 1]);
433 else
434 {
435 if (n == 8) printf ("find some crushed %s eggs",monster[roll(7)- 1]);
436 }
437 if (n > 8)
438 {
439 printf ("smell ");
440 if (n == 9) printf ("%s",dungeon[roll_12()- 1].contents);
441 else
442 {
443 printf ("something dead...%s",dungeon[roll_12()- 1].contents);
444 }
445 }
446 }
447 printf ("!\n");
448 }
449 if (bl + t[3] == 2)
450 {
451 printf ("\n%s%s%s CURES YOUR BLINDNESS!%s\n",pad,bright,dungeon[28].contents,dim);
452 bl = 0;
453 }
454 if (bf + t[5] == 2)
455 {
456 printf ("\n%s%s%s DISSOLVES THE BOOK!%s\n",pad,bright,dungeon[30].contents,dim);
457 bf = 0;
458 }
459 }
460
461 return 0;
462 }
463
464 process_command()
465 {
466 int n;
467 char buf[10];
468 done = 0;
469
470 while (done == 0)
471 {
472 printf ("\nCommand #%d? ",tt);
473 ++tt;
474 temp = fancy_input(1636);
475 if (temp == 29) take_a_drink();
476 if (temp == 28) kiss_frog();
477 if (temp == 30) release_frog();
478 if (temp == 27) catch_frog();
479
480 if (temp == 20)
481 {
482 if (level[func_d()- 1] == 2) are_you_leaving();
483 else go_move();
484 }
485
486 if ((temp == 17)|| (temp == 18)|| (temp == 19)) go_move();
487 if (temp == 22)
488 {
489 if (level[func_d()- 1] == 3)
490 {
491 z_axis = z_axis - 1;
492 done = 1;
493 }
494 else
495 {
496 printf ("\n%s** THERE ARE NO STAIRS GOING UP FROM HERE!\n",pad);
497 check_events();
498 }
499 }
500
501 if (temp == 23)
502 {
503 if (level[func_d()- 1] == 4)
504 {
505 z_axis = z_axis + 1;
506 done = 1;
507 }
508 else
509 {
510 printf ("\n%s** THERE ARE NO STAIRS GOING DOWN FROM HERE!\n",pad);
511 check_events();
512 }
513 }
514
515 if (temp == 24) show_map();
516 if (temp == 26) flares();
517 if (temp == 21) lamp();
518 if (temp == 31) open_thing();
519 if (temp == 32) gaze_orb();
520 if (temp == 35) save_game();
521 if (temp == 33)
522 {
523 if (rf == 0)
524 {
525 printf ("\n%s** YOU CAN'T TELEPORT WITHOUT THE RUNESTAFF!\n",pad);
526 check_events();
527 }
528 else
529 {
530 do
531 {
532 printf ("%sGive the room number [ W}E N}S U}D ] as XYZ: ",bright);
533 scanf ("%s",XXXbuf);
534 printf ("%s",dim);
535 n = atoi(buf);
536 x_axis = n / 100;
537 y_axis = n / 10 - 10 * x_axis;
538 z_axis = n - 10 * y_axis - 100 * x_axis;
539 if ((n < 111)|| (n > 888)) printf ("\n%s** TRY NUMBERS FROM 111 TO 888.\n\n",pad);
540 }
541 while ((n < 111)|| (n > 888));
542 getch();
543 done = 1;
544 }
545 }
546
547 if (temp == 36)
548 {
549 of = 1;
550 tc = 8;
551 for (n = 1; n <= 8; ++n)
552 {
553 t[n - 1] = 1;
554 }
555 done = 1;
556 }
557
558 if ((temp == 34)&& (of == 1)&& (level[func_d()- 1] == 2))
559 {
560 printf ("\n");
561 border ("*",52);
562 printf ("%s CONGRATULATIONS!\n",bright);
563 printf ("I thought you'd never find the blasted light switch!\n");
564 printf ("%sALL CASTLE ROOMS ARE NOW NICE AND BRIGHT.\n",pad);
565 border ("*",52);
566 if (master_game == 0) master_game = 1;
567 printf (" The RUNESTAFF just reappeared. Lucky %s!\n",species[dd - 1]);
568 rf = 1;
569 for (n = 1; n <= 512; ++n)
570 {
571 if (level[n - 1] > 100) level[n - 1] = level[n - 1] - 100;
572 }
573 if (master_game != 2)
574 {
575 if ((master_game == 1)&& (tc == 8))
576 {
577 master_game = 2;
578 done = 1;
579 startnewgame = 1;
580 }
581 else
582 {
583 printf ("\n");
584 border ("-",52);
585 printf (" You must have ALL treasures to rescue PRINCE%s.\n",sss[ss - 2]);
586 border ("-",52);
587
588
589 done = 1;
590 }
591 }
592 else
593 {
594 done = 1;
595 }
596 }
597 if (temp == 25)
598 {
599 printf ("%s THE %s***ORB OF POWER***%s CAN REVEAL MANY THINGS!\n",clrs,bright,dim);
600 printf ("\n%sThe following commands are available:%s\n",bright,dim);
601 printf (" (C)atch (G)aze (L)ook (Q)uit (U)p\n");
602 printf (" (D)own (H)elp (M)ap (R)elease (W)est\n");
603 printf (" (E)ast Dr(I)nk (N)orth (S)outh\n");
604 printf (" (F)lare (K)iss (O)pen (T)eleport\n");
605 printf ("\n%sThe contents of rooms are as follows:%s\n",bright,dim);
606 printf (" Empty Room(.) (F)lares (S)inkhole\n");
607 printf (" (B)ook (G)old Pieces (T)reasures\n");
608 printf (" (C)hest (M)onster/STAFF Stairs (U)p\n");
609 printf (" Stairs (D)own Crystal (O)rb (V)endor\n");
610 printf (" (E)ntrance/Exit Magic (P)ool (W)arp/ORB\n");
611 printf ("\n%sThe magical properties of treasures are:%s\n",bright,dim);
612 printf (" %s%sNo lethargy %s%s%s.None\n",treasure[8 * t[0]],dots,treasure[8 * t[1] + 1],dots,dots);
613 printf (" %s%s.No leech %s...Blindness cure\n",treasure[8 * t[2] + 2],dots,treasure[8 * t[3] + 3]);
614 printf (" %s..No forgetting %s.Dissolve books\n",treasure[8 * t[4] + 4],treasure[8 * t[5] + 5]);
615 printf (" %s%s%s..None %s%s%s...None\n",treasure[8 * t[6] + 6],dots,dots,treasure[8 * t[7] + 7],dots,dots);
616 printf ("\n You've got the treasures shown in %sCAPITAL%s letters!\n",bright,dim);
617
618
619 done = 1;
620 }
621
622 if ((temp < 17)|| (temp > 36)|| (temp == 34)) done = 1;
623 if (alive == 0) done = 1;
624 }
625 return 0;
626 }
627
628 take_a_drink()
629 {
630 int q;
631 isfrog = 0;
632 gotfrog = 0;
633 if (level[func_d()- 1] != 5)
634 {
635 printf ("\n%s** IF YOU WANT A DRINK, FIND A POOL!\n",pad);
636 check_events();
637 }
638 else
639 {
640 q = roll(8);
641 printf ("\n%sYou take a drink and ",pad);
642 if (q > 6)
643 {
644 ss = ss + 1;
645 if (ss == 4) ss = 2;
646 dd = roll(4);
647 printf ("turn into a %s%s!\n",sss[ss],species[dd - 1]);
648 }
649 if (q <= 6) printf ("feel ");
650 if (q == 1)
651 {
652 printf ("STRONGER.\n");
653 uu = below_nineteen(uu + roll(3));
654 }
655 if (q == 2)
656 {
657 printf ("WEAKER.\n");
658 uu = uu - roll(3);
659 if (uu < 1) alive = 0;
660 }
661 if (q == 3)
662 {
663 printf ("DUMBER.\n");
664 vv = vv - roll(3);
665 if (vv < 1) alive = 0;
666 }
667 if (q == 4)
668 {
669 printf ("SMARTER.\n");
670 vv = below_nineteen(vv + roll(3));
671 }
672 if (q == 5)
673 {
674 printf ("NIMBLER.\n");
675 ww = below_nineteen(ww + roll(3));
676 }
677 if (q == 6)
678 {
679 printf ("CLUMSIER.\n");
680 ww = ww - roll(3);
681 if (ww < 1) alive = 0;
682 }
683 if (alive == 1) check_events();
684 }
685 return 0;
686 }
687
688 kiss_frog()
689 {
690 int n, k;
691 if ((gotfrog == 0)|| (isfrog == 0))
692 {
693 printf ("\n%sYou hold nothing kissable!\n",pad);
694 isfrog = 0;
695 gotfrog = 0;
696 return 0;
697 }
698
699 if ((isfrog == 3)&& (roll(3)> 1))
700 {
701 printf ("\n%sYou're weird! You want a bad case of warts?\n",pad);
702 return 0;
703 }
704
705 if (isfrog <= 2)
706 {
707 for (n = 1; n <= 7; ++n)
708 {
709 if ((w[n - 1][0] == x_axis)&& (w[n - 1][1] == y_axis)&& (w[n - 1][2] == z_axis))
710 {
711 border ("-",52);
712 if (n >= 4)
713 {
714 printf ("%sYOU FOUND THE %s WITCH OF THE %s!\n",pad,sss[n / 2 + 6],sss[n]);
715 if (n < 6)
716 {
717 printf ("\nYou get maximum %s, %s, %s...\n",strength,intelligence,dexterity);
718 uu = 18;
719 vv = 18;
720 ww = 18;
721 ee = 3;
722 ff = 3;
723 gg = gg + 5000;
724 printf ("also SWORD, PLATE ARMOR, and 5,000 %s!\n",gold[roll(14)- 1]);
725 border ("-",52);
726 }
727 else
728 {
729 printf ("\nYou lose the RUNESTAFF and all lights just went out!\n");
730 border ("-",52);
731 rf = 0;
732 for (k = 1; k <= 512; ++k)
733 {
734 if (level[k - 1] < 99) level[k - 1] = level[k - 1] + 100;
735 }
736 }
737 }
738 else
739 {
740 printf ("%sYOU FOUND THE %s PRINCE%s.\n",pad,royal[3 * (ss - 2)+ n - 1],sss[ss - 2]);
741 border ("-",52);
742 if (n == 3) pf = 1;
743 }
744 level[3] = 2;
745 w[n - 1][0] = 0;
746
747
748 done = 1;
749 gotfrog = 0;
750 isfrog = 0;
751 return 0;
752 }
753 }
754 if (done == 0)
755 {
756 gotfrog = 0;
757 k = roll(5);
758 if (k > 1)
759 {
760 printf ("\n%sNothing happens!\n",pad);
761 isfrog = 0;
762 }
763 }
764 }
765
766 if ((isfrog > 2)|| (k == 1))
767 {
768 n = roll_12();
769 printf ("\n%s The %s just turned into %s!\n",pad,frog[34 + isfrog],dungeon[n - 1].contents);
770 level[func_d() - 1] = n;
771 attack = n - 12;
772 isfrog = 0;
773 go_fight();
774 }
775 return 0;
776 }
777
778 release_frog()
779 {
780 int n;
781 if ((gotfrog != 1)|| (isfrog < 6)|| (roll(2)> 1))
782 {
783 printf ("\n%sNothing happens!\n",pad);
784 }
785 else
786 {
787 n = roll(1000);
788 find_money(n);
789 printf ("For releasing me I give you %d %s!\n",n,gold[roll(14)- 1]);
790 gg = gg + n;
791 isfrog = 0;
792 gotfrog = 0;
793 }
794 return 0;
795 }
796
797 catch_frog()
798 {
799 int n;
800 gotfrog = 0;
801 if (bl)
802 {
803 printf ("\n%s** YOU CAN'T SEE ANYTHING, YOU DUMB %s!\n",pad,species[dd - 1]);
804 check_events();
805 }
806 else
807 {
808 if (isfrog == 0)
809 {
810 printf ("\n%sThere is nothing here to catch!\n",pad);
811 }
812 else
813 {
814 if ((isfrog > 3)&& (isfrog < 6))
815 {
816 n = 11;
817 if (master_game == 2) n = 16;
818 printf ("\n%sNot much challenge. Written on the shell is...\n",pad);
819 printf ("\n%s%s%s!%s\n",bright,pad,hint[roll(n)- 1],dim);
820 gotfrog = 1;
821 }
822
823 if ((ww > 15)&& (isfrog > 5)&& (roll(3)== 1))
824 {
825 printf ("\n%sYou are left holding a tail in your hand!\n",pad);
826 isfrog = 0;
827 }
828
829 else
830 {
831 if ((ww > 17)&& (isfrog > 5)&& (roll(2)== 1))
832 {
833 printf ("\n%sWell, you caught me%sNOW WHAT?\n",pad,dots);
834 gotfrog = 1;
835 }
836
837 if ((gotfrog == 0)&& ((master_game < 2)|| (isfrog > 5)))
838 {
839 printf ("\n%sThe critter simply eludes your grasp!\n",pad);
840 isfrog = 0;
841 }
842 else
843 {
844 if ((isfrog > 0)&& (gotfrog == 0))
845 {
846 printf ("\n%sWell, you caught me%sNOW WHAT?\n",pad,dots);
847 gotfrog = 1;
848 }
849 }
850 }
851 }
852 }
853 return 0;
854 }
855
856 show_map()
857 {
858 int q, x, y;
859 gotfrog = 0;
860 isfrog = 0;
861 x = x_axis;
862 y = y_axis;
863
864 if (bl)
865 {
866 printf ("\n%s** YOU CAN'T SEE ANYTHING, YOU DUMB %s!\n",pad,species[dd - 1]);
867 check_events();
868 return 0;
869 }
870 ident();
871 printf ("\n%s%s",pad,bright);
872 for (x_axis = 1; x_axis <= 8; ++x_axis)
873 {
874 printf (" %d ",x_axis);
875 }
876 printf ("\n\n");
877 for (y_axis = 1; y_axis <= 8; ++y_axis)
878 {
879 printf (" %s%d ",bright,y_axis);
880 for (x_axis = 1; x_axis <= 8; ++x_axis)
881 {
882 q = level[func_d() - 1];
883 if (q > 99) q = 34;
884 if ((x == x_axis)&& (y == y_axis))
885 {
886 printf ("%s<%s%s%s>%s ",dim,bright,dungeon[q - 1].id,dim,bright);
887 }
888 else
889 {
890 printf (" ");
891 if (q == 34) printf ("%s",dim);
892 printf ("%s%s",dungeon[q - 1].id,bright);
893 printf (" ");
894 }
895 }
896 printf ("\n\n");
897 }
898 x_axis = x;
899 y_axis = y;
900 printf ("%s",dim);
901 return 0;
902 }
903
904 go_move()
905 {
906 gotfrog = 0;
907 isfrog = 0;
908 if (temp == 17) y_axis = y_axis - 1;
909 if (temp == 19) y_axis = y_axis + 1;
910 y_axis = below_nine(y_axis);
911 if (temp == 18) x_axis = x_axis + 1;
912 if (temp == 20) x_axis = x_axis - 1;
913 x_axis = below_nine(x_axis);
914 done = 1;
915 return 0;
916 }
917
918 flares()
919 {
920 int i, j, q, x, y;
921 gotfrog = 0;
922 isfrog = 0;
923 if (bl)
924 {
925 printf ("\n%s** YOU CAN'T SEE ANYTHING, YOU DUMB %s!\n",pad,species[dd - 1]);
926 check_events();
927 return 0;
928 }
929 if (fl == 0)
930 {
931 printf ("\n%s** HEY, BRIGHT ONE, YOU'RE OUT OF FLARES!\n",pad);
932 check_events();
933 return 0;
934 }
935 fl = fl - 1;
936 y = y_axis;
937 x = x_axis;
938 for (i = y - 1; i <= y + 1; ++i)
939 {
940 printf ("%s%s%s ",qpad,qpad,bright);
941 y_axis = below_nine(i);
942 for (j = x - 1; j <= x + 1; ++j)
943 {
944 x_axis = below_nine(j);
945 q = func_e();
946 level[func_d() - 1] = q;
947 if (q == 34) printf ("%s",dim);
948 printf ("%s%s",dungeon[q - 1].id,bright);
949 printf (" ");
950 }
951 printf ("\n");
952 }
953 printf ("%s",dim);
954 y_axis = y;
955 x_axis = x;
956 check_events();
957 return 0;
958 }
959
960 lamp()
961 {
962 int i, x, y;
963 gotfrog = 0;
964 isfrog = 0;
965 if (bl)
966 {
967 printf ("\n%s** YOU CAN'T SEE ANYTHING, YOU DUMB %s!\n",pad,species[dd - 1]);
968 check_events();
969 return 0;
970 }
971 if (lf == 0)
972 {
973 printf ("\n%s** YOU DON'T HAVE A LAMP, %s!\n",pad,species[dd - 1]);
974 check_events();
975 return 0;
976 }
977 printf ("\nWhere do you want to shine the lamp (N,E,S,W)? ");
978 i = fancy_input(1620);
979 x = x_axis;
980 y = y_axis;
981 y_axis = below_nine(y_axis - (i == 17)+ (i == 19));
982 x_axis = below_nine(x_axis - (i == 20)+ (i == 18));
983 if (x - x_axis + y - y_axis == 0)
984 {
985 printf ("\n** THAT'S NOT A DIRECTION, %s!\n",species[dd - 1]);
986 check_events();
987 return 0;
988 }
989 printf ("\n%sThe lamp shines into (%d,%d) LEVEL %d.\n",pad,x_axis,y_axis,z_axis);
990 level[func_d() - 1] = func_e();
991 printf ("\nThere you will find %s.\n",dungeon[level[func_d()- 1] - 1].contents);
992 x_axis = x;
993 y_axis = y;
994 check_events();
995 return 0;
996 }
997
998 open_thing()
999 {
1000 int i, q;
1001 gotfrog = 0;
1002 isfrog = 0;
1003 if ((level[func_d()- 1] != 6)&& (level[func_d()- 1] != 12))
1004 {
1005 printf ("\n%s** THE ONLY THING OPENED WAS YOUR BIG MOUTH!\n",pad);
1006 check_events();
1007 return 0;
1008 }
1009 if (level[func_d()- 1] == 12)
1010 {
1011 printf ("\n%sYou open the book and\n",pad);
1012 q = roll(6);
1013 switch (q)
1014 {
1015 case 2:
1016 printf ("%sIt's another volume of Zot's poetry! - YECH!!\n",pad);
1017 break;
1018
1019 case 3:
1020 printf ("%sIt's an old copy of PLAY%s!\n",pad,species[roll(4)- 1]);
1021 break;
1022
1023 case 4:
1024 printf ("%sIt's a MANUAL of %s%s%s!\n",pad,bright,dexterity,dim);
1025 ww = 18;
1026 break;
1027
1028 case 5:
1029 printf ("%sIt's a MANUAL of %s%s%s!\n",pad,bright,strength,dim);
1030 uu = 18;
1031 break;
1032
1033 case 6:
1034 printf ("%sthe book sticks to your hands -\n",qpad);
1035 printf ("%s%sNOW YOU ARE UNABLE TO DRAW YOUR WEAPON!%s\n",qpad,bright,dim);
1036 bf = 1;
1037 break;
1038
1039 default:
1040 printf ("%s%sFLASH!%s OH NO! You are now a BLIND %s!\n",bright,pad,dim,species[dd - 1]);
1041 bl = 1;
1042 break;
1043 }
1044 level[func_d() - 1] = 1;
1045 check_events();
1046 return 0;
1047 }
1048 printf ("\n%sYou open the chest and find\n",pad);
1049 q = roll(4);
1050 switch (q)
1051 {
1052 case 2:
1053 printf ("%sKABOOM! IT EXPLODES!!\n",pad);
1054 i = roll(z_axis);
1055 check_damage(i);
1056 level[func_d() - 1] = 1;
1057 if ((uu < 1)|| (ww < 1)) alive = 0;
1058 if (alive) check_events();
1059 break;
1060
1061 case 3:
1062 printf ("%sGAS! You stagger from the room!\n",pad);
1063 i = roll(4) + 16;
1064 level[func_d() - 1] = 1;
1065 y_axis = below_nine(y_axis - (i == 17)+ (i == 19));
1066 x_axis = below_nine(x_axis - (i == 20)+ (i == 18));
1067 done = 1;
1068 break;
1069
1070 default:
1071 q = roll(z_axis * 250);
1072 find_money(q);
1073 gg = gg + q;
1074 printf (" %d %s! You now have %d.\n",q,gold[roll(14)- 1],gg);
1075 level[func_d() - 1] = 1;
1076 check_events();
1077 break;
1078 }
1079 return 0;
1080 }
1081
1082 gaze_orb()
1083 {
1084 int a, b, c, i, q;
1085 gotfrog = 0;
1086 isfrog = 0;
1087 if (bl)
1088 {
1089 printf ("\n%s** YOU CAN'T SEE ANYTHING, YOU DUMB %s!\n",pad,species[dd - 1]);
1090 check_events();
1091 return 0;
1092 }
1093 if (level[func_d()- 1] != 11)
1094 {
1095 printf ("\n%s** IT'S HARD TO GAZE WITHOUT AN ORB!\n",pad);
1096 check_events();
1097 return 0;
1098 }
1099 printf ("\n%sYou see ",pad);
1100 if (master_game + of == 1)
1101 {
1102 printf ("a Vendor with a message!\n");
1103 check_events();
1104 return 0;
1105 }
1106 q = roll(6);
1107 switch (q)
1108 {
1109 case 2:
1110 a = roll(8);
1111 b = roll(8);
1112 c = roll(8);
1113 if (roll(3)== 1)
1114 {
1115 a = o[0];
1116 b = o[1];
1117 c = o[2];
1118 }
1119 if (master_game == 0)
1120 {
1121 printf ("%s***THE ORB OF ZOT***%s\n",bright,dim);
1122 printf ("%sAT (%d,%d) LEVEL %d!\n",qpad,a,b,c);
1123 }
1124 else
1125 {
1126 printf ("yourself drinking from a pool -\n");
1127 printf ("%sand becoming %s!\n",qpad,dungeon[roll_12()- 1].contents);
1128 }
1129 break;
1130
1131 case 3:
1132 printf ("yourself drinking from a pool -\n");
1133 printf ("%sand becoming %s!\n",qpad,dungeon[roll_12()- 1].contents);
1134 break;
1135
1136 case 4:
1137 printf ("%s gazing back at you!\n",dungeon[roll_12()- 1].contents);
1138 break;
1139
1140 case 5:
1141 a = x_axis;
1142 b = y_axis;
1143 c = z_axis;
1144 x_axis = roll(8);
1145 y_axis = roll(8);
1146 z_axis = roll(8);
1147 i = func_e();
1148 level[func_d() - 1] = i;
1149 printf ("%s at (%d,%d) LEVEL %d!\n",dungeon[i - 1].contents,x_axis,y_axis,z_axis);
1150 x_axis = a;
1151 y_axis = b;
1152 z_axis = c;
1153 break;
1154
1155 case 6:
1156 printf ("a soap opera rerun!\n");
1157 break;
1158
1159 default:
1160 printf ("yourself in a BLOODY HEAP!\n");
1161 uu = uu - roll(2);
1162 if (uu < 1) alive = 0;
1163 break;
1164 }
1165 if (alive == 1) check_events();
1166 return 0;
1167 }
1168
1169 save_game()
1170 {
1171 int a, i;
1172 char zotsav[40];
1173
1174 gotfrog = 0;
1175 isfrog = 0;
1176 printf ("\nDo you really want to quit now? ");
1177 i = fancy_input(102);
1178 if (i != 2)
1179 {
1180 printf ("\n%s** THEN DON'T SAY THAT YOU DO!\n",pad);
1181 check_events();
1182 return 0;
1183 }
1184 splash();
1185 saveagain:;
1186 printf ("\nDo you want to save this game? ");
1187 i = fancy_input(102);
1188 if (i == 2)
1189 {
1190 printf ("%sEnter a new segment name for saved game:%s ",bright,dim);
1191 scanf ("%s",XXXzotsav);
1192 getch();
1193 printf ("\n");
1194 infile = fopen (zotsav,"r");
1195 if (infile != NULL)
1196 {
1197 printf ("%sYOU DUMMY! FAILURE! SEGMENT EXISTS ALREADY.%s\n",bright,dim);
1198 fclose (infile);
1199 goto saveagain;
1200 }
1201 else
1202 {
1203 outfile = fopen (zotsav,"w");
1204 for (i = 1; i <= 512; ++i)
1205 {
1206 fprintf (outfile,"%d\n",level[i - 1]);
1207 }
1208 for (i = 1; i <= 8; ++i)
1209 {
1210 fprintf (outfile,"%d\n",t[i - 1]);
1211 }
1212 for (i = 1; i <= 16; ++i)
1213 {
1214 fprintf (outfile,"%d\n",p[i - 1]);
1215 }
1216 for (i = 1; i <= 3; ++i)
1217 {
1218 fprintf (outfile,"%d\n",r[i - 1]);
1219 fprintf (outfile,"%d\n",o[i - 1]);
1220 for (a = 1; a <= 4; ++a)
1221 {
1222 fprintf (outfile,"%d\n",c[i - 1][a - 1]);
1223 }
1224 for (a = 1; a <= 15; ++a)
1225 {
1226 fprintf (outfile,"%d\n",w[a - 1][i - 1]);
1227 }
1228 }
1229 fprintf (outfile,"%d\n",ah);
1230 fprintf (outfile,"%d\n",bf);
1231 fprintf (outfile,"%d\n",bl);
1232 fprintf (outfile,"%d\n",dd);
1233 fprintf (outfile,"%d\n",ee);
1234 fprintf (outfile,"%d\n",ff);
1235 fprintf (outfile,"%d\n",fl);
1236 fprintf (outfile,"%d\n",gg);
1237 fprintf (outfile,"%d\n",hh);
1238 fprintf (outfile,"%d\n",lf);
1239 fprintf (outfile,"%d\n",master_game);
1240 fprintf (outfile,"%d\n",new_game);
1241 fprintf (outfile,"%d\n",of);
1242 fprintf (outfile,"%d\n",pf);
1243 fprintf (outfile,"%d\n",rf);
1244 fprintf (outfile,"%d\n",ss);
1245 fprintf (outfile,"%d\n",tt);
1246 fprintf (outfile,"%d\n",tc);
1247 fprintf (outfile,"%d\n",uu);
1248 fprintf (outfile,"%d\n",vv);
1249 fprintf (outfile,"%d\n",vf);
1250 fprintf (outfile,"%d\n",ww);
1251 fprintf (outfile,"%d\n",wc);
1252 fprintf (outfile,"%d\n",x_axis);
1253 fprintf (outfile,"%d\n",y_axis);
1254 fprintf (outfile,"%d\n",z_axis);
1255
1256 fclose (outfile);
1257 }
1258 }
1259 end_game();
1260 return 0;
1261 }
1262
1263 are_you_leaving()
1264 {
1265 int i;
1266 char *leaving = " Leaving without ";
1267 gotfrog = 0;
1268 isfrog = 0;
1269
1270 printf ("%s",clrs);
1271 if (master_game == 0) printf ("\n%sturning on the lights?\n",leaving);
1272 if ((master_game < 2)&& (tc < 8)) printf ("\n%sall the treasures?\n",leaving);
1273 if (pf == 0) printf ("\n%sthe %s PRINCE%s? ",leaving,royal[(3 * (ss - 1))- 1],sss[ss - 2]);
1274 if (pf == 0) i = fancy_input(102);
1275 if (i == 1)
1276 {
1277 check_events();
1278 return 0;
1279 }
1280 if (pf == 0)
1281 {
1282 end_game();
1283 }
1284 else
1285 {
1286 printf ("\n");
1287 border ("*",52);
1288 printf ("%sSO THAT ALL MAY KNOW OF YOUR SUCCESS%s\n",pad,dots);
1289 printf ("%sHere is a small wedding gift.\n");
1290 printf ("%s%s%s%s...the CULLINAN diamond!%s\n",bright,qpad,qpad,pad,dim);
1291 border ("*",52);
1292 printf ("%s Have a great life you two!\n",qpad);
1293 printf ("\nAre you and the %s%s PRINCE%s%s ready to leave? ",bright,royal[(3 * (ss - 1))- 1],sss[ss - 2],dim);
1294 i = fancy_input(102);
1295 if (i == 2)
1296 {
1297 end_game();
1298 }
1299 else
1300 {
1301 check_events();
1302 }
1303 }
1304 return 0;
1305 }
1306
1307 end_game()
1308 {
1309 int i;
1310 if (alive == 0)
1311 {
1312 printf ("\n%sAt the time you died you had:\n",pad);
1313 }
1314 else
1315 {
1316 printf ("\n You left the castle with");
1317 if (of == 0) printf ("out");
1318 printf (" the %s***ORB OF ZOT***%s.\n",bright,dim);
1319 if (of == 0)
1320 {
1321 printf ("\n%sA LESS THAN AWE-INSPIRING DEFEAT.\n",pad);
1322 printf ("\n%sWhen you left the castle, you had:\n",pad);
1323 }
1324 else
1325 {
1326 printf ("\n%sAN INCREDIBLY GLORIOUS VICTORY!!\n",pad);
1327 printf ("\n%sIn addition, you got out with the following:\n",pad);
1328 }
1329 }
1330 if (alive == 1) printf ("%syour miserable life!\n",qpad);
1331 for (i = 1; i <= 8; ++i)
1332 {
1333 if (t[i - 1]) printf ("%s%s%s\n",bright,qpad,dungeon[i + 24].contents);
1334 }
1335 printf ("%s%s%s and %s",dim,qpad,cause[ff],cause[ee + 4]);
1336 if (lf) printf (" and a lamp.");
1337 printf ("\n");
1338 printf ("\n%sYou also had %d FLARES and %d GOLD PIECES\n",pad,fl,gg);
1339 if (rf) printf ("%sand the RUNESTAFF\n",qpad);
1340 printf ("%sand it took you %d turns!\n",qpad,tt);
1341 printf ("\n Are you foolish enough to re-enter the castle? ");
1342 i = fancy_input(304);
1343 if (i == 4)
1344 {
1345 printf ("\n%s%sMAYBE DUMB %s IS NOT SO DUMB AFTER ALL!%s\n",bright,pad,species[dd - 1],dim);
1346 done = 1;
1347 startnewgame = 1;
1348 quit = 1;
1349 }
1350 else
1351 {
1352 printf ("\n%s%s%sSOME %sS NEVER LEARN!%s\n",bright,pad,qpad,species[dd - 1],dim);
1353 printf ("\n Please be patient while the castle is restocked.\n");
1354 initialize();
1355 done = 1;
1356 startnewgame = 1;
1357 }
1358 return 0;
1359 }
1360
1361 check_damage(q)
1362 # 1356
1363 int q;
1364 {
1365 if (ee > 0)
1366 {
1367 q = q - ee;
1368 ah = ah - ee;
1369 if (q < 0)
1370 {
1371 ah = ah - q;
1372 q = 0;
1373 }
1374 if (ah < 0)
1375 {
1376 ah = 0;
1377 ee = 0;
1378 printf ("%s%s********** YOUR ARMOR HAS BEEN DESTROYED!%s\n",pad,bright,dim);
1379 printf ("\n%sGOOD LUCK!\n",pad);
1380 }
1381 }
1382 if (ww > 0) ww = ww - q / 2;
1383 uu = uu - q;
1384 return 0;
1385 }
1386