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 to take an exit in the direction just typed.
5F34 LD A,($5B7A) A matched exit is remembered as a room change, and the scripts are not run.
5F37 LD ($5B95),A
5F3A OR A
5F3B JR NZ,GameLoop_Act
5F3D CALL RunScripts Call RunScripts to run the ordinary command scripts.
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 Run the high-priority scripts again without keeping the old room-changed flag.
5F4D LD ($5B95),A
5F50 CALL RunPriorityScripts
5F53 LD A,($5B95)
5F56 OR A
5F57 JR Z,ObeyCommand_Redraw
5F59 CALL DescribeLocation Call DescribeLocation when those scripts moved the player.
ObeyCommand_Redraw 5F5C CALL DrawRoomOnce Redraw, then count down one repeat.
5F5F LD HL,$5D8E
5F62 DEC (HL)
5F63 JR 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 The sentence at AbsorbWater is 1B characters.
5F7E LD B,$1B
ObeyCommand_Water 5F80 LD A,(HL) Print one character of it.
5F81 CALL PlotCharacter
5F84 INC HL
5F85 DJNZ ObeyCommand_Water
5F87 LD A,$0D Finish that sentence with ENTER and take another turn.
5F89 CALL PlotCharacter
5F8C JP GameLoop_Act
Prev: 5F16 Up: Map Next: 5F8F