Prev: B90D Up: Map Next: B952
B938: 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 at +$18, the width in bytes, one more when the pixel x is not a multiple of 8, and +$19, the height in rows, not cut at the top of the screen as DRAW_OBJECT cuts it. FIND_SPRITE also turns the sprite the way the object faces.
When the object's sprite is the empty one (graphics 0 and 1 use it), FIND_SPRITE returns straight to this routine's caller, and +$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 B938 CALL CALC_PIXEL_XY the pixel position; DE = the sprite, turned the way the object faces
B93B CALL FIND_SPRITE
B93E LD A,(IX+$1A) the width, and one more for a shifted sprite
B941 AND $07
B943 LD A,(DE)
B944 INC DE
B945 JR Z,CALC_2D_INFO_0
B947 INC A
CALC_2D_INFO_0 B948 AND $0F +$18: the width in bytes
B94A LD (IX+$18),A
B94D LD A,(DE) +$19: the height
B94E LD (IX+$19),A
B951 RET
Prev: B90D Up: Map Next: B952