![]() |
Routines |
| Prev: C440 | Up: Map | Next: C4C8 |
|
Used by the routines at HandlePickupAndDrop and HandlePlayerLegs.
Tests whether the player is inside the room. The distance from the middle of the room (80) has to be smaller than the distance to the wall, less the width of the player along x and less the depth of the player along y.
|
||||||||||||
|
Limits from the wall distances.
|
||||||||||||
| TestPlayerInRoom | C4A3 | LD HL,($A71D) | Fetch the limits of the room, RoomSizeX along x and RoomSizeY along y. | |||||||||
|
Take the half size along x off the limit along x.
|
||||||||||||
| C4A6 | LD A,L | Copy the distance along x to A. | ||||||||||
| C4A7 | SUB (IX+$04) | Subtract the width of the player. | ||||||||||
| C4AA | LD L,A | Store the limit along x in L. | ||||||||||
|
Take the half size along y off the limit along y.
|
||||||||||||
| C4AB | LD A,H | Copy the distance along y to A. | ||||||||||
| C4AC | SUB (IX+$05) | Subtract the depth of the player. | ||||||||||
| C4AF | LD H,A | Store the limit along y in H. | ||||||||||
|
Compare the x distance from the middle.
|
||||||||||||
| C4B0 | LD A,(IX+$01) | Fetch the x position of the object. | ||||||||||
|
Take away the middle of the room, 80, and jump to TestPlayerInRoom_LimitX if the distance is not negative.
|
||||||||||||
| C4B3 | SUB $80 | Subtract 80. | ||||||||||
| C4B5 | JP P,TestPlayerInRoom_LimitX | Jump to TestPlayerInRoom_LimitX if the sign flag is clear. | ||||||||||
| C4B8 | NEG | Negate A. | ||||||||||
| TestPlayerInRoom_LimitX | C4BA | CP L | Return if the player is outside along x. | |||||||||
| C4BB | RET NC | |||||||||||
|
Compare the y distance from the middle.
|
||||||||||||
| C4BC | LD A,(IX+$02) | Fetch the y position of the object. | ||||||||||
|
Take away the middle of the room, 80, and jump to TestPlayerInRoom_LimitY if the distance is not negative.
|
||||||||||||
| C4BF | SUB $80 | Subtract 80. | ||||||||||
| C4C1 | JP P,TestPlayerInRoom_LimitY | Jump to TestPlayerInRoom_LimitY if the sign flag is clear. | ||||||||||
| C4C4 | NEG | Negate A. | ||||||||||
| TestPlayerInRoom_LimitY | C4C6 | CP H | Compare it with the limit along y. | |||||||||
| C4C7 | RET | Return. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: C440 | Up: Map | Next: C4C8 |