Routines |
Prev: E8D5 | Up: Map | Next: E929 |
Used by the routine at E8D5.
|
||||
This routine sets the general room/viewport movement based on Maroc's updated vertical/horizontal movement speed.
Although the game gives the effect of Maroc moving, he's not; it's actually every other graphic item that's moving in the opposite direction, so we need to change the room position based on the NEGative of Maroc's speed/direction.
First, check if Maroc is in a vertical scrolling tunnel:
|
||||
E8EE | LD A,($EAB7) | Get the current room number | ||
E8F1 | CP $E0 | If >=224, Maroc is in a vertically scrolling tunnel | ||
E8F3 | JR NC,$E923 | |||
Maroc is in a standard room, not a vertical tunnel:
|
||||
E8F5 | LD E,$5A | Default vertical pixel position of the room | ||
E8F7 | LD ($EB4A),A | Store room number | ||
E8FA | LD A,$1C | |||
E8FC | LD ($EB48),A | Default horizontal position of the room, in half character (4 pixel) steps | ||
E8FF | LD A,($EB04) | Calculate and store NEGative value of Maroc's horizontal movement speed (room elements move in the opposite direction to Maroc's controlled movement) | ||
E902 | NEG | |||
E904 | LD ($EB4C),A | |||
E907 | LD A,($EB05) | Calculate and store NEGative value of Maroc's vertical movement speed | ||
E90A | NEG | |||
E90C | LD ($EB4D),A | |||
E90F | CALL $E039 | Run room boundary collision check and adjustment | ||
E912 | LD A,($EB4D) | Copy back the post-boundary check adjusted position to Maroc's vertical position | ||
E915 | NEG | |||
E917 | LD ($EB05),A | |||
E91A | LD A,($EB4C) | Copy back the post-boundary check adjusted position to Maroc's horizontal position | ||
E91D | NEG | |||
E91F | LD ($EB04),A | |||
E922 | RET | Return to the routine at C7D4 | ||
Maroc is in a vertical scrolling tunnel.
The player can't alter Maroc's vertical speed - it's set at max (32):
|
||||
E923 | LD A,$20 | Set Maroc's vertical upward movement speed to maximum (32) | ||
E925 | LD ($EB05),A | |||
E928 | RET | Return to the routine at C7D4 |
Prev: E8D5 | Up: Map | Next: E929 |