Prev: 96A8 Up: Map Next: 9728
96B3: Turn: Advance The Other Characters
Used by the routine at InglishApplyAMatch.
Gives every other character a turn, running their scripts.
Save the registers used while the other characters take a turn.
TurnAdvanceTheOtherCharacters 96B3 PUSH HL Save HL, IX, IY, BC and DE, then call Event_LocationTwentyFive to run the location 25 event.
96B4 PUSH IX
96B6 PUSH IY
96B8 PUSH BC
96B9 PUSH DE
96BA CALL Event_LocationTwentyFive
96BD CALL Turn_GateTheMessage_0 Call Turn_GateTheMessage_0 to walk the special-object records.
96C0 SUB A Clear the flag at B6F0.
96C1 LD ($B6F0),A Update *B6F0.
96C4 INC A The other characters start with messages held back.
96C5 LD ($B6FB),A Store that in the message-suppressed flag.
96C8 LD ($B6FA),A Update *B6FA.
96CB LD IY,$CA84 Point IY at the handler table at CA84.
TurnAdvanceTheOtherCharacters_Loop 96CF LD A,(IY+$00) Read the id from this handler record.
96D2 CP $FF Jump to TurnAdvanceTheOtherCharacters_SetTheDayAndReturn if this handler id is FF.
96D4 JR Z,TurnAdvanceTheOtherCharacters_SetTheDayAndReturn
96D6 LD A,(IY+$01) Read the countdown from this handler record.
96D9 CP $00 Jump to TurnAdvanceTheOtherCharacters_StepToTheNext if the countdown is zero.
96DB JR Z,TurnAdvanceTheOtherCharacters_StepToTheNext
96DD DEC A Step the countdown down and jump to TurnAdvanceTheOtherCharacters_TestTheSecondFlag if it has not reached zero.
96DE LD (IY+$01),A
96E1 CP $00
96E3 JR NZ,TurnAdvanceTheOtherCharacters_TestTheSecondFlag
96E5 LD A,($B6F0) Read *B6F0.
96E8 CP $01 Jump to TurnAdvanceTheOtherCharacters_TestTheSecondFlag if the other-characters gate is 01.
96EA LD (IY+$01),A
96ED JR Z,TurnAdvanceTheOtherCharacters_TestTheSecondFlag
96EF INC A Count on from the other-characters gate.
96F0 LD ($B6F0),A Update *B6F0.
96F3 LD L,(IY+$02) Read the low byte of the first handler.
96F6 LD H,(IY+$03) Read the high byte of the first handler.
Run the handler for this action.
96F9 CALL TriggerAction Call TriggerAction to call the handler stored for this action.
96FC JR TurnAdvanceTheOtherCharacters_StepToTheNext Jump to TurnAdvanceTheOtherCharacters_StepToTheNext to update the day flag.
TurnAdvanceTheOtherCharacters_TestTheSecondFlag 96FE LD A,(IY+$04) Read the second flag from this handler record.
9701 CP $00 Jump to TurnAdvanceTheOtherCharacters_StepToTheNext if the second flag is zero.
9703 JR Z,TurnAdvanceTheOtherCharacters_StepToTheNext
9705 CP (IY+$01) Jump to TurnAdvanceTheOtherCharacters_StepToTheNext if the second flag is below the countdown.
9708 JR C,TurnAdvanceTheOtherCharacters_StepToTheNext
970A LD L,(IY+$05) Read the low byte of the second handler.
970D LD H,(IY+$06) Read the high byte of the second handler.
Run the handler for this action.
9710 CALL TriggerAction Call TriggerAction to call the handler stored for this action.
TurnAdvanceTheOtherCharacters_StepToTheNext 9713 LD DE,$0007 Step the pointer on by 07 bytes.
9716 ADD IY,DE
9718 JP TurnAdvanceTheOtherCharacters_Loop Jump back to TurnAdvanceTheOtherCharacters_Loop to try the next object.
TurnAdvanceTheOtherCharacters_SetTheDayAndReturn 971B LD A,$01 Write 01 (day) to *NightDay.
971D LD ($B702),A
9720 POP DE Restore DE, BC, IY, IX and HL from the stack.
9721 POP BC
9722 POP IY
9724 POP IX
9726 POP HL
9727 RET Return.
Prev: 96A8 Up: Map Next: 9728