![]() |
Routines |
| Prev: 57898 | Up: Map | Next: 58000 |
|
Used by the routines at Handle_Horizontal_Enemy_Entity and Process_Wall_Bouncing_Enemy.
Walks the wave entity list between the snapshot pointer at 50443 and the write pointer at 50445. For each entity with a type nibble below 4 tests bounds overlap via HitTestBounds8AtHL; returns without carry set if an overlapping entity is found with its position left in alternate HL. Returns with carry set if the list is exhausted without a match. Entities with a type nibble of 4 or higher are skipped as non-collidable. Called from Handle_Horizontal_Enemy_Entity and Process_Wall_Bouncing_Enemy.
|
||||
| Find_Colliding_Wave_Enemy | 57954 | EXX | Switch to alternate registers and load the entity list snapshot pointer from 50443. | |
| 57955 | LD HL,(50443) | |||
| Find_Colliding_Wave_Enemy_Next | 57958 | EX DE,HL | Compare the snapshot against the write pointer; return with carry set (no match) if the list is exhausted. | |
| 57959 | LD HL,(50445) | |||
| 57962 | AND A | |||
| 57963 | SBC HL,DE | |||
| 57965 | SCF | |||
| 57966 | EX DE,HL | |||
| 57967 | RET Z | Advance three bytes past the handler word, read the entity type nibble, and mask to the low 4 bits. | ||
| 57968 | INC HL | |||
| 57969 | INC HL | |||
| 57970 | INC HL | |||
| 57971 | LD A,(HL) | |||
| 57972 | AND %00001111 | Mask the type to the low nibble. | ||
| 57974 | CP 4 | Jump to Find_Colliding_Wave_Enemy_1 to skip this entity if the type is 4 or higher (non-collidable). | ||
| 57976 | INC HL | |||
| 57977 | JP NC,Find_Colliding_Wave_Enemy_1 | Test whether this entity's bounds overlap the current position via HitTestBounds8AtHL; advance and loop if they do not. | ||
| 57980 | CALL HitTestBounds8AtHL | |||
| 57983 | RET NC | No overlap: step the alternate HL back three bytes and loop. | ||
| 57984 | EXX | |||
| 57985 | DEC HL | |||
| 57986 | DEC HL | |||
| 57987 | DEC HL | |||
| 57988 | EXX | |||
| Find_Colliding_Wave_Enemy_0 | 57989 | INC HL | Advance two bytes to the next entity record and loop. | |
| 57990 | INC HL | |||
| 57991 | JP Find_Colliding_Wave_Enemy_Next | |||
| Find_Colliding_Wave_Enemy_1 | 57994 | INC HL | Wide entity: advance three more bytes and loop. | |
| 57995 | INC HL | |||
| 57996 | INC HL | |||
| 57997 | JP Find_Colliding_Wave_Enemy_0 | |||
| Prev: 57898 | Up: Map | Next: 58000 |