Prev: 47304 Up: Map Next: 47395
47322: 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 47322 CALL SetPixelAdjustments_Sparkle Set the pixel adjustments of a sparkle.
47325 LD A,(23624) Fetch the graphic number of the first special object of the room from ObjectsTable_FirstSpecial.
47328 AND A Test whether the slot is empty.
47329 JP NZ,HandleRepelSpell_Vanish Jump to HandleRepelSpell_Vanish if the slot is in use, to remove the bubbles.
47332 SET 1,(IX+7) Flag the bubbles to be ignored in the 3D calculations.
47336 CALL ApplyGravityAndMove Apply gravity to the bubbles and move them.
47339 CALL NextSpriteNumber Change to the next graphic of the bubbles.
47342 LD A,(IX+3) Fetch the Z coordinate of the bubbles.
47345 CP 160 Compare it with 160.
47347 LD (IX+11),2 Set the speed in Z to 2.
47351 JR C,HandleCauldronBubbles_Draw Jump to HandleCauldronBubbles_Draw if the bubbles have not reached the top.
47353 LD (IX+11),1 Set the speed in Z to 1.
47357 LD A,(23560) Fetch the graphic number of the legs of the player from ObjectsTable.
47360 SUB 48 Take off the first graphic number of Wulf.
47362 CP 16 Jump to HandleCauldronBubbles_Repel if the player is Wulf.
47364 JR C,HandleCauldronBubbles_Repel
47366 LD A,(IX+0) Fetch the graphic number of the bubbles.
47369 AND %00000011 Keep the frame of the animation.
47371 JR NZ,HandleCauldronBubbles_Draw Jump to HandleCauldronBubbles_Draw if it is not the first frame.
47373 CALL FindNextObjectRequired Find the next object that is needed.
47376 LD A,(HL) Fetch its graphic number.
47377 OR %10101000 Make it the graphic number of the object that shows through the bubbles.
47379 LD (IX+0),A Store the graphic number.
This entry point is used by the routine at HandleSpecialObjectInCauldron.
Flag the bubbles to be redrawn.
HandleCauldronBubbles_Draw 47382 JP SetWipeAndDrawFlags Flag the bubbles to be drawn again.
Turn the bubbles into the spell that repels Wulf.
HandleCauldronBubbles_Repel 47385 SET 2,(IX+0) Turn the bubbles into the spell that repels Wulf.
47389 RES 1,(IX+7) Make the spell take part in the 3D calculations.
47393 JR HandleCauldronBubbles_Draw Jump to HandleCauldronBubbles_Draw.
Prev: 47304 Up: Map Next: 47395