![]() |
Routines |
| Prev: E863 | Up: Map | Next: E92C |
|
Per-frame handler for the wall-bouncing enemy. If the wave start delay is still counting down, advances to the next entity record without processing. Otherwise checks for player contact via Find_Colliding_Entity and triggers player death via Strip_Attributes_And_Fade if the bouncer is touching. If the bouncer is already dying, skips to the draw step. Searches the wave enemy list for a collision via Find_Colliding_Wave_Enemy; if none is found, defers to Handle_Enemy_Collision_Chain. On a hit, decrements a countdown timer; when it expires the bouncer erases itself, nudges one step toward the player, picks a new heading, and redraws.
|
||||||||
|
If the wave is still warming up, skip ahead without processing.
|
||||||||
| Process_Wall_Bouncing_Enemy | E881 | LD A,($C533) | If the wave start delay at Wave_Start_Delay is non-zero, skip to Process_Wall_Bouncing_Enemy_Advance. | |||||
| E884 | AND A | |||||||
| E885 | JP NZ,Process_Wall_Bouncing_Enemy_Advance | |||||||
|
Check whether the player is touching the bouncer and kill them if so.
|
||||||||
| E888 | INC HL | Advance to the velocity pair. | ||||||
| E889 | INC HL | |||||||
| E88A | EXX | Switch to alternate registers. | ||||||
| E88B | CALL Find_Colliding_Entity | Search for a contact slot via Find_Colliding_Entity. | ||||||
| E88E | JP NC,Kill_Wall_Bouncing_Enemy | Jump to Kill_Wall_Bouncing_Enemy if player contact is confirmed. | ||||||
| E891 | LD HL,$C4D4 | Load the player position from Player_Y_Position and test overlap via HitTestBounds8AtHL. | ||||||
| E894 | CALL HitTestBounds8AtHL | |||||||
| E897 | JP NC,Strip_Attributes_And_Fade | Kill the player via Strip_Attributes_And_Fade if the overlap test confirmed contact. | ||||||
| E89A | EXX | Switch back and step three bytes toward the entity record start. | ||||||
| E89B | DEC HL | |||||||
| E89C | DEC HL | |||||||
| E89D | DEC HL | |||||||
|
If the bouncer is already dying, skip directly to the draw step.
|
||||||||
| E89E | DEC HL | If the bouncer is already dying (bit 0 of active flag), skip to Process_Wall_Bouncing_Enemy_Advance. | ||||||
| E89F | DEC HL | |||||||
| E8A0 | LD A,(HL) | |||||||
| E8A1 | SRL A | |||||||
| E8A3 | JR C,Process_Wall_Bouncing_Enemy_Advance | |||||||
|
Search the wave enemy list for an enemy the bouncer has hit.
|
||||||||
| E8A5 | INC HL | Step ahead and search the wave enemy list for a collision via Find_Colliding_Wave_Enemy. | ||||||
| E8A6 | INC HL | |||||||
| E8A7 | CALL Find_Colliding_Wave_Enemy | |||||||
| E8AA | JP NC,Handle_Enemy_Collision_Chain | Jump to Handle_Enemy_Collision_Chain if no wave enemy collision was detected. | ||||||
| E8AD | EXX | Switch to alternate registers and step back to the bounce timer. | ||||||
| E8AE | DEC HL | |||||||
|
Tick down the bounce countdown; erase and redirect when it expires.
|
||||||||
| E8AF | DEC HL | Step to the bounce timer and subtract 04. | ||||||
| E8B0 | LD A,(HL) | |||||||
| E8B1 | SUB $04 | |||||||
| E8B3 | LD (HL),A | |||||||
| E8B4 | JR NZ,Process_Wall_Bouncing_Enemy_Advance | If the countdown has not reached zero, skip to Process_Wall_Bouncing_Enemy_Advance. | ||||||
| E8B6 | LD (HL),$0C | Reset the bounce countdown to 0C. | ||||||
| E8B8 | INC HL | Erase the bouncer sprite via Erase_Wide_Entity_Sprite, preserving the entity pointer. | ||||||
| E8B9 | PUSH HL | |||||||
| E8BA | CALL Erase_Wide_Entity_Sprite | |||||||
| E8BD | POP HL | |||||||
| E8BE | INC HL | |||||||
|
Step the bouncer one pixel toward the player and pick a new heading.
|
||||||||
| E8BF | LD A,($C4D4) | Measure the signed Y distance to the player at Player_Y_Position. | ||||||
| E8C2 | SUB (HL) | |||||||
| E8C3 | JR Z,Process_Wall_Bouncing_Enemy_Step_Y | Set the Y step: 01 (player below), FF (player above), or 00. | ||||||
| E8C5 | LD A,$01 | |||||||
| E8C7 | JR NC,Process_Wall_Bouncing_Enemy_Step_Y | |||||||
| E8C9 | LD A,$FF | |||||||
| Process_Wall_Bouncing_Enemy_Step_Y | E8CB | LD B,A | Store the Y step in B, apply it to the Y position, and advance. | |||||
| E8CC | ADD A,(HL) | |||||||
| E8CD | LD (HL),A | |||||||
| E8CE | INC HL | |||||||
| E8CF | LD A,($C4D5) | Measure the signed X distance to the player at Player_X_Position. | ||||||
| E8D2 | SUB (HL) | |||||||
| E8D3 | JR Z,Process_Wall_Bouncing_Enemy_Step_X | Set the X step: 01 (player right), FF (player left), or 00. | ||||||
| E8D5 | LD A,$01 | |||||||
| E8D7 | JR NC,Process_Wall_Bouncing_Enemy_Step_X | |||||||
| E8D9 | LD A,$FF | |||||||
| Process_Wall_Bouncing_Enemy_Step_X | E8DB | LD C,A | Store the X step in C, apply it to the X position, and pack both step signs into a 4-bit direction code. | |||||
| E8DC | ADD A,(HL) | |||||||
| E8DD | LD (HL),A | |||||||
| E8DE | LD A,C | |||||||
| E8DF | AND $03 | |||||||
| E8E1 | RLA | |||||||
| E8E2 | RLA | |||||||
|
Apply the new heading: look up the direction colour and redraw.
|
||||||||
| E8E3 | LD C,A | Pack the Y and X step signs into a 4-bit direction code. | ||||||
| E8E4 | LD A,B | |||||||
| E8E5 | AND $03 | |||||||
| E8E7 | OR C | |||||||
| E8E8 | LD C,A | |||||||
| E8E9 | LD B,$00 | |||||||
| E8EB | EX DE,HL | Look up the heading colour from the direction table at Enemy_Direction_Code_Table. | ||||||
| E8EC | LD HL,$EAF7 | |||||||
| E8EF | ADD HL,BC | |||||||
| E8F0 | LD A,(HL) | |||||||
| E8F1 | PUSH DE | |||||||
| E8F2 | DEC DE | |||||||
| E8F3 | DEC DE | Write the heading colour to the entity record. | ||||||
| E8F4 | LD (DE),A | |||||||
| E8F5 | LD A,($C4E5) | Look up the animation frame colour from the cycle table at Enemy_Colour_Cycle_Table. | ||||||
| E8F8 | AND $07 | |||||||
| E8FA | LD C,A | |||||||
| E8FB | LD B,$00 | |||||||
| E8FD | LD HL,$EA0F | |||||||
| E900 | ADD HL,BC | |||||||
| E901 | LD A,(HL) | |||||||
| E902 | EX DE,HL | Restore the entity pointer, set the frame colour in B', and respawn the bouncer via Draw_Wide_Entity_Sprite. | ||||||
| E903 | EXX | |||||||
| E904 | LD B,A | |||||||
| E905 | EXX | |||||||
| E906 | CALL Draw_Wide_Entity_Sprite | |||||||
| E909 | POP HL | Restore the entity pointer from the stack. | ||||||
| E90A | INC HL | Advance four bytes to the next entity record. | ||||||
| E90B | INC HL | |||||||
| E90C | INC HL | |||||||
| E90D | INC HL | |||||||
| E90E | RET | Return. | ||||||
|
This entry point is used by the routine at Handle_Enemy_Collision_Chain.
Bouncer skipped: look up the animation colour and redraw without moving.
|
||||||||
| Process_Wall_Bouncing_Enemy_Advance | E90F | INC HL | Advance one byte, stash the pointer, and read the frame index from Colour_Cycle_Table_Pointer. | |||||
| E910 | PUSH HL | |||||||
| E911 | LD A,($C4E5) | |||||||
| E914 | AND $07 | |||||||
| E916 | LD C,A | |||||||
| E917 | LD B,$00 | |||||||
| E919 | EX DE,HL | Look up the animation colour from Enemy_Colour_Cycle_Table and set it in B'. | ||||||
| E91A | LD HL,$EA0F | |||||||
| E91D | ADD HL,BC | |||||||
| E91E | LD A,(HL) | |||||||
| E91F | EX DE,HL | |||||||
| E920 | EXX | |||||||
| E921 | LD B,A | |||||||
| E922 | EXX | |||||||
| E923 | CALL Paint_Wide_Entity_Attributes | Draw the bouncer in its current position via Paint_Wide_Entity_Attributes. | ||||||
| E926 | POP HL | Restore the entity pointer from the stack. | ||||||
| E927 | LD DE,$0006 | Step six bytes to the next entity record. | ||||||
| E92A | ADD HL,DE | |||||||
| E92B | RET | Return. | ||||||
| Prev: E863 | Up: Map | Next: E92C |