Prev: 36249 Up: Map Next: 36485
36253: Action: Move
Used by the routine at Action_Run.
Moves the current character one step in the commanded direction, if that exit is open. Reached through the action table at ActionTable, dispatched by Turn_RunTheHandlerIfPresent.
Action_Direction 36253 CALL LocationLit Jump to Action_Direction_TestIfInside if LocationLit reports that it is light.
36256 JR NC,Action_Direction_TestIfInside
36258 LD A,9 Roll a random number below 9.
Roll a random number.
36260 CALL GetRandomNumber Call GetRandomNumber to roll a number from the limit in A.
36263 INC A Add one, making the roll 1-9.
36264 LD (46823),A Update *CurrentAction.
This entry point is used by the routines at Action_LeaveIfTheWayIsOpen and ActionUntie.
Action_Direction_TestIfInside 36267 LD IY,(46860) Read *Pointer_CurrentCharacter.
36271 LD A,(IY+1) Read where the character is.
36274 CP 255 Jump to Action_Direction_TotalTheVolume if this character is not inside another object.
36276 JR Z,Action_Direction_TotalTheVolume
Find the object's record.
36278 CALL LocateObject Call LocateObject to locate object.
36281 BIT 6,(IX+7) Jump to Action_Direction_TestForLight if the object is not an animal.
36285 JR Z,Action_Direction_TestForLight
36287 LD (IY+1),255 Mark where this object is as unset.
Action_Direction_TotalTheVolume 36291 LD A,(46826) Read *CurrentCharacter.
36294 CALL Condition_TotalTheVolumeInside Call Condition_TotalTheVolumeInside to total the volume inside the character.
36297 ADD A,(IY+2) Add the character's volume onto the total from Condition_TotalTheVolumeInside.
36300 LD (36252),A Store the character's volume plus the object's volume as the move volume.
36303 LD A,(46823) Read *CurrentAction.
36306 CALL TableFindAnExitInADirection Call TableFindAnExitInADirection to find an exit in the direction in A.
36309 CP 255 Jump to Action_Direction_ReadThisExitDestination if TableFindAnExitInADirection found an exit in that direction.
36311 JR NZ,Action_Direction_ReadThisExitDestination
Action_Direction_TestForLight 36313 CALL LocationLit Jump to ResponseThatWillNotWork if LocationLit reports that it is light.
36316 JP NC,ResponseThatWillNotWork
36319 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the fall is not described.
36322 LD IX,49435 Point IX at 0 - "You".
36326 AND A Clear carry so a zero is shifted into the strength.
36327 LD HL,44413 Point at the message "but fall and hit your head[0x15]" (TextMessages).
36330 RR (IX+5) Shift the player's strength right.
36334 JP NZ,PrintMessage Jump back to PrintMessage unless halving the player's strength left it zero.
36337 LD HL,44426 Point at the message "but fall and smash your skull" (44426).
36340 CALL PrintMessage Call PrintMessage to print message.
36343 JP YouAreDead Jump to YouAreDead to end the game.
Action_Direction_ReadThisExitDestination 36346 LD A,(IX+2) Read this exit's destination.
36349 AND A Jump back to Action_Direction_TestForLight if this exit's destination is zero.
36350 JR Z,Action_Direction_TestForLight
36352 LD (36251),A Store the destination at ActionLocationID.
36355 LD A,(IX+1) Read the object this exit goes via.
36358 CALL Action_CheckTheObjectFlags Call Action_CheckTheObjectFlags to check whether this object can be entered.
36361 DEC A Jump back to Action_Direction_TestForLight when the check returns 1, and the character falls.
36362 JR Z,Action_Direction_TestForLight
36364 DEC A Jump to Action_Direction_TooSmallToEnter when the check returns 2: the way is too small.
36365 JR Z,Action_Direction_TooSmallToEnter
36367 DEC A Jump to Action_Direction_TooFullToEnter when the check returns 3: the way is too full.
36368 JR Z,Action_Direction_TooFullToEnter
This entry point is used by the routine at Object_MoveContents.
Action_Direction_0 36370 CALL ConditionSuppressTheMessage Call ConditionSuppressTheMessage. If the message is held back, the character does not move.
36373 LD (IY+16),B Update the location.
36376 LD A,(46826) Read the character whose turn it is.
36379 CALL Object_MoveContents_0 Call Object_MoveContents_0 to move what is inside the character to the new location.
36382 LD A,(46826) Read the character whose turn it is.
36385 CP 0 Return if the character is not 0 - "You".
36387 RET NZ
36388 LD IX,51086 Call IndexIdTable using the events table, looking for a match with ActionLocationID.
36392 LD A,(36251)
36395 CALL IndexIdTable
36398 JR Z,PercentageLocation Jump to PercentageLocation if no event was found.
36400 LD L,(IX+1) Load the event from the events table.
36403 LD H,(IX+2)
36406 CALL TriggerAction Call TriggerAction to execute it.
This entry point is used by the routine at EventForestriver.
The game adds a one-time only value to the completion percentage once certain locations are reached (as long as it's not dark).
PercentageLocation 36409 CALL LocationLit Return if LocationLit reports that it is dark.
36412 RET C
36413 LD A,(46826) Read the character whose turn it is.
36416 AND A See whether the character whose turn it is is zero.
36417 LD A,(36251) Read the current location.
36420 JR NZ,PercentageLocation_Skip Jump to PercentageLocation_Skip if the character whose turn it is is not zero.
36422 LD HL,(36249) Read the location pointer from ActionLocationData.
36425 BIT 6,(HL) If bit 6 is already (percentage is already added) set jump to YouSeeController.
36427 JP NZ,YouSeeController
36430 SET 6,(HL) Mark the current location data so bit 6 is on.
36432 PUSH AF Call IndexIdTable with PercentageLocationTable.
36433 LD IX,36206
36437 CALL IndexIdTable
36440 JR Z,PercentageLocation_Return Jump to PercentageLocation_Return if there was no match.
36442 PUSH DE Read the low byte of this location's percentage.
36443 LD E,(IX+1)
36446 LD D,(IX+2) Read the high byte of this location's percentage.
36449 LD HL,(46839) Add the percentage value to PercentageComplete and write it.
36452 ADD HL,DE
36453 LD (46839),HL
36456 POP DE
PercentageLocation_Return 36457 POP AF Jump to YouSeePreposition to locate location.
PercentageLocation_Skip 36458 JP YouSeePreposition
Action_Direction_TooSmallToEnter 36461 LD HL,44579 Point at the message "[0x04] is too small for you to enter" (44579).
36464 JR Action_Direction_ReadTheLocationLowByte Jump to Action_Direction_ReadTheLocationLowByte to print "[0x04] is too small for you to enter".
Action_Direction_TooFullToEnter 36466 LD IX,(36249) Point IX at the location record stored at ActionLocationData.
36470 LD HL,44590 Point at the message "[0x04] is too full for you to{5} enter[0x15]" (44590).
Action_Direction_ReadTheLocationLowByte 36473 PUSH HL Save the message address and read the low byte at offset 2 of the location.
36474 LD L,(IX+2)
36477 LD H,(IX+3) Read the high byte at offset 2 of the location.
36480 EX (SP),HL Swap HL with the address on the stack.
36481 CALL PrintMessage Call PrintMessage to print message.
36484 RET Return.
Prev: 36249 Up: Map Next: 36485