Prev: B5C4 Up: Map Next: B68B
B5D4: Create a new projectile
Used by the routines at BC48, BF4F, C141, C15B, C181, C19B and C1B3.
Input
IY Address pointer in the projectile configuration buffer
IX Address pointer in the enemy configuration buffer
B5D4 LD ($A232),A Set A232 to the increment for the y-position
B5D7 LD A,(IX+$01) Set A22E to enemy y-position
B5DA LD ($A22E),A
B5DD LD A,(IX+$02) Set A230 to enemy face direction
B5E0 LD ($A230),A
B5E3 LD A,($A1ED) Set the projectile type to A
B5E6 SET 7,A
B5E8 JP $B607 Jump to create this projectile
Create a new projectile fired for Rex. Used by the routines at B3B8 and B49C.
B5EB LD A,($A24F) Set A22C to Rex x-position
B5EE LD ($A22C),A
B5F1 LD A,($A250) Set A22E to Rex y-position
B5F4 LD ($A22E),A
B5F7 LD A,($A254) Set A230 to Rex face direction
B5FA LD ($A230),A
B5FD LD A,$11 Set A232 to the increment for the y-position
B5FF LD ($A232),A
B602 LD A,($A1AC) Set A to Rex weapon number
B605 RES 7,A
Create a new projectile in the projectile configuration buffer based on predefined values. This entry point is used by the routines at B3B8, B5D4 and B937.
B607 LD (IY+$06),$01 Set projectile status to flying
B60B LD (IY+$0B),A Set the projectile type
B60E LD A,($A22E) Set A to the y-position
B611 LD HL,$A232 Increment y-position
B614 ADD A,(HL)
B615 LD (IY+$01),A Save y-position of laser to projectile configuration buffer
B618 LD L,A Computes offset on room buffer for y-position. NOT NEEDED HERE!
B619 LD H,$00
B61B ADD HL,HL
B61C ADD HL,HL
B61D ADD HL,HL
B61E ADD HL,HL
B61F ADD HL,HL
B620 LD A,($A22C) Increment x-position and save it at projectile configuration buffer
B623 ADD A,$10
B625 LD (IY+$00),A
B628 LD A,($A214) is Rex firing the wepaon?
B62B OR A
B62C JP NZ,$B640 Jump if not
B62F LD A,($A22C) Check bits 2-0 of x-position
B632 AND $07
B634 CP $06 Decrement y-position of laser when Rex is moving Bits 2-0: $06 and $00 decrement y-position
B636 JP Z,$B63D
B639 OR A
B63A JP NZ,$B640
B63D DEC (IY+$01)
B640 LD (IY+$04),$08 Set x-delta of laser
B644 LD HL,$0001 Set offset of 1
B647 LD (IY+$07),L
B64A LD (IY+$08),H
B64D LD A,($A230) is Rex direction facing right
B650 OR A
B651 JP Z,$B669 Jump if so
B654 LD A,(IY+$00) Recompute x-position for facing left
B657 SUB $10
B659 LD (IY+$00),A
B65C LD HL,$FFFF Recompute x-offset for facing left (-1)
B65F LD (IY+$07),L
B662 LD (IY+$08),H
B665 LD (IY+$04),$F8 Recompute x-delta for facing left
B669 LD L,(IY+$01) Computes offset on room buffer for y-position
B66C LD H,$00
B66E ADD HL,HL
B66F ADD HL,HL
B670 ADD HL,HL
B671 ADD HL,HL
B672 ADD HL,HL
B673 LD A,(IY+$00) Computes offset on room buffer for x-position
B676 SRL A
B678 SRL A
B67A SRL A
B67C LD E,A Computes address into room buffer for draw the projectile and save this address into projectile configuration buffer
B67D LD D,$00
B67F ADD HL,DE
B680 LD DE,$E7FF
B683 ADD HL,DE
B684 LD (IY+$02),L
B687 LD (IY+$03),H
B68A RET
Prev: B5C4 Up: Map Next: B68B