Prev: C613 Up: Map Next: C657
C63D: Work out an object's screen rectangle
Used by the routine at SET_DRAW_OBJS_OVERLAPPED.
Fills in where an object's sprite lands in the screen buffer: the pixel position at +$1A and +$1B (CALC_PIXEL_XY), and the size -- +$18 the width in bytes, one more when the pixel x is not a multiple of 8, and +$19 the height in rows. FLIP_SPRITE also turns the sprite the way the object faces.
Two cases leave things as they were. While the scene after a game runs (GAME_OVER), CALC_PIXEL_XY does not move the position. And when the object's sprite is the empty one (graphics 0 and 1 use it), FLIP_SPRITE returns straight to this routine's caller, so +$18 and +$19 keep what they held: the area the object last covered is still the area to clear.
Input
IX the object
CALC_2D_INFO C63D CALL CALC_PIXEL_XY The pixel position
C640 CALL FLIP_SPRITE DE = the sprite, turned the way the object faces
C643 LD A,(IX+$1A) The width, bits 0-3 of the sprite's first byte, and one more for a shifted sprite
C646 AND $07
C648 LD A,(DE)
C649 INC DE
C64A JR Z,CALC_2D_INFO_0
C64C INC A
CALC_2D_INFO_0 C64D AND $0F
C64F LD (IX+$18),A +$18: the width in bytes
C652 LD A,(DE) +$19: the height
C653 LD (IX+$19),A
C656 RET
Prev: C613 Up: Map Next: C657