Prev: 39192 Up: Map Next: 39513
39366: 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 39366 PUSH IX Save the script pointer and call Inglish_BuildTheActionSentence to build the action sentence.
39368 CALL Inglish_BuildTheActionSentence
39371 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 39374 LD A,(46846) Jump to Turn_ApplyTheSavedMatch_RunTheHandler if *46846 is 1.
39377 CP 1
39379 JR Z,Turn_ApplyTheSavedMatch_RunTheHandler
Test the current action.
39381 LD A,(46823) Jump to Turn_ApplyTheSavedMatch_TestForNoObject if *CurrentAction is not 30.
39384 CP 30
39386 JR NZ,Turn_ApplyTheSavedMatch_TestForNoObject
39388 LD A,(46838) Read *46838.
39391 LD HL,49451 Point HL at *49451.
39394 CP (HL) Jump to Turn_ApplyTheSavedMatch_RunTheHandler if the script location is not the current location.
39395 JR NZ,Turn_ApplyTheSavedMatch_RunTheHandler
Test the current object.
Turn_ApplyTheSavedMatch_TestForNoObject 39397 LD A,(46824) Jump to Turn_ApplyTheSavedMatch_PrintTheSentence if *CurrentObject is 255.
39400 CP 255
39402 JR Z,Turn_ApplyTheSavedMatch_PrintTheSentence
39404 CALL ObjectFirstLocation Call ObjectFirstLocation to get object first location.
39407 LD (38925),A Jump to Turn_ApplyTheSavedMatch_PrintTheSentence unless ObjectFirstLocation returned 255.
39410 CP 255
39412 JR NZ,Turn_ApplyTheSavedMatch_PrintTheSentence
39414 LD BC,(46837) Read *46837.
39418 LD A,C Jump to Turn_ApplyTheSavedMatch_PrintTheSentence if the script location (*46838) is where the player starts (*46837).
39419 CP B
39420 JR Z,Turn_ApplyTheSavedMatch_PrintTheSentence
39422 LD B,(IX+0) Load the copy count into B.
Turn_ApplyTheSavedMatch_TestWhetherTheObjectIsHere 39425 CP (IX+16) Jump to Turn_ApplyTheSavedMatch_ReadTheCurrentCharacter if the current object is the object's location.
39428 JR Z,Turn_ApplyTheSavedMatch_ReadTheCurrentCharacter
39430 INC IX Step to the next byte of this object.
39432 DJNZ Turn_ApplyTheSavedMatch_TestWhetherTheObjectIsHere Loop back to Turn_ApplyTheSavedMatch_TestWhetherTheObjectIsHere until every copy's location has been checked.
39434 JR Turn_ApplyTheSavedMatch_PrintTheSentence Jump to Turn_ApplyTheSavedMatch_PrintTheSentence to describe the action.
Turn_ApplyTheSavedMatch_ReadTheCurrentCharacter 39436 LD A,(46826) Read *CurrentCharacter.
39439 LD B,A Copy the result into B.
39440 LD A,255 Write 255 to *CurrentCharacter.
39442 LD (46826),A
39445 LD A,1 Write 1 (day) to *NightDay.
39447 LD (46850),A
39450 PUSH IY Call Inglish_DescribeTheAction to print the sentence for the current action.
39452 CALL Inglish_DescribeTheAction
39455 POP IY Clear the time-of-day flag at NightDay.
39457 SUB A
39458 LD (46850),A Update *NightDay.
39461 LD A,B Use the character whose turn it is again.
39462 LD (46826),A Update *CurrentCharacter.
39465 JR Turn_ApplyTheSavedMatch_RunTheHandler Jump to Turn_ApplyTheSavedMatch_RunTheHandler to run the handler, as the action has already been described.
Turn_ApplyTheSavedMatch_PrintTheSentence 39467 PUSH IY Call Inglish_DescribeTheAction to print the sentence for the current action.
39469 CALL Inglish_DescribeTheAction
39472 POP IY
Turn_ApplyTheSavedMatch_RunTheHandler 39474 CALL Turn_RunTheHandlerIfPresent Call Turn_RunTheHandlerIfPresent to run the handler when one is present.
39477 LD A,(46826) Read *CurrentCharacter.
39480 LD HL,46838 Point HL at the script location.
39483 LD DE,45079 Point DE at 45079.
39486 CALL TurnReportACharacter Call TurnReportACharacter to print a line about another character here.
Test the noun-print flag.
39489 LD A,(46846) Jump to Turn_ApplyTheSavedMatch_ClearTheZeroFlag if *46846 is 1.
39492 CP 1
39494 JR Z,Turn_ApplyTheSavedMatch_ClearTheZeroFlag
39496 LD A,(46824) Read *CurrentObject.
39499 LD HL,38925 Point HL at 38925.
39502 LD DE,45084 Point DE at 45084.
39505 CALL TurnReportACharacter Call TurnReportACharacter to print a line about another character here.
Turn_ApplyTheSavedMatch_ClearTheZeroFlag 39508 OR 1 Clear the zero flag.
Turn_ApplyTheSavedMatch_RestoreTheSavedMatch 39510 POP IX Restore IX from the stack.
39512 RET Return.
Prev: 39192 Up: Map Next: 39513