Prev: CC01 Up: Map Next: CC96
CC6D: 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 04) 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 CC6D LD IY,$5C08 Point IY at RoomObjects.
CC71 LD DE,$0040 Set DE to 0040.
CC74 LD B,$04 Set B to 04.
FindDoorHeight_Next CC76 LD A,(IY+$00) Fetch the sprite number of the object.
CC79 CP $04 Return if it is 04 or more.
CC7B RET NC
CC7C LD A,(IY+$01) Fetch the x position of the object.
CC7F ADD A,(IY+$02) Add the y position of the object.
CC82 CP C Jump to FindDoorHeight_Found if it is equal to C.
CC83 JR Z,FindDoorHeight_Found
CC85 ADD IY,DE Add DE to IY.
CC87 DJNZ FindDoorHeight_Next Jump to FindDoorHeight_Next until B is zero.
CC89 RET Return.
Give the player the height of the arch.
FindDoorHeight_Found CC8A LD A,(IY+$03) Fetch the z position of the arch.
CC8D LD (IX+$03),A Set the z position of the player.
CC90 ADD A,$0C Add 0C.
CC92 LD (IX+$23),A Set the z position of the top half.
CC95 RET Return.
View the equivalent code in;
Prev: CC01 Up: Map Next: CC96