Prev: B6EC Up: Map Next: B785
B731: Handler: Bombs
Copy the template into Bomb_States when that slot is empty, then place the bomb from the rover or Jetman.
Copy the bomb template into Bomb_States when that slot is empty.
Handler_Bombs B731 LD DE,$6198 DE=Bomb_States.
B734 LD A,(DE) Return if a bomb is already active.
B735 AND A
B736 RET NZ
B737 LD HL,$B76D HL=Bomb_Actor_Template.
B73A LD BC,$0018 Copy the 18-byte template into the bomb slot.
B73D LDIR
Take the spawn X from the rover or from Jetman.
B73F LD A,($6090) Fetch Rover_Slot.
B742 SUB $1A Subtract 1A.
B744 CP $10 Compare it with 10.
B746 JR C,Handler_Bombs_FromRover Jump to Handler_Bombs_FromRover if the rover type is in range.
B748 LD HL,($607A) Fetch Jetman_Position.
Offset the spawn X by 30 to the right, or to the left when the rover is outside the alien base range.
Handler_Bombs_Loop B74B PUSH HL Stash the spawn X on the stack.
B74C LD HL,($6092) Fetch Rover_Position.
B74F LD BC,($6182) Fetch AlienBase_WorldX.
B753 CALL Handler_Missile_CompareWorldX Call Handler_Missile_CompareWorldX.
B756 JR NC,Handler_Bombs_OffsetLeft Jump to Handler_Bombs_OffsetLeft if the rover is outside the 1000 range of AlienBase_WorldX.
B758 LD BC,$0030 Set the offset in BC to 0030.
Add the offset to the spawn X and write it to the bomb slot.
Handler_Bombs_PlaceX B75B POP HL Restore the spawn X from the stack.
B75C CALL MaskWorldX Call MaskWorldX.
B75F LD ($619A),HL Write it to 619A.
B762 RET Return.
Handler_Bombs_FromRover B763 LD HL,($6092) Fetch Rover_Position.
B766 JR Handler_Bombs_Loop Jump to Handler_Bombs_Loop.
Handler_Bombs_OffsetLeft B768 LD BC,$FFD0 Set the offset in BC to FFD0 (-30).
B76B JR Handler_Bombs_PlaceX Jump to Handler_Bombs_PlaceX.
Bomb_Actor_Template B76D DEFB $EC,$00,$00,$00,$AF,$00,$01,$44 Bomb actor template.
B775 DEFB $00,$00,$00,$00,$00,$00,$00,$00
B77D DEFB $00,$06,$06,$00,$00,$00,$00,$00
Prev: B6EC Up: Map Next: B785