Prev: 51112 Up: Map Next: 51202
51117: Handle Near Arch
The handler of the object types 6 and 8, 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 13 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 13 back along x.
Input
IX Door record
HandleNearArch 51117 BIT 6,(IX+7) Jump to HandleNearArch_Mirrored if the door is mirrored.
51121 JR NZ,HandleNearArch_Mirrored
51123 LD A,(IX+0) Fetch the type.
51126 CP 8 Jump to SetDoorOffsetTypeEight if it is type 8.
51128 JR Z,SetDoorOffsetTypeEight
51130 LD HL,64507 Set the offsets for the sprite of type 6 in HL, which are 251 horizontally and 251 vertically.
This entry point is used by the routine at SetDoorOffsetTypeEight.
HandleNearArch_Place 51133 CALL StorePixelAdjustments Call StorePixelAdjustments to set the offsets.
51136 LD A,(IX+2) Set the y position of the place in front of the door, which is 13 further than the door.
51139 ADD A,13
51141 LD (IX+10),A
51144 LD A,(IX+1) Set the x position of the place in front of the door, which is the same as that of the door.
51147 LD (IX+9),A
51150 LD HL,1551 Set the sizes of the area that the player has to be in, which are 15 along x and 6 along y, in HL.
HandleNearArch_Check 51153 LD A,(IX+3) Set the z position of the place in front of the door, which is the same as that of the door.
51156 LD (IX+11),A
51159 CALL TestDoorPassage Call TestDoorPassage to find out if the player is passing through the door.
51162 JP NudgeObjectsToArch Jump to NudgeObjectsToArch to push the player towards the door.
The door is mirrored.
HandleNearArch_Mirrored 51165 LD A,(IX+0) Fetch the type.
51168 CP 8 Jump to HandleNearArch_MirroredTypeEight if it is type 8.
51170 JR Z,HandleNearArch_MirroredTypeEight
51172 LD HL,64239 Set the offsets for the sprite of type 6 in HL, which are 239 horizontally and 250 vertically.
HandleNearArch_MirroredPlace 51175 CALL StorePixelAdjustments Call StorePixelAdjustments to set the offsets.
51178 LD A,(IX+1) Set the x position of the place in front of the door, which is 13 less than that of the door.
51181 SUB 13
51183 LD (IX+9),A
51186 LD A,(IX+2) Set the y position of the place in front of the door, which is the same as that of the door.
51189 LD (IX+10),A
51192 LD HL,3846 Set the sizes of the area that the player has to be in, which are 6 along x and 15 along y.
51195 JR HandleNearArch_Check Jump to HandleNearArch_Check.
HandleNearArch_MirroredTypeEight 51197 LD HL,64496 Set the offsets for the sprite of type 8 in HL, which are 240 horizontally and 251 vertically.
51200 JR HandleNearArch_MirroredPlace Jump to HandleNearArch_MirroredPlace.
View the equivalent code in;
Prev: 51112 Up: Map Next: 51202