author | unc0rr |
Mon, 02 Jul 2007 21:33:21 +0000 | |
changeset 547 | b81a055f2d06 |
parent 545 | f527450337c1 |
child 549 | 4278a80140a8 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
393 | 3 |
* Copyright (c) 2004-2007 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
183 | 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 |
|
4 | 8 |
* |
183 | 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. |
|
4 | 13 |
* |
183 | 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 |
|
4 | 17 |
*) |
18 |
||
19 |
procedure doStepDrowningGear(Gear: PGear); forward; |
|
20 |
||
21 |
function CheckGearDrowning(Gear: PGear): boolean; |
|
22 |
begin |
|
498 | 23 |
if cWaterLine < hwRound(Gear^.Y) + Gear^.Radius then |
4 | 24 |
begin |
351 | 25 |
CheckGearDrowning:= true; |
26 |
Gear^.State:= gstDrowning; |
|
27 |
Gear^.doStep:= @doStepDrowningGear; |
|
28 |
PlaySound(sndSplash, false) |
|
29 |
end else |
|
30 |
CheckGearDrowning:= false |
|
4 | 31 |
end; |
32 |
||
33 |
procedure CheckCollision(Gear: PGear); |
|
34 |
begin |
|
351 | 35 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.X)) or TestCollisionYwithGear(Gear, hwSign(Gear^.Y)) |
36 |
then Gear^.State:= Gear^.State or gstCollision |
|
37 |
else Gear^.State:= Gear^.State and not gstCollision |
|
4 | 38 |
end; |
39 |
||
40 |
procedure CheckHHDamage(Gear: PGear); |
|
522 | 41 |
var dmg: Longword; |
4 | 42 |
begin |
522 | 43 |
if _0_4 < Gear^.dY then |
44 |
begin |
|
45 |
dmg:= 1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70); |
|
46 |
inc(Gear^.Damage, dmg); |
|
47 |
AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, dmg, Gear); |
|
48 |
end |
|
4 | 49 |
end; |
50 |
||
51 |
//////////////////////////////////////////////////////////////////////////////// |
|
52 |
//////////////////////////////////////////////////////////////////////////////// |
|
53 |
procedure CalcRotationDirAngle(Gear: PGear); |
|
351 | 54 |
var dAngle: hwFloat; |
4 | 55 |
begin |
351 | 56 |
dAngle:= (hwAbs(Gear^.dX) + hwAbs(Gear^.dY)) * _0_1; |
57 |
if not Gear^.dX.isNegative then Gear^.DirAngle:= Gear^.DirAngle + dAngle |
|
58 |
else Gear^.DirAngle:= Gear^.DirAngle - dAngle; |
|
498 | 59 |
if Gear^.DirAngle.isNegative then Gear^.DirAngle:= Gear^.DirAngle + _16 |
60 |
else if _16 < Gear^.DirAngle then Gear^.DirAngle:= Gear^.DirAngle - _16 |
|
4 | 61 |
end; |
62 |
||
63 |
//////////////////////////////////////////////////////////////////////////////// |
|
64 |
procedure doStepDrowningGear(Gear: PGear); |
|
65 |
begin |
|
66 |
AllInactive:= false; |
|
351 | 67 |
Gear^.Y:= Gear^.Y + cDrownSpeed; |
68 |
if hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater then DeleteGear(Gear) |
|
4 | 69 |
end; |
70 |
||
71 |
//////////////////////////////////////////////////////////////////////////////// |
|
72 |
procedure doStepFallingGear(Gear: PGear); |
|
542 | 73 |
var isFalling: boolean; |
4 | 74 |
begin |
503 | 75 |
Gear^.State:= Gear^.State and not gstCollision; |
76 |
||
77 |
if Gear^.dY.isNegative then |
|
4 | 78 |
begin |
542 | 79 |
isFalling:= true; |
503 | 80 |
if TestCollisionYwithGear(Gear, -1) then |
81 |
begin |
|
82 |
Gear^.dX:= Gear^.dX * Gear^.Friction; |
|
83 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
84 |
Gear^.State:= Gear^.State or gstCollision |
|
85 |
end |
|
86 |
end else |
|
87 |
if TestCollisionYwithGear(Gear, 1) then |
|
88 |
begin |
|
542 | 89 |
isFalling:= false; |
503 | 90 |
Gear^.dX:= Gear^.dX * Gear^.Friction; |
91 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
92 |
Gear^.State:= Gear^.State or gstCollision |
|
542 | 93 |
end else isFalling:= true; |
503 | 94 |
|
351 | 95 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
4 | 96 |
begin |
351 | 97 |
Gear^.dX:= - Gear^.dX * Gear^.Elasticity; |
98 |
Gear^.State:= Gear^.State or gstCollision |
|
4 | 99 |
end; |
503 | 100 |
|
542 | 101 |
if isFalling then Gear^.dY:= Gear^.dY + cGravity; |
503 | 102 |
|
351 | 103 |
Gear^.X:= Gear^.X + Gear^.dX; |
104 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
4 | 105 |
CheckGearDrowning(Gear); |
503 | 106 |
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and |
542 | 107 |
(not isFalling) then Gear^.State:= Gear^.State and not gstMoving |
108 |
else Gear^.State:= Gear^.State or gstMoving |
|
4 | 109 |
end; |
110 |
||
111 |
//////////////////////////////////////////////////////////////////////////////// |
|
112 |
procedure doStepCloud(Gear: PGear); |
|
113 |
begin |
|
351 | 114 |
Gear^.X:= Gear^.X + cWindSpeed * 200 + Gear^.dX; |
498 | 115 |
if hwRound(Gear^.Y) > -160 then Gear^.dY:= Gear^.dY - _1div50000 |
116 |
else Gear^.dY:= Gear^.dY + _1div50000; |
|
351 | 117 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
498 | 118 |
if hwRound(Gear^.X) < -cScreenWidth - 256 then Gear^.X:= int2hwFloat(cScreenWidth + 2048) else |
119 |
if hwRound(Gear^.X) > cScreenWidth + 2048 then Gear^.X:= int2hwFloat(-cScreenWidth - 256) |
|
4 | 120 |
end; |
121 |
||
122 |
//////////////////////////////////////////////////////////////////////////////// |
|
123 |
procedure doStepBomb(Gear: PGear); |
|
371 | 124 |
var i: LongInt; |
4 | 125 |
begin |
126 |
AllInactive:= false; |
|
127 |
doStepFallingGear(Gear); |
|
351 | 128 |
dec(Gear^.Timer); |
129 |
if Gear^.Timer = 0 then |
|
4 | 130 |
begin |
351 | 131 |
case Gear^.Kind of |
132 |
gtAmmo_Bomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
78 | 133 |
gtClusterBomb: begin |
351 | 134 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
78 | 135 |
for i:= 0 to 4 do |
498 | 136 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, (getrandom - _0_5) * _0_2, (getrandom - _3) * _0_08, 0); |
78 | 137 |
end |
138 |
end; |
|
4 | 139 |
DeleteGear(Gear); |
140 |
exit |
|
141 |
end; |
|
142 |
CalcRotationDirAngle(Gear); |
|
351 | 143 |
if (Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving) then PlaySound(sndGrenadeImpact, false) |
4 | 144 |
end; |
145 |
||
78 | 146 |
procedure doStepCluster(Gear: PGear); |
147 |
begin |
|
148 |
AllInactive:= false; |
|
149 |
doStepFallingGear(Gear); |
|
351 | 150 |
if (Gear^.State and gstCollision) <> 0 then |
78 | 151 |
begin |
351 | 152 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); |
78 | 153 |
DeleteGear(Gear); |
154 |
exit |
|
155 |
end; |
|
156 |
if (GameTicks and $1F) = 0 then |
|
498 | 157 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
78 | 158 |
end; |
159 |
||
4 | 160 |
//////////////////////////////////////////////////////////////////////////////// |
161 |
procedure doStepGrenade(Gear: PGear); |
|
162 |
begin |
|
163 |
AllInactive:= false; |
|
351 | 164 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
4 | 165 |
doStepFallingGear(Gear); |
351 | 166 |
if (Gear^.State and gstCollision) <> 0 then |
4 | 167 |
begin |
351 | 168 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
4 | 169 |
DeleteGear(Gear); |
170 |
exit |
|
171 |
end; |
|
172 |
if (GameTicks and $3F) = 0 then |
|
498 | 173 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
4 | 174 |
end; |
175 |
||
176 |
//////////////////////////////////////////////////////////////////////////////// |
|
95 | 177 |
procedure doStepHealthTagWork(Gear: PGear); |
4 | 178 |
begin |
522 | 179 |
if Gear^.Kind = gtHealthTag then |
180 |
AllInactive:= false; |
|
351 | 181 |
dec(Gear^.Timer); |
522 | 182 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
351 | 183 |
if Gear^.Timer = 0 then |
4 | 184 |
begin |
522 | 185 |
if Gear^.Kind = gtHealthTag then |
186 |
PHedgehog(Gear^.Hedgehog)^.Gear^.Active:= true; // to let current hh die |
|
4 | 187 |
DeleteGear(Gear) |
188 |
end |
|
189 |
end; |
|
190 |
||
263 | 191 |
procedure doStepHealthTagWorkUnderWater(Gear: PGear); |
192 |
begin |
|
193 |
AllInactive:= false; |
|
351 | 194 |
Gear^.Y:= Gear^.Y - _0_08; |
498 | 195 |
if hwRound(Gear^.Y) < cWaterLine + 10 then |
263 | 196 |
DeleteGear(Gear) |
197 |
end; |
|
198 |
||
95 | 199 |
procedure doStepHealthTag(Gear: PGear); |
200 |
var s: shortstring; |
|
522 | 201 |
font: THWFont; |
95 | 202 |
begin |
203 |
AllInactive:= false; |
|
522 | 204 |
if Gear^.Kind = gtHealthTag then |
205 |
begin |
|
206 |
font:= fnt16; |
|
207 |
Gear^.dY:= -_0_08 |
|
208 |
end else |
|
209 |
begin |
|
210 |
font:= fntSmall; |
|
211 |
Gear^.dY:= -_0_02 |
|
212 |
end; |
|
213 |
||
351 | 214 |
str(Gear^.State, s); |
522 | 215 |
Gear^.Surf:= RenderString(s, PHedgehog(Gear^.Hedgehog)^.Team^.Color, font); |
498 | 216 |
if hwRound(Gear^.Y) < cWaterLine then Gear^.doStep:= @doStepHealthTagWork |
522 | 217 |
else Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
218 |
Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Surf^.h) |
|
95 | 219 |
end; |
220 |
||
4 | 221 |
//////////////////////////////////////////////////////////////////////////////// |
222 |
procedure doStepGrave(Gear: PGear); |
|
223 |
begin |
|
224 |
AllInactive:= false; |
|
498 | 225 |
if Gear^.dY.isNegative then |
226 |
if TestCollisionY(Gear, -1) then Gear^.dY:= _0; |
|
4 | 227 |
|
351 | 228 |
if not Gear^.dY.isNegative then |
68 | 229 |
if TestCollisionY(Gear, 1) then |
4 | 230 |
begin |
351 | 231 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
232 |
if Gear^.dY > - _1div1024 then |
|
4 | 233 |
begin |
351 | 234 |
Gear^.Active:= false; |
4 | 235 |
exit |
351 | 236 |
end else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false) |
4 | 237 |
end; |
351 | 238 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
4 | 239 |
CheckGearDrowning(Gear); |
351 | 240 |
Gear^.dY:= Gear^.dY + cGravity |
4 | 241 |
end; |
242 |
||
243 |
//////////////////////////////////////////////////////////////////////////////// |
|
244 |
procedure doStepUFOWork(Gear: PGear); |
|
351 | 245 |
var t: hwFloat; |
374 | 246 |
y: LongInt; |
4 | 247 |
begin |
248 |
AllInactive:= false; |
|
351 | 249 |
t:= Distance(Gear^.dX, Gear^.dY); |
250 |
Gear^.dX:= Gear^.Elasticity * (Gear^.dX + _0_000004 * (TargetPoint.X - hwRound(Gear^.X))); |
|
251 |
Gear^.dY:= Gear^.Elasticity * (Gear^.dY + _0_000004 * (TargetPoint.Y - hwRound(Gear^.Y))); |
|
252 |
t:= t / Distance(Gear^.dX, Gear^.dY); |
|
253 |
Gear^.dX:= Gear^.dX * t; |
|
254 |
Gear^.dY:= Gear^.dY * t; |
|
255 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
256 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
374 | 257 |
|
258 |
if (GameTicks and $3F) = 0 then |
|
259 |
begin |
|
260 |
y:= hwRound(Gear^.Y); |
|
261 |
if y + Gear^.Radius < cWaterLine then |
|
498 | 262 |
AddGear(hwRound(Gear^.X), y, gtSmokeTrace, 0, _0, _0, 0); |
374 | 263 |
end; |
264 |
||
4 | 265 |
CheckCollision(Gear); |
351 | 266 |
dec(Gear^.Timer); |
267 |
if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then |
|
4 | 268 |
begin |
351 | 269 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
4 | 270 |
DeleteGear(Gear); |
271 |
end; |
|
272 |
end; |
|
273 |
||
274 |
procedure doStepUFO(Gear: PGear); |
|
275 |
begin |
|
276 |
AllInactive:= false; |
|
351 | 277 |
Gear^.X:= Gear^.X + Gear^.dX; |
278 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
279 |
Gear^.dY:= Gear^.dY + cGravity; |
|
4 | 280 |
CheckCollision(Gear); |
351 | 281 |
if (Gear^.State and gstCollision) <> 0 then |
4 | 282 |
begin |
351 | 283 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
4 | 284 |
DeleteGear(Gear); |
285 |
exit |
|
286 |
end; |
|
351 | 287 |
dec(Gear^.Timer); |
288 |
if Gear^.Timer = 0 then |
|
4 | 289 |
begin |
351 | 290 |
Gear^.Timer:= 5000; |
291 |
Gear^.doStep:= @doStepUFOWork |
|
4 | 292 |
end; |
293 |
end; |
|
294 |
||
295 |
//////////////////////////////////////////////////////////////////////////////// |
|
296 |
procedure doStepShotgunShot(Gear: PGear); |
|
297 |
var i: LongWord; |
|
298 |
begin |
|
299 |
AllInactive:= false; |
|
351 | 300 |
if Gear^.Timer > 0 then |
4 | 301 |
begin |
351 | 302 |
dec(Gear^.Timer); |
303 |
if Gear^.Timer = 0 then PlaySound(sndShotgunFire, false); |
|
4 | 304 |
exit |
305 |
end; |
|
306 |
i:= 200; |
|
307 |
repeat |
|
351 | 308 |
Gear^.X:= Gear^.X + Gear^.dX; |
309 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
4 | 310 |
CheckCollision(Gear); |
351 | 311 |
if (Gear^.State and gstCollision) <> 0 then |
4 | 312 |
begin |
506 | 313 |
Gear^.X:= Gear^.X + Gear^.dX * 8; |
314 |
Gear^.Y:= Gear^.Y + Gear^.dY * 8; |
|
315 |
ShotgunShot(Gear); |
|
4 | 316 |
DeleteGear(Gear); |
75 | 317 |
AfterAttack; |
4 | 318 |
exit |
319 |
end; |
|
320 |
dec(i) |
|
321 |
until i = 0; |
|
498 | 322 |
if (Gear^.X < _0) or (Gear^.Y < _0) or (Gear^.X > _2048) or (Gear^.Y > _1024) then |
95 | 323 |
begin |
324 |
DeleteGear(Gear); |
|
325 |
AfterAttack |
|
326 |
end |
|
4 | 327 |
end; |
328 |
||
329 |
//////////////////////////////////////////////////////////////////////////////// |
|
38 | 330 |
procedure doStepDEagleShot(Gear: PGear); |
331 |
var i, x, y: LongWord; |
|
351 | 332 |
oX, oY: hwFloat; |
38 | 333 |
begin |
334 |
AllInactive:= false; |
|
37 | 335 |
i:= 80; |
351 | 336 |
oX:= Gear^.X; |
337 |
oY:= Gear^.Y; |
|
37 | 338 |
repeat |
351 | 339 |
Gear^.X:= Gear^.X + Gear^.dX; |
340 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
341 |
x:= hwRound(Gear^.X); |
|
342 |
y:= hwRound(Gear^.Y); |
|
38 | 343 |
if ((y and $FFFFFC00) = 0) and ((x and $FFFFF800) = 0) |
351 | 344 |
and (Land[y, x] <> 0) then inc(Gear^.Damage); |
519 | 345 |
if Gear^.Damage > 5 then AmmoShove(Gear, 7, 20); |
38 | 346 |
dec(i) |
351 | 347 |
until (i = 0) or (Gear^.Damage > Gear^.Health); |
348 |
if Gear^.Damage > 0 then |
|
37 | 349 |
begin |
351 | 350 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1); |
351 |
dec(Gear^.Health, Gear^.Damage); |
|
352 |
Gear^.Damage:= 0 |
|
37 | 353 |
end; |
498 | 354 |
if (Gear^.Health <= 0) or (Gear^.X < _0) or (Gear^.Y < _0) or (Gear^.X > _2048) or (Gear^.Y > _1024) then |
37 | 355 |
DeleteGear(Gear) |
356 |
end; |
|
357 |
||
358 |
//////////////////////////////////////////////////////////////////////////////// |
|
4 | 359 |
procedure doStepActionTimer(Gear: PGear); |
360 |
begin |
|
351 | 361 |
dec(Gear^.Timer); |
362 |
case Gear^.Kind of |
|
83 | 363 |
gtATStartGame: begin |
4 | 364 |
AllInactive:= false; |
351 | 365 |
if Gear^.Timer = 0 then |
83 | 366 |
AddCaption(trmsg[sidStartFight], $FFFFFF, capgrpGameState); |
4 | 367 |
end; |
83 | 368 |
gtATSmoothWindCh: begin |
351 | 369 |
if Gear^.Timer = 0 then |
6 | 370 |
begin |
351 | 371 |
if WindBarWidth < Gear^.Tag then inc(WindBarWidth) |
372 |
else if WindBarWidth > Gear^.Tag then dec(WindBarWidth); |
|
373 |
if WindBarWidth <> Gear^.Tag then Gear^.Timer:= 10; |
|
83 | 374 |
end |
375 |
end; |
|
376 |
gtATFinishGame: begin |
|
377 |
AllInactive:= false; |
|
351 | 378 |
if Gear^.Timer = 0 then |
113 | 379 |
begin |
380 |
SendIPC('N'); |
|
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
306
diff
changeset
|
381 |
SendIPC('q'); |
83 | 382 |
GameState:= gsExit |
113 | 383 |
end |
6 | 384 |
end; |
4 | 385 |
end; |
351 | 386 |
if Gear^.Timer = 0 then DeleteGear(Gear) |
4 | 387 |
end; |
388 |
||
389 |
//////////////////////////////////////////////////////////////////////////////// |
|
390 |
procedure doStepPickHammerWork(Gear: PGear); |
|
371 | 391 |
var i, ei: LongInt; |
4 | 392 |
HHGear: PGear; |
393 |
begin |
|
70 | 394 |
AllInactive:= false; |
351 | 395 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
396 |
dec(Gear^.Timer); |
|
397 |
if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then |
|
4 | 398 |
begin |
282 | 399 |
StopSound(sndPickhammer); |
4 | 400 |
DeleteGear(Gear); |
401 |
AfterAttack; |
|
402 |
exit |
|
403 |
end; |
|
422 | 404 |
|
405 |
if (Gear^.Timer mod 33) = 0 then |
|
406 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 6, 6, EXPLDontDraw); |
|
407 |
||
408 |
if (Gear^.Timer mod 47) = 0 then |
|
4 | 409 |
begin |
371 | 410 |
i:= hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
411 |
ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
4 | 412 |
while i <= ei do |
413 |
begin |
|
422 | 414 |
DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); |
4 | 415 |
inc(i, 1) |
416 |
end; |
|
351 | 417 |
Gear^.X:= Gear^.X + Gear^.dX; |
418 |
Gear^.Y:= Gear^.Y + _1_9; |
|
42 | 419 |
SetAllHHToActive; |
4 | 420 |
end; |
421 |
if TestCollisionYwithGear(Gear, 1) then |
|
422 |
begin |
|
498 | 423 |
Gear^.dY:= _0; |
351 | 424 |
SetLittle(HHGear^.dX); |
498 | 425 |
HHGear^.dY:= _0; |
4 | 426 |
end else |
427 |
begin |
|
351 | 428 |
Gear^.dY:= Gear^.dY + cGravity; |
429 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
498 | 430 |
if Gear^.Y > _1024 then Gear^.Timer:= 1 |
4 | 431 |
end; |
432 |
||
351 | 433 |
Gear^.X:= Gear^.X + HHGear^.dX; |
434 |
HHGear^.X:= Gear^.X; |
|
498 | 435 |
HHGear^.Y:= Gear^.Y - int2hwFloat(cHHRadius); |
4 | 436 |
|
351 | 437 |
if (Gear^.Message and gm_Attack) <> 0 then |
438 |
if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer:= 1 else else |
|
439 |
if (Gear^.State and gsttmpFlag) = 0 then Gear^.State:= Gear^.State or gsttmpFlag; |
|
440 |
if ((Gear^.Message and gm_Left) <> 0) then Gear^.dX:= - _0_3 else |
|
441 |
if ((Gear^.Message and gm_Right) <> 0) then Gear^.dX:= _0_3 |
|
498 | 442 |
else Gear^.dX:= _0; |
4 | 443 |
end; |
444 |
||
445 |
procedure doStepPickHammer(Gear: PGear); |
|
371 | 446 |
var i, y: LongInt; |
4 | 447 |
ar: TRangeArray; |
448 |
begin |
|
449 |
i:= 0; |
|
498 | 450 |
y:= hwRound(Gear^.Y) - cHHRadius * 2; |
351 | 451 |
while y < hwRound(Gear^.Y) do |
4 | 452 |
begin |
371 | 453 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
454 |
ar[i].Right:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
4 | 455 |
inc(y, 2); |
456 |
inc(i) |
|
457 |
end; |
|
498 | 458 |
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
351 | 459 |
Gear^.dY:= PHedgehog(Gear^.Hedgehog)^.Gear^.dY; |
282 | 460 |
PlaySound(sndPickhammer, true); |
4 | 461 |
doStepPickHammerWork(Gear); |
351 | 462 |
Gear^.doStep:= @doStepPickHammerWork |
4 | 463 |
end; |
464 |
||
465 |
//////////////////////////////////////////////////////////////////////////////// |
|
371 | 466 |
var BTPrevAngle, BTSteps: LongInt; |
302 | 467 |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
468 |
procedure doStepBlowTorchWork(Gear: PGear); |
302 | 469 |
var HHGear: PGear; |
305 | 470 |
b: boolean; |
302 | 471 |
begin |
472 |
AllInactive:= false; |
|
351 | 473 |
dec(Gear^.Timer); |
474 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
475 |
|
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
476 |
HedgehogChAngle(HHGear); |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
477 |
|
305 | 478 |
b:= false; |
479 |
||
371 | 480 |
if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
305 | 481 |
begin |
498 | 482 |
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle) * _0_5, HHGear^.dX); |
355 | 483 |
Gear^.dY:= AngleCos(HHGear^.Angle) * ( - _0_5); |
351 | 484 |
BTPrevAngle:= HHGear^.Angle; |
358 | 485 |
b:= true |
305 | 486 |
end; |
487 |
||
351 | 488 |
if Gear^.Timer mod cHHStepTicks = 0 then |
302 | 489 |
begin |
305 | 490 |
b:= true; |
498 | 491 |
if Gear^.dX.isNegative then HHGear^.Message:= (HHGear^.Message or gm_Left) and not gm_Right |
492 |
else HHGear^.Message:= (HHGear^.Message or gm_Right) and not gm_Left; |
|
357 | 493 |
|
494 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
302 | 495 |
HedgehogStep(HHGear); |
357 | 496 |
HHGear^.State:= HHGear^.State or gstAttacking; |
305 | 497 |
|
498 |
inc(BTSteps); |
|
511 | 499 |
if BTSteps = 7 then |
305 | 500 |
begin |
501 |
BTSteps:= 0; |
|
511 | 502 |
Gear^.X:= HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); |
503 |
Gear^.Y:= HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); |
|
351 | 504 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
511 | 505 |
AmmoShove(Gear, 2, 14); |
351 | 506 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
305 | 507 |
end; |
508 |
||
542 | 509 |
if (HHGear^.State and gstMoving) <> 0 then Gear^.Timer:= 0 |
302 | 510 |
end; |
305 | 511 |
|
512 |
if b then |
|
498 | 513 |
DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7, |
351 | 514 |
Gear^.dX, Gear^.dY, |
306 | 515 |
cHHRadius * 5, cHHRadius * 2 + 6); |
305 | 516 |
|
351 | 517 |
if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) then |
302 | 518 |
begin |
351 | 519 |
HHGear^.Message:= 0; |
302 | 520 |
DeleteGear(Gear); |
521 |
AfterAttack |
|
522 |
end |
|
523 |
end; |
|
524 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
525 |
procedure doStepBlowTorch(Gear: PGear); |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
526 |
var HHGear: PGear; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
527 |
begin |
371 | 528 |
BTPrevAngle:= High(LongInt); |
305 | 529 |
BTSteps:= 0; |
351 | 530 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
531 |
HHGear^.Message:= 0; |
|
532 |
Gear^.doStep:= @doStepBlowTorchWork |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
533 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
534 |
|
302 | 535 |
//////////////////////////////////////////////////////////////////////////////// |
536 |
||
4 | 537 |
procedure doStepRopeWork(Gear: PGear); |
70 | 538 |
const flCheck: boolean = false; |
4 | 539 |
var HHGear: PGear; |
351 | 540 |
len, cs, cc, tx, ty: hwFloat; |
108 | 541 |
lx, ly: LongInt; |
4 | 542 |
|
543 |
procedure DeleteMe; |
|
544 |
begin |
|
545 |
with HHGear^ do |
|
546 |
begin |
|
547 |
Message:= Message and not gm_Attack; |
|
542 | 548 |
State:= State or gstMoving; |
4 | 549 |
end; |
550 |
DeleteGear(Gear); |
|
534 | 551 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
351 | 552 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
4 | 553 |
end; |
554 |
||
555 |
begin |
|
351 | 556 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
108 | 557 |
|
351 | 558 |
if ((HHGear^.State and gstHHDriven) = 0) |
80 | 559 |
or (CheckGearDrowning(HHGear)) then |
4 | 560 |
begin |
561 |
DeleteMe; |
|
562 |
exit |
|
563 |
end; |
|
351 | 564 |
Gear^.dX:= HHGear^.X - Gear^.X; |
565 |
Gear^.dY:= HHGear^.Y - Gear^.Y; |
|
4 | 566 |
|
351 | 567 |
if (Gear^.Message and gm_Left <> 0) then HHGear^.dX:= HHGear^.dX - _0_0002 else |
568 |
if (Gear^.Message and gm_Right <> 0) then HHGear^.dX:= HHGear^.dX + _0_0002; |
|
4 | 569 |
|
351 | 570 |
if not TestCollisionYwithGear(HHGear, 1) then HHGear^.dY:= HHGear^.dY + cGravity; |
4 | 571 |
|
351 | 572 |
cs:= Gear^.dY + HHGear^.dY; |
573 |
cc:= Gear^.dX + HHGear^.dX; |
|
498 | 574 |
len:= _1 / Distance(cc, cs); |
108 | 575 |
cc:= cc * len; |
576 |
cs:= cs * len; |
|
4 | 577 |
|
578 |
flCheck:= not flCheck; |
|
579 |
if flCheck then // check whether rope needs dividing |
|
580 |
begin |
|
498 | 581 |
len:= Gear^.Elasticity - _20; |
582 |
while len > _5 do |
|
4 | 583 |
begin |
584 |
tx:= cc*len; |
|
585 |
ty:= cs*len; |
|
351 | 586 |
lx:= hwRound(Gear^.X + tx) + hwSign(HHGear^.dX); |
587 |
ly:= hwRound(Gear^.Y + ty) + hwSign(HHGear^.dY); |
|
4 | 588 |
if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then |
589 |
begin |
|
590 |
with RopePoints.ar[RopePoints.Count] do |
|
591 |
begin |
|
351 | 592 |
X:= Gear^.X; |
593 |
Y:= Gear^.Y; |
|
370
c75410fe3133
- Repair bots: they can walk and use bazooka, possible cannot jump (why?)
unc0rr
parents:
358
diff
changeset
|
594 |
if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle32(Gear^.dY, Gear^.dX); |
351 | 595 |
b:= (cc * HHGear^.dY) > (cs * HHGear^.dX); |
4 | 596 |
dLen:= len |
597 |
end; |
|
351 | 598 |
Gear^.X:= Gear^.X + tx; |
599 |
Gear^.Y:= Gear^.Y + ty; |
|
4 | 600 |
inc(RopePoints.Count); |
351 | 601 |
Gear^.Elasticity:= Gear^.Elasticity - len; |
602 |
Gear^.Friction:= Gear^.Friction - len; |
|
4 | 603 |
break |
604 |
end; |
|
498 | 605 |
len:= len - _3 |
4 | 606 |
end; |
607 |
end else |
|
608 |
if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
|
609 |
begin |
|
610 |
tx:= RopePoints.ar[Pred(RopePoints.Count)].X; |
|
611 |
ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; |
|
351 | 612 |
if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear^.X) * (ty - HHGear^.Y) > (tx - HHGear^.X) * (ty - Gear^.Y)) then |
4 | 613 |
begin |
614 |
dec(RopePoints.Count); |
|
351 | 615 |
Gear^.X:=RopePoints.ar[RopePoints.Count].X; |
616 |
Gear^.Y:=RopePoints.ar[RopePoints.Count].Y; |
|
617 |
Gear^.Elasticity:= Gear^.Elasticity + RopePoints.ar[RopePoints.Count].dLen; |
|
618 |
Gear^.Friction:= Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen |
|
4 | 619 |
end |
620 |
end; |
|
621 |
||
351 | 622 |
Gear^.dX:= HHGear^.X - Gear^.X; |
623 |
Gear^.dY:= HHGear^.Y - Gear^.Y; |
|
108 | 624 |
|
351 | 625 |
cs:= Gear^.dY + HHGear^.dY; |
626 |
cc:= Gear^.dX + HHGear^.dX; |
|
498 | 627 |
len:= _1 / Distance(cc, cs); |
108 | 628 |
cc:= cc * len; |
629 |
cs:= cs * len; |
|
4 | 630 |
|
351 | 631 |
HHGear^.dX:= HHGear^.X; |
632 |
HHGear^.dY:= HHGear^.Y; |
|
4 | 633 |
|
351 | 634 |
if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Elasticity < Gear^.Friction) then |
635 |
if not (TestCollisionXwithGear(HHGear, hwSign(Gear^.dX)) |
|
636 |
or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY))) then Gear^.Elasticity:= Gear^.Elasticity + _0_3; |
|
4 | 637 |
|
498 | 638 |
if ((Gear^.Message and gm_Up) <> 0) and (Gear^.Elasticity > _30) then |
351 | 639 |
if not (TestCollisionXwithGear(HHGear, -hwSign(Gear^.dX)) |
640 |
or TestCollisionYwithGear(HHGear, -hwSign(Gear^.dY))) then Gear^.Elasticity:= Gear^.Elasticity - _0_3; |
|
4 | 641 |
|
351 | 642 |
HHGear^.X:= Gear^.X + cc*Gear^.Elasticity; |
643 |
HHGear^.Y:= Gear^.Y + cs*Gear^.Elasticity; |
|
4 | 644 |
|
351 | 645 |
HHGear^.dX:= HHGear^.X - HHGear^.dX; |
646 |
HHGear^.dY:= HHGear^.Y - HHGear^.dY; |
|
4 | 647 |
|
351 | 648 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
649 |
HHGear^.dX:= -_0_6 * HHGear^.dX; |
|
650 |
if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then |
|
651 |
HHGear^.dY:= -_0_6 * HHGear^.dY; |
|
4 | 652 |
|
351 | 653 |
if (Gear^.Message and gm_Attack) <> 0 then |
654 |
if (Gear^.State and gsttmpFlag) <> 0 then DeleteMe else |
|
655 |
else if (Gear^.State and gsttmpFlag) = 0 then Gear^.State:= Gear^.State or gsttmpFlag; |
|
4 | 656 |
end; |
657 |
||
658 |
||
659 |
procedure doStepRopeAttach(Gear: PGear); |
|
660 |
var HHGear: PGear; |
|
351 | 661 |
tx, ty, tt: hwFloat; |
4 | 662 |
begin |
351 | 663 |
Gear^.X:= Gear^.X - Gear^.dX; |
664 |
Gear^.Y:= Gear^.Y - Gear^.dY; |
|
498 | 665 |
Gear^.Elasticity:= Gear^.Elasticity + _1; |
351 | 666 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
517 | 667 |
DeleteCI(HHGear); |
542 | 668 |
if (HHGear^.State and gstMoving) <> 0 then |
68 | 669 |
if TestCollisionYwithGear(HHGear, 1) then |
4 | 670 |
begin |
498 | 671 |
HHGear^.dY:= _0; |
4 | 672 |
CheckHHDamage(HHGear); |
542 | 673 |
HHGear^.State:= HHGear^.State and not (gstMoving or gstHHJumping); |
4 | 674 |
end else |
675 |
begin |
|
351 | 676 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
677 |
HHGear^.X:= HHGear^.X + HHGear^.dX; |
|
678 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; |
|
679 |
Gear^.X:= Gear^.X + HHGear^.dX; |
|
680 |
Gear^.Y:= Gear^.Y + HHGear^.dY; |
|
681 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
682 |
tt:= Gear^.Elasticity; |
|
498 | 683 |
tx:= _0; |
684 |
ty:= _0; |
|
685 |
while tt > _20 do |
|
4 | 686 |
begin |
517 | 687 |
if TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX)) |
688 |
or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then |
|
4 | 689 |
begin |
351 | 690 |
Gear^.X:= Gear^.X + tx; |
691 |
Gear^.Y:= Gear^.Y + ty; |
|
692 |
Gear^.Elasticity:= tt; |
|
693 |
Gear^.doStep:= @doStepRopeWork; |
|
4 | 694 |
with HHGear^ do State:= State and not gstAttacking; |
498 | 695 |
tt:= _0 |
4 | 696 |
end; |
517 | 697 |
tx:= tx + Gear^.dX + Gear^.dX; |
698 |
ty:= ty + Gear^.dY + Gear^.dY; |
|
498 | 699 |
tt:= tt - _2; |
4 | 700 |
end; |
701 |
end; |
|
702 |
CheckCollision(Gear); |
|
351 | 703 |
if (Gear^.State and gstCollision) <> 0 then |
4 | 704 |
begin |
351 | 705 |
Gear^.doStep:= @doStepRopeWork; |
4 | 706 |
with HHGear^ do State:= State and not gstAttacking; |
498 | 707 |
if Gear^.Elasticity < _10 then |
708 |
Gear^.Elasticity:= _10000; |
|
4 | 709 |
end; |
710 |
||
351 | 711 |
if (Gear^.Elasticity > Gear^.Friction) or ((Gear^.Message and gm_Attack) = 0) then |
4 | 712 |
begin |
351 | 713 |
with PHedgehog(Gear^.Hedgehog)^.Gear^ do |
4 | 714 |
begin |
715 |
State:= State and not gstAttacking; |
|
716 |
Message:= Message and not gm_Attack |
|
717 |
end; |
|
718 |
DeleteGear(Gear) |
|
719 |
end |
|
720 |
end; |
|
721 |
||
722 |
procedure doStepRope(Gear: PGear); |
|
723 |
begin |
|
351 | 724 |
Gear^.dX:= - Gear^.dX; |
725 |
Gear^.dY:= - Gear^.dY; |
|
726 |
Gear^.doStep:= @doStepRopeAttach |
|
4 | 727 |
end; |
728 |
||
729 |
//////////////////////////////////////////////////////////////////////////////// |
|
730 |
procedure doStepSmokeTrace(Gear: PGear); |
|
731 |
begin |
|
351 | 732 |
inc(Gear^.Timer); |
733 |
if Gear^.Timer > 64 then |
|
4 | 734 |
begin |
351 | 735 |
Gear^.Timer:= 0; |
736 |
dec(Gear^.State) |
|
4 | 737 |
end; |
351 | 738 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
739 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
740 |
if Gear^.State = 0 then DeleteGear(Gear) |
|
4 | 741 |
end; |
9 | 742 |
|
743 |
//////////////////////////////////////////////////////////////////////////////// |
|
744 |
procedure doStepExplosion(Gear: PGear); |
|
745 |
begin |
|
351 | 746 |
inc(Gear^.Timer); |
747 |
if Gear^.Timer > 75 then |
|
9 | 748 |
begin |
351 | 749 |
inc(Gear^.State); |
750 |
Gear^.Timer:= 0; |
|
751 |
if Gear^.State > 5 then DeleteGear(Gear) |
|
9 | 752 |
end; |
753 |
end; |
|
10 | 754 |
|
755 |
//////////////////////////////////////////////////////////////////////////////// |
|
756 |
procedure doStepMine(Gear: PGear); |
|
757 |
begin |
|
542 | 758 |
if (Gear^.State and gstMoving) <> 0 then |
10 | 759 |
begin |
503 | 760 |
DeleteCI(Gear); |
10 | 761 |
doStepFallingGear(Gear); |
542 | 762 |
if (Gear^.State and gstMoving) = 0 then |
13 | 763 |
begin |
503 | 764 |
AddGearCI(Gear); |
498 | 765 |
Gear^.dX:= _0; |
766 |
Gear^.dY:= _0 |
|
13 | 767 |
end; |
768 |
CalcRotationDirAngle(Gear); |
|
10 | 769 |
AllInactive:= false |
770 |
end; |
|
351 | 771 |
|
772 |
if ((Gear^.State and gsttmpFlag) <> 0) then |
|
773 |
if ((Gear^.State and gstAttacking) = 0) then |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
774 |
begin |
39 | 775 |
if ((GameTicks and $F) = 0) then |
351 | 776 |
if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State:= Gear^.State or gstAttacking |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
777 |
end else // gstAttacking <> 0 |
10 | 778 |
begin |
779 |
AllInactive:= false; |
|
351 | 780 |
if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick, false); |
781 |
if Gear^.Timer = 0 then |
|
10 | 782 |
begin |
351 | 783 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
521 | 784 |
DeleteGear(Gear); |
785 |
exit |
|
10 | 786 |
end; |
351 | 787 |
dec(Gear^.Timer); |
13 | 788 |
end else // gsttmpFlag = 0 |
351 | 789 |
if TurnTimeLeft = 0 then Gear^.State:= Gear^.State or gsttmpFlag; |
10 | 790 |
end; |
57 | 791 |
|
39 | 792 |
//////////////////////////////////////////////////////////////////////////////// |
793 |
procedure doStepDynamite(Gear: PGear); |
|
794 |
begin |
|
43 | 795 |
doStepFallingGear(Gear); |
796 |
AllInactive:= false; |
|
351 | 797 |
if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag); |
798 |
if Gear^.Timer = 0 then |
|
39 | 799 |
begin |
351 | 800 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound); |
43 | 801 |
DeleteGear(Gear); |
802 |
exit |
|
39 | 803 |
end; |
351 | 804 |
dec(Gear^.Timer); |
39 | 805 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
806 |
|
351 | 807 |
/////////////////////////////////////////////////////////////////////////////// |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
808 |
procedure doStepCase(Gear: PGear); |
371 | 809 |
var i, x, y: LongInt; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
810 |
begin |
351 | 811 |
if (Gear^.Message and gm_Destroy) > 0 then |
15 | 812 |
begin |
813 |
DeleteGear(Gear); |
|
435 | 814 |
FreeActionsList; |
441 | 815 |
with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do |
816 |
if Gear <> nil then Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
|
15 | 817 |
exit |
818 |
end; |
|
819 |
||
351 | 820 |
if Gear^.Damage > 0 then |
79 | 821 |
begin |
351 | 822 |
x:= hwRound(Gear^.X); |
823 |
y:= hwRound(Gear^.Y); |
|
79 | 824 |
DeleteGear(Gear); |
89 | 825 |
doMakeExplosion(x, y, 25, EXPLAutoSound); |
79 | 826 |
for i:= 0 to 63 do |
498 | 827 |
AddGear(x, y, gtFlame, 0, _0, _0, 0); |
79 | 828 |
exit |
829 |
end; |
|
830 |
||
351 | 831 |
if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
832 |
begin |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
833 |
AllInactive:= false; |
351 | 834 |
Gear^.dY:= Gear^.dY + cGravity; |
835 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
498 | 836 |
if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0 else |
439 | 837 |
if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
838 |
begin |
351 | 839 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
498 | 840 |
if Gear^.dY > - _0_001 then Gear^.dY:= _0 |
351 | 841 |
else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false); |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
842 |
end; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
843 |
CheckGearDrowning(Gear); |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
844 |
end; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
845 |
|
511 | 846 |
if (Gear^.dY.QWordValue = 0) then AddGearCI(Gear) |
847 |
else if (Gear^.dY.QWordValue <> 0) then DeleteCI(Gear) |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
848 |
end; |
49 | 849 |
|
850 |
//////////////////////////////////////////////////////////////////////////////// |
|
851 |
var thexchar: array[0..5] of record |
|
371 | 852 |
oy, ny: LongInt; |
49 | 853 |
team: PTeam; |
854 |
end; |
|
855 |
thexchcnt: Longword; |
|
143 | 856 |
currsorter: PGear; |
49 | 857 |
|
858 |
procedure doStepTeamHealthSorterWork(Gear: PGear); |
|
371 | 859 |
var i: LongInt; |
49 | 860 |
begin |
861 |
AllInactive:= false; |
|
351 | 862 |
dec(Gear^.Timer); |
863 |
if (Gear^.Timer and 15) = 0 then |
|
49 | 864 |
for i:= 0 to Pred(thexchcnt) do |
865 |
with thexchar[i] do |
|
866 |
{$WARNINGS OFF} |
|
351 | 867 |
team^.DrawHealthY:= ny + (oy - ny) * Gear^.Timer div 640; |
49 | 868 |
{$WARNINGS ON} |
351 | 869 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
143 | 870 |
begin |
871 |
if currsorter = Gear then currsorter:= nil; |
|
49 | 872 |
DeleteGear(Gear) |
143 | 873 |
end |
49 | 874 |
end; |
875 |
||
876 |
procedure doStepTeamHealthSorter(Gear: PGear); |
|
547 | 877 |
var i, t: Longword; |
49 | 878 |
begin |
879 |
AllInactive:= false; |
|
880 |
i:= 0; |
|
547 | 881 |
for t:= 0 to Pred(TeamsCount) do |
882 |
with TeamsArray[t]^ do |
|
49 | 883 |
begin |
547 | 884 |
thexchar[i].oy:= DrawHealthY; |
885 |
thexchar[i].team:= TeamsArray[t]; |
|
49 | 886 |
inc(i); |
887 |
end; |
|
547 | 888 |
|
49 | 889 |
thexchcnt:= i; |
890 |
for i:= 1 to thexchcnt do |
|
891 |
for t:= 0 to thexchcnt - 2 do |
|
351 | 892 |
if thexchar[t].team^.TeamHealthBarWidth > thexchar[Succ(t)].team^.TeamHealthBarWidth then |
49 | 893 |
begin |
894 |
thexchar[5]:= thexchar[t]; |
|
895 |
thexchar[t]:= thexchar[Succ(t)]; |
|
896 |
thexchar[Succ(t)]:= thexchar[5] |
|
897 |
end; |
|
547 | 898 |
|
49 | 899 |
t:= cScreenHeight - 4; |
900 |
for i:= 0 to Pred(thexchcnt) do |
|
901 |
with thexchar[i] do |
|
902 |
begin |
|
351 | 903 |
dec(t, team^.HealthRect.h + 2); |
49 | 904 |
ny:= t |
905 |
end; |
|
547 | 906 |
|
351 | 907 |
Gear^.Timer:= 640; |
908 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
143 | 909 |
currsorter:= Gear |
49 | 910 |
end; |
911 |
||
79 | 912 |
//////////////////////////////////////////////////////////////////////////////// |
913 |
procedure doStepShover(Gear: PGear); |
|
914 |
var HHGear: PGear; |
|
915 |
begin |
|
351 | 916 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
917 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
79 | 918 |
AmmoShove(Gear, 30, 115); |
351 | 919 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
79 | 920 |
DeleteGear(Gear) |
921 |
end; |
|
922 |
||
923 |
//////////////////////////////////////////////////////////////////////////////// |
|
924 |
procedure doStepFlame(Gear: PGear); |
|
925 |
begin |
|
926 |
AllInactive:= false; |
|
927 |
if not TestCollisionYwithGear(Gear, 1) then |
|
928 |
begin |
|
351 | 929 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
930 |
Gear^.dY:= Gear^.dY + cGravity; |
|
931 |
if hwAbs(Gear^.dX) > _0_1 then Gear^.dX:= Gear^.dX * _0_5; |
|
932 |
if Gear^.dY > _0_1 then Gear^.dY:= Gear^.dY * _0_995; |
|
933 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
934 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
498 | 935 |
if not (Gear^.Y < _1024) then |
79 | 936 |
begin |
937 |
DeleteGear(Gear); |
|
938 |
exit |
|
939 |
end |
|
940 |
end else begin |
|
351 | 941 |
if Gear^.Timer > 0 then dec(Gear^.Timer) |
79 | 942 |
else begin |
506 | 943 |
// doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 2, 0); |
351 | 944 |
dec(Gear^.Health); |
945 |
Gear^.Timer:= 1250 - Gear^.Angle * 12 |
|
79 | 946 |
end |
947 |
end; |
|
948 |
||
351 | 949 |
if (((GameTicks div 8) mod 64) = Gear^.Angle) then |
79 | 950 |
AmmoFlameWork(Gear); |
951 |
||
351 | 952 |
if Gear^.Health = 0 then |
79 | 953 |
DeleteGear(Gear) |
954 |
end; |
|
82 | 955 |
|
956 |
//////////////////////////////////////////////////////////////////////////////// |
|
957 |
procedure doStepFirePunchWork(Gear: PGear); |
|
958 |
var HHGear: PGear; |
|
959 |
begin |
|
960 |
AllInactive:= false; |
|
351 | 961 |
if ((Gear^.Message and gm_Destroy) <> 0) then |
82 | 962 |
begin |
963 |
DeleteGear(Gear); |
|
964 |
AfterAttack; |
|
965 |
exit |
|
966 |
end; |
|
967 |
||
351 | 968 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
969 |
if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then |
|
82 | 970 |
begin |
351 | 971 |
Gear^.Tag:= hwRound(HHGear^.Y); |
498 | 972 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4, 2); |
351 | 973 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
974 |
Gear^.Y:= HHGear^.Y; |
|
82 | 975 |
AmmoShove(Gear, 30, 40); |
351 | 976 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
82 | 977 |
end; |
351 | 978 |
|
979 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
980 |
if not (HHGear^.dY.isNegative) then |
|
82 | 981 |
begin |
542 | 982 |
HHGear^.State:= HHGear^.State or gstMoving; |
82 | 983 |
DeleteGear(Gear); |
984 |
AfterAttack; |
|
985 |
exit |
|
986 |
end; |
|
351 | 987 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY |
82 | 988 |
end; |
989 |
||
990 |
procedure doStepFirePunch(Gear: PGear); |
|
991 |
var HHGear: PGear; |
|
992 |
begin |
|
993 |
AllInactive:= false; |
|
351 | 994 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
514 | 995 |
DeleteCI(HHGear); |
498 | 996 |
HHGear^.X:= int2hwFloat(hwRound(HHGear^.X)) - _0_5; |
351 | 997 |
SetLittle(HHGear^.dX); |
998 |
HHGear^.dY:= - _0_3; |
|
82 | 999 |
|
351 | 1000 |
Gear^.X:= HHGear^.X; |
498 | 1001 |
Gear^.dX:= SignAs(_0_45, HHGear^.dX); |
351 | 1002 |
Gear^.dY:= - _0_9; |
1003 |
Gear^.doStep:= @doStepFirePunchWork; |
|
498 | 1004 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
82 | 1005 |
end; |
1006 |
||
263 | 1007 |
//////////////////////////////////////////////////////////////////////////////// |
1008 |
||
211 | 1009 |
procedure doStepParachute(Gear: PGear); |
1010 |
var HHGear: PGear; |
|
1011 |
begin |
|
351 | 1012 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1013 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
517 | 1014 |
DeleteCI(HHGear); |
82 | 1015 |
|
516 | 1016 |
inc(Gear^.Timer); |
1017 |
||
212 | 1018 |
if TestCollisionYwithGear(HHGear, 1) |
351 | 1019 |
or ((HHGear^.State and gstHHDriven) = 0) |
212 | 1020 |
or CheckGearDrowning(HHGear) then |
211 | 1021 |
begin |
1022 |
with HHGear^ do |
|
1023 |
begin |
|
1024 |
Message:= 0; |
|
351 | 1025 |
SetLittle(dx); |
498 | 1026 |
dY:= _0; |
211 | 1027 |
State:= State and not (gstAttacking or gstAttacked); |
542 | 1028 |
State:= State or gstMoving; |
211 | 1029 |
end; |
1030 |
DeleteGear(Gear); |
|
516 | 1031 |
if Gear^.Timer > 10 then |
1032 |
begin |
|
534 | 1033 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
516 | 1034 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
1035 |
end; |
|
211 | 1036 |
exit |
1037 |
end; |
|
1038 |
||
351 | 1039 |
if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1040 |
HHGear^.X:= HHGear^.X + cWindSpeed * 200; |
|
211 | 1041 |
|
351 | 1042 |
if (Gear^.Message and gm_Left) <> 0 then HHGear^.X:= HHGear^.X - cMaxWindSpeed * 40 |
1043 |
else if (Gear^.Message and gm_Right) <> 0 then HHGear^.X:= HHGear^.X + cMaxWindSpeed * 40; |
|
1044 |
if (Gear^.Message and gm_Up) <> 0 then HHGear^.Y:= HHGear^.Y - cGravity * 40 |
|
1045 |
else if (Gear^.Message and gm_Down) <> 0 then HHGear^.Y:= HHGear^.Y + cGravity * 40; |
|
211 | 1046 |
|
351 | 1047 |
HHGear^.Y:= HHGear^.Y + cGravity * 100; |
263 | 1048 |
end; |
211 | 1049 |
|
263 | 1050 |
//////////////////////////////////////////////////////////////////////////////// |
1051 |
procedure doStepAirAttackWork(Gear: PGear); |
|
1052 |
begin |
|
1053 |
AllInactive:= false; |
|
498 | 1054 |
Gear^.X:= Gear^.X + cAirPlaneSpeed * Gear^.Tag; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1055 |
if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then |
263 | 1056 |
begin |
351 | 1057 |
dec(Gear^.Health); |
1058 |
case Gear^.State of |
|
498 | 1059 |
0: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
1060 |
1: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
285 | 1061 |
end; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1062 |
Gear^.dX:= Gear^.dX + int2hwFloat(30 * Gear^.Tag) |
263 | 1063 |
end; |
498 | 1064 |
if (hwRound(Gear^.X) > 3072) or (hwRound(Gear^.X) < -1024) then DeleteGear(Gear) |
263 | 1065 |
end; |
1066 |
||
1067 |
procedure doStepAirAttack(Gear: PGear); |
|
1068 |
begin |
|
1069 |
AllInactive:= false; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1070 |
|
408 | 1071 |
if Gear^.X.QWordValue = 0 then Gear^.Tag:= 1 |
1072 |
else Gear^.Tag:= -1; |
|
498 | 1073 |
Gear^.X:= _1024 - _2048 * Gear^.Tag; |
1074 |
Gear^.Y:= -_128; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1075 |
Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15); |
357 | 1076 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1077 |
if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then |
498 | 1078 |
Gear^.dX:= Gear^.dX - cBombsSpeed * hwSqrt((int2hwFloat(TargetPoint.Y) - Gear^.Y) * 2 / cGravity) * Gear^.Tag; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1079 |
addfilelog('attack: x = '+floattostr(gear^.dx)); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1080 |
|
351 | 1081 |
Gear^.Health:= 6; |
1082 |
Gear^.doStep:= @doStepAirAttackWork |
|
263 | 1083 |
end; |
1084 |
||
1085 |
//////////////////////////////////////////////////////////////////////////////// |
|
1086 |
||
1087 |
procedure doStepAirBomb(Gear: PGear); |
|
1088 |
begin |
|
1089 |
AllInactive:= false; |
|
1090 |
doStepFallingGear(Gear); |
|
351 | 1091 |
if (Gear^.State and gstCollision) <> 0 then |
263 | 1092 |
begin |
351 | 1093 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
263 | 1094 |
DeleteGear(Gear); |
1095 |
exit |
|
1096 |
end; |
|
1097 |
if (GameTicks and $3F) = 0 then |
|
498 | 1098 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
211 | 1099 |
end; |
409 | 1100 |
|
1101 |
//////////////////////////////////////////////////////////////////////////////// |
|
1102 |
||
1103 |
procedure doStepGirder(Gear: PGear); |
|
415 | 1104 |
var HHGear: PGear; |
409 | 1105 |
begin |
1106 |
AllInactive:= false; |
|
415 | 1107 |
|
1108 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
409 | 1109 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, |
1110 |
TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, |
|
520 | 1111 |
sprAmGirder, Gear^.State, true) then |
409 | 1112 |
begin |
415 | 1113 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
1114 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1115 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1116 |
DeleteGear(Gear); |
|
1117 |
isCursorVisible:= true |
|
409 | 1118 |
end |
415 | 1119 |
else begin |
1120 |
DeleteGear(Gear); |
|
1121 |
AfterAttack |
|
1122 |
end; |
|
1123 |
TargetPoint.X:= NoPointX |
|
409 | 1124 |
end; |
520 | 1125 |
|
1126 |
//////////////////////////////////////////////////////////////////////////////// |
|
525 | 1127 |
procedure doStepTeleportAfter(Gear: PGear); |
1128 |
var HHGear: PGear; |
|
1129 |
begin |
|
1130 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1131 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; |
|
1132 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
1133 |
if TestCollisionYwithGear(HHGear, 1) then |
|
1134 |
begin |
|
1135 |
DeleteGear(Gear); |
|
1136 |
AfterAttack |
|
1137 |
end |
|
1138 |
end; |
|
520 | 1139 |
|
1140 |
procedure doStepTeleport(Gear: PGear); |
|
1141 |
var HHGear: PGear; |
|
1142 |
begin |
|
1143 |
AllInactive:= false; |
|
1144 |
||
1145 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1146 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
|
1147 |
TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
|
1148 |
sprHHTelepMask, 0, false) then |
|
1149 |
begin |
|
1150 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1151 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1152 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1153 |
DeleteGear(Gear); |
|
1154 |
isCursorVisible:= true |
|
1155 |
end |
|
1156 |
else begin |
|
1157 |
DeleteCI(HHGear); |
|
525 | 1158 |
Gear^.doStep:= @doStepTeleportAfter; |
520 | 1159 |
HHGear^.X:= int2hwFloat(TargetPoint.X); |
1160 |
HHGear^.Y:= int2hwFloat(TargetPoint.Y); |
|
542 | 1161 |
HHGear^.State:= HHGear^.State or gstMoving |
520 | 1162 |
end; |
1163 |
TargetPoint.X:= NoPointX |
|
1164 |
end; |
|
534 | 1165 |
|
1166 |
//////////////////////////////////////////////////////////////////////////////// |
|
1167 |
procedure doStepSwitcherWork(Gear: PGear); |
|
1168 |
var HHGear: PGear; |
|
1169 |
th: LongInt; |
|
1170 |
Msg, State: Longword; |
|
1171 |
begin |
|
1172 |
AllInactive:= false; |
|
1173 |
||
540 | 1174 |
if ((Gear^.Message and not gm_Switch) <> 0) or (TurnTimeLeft = 0) then |
534 | 1175 |
begin |
1176 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1177 |
Msg:= Gear^.Message and not gm_Switch; |
|
1178 |
DeleteGear(Gear); |
|
538 | 1179 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
1180 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
534 | 1181 |
|
1182 |
HHGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear; |
|
538 | 1183 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
534 | 1184 |
HHGear^.Message:= Msg; |
1185 |
exit |
|
1186 |
end; |
|
1187 |
||
1188 |
if (Gear^.Message and gm_Switch) <> 0 then |
|
1189 |
begin |
|
1190 |
HHGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear; |
|
1191 |
HHGear^.Message:= HHGear^.Message and not gm_Switch; |
|
1192 |
State:= HHGear^.State; |
|
1193 |
HHGear^.State:= 0; |
|
1194 |
HHGear^.Active:= false; |
|
1195 |
HHGear^.Z:= cHHZ; |
|
1196 |
RemoveGearFromList(HHGear); |
|
1197 |
InsertGearToList(HHGear); |
|
1198 |
||
1199 |
th:= CurrentTeam^.CurrHedgehog; |
|
1200 |
repeat |
|
1201 |
CurrentTeam^.CurrHedgehog:= Succ(CurrentTeam^.CurrHedgehog) mod (cMaxHHIndex + 1); |
|
537 | 1202 |
until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (CurrentTeam^.CurrHedgehog = th); |
534 | 1203 |
|
1204 |
HHGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear; |
|
1205 |
HHGear^.State:= State; |
|
1206 |
HHGear^.Active:= true; |
|
1207 |
FollowGear:= HHGear; |
|
1208 |
HHGear^.Z:= cCurrHHZ; |
|
1209 |
RemoveGearFromList(HHGear); |
|
1210 |
InsertGearToList(HHGear); |
|
1211 |
Gear^.X:= HHGear^.X; |
|
1212 |
Gear^.Y:= HHGear^.Y |
|
1213 |
end; |
|
1214 |
end; |
|
1215 |
||
1216 |
procedure doStepSwitcher(Gear: PGear); |
|
1217 |
var HHGear: PGear; |
|
1218 |
begin |
|
1219 |
Gear^.doStep:= @doStepSwitcherWork; |
|
1220 |
||
1221 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1222 |
with HHGear^ do |
|
1223 |
begin |
|
1224 |
State:= State and not gstAttacking; |
|
1225 |
Message:= Message and not gm_Attack |
|
1226 |
end |
|
1227 |
end; |