![]() |
Routines |
| Prev: 9BEA | Up: Map | Next: 9C61 |
|
The edge list is a run of vertex numbers. The first begins a group, each one after it draws a line from that vertex to this one, and $FF ends the group; a second $FF ends the list. Writing it as groups rather than as pairs means a corner shared by three lines is only named once.
The vertex number cannot be known in advance, so as with MARK_ROOM_VISITED the routine writes the instruction that will use it: the displacement in each LD r,(IX+$00) below is overwritten just before it runs.
For room shape $00 the vertices are two nested squares -- (4,187) (4,4) (187,4) (187,187) and (31,160) (31,31) (160,31) (160,160) -- and the groups are 0 to 1,3,4; 2 to 1,3,6; 5 to 1,4,6; 7 to 3,4,6. That is the four outer walls, the four inner ones and the four corner diagonals, each drawn exactly once, which is the "looking into a box" outline every room is built from.
|
||||
| DRAW_OUTLINE | 9C2F | LD A,(HL) | $FF ends the whole list. | |
| 9C30 | INC HL | |||
| 9C31 | CP $FF | |||
| 9C33 | RET Z | |||
| 9C34 | SLA A | Double the vertex number and patch it into both halves of the 16-bit fetch below. | ||
| 9C36 | LD ($9C3F),A | |||
| 9C39 | INC A | |||
| 9C3A | LD ($9C42),A | |||
| FROM_VERTEX_X | 9C3D | LD C,(IX+$00) | Reads as (IX+$00) but the displacements were just rewritten. | |
| FROM_VERTEX_Y | 9C40 | LD B,(IX+$00) | ||
| DRAW_OUTLINE_0 | 9C43 | PUSH BC | ||
| 9C44 | LD A,(HL) | |||
| 9C45 | INC HL | |||
| 9C46 | CP $FF | |||
| 9C48 | JR Z,OUTLINE_DONE | |||
| 9C4A | SLA A | |||
| 9C4C | LD ($9C55),A | TO_VERTEX_X+2: the displacement in the fetch below | ||
| 9C4F | INC A | |||
| 9C50 | LD ($9C58),A | TO_VERTEX_Y+2: likewise | ||
| TO_VERTEX_X | 9C53 | LD E,(IX+$00) | ||
| TO_VERTEX_Y | 9C56 | LD D,(IX+$00) | ||
| 9C59 | PUSH HL | |||
| 9C5A | CALL DRAW_LINE | Draw one line, corner to corner. | ||
| 9C5D | POP HL | |||
| 9C5E | POP BC | |||
| 9C5F | JR DRAW_OUTLINE_0 | |||
| Prev: 9BEA | Up: Map | Next: 9C61 |