Prev: 54102 Up: Map Next: 54210
54130: 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 54130 CALL GetMapCell Call GetMapCell.
54133 RET Z Return if the cell is empty.
54134 LD (48064),A Set WallTile.
54137 ADD A,A Double the tile.
54138 LD HL,48058 Add ViewRotatedFlag.
54141 OR (HL)
54142 LD BC,25252 Point BC at StripListTable.
54145 CALL GetTableEntry Call GetTableEntry.
54148 PUSH HL Copy the list address to IY (using the stack).
54149 POP IY
Find the position and draw strips as they are.
54151 CALL ProjectCell Call ProjectCell.
54154 XOR A Write 0 to *MirrorFlag.
54155 LD (48114),A
54158 LD B,8 Set a count of 8.
Draw eight steps going up and to the right.
DrawCellWithWalls_Up 54160 CALL DrawWallStrips Call DrawWallStrips.
54163 LD HL,(48059) Fetch DrawnColumns.
54166 LD A,L Return if all sixteen bits are set.
54167 AND H
54168 CPL
54169 AND A
54170 RET Z
54171 CALL StepUpRight Call StepUpRight.
54174 DJNZ DrawCellWithWalls_Up Jump to DrawCellWithWalls_Up if there are any left.
Move up by eight pixels to start the second run.
54176 LD HL,(48056) Move ScreenYPosition up by eight pixels.
54179 LD DE,8
54182 ADD HL,DE
54183 LD (48056),HL
Draw the rest of the strips flipped.
54186 LD A,1 Write 1 to *MirrorFlag.
54188 LD (48114),A
54191 LD B,8 Set a count of 8.
Draw eight steps going down and to the right.
DrawCellWithWalls_Down 54193 CALL DrawWallStrips Call DrawWallStrips.
54196 LD HL,(48059) Fetch DrawnColumns.
54199 LD A,L Return if all sixteen bits are set.
54200 AND H
54201 CPL
54202 AND A
54203 RET Z
54204 CALL StepDownRight Call StepDownRight.
54207 DJNZ DrawCellWithWalls_Down Jump to DrawCellWithWalls_Down if there are any left.
54209 RET Return.
View the equivalent code in;
Prev: 54102 Up: Map Next: 54210