Prev: C7A8 Up: Map Next: C802
C7AD: The first pillar of an arch (graphics 6 and 8)
This pillar is the doorway. It works out the point in the middle of the arch, 13 from itself along the wall, and keeps it in its own +$09 to +$0B -- the step fields, which a pillar never needs, borrowed because IS_NEAR_TO compares +$09 to +$0B of one record with +$01 to +$03 of another. Then HANDLE_EXIT_SCREEN lets the player out of the room if he is in the doorway and past the wall, and ARCH_NUDGE_TO_CENTRE nudges him onto the arch's middle line if he is near it.
An arch in a wall of constant U (not mirrored) has its other pillar 13 further along V, and its doorway reaches 15 either way in U and 6 in V; one in a wall of constant V (mirrored) has its other pillar 13 back along U, and a doorway 6 in U and 15 in V.
A pillar's +$08 is not the room it stands in: the builder (BUILD_ROOM) gives every piece of a scenery entry the byte after the entry, which for a doorway is the room it leads to.
Input
IX The pillar's record
FIRST_PILLAR C7AD BIT 6,(IX+$07) Mirrored: an arch in a wall of constant V
C7B1 JR NZ,FIRST_PILLAR_0
C7B3 LD A,(IX+$00) Graphic 8 has an offset of its own
C7B6 CP $08
C7B8 JR Z,FIRST_PILLAR_EIGHT
C7BA LD HL,$FBFB Graphic 6, not mirrored: X -5, Y -5
This entry point is used by the routine at FIRST_PILLAR_EIGHT.
ARCH_ALONG_U C7BD CALL SET_PIXEL_ADJ Set the offset
C7C0 LD A,(IX+$02) V of the middle: this pillar's plus 13
C7C3 ADD A,$0D
C7C5 LD (IX+$0A),A
C7C8 LD A,(IX+$01) U of the middle: this pillar's
C7CB LD (IX+$09),A
C7CE LD HL,$060F The doorway: U within 15, V within 6
ARCH_CHECK_DOORWAY C7D1 LD A,(IX+$03) Z of the middle: the pillar's base
C7D4 LD (IX+$0B),A
C7D7 CALL HANDLE_EXIT_SCREEN In the doorway and past the wall: out of the room, and no return
C7DA JP ARCH_NUDGE_TO_CENTRE Near it: nudge towards the middle
FIRST_PILLAR_0 C7DD LD A,(IX+$00) Mirrored: graphic 8 has an offset of its own
C7E0 CP $08
C7E2 JR Z,FIRST_PILLAR_1
C7E4 LD HL,$FAEF Graphic 6, mirrored: X -17, Y -6
ARCH_ALONG_V C7E7 CALL SET_PIXEL_ADJ Set the offset
C7EA LD A,(IX+$01) U of the middle: this pillar's less 13
C7ED SUB $0D
C7EF LD (IX+$09),A
C7F2 LD A,(IX+$02) V of the middle: this pillar's
C7F5 LD (IX+$0A),A
C7F8 LD HL,$0F06 The doorway: U within 6, V within 15
C7FB JR ARCH_CHECK_DOORWAY
FIRST_PILLAR_1 C7FD LD HL,$FBF0 Graphic 8, mirrored: X -16, Y -5
C800 JR ARCH_ALONG_V
Prev: C7A8 Up: Map Next: C802