![]() |
Routines |
| Prev: 8D99 | Up: Map | Next: 8E85 |
|
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 | 8D9D | CALL LocationLit | Jump to Action_Direction_TestIfInside if LocationLit reports that it is light. | |
| 8DA0 | JR NC,Action_Direction_TestIfInside | |||
| 8DA2 | LD A,$09 | Roll a random number below 09. | ||
|
Roll a random number.
|
||||
| 8DA4 | CALL GetRandomNumber | Call GetRandomNumber to roll a number from the limit in A. | ||
| 8DA7 | INC A | Add one, making the roll 01-09. | ||
| 8DA8 | LD ($B6E7),A | Update *CurrentAction. | ||
|
This entry point is used by the routines at Action_LeaveIfTheWayIsOpen and ActionUntie.
|
||||
| Action_Direction_TestIfInside | 8DAB | LD IY,($B70C) | Read *Pointer_CurrentCharacter. | |
| 8DAF | LD A,(IY+$01) | Read where the character is. | ||
| 8DB2 | CP $FF | Jump to Action_Direction_TotalTheVolume if this character is not inside another object. | ||
| 8DB4 | JR Z,Action_Direction_TotalTheVolume | |||
|
Find the object's record.
|
||||
| 8DB6 | CALL LocateObject | Call LocateObject to locate object. | ||
| 8DB9 | BIT 6,(IX+$07) | Jump to Action_Direction_TestForLight if the object is not an animal. | ||
| 8DBD | JR Z,Action_Direction_TestForLight | |||
| 8DBF | LD (IY+$01),$FF | Mark where this object is as unset. | ||
| Action_Direction_TotalTheVolume | 8DC3 | LD A,($B6EA) | Read *CurrentCharacter. | |
| 8DC6 | CALL Condition_TotalTheVolumeInside | Call Condition_TotalTheVolumeInside to total the volume inside the character. | ||
| 8DC9 | ADD A,(IY+$02) | Add the character's volume onto the total from Condition_TotalTheVolumeInside. | ||
| 8DCC | LD ($8D9C),A | Store the character's volume plus the object's volume as the move volume. | ||
| 8DCF | LD A,($B6E7) | Read *CurrentAction. | ||
| 8DD2 | CALL TableFindAnExitInADirection | Call TableFindAnExitInADirection to find an exit in the direction in A. | ||
| 8DD5 | CP $FF | Jump to Action_Direction_ReadThisExitDestination if TableFindAnExitInADirection found an exit in that direction. | ||
| 8DD7 | JR NZ,Action_Direction_ReadThisExitDestination | |||
| Action_Direction_TestForLight | 8DD9 | CALL LocationLit | Jump to ResponseThatWillNotWork if LocationLit reports that it is light. | |
| 8DDC | JP NC,ResponseThatWillNotWork | |||
| 8DDF | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the fall is not described. | ||
| 8DE2 | LD IX,$C11B | Point IX at $00 - "You". | ||
| 8DE6 | AND A | Clear carry so a zero is shifted into the strength. | ||
| 8DE7 | LD HL,$AD7D | Point at the message "but fall and hit your head[0x15]" (TextMessages). | ||
| 8DEA | RR (IX+$05) | Shift the player's strength right. | ||
| 8DEE | JP NZ,PrintMessage | Jump back to PrintMessage unless halving the player's strength left it zero. | ||
| 8DF1 | LD HL,$AD8A | Point at the message "but fall and smash your skull" (AD8A). | ||
| 8DF4 | CALL PrintMessage | Call PrintMessage to print message. | ||
| 8DF7 | JP YouAreDead | Jump to YouAreDead to end the game. | ||
| Action_Direction_ReadThisExitDestination | 8DFA | LD A,(IX+$02) | Read this exit's destination. | |
| 8DFD | AND A | Jump back to Action_Direction_TestForLight if this exit's destination is zero. | ||
| 8DFE | JR Z,Action_Direction_TestForLight | |||
| 8E00 | LD ($8D9B),A | Store the destination at ActionLocationID. | ||
| 8E03 | LD A,(IX+$01) | Read the object this exit goes via. | ||
| 8E06 | CALL Action_CheckTheObjectFlags | Call Action_CheckTheObjectFlags to check whether this object can be entered. | ||
| 8E09 | DEC A | Jump back to Action_Direction_TestForLight when the check returns 01, and the character falls. | ||
| 8E0A | JR Z,Action_Direction_TestForLight | |||
| 8E0C | DEC A | Jump to Action_Direction_TooSmallToEnter when the check returns 02: the way is too small. | ||
| 8E0D | JR Z,Action_Direction_TooSmallToEnter | |||
| 8E0F | DEC A | Jump to Action_Direction_TooFullToEnter when the check returns 03: the way is too full. | ||
| 8E10 | JR Z,Action_Direction_TooFullToEnter | |||
|
This entry point is used by the routine at Object_MoveContents.
|
||||
| Action_Direction_0 | 8E12 | CALL ConditionSuppressTheMessage | Call ConditionSuppressTheMessage. If the message is held back, the character does not move. | |
| 8E15 | LD (IY+$10),B | Update the location. | ||
| 8E18 | LD A,($B6EA) | Read the character whose turn it is. | ||
| 8E1B | CALL Object_MoveContents_0 | Call Object_MoveContents_0 to move what is inside the character to the new location. | ||
| 8E1E | LD A,($B6EA) | Read the character whose turn it is. | ||
| 8E21 | CP $00 | Return if the character is not $00 - "You". | ||
| 8E23 | RET NZ | |||
| 8E24 | LD IX,$C78E | Call IndexIdTable using the events table, looking for a match with ActionLocationID. | ||
| 8E28 | LD A,($8D9B) | |||
| 8E2B | CALL IndexIdTable | |||
| 8E2E | JR Z,PercentageLocation | Jump to PercentageLocation if no event was found. | ||
| 8E30 | LD L,(IX+$01) | Load the event from the events table. | ||
| 8E33 | LD H,(IX+$02) | |||
| 8E36 | 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 | 8E39 | CALL LocationLit | Return if LocationLit reports that it is dark. | |
| 8E3C | RET C | |||
| 8E3D | LD A,($B6EA) | Read the character whose turn it is. | ||
| 8E40 | AND A | See whether the character whose turn it is is zero. | ||
| 8E41 | LD A,($8D9B) | Read the current location. | ||
| 8E44 | JR NZ,PercentageLocation_Skip | Jump to PercentageLocation_Skip if the character whose turn it is is not zero. | ||
| 8E46 | LD HL,($8D99) | Read the location pointer from ActionLocationData. | ||
| 8E49 | BIT 6,(HL) | If bit 6 is already (percentage is already added) set jump to YouSeeController. | ||
| 8E4B | JP NZ,YouSeeController | |||
| 8E4E | SET 6,(HL) | Mark the current location data so bit 6 is on. | ||
| 8E50 | PUSH AF | Call IndexIdTable with PercentageLocationTable. | ||
| 8E51 | LD IX,$8D6E | |||
| 8E55 | CALL IndexIdTable | |||
| 8E58 | JR Z,PercentageLocation_Return | Jump to PercentageLocation_Return if there was no match. | ||
| 8E5A | PUSH DE | Read the low byte of this location's percentage. | ||
| 8E5B | LD E,(IX+$01) | |||
| 8E5E | LD D,(IX+$02) | Read the high byte of this location's percentage. | ||
| 8E61 | LD HL,($B6F7) | Add the percentage value to PercentageComplete and write it. | ||
| 8E64 | ADD HL,DE | |||
| 8E65 | LD ($B6F7),HL | |||
| 8E68 | POP DE | |||
| PercentageLocation_Return | 8E69 | POP AF | Jump to YouSeePreposition to locate location. | |
| PercentageLocation_Skip | 8E6A | JP YouSeePreposition | ||
| Action_Direction_TooSmallToEnter | 8E6D | LD HL,$AE23 | Point at the message "[0x04] is too small for you to enter" (AE23). | |
| 8E70 | JR Action_Direction_ReadTheLocationLowByte | Jump to Action_Direction_ReadTheLocationLowByte to print "[0x04] is too small for you to enter". | ||
| Action_Direction_TooFullToEnter | 8E72 | LD IX,($8D99) | Point IX at the location record stored at ActionLocationData. | |
| 8E76 | LD HL,$AE2E | Point at the message "[0x04] is too full for you to{5} enter[0x15]" (AE2E). | ||
| Action_Direction_ReadTheLocationLowByte | 8E79 | PUSH HL | Save the message address and read the low byte at offset 2 of the location. | |
| 8E7A | LD L,(IX+$02) | |||
| 8E7D | LD H,(IX+$03) | Read the high byte at offset 2 of the location. | ||
| 8E80 | EX (SP),HL | Swap HL with the address on the stack. | ||
| 8E81 | CALL PrintMessage | Call PrintMessage to print message. | ||
| 8E84 | RET | Return. | ||
| Prev: 8D99 | Up: Map | Next: 8E85 |