Prev: D356 Up: Map Next: D3C2
D372: Draw Cell With Walls
Used by the routine at DrawView.
Draws the walls of a building in a cell of the village, using the lists of strips in StripListTable. The list is chosen from the tile of the cell and ViewRotatedFlag. Nothing is drawn if the cell is empty. A list holds sixteen steps of two strips each, one above the other. They are drawn in two runs of eight, going up and to the right and then down and to the right, with the second run flipped by MirrorFlag, 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 DrawnColumns are set.
Input
HL The cell: the column in L and the row in H
Find the list of strips.
DrawCellWithWalls D372 CALL GetMapCell Call GetMapCell.
D375 RET Z Return if the cell is empty.
D376 LD ($BBC0),A Set WallTile.
D379 ADD A,A Double the tile.
D37A LD HL,$BBBA Add ViewRotatedFlag.
D37D OR (HL)
D37E LD BC,$62A4 Point BC at StripListTable.
D381 CALL GetTableEntry Call GetTableEntry.
D384 PUSH HL Copy the list address to IY (using the stack).
D385 POP IY
Find the position and draw strips as they are.
D387 CALL ProjectCell Call ProjectCell.
D38A XOR A Write 00 to *MirrorFlag.
D38B LD ($BBF2),A
D38E LD B,$08 Set a count of 08.
Draw eight steps going up and to the right.
DrawCellWithWalls_Up D390 CALL DrawWallStrips Call DrawWallStrips.
D393 LD HL,($BBBB) Fetch DrawnColumns.
D396 LD A,L Return if all sixteen bits are set.
D397 AND H
D398 CPL
D399 AND A
D39A RET Z
D39B CALL StepUpRight Call StepUpRight.
D39E DJNZ DrawCellWithWalls_Up Jump to DrawCellWithWalls_Up if there are any left.
Move up by eight pixels to start the second run.
D3A0 LD HL,($BBB8) Move ScreenYPosition up by eight pixels.
D3A3 LD DE,$0008
D3A6 ADD HL,DE
D3A7 LD ($BBB8),HL
Draw the rest of the strips flipped.
D3AA LD A,$01 Write 01 to *MirrorFlag.
D3AC LD ($BBF2),A
D3AF LD B,$08 Set a count of 08.
Draw eight steps going down and to the right.
DrawCellWithWalls_Down D3B1 CALL DrawWallStrips Call DrawWallStrips.
D3B4 LD HL,($BBBB) Fetch DrawnColumns.
D3B7 LD A,L Return if all sixteen bits are set.
D3B8 AND H
D3B9 CPL
D3BA AND A
D3BB RET Z
D3BC CALL StepDownRight Call StepDownRight.
D3BF DJNZ DrawCellWithWalls_Down Jump to DrawCellWithWalls_Down if there are any left.
D3C1 RET Return.
View the equivalent code in;
Prev: D356 Up: Map Next: D3C2