Prev: B339 Up: Map Next: B436
B372: Rex fires weapon
Used by the routine at 947A.
B372 LD A,($A012) Return if FIRE key is hold down
B375 OR A
B376 RET NZ
B377 LD A,($A05D) Return if Rex not visible
B37A OR A
B37B RET Z
B37C LD A,$01 Set FIRE key hold down active
B37E LD ($A012),A
B381 CALL $B506 Configure weapon sound and check for weapon free slot
B384 LD A,($A013) Check Rex weapon type
B387 OR A is basic laser?
B388 JP Z,$B38D Jump forward if so (no energy loss on fire)
B38B LD A,$01 Set energy loss quantity to 1
B38D CALL $B9EF Handle weapon energy loss
B390 LD A,($A040) Jump forward if not rapid shot active
B393 OR A
B394 JP Z,$B3A6
rapid shot active
B397 LD A,($A041) Decrement rapid shots quantity
B39A DEC A
B39B LD ($A041),A
B39E OR A Jump forward if rapid shot not depleted
B39F JP NZ,$B3A6
B3A2 XOR A Rapid shots depleted, inactive rapid shots
B3A3 LD ($A040),A
check type of weapon
B3A6 LD A,($A013) Set A the type of weapon
B3A9 CP $04 is spray?
B3AB JP Z,$B456 Jump to handle spray weapon fire
B3AE CP $02 is laser?
B3B0 JP Z,$B41D Jump to handle laser fire
create projectile for basic laser, double fire and multiple
B3B3 CALL $B5A5 Create a new projectile for basic laser
B3B6 LD (IY+$05),$00 Set projectile y-delta to 0
B3BA LD A,($A013) Check weapon type
B3BD CP $01 is double fire?
B3BF JP Z,$B40C Jump to handle double fire weapon
B3C2 CP $03 Return if weapon type is not multiple
B3C4 RET NZ
B3C5 LD A,($A060) Return if Rex is teleporting
B3C8 OR A
B3C9 RET NZ
handle fire for multiple
B3CA LD A,($A014) Set B the number of drones based on weapon energy level
B3CD ADD A,$03
B3CF LD B,A
B3D0 LD HL,$5E4E Set HL the address for the drone configuration data table
B3D3 PUSH BC Save BC
B3D4 CALL $B506 Configure weapon sound and check for weapon free slot
B3D7 LD A,(HL) Set A093 the x-position of the drone
B3D8 LD ($A093),A
B3DB LD A,($A0BB)
B3DE LD A,$01 Set A097 direction of projectile left
B3E0 LD ($A097),A
B3E3 LD A,($A0B6) If x-position of drone is greater than x-position of Rex then set projectile to move right
B3E6 CP (HL)
B3E7 JP NC,$B3EE
B3EA XOR A
B3EB LD ($A097),A
B3EE LD A,(HL) if x-position of drone is greater than 240 or less than 16 then jump to process the next drone
B3EF INC HL
B3F0 CP $F0
B3F2 JP NC,$B404
B3F5 LD A,(HL) Set A095 the y-position of drone
B3F6 LD ($A095),A
B3F9 LD A,$03 Set the y-position increment at A099
B3FB LD ($A099),A
B3FE XOR A Set A the projectile type to 0
B3FF PUSH HL Save HL
B400 CALL $B5C1 Create a new projectile
B403 POP HL Restore HL
B404 LD DE,$0002 Point HL to the next drone
B407 ADD HL,DE
B408 POP BC Restore BC
B409 DJNZ $B3D3 Jump back and process next drone
B40B RET
Handle double fire weapon
B40C CALL $B506 Configure weapon sound and check for weapon free slot
B40F LD A,$13 Set into A099 the increment (19) in y-position for the new projectile
B411 LD ($A099),A
B414 LD A,($A013) Reset weapon projectile subtype
B417 RES 7,A
B419 CALL $B5C1 Create a new projectile
B41C RET
Configure laser projectile
B41D CALL $B5A5 Create a new projectile
B420 LD (IY+$05),$00 Set y-delta to 0
B424 LD (IY+$0C),$08 Set laser counter to create laser #6
B428 LD A,(IY+$00) Set x-position for laser #6
B42B LD (IY+$0D),A
B42E LD A,($A068) Set the laser duration counter
B431 DEC A
B432 LD (IY+$0E),A
B435 RET
Prev: B339 Up: Map Next: B436