![]() |
Routines |
| Prev: D320 | Up: Map | Next: D3B5 |
|
Used by the routine at PlacePlayerAtDoor.
Looks through the first four pairs of objects of the room for an arch (a graphic number below 06) whose X and Y coordinates add up to a given number. When it finds one it gives the player the height of the arch.
|
||||||||||
|
Find the matching arch and copy its height to the player.
|
||||||||||
| FindDoorHeight | D38C | LD IY,$5C88 | Point IY at the first object of the room, ObjectsTable_RoomObjects. | |||||||
| D390 | LD DE,$0040 | Set the distance between pairs of objects to 40. | ||||||||
| D393 | LD B,$04 | Set the number of pairs to 04. | ||||||||
| FindDoorHeight_Next | D395 | LD A,(IY+$00) | Fetch the graphic number of the object. | |||||||
| D398 | CP $06 | Compare it with 06. | ||||||||
| D39A | RET NC | Return if it is not an arch. | ||||||||
| D39B | LD A,(IY+$01) | Add the Y coordinate to the X coordinate. | ||||||||
| D39E | ADD A,(IY+$02) | |||||||||
| D3A1 | CP C | Compare the sum with the one that is wanted. | ||||||||
| D3A2 | JR Z,FindDoorHeight_Found | Jump to FindDoorHeight_Found if it matches. | ||||||||
| D3A4 | ADD IY,DE | Point IY at the next pair. | ||||||||
| D3A6 | DJNZ FindDoorHeight_Next | Jump to FindDoorHeight_Next until all of the pairs have been tried. | ||||||||
| D3A8 | RET | Return. | ||||||||
| FindDoorHeight_Found | D3A9 | LD A,(IY+$03) | Fetch the Z coordinate of the arch. | |||||||
| D3AC | LD (IX+$03),A | Set the Z coordinate of the legs of the player. | ||||||||
| D3AF | ADD A,$0C | Add 0C to it. | ||||||||
| D3B1 | LD (IX+$23),A | Set the Z coordinate of the top half of the player. | ||||||||
| D3B4 | RET | Return. | ||||||||
|
View the equivalent code in;
|
||||||||||
| Prev: D320 | Up: Map | Next: D3B5 |