Prev: B625 Up: Map Next: B6EC
B628: Update Left Shot
Used by the routine at UpdateShot.
Updates a shot that is facing left (bit 7 of its type is set), in the same way as the section of UpdateShot that is used for a shot that is facing right.
Input
IX Address of the shot
UpdateLeftShot B628 LD DE,$B3E2 The second shot offset.
B62B CALL AddShotOffset Call AddShotOffset.
B62E CALL FindObjectScreenAddress Call FindObjectScreenAddress.
B631 LD B,(IX+$0E) The high byte of the vertical acceleration.
B634 EXX Switch to the alternate registers.
B635 BIT 7,(IX+$10) Jump to UpdateLeftShot_Hit if bit 7 of offset 10 of IX is set.
B639 JR NZ,UpdateLeftShot_Hit
B63B LD A,$F0 A=F0.
B63D ADD A,(IX+$0B) Add the byte at offset 0B of IX to A.
B640 LD (IX+$0B),A Write the high byte of the horizontal acceleration.
B643 LD A,$F0 A=F0.
B645 ADD A,(IX+$07) Add the byte at offset 07 of IX to A.
B648 LD (IX+$07),A Write the high byte of the horizontal speed.
B64B LD A,(IX+$0E) The high byte of the vertical acceleration.
B64E AND A Jump to UpdateLeftShot_Test if A is not zero.
B64F JR NZ,UpdateLeftShot_Test
B651 LD (IX+$0B),$58 Store 58 at offset 0B of IX.
UpdateLeftShot_Test B655 LD (IX+$0F),$00 Store 00 at offset 0F of IX.
B659 CALL TestShotHitsGround Call TestShotHitsGround.
B65C JR Z,UpdateLeftShot_Length Jump to UpdateLeftShot_Length if the zero flag is set.
B65E SET 7,(IX+$10) Set bit 7 of offset 10 of IX.
B662 SET 5,(IX+$10) Set bit 5 of offset 10 of IX.
B666 LD A,$10 A=10.
B668 ADD A,(IX+$07) Add the byte at offset 07 of IX to A.
B66B LD (IX+$07),A Write the high byte of the horizontal speed.
B66E LD A,$10 A=10.
B670 ADD A,(IX+$0B) Add the byte at offset 0B of IX to A.
B673 LD (IX+$0B),A Write the high byte of the horizontal acceleration.
B676 JR UpdateLeftShot_End Jump to UpdateLeftShot_End.
UpdateLeftShot_Length B678 LD A,(IX+$0E) The high byte of the vertical acceleration.
B67B INC A Advance A.
B67C LD (IX+$0E),A Write the high byte of the vertical acceleration.
UpdateLeftShot_End B67F LD A,(IX+$0B) The high byte of the horizontal acceleration.
B682 CP $08 Jump to UpdateShot_LeftTable if A is not 08.
B684 JP NZ,UpdateShot_LeftTable
B687 SET 7,(IX+$10) Set bit 7 of offset 10 of IX.
B68B JP UpdateShot_LeftTable Jump to UpdateShot_LeftTable.
UpdateLeftShot_Hit B68E LD A,(IX+$0F) The low byte of the vertical acceleration.
B691 INC A Advance A.
B692 LD (IX+$0F),A Write the low byte of the vertical acceleration.
B695 BIT 5,(IX+$10) Jump to UpdateLeftShot_Stopped if bit 5 of offset 10 of IX is set.
B699 JR NZ,UpdateLeftShot_Stopped
B69B CALL TestShotHitsGround Call TestShotHitsGround.
B69E JR Z,UpdateLeftShot_Facing Jump to UpdateLeftShot_Facing if the zero flag is set.
B6A0 SET 5,(IX+$10) Set bit 5 of offset 10 of IX.
UpdateLeftShot_Stopped B6A4 LD A,(IX+$07) The high byte of the horizontal speed.
B6A7 NEG Negate A.
B6A9 ADD A,(IX+$0B) Add the byte at offset 0B of IX to A.
B6AC LD (IX+$0B),A Write the high byte of the horizontal acceleration.
B6AF LD (IX+$07),$00 Store 00 at offset 07 of IX.
B6B3 CP $08 Jump to UpdateLeftShot_Facing if A is 08 or more.
B6B5 JR NC,UpdateLeftShot_Facing
B6B7 ADD A,$08 Add 08 to A.
B6B9 LD (IX+$0B),A Write the high byte of the horizontal acceleration.
B6BC LD A,(IX+$0E) The high byte of the vertical acceleration.
B6BF DEC A Step A back.
B6C0 LD (IX+$0E),A Write the high byte of the vertical acceleration.
B6C3 LD A,(IX+$0F) The low byte of the vertical acceleration.
B6C6 INC A Advance A.
B6C7 LD (IX+$0F),A Write the low byte of the vertical acceleration.
UpdateLeftShot_Facing B6CA BIT 6,(IX+$10) Jump to UpdateLeftShot_Count if bit 6 of offset 10 of IX is clear.
B6CE JR Z,UpdateLeftShot_Count
B6D0 LD A,(IX+$0E) The high byte of the vertical acceleration.
B6D3 DEC A Step A back.
B6D4 LD (IX+$0E),A Write the high byte of the vertical acceleration.
B6D7 JP UpdateShot_LeftTable Jump to UpdateShot_LeftTable.
UpdateLeftShot_Count B6DA LD A,(IX+$0F) The low byte of the vertical acceleration.
B6DD ADD A,(IX+$0E) Add the byte at offset 0E of IX to A.
B6E0 CP $08 Jump to UpdateShot_LeftTable if A is not 08.
B6E2 JP NZ,UpdateShot_LeftTable
B6E5 SET 6,(IX+$10) Set bit 6 of offset 10 of IX.
B6E9 JP UpdateShot_LeftTable Jump to UpdateShot_LeftTable.
Prev: B625 Up: Map Next: B6EC