![]() |
Routines |
| Prev: 36874 | Up: Map | Next: 37115 |
|
Checks whether the player is close to the entity of a door. It is only checked when the player is a character and the bottom four bits of offset 2 of the player are zero. The player is in range when it is to the right of the position of the entity by less than the range along the X axis, and above it by less than the range along the Y axis. The range along the X axis is halved if the attribute of the entity is bright, and the range along the Y axis is halved if it is not.
|
||||||||||||||||
| CheckPlayerInRange | 37068 | LD A,(60050) | Fetch offset 2 of the player. | |||||||||||||
| 37071 | AND %00001111 | Keep only bits 0-3. | ||||||||||||||
| 37073 | RET NZ | Return if they are not all zero. | ||||||||||||||
| 37074 | LD A,(60048) | Fetch the sprite ID of the player from Player. | ||||||||||||||
| 37077 | DEC A | Subtract one to get the ID that starts at zero. | ||||||||||||||
| 37078 | CP 48 | Return if the player is not a character. | ||||||||||||||
| 37080 | RET NC | |||||||||||||||
| 37081 | BIT 6,(IX+5) | Jump to CheckPlayerInRange_X if the attribute of the entity is not bright. | ||||||||||||||
| 37085 | JR Z,CheckPlayerInRange_X | |||||||||||||||
| 37087 | SRL C | Halve the range along the X axis. | ||||||||||||||
| CheckPlayerInRange_X | 37089 | LD A,(60051) | Fetch the X position of the player from 60051. | |||||||||||||
| 37092 | SUB (IX+3) | Subtract the X position of the entity. | ||||||||||||||
| 37095 | CP C | Return if the player is not in range. | ||||||||||||||
| 37096 | RET NC | |||||||||||||||
| 37097 | BIT 6,(IX+5) | Jump to CheckPlayerInRange_Y if the attribute of the entity is bright. | ||||||||||||||
| 37101 | JR NZ,CheckPlayerInRange_Y | |||||||||||||||
| 37103 | SRL B | Halve the range along the Y axis. | ||||||||||||||
| CheckPlayerInRange_Y | 37105 | LD A,(60052) | Fetch the Y position of the player from 60052. | |||||||||||||
| 37108 | SUB (IX+4) | Subtract the Y position of the entity. | ||||||||||||||
| 37111 | NEG | Negate the result. | ||||||||||||||
| 37113 | CP B | Compare it with the range. | ||||||||||||||
| 37114 | RET | Return. | ||||||||||||||
| Prev: 36874 | Up: Map | Next: 37115 |