Prev: 31922 Up: Map Next: 31984
31960: Draw or undraw sprite
Draws or clears a sprite using a sequence of pixel sets or clears.
Input
A Mode for pixel (0=set,1=clear,2=XOR,3=ClearByte)
HL Sprite data, list of x,y offset pairs, 0xFF to end
IX Pointer to xpos,ypos screen location (chars)
Output
HL 1 byte off the end of the sprite data, which is often the next sprite to draw
sprite_draw_or_clear 31960 CALL prime_update_pixel_trampoline Prime jump at 32362, consumes A
sprite_draw_or_clear_0 31963 LD A,(HL) Pick up next byte in sequence. x_offset End if negative number
31964 INC HL
31965 OR A
31966 RET M
31967 ADD A,(IX+0) IX+0 points to xpos
31970 LD C,A C=xpos + x_offset
31971 LD A,(HL) Pick up next byte in sequence. y_offset
31972 INC HL
31973 ADD A,(IX+1) IX+1 points to ypos
31976 LD B,A B=ypos + y_offset
31977 PUSH HL
31978 CALL update_pixel Update pixel at C,B according to input mode
31981 POP HL
31982 JR sprite_draw_or_clear_0 Go back for next pixel in the sprite data
Prev: 31922 Up: Map Next: 31984