Prev: 9A85 Up: Map Next: 9ACD
9AA0: Switch a character to the script it keeps for an action
Used by the routines at REACT_TO_ACTION and CHARACTERS_ACT.
Looks the action up in the character's own script table with FIND_RECORD, and if it has a script for it, sends the character there. The script opcode $0C uses it, and so does REACT_TO_ACTION: whenever an action is done to a character, it reacts. That is what the entries after the first few in each table are for -- Gandalf's and Thorin's have scripts for being given something ($1D), captured ($30) and attacked ($0F).
Input
A The character
B The action
REACT 9AA0 PUSH IY
9AA2 PUSH IX
9AA4 CALL FIND_CHARACTER Not in CHARACTERS: nothing to do
9AA7 CP $FF
9AA9 JR Z,REACT_0
9AAB LD L,(IY+$04) Its script for this action, if it has one
9AAE LD H,(IY+$05)
9AB1 PUSH HL
9AB2 POP IX
9AB4 LD A,B
9AB5 CALL FIND_RECORD
9AB8 CP $FF
9ABA JR Z,REACT_0
9ABC LD L,(IX+$01) Go there
9ABF LD H,(IX+$02)
9AC2 LD (IY+$02),L
9AC5 LD (IY+$03),H
REACT_0 9AC8 POP IX
9ACA POP IY
9ACC RET
Prev: 9A85 Up: Map Next: 9ACD