Prev: B8C8 Up: Map Next: B923
B8DA: Handle Cauldron Bubbles
Handles the bubbles that rise from the cauldron. They are replaced by the object that is needed next, shown once in four frames, when they are at the top, unless the player is Wulf, when they turn into the spell that repels him. The bubbles vanish once a special object appears in the first slot.
Input
IX Address of the bubbles object
Rise and show the next required object, or the repel spell.
HandleCauldronBubbles B8DA CALL SetPixelAdjustments_Sparkle Set the pixel adjustments of a sparkle.
B8DD LD A,($5C48) Fetch the graphic number of the first special object of the room from ObjectsTable_FirstSpecial.
B8E0 AND A Test whether the slot is empty.
B8E1 JP NZ,HandleRepelSpell_Vanish Jump to HandleRepelSpell_Vanish if the slot is in use, to remove the bubbles.
B8E4 SET 1,(IX+$07) Flag the bubbles to be ignored in the 3D calculations.
B8E8 CALL ApplyGravityAndMove Apply gravity to the bubbles and move them.
B8EB CALL NextSpriteNumber Change to the next graphic of the bubbles.
B8EE LD A,(IX+$03) Fetch the Z coordinate of the bubbles.
B8F1 CP $A0 Compare it with A0.
B8F3 LD (IX+$0B),$02 Set the speed in Z to 02.
B8F7 JR C,HandleCauldronBubbles_Draw Jump to HandleCauldronBubbles_Draw if the bubbles have not reached the top.
B8F9 LD (IX+$0B),$01 Set the speed in Z to 01.
B8FD LD A,($5C08) Fetch the graphic number of the legs of the player from ObjectsTable.
B900 SUB $30 Take off the first graphic number of Wulf.
B902 CP $10 Jump to HandleCauldronBubbles_Repel if the player is Wulf.
B904 JR C,HandleCauldronBubbles_Repel
B906 LD A,(IX+$00) Fetch the graphic number of the bubbles.
B909 AND %00000011 Keep the frame of the animation.
B90B JR NZ,HandleCauldronBubbles_Draw Jump to HandleCauldronBubbles_Draw if it is not the first frame.
B90D CALL FindNextObjectRequired Find the next object that is needed.
B910 LD A,(HL) Fetch its graphic number.
B911 OR %10101000 Make it the graphic number of the object that shows through the bubbles.
B913 LD (IX+$00),A Store the graphic number.
This entry point is used by the routine at HandleSpecialObjectInCauldron.
Flag the bubbles to be redrawn.
HandleCauldronBubbles_Draw B916 JP SetWipeAndDrawFlags Flag the bubbles to be drawn again.
Turn the bubbles into the spell that repels Wulf.
HandleCauldronBubbles_Repel B919 SET 2,(IX+$00) Turn the bubbles into the spell that repels Wulf.
B91D RES 1,(IX+$07) Make the spell take part in the 3D calculations.
B921 JR HandleCauldronBubbles_Draw Jump to HandleCauldronBubbles_Draw.
Prev: B8C8 Up: Map Next: B923