![]() |
Routines |
| Prev: 33539 | Up: Map | Next: 33675 |
|
Used by the routine at DrawVerticalEdge.
Works out how much to adjust the drawing of a terrain tile when it is next to a sloping tile. The tile codes 144 to 147 are the four slope tiles; the codes of the two tiles under consideration are held at StartShape and EndShape.
|
||||||||||||||||
| AdjustTerrainSlope | 33607 | LD A,(IX+1) | Fetch the map column of the object. | |||||||||||||
| 33610 | AND A | Test it. | ||||||||||||||
| 33611 | RET Z | Return if it is zero. | ||||||||||||||
| 33612 | LD HL,(23603) | Fetch the two tile codes from StartShape into HL. | ||||||||||||||
| 33615 | LD BC,0 | Clear the adjustment (B) and the extra row count (C). | ||||||||||||||
| 33618 | CALL AdjustTerrainSlope_First | Check the first tile code. | ||||||||||||||
| 33621 | CALL AdjustTerrainSlope_Second | Check the second tile code. | ||||||||||||||
|
Slope tile 145 can add an extra row.
|
||||||||||||||||
| 33624 | LD A,L | Fetch the first tile code. | ||||||||||||||
| 33625 | CP 145 | Jump to AdjustTerrainSlope_Tile93 if it is not slope tile 145. | ||||||||||||||
| 33627 | JR NZ,AdjustTerrainSlope_Tile93 | |||||||||||||||
| 33629 | BIT 7,H | Jump to AdjustTerrainSlope_Tile93 if the second tile code is a special tile (bit 7 is set). | ||||||||||||||
| 33631 | JR NZ,AdjustTerrainSlope_Tile93 | |||||||||||||||
| 33633 | LD A,E | Fetch the direction flag. | ||||||||||||||
| 33634 | AND A | Test it and jump to AdjustTerrainSlope_Tile93 if it is set. | ||||||||||||||
| 33635 | JR NZ,AdjustTerrainSlope_Tile93 | |||||||||||||||
| 33637 | INC C | Add an extra row. | ||||||||||||||
|
Slope tile 147 can add an extra row too.
|
||||||||||||||||
| AdjustTerrainSlope_Tile93 | 33638 | LD A,L | Fetch the first tile code. | |||||||||||||
| 33639 | CP 147 | Jump to AdjustTerrainSlope_Return if it is not slope tile 147. | ||||||||||||||
| 33641 | JR NZ,AdjustTerrainSlope_Return | |||||||||||||||
| 33643 | LD A,(52411) | Fetch the scroll speed from HorizontalSpeed. | ||||||||||||||
| 33646 | AND A | Test it. | ||||||||||||||
| 33647 | JR NZ,AdjustTerrainSlope_AddRow | Jump to AdjustTerrainSlope_AddRow if the screen is scrolling. | ||||||||||||||
| 33649 | LD A,(47757) | Fetch the vertical position from 47757. | ||||||||||||||
| 33652 | AND %00000111 | Test the bottom three bits. | ||||||||||||||
| 33654 | JR Z,AdjustTerrainSlope_Return | Jump to AdjustTerrainSlope_Return if they are all zero. | ||||||||||||||
| AdjustTerrainSlope_AddRow | 33656 | LD A,E | Fetch the direction flag. | |||||||||||||
| 33657 | AND A | Test it. | ||||||||||||||
| 33658 | JR NZ,AdjustTerrainSlope_Return | Jump to AdjustTerrainSlope_Return if it is set. | ||||||||||||||
| 33660 | INC C | Add an extra row. | ||||||||||||||
|
Return the adjusted vertical position and the extra row count.
|
||||||||||||||||
| AdjustTerrainSlope_Return | 33661 | LD HL,(47757) | Fetch the position from 47757 into HL. | |||||||||||||
| 33664 | LD A,L | Add the adjustment in B to the low byte of the position. | ||||||||||||||
| 33665 | ADD A,B | |||||||||||||||
| 33666 | LD L,A | |||||||||||||||
| 33667 | LD A,0 | Clear A, then add the extra row count to it. | ||||||||||||||
| 33669 | ADD A,C | |||||||||||||||
| 33670 | LD C,A | Copy the extra row count back into C. | ||||||||||||||
| 33671 | LD (23588),A | Store the extra row count in ColumnStepSize. | ||||||||||||||
| 33674 | RET | Return. | ||||||||||||||
| Prev: 33539 | Up: Map | Next: 33675 |