![]() |
Routines |
| Prev: 51354 | Up: Map | Next: 51410 |
|
Used by the routines at TestDoorPassage and NudgeObjectsToArch.
Tests if the player is standing in the place in front of a door, which is a box that is centred on the place that is held in the speeds and the z position of the door, as far as the sizes in HL along x and y and 4 along z.
|
||||||||||||||||||
|
Test along x.
|
||||||||||||||||||
| TestNearTo | 51373 | LD A,(IX+9) | Fetch the x position of the place. | |||||||||||||||
| 51376 | SUB (IY+1) | Take away the x position of the player. | ||||||||||||||||
| 51379 | JR NC,TestNearTo_Y | Jump to TestNearTo_Y if the difference is not negative. | ||||||||||||||||
| 51381 | NEG | Make it positive. | ||||||||||||||||
|
Test along y.
|
||||||||||||||||||
| TestNearTo_Y | 51383 | CP L | Return with the carry flag clear if it is not less than the size of the box along x. | |||||||||||||||
| 51384 | RET NC | |||||||||||||||||
| 51385 | LD A,(IX+10) | Fetch the y position of the place. | ||||||||||||||||
| 51388 | SUB (IY+2) | Take away the y position of the player. | ||||||||||||||||
| 51391 | JR NC,TestNearTo_Z | Jump to TestNearTo_Z if the difference is not negative. | ||||||||||||||||
| 51393 | NEG | Make it positive. | ||||||||||||||||
|
Test along z.
|
||||||||||||||||||
| TestNearTo_Z | 51395 | CP H | Return with the carry flag clear if it is not less than the size of the box along y. | |||||||||||||||
| 51396 | RET NC | |||||||||||||||||
| 51397 | LD A,(IX+11) | Fetch the z position of the place. | ||||||||||||||||
| 51400 | SUB (IY+3) | Take away the z position of the player. | ||||||||||||||||
| 51403 | JR NC,TestNearTo_Done | Jump to TestNearTo_Done if the difference is not negative. | ||||||||||||||||
| 51405 | NEG | Make it positive. | ||||||||||||||||
| TestNearTo_Done | 51407 | CP 4 | Compare the difference with 4. | |||||||||||||||
| 51409 | RET | Return with the carry flag set if it is less. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: 51354 | Up: Map | Next: 51410 |