Prev: CD32 Up: Map Next: CD43
CD33: Work out an object's screen rectangle
Used by the routine at set_draw_objs_overlapped.
Fills in the four bytes that say where an object's sprite lands in the screen buffer: the pixel position at +$1A and +$1B (from calc_pixel_XY) and the size at +$18 (width in bytes) and +$19 (height in pixel rows). The width is the sprite's own, plus one byte when the x position is not a multiple of eight, because a sprite shifted across a byte boundary spills into the next byte.
flip_sprite also turns the sprite the way the object's flip bits ask for. When the object's sprite is the empty one (types 0 and 1 both use it), flip_sprite discards this routine's return address and goes straight back to the caller, so the size bytes keep their previous values. That is what an object that is vanishing wants: the area it last covered is still the area to clear.
Input
IX the object
calc_2d_info CD33 CALL calc_pixel_XY pixel position into +$1A/+$1B; DE = the sprite, flipped to match
CD36 CALL flip_sprite
CD39 LD A,(IX+$1A) Z set if the sprite starts on a byte boundary
CD3C AND $07
CD3E LD A,(DE) the sprite's width byte (flip flags in the top bits)
CD3F INC DE
CD40 JR Z,store_2d_size one byte wider when shifted
CD42 INC A
Prev: CD32 Up: Map Next: CD43