Prev: E47B Up: Map Next: E4C5
E4A2: Controls: Right/ Down
Used by the routine at Controls_CheckUp.
Did the player press diagonally right/ down?
Controls_CheckRightDown E4A2 CP $05 Jump to Controls_CheckLeftDown if the player didn't press right/ down (01+04=05).
E4A4 JR NZ,Controls_CheckLeftDown
Right/ down movement checks for boundaries and the home box.
E4A6 LD A,($D82D) A=*DestinationCursor_X_Position.
Can the player move right?
E4A9 CP $0F If *DestinationCursor_X_Position is at or beyond the right-most boundary jump to MoveDown_Checks.
E4AB 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 02/ 02:
cursor-02-02
E4AE CP $02 If *DestinationCursor_X_Position is not 02 (which confirms the player can't be inside the home box), jump to MoveRightDown.
E4B0 JR NZ,MoveRightDown
If both the horizontal and the vertical co-ordinates are 02 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.
E4B2 LD A,($D82C) If *DestinationCursor_Y_Position is 02 (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.
E4B5 CP $02
E4B7 JP Z,MoveRight_Checks
Normal right movement.
E4BA LD A,($D82D) 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 E4BD ADD A,$04 Move 04 character blocks right.
E4BF LD ($D82D),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).
E4C2 INC (HL) Increment *HL by one.
E4C3 JR MoveDown_Checks Jump to MoveDown_Checks.
Prev: E47B Up: Map Next: E4C5