Prev: 52225 Up: Map Next: 52374
52333: Find Door Height
Used by the routine at PlacePlayerAtDoor.
Looks through the first four pairs of objects of the room for an arch (a sprite number below 4) whose x and y positions 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 positions of the arch
IX Address of the player
Walk the first four pairs.
FindDoorHeight 52333 LD IY,23560 Point IY at RoomObjects.
52337 LD DE,64 Set DE to 0064.
52340 LD B,4 Set B to 4.
FindDoorHeight_Next 52342 LD A,(IY+0) Fetch the sprite number of the object.
52345 CP 4 Return if it is 4 or more.
52347 RET NC
52348 LD A,(IY+1) Fetch the x position of the object.
52351 ADD A,(IY+2) Add the y position of the object.
52354 CP C Jump to FindDoorHeight_Found if it is equal to C.
52355 JR Z,FindDoorHeight_Found
52357 ADD IY,DE Add DE to IY.
52359 DJNZ FindDoorHeight_Next Jump to FindDoorHeight_Next until B is zero.
52361 RET Return.
Give the player the height of the arch.
FindDoorHeight_Found 52362 LD A,(IY+3) Fetch the z position of the arch.
52365 LD (IX+3),A Set the z position of the player.
52368 ADD A,12 Add 12.
52370 LD (IX+35),A Set the z position of the top half.
52373 RET Return.
View the equivalent code in;
Prev: 52225 Up: Map Next: 52374