Prev: 51311 Up: Map Next: 51413
51371: 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 96 to 99) 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 51371 LD A,(IX+7) Fetch the flags of the first object.
51374 OR (IY+7) Merge the flags of the other object.
51377 AND %00000010 Keep only bit 1.
51379 JP NZ,DrawObjectsInOrder_FindSecond Jump to DrawObjectsInOrder_FindSecond if either object is ignored.
Replace a valve with a sparkle.
51382 LD A,(IX+0) Fetch the sprite number of the first object.
51385 SUB 96 Take 96 off it, to get the number of the valve.
51387 CP 4 Jump to ReplaceOverlappingSpecialObject_Other if it is not a valve.
51389 JR NC,ReplaceOverlappingSpecialObject_Other
51391 LD (IX+0),64 Replace it with a sparkle.
51395 JR ReplaceOverlappingSpecialObject_Next Jump to ReplaceOverlappingSpecialObject_Next.
Try the other object.
ReplaceOverlappingSpecialObject_Other 51397 LD A,(IY+0) Fetch the sprite number of the other object.
51400 SUB 96 Take 96 off it, to get the number of the valve.
51402 CP 4 Jump to ReplaceOverlappingSpecialObject_Next if it is not a valve.
51404 JR NC,ReplaceOverlappingSpecialObject_Next
51406 LD (IY+0),64 Replace it with a sparkle.
Compare the first object with the next one.
ReplaceOverlappingSpecialObject_Next 51410 JP DrawObjectsInOrder_FindSecond Jump to DrawObjectsInOrder_FindSecond.
Prev: 51311 Up: Map Next: 51413