Prev: 838B Up: Map Next: 83CE
83A1: 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 83A1 LD A,($5C33) Fetch the first tile code from StartShape.
83A4 CP $90 Jump to AdjustTerrainSlope_First90 if it is slope tile 90.
83A6 JR Z,AdjustTerrainSlope_First90
83A8 CP $91 Is it slope tile 91?
83AA RET NZ Return if not, as no other tile needs adjusting.
83AB LD A,E Fetch the direction flag.
83AC AND A Test it.
83AD JR Z,AdjustTerrainSlope_Scroll Jump to AdjustTerrainSlope_Scroll if it is clear.
83AF LD B,$07 Set the adjustment to 07.
83B1 RET Return.
AdjustTerrainSlope_First90 83B2 LD B,$07 Set the adjustment to 07.
83B4 LD A,E Fetch the direction flag.
83B5 AND A Test it.
83B6 RET Z Return if it is clear.
83B7 LD B,$00 Clear the adjustment.
83B9 LD A,($CCBB) Fetch the scroll speed from HorizontalSpeed.
83BC BIT 7,A Is the scroll speed negative?
83BE RET NZ Return if so.
83BF AND A Test the scroll speed.
83C0 RET Z Return if the screen is not scrolling.
83C1 LD A,L Fetch the bottom three bits of the vertical position.
83C2 AND $07
83C4 JR NZ,AdjustTerrainSlope_Scroll Jump to AdjustTerrainSlope_Scroll if they are not all zero.
83C6 INC C Add an extra row.
AdjustTerrainSlope_Scroll 83C7 LD A,($CCBB) Fetch the scroll speed from HorizontalSpeed.
83CA NEG Negate it.
83CC LD B,A Use it as the adjustment.
83CD RET Return.
Prev: 838B Up: Map Next: 83CE