author | unc0rr |
Sun, 01 Jul 2007 11:02:47 +0000 | |
changeset 543 | 465e2ec8f05f |
parent 542 | ec26095f1bed |
child 545 | f527450337c1 |
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); |
|
877 |
var team: PTeam; |
|
878 |
i, t: Longword; |
|
879 |
begin |
|
880 |
AllInactive:= false; |
|
881 |
team:= TeamsList; |
|
882 |
i:= 0; |
|
883 |
while team <> nil do |
|
884 |
begin |
|
351 | 885 |
thexchar[i].oy:= team^.DrawHealthY; |
49 | 886 |
thexchar[i].team:= team; |
887 |
inc(i); |
|
351 | 888 |
team:= team^.Next |
49 | 889 |
end; |
890 |
thexchcnt:= i; |
|
891 |
for i:= 1 to thexchcnt do |
|
892 |
for t:= 0 to thexchcnt - 2 do |
|
351 | 893 |
if thexchar[t].team^.TeamHealthBarWidth > thexchar[Succ(t)].team^.TeamHealthBarWidth then |
49 | 894 |
begin |
895 |
thexchar[5]:= thexchar[t]; |
|
896 |
thexchar[t]:= thexchar[Succ(t)]; |
|
897 |
thexchar[Succ(t)]:= thexchar[5] |
|
898 |
end; |
|
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; |
|
351 | 906 |
Gear^.Timer:= 640; |
907 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
|
143 | 908 |
currsorter:= Gear |
49 | 909 |
end; |
910 |
||
79 | 911 |
//////////////////////////////////////////////////////////////////////////////// |
912 |
procedure doStepShover(Gear: PGear); |
|
913 |
var HHGear: PGear; |
|
914 |
begin |
|
351 | 915 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
916 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
79 | 917 |
AmmoShove(Gear, 30, 115); |
351 | 918 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
79 | 919 |
DeleteGear(Gear) |
920 |
end; |
|
921 |
||
922 |
//////////////////////////////////////////////////////////////////////////////// |
|
923 |
procedure doStepFlame(Gear: PGear); |
|
924 |
begin |
|
925 |
AllInactive:= false; |
|
926 |
if not TestCollisionYwithGear(Gear, 1) then |
|
927 |
begin |
|
351 | 928 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
929 |
Gear^.dY:= Gear^.dY + cGravity; |
|
930 |
if hwAbs(Gear^.dX) > _0_1 then Gear^.dX:= Gear^.dX * _0_5; |
|
931 |
if Gear^.dY > _0_1 then Gear^.dY:= Gear^.dY * _0_995; |
|
932 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
933 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
498 | 934 |
if not (Gear^.Y < _1024) then |
79 | 935 |
begin |
936 |
DeleteGear(Gear); |
|
937 |
exit |
|
938 |
end |
|
939 |
end else begin |
|
351 | 940 |
if Gear^.Timer > 0 then dec(Gear^.Timer) |
79 | 941 |
else begin |
506 | 942 |
// doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 2, 0); |
351 | 943 |
dec(Gear^.Health); |
944 |
Gear^.Timer:= 1250 - Gear^.Angle * 12 |
|
79 | 945 |
end |
946 |
end; |
|
947 |
||
351 | 948 |
if (((GameTicks div 8) mod 64) = Gear^.Angle) then |
79 | 949 |
AmmoFlameWork(Gear); |
950 |
||
351 | 951 |
if Gear^.Health = 0 then |
79 | 952 |
DeleteGear(Gear) |
953 |
end; |
|
82 | 954 |
|
955 |
//////////////////////////////////////////////////////////////////////////////// |
|
956 |
procedure doStepFirePunchWork(Gear: PGear); |
|
957 |
var HHGear: PGear; |
|
958 |
begin |
|
959 |
AllInactive:= false; |
|
351 | 960 |
if ((Gear^.Message and gm_Destroy) <> 0) then |
82 | 961 |
begin |
962 |
DeleteGear(Gear); |
|
963 |
AfterAttack; |
|
964 |
exit |
|
965 |
end; |
|
966 |
||
351 | 967 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
968 |
if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then |
|
82 | 969 |
begin |
351 | 970 |
Gear^.Tag:= hwRound(HHGear^.Y); |
498 | 971 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4, 2); |
351 | 972 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
973 |
Gear^.Y:= HHGear^.Y; |
|
82 | 974 |
AmmoShove(Gear, 30, 40); |
351 | 975 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
82 | 976 |
end; |
351 | 977 |
|
978 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
979 |
if not (HHGear^.dY.isNegative) then |
|
82 | 980 |
begin |
542 | 981 |
HHGear^.State:= HHGear^.State or gstMoving; |
82 | 982 |
DeleteGear(Gear); |
983 |
AfterAttack; |
|
984 |
exit |
|
985 |
end; |
|
351 | 986 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY |
82 | 987 |
end; |
988 |
||
989 |
procedure doStepFirePunch(Gear: PGear); |
|
990 |
var HHGear: PGear; |
|
991 |
begin |
|
992 |
AllInactive:= false; |
|
351 | 993 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
514 | 994 |
DeleteCI(HHGear); |
498 | 995 |
HHGear^.X:= int2hwFloat(hwRound(HHGear^.X)) - _0_5; |
351 | 996 |
SetLittle(HHGear^.dX); |
997 |
HHGear^.dY:= - _0_3; |
|
82 | 998 |
|
351 | 999 |
Gear^.X:= HHGear^.X; |
498 | 1000 |
Gear^.dX:= SignAs(_0_45, HHGear^.dX); |
351 | 1001 |
Gear^.dY:= - _0_9; |
1002 |
Gear^.doStep:= @doStepFirePunchWork; |
|
498 | 1003 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
82 | 1004 |
end; |
1005 |
||
263 | 1006 |
//////////////////////////////////////////////////////////////////////////////// |
1007 |
||
211 | 1008 |
procedure doStepParachute(Gear: PGear); |
1009 |
var HHGear: PGear; |
|
1010 |
begin |
|
351 | 1011 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1012 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
517 | 1013 |
DeleteCI(HHGear); |
82 | 1014 |
|
516 | 1015 |
inc(Gear^.Timer); |
1016 |
||
212 | 1017 |
if TestCollisionYwithGear(HHGear, 1) |
351 | 1018 |
or ((HHGear^.State and gstHHDriven) = 0) |
212 | 1019 |
or CheckGearDrowning(HHGear) then |
211 | 1020 |
begin |
1021 |
with HHGear^ do |
|
1022 |
begin |
|
1023 |
Message:= 0; |
|
351 | 1024 |
SetLittle(dx); |
498 | 1025 |
dY:= _0; |
211 | 1026 |
State:= State and not (gstAttacking or gstAttacked); |
542 | 1027 |
State:= State or gstMoving; |
211 | 1028 |
end; |
1029 |
DeleteGear(Gear); |
|
516 | 1030 |
if Gear^.Timer > 10 then |
1031 |
begin |
|
534 | 1032 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
516 | 1033 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^) |
1034 |
end; |
|
211 | 1035 |
exit |
1036 |
end; |
|
1037 |
||
351 | 1038 |
if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1039 |
HHGear^.X:= HHGear^.X + cWindSpeed * 200; |
|
211 | 1040 |
|
351 | 1041 |
if (Gear^.Message and gm_Left) <> 0 then HHGear^.X:= HHGear^.X - cMaxWindSpeed * 40 |
1042 |
else if (Gear^.Message and gm_Right) <> 0 then HHGear^.X:= HHGear^.X + cMaxWindSpeed * 40; |
|
1043 |
if (Gear^.Message and gm_Up) <> 0 then HHGear^.Y:= HHGear^.Y - cGravity * 40 |
|
1044 |
else if (Gear^.Message and gm_Down) <> 0 then HHGear^.Y:= HHGear^.Y + cGravity * 40; |
|
211 | 1045 |
|
351 | 1046 |
HHGear^.Y:= HHGear^.Y + cGravity * 100; |
263 | 1047 |
end; |
211 | 1048 |
|
263 | 1049 |
//////////////////////////////////////////////////////////////////////////////// |
1050 |
procedure doStepAirAttackWork(Gear: PGear); |
|
1051 |
begin |
|
1052 |
AllInactive:= false; |
|
498 | 1053 |
Gear^.X:= Gear^.X + cAirPlaneSpeed * Gear^.Tag; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1054 |
if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then |
263 | 1055 |
begin |
351 | 1056 |
dec(Gear^.Health); |
1057 |
case Gear^.State of |
|
498 | 1058 |
0: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
1059 |
1: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
285 | 1060 |
end; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1061 |
Gear^.dX:= Gear^.dX + int2hwFloat(30 * Gear^.Tag) |
263 | 1062 |
end; |
498 | 1063 |
if (hwRound(Gear^.X) > 3072) or (hwRound(Gear^.X) < -1024) then DeleteGear(Gear) |
263 | 1064 |
end; |
1065 |
||
1066 |
procedure doStepAirAttack(Gear: PGear); |
|
1067 |
begin |
|
1068 |
AllInactive:= false; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1069 |
|
408 | 1070 |
if Gear^.X.QWordValue = 0 then Gear^.Tag:= 1 |
1071 |
else Gear^.Tag:= -1; |
|
498 | 1072 |
Gear^.X:= _1024 - _2048 * Gear^.Tag; |
1073 |
Gear^.Y:= -_128; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1074 |
Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15); |
357 | 1075 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1076 |
if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then |
498 | 1077 |
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
|
1078 |
addfilelog('attack: x = '+floattostr(gear^.dx)); |
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1079 |
|
351 | 1080 |
Gear^.Health:= 6; |
1081 |
Gear^.doStep:= @doStepAirAttackWork |
|
263 | 1082 |
end; |
1083 |
||
1084 |
//////////////////////////////////////////////////////////////////////////////// |
|
1085 |
||
1086 |
procedure doStepAirBomb(Gear: PGear); |
|
1087 |
begin |
|
1088 |
AllInactive:= false; |
|
1089 |
doStepFallingGear(Gear); |
|
351 | 1090 |
if (Gear^.State and gstCollision) <> 0 then |
263 | 1091 |
begin |
351 | 1092 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
263 | 1093 |
DeleteGear(Gear); |
1094 |
exit |
|
1095 |
end; |
|
1096 |
if (GameTicks and $3F) = 0 then |
|
498 | 1097 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
211 | 1098 |
end; |
409 | 1099 |
|
1100 |
//////////////////////////////////////////////////////////////////////////////// |
|
1101 |
||
1102 |
procedure doStepGirder(Gear: PGear); |
|
415 | 1103 |
var HHGear: PGear; |
409 | 1104 |
begin |
1105 |
AllInactive:= false; |
|
415 | 1106 |
|
1107 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
409 | 1108 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, |
1109 |
TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, |
|
520 | 1110 |
sprAmGirder, Gear^.State, true) then |
409 | 1111 |
begin |
415 | 1112 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
1113 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1114 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1115 |
DeleteGear(Gear); |
|
1116 |
isCursorVisible:= true |
|
409 | 1117 |
end |
415 | 1118 |
else begin |
1119 |
DeleteGear(Gear); |
|
1120 |
AfterAttack |
|
1121 |
end; |
|
1122 |
TargetPoint.X:= NoPointX |
|
409 | 1123 |
end; |
520 | 1124 |
|
1125 |
//////////////////////////////////////////////////////////////////////////////// |
|
525 | 1126 |
procedure doStepTeleportAfter(Gear: PGear); |
1127 |
var HHGear: PGear; |
|
1128 |
begin |
|
1129 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1130 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; |
|
1131 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
1132 |
if TestCollisionYwithGear(HHGear, 1) then |
|
1133 |
begin |
|
1134 |
DeleteGear(Gear); |
|
1135 |
AfterAttack |
|
1136 |
end |
|
1137 |
end; |
|
520 | 1138 |
|
1139 |
procedure doStepTeleport(Gear: PGear); |
|
1140 |
var HHGear: PGear; |
|
1141 |
begin |
|
1142 |
AllInactive:= false; |
|
1143 |
||
1144 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1145 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
|
1146 |
TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
|
1147 |
sprHHTelepMask, 0, false) then |
|
1148 |
begin |
|
1149 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1150 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1151 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1152 |
DeleteGear(Gear); |
|
1153 |
isCursorVisible:= true |
|
1154 |
end |
|
1155 |
else begin |
|
1156 |
DeleteCI(HHGear); |
|
525 | 1157 |
Gear^.doStep:= @doStepTeleportAfter; |
520 | 1158 |
HHGear^.X:= int2hwFloat(TargetPoint.X); |
1159 |
HHGear^.Y:= int2hwFloat(TargetPoint.Y); |
|
542 | 1160 |
HHGear^.State:= HHGear^.State or gstMoving |
520 | 1161 |
end; |
1162 |
TargetPoint.X:= NoPointX |
|
1163 |
end; |
|
534 | 1164 |
|
1165 |
//////////////////////////////////////////////////////////////////////////////// |
|
1166 |
procedure doStepSwitcherWork(Gear: PGear); |
|
1167 |
var HHGear: PGear; |
|
1168 |
Team: PTeam; |
|
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; |