Prev: CD13 Up: Map Next: CD34
CD18: Find Colliding Entity
Walks the entity list from Entity_List, testing each record's bounds against the current entity via HitTestBounds8AtHL. Returns without carry if no collision is found (list exhausted). Returns with carry set if the current entity's position overlaps another entity's bounds.
Find_Colliding_Entity CD18 LD HL,$6000 Point HL to the start of the entity list at Entity_List.
Find_Colliding_Entity_Check CD1B INC HL Skip the handler address and read the state byte. If it is the FF sentinel, set carry and return (end of list reached).
CD1C INC HL
CD1D LD A,(HL)
CD1E CP $FF
CD20 SCF
CD21 RET Z
CD22 INC HL Advance past three more bytes and test this entity's bounds against the current position via HitTestBounds8AtHL.
CD23 INC HL
CD24 INC HL
CD25 CALL HitTestBounds8AtHL
CD28 EXX Adjust alternate HL back by three and return without carry if the bounds do not overlap.
CD29 DEC HL
CD2A DEC HL
CD2B DEC HL
CD2C EXX
CD2D RET NC Advance four bytes to the next entity record.
CD2E INC HL
CD2F INC HL
CD30 INC HL
CD31 INC HL
CD32 JR Find_Colliding_Entity_Check Check the next entity.
Prev: CD13 Up: Map Next: CD34