Prev: 9918 Up: Map Next: 9A59
99C6: Turn: Apply The Saved Match
Used by the routines at Turn_StepTheScriptPointer and ActionClimb.
Builds the action sentence through Inglish_BuildTheActionSentence and returns when that routine sets the zero flag.
Turn_ApplyTheSavedMatch 99C6 PUSH IX Save the script pointer and call Inglish_BuildTheActionSentence to build the action sentence.
99C8 CALL Inglish_BuildTheActionSentence
99CB JP Z,Turn_ApplyTheSavedMatch_RestoreTheSavedMatch Jump to Turn_ApplyTheSavedMatch_RestoreTheSavedMatch if Inglish_BuildTheActionSentence returned with the zero flag set.
This entry point is used by the routine at Turn_GateTheMessage.
Test the noun-print flag.
Turn_ApplyTheSavedMatch_TestTheNounPrintFlag 99CE LD A,($B6FE) Jump to Turn_ApplyTheSavedMatch_RunTheHandler if *B6FE is 01.
99D1 CP $01
99D3 JR Z,Turn_ApplyTheSavedMatch_RunTheHandler
Test the current action.
99D5 LD A,($B6E7) Jump to Turn_ApplyTheSavedMatch_TestForNoObject if *CurrentAction is not 1E.
99D8 CP $1E
99DA JR NZ,Turn_ApplyTheSavedMatch_TestForNoObject
99DC LD A,($B6F6) Read *B6F6.
99DF LD HL,$C12B Point HL at *C12B.
99E2 CP (HL) Jump to Turn_ApplyTheSavedMatch_RunTheHandler if the script location is not the current location.
99E3 JR NZ,Turn_ApplyTheSavedMatch_RunTheHandler
Test the current object.
Turn_ApplyTheSavedMatch_TestForNoObject 99E5 LD A,($B6E8) Jump to Turn_ApplyTheSavedMatch_PrintTheSentence if *CurrentObject is FF.
99E8 CP $FF
99EA JR Z,Turn_ApplyTheSavedMatch_PrintTheSentence
99EC CALL ObjectFirstLocation Call ObjectFirstLocation to get object first location.
99EF LD ($980D),A Jump to Turn_ApplyTheSavedMatch_PrintTheSentence unless ObjectFirstLocation returned FF.
99F2 CP $FF
99F4 JR NZ,Turn_ApplyTheSavedMatch_PrintTheSentence
99F6 LD BC,($B6F5) Read *B6F5.
99FA LD A,C Jump to Turn_ApplyTheSavedMatch_PrintTheSentence if the script location (*B6F6) is where the player starts (*B6F5).
99FB CP B
99FC JR Z,Turn_ApplyTheSavedMatch_PrintTheSentence
99FE LD B,(IX+$00) Load the copy count into B.
Turn_ApplyTheSavedMatch_TestWhetherTheObjectIsHere 9A01 CP (IX+$10) Jump to Turn_ApplyTheSavedMatch_ReadTheCurrentCharacter if the current object is the object's location.
9A04 JR Z,Turn_ApplyTheSavedMatch_ReadTheCurrentCharacter
9A06 INC IX Step to the next byte of this object.
9A08 DJNZ Turn_ApplyTheSavedMatch_TestWhetherTheObjectIsHere Loop back to Turn_ApplyTheSavedMatch_TestWhetherTheObjectIsHere until every copy's location has been checked.
9A0A JR Turn_ApplyTheSavedMatch_PrintTheSentence Jump to Turn_ApplyTheSavedMatch_PrintTheSentence to describe the action.
Turn_ApplyTheSavedMatch_ReadTheCurrentCharacter 9A0C LD A,($B6EA) Read *CurrentCharacter.
9A0F LD B,A Copy the result into B.
9A10 LD A,$FF Write FF to *CurrentCharacter.
9A12 LD ($B6EA),A
9A15 LD A,$01 Write 01 (day) to *NightDay.
9A17 LD ($B702),A
9A1A PUSH IY Call Inglish_DescribeTheAction to print the sentence for the current action.
9A1C CALL Inglish_DescribeTheAction
9A1F POP IY Clear the time-of-day flag at NightDay.
9A21 SUB A
9A22 LD ($B702),A Update *NightDay.
9A25 LD A,B Use the character whose turn it is again.
9A26 LD ($B6EA),A Update *CurrentCharacter.
9A29 JR Turn_ApplyTheSavedMatch_RunTheHandler Jump to Turn_ApplyTheSavedMatch_RunTheHandler to run the handler, as the action has already been described.
Turn_ApplyTheSavedMatch_PrintTheSentence 9A2B PUSH IY Call Inglish_DescribeTheAction to print the sentence for the current action.
9A2D CALL Inglish_DescribeTheAction
9A30 POP IY
Turn_ApplyTheSavedMatch_RunTheHandler 9A32 CALL Turn_RunTheHandlerIfPresent Call Turn_RunTheHandlerIfPresent to run the handler when one is present.
9A35 LD A,($B6EA) Read *CurrentCharacter.
9A38 LD HL,$B6F6 Point HL at the script location.
9A3B LD DE,$B017 Point DE at B017.
9A3E CALL TurnReportACharacter Call TurnReportACharacter to print a line about another character here.
Test the noun-print flag.
9A41 LD A,($B6FE) Jump to Turn_ApplyTheSavedMatch_ClearTheZeroFlag if *B6FE is 01.
9A44 CP $01
9A46 JR Z,Turn_ApplyTheSavedMatch_ClearTheZeroFlag
9A48 LD A,($B6E8) Read *CurrentObject.
9A4B LD HL,$980D Point HL at 980D.
9A4E LD DE,$B01C Point DE at B01C.
9A51 CALL TurnReportACharacter Call TurnReportACharacter to print a line about another character here.
Turn_ApplyTheSavedMatch_ClearTheZeroFlag 9A54 OR $01 Clear the zero flag.
Turn_ApplyTheSavedMatch_RestoreTheSavedMatch 9A56 POP IX Restore IX from the stack.
9A58 RET Return.
Prev: 9918 Up: Map Next: 9A59