Prev: B555 Up: Map Next: B58B
B566: Handler: the finale sparks (types 131 to 133)
When the fourteenth object goes into the cauldron, prepare_final_animation clears away objects 3 to 13 and turns every plain block from object 14 on into one of these. Below height $A4 a spark rises two a frame while moving four a frame round the middle of the room: which quarter of the room it is in picks a direction from dX_dY_tbl, and each direction carries it into the next quarter round. Once it is high enough it flies at Sabreman instead, and when it comes within 6 of him on both X and Y the game ends -- through game_over, which sees the finale flag at $5BC3 and shows the closing message.
Every frame each spark takes a random one of the three frames, and leaves its height at $5BC5 for end_of_frame to turn into a tone.
Input
IX the spark
upd_131_to_133 B566 CALL adj_m4_m12 drawing offsets
B569 LD A,(IX+$03) high enough: go for Sabreman
B56C CP $A4
B56E JR NC,spark_near_player
B570 LD (IX+$0B),$03 dZ = 3; gravity takes one, so it rises two a frame
B574 LD A,(IX+$01) L = which quarter: bit 1 from X, bit 0 from Y
B577 RLCA
B578 AND $01
B57A LD L,A
B57B LD A,(IX+$02)
B57E AND $80
B580 OR L
B581 RLCA
B582 AND $03
B584 LD L,A
B585 LD BC,dX_dY_tbl go and set that quarter's direction
B588 JP jump_to_tbl_entry
Prev: B555 Up: Map Next: B58B