Prev: 58491 Up: Map Next: 58565
58530: Controls: Right/ Down
Used by the routine at Controls_CheckUp.
Did the player press diagonally right/ down?
Controls_CheckRightDown 58530 CP 5 Jump to Controls_CheckLeftDown if the player didn't press right/ down (1+4=5).
58532 JR NZ,Controls_CheckLeftDown
Right/ down movement checks for boundaries and the home box.
58534 LD A,(55341) A=*DestinationCursor_X_Position.
Can the player move right?
58537 CP 15 If *DestinationCursor_X_Position is at or beyond the right-most boundary jump to MoveDown_Checks.
58539 JP P,MoveDown_Checks
Is the player inside the home box?
The game restricts this (i.e. this image would never happen), but to demonstrate - this is position 2/ 2:
cursor-02-02
58542 CP 2 If *DestinationCursor_X_Position is not 2 (which confirms the player can't be inside the home box), jump to MoveRightDown.
58544 JR NZ,MoveRightDown
If both the horizontal and the vertical co-ordinates are 2 then the player IS inside the home box. We then jump to MoveRight_Checks to handle the animation of moving out of the home box.
58546 LD A,(55340) If *DestinationCursor_Y_Position is 2 (which confirms that yes, the player is inside the home box), jump to MoveRight_Checks so this routine can handle the rest of the movement update.
58549 CP 2
58551 JP Z,MoveRight_Checks
Normal right movement.
58554 LD A,(55341) Reload *DestinationCursor_X_Position into A.
Note this only handles moving right, it then passes the rest of the movement to MoveDown_Checks for handling moving down.
MoveRightDown 58557 ADD A,4 Move 4 character blocks right.
58559 LD (55341),A Update *DestinationCursor_X_Position.
Update the tile ID the player has now landed on (note, this only covers the "right" movement here - the jump below covers if down should also alter the value).
58562 INC (HL) Increment *HL by one.
58563 JR MoveDown_Checks Jump to MoveDown_Checks.
Prev: 58491 Up: Map Next: 58565