Prev: 38568 Up: Map Next: 38696
38579: 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 38579 PUSH HL Save HL, IX, IY, BC and DE, then call Event_LocationTwentyFive to run the location 37 event.
38580 PUSH IX
38582 PUSH IY
38584 PUSH BC
38585 PUSH DE
38586 CALL Event_LocationTwentyFive
38589 CALL Turn_GateTheMessage_0 Call Turn_GateTheMessage_0 to walk the special-object records.
38592 SUB A Clear the flag at 46832.
38593 LD (46832),A Update *46832.
38596 INC A The other characters start with messages held back.
38597 LD (46843),A Store that in the message-suppressed flag.
38600 LD (46842),A Update *46842.
38603 LD IY,51844 Point IY at the handler table at 51844.
TurnAdvanceTheOtherCharacters_Loop 38607 LD A,(IY+0) Read the id from this handler record.
38610 CP 255 Jump to TurnAdvanceTheOtherCharacters_SetTheDayAndReturn if this handler id is 255.
38612 JR Z,TurnAdvanceTheOtherCharacters_SetTheDayAndReturn
38614 LD A,(IY+1) Read the countdown from this handler record.
38617 CP 0 Jump to TurnAdvanceTheOtherCharacters_StepToTheNext if the countdown is zero.
38619 JR Z,TurnAdvanceTheOtherCharacters_StepToTheNext
38621 DEC A Step the countdown down and jump to TurnAdvanceTheOtherCharacters_TestTheSecondFlag if it has not reached zero.
38622 LD (IY+1),A
38625 CP 0
38627 JR NZ,TurnAdvanceTheOtherCharacters_TestTheSecondFlag
38629 LD A,(46832) Read *46832.
38632 CP 1 Jump to TurnAdvanceTheOtherCharacters_TestTheSecondFlag if the other-characters gate is 1.
38634 LD (IY+1),A
38637 JR Z,TurnAdvanceTheOtherCharacters_TestTheSecondFlag
38639 INC A Count on from the other-characters gate.
38640 LD (46832),A Update *46832.
38643 LD L,(IY+2) Read the low byte of the first handler.
38646 LD H,(IY+3) Read the high byte of the first handler.
Run the handler for this action.
38649 CALL TriggerAction Call TriggerAction to call the handler stored for this action.
38652 JR TurnAdvanceTheOtherCharacters_StepToTheNext Jump to TurnAdvanceTheOtherCharacters_StepToTheNext to update the day flag.
TurnAdvanceTheOtherCharacters_TestTheSecondFlag 38654 LD A,(IY+4) Read the second flag from this handler record.
38657 CP 0 Jump to TurnAdvanceTheOtherCharacters_StepToTheNext if the second flag is zero.
38659 JR Z,TurnAdvanceTheOtherCharacters_StepToTheNext
38661 CP (IY+1) Jump to TurnAdvanceTheOtherCharacters_StepToTheNext if the second flag is below the countdown.
38664 JR C,TurnAdvanceTheOtherCharacters_StepToTheNext
38666 LD L,(IY+5) Read the low byte of the second handler.
38669 LD H,(IY+6) Read the high byte of the second handler.
Run the handler for this action.
38672 CALL TriggerAction Call TriggerAction to call the handler stored for this action.
TurnAdvanceTheOtherCharacters_StepToTheNext 38675 LD DE,7 Step the pointer on by 7 bytes.
38678 ADD IY,DE
38680 JP TurnAdvanceTheOtherCharacters_Loop Jump back to TurnAdvanceTheOtherCharacters_Loop to try the next object.
TurnAdvanceTheOtherCharacters_SetTheDayAndReturn 38683 LD A,1 Write 1 (day) to *NightDay.
38685 LD (46850),A
38688 POP DE Restore DE, BC, IY, IX and HL from the stack.
38689 POP BC
38690 POP IY
38692 POP IX
38694 POP HL
38695 RET Return.
Prev: 38568 Up: Map Next: 38696