Prev: 7415 Up: Map Next: 74A0
7441: Operate tank shell
Advances the tank shell along its trajectory and renders it. Shell moves in a parabolic arc based on speed and step count.
  • Returns if shell not flying (bit 7 of tank_shell_state)
  • Increments trajectory step, explodes at step 8
  • Plays descending pitch sound based on step
  • Moves shell based on speed and orientation
  • Renders shell sprite or triggers explosion
operate_tank_shell 7441 LD A,($7383) Return if TANK_SHELL_BIT_FLYING not set.
7444 BIT 7,A
7446 RET Z
7447 LD BC,($7385) Load shell coords, increment trajectory step, store.
744B LD A,($7384)
744E INC A
744F LD ($7384),A
7452 CP $08 If step == 8 (max), explode via render_tank_shell_explosion.
7454 JP Z,render_tank_shell_explosion
7457 LD DE,$0002 Play shell whistle: BEEPER with DE=$0002, HL=(step, 0).
745A LD H,A
745B LD L,$00
745D CALL $03B5
7460 LD BC,($7385) Reload shell coords, advance Y position, store to previous_object_coordinates.
7464 CALL advance_object
7467 LD ($8B0A),BC
746B LD A,($7383) Get shell speed from state, add speed×2 to X position.
746E LD D,A
746F AND $07
7471 LD E,A
7472 LD A,C
7473 ADD A,E
7474 ADD A,E
7475 LD C,A
7476 BIT 6,D If left-facing, invert X delta via invert_shell_coordinate_delta.
7478 CALL NZ,invert_shell_coordinate_delta
747B INC B Increment Y, store position to object_coordinates and tank_shell_coordinates.
747C LD ($8B0C),BC
7480 LD ($7385),BC
7484 LD A,$00 Set collision mode to COLLISION_MODE_NONE.
7486 LD ($5EF5),A
7489 LD A,B Check viewport boundary. If off-screen, handle via erase_tank_shell_offscreen.
748A AND $88
748C CP $88
748E JP Z,erase_tank_shell_offscreen
7491 LD HL,$8431 Render shell sprite: height=1, width=1, frame=$08.
7494 LD DE,$0100
7497 LD A,$01
7499 LD BC,$0008
749C CALL render_sprite
749F RET
Prev: 7415 Up: Map Next: 74A0