Prev: B627 Up: Map Next: B67C
B648: Draw the hero car's turbo smoke
Draws one cloud of turbo exhaust smoke, at vertical position 119 and centred at x + 127. It returns without drawing while the car is airborne. Unflipped, C' is zero and x comes from the unflipped table; flipped, C' is the byte width less one and x comes from the flipped table.
Used by the routine at animate_hero_car.
Input
A Index 0..3 of car turbo smoke animation
A' Non-zero to draw flipped, for the left hand exhaust
Calculate address of hero_car_turbo smoke[A]
draw_smoke B648 RLCA
B649 LD C,A
B64A RLCA
B64B ADD A,C
B64C LD C,A
B64D LD B,$00
B64F LD HL,$CF9A
B652 ADD HL,BC
Don't draw smoke if car's mid-jump
B653 LD A,($B064) Read jump counter in move_hero_car
B656 AND A Set flags
B657 RET NZ Return if non-zero
Load width, height and flipped/unflipped x positions from hero_car_turbo_smoke[A_anim_frame]
B658 LD C,(HL) C = *HL++ -- width
B659 INC HL
B65A LD B,(HL) B = *HL++ -- height
B65B INC HL
B65C LD D,(HL) D = *HL++ -- flipped x
B65D INC HL
B65E LD E,(HL) E = *HL++ -- unflipped x
B65F INC HL
Load frame data pointer into HL
B660 LD A,(HL) Load low byte
B661 INC HL Advance
B662 LD H,(HL) Load high byte
B663 LD L,A Finalise
Work out whether to draw the flipped (left) or normal (right) exhaust.
B664 PUSH BC Preserve width/height
B665 EXX Bank
B666 EX AF,AF' Bank
B667 POP BC Restore width/height
B668 LD B,A B = A -- copy flip flag
B669 LD E,C E = C
B66A DEC C C--
B66B AND A Set flags -- test flip
B66C JR NZ,dsm_flip Jump to dsm_flip if non-zero -- flipped
B66E LD C,A C = A
B66F EXX Unbank
B670 LD A,E A = E
B671 JR dsm_draw Jump to dsm_draw
dsm_flip B673 EXX Unbank
B674 LD A,D A = D
dsm_draw B675 ADD A,$7F E = A + 127 -- horizontal position
B677 LD E,A
B678 LD D,$77 Set vertical position to 119
B67A JR draw_masked_sprite_rel_car Exit via draw_masked_sprite_rel_car (draw part using car_y)
Prev: B627 Up: Map Next: B67C