Prev: 54048 Up: Map Next: 54197
54156: Find Door Height
Used by the routine at PlacePlayerAtDoor.
Looks through the first four pairs of objects of the room for an arch (a graphic number below 6) whose X and Y coordinates add up to a given number. When it finds one it gives the player the height of the arch.
Input
C Sum of the X and Y coordinates of the arch
IX Address of the player
Find the matching arch and copy its height to the player.
FindDoorHeight 54156 LD IY,23688 Point IY at the first object of the room, ObjectsTable_RoomObjects.
54160 LD DE,64 Set the distance between pairs of objects to 64.
54163 LD B,4 Set the number of pairs to 4.
FindDoorHeight_Next 54165 LD A,(IY+0) Fetch the graphic number of the object.
54168 CP 6 Compare it with 6.
54170 RET NC Return if it is not an arch.
54171 LD A,(IY+1) Add the Y coordinate to the X coordinate.
54174 ADD A,(IY+2)
54177 CP C Compare the sum with the one that is wanted.
54178 JR Z,FindDoorHeight_Found Jump to FindDoorHeight_Found if it matches.
54180 ADD IY,DE Point IY at the next pair.
54182 DJNZ FindDoorHeight_Next Jump to FindDoorHeight_Next until all of the pairs have been tried.
54184 RET Return.
FindDoorHeight_Found 54185 LD A,(IY+3) Fetch the Z coordinate of the arch.
54188 LD (IX+3),A Set the Z coordinate of the legs of the player.
54191 ADD A,12 Add 12 to it.
54193 LD (IX+35),A Set the Z coordinate of the top half of the player.
54196 RET Return.
View the equivalent code in;
Prev: 54048 Up: Map Next: 54197