Prev: 6256 Up: Map Next: 62CE
6268: Check collision with explosion fragments
Used by the routine at check_missile_vs_objects.
Iterates through exploding_fragments (exploding_fragments) to check if the entity collides with any active debris. Each fragment entry is 3 bytes: X, Y, and type/state.
Collision uses 8x8 bounding box for the entity and 16x8 for fragments. Result stored in collision_coordinates: $02 = collision detected, $00 = no collision (end of list reached).
check_fragment_collision 6268 LD HL,($5F62) Load fragment coordinates (C=X, B=Y) from list pointer exploding_fragments_ptr and advance by 3.
626B LD C,(HL)
626C INC HL
626D LD B,(HL)
626E INC HL
626F INC HL
6270 LD ($5F62),HL Store updated pointer; copy X to A for marker check.
6273 LD A,C
6274 CP $00 If empty slot, skip to next fragment.
6276 JP Z,check_fragment_collision
6279 CP $FF If end-of-set marker, jump to check_fragment_collision_end (no collision).
627B JP Z,check_fragment_collision_end
627E CALL advance_object Adjust Y coordinate for scrolling.
Y-axis collision check (8-pixel height for both entity and fragment).
6281 LD DE,($5EF3) Check if entity_Y + 8 >= fragment_Y; if not, next fragment.
6285 LD A,D
6286 ADD A,$08
6288 LD H,$00
628A LD L,A
628B LD D,$00
628D OR A
628E LD E,B
628F SBC HL,DE
6291 JP M,check_fragment_collision (continued).
6294 LD A,B Check if fragment_Y + 8 >= entity_Y; if not, next fragment.
6295 ADD A,$08
6297 LD H,$00
6299 LD L,A
629A LD E,D
629B LD D,$00
629D OR A
629E SBC HL,DE
62A0 JP M,check_fragment_collision
X-axis collision check (8-pixel width for entity, 16-pixel for fragment).
62A3 LD DE,($5EF3) Check if entity_X + 8 >= fragment_X; if not, next fragment.
62A7 LD H,$00
62A9 LD A,E
62AA ADD A,$08
62AC LD L,A
62AD LD D,$00
62AF LD E,C
62B0 OR A
62B1 SBC HL,DE
62B3 JP M,check_fragment_collision (continued).
62B6 LD A,C Check if fragment_X + 16 >= entity_X; if not, next fragment.
62B7 ADD A,$10
62B9 LD DE,($5EF3)
62BD LD H,$00
62BF LD L,A
62C0 OR A
62C1 LD D,$00
62C3 SBC HL,DE
62C5 JP M,check_fragment_collision
Collision detected with fragment.
62C8 LD A,$02 Store $02 (collision) to collision_coordinates and return.
62CA LD ($5F8B),A
62CD RET
Prev: 6256 Up: Map Next: 62CE