Prev: 50343 Up: Map Next: 50587
50507: 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 50507 CALL GetMapCell Call GetMapCell.
50510 RET Z Return if the cell is empty.
50511 LD (41555),A Set CellCode.
50514 ADD A,A Double the code.
50515 LD HL,41576 Add ViewRotation.
50518 OR (HL)
50519 LD BC,25196 Point BC at TileListPointers.
50522 CALL GetTableEntry Call GetTableEntry.
50525 PUSH HL Copy the list address to IY (using the stack).
50526 POP IY
Find the position and draw tiles as they are.
50528 CALL ProjectCell Call ProjectCell.
50531 XOR A Write 0 to *FlipFlag.
50532 LD (41554),A
50535 LD B,8 Set a count of 8.
Draw eight steps going down and to the right.
DrawCellWithWalls_Down 50537 CALL DrawWallStrips Call DrawWallStrips.
50540 LD HL,(41544) Fetch ColumnFlags.
50543 LD A,L Return if all sixteen bits are set.
50544 AND H
50545 CPL
50546 AND A
50547 RET Z
50548 CALL StepDownRightKeepList Call StepDownRightKeepList.
50551 DJNZ DrawCellWithWalls_Down Jump to DrawCellWithWalls_Down if there are any left.
Move up by eight pixels to start the second run.
50553 LD HL,(41552) Move ScreenVerticalPosition up by eight pixels.
50556 LD DE,8
50559 ADD HL,DE
50560 LD (41552),HL
Draw the rest of the tiles flipped.
50563 LD A,1 Write 1 to *FlipFlag.
50565 LD (41554),A
50568 LD B,8 Set a count of 8.
Draw eight steps going up and to the right.
DrawCellWithWalls_Up 50570 CALL DrawWallStrips Call DrawWallStrips.
50573 LD HL,(41544) Fetch ColumnFlags.
50576 LD A,L Return if all sixteen bits are set.
50577 AND H
50578 CPL
50579 AND A
50580 RET Z
50581 CALL StepUpRightKeepList Call StepUpRightKeepList.
50584 DJNZ DrawCellWithWalls_Up Jump to DrawCellWithWalls_Up if there are any left.
50586 RET Return.
View the equivalent code in;
Prev: 50343 Up: Map Next: 50587