Prev: 5F16 Up: Map Next: 5F8F
5F21: Obey Command
Used by the routine at GameLoop.
Turns the verb and noun into a movement or a scripted action. PUSH, PULL, ROLL or MOVE with CURTAINS is rewritten to noun 2B. WET, COOL, DAMP or SOAK is refused, except with the robe, the door or the running water.
Curtains are a special noun for the pushing verbs.
ObeyCommand 5F21 CP $1B Verb 1B (PUSH, PULL, ROLL or MOVE) continues.
5F23 JR NZ,ObeyCommand_Move
5F25 LD A,($5B80) Noun 85 (CURTAINS) continues.
5F28 CP $85
5F2A JR NZ,ObeyCommand_Move
5F2C LD A,$2B That pair becomes noun 2B.
5F2E LD ($5B80),A
A movement that matches an exit changes the room and skips the scripts.
ObeyCommand_Move 5F31 CALL TakeExit Call TakeExit.
5F34 LD A,($5B7A) Write the match into RoomChanged.
5F37 LD ($5B95),A
5F3A OR A Jump to GameLoop_Act if an exit was taken.
5F3B JR NZ,GameLoop_Act
Run the ordinary command scripts.
5F3D CALL RunScripts Call RunScripts.
5F40 LD A,($5B79) Jump to ObeyCommand_Wet when no script line matched.
5F43 OR A
5F44 JR Z,ObeyCommand_Wet
This entry point is used by the routine at GameLoop.
A script asked for the location to be reconsidered several times.
ObeyCommand_Repeat 5F46 LD A,($5D8E) Jump to GameLoop_Act once the repeat count has run out.
5F49 OR A
5F4A JR Z,GameLoop_Act
5F4C XOR A Write 00 to RoomChanged.
5F4D LD ($5B95),A
Run the high-priority scripts.
5F50 CALL RunPriorityScripts Call RunPriorityScripts.
5F53 LD A,($5B95) Jump to ObeyCommand_Redraw if the room did not change.
5F56 OR A
5F57 JR Z,ObeyCommand_Redraw
5F59 CALL DescribeLocation Call DescribeLocation when those scripts moved the player.
Count down one repeat after the redraw.
ObeyCommand_Redraw 5F5C CALL DrawRoomOnce Call DrawRoomOnce.
5F5F LD HL,$5D8E Point HL at RepeatCounter.
5F62 DEC (HL) Count down one repeat.
5F63 JR ObeyCommand_Repeat Jump to ObeyCommand_Repeat.
WET, COOL, DAMP or SOAK only works on the robe, the door or the running water.
ObeyCommand_Wet 5F65 LD A,($5B7F) Only verb 1C (WET, COOL, DAMP or SOAK) continues.
5F68 CP $1C
5F6A JR NZ,RefuseCommand
5F6C LD A,($5B80) The robe, noun B8, is allowed.
5F6F CP $B8
5F71 JR Z,RefuseCommand
5F73 CP $DE The running water, noun DE, is allowed.
5F75 JR Z,RefuseCommand
5F77 CP $D1 The door, noun D1, is allowed.
5F79 JR Z,RefuseCommand
5F7B LD HL,$5F8F Point HL at AbsorbWater.
5F7E LD B,$1B 1B characters.
Print the refusal one character at a time.
ObeyCommand_Water 5F80 LD A,(HL) Fetch this character.
5F81 CALL PlotCharacter Call PlotCharacter.
5F84 INC HL Advance to the next character.
5F85 DJNZ ObeyCommand_Water Jump to ObeyCommand_Water until the sentence is done.
5F87 LD A,$0D Print ENTER.
5F89 CALL PlotCharacter
5F8C JP GameLoop_Act Jump to GameLoop_Act.
Prev: 5F16 Up: Map Next: 5F8F