Prev: 50999 Up: Map Next: 51052
51004: Handle Near Arch
The handler for the near side of an arch (objects 2 and 4). As an arch does not move, its speeds are used to keep the position of the middle of the doorway: the middle is 13 further along the y axis than the arch, or 13 further back along the x axis if the sprite is flipped. The player, and any special object, is flagged if near the arch, and is nudged towards the middle of the doorway.
Input
IX The address of the object
Unflipped: doorway 13 along y.
HandleNearArch 51004 BIT 6,(IX+7) Jump to HandleFlippedNearArch if the arch is flipped horizontally.
51008 JR NZ,HandleFlippedNearArch
51010 LD A,(IX+0) Fetch the graphic number of the arch.
51013 CP 4 Jump to AdjustTreeArch if it is a tree arch.
51015 JR Z,AdjustTreeArch
51017 LD HL,65017 Set HL to 65017.
This entry point is used by the routine at AdjustTreeArch.
The doorway is thirteen units further along the Y axis than the arch.
HandleNearArch_Position 51020 CALL StorePixelAdjustments Call StorePixelAdjustments.
51023 LD A,(IX+2) Fetch the y position of the arch.
51026 ADD A,13 Add 13.
51028 LD (IX+10),A Keep it as the Y coordinate of the middle of the doorway.
51031 LD A,(IX+1) Fetch the x position of the arch.
51034 LD (IX+9),A Keep it as the X coordinate of the middle of the doorway.
51037 LD HL,1551 Set HL to 1551.
This entry point is used by the routine at HandleFlippedNearArch.
Keep z and flag or nudge the player.
HandleNearArch_Near 51040 LD A,(IX+3) Fetch the z position of the arch.
51043 LD (IX+11),A Keep it as the Z coordinate of the middle of the doorway.
51046 CALL FlagObjectsNearArch Flag the objects that are near the arch.
51049 JP NudgeObjectsToArch Jump to NudgeObjectsToArch.
View the equivalent code in;
Prev: 50999 Up: Map Next: 51052