Prev: 66d0 Up: Map Next: 678c
66fc: Update Rocket ship colour.
Colouring is based on the number of fuel pods collected. This routine is never CALLed (only via JR), so the last RET forces the calling routine to return. Used by the routines at 6690, 66b4 and 66d0.
Input
IX Rocket object.
66fc ld l,(ix+$01) Rocket X position
66ff ld h,(ix+$02) Rocket Y position
6702 push hl
6703 ld a,(ix+$04) A=colour attribute
6706 ld b,a Set loop counter
6707 ld c,$00
Draw all collected rocket modules.
6709 push bc
670a ld a,($5df0) A=player level
670d rrca Calculate which sprite to use for the current level
670e rrca
670f and $03
6711 or c
6712 sla a
6714 call $64b1 DE=item address from lookup table using A
6717 call $7226 Update actor position using DE
671a pop bc Restore loop counter
671b ld a,(ix+$02) Subtract 16 from a rocket Y position
671e sub $10
6720 ld (ix+$02),a
6723 ld a,($5dc1)
6726 sub $10 Subtract 16 from Actor Y position
6728 ld ($5dc1),a
672b ld a,c
672c add a,$04
672e ld c,a
672f djnz $6709 Loop and update rocket/actor again
6731 ld a,$02
6733 ld ($5dc4),a
6736 xor a
6737 ld ($5dc3),a
673a pop hl
673b ld (ix+$02),h Update rocket Y position: only Y changed in loop above
673e ld ($5dcf),hl Update current Actor Y,X coords
Colour the rocket modules based on collected fuel pod count.
6741 ld b,(ix+$04) Rocket "state"
6744 sla b
6746 ld a,b
6747 cp $06 if value < 6, or the fuel pod counter is zero, then set rocket colour to white and redraw
6749 jr c,$6772
674b ld a,(ix+$05)
674e and a
674f jr z,$6772
6751 cp $06 Check if all fuel collected (is checked at 6760)
6753 push af Preserve Carry (no care for A)
6754 ld a,($5dcc) Game timer
6757 rrca
6758 rrca
6759 and $04
675b or $43
675d ld c,a
675e pop af Restore Carry value (from 6751 check above)
675f ld a,c
6760 jr nc,$6774 Colour all sprites if all fuel has been collected
6762 ld b,(ix+$05) else use fuel pod count as loop counter
6765 ld (ix+$03),$43 Set colour to Magenta
6769 call $677a Update sprite colour
Set part of rocket back to white based on amount of uncollected fuel pods.
676c ld a,$06 A=max possible fuel pods
676e sub (ix+$05) Subtract remaining fuel pod count
6771 ld b,a Set loop counter
6772 ld a,$47 Set Rocket colour to white
6774 ld (ix+$03),a
6777 jp $677a Redundant JP!
677a push bc
677b call $7197 Colourize the sprite
677e pop bc
677f ld hl,($5dcf) HL=current rocket sprite coords
6782 ld a,h Update Y position
6783 sub $08
6785 ld h,a
6786 ld ($5dcf),hl Update current rocket sprite coords
6789 djnz $677a Loop and continue colouring
678b ret
Prev: 66d0 Up: Map Next: 678c