39 3: PlaySound(sndOw4, Hedgehog^.Team^.voicepack); |
39 3: PlaySound(sndOw4, Hedgehog^.Team^.voicepack); |
40 end |
40 end |
41 end; |
41 end; |
42 |
42 |
43 // Shouldn't more of this ammo switching stuff be moved to uAmmos ? |
43 // Shouldn't more of this ammo switching stuff be moved to uAmmos ? |
44 procedure ChangeAmmo(Gear: PGear); |
44 function ChangeAmmo(Gear: PGear): boolean; |
45 var slot, i: Longword; |
45 var slot, i: Longword; |
46 ammoidx: LongInt; |
46 ammoidx: LongInt; |
47 begin |
47 begin |
|
48 ChangeAmmo:= false; |
48 slot:= Gear^.MsgParam; |
49 slot:= Gear^.MsgParam; |
49 |
50 |
50 with PHedgehog(Gear^.Hedgehog)^ do |
51 with PHedgehog(Gear^.Hedgehog)^ do |
51 begin |
52 begin |
52 Gear^.Message:= Gear^.Message and not gmSlot; |
53 Gear^.Message:= Gear^.Message and not gmSlot; |
53 ammoidx:= 0; |
54 ammoidx:= 0; |
54 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); |
|
55 |
|
56 if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or |
55 if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or |
|
56 (TargetPoint.X <> NoPointX) or |
57 ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0)) or |
57 ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) = 0)) or |
58 ((Gear^.State and gstHHDriven) = 0) then exit; |
58 ((Gear^.State and gstHHDriven) = 0) then exit; |
|
59 ChangeAmmo:= true; |
|
60 |
|
61 while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do inc(ammoidx); |
59 |
62 |
60 if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^); |
63 if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0) and (MultiShootAttacks > 0) then OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^); |
61 |
64 |
62 MultiShootAttacks:= 0; |
65 MultiShootAttacks:= 0; |
63 Gear^.Message:= Gear^.Message and not (gmLJump or gmHJump); |
66 Gear^.Message:= Gear^.Message and not (gmLJump or gmHJump); |
108 Gear^.Message:= Gear^.Message and not gmWeapon; |
112 Gear^.Message:= Gear^.Message and not gmWeapon; |
109 |
113 |
110 with Hedgehog^ do |
114 with Hedgehog^ do |
111 while (CurAmmoType <> weap) and (t >= 0) do |
115 while (CurAmmoType <> weap) and (t >= 0) do |
112 begin |
116 begin |
113 ChangeAmmo(Gear); |
117 s:= ChangeAmmo(Gear); |
114 dec(t) |
118 dec(t) |
115 end; |
119 end; |
116 |
120 |
117 ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^) |
121 if s then ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^) |
118 end; |
122 end; |
119 |
123 |
120 procedure HHSetTimer(Gear: PGear); |
124 procedure HHSetTimer(Gear: PGear); |
121 var CurWeapon: PAmmo; |
125 var CurWeapon: PAmmo; |
122 begin |
126 begin |
792 if (CurAmmoGear = nil) |
796 if (CurAmmoGear = nil) |
793 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
797 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
794 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0) then |
798 or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEndHint) <> 0) then |
795 begin |
799 begin |
796 if ((Gear^.Message and gmSlot) <> 0) then |
800 if ((Gear^.Message and gmSlot) <> 0) then |
797 begin |
801 if ChangeAmmo(Gear) then ApplyAmmoChanges(Hedgehog^); |
798 ChangeAmmo(Gear); |
|
799 ApplyAmmoChanges(Hedgehog^) |
|
800 end; |
|
801 |
802 |
802 if ((Gear^.Message and gmWeapon) <> 0) then HHSetWeapon(Gear); |
803 if ((Gear^.Message and gmWeapon) <> 0) then HHSetWeapon(Gear); |
803 |
804 |
804 if ((Gear^.Message and gmTimer) <> 0) then HHSetTimer(Gear); |
805 if ((Gear^.Message and gmTimer) <> 0) then HHSetTimer(Gear); |
805 end; |
806 end; |