![]() |
Routines |
| Prev: 900A | Up: Map | Next: 90FB |
|
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 02 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 | 90CC | LD A,($EA92) | Fetch offset 02 of the player. | |||||||||||||
| 90CF | AND %00001111 | Keep only bits 0-3. | ||||||||||||||
| 90D1 | RET NZ | Return if they are not all zero. | ||||||||||||||
| 90D2 | LD A,($EA90) | Fetch the sprite ID of the player from Player. | ||||||||||||||
| 90D5 | DEC A | Subtract one to get the ID that starts at zero. | ||||||||||||||
| 90D6 | CP $30 | Return if the player is not a character. | ||||||||||||||
| 90D8 | RET NC | |||||||||||||||
| 90D9 | BIT 6,(IX+$05) | Jump to CheckPlayerInRange_X if the attribute of the entity is not bright. | ||||||||||||||
| 90DD | JR Z,CheckPlayerInRange_X | |||||||||||||||
| 90DF | SRL C | Halve the range along the X axis. | ||||||||||||||
| CheckPlayerInRange_X | 90E1 | LD A,($EA93) | Fetch the X position of the player from EA93. | |||||||||||||
| 90E4 | SUB (IX+$03) | Subtract the X position of the entity. | ||||||||||||||
| 90E7 | CP C | Return if the player is not in range. | ||||||||||||||
| 90E8 | RET NC | |||||||||||||||
| 90E9 | BIT 6,(IX+$05) | Jump to CheckPlayerInRange_Y if the attribute of the entity is bright. | ||||||||||||||
| 90ED | JR NZ,CheckPlayerInRange_Y | |||||||||||||||
| 90EF | SRL B | Halve the range along the Y axis. | ||||||||||||||
| CheckPlayerInRange_Y | 90F1 | LD A,($EA94) | Fetch the Y position of the player from EA94. | |||||||||||||
| 90F4 | SUB (IX+$04) | Subtract the Y position of the entity. | ||||||||||||||
| 90F7 | NEG | Negate the result. | ||||||||||||||
| 90F9 | CP B | Compare it with the range. | ||||||||||||||
| 90FA | RET | Return. | ||||||||||||||
| Prev: 900A | Up: Map | Next: 90FB |