![]() |
Routines |
| Prev: 59311 | Up: Map | Next: 59491 |
|
Used by the routine at Evaluate_And_Spawn_Tracked_Enemies.
Initialises the tracked-enemy active count at 50221 to zero, copies the per-wave count byte into 50220 and adds it to the total wave enemy count at Active_Enemy_Count, then stashes the wave data pointer. If the count is zero, jumps to Spawn_Tracked_Enemy_Entities_Terminate; otherwise loops B times: writes a 14-byte entity record (handler Process_Tracked_Enemy_Entity, entity type 176 random type variant, random screen position via Pick_Random_Spawn_Position_Y, three initial bytes from the wave data for velocity seeds, and 255 as the terminator) into the entity list via *Entity_List_Write_Pointer, spawning each entity via Draw_Wide_Entity_Sprite. Closes the entity list with the 53668 terminator.
|
||||
| Spawn_Tracked_Enemy_Entities | 59343 | XOR A | Clear 50221 copy the spawn count into 50220 and accumulate it into the wave enemy count at Active_Enemy_Count. | |
| 59344 | LD (50221),A | |||
| 59347 | LD A,(HL) | |||
| 59348 | LD (50220),A | |||
| 59351 | PUSH AF | |||
| 59352 | LD B,A | Stash the wave data pointer, load the entity list write pointer, and jump to Spawn_Tracked_Enemy_Entities_Terminate if the count is zero. | ||
| 59353 | LD A,(50204) | |||
| 59356 | ADD A,B | |||
| 59357 | LD (50204),A | |||
| 59360 | POP AF | |||
| 59361 | INC HL | |||
| 59362 | AND A | |||
| 59363 | PUSH HL | |||
| 59364 | LD HL,(50441) | |||
|
This entry point is used by the routine at 36963.
|
||||
| Spawn_Tracked_Enemy_Entities_0 | 59367 | JP Z,Spawn_Tracked_Enemy_Entities_Terminate | ||
| 59370 | LD B,A | |||
| Spawn_Tracked_Enemy_Entities_Record | 59371 | PUSH BC | Write the Process_Tracked_Enemy_Entity handler and entity type 176 to the entity list record. | |
| 59372 | LD DE,58208 | |||
| 59375 | LD (HL),E | |||
| 59376 | INC HL | |||
| 59377 | LD (HL),D | |||
| 59378 | INC HL | |||
| 59379 | LD (HL),176 | |||
| 59381 | INC HL | |||
| 59382 | LD (HL),4 | Generate a random entity type variant via Generate_Random_Byte. | ||
| 59384 | INC HL | |||
| 59385 | CALL Generate_Random_Byte | Mask to 2 bits for the type variant and add 40. | ||
| 59388 | AND 3 | |||
| 59390 | ADD A,40 | |||
| 59392 | LD (HL),A | Write the entity type variant and advance. | ||
| 59393 | INC HL | |||
| 59394 | PUSH HL | Point HL at the spawn buffer, write the type variant, and call Pick_Random_Spawn_Position_Y to generate a valid random screen position. | ||
| 59395 | LD HL,50449 | |||
| 59398 | LD (HL),A | |||
| 59399 | INC HL | |||
| 59400 | CALL Pick_Random_Spawn_Position_Y | |||
| 59403 | LD DE,50491 | |||
| 59406 | LDD | Copy three bytes from the wave data at 50491 using LDD×4 and apply the direction delta via Apply_Direction_Delta. | ||
| 59408 | LDD | |||
| 59410 | LDD | |||
| 59412 | PUSH HL | |||
| 59413 | LDD | |||
| 59415 | LD A,(HL) | |||
| 59416 | LD (DE),A | |||
| 59417 | EX DE,HL | |||
| 59418 | CALL Apply_Direction_Delta | |||
| 59421 | EXX | Set colour INK: RED, PAPER: BLACK (BRIGHT) in B' and spawn the entity via Draw_Wide_Entity_Sprite. | ||
| 59422 | LD B,66 | |||
| 59424 | EXX | |||
| 59425 | CALL Draw_Wide_Entity_Sprite | |||
| 59428 | POP HL | Write three velocity seed bytes, initial deltas, and the 255 record terminator; loop back to Spawn_Tracked_Enemy_Entities_Record for the next entity. | ||
| 59429 | POP DE | |||
| 59430 | XOR A | |||
| 59431 | LDI | |||
| 59433 | LD (DE),A | |||
| 59434 | INC DE | |||
| 59435 | LDI | |||
| 59437 | LD (DE),A | |||
| 59438 | INC DE | |||
| 59439 | PUSH DE | |||
| 59440 | CALL Advance_RNG_Seed | |||
| 59443 | LD DE,0 | |||
| 59446 | CALL Clamp_Entity_Velocity | |||
| 59449 | POP DE | |||
| 59450 | EX DE,HL | |||
| 59451 | LD (HL),D | |||
| 59452 | INC HL | |||
| 59453 | LD (HL),E | |||
| 59454 | INC HL | |||
| 59455 | PUSH HL | |||
| 59456 | CALL Advance_RNG_Seed | |||
| 59459 | LD DE,0 | |||
| 59462 | CALL Clamp_Entity_Velocity | |||
| 59465 | POP DE | |||
| 59466 | EX DE,HL | |||
| 59467 | LD (HL),D | |||
| 59468 | INC HL | |||
| 59469 | LD (HL),E | |||
| 59470 | INC HL | |||
| 59471 | LD (HL),255 | |||
| 59473 | INC HL | |||
| 59474 | POP BC | |||
| 59475 | DJNZ Spawn_Tracked_Enemy_Entities_Record | |||
| Spawn_Tracked_Enemy_Entities_Terminate | 59477 | LD DE,53668 | Save the entity list pointer to *Entity_List_Write_Pointer and write the 53668 terminator. | |
| 59480 | LD (50441),HL | |||
| 59483 | LD (HL),E | |||
| 59484 | INC HL | |||
| 59485 | LD (HL),D | Write 255 and advance HL. | ||
| 59486 | INC HL | |||
| 59487 | LD (HL),255 | Restore the wave data pointer and return. | ||
| 59489 | POP HL | |||
| 59490 | RET | |||
| Prev: 59311 | Up: Map | Next: 59491 |