Prev: B610 Up: Map Next: B71B
B654: Animate the fireworks.
Used by the routine at Action14_Win.
Input
Output
The fireworks are update by the use of a script, which holds the position and bitmap of every frame of the animation.
Fireworks B654 LD B,$0A Number of fireworks to display / update.
B656 LD IX,firework_ptrs Address of table that points to the current info on each firework.
Fireworks_0 B65A PUSH BC
B65B LD E,(IX+$02) Get the current frame for current firework, from the script.
B65E LD D,(IX+$03)
B661 LD L,(IX+$04) Get the end address of firework script.
B664 LD H,(IX+$05)
B667 INC DE Move address onto the next pair of firework info in the script.
B668 INC DE
B669 INC DE
B66A INC DE
B66B INC DE
B66C INC DE
B66D OR A See if address has reached the end of the script.
B66E SBC HL,DE Skip on if HL == DE
B670 LD A,H
B671 OR L
B672 JP Z,firework_reset
B675 LD (IX+$02),E Store new address for next time.
B678 LD (IX+$03),D
B67B LD H,D
B67C LD L,E
Fireworks_1 B67D LD A,(HL) Get tile
B67E INC HL
B67F LD E,(HL) Get position
B680 INC HL
B681 LD D,(HL)
B682 INC HL
B683 LD C,(IX+$06) Get colour
B686 CP $FE Check for special commands in the tile value.
B688 CALL Z,firework_explode
B68B CP $FD
B68D CALL Z,firework_erase
B690 CP $FB
B692 CALL Z,firework_split
B695 INC E Position right by two cells and draw.
B696 INC E
B697 CALL TileDraw
B69A LD A,(HL) Get info for second of the pair in the script.
B69B INC HL
B69C LD E,(HL)
B69D INC HL
B69E LD D,(HL)
B69F CP $FE Check for special commands in the tile value.
B6A1 CALL Z,firework_explode
B6A4 CP $FD
B6A6 CALL Z,firework_erase
B6A9 CP $FB
B6AB CALL Z,firework_split
B6AE INC E Position right by two cells and draw.
B6AF INC E
B6B0 CALL TileDraw
B6B3 LD DE,$0007 Address of next firework.
B6B6 ADD IX,DE
B6B8 LD BC,$0352
Fireworks_2 B6BB DEC BC Pause
B6BC LD A,B
B6BD OR C
B6BE JR NZ,Fireworks_2
B6C0 POP BC
B6C1 DJNZ Fireworks_0
B6C3 RET Next.
Reset firework.
firework_reset B6C4 LD A,R Create a random colour other than 'Blue'
B6C6 AND $07
B6C8 CP $01
B6CA JR Z,firework_reset
B6CC SET 6,A
B6CE LD (IX+$06),A
B6D1 LD A,(IX+$00) Get start address of script and put into 'current' pointer.
B6D4 LD (IX+$02),A
B6D7 LD L,A
B6D8 LD A,(IX+$01)
B6DB LD (IX+$03),A
B6DE LD H,A
B6DF PUSH HL
B6E0 PUSH BC
B6E1 PUSH DE
B6E2 LD BC,$320A Make explosion noise.
B6E5 LD DE,$0114
B6E8 LD HL,$7698
B6EB CALL Beep_Effect
B6EE POP DE
B6EF POP BC
B6F0 POP HL
B6F1 JP Fireworks_1 Update firework.
Start explosion animation.
firework_explode B6F4 LD A,$10 Draws the two tiles that make up an exploding firework.
B6F6 INC E
B6F7 INC E
B6F8 CALL TileDraw
B6FB INC A
B6FC INC E
B6FD CALL TileDraw
B700 INC A
B701 RET
Erase firework frame.
firework_erase B702 XOR A Draw two blank tiles over the firework.
B703 INC E
B704 INC E
B705 CALL TileDraw
B708 INC E
B709 CALL TileDraw
B70C RET
Draw firework splitting into three.
firework_split B70D LD A,$13 Draws two tiles that show a firework splitting.
B70F INC E
B710 INC E
B711 CALL TileDraw
B714 INC E
B715 INC A
B716 CALL TileDraw
B719 INC A
B71A RET
Prev: B610 Up: Map Next: B71B