Prev: 46404 Up: Map Next: 46475
46438: Handle Ending Sparkles
Handles one of the sparkles that fly off the blocks when the cauldron room is shown at the end of the game. A sparkle rises until it is high enough, in one of four diagonal directions that depend on the part of the room it is in, and then flies at the player.
Input
IX Address of the sparkle object
Rise until the sparkle is high enough, then fly at the player.
HandleEndingSparkles 46438 CALL SetPixelAdjustments_Sparkle Set the pixel adjustments for a sparkle.
46441 LD A,(IX+3) Fetch the height of the sparkle.
46444 CP 164 Jump to SendSparkleAtPlayer if it has reached the top.
46446 JR NC,SendSparkleAtPlayer
Pick a diagonal from the part of the room the sparkle is in.
46448 LD (IX+11),3 Make the sparkle rise at a speed of 3.
46452 LD A,(IX+1) Fetch the X coordinate of the sparkle.
46455 RLCA Rotate bit 7 into bit 0.
46456 AND %00000001 Keep only that bit.
46458 LD L,A Stash it in L.
46459 LD A,(IX+2) Fetch the Y coordinate of the sparkle.
46462 AND %10000000 Keep bit 7 of it.
46464 OR L Add the bit from the X coordinate.
46465 RLCA Rotate the two bits into bits 0 and 1.
46466 AND %00000011 Keep only those two bits.
46468 LD L,A Use them as the number of the entry of the direction table.
46469 LD BC,46475 Point BC at SparkleDirectionTable.
46472 JP RunGame_JumpToHandler Jump to the routine for the direction.
Prev: 46404 Up: Map Next: 46475