Prev: 33675 Up: Map Next: 33742
33697: Adjust First Slope Tile
Used by the routine at AdjustTerrainSlope.
Looks at the first tile code of the pair for AdjustTerrainSlope.
Input
C Extra row count
E Direction flag
L Vertical position
Output
B Adjustment
C Updated extra row count
AdjustTerrainSlope_First 33697 LD A,(23603) Fetch the first tile code from StartShape.
33700 CP 144 Jump to AdjustTerrainSlope_First90 if it is slope tile 144.
33702 JR Z,AdjustTerrainSlope_First90
33704 CP 145 Is it slope tile 145?
33706 RET NZ Return if not, as no other tile needs adjusting.
33707 LD A,E Fetch the direction flag.
33708 AND A Test it.
33709 JR Z,AdjustTerrainSlope_Scroll Jump to AdjustTerrainSlope_Scroll if it is clear.
33711 LD B,7 Set the adjustment to 7.
33713 RET Return.
AdjustTerrainSlope_First90 33714 LD B,7 Set the adjustment to 7.
33716 LD A,E Fetch the direction flag.
33717 AND A Test it.
33718 RET Z Return if it is clear.
33719 LD B,0 Clear the adjustment.
33721 LD A,(52411) Fetch the scroll speed from HorizontalSpeed.
33724 BIT 7,A Is the scroll speed negative?
33726 RET NZ Return if so.
33727 AND A Test the scroll speed.
33728 RET Z Return if the screen is not scrolling.
33729 LD A,L Fetch the bottom three bits of the vertical position.
33730 AND 7
33732 JR NZ,AdjustTerrainSlope_Scroll Jump to AdjustTerrainSlope_Scroll if they are not all zero.
33734 INC C Add an extra row.
AdjustTerrainSlope_Scroll 33735 LD A,(52411) Fetch the scroll speed from HorizontalSpeed.
33738 NEG Negate it.
33740 LD B,A Use it as the adjustment.
33741 RET Return.
Prev: 33675 Up: Map Next: 33742