Prev: C7A8 Up: Map Next: C802
C7AD: Handle Near Arch
The handler of the object types 06 and 08, which are the doors in the walls of a room. A door does not change, but it checks for the player standing in the doorway, which makes the player pass into the room on the other side.
A door that is not mirrored is in a wall at one end of the x axis, and has the place that the player has to be at, in front of it, held in the speeds along x and y and the position along z of its record, which no other object uses as it does not move. The place is 0D further along y than the door. When the door is mirrored it is in a wall at one end of the y axis and the place is 0D back along x.
Input
IX Door record
HandleNearArch C7AD BIT 6,(IX+$07) Jump to HandleNearArch_Mirrored if the door is mirrored.
C7B1 JR NZ,HandleNearArch_Mirrored
C7B3 LD A,(IX+$00) Fetch the type.
C7B6 CP $08 Jump to SetDoorOffsetTypeEight if it is type 08.
C7B8 JR Z,SetDoorOffsetTypeEight
C7BA LD HL,$FBFB Set the offsets for the sprite of type 06 in HL, which are FB horizontally and FB vertically.
This entry point is used by the routine at SetDoorOffsetTypeEight.
HandleNearArch_Place C7BD CALL StorePixelAdjustments Call StorePixelAdjustments to set the offsets.
C7C0 LD A,(IX+$02) Set the y position of the place in front of the door, which is 0D further than the door.
C7C3 ADD A,$0D
C7C5 LD (IX+$0A),A
C7C8 LD A,(IX+$01) Set the x position of the place in front of the door, which is the same as that of the door.
C7CB LD (IX+$09),A
C7CE LD HL,$060F Set the sizes of the area that the player has to be in, which are 0F along x and 06 along y, in HL.
HandleNearArch_Check C7D1 LD A,(IX+$03) Set the z position of the place in front of the door, which is the same as that of the door.
C7D4 LD (IX+$0B),A
C7D7 CALL TestDoorPassage Call TestDoorPassage to find out if the player is passing through the door.
C7DA JP NudgeObjectsToArch Jump to NudgeObjectsToArch to push the player towards the door.
The door is mirrored.
HandleNearArch_Mirrored C7DD LD A,(IX+$00) Fetch the type.
C7E0 CP $08 Jump to HandleNearArch_MirroredTypeEight if it is type 08.
C7E2 JR Z,HandleNearArch_MirroredTypeEight
C7E4 LD HL,$FAEF Set the offsets for the sprite of type 06 in HL, which are EF horizontally and FA vertically.
HandleNearArch_MirroredPlace C7E7 CALL StorePixelAdjustments Call StorePixelAdjustments to set the offsets.
C7EA LD A,(IX+$01) Set the x position of the place in front of the door, which is 0D less than that of the door.
C7ED SUB $0D
C7EF LD (IX+$09),A
C7F2 LD A,(IX+$02) Set the y position of the place in front of the door, which is the same as that of the door.
C7F5 LD (IX+$0A),A
C7F8 LD HL,$0F06 Set the sizes of the area that the player has to be in, which are 06 along x and 0F along y.
C7FB JR HandleNearArch_Check Jump to HandleNearArch_Check.
HandleNearArch_MirroredTypeEight C7FD LD HL,$FBF0 Set the offsets for the sprite of type 08 in HL, which are F0 horizontally and FB vertically.
C800 JR HandleNearArch_MirroredPlace Jump to HandleNearArch_MirroredPlace.
View the equivalent code in;
Prev: C7A8 Up: Map Next: C802