| ← CCD2 | Map | CD6B → |
CD16: Sweep this inhabitant against the pool objects that are not balls
|
Tests this inhabitant against the other pool objects, the bat included, and reports the first overlap. A hit is always a plain kill: the death sequence, and no score.
|
|||||||||||||
|
|||||||||||||
|
Loops over every object but the bat extension, which is never swept. It skips ball A, the secondary object while its sprite pointer shows the ball sprite, and the inhabitant itself. The sweep applies those skips itself, so an inhabitant that never runs the ball kill still gets them. A slot counts only while it is active.
A hit is reported when the slot is within 12 pixels of the inhabitant on both axes. The window reaches 12 pixels one way and 11 the other on each axis, with the same one-short fold as the plain overlap. The gap is measured slot minus inhabitant.
|
|||||||||||||
| overlap_sweep | CD16 | XOR A | Walk the objects, with the object index in A. | ||||||||||
| overlap_sweep_loop | CD17 | CP $01 | Skip ball A's slot. Skip the secondary object's slot too while its sprite pointer shows it holds a ball. | ||||||||||
| CD19 | JR Z,overlap_sweep_step | ||||||||||||
| CD1B | CP $02 | ||||||||||||
| CD1D | JR NZ,overlap_sweep_test | ||||||||||||
| CD1F | LD HL,(obj2_sprite_ptr) | ||||||||||||
| CD22 | LD DE,slot_ball | ||||||||||||
| CD25 | AND A | ||||||||||||
| CD26 | SBC HL,DE | ||||||||||||
| CD28 | JR Z,overlap_sweep_step | ||||||||||||
| overlap_sweep_test | CD2A | CP C | Skip the inhabitant's own slot, then walk to the record of slot A. | ||||||||||
| CD2B | JR Z,overlap_sweep_step | ||||||||||||
| CD2D | LD B,A | ||||||||||||
| CD2E | LD HL,object_table | ||||||||||||
| CD31 | OR A | ||||||||||||
| CD32 | JR Z,overlap_sweep_object | ||||||||||||
| CD34 | LD DE,$0009 | ||||||||||||
| overlap_sweep_advance | CD37 | ADD HL,DE | |||||||||||
| CD38 | DJNZ overlap_sweep_advance | ||||||||||||
| overlap_sweep_object | CD3A | EX AF,AF' | Park the slot index in A'; skip the slot unless it is active. | ||||||||||
| CD3B | PUSH HL | ||||||||||||
| CD3C | LD DE,$0008 | ||||||||||||
| CD3F | ADD HL,DE | ||||||||||||
| CD40 | BIT 0,(HL) | ||||||||||||
| CD42 | POP HL | ||||||||||||
| CD43 | JR Z,overlap_sweep_skip | ||||||||||||
| CD45 | LD A,(HL) | Read the slot's X and Y (X into A, Y into D) and form the X gap to the inhabitant. A negative gap folds to one less than its magnitude. | |||||||||||
| CD46 | INC HL | ||||||||||||
| CD47 | LD D,(HL) | ||||||||||||
| CD48 | SUB (IX+$00) | ||||||||||||
| CD4B | JP P,overlap_sweep_dx | ||||||||||||
| CD4E | CPL | ||||||||||||
| overlap_sweep_dx | CD4F | CP $0C | X gap inside the window: form the Y gap, a positive one used as it stands. | ||||||||||
| CD51 | JR NC,overlap_sweep_skip | ||||||||||||
| CD53 | LD A,D | ||||||||||||
| CD54 | SUB (IX+$01) | ||||||||||||
| CD57 | JP P,overlap_sweep_dy | ||||||||||||
| CD5A | CPL | A negative gap folds to one less than its magnitude. | |||||||||||
| overlap_sweep_dy | CD5B | CP $0C | Both gaps inside the window is a hit – restore the parked slot index and return 1 in A; otherwise fall through to the next slot. | ||||||||||
| CD5D | JR NC,overlap_sweep_skip | ||||||||||||
| CD5F | EX AF,AF' | ||||||||||||
| CD60 | LD A,$01 | ||||||||||||
| CD62 | RET | ||||||||||||
| overlap_sweep_skip | CD63 | EX AF,AF' | This slot is inactive or too far to count. Take the slot index back. | ||||||||||
| overlap_sweep_step | CD64 | INC A | Advance to the next object. After the last object with no hit, return 0. | ||||||||||
| CD65 | CP $08 | ||||||||||||
| CD67 | JR NZ,overlap_sweep_loop | ||||||||||||
| CD69 | XOR A | ||||||||||||
| CD6A | RET | ||||||||||||
| ← CCD2 | Map | CD6B → |
