home *** CD-ROM | disk | FTP | other *** search
-
- {SPECIALS.PA2}
-
-
- { Special }
- {Handle the 'special' stuff - move player}
- {to specified room, and display the text }
- {provided. }
- {(called by the procedures below it) }
-
- PROCEDURE special(rm : Integer);
-
- BEGIN
- IF (Special_Ptr[rm].start < 1) OR (Special_Ptr[rm].len < 1)
- THEN
- BEGIN {No SPECIAL text exists so -- do nothing} END
- ELSE Describe_It('SPECIAL', rm);
- {move the player's location}
- MoveGroup(Current_room, rm);
- Current_room := rm;
- {describe the special by reading the author's "text" for the new room}
- Room[Current_room]^.has_seen := False; {describe it again}
- END; {special}
-
- { Turn (noun,prep,object) }
- {turn on light, turn handle, turn rock over with rod}
-
- PROCEDURE Turn(noun, prep, object_word : words);
-
- VAR l, num : Integer;
- BEGIN
- IF (noun = 'ALL') OR (object_word = 'ALL')
- THEN WriteLn(IO, 'Not everything at once - one at a time!')
- ELSE
- BEGIN
- IF (noun = '') THEN noun := object_word;
- num := Noun_Number(noun);
- l := location(num);
- Normalize(noun);
- IF NOT Is_Visible(num)
- THEN WriteLn(IO, 'I see no ', noun, ' here.')
- ELSE IF (num < First_noun) OR (num > MaxNoun)
- THEN WriteLn(IO, 'I don''t know how to turn the ', noun)
- ELSE
- {check for special}
- IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = num)
- AND (N[num]^.turnable) AND ((l = Current_room) OR (l = Player))
- THEN special(Room[Current_room]^.special)
- ELSE IF N[num]^.turnable
- THEN
- IF (Turn_Ptr[num].start < 1) OR (Turn_Ptr[num].len < 1)
- THEN
- WriteLn(IO, 'Turning the ', noun,
- ' doesn''t seem to accomplish anything.')
- ELSE
- BEGIN
- Describe_It('TURN_DESCR', num);
- WriteLn(IO, ' ');
- END
- ELSE IF N[num]^.is_light
- THEN IF prep = 'ON' THEN light(noun)
- ELSE Extinguish(noun)
- ELSE WriteLn(IO, 'You can''t seem to turn the ', noun, '.');
- END;
- END;
-
- { Push (noun,prep,object) }
- {push button, push troll with rod}
-
- PROCEDURE Push(noun, prep, object_word : words);
-
- VAR n_num, l : Integer;
- BEGIN
- IF (noun = 'ALL') OR (object_word = 'ALL')
- THEN WriteLn(IO, 'Not everything at once - one at a time!')
- ELSE
- BEGIN
- n_num := Noun_Number(noun);
- l := location(n_num);
- Normalize(noun);
- IF NOT Is_Visible(n_num)
- THEN WriteLn(IO, 'I see no ', noun, ' here.')
- ELSE IF (n_num >= First_creature) AND (n_num <= MaxCreature)
- THEN IF M[n_num]^.gender = Thing {Default creature} THEN
- IF M[n_num]^.hostile
- THEN WriteLn(IO, 'The ', noun, ' growls and snaps at your hand as you ',
- 'reach toward it.')
- ELSE WriteLn(IO, 'The ', noun, ' makes a pleasant sound as you pat it ',
- 'gently on the head.')
- ELSE {NOT Thing}
- IF M[n_num]^.hostile
- THEN WriteLn(IO, 'The ', noun, ' scowls and pushes your hand away as you ',
- 'reach toward ', Object_IT[M[n_num]^.gender], '.')
- ELSE WriteLn(IO, 'The ', noun, ' smiles as your hand touches ',
- Object_IT[M[n_num]^.gender], '.')
- ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
- THEN WriteLn(IO, 'Nothing happens when you touch the ', noun)
- ELSE
- {check for special first}
- IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
- AND (N[n_num]^.pushable) AND ((l = Current_room) OR (l = Player))
- THEN special(Room[Current_room]^.special)
- ELSE IF N[n_num]^.pushable
- THEN
- IF (Push_Ptr[n_num].start < 1) OR
- (Push_Ptr[n_num].len < 1)
- THEN
- WriteLn(IO, 'The ', noun, ' cleverly ignores your touch.')
- ELSE
- BEGIN
- Describe_It('PUSH_DESCR', n_num);
- WriteLn(IO, ' ');
- END
- ELSE WriteLn(IO, 'The ', noun, ' cleverly resists your touch.');
- END;
- END;
-
- { Pull (noun,prep,object)}
- {pull rope, pull princess}
-
- PROCEDURE Pull(noun, prep, object_word : words);
-
- VAR n_num, l : Integer;
- BEGIN
- IF (noun = 'ALL') OR (object_word = 'ALL')
- THEN WriteLn(IO, 'Not everything at once - one at a time!')
- ELSE
- BEGIN
- n_num := Noun_Number(noun);
- l := location(n_num);
- Normalize(noun);
- IF NOT Is_Visible(n_num)
- THEN WriteLn(IO, 'I see no ', noun, ' here.')
- ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
- THEN WriteLn(IO, 'Pulling the ', noun, ' doesn''t seem possible.')
- ELSE
- {check for special first}
- IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
- AND (N[n_num]^.pullable) AND ((l = Current_room) OR (l = Player))
- THEN special(Room[Current_room]^.special)
- ELSE IF N[n_num]^.pullable
- THEN
- IF (Pull_Ptr[n_num].start < 1) OR
- (Pull_Ptr[n_num].len < 1)
- THEN
- WriteLn(IO, 'Pulling the ', noun, ' doesn''t seem to affect ', ItOrThem[N[n_num]^.SingOrPlur]
- , ' any.')
- ELSE
- BEGIN
- Describe_It('PULL_DESCR', n_num);
- WriteLn(IO, ' ');
- END
- ELSE WriteLn(IO, 'Pulling on the ', noun, ' doesn''t seem to work.');
- END;
- END;
-
- { Play (noun) }
- {play radio, play baseball, play with dog}
-
- PROCEDURE Play(noun : words);
-
- VAR n_num, l : Integer;
- BEGIN
- IF (noun = 'ALL')
- THEN WriteLn(IO, 'Not everything at once - one at a time!')
- ELSE
- BEGIN
- n_num := Noun_Number(noun);
- IF (n_num = 0) AND (object_word <> '')
- THEN {cover for 'play with xxxxx'}
- BEGIN
- noun := object_word; {object rudely taken as a global variable}
- n_num := Noun_Number(noun);
- END;
- l := location(n_num);
- Normalize(noun);
- IF NOT Is_Visible(n_num)
- THEN WriteLn(IO, 'I see no ', noun, ' here.')
- ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
- THEN WriteLn(IO, 'Playing with the ', noun, ' doesn''t make much sense!')
- ELSE
- {check for special first}
- IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
- AND (N[n_num]^.playable) AND ((l = Current_room) OR (l = Player))
- THEN special(Room[Current_room]^.special)
- ELSE IF N[n_num]^.playable
- THEN
- IF (Play_Ptr[n_num].start < 1) OR
- (Play_Ptr[n_num].len < 1)
- THEN
- WriteLn(IO, 'You play with the ', noun, ' for a while. ',
- 'Nothing significant happens.')
- ELSE
- BEGIN
- Describe_It('PLAY_DESCR', n_num);
- WriteLn(IO, ' ');
- END
- ELSE WriteLn(IO, 'You play with the ', noun, ' for a while. ',
- 'Nothing significant happens.');
- END;
- END;
-
- { Change_Locations }
- { e.g., GO TO CAVE, CLIMB ROPE, SHOW ID BADGE TO SECURITY GUARD}
- { To use: Define either a Global or Room synonym}
- { as: Change_Locations CLIMB }
- { Then whenever player inputs 'CLIMB HILL' and }
- { ( where HILL is a KEY noun in that room) }
- { and Room.Special exists and KEY = # for HILL }
- { Then SPECIAL will be executed normally }
-
- PROCEDURE Change_Locations(noun : words);
-
- VAR n_num, l : Integer;
- BEGIN
- IF (noun = 'ALL')
- THEN WriteLn(IO, 'Not everything at once - one at a time!')
- ELSE
- BEGIN
- n_num := Noun_Number(noun);
- IF (n_num = 0) AND (object_word <> '')
- THEN {cover for 'GO TO xxxxx'}
- BEGIN
- noun := object_word; {object rudely taken as a global variable}
- n_num := Noun_Number(noun);
- END;
- l := location(n_num);
- Normalize(noun);
- IF NOT Is_Visible(n_num)
- THEN WriteLn(IO, 'I see no ', noun, ' here.')
- ELSE IF (n_num < First_noun) OR (n_num > MaxNoun)
- THEN WriteLn(IO, 'To "', Original_Verb, '" the ', noun, ' doesn''t make much sense!')
- ELSE
- {check for special first}
- IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = n_num)
- AND ((l = Current_room) OR (l = Player))
- THEN special(Room[Current_room]^.special)
- ELSE WriteLn(IO, 'You ', Original_Verb, ' the ', noun, ' for a while. ',
- 'Nothing significant happens.');
- END;
- END;
-
- { MagicWord }
- { e.g., XYZZY, PLUGH ,etc. }
- { To use: Define either a Global or Room synonym}
- { as: MAGIC_WORD xyzzy }
- { Then whenever player inputs 'xyzzy' and }
- { that is the operable magic word in that room) }
- { and Room.Special exits and KEY = 0 (must be 0)}
- { Then SPECIAL will be executed normally }
-
- PROCEDURE MagicWord;
-
- BEGIN
- {$V-} Capitalize(Original_Verb); {$V+}
- IF (Room[Current_room]^.special <> 0) AND (Room[Current_room]^.key = 0)
- {MagicWord must have Room.Special with KEY = 0}
- THEN special(Room[Current_room]^.special)
- ELSE WriteLn(IO, '"', Original_Verb, '" is a great word, but it doesn''t seems to',
- ' have any effect here.');
- END; {MagicWord}
-
- {Go (direction)}
-
- PROCEDURE Go(Dir : words);
-
- VAR rm, i, blocker : Integer;
- wd : words;
- BEGIN
- WITH Room[Current_room]^ DO
- IF (Dir = 'NORTH') THEN rm := Path[NORTH]
- ELSE IF (Dir = 'SOUTH') THEN rm := Path[SOUTH]
- ELSE IF (Dir = 'EAST') THEN rm := Path[EAST]
- ELSE IF (Dir = 'WEST') THEN rm := Path[WEST]
- ELSE IF (Dir = 'NORTHEAST') THEN rm := Path[northeast]
- ELSE IF (Dir = 'NORTHWEST') THEN rm := Path[northwest]
- ELSE IF (Dir = 'SOUTHEAST') THEN rm := Path[southeast]
- ELSE IF (Dir = 'SOUTHWEST') THEN rm := Path[southwest]
- ELSE IF (Dir = 'UP') THEN rm := Path[up]
- ELSE IF (Dir = 'DOWN') THEN rm := Path[down]
- ELSE IF (Dir = 'ENTER') THEN rm := Path[enter]
- ELSE IF (Dir = 'EXIT') THEN rm := Path[Exit]
- ELSE
- rm := Nowhere;
- {If rm > 1000 print message number rm - 1000}
- IF rm > 1000 THEN Describe_It('MESSAGE', rm-1000)
- ELSE IF (rm < First_Room) OR (rm > MaxRoom)
- THEN
- IF Dir = 'ENTER'
- THEN WriteLn(IO, 'There''s nothing to enter here!')
- ELSE IF Dir = 'EXIT'
- THEN WriteLn(IO, 'Exiting doesn''t seem appropriate just now.')
- ELSE
- BEGIN
- Normalize(Dir);
- WriteLn(IO, 'You can''t go ', Dir, ' from here!');
- END
- ELSE {valid direction, check for creature blocking exit}
- BEGIN
- blocker := Nowhere;
- FOR i := First_creature TO MaxCreature DO
- IF (M[i]^.location = Current_room) AND (M[i]^.hostile)
- THEN blocker := i;
- IF ((blocker = Nowhere) OR (NOT LightIsHere))
- THEN BEGIN {OK - to move, blocker can't see in dark}
- MoveGroup(Current_room, rm);
- Current_room := rm;
- END
- ELSE
- BEGIN
- wd := M[blocker]^.name;
- Normalize(wd);
- WriteLn(IO, 'The ', wd, ' blocks your way and will not let you leave!');
- END;
- END;
- END; {Go}
-
- { Take_All }
- {get all items than can be carried in the room}
-
- PROCEDURE Take_All;
-
- VAR i : Integer;
- match : Boolean;
- BEGIN
- match := False;
- FOR i := First_noun TO MaxNoun DO
- BEGIN
- IF (N[i]^.location = Current_room) AND (N[i]^.movable)
- THEN
- BEGIN
- NounNumber := i;
- Adjective := N[i]^.adj;
- noun := N[i]^.name;
- Take(N[i]^.name);
- match := True;
- END;
- END;
- IF NOT match THEN WriteLn(IO, 'There is nothing here that can be taken!');
- END; {take_all}
-
- { Drop_All }
- {drop all items being carried (not being worn)}
-
- PROCEDURE Drop_All;
-
- VAR i : Integer;
- match : Boolean;
- BEGIN
- match := False;
- FOR i := First_noun TO MaxNoun DO
- IF (N[i]^.location = Player)
- THEN
- BEGIN
- NounNumber := i;
- Adjective := N[i]^.adj;
- noun := N[i]^.name;
- Drop(N[i]^.name);
- match := True;
- END;
- IF NOT match THEN WriteLn(IO, 'You weren''t carrying anything!');
- END; {drop_all}
-
- { Wear_All }
- {get all items than can be worn in the room}
-
- PROCEDURE Wear_All;
-
- VAR i : Integer;
- match : Boolean;
- BEGIN
- match := False;
- FOR i := First_noun TO MaxNoun DO
- BEGIN
- IF ((N[i]^.location = Current_room) AND (N[i]^.wearable))
- THEN
- BEGIN
- NounNumber := i;
- Adjective := N[i]^.adj;
- noun := N[i]^.name;
- Wear(N[i]^.name);
- match := True;
- END;
- END;
- IF NOT match THEN WriteLn(IO, 'There is nothing here that can be worn!');
- END; {wear_all}
-
- { Remove_All }
- {take off all items being worn}
-
- PROCEDURE Remove_All;
-
- VAR i : Integer;
- match : Boolean;
- BEGIN
- match := False;
- FOR i := First_noun TO MaxNoun DO
- IF (N[i]^.location = Wearing)
- THEN
- BEGIN
- NounNumber := i;
- Adjective := N[i]^.adj;
- noun := N[i]^.name;
- Drop(N[i]^.name);
- match := True;
- END;
- IF NOT match THEN WriteLn(IO, 'You weren''t wearing anything!');
- END; {remove_all}
-
-
- { Attack (noun,prep,object) }
- { (attack, fight, kill) }
- {kill troll with axe, shoot guard with laser}
-
- PROCEDURE Attack(noun, prep, object_word : words);
-
- VAR m_num, o_num : Integer;
- BEGIN
- m_num := Noun_Number(noun);
- o_num := Noun_Number(object_word);
- IF (noun = 'ALL') OR (object_word = 'ALL')
- THEN WriteLn(IO, 'Not everything at once - one at a time!')
- ELSE IF NOT Is_Creature(noun)
- THEN
- BEGIN
- WriteLn(IO, 'It would really make more sense to specify some living thing');
- WriteLn(IO, 'to ', Original_Verb, '. Hostility really requires a target of some sort.');
- END
- ELSE {it is a creature of some sort}
- BEGIN
- m_num := Creature_Number(noun);
- IF prep = 'WITH'
- THEN o_num := Noun_Number(object_word)
- ELSE o_num := Nowhere;
- IF (o_num >= First_noun) AND (N[o_num]^.can_shoot)
- THEN Shoot(noun, prep, object_word)
- ELSE IF o_num >= First_noun
- THEN Throw(object_word, 'AT', noun)
- ELSE IF M[m_num]^.hostile
- THEN
- BEGIN
- Normalize(noun);
- WriteLn(IO, '[With your bare hands]');
- WriteLn(IO, 'You grab the ', noun, ' with your hands and attempt to');
- WriteLn(IO, 'strangle ', Object_IT[M[m_num]^.gender], '. '
- , Cap_Subject_IT[M[m_num]^.gender], ' slips easily from your grasp and');
- WriteLn(IO, Snarls[M[m_num]^.gender], ' at you, preparing to respond with an attack. ');
- WriteLn(IO, 'You leap out of way just in time.');
- WriteLn(IO, ' ');
- M[m_num]^.counter := M[m_num]^.counter+1;
- END
- ELSE {friendly creature}
- BEGIN
- Normalize(noun);
- WriteLn(IO, '[With your bare hands]');
- WriteLn(IO, 'You grab the ', noun, ' with your hands and attempt to');
- WriteLn(IO, 'strangle ', Object_IT[M[m_num]^.gender], '. '
- , Cap_Subject_IT[M[m_num]^.gender], ' writhes in your fingers, and slips');
- WriteLn(IO, 'free, scratching you in the process. ', Cap_Subject_IT[M[m_num]^.gender],
- ' crawls away');
- WriteLn(IO, 'from you, gasping for breath.');
- WriteLn(IO, ' The ', noun, ' seems puzzled and confused by your');
- WriteLn(IO, 'actions, and seems upset, but not hostile.');
- END
- END; {if it is a creature}
- END; {Procedure attack}
-