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);
|
|
31 |
|
|
32 |
implementation
|
|
33 |
uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, uMisc,
|
|
34 |
uCommands, uLocale, uUtils, uVisualGears, uStats, uIO, uScript,
|
|
35 |
uGearsList, uGears, uCollisions, uRandom, uStore, uTeams,
|
|
36 |
uGearsUtils;
|
|
37 |
|
|
38 |
// Shouldn't more of this ammo switching stuff be moved to uAmmos ?
|
|
39 |
function ChangeAmmo(HHGear: PGear): boolean;
|
|
40 |
var slot, i: Longword;
|
|
41 |
ammoidx: LongInt;
|
|
42 |
begin
|
|
43 |
ChangeAmmo:= false;
|
|
44 |
slot:= HHGear^.MsgParam;
|
|
45 |
|
|
46 |
with HHGear^.Hedgehog^ do
|
|
47 |
begin
|
|
48 |
HHGear^.Message:= HHGear^.Message and (not gmSlot);
|
|
49 |
ammoidx:= 0;
|
|
50 |
if ((HHGear^.State and (gstAttacking or gstAttacked)) <> 0)
|
|
51 |
or ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0))
|
|
52 |
or ((HHGear^.State and gstHHDriven) = 0) then
|
|
53 |
exit;
|
|
54 |
ChangeAmmo:= true;
|
|
55 |
|
|
56 |
while (ammoidx < cMaxSlotAmmoIndex) and (Ammo^[slot, ammoidx].AmmoType <> CurAmmoType) do
|
|
57 |
inc(ammoidx);
|
|
58 |
|
|
59 |
if ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) and (MultiShootAttacks > 0) then
|
|
60 |
OnUsedAmmo(HHGear^.Hedgehog^);
|
|
61 |
|
|
62 |
MultiShootAttacks:= 0;
|
|
63 |
HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
|
|
64 |
|
|
65 |
if Ammoz[CurAmmoType].Slot = slot then
|
|
66 |
begin
|
|
67 |
i:= 0;
|
|
68 |
repeat
|
|
69 |
inc(ammoidx);
|
|
70 |
if (ammoidx > cMaxSlotAmmoIndex) then
|
|
71 |
begin
|
|
72 |
inc(i);
|
|
73 |
CurAmmoType:= amNothing;
|
|
74 |
ammoidx:= -1;
|
|
75 |
//TryDo(i < 2, 'Engine bug: no ammo in current slot', true)
|
|
76 |
end;
|
|
77 |
until (i = 1) or ((Ammo^[slot, ammoidx].Count > 0)
|
|
78 |
and (Team^.Clan^.TurnNumber > Ammoz[Ammo^[slot, ammoidx].AmmoType].SkipTurns))
|
|
79 |
|
|
80 |
end
|
|
81 |
else
|
|
82 |
begin
|
|
83 |
i:= 0;
|
|
84 |
// check whether there is ammo in slot
|
|
85 |
while (i <= cMaxSlotAmmoIndex) and ((Ammo^[slot, i].Count = 0)
|
|
86 |
or (Team^.Clan^.TurnNumber <= Ammoz[Ammo^[slot, i].AmmoType].SkipTurns))
|
|
87 |
do inc(i);
|
|
88 |
|
|
89 |
if i <= cMaxSlotAmmoIndex then
|
|
90 |
ammoidx:= i
|
|
91 |
else ammoidx:= -1
|
|
92 |
end;
|
|
93 |
if ammoidx >= 0 then
|
|
94 |
CurAmmoType:= Ammo^[slot, ammoidx].AmmoType;
|
|
95 |
end
|
|
96 |
end;
|
|
97 |
|
|
98 |
procedure HHSetWeapon(HHGear: PGear);
|
|
99 |
var t: LongInt;
|
|
100 |
weap: TAmmoType;
|
|
101 |
Hedgehog: PHedgehog;
|
|
102 |
s: boolean;
|
|
103 |
begin
|
|
104 |
s:= false;
|
|
105 |
|
|
106 |
weap:= TAmmoType(HHGear^.MsgParam);
|
|
107 |
Hedgehog:= HHGear^.Hedgehog;
|
|
108 |
|
|
109 |
if Hedgehog^.Team^.Clan^.TurnNumber <= Ammoz[weap].SkipTurns then
|
|
110 |
exit; // weapon is not activated yet
|
|
111 |
|
|
112 |
HHGear^.MsgParam:= Ammoz[weap].Slot;
|
|
113 |
|
|
114 |
t:= cMaxSlotAmmoIndex;
|
|
115 |
|
|
116 |
HHGear^.Message:= HHGear^.Message and (not gmWeapon);
|
|
117 |
|
|
118 |
with Hedgehog^ do
|
|
119 |
while (CurAmmoType <> weap) and (t >= 0) do
|
|
120 |
begin
|
|
121 |
s:= ChangeAmmo(HHGear);
|
|
122 |
dec(t)
|
|
123 |
end;
|
|
124 |
|
|
125 |
if s then
|
|
126 |
ApplyAmmoChanges(HHGear^.Hedgehog^)
|
|
127 |
end;
|
|
128 |
|
|
129 |
procedure HHSetTimer(Gear: PGear);
|
|
130 |
var CurWeapon: PAmmo;
|
|
131 |
color: LongWord;
|
|
132 |
begin
|
|
133 |
Gear^.Message:= Gear^.Message and (not gmTimer);
|
6924
|
134 |
CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
|
6581
|
135 |
with Gear^.Hedgehog^ do
|
|
136 |
if ((Gear^.Message and gmPrecise) <> 0) and ((CurWeapon^.Propz and ammoprop_SetBounce) <> 0) then
|
|
137 |
begin
|
|
138 |
color:= Gear^.Hedgehog^.Team^.Clan^.Color;
|
|
139 |
case Gear^.MsgParam of
|
|
140 |
1: begin
|
|
141 |
AddCaption(format(trmsg[sidBounce], trmsg[sidBounce1]), color, capgrpAmmostate);
|
|
142 |
CurWeapon^.Bounciness:= 350;
|
|
143 |
end;
|
|
144 |
2: begin
|
|
145 |
AddCaption(format(trmsg[sidBounce], trmsg[sidBounce2]), color, capgrpAmmostate);
|
|
146 |
CurWeapon^.Bounciness:= 700;
|
|
147 |
end;
|
|
148 |
3: begin
|
|
149 |
AddCaption(format(trmsg[sidBounce], trmsg[sidBounce3]), color, capgrpAmmostate);
|
|
150 |
CurWeapon^.Bounciness:= 1000;
|
|
151 |
end;
|
|
152 |
4: begin
|
|
153 |
AddCaption(format(trmsg[sidBounce], trmsg[sidBounce4]), color, capgrpAmmostate);
|
|
154 |
CurWeapon^.Bounciness:= 2000;
|
|
155 |
end;
|
|
156 |
5: begin
|
|
157 |
AddCaption(format(trmsg[sidBounce], trmsg[sidBounce5]), color, capgrpAmmostate);
|
|
158 |
CurWeapon^.Bounciness:= 4000;
|
|
159 |
end
|
|
160 |
end
|
|
161 |
end
|
|
162 |
else if (CurWeapon^.Propz and ammoprop_Timerable) <> 0 then
|
|
163 |
begin
|
|
164 |
CurWeapon^.Timer:= 1000 * Gear^.MsgParam;
|
|
165 |
with CurrentTeam^ do
|
|
166 |
ApplyAmmoChanges(Hedgehogs[CurrHedgehog]);
|
|
167 |
end;
|
|
168 |
end;
|
|
169 |
|
|
170 |
|
|
171 |
procedure Attack(Gear: PGear);
|
|
172 |
var xx, yy, newDx, newDy, lx, ly: hwFloat;
|
|
173 |
speech: PVisualGear;
|
|
174 |
newGear: PGear;
|
|
175 |
CurWeapon: PAmmo;
|
|
176 |
altUse: boolean;
|
|
177 |
elastic: hwFloat;
|
|
178 |
begin
|
|
179 |
newGear:= nil;
|
|
180 |
bShowFinger:= false;
|
6924
|
181 |
CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
|
6581
|
182 |
with Gear^,
|
|
183 |
Gear^.Hedgehog^ do
|
|
184 |
begin
|
|
185 |
if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstHHChooseTarget)) = 0) and (((State and gstMoving) = 0)
|
|
186 |
or (Power > 0)
|
|
187 |
or (CurAmmoType = amTeleport)
|
|
188 |
or
|
|
189 |
// Allow attacks while moving on ammo with AltAttack
|
|
190 |
((CurAmmoGear <> nil) and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0))
|
|
191 |
or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackInMove) <> 0))
|
|
192 |
and ((TargetPoint.X <> NoPointX) or ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget) = 0)) then
|
|
193 |
begin
|
|
194 |
State:= State or gstAttacking;
|
|
195 |
if Power = cMaxPower then
|
|
196 |
Message:= Message and (not gmAttack)
|
|
197 |
else if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) = 0 then
|
|
198 |
Message:= Message and (not gmAttack)
|
|
199 |
else
|
|
200 |
begin
|
|
201 |
if Power = 0 then
|
|
202 |
begin
|
|
203 |
AttackBar:= CurrentTeam^.AttackBar;
|
|
204 |
PlaySound(sndThrowPowerUp)
|
|
205 |
end;
|
|
206 |
inc(Power)
|
|
207 |
end;
|
|
208 |
if ((Message and gmAttack) <> 0) then
|
|
209 |
exit;
|
|
210 |
|
|
211 |
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0 then
|
|
212 |
begin
|
|
213 |
StopSound(sndThrowPowerUp);
|
|
214 |
PlaySound(sndThrowRelease);
|
|
215 |
end;
|
|
216 |
|
|
217 |
xx:= SignAs(AngleSin(Angle), dX);
|
|
218 |
yy:= -AngleCos(Angle);
|
|
219 |
|
|
220 |
lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle)));
|
|
221 |
ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle)));
|
|
222 |
|
|
223 |
if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
|
|
224 |
xx:= - xx;
|
|
225 |
if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then
|
|
226 |
AddVoice(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack);
|
|
227 |
|
|
228 |
// Initiating alt attack
|
|
229 |
if (CurAmmoGear <> nil)
|
|
230 |
and ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)
|
|
231 |
and ((Gear^.Message and gmLJump) <> 0)
|
|
232 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
|
|
233 |
begin
|
|
234 |
newDx:= dX / _2;
|
|
235 |
newDy:= dY / _2;
|
|
236 |
altUse:= true;
|
|
237 |
end
|
|
238 |
else
|
|
239 |
begin
|
|
240 |
newDx:= xx*Power/cPowerDivisor;
|
|
241 |
newDy:= yy*Power/cPowerDivisor;
|
|
242 |
altUse:= false
|
|
243 |
end;
|
|
244 |
|
|
245 |
case CurAmmoType of
|
|
246 |
amGrenade: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGrenade, 0, newDx, newDy, CurWeapon^.Timer);
|
|
247 |
amMolotov: newGear:= AddGear(hwRound(lx), hwRound(ly), gtMolotov, 0, newDx, newDy, 0);
|
|
248 |
amClusterBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtClusterBomb, 0, newDx, newDy, CurWeapon^.Timer);
|
|
249 |
amGasBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtGasBomb, 0, newDx, newDy, CurWeapon^.Timer);
|
|
250 |
amBazooka: newGear:= AddGear(hwRound(lx), hwRound(ly), gtShell, 0, newDx, newDy, 0);
|
|
251 |
amSnowball: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSnowball, 0, newDx, newDy, 0);
|
|
252 |
amBee: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBee, 0, newDx, newDy, 0);
|
|
253 |
amShotgun: begin
|
|
254 |
PlaySound(sndShotgunReload);
|
|
255 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtShotgunShot, 0, xx * _0_5, yy * _0_5, 0);
|
|
256 |
end;
|
|
257 |
amPickHammer: newGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
|
|
258 |
amSkip: ParseCommand('/skip', true);
|
|
259 |
amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
|
|
260 |
amMine: if altUse then
|
|
261 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, newDx, newDy, 3000)
|
|
262 |
else
|
|
263 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
|
|
264 |
amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
|
|
265 |
amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
|
|
266 |
amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
|
|
267 |
amPortalGun: begin
|
|
268 |
newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtPortal, 0, xx * _0_6, yy * _0_6,
|
|
269 |
// set selected color
|
|
270 |
CurWeapon^.Pos);
|
|
271 |
end;
|
|
272 |
amSniperRifle: begin
|
|
273 |
PlaySound(sndSniperReload);
|
|
274 |
newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSniperRifleShot, 0, xx * _0_5, yy * _0_5, 0);
|
|
275 |
end;
|
|
276 |
amDynamite: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtDynamite, 0, SignAs(_0_03, dX), _0, 5000);
|
|
277 |
amFirePunch: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtFirePunch, 0, xx, _0, 0);
|
|
278 |
amWhip: begin
|
|
279 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtWhip, 0, SignAs(_1, dX), - _0_8, 0);
|
|
280 |
PlaySound(sndWhipCrack)
|
|
281 |
end;
|
|
282 |
amHammer: begin
|
|
283 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtHammer, 0, SignAs(_1, dX), - _0_8, 0);
|
|
284 |
PlaySound(sndWhack)
|
|
285 |
end;
|
|
286 |
amBaseballBat: begin
|
|
287 |
newGear:= AddGear(hwRound(lx) + hwSign(dX) * 10, hwRound(ly), gtShover, gsttmpFlag, xx * _0_5, yy * _0_5, 0);
|
|
288 |
PlaySound(sndBaseballBat) // TODO: Only play if something is hit?
|
|
289 |
end;
|
|
290 |
amParachute: begin
|
|
291 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtParachute, 0, _0, _0, 0);
|
|
292 |
PlaySound(sndParachute)
|
|
293 |
end;
|
|
294 |
// we save CurWeapon^.Pos (in this case: cursor direction) by using it as (otherwise irrelevant) X value of the new gear.
|
|
295 |
amAirAttack: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 0, _0, _0, 0);
|
|
296 |
amMineStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 1, _0, _0, 0);
|
|
297 |
amDrillStrike: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 3, _0, _0, CurWeapon^.Timer);
|
|
298 |
amNapalm: newGear:= AddGear(CurWeapon^.Pos, 0, gtAirAttack, 2, _0, _0, 0);
|
|
299 |
amBlowTorch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
|
|
300 |
amGirder: newGear:= AddGear(0, 0, gtGirder, CurWeapon^.Pos, _0, _0, 0);
|
|
301 |
amTeleport: newGear:= AddGear(CurWeapon^.Pos, 0, gtTeleport, 0, _0, _0, 0);
|
|
302 |
amSwitch: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSwitcher, 0, _0, _0, 0);
|
|
303 |
amMortar: begin
|
|
304 |
playSound(sndMortar);
|
|
305 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtMortar, 0, xx*cMaxPower/cPowerDivisor, yy*cMaxPower/cPowerDivisor, 0);
|
|
306 |
end;
|
|
307 |
amRCPlane: begin
|
|
308 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtRCPlane, 0, xx * cMaxPower / cPowerDivisor / 4, yy * cMaxPower / cPowerDivisor / 4, 0);
|
|
309 |
newGear^.SoundChannel:= LoopSound(sndRCPlane, nil)
|
|
310 |
end;
|
|
311 |
amKamikaze: newGear:= AddGear(hwRound(lx), hwRound(ly), gtKamikaze, 0, xx * _0_5, yy * _0_5, 0);
|
|
312 |
amCake: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 3, hwRound(ly), gtCake, 0, xx, _0, 0);
|
|
313 |
amSeduction: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSeduction, 0, _0, _0, 0);
|
|
314 |
amWatermelon: newGear:= AddGear(hwRound(lx), hwRound(ly), gtWatermelon, 0, newDx, newDy, CurWeapon^.Timer);
|
|
315 |
amHellishBomb: newGear:= AddGear(hwRound(lx), hwRound(ly), gtHellishBomb, 0, newDx, newDy, 0);
|
|
316 |
amDrill: newGear:= AddGear(hwRound(lx), hwRound(ly), gtDrill, 0, newDx, newDy, 0);
|
|
317 |
amBallgun: newGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun, 0, xx * _0_5, yy * _0_5, 0);
|
|
318 |
amJetpack: newGear:= AddGear(hwRound(lx), hwRound(ly), gtJetpack, 0, _0, _0, 0);
|
|
319 |
amBirdy: begin
|
|
320 |
PlaySound(sndWhistle);
|
|
321 |
newGear:= AddGear(hwRound(lx), hwRound(ly) - 32, gtBirdy, 0, _0, _0, 0);
|
|
322 |
end;
|
|
323 |
amLowGravity: begin
|
|
324 |
PlaySound(sndLowGravity);
|
|
325 |
cGravity:= cMaxWindSpeed;
|
|
326 |
cGravityf:= 0.00025
|
|
327 |
end;
|
|
328 |
amExtraDamage: begin
|
|
329 |
PlaySound(sndHellishImpact4);
|
|
330 |
cDamageModifier:= _1_5
|
|
331 |
end;
|
|
332 |
amInvulnerable: Invulnerable:= true;
|
|
333 |
amExtraTime: begin
|
|
334 |
PlaySound(sndSwitchHog);
|
|
335 |
TurnTimeLeft:= TurnTimeLeft + 30000
|
|
336 |
end;
|
|
337 |
amLaserSight: cLaserSighting:= true;
|
|
338 |
amVampiric: begin
|
|
339 |
PlaySound(sndOw1, Team^.voicepack);
|
|
340 |
cVampiric:= true;
|
|
341 |
end;
|
|
342 |
amPiano: begin
|
|
343 |
// Tuck the hedgehog away until the piano attack is completed
|
|
344 |
Unplaced:= true;
|
|
345 |
X:= _0;
|
|
346 |
Y:= _0;
|
|
347 |
newGear:= AddGear(TargetPoint.X, 0, gtPiano, 0, _0, _0, 0);
|
|
348 |
PauseMusic
|
|
349 |
end;
|
|
350 |
amFlamethrower: newGear:= AddGear(hwRound(X), hwRound(Y), gtFlamethrower, 0, xx * _0_5, yy * _0_5, 0);
|
|
351 |
amLandGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtLandGun, 0, xx * _0_5, yy * _0_5, 0);
|
|
352 |
amResurrector: begin
|
|
353 |
newGear:= AddGear(hwRound(lx), hwRound(ly), gtResurrector, 0, _0, _0, 0);
|
|
354 |
newGear^.SoundChannel := LoopSound(sndResurrector);
|
|
355 |
end;
|
|
356 |
//amMelonStrike: AddGear(CurWeapon^.Pos, 0, gtAirAttack, 4, _0, _0, 0);
|
|
357 |
amStructure: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtStructure, gstWait, SignAs(_0_02, dX), _0, 3000);
|
|
358 |
amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
|
|
359 |
end;
|
|
360 |
|
|
361 |
case CurAmmoType of
|
|
362 |
amGrenade, amMolotov,
|
|
363 |
amClusterBomb, amGasBomb,
|
|
364 |
amBazooka, amSnowball,
|
|
365 |
amBee, amSMine,
|
|
366 |
amMortar, amWatermelon,
|
|
367 |
amHellishBomb, amDrill: FollowGear:= newGear;
|
|
368 |
|
|
369 |
amShotgun, amPickHammer,
|
|
370 |
amRope, amDEagle,
|
|
371 |
amSineGun, amSniperRifle,
|
|
372 |
amFirePunch, amWhip,
|
|
373 |
amHammer, amBaseballBat,
|
|
374 |
amParachute, amBlowTorch,
|
|
375 |
amGirder, amTeleport,
|
|
376 |
amSwitch, amRCPlane,
|
|
377 |
amKamikaze, amCake,
|
|
378 |
amSeduction, amBallgun,
|
|
379 |
amJetpack, amBirdy,
|
|
380 |
amFlamethrower, amLandGun,
|
|
381 |
amResurrector, amStructure,
|
|
382 |
amTardis, amPiano: CurAmmoGear:= newGear;
|
|
383 |
end;
|
|
384 |
|
|
385 |
if ((CurAmmoType = amMine) or (CurAmmoType = amSMine)) and (GameFlags and gfInfAttack <> 0) then
|
|
386 |
newGear^.FlightTime:= GameTicks + 1000
|
|
387 |
else if CurAmmoType = amDrill then
|
|
388 |
newGear^.FlightTime:= GameTicks + 250;
|
|
389 |
if Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then
|
|
390 |
begin
|
|
391 |
newGear^.Target.X:= TargetPoint.X;
|
|
392 |
newGear^.Target.Y:= TargetPoint.Y
|
|
393 |
end;
|
|
394 |
|
|
395 |
// Clear FollowGear if using on a rope/parachute/saucer etc so focus stays with the hog's movement
|
|
396 |
if altUse then
|
|
397 |
FollowGear:= nil;
|
|
398 |
|
|
399 |
if (newGear <> nil) and ((Ammoz[newGear^.AmmoType].Ammo.Propz and ammoprop_SetBounce) <> 0) then
|
|
400 |
begin
|
|
401 |
elastic:= int2hwfloat(CurWeapon^.Bounciness) / _1000;
|
|
402 |
|
|
403 |
if elastic < _1 then
|
|
404 |
newGear^.Elasticity:= newGear^.Elasticity * elastic
|
|
405 |
else if elastic > _1 then
|
|
406 |
newGear^.Elasticity:= _1 - ((_1-newGear^.Elasticity) / elastic);
|
|
407 |
(* Experimented with friction modifier. Didn't seem helpful
|
|
408 |
fric:= int2hwfloat(CurWeapon^.Bounciness) / _250;
|
|
409 |
if fric < _1 then newGear^.Friction:= newGear^.Friction * fric
|
|
410 |
else if fric > _1 then newGear^.Friction:= _1 - ((_1-newGear^.Friction) / fric)*)
|
|
411 |
end;
|
|
412 |
|
|
413 |
|
|
414 |
uStats.AmmoUsed(CurAmmoType);
|
|
415 |
|
|
416 |
if not (SpeechText = '') then
|
|
417 |
begin
|
|
418 |
speech:= AddVisualGear(0, 0, vgtSpeechBubble);
|
|
419 |
if speech <> nil then
|
|
420 |
begin
|
|
421 |
speech^.Text:= SpeechText;
|
|
422 |
speech^.Hedgehog:= Gear^.Hedgehog;
|
|
423 |
speech^.FrameTicks:= SpeechType;
|
|
424 |
end;
|
|
425 |
SpeechText:= ''
|
|
426 |
end;
|
|
427 |
|
|
428 |
Power:= 0;
|
|
429 |
if (CurAmmoGear <> nil)
|
|
430 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
|
|
431 |
begin
|
|
432 |
Message:= Message or gmAttack;
|
|
433 |
CurAmmoGear^.Message:= Message
|
|
434 |
end
|
|
435 |
else
|
|
436 |
begin
|
|
437 |
if not CurrentTeam^.ExtDriven
|
|
438 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_Power) <> 0) then
|
|
439 |
SendIPC('a');
|
|
440 |
AfterAttack;
|
|
441 |
end
|
|
442 |
end
|
|
443 |
else
|
|
444 |
Message:= Message and (not gmAttack);
|
|
445 |
end;
|
|
446 |
TargetPoint.X := NoPointX;
|
|
447 |
ScriptCall('onHogAttack');
|
|
448 |
end;
|
|
449 |
|
|
450 |
procedure AfterAttack;
|
|
451 |
var s: shortstring;
|
|
452 |
a: TAmmoType;
|
|
453 |
begin
|
|
454 |
with CurrentHedgehog^.Gear^, CurrentHedgehog^ do
|
|
455 |
begin
|
|
456 |
a:= CurAmmoType;
|
|
457 |
State:= State and (not gstAttacking);
|
|
458 |
if (Ammoz[a].Ammo.Propz and ammoprop_Effect) = 0 then
|
|
459 |
begin
|
|
460 |
Inc(MultiShootAttacks);
|
|
461 |
|
|
462 |
if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks) then
|
|
463 |
begin
|
|
464 |
s:= inttostr(Ammoz[a].Ammo.NumPerTurn - MultiShootAttacks + 1);
|
|
465 |
AddCaption(format(trmsg[sidRemaining], s), cWhiteColor, capgrpAmmostate);
|
|
466 |
end;
|
|
467 |
|
|
468 |
if (Ammoz[a].Ammo.NumPerTurn >= MultiShootAttacks)
|
|
469 |
or ((GameFlags and gfMultiWeapon) <> 0) then
|
|
470 |
begin
|
|
471 |
isInMultiShoot:= true
|
|
472 |
end
|
|
473 |
else
|
|
474 |
begin
|
|
475 |
OnUsedAmmo(CurrentHedgehog^);
|
|
476 |
if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) and (((GameFlags and gfInfAttack) = 0) or PlacingHogs) then
|
|
477 |
begin
|
|
478 |
if TagTurnTimeLeft = 0 then
|
|
479 |
TagTurnTimeLeft:= TurnTimeLeft;
|
|
480 |
TurnTimeLeft:=(Ammoz[a].TimeAfterTurn * cGetAwayTime) div 100;
|
|
481 |
end;
|
|
482 |
if ((Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) = 0) then
|
|
483 |
State:= State or gstAttacked;
|
|
484 |
if (Ammoz[a].Ammo.Propz and ammoprop_NoRoundEnd) <> 0 then
|
|
485 |
ApplyAmmoChanges(CurrentHedgehog^)
|
|
486 |
end;
|
|
487 |
end
|
|
488 |
else
|
|
489 |
begin
|
|
490 |
OnUsedAmmo(CurrentHedgehog^);
|
|
491 |
ApplyAmmoChanges(CurrentHedgehog^);
|
|
492 |
end;
|
|
493 |
AttackBar:= 0
|
|
494 |
end
|
|
495 |
end;
|
|
496 |
|
|
497 |
////////////////////////////////////////////////////////////////////////////////
|
|
498 |
procedure doStepHedgehogDead(Gear: PGear);
|
|
499 |
const frametime = 200;
|
|
500 |
timertime = frametime * 6;
|
|
501 |
begin
|
|
502 |
if Gear^.Hedgehog^.Unplaced then
|
|
503 |
exit;
|
|
504 |
if Gear^.Timer > 1 then
|
|
505 |
begin
|
|
506 |
AllInactive:= false;
|
|
507 |
dec(Gear^.Timer);
|
|
508 |
if (Gear^.Timer mod frametime) = 0 then
|
|
509 |
inc(Gear^.Pos)
|
|
510 |
end
|
|
511 |
else if Gear^.Timer = 1 then
|
|
512 |
begin
|
|
513 |
Gear^.State:= Gear^.State or gstNoDamage;
|
|
514 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, CurrentHedgehog, EXPLAutoSound);
|
|
515 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtGrave, 0, _0, _0, 0)^.Hedgehog:= Gear^.Hedgehog;
|
|
516 |
DeleteGear(Gear);
|
|
517 |
SetAllToActive
|
|
518 |
end
|
|
519 |
else // Gear^.Timer = 0
|
|
520 |
begin
|
|
521 |
AllInactive:= false;
|
|
522 |
Gear^.Z:= cCurrHHZ;
|
|
523 |
RemoveGearFromList(Gear);
|
|
524 |
InsertGearToList(Gear);
|
|
525 |
PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
|
|
526 |
Gear^.Pos:= 0;
|
|
527 |
Gear^.Timer:= timertime
|
|
528 |
end
|
|
529 |
end;
|
|
530 |
|
|
531 |
////////////////////////////////////////////////////////////////////////////////
|
|
532 |
procedure doStepHedgehogGone(Gear: PGear);
|
|
533 |
const frametime = 65;
|
|
534 |
timertime = frametime * 11;
|
|
535 |
begin
|
|
536 |
if Gear^.Hedgehog^.Unplaced then
|
|
537 |
exit;
|
|
538 |
if Gear^.Timer > 1 then
|
|
539 |
begin
|
|
540 |
AllInactive:= false;
|
|
541 |
dec(Gear^.Timer);
|
|
542 |
if (Gear^.Timer mod frametime) = 0 then
|
|
543 |
inc(Gear^.Pos)
|
|
544 |
end
|
|
545 |
else
|
|
546 |
if Gear^.Timer = 1 then
|
|
547 |
begin
|
|
548 |
DeleteGear(Gear);
|
|
549 |
SetAllToActive
|
|
550 |
end
|
|
551 |
else // Gear^.Timer = 0
|
|
552 |
begin
|
|
553 |
AllInactive:= false;
|
|
554 |
Gear^.Z:= cCurrHHZ;
|
|
555 |
RemoveGearFromList(Gear);
|
|
556 |
InsertGearToList(Gear);
|
|
557 |
PlaySound(sndByeBye, Gear^.Hedgehog^.Team^.voicepack);
|
|
558 |
PlaySound(sndWarp);
|
|
559 |
Gear^.Pos:= 0;
|
|
560 |
Gear^.Timer:= timertime
|
|
561 |
end
|
|
562 |
end;
|
|
563 |
|
|
564 |
////////////////////////////////////////////////////////////////////////////////
|
|
565 |
procedure PickUp(HH, Gear: PGear);
|
|
566 |
var s: shortstring;
|
|
567 |
a: TAmmoType;
|
|
568 |
i: LongInt;
|
|
569 |
vga: PVisualGear;
|
|
570 |
begin
|
|
571 |
Gear^.Message:= gmDestroy;
|
|
572 |
PlaySound(sndShotgunReload);
|
|
573 |
if (Gear^.Pos and posCaseExplode) <> 0 then
|
|
574 |
if (Gear^.Pos and posCasePoison) <> 0 then
|
|
575 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned)
|
|
576 |
else
|
|
577 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound)
|
|
578 |
else if (Gear^.Pos and posCasePoison) <> 0 then
|
|
579 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, HH^.Hedgehog, EXPLAutoSound + EXPLPoisoned + EXPLNoDamage)
|
|
580 |
else
|
|
581 |
case Gear^.Pos of
|
|
582 |
posCaseUtility,
|
|
583 |
posCaseAmmo: begin
|
|
584 |
if Gear^.AmmoType <> amNothing then a:= Gear^.AmmoType
|
|
585 |
else
|
|
586 |
begin
|
|
587 |
for i:= 0 to GameTicks and $7F do
|
|
588 |
GetRandom(2); // Burn some random numbers
|
|
589 |
if Gear^.Pos = posCaseUtility then
|
|
590 |
a:= GetUtility(HH^.Hedgehog)
|
|
591 |
else
|
|
592 |
a:= GetAmmo(HH^.Hedgehog)
|
|
593 |
end;
|
|
594 |
AddAmmo(HH^.Hedgehog^, a);
|
|
595 |
// Possibly needs to check shared clan ammo game flag once added.
|
|
596 |
// On the other hand, no obvious reason that clan members shouldn't know what ammo another clan member picked up
|
|
597 |
if (not (HH^.Hedgehog^.Team^.ExtDriven
|
|
598 |
or (HH^.Hedgehog^.BotLevel > 0)))
|
|
599 |
or (HH^.Hedgehog^.Team^.Clan^.ClanIndex = LocalClan)
|
|
600 |
or (GameType = gmtDemo) then
|
|
601 |
begin
|
|
602 |
s:= trammo[Ammoz[a].NameId] + ' (+' + IntToStr(Ammoz[a].NumberInCase) + ')';
|
|
603 |
AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
|
|
604 |
|
|
605 |
// show ammo icon
|
|
606 |
vga:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtAmmo);
|
|
607 |
if vga <> nil then
|
|
608 |
vga^.Frame:= Longword(a);
|
|
609 |
end;
|
|
610 |
|
|
611 |
end;
|
|
612 |
posCaseHealth: begin
|
|
613 |
inc(HH^.Health, Gear^.Health);
|
|
614 |
HH^.Hedgehog^.Effects[hePoisoned] := false;
|
|
615 |
str(Gear^.Health, s);
|
|
616 |
s:= '+' + s;
|
|
617 |
AddCaption(s, HH^.Hedgehog^.Team^.Clan^.Color, capgrpAmmoinfo);
|
|
618 |
RenderHealth(HH^.Hedgehog^);
|
|
619 |
RecountTeamHealth(HH^.Hedgehog^.Team);
|
|
620 |
|
|
621 |
i:= 0;
|
|
622 |
while i < Gear^.Health do
|
|
623 |
begin
|
|
624 |
vga:= AddVisualGear(hwRound(HH^.X), hwRound(HH^.Y), vgtStraightShot);
|
|
625 |
if vga <> nil then
|
|
626 |
with vga^ do
|
|
627 |
begin
|
|
628 |
Tint:= $00FF00FF;
|
|
629 |
State:= ord(sprHealth)
|
|
630 |
end;
|
|
631 |
inc(i, 5);
|
|
632 |
end;
|
|
633 |
end;
|
|
634 |
end
|
|
635 |
end;
|
|
636 |
|
|
637 |
procedure HedgehogStep(Gear: PGear);
|
|
638 |
var PrevdX: LongInt;
|
|
639 |
CurWeapon: PAmmo;
|
|
640 |
begin
|
6924
|
641 |
CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
|
6581
|
642 |
if ((Gear^.State and (gstAttacking or gstMoving)) = 0) then
|
|
643 |
begin
|
|
644 |
if isCursorVisible then
|
|
645 |
with Gear^.Hedgehog^ do
|
|
646 |
with CurWeapon^ do
|
|
647 |
begin
|
|
648 |
if (Gear^.Message and gmLeft ) <> 0 then
|
|
649 |
Pos:= (Pos - 1 + Ammoz[AmmoType].PosCount) mod Ammoz[AmmoType].PosCount
|
|
650 |
else
|
|
651 |
if (Gear^.Message and gmRight ) <> 0 then
|
|
652 |
Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount
|
|
653 |
else
|
|
654 |
exit;
|
|
655 |
StepTicks:= 200;
|
|
656 |
exit
|
|
657 |
end;
|
|
658 |
|
|
659 |
if ((Gear^.Message and gmAnimate) <> 0) then
|
|
660 |
begin
|
|
661 |
Gear^.Message:= 0;
|
|
662 |
Gear^.State:= Gear^.State or gstAnimation;
|
|
663 |
Gear^.Tag:= Gear^.MsgParam;
|
|
664 |
Gear^.Timer:= 0;
|
|
665 |
Gear^.Pos:= 0
|
|
666 |
end;
|
|
667 |
|
|
668 |
if ((Gear^.Message and gmLJump ) <> 0) then
|
|
669 |
begin
|
|
670 |
Gear^.Message:= Gear^.Message and (not gmLJump);
|
|
671 |
DeleteCI(Gear);
|
|
672 |
if TestCollisionYwithGear(Gear, -1) = 0 then
|
|
673 |
if not TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX)) then
|
|
674 |
Gear^.Y:= Gear^.Y - _2
|
|
675 |
else
|
|
676 |
if not TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX)) then
|
|
677 |
Gear^.Y:= Gear^.Y - _1;
|
|
678 |
if not (TestCollisionXwithGear(Gear, hwSign(Gear^.dX))
|
|
679 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then
|
|
680 |
begin
|
|
681 |
Gear^.dY:= -_0_15;
|
|
682 |
if not cArtillery then
|
|
683 |
Gear^.dX:= SignAs(_0_15, Gear^.dX);
|
|
684 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
|
|
685 |
PlaySound(sndJump1, Gear^.Hedgehog^.Team^.voicepack);
|
|
686 |
exit
|
|
687 |
end;
|
|
688 |
end;
|
|
689 |
|
|
690 |
if ((Gear^.Message and gmHJump ) <> 0) then
|
|
691 |
begin
|
|
692 |
DeleteCI(Gear);
|
|
693 |
Gear^.Message:= Gear^.Message and (not gmHJump);
|
|
694 |
|
|
695 |
Gear^.dY:= -_0_2;
|
|
696 |
SetLittle(Gear^.dX);
|
|
697 |
Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
|
|
698 |
PlaySound(sndJump3, Gear^.Hedgehog^.Team^.voicepack);
|
|
699 |
exit
|
|
700 |
end;
|
|
701 |
|
|
702 |
PrevdX:= hwSign(Gear^.dX);
|
|
703 |
if (Gear^.Message and gmLeft )<>0 then
|
|
704 |
Gear^.dX:= -cLittle else
|
|
705 |
if (Gear^.Message and gmRight )<>0 then
|
|
706 |
Gear^.dX:= cLittle else exit;
|
|
707 |
|
|
708 |
if (Gear^.Message and (gmLeft or gmRight)) <> 0 then
|
|
709 |
begin
|
|
710 |
StepSoundTimer:= cHHStepTicks;
|
|
711 |
end;
|
|
712 |
|
|
713 |
StepTicks:= cHHStepTicks;
|
|
714 |
if PrevdX <> hwSign(Gear^.dX) then
|
|
715 |
begin
|
|
716 |
FollowGear:= Gear;
|
|
717 |
exit
|
|
718 |
end;
|
|
719 |
DeleteCI(Gear); // must be after exit!! (see previous line)
|
|
720 |
|
|
721 |
Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
|
|
722 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then
|
|
723 |
begin
|
|
724 |
if not (TestCollisionXwithXYShift(Gear, _0, -6, hwSign(Gear^.dX))
|
|
725 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then
|
|
726 |
Gear^.Y:= Gear^.Y - _1;
|
|
727 |
if not (TestCollisionXwithXYShift(Gear, _0, -5, hwSign(Gear^.dX))
|
|
728 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then
|
|
729 |
Gear^.Y:= Gear^.Y - _1;
|
|
730 |
if not (TestCollisionXwithXYShift(Gear, _0, -4, hwSign(Gear^.dX))
|
|
731 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then
|
|
732 |
Gear^.Y:= Gear^.Y - _1;
|
|
733 |
if not (TestCollisionXwithXYShift(Gear, _0, -3, hwSign(Gear^.dX))
|
|
734 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then
|
|
735 |
Gear^.Y:= Gear^.Y - _1;
|
|
736 |
if not (TestCollisionXwithXYShift(Gear, _0, -2, hwSign(Gear^.dX))
|
|
737 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then
|
|
738 |
Gear^.Y:= Gear^.Y - _1;
|
|
739 |
if not (TestCollisionXwithXYShift(Gear, _0, -1, hwSign(Gear^.dX))
|
|
740 |
or (TestCollisionYwithGear(Gear, -1) <> 0)) then
|
|
741 |
Gear^.Y:= Gear^.Y - _1;
|
|
742 |
end;
|
|
743 |
|
|
744 |
if (not cArtillery) and ((Gear^.Message and gmPrecise) = 0) and (not TestCollisionXwithGear(Gear, hwSign(Gear^.dX))) then
|
|
745 |
Gear^.X:= Gear^.X + SignAs(_1, Gear^.dX);
|
|
746 |
|
|
747 |
SetAllHHToActive;
|
|
748 |
|
|
749 |
if TestCollisionYwithGear(Gear, 1) = 0 then
|
|
750 |
begin
|
|
751 |
Gear^.Y:= Gear^.Y + _1;
|
|
752 |
if TestCollisionYwithGear(Gear, 1) = 0 then
|
|
753 |
begin
|
|
754 |
Gear^.Y:= Gear^.Y + _1;
|
|
755 |
if TestCollisionYwithGear(Gear, 1) = 0 then
|
|
756 |
begin
|
|
757 |
Gear^.Y:= Gear^.Y + _1;
|
|
758 |
if TestCollisionYwithGear(Gear, 1) = 0 then
|
|
759 |
begin
|
|
760 |
Gear^.Y:= Gear^.Y + _1;
|
|
761 |
if TestCollisionYwithGear(Gear, 1) = 0 then
|
|
762 |
begin
|
|
763 |
Gear^.Y:= Gear^.Y + _1;
|
|
764 |
if TestCollisionYwithGear(Gear, 1) = 0 then
|
|
765 |
begin
|
|
766 |
Gear^.Y:= Gear^.Y + _1;
|
|
767 |
if TestCollisionYwithGear(Gear, 1) = 0 then
|
|
768 |
begin
|
|
769 |
Gear^.Y:= Gear^.Y - _6;
|
|
770 |
Gear^.dY:= _0;
|
|
771 |
Gear^.State:= Gear^.State or gstMoving;
|
|
772 |
exit
|
|
773 |
end;
|
|
774 |
end
|
|
775 |
end
|
|
776 |
end
|
|
777 |
end
|
|
778 |
end
|
|
779 |
end;
|
|
780 |
AddGearCI(Gear)
|
|
781 |
end
|
|
782 |
end;
|
|
783 |
|
|
784 |
procedure HedgehogChAngle(HHGear: PGear);
|
|
785 |
var da: LongWord;
|
|
786 |
begin
|
|
787 |
with HHGear^.Hedgehog^ do
|
|
788 |
if ((CurAmmoType = amRope) and ((HHGear^.State and (gstMoving or gstHHJumping)) = gstMoving))
|
|
789 |
or ((CurAmmoType = amPortalGun) and ((HHGear^.State and gstMoving) <> 0)) then
|
|
790 |
da:= 2
|
|
791 |
else da:= 1;
|
|
792 |
|
|
793 |
if (((HHGear^.Message and gmPrecise) = 0) or ((GameTicks mod 5) = 1)) then
|
|
794 |
if ((HHGear^.Message and gmUp) <> 0) and (HHGear^.Angle >= CurMinAngle + da) then
|
|
795 |
dec(HHGear^.Angle, da)
|
|
796 |
else
|
|
797 |
if ((HHGear^.Message and gmDown) <> 0) and (HHGear^.Angle + da <= CurMaxAngle) then
|
|
798 |
inc(HHGear^.Angle, da)
|
|
799 |
end;
|
|
800 |
|
|
801 |
|
|
802 |
////////////////////////////////////////////////////////////////////////////////
|
|
803 |
procedure doStepHedgehogMoving(Gear: PGear);
|
|
804 |
var isFalling, isUnderwater: boolean;
|
|
805 |
land: Word;
|
|
806 |
begin
|
|
807 |
land:= 0;
|
|
808 |
isUnderwater:= cWaterLine < hwRound(Gear^.Y) + Gear^.Radius;
|
|
809 |
if Gear^.dX.QWordValue > 8160437862 then
|
|
810 |
Gear^.dX.QWordValue:= 8160437862;
|
|
811 |
if Gear^.dY.QWordValue > 8160437862 then
|
|
812 |
Gear^.dY.QWordValue:= 8160437862;
|
|
813 |
|
|
814 |
if Gear^.Hedgehog^.Unplaced then
|
|
815 |
begin
|
|
816 |
Gear^.dY:= _0;
|
|
817 |
Gear^.dX:= _0;
|
|
818 |
Gear^.State:= Gear^.State and (not gstMoving);
|
|
819 |
exit
|
|
820 |
end;
|
|
821 |
isFalling:= (Gear^.dY.isNegative) or not TestCollisionYKick(Gear, 1);
|
|
822 |
if isFalling then
|
|
823 |
begin
|
|
824 |
if (Gear^.dY.isNegative) and TestCollisionYKick(Gear, -1) then
|
|
825 |
Gear^.dY:= _0;
|
|
826 |
Gear^.State:= Gear^.State or gstMoving;
|
|
827 |
if (CurrentHedgehog^.Gear = Gear)
|
|
828 |
and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
|
|
829 |
begin
|
|
830 |
FollowGear:= Gear;
|
|
831 |
end;
|
|
832 |
if isUnderwater then
|
|
833 |
Gear^.dY:= Gear^.dY + cGravity / _2
|
|
834 |
else
|
|
835 |
begin
|
|
836 |
Gear^.dY:= Gear^.dY + cGravity;
|
|
837 |
// this set of circumstances could be less complex if jumping was more clearly identified
|
|
838 |
if ((GameFlags and gfMoreWind) <> 0) and (((Gear^.Damage <> 0)
|
|
839 |
or ((CurAmmoGear <> nil) and ((CurAmmoGear^.AmmoType = amJetpack) or (CurAmmoGear^.AmmoType = amBirdy)))
|
|
840 |
or ((Gear^.dY.QWordValue + Gear^.dX.QWordValue) > _0_55.QWordValue))) then
|
|
841 |
Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
|
|
842 |
end
|
|
843 |
end
|
|
844 |
else
|
|
845 |
begin
|
|
846 |
land:= TestCollisionYwithGear(Gear, 1);
|
|
847 |
if ((Gear^.dX.QWordValue + Gear^.dY.QWordValue) < _0_55.QWordValue) and ((land and lfIce) = 0)
|
|
848 |
and ((Gear^.State and gstHHJumping) <> 0) then
|
|
849 |
SetLittle(Gear^.dX);
|
|
850 |
|
|
851 |
if not Gear^.dY.isNegative then
|
|
852 |
begin
|
|
853 |
CheckHHDamage(Gear);
|
|
854 |
|
|
855 |
if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery)
|
|
856 |
and (Gear^.dX.QWordValue < _0_02.QWordValue) then
|
|
857 |
Gear^.dX.isNegative:= not Gear^.dX.isNegative; // landing after high jump
|
|
858 |
Gear^.State:= Gear^.State and (not (gstHHJumping or gstHHHJump));
|
|
859 |
Gear^.dY:= _0;
|
|
860 |
end
|
|
861 |
else
|
|
862 |
Gear^.dY:= Gear^.dY + cGravity;
|
|
863 |
|
|
864 |
if ((Gear^.State and gstMoving) <> 0) then
|
|
865 |
begin
|
|
866 |
if land and lfIce <> 0 then
|
|
867 |
begin
|
|
868 |
Gear^.dX:= Gear^.dX * (_1 - (_1 - Gear^.Friction) / _2)
|
|
869 |
end
|
|
870 |
else
|
|
871 |
Gear^.dX:= Gear^.dX * Gear^.Friction;
|
|
872 |
end
|
|
873 |
end;
|
|
874 |
|
|
875 |
if (Gear^.State <> 0) then
|
|
876 |
DeleteCI(Gear);
|
|
877 |
|
|
878 |
if isUnderwater then
|
|
879 |
begin
|
|
880 |
Gear^.dY:= Gear^.dY * _0_999;
|
|
881 |
Gear^.dX:= Gear^.dX * _0_999;
|
|
882 |
end;
|
|
883 |
|
|
884 |
if (Gear^.State and gstMoving) <> 0 then
|
|
885 |
if TestCollisionXKick(Gear, hwSign(Gear^.dX)) then
|
|
886 |
if not isFalling then
|
|
887 |
if hwAbs(Gear^.dX) > _0_01 then
|
|
888 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -1, hwSign(Gear^.dX)) then
|
|
889 |
begin
|
|
890 |
Gear^.X:= Gear^.X + Gear^.dX;
|
|
891 |
Gear^.dX:= Gear^.dX * _0_96;
|
|
892 |
Gear^.Y:= Gear^.Y - _1
|
|
893 |
end
|
|
894 |
else
|
|
895 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -2, hwSign(Gear^.dX)) then
|
|
896 |
begin
|
|
897 |
Gear^.X:= Gear^.X + Gear^.dX;
|
|
898 |
Gear^.dX:= Gear^.dX * _0_93;
|
|
899 |
Gear^.Y:= Gear^.Y - _2
|
|
900 |
end
|
|
901 |
else
|
|
902 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -3, hwSign(Gear^.dX)) then
|
|
903 |
begin
|
|
904 |
Gear^.X:= Gear^.X + Gear^.dX;
|
|
905 |
Gear^.dX:= Gear^.dX * _0_9 ;
|
|
906 |
Gear^.Y:= Gear^.Y - _3
|
|
907 |
end
|
|
908 |
else
|
|
909 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -4, hwSign(Gear^.dX)) then
|
|
910 |
begin
|
|
911 |
Gear^.X:= Gear^.X + Gear^.dX;
|
|
912 |
Gear^.dX:= Gear^.dX * _0_87;
|
|
913 |
Gear^.Y:= Gear^.Y - _4
|
|
914 |
end
|
|
915 |
else
|
|
916 |
if not TestCollisionXwithXYShift(Gear, int2hwFloat(hwSign(Gear^.dX)) - Gear^.dX, -5, hwSign(Gear^.dX)) then
|
|
917 |
begin
|
|
918 |
Gear^.X:= Gear^.X + Gear^.dX;
|
|
919 |
Gear^.dX:= Gear^.dX * _0_84;
|
|
920 |
Gear^.Y:= Gear^.Y - _5
|
|
921 |
end
|
|
922 |
else
|
|
923 |
if hwAbs(Gear^.dX) > _0_02 then
|
|
924 |
Gear^.dX:= -Gear^.Elasticity * Gear^.dX
|
|
925 |
else
|
|
926 |
begin
|
|
927 |
Gear^.State:= Gear^.State and (not gstMoving);
|
|
928 |
while TestCollisionYWithGear(Gear,1) = 0 do
|
|
929 |
Gear^.Y:= Gear^.Y+_1;
|
|
930 |
SetLittle(Gear^.dX)
|
|
931 |
end
|
|
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 if (hwAbs(Gear^.dX) > cLittle)
|
|
940 |
and ((Gear^.State and gstHHJumping) = 0) then
|
|
941 |
Gear^.dX:= -Gear^.Elasticity * Gear^.dX
|
|
942 |
else
|
|
943 |
SetLittle(Gear^.dX);
|
|
944 |
|
|
945 |
if (not isFalling)
|
|
946 |
and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
|
|
947 |
begin
|
|
948 |
Gear^.State:= Gear^.State and (not gstWinner);
|
|
949 |
Gear^.State:= Gear^.State and (not gstMoving);
|
|
950 |
while TestCollisionYWithGear(Gear,1) = 0 do
|
|
951 |
Gear^.Y:= Gear^.Y+_1;
|
|
952 |
SetLittle(Gear^.dX);
|
|
953 |
Gear^.dY:= _0
|
|
954 |
end
|
|
955 |
else
|
|
956 |
Gear^.State:= Gear^.State or gstMoving;
|
|
957 |
|
|
958 |
if (Gear^.State and gstMoving) <> 0 then
|
|
959 |
begin
|
|
960 |
Gear^.State:= Gear^.State and (not gstAnimation);
|
|
961 |
// ARTILLERY but not being moved by explosions
|
|
962 |
Gear^.X:= Gear^.X + Gear^.dX;
|
|
963 |
Gear^.Y:= Gear^.Y + Gear^.dY;
|
|
964 |
if (not Gear^.dY.isNegative) and (not TestCollisionYKick(Gear, 1))
|
|
965 |
and TestCollisionYwithXYShift(Gear, 0, 1, 1) then
|
|
966 |
begin
|
|
967 |
CheckHHDamage(Gear);
|
|
968 |
Gear^.dY:= _0;
|
|
969 |
Gear^.Y:= Gear^.Y + _1
|
|
970 |
end;
|
|
971 |
CheckGearDrowning(Gear);
|
|
972 |
// hide target cursor if current hog is drowning
|
|
973 |
if (Gear^.State and gstDrowning) <> 0 then
|
|
974 |
if (CurrentHedgehog^.Gear = Gear) then
|
|
975 |
isCursorVisible:= false
|
|
976 |
end;
|
|
977 |
|
|
978 |
if (hwAbs(Gear^.dY) > _0) and (Gear^.FlightTime > 0) and ((GameFlags and gfLowGravity) = 0) then
|
|
979 |
begin
|
|
980 |
inc(Gear^.FlightTime);
|
|
981 |
if Gear^.FlightTime = 3000 then
|
|
982 |
begin
|
|
983 |
AddCaption(GetEventString(eidHomerun), cWhiteColor, capgrpMessage);
|
|
984 |
PlaySound(sndHomerun)
|
|
985 |
end;
|
|
986 |
end
|
|
987 |
else
|
|
988 |
begin
|
|
989 |
uStats.hedgehogFlight(Gear, Gear^.FlightTime);
|
|
990 |
Gear^.FlightTime:= 0;
|
|
991 |
end;
|
|
992 |
|
|
993 |
end;
|
|
994 |
|
|
995 |
procedure doStepHedgehogDriven(HHGear: PGear);
|
|
996 |
var t: PGear;
|
|
997 |
wasJumping: boolean;
|
|
998 |
Hedgehog: PHedgehog;
|
|
999 |
begin
|
|
1000 |
Hedgehog:= HHGear^.Hedgehog;
|
|
1001 |
if isInMultiShoot then
|
|
1002 |
HHGear^.Message:= 0;
|
|
1003 |
|
|
1004 |
if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_Utility) <> 0) and isInMultiShoot then
|
|
1005 |
AllInactive:= true
|
|
1006 |
else if not isInMultiShoot then
|
|
1007 |
AllInactive:= false;
|
|
1008 |
|
|
1009 |
if (TurnTimeLeft = 0) or (HHGear^.Damage > 0) then
|
|
1010 |
begin
|
|
1011 |
if TagTurnTimeLeft = 0 then
|
|
1012 |
TagTurnTimeLeft:= TurnTimeLeft;
|
|
1013 |
TurnTimeLeft:= 0;
|
|
1014 |
isCursorVisible:= false;
|
|
1015 |
HHGear^.State:= HHGear^.State and (not (gstHHDriven or gstAnimation or gstAttacking));
|
|
1016 |
AttackBar:= 0;
|
|
1017 |
if HHGear^.Damage > 0 then
|
|
1018 |
HHGear^.State:= HHGear^.State and (not (gstHHJumping or gstHHHJump));
|
|
1019 |
exit
|
|
1020 |
end;
|
|
1021 |
|
|
1022 |
if (HHGear^.State and gstAnimation) <> 0 then
|
|
1023 |
begin
|
|
1024 |
HHGear^.Message:= 0;
|
|
1025 |
if (HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].VoiceDelay) and (HHGear^.Timer = 0) then
|
|
1026 |
PlaySound(Wavez[TWave(HHGear^.Tag)].Voice, Hedgehog^.Team^.voicepack);
|
|
1027 |
inc(HHGear^.Timer);
|
|
1028 |
if HHGear^.Timer = Wavez[TWave(HHGear^.Tag)].Interval then
|
|
1029 |
begin
|
|
1030 |
HHGear^.Timer:= 0;
|
|
1031 |
inc(HHGear^.Pos);
|
|
1032 |
if HHGear^.Pos = Wavez[TWave(HHGear^.Tag)].FramesCount then
|
|
1033 |
HHGear^.State:= HHGear^.State and (not gstAnimation)
|
|
1034 |
end;
|
|
1035 |
exit
|
|
1036 |
end;
|
|
1037 |
|
|
1038 |
if ((HHGear^.State and gstMoving) <> 0)
|
|
1039 |
or (StepTicks = cHHStepTicks)
|
|
1040 |
or (CurAmmoGear <> nil) then // we are moving
|
|
1041 |
begin
|
|
1042 |
with Hedgehog^ do
|
|
1043 |
if (CurAmmoGear = nil)
|
|
1044 |
and (HHGear^.dY > _0_39)
|
|
1045 |
and (CurAmmoType = amParachute) then
|
|
1046 |
HHGear^.Message:= HHGear^.Message or gmAttack;
|
|
1047 |
// check for case with ammo
|
|
1048 |
t:= CheckGearNear(HHGear, gtCase, 36, 36);
|
|
1049 |
if t <> nil then
|
|
1050 |
PickUp(HHGear, t)
|
|
1051 |
end;
|
|
1052 |
|
|
1053 |
if (CurAmmoGear = nil) then
|
|
1054 |
if (((HHGear^.Message and gmAttack) <> 0)
|
|
1055 |
or ((HHGear^.State and gstAttacking) <> 0)) then
|
|
1056 |
Attack(HHGear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
|
|
1057 |
else
|
|
1058 |
else
|
|
1059 |
with Hedgehog^ do
|
|
1060 |
if ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)
|
|
1061 |
and ((HHGear^.Message and gmLJump) <> 0)
|
|
1062 |
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
|
|
1063 |
begin
|
|
1064 |
Attack(HHGear);
|
|
1065 |
HHGear^.Message:= HHGear^.Message and (not gmLJump)
|
|
1066 |
end;
|
|
1067 |
|
|
1068 |
if (CurAmmoGear = nil)
|
|
1069 |
or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0)
|
|
1070 |
or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) then
|
|
1071 |
begin
|
|
1072 |
if ((HHGear^.Message and gmSlot) <> 0) then
|
|
1073 |
if ChangeAmmo(HHGear) then ApplyAmmoChanges(Hedgehog^);
|
|
1074 |
|
|
1075 |
if ((HHGear^.Message and gmWeapon) <> 0) then
|
|
1076 |
HHSetWeapon(HHGear);
|
|
1077 |
|
|
1078 |
if ((HHGear^.Message and gmTimer) <> 0) then
|
|
1079 |
HHSetTimer(HHGear);
|
|
1080 |
end;
|
|
1081 |
|
|
1082 |
if CurAmmoGear <> nil then
|
|
1083 |
begin
|
|
1084 |
CurAmmoGear^.Message:= HHGear^.Message;
|
|
1085 |
exit
|
|
1086 |
end;
|
|
1087 |
|
|
1088 |
if not isInMultiShoot then
|
|
1089 |
HedgehogChAngle(HHGear);
|
|
1090 |
|
|
1091 |
if (HHGear^.State and gstMoving) <> 0 then
|
|
1092 |
begin
|
|
1093 |
wasJumping:= ((HHGear^.State and gstHHJumping) <> 0);
|
|
1094 |
|
|
1095 |
if ((HHGear^.Message and gmHJump) <> 0) and wasJumping and ((HHGear^.State and gstHHHJump) = 0) then
|
|
1096 |
if (not (hwAbs(HHGear^.dX) > cLittle)) and (HHGear^.dY < -_0_02) then
|
|
1097 |
begin
|
|
1098 |
HHGear^.State:= HHGear^.State or gstHHHJump;
|
|
1099 |
HHGear^.dY:= -_0_25;
|
|
1100 |
if not cArtillery then
|
|
1101 |
HHGear^.dX:= -SignAs(_0_02, HHGear^.dX);
|
|
1102 |
PlaySound(sndJump2, Hedgehog^.Team^.voicepack)
|
|
1103 |
end;
|
|
1104 |
|
|
1105 |
HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
|
|
1106 |
|
|
1107 |
if (not cArtillery) and wasJumping and TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
|
|
1108 |
SetLittle(HHGear^.dX);
|
|
1109 |
|
|
1110 |
if Hedgehog^.Gear <> nil then
|
|
1111 |
doStepHedgehogMoving(HHGear);
|
|
1112 |
|
|
1113 |
if ((HHGear^.State and (gstMoving or gstDrowning)) = 0) then
|
|
1114 |
begin
|
|
1115 |
AddGearCI(HHGear);
|
|
1116 |
if wasJumping then
|
|
1117 |
StepTicks:= 410
|
|
1118 |
else
|
|
1119 |
StepTicks:= 95
|
|
1120 |
end;
|
|
1121 |
exit
|
|
1122 |
end;
|
|
1123 |
|
|
1124 |
if not isInMultiShoot and (Hedgehog^.Gear <> nil) then
|
|
1125 |
begin
|
|
1126 |
if StepTicks > 0 then
|
|
1127 |
dec(StepTicks);
|
|
1128 |
if (StepTicks = 0) then
|
|
1129 |
HedgehogStep(HHGear)
|
|
1130 |
end
|
|
1131 |
end;
|
|
1132 |
|
|
1133 |
////////////////////////////////////////////////////////////////////////////////
|
|
1134 |
procedure doStepHedgehogFree(Gear: PGear);
|
|
1135 |
var prevState: Longword;
|
|
1136 |
begin
|
|
1137 |
prevState:= Gear^.State;
|
|
1138 |
|
|
1139 |
doStepHedgehogMoving(Gear);
|
|
1140 |
|
|
1141 |
if (Gear^.State and (gstMoving or gstDrowning)) <> 0 then
|
|
1142 |
begin
|
|
1143 |
if Gear^.Damage > 0 then
|
|
1144 |
CalcRotationDirAngle(Gear);
|
|
1145 |
AllInactive:= false;
|
|
1146 |
exit
|
|
1147 |
end;
|
|
1148 |
|
|
1149 |
if (Gear^.Health = 0) then
|
|
1150 |
begin
|
|
1151 |
if PrvInactive or ((GameFlags and gfInfAttack) <> 0) then
|
|
1152 |
begin
|
|
1153 |
Gear^.Timer:= 0;
|
|
1154 |
FollowGear:= Gear;
|
|
1155 |
PrvInactive:= false;
|
|
1156 |
AllInactive:= false;
|
|
1157 |
|
|
1158 |
if (Gear^.State and gstHHGone) = 0 then
|
|
1159 |
begin
|
|
1160 |
Gear^.Hedgehog^.Effects[hePoisoned] := false;
|
|
1161 |
if Gear^.Hedgehog^.Effects[heResurrectable] then
|
|
1162 |
begin
|
|
1163 |
ResurrectHedgehog(Gear);
|
|
1164 |
end
|
|
1165 |
else
|
|
1166 |
begin
|
|
1167 |
Gear^.State:= (Gear^.State or gstHHDeath) and (not gstAnimation);
|
|
1168 |
Gear^.doStep:= @doStepHedgehogDead;
|
|
1169 |
// Death message
|
|
1170 |
AddCaption(Format(GetEventString(eidDied), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
|
|
1171 |
end;
|
|
1172 |
end
|
|
1173 |
else
|
|
1174 |
begin
|
|
1175 |
Gear^.State:= Gear^.State and (not gstAnimation);
|
|
1176 |
Gear^.doStep:= @doStepHedgehogGone;
|
|
1177 |
|
|
1178 |
// Gone message
|
|
1179 |
AddCaption(Format(GetEventString(eidGone), Gear^.Hedgehog^.Name), cWhiteColor, capgrpMessage);
|
|
1180 |
end
|
|
1181 |
end;
|
|
1182 |
exit
|
|
1183 |
end;
|
|
1184 |
|
|
1185 |
if ((Gear^.State and gstWait) = 0) and
|
|
1186 |
(prevState <> Gear^.State) then
|
|
1187 |
begin
|
|
1188 |
Gear^.State:= Gear^.State or gstWait;
|
|
1189 |
Gear^.Timer:= 150
|
|
1190 |
end
|
|
1191 |
else
|
|
1192 |
begin
|
|
1193 |
if Gear^.Timer = 0 then
|
|
1194 |
begin
|
|
1195 |
Gear^.State:= Gear^.State and (not (gstWait or gstLoser or gstWinner or gstAttacked or gstNotKickable or gstHHChooseTarget));
|
|
1196 |
Gear^.Active:= false;
|
|
1197 |
AddGearCI(Gear);
|
|
1198 |
exit
|
|
1199 |
end
|
|
1200 |
else dec(Gear^.Timer)
|
|
1201 |
end;
|
|
1202 |
|
|
1203 |
AllInactive:= false
|
|
1204 |
end;
|
|
1205 |
|
|
1206 |
////////////////////////////////////////////////////////////////////////////////
|
|
1207 |
procedure doStepHedgehog(Gear: PGear);
|
|
1208 |
(*
|
|
1209 |
var x,y,tx,ty: LongInt;
|
|
1210 |
tdX, tdY, slope: hwFloat;
|
|
1211 |
land: Word; *)
|
|
1212 |
var slope: hwFloat;
|
|
1213 |
begin
|
|
1214 |
if (Gear^.Message and gmDestroy) <> 0 then
|
|
1215 |
begin
|
|
1216 |
DeleteGear(Gear);
|
|
1217 |
exit
|
|
1218 |
end;
|
|
1219 |
|
|
1220 |
if (Gear^.State and gstHHDriven) = 0 then
|
|
1221 |
doStepHedgehogFree(Gear)
|
|
1222 |
else
|
|
1223 |
begin
|
|
1224 |
with Gear^.Hedgehog^ do
|
|
1225 |
if Team^.hasGone then
|
|
1226 |
TeamGoneEffect(Team^)
|
|
1227 |
else
|
|
1228 |
doStepHedgehogDriven(Gear)
|
|
1229 |
end;
|
|
1230 |
if (Gear^.Message and (gmAllStoppable or gmLJump or gmHJump) = 0)
|
|
1231 |
and (Gear^.State and (gstHHJumping or gstHHHJump or gstAttacking) = 0)
|
|
1232 |
and (not Gear^.dY.isNegative) and (GameTicks mod (100*LongWOrd(hwRound(cMaxWindSpeed*2/cGravity))) = 0)
|
|
1233 |
and (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
|
|
1234 |
begin
|
|
1235 |
slope:= CalcSlopeBelowGear(Gear);
|
|
1236 |
Gear^.dX:=Gear^.dX+slope*_0_07;
|
|
1237 |
if slope.QWordValue <> 0 then
|
|
1238 |
Gear^.State:= Gear^.State or gstMoving;
|
|
1239 |
(*
|
|
1240 |
x:= hwRound(Gear^.X);
|
|
1241 |
y:= hwRound(Gear^.Y);
|
|
1242 |
AddVisualGear(x, y, vgtSmokeTrace);
|
|
1243 |
AddVisualGear(x - hwRound(_5*slope), y + hwRound(_5*slope), vgtSmokeTrace);
|
|
1244 |
AddVisualGear(x + hwRound(_5*slope), y - hwRound(_5*slope), vgtSmokeTrace);
|
|
1245 |
AddVisualGear(x - hwRound(_20 * slope), y + hwRound(_20 * slope), vgtSmokeTrace);
|
|
1246 |
AddVisualGear(x + hwRound(_20 * slope), y - hwRound(_20 * slope), vgtSmokeTrace);
|
|
1247 |
AddVisualGear(x - hwRound(_30 * slope), y + hwRound(_30 * slope), vgtSmokeTrace);
|
|
1248 |
AddVisualGear(x + hwRound(_30 * slope), y - hwRound(_30 * slope), vgtSmokeTrace);
|
|
1249 |
AddVisualGear(x - hwRound(_40 * slope), y + hwRound(_40 * slope), vgtSmokeTrace);
|
|
1250 |
AddVisualGear(x + hwRound(_40 * slope), y - hwRound(_40 * slope), vgtSmokeTrace);
|
|
1251 |
AddVisualGear(x - hwRound(_50 * slope), y + hwRound(_50 * slope), vgtSmokeTrace);
|
|
1252 |
AddVisualGear(x + hwRound(_50 * slope), y - hwRound(_50 * slope), vgtSmokeTrace); *)
|
|
1253 |
end
|
|
1254 |
end;
|
|
1255 |
|
|
1256 |
end.
|