home *** CD-ROM | disk | FTP | other *** search
/ CD PowerPlay 6 / TheCompleteAdventureCollection1995 / CDPP6.ISO / utility / agtsrc / specials.pa4 < prev    next >
Encoding:
Text File  |  1989-12-20  |  16.5 KB  |  468 lines

  1.  
  2.   {SPECIALS.PA2}
  3.  
  4.  
  5.   { Special }
  6.   {Handle the 'special' stuff - move player}
  7.   {to specified room, and display the text }
  8.   {provided. }
  9.   {(called by the procedures below it) }
  10.  
  11.   PROCEDURE special(rm : Integer);
  12.  
  13.   BEGIN
  14.     IF (Special_Ptr[rm].start < 1) OR (Special_Ptr[rm].len < 1)
  15.     THEN
  16.       BEGIN {No SPECIAL text exists so -- do nothing} END
  17.     ELSE Describe_It('SPECIAL', rm);
  18.     {move the player's location}
  19.     MoveGroup(Current_room, rm);
  20.     Current_room := rm;
  21.     {describe the special by reading the author's "text" for the new room}
  22.     Room[Current_room]^.has_seen := False; {describe it again}
  23.   END;                            {special}
  24.  
  25.   { Turn (noun,prep,object) }
  26.   {turn on light, turn handle, turn rock over with rod}
  27.  
  28.   PROCEDURE Turn(noun, prep, object_word : words);
  29.  
  30.   VAR l, num : Integer;
  31.   BEGIN
  32.     IF (noun = 'ALL') OR (object_word = 'ALL')
  33.     THEN WriteLn(IO, 'Not everything at once - one at a time!')
  34.     ELSE
  35.       BEGIN
  36.         IF (noun = '') THEN noun := object_word;
  37.         num := Noun_Number(noun);
  38.         l := location(num);
  39.         Normalize(noun);
  40.         IF NOT Is_Visible(num)
  41.         THEN WriteLn(IO, 'I see no ', noun, ' here.')
  42.         ELSE IF (num < First_noun) OR (num > MaxNoun)
  43.         THEN WriteLn(IO, 'I don''t know how to turn the ', noun)
  44.         ELSE
  45.           {check for special}
  46.           IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = num)
  47.           AND (N[num]^.turnable) AND ((l = Current_room) OR (l = Player))
  48.           THEN special(Room[Current_room]^.special)
  49.           ELSE IF N[num]^.turnable
  50.           THEN
  51.             IF (Turn_Ptr[num].start < 1) OR (Turn_Ptr[num].len < 1)
  52.             THEN
  53.               WriteLn(IO, 'Turning the ', noun,
  54.                       ' doesn''t seem to accomplish anything.')
  55.             ELSE
  56.               BEGIN
  57.                 Describe_It('TURN_DESCR', num);
  58.                 WriteLn(IO, ' ');
  59.               END
  60.           ELSE IF N[num]^.is_light
  61.           THEN IF prep = 'ON' THEN light(noun)
  62.             ELSE Extinguish(noun)
  63.           ELSE WriteLn(IO, 'You can''t seem to turn the ', noun, '.');
  64.       END;
  65.   END;
  66.  
  67.   { Push (noun,prep,object) }
  68.   {push button, push troll with rod}
  69.  
  70.   PROCEDURE Push(noun, prep, object_word : words);
  71.  
  72.   VAR n_num, l : Integer;
  73.   BEGIN
  74.     IF (noun = 'ALL') OR (object_word = 'ALL')
  75.     THEN WriteLn(IO, 'Not everything at once - one at a time!')
  76.     ELSE
  77.       BEGIN
  78.         n_num := Noun_Number(noun);
  79.         l := location(n_num);
  80.         Normalize(noun);
  81.         IF NOT Is_Visible(n_num)
  82.         THEN WriteLn(IO, 'I see no ', noun, ' here.')
  83.         ELSE IF (n_num >= First_creature) AND (n_num <= MaxCreature)
  84.         THEN IF M[n_num]^.gender = Thing {Default creature} THEN
  85.             IF M[n_num]^.hostile
  86.             THEN WriteLn(IO, 'The ', noun, ' growls and snaps at your hand as you ',
  87.                          'reach toward it.')
  88.             ELSE WriteLn(IO, 'The ', noun, ' makes a pleasant sound as you pat it ',
  89.                          'gently on the head.')
  90.           ELSE                    {NOT Thing}
  91.             IF M[n_num]^.hostile
  92.             THEN WriteLn(IO, 'The ', noun, ' scowls and pushes your hand away as you ',
  93.                          'reach toward ', Object_IT[M[n_num]^.gender], '.')
  94.             ELSE WriteLn(IO, 'The ', noun, ' smiles as your hand touches ',
  95.                          Object_IT[M[n_num]^.gender], '.')
  96.         ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
  97.         THEN WriteLn(IO, 'Nothing happens when you touch the ', noun)
  98.         ELSE
  99.           {check for special first}
  100.           IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
  101.           AND (N[n_num]^.pushable) AND ((l = Current_room) OR (l = Player))
  102.           THEN special(Room[Current_room]^.special)
  103.           ELSE IF N[n_num]^.pushable
  104.           THEN
  105.             IF (Push_Ptr[n_num].start < 1) OR
  106.             (Push_Ptr[n_num].len < 1)
  107.             THEN
  108.               WriteLn(IO, 'The ', noun, ' cleverly ignores your touch.')
  109.             ELSE
  110.               BEGIN
  111.                 Describe_It('PUSH_DESCR', n_num);
  112.                 WriteLn(IO, ' ');
  113.               END
  114.           ELSE WriteLn(IO, 'The ', noun, ' cleverly resists your touch.');
  115.       END;
  116.   END;
  117.  
  118.   { Pull (noun,prep,object)}
  119.   {pull rope, pull princess}
  120.  
  121.   PROCEDURE Pull(noun, prep, object_word : words);
  122.  
  123.   VAR n_num, l : Integer;
  124.   BEGIN
  125.     IF (noun = 'ALL') OR (object_word = 'ALL')
  126.     THEN WriteLn(IO, 'Not everything at once - one at a time!')
  127.     ELSE
  128.       BEGIN
  129.         n_num := Noun_Number(noun);
  130.         l := location(n_num);
  131.         Normalize(noun);
  132.         IF NOT Is_Visible(n_num)
  133.         THEN WriteLn(IO, 'I see no ', noun, ' here.')
  134.         ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
  135.         THEN WriteLn(IO, 'Pulling the ', noun, ' doesn''t seem possible.')
  136.         ELSE
  137.           {check for special first}
  138.           IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
  139.           AND (N[n_num]^.pullable) AND ((l = Current_room) OR (l = Player))
  140.           THEN special(Room[Current_room]^.special)
  141.           ELSE IF N[n_num]^.pullable
  142.           THEN
  143.             IF (Pull_Ptr[n_num].start < 1) OR
  144.             (Pull_Ptr[n_num].len < 1)
  145.             THEN
  146.               WriteLn(IO, 'Pulling the ', noun, ' doesn''t seem to affect ', ItOrThem[N[n_num]^.SingOrPlur]
  147.                       , ' any.')
  148.             ELSE
  149.               BEGIN
  150.                 Describe_It('PULL_DESCR', n_num);
  151.                 WriteLn(IO, ' ');
  152.               END
  153.           ELSE WriteLn(IO, 'Pulling on the ', noun, ' doesn''t seem to work.');
  154.       END;
  155.   END;
  156.  
  157.   { Play (noun) }
  158.   {play radio, play baseball, play with dog}
  159.  
  160.   PROCEDURE Play(noun : words);
  161.  
  162.   VAR n_num, l : Integer;
  163.   BEGIN
  164.     IF (noun = 'ALL')
  165.     THEN WriteLn(IO, 'Not everything at once - one at a time!')
  166.     ELSE
  167.       BEGIN
  168.         n_num := Noun_Number(noun);
  169.         IF (n_num = 0) AND (object_word <> '')
  170.         THEN                      {cover for 'play with xxxxx'}
  171.           BEGIN
  172.             noun := object_word;  {object rudely taken as a global variable}
  173.             n_num := Noun_Number(noun);
  174.           END;
  175.         l := location(n_num);
  176.         Normalize(noun);
  177.         IF NOT Is_Visible(n_num)
  178.         THEN WriteLn(IO, 'I see no ', noun, ' here.')
  179.         ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
  180.         THEN WriteLn(IO, 'Playing with the ', noun, ' doesn''t make much sense!')
  181.         ELSE
  182.           {check for special first}
  183.           IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
  184.           AND (N[n_num]^.playable) AND ((l = Current_room) OR (l = Player))
  185.           THEN special(Room[Current_room]^.special)
  186.           ELSE IF N[n_num]^.playable
  187.           THEN
  188.             IF (Play_Ptr[n_num].start < 1) OR
  189.             (Play_Ptr[n_num].len < 1)
  190.             THEN
  191.               WriteLn(IO, 'You play with the ', noun, ' for a while. ',
  192.                       'Nothing significant happens.')
  193.             ELSE
  194.               BEGIN
  195.                 Describe_It('PLAY_DESCR', n_num);
  196.                 WriteLn(IO, ' ');
  197.               END
  198.           ELSE WriteLn(IO, 'You play with the ', noun, ' for a while. ',
  199.                        'Nothing significant happens.');
  200.       END;
  201.   END;
  202.  
  203.   { Change_Locations }
  204.   { e.g., GO TO CAVE, CLIMB ROPE, SHOW ID BADGE TO SECURITY GUARD}
  205.   { To use: Define either a Global or Room synonym}
  206.   { as: Change_Locations CLIMB }
  207.   { Then whenever player inputs 'CLIMB HILL' and }
  208.   { ( where HILL is a KEY noun in that room) }
  209.   { and Room.Special exists and KEY = # for HILL }
  210.   { Then SPECIAL will be executed normally }
  211.  
  212.   PROCEDURE Change_Locations(noun : words);
  213.  
  214.   VAR n_num, l : Integer;
  215.   BEGIN
  216.     IF (noun = 'ALL')
  217.     THEN WriteLn(IO, 'Not everything at once - one at a time!')
  218.     ELSE
  219.       BEGIN
  220.         n_num := Noun_Number(noun);
  221.         IF (n_num = 0) AND (object_word <> '')
  222.         THEN                      {cover for 'GO TO xxxxx'}
  223.           BEGIN
  224.             noun := object_word;  {object rudely taken as a global variable}
  225.             n_num := Noun_Number(noun);
  226.           END;
  227.         l := location(n_num);
  228.         Normalize(noun);
  229.         IF NOT Is_Visible(n_num)
  230.         THEN WriteLn(IO, 'I see no ', noun, ' here.')
  231.         ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
  232.         THEN WriteLn(IO, 'To "', Original_Verb, '" the ', noun, ' doesn''t make much sense!')
  233.         ELSE
  234.           {check for special first}
  235.           IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
  236.           AND ((l = Current_room) OR (l = Player))
  237.           THEN special(Room[Current_room]^.special)
  238.           ELSE WriteLn(IO, 'You ', Original_Verb, ' the ', noun, ' for a while. ',
  239.                        'Nothing significant happens.');
  240.       END;
  241.   END;
  242.  
  243.   { MagicWord }
  244.   { e.g., XYZZY, PLUGH ,etc. }
  245.   { To use: Define either a Global or Room synonym}
  246.   { as: MAGIC_WORD xyzzy }
  247.   { Then whenever player inputs 'xyzzy' and }
  248.   { that is the operable magic word in that room) }
  249.   { and Room.Special exits and KEY = 0 (must be 0)}
  250.   { Then SPECIAL will be executed normally }
  251.  
  252.   PROCEDURE MagicWord;
  253.  
  254.   BEGIN
  255.     {$V-} Capitalize(Original_Verb); {$V+}
  256.     IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = 0)
  257.     {MagicWord must have Room.Special with KEY = 0}
  258.     THEN special(Room[Current_room]^.special)
  259.     ELSE WriteLn(IO, '"', Original_Verb, '" is a great word, but it doesn''t seems to',
  260.                  ' have any effect here.');
  261.   END;                            {MagicWord}
  262.  
  263.   {Go (direction)}
  264.  
  265.   PROCEDURE Go(Dir : words);
  266.  
  267.   VAR rm, i, blocker : Integer;
  268.     wd : words;
  269.   BEGIN
  270.     WITH Room[Current_room]^ DO
  271.       IF (Dir = 'NORTH') THEN rm := Path[NORTH]
  272.       ELSE IF (Dir = 'SOUTH') THEN rm := Path[SOUTH]
  273.       ELSE IF (Dir = 'EAST') THEN rm := Path[EAST]
  274.       ELSE IF (Dir = 'WEST') THEN rm := Path[WEST]
  275.       ELSE IF (Dir = 'NORTHEAST') THEN rm := Path[northeast]
  276.       ELSE IF (Dir = 'NORTHWEST') THEN rm := Path[northwest]
  277.       ELSE IF (Dir = 'SOUTHEAST') THEN rm := Path[southeast]
  278.       ELSE IF (Dir = 'SOUTHWEST') THEN rm := Path[southwest]
  279.       ELSE IF (Dir = 'UP') THEN rm := Path[up]
  280.       ELSE IF (Dir = 'DOWN') THEN rm := Path[down]
  281.       ELSE IF (Dir = 'ENTER') THEN rm := Path[enter]
  282.       ELSE IF (Dir = 'EXIT') THEN rm := Path[Exit]
  283.       ELSE
  284.         rm := Nowhere;
  285.     {If rm > 1000 print message number rm - 1000}
  286.     IF rm > 1000 THEN Describe_It('MESSAGE', rm-1000)
  287.     ELSE IF (rm < First_Room) OR (rm > MaxRoom)
  288.     THEN
  289.       IF Dir = 'ENTER'
  290.       THEN WriteLn(IO, 'There''s nothing to enter here!')
  291.       ELSE IF Dir = 'EXIT'
  292.       THEN WriteLn(IO, 'Exiting doesn''t seem appropriate just now.')
  293.       ELSE
  294.         BEGIN
  295.           Normalize(Dir);
  296.           WriteLn(IO, 'You can''t go ', Dir, ' from here!');
  297.         END
  298.     ELSE                          {valid direction, check for creature blocking exit}
  299.       BEGIN
  300.         blocker := Nowhere;
  301.         FOR i := First_creature TO MaxCreature DO
  302.           IF (M[i]^.location = Current_room) AND (M[i]^.hostile)
  303.           THEN blocker := i;
  304.         IF ((blocker = Nowhere) OR (NOT LightIsHere))
  305.         THEN BEGIN                {OK - to move, blocker can't see in dark}
  306.           MoveGroup(Current_room, rm);
  307.           Current_room := rm;
  308.         END
  309.         ELSE
  310.           BEGIN
  311.             wd := M[blocker]^.name;
  312.             Normalize(wd);
  313.             WriteLn(IO, 'The ', wd, ' blocks your way and will not let you leave!');
  314.           END;
  315.       END;
  316.   END;                            {Go}
  317.  
  318.   { Take_All }
  319.   {get all items than can be carried in the room}
  320.  
  321.   PROCEDURE Take_All;
  322.  
  323.   VAR i : Integer;
  324.     match : Boolean;
  325.   BEGIN
  326.     match := False;
  327.     FOR i := First_noun TO MaxNoun DO
  328.       BEGIN
  329.         IF (N[i]^.location = Current_room) AND (N[i]^.movable)
  330.         THEN
  331.           BEGIN
  332.             NounNumber := i;
  333.             Adjective := N[i]^.adj;
  334.             noun := N[i]^.name;
  335.             Take(N[i]^.name);
  336.             match := True;
  337.           END;
  338.       END;
  339.     IF NOT match THEN WriteLn(IO, 'There is nothing here that can be taken!');
  340.   END;                            {take_all}
  341.  
  342.   { Drop_All }
  343.   {drop all items being carried (not being worn)}
  344.  
  345.   PROCEDURE Drop_All;
  346.  
  347.   VAR i : Integer;
  348.     match : Boolean;
  349.   BEGIN
  350.     match := False;
  351.     FOR i := First_noun TO MaxNoun DO
  352.       IF (N[i]^.location = Player)
  353.       THEN
  354.         BEGIN
  355.           NounNumber := i;
  356.           Adjective := N[i]^.adj;
  357.           noun := N[i]^.name;
  358.           Drop(N[i]^.name);
  359.           match := True;
  360.         END;
  361.     IF NOT match THEN WriteLn(IO, 'You weren''t carrying anything!');
  362.   END;                            {drop_all}
  363.  
  364.   { Wear_All }
  365.   {get all items than can be worn in the room}
  366.  
  367.   PROCEDURE Wear_All;
  368.  
  369.   VAR i : Integer;
  370.     match : Boolean;
  371.   BEGIN
  372.     match := False;
  373.     FOR i := First_noun TO MaxNoun DO
  374.       BEGIN
  375.         IF ((N[i]^.location = Current_room) AND (N[i]^.wearable))
  376.         THEN
  377.           BEGIN
  378.             NounNumber := i;
  379.             Adjective := N[i]^.adj;
  380.             noun := N[i]^.name;
  381.             Wear(N[i]^.name);
  382.             match := True;
  383.           END;
  384.       END;
  385.     IF NOT match THEN WriteLn(IO, 'There is nothing here that can be worn!');
  386.   END;                            {wear_all}
  387.  
  388.   { Remove_All }
  389.   {take off all items being worn}
  390.  
  391.   PROCEDURE Remove_All;
  392.  
  393.   VAR i : Integer;
  394.     match : Boolean;
  395.   BEGIN
  396.     match := False;
  397.     FOR i := First_noun TO MaxNoun DO
  398.       IF (N[i]^.location = Wearing)
  399.       THEN
  400.         BEGIN
  401.           NounNumber := i;
  402.           Adjective := N[i]^.adj;
  403.           noun := N[i]^.name;
  404.           Drop(N[i]^.name);
  405.           match := True;
  406.         END;
  407.     IF NOT match THEN WriteLn(IO, 'You weren''t wearing anything!');
  408.   END;                            {remove_all}
  409.  
  410.  
  411.   { Attack (noun,prep,object) }
  412.   { (attack, fight, kill) }
  413.   {kill troll with axe, shoot guard with laser}
  414.  
  415.   PROCEDURE Attack(noun, prep, object_word : words);
  416.  
  417.   VAR m_num, o_num : Integer;
  418.   BEGIN
  419.     m_num := Noun_Number(noun);
  420.     o_num := Noun_Number(object_word);
  421.     IF (noun = 'ALL') OR (object_word = 'ALL')
  422.     THEN WriteLn(IO, 'Not everything at once - one at a time!')
  423.     ELSE IF NOT Is_Creature(noun)
  424.     THEN
  425.       BEGIN
  426.         WriteLn(IO, 'It would really make more sense to specify some living thing');
  427.         WriteLn(IO, 'to ', Original_Verb, '. Hostility really requires a target of some sort.');
  428.       END
  429.     ELSE                          {it is a creature of some sort}
  430.       BEGIN
  431.         m_num := Creature_Number(noun);
  432.         IF prep = 'WITH'
  433.         THEN o_num := Noun_Number(object_word)
  434.         ELSE o_num := Nowhere;
  435.         IF (o_num >= First_noun) AND (N[o_num]^.can_shoot)
  436.         THEN Shoot(noun, prep, object_word)
  437.         ELSE IF o_num >= First_noun
  438.         THEN Throw(object_word, 'AT', noun)
  439.         ELSE IF M[m_num]^.hostile
  440.         THEN
  441.           BEGIN
  442.             Normalize(noun);
  443.             WriteLn(IO, '[With your bare hands]');
  444.             WriteLn(IO, 'You grab the ', noun, ' with your hands and attempt to');
  445.             WriteLn(IO, 'strangle ', Object_IT[M[m_num]^.gender], '. '
  446.                     , Cap_Subject_IT[M[m_num]^.gender], ' slips easily from your grasp and');
  447.             WriteLn(IO, Snarls[M[m_num]^.gender], ' at you, preparing to respond with an attack. ');
  448.             WriteLn(IO, 'You leap out of way just in time.');
  449.             WriteLn(IO, ' ');
  450.             M[m_num]^.counter := M[m_num]^.counter+1;
  451.           END
  452.         ELSE                      {friendly creature}
  453.           BEGIN
  454.             Normalize(noun);
  455.             WriteLn(IO, '[With your bare hands]');
  456.             WriteLn(IO, 'You grab the ', noun, ' with your hands and attempt to');
  457.             WriteLn(IO, 'strangle ', Object_IT[M[m_num]^.gender], '. '
  458.                     , Cap_Subject_IT[M[m_num]^.gender], ' writhes in your fingers, and slips');
  459.             WriteLn(IO, 'free, scratching you in the process. ', Cap_Subject_IT[M[m_num]^.gender],
  460.                     ' crawls away');
  461.             WriteLn(IO, 'from you, gasping for breath.');
  462.             WriteLn(IO, ' The ', noun, ' seems puzzled and confused by your');
  463.             WriteLn(IO, 'actions, and seems upset, but not hostile.');
  464.           END
  465.       END;                        {if it is a creature}
  466.   END;                            {Procedure attack}
  467.  
  468.