Prev: C232 Up: Map Next: C274
C238: Handle Object At Centre Of Room
Used by the routine at HandleObjectDroppedInCauldron.
Handles an object that has been dropped in the cauldron once it is at the centre of the room. If it is above the cauldron it is flagged to be ignored in the 3D calculations and left to fall. When it has dropped to the bottom the object is added to the cauldron.
Input
IX Address of the object
HandleObjectAtCentreOfRoom C238 LD A,$80 Set A to the height of the bottom of the cauldron.
C23A CP (IX+$03) Compare it with the Z coordinate of the object.
C23D JR NC,AddObjectToCauldron Jump to AddObjectToCauldron if the object is at the bottom of the cauldron.
C23F SET 1,(IX+$07) Flag the object to be ignored in the 3D calculations.
C243 JR HandleObjectDroppedInCauldron_Move Jump to HandleObjectDroppedInCauldron_Move to let it fall.
The object is in the cauldron. If it is the one that is needed next, count it and show that something happens.
AddObjectToCauldron C245 LD (IX+$03),$80 Set the Z coordinate of the object to the height of the bottom of the cauldron.
C249 CALL FindNextObjectRequired Find the number of the object that is needed next.
C24C LD A,(IX+$00) Fetch the graphic number of the object.
C24F AND %00000111 Convert it to the number of the object.
C251 CP (HL) Compare it with the number that is needed.
C252 JR NZ,AddObjectToCauldron_Remove Jump to AddObjectToCauldron_Remove if it is not the one that is needed.
C254 LD HL,$5BBB Point HL at Charms.
C257 INC (HL) Count one more.
C258 CALL CycleColoursWithSound Make the colours of the screen cycle.
C25B LD A,($5BBB) Fetch the number of charms in the cauldron from Charms.
C25E CP $0E Jump to AddObjectToCauldron_Remove if there are more to come.
C260 JR NZ,AddObjectToCauldron_Remove
C262 CALL PrepareFinalAnimation Start the final animation.
Remove the object.
AddObjectToCauldron_Remove C265 XOR A Clear A.
C266 LD ($5BC4),A Flag that no object is being put into the cauldron at ObjectInCauldronFlag.
C269 LD L,(IX+$10) Fetch the low byte of the address of the table entry that the object comes from.
C26C LD H,(IX+$11) Fetch the high byte.
C26F LD (HL),$00 Clear the graphic number of the table entry.
C271 JP HandleRepelSpell_Vanish Jump to HandleRepelSpell_Vanish to remove the object.
Prev: C232 Up: Map Next: C274