Prev: ADA1 Up: Map Next: AF01
AECC: Handle Berk Action
Used by the routines at Update_Berk_State and Update_Timed_Events.
Flash the status attribute strip, play a stinger, clear messaging attrs, then count down Pointer_BerkHeldEntity / score.
Handle_Berk_Action AECC LD HL,$5AB9 Point HL at attribute-file address 5AB9 (attribute buffer).
AECF LD B,$06 Load B with 06 as a loop counter.
Paint the status attribute strip bright, play Berk's action stinger, then clear messaging attrs.
Handle_Berk_Action_FillAttributes AED1 LD (HL),$78 Write attribute/value 78 through the pointer in HL.
AED3 INC HL Advance 5AB9 (attribute buffer) by one byte.
AED4 DJNZ Handle_Berk_Action_FillAttributes Decrease the loop counter in B and jump to Handle_Berk_Action_FillAttributes if more iterations remain.
AED6 LD A,$02 Load A with sound index 02.
AED8 CALL Queue_Sound Call Queue_Sound to queue a sound effect.
AEDB CALL Play_QueuedSound Call Play_QueuedSound to play a fanfare / stinger.
AEDE CALL Clear_Messaging_Attributes Call Clear_Messaging_Attributes to clear messaging attributes.
Count down the held-entity pointer and bump the score while Pointer_BerkHeldEntity is non-zero.
Handle_Berk_Action_ScoreHeldCountdown AEE1 LD HL,($72DB) Load HL with the pointer to the entity Berk is holding (Pointer_BerkHeldEntity).
AEE4 LD A,H Copy the high byte of the pointer into A.
AEE5 OR L OR L into A to test whether Pointer_BerkHeldEntity is zero.
AEE6 JP Z,Initialise_Room_Display If the result was zero, jump to Initialise_Room_Display.
AEE9 DEC HL Step pointer to the entity Berk is holding back by one byte.
AEEA LD ($72DB),HL Store HL in the pointer to the entity Berk is holding (Pointer_BerkHeldEntity).
AEED LD HL,($72DD) Load HL with the score (Score).
AEF0 INC HL Advance score by one byte.
AEF1 LD ($72DD),HL Store HL in the score (Score).
AEF4 CALL Initialise_Room_Display Call Initialise_Room_Display to initialise the room display.
AEF7 LD A,$01 Load A with sound index 01.
AEF9 CALL Queue_Sound Call Queue_Sound to queue a sound effect.
AEFC CALL Play_QueuedSound Call Play_QueuedSound to play a fanfare / stinger.
AEFF JR Handle_Berk_Action_ScoreHeldCountdown Jump to Handle_Berk_Action_ScoreHeldCountdown to keep scanning held-entity slots.
Prev: ADA1 Up: Map Next: AF01