Prev: 58452 Up: Map Next: 58530
58491: Controls: Up
Used by the routine at Controls_CheckDown.
Did the player press up?
Controls_CheckUp 58491 CP 8 Jump to Controls_CheckRightDown if the player didn't press up (8).
58493 JR NZ,Controls_CheckRightDown
Up movement checks for boundaries and the home box.
MoveUp_Checks 58495 LD A,(55340) A=*DestinationCursor_Y_Position.
Can the player move up?
58498 CP 5 If *DestinationCursor_Y_Position is at or beyond the top-most boundary jump to Handler_CursorMovement.
58500 JP M,Handler_CursorMovement
Is the player below the home box?
This is position 2/ 6:
cursor-02-06
58503 CP 6 If *DestinationCursor_Y_Position is not 6 (which confirms the player can't be below the home box), jump to MoveUp.
58505 JR NZ,MoveUp
If the horizontal co-ordinate is 2 and the vertical co-ordinate is 6 then the player is below the home box. As the home box can only be entered from the right side, we treat the bottom side as a boundary and don't allow the player to move through it.
58507 LD A,(55341) Now compare *DestinationCursor_X_Position with 2.
58510 CP 2
58512 JP Z,Handler_CursorMovement If *DestinationCursor_X_Position is 2 (which confirms that yes, the player is below the home box), jump to Handler_CursorMovement to prevent the movement from happening.
Normal up movement.
58515 LD A,(55340) Reload *DestinationCursor_Y_Position into A.
MoveUp 58518 SUB 4 Move 4 rows up.
58520 LD (55340),A Update *DestinationCursor_Y_Position.
Update the tile ID the player has now landed on.
58523 LD A,(HL) Subtract 7 from *HL.
58524 SUB 7
58526 LD (HL),A
58527 JP Handler_CursorMovement Jump to Handler_CursorMovement.
Prev: 58452 Up: Map Next: 58530