Prev: C86F Up: Map Next: C8D5
C8AB: Replace Overlapping Special Object
Handles two objects that fill the same space. If neither of them is ignored and one of them is a valve (objects 60 to 63) it is replaced by a sparkle.
Input
IX The address of the first object
IY The address of the other object
Skip if either object is ignored.
ReplaceOverlappingSpecialObject C8AB LD A,(IX+$07) Fetch the flags of the first object.
C8AE OR (IY+$07) Merge the flags of the other object.
C8B1 AND %00000010 Keep only bit 1.
C8B3 JP NZ,DrawObjectsInOrder_FindSecond Jump to DrawObjectsInOrder_FindSecond if either object is ignored.
Replace a valve with a sparkle.
C8B6 LD A,(IX+$00) Fetch the sprite number of the first object.
C8B9 SUB $60 Take 60 off it, to get the number of the valve.
C8BB CP $04 Jump to ReplaceOverlappingSpecialObject_Other if it is not a valve.
C8BD JR NC,ReplaceOverlappingSpecialObject_Other
C8BF LD (IX+$00),$40 Replace it with a sparkle.
C8C3 JR ReplaceOverlappingSpecialObject_Next Jump to ReplaceOverlappingSpecialObject_Next.
Try the other object.
ReplaceOverlappingSpecialObject_Other C8C5 LD A,(IY+$00) Fetch the sprite number of the other object.
C8C8 SUB $60 Take 60 off it, to get the number of the valve.
C8CA CP $04 Jump to ReplaceOverlappingSpecialObject_Next if it is not a valve.
C8CC JR NC,ReplaceOverlappingSpecialObject_Next
C8CE LD (IY+$00),$40 Replace it with a sparkle.
Compare the first object with the next one.
ReplaceOverlappingSpecialObject_Next C8D2 JP DrawObjectsInOrder_FindSecond Jump to DrawObjectsInOrder_FindSecond.
Prev: C86F Up: Map Next: C8D5