Prev: 718e Up: Map Next: 71d6
7197: Colourize a sprite.
Using Actor, adds colour to a sprite, working from bottom-to-top, left-to-right. This also handles sprites that are wrapped around the screen. Used by the routines at 63a3, 64a4, 650e, 6514, 6632, 66fc, 687a, 6d43, 6d9c and 7492.
Input
IX Jetman/Alien object.
7197 exx
7198 ld hl,($5dcf) HL=actor coords
719b call $71d6 HL=coord to attribute file address (using HL)
719e ld a,($5dc4)
71a1 ld b,a B=width loop counter (in pixels)
71a2 ld a,($5dc3)
71a5 rrca
71a6 rrca
71a7 inc a
71a8 rrca
71a9 and $1f
71ab inc a
71ac ld c,a C=height loop counter (in pixels)
71ad ld d,(ix+$03) D=object colour attribute
71b0 ld e,b E=width loop counter (in pixels)
71b1 push hl
Loop for updating attribute file with colour.
71b2 ld a,h A=actor Y position
71b3 cp $5b Decrement position if address is outside of attribute file address range
71b5 jr nc,$71c8
71b7 cp $58
71b9 jr c,$71c8
71bb ld (hl),d Otherwise, set the colour at this location
71bc inc l Next tile column
71bd ld a,l Next tile if column < screen width (32 chars)
71be and $1f
71c0 jr nz,$71c6
71c2 ld a,l else, wrap-around and continue applying colour
71c3 sub $20
71c5 ld l,a L=start of current row
71c6 djnz $71b2 Loop back and continue with next tile
Decrement the vertical position and colour the tiles.
71c8 pop hl
71c9 push bc
71ca and a Clear Carry flag
71cb ld bc,$0020 HL -= 32 tiles. Places address pointer previous line
71ce sbc hl,bc
71d0 pop bc
71d1 ld b,e B=reset to original width counter
71d2 dec c Decrement height counter
71d3 jr nz,$71b1 Repeat until all tiles have been coloured
71d5 ret
Prev: 718e Up: Map Next: 71d6