| ← CC56 | Map | CD16 → |
CCD2: Ball kill, the shared overlap helpers, then the per-type handlers
|
Tests one inhabitant against the live balls and kills it on a wide overlap. This entry also opens the inhabitant-behavior block. The shared helpers come first: this one, the sweep and the wide overlap. The per-type handlers follow, from the face monster's handler on.
Most handlers run the reaction-state machine and advance the animation. They then move or steer, despawn off the far edge, and call these helpers. They differ only in movement and in what an overlap does.
|
|||||||||||||||
|
|||||||||||||||
|
The test is the wide overlap between the inhabitant's sprite and a ball's. Ball A is always tested. Ball B shares the secondary object's place and is tested only while that holds a ball. The slot holds a ball when its sprite pointer is the ball sprite. Either overlap is a kill.
|
|||||||||||||||
| ball_kill | CCD2 | LD A,C | Name the inhabitant (C) as the first overlap operand and ball A as the second, then run the wide overlap test. | ||||||||||||
| CCD3 | LD (overlap_slot_1),A | ||||||||||||||
| CCD6 | LD A,$01 | ||||||||||||||
| CCD8 | LD (overlap_slot_2),A | ||||||||||||||
| CCDB | CALL overlap_wide | ||||||||||||||
| CCDE | OR A | Wide overlap with ball A: take the kill path. | |||||||||||||
| CCDF | JR NZ,ball_kill_hit | ||||||||||||||
| CCE1 | PUSH IX | Test the secondary object only while its sprite pointer shows it holds a ball. Otherwise take the miss path. | |||||||||||||
| CCE3 | LD IX,obj2_object | ||||||||||||||
| CCE7 | LD L,(IX+$06) | ||||||||||||||
| CCEA | LD H,(IX+$07) | ||||||||||||||
| CCED | POP IX | ||||||||||||||
| CCEF | LD DE,slot_ball | ||||||||||||||
| CCF2 | XOR A | ||||||||||||||
| CCF3 | SBC HL,DE | ||||||||||||||
| CCF5 | JR NZ,ball_kill_miss | ||||||||||||||
| CCF7 | LD A,C | Name the secondary object as the second overlap operand and test it the same way. An overlap also kills. | |||||||||||||
| CCF8 | LD (overlap_slot_1),A | ||||||||||||||
| CCFB | LD A,$02 | ||||||||||||||
| CCFD | LD (overlap_slot_2),A | ||||||||||||||
| CD00 | CALL overlap_wide | ||||||||||||||
| CD03 | OR A | ||||||||||||||
| CD04 | JR NZ,ball_kill_hit | ||||||||||||||
| ball_kill_miss | CD06 | AND A | No overlap: clear carry and return. | ||||||||||||
| CD07 | RET | ||||||||||||||
| ball_kill_hit | CD08 | LD (IY+$0B),$00 | Kill: zero the animation frame, start the death reaction, bank B into the pending score, set carry and return. | ||||||||||||
| CD0C | LD (IY+$0C),$02 | ||||||||||||||
| CD10 | LD A,B | ||||||||||||||
| CD11 | LD (pending_score),A | ||||||||||||||
| CD14 | SCF | ||||||||||||||
| CD15 | RET | ||||||||||||||
| ← CC56 | Map | CD16 → |
