home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / games / volume15 / dinkum / part01 / gleeper.c < prev    next >
C/C++ Source or Header  |  1993-01-27  |  13KB  |  447 lines

  1. #define GLPR
  2. #include "dink_sym.h"
  3. #include "dink_glb.h"
  4.  
  5. void gleeper(n) 
  6. /********************************************/
  7. /*                                          */
  8. /*           Gleeper Subroutine             */
  9. /*                                          */
  10. /*     Software by Gary A. Allen, Jr.       */
  11. /*           Version: Mk 1.00               */
  12. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  13. /*                                          */
  14. /********************************************/
  15. int n ;
  16. {
  17. register int i ;
  18. int count ;
  19. static int sw_glp_st = FALSE, cnt_down = 0 ;
  20.  
  21. /* Gleep display routine */
  22. count = room[n][M_gleep] ;
  23.  
  24. if (((object[O_torch][J_loc] == B_have)&&object[O_torch][J_property])|| 
  25.     (n < 186)||(n > 202)) { 
  26.     if (count != 0) {
  27.         sw_glp_st = TRUE ; /*  gleeps can now multiply */
  28.         if (count != 1) 
  29.                printf("There are %d gleeps here. \n",count) ;
  30.         else printf("There is a gleep here. \n") ;
  31.         return ;
  32.     }
  33. }
  34.  
  35. /* Gleep reproduction routine */
  36. if (sw_glp_st == TRUE) {
  37.     if (++cnt_down > 5) {
  38.         cnt_down = 0 ;
  39.         for (i = 0; i <= 9; i++) {
  40.             if (room[gleep_spot[i]][M_gleep] == 0) continue;
  41.             if (room[gleep_spot[i]][M_gleep] > 10000) 
  42.                 ++room[gleep_spot[i]][M_gleep] ;
  43.             else room[gleep_spot[i]][M_gleep] <<= 1 ;
  44.         }
  45.     }
  46. }
  47. } /* --- end of "gleeper" subroutine --- */
  48.  
  49. void ender(i_quit)
  50. /********************************************/
  51. /*                                          */
  52. /*            Ender Subroutine              */
  53. /*                                          */
  54. /*     Software by Gary A. Allen, Jr.       */
  55. /*           Version: Mk 1.00               */
  56. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  57. /*                                          */
  58. /********************************************/
  59.  
  60. int i_quit ;
  61. {
  62. #ifdef __TURBOC__
  63. void hold_it(void), new_score(void), exit(int) ;
  64. #endif
  65.  
  66. /* get last score */
  67. new_score() ;
  68.  
  69. if (gleep_score != 0) sw_active = TRUE ; 
  70.  
  71. if (i_quit == F_died) { 
  72.     hold_it() ;
  73.     score -= 100 ;
  74. printf ("\nOh Dear!  You've just turned yourself into a corpse! \n\n");
  75. printf ("For getting killed you lose 100 points. \n\n") ;
  76. }
  77.  
  78. if (!sw_active) {
  79.     if (score == 0) { 
  80.         printf("You concluded the game with no points.  ") ; 
  81.         printf("What a pitiful performance!!\n") ;
  82.     }
  83.     else {
  84. printf("You concluded the game with a miserable negative score\n") ;
  85. printf("of %d points.  Your score was better BEFORE you \n",score);
  86. printf("started playing (need I say more on how this reflects\n");
  87. printf("upon your limited aptitude at Dinkum).\n") ;
  88.     }
  89.     goto all_done ;
  90. }
  91.  
  92. if (score == 0)  {
  93. printf("You concluded the game with no points ") ;
  94.     if (gleep_score == 0) { 
  95. printf("and didn't drop a single gleep\n") ;
  96. printf("into the gleep tank. What a pitiful performance!!\n") ;
  97.     }
  98.     else {
  99.         if (gleep_score > 1) {
  100. printf("but you did put %d gleeps\n",gleep_score) ;
  101. printf("into the gleep tank.\n") ;
  102.         }
  103.         else {
  104. printf("but you did manage to find a gleep\n") ;
  105. printf("and put it in the gleep tank, (Hah!! What an achievement!).\n");
  106.         }
  107.     }
  108. }
  109.  
  110. else {
  111. if (score > 0)
  112. printf ("You concluded the game with %d points",score);
  113. else {
  114. printf("You concluded the game with a miserable negative score\n") ;
  115. printf("of %d points.  Your score was better BEFORE you \n",score);
  116. printf("started playing (need I say more on how this reflects\n");
  117. printf("upon your limited aptitude at Dinkum).  You ") ;
  118.     if (gleep_score == 0) { 
  119. printf("also failed to\nget any gleeps into the tank.  At least ");
  120. printf("you're consistent.\n\n") ;
  121.     }
  122.     else {
  123. printf("managed\nto get something into the gleep tank.  However ");
  124. printf("it hardly\nmatters, considering your poor score.\n\n") ;
  125.     }
  126.     goto all_done ;
  127. }
  128.     if (gleep_score == 0) 
  129. printf(".\nHowever you placed no gleeps in the gleep tank.\n") ;
  130.     else {
  131.         if (gleep_score > 1) {
  132. printf (" and placed %d gleeps\n",gleep_score) ;
  133. printf ("in the gleep tank.  Good on you, Mate!\n") ;
  134.         }
  135.         else {
  136. printf(" but you did manage to find a gleep\n") ;
  137. printf("and put it in the gleep tank.  ") ;
  138. printf("However any idiot could do that!\n") ;
  139.         }
  140.     }
  141. }
  142. all_done:
  143. printf("\nDinkum has ended.  If you are interested in more ") ;
  144. printf("information\nabout this program type:    dinkum -h\n") ;
  145. exit(0);
  146. } /* --- end of "ender" routine --- */
  147.  
  148. void clip_in(ammo_flag)
  149. /********************************************/
  150. /*                                          */
  151. /*            Clip_In Subroutine            */
  152. /*                                          */
  153. /*     Software by Gary A. Allen, Jr.       */
  154. /*           Version: Mk 2.00               */
  155. /* (c) Copyright 1990 by Gary A. Allen, Jr. */
  156. /*                                          */
  157. /********************************************/
  158.  
  159. int ammo_flag ;
  160. {
  161. /* ammo clip insertion routine */
  162. if (object[O_rifle][J_loc] != B_have) {
  163. printf("Galah!!  You don't have a rifle to put an ammo clip into.\n");
  164.     return ;
  165. }
  166. if (clip_flag != F_no_clip) {
  167. printf("There is already an ammo clip in the rifle. \n") ;
  168.     return ;
  169. }
  170. if (((object[O_clip][J_loc] != B_have)&&(ammo_flag == F_normal_clip))||
  171. ((object[O_org_clip][J_loc] != B_have)&&(ammo_flag == F_org_clip))) {
  172. printf("You don't possess an ammo clip to put into the rifle.\n");
  173.     return ;
  174. }
  175. /* actually load the clip into the rifle */
  176. object[O_rifle][J_type] = Z_alias ;
  177. carry_count-- ;
  178. carry_weight -= object[O_clip][J_weight]  ;
  179. if (ammo_flag == F_normal_clip) {
  180.     object[O_clip][J_loc] = B_unmade ;
  181.     clip_flag = F_normal_clip ;
  182.     object[O_rifle][J_property]  = object[O_clip][J_property] ;
  183. }
  184. else {
  185.     object[O_org_clip][J_loc] = B_unmade ;
  186.     clip_flag = F_org_clip ;
  187.     object[O_rifle][J_property] = object[O_org_clip][J_property] ;
  188. }
  189. printf("The ammunition clip slides into the rifle with a \"click\".\n");
  190. printf("You have %d bullets in the clip \n",
  191.             object[O_rifle][J_property]) ;
  192. if (object[O_rifle][J_property] > 0) 
  193.     printf("You cycle the M16's bolt once to chamber a round.\n");
  194. return ;
  195. }
  196.  
  197. void clip_out(n)
  198. /********************************************/
  199. /*                                          */
  200. /*           Clip_Out Subroutine            */
  201. /*                                          */
  202. /*     Software by Gary A. Allen, Jr.       */
  203. /*           Version: Mk 1.00               */
  204. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  205. /*                                          */
  206. /********************************************/
  207. int n ;
  208. {
  209. int ammo_flag ; 
  210.  
  211. /* remove clip from rifle */
  212. if (object[O_rifle][J_loc] != B_have) {
  213.     printf("You Bloody Galah!  ") ;
  214.     printf("You don't have a rifle in your possession!\n");
  215. return ;
  216. }
  217. if (clip_flag == F_no_clip) {
  218.     printf("There is no clip in the rifle. \n") ;
  219. return ;
  220. }
  221. /* eject the clip from the rifle */
  222. object[O_rifle][J_type] = Z_normal ;
  223. if (clip_flag == F_normal_clip) {
  224.     object[O_clip][J_loc] = n ;
  225.     ammo_flag = F_normal_clip ;
  226. }
  227. else {
  228.     object[O_org_clip][J_loc] = n ;
  229.     ammo_flag = F_org_clip ;
  230. }
  231. ++room[n][M_obj_cnt] ;
  232. clip_flag = F_no_clip ;
  233. printf("You press the \"eject\" button on the rifle and the ") ;
  234. printf("magazine falls to the ground.\n") ;
  235. if (object[O_rifle][J_property] > 0) {
  236. printf("You then cycle the M16's bolt once to clear the chamber. ");
  237. printf("The unfired round\n") ;
  238. printf("is ejected from the breech and rolls out of sight. \n") ;
  239.     if (ammo_flag == F_normal_clip) 
  240.         object[O_clip][J_property] = 
  241.             --object[O_rifle][J_property] ;
  242.         else object[O_org_clip][J_property] = 
  243.                 --object[O_rifle][J_property] ;
  244.     object[O_rifle][J_property] = 0 ;
  245. }
  246. return ;
  247. }
  248.  
  249. void igniter(n)
  250. /********************************************/
  251. /*                                          */
  252. /*           Igniter Subroutine             */
  253. /*                                          */
  254. /*     Software by Gary A. Allen, Jr.       */
  255. /*           Version: Mk 1.00               */
  256. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  257. /*                                          */
  258. /********************************************/
  259.  
  260. int n ;
  261. {
  262. #ifdef __TURBOC__
  263. void switcher(int) ;
  264. long time(int) ;
  265. #endif
  266.  
  267. /* reject single verb command */
  268. if (tag[V_VERB_ONLY]) {
  269.     printf("What exactly do you want me to set alight?\n") ;
  270.     return ;
  271. }
  272.  
  273. /* deal with 'light torch' command */
  274. if (tag[V_torch]) {
  275.     switcher(n) ;
  276.     return ;
  277. }
  278.  
  279. /* see if the user has or requested matches */
  280. if (!tag[V_match]) {
  281. printf("What am I to light it with?\n") ;
  282. printf("(I am not prepared to rub two sticks together.)\n") ;
  283.     return ;
  284. }
  285. if (object[O_matches][J_loc] != B_have) {
  286. printf("I have no matches!\n") ;
  287.     return ;
  288. }
  289. else {
  290. /* reject spurious "ignite" command */
  291.     if ((!tag[V_cap])&&(!tag[V_dynamite])&&
  292.         (sent[2] != V_LINE_END)) {
  293. printf("It would be a fire hazard to set that alight.\n");
  294.         return ;
  295.     }
  296.  
  297. /* deal with spurious "light dynamite with match" */
  298. if (tag[V_dynamite]&&(object[O_dynamite][J_loc] != B_have)) {
  299. printf("You have no dynamite to ignite.\n") ;
  300.     return ;
  301. }
  302.  
  303. /* deal with spurious "light cap with match" */
  304. if (tag[V_cap]&&(object[O_dynamite][J_loc] != B_have)&& 
  305.     (object[O_cap][J_loc] != B_have)) {
  306. printf("You don't have one to ignite.\n") ;
  307.     return ;
  308. }
  309.  
  310. /* light up the match(es) */
  311.     if (tag[V_PLURAL]) {
  312. printf("You open up the match box and strike ALL of the matches.\n");
  313.         object[O_matches][J_loc] = B_destroyed ;
  314.     }
  315.     else {
  316. printf("You take one match from the match box and ignite it.\n") ;
  317.     }
  318. }
  319.  
  320. /* see if user selected burnable objects */
  321. if (tag[V_cap]&&(object[O_cap][J_loc] == B_have)) {
  322. printf("You then ignite the fuse of the blasting cap.\n\n"); 
  323. printf("Ssssssssssssssssssssssss........\n");
  324.     clock_explode = time(0) + 11 ;
  325.     sw_clock = TRUE ;
  326.     flag_clock = V_cap ;
  327.     return ;
  328. }
  329.  
  330. if ((tag[V_cap]||tag[V_dynamite])&&
  331.     (object[O_dynamite][J_loc] == B_have)) {
  332.     if (object[O_dynamite][J_type] == Z_alias) {
  333. printf("You then ignite the fuse of the dynamite's blasting cap....\n");
  334. printf("You need to very quickly get very far away from this thing!!");
  335. printf("\n\nSsssssssssssssssssssssss........\n");
  336.         clock_explode = time(0) + 11 ;
  337.         sw_clock = TRUE ;
  338.         flag_clock = V_dynamite ;
  339.          return ;
  340.     }
  341.     else {
  342. printf("You then ignite the dynamite. Which is an odd thing\n"); 
  343. printf("to do since it doesn't have a blasting cap in it.  The\n");
  344. printf
  345.   ("\"dynamite\" (which is actually a very safe mining explosive)\n");
  346. printf("burns for a few minutes, billowing out smelly black smoke\n");
  347. printf("and eventually goes out leaving a few scant ashes behind.\n") ;
  348.         object[O_dynamite][J_loc] = B_destroyed ;
  349.          return ;
  350.     }
  351. }
  352.  
  353. } /* -- end of the "igniter" subroutine --- */
  354.  
  355. void hold_it()
  356. /********************************************/
  357. /*                                          */
  358. /*            Wait Subroutine               */
  359. /*                                          */
  360. /*     Software by Gary A. Allen, Jr.       */
  361. /*           Version: Mk 1.00               */
  362. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  363. /*                                          */
  364. /********************************************/
  365.  
  366. {
  367. #ifdef __TURBOC__
  368. char getch(void) ;
  369.  
  370. /* Stop scrolling the screen until the user is ready */
  371. printf("               [Press any key to continue]\r") ;
  372. getch() ;
  373. printf("                                          \n") ;
  374. #endif
  375.  
  376. #ifndef __TURBOC__
  377. printf("               [Press RETURN to continue]\n") ;
  378. getchar() ;
  379. #endif
  380.  
  381. } /* --- end of the "hold_it" subroutine --- */
  382.  
  383. void eater()
  384. /********************************************/
  385. /*                                          */
  386. /*            Eater Subroutine              */
  387. /*                                          */
  388. /*     Software by Gary A. Allen, Jr.       */
  389. /*           Version: Mk 1.00               */
  390. /* (c) Copyright 1989 by Gary A. Allen, Jr. */
  391. /*                                          */
  392. /********************************************/
  393. {
  394.  
  395. #ifdef __TURBOC__
  396. void ender(int) ;
  397. #endif
  398.  
  399. /* reject single verb command */
  400. if (tag[V_VERB_ONLY]) {
  401.     printf("What exactly do you want me to swallow?\n") ;
  402.     return ;
  403. }
  404.  
  405. /* deal with "eat (atropine) pill(s)" command */
  406. if (tag[V_pill]) {
  407.     if (object[O_pills][J_loc] != B_have) {
  408. printf("You don't have the atropine pills in your possesion!\n") ;
  409.         return ;
  410.     }
  411.     if (tag[V_PLURAL]) {
  412. printf("You remove ALL of the pills from the packet and swallow\n");
  413. printf("the lot.  For a couple of minutes nothing happens, then you\n");
  414. printf("start seeing double and have nervous twitches. You then\n");
  415. printf("start shaking violently and collapse to the ground.\n") ;
  416. printf("Eventually you pass out and expire from atropine poisoning.\n");
  417.         ender(F_died) ;
  418.     }
  419.     if (--pill_count <= 0 ) {
  420.         object[O_pills][J_loc] = B_destroyed ;
  421.         carry_count-- ;
  422.         carry_weight -= object[O_pills][J_weight]  ;
  423. printf("You swallow the last atropine pill and throw away the empty\n");
  424. printf("packet which disappears from sight.  ") ;
  425.     }
  426. else printf("You swallow one atropine pill.  ") ;
  427.         i_poison += 10 ;
  428.         if (i_poison >= 30) {
  429. printf("\nAfter a moment you have a violent seizure and die.\n") ;
  430.             ender(F_died) ;
  431.         }
  432.         if (i_poison >= 20) {
  433. printf("\nYou begin to shake violently and can barely stand.\n") ;
  434.             return ;
  435.         }
  436.         if (i_poison >= 15) {
  437. printf("\nYour hands become a bit jittery and your vision blurred.\n") ;
  438.             return ;
  439.         }
  440.         printf("The drug has no ill effect.\n") ;
  441.     return ;
  442. }
  443. else 
  444. printf("I am not inclined towards putting that into my mouth!\n") ;
  445.  
  446. } /* --- end of the "eater" subroutine --- */
  447.