Prev: 719F Up: Map Next: 720E
71A2: Animate tank shell explosion
Handles animation of tank shell explosions. Called when object type is 0 (special marker for shell explosions). Advances explosion frame counter and renders the current frame.
  • Only processes on odd ticks
  • Extracts frame index from bits 3-5 of object definition
  • Finishes explosion when frame reaches 7 or Y position is off-screen
  • Uses sprite at sprite_tank_shell_explosion with varying attributes for color cycling
Input
B Y position
C X position
D Object definition (bits 3-5 = frame index)
operate_tank_shell_explosion 71A2 LD A,($5EEF) Skip if even tick (explosions animate on odd ticks).
71A5 AND $01
71A7 CP $01
71A9 JP NZ,operate_viewport_slots Store position to previous_object_coordinates and object_coordinates for rendering.
71AC LD ($8B0A),BC
71B0 LD ($8B0C),BC Check Y position: if bit 7 set (off-screen), finish explosion.
71B4 LD A,B
71B5 AND $80
71B7 CP $80
71B9 JP Z,finish_tank_shell_explosion Extract frame index from D bits 3-5, increment. If frame == 7, finish.
71BC LD A,D
71BD SRL A
71BF SRL A
71C1 SRL A
71C3 AND $07
71C5 INC A
71C6 CP $07
71C8 JP Z,finish_tank_shell_explosion Shift frame back to bits 3-5 position, store in E.
71CB SLA A
71CD SLA A
71CF SLA A
71D1 LD E,A Merge new frame into D, update object definition in viewport array.
71D2 LD A,D
71D3 AND $C7
71D5 OR E
71D6 LD HL,($5F60)
71D9 DEC HL
71DA LD (HL),A
71DB LD HL,$8FFC Load sprite base sprite_tank_shell_explosion, calculate frame offset: HL -= (frame * $20).
71DE SRL A
71E0 SRL A
71E2 SRL A
71E4 AND $07
71E6 LD BC,$0020
71E9 OR A
71EA SBC HL,BC
tank_shell_frame_calc_loop 71EC ADD HL,BC Add frame size, loop until frame index exhausted.
71ED DEC A
71EE JR NZ,tank_shell_frame_calc_loop
This entry point is used by the routine at finish_tank_shell_explosion.
tank_shell_render_entry 71F0 LD BC,$82C5 Store erase sprite all_ff to render_sprite_ptr, get frame-based attributes.
71F3 LD ($8B0E),BC
71F7 LD A,($5EEF) Calculate attributes with color cycling, set sprite params: width=2, height=16.
71FA AND $06
71FC SRL A
71FE ADD A,$0C
7200 LD E,A
7201 LD BC,$0000
7204 LD D,$10
7206 LD A,$02
7208 CALL render_object Render and return to main loop.
720B JP operate_viewport_slots
Prev: 719F Up: Map Next: 720E