Prev: 72FD Up: Map Next: 7343
7302: Operate tank on river bank
Handles tanks positioned on the river bank. While the probe point (16 pixels ahead in the facing direction) reads solid terrain ($FF), the tank moves normally via tank_move_entry. When the probe reads anything other than $FF (river edge reached), the tank stops moving and fires a shell. While the shell is flying or exploding, the tank returns to the main loop without updating its position, keeping it stationary. The tank never reverses direction. Shell trajectory depends on tank orientation and uses pseudo-random speed.
Input
B Y position (on stack)
C X position (on stack)
D Object definition byte
operate_tank_on_bank 7302 LD BC,($8B0A) Load stored position, check terrain 16 pixels ahead in facing direction.
7306 LD A,C
7307 ADD A,$10
7309 LD C,A
730A BIT 6,D If left-facing, negate offset via invert_tank_offset_delta.
730C CALL NZ,invert_tank_offset_delta
730F CALL calculate_pixel_address If terrain is solid ($FF), move tank normally.
7312 LD A,(HL)
7313 CP $FF
7315 POP BC
7316 POP DE
7317 JP Z,tank_move_entry Pop BC/DE, jump to tank_move_entry if terrain clear.
731A LD A,($7383) Check shell state: if already flying, return to main loop.
731D BIT 7,A
731F JP NZ,operate_viewport_slots
7322 BIT 5,A If shell exploding, return to main loop.
7324 JP NZ,operate_viewport_slots
7327 CP $00 If shell uninitialized, initialize via init_tank_shell_state.
7329 JP Z,init_tank_shell_state
732C RES 5,A Clear exploding bit.
This entry point is used by the routines at init_tank_shell_state and check_shell_init_condition.
tank_fire_shell_entry 732E SET 7,A Set flying bit.
7330 LD ($7383),A Store shell state, calculate spawn X position.
7333 LD A,C
7334 SUB $10
7336 LD C,A
7337 BIT 6,D If right-facing, add offset via add_tank_offset_delta. Store shell coordinates.
7339 CALL Z,add_tank_offset_delta
733C LD ($7385),BC
7340 JP operate_viewport_slots
Prev: 72FD Up: Map Next: 7343