![]() |
Routines |
| Prev: 58182 | Up: Map | Next: 58514 |
|
Per-frame entity handler for IX-indexed tracked wave enemies. If the wave start delay is still counting, advances the entity pointer via Process_Tracked_Enemy_Entity_Advance. Otherwise stores the entity record pointer at Entity_Pointer_Stash, rebuilds the spawn buffer via Build_Entity_Spawn_Record, and searches for a collision- free slot via Find_Colliding_Entity. Tests player contact via HitTestBounds8AtHL and triggers death via Strip_Attributes_And_Fade if touching. Decrements the animation phase, erases the sprite via Erase_Wide_Entity_Sprite, advances the animation frame within the phase mask, then re-enters movement at Process_Tracked_Enemy_Entity_Move. Updates the entity velocity with angular rate via Advance_RNG_Seed and Clamp_Entity_Velocity, clamps position to the play area, rebuilds the spawn buffer, and draws via Draw_Wide_Entity_Sprite. When the animation phase reaches zero, either removes the entity or promotes it to the next phase and spawns a cluster entity with handler Process_Cluster_Entity.
|
||||
| Process_Tracked_Enemy_Entity | 58208 | LD A,(50483) | Skip to Process_Tracked_Enemy_Entity_Advance if the wave start delay at 50483 is still active. | |
| 58211 | AND A | |||
| 58212 | JP NZ,Process_Tracked_Enemy_Entity_Advance | |||
| 58215 | LD (50447),HL | Store the entity record pointer at Entity_Pointer_Stash and reload into IX. | ||
| 58218 | LD IX,(50447) | |||
| 58222 | CALL Build_Entity_Spawn_Record | Point HL at the spawn buffer (50450), switch to alternate registers, and search for a free entity slot via Find_Colliding_Entity; jump to Kill_Tracked_Enemy_Entity if no free slot is available. | ||
| 58225 | LD HL,50450 | |||
| 58228 | EXX | |||
| 58229 | CALL Find_Colliding_Entity | |||
| 58232 | JP NC,Kill_Tracked_Enemy_Entity | Test player contact via HitTestBounds8AtHL; trigger death via Strip_Attributes_And_Fade if touching. Reload the entity pointer, decrement the animation phase, and erase the entity sprite via Erase_Wide_Entity_Sprite. | ||
| 58235 | LD HL,50388 | |||
| 58238 | CALL HitTestBounds8AtHL | |||
| 58241 | JP NC,Strip_Attributes_And_Fade | |||
| 58244 | LD HL,50449 | |||
| 58247 | CALL Erase_Wide_Entity_Sprite | |||
| 58250 | LD HL,(50447) | |||
| 58253 | DEC (HL) | |||
|
Read the animation phase and select the animation frame mask: 7 if the phase is 55 or higher, 3 otherwise.
|
||||
| 58254 | LD A,(HL) | Read the phase, select the frame mask, and advance HL. | ||
| 58255 | LD C,A | |||
| 58256 | BIT 0,A | |||
| 58258 | JP NZ,Process_Tracked_Enemy_Entity_Move | |||
| 58261 | CP 55 | |||
| 58263 | LD B,3 | |||
| 58265 | JP NC,Process_Tracked_Enemy_Entity_Frame | |||
| 58268 | LD B,7 | |||
| Process_Tracked_Enemy_Entity_Frame | 58270 | INC HL | Increment the animation frame within the mask, add the base offset 40 and write back. | |
| 58271 | INC HL | |||
| 58272 | LD A,(HL) | |||
| 58273 | INC A | |||
| 58274 | AND B | |||
| 58275 | ADD A,40 | |||
| 58277 | LD (HL),A | Jump to Process_Tracked_Enemy_Entity_Phase_End if the animation phase has reached zero. | ||
| 58278 | LD A,C | |||
| 58279 | AND A | |||
| 58280 | JP Z,Process_Tracked_Enemy_Entity_Phase_End | |||
|
Update the entity velocity: apply the angular rate via Advance_RNG_Seed to both Y and X velocity components, clamp each via Clamp_Entity_Velocity, then add the velocities to the Y and X position and clamp to the play area.
|
||||
| Process_Tracked_Enemy_Entity_Move | 58283 | LD D,(IX+7) | Load the Y velocity from the entity record and apply the angular rate via Advance_RNG_Seed. | |
| 58286 | LD E,(IX+8) | |||
| 58289 | CALL Advance_RNG_Seed | Clamp the Y velocity via Clamp_Entity_Velocity and store it back. | ||
| 58292 | CALL Clamp_Entity_Velocity | |||
| 58295 | LD (IX+7),H | Add the clamped Y velocity to the entity Y position; load and apply the angular rate to the X velocity. | ||
| 58298 | LD (IX+8),L | |||
| 58301 | LD D,(IX+3) | |||
| 58304 | LD E,(IX+4) | |||
| 58307 | ADD HL,DE | |||
| 58308 | LD A,H | |||
| 58309 | CP 16 | |||
| 58311 | JP NC,Process_Tracked_Enemy_Entity_Clamp_Y | |||
| 58314 | LD H,16 | |||
| 58316 | JP Process_Tracked_Enemy_Entity_X | |||
| Process_Tracked_Enemy_Entity_Clamp_Y | 58319 | CP 169 | Clamp the Y position to the floor 16 or ceiling 169. | |
| 58321 | JP C,Process_Tracked_Enemy_Entity_X | |||
| 58324 | LD H,169 | |||
| Process_Tracked_Enemy_Entity_X | 58326 | LD (IX+3),H | Store the clamped Y position and load the X velocity components. | |
| 58329 | LD (IX+4),L | |||
| 58332 | LD D,(IX+9) | |||
| 58335 | LD E,(IX+10) | Apply the angular rate to the X velocity and clamp via Clamp_Entity_Velocity. | ||
| 58338 | CALL Advance_RNG_Seed | |||
| 58341 | CALL Clamp_Entity_Velocity | |||
| 58344 | LD (IX+9),H | Add the clamped X velocity to the entity X position. | ||
| 58347 | LD (IX+10),L | |||
| 58350 | LD D,(IX+5) | |||
| 58353 | LD E,(IX+6) | |||
| 58356 | ADD HL,DE | |||
| 58357 | LD A,H | |||
| 58358 | CP 8 | |||
| 58360 | JP NC,Process_Tracked_Enemy_Entity_Clamp_X | |||
| 58363 | LD H,8 | |||
| 58365 | JP Process_Tracked_Enemy_Entity_Draw | |||
| Process_Tracked_Enemy_Entity_Clamp_X | 58368 | CP 233 | Clamp the X position to the floor 8 or ceiling 233. | |
| 58370 | JP C,Process_Tracked_Enemy_Entity_Draw | |||
| 58373 | LD H,233 | |||
| Process_Tracked_Enemy_Entity_Draw | 58375 | LD (IX+5),H | Store the clamped X position and rebuild the spawn buffer via Build_Entity_Spawn_Record. | |
| 58378 | LD (IX+6),L | |||
| 58381 | CALL Build_Entity_Spawn_Record | |||
| 58384 | LD B,66 | Set colour INK: RED, PAPER: BLACK (BRIGHT) in B', draw the entity via Draw_Wide_Entity_Sprite, and restore HL. | ||
| 58386 | EXX | |||
| 58387 | LD HL,50449 | |||
| 58390 | CALL Draw_Wide_Entity_Sprite | |||
|
This entry point is used by the routine at Kill_Tracked_Enemy_Entity.
Reload the entity list pointer from Entity_Pointer_Stash and advance it by 12 bytes.
|
||||
| Process_Tracked_Enemy_Entity_Reload | 58393 | LD HL,(50447) | Reload HL from Entity_Pointer_Stash. | |
| Process_Tracked_Enemy_Entity_Advance | 58396 | LD DE,12 | Advance the entity pointer by 12 bytes and return. | |
| 58399 | ADD HL,DE | |||
| 58400 | RET | |||
|
The animation phase has reached zero. If the entity still has remaining passes, promote it to the next phase and spawn a cluster entity; otherwise remove it from the active set.
|
||||
| Process_Tracked_Enemy_Entity_Phase_End | 58401 | LD A,(IX+1) | If the entity has remaining animation passes, jump to Process_Tracked_Enemy_Entity_Promote; otherwise fall through to remove it. | |
| 58404 | AND A | |||
| 58405 | JP NZ,Process_Tracked_Enemy_Entity_Promote | |||
| 58408 | LD HL,50220 | Decrement the active entity count at 50220 and the total wave enemy count at Active_Enemy_Count; write handler Process_Tracked_Enemy_Entity_Advance and jump to Process_Tracked_Enemy_Entity_Reload. | ||
| 58411 | DEC (HL) | |||
| 58412 | LD HL,50204 | |||
| 58415 | DEC (HL) | |||
| 58416 | LD DE,58396 | |||
| 58419 | LD (IX-1),D | |||
| 58422 | LD (IX-2),E | |||
| 58425 | JP Process_Tracked_Enemy_Entity_Reload | |||
|
Entity still has passes remaining: increment the animation counters, spawn a cluster entity with handler Process_Cluster_Entity into the entity list, and re-enter the movement update loop at Process_Tracked_Enemy_Entity_Move.
|
||||
| Process_Tracked_Enemy_Entity_Promote | 58428 | LD (IX+0),20 | Set the animation byte to 20 decrement the remaining pass count, and increment the active count at 50220 and Active_Enemy_Count. | |
| 58432 | DEC (IX+1) | |||
| 58435 | LD HL,50221 | |||
| 58438 | INC (HL) | |||
| 58439 | LD HL,50204 | |||
| 58442 | INC (HL) | |||
| 58443 | LD HL,(50441) | Load the entity list write pointer from *Entity_List_Write_Pointer and write the Process_Cluster_Entity handler. | ||
| 58446 | LD DE,58656 | |||
| 58449 | LD (HL),E | |||
| 58450 | INC HL | |||
| 58451 | LD (HL),D | Write the entity type (28), Y and X coordinates from the current entity into the new cluster record. | ||
| 58452 | INC HL | |||
| 58453 | LD (HL),28 | |||
| 58455 | INC HL | |||
| 58456 | LD B,(IX+3) | |||
| 58459 | LD (HL),B | |||
| 58460 | INC HL | |||
| 58461 | LD C,(IX+5) | |||
| 58464 | LD (HL),C | |||
| 58465 | PUSH HL | Stash HL, set colour INK: CYAN, PAPER: BLACK (BRIGHT) in B', draw the entity colour slot via Draw_Entity_Sprite, and restore HL. | ||
| 58466 | DEC HL | |||
| 58467 | DEC HL | |||
| 58468 | EXX | |||
| 58469 | LD B,69 | |||
| 58471 | EXX | |||
| 58472 | CALL Draw_Entity_Sprite | |||
| 58475 | POP HL | Write the trailing record bytes, advance HL, save the entity list pointer, write the 53668 terminator, and jump to Process_Tracked_Enemy_Entity_Move. | ||
| 58476 | INC HL | |||
| 58477 | LD (HL),5 | |||
| 58479 | INC HL | |||
| 58480 | LD (HL),9 | |||
| 58482 | INC HL | |||
| 58483 | LD (HL),0 | |||
| 58485 | INC HL | |||
| 58486 | LD (HL),25 | |||
| 58488 | INC HL | |||
| 58489 | INC HL | |||
| 58490 | INC HL | |||
| 58491 | LD (HL),5 | |||
| 58493 | INC HL | |||
| 58494 | LD (HL),5 | |||
| 58496 | INC HL | |||
| 58497 | INC HL | |||
| 58498 | INC HL | |||
| 58499 | LD (HL),255 | |||
| 58501 | INC HL | |||
| 58502 | LD DE,53668 | |||
| 58505 | LD (50441),HL | |||
| 58508 | LD (HL),E | |||
| 58509 | INC HL | |||
| 58510 | LD (HL),D | |||
| 58511 | JP Process_Tracked_Enemy_Entity_Move | |||
| Prev: 58182 | Up: Map | Next: 58514 |