Prev: B37F Up: Map Next: B47C
B3B8: Rex fires weapon
Used by the routine at 9470.
B3B8 LD A,($A1AB) Return if FIRE key is hold down
B3BB OR A
B3BC RET NZ
B3BD LD A,($A1F6) Return if Rex not visible
B3C0 OR A
B3C1 RET Z
B3C2 LD A,$01 Set FIRE key hold down active
B3C4 LD ($A1AB),A
B3C7 CALL $B54C Configure weapon sound and check for weapon free slot
B3CA LD A,($A1AC) Check Rex weapon type
B3CD OR A is basic laser?
B3CE JP Z,$B3D3 Jump forward if so (no energy loss on fire)
B3D1 LD A,$01 Set energy loss quantity to 1
B3D3 CALL $BA6A Handle weapon energy loss
B3D6 LD A,($A1D9) Jump forward if not rapid shot active
B3D9 OR A
B3DA JP Z,$B3EC
rapid shot active
B3DD LD A,($A1DA) Decrement rapid shots quantity
B3E0 DEC A
B3E1 LD ($A1DA),A
B3E4 OR A Jump forward if rapid shot not depleted
B3E5 JP NZ,$B3EC
B3E8 XOR A Rapid shots depleted, inactive rapid shots
B3E9 LD ($A1D9),A
check type of weapon
B3EC LD A,($A1AC) Set A the type of weapon
B3EF CP $04 is spray?
B3F1 JP Z,$B49C Jump to handle spray weapon fire
B3F4 CP $02 is laser?
B3F6 JP Z,$B463 Jump to handle laser fire
create projectile for basic laser, double fire and multiple
B3F9 CALL $B5EB Create a new projectile for basic laser
B3FC LD (IY+$05),$00 Set projectile y-delta to 0
B400 LD A,($A1AC) Check weapon type
B403 CP $01 is double fire?
B405 JP Z,$B452 Jump to handle double fire weapon
B408 CP $03 Return if weapon type is not multiple
B40A RET NZ
B40B LD A,($A1F9) Return if Rex is teleporting
B40E OR A
B40F RET NZ
handle fire for multiple
B410 LD A,($A1AD) Set B the number of drones based on weapon energy level
B413 ADD A,$03
B415 LD B,A
B416 LD HL,$5E4E Set HL the address for the drone configuration data table
B419 PUSH BC Save BC
B41A CALL $B54C Configure weapon sound and check for weapon free slot
B41D LD A,(HL) Set A22C the x-position of the drone
B41E LD ($A22C),A
B421 LD A,($A254)
B424 LD A,$01 Set A230 direction of projectile left
B426 LD ($A230),A
B429 LD A,($A24F) If x-position of drone is greater than x-position of Rex then set projectile to move right
B42C CP (HL)
B42D JP NC,$B434
B430 XOR A
B431 LD ($A230),A
B434 LD A,(HL) if x-position of drone is greater than 240 or less than 16 then jump to process the next drone
B435 INC HL
B436 CP $F0
B438 JP NC,$B44A
B43B LD A,(HL) Set A22E the y-position of drone
B43C LD ($A22E),A
B43F LD A,$03 Set the y-position increment at A232
B441 LD ($A232),A
B444 XOR A Set A the projectile type to 0
B445 PUSH HL Save HL
B446 CALL $B607 Create a new projectile
B449 POP HL Restore HL
B44A LD DE,$0002 Point HL to the next drone
B44D ADD HL,DE
B44E POP BC Restore BC
B44F DJNZ $B419 Jump back and process next drone
B451 RET
Handle double fire weapon
B452 CALL $B54C Configure weapon sound and check for weapon free slot
B455 LD A,$13 Set into A232 the increment (19) in y-position for the new projectile
B457 LD ($A232),A
B45A LD A,($A1AC) Reset weapon projectile subtype
B45D RES 7,A
B45F CALL $B607 Create a new projectile
B462 RET
Configure laser projectile
B463 CALL $B5EB Create a new projectile
B466 LD (IY+$05),$00 Set y-delta to 0
B46A LD (IY+$0C),$08 Set laser counter to create laser #6
B46E LD A,(IY+$00) Set x-position for laser #6
B471 LD (IY+$0D),A
B474 LD A,($A201) Set the laser duration counter
B477 DEC A
B478 LD (IY+$0E),A
B47B RET
Prev: B37F Up: Map Next: B47C