Prev: BFD8 Up: Map Next: C048
BFEA: The update routine for the first pillar of a doorway (graphic 2)
Reached through UPDATES. This pillar is the doorway. It works out the point in the middle of the doorway, 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 CHK_PLYR_NEAR_ARCH marks the robot's legs as in the doorway if they are near enough, which lets them past the line of the wall (HANDLE_EXIT_SCREEN), and ARCH_NUDGE_TO_CENTRE nudges him onto the doorway's middle line if he is near it and facing through.
A doorway in a wall of constant U (not mirrored) has its other pillar 13 further along V, and 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 reaches 6 in U and 15 in V. The backgrounds put the middle of every doorway at 128 along its wall.
As Knight Lore's adj_2_4_hflip and the routines after it, and Pentagram's FIRST_PILLAR. The nudge differs from both: see NUDGE_ALONG_V.
Input
IX the pillar's record
FIRST_PILLAR BFEA BIT 6,(IX+$07) Mirrored: a doorway in a wall of constant V
BFEE JR NZ,ARCH_ALONG_V
BFF0 LD HL,$F9FA Not mirrored: X -6, Y -7
BFF3 CALL SET_PIXEL_ADJ
BFF6 LD A,(IX+$02) V of the middle: this pillar's plus 13
BFF9 ADD A,$0D
BFFB LD (IX+$0A),A
BFFE LD A,(IX+$01) U of the middle: this pillar's
C001 LD (IX+$09),A
C004 LD HL,$060F In the doorway: U within 15, V within 6
ARCH_CHECK_DOORWAY C007 LD A,(IX+$03) Z of the middle: the pillar's base
C00A LD (IX+$0B),A
C00D CALL CHK_PLYR_NEAR_ARCH In the doorway: the legs may cross the line of the wall
C010 JP ARCH_NUDGE_TO_CENTRE Near it: nudge towards the middle
ARCH_ALONG_V C013 LD HL,$FAF6 Mirrored: X -10, Y -6
C016 CALL SET_PIXEL_ADJ
C019 LD A,(IX+$01) U of the middle: this pillar's less 13
C01C SUB $0D
C01E LD (IX+$09),A
C021 LD A,(IX+$02) V of the middle: this pillar's
C024 LD (IX+$0A),A
C027 LD HL,$0F06 In the doorway: U within 6, V within 15
C02A JR ARCH_CHECK_DOORWAY
Nudge the robot towards the middle line of the doorway: if his legs, record 0, are in use, use doorways (bit 3 of +7), and are within 15 of the middle in U and V and 4 in Z, one of the routines in NUDGE_ROUTINES is run, picked by the pillar's own facing (GET_SPRITE_DIR). Knight Lore does this for each of records 0 to 3; here only the legs are nudged, as in Pentagram.
ARCH_NUDGE_TO_CENTRE C02C LD HL,$0F0F 15 either way in U and V
C02F LD IY,OBJECTS the robot's legs, if there are any
C033 LD A,(IY+$00)
C036 AND A
C037 RET Z
C038 BIT 3,(IY+$07) not one that uses doorways
C03C RET Z
C03D CALL IS_NEAR_TO not near
C040 RET NC
C041 PUSH BC the nudge routine for the pillar's facing; the BC pushed here is taken off again at NUDGE_DONE
C042 LD BC,NUDGE_ROUTINES
C045 JP DISPATCH_ON_FACING
Prev: BFD8 Up: Map Next: C048