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