Prev: A7AA Up: Map Next: A971
A86E: Event: A Random Half
Used by the routine at Event_TheDeepBog.
Rolls a random half. Below 32 it returns at once; otherwise the boat may glide across the river.
Event_ARandomHalf A86E LD A,$64 Take the roll limit 64.
Roll a random number.
A870 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
A873 CP $32 Compare the roll with 32.
A875 RET Return.
If the message is held back, the boat does not sail.
Reached through the action list of $12 - "Rope" for action 31, dispatched by TriggerAction.
A876 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the boat does not sail.
A879 LD A,($C61C) Return if where that object is is not 12.
A87C CP $12
A87E RET NZ
A87F LD HL,$AF92 Point HL at "the boat glides across the river and lands on this side".
Print the message at HL.
Event_ARandomHalf_PrintMessage A882 CALL PrintMessage Call PrintMessage to print message.
A885 LD A,($C62B) Keep 42, and jump to Event_ARandomHalf_MoveTheBoat if the boat's location is not already 42.
A888 CP $42
A88A LD A,$42
A88C JR NZ,Event_ARandomHalf_MoveTheBoat
A88E LD A,$43 Take location 43 for the boat.
Event_ARandomHalf_MoveTheBoat A890 LD ($C62B),A Store the boat's new location at C62B.
A893 LD B,A Copy the result into B.
A894 LD A,$FF Write FF to *C61C.
A896 LD ($C61C),A
A899 LD A,$29 Take the id of $29 - "Wooden Boat".
A89B JP Object_MoveContents_0 Jump to Object_MoveContents_0 to move what is inside object 29 to the boat's new location.
Reached through the action list of $29 - "Wooden Boat" for action 00, dispatched by TriggerAction.
A89E CALL Turn_GateTheMessage Call Turn_GateTheMessage to let the message through or hold it back.
A8A1 LD A,($B6EA) Read *CurrentCharacter.
A8A4 AND A Return if it is not the player's turn.
A8A5 RET NZ
A8A6 LD HL,$AFA4 Point HL at "with a lurch the boat glides across the river and[0x02] ngfar".
A8A9 JR Event_ARandomHalf_PrintMessage Jump back to Event_ARandomHalf_PrintMessage to print "with a lurch the boat glides across the river".
A8AB LD A,($B6F4) Return if the slot flag at B6F4 is not 01.
A8AE CP $01
A8B0 RET NZ
A8B1 SUB A Clear the flag at B6F4.
A8B2 LD ($B6F4),A Store the result at B6F4.
A8B5 INC A Set A to 01 for Inglish_SaveTheClauseAndAct.
A8B6 CALL Inglish_SaveTheClauseAndAct Call Inglish_SaveTheClauseAndAct to save the clause and act.
A8B9 RET Z Return if Inglish_SaveTheClauseAndAct returned with the zero flag set.
A8BA SUB A Take zero.
A8BB LD ($B6FB),A Clear the message-suppressed flag.
A8BE LD A,($B6E6) Read *B6E6.
A8C1 LD ($C9E3),A Store the result at C9E3.
A8C4 LD BC,($B6E8) Read *CurrentObject.
A8C8 LD ($C9E4),BC Store BC at C9E4.
A8CC LD A,$42 Write 42 to C9E2.
A8CE LD ($C9E2),A
A8D1 RET Return.
A8D2 LD A,($C4C1) Return if the location of $44 - "Gollum" is not where the player starts.
A8D5 LD HL,$B6F5
A8D8 CP (HL)
A8D9 RET NZ
A8DA LD HL,$C122 Return if the player is not visible.
A8DD BIT 7,(HL)
A8DF RET Z
If the message is held back, the glide is not started.
A8E0 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the glide is not started.
A8E3 LD HL,($B6EE) Read *B6EE.
A8E6 INC HL Step on through the token held for the printer.
A8E7 INC HL
A8E8 LD E,(HL) Read the low byte of the token held for the printer.
A8E9 INC HL Step to the next byte of the token held for the printer.
A8EA LD D,(HL) Read the high byte of the token held for the printer.
A8EB PUSH DE Call Response_YouSay to print "You say " and the message.
A8EC POP HL
A8ED CALL Response_YouSay
A8F0 LD A,$01 Write 01 to *B6F9.
A8F2 LD ($B6F9),A
A8F5 RET Return.
If the message is held back, the random half is not taken.
A8F6 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the random half is not taken.
A8F9 SUB A Clear the talk flag at B6F9.
A8FA LD ($B6F9),A Update *B6F9.
A8FD CALL Inglish_SaveTheClauseAndAct Call Inglish_SaveTheClauseAndAct to save the clause and act.
A900 JR Z,Event_ARandomHalf_HoldTheMessage Jump to Event_ARandomHalf_HoldTheMessage when Inglish_SaveTheClauseAndAct returns with the zero flag set.
A902 LD BC,$0018 Search 18 bytes of the clause slot for the riddle answer.
A905 LD DE,($B6EE) Read *B6EE.
A909 LD A,(DE) Read the first byte of the riddle answer.
Event_ARandomHalf_SearchForTheRiddleAnswer A90A CPIR Search from HL for this byte of the riddle answer.
A90C JR NZ,Event_ARandomHalf_HoldTheMessage Jump to Event_ARandomHalf_HoldTheMessage if the byte was not found.
A90E INC DE Jump back to Event_ARandomHalf_SearchForTheRiddleAnswer unless the next byte of the riddle answer matches.
A90F LD A,(DE)
A910 DEC DE
A911 CP (HL)
A912 JR NZ,Event_ARandomHalf_SearchForTheRiddleAnswer
A914 RET Return.
If the message is held back, day is not set.
Event_ARandomHalf_HoldTheMessage A915 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, day is not set.
A918 LD A,$01 Set NightDay to 01 (daytime).
A91A LD ($B702),A
A91D LD HL,$B1DB Point at the message "someone strangle(s|d|ing|es) you from behind" (B1DB).
A920 CALL PrintMessage Call PrintMessage to print message.
A923 JP YouAreDead Jump back to YouAreDead to end the game.
A926 LD A,($C4C1) Return if that object's location is not where the player starts.
A929 LD HL,$B6F5
A92C CP (HL)
A92D RET NZ
If the message is held back, Gollum's question is not printed.
A92E CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, Gollum's question is not printed.
A931 LD HL,$B2D9 Point HL at "what has it got in its pocket(s|d|ing|es) ?".
A934 LD A,$08 Roll a random number below 08.
Roll a random number.
A936 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
A939 JP NC,Response_YouSay Jump back to Response_YouSay unless GetRandomNumber negated the roll (carry clear).
A93C LD IX,$C31A Jump back to Response_YouSay if $10 - "Valuable Golden Ring" is with 44.
A940 LD A,$44
A942 CP (IX+$01)
A945 JP Z,Response_YouSay
A948 LD HL,$B2E7 Point HL at "my birthday present".
A94B JP Response_YouSay Jump back to Response_YouSay to print "my birthday present".
A94E LD A,($B6F6) Read *B6F6.
A951 LD HL,$B6F5 Return if the script location is not where the player starts.
A954 CP (HL)
A955 RET NZ
If the message is held back, the action code is not stored.
A956 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the action code is not stored.
A959 LD A,$1B Write 1B to *CurrentAction.
A95B LD ($B6E7),A
A95E LD A,$00 Write 00 to *CurrentObject.
A960 LD ($B6E8),A
A963 LD A,$FF Write FF to *B6E9.
A965 LD ($B6E9),A
Say that will not work.
A968 CALL ResponseThatWillNotWork Call ResponseThatWillNotWork to answer with that will not work.
A96B CALL Action_AddToThePlayersStrength Call Action_AddToThePlayersStrength to add 0A to the player's strength.
A96E JP YouAreDead Jump to YouAreDead to end the game.
Prev: A7AA Up: Map Next: A971