Prev: 52353 Up: Map Next: 52457
52430: Primary Enemy Entity Handler
Entity handler stored in primary wave enemy records. Called once per frame by the entity dispatcher in DispatchWordFromHL. Searches the entity list for a collision-free position via Find_Colliding_Entity. If a free position exists, hands off to Process_Enemy_Entity to draw the entity and detect contact with other enemies. Otherwise checks whether the enemy touches the player via HitTestBounds8AtHL; if the player is hit, the death transition fires via Strip_Attributes_And_Fade.
Primary_Enemy_Entity_Handler 52430 EXX Switch to alternate registers and search the entity list for a free slot via Find_Colliding_Entity; restore main registers.
52431 CALL Find_Colliding_Entity
52434 EXX
52435 JR NC,Process_Enemy_Entity If a free slot was found, hand off to Process_Enemy_Entity.
52437 EXX Load the player's screen position into alternate HL.
52438 LD HL,50388
52441 EXX
52442 CALL HitTestBounds8AtHL Test whether the enemy's bounds overlap the player via HitTestBounds8AtHL.
52445 JP NC,Strip_Attributes_And_Fade If the player is hit, trigger the death transition via Strip_Attributes_And_Fade.
52448 INC HL Advance the entity list pointer four bytes and save it in BC.
52449 INC HL
52450 INC HL
52451 INC HL
52452 LD B,H
52453 LD C,L
52454 JP Draw_Spawned_Entity_Attribute Write the entity's attribute colour via Draw_Spawned_Entity_Attribute.
Prev: 52353 Up: Map Next: 52457