Prev: B90D Up: Map Next: B952
B938: Calculate Sprite Size
Used by the routine at FlagOverlappingObjects.
Works out the size on the screen of the sprite of an object, without drawing it, and stores it in the object. The width is one more than the width of the sprite data if the sprite has to be shifted.
Input
IX Object record
Find the sprite and whether it is shifted.
CalculateSpriteSize B938 CALL CalculatePixelCoordinates Call CalculatePixelCoordinates to work out the screen position of the object.
B93B CALL GetSpriteAddress Call GetSpriteAddress to get the address of its sprite.
B93E LD A,(IX+$1A) Fetch the screen x co-ordinate.
B941 AND %00000111 Keep the number of bits that the sprite is shifted by.
B943 LD A,(DE) Fetch the width of the sprite, and move on to its height.
B944 INC DE
B945 JR Z,CalculateSpriteSize_Store Jump to CalculateSpriteSize_Store if the sprite is not shifted.
B947 INC A Add one to the width for the shift.
Store the width and height.
CalculateSpriteSize_Store B948 AND %00001111 Keep only the width.
B94A LD (IX+$18),A Write the width to the object.
B94D LD A,(DE) Fetch the height of the sprite.
B94E LD (IX+$19),A Write the height to the object.
B951 RET Return.
View the equivalent code in;
Prev: B90D Up: Map Next: B952