home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / games / volume15 / dinkum / part04 / dinkum.c next >
C/C++ Source or Header  |  1993-01-27  |  26KB  |  968 lines

  1. #define DINKUM.C
  2. #include "dink_sym.h"
  3. #include "dink_glb.h"
  4. #include <stdlib.h>
  5. #define Failed        0
  6. #define Request        1
  7.  
  8. /* ---------------- Version Date --------------- */
  9. char *lb_date = "24 August 1992" ;
  10. /* --------------------------------------------- */
  11.  
  12. /*  ---- Version Number  ---- */
  13. char *lb_version = "1.27" ;
  14. /*  ------------------------- */
  15.  
  16. /* ---------------- Version Type --------------- */
  17. char *lb_share = "[Shareware Version]" ;
  18. /* --------------------------------------------- */
  19.  
  20. /*  ---- Serial Number  ---- */
  21. #define S_number     1
  22. int serial = S_number ;
  23. /*  ------------------------ */
  24.  
  25. /* Global variables local to this file only */
  26. int sw_help = FALSE, sw_null = FALSE, sw_number = FALSE, sw_standard = FALSE ;
  27.  
  28. /* MAIN PROGRAM --- MAIN PROGRAM --- MAIN PROGRAM --- MAIN PROGRAM */
  29. void main(argc,argv)
  30. /********************************************************************/
  31. /*                                                                  */
  32. /*                  --- The Dinkum Program ---                      */
  33. /*                                                                  */
  34. /* Software by Gary A. Allen, Jr.  24 August 1992  Version: Mk 1.27 */
  35. /*           (c) Copyright 1990 by Gary A. Allen, Jr.               */
  36. /*                                                                  */
  37. /********************************************************************/
  38.  
  39. int argc ;
  40. char *argv[] ;
  41. {
  42. register int i, j ;
  43.  
  44. int dig_1, dig_2 ;
  45. int pnt, n, i_rand1, i_rand2, i_rand3, old_n = 0, n_back ;
  46. long l_pass, l_time, l_base, start_time, *time_arg = 0 ;
  47. char chr, cmd[8] ;
  48.  
  49. #ifdef __TURBOC__
  50. /* Function prototypes */
  51. void switch_list(void) ; 
  52. void cmd_switch(char[8], int, int, char *[]) ;
  53. void bugs(int), help(void) ;
  54. void kelly(int), long_descp(int), objlooker(int), killer(int) ;
  55. void gleeper(int), actor(int), ender(int), closer(int), opener(int) ;
  56. void dialer(int), taker(int), dropper(int), describe(int), rdtxt(int) ;
  57. void igniter(int), switcher(int), unlocker(int), sounder(int) ;
  58. void loader(void), eater(void), filler(void), looker(int), exit(int) ;
  59. void monster(int*,int*), new_score(void), boom(void), parse(void) ;
  60. void inventer(void), drinker(void), reader(void), pusher(int*);
  61. void pass(void), unloader(int) ;
  62. long time(long*) ;
  63. char getch(void), getche(void) ;
  64. #endif
  65.  
  66. /* Software security */
  67. if (serial != S_number) exit(0) ;  /* abort if serial number changed */
  68.  
  69. /* Scan the after the DOS/Unix command for switches or file name */
  70. if (argc > 1) {
  71. for (i = 1; i <= argc-1; i++) {
  72.     /* Flush command vector */
  73.     for (j = 0; j <= 7; j++) cmd[j] = '\0' ;
  74.     /* Get command vector */
  75.     sscanf(argv[i],"%c%c%c%c%c%c%c%c%c", &chr, &cmd[0], &cmd[1],
  76.         &cmd[2], &cmd[3], &cmd[4], &cmd[5], &cmd[6], &cmd[7]) ;
  77.     sw_null = FALSE ;
  78.     if (chr == '?') help() ;
  79.     if (chr == '-') {
  80.         for (j = 0; j <= 7; j++) {
  81.             cmd_switch(cmd, j, i, argv) ;
  82.             if (sw_number) {
  83.                 i++ ;
  84.                 sw_number = FALSE ;
  85.                 break ;
  86.             }
  87.             if (sw_null) break ;
  88.         } /* end of command "for" loop */
  89.  
  90.         if (j >= 7) {
  91. printf("\n!!!! Too many commands on one \"-\" switch group.\n") ;
  92. printf("!!!! Break up the commands into several \"-\" switch groups.\n") ;
  93.             bugs(Failed) ;
  94.         }
  95.     } /* end of the "-" marker block */
  96.  
  97.     /* Deal with garbage on the command line */
  98.     else {
  99. printf ("\n!!!! The following on the command line was not understood:  %s \n",
  100.     argv[i]);
  101.         bugs(Failed) ;
  102.     } /* Nondefault scratch file opening block */
  103.  
  104. } /* end of argument token "for" loop */
  105.  
  106. if (sw_help) help() ;
  107. } /* end of the command switch block */
  108.  
  109. /* Deal with someone cheating with switch "-s" */
  110. if (sw_standard && (!sw_wizard)) {
  111.     printf("!!!! Command line switch -s is unknown.\n") ;
  112.     bugs(Failed) ;
  113. }
  114.  
  115. /* Software security */
  116. if (serial != S_number) exit(0) ;  /* abort if serial number changed */
  117.  
  118. /* Initialize the program */
  119. sw_warned = FALSE ;
  120. l_time = time(time_arg) ;
  121. l_base = l_time/10 ;
  122. l_base *= 10 ;
  123. l_pass = l_time - l_base ;
  124. dig_1 = (int)l_pass ;
  125.  
  126. printf("                    ") ;
  127. printf("                   --- Dinkum --- \n");
  128. printf("                    ") ;
  129. printf("     (c) Copyright 1990 by Gary A. Allen, Jr.\n") ;
  130. printf("                    ") ;
  131. printf("  All Rights Reserved. Version %s, %s\n\n",
  132.     lb_version, lb_date);
  133.  
  134. printf("Would like some initial help with Dinkum?\n") ;
  135.  
  136. for (;;) {
  137.  
  138. #ifndef __TURBOC__
  139.     do {
  140.         printf("(Answer:  Yes or No) ") ; 
  141.     } while ('\n' == (chr = getchar())) ;
  142.  
  143.     while ('\n' != getchar()) ;
  144. #endif
  145.  
  146. #ifdef __TURBOC__
  147.     printf("\n") ;
  148.     do {
  149.         printf("(Answer:  Yes or No) ") ; 
  150.     } while ('\n' == (chr = getch())) ;
  151.     printf("\n") ;
  152. #endif
  153.  
  154.     if (('n' == chr)||('N' == chr)||('y' == chr)||('Y' == chr)) {
  155.         if (('y' == chr)||('Y' == chr)) {
  156. printf("\nG'day Mate!  Welcome to \"Dinkum\" the Australian adventure");
  157. printf("\ngame.  In Dinkum you'll search for treasure in the\n") ;
  158. printf("Australian Outback.  You give the commands and I'll do the\n");
  159. printf("dangerous work. I understand most plain English sentences.\n");
  160. printf("If you want me to go east then type \"Will you please go\n");
  161. printf("east?\" and press the RETURN or ENTER key.  If you don't\n") ;
  162. printf("enjoy typing then just type \"e\" and press RETURN.  I'll\n");
  163. printf("still go east.  After you have gathered up some things\n") ;
  164. printf("you can see what you have by typing \"inventory\".\n") ;
  165. printf("Sometimes you can learn more about an object by typing\n");
  166. printf("\"examine NAME-OF-OBJECT\".  I understand many other\n") ;
  167. printf("commands and words.  However I'll let you have the fun of\n") ;
  168. printf("finding out what I can and can not understand. Good luck!\n\n");
  169.         }
  170.         break ;
  171.     }
  172. }
  173.  
  174. /* produce two random numbers ranging from 0-9 based on system clock*/
  175. l_time = time(time_arg) ;
  176. start_time = l_time ;
  177. l_base = l_time/10 ;
  178. l_base *= 10 ;
  179. l_pass = l_time - l_base ;
  180. dig_2 = (int)l_pass ;
  181.  
  182. /* generate the actual random array pointers */
  183. if (sw_standard) {
  184.     i_rand1 = 1 ; 
  185.     i_rand2 = 0 ;
  186.     i_rand3 = 7 ;
  187. }
  188. else {
  189.     i_rand3 = (dig_1 + dig_2)/2 ;
  190.     i_rand2 = dig_2/3 ;
  191.     i_rand1 = (dig_1/3) + 1 ;
  192. }
  193.  
  194. printf("\nIt's a hot summer day (in January) in ") ;
  195. printf("Queensland, Australia.\n") ;
  196. n_back = R_meadow ;
  197. n = R_meadow ;
  198.  
  199. /* Software security */
  200. if (serial != S_number) exit(0) ;  /* abort if serial number changed */
  201.  
  202. /* load objects into the rooms */
  203. for (i = 0; i <= obj_init_max; i++) 
  204.     object[obj_init[i][0]][J_loc] = obj_init[i][i_rand1] ;
  205.  
  206. carry_count = 0 ;
  207. carry_weight = 0 ;
  208.  
  209. for (i = 0; i <= objcnt; i++) {
  210.     j = object[i][J_loc] ;
  211.     if ((j >= 0) && (object[i][J_type] != Z_unmovable))
  212.          ++room[j][M_obj_cnt] ;
  213. }
  214.  
  215. /* load monsters into the rooms */
  216. for (i = 0; i <= mon_init_max; i++) 
  217.     enemy[i+1][E_location] = mon_init[i][i_rand2] ;
  218.  
  219. for (i = 0; i <= enemy_max; i++) { 
  220.     j = enemy[i][E_location] ;
  221.     if (j != B_unmade) ++room[j][M_monster] ;
  222. }
  223.  
  224. /* load the gleep reproductive locations and seed gleep */
  225. for (i = 0; i <= 9; i++)  
  226.     gleep_spot[i] = gleep_init[i][i_rand2] ;
  227. room[gleep_spot[0]-1][M_gleep] = 1 ; /* seed a nonreproductive spot */ 
  228.  
  229. /* load safe passage for end-game killing passages  */
  230. room[218 + i_rand3][M_rm_type] = T_short_descp ;
  231.  
  232. /* Beginning of main loop */
  233. loop:
  234. /* special action routine */
  235. new_score() ;  /* update the score */
  236.  
  237. /* See if the game has timed out */
  238. l_time = time(time_arg) ;
  239. if ((!sw_warned) && (l_time > start_time + 3300)) {
  240.     sw_warned = TRUE ;
  241.     start_time = l_time ;
  242. printf("There's suddenly a puff of blue smoke which fills the room\n") ;
  243. printf("with a hazy cloud.  Slowly this cloud coalesces into a\n") ;
  244. printf("ghostly human form.  This ethereal being is wearing a grey\n") ;
  245. printf("flannel suit, a bowler hat, and glancing at a gold pocket\n") ;
  246. printf("watch which is attached to a long golden chain.  You can\n");
  247. printf("hear \"Waltzing Matilda\" being played softly in the\n") ;
  248. printf("background.  You know what?  I think this ethereal being\n") ;
  249. printf("is none other than the ghost of Banjo Patterson!  With\n") ;
  250. printf("this realization Banjo looks up in your direction and\n") ;
  251. printf("begins to speak:\n\n") ;
  252. printf("\"Sorry mate, you've been at this for too long!  You've\n") ;
  253. printf("got five more minutes to go and then you're history!\"\n\n") ;
  254. printf("Then just as suddenly Banjo Patterson dissolves back into\n") ;
  255. printf("smoke and disappears from view.\n\n") ;
  256. }
  257. if (sw_warned && (l_time > start_time + 300)) {
  258. printf("You hear someone clearing his throat behind you.  You turn\n") ;
  259. printf("around and see Banjo Patterson has appeared once again.  An\n");
  260. printf("old brass chain is hanging from mid air next to Banjo.  On\n") ;
  261. printf("the end of the chain is a white porcelain tear drop shaped\n");
  262. printf("nob with the word \"PULL\" written on it in black letters.\n") ;
  263. printf("Banjo reaches for the nob and says the following:\n\n\"Sorry") ;
  264. printf(" mate, your time has come!  Better luck next time!\"\n\n");
  265. printf("He gives the chain a quick jerk and everything around you\n") ;
  266. printf("slowly fades from view.\n\n") ;
  267.     ender(F_quit) ;
  268. }
  269.  
  270. kelly(n) ; /* check if Ned Kelly can do something */
  271.  
  272. /* Check if there is a long description */
  273. if ((room[R_hideout][M_monster] > 0)&&(n == R_hideout)) goto command ;
  274. if ((monster_flag == F_monster_active)&&(old_n == n)) goto command ;
  275.     else old_n = 0 ;
  276. if (room[n][M_rm_type] == T_long_descp) {
  277.     long_descp(n) ; /* do the long description of the room */
  278.     goto objlook ;  
  279. }
  280. else describe(n) ;  /* short description */
  281.  
  282. /* describe unmovable action objects and status */
  283. if (room[n][M_rm_type] == T_action_obj) actor(n) ;
  284.  
  285. objlook:
  286. objlooker(n) ; /* Check if there are objects in the room */
  287. gleeper(n) ;   /* check for gleeps and update the gleep count */
  288.  
  289. /* see if the spaceship's transporter is active */
  290. if (sw_transport) {
  291.     if (n == R_ship_passage) sw_transport = FALSE ;
  292.     else if (n == R_transport) {
  293.         n = R_closet ;
  294.         sw_transport = FALSE ;
  295. printf("\nSuddenly radiant energy seems to surge from the hexagons\n");
  296. printf("around you.  Then there is a bright flash and you find\n");
  297. printf("yourself in.....\n\n") ;
  298. printf("A closet stinking of moth balls full of nondescript junk.\n") ;
  299. printf("The only exit is to the north through a curtain hanging\n");
  300. printf("over the entrance.\n\n") ; 
  301.     }
  302. }
  303.  
  304. /* monster check */
  305. command:
  306. if ((room[n][M_monster] > 0)||(monster_flag != F_no_monster)) {
  307.     if (monster_flag == F_wounded) {
  308.         monster_flag = F_monster_active ;
  309.     }
  310.     else monster(&n,&old_n) ;
  311. }
  312.  
  313. /* parse in the command */
  314. parse();
  315.  
  316. /* poison check */
  317. /* remove atropine drug with each game cycle */
  318. if (i_poison > 0) {
  319.     --i_poison ;
  320. }
  321. else {
  322.     /* accumulate poison if holding the orange clip */
  323.     if (object[O_org_clip][J_loc] == B_have) {
  324.         --i_poison ;
  325.         switch (i_poison) {
  326.         case -20:
  327.     printf("You've developed a nervous tick near your eye.\n") ;
  328.             break ;
  329.         case -30:
  330.     printf("You're hands are starting to shake ") ;
  331.     printf("and you're sweating like a pig.\n") ;    
  332.             break ;
  333.         case -35:
  334.     printf("You're shaking so bad you can barely stand and you ");
  335.     printf("could lose your lunch\nat any moment.\n") ;
  336.             break ;
  337.         case -40:
  338. printf("The toxic fumes coming off of the orange ammo clip you were ") ;
  339. printf("carrying finally\ncaught up with you.  You fall over DEAD!\n") ;
  340.             ender(F_died) ;
  341.         }
  342.     }
  343.     /* remove poison after release of orange clip */
  344.     else if (i_poison < 0) ++i_poison ;
  345. }
  346.  
  347. /* clock check */
  348. if (sw_clock) {
  349.     switch (flag_clock) {
  350.     /* see if the blasting cap is to explode */
  351.     case V_cap:
  352.         if (time(time_arg) > clock_explode) {
  353.             if (object[O_cap][J_loc] == B_have) {
  354. printf("                           POP!!\n") ;
  355. printf("The blasting cap which you were stupidly holding in your\n") ;
  356. printf("hand just blew up and took two of your fingers with it!\n") ;
  357. printf("Good thing you've got another eight fingers to spare!\n\n") ;
  358.                 carry_count-- ;
  359.                 carry_weight -= object[O_cap][J_weight];
  360.             }
  361.             else {
  362. printf("Far down the tunnel you hear a POP!\n") ;
  363. printf("The blasting cap has finally exploded, not that it\n");
  364. printf("achieved much except make a loud noise.\n\n") ;
  365.             }
  366.             object[O_cap][J_loc] = B_destroyed ;
  367.             sw_clock = FALSE ;
  368.         }
  369.         break ;
  370.     
  371.     /* see if the dynamite is to explode */
  372.     case V_dynamite:
  373.         if (time(time_arg) > clock_explode) {
  374.             /* player dies if he is holding the dynamite */
  375.             if (object[O_dynamite][J_loc] == B_have) {
  376.             boom () ;
  377.  
  378. printf("The dynamite which you were holding and had earlier ignited\n");
  379. printf("the fuse has finally exploded.  That was a rather noisy\n");
  380. printf("and messy way to commit suicide!  Needless to say there is\n");
  381. printf("nothing left of you but a greasy spot.\n") ;
  382.             ender(F_died) ;
  383.             }
  384.             /* player dies if too close during explosion */
  385.             else {
  386.     if (((n <= 185)&&(n >= 178))||((n <= 170)&&(n >= 166))) {
  387.             boom () ;
  388.  
  389. printf("You weren't far enough away from the dynamite when it\n");
  390. printf("exploded!  The shock wave was still strong enough to blow\n");
  391. printf("your brains out your ears.  Good try anyway!\n");
  392.             ender(F_died) ;
  393.                 }
  394.             /* dynamite explodes and player survives */
  395.                 else {
  396. printf("Far down the tunnel you hear a low BOOM!\n") ;
  397. printf("That dynamite you set burning has finally exploded.\n\n");
  398.  
  399. /* open up the passage to the UFO */
  400. if (object[O_dynamite][J_loc] == R_blast_point) {
  401.     room[R_blast_point][1] = 186 ;
  402.     room[R_blast_point][M_descp] = 55 ;
  403.                     }
  404.                 }
  405.             }
  406.             object[O_dynamite][J_loc] = B_destroyed ;
  407.             sw_clock = FALSE ;
  408.         }
  409.         break ;
  410.     }
  411. }
  412.  
  413. /* the command is a simple move command */
  414. if (tag[V_MOVE]) {
  415.     pnt = verb ;
  416. move:
  417.     /* see if this movement prohibits blasting caps */
  418.     if (((pnt == V_u)||(pnt == V_up))&&
  419.         ((n == R_manhole_1)||(n == R_manhole_2))) {
  420.         if (object[O_cap][J_loc] == B_have) {
  421. printf("As you were climbing up through the hole in the ceiling,\n");
  422. printf("the blasting cap slipped from your grasp and fell to the\n") ;
  423. printf("floor below where it detonated on impact.  The explosion\n") ;
  424. printf("was deafening, but caused no damage.\n") ;
  425.             carry_count-- ;
  426.             carry_weight -= object[O_cap][J_weight] ;
  427.             object[O_cap][J_loc] = B_destroyed; 
  428.         }
  429.         else if ((object[O_dynamite][J_loc] == B_have)&&
  430.             (object[O_dynamite][J_type] == Z_alias)) {
  431.             boom () ;
  432.  
  433. printf("As you were climbing up through the hole in the ceiling,\n");
  434. printf("the dynamite with the blasting cap inside slipped from\n") ;
  435. printf("your grasp and fell to the floor below where it detonated\n") ;
  436. printf("on impact.  At that point you literally became a human\n");
  437. printf("cannon ball as the shock wave carried you up the vertical\n");
  438. printf("passage and splattered you into protoplasmic jelly on the\n");
  439. printf("ceiling above.\n") ; 
  440.             ender(F_died) ;
  441.         }
  442.     }
  443.  
  444.     pnt-- ;
  445.     if (room[n][pnt] == -1) {
  446.         printf ("You can't go that way. \n");
  447.         goto command ; 
  448.     }
  449.  
  450.     n_back = n ;        /* save previous "n" for "back" */
  451.     n = room[n][pnt] ;
  452.     if (room[n][M_rm_type] != T_lethal) goto loop ;
  453.  
  454. /* player walked into a lethal room */
  455.     long_descp(n) ;
  456.     ender(F_died) ;
  457. }
  458.  
  459. /* complicated command decoder */
  460. switch (verb) {
  461.  
  462. /* "help" command */
  463. case V_help:
  464. case V_info:
  465. printf("There is no help available.  You're on your own!\n") ;
  466.     break ;
  467.  
  468. /* "quit" command */
  469. case V_quit:
  470.     ender(F_quit) ;
  471.  
  472. /* "question" command */
  473. case V_QUESTION:
  474.     if (tag[V_VERB_ONLY]) {
  475.         if (tag[V_how]) {
  476. printf("That's for you to figure out.\n") ;
  477.             break ;
  478.         }
  479. printf("I don't have a clue!\n") ;
  480.         break ;
  481.     }
  482.  
  483.     /* Question "Where am I?" */
  484.     if (tag[V_where] && tag[V_am]) {
  485.         tag[V_VERB_ONLY] = TRUE ; /* This is for "looker" */
  486.         looker(n) ;
  487.         break ;
  488.     }
  489.  
  490.     /* Question "What have I got?" */
  491.     if (tag[V_what] && tag[V_have]) {
  492.         inventer() ;
  493.         break ;
  494.     }
  495.  
  496.     /* Question which can't be processed */
  497. printf("You asked a question.  Unfortunately I have no answers.\n") ;
  498.     break ;
  499.  
  500. /* "inventory" command */
  501. case V_inventory: 
  502. case V_invent:
  503.     inventer() ;
  504.     break;
  505.  
  506. /* "close" command  */
  507. case V_close:
  508. case V_shut:
  509.     closer(n) ;
  510.     break;
  511.  
  512. /* "open" command  */
  513. case V_open:
  514. case V_swing:
  515.     opener(n) ;
  516.     break;
  517.  
  518. /* "dial" command  */
  519. case V_dial:
  520. case V_combination:
  521.     dialer(n) ;
  522.     break ;
  523.  
  524. /* "drink" command */
  525. case V_drink: 
  526.     drinker() ;
  527.     break ;
  528.  
  529. /* "ignite" command */
  530. case V_ignite: 
  531. case V_light: 
  532.     igniter(n) ;
  533.     break ;
  534.  
  535. /* "read" command  */
  536. case V_read:
  537.     reader() ;
  538.     break;
  539.  
  540. /* "push" command  */
  541. case V_push:
  542. case V_press:
  543.     pusher(&n) ;
  544.     break ;
  545.  
  546. /* "turn", "switch" command */
  547. case V_switch:
  548. case V_turn:
  549. case V_select:
  550. case V_set:
  551.     switcher(n) ;
  552.     break ;
  553.  
  554. /* "shoot" command  */
  555. case V_shoot:
  556. case V_fire:
  557. case V_kill:
  558.     killer(n) ;
  559.     break;
  560.  
  561. /* "unlock" command  */
  562. case V_unlock:
  563.     unlocker(n) ;
  564.     break;
  565.  
  566. /* "eat" command  */
  567. case V_eat:
  568. case V_swallow:
  569.     eater() ;
  570.     break;
  571.  
  572. /* "fill" command  */
  573. case V_fill:
  574.     filler() ;
  575.     break;
  576.  
  577. /* "sound" command  */
  578. case V_sound:
  579. case V_bang:
  580. case V_hit:
  581. case V_strike:
  582.     sounder(n) ;
  583.     break;
  584.  
  585. /* "SVC" wizard move command */
  586. case V_svc:
  587.     if (sw_wizard) {
  588.         printf ("Enter room coordinate number:  ");
  589.         scanf ("%d",&n);
  590.         goto loop ;
  591.     }
  592.     else {
  593. cheater:
  594. printf("Rather than cheat at this game by using a disassembler, you\n");
  595. printf("should send the author $150 and he'll gladly send you\n") ;
  596. printf("the source code.  If you just want a clue, then send $20\n") ;
  597. printf("registration fee with your question and he'll provide\n") ;
  598. printf("the answer.  You can find the author's address by\n") ;
  599. printf("typing:  dinkum -h\n") ;
  600.         exit(0) ;
  601.     } 
  602.  
  603. /* "STATS" game statistics */
  604. case V_stats :
  605.         printf("      --- Dinkum --- \n");
  606.         printf("Version: %s, %s\n\n", lb_version, lb_date);
  607.         printf("i_rand1 = %d, i_rand2 = %d, i_rand3 = %d\n",
  608.             i_rand1, i_rand2, i_rand3) ;
  609.         printf("Room Number = %d\n", n) ;
  610.         printf("Room object count = %d \n",
  611.             room[n][M_obj_cnt]) ;
  612.         printf("Room monster count = %d\n",
  613.             room[n][M_monster]) ; 
  614.         printf("Gleeps on room's floor count = %d\n",
  615.             room[n][M_gleep]) ;
  616.         printf("Poison level = %d\n",i_poison) ;
  617.         printf("Gleep count = %d\n", gleep_count) ;
  618.         printf("carry_count = %d, carry_weight = %d\n",
  619.             carry_count, carry_weight) ;
  620.         break ;
  621.  
  622. /* "SU" wizard initiation command */
  623. case V_su:
  624.     pass() ;
  625.     break ;
  626.  
  627. /* "JSYS" wizard command which deactivates a monster */
  628. case V_jsys:
  629.     if (sw_wizard) monster_flag = F_no_monster ;
  630.     else goto cheater ;
  631.     break ;
  632.  
  633. /* "score" command */
  634. case V_score: 
  635.     new_score () ;
  636.     if ((gleep_score == 0)&&(score == 0)) {
  637. printf("You haven't scored anything at all, Bozo! Try putting\n");
  638. printf("a valuable into the safe or find some gleeps.\n") ;
  639.         break ;
  640.     }
  641.     if (score == 0) { 
  642.         if (gleep_score > 1) {
  643. printf("You haven't scored any points but you splashed ") ;
  644. printf ("%d gleeps into the gleep tank.\n",gleep_score) ;
  645.         }
  646.         else {
  647. printf("You haven't scored any points at all but you did put a\n");
  648. printf ("gleep in the gleep tank (big deal!).\n") ;
  649.         }
  650.     }
  651.     else {
  652. printf ("You scored %d points ",score) ;
  653.         if (gleep_score == 0) 
  654. printf ("but have yet to put any gleeps in the gleep tank.\n") ;
  655.         else {
  656.             if (gleep_score > 1) 
  657. printf ("and put %d gleeps into the gleep tank.\n",gleep_score) ;
  658.     
  659.             else 
  660. printf ("and put a gleep in the gleep tank.\n") ;
  661.         }
  662.     }
  663.     break ;
  664.  
  665. /* "enter" command  */
  666. case V_enter:
  667. switch (n) {
  668.  
  669.     /* Lift entrance at the ground level */
  670.     case R_lift_entr:
  671.         if (room[R_lift_entr][2] == -1) goto door_shut ;
  672.         pnt = 3 ;
  673.         break ;
  674.     /* office door */
  675.     case R_office_entr:
  676.         if (room[R_office_entr][2] == -1) goto door_shut ;
  677.         pnt = 3 ;
  678.         break ;
  679.     /* Lift entrance at level #49 */
  680.     case R_L49_entr:
  681.         pnt = 3 ;
  682.         break ;
  683.     /* Entrance to Ned Kelly's hideout */
  684.     case R_hideout_entr:
  685.         pnt = 3 ;
  686.         break ;
  687.     default:
  688.     printf("I don't understand exactly how to enter. \n");
  689.         goto command ;
  690. }
  691. goto move ;
  692. door_shut:
  693. printf("I can't do it!  The door needs to be opened.\n") ;
  694. goto command ;
  695.  
  696. /* "exit" command  */
  697. case V_exit:
  698. case V_leave:
  699. case V_depart:
  700. switch (n) {
  701.  
  702.     /* Lift entrance at the ground level */
  703.     case R_lift_inside:
  704.         pnt = 4 ;
  705.         break ;
  706.     /* office door */
  707.     case R_office_hall:
  708.         pnt = 4 ;
  709.         break ;
  710.     /* Ned Kelly's hideout */
  711.     case R_hideout :
  712.         pnt = 4 ;
  713.         break ;
  714.     default:
  715. printf("I don't understand exactly how you want to exit.\n");
  716.         goto command ;
  717. }
  718. goto move ;
  719.  
  720. /* "dig" command */
  721. case V_dig:
  722. printf("You get on your knees and scrape away at the ground for\n") ;
  723. printf("awhile. Except for getting your hands dirty you didn't\n") ;
  724. printf("achieve much.\n") ;
  725.     break ;
  726.  
  727. /* "stand" command */
  728. case V_stand:
  729. printf("You're standing there very nicely.  However you're not\n");
  730. printf("achieving much by doing so.\n") ;
  731.     break ;
  732.  
  733. /* "load" rifle command */
  734. case V_load:
  735.     loader() ;
  736.     break ;
  737.  
  738. /* "unload" rifle command */
  739. case V_unload:
  740.     unloader(n) ;
  741.     break ;
  742.  
  743. /* "pull" command */
  744. case V_pull:
  745.     if (tag[V_trigger]) {
  746.         /* alias in the "shoot" command */
  747.         verb = V_shoot ;
  748.         tag[V_VERB_ONLY] = TRUE ;
  749.         killer(n) ;   /* "pull trigger" */
  750.     }
  751.     else  printf("I don't see how I could pull that.\n") ;
  752.     break ;
  753.  
  754. /* "climb" command */
  755. case V_climb:
  756. printf("I'm not climbing anything!  (I'm afraid of heights.)\n") ;
  757.     break ;
  758.  
  759. /* "swim" command */
  760. case V_swim:
  761. printf("I'm not going for a swim!  (I'm afraid of the water.)\n") ;
  762.     break ;
  763.  
  764. /* Go backwards to previous location */
  765. case V_back:
  766.     n = n_back ;
  767.     goto loop ;
  768.  
  769. /* "take", "get", "lift" command */
  770. case V_take:
  771. case V_get:
  772. case V_lift:
  773. case V_pick:
  774. case V_grab:
  775. case V_remove:
  776. case V_attach:
  777. case V_hold:
  778.     taker(n) ;
  779.     break ;
  780.  
  781. /* "drop", "throw", "put" command */
  782. case V_drop:
  783. case V_throw:
  784. case V_put:
  785. case V_fling:
  786. case V_insert:
  787. case V_give:
  788. case V_eject:
  789. case V_slow_drop:
  790.     dropper(n) ;
  791.     break ;
  792.  
  793. /* "look" command */
  794. case V_look:
  795. case V_l:
  796. case V_examine:
  797. case V_describe:
  798.     looker(n) ;
  799.     break;
  800.  
  801. /* gibberish command */
  802. default:
  803. printf("Huh?  You will have to make yourself clearer! \n");
  804.  
  805. } /* end of "decoder" switch */
  806. goto command;
  807.  
  808. } /* --- end of Main routine --- */
  809.  
  810. void cmd_switch(cmd, cmd_arg, i_point, argv)
  811. /*****************************************************/
  812. /*                                                   */
  813. /*         --- Command line Switch Parser ---        */
  814. /*                                                   */
  815. /*  (c) Copyright 1992,   University of Queensland   */
  816. /*        Program written by Gary A. Allen, Jr.      */
  817. /*           Version:  Mk 1.1   24 February 1992     */
  818. /*                                                   */
  819. /*****************************************************/
  820.  
  821. char cmd[8], *argv[] ;
  822. int cmd_arg, i_point ;
  823. {
  824. void switch_list(), description() ; 
  825.  
  826. switch (cmd[cmd_arg]) {
  827. case '\0':
  828. case -1:
  829.     sw_null = TRUE ;
  830.     return ;
  831.  
  832. /* Version verification command switch */
  833. case 'v':
  834.     if ((cmd[cmd_arg+1] == 'e')&&(cmd[cmd_arg+2] == 'r')) {
  835.         printf("Version: %s, Serial Number: %06d %s \n", 
  836.             lb_version, serial, lb_share) ;
  837.         bugs(Request) ;
  838.     }
  839.     else {
  840.         printf("!!!! Command line switch -v is unknown.\n") ;
  841.         bugs(Failed) ;
  842.     }
  843.  
  844. /* Wizard mode command switch */
  845. case 'w':
  846. case 'W':
  847.     pass() ;
  848.     break ;
  849.  
  850. /* Standard matrix load command switch */
  851. case 's':
  852. case 'S':
  853.     sw_standard = TRUE ;
  854.     break ;
  855.  
  856.  
  857. /* Rubbish option to supress a warning */
  858. case 'y':
  859. case 'Y':
  860.     sw_number = TRUE ;
  861.     printf("y = %d\n", atoi(argv[i_point+1])) ;
  862.     return ;
  863.  
  864. /* Help option */
  865. case '?':
  866. case 'h':
  867. case 'H':
  868.     sw_help = TRUE ;
  869.     return ;
  870.  
  871. case ' ':
  872. case '-':
  873. case '1':
  874. case '2':
  875. case '3':
  876. case '4':
  877. case '5':
  878. case '6':
  879. case '7':
  880. case '8':
  881. case '9':
  882.     return ;
  883.  
  884. default:
  885. printf("!!!! Command line switch -%c is unknown.\n", cmd[cmd_arg]) ;
  886.     bugs(Failed) ;
  887. }
  888. } /* --- end of the cmd_switch subroutine --- */
  889.  
  890. void bugs(i_type)
  891. /***************************************************************/
  892. /*                                                             */
  893. /*       (c) Copyright 1992,   University of Queensland        */
  894. /*            Program written by Gary A. Allen, Jr.            */
  895. /*             Version:  Mk 1.0        24 April 1992           */
  896. /*                                                             */
  897. /***************************************************************/
  898. int i_type ;
  899. {
  900. switch(i_type) {
  901. case Failed:
  902.     printf("!!!! If confused, type:  dinkum -h \n");
  903.     printf("!!!! --- Program ABORTED --- \n");
  904.     break ;
  905.  
  906. case Request:
  907.     printf("Program terminated by user request.\n") ;
  908.     break ;
  909. }
  910. exit (0) ; 
  911. } /* --- end of the "bugs" subroutine --- */
  912.  
  913. void help() 
  914. /*****************************************************/
  915. /*                                                   */
  916. /*                    Help Routine                   */
  917. /*                                                   */
  918. /*  (c) Copyright 1992,   University of Queensland   */
  919. /*        Program written by Gary A. Allen, Jr.      */
  920. /*           Version:  Mk 1.0    24 April 1992       */
  921. /*                                                   */
  922. /*****************************************************/
  923. {
  924. char chr ;
  925.  
  926. printf("                    --- Dinkum --- \n");
  927. printf("       (c) Copyright 1990 by Gary A. Allen, Jr.\n") ;
  928. printf("   All Rights Reserved. Version: %s, %s\n\n", 
  929.         lb_version, lb_date);
  930.  
  931. printf("      Dinkum is a text style \"adventure\" game.\n\n") ;
  932.  
  933. printf("You are free to use, copy and distribute Dinkum provided:\n") ;
  934. printf("       NO FEE IS CHARGED FOR USE, COPYING OR DISTRIBUTION.\n") ;
  935. printf("       THIS PROGRAM IS FOR PRIVATE, NONCOMMERICAL USE ONLY.\n");
  936. printf("       THE PROGRAM MAY NOT BE MODIFIED IN ANY WAY.\n\n") ;
  937.  
  938. printf("This program is provided AS IS without any warranty,\n") ;
  939. printf("expressed or implied, including but not limited to fitness\n") ;
  940. printf("for any particular purpose.\n\n") ;
  941.  
  942. /* keep the screen from scrolling */
  943. #ifndef __TURBOC__
  944. printf("         [Press RETURN or ENTER to continue]") ;
  945. chr = getchar() ;
  946. #endif
  947.  
  948. #ifdef __TURBOC__
  949. printf("  [Press \"q\" to quit or any other key to continue]") ;
  950. chr = getche() ;
  951. printf("\r                                                        \r") ;
  952. #endif
  953.  
  954. if ((chr == 'q')||(chr == 'Q')) exit (0) ;
  955.  
  956. printf("When corresponding please state the current version of\n") ;
  957. printf("Dinkum which you are using.  Contributions and questions\n") ;
  958. printf("about this program should be sent to the following address:\n\n") ;
  959. printf("          E-mail address:     gary@sun.mech.uq.oz.au\n\n") ;
  960. printf("          Postal address:     Gary A. Allen, Jr. \n");
  961. printf("                              P.O. Box 13\n") ;       
  962. printf("                              St. Lucia, Queensland  4067\n");
  963. printf("                              Australia\n") ;
  964.  
  965. exit(0);
  966. } /* ---- end of the "help" subroutine ---- */
  967.  
  968.