author | Urbertar@gmail.com |
Wed, 27 Feb 2013 13:13:34 +0200 | |
changeset 8592 | bb724ef609db |
parent 8589 | 3bb505fc707e |
child 8616 | c4536e98c712 |
permissions | -rw-r--r-- |
6581 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
6700 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
6581 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*) |
|
18 |
||
19 |
{$INCLUDE "options.inc"} |
|
20 |
||
21 |
unit uGearsHedgehog; |
|
22 |
interface |
|
23 |
uses uTypes; |
|
24 |
||
25 |
procedure doStepHedgehog(Gear: PGear); |
|
26 |
procedure AfterAttack; |
|
27 |
procedure HedgehogStep(Gear: PGear); |
|
28 |
procedure doStepHedgehogMoving(Gear: PGear); |
|
29 |
procedure HedgehogChAngle(HHGear: PGear); |
|
30 |
procedure PickUp(HH, Gear: PGear); |
|
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
31 |
procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
8574 | 32 |
procedure CheckIce(Gear: PGear); inline; |
6581 | 33 |
|
34 |
implementation |
|
6992 | 35 |
uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, |
6581 | 36 |
uCommands, uLocale, uUtils, uVisualGears, uStats, uIO, uScript, |
37 |
uGearsList, uGears, uCollisions, uRandom, uStore, uTeams, |
|
38 |
uGearsUtils; |
|
39 |
||
7028 | 40 |
var GHStepTicks: LongWord = 0; |
41 |
||
6581 | 42 |
// Shouldn't more of this ammo switching stuff be moved to uAmmos ? |
43 |
function ChangeAmmo(HHGear: PGear): boolean; |
|
44 |
var slot, i: Longword; |
|
45 |
ammoidx: LongInt; |
|
7754 | 46 |
prevAmmo: TAmmoType; |
6581 | 47 |
begin |
48 |
ChangeAmmo:= false; |
|
49 |
slot:= HHGear^.MsgParam; |
|
50 |
||
51 |
with HHGear^.Hedgehog^ do |
|
52 |
begin |
|
53 |
HHGear^.Message:= HHGear^.Message and (not gmSlot); |
|
7754 | 54 |
prevAmmo:= CurAmmoType; |
6581 | 55 |
ammoidx:= 0; |
56 |
if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0) |
|
57 |
or ((HHGear^.State and gstHHDriven) = 0) then |
|
58 |
exit; |
|
59 |
ChangeAmmo:= true; |
|
60 |
||
61 |
while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do |
|
62 |
inc(ammoidx); |
|
63 |
||
8553
a8e1cff496d8
Allow switching away from any weapon when during multishoot.
nemo
parents:
8494
diff
changeset
|
64 |
if (MultiShootAttacks > 0) then |
a8e1cff496d8
Allow switching away from any weapon when during multishoot.
nemo
parents:
8494
diff
changeset
|
65 |
begin |
a8e1cff496d8
Allow switching away from any weapon when during multishoot.
nemo
parents:
8494
diff
changeset
|
66 |
if (CurAmmoType = amSniperRifle) and ((GameFlags and gfArtillery) = 0) then |
a8e1cff496d8
Allow switching away from any weapon when during multishoot.
nemo
parents:
8494
diff
changeset
|
67 |
cArtillery := false; |
a8e1cff496d8
Allow switching away from any weapon when during multishoot.
nemo
parents:
8494
diff
changeset
|
68 |
OnUsedAmmo(HHGear^.Hedgehog^) |
a8e1cff496d8
Allow switching away from any weapon when during multishoot.
nemo
parents:
8494
diff
changeset
|
69 |
end; |
6581 | 70 |
|
71 |
MultiShootAttacks:= 0; |
|
72 |
HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); |
|
73 |
||
74 |
if Ammoz[CurAmmoType].Slot = slot then |
|
75 |
begin |
|
76 |
i:= 0; |
|
77 |
repeat |
|
78 |
inc(ammoidx); |
|
79 |
if (ammoidx > cMaxSlotAmmoIndex) then |
|
80 |
begin |
|
81 |
inc(i); |
|
82 |
CurAmmoType:= amNothing; |
|
83 |
ammoidx:= -1; |
|
84 |
//TryDo(i < 2, 'Engine bug: no ammo in current slot', true) |
|
85 |
end; |
|
86 |
until (i = 1) or ((Ammo^[slot, ammoidx].Count > 0) |
|
87 |
and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns)) |
|
88 |
||
89 |
end |
|
90 |
else |
|
91 |
begin |
|
92 |
i:= 0; |
|
93 |
// check whether there is ammo in slot |
|
94 |
while (i <= cMaxSlotAmmoIndex) and ((Ammo^[slot, i].Count = 0) |
|
95 |
or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns)) |
|
96 |
do inc(i); |
|
97 |
||
98 |
if i <= cMaxSlotAmmoIndex then |
|
99 |
ammoidx:= i |
|
100 |
else ammoidx:= -1 |
|
101 |
end; |
|
102 |
if ammoidx >= 0 then |
|
103 |
CurAmmoType:= Ammo^[slot, ammoidx].AmmoType; |
|
7754 | 104 |
if (prevAmmo <> CurAmmoType) then |
105 |
begin |
|
106 |
if CurAmmoType = amKnife then |
|
107 |
LoadHedgehogHat(HHGear^.Hedgehog^, 'Reserved/chef') |
|
108 |
else if prevAmmo = amKnife then |
|
109 |
LoadHedgehogHat(HHGear^.Hedgehog^, Hat); |
|
8051
f26422ef0333
oft-requested, should make the shoppa guys happy, probably, but, knowing them, I'm sure someone will complain
nemo
parents:
8030
diff
changeset
|
110 |
end; |
f26422ef0333
oft-requested, should make the shoppa guys happy, probably, but, knowing them, I'm sure someone will complain
nemo
parents:
8030
diff
changeset
|
111 |
// Try again in the next slot |
f26422ef0333
oft-requested, should make the shoppa guys happy, probably, but, knowing them, I'm sure someone will complain
nemo
parents:
8030
diff
changeset
|
112 |
if CurAmmoType = prevAmmo then |
f26422ef0333
oft-requested, should make the shoppa guys happy, probably, but, knowing them, I'm sure someone will complain
nemo
parents:
8030
diff
changeset
|
113 |
begin |
f26422ef0333
oft-requested, should make the shoppa guys happy, probably, but, knowing them, I'm sure someone will complain
nemo
parents:
8030
diff
changeset
|
114 |
if slot >= cMaxSlotIndex then slot:= 0 else inc(slot); |
f26422ef0333
oft-requested, should make the shoppa guys happy, probably, but, knowing them, I'm sure someone will complain
nemo
parents:
8030
diff
changeset
|
115 |
HHGear^.MsgParam:= slot; |
f26422ef0333
oft-requested, should make the shoppa guys happy, probably, but, knowing them, I'm sure someone will complain
nemo
parents:
8030
diff
changeset
|
116 |
ChangeAmmo(HHGear) |
7754 | 117 |
end |
6581 | 118 |
end |
119 |
end; |
|
120 |
||
121 |
procedure HHSetWeapon(HHGear: PGear); |
|
122 |
var t: LongInt; |
|
123 |
weap: TAmmoType; |
|
124 |
Hedgehog: PHedgehog; |
|
125 |
s: boolean; |
|
126 |
begin |
|
127 |
s:= false; |
|
128 |
||
129 |
weap:= TAmmoType(HHGear^.MsgParam); |
|
130 |
Hedgehog:= HHGear^.Hedgehog; |
|
131 |
||
132 |
if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then |
|
133 |
exit; // weapon is not activated yet |
|
134 |
||
135 |
HHGear^.MsgParam:= Ammoz[weap].Slot; |
|
136 |
||
137 |
t:= cMaxSlotAmmoIndex; |
|
138 |
||
139 |
HHGear^.Message:= HHGear^.Message and (not gmWeapon); |
|
140 |
||
141 |
with Hedgehog^ do |
|
142 |
while (CurAmmoType <> weap) and (t >= 0) do |
|
143 |
begin |
|
144 |
s:= ChangeAmmo(HHGear); |
|
145 |
dec(t) |
|
146 |
end; |
|
147 |
||
148 |
if s then |
|
149 |
ApplyAmmoChanges(HHGear^.Hedgehog^) |
|
150 |
end; |
|
151 |
||
152 |
procedure HHSetTimer(Gear: PGear); |
|
153 |
var CurWeapon: PAmmo; |
|
154 |
color: LongWord; |
|
155 |
begin |
|
156 |
Gear^.Message:= Gear^.Message and (not gmTimer); |
|
6924 | 157 |
CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^); |
6581 | 158 |
with Gear^.Hedgehog^ do |
159 |
if ((Gear^.Message and gmPrecise) <> 0) and ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then |
|
160 |
begin |
|
161 |
color:= Gear^.Hedgehog^.Team^.Clan^.Color; |
|
162 |
case Gear^.MsgParam of |
|
163 |
1: begin |
|
7069 | 164 |
AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate); |
6581 | 165 |
CurWeapon^.Bounciness:= 350; |
166 |
end; |
|
167 |
2: begin |
|
7069 | 168 |
AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate); |
6581 | 169 |
CurWeapon^.Bounciness:= 700; |
170 |
end; |
|
171 |
3: begin |
|
7069 | 172 |
AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate); |
6581 | 173 |
CurWeapon^.Bounciness:= 1000; |
174 |
end; |
|
175 |
4: begin |
|
7069 | 176 |
AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate); |
6581 | 177 |
CurWeapon^.Bounciness:= 2000; |
178 |
end; |
|
179 |
5: begin |
|
7069 | 180 |
AddCaption(FormatA(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate); |
6581 | 181 |
CurWeapon^.Bounciness:= 4000; |
182 |
end |
|
183 |
end |
|
184 |
end |
|
185 |
else if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then |
|
186 |
begin |
|
187 |
CurWeapon^.Timer:= 1000 * Gear^.MsgParam; |
|
188 |
with CurrentTeam^ do |
|
189 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]); |
|
190 |
end; |
|
191 |
end; |
|
192 |
||
193 |
||
194 |
procedure Attack(Gear: PGear); |
|
195 |
var xx, yy, newDx, newDy, lx, ly: hwFloat; |
|
196 |
speech: PVisualGear; |
|
197 |
newGear: PGear; |
|
198 |
CurWeapon: PAmmo; |
|
199 |
altUse: boolean; |
|
200 |
elastic: hwFloat; |
|
201 |
begin |
|
202 |
newGear:= nil; |
|
203 |
bShowFinger:= false; |
|
6924 | 204 |
CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^); |
6581 | 205 |
with Gear^, |
206 |
Gear^.Hedgehog^ do |
|
207 |
begin |
|
208 |
if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstHHChooseTarget)) = 0) and (((State and gstMoving) = 0) |
|
209 |
or (Power > 0) |
|
210 |
or (CurAmmoType = amTeleport) |
|
211 |
or |
|
212 |
// Allow attacks while moving on ammo with AltAttack |
|
213 |
((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)) |
|
214 |
or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0)) |
|
215 |
and ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then |
|
216 |
begin |
|
217 |
State:= State or gstAttacking; |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
218 |
if (Power = cMaxPower) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) = 0) then |
6581 | 219 |
Message:= Message and (not gmAttack) |
220 |
else |
|
221 |
begin |
|
222 |
if Power = 0 then |
|
223 |
begin |
|
224 |
AttackBar:= CurrentTeam^.AttackBar; |
|
225 |
PlaySound(sndThrowPowerUp) |
|
226 |
end; |
|
227 |
inc(Power) |
|
228 |
end; |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
229 |
if ((Message and gmAttack) <> 0) then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
230 |
exit; |
6581 | 231 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
232 |
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0 then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
233 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
234 |
StopSound(sndThrowPowerUp); |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
235 |
PlaySound(sndThrowRelease); |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
236 |
end; |
6581 | 237 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
238 |
xx:= SignAs(AngleSin(Angle), dX); |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
239 |
yy:= -AngleCos(Angle); |
6581 | 240 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
241 |
lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle))); |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
242 |
ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle))); |
6581 | 243 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
244 |
if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
245 |
xx:= - xx; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
246 |
if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
247 |
AddVoice(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack); |
6581 | 248 |
|
249 |
// Initiating alt attack |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
250 |
if (CurAmmoGear <> nil) |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
251 |
and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
252 |
and ((Gear^.Message and gmLJump) <> 0) |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
253 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
254 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
255 |
newDx:= dX; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
256 |
newDy:= dY; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
257 |
altUse:= true |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
258 |
end |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
259 |
else |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
260 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
261 |
newDx:= xx*Power/cPowerDivisor; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
262 |
newDy:= yy*Power/cPowerDivisor; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
263 |
altUse:= false |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
264 |
end; |
6581 | 265 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
266 |
case CurAmmoType of |
6581 | 267 |
amGrenade: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGrenade, 0, newDx, newDy, CurWeapon^.Timer); |
268 |
amMolotov: newGear:= AddGear(hwRound(lx), hwRound(ly), gtMolotov, 0, newDx, newDy, 0); |
|
269 |
amClusterBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtClusterBomb, 0, newDx, newDy, CurWeapon^.Timer); |
|
270 |
amGasBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGasBomb, 0, newDx, newDy, CurWeapon^.Timer); |
|
271 |
amBazooka: newGear:= AddGear(hwRound(lx), hwRound(ly), gtShell, 0, newDx, newDy, 0); |
|
272 |
amSnowball: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSnowball, 0, newDx, newDy, 0); |
|
273 |
amBee: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBee, 0, newDx, newDy, 0); |
|
274 |
amShotgun: begin |
|
275 |
PlaySound(sndShotgunReload); |
|
276 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtShotgunShot, 0, xx * _0_5, yy * _0_5, 0); |
|
277 |
end; |
|
278 |
amPickHammer: newGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0); |
|
279 |
amSkip: ParseCommand('/skip', true); |
|
280 |
amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0); |
|
7602
a620319d377e
Fix throwing things off rope, also make throwing things a bit more generic and gear density dependent (so you can throw mines further, and also throw dynamite a little).
nemo
parents:
7598
diff
changeset
|
281 |
amMine: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000); |
6581 | 282 |
amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
7754 | 283 |
amKnife: begin |
284 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtKnife, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0); |
|
285 |
newGear^.State:= newGear^.State or gstMoving; |
|
8494
53b91a602955
Cleaver tweaks based on feedback. Nerf damage, shrink radius. This means cleaver will embed into ground quite a bit further.
nemo
parents:
8493
diff
changeset
|
286 |
newGear^.Radius:= 4 // temporarily shrink so it doesn't instantly embed in the ground |
7754 | 287 |
end; |
6581 | 288 |
amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0); |
289 |
amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0); |
|
290 |
amPortalGun: begin |
|
291 |
newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6, |
|
292 |
// set selected color |
|
293 |
CurWeapon^.Pos); |
|
294 |
end; |
|
295 |
amSniperRifle: begin |
|
296 |
PlaySound(sndSniperReload); |
|
297 |
newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0); |
|
298 |
end; |
|
299 |
amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000); |
|
300 |
amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0); |
|
301 |
amWhip: begin |
|
302 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0); |
|
303 |
PlaySound(sndWhipCrack) |
|
304 |
end; |
|
305 |
amHammer: begin |
|
306 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0); |
|
307 |
PlaySound(sndWhack) |
|
308 |
end; |
|
309 |
amBaseballBat: begin |
|
310 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0); |
|
311 |
PlaySound(sndBaseballBat) // TODO: Only play if something is hit? |
|
312 |
end; |
|
313 |
amParachute: begin |
|
314 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0); |
|
315 |
PlaySound(sndParachute) |
|
316 |
end; |
|
317 |
// we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear. |
|
318 |
amAirAttack: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0); |
|
319 |
amMineStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0); |
|
320 |
amDrillStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer); |
|
321 |
amNapalm: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0); |
|
322 |
amBlowTorch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0); |
|
323 |
amGirder: newGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0); |
|
324 |
amTeleport: newGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0); |
|
325 |
amSwitch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSwitcher, 0, _0, _0, 0); |
|
326 |
amMortar: begin |
|
327 |
playSound(sndMortar); |
|
328 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtMortar, 0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0); |
|
329 |
end; |
|
330 |
amRCPlane: begin |
|
331 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0); |
|
7053 | 332 |
newGear^.SoundChannel:= LoopSound(sndRCPlane) |
6581 | 333 |
end; |
334 |
amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0); |
|
7832 | 335 |
amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, SignAs(cLittle, xx), _0, 0); |
6581 | 336 |
amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0); |
337 |
amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon, 0, newDx, newDy, CurWeapon^.Timer); |
|
338 |
amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb, 0, newDx, newDy, 0); |
|
339 |
amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0); |
|
340 |
amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun, 0, xx * _0_5, yy * _0_5, 0); |
|
341 |
amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0); |
|
342 |
amBirdy: begin |
|
343 |
PlaySound(sndWhistle); |
|
344 |
newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0); |
|
345 |
end; |
|
346 |
amLowGravity: begin |
|
347 |
PlaySound(sndLowGravity); |
|
348 |
cGravity:= cMaxWindSpeed; |
|
349 |
cGravityf:= 0.00025 |
|
350 |
end; |
|
351 |
amExtraDamage: begin |
|
352 |
PlaySound(sndHellishImpact4); |
|
353 |
cDamageModifier:= _1_5 |
|
354 |
end; |
|
355 |
amInvulnerable: Invulnerable:= true; |
|
356 |
amExtraTime: begin |
|
357 |
PlaySound(sndSwitchHog); |
|
358 |
TurnTimeLeft:= TurnTimeLeft + 30000 |
|
359 |
end; |
|
360 |
amLaserSight: cLaserSighting:= true; |
|
361 |
amVampiric: begin |
|
7053 | 362 |
PlaySoundV(sndOw1, Team^.voicepack); |
6581 | 363 |
cVampiric:= true; |
364 |
end; |
|
365 |
amPiano: begin |
|
366 |
// Tuck the hedgehog away until the piano attack is completed |
|
367 |
Unplaced:= true; |
|
368 |
X:= _0; |
|
369 |
Y:= _0; |
|
8414
c1ac0b64315e
Start piano higher (piano on maps that matched land_height was really weird before). Experiment w/ trying to make birdy shrink into distance to avoid odd birdy vanishes if tracking it.
nemo
parents:
8161
diff
changeset
|
370 |
newGear:= AddGear(TargetPoint.X, -1024, gtPiano, 0, _0, _0, 0); |
6581 | 371 |
PauseMusic |
372 |
end; |
|
373 |
amFlamethrower: newGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower, 0, xx * _0_5, yy * _0_5, 0); |
|
374 |
amLandGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun, 0, xx * _0_5, yy * _0_5, 0); |
|
375 |
amResurrector: begin |
|
376 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtResurrector, 0, _0, _0, 0); |
|
377 |
newGear^.SoundChannel := LoopSound(sndResurrector); |
|
378 |
end; |
|
8161 | 379 |
//amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000); |
6581 | 380 |
amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000); |
8557 | 381 |
amIceGun: begin |
382 |
newGear:= AddGear(hwRound(X), hwRound(Y), gtIceGun, 0, _0, _0, 0); |
|
383 |
newGear^.radius := 8; |
|
384 |
end; |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
385 |
end; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
386 |
if altUse and (newGear <> nil) then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
387 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
388 |
newGear^.dX:= newDx / newGear^.Density; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
389 |
newGear^.dY:= newDY / newGear^.Density |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
390 |
end; |
6581 | 391 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
392 |
case CurAmmoType of |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
393 |
amGrenade, amMolotov, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
394 |
amClusterBomb, amGasBomb, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
395 |
amBazooka, amSnowball, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
396 |
amBee, amSMine, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
397 |
amMortar, amWatermelon, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
398 |
amHellishBomb, amDrill: FollowGear:= newGear; |
6581 | 399 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
400 |
amShotgun, amPickHammer, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
401 |
amRope, amDEagle, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
402 |
amSineGun, amSniperRifle, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
403 |
amFirePunch, amWhip, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
404 |
amHammer, amBaseballBat, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
405 |
amParachute, amBlowTorch, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
406 |
amGirder, amTeleport, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
407 |
amSwitch, amRCPlane, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
408 |
amKamikaze, amCake, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
409 |
amSeduction, amBallgun, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
410 |
amJetpack, amBirdy, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
411 |
amFlamethrower, amLandGun, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
412 |
amResurrector, //amStructure, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
413 |
amTardis, amPiano, |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
414 |
amIceGun: CurAmmoGear:= newGear; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
415 |
end; |
6581 | 416 |
|
417 |
if ((CurAmmoType = amMine) or (CurAmmoType = amSMine)) and (GameFlags and gfInfAttack <> 0) then |
|
418 |
newGear^.FlightTime:= GameTicks + 1000 |
|
419 |
else if CurAmmoType = amDrill then |
|
420 |
newGear^.FlightTime:= GameTicks + 250; |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
421 |
if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
422 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
423 |
newGear^.Target.X:= TargetPoint.X; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
424 |
newGear^.Target.Y:= TargetPoint.Y |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
425 |
end; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
426 |
if (newGear <> nil) and (newGear^.CollisionMask and $80 <> 0) then newGear^.CollisionMask:= newGear^.CollisionMask and (not $80); |
6581 | 427 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
428 |
// Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
429 |
if altUse then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
430 |
FollowGear:= nil; |
6581 | 431 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
432 |
if (newGear <> nil) and ((Ammoz[newGear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
433 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
434 |
elastic:= int2hwfloat(CurWeapon^.Bounciness) / _1000; |
6581 | 435 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
436 |
if elastic < _1 then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
437 |
newGear^.Elasticity:= newGear^.Elasticity * elastic |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
438 |
else if elastic > _1 then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
439 |
newGear^.Elasticity:= _1 - ((_1-newGear^.Elasticity) / elastic); |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
440 |
(* Experimented with friction modifier. Didn't seem helpful |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
441 |
fric:= int2hwfloat(CurWeapon^.Bounciness) / _250; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
442 |
if fric < _1 then newGear^.Friction:= newGear^.Friction * fric |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
443 |
else if fric > _1 then newGear^.Friction:= _1 - ((_1-newGear^.Friction) / fric)*) |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
444 |
end; |
6581 | 445 |
|
446 |
||
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
447 |
uStats.AmmoUsed(CurAmmoType); |
6581 | 448 |
|
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
449 |
if not (SpeechText = '') then |
6581 | 450 |
begin |
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
451 |
speech:= AddVisualGear(0, 0, vgtSpeechBubble); |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
452 |
if speech <> nil then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
453 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
454 |
speech^.Text:= SpeechText; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
455 |
speech^.Hedgehog:= Gear^.Hedgehog; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
456 |
speech^.FrameTicks:= SpeechType; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
457 |
end; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
458 |
SpeechText:= '' |
6581 | 459 |
end; |
460 |
||
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
461 |
Power:= 0; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
462 |
if (CurAmmoGear <> nil) |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
463 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0){check for dropping ammo from rope} then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
464 |
begin |
8566
d9627d65edf7
This and the "retain freezing" stuff could probably use a flag.
nemo
parents:
8562
diff
changeset
|
465 |
if CurAmmoType in [amRope,amResurrector] then Message:= Message or gmAttack; |
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
466 |
CurAmmoGear^.Message:= Message |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
467 |
end |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
468 |
else |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
469 |
begin |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
470 |
if not CurrentTeam^.ExtDriven |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
471 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
472 |
SendIPC(_S'a'); |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
473 |
AfterAttack; |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
474 |
end |
6581 | 475 |
end |
8492
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
476 |
else |
67d2ad3b3ce9
Allow moving after firing cleaver. This changes multishoot behaviour quite a bit. Needs a lot of testing.
nemo
parents:
8414
diff
changeset
|
477 |
Message:= Message and (not gmAttack); |
6581 | 478 |
end; |
479 |
TargetPoint.X := NoPointX; |
|
480 |
ScriptCall('onHogAttack'); |
|
481 |
end; |
|
482 |
||
483 |
procedure AfterAttack; |
|
484 |
var s: shortstring; |
|
485 |
a: TAmmoType; |
|
7459
8511a3f899d3
Allow AfterAttack to proceed even if the Hedgehog is dead. They could be resurrected after all.
nemo
parents:
7426
diff
changeset
|
486 |
HHGear: PGear; |
6581 | 487 |
begin |
7459
8511a3f899d3
Allow AfterAttack to proceed even if the Hedgehog is dead. They could be resurrected after all.
nemo
parents:
7426
diff
changeset
|
488 |
with CurrentHedgehog^ do |
6581 | 489 |
begin |
7459
8511a3f899d3
Allow AfterAttack to proceed even if the Hedgehog is dead. They could be resurrected after all.
nemo
parents:
7426
diff
changeset
|
490 |
HHGear:= Gear; |
6581 | 491 |
a:= CurAmmoType; |
7459
8511a3f899d3
Allow AfterAttack to proceed even if the Hedgehog is dead. They could be resurrected after all.
nemo
parents:
7426
diff
changeset
|
492 |
if HHGear <> nil then HHGear^.State:= HHGear^.State and (not gstAttacking); |
6581 | 493 |
if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then |
494 |
begin |
|
495 |
Inc(MultiShootAttacks); |
|
496 |
||
497 |
if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then |
|
498 |
begin |
|
499 |
s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1); |
|
500 |
AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate); |
|
501 |
end; |
|
502 |
||
503 |
if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) |
|
504 |
or ((GameFlags and gfMultiWeapon) <> 0) then |
|
505 |
begin |
|
506 |
isInMultiShoot:= true |
|
507 |
end |
|
508 |
else |
|
509 |
begin |
|
510 |
OnUsedAmmo(CurrentHedgehog^); |
|
511 |
if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (((GameFlags and gfInfAttack) = 0) or PlacingHogs) then |
|
512 |
begin |
|
513 |
if TagTurnTimeLeft = 0 then |
|
514 |
TagTurnTimeLeft:= TurnTimeLeft; |
|
515 |
TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100; |
|
516 |
end; |
|
7459
8511a3f899d3
Allow AfterAttack to proceed even if the Hedgehog is dead. They could be resurrected after all.
nemo
parents:
7426
diff
changeset
|
517 |
if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (HHGear <> nil) then |
7462 | 518 |
HHGear^.State:= HHGear^.State or gstAttacked; |
6581 | 519 |
if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then |
520 |
ApplyAmmoChanges(CurrentHedgehog^) |
|
521 |
end; |
|
522 |
end |
|
523 |
else |
|
524 |
begin |
|
525 |
OnUsedAmmo(CurrentHedgehog^); |
|
526 |
ApplyAmmoChanges(CurrentHedgehog^); |
|
527 |
end; |
|
528 |
AttackBar:= 0 |
|
529 |
end |
|
530 |
end; |
|
531 |
||
532 |
//////////////////////////////////////////////////////////////////////////////// |
|
533 |
procedure doStepHedgehogDead(Gear: PGear); |
|
534 |
const frametime = 200; |
|
535 |
timertime = frametime * 6; |
|
536 |
begin |
|
537 |
if Gear^.Hedgehog^.Unplaced then |
|
538 |
exit; |
|
539 |
if Gear^.Timer > 1 then |
|
540 |
begin |
|
541 |
AllInactive:= false; |
|
542 |
dec(Gear^.Timer); |
|
543 |
if (Gear^.Timer mod frametime) = 0 then |
|
544 |
inc(Gear^.Pos) |
|
545 |
end |
|
546 |
else if Gear^.Timer = 1 then |
|
547 |
begin |
|
548 |
Gear^.State:= Gear^.State or gstNoDamage; |
|
549 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound); |
|
550 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog; |
|
551 |
DeleteGear(Gear); |
|
552 |
SetAllToActive |
|
553 |
end |
|
554 |
else // Gear^.Timer = 0 |
|
555 |
begin |
|
556 |
AllInactive:= false; |
|
557 |
Gear^.Z:= cCurrHHZ; |
|
558 |
RemoveGearFromList(Gear); |
|
559 |
InsertGearToList(Gear); |
|
7053 | 560 |
PlaySoundV(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); |
6581 | 561 |
Gear^.Pos:= 0; |
562 |
Gear^.Timer:= timertime |
|
563 |
end |
|
564 |
end; |
|
565 |
||
566 |
//////////////////////////////////////////////////////////////////////////////// |
|
567 |
procedure doStepHedgehogGone(Gear: PGear); |
|
568 |
const frametime = 65; |
|
569 |
timertime = frametime * 11; |
|
570 |
begin |
|
571 |
if Gear^.Hedgehog^.Unplaced then |
|
572 |
exit; |
|
573 |
if Gear^.Timer > 1 then |
|
574 |
begin |
|
575 |
AllInactive:= false; |
|
576 |
dec(Gear^.Timer); |
|
577 |
if (Gear^.Timer mod frametime) = 0 then |
|
578 |
inc(Gear^.Pos) |
|
579 |
end |
|
580 |
else |
|
581 |
if Gear^.Timer = 1 then |
|
582 |
begin |
|
583 |
DeleteGear(Gear); |
|
584 |
SetAllToActive |
|
585 |
end |
|
586 |
else // Gear^.Timer = 0 |
|
587 |
begin |
|
588 |
AllInactive:= false; |
|
589 |
Gear^.Z:= cCurrHHZ; |
|
590 |
RemoveGearFromList(Gear); |
|
591 |
InsertGearToList(Gear); |
|
7053 | 592 |
PlaySoundV(sndByeBye, Gear^.Hedgehog^.Team^.voicepack); |
6581 | 593 |
PlaySound(sndWarp); |
594 |
Gear^.Pos:= 0; |
|
595 |
Gear^.Timer:= timertime |
|
596 |
end |
|
597 |
end; |
|
598 |
||
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
599 |
procedure AddPickup(HH: THedgehog; ammo: TAmmoType; cnt, X, Y: LongWord); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
600 |
var s: shortstring; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
601 |
vga: PVisualGear; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
602 |
begin |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
603 |
if cnt <> 0 then AddAmmo(HH, ammo, cnt) |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
604 |
else AddAmmo(HH, ammo); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
605 |
|
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
606 |
if (not (HH.Team^.ExtDriven |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
607 |
or (HH.BotLevel > 0))) |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
608 |
or (HH.Team^.Clan^.ClanIndex = LocalClan) |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
609 |
or (GameType = gmtDemo) then |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
610 |
begin |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
611 |
if cnt <> 0 then |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
612 |
s:= trammo[Ammoz[ammo].NameId] + ' (+' + IntToStr(cnt) + ')' |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
613 |
else |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
614 |
s:= trammo[Ammoz[ammo].NameId] + ' (+' + IntToStr(Ammoz[ammo].NumberInCase) + ')'; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
615 |
AddCaption(s, HH.Team^.Clan^.Color, capgrpAmmoinfo); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
616 |
|
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
617 |
// show ammo icon |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
618 |
vga:= AddVisualGear(X, Y, vgtAmmo); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
619 |
if vga <> nil then |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
620 |
vga^.Frame:= Longword(ammo); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
621 |
end; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
622 |
end; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
623 |
|
6581 | 624 |
//////////////////////////////////////////////////////////////////////////////// |
625 |
procedure PickUp(HH, Gear: PGear); |
|
626 |
var s: shortstring; |
|
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
627 |
i: LongInt; |
6581 | 628 |
vga: PVisualGear; |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
629 |
ag, gi: PGear; |
6581 | 630 |
begin |
631 |
Gear^.Message:= gmDestroy; |
|
632 |
if (Gear^.Pos and posCaseExplode) <> 0 then |
|
633 |
if (Gear^.Pos and posCasePoison) <> 0 then |
|
634 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned) |
|
635 |
else |
|
636 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound) |
|
637 |
else if (Gear^.Pos and posCasePoison) <> 0 then |
|
638 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned + EXPLNoDamage) |
|
639 |
else |
|
640 |
case Gear^.Pos of |
|
641 |
posCaseUtility, |
|
642 |
posCaseAmmo: begin |
|
7597
1ef520fea21c
make cheating a bit easier (mikade insisted). Also, try flipping dust for a bit more variety.
nemo
parents:
7462
diff
changeset
|
643 |
PlaySound(sndShotgunReload); |
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
644 |
if Gear^.AmmoType <> amNothing then |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
645 |
begin |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
646 |
AddPickup(HH^.Hedgehog^, Gear^.AmmoType, Gear^.Power, hwRound(Gear^.X), hwRound(Gear^.Y)); |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
647 |
end |
6581 | 648 |
else |
649 |
begin |
|
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
650 |
// Add spawning here... |
7409 | 651 |
AddRandomness(GameTicks); |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
652 |
|
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
653 |
gi := GearsList; |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
654 |
while gi <> nil do |
7391
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
655 |
begin |
8030
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
656 |
if (gi^.Kind = gtGenericFaller) and (gi^.State and gstInvisible <> 0) then |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
657 |
begin |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
658 |
gi^.Active:= true; |
8030
165aeaaaf445
Call fallers less often. Should hopefully still be about as effective at the intended purpose. Should help loads quite a bit.
nemo
parents:
8003
diff
changeset
|
659 |
gi^.State:= gi^.State or gstTmpFlag; |
7406
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
660 |
gi^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX); |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
661 |
gi^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY); |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
662 |
gi^.dX:= _90-(GetRandomf*_360); |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
663 |
gi^.dY:= _90-(GetRandomf*_360) |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
664 |
end; |
1fe2c821f9bf
Try avoiding spamming the log by retaining the gears. untested.
nemo
parents:
7391
diff
changeset
|
665 |
gi := gi^.NextGear |
7391
588eabb4b384
Apparently order of multiple getrandom in params is undefined. Also remove broken and pointless getrandom call.
nemo
parents:
7389
diff
changeset
|
666 |
end; |
7598 | 667 |
ag:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAddAmmo, gstInvisible, _0, _0, GetRandom(125)+25); |
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
668 |
ag^.Pos:= Gear^.Pos; |
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
669 |
ag^.Power:= Gear^.Power |
6581 | 670 |
end; |
671 |
end; |
|
672 |
posCaseHealth: begin |
|
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
673 |
PlaySound(sndShotgunReload); |
6581 | 674 |
inc(HH^.Health, Gear^.Health); |
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6992
diff
changeset
|
675 |
HH^.Hedgehog^.Effects[hePoisoned] := 0; |
6581 | 676 |
str(Gear^.Health, s); |
677 |
s:= '+' + s; |
|
678 |
AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo); |
|
679 |
RenderHealth(HH^.Hedgehog^); |
|
680 |
RecountTeamHealth(HH^.Hedgehog^.Team); |
|
681 |
||
682 |
i:= 0; |
|
683 |
while i < Gear^.Health do |
|
684 |
begin |
|
685 |
vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot); |
|
686 |
if vga <> nil then |
|
687 |
with vga^ do |
|
688 |
begin |
|
689 |
Tint:= $00FF00FF; |
|
690 |
State:= ord(sprHealth) |
|
691 |
end; |
|
692 |
inc(i, 5); |
|
693 |
end; |
|
694 |
end; |
|
695 |
end |
|
696 |
end; |
|
697 |
||
698 |
procedure HedgehogStep(Gear: PGear); |
|
699 |
var PrevdX: LongInt; |
|
700 |
CurWeapon: PAmmo; |
|
701 |
begin |
|
6924 | 702 |
CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^); |
6581 | 703 |
if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then |
704 |
begin |
|
705 |
if isCursorVisible then |
|
706 |
with Gear^.Hedgehog^ do |
|
707 |
with CurWeapon^ do |
|
708 |
begin |
|
709 |
if (Gear^.Message and gmLeft ) <> 0 then |
|
710 |
Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount |
|
711 |
else |
|
712 |
if (Gear^.Message and gmRight ) <> 0 then |
|
713 |
Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount |
|
714 |
else |
|
715 |
exit; |
|
7028 | 716 |
GHStepTicks:= 200; |
6581 | 717 |
exit |
718 |
end; |
|
719 |
||
720 |
if ((Gear^.Message and gmAnimate) <> 0) then |
|
721 |
begin |
|
722 |
Gear^.Message:= 0; |
|
723 |
Gear^.State:= Gear^.State or gstAnimation; |
|
724 |
Gear^.Tag:= Gear^.MsgParam; |
|
725 |
Gear^.Timer:= 0; |
|
726 |
Gear^.Pos:= 0 |
|
727 |
end; |
|
728 |
||
729 |
if ((Gear^.Message and gmLJump ) <> 0) then |
|
730 |
begin |
|
731 |
Gear^.Message:= Gear^.Message and (not gmLJump); |
|
732 |
DeleteCI(Gear); |
|
733 |
if TestCollisionYwithGear(Gear, -1) = 0 then |
|
734 |
if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then |
|
735 |
Gear^.Y:= Gear^.Y - _2 |
|
736 |
else |
|
737 |
if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then |
|
738 |
Gear^.Y:= Gear^.Y - _1; |
|
739 |
if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) |
|
740 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then |
|
741 |
begin |
|
742 |
Gear^.dY:= -_0_15; |
|
743 |
if not cArtillery then |
|
744 |
Gear^.dX:= SignAs(_0_15, Gear^.dX); |
|
745 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
|
7053 | 746 |
PlaySoundV(sndJump1, Gear^.Hedgehog^.Team^.voicepack); |
6581 | 747 |
exit |
748 |
end; |
|
749 |
end; |
|
750 |
||
751 |
if ((Gear^.Message and gmHJump ) <> 0) then |
|
752 |
begin |
|
753 |
DeleteCI(Gear); |
|
754 |
Gear^.Message:= Gear^.Message and (not gmHJump); |
|
755 |
||
756 |
Gear^.dY:= -_0_2; |
|
757 |
SetLittle(Gear^.dX); |
|
758 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping; |
|
7053 | 759 |
PlaySoundV(sndJump3, Gear^.Hedgehog^.Team^.voicepack); |
6581 | 760 |
exit |
761 |
end; |
|
762 |
||
763 |
PrevdX:= hwSign(Gear^.dX); |
|
764 |
if (Gear^.Message and gmLeft )<>0 then |
|
765 |
Gear^.dX:= -cLittle else |
|
766 |
if (Gear^.Message and gmRight )<>0 then |
|
7187
aff30d80bd7b
- Allow camera movement while current hedgehog is falling
unc0rr
parents:
7164
diff
changeset
|
767 |
Gear^.dX:= cLittle |
aff30d80bd7b
- Allow camera movement while current hedgehog is falling
unc0rr
parents:
7164
diff
changeset
|
768 |
else exit; |
6581 | 769 |
|
7187
aff30d80bd7b
- Allow camera movement while current hedgehog is falling
unc0rr
parents:
7164
diff
changeset
|
770 |
StepSoundTimer:= cHHStepTicks; |
7719
eeae1cb6b6bf
Move hedgehog's step routine into separate function, use it in both hedgehog and ai code
unc0rr
parents:
7671
diff
changeset
|
771 |
|
7028 | 772 |
GHStepTicks:= cHHStepTicks; |
6581 | 773 |
if PrevdX <> hwSign(Gear^.dX) then |
774 |
begin |
|
775 |
FollowGear:= Gear; |
|
776 |
exit |
|
777 |
end; |
|
778 |
DeleteCI(Gear); // must be after exit!! (see previous line) |
|
779 |
||
780 |
Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7; |
|
7164
fad64b97947e
Some brainfucking code which greatly reduces number of TestCollision* calls in hedgehog walk routine. Especially helpful to AI optimization. Also fixes some edge cases.
unc0rr
parents:
7069
diff
changeset
|
781 |
|
7719
eeae1cb6b6bf
Move hedgehog's step routine into separate function, use it in both hedgehog and ai code
unc0rr
parents:
7671
diff
changeset
|
782 |
if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) then |
eeae1cb6b6bf
Move hedgehog's step routine into separate function, use it in both hedgehog and ai code
unc0rr
parents:
7671
diff
changeset
|
783 |
MakeHedgehogsStep(Gear); |
6581 | 784 |
|
8576
286ebfcb3d97
workaround for frequent AllHH active call in hedgehog step
nemo
parents:
8574
diff
changeset
|
785 |
SetAllHHToActive(false); |
6581 | 786 |
AddGearCI(Gear) |
787 |
end |
|
788 |
end; |
|
789 |
||
790 |
procedure HedgehogChAngle(HHGear: PGear); |
|
791 |
var da: LongWord; |
|
792 |
begin |
|
793 |
with HHGear^.Hedgehog^ do |
|
794 |
if ((CurAmmoType = amRope) and ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving)) |
|
795 |
or ((CurAmmoType = amPortalGun) and ((HHGear^.State and gstMoving) <> 0)) then |
|
796 |
da:= 2 |
|
797 |
else da:= 1; |
|
798 |
||
799 |
if (((HHGear^.Message and gmPrecise) = 0) or ((GameTicks mod 5) = 1)) then |
|
800 |
if ((HHGear^.Message and gmUp) <> 0) and (HHGear^.Angle >= CurMinAngle + da) then |
|
801 |
dec(HHGear^.Angle, da) |
|
802 |
else |
|
803 |
if ((HHGear^.Message and gmDown) <> 0) and (HHGear^.Angle + da <= CurMaxAngle) then |
|
804 |
inc(HHGear^.Angle, da) |
|
805 |
end; |
|
806 |
||
807 |
||
808 |
//////////////////////////////////////////////////////////////////////////////// |
|
809 |
procedure doStepHedgehogMoving(Gear: PGear); |
|
810 |
var isFalling, isUnderwater: boolean; |
|
811 |
land: Word; |
|
812 |
begin |
|
813 |
land:= 0; |
|
814 |
isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius; |
|
815 |
if Gear^.dX.QWordValue > 8160437862 then |
|
816 |
Gear^.dX.QWordValue:= 8160437862; |
|
817 |
if Gear^.dY.QWordValue > 8160437862 then |
|
818 |
Gear^.dY.QWordValue:= 8160437862; |
|
819 |
||
820 |
if Gear^.Hedgehog^.Unplaced then |
|
821 |
begin |
|
822 |
Gear^.dY:= _0; |
|
823 |
Gear^.dX:= _0; |
|
824 |
Gear^.State:= Gear^.State and (not gstMoving); |
|
825 |
exit |
|
826 |
end; |
|
7426
55b49cc1f33a
Changes for the benefit of pas2c. Use downto in for loops to avoid repeated calls of Random/GetRandom. Wrap nots.
nemo
parents:
7409
diff
changeset
|
827 |
isFalling:= (Gear^.dY.isNegative) or (not TestCollisionYKick(Gear, 1)); |
6581 | 828 |
if isFalling then |
829 |
begin |
|
830 |
if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then |
|
831 |
Gear^.dY:= _0; |
|
832 |
Gear^.State:= Gear^.State or gstMoving; |
|
833 |
if (CurrentHedgehog^.Gear = Gear) |
|
834 |
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then |
|
835 |
begin |
|
7187
aff30d80bd7b
- Allow camera movement while current hedgehog is falling
unc0rr
parents:
7164
diff
changeset
|
836 |
// TODO: why so aggressive at setting FollowGear when falling? |
6581 | 837 |
FollowGear:= Gear; |
838 |
end; |
|
839 |
if isUnderwater then |
|
840 |
Gear^.dY:= Gear^.dY + cGravity / _2 |
|
841 |
else |
|
842 |
begin |
|
843 |
Gear^.dY:= Gear^.dY + cGravity; |
|
844 |
// this set of circumstances could be less complex if jumping was more clearly identified |
|
845 |
if ((GameFlags and gfMoreWind) <> 0) and (((Gear^.Damage <> 0) |
|
846 |
or ((CurAmmoGear <> nil) and ((CurAmmoGear^.AmmoType = amJetpack) or (CurAmmoGear^.AmmoType = amBirdy))) |
|
847 |
or ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue))) then |
|
848 |
Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density |
|
849 |
end |
|
850 |
end |
|
851 |
else |
|
852 |
begin |
|
853 |
land:= TestCollisionYwithGear(Gear, 1); |
|
854 |
if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((land and lfIce) = 0) |
|
855 |
and ((Gear^.State and gstHHJumping) <> 0) then |
|
856 |
SetLittle(Gear^.dX); |
|
857 |
||
858 |
if not Gear^.dY.isNegative then |
|
859 |
begin |
|
860 |
CheckHHDamage(Gear); |
|
861 |
||
862 |
if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) |
|
863 |
and (Gear^.dX.QWordValue < _0_02.QWordValue) then |
|
864 |
Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump |
|
865 |
Gear^.State:= Gear^.State and (not (gstHHJumping or gstHHHJump)); |
|
866 |
Gear^.dY:= _0; |
|
867 |
end |
|
868 |
else |
|
869 |
Gear^.dY:= Gear^.dY + cGravity; |
|
870 |
||
871 |
if ((Gear^.State and gstMoving) <> 0) then |
|
872 |
begin |
|
873 |
if land and lfIce <> 0 then |
|
874 |
begin |
|
875 |
Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2) |
|
876 |
end |
|
877 |
else |
|
878 |
Gear^.dX:= Gear^.dX * Gear^.Friction; |
|
879 |
end |
|
880 |
end; |
|
881 |
||
882 |
if (Gear^.State <> 0) then |
|
883 |
DeleteCI(Gear); |
|
884 |
||
885 |
if isUnderwater then |
|
886 |
begin |
|
887 |
Gear^.dY:= Gear^.dY * _0_999; |
|
888 |
Gear^.dX:= Gear^.dX * _0_999; |
|
889 |
end; |
|
890 |
||
891 |
if (Gear^.State and gstMoving) <> 0 then |
|
892 |
if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then |
|
893 |
if not isFalling then |
|
894 |
if hwAbs(Gear^.dX) > _0_01 then |
|
895 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then |
|
896 |
begin |
|
897 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
898 |
Gear^.dX:= Gear^.dX * _0_96; |
|
899 |
Gear^.Y:= Gear^.Y - _1 |
|
900 |
end |
|
901 |
else |
|
902 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then |
|
903 |
begin |
|
904 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
905 |
Gear^.dX:= Gear^.dX * _0_93; |
|
906 |
Gear^.Y:= Gear^.Y - _2 |
|
907 |
end |
|
908 |
else |
|
909 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then |
|
910 |
begin |
|
911 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
912 |
Gear^.dX:= Gear^.dX * _0_9 ; |
|
913 |
Gear^.Y:= Gear^.Y - _3 |
|
914 |
end |
|
915 |
else |
|
916 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then |
|
917 |
begin |
|
918 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
919 |
Gear^.dX:= Gear^.dX * _0_87; |
|
920 |
Gear^.Y:= Gear^.Y - _4 |
|
921 |
end |
|
922 |
else |
|
923 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then |
|
924 |
begin |
|
925 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
926 |
Gear^.dX:= Gear^.dX * _0_84; |
|
927 |
Gear^.Y:= Gear^.Y - _5 |
|
928 |
end |
|
929 |
else |
|
930 |
if hwAbs(Gear^.dX) > _0_02 then |
|
931 |
Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
932 |
else |
|
933 |
begin |
|
934 |
Gear^.State:= Gear^.State and (not gstMoving); |
|
935 |
while TestCollisionYWithGear(Gear,1) = 0 do |
|
936 |
Gear^.Y:= Gear^.Y+_1; |
|
937 |
SetLittle(Gear^.dX) |
|
938 |
end |
|
939 |
else |
|
940 |
begin |
|
941 |
Gear^.State:= Gear^.State and (not gstMoving); |
|
942 |
while TestCollisionYWithGear(Gear,1) = 0 do |
|
943 |
Gear^.Y:= Gear^.Y+_1; |
|
944 |
SetLittle(Gear^.dX) |
|
945 |
end |
|
946 |
else if (hwAbs(Gear^.dX) > cLittle) |
|
947 |
and ((Gear^.State and gstHHJumping) = 0) then |
|
948 |
Gear^.dX:= -Gear^.Elasticity * Gear^.dX |
|
949 |
else |
|
950 |
SetLittle(Gear^.dX); |
|
951 |
||
952 |
if (not isFalling) |
|
7362
53bcfc714cb3
Fix rare condition when hog's gear stucks in an infinite loop which adds 1 to its Y coordinate not checking for drowning
unc0rr
parents:
7339
diff
changeset
|
953 |
and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then |
6581 | 954 |
begin |
955 |
Gear^.State:= Gear^.State and (not gstWinner); |
|
956 |
Gear^.State:= Gear^.State and (not gstMoving); |
|
7426
55b49cc1f33a
Changes for the benefit of pas2c. Use downto in for loops to avoid repeated calls of Random/GetRandom. Wrap nots.
nemo
parents:
7409
diff
changeset
|
957 |
while (TestCollisionYWithGear(Gear,1) = 0) and (not CheckGearDrowning(Gear)) do |
6581 | 958 |
Gear^.Y:= Gear^.Y+_1; |
959 |
SetLittle(Gear^.dX); |
|
960 |
Gear^.dY:= _0 |
|
961 |
end |
|
962 |
else |
|
963 |
Gear^.State:= Gear^.State or gstMoving; |
|
964 |
||
965 |
if (Gear^.State and gstMoving) <> 0 then |
|
966 |
begin |
|
967 |
Gear^.State:= Gear^.State and (not gstAnimation); |
|
968 |
// ARTILLERY but not being moved by explosions |
|
969 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
970 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
971 |
if (not Gear^.dY.isNegative) and (not TestCollisionYKick(Gear, 1)) |
|
972 |
and TestCollisionYwithXYShift(Gear, 0, 1, 1) then |
|
973 |
begin |
|
974 |
CheckHHDamage(Gear); |
|
975 |
Gear^.dY:= _0; |
|
976 |
Gear^.Y:= Gear^.Y + _1 |
|
977 |
end; |
|
978 |
CheckGearDrowning(Gear); |
|
979 |
// hide target cursor if current hog is drowning |
|
980 |
if (Gear^.State and gstDrowning) <> 0 then |
|
981 |
if (CurrentHedgehog^.Gear = Gear) then |
|
982 |
isCursorVisible:= false |
|
983 |
end; |
|
7623
addc5b262617
isZero appears to be never used. Use it in a few obvious cases and add web variant.
nemo
parents:
7615
diff
changeset
|
984 |
if (not isZero(Gear^.dY)) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then |
6581 | 985 |
begin |
986 |
inc(Gear^.FlightTime); |
|
8003 | 987 |
if (Gear^.FlightTime > 1500) and ((hwRound(Gear^.X) < LongInt(leftX)-250) or (hwRound(Gear^.X) > LongInt(rightX)+250)) then |
6581 | 988 |
begin |
7763 | 989 |
Gear^.FlightTime:= 0; |
6581 | 990 |
AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage); |
991 |
PlaySound(sndHomerun) |
|
992 |
end; |
|
993 |
end |
|
994 |
else |
|
995 |
begin |
|
996 |
uStats.hedgehogFlight(Gear, Gear^.FlightTime); |
|
997 |
Gear^.FlightTime:= 0; |
|
998 |
end; |
|
999 |
||
1000 |
end; |
|
1001 |
||
1002 |
procedure doStepHedgehogDriven(HHGear: PGear); |
|
1003 |
var t: PGear; |
|
1004 |
wasJumping: boolean; |
|
1005 |
Hedgehog: PHedgehog; |
|
1006 |
begin |
|
1007 |
Hedgehog:= HHGear^.Hedgehog; |
|
8562
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1008 |
//if isInMultiShoot and not AllInactive and (Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle]) then HHGear^.Message:= HHGear^.Message and not gmAttack; |
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1009 |
if isInMultiShoot and (Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle]) then |
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1010 |
begin |
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1011 |
AllInactive:= true; |
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1012 |
HHGear^.Message:= 0 |
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1013 |
end |
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1014 |
else AllInactive:= false; |
6581 | 1015 |
|
1016 |
if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then |
|
1017 |
begin |
|
8494
53b91a602955
Cleaver tweaks based on feedback. Nerf damage, shrink radius. This means cleaver will embed into ground quite a bit further.
nemo
parents:
8493
diff
changeset
|
1018 |
if (Hedgehog^.CurAmmoType = amKnife) then |
53b91a602955
Cleaver tweaks based on feedback. Nerf damage, shrink radius. This means cleaver will embed into ground quite a bit further.
nemo
parents:
8493
diff
changeset
|
1019 |
LoadHedgehogHat(Hedgehog^, Hedgehog^.Hat); |
6581 | 1020 |
if TagTurnTimeLeft = 0 then |
1021 |
TagTurnTimeLeft:= TurnTimeLeft; |
|
1022 |
TurnTimeLeft:= 0; |
|
1023 |
isCursorVisible:= false; |
|
1024 |
HHGear^.State:= HHGear^.State and (not (gstHHDriven or gstAnimation or gstAttacking)); |
|
1025 |
AttackBar:= 0; |
|
1026 |
if HHGear^.Damage > 0 then |
|
1027 |
HHGear^.State:= HHGear^.State and (not (gstHHJumping or gstHHHJump)); |
|
1028 |
exit |
|
1029 |
end; |
|
1030 |
||
1031 |
if (HHGear^.State and gstAnimation) <> 0 then |
|
1032 |
begin |
|
1033 |
HHGear^.Message:= 0; |
|
1034 |
if (HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].VoiceDelay) and (HHGear^.Timer = 0) then |
|
7053 | 1035 |
PlaySoundV(Wavez[TWave(HHGear^.Tag)].Voice, Hedgehog^.Team^.voicepack); |
6581 | 1036 |
inc(HHGear^.Timer); |
1037 |
if HHGear^.Timer = Wavez[TWave(HHGear^.Tag)].Interval then |
|
1038 |
begin |
|
1039 |
HHGear^.Timer:= 0; |
|
1040 |
inc(HHGear^.Pos); |
|
1041 |
if HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].FramesCount then |
|
1042 |
HHGear^.State:= HHGear^.State and (not gstAnimation) |
|
1043 |
end; |
|
1044 |
exit |
|
1045 |
end; |
|
1046 |
||
1047 |
if ((HHGear^.State and gstMoving) <> 0) |
|
7028 | 1048 |
or (GHStepTicks = cHHStepTicks) |
6581 | 1049 |
or (CurAmmoGear <> nil) then // we are moving |
1050 |
begin |
|
1051 |
with Hedgehog^ do |
|
1052 |
if (CurAmmoGear = nil) |
|
1053 |
and (HHGear^.dY > _0_39) |
|
1054 |
and (CurAmmoType = amParachute) then |
|
1055 |
HHGear^.Message:= HHGear^.Message or gmAttack; |
|
1056 |
// check for case with ammo |
|
1057 |
t:= CheckGearNear(HHGear, gtCase, 36, 36); |
|
1058 |
if t <> nil then |
|
1059 |
PickUp(HHGear, t) |
|
1060 |
end; |
|
1061 |
||
1062 |
if (CurAmmoGear = nil) then |
|
1063 |
if (((HHGear^.Message and gmAttack) <> 0) |
|
1064 |
or ((HHGear^.State and gstAttacking) <> 0)) then |
|
1065 |
Attack(HHGear) // should be before others to avoid desync with '/put' msg and changing weapon msgs |
|
1066 |
else |
|
1067 |
else |
|
1068 |
with Hedgehog^ do |
|
1069 |
if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) |
|
1070 |
and ((HHGear^.Message and gmLJump) <> 0) |
|
1071 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then |
|
1072 |
begin |
|
1073 |
Attack(HHGear); |
|
1074 |
HHGear^.Message:= HHGear^.Message and (not gmLJump) |
|
1075 |
end; |
|
1076 |
||
1077 |
if (CurAmmoGear = nil) |
|
7956
61da79e83330
Causes AI fail. Needs testing 'cause at some point, I thought this was needed for portal, I don't remember *why*
nemo
parents:
7832
diff
changeset
|
1078 |
or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) then |
6581 | 1079 |
begin |
1080 |
if ((HHGear^.Message and gmSlot) <> 0) then |
|
1081 |
if ChangeAmmo(HHGear) then ApplyAmmoChanges(Hedgehog^); |
|
1082 |
||
1083 |
if ((HHGear^.Message and gmWeapon) <> 0) then |
|
1084 |
HHSetWeapon(HHGear); |
|
1085 |
||
1086 |
if ((HHGear^.Message and gmTimer) <> 0) then |
|
1087 |
HHSetTimer(HHGear); |
|
1088 |
end; |
|
1089 |
||
1090 |
if CurAmmoGear <> nil then |
|
1091 |
begin |
|
1092 |
CurAmmoGear^.Message:= HHGear^.Message; |
|
1093 |
exit |
|
1094 |
end; |
|
1095 |
||
1096 |
HedgehogChAngle(HHGear); |
|
1097 |
||
1098 |
if (HHGear^.State and gstMoving) <> 0 then |
|
1099 |
begin |
|
1100 |
wasJumping:= ((HHGear^.State and gstHHJumping) <> 0); |
|
1101 |
||
1102 |
if ((HHGear^.Message and gmHJump) <> 0) and wasJumping and ((HHGear^.State and gstHHHJump) = 0) then |
|
1103 |
if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then |
|
1104 |
begin |
|
1105 |
HHGear^.State:= HHGear^.State or gstHHHJump; |
|
1106 |
HHGear^.dY:= -_0_25; |
|
1107 |
if not cArtillery then |
|
1108 |
HHGear^.dX:= -SignAs(_0_02, HHGear^.dX); |
|
7053 | 1109 |
PlaySoundV(sndJump2, Hedgehog^.Team^.voicepack) |
6581 | 1110 |
end; |
1111 |
||
1112 |
HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump)); |
|
1113 |
||
1114 |
if (not cArtillery) and wasJumping and TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
|
1115 |
SetLittle(HHGear^.dX); |
|
1116 |
||
1117 |
if Hedgehog^.Gear <> nil then |
|
1118 |
doStepHedgehogMoving(HHGear); |
|
1119 |
||
1120 |
if ((HHGear^.State and (gstMoving or gstDrowning)) = 0) then |
|
1121 |
begin |
|
1122 |
AddGearCI(HHGear); |
|
1123 |
if wasJumping then |
|
7028 | 1124 |
GHStepTicks:= 410 |
6581 | 1125 |
else |
7028 | 1126 |
GHStepTicks:= 95 |
6581 | 1127 |
end; |
1128 |
exit |
|
1129 |
end; |
|
1130 |
||
8562
d9d1cb650ff8
Restore freezing hedgehog for shotgun, sniper rifle and deagle to make unc0rr happy. You'll still be able to get away after throwing cleaver and sticky bomb tho.
nemo
parents:
8553
diff
changeset
|
1131 |
if not(isInMultiShoot and (Hedgehog^.CurAmmoType in [amShotgun, amDEagle, amSniperRifle])) and (Hedgehog^.Gear <> nil) then |
6581 | 1132 |
begin |
7028 | 1133 |
if GHStepTicks > 0 then |
1134 |
dec(GHStepTicks); |
|
1135 |
if (GHStepTicks = 0) then |
|
6581 | 1136 |
HedgehogStep(HHGear) |
1137 |
end |
|
1138 |
end; |
|
1139 |
||
1140 |
//////////////////////////////////////////////////////////////////////////////// |
|
1141 |
procedure doStepHedgehogFree(Gear: PGear); |
|
1142 |
var prevState: Longword; |
|
1143 |
begin |
|
1144 |
prevState:= Gear^.State; |
|
1145 |
||
1146 |
doStepHedgehogMoving(Gear); |
|
1147 |
||
1148 |
if (Gear^.State and (gstMoving or gstDrowning)) <> 0 then |
|
1149 |
begin |
|
1150 |
if Gear^.Damage > 0 then |
|
1151 |
CalcRotationDirAngle(Gear); |
|
1152 |
AllInactive:= false; |
|
1153 |
exit |
|
1154 |
end; |
|
1155 |
||
1156 |
if (Gear^.Health = 0) then |
|
1157 |
begin |
|
1158 |
if PrvInactive or ((GameFlags and gfInfAttack) <> 0) then |
|
1159 |
begin |
|
1160 |
Gear^.Timer:= 0; |
|
1161 |
FollowGear:= Gear; |
|
1162 |
PrvInactive:= false; |
|
1163 |
AllInactive:= false; |
|
1164 |
||
1165 |
if (Gear^.State and gstHHGone) = 0 then |
|
1166 |
begin |
|
7010
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6992
diff
changeset
|
1167 |
Gear^.Hedgehog^.Effects[hePoisoned] := 0; |
10a0a31804f3
Switch effects to longint for convenience of tracking ice states. I could add a new Hedgehog value, but since we have this effects list being all useless as booleans anyway...
nemo
parents:
6992
diff
changeset
|
1168 |
if Gear^.Hedgehog^.Effects[heResurrectable] <> 0 then |
6581 | 1169 |
begin |
1170 |
ResurrectHedgehog(Gear); |
|
1171 |
end |
|
1172 |
else |
|
1173 |
begin |
|
1174 |
Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation); |
|
1175 |
Gear^.doStep:= @doStepHedgehogDead; |
|
1176 |
// Death message |
|
1177 |
AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
|
1178 |
end; |
|
1179 |
end |
|
1180 |
else |
|
1181 |
begin |
|
1182 |
Gear^.State:= Gear^.State and (not gstAnimation); |
|
1183 |
Gear^.doStep:= @doStepHedgehogGone; |
|
1184 |
||
1185 |
// Gone message |
|
1186 |
AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage); |
|
1187 |
end |
|
1188 |
end; |
|
1189 |
exit |
|
1190 |
end; |
|
1191 |
||
1192 |
if ((Gear^.State and gstWait) = 0) and |
|
1193 |
(prevState <> Gear^.State) then |
|
1194 |
begin |
|
1195 |
Gear^.State:= Gear^.State or gstWait; |
|
1196 |
Gear^.Timer:= 150 |
|
1197 |
end |
|
1198 |
else |
|
1199 |
begin |
|
1200 |
if Gear^.Timer = 0 then |
|
1201 |
begin |
|
1202 |
Gear^.State:= Gear^.State and (not (gstWait or gstLoser or gstWinner or gstAttacked or gstNotKickable or gstHHChooseTarget)); |
|
8563
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1203 |
if Gear^.Hedgehog^.Effects[heFrozen] = 0 then Gear^.Active:= false; |
6581 | 1204 |
AddGearCI(Gear); |
1205 |
exit |
|
1206 |
end |
|
1207 |
else dec(Gear^.Timer) |
|
1208 |
end; |
|
1209 |
||
1210 |
AllInactive:= false |
|
1211 |
end; |
|
1212 |
||
8574 | 1213 |
procedure CheckIce(Gear: PGear); inline; |
6581 | 1214 |
(* |
1215 |
var x,y,tx,ty: LongInt; |
|
1216 |
tdX, tdY, slope: hwFloat; |
|
1217 |
land: Word; *) |
|
1218 |
var slope: hwFloat; |
|
1219 |
begin |
|
8574 | 1220 |
if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0) |
1221 |
and (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0) |
|
1222 |
and (not Gear^.dY.isNegative) and (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then |
|
1223 |
begin |
|
1224 |
slope:= CalcSlopeBelowGear(Gear); |
|
1225 |
if slope.QWordValue > 730144440 then // ignore mild slopes |
|
1226 |
begin |
|
1227 |
Gear^.dX:=Gear^.dX+slope*cGravity*_256; |
|
1228 |
Gear^.State:= Gear^.State or gstMoving |
|
1229 |
end |
|
1230 |
end; |
|
1231 |
(* |
|
1232 |
x:= hwRound(Gear^.X); |
|
1233 |
y:= hwRound(Gear^.Y); |
|
1234 |
AddVisualGear(x, y, vgtSmokeTrace); |
|
1235 |
AddVisualGear(x - hwRound(_5*slope), y + hwRound(_5*slope), vgtSmokeTrace); |
|
1236 |
AddVisualGear(x + hwRound(_5*slope), y - hwRound(_5*slope), vgtSmokeTrace); |
|
1237 |
AddVisualGear(x - hwRound(_20 * slope), y + hwRound(_20 * slope), vgtSmokeTrace); |
|
1238 |
AddVisualGear(x + hwRound(_20 * slope), y - hwRound(_20 * slope), vgtSmokeTrace); |
|
1239 |
AddVisualGear(x - hwRound(_30 * slope), y + hwRound(_30 * slope), vgtSmokeTrace); |
|
1240 |
AddVisualGear(x + hwRound(_30 * slope), y - hwRound(_30 * slope), vgtSmokeTrace); |
|
1241 |
AddVisualGear(x - hwRound(_40 * slope), y + hwRound(_40 * slope), vgtSmokeTrace); |
|
1242 |
AddVisualGear(x + hwRound(_40 * slope), y - hwRound(_40 * slope), vgtSmokeTrace); |
|
1243 |
AddVisualGear(x - hwRound(_50 * slope), y + hwRound(_50 * slope), vgtSmokeTrace); |
|
1244 |
AddVisualGear(x + hwRound(_50 * slope), y - hwRound(_50 * slope), vgtSmokeTrace); *) |
|
1245 |
end; |
|
1246 |
||
1247 |
//////////////////////////////////////////////////////////////////////////////// |
|
1248 |
procedure doStepHedgehog(Gear: PGear); |
|
1249 |
begin |
|
7389
15c3fb4882df
Sorry about the slight delay in pickup. You can blame a few lame cheaters. This is to make their cheating a bit harder.
nemo
parents:
7375
diff
changeset
|
1250 |
CheckSum:= CheckSum xor Gear^.Hedgehog^.BotLevel; |
6581 | 1251 |
if (Gear^.Message and gmDestroy) <> 0 then |
1252 |
begin |
|
1253 |
DeleteGear(Gear); |
|
1254 |
exit |
|
1255 |
end; |
|
8576
286ebfcb3d97
workaround for frequent AllHH active call in hedgehog step
nemo
parents:
8574
diff
changeset
|
1256 |
if GameTicks mod 100 = 0 then CheckIce(Gear); |
8563
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1257 |
if Gear^.Hedgehog^.Effects[heFrozen] > 0 then |
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1258 |
begin |
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1259 |
if Gear^.Hedgehog^.Effects[heFrozen] > 256 then |
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1260 |
dec(Gear^.Hedgehog^.Effects[heFrozen]) |
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1261 |
else if GameTicks mod 10 = 0 then |
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1262 |
dec(Gear^.Hedgehog^.Effects[heFrozen]) |
4d9d8287e601
Trying to improve rendering, sliding and thawing. Messing around w/ making fire thaw faster.
nemo
parents:
8560
diff
changeset
|
1263 |
end; |
6581 | 1264 |
if (Gear^.State and gstHHDriven) = 0 then |
1265 |
doStepHedgehogFree(Gear) |
|
1266 |
else |
|
1267 |
begin |
|
1268 |
with Gear^.Hedgehog^ do |
|
1269 |
if Team^.hasGone then |
|
1270 |
TeamGoneEffect(Team^) |
|
1271 |
else |
|
1272 |
doStepHedgehogDriven(Gear) |
|
1273 |
end; |
|
1274 |
end; |
|
1275 |
||
1276 |
end. |