Prev: C4A7 Up: Map Next: C59B
C54B: Draw Cell With Walls
Used by the routine at DrawTown.
Draws the walls of a building in a cell of the town, using the lists of tiles in TileListPointers. The list is chosen from the code of the cell and ViewRotation. Nothing is drawn if the cell is empty. A list holds sixteen steps of two tiles each, one above the other. They are drawn in two runs of eight, going down and to the right and then up and to the right, with the second run flipped by FlipFlag, to make the two walls which can be seen. Each step is drawn by DrawWallStrips, and nothing more is drawn when all of the bits in ColumnFlags are set.
Input
HL The cell: the column in L and the row in H
Find the list of tiles.
DrawCellWithWalls C54B CALL GetMapCell Call GetMapCell.
C54E RET Z Return if the cell is empty.
C54F LD ($A253),A Set CellCode.
C552 ADD A,A Double the code.
C553 LD HL,$A268 Add ViewRotation.
C556 OR (HL)
C557 LD BC,$626C Point BC at TileListPointers.
C55A CALL GetTableEntry Call GetTableEntry.
C55D PUSH HL Copy the list address to IY (using the stack).
C55E POP IY
Find the position and draw tiles as they are.
C560 CALL ProjectCell Call ProjectCell.
C563 XOR A Write 00 to *FlipFlag.
C564 LD ($A252),A
C567 LD B,$08 Set a count of 08.
Draw eight steps going down and to the right.
DrawCellWithWalls_Down C569 CALL DrawWallStrips Call DrawWallStrips.
C56C LD HL,($A248) Fetch ColumnFlags.
C56F LD A,L Return if all sixteen bits are set.
C570 AND H
C571 CPL
C572 AND A
C573 RET Z
C574 CALL StepDownRightKeepList Call StepDownRightKeepList.
C577 DJNZ DrawCellWithWalls_Down Jump to DrawCellWithWalls_Down if there are any left.
Move up by eight pixels to start the second run.
C579 LD HL,($A250) Move ScreenVerticalPosition up by eight pixels.
C57C LD DE,$0008
C57F ADD HL,DE
C580 LD ($A250),HL
Draw the rest of the tiles flipped.
C583 LD A,$01 Write 01 to *FlipFlag.
C585 LD ($A252),A
C588 LD B,$08 Set a count of 08.
Draw eight steps going up and to the right.
DrawCellWithWalls_Up C58A CALL DrawWallStrips Call DrawWallStrips.
C58D LD HL,($A248) Fetch ColumnFlags.
C590 LD A,L Return if all sixteen bits are set.
C591 AND H
C592 CPL
C593 AND A
C594 RET Z
C595 CALL StepUpRightKeepList Call StepUpRightKeepList.
C598 DJNZ DrawCellWithWalls_Up Jump to DrawCellWithWalls_Up if there are any left.
C59A RET Return.
View the equivalent code in;
Prev: C4A7 Up: Map Next: C59B