Prev: 52499 Up: Map Next: 52532
52504: 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 52504 LD HL,24576 Point HL to the start of the entity list at Entity_List.
Find_Colliding_Entity_Check 52507 INC HL Skip the handler address and read the state byte. If it is the 255 sentinel, set carry and return (end of list reached).
52508 INC HL
52509 LD A,(HL)
52510 CP 255
52512 SCF
52513 RET Z
52514 INC HL Advance past three more bytes and test this entity's bounds against the current position via HitTestBounds8AtHL.
52515 INC HL
52516 INC HL
52517 CALL HitTestBounds8AtHL
52520 EXX Adjust alternate HL back by three and return without carry if the bounds do not overlap.
52521 DEC HL
52522 DEC HL
52523 DEC HL
52524 EXX
52525 RET NC Advance four bytes to the next entity record.
52526 INC HL
52527 INC HL
52528 INC HL
52529 INC HL
52530 JR Find_Colliding_Entity_Check Check the next entity.
Prev: 52499 Up: Map Next: 52532