Prev: BFD8 Up: Map Next: C02C
BFEA: Handle Near Arch
The handler for the near side of an arch (object 02). As an arch does not move, its speeds are used to keep the position of the middle of the doorway: the middle is 0D further along the y axis than the arch, or 0D further back along the x axis if the sprite is flipped. The player is flagged if near the arch, and is nudged towards the middle of the doorway.
Input
IX The address of the object
Unflipped: doorway 0D along y.
HandleNearArch BFEA BIT 6,(IX+$07) Jump to HandleNearArch_Flipped if the sprite is flipped.
BFEE JR NZ,HandleNearArch_Flipped
BFF0 LD HL,$F9FA Set HL to F9FA.
BFF3 CALL SetPixelAdjustments_Store Call SetPixelAdjustments_Store.
BFF6 LD A,(IX+$02) Fetch the y position of the arch.
BFF9 ADD A,$0D Add 0D.
BFFB LD (IX+$0A),A Set it as the y of the doorway middle.
BFFE LD A,(IX+$01) Fetch the x position of the arch.
C001 LD (IX+$09),A Set it as the x of the doorway middle.
C004 LD HL,$060F Set HL to 060F.
Keep z and flag or nudge the player.
HandleNearArch_Near C007 LD A,(IX+$03) Fetch the z position of the arch.
C00A LD (IX+$0B),A Set it as the z of the doorway middle.
C00D CALL FlagPlayerNearArch Call FlagPlayerNearArch.
C010 JP NudgePlayerToArch Jump to NudgePlayerToArch.
Flipped: doorway 0D back along x.
HandleNearArch_Flipped C013 LD HL,$FAF6 Set HL to FAF6.
C016 CALL SetPixelAdjustments_Store Call SetPixelAdjustments_Store.
C019 LD A,(IX+$01) Fetch the x position of the arch.
C01C SUB $0D Subtract 0D.
C01E LD (IX+$09),A Set it as the x of the doorway middle.
C021 LD A,(IX+$02) Fetch the y position of the arch.
C024 LD (IX+$0A),A Set it as the y of the doorway middle.
C027 LD HL,$0F06 Set HL to 0F06.
C02A JR HandleNearArch_Near Jump to HandleNearArch_Near.
View the equivalent code in;
Prev: BFD8 Up: Map Next: C02C