Prev: D18E Up: Map Next: D1FA
D19D: Draw a building's outline on the ground
Used by the routine at DRAW_CELLS.
What stands in front of the knight is not drawn as walls, which would hide him: the drawing order (DRAW_CELLS) calls this for his own cell and the three nearer the viewer -- one less in V, one more in U, and both -- and for those only the line where the building's walls meet the ground is drawn, all the way round. The two near faces come from the building definition for this view (OUTLINE_NEAR_FACES), and the two far ones from the definition for the other view, which describes those same walls seen from the other side: from the right-hand corner leftwards, up the screen along one face and down along the other, each column's edge through DRAW_EDGE with C set to 1. Each tile has an edge picture under it (TILE_EDGES): a plain line for a wall, or a stub at one end for a tile with an archway, and C = 1 swaps which end's stub, since those faces are seen from behind. An archway in a wall so leaves a gap in its outline.
Open ground (type 0) has no building. Drawn with OR, and not through the column claims of DRAW_WALLS's walls. Measured: with this routine made to return at once, the white lines on the ground in front of the knight were gone, and with DRAW_WALLS returning at once instead, the walls behind him.
Input
HL the cell, as the drawing order sees it
DRAW_OUTLINE D19D CALL LOOK_UP_CELL The cell's type; open ground: nothing
D1A0 RET Z
D1A1 ADD A,A The type times two, the building table's index for the usual view; DRAW_X and DRAW_Y the cell's corner on the screen (PROJECT_CELL)
D1A2 PUSH AF
D1A3 CALL PROJECT_CELL
D1A6 POP AF
D1A7 PUSH AF
D1A8 LD HL,VIEW Which way round?
D1AB BIT 0,(HL)
D1AD JR NZ,DRAW_OUTLINE_2
D1AF CALL OUTLINE_NEAR_FACES The usual way: the near faces from the usual view's definition, and then the far ones from the turned one's (index plus 1)
D1B2 POP AF
D1B3 OR $01
OUTLINE_FAR_FACES D1B5 LD HL,(DRAW_X) A column back to the left: the far faces start from the right-hand corner, where the near faces ended
D1B8 LD DE,$FFF0
D1BB ADD HL,DE
D1BC LD (DRAW_X),HL
D1BF LD BC,BUILDING_TABLE IY = the other view's definition (BUILDING_TABLE)
D1C2 CALL TABLE_WORD
D1C5 PUSH HL
D1C6 POP IY
D1C8 XOR A Its first face, unmirrored: eight columns leftwards and up the screen, C = 1
D1C9 LD (DRAW_PASS),A
D1CC LD BC,$0801
DRAW_OUTLINE_0 D1CF CALL DRAW_EDGE
D1D2 CALL EDGE_LEFT_UP
D1D5 DJNZ DRAW_OUTLINE_0
D1D7 LD HL,(DRAW_Y) Down 8 lines for the second face, which slopes the other way
D1DA LD DE,$FFF8
D1DD ADD HL,DE
D1DE LD (DRAW_Y),HL
D1E1 LD A,$01 The second face, mirrored: eight columns leftwards and down
D1E3 LD (DRAW_PASS),A
D1E6 LD BC,$0801
DRAW_OUTLINE_1 D1E9 CALL DRAW_EDGE
D1EC CALL EDGE_LEFT_DOWN
D1EF DJNZ DRAW_OUTLINE_1
D1F1 RET
DRAW_OUTLINE_2 D1F2 OR $01 Turned round: the turned definition's faces are the near ones, and the usual view's the far ones
D1F4 CALL OUTLINE_NEAR_FACES
D1F7 POP AF
D1F8 JR OUTLINE_FAR_FACES
Prev: D18E Up: Map Next: D1FA