home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / games / volume15 / dinkum / part02 / objlook.c < prev   
C/C++ Source or Header  |  1993-01-27  |  16KB  |  443 lines

  1. #define OBJLKR
  2. #include "dink_sym.h"
  3. #include "dink_glb.h"
  4.  
  5. void objlooker(n)
  6. /*********************************************************/
  7. /*                                                       */
  8. /*    --- Object in Room Examination Subroutine ---      */
  9. /*                                                       */
  10. /*      Program by Gary A. Allen, Jr.  18 May 1990       */
  11. /*        (c) Copywrite 1989 by Gary A. Allen, Jr.       */
  12. /*                                                       */
  13. /*********************************************************/
  14. int n ;
  15. {
  16. #ifdef __TURBOC__
  17. void objector(int) ;
  18. #endif
  19.  
  20. register int i ;
  21.  
  22. if (((object[O_torch][J_loc] == B_have)&&object[O_torch][J_property])|| 
  23.    (n < 186)||(n > 202)) { 
  24.     if (room[n][M_obj_cnt] == 1) {
  25.         for (i=0; i <= objcnt; i++) {
  26.             if ((object[i][J_loc] == n) && 
  27.                 (object[i][J_type] != Z_unmovable)) {
  28.                 if (n == R_office_mang) {
  29. printf ("On the floor you see ") ;
  30.                     objector(i) ;
  31.                     printf (".\n") ;
  32.                 }
  33.                 else {
  34.                      printf ("You see ") ;
  35.                     objector(i) ;
  36.                     printf (".\n") ;
  37.                 }
  38.             }
  39.         }
  40.     }
  41.     if (room[n][M_obj_cnt] > 1) {
  42.         if (n == R_office_mang) 
  43. printf ("You see the following on the floor: \n");
  44.         else printf ("You see the following: \n");
  45.         for (i=0; i <= objcnt; i++) {
  46.             if ((object[i][J_loc] == n) && 
  47.                 (object[i][J_type] != Z_unmovable)) {
  48.                 printf ("        ") ;
  49.                 objector(i) ;
  50.                 printf ("\n") ;
  51.             }
  52.         }
  53.     }
  54. }
  55. } /* end of "objlooker" subroutine */
  56.  
  57. void kelly(n) 
  58. /********************************************************************/
  59. /*                                                                  */
  60. /*                  --- Ned Kelly Subroutine --                     */
  61. /*                                                                  */
  62. /* Software by Gary A. Allen, Jr. 5 November 1989  Version: Mk 1.2  */
  63. /*           (c) Copyright 1989 by Gary A. Allen, Jr.               */
  64. /*                                                                  */
  65. /********************************************************************/
  66. int n ;
  67. {
  68. register int i, k ;
  69. static int ned_look = 0, sw_fiddle = TRUE ;
  70. int  sw_ned_look, sw_ned_set ;
  71.  
  72. /* check if Ned  Kelly is dead */
  73. if (enemy[N_ned][E_location] == B_destroyed) return ;
  74.  
  75. /* this switch is for Ned looking for treasure once per cycle */
  76. sw_ned_look = FALSE ;
  77. sw_ned_set = FALSE ;
  78.  
  79. /* check if player is in Ned's trigger rooms */
  80. switch (n) {
  81. /* Cause Ned Kelly to steal */
  82. case R_lift_inside:
  83.     /* are there valuables in the safe and the safe open? */
  84.     if ((score > 0)&&
  85.         (room[R_office_mang][M_rm_status] >= S_dialed)) {
  86.     /* is the office building open? */
  87.         if ((ned_look > 4)||
  88.             (room[R_office_entr][M_rm_status] == S_open)||
  89.             (room[R_office_entr][M_rm_status] == S_kicked)||
  90.         (room[R_office_entr][M_rm_status] == S_unlocked)) {
  91.  
  92.             if (ned_look > 4) {
  93.             room[R_office_entr][M_rm_status] = S_kicked ;
  94.             room[R_office_entr][2] = R_office_hall ;
  95.             }
  96. /* scan the object list for treasure in safe and transfer to hideout */
  97.             for (i=0; i <= objcnt; i++) {
  98.     if ((object[i][J_loc] == B_in_safe)&&(object[i][J_value] > 0)) {
  99.                     ++room[R_hideout][M_obj_cnt] ;
  100.                     object[i][J_loc] = R_hideout; 
  101.                     sw_ned_set = TRUE ;
  102.                 }
  103.             }    
  104.         }
  105. /* the safe is open with treasure but the door is locked */
  106.         else {
  107.             ++ned_look ;
  108.             sw_ned_look = TRUE ;
  109.         }
  110.     } /* end of the block concerning Ned and the safe */
  111.  
  112.     if (sw_valuable) {
  113.         for (i=0; i <= objcnt; i++) {
  114. /* scan for treasure laying around outside the building on surface */
  115.             for (k = 22; k <= 36; k++) { 
  116.                 if ((object[i][J_loc] == k)&&
  117.                     (object[i][J_value] > 0)) {
  118.                     ++room[R_hideout][M_obj_cnt] ;
  119.                     --room[k][M_obj_cnt] ;
  120.                     object[i][J_loc] = R_hideout; 
  121.                     sw_ned_set = TRUE ;
  122.                     sw_valuable = FALSE ;
  123.                     break ;
  124.                 }
  125.             }    
  126.             for (k = 144; k <= 145; k++) {
  127.                 if ((object[i][J_loc] == k)&&
  128.                     (object[i][J_value] > 0)) {
  129.                     ++room[R_hideout][M_obj_cnt] ;
  130.                     --room[k][M_obj_cnt] ;
  131.                     object[i][J_loc] = R_hideout; 
  132.                     sw_valuable = FALSE ;
  133.                     sw_ned_set = TRUE ;
  134.                     break ;
  135.                 }
  136.             }    
  137.         /* scan the office building for treasure on the floor */
  138.             for (k = 37; k <= 41; k++) { 
  139.                 if ((object[i][J_loc] == k)&&
  140.                     (object[i][J_value] > 0)) {
  141. /* if the office bldg. door is open then Ned Kelly steals treasure */
  142.         if ((room[R_office_entr][M_rm_status] == S_open)||
  143.             (room[R_office_entr][M_rm_status] == S_unlocked)||
  144.           (room[R_office_entr][M_rm_status] == S_kicked)) {
  145.             ++room[R_hideout][M_obj_cnt] ;
  146.             --room[k][M_obj_cnt] ;
  147.             object[i][J_loc] = R_hideout; 
  148.             sw_valuable = FALSE ;
  149.             sw_ned_set = TRUE ;
  150.             break ;
  151.         }
  152. /* if Ned Kelly sees locked treasure four times, he kicks in the door */
  153.         if (ned_look > 4) {
  154.             room[R_office_entr][M_rm_status] = S_kicked ;
  155.             room[R_office_entr][2] = R_office_hall ;
  156.             ++room[R_hideout][M_obj_cnt] ;
  157.             --room[k][M_obj_cnt] ;
  158.             object[i][J_loc] = R_hideout; 
  159.             sw_valuable = FALSE ;
  160.             sw_ned_set = TRUE ;
  161.         }
  162.         else {
  163.             if (!sw_ned_look) ++ned_look ;
  164.             sw_ned_look = TRUE ;
  165.             break ; /* conclude the office bldg. loop */
  166.         }
  167.         break ;
  168.                 }
  169.             }    
  170.         }    
  171.     } /* end of block concerning Ned and loose treasure */
  172.  
  173.     if (sw_ned_set) {
  174.         enemy[N_ned][E_status] = F_stealing ; 
  175.         enemy[N_ned][E_location] = R_hideout ;
  176.         room[R_hideout][M_monster] = 1 ;
  177.         sw_ned_set = FALSE ;
  178.     }
  179.     return ;
  180.  
  181. case R_office_entr:
  182. /* Cause Ned Kelly to run away with treasure */
  183.     if (enemy[N_ned][E_status] == F_stealing) {
  184.         enemy[N_ned][E_status] = F_asleep ;
  185. printf("There is an odd looking character with an iron bucket on his ");
  186. printf("head and a swag\n");
  187. printf("bag over his shoulder running away from the ");
  188. printf("office building towards\nthe desert. \n\n") ;
  189.         return ;
  190.     }
  191.     if ((ned_look == 3) && sw_fiddle && 
  192.         (room[R_office_entr][M_rm_status] != S_open) &&
  193.         (room[R_office_entr][M_rm_status] != S_kicked) &&
  194.         (room[R_office_entr][M_rm_status] != S_unlocked)) {
  195.         sw_fiddle = FALSE ;
  196. printf("As you approach the office building's door, you see a\n");
  197. printf("strange looking character with a bucket on his head and\n") ;
  198. printf("wearing an iron breast plate.  He is on his knees before\n") ;
  199. printf("the door trying to pick the lock with a bit of coat hanger\n") ;
  200. printf("wire. Suddenly, he turns and sees you coming. With amazing\n"); 
  201. printf("speed, he throws away his wire and runs off towards the\n") ;
  202. printf("open desert.\n\n") ;
  203.         return ;
  204.     }
  205. } /* end of the ned kelly room switch block */
  206. } /* --- end of the "kelly" subroutine  --- */ 
  207.  
  208. void sounder(n) 
  209. /********************************************************************/
  210. /*                                                                  */
  211. /*                  --- Gong Sounding Subroutine --                 */
  212. /*                                                                  */
  213. /* Software by Gary A. Allen, Jr. 21 June 1989     Version: Mk 1.0  */
  214. /*           (c) Copyright 1989 by Gary A. Allen, Jr.               */
  215. /*                                                                  */
  216. /********************************************************************/
  217. int n ;
  218. {
  219. #ifdef __TURBOC__
  220. void exit(int), hold_it(void) ;
  221. char getche(void) ;
  222. #endif
  223.  
  224. char letter ;
  225.  
  226. /* see if player is in the gong room */
  227. if (n != R_gong) {
  228.     if (tag[V_gong]) printf("I don't see a gong here.\n") ;
  229.     else printf("I don't see how you can do that.\n") ;
  230.     return ;
  231. }
  232.  
  233. /* The player is in the gong room. Does he have the clapper? */
  234. if (tag[V_clapper]) {
  235.     if (object[O_clapper][J_loc] == B_have) {
  236.         if (!tag[V_gong]) {
  237. printf("With what are you going to do that with the clapper?\n") ;
  238.             return ;
  239.         }
  240. printf
  241. ("\n  GGGGGGGG       OOOOOOOO     NN       NN     GGGGGGGG     !!!\n") ;
  242. printf
  243. ("GG        GG   OO        OO   NNN      NN   GG        GG   !!!\n") ;
  244. printf
  245. ("GG             OO        OO   NN N     NN   GG             !!!\n") ;
  246. printf
  247. ("GG             OO        OO   NN  N    NN   GG             !!!\n") ;
  248. printf
  249. ("GG   GGGGGGG   OO        OO   NN   N   NN   GG    GGGGGG   !!!\n") ;
  250. printf
  251. ("GG        GG   OO        OO   NN    N  NN   GG        GG   !!!\n") ;
  252. printf
  253. ("GG        GG   OO        OO   NN     N NN   GG        GG\n") ;
  254. printf
  255. ("GG        GG   OO        OO   NN      NNN   GG        GG   000\n") ;
  256. printf
  257. ("  GGGGGGGG       OOOOOOOO     NN       NN     GGGGGGGG     000\n\n") ;
  258.  
  259. /* see if the "end game" can begine */
  260.         if ((score < max_score)||(gleep_score == 0)) {
  261. printf("You hear an ethereal voice which says:\n\n") ;
  262.             if (score < max_score) {
  263. printf("Sorry Mate!  You haven't put all of the treasure in the\n") ;
  264. printf("safe yet.  Find the rest, and then the secret of the gong\n") ;
  265. printf("will be revealed.\n") ;
  266.                 return ;
  267.             }
  268.             if (gleep_score == 0) {
  269. printf("Good on you Mate!  You've found all of the treasure.\n") ;
  270. printf("However you haven't put a single gleep in the gleep tank!\n");
  271. printf("You're not a Fair Dinkum Adventurer until you've put at\n") ;
  272. printf("least one gleep in the tank.\n") ;
  273.                 return ;
  274.             }
  275.         }
  276.         /* Begin the End Game */
  277. printf("There is a loud \"Fromp!\" as a portcullis crashes down and\n");
  278. printf("seals the northern (and only) exit.  The lights go dim and\n");
  279. printf("a hazy fog appears in the room.  Slowly this fog coalesces\n") ;
  280. if (sw_warned) {
  281. printf("into the now familiar form of Banjo Patterson.  For some\n") ;
  282. printf("odd reason Banjo is holding in his right hand a sword of\n") ;
  283. printf("fire such as one reads about in Genesis. The deathly quiet\n");
  284. printf("is broken when Banjo begins to speak:\n") ;
  285. }
  286. else {
  287. printf("into a ghostly human form.  This ethereal being is wearing\n") ;
  288. printf("a grey flannel suit, a bowler hat, and has a gold pocket\n") ;
  289. printf("watch chain looped across the front of his waist coat.  He\n");
  290. printf("is holding in his right hand a sword of fire such as one\n") ;
  291. printf("reads about in Genesis.  You can hear \"Waltzing Matilda\"\n");
  292. printf("being played softly in the background.  You know what?\n");
  293. printf("I think this ethereal being is none other than the ghost\n") ;
  294. printf("of Banjo Patterson!  With this realization Banjo begins to\n") ;
  295. printf("speak:\n") ;
  296. }
  297.         hold_it() ;
  298. printf("\"Good on you, Fair Dinkum Adventurer!  You have braved\n") ; 
  299. printf("the perils of hoop snakes, drop bears, and mutant wombats.\n") ;
  300. printf("You have solved many riddles, collected much treasure and\n") ;
  301. printf("encountered true evil and dealt with it appropriately.\n");
  302. printf("However it has occured to us that you might not be one of\n") ;
  303. printf("the chosen few who can be admitted into the Land of the\n") ;
  304. printf("Blessed.  The possibility remains that you could be a\n") ;
  305. printf("whinging Pom or a bleeding Yank.  Therefore you will be\n") ;
  306. printf("tested with three questions.  If you answer correctly, you\n") ;
  307. printf("will be admitted into paradise. However should you answer\n");
  308. printf("falsely, you will be sent to another place, an abode of\n");
  309. printf("darkness and dread.  So answer wisely, for you will not be\n") ;
  310. printf("given a second chance!\"\n\n") ;
  311.  
  312. printf("What is the capital of Australia?\n\n") ;
  313. printf("     A) Sydney\n") ;
  314. printf("     B) Canberra\n") ;
  315. printf("     C) Melbourne\n\n") ;
  316. printf("Answer A, B, or C:  ") ;
  317. quest1:
  318. #ifndef __TURBOC__
  319.         letter = getchar() ;
  320.         if ((letter == '\n')||(letter == ' ')) goto quest1 ;
  321.         if (('b' == letter)||('B' == letter)) 
  322.             printf("\nCorrect!\n\n") ;
  323. #endif
  324.  
  325. #ifdef __TURBOC__
  326.         letter = getche() ;
  327.         if ((letter == '\n')||(letter == ' ')) goto quest1 ;
  328.         if (('b' == letter)||('B' == letter)) 
  329.             printf("\n\nCorrect!\n\n") ;
  330. #endif
  331.         else goto la ;
  332.  
  333. printf("In the Australian emblem there appears two animals on\n") ;
  334. printf("either side of a shield.  One of the two animals is a\n") ;
  335. printf("kangaroo.  What species is the other animal?\n\n") ;
  336. printf("     A) Koala Bear\n") ;
  337. printf("     B) Platypus\n") ;
  338. printf("     C) Emu\n\n") ;
  339. printf("Answer A, B, or C:  ") ;
  340. quest2:
  341. #ifndef __TURBOC__
  342.         letter = getchar() ;
  343.         if ((letter == '\n')||(letter == ' ')) goto quest2 ;
  344.         if (('c' == letter)||('C' == letter)) 
  345.             printf("\nCorrect!\n\n") ;
  346. #endif
  347.  
  348. #ifdef __TURBOC__
  349.         letter = getche() ;
  350.         if ((letter == '\n')||(letter == ' ')) goto quest2 ;
  351.         if (('c' == letter)||('C' == letter)) 
  352.             printf("\n\nCorrect!\n\n") ;
  353. #endif
  354.         else goto la ;
  355.  
  356. printf("Which place is a state in Australia?\n\n") ;
  357. printf("     A) Arcadia\n") ;
  358. printf("     B) Patagonia\n") ;
  359. printf("     C) Tasmania\n\n") ;
  360. printf("Answer A, B, or C:  ") ;
  361. quest3:
  362. #ifndef __TURBOC__
  363.         letter = getchar() ;
  364.         if ((letter == '\n')||(letter == ' ')) goto quest3 ;
  365.         if (('c' == letter)||('C' == letter)) 
  366.             printf("\nCorrect!\n\n") ;
  367. #endif
  368.  
  369. #ifdef __TURBOC__
  370.         letter = getche() ;
  371.         if ((letter == '\n')||(letter == ' ')) goto quest3 ;
  372.         if (('c' == letter)||('C' == letter)) 
  373.             printf("\n\nCorrect!\n\n") ;
  374. #endif
  375.         else goto la ;
  376.  
  377. /* Player has won the game */
  378. printf("You see Banjo Patterson with a beatific smile.  He waves\n") ;
  379. printf("his firey sword with a florish and the scene around you\n") ;
  380. printf("disolves into a million tiny motes of light.  You now\n") ;
  381. printf("find yourself wearing swimming togs.  You are being carried\n");
  382. printf("by a guard of honor made up of four sumptuous shielas\n") ;
  383. printf("dressed in string bikinis and four handsome lifeguards.\n") ;
  384. printf("They carry you to a perfect beach on South Stradbroke\n") ;
  385. printf("Island.  Off in the distance on the Queensland mainland\n") ;
  386. printf("you see the Gold Coast which vaguely resembles the Emerald\n") ;
  387. printf("City of the classic movie.  Your guard of honor sets you\n") ;
  388. printf("down and hands you a can of Power's Bitter.  Three\n") ;
  389. printf("beautiful white pelicans float over head in a clear blue\n") ;
  390. printf("sky completing a scene of exquisite beauty.\n\n") ;
  391. printf("You're in paradise Mate and you've also won the game!\n\n") ;
  392.  
  393. /* deal with final gleep announcement */
  394. if (gleep_score == 1) {
  395. printf("---- A hint for those who want to go on playing Dinkum ----\n");
  396. printf("In this game you only put the minimum single gleep in the\n");
  397. printf("gleep tank.  In future games try seeding fertile tunnels\n");
  398. printf("with gleeps and reproducing them.  Build up as many gleeps\n");
  399. printf("as you can and then hit the gong before Dinkum times out.\n");
  400. }
  401. else {
  402. printf("You won this game with %d gleeps in the gleep tank.\n\n",
  403.     gleep_score) ;
  404. }
  405.         if (sw_wizard) return ;
  406.         else exit(0) ;
  407.  
  408. /* Player enters false answer and goes to Los Angeles */
  409. la:
  410. printf("\n        -!-!-!-!-!-     Wrong!    -!-!-!-!-!-\n\n") ;
  411. printf("Banjo Patterson brings down the sword of fire onto your\n");
  412. printf("head. The scene around you disappears in a flash and you\n");
  413. printf("find yourself transported to.....\n\n") ;
  414. printf("             Pico Blvd., West Los Angeles\n\n") ;
  415. printf("L.A. is having a stage three smog alert.  The air is so\n");
  416. printf("foul you can taste it.  A Los Angeles municipal bus roars\n");
  417. printf("by covering you in soot.  Across the street you see a\n");
  418. printf("modern day Neanderthal selling vials of Crack to children.\n"); 
  419. printf("The person next to you has taken a definite physical\n");
  420. printf("interest in you.  She/he is wearing a short skirt and has a\n");
  421. printf("beehive hairdo.  He/she also has a five o'clock shadow, and\n");
  422. printf("bicepts so thick that he could collapse your skull with a\n");
  423. printf("single thump.\n\n") ; 
  424. printf("We now leave this unhappy scene.  Since you were sent to\n") ;
  425. printf("Los Angeles your score has been zeroed.\n\n") ; 
  426. printf("So ends yet another unsuccessful session at Dinkum!\n") ;
  427.  
  428.         if (sw_wizard) return ;
  429.         else exit(0) ;
  430.     }
  431.     else {
  432.         printf("I don't have a clapper to hit it with! \n") ;
  433.         return ;
  434.     }
  435. }
  436. else {
  437.     printf("Thud! \n") ;
  438.     printf("Nothing happened.\n") ;
  439. printf("I think you'd have more success if you used a gong clapper.\n");
  440.     return ;
  441. }
  442. } /* --- end of the "sounder" subroutine  --- */ 
  443.