Prev: 42922 Up: Map Next: 43377
43118: Event: A Random Half
Used by the routine at Event_TheDeepBog.
Rolls a random half. Below 50 it returns at once; otherwise the boat may glide across the river.
Event_ARandomHalf 43118 LD A,100 Take the roll limit 100.
Roll a random number.
43120 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
43123 CP 50 Compare the roll with 50.
43125 RET Return.
If the message is held back, the boat does not sail.
Reached through the action list of 18 - "Rope" for action 49, dispatched by TriggerAction.
43126 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the boat does not sail.
43129 LD A,(50716) Return if where that object is is not 18.
43132 CP 18
43134 RET NZ
43135 LD HL,44946 Point HL at "the boat glides across the river and lands on this side".
Print the message at HL.
Event_ARandomHalf_PrintMessage 43138 CALL PrintMessage Call PrintMessage to print message.
43141 LD A,(50731) Keep 66, and jump to Event_ARandomHalf_MoveTheBoat if the boat's location is not already 66.
43144 CP 66
43146 LD A,66
43148 JR NZ,Event_ARandomHalf_MoveTheBoat
43150 LD A,67 Take location 67 for the boat.
Event_ARandomHalf_MoveTheBoat 43152 LD (50731),A Store the boat's new location at 50731.
43155 LD B,A Copy the result into B.
43156 LD A,255 Write 255 to *50716.
43158 LD (50716),A
43161 LD A,41 Take the id of 41 - "Wooden Boat".
43163 JP Object_MoveContents_0 Jump to Object_MoveContents_0 to move what is inside object 41 to the boat's new location.
Reached through the action list of 41 - "Wooden Boat" for action 0, dispatched by TriggerAction.
43166 CALL Turn_GateTheMessage Call Turn_GateTheMessage to let the message through or hold it back.
43169 LD A,(46826) Read *CurrentCharacter.
43172 AND A Return if it is not the player's turn.
43173 RET NZ
43174 LD HL,44964 Point HL at "with a lurch the boat glides across the river and[0x02] ngfar".
43177 JR Event_ARandomHalf_PrintMessage Jump back to Event_ARandomHalf_PrintMessage to print "with a lurch the boat glides across the river".
43179 LD A,(46836) Return if the slot flag at 46836 is not 1.
43182 CP 1
43184 RET NZ
43185 SUB A Clear the flag at 46836.
43186 LD (46836),A Store the result at 46836.
43189 INC A Set A to 1 for Inglish_SaveTheClauseAndAct.
43190 CALL Inglish_SaveTheClauseAndAct Call Inglish_SaveTheClauseAndAct to save the clause and act.
43193 RET Z Return if Inglish_SaveTheClauseAndAct returned with the zero flag set.
43194 SUB A Take zero.
43195 LD (46843),A Clear the message-suppressed flag.
43198 LD A,(46822) Read *46822.
43201 LD (51683),A Store the result at 51683.
43204 LD BC,(46824) Read *CurrentObject.
43208 LD (51684),BC Store BC at 51684.
43212 LD A,66 Write 66 to 51682.
43214 LD (51682),A
43217 RET Return.
43218 LD A,(50369) Return if the location of 68 - "Gollum" is not where the player starts.
43221 LD HL,46837
43224 CP (HL)
43225 RET NZ
43226 LD HL,49442 Return if the player is not visible.
43229 BIT 7,(HL)
43231 RET Z
If the message is held back, the glide is not started.
43232 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the glide is not started.
43235 LD HL,(46830) Read *46830.
43238 INC HL Step on through the token held for the printer.
43239 INC HL
43240 LD E,(HL) Read the low byte of the token held for the printer.
43241 INC HL Step to the next byte of the token held for the printer.
43242 LD D,(HL) Read the high byte of the token held for the printer.
43243 PUSH DE Call Response_YouSay to print "You say " and the message.
43244 POP HL
43245 CALL Response_YouSay
43248 LD A,1 Write 1 to *46841.
43250 LD (46841),A
43253 RET Return.
If the message is held back, the random half is not taken.
43254 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the random half is not taken.
43257 SUB A Clear the talk flag at 46841.
43258 LD (46841),A Update *46841.
43261 CALL Inglish_SaveTheClauseAndAct Call Inglish_SaveTheClauseAndAct to save the clause and act.
43264 JR Z,Event_ARandomHalf_HoldTheMessage Jump to Event_ARandomHalf_HoldTheMessage when Inglish_SaveTheClauseAndAct returns with the zero flag set.
43266 LD BC,24 Search 24 bytes of the clause slot for the riddle answer.
43269 LD DE,(46830) Read *46830.
43273 LD A,(DE) Read the first byte of the riddle answer.
Event_ARandomHalf_SearchForTheRiddleAnswer 43274 CPIR Search from HL for this byte of the riddle answer.
43276 JR NZ,Event_ARandomHalf_HoldTheMessage Jump to Event_ARandomHalf_HoldTheMessage if the byte was not found.
43278 INC DE Jump back to Event_ARandomHalf_SearchForTheRiddleAnswer unless the next byte of the riddle answer matches.
43279 LD A,(DE)
43280 DEC DE
43281 CP (HL)
43282 JR NZ,Event_ARandomHalf_SearchForTheRiddleAnswer
43284 RET Return.
If the message is held back, day is not set.
Event_ARandomHalf_HoldTheMessage 43285 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, day is not set.
43288 LD A,1 Set NightDay to 1 (daytime).
43290 LD (46850),A
43293 LD HL,45531 Point at the message "someone strangle(s|d|ing|es) you from behind" (45531).
43296 CALL PrintMessage Call PrintMessage to print message.
43299 JP YouAreDead Jump back to YouAreDead to end the game.
43302 LD A,(50369) Return if that object's location is not where the player starts.
43305 LD HL,46837
43308 CP (HL)
43309 RET NZ
If the message is held back, Gollum's question is not printed.
43310 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, Gollum's question is not printed.
43313 LD HL,45785 Point HL at "what has it got in its pocket(s|d|ing|es) ?".
43316 LD A,8 Roll a random number below 8.
Roll a random number.
43318 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
43321 JP NC,Response_YouSay Jump back to Response_YouSay unless GetRandomNumber negated the roll (carry clear).
43324 LD IX,49946 Jump back to Response_YouSay if 16 - "Valuable Golden Ring" is with 68.
43328 LD A,68
43330 CP (IX+1)
43333 JP Z,Response_YouSay
43336 LD HL,45799 Point HL at "my birthday present".
43339 JP Response_YouSay Jump back to Response_YouSay to print "my birthday present".
43342 LD A,(46838) Read *46838.
43345 LD HL,46837 Return if the script location is not where the player starts.
43348 CP (HL)
43349 RET NZ
If the message is held back, the action code is not stored.
43350 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the action code is not stored.
43353 LD A,27 Write 27 to *CurrentAction.
43355 LD (46823),A
43358 LD A,0 Write 0 to *CurrentObject.
43360 LD (46824),A
43363 LD A,255 Write 255 to *46825.
43365 LD (46825),A
Say that will not work.
43368 CALL ResponseThatWillNotWork Call ResponseThatWillNotWork to answer with that will not work.
43371 CALL Action_AddToThePlayersStrength Call Action_AddToThePlayersStrength to add 10 to the player's strength.
43374 JP YouAreDead Jump to YouAreDead to end the game.
Prev: 42922 Up: Map Next: 43377