![]() |
Routines |
| Prev: 49253 | Up: Map | Next: 49283 |
|
Used by the routines at SpawnGhost, UpdateGhost, UpdateCreature, HitOutcome_Split, ColourInventoryItems, UpdateSpore, UpdateSpeedBonus, UpdateHealthBonus and SpawnBonus.
Checks whether the object at IX is within a given number of cells of the player, along both axes. The ghosts, creatures and bonuses use it to find out whether they are near enough to matter.
|
||||||||||||||
|
Compare the columns.
|
||||||||||||||
| CheckPlayerClose | 49257 | LD A,(48272) | Fetch the player's column from 48272. | |||||||||||
| 49260 | SUB (IX+2) | Work out how many columns the object is from the player. | ||||||||||||
| 49263 | JP P,CheckPlayerClose_Columns | Jump to CheckPlayerClose_Columns if the difference is not negative. | ||||||||||||
| 49266 | NEG | Otherwise turn the distance round, so that it is positive. | ||||||||||||
| CheckPlayerClose_Columns | 49268 | CP C | Compare the distance in columns with the limit. | |||||||||||
| 49269 | RET NC | Return with the carry flag clear if the object is too far away. | ||||||||||||
|
Compare the rows.
|
||||||||||||||
| 49270 | LD A,(48274) | Fetch the player's row from 48274. | ||||||||||||
| 49273 | SUB (IX+4) | Work out how many rows the object is from the player. | ||||||||||||
| 49276 | JP P,CheckPlayerClose_Rows | Jump to CheckPlayerClose_Rows if the difference is not negative. | ||||||||||||
| 49279 | NEG | Otherwise turn the distance round, so that it is positive. | ||||||||||||
| CheckPlayerClose_Rows | 49281 | CP C | Compare the distance in rows with the limit. | |||||||||||
| 49282 | RET | Return with the carry flag set only if the object is close enough. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 49253 | Up: Map | Next: 49283 |