Prev: 38900 Up: Map Next: 39192
38911: Turn: Gate The Message
Gates the message. The caller continues only when the message gate and the message-suppressed flag are both set.
Turn_GateTheMessage 38911 PUSH BC Read *46842.
38912 LD BC,(46842)
38916 LD A,C Jump to Turn_GateTheMessage_Return if the message gate and the message-suppressed flag are both set.
38917 AND B
38918 JR NZ,Turn_GateTheMessage_Return
38920 POP BC
Turn_GateTheMessage_Return 38921 POP BC Restore BC from the stack.
38922 RET Return.
38923 NOP Try count for this turn. Turn_GateTheMessage_ClearTheTryCount clears it, Turn_StepTheScriptPointer_CountAnotherTry adds one, and Turn_GateTheMessage_TestTheTryCount stops at 6.
38924 NOP Workspace byte. Action_None_StoreTheDarkFlag writes whether the location is dark.
38925 NOP Result of ObjectFirstLocation, written at 39407 and read at 39499.
This entry point is used by the routine at TurnAdvanceTheOtherCharacters.
Turn_GateTheMessage_0 38926 CALL Action_None Call Action_None, the empty action, before the special objects are walked.
38929 LD IY,51915 Point IY at the special-object records.
Turn_GateTheMessage_ClearTheTryCount 38933 XOR A Clear the try count.
38934 LD (38923),A
38937 LD A,(IY+0) Read the special-object id.
38940 CP 255 Jump to Turn_GateTheMessage_ClearTheCharacterWhoseTurn at the end of the special-object records.
38942 JP Z,Turn_GateTheMessage_ClearTheCharacterWhoseTurn
38945 CP 0 Jump to Turn_GateTheMessage_StepThePointerOnBySevenBytes if this special-object id is zero.
38947 JP Z,Turn_GateTheMessage_StepThePointerOnBySevenBytes
38950 LD (46826),A Update *CurrentCharacter.
38953 CALL ObjectFirstLocation Call ObjectFirstLocation to get object first location.
38956 LD (46860),IX Update *Pointer_CurrentCharacter.
38960 LD (46838),A Update *46838.
38963 SUB A Clear the time-of-day flag at NightDay.
38964 LD (46850),A Update *NightDay.
38967 LD A,(IY+0) Read the special-object id.
38970 PUSH IY Save IY and point it at 0 - "You".
38972 LD IY,49435
38976 CALL Condition_SwapAndRetest Call Condition_SwapAndRetest to swap the objects and test visibility again.
38979 POP IY Jump to Turn_GateTheMessage_TestIfInside if Condition_SwapAndRetest did not find the object visible.
38981 JR Z,Turn_GateTheMessage_TestIfInside
Test the flag.
38983 LD A,(38924) Jump to Turn_GateTheMessage_TestIfInside if *38924 is 2.
38986 CP 2
38988 JR Z,Turn_GateTheMessage_TestIfInside
38990 LD A,1 Write 1 (day) to *NightDay.
38992 LD (46850),A
Test the flag.
38995 LD A,(38924) Jump to Turn_GateTheMessage_TestIfInside if *38924 is not 1.
38998 CP 1
39000 JR NZ,Turn_GateTheMessage_TestIfInside
39002 INC A Count on from the turn phase.
39003 LD (38924),A Store the result at 38924.
Say "you{5} hear a noise".
39006 LD HL,45095 Point HL at the message and call PrintMessage.
39009 CALL PrintMessage
39012 SUB A Clear the time-of-day flag at NightDay.
39013 LD (46850),A Update *NightDay.
Turn_GateTheMessage_TestIfInside 39016 LD A,255 Jump to ActionClimb if this object is inside another object.
39018 CP (IX+1)
39021 JP NZ,ActionClimb
This entry point is used by the routine at ActionClimb.
Turn_GateTheMessage_1 39024 LD IX,(46860) Read *Pointer_CurrentCharacter.
39028 CALL Inglish_KeepTheCharacterSlot Call Inglish_KeepTheCharacterSlot to keep the character slot.
39031 LD A,0 Take zero, and jump to Turn_GateTheMessage_StoreTheSlotFlag unless Inglish_KeepTheCharacterSlot found this character's slot.
39033 JR NZ,Turn_GateTheMessage_StoreTheSlotFlag
39035 INC A Count on from zero.
Turn_GateTheMessage_StoreTheSlotFlag 39036 LD (46836),A Store the slot flag at 46836.
This entry point is used by the routine at Turn_StepTheScriptPointer.
Turn_GateTheMessage_ReadTheScriptPointer 39039 LD L,(IY+2) Read the low byte of the script pointer.
39042 LD H,(IY+3) Read the high byte of the script pointer.
This entry point is used by the routine at Turn_StepTheScriptPointer.
Test the flag.
Turn_GateTheMessage_TestTheTryCount 39045 LD A,(38923) Jump to Turn_GateTheMessage_StepThePointerOnBySevenBytes if the try count is 6.
39048 CP 6
39050 JR Z,Turn_GateTheMessage_StepThePointerOnBySevenBytes
39052 LD A,(HL) Read the next script byte.
39053 LD DE,4 The next field is 0004 bytes on.
39056 PUSH HL Point IX at this script byte.
39057 POP IX
39059 AND 15 Jump to Turn_GateTheMessage_TakeThePointer if the low nibble of the script byte is not below 5.
39061 CP 5
39063 JR NC,Turn_GateTheMessage_TakeThePointer
Test the flag.
39065 LD A,(46836) Jump to Turn_GateTheMessage_TestTheEntryKind if *46836 is not 1.
39068 CP 1
39070 JR NZ,Turn_GateTheMessage_TestTheEntryKind
39072 BIT 6,(HL) Jump to Turn_GateTheMessage_TestTheEntryKind if bit 6 of the script byte is set.
39074 JR NZ,Turn_GateTheMessage_TestTheEntryKind
39076 SUB A Clear the flag at 46836.
39077 LD (46836),A Store the result at 46836.
39080 INC A Set A to 1 for Inglish_SaveTheClauseAndAct.
39081 CALL Inglish_SaveTheClauseAndAct Call Inglish_SaveTheClauseAndAct to save the clause and act.
39084 JR Z,Turn_GateTheMessage_TestTheEntryKind Jump to Turn_GateTheMessage_TestTheEntryKind if Inglish_SaveTheClauseAndAct returned with the zero flag set.
Update the message gate.
39086 LD A,1 Hold messages back: set the message gate and the message-suppressed flag.
39088 LD (46842),A
39091 LD (46843),A
39094 LD HL,39169 Point HL at Turn_GateTheMessage_StepThePointerOnBySevenBytes, where the message routine should return.
39097 PUSH HL Jump to Turn_ApplyTheSavedMatch_TestTheNounPrintFlag to test the noun-print flag.
39098 PUSH IX
39100 JP Turn_ApplyTheSavedMatch_TestTheNounPrintFlag
Turn_GateTheMessage_TestTheEntryKind 39103 LD A,(HL) Jump to Turn_StepTheScriptPointer_StepTwoBytes if the low nibble of the script code is 4.
39104 AND 15
39106 CP 4
39108 JP Z,Turn_StepTheScriptPointer_StepTwoBytes
39111 JR C,Turn_StepTheScriptPointer_RunTheScriptEntry Jump to Turn_StepTheScriptPointer_RunTheScriptEntry if the low nibble of the script code is below 4.
39113 JR Turn_GateTheMessage_StepThePointerOnBySevenBytes Jump to Turn_GateTheMessage_StepThePointerOnBySevenBytes to step on to the next special object.
Turn_GateTheMessage_TakeThePointer 39115 CP 14 Jump to Turn_GateTheMessage_TakeTheCount if the low nibble of the script code is not 14.
39117 JR NZ,Turn_GateTheMessage_TakeTheCount
39119 LD E,(IX+1) Read the next byte of this script.
39122 LD (IY+2),E Store it as the low byte of the script pointer.
39125 LD E,(IX+2) Read the byte after that.
39128 LD (IY+3),E Store it as the high byte of the script pointer.
39131 JR Turn_GateTheMessage_ReadTheScriptPointer Jump back to Turn_GateTheMessage_ReadTheScriptPointer to read the script pointer.
Turn_GateTheMessage_TakeTheCount 39133 CP 12 Jump to Turn_GateTheMessage_PickAtRandom if the low nibble of the script code is not 12.
39135 JR NZ,Turn_GateTheMessage_PickAtRandom
39137 LD B,(IX+1) Read the next script byte into B.
39140 LD A,(IY+0) Read the special-object id.
39143 CALL Turn_UseASpecialObject Call Turn_UseASpecialObject to look the id up as a special object.
39146 JR Turn_GateTheMessage_ReadTheScriptPointer Jump back to Turn_GateTheMessage_ReadTheScriptPointer to read the script pointer.
Turn_GateTheMessage_PickAtRandom 39148 CP 15 Jump to Turn_GateTheMessage_TestForNoCode if this script code is not 15.
39150 JR NZ,Turn_GateTheMessage_TestForNoCode
39152 CALL Turn_PickAScriptEntry Call Turn_PickAScriptEntry to pick a random script entry.
39155 JR Turn_GateTheMessage_ReadTheScriptPointer Jump back to Turn_GateTheMessage_ReadTheScriptPointer to read the script pointer.
Turn_GateTheMessage_TestForNoCode 39157 CP 0 Jump to Turn_GateTheMessage_KeepTheSmaller if this script code is not zero.
39159 JR NZ,Turn_GateTheMessage_KeepTheSmaller
39161 ADD HL,DE Step the script pointer in HL on by 4 bytes.
39162 JR Turn_GateTheMessage_TestTheTryCount Jump back to Turn_GateTheMessage_TestTheTryCount to try the next script entry.
Turn_GateTheMessage_KeepTheSmaller 39164 SUB A Clear E before the locations are compared.
39165 LD E,A Clear E.
39166 CALL Turn_PickAScriptEntry_0 Call Turn_PickAScriptEntry_0 to keep the smaller of the location and the roll.
This entry point is used by the routines at Turn_StepTheScriptPointer and ActionClimb.
Turn_GateTheMessage_StepThePointerOnBySevenBytes 39169 LD DE,7 Step the pointer on by 0007 bytes.
39172 ADD IY,DE
39174 JP Turn_GateTheMessage_ClearTheTryCount Jump back to Turn_GateTheMessage_ClearTheTryCount to try the next special object.
Turn_GateTheMessage_ClearTheCharacterWhoseTurn 39177 SUB A Clear the character whose turn it is.
39178 LD (46826),A Update *CurrentCharacter.
39181 INC A Count on to 1 for the day flag.
39182 LD (46850),A Update *NightDay.
39185 LD HL,49435 Point *Pointer_CurrentCharacter at "You".
39188 LD (46860),HL
39191 RET Return.
Prev: 38900 Up: Map Next: 39192