![]() |
Routines |
| Prev: CD08 | Up: Map | Next: CD4D |
|
Used by the routine at FlagOverlappingObjects.
Works out where an object is on the screen and how much of the screen its sprite covers. The width in bytes is one more than the width of the sprite if the sprite does not start on a byte boundary, because it has to be shifted across.
|
||||||||
|
Work out the pixel position, then the width and height of the sprite.
|
||||||||
| CalculateSpriteSize | CD33 | CALL CalculatePixelCoordinates | Work out the pixel coordinates of the object. | |||||
| CD36 | CALL GetSpriteAddress | Find the sprite of the object, and flip it if it needs it. | ||||||
| CD39 | LD A,(IX+$1A) | Fetch the pixel X coordinate. | ||||||
| CD3C | AND %00000111 | Keep the offset of the bit within the byte. | ||||||
| CD3E | LD A,(DE) | Fetch the width of the sprite in bytes. | ||||||
| CD3F | INC DE | Point DE at the height of the sprite. | ||||||
| CD40 | JR Z,CalculateSpriteSize_Store | Jump to CalculateSpriteSize_Store if the sprite starts on a byte boundary. | ||||||
| CD42 | INC A | Add one byte to the width. | ||||||
| CalculateSpriteSize_Store | CD43 | AND %00001111 | Keep the low nibble of the width. | |||||
| CD45 | LD (IX+$18),A | Store the width in bytes. | ||||||
| CD48 | LD A,(DE) | Fetch the height of the sprite in lines. | ||||||
| CD49 | LD (IX+$19),A | Store the height in lines. | ||||||
| CD4C | RET | Return. | ||||||
| Prev: CD08 | Up: Map | Next: CD4D |