author | unc0rr |
Sat, 10 Jan 2009 15:36:28 +0000 | |
changeset 1634 | 486a89f0e843 |
parent 1633 | c1de4078b0fd |
child 1635 | cc5976f292f9 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
883 | 3 |
* Copyright (c) 2004-2008 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 |
1133 | 24 |
begin |
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)) |
1133 | 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 |
1123 | 44 |
begin |
45 |
if _0_6 < Gear^.dY then |
|
1132 | 46 |
PlaySound(sndOw4, false) |
1123 | 47 |
else |
1132 | 48 |
PlaySound(sndOw1, false); |
1123 | 49 |
|
50 |
dmg:= 1 + hwRound((hwAbs(Gear^.dY) - _0_4) * 70); |
|
51 |
inc(Gear^.Damage, dmg); |
|
1505 | 52 |
AddDamageTag(hwRound(Gear^.X), hwRound(Gear^.Y) + cHHRadius, dmg, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color); |
1123 | 53 |
end |
4 | 54 |
end; |
55 |
||
56 |
//////////////////////////////////////////////////////////////////////////////// |
|
57 |
//////////////////////////////////////////////////////////////////////////////// |
|
58 |
procedure CalcRotationDirAngle(Gear: PGear); |
|
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset
|
59 |
var dAngle: real; |
4 | 60 |
begin |
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset
|
61 |
dAngle:= (hwAbs(Gear^.dX) + hwAbs(Gear^.dY)).QWordValue / $80000000; |
1133 | 62 |
if not Gear^.dX.isNegative then |
63 |
Gear^.DirAngle:= Gear^.DirAngle + dAngle |
|
64 |
else |
|
65 |
Gear^.DirAngle:= Gear^.DirAngle - dAngle; |
|
66 |
||
776
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset
|
67 |
if Gear^.DirAngle < 0 then Gear^.DirAngle:= Gear^.DirAngle + 360 |
8fc7e59d9cb4
Convert the rest of rotated sprites to be rotated by OpenGL
unc0rr
parents:
764
diff
changeset
|
68 |
else if 360 < Gear^.DirAngle then Gear^.DirAngle:= Gear^.DirAngle - 360 |
4 | 69 |
end; |
70 |
||
71 |
//////////////////////////////////////////////////////////////////////////////// |
|
72 |
procedure doStepDrowningGear(Gear: PGear); |
|
73 |
begin |
|
74 |
AllInactive:= false; |
|
351 | 75 |
Gear^.Y:= Gear^.Y + cDrownSpeed; |
76 |
if hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater then DeleteGear(Gear) |
|
4 | 77 |
end; |
78 |
||
79 |
//////////////////////////////////////////////////////////////////////////////// |
|
80 |
procedure doStepFallingGear(Gear: PGear); |
|
542 | 81 |
var isFalling: boolean; |
4 | 82 |
begin |
503 | 83 |
Gear^.State:= Gear^.State and not gstCollision; |
84 |
||
85 |
if Gear^.dY.isNegative then |
|
1133 | 86 |
begin |
87 |
isFalling:= true; |
|
88 |
if TestCollisionYwithGear(Gear, -1) then |
|
89 |
begin |
|
90 |
Gear^.dX:= Gear^.dX * Gear^.Friction; |
|
91 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
92 |
Gear^.State:= Gear^.State or gstCollision |
|
93 |
end |
|
94 |
end else |
|
95 |
if TestCollisionYwithGear(Gear, 1) then |
|
96 |
begin |
|
97 |
isFalling:= false; |
|
98 |
Gear^.dX:= Gear^.dX * Gear^.Friction; |
|
99 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
100 |
Gear^.State:= Gear^.State or gstCollision |
|
101 |
end else isFalling:= true; |
|
503 | 102 |
|
351 | 103 |
if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then |
1133 | 104 |
begin |
105 |
Gear^.dX:= - Gear^.dX * Gear^.Elasticity; |
|
106 |
Gear^.dY:= Gear^.dY * Gear^.Elasticity; |
|
107 |
Gear^.State:= Gear^.State or gstCollision |
|
108 |
end; |
|
503 | 109 |
|
542 | 110 |
if isFalling then Gear^.dY:= Gear^.dY + cGravity; |
503 | 111 |
|
351 | 112 |
Gear^.X:= Gear^.X + Gear^.dX; |
113 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
4 | 114 |
CheckGearDrowning(Gear); |
503 | 115 |
if (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) < _0_0002) and |
1133 | 116 |
(not isFalling) then |
117 |
Gear^.State:= Gear^.State and not gstMoving |
|
118 |
else |
|
119 |
Gear^.State:= Gear^.State or gstMoving |
|
4 | 120 |
end; |
121 |
||
122 |
//////////////////////////////////////////////////////////////////////////////// |
|
123 |
procedure doStepBomb(Gear: PGear); |
|
371 | 124 |
var i: LongInt; |
919 | 125 |
dX, dY: hwFloat; |
4 | 126 |
begin |
127 |
AllInactive:= false; |
|
1263 | 128 |
|
4 | 129 |
doStepFallingGear(Gear); |
1263 | 130 |
|
351 | 131 |
dec(Gear^.Timer); |
132 |
if Gear^.Timer = 0 then |
|
1133 | 133 |
begin |
134 |
case Gear^.Kind of |
|
135 |
gtAmmo_Bomb: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
1603 | 136 |
gtBall: doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 40, EXPLAutoSound); |
1133 | 137 |
gtClusterBomb: begin |
138 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); |
|
139 |
for i:= 0 to 4 do |
|
140 |
begin |
|
141 |
dX:= rndSign(GetRandom * _0_1); |
|
142 |
dY:= (GetRandom - _3) * _0_08; |
|
1261 | 143 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 25); |
144 |
end |
|
145 |
end; |
|
146 |
gtWatermelon: begin |
|
147 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound); |
|
148 |
for i:= 0 to 5 do |
|
149 |
begin |
|
150 |
dX:= rndSign(GetRandom * _0_1); |
|
1496 | 151 |
dY:= (GetRandom - _1_5) * _0_3; |
1262 | 152 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMelonPiece, 0, dX, dY, 75)^.DirAngle:= i * 60; |
1133 | 153 |
end |
1263 | 154 |
end; |
1555 | 155 |
gtHellishBomb: begin |
156 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 90, EXPLAutoSound); |
|
157 |
for i:= 0 to 127 do |
|
158 |
begin |
|
159 |
dX:= AngleCos(i * 16) * _0_5 * (GetRandom + _1); |
|
160 |
dY:= AngleSin(i * 16) * _0_5 * (GetRandom + _1); |
|
161 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, dY, 0); |
|
162 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, dX, -dY, 0); |
|
163 |
end |
|
164 |
end; |
|
1133 | 165 |
end; |
166 |
DeleteGear(Gear); |
|
167 |
exit |
|
168 |
end; |
|
1263 | 169 |
|
4 | 170 |
CalcRotationDirAngle(Gear); |
1263 | 171 |
|
172 |
if Gear^.Kind = gtHellishBomb then |
|
1279 | 173 |
begin |
174 |
if Gear^.Timer = 3000 then PlaySound(sndHellish, false); |
|
175 |
||
1263 | 176 |
if (GameTicks and $3F) = 0 then |
177 |
if (Gear^.State and gstCollision) = 0 then |
|
178 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtEvilTrace, 0, _0, _0, 0); |
|
1279 | 179 |
end; |
1263 | 180 |
|
1158 | 181 |
if (Gear^.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving) then |
182 |
if (hwAbs(Gear^.dX) > _0_1) or |
|
183 |
(hwAbs(Gear^.dY) > _0_1) then |
|
184 |
PlaySound(sndGrenadeImpact, false) |
|
4 | 185 |
end; |
186 |
||
1279 | 187 |
procedure doStepWatermelon(Gear: PGear); |
188 |
begin |
|
189 |
AllInactive:= false; |
|
190 |
PlaySound(sndMelon, false); |
|
191 |
Gear^.doStep:= @doStepBomb |
|
192 |
end; |
|
193 |
||
78 | 194 |
procedure doStepCluster(Gear: PGear); |
195 |
begin |
|
196 |
AllInactive:= false; |
|
197 |
doStepFallingGear(Gear); |
|
351 | 198 |
if (Gear^.State and gstCollision) <> 0 then |
1133 | 199 |
begin |
1261 | 200 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Timer, EXPLAutoSound); |
1133 | 201 |
DeleteGear(Gear); |
202 |
exit |
|
203 |
end; |
|
1262 | 204 |
|
205 |
if Gear^.Kind = gtMelonPiece then |
|
206 |
CalcRotationDirAngle(Gear) |
|
207 |
else |
|
208 |
if (GameTicks and $1F) = 0 then |
|
209 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
|
78 | 210 |
end; |
211 |
||
4 | 212 |
//////////////////////////////////////////////////////////////////////////////// |
213 |
procedure doStepGrenade(Gear: PGear); |
|
214 |
begin |
|
215 |
AllInactive:= false; |
|
351 | 216 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
4 | 217 |
doStepFallingGear(Gear); |
351 | 218 |
if (Gear^.State and gstCollision) <> 0 then |
1133 | 219 |
begin |
220 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
221 |
DeleteGear(Gear); |
|
222 |
exit |
|
223 |
end; |
|
4 | 224 |
if (GameTicks and $3F) = 0 then |
1133 | 225 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
4 | 226 |
end; |
227 |
||
228 |
//////////////////////////////////////////////////////////////////////////////// |
|
95 | 229 |
procedure doStepHealthTagWork(Gear: PGear); |
4 | 230 |
begin |
522 | 231 |
if Gear^.Kind = gtHealthTag then |
1505 | 232 |
AllInactive:= false; |
233 |
||
351 | 234 |
dec(Gear^.Timer); |
522 | 235 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
1505 | 236 |
|
351 | 237 |
if Gear^.Timer = 0 then |
1133 | 238 |
begin |
239 |
if Gear^.Kind = gtHealthTag then |
|
240 |
PHedgehog(Gear^.Hedgehog)^.Gear^.Active:= true; // to let current hh die |
|
241 |
DeleteGear(Gear) |
|
242 |
end |
|
4 | 243 |
end; |
244 |
||
263 | 245 |
procedure doStepHealthTagWorkUnderWater(Gear: PGear); |
246 |
begin |
|
1505 | 247 |
AllInactive:= false; |
1495 | 248 |
|
351 | 249 |
Gear^.Y:= Gear^.Y - _0_08; |
1495 | 250 |
|
498 | 251 |
if hwRound(Gear^.Y) < cWaterLine + 10 then |
1505 | 252 |
DeleteGear(Gear) |
263 | 253 |
end; |
254 |
||
95 | 255 |
procedure doStepHealthTag(Gear: PGear); |
256 |
var s: shortstring; |
|
257 |
begin |
|
1505 | 258 |
AllInactive:= false; |
259 |
Gear^.dY:= -_0_08; |
|
522 | 260 |
|
351 | 261 |
str(Gear^.State, s); |
1505 | 262 |
Gear^.Tex:= RenderStringTex(s, PHedgehog(Gear^.Hedgehog)^.Team^.Clan^.Color, fnt16); |
263 |
||
264 |
if hwRound(Gear^.Y) < cWaterLine then |
|
265 |
Gear^.doStep:= @doStepHealthTagWork |
|
266 |
else |
|
267 |
Gear^.doStep:= @doStepHealthTagWorkUnderWater; |
|
268 |
||
762 | 269 |
Gear^.Y:= Gear^.Y - int2hwFloat(Gear^.Tex^.h) |
95 | 270 |
end; |
271 |
||
4 | 272 |
//////////////////////////////////////////////////////////////////////////////// |
273 |
procedure doStepGrave(Gear: PGear); |
|
274 |
begin |
|
275 |
AllInactive:= false; |
|
498 | 276 |
if Gear^.dY.isNegative then |
277 |
if TestCollisionY(Gear, -1) then Gear^.dY:= _0; |
|
4 | 278 |
|
351 | 279 |
if not Gear^.dY.isNegative then |
68 | 280 |
if TestCollisionY(Gear, 1) then |
4 | 281 |
begin |
351 | 282 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
283 |
if Gear^.dY > - _1div1024 then |
|
4 | 284 |
begin |
351 | 285 |
Gear^.Active:= false; |
4 | 286 |
exit |
351 | 287 |
end else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false) |
4 | 288 |
end; |
1505 | 289 |
|
351 | 290 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
4 | 291 |
CheckGearDrowning(Gear); |
351 | 292 |
Gear^.dY:= Gear^.dY + cGravity |
4 | 293 |
end; |
294 |
||
295 |
//////////////////////////////////////////////////////////////////////////////// |
|
296 |
procedure doStepUFOWork(Gear: PGear); |
|
351 | 297 |
var t: hwFloat; |
374 | 298 |
y: LongInt; |
4 | 299 |
begin |
300 |
AllInactive:= false; |
|
351 | 301 |
t:= Distance(Gear^.dX, Gear^.dY); |
302 |
Gear^.dX:= Gear^.Elasticity * (Gear^.dX + _0_000004 * (TargetPoint.X - hwRound(Gear^.X))); |
|
303 |
Gear^.dY:= Gear^.Elasticity * (Gear^.dY + _0_000004 * (TargetPoint.Y - hwRound(Gear^.Y))); |
|
304 |
t:= t / Distance(Gear^.dX, Gear^.dY); |
|
305 |
Gear^.dX:= Gear^.dX * t; |
|
306 |
Gear^.dY:= Gear^.dY * t; |
|
307 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
308 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
374 | 309 |
|
310 |
if (GameTicks and $3F) = 0 then |
|
311 |
begin |
|
312 |
y:= hwRound(Gear^.Y); |
|
313 |
if y + Gear^.Radius < cWaterLine then |
|
498 | 314 |
AddGear(hwRound(Gear^.X), y, gtSmokeTrace, 0, _0, _0, 0); |
374 | 315 |
end; |
316 |
||
4 | 317 |
CheckCollision(Gear); |
351 | 318 |
dec(Gear^.Timer); |
319 |
if ((Gear^.State and gstCollision) <> 0) or (Gear^.Timer = 0) then |
|
4 | 320 |
begin |
560 | 321 |
StopSound(sndUFO); |
351 | 322 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
4 | 323 |
DeleteGear(Gear); |
324 |
end; |
|
325 |
end; |
|
326 |
||
327 |
procedure doStepUFO(Gear: PGear); |
|
328 |
begin |
|
329 |
AllInactive:= false; |
|
351 | 330 |
Gear^.X:= Gear^.X + Gear^.dX; |
331 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
332 |
Gear^.dY:= Gear^.dY + cGravity; |
|
4 | 333 |
CheckCollision(Gear); |
351 | 334 |
if (Gear^.State and gstCollision) <> 0 then |
4 | 335 |
begin |
351 | 336 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
4 | 337 |
DeleteGear(Gear); |
338 |
exit |
|
339 |
end; |
|
351 | 340 |
dec(Gear^.Timer); |
341 |
if Gear^.Timer = 0 then |
|
4 | 342 |
begin |
560 | 343 |
PlaySound(sndUFO, true); |
351 | 344 |
Gear^.Timer:= 5000; |
345 |
Gear^.doStep:= @doStepUFOWork |
|
4 | 346 |
end; |
347 |
end; |
|
348 |
||
349 |
//////////////////////////////////////////////////////////////////////////////// |
|
876 | 350 |
procedure doStepShotIdle(Gear: PGear); |
351 |
begin |
|
352 |
AllInactive:= false; |
|
353 |
inc(Gear^.Timer); |
|
354 |
if Gear^.Timer > 75 then |
|
355 |
begin |
|
356 |
DeleteGear(Gear); |
|
357 |
AfterAttack |
|
358 |
end |
|
359 |
end; |
|
360 |
||
4 | 361 |
procedure doStepShotgunShot(Gear: PGear); |
362 |
var i: LongWord; |
|
363 |
begin |
|
364 |
AllInactive:= false; |
|
876 | 365 |
|
366 |
if ((Gear^.State and gstAnimation) = 0) then |
|
367 |
begin |
|
368 |
dec(Gear^.Timer); |
|
369 |
if Gear^.Timer = 0 then |
|
370 |
begin |
|
371 |
PlaySound(sndShotgunFire, false); |
|
372 |
Gear^.State:= Gear^.State or gstAnimation |
|
373 |
end; |
|
374 |
exit |
|
375 |
end |
|
376 |
else inc(Gear^.Timer); |
|
377 |
||
4 | 378 |
i:= 200; |
379 |
repeat |
|
351 | 380 |
Gear^.X:= Gear^.X + Gear^.dX; |
381 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
4 | 382 |
CheckCollision(Gear); |
351 | 383 |
if (Gear^.State and gstCollision) <> 0 then |
876 | 384 |
begin |
385 |
Gear^.X:= Gear^.X + Gear^.dX * 8; |
|
386 |
Gear^.Y:= Gear^.Y + Gear^.dY * 8; |
|
387 |
ShotgunShot(Gear); |
|
388 |
Gear^.doStep:= @doStepShotIdle; |
|
389 |
exit |
|
390 |
end; |
|
4 | 391 |
dec(i) |
392 |
until i = 0; |
|
498 | 393 |
if (Gear^.X < _0) or (Gear^.Y < _0) or (Gear^.X > _2048) or (Gear^.Y > _1024) then |
876 | 394 |
Gear^.doStep:= @doStepShotIdle |
4 | 395 |
end; |
396 |
||
397 |
//////////////////////////////////////////////////////////////////////////////// |
|
559 | 398 |
procedure doStepDEagleShotWork(Gear: PGear); |
38 | 399 |
var i, x, y: LongWord; |
351 | 400 |
oX, oY: hwFloat; |
38 | 401 |
begin |
402 |
AllInactive:= false; |
|
876 | 403 |
inc(Gear^.Timer); |
37 | 404 |
i:= 80; |
351 | 405 |
oX:= Gear^.X; |
406 |
oY:= Gear^.Y; |
|
37 | 407 |
repeat |
351 | 408 |
Gear^.X:= Gear^.X + Gear^.dX; |
409 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
410 |
x:= hwRound(Gear^.X); |
|
411 |
y:= hwRound(Gear^.Y); |
|
38 | 412 |
if ((y and $FFFFFC00) = 0) and ((x and $FFFFF800) = 0) |
351 | 413 |
and (Land[y, x] <> 0) then inc(Gear^.Damage); |
519 | 414 |
if Gear^.Damage > 5 then AmmoShove(Gear, 7, 20); |
38 | 415 |
dec(i) |
351 | 416 |
until (i = 0) or (Gear^.Damage > Gear^.Health); |
417 |
if Gear^.Damage > 0 then |
|
37 | 418 |
begin |
351 | 419 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 82 - i, 1); |
420 |
dec(Gear^.Health, Gear^.Damage); |
|
421 |
Gear^.Damage:= 0 |
|
37 | 422 |
end; |
498 | 423 |
if (Gear^.Health <= 0) or (Gear^.X < _0) or (Gear^.Y < _0) or (Gear^.X > _2048) or (Gear^.Y > _1024) then |
876 | 424 |
Gear^.doStep:= @doStepShotIdle |
37 | 425 |
end; |
426 |
||
559 | 427 |
procedure doStepDEagleShot(Gear: PGear); |
428 |
begin |
|
429 |
PlaySound(sndGun, false); |
|
430 |
Gear^.doStep:= @doStepDEagleShotWork |
|
431 |
end; |
|
432 |
||
37 | 433 |
//////////////////////////////////////////////////////////////////////////////// |
4 | 434 |
procedure doStepActionTimer(Gear: PGear); |
435 |
begin |
|
351 | 436 |
dec(Gear^.Timer); |
437 |
case Gear^.Kind of |
|
83 | 438 |
gtATStartGame: begin |
4 | 439 |
AllInactive:= false; |
351 | 440 |
if Gear^.Timer = 0 then |
83 | 441 |
AddCaption(trmsg[sidStartFight], $FFFFFF, capgrpGameState); |
4 | 442 |
end; |
83 | 443 |
gtATSmoothWindCh: begin |
351 | 444 |
if Gear^.Timer = 0 then |
6 | 445 |
begin |
351 | 446 |
if WindBarWidth < Gear^.Tag then inc(WindBarWidth) |
447 |
else if WindBarWidth > Gear^.Tag then dec(WindBarWidth); |
|
448 |
if WindBarWidth <> Gear^.Tag then Gear^.Timer:= 10; |
|
83 | 449 |
end |
450 |
end; |
|
451 |
gtATFinishGame: begin |
|
452 |
AllInactive:= false; |
|
351 | 453 |
if Gear^.Timer = 0 then |
113 | 454 |
begin |
455 |
SendIPC('N'); |
|
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
306
diff
changeset
|
456 |
SendIPC('q'); |
83 | 457 |
GameState:= gsExit |
113 | 458 |
end |
6 | 459 |
end; |
4 | 460 |
end; |
351 | 461 |
if Gear^.Timer = 0 then DeleteGear(Gear) |
4 | 462 |
end; |
463 |
||
464 |
//////////////////////////////////////////////////////////////////////////////// |
|
465 |
procedure doStepPickHammerWork(Gear: PGear); |
|
371 | 466 |
var i, ei: LongInt; |
4 | 467 |
HHGear: PGear; |
468 |
begin |
|
70 | 469 |
AllInactive:= false; |
351 | 470 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
471 |
dec(Gear^.Timer); |
|
472 |
if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0)or((HHGear^.State and gstHHDriven) = 0) then |
|
1200 | 473 |
begin |
474 |
StopSound(sndPickhammer); |
|
475 |
DeleteGear(Gear); |
|
476 |
AfterAttack; |
|
477 |
exit |
|
478 |
end; |
|
845 | 479 |
|
422 | 480 |
if (Gear^.Timer mod 33) = 0 then |
1200 | 481 |
begin |
482 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
483 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y) + 7, 6, EXPLDontDraw); |
|
484 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
|
485 |
end; |
|
422 | 486 |
|
487 |
if (Gear^.Timer mod 47) = 0 then |
|
1200 | 488 |
begin |
489 |
i:= hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
|
490 |
ei:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
491 |
while i <= ei do |
|
492 |
begin |
|
493 |
DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); |
|
494 |
inc(i, 1) |
|
495 |
end; |
|
496 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
497 |
Gear^.Y:= Gear^.Y + _1_9; |
|
498 |
SetAllHHToActive; |
|
499 |
end; |
|
4 | 500 |
if TestCollisionYwithGear(Gear, 1) then |
1200 | 501 |
begin |
502 |
Gear^.dY:= _0; |
|
503 |
SetLittle(HHGear^.dX); |
|
504 |
HHGear^.dY:= _0; |
|
505 |
end else |
|
506 |
begin |
|
507 |
Gear^.dY:= Gear^.dY + cGravity; |
|
508 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1417 | 509 |
if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer:= 1 |
1200 | 510 |
end; |
4 | 511 |
|
351 | 512 |
Gear^.X:= Gear^.X + HHGear^.dX; |
513 |
HHGear^.X:= Gear^.X; |
|
498 | 514 |
HHGear^.Y:= Gear^.Y - int2hwFloat(cHHRadius); |
4 | 515 |
|
351 | 516 |
if (Gear^.Message and gm_Attack) <> 0 then |
517 |
if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer:= 1 else else |
|
518 |
if (Gear^.State and gsttmpFlag) = 0 then Gear^.State:= Gear^.State or gsttmpFlag; |
|
519 |
if ((Gear^.Message and gm_Left) <> 0) then Gear^.dX:= - _0_3 else |
|
520 |
if ((Gear^.Message and gm_Right) <> 0) then Gear^.dX:= _0_3 |
|
498 | 521 |
else Gear^.dX:= _0; |
4 | 522 |
end; |
523 |
||
524 |
procedure doStepPickHammer(Gear: PGear); |
|
371 | 525 |
var i, y: LongInt; |
4 | 526 |
ar: TRangeArray; |
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
527 |
HHGear: PGear; |
4 | 528 |
begin |
529 |
i:= 0; |
|
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
530 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
531 |
|
498 | 532 |
y:= hwRound(Gear^.Y) - cHHRadius * 2; |
351 | 533 |
while y < hwRound(Gear^.Y) do |
4 | 534 |
begin |
371 | 535 |
ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
536 |
ar[i].Right:= hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
4 | 537 |
inc(y, 2); |
538 |
inc(i) |
|
539 |
end; |
|
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
540 |
|
498 | 541 |
DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
911
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
542 |
Gear^.dY:= HHGear^.dY; |
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
543 |
DeleteCI(HHGear); |
b709fe13ed69
Fix issue with hedgehog on top of the hedgehog with pickhammer
unc0rr
parents:
883
diff
changeset
|
544 |
|
282 | 545 |
PlaySound(sndPickhammer, true); |
4 | 546 |
doStepPickHammerWork(Gear); |
351 | 547 |
Gear^.doStep:= @doStepPickHammerWork |
4 | 548 |
end; |
549 |
||
550 |
//////////////////////////////////////////////////////////////////////////////// |
|
371 | 551 |
var BTPrevAngle, BTSteps: LongInt; |
302 | 552 |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
553 |
procedure doStepBlowTorchWork(Gear: PGear); |
302 | 554 |
var HHGear: PGear; |
1528 | 555 |
b: boolean; |
556 |
prevX: LongInt; |
|
302 | 557 |
begin |
558 |
AllInactive:= false; |
|
351 | 559 |
dec(Gear^.Timer); |
560 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
561 |
|
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
562 |
HedgehogChAngle(HHGear); |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
563 |
|
305 | 564 |
b:= false; |
565 |
||
371 | 566 |
if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
1528 | 567 |
begin |
568 |
Gear^.dX:= SignAs(AngleSin(HHGear^.Angle) * _0_5, HHGear^.dX); |
|
569 |
Gear^.dY:= AngleCos(HHGear^.Angle) * ( - _0_5); |
|
570 |
BTPrevAngle:= HHGear^.Angle; |
|
571 |
b:= true |
|
572 |
end; |
|
573 |
||
574 |
if ((HHGear^.State and gstMoving) <> 0) then |
|
575 |
begin |
|
576 |
doStepHedgehogMoving(HHGear); |
|
577 |
if (HHGear^.Damage > 0) then Gear^.Timer:= 0 |
|
578 |
end; |
|
305 | 579 |
|
351 | 580 |
if Gear^.Timer mod cHHStepTicks = 0 then |
1528 | 581 |
begin |
582 |
b:= true; |
|
583 |
if Gear^.dX.isNegative then |
|
1547 | 584 |
HHGear^.Message:= (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Left |
1528 | 585 |
else |
1547 | 586 |
HHGear^.Message:= (HHGear^.Message and (gm_Attack or gm_Up or gm_Down)) or gm_Right; |
305 | 587 |
|
1528 | 588 |
if ((HHGear^.State and gstMoving) = 0) then |
589 |
begin |
|
590 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
591 |
prevX:= hwRound(HHGear^.X); |
|
592 |
||
593 |
HedgehogStep(HHGear); |
|
594 |
||
595 |
if (prevX = hwRound(HHGear^.X)) then HHGear^.X:= HHGear^.X + SignAs(_1, HHGear^.dX); |
|
596 |
HHGear^.State:= HHGear^.State or gstAttacking |
|
597 |
end; |
|
305 | 598 |
|
1528 | 599 |
inc(BTSteps); |
600 |
if BTSteps = 7 then |
|
601 |
begin |
|
602 |
BTSteps:= 0; |
|
603 |
Gear^.X:= HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); |
|
604 |
Gear^.Y:= HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); |
|
605 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
606 |
AmmoShove(Gear, 2, 10); |
|
607 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
|
608 |
end; |
|
609 |
end; |
|
305 | 610 |
|
611 |
if b then |
|
498 | 612 |
DrawTunnel(HHGear^.X - Gear^.dX * cHHRadius, HHGear^.Y - _4 - Gear^.dY * cHHRadius + hwAbs(Gear^.dY) * 7, |
351 | 613 |
Gear^.dX, Gear^.dY, |
1501 | 614 |
cHHRadius * 5, cHHRadius * 2 + 7); |
305 | 615 |
|
351 | 616 |
if (Gear^.Timer = 0) or ((HHGear^.Message and gm_Attack) <> 0) then |
1528 | 617 |
begin |
618 |
HHGear^.Message:= 0; |
|
619 |
HHGear^.State:= HHGear^.State and (not gstNotKickable); |
|
620 |
DeleteGear(Gear); |
|
621 |
AfterAttack |
|
622 |
end |
|
302 | 623 |
end; |
624 |
||
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
625 |
procedure doStepBlowTorch(Gear: PGear); |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
626 |
var HHGear: PGear; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
627 |
begin |
371 | 628 |
BTPrevAngle:= High(LongInt); |
305 | 629 |
BTSteps:= 0; |
351 | 630 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
631 |
HHGear^.Message:= 0; |
|
1528 | 632 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
351 | 633 |
Gear^.doStep:= @doStepBlowTorchWork |
303
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
634 |
end; |
1659c4aad5ab
Now blow torch angle can be changed during blowing :)
unc0rr
parents:
302
diff
changeset
|
635 |
|
302 | 636 |
//////////////////////////////////////////////////////////////////////////////// |
637 |
||
4 | 638 |
procedure doStepRopeWork(Gear: PGear); |
639 |
var HHGear: PGear; |
|
1547 | 640 |
len, cs, cc, tx, ty, nx, ny, ropeDx, ropeDy: hwFloat; |
1504 | 641 |
lx, ly: LongInt; |
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
642 |
haveCollision, |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
643 |
haveDivided: boolean; |
4 | 644 |
|
1504 | 645 |
procedure DeleteMe; |
646 |
begin |
|
647 |
with HHGear^ do |
|
648 |
begin |
|
649 |
Message:= Message and not gm_Attack; |
|
650 |
State:= State or gstMoving; |
|
651 |
end; |
|
652 |
DeleteGear(Gear) |
|
653 |
end; |
|
4 | 654 |
|
655 |
begin |
|
351 | 656 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
108 | 657 |
|
351 | 658 |
if ((HHGear^.State and gstHHDriven) = 0) |
1504 | 659 |
or (CheckGearDrowning(HHGear)) then |
660 |
begin |
|
661 |
DeleteMe; |
|
662 |
exit |
|
663 |
end; |
|
928
b9064b48b001
Some preparation work for attacking from rope, parachute and etc.
unc0rr
parents:
925
diff
changeset
|
664 |
|
1547 | 665 |
ropeDx:= HHGear^.X - Gear^.X; // vector between hedgehog and rope attaching point |
666 |
ropeDy:= HHGear^.Y - Gear^.Y; |
|
4 | 667 |
|
351 | 668 |
if (Gear^.Message and gm_Left <> 0) then HHGear^.dX:= HHGear^.dX - _0_0002 else |
669 |
if (Gear^.Message and gm_Right <> 0) then HHGear^.dX:= HHGear^.dX + _0_0002; |
|
4 | 670 |
|
351 | 671 |
if not TestCollisionYwithGear(HHGear, 1) then HHGear^.dY:= HHGear^.dY + cGravity; |
4 | 672 |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
673 |
tx:= ropeDx + HHGear^.dX; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
674 |
ty:= ropeDy + HHGear^.dY; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
675 |
len:= _1 / Distance(tx, ty); |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
676 |
tx:= tx * len; // rope vector plus hedgehog direction vector normalized |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
677 |
ty:= ty * len; |
4 | 678 |
|
1554 | 679 |
Gear^.dX:= tx; // for visual purposes only |
680 |
Gear^.dY:= ty; |
|
681 |
||
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
682 |
haveDivided:= false; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
683 |
// check whether rope needs dividing |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
684 |
len:= _1 / Distance(ropeDx, ropeDy); // old rope pos |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
685 |
nx:= ropeDx * len; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
686 |
ny:= ropeDy * len; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
687 |
|
1504 | 688 |
len:= Gear^.Elasticity - _20; |
689 |
while len > _5 do |
|
690 |
begin |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
691 |
lx:= hwRound(Gear^.X + tx * len); |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
692 |
ly:= hwRound(Gear^.Y + ty * len); |
1504 | 693 |
if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0) and (Land[ly, lx] <> 0) then |
694 |
begin |
|
695 |
with RopePoints.ar[RopePoints.Count] do |
|
696 |
begin |
|
697 |
X:= Gear^.X; |
|
698 |
Y:= Gear^.Y; |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
699 |
if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle(Gear^.dY, Gear^.dX); |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
700 |
b:= (tx * HHGear^.dY) > (ty * HHGear^.dX); |
1504 | 701 |
dLen:= len |
702 |
end; |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
703 |
Gear^.X:= Gear^.X + nx * len; |
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
704 |
Gear^.Y:= Gear^.Y + ny * len; |
1504 | 705 |
inc(RopePoints.Count); |
706 |
TryDo(RopePoints.Count <= MAXROPEPOINTS, 'Rope points overflow', true); |
|
707 |
Gear^.Elasticity:= Gear^.Elasticity - len; |
|
708 |
Gear^.Friction:= Gear^.Friction - len; |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
709 |
haveDivided:= true; |
1504 | 710 |
break |
711 |
end; |
|
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
712 |
len:= len - _0_3 // should be the same as increase step |
1504 | 713 |
end; |
1553
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
714 |
|
77f326c7f0ef
The best final fix for rope stucking in the ground bug
unc0rr
parents:
1552
diff
changeset
|
715 |
if not haveDivided then |
1504 | 716 |
if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
717 |
begin |
|
718 |
tx:= RopePoints.ar[Pred(RopePoints.Count)].X; |
|
719 |
ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; |
|
720 |
if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear^.X) * (ty - HHGear^.Y) > (tx - HHGear^.X) * (ty - Gear^.Y)) then |
|
721 |
begin |
|
722 |
dec(RopePoints.Count); |
|
723 |
Gear^.X:=RopePoints.ar[RopePoints.Count].X; |
|
724 |
Gear^.Y:=RopePoints.ar[RopePoints.Count].Y; |
|
725 |
Gear^.Elasticity:= Gear^.Elasticity + RopePoints.ar[RopePoints.Count].dLen; |
|
726 |
Gear^.Friction:= Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen |
|
727 |
end |
|
728 |
end; |
|
4 | 729 |
|
1548
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
730 |
ropeDx:= HHGear^.X - Gear^.X; |
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
731 |
ropeDy:= HHGear^.Y - Gear^.Y; |
108 | 732 |
|
1548
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
733 |
cs:= ropeDy + HHGear^.dY; |
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
734 |
cc:= ropeDx + HHGear^.dX; |
498 | 735 |
len:= _1 / Distance(cc, cs); |
108 | 736 |
cc:= cc * len; |
737 |
cs:= cs * len; |
|
4 | 738 |
|
1552
cd907418da91
Bring back old rope behaviour when changing its length (that's more correct physical model)
unc0rr
parents:
1551
diff
changeset
|
739 |
tx:= HHGear^.X; |
cd907418da91
Bring back old rope behaviour when changing its length (that's more correct physical model)
unc0rr
parents:
1551
diff
changeset
|
740 |
ty:= HHGear^.Y; |
4 | 741 |
|
351 | 742 |
if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Elasticity < Gear^.Friction) then |
1548
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
743 |
if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx)) |
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
744 |
or TestCollisionYwithGear(HHGear, hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity + _0_3; |
4 | 745 |
|
498 | 746 |
if ((Gear^.Message and gm_Up) <> 0) and (Gear^.Elasticity > _30) then |
1548
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
747 |
if not (TestCollisionXwithGear(HHGear, -hwSign(ropeDx)) |
682c0c968997
- Fix wrond hedgehog speed calculation when using rope and changing rope length
unc0rr
parents:
1547
diff
changeset
|
748 |
or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity - _0_3; |
4 | 749 |
|
351 | 750 |
HHGear^.X:= Gear^.X + cc*Gear^.Elasticity; |
751 |
HHGear^.Y:= Gear^.Y + cs*Gear^.Elasticity; |
|
4 | 752 |
|
1552
cd907418da91
Bring back old rope behaviour when changing its length (that's more correct physical model)
unc0rr
parents:
1551
diff
changeset
|
753 |
HHGear^.dX:= HHGear^.X - tx; |
cd907418da91
Bring back old rope behaviour when changing its length (that's more correct physical model)
unc0rr
parents:
1551
diff
changeset
|
754 |
HHGear^.dY:= HHGear^.Y - ty; |
cd907418da91
Bring back old rope behaviour when changing its length (that's more correct physical model)
unc0rr
parents:
1551
diff
changeset
|
755 |
|
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
756 |
haveCollision:= false; |
351 | 757 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
758 |
begin |
1504 | 759 |
HHGear^.dX:= -_0_6 * HHGear^.dX; |
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
760 |
haveCollision:= true |
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
761 |
end; |
351 | 762 |
if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then |
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
763 |
begin |
1504 | 764 |
HHGear^.dY:= -_0_6 * HHGear^.dY; |
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
765 |
haveCollision:= true |
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
766 |
end; |
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
767 |
|
1579
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset
|
768 |
if haveCollision |
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset
|
769 |
and (Gear^.Message and (gm_Left or gm_Right) <> 0) |
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset
|
770 |
and (Gear^.Message and (gm_Up or gm_Down) <> 0) then |
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
771 |
begin |
1579
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset
|
772 |
HHGear^.dX:= SignAs(hwAbs(HHGear^.dX) + _0_2, HHGear^.dX); |
2f581b1f289e
More bouncy rope, but you need to press vertical arrow and horizontal keys at once to bounce
unc0rr
parents:
1573
diff
changeset
|
773 |
HHGear^.dY:= SignAs(hwAbs(HHGear^.dY) + _0_2, HHGear^.dY) |
1551
c747e69f98f3
Add some speed to hedgehog on rope when colliding with land and pressing left or right arrow key
unc0rr
parents:
1548
diff
changeset
|
774 |
end; |
4 | 775 |
|
789 | 776 |
len:= Distance(HHGear^.dX, HHGear^.dY); |
940 | 777 |
if len > _0_8 then |
1504 | 778 |
begin |
779 |
len:= _0_8 / len; |
|
780 |
HHGear^.dX:= HHGear^.dX * len; |
|
781 |
HHGear^.dY:= HHGear^.dY * len; |
|
782 |
end; |
|
789 | 783 |
|
351 | 784 |
if (Gear^.Message and gm_Attack) <> 0 then |
1504 | 785 |
if (Gear^.State and gsttmpFlag) <> 0 then |
786 |
DeleteMe |
|
787 |
else |
|
788 |
else |
|
789 |
if (Gear^.State and gsttmpFlag) = 0 then |
|
790 |
Gear^.State:= Gear^.State or gsttmpFlag; |
|
4 | 791 |
end; |
792 |
||
793 |
||
794 |
procedure doStepRopeAttach(Gear: PGear); |
|
795 |
var HHGear: PGear; |
|
351 | 796 |
tx, ty, tt: hwFloat; |
4 | 797 |
begin |
351 | 798 |
Gear^.X:= Gear^.X - Gear^.dX; |
799 |
Gear^.Y:= Gear^.Y - Gear^.dY; |
|
498 | 800 |
Gear^.Elasticity:= Gear^.Elasticity + _1; |
351 | 801 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
517 | 802 |
DeleteCI(HHGear); |
542 | 803 |
if (HHGear^.State and gstMoving) <> 0 then |
1433 | 804 |
if TestCollisionYwithGear(HHGear, 1) then |
805 |
begin |
|
806 |
CheckHHDamage(HHGear); |
|
807 |
HHGear^.dY:= _0; |
|
808 |
HHGear^.State:= HHGear^.State and not (gstMoving or gstHHJumping); |
|
809 |
end else |
|
810 |
begin |
|
811 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then SetLittle(HHGear^.dX); |
|
812 |
HHGear^.X:= HHGear^.X + HHGear^.dX; |
|
813 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; |
|
814 |
Gear^.X:= Gear^.X + HHGear^.dX; |
|
815 |
Gear^.Y:= Gear^.Y + HHGear^.dY; |
|
816 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
817 |
tt:= Gear^.Elasticity; |
|
818 |
tx:= _0; |
|
819 |
ty:= _0; |
|
820 |
while tt > _20 do |
|
821 |
begin |
|
822 |
if TestCollisionXwithXYShift(Gear, tx, hwRound(ty), -hwSign(Gear^.dX)) |
|
823 |
or TestCollisionYwithXYShift(Gear, hwRound(tx), hwRound(ty), -hwSign(Gear^.dY)) then |
|
824 |
begin |
|
825 |
Gear^.X:= Gear^.X + tx; |
|
826 |
Gear^.Y:= Gear^.Y + ty; |
|
827 |
Gear^.Elasticity:= tt; |
|
828 |
Gear^.doStep:= @doStepRopeWork; |
|
1624
3cbf01d31e5c
- Fix bug when hedgehog was unable to drop some weapons from rope if it thrown rope in jump
unc0rr
parents:
1603
diff
changeset
|
829 |
with HHGear^ do State:= State and not (gstAttacking or gstMoving); |
1433 | 830 |
tt:= _0 |
831 |
end; |
|
832 |
tx:= tx + Gear^.dX + Gear^.dX; |
|
833 |
ty:= ty + Gear^.dY + Gear^.dY; |
|
834 |
tt:= tt - _2; |
|
835 |
end; |
|
836 |
end; |
|
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
837 |
|
4 | 838 |
CheckCollision(Gear); |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
839 |
|
351 | 840 |
if (Gear^.State and gstCollision) <> 0 then |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
841 |
begin |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
842 |
Gear^.doStep:= @doStepRopeWork; |
974
fc16141a0128
Prevent wrong aim direction when using rope after high jump
unc0rr
parents:
963
diff
changeset
|
843 |
with HHGear^ do State:= State and not (gstAttacking or gstHHHJump); |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
844 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
845 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
846 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
847 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
848 |
if Gear^.Elasticity < _10 then |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
849 |
Gear^.Elasticity:= _10000; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
850 |
end; |
4 | 851 |
|
1634
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset
|
852 |
if (Gear^.Elasticity > Gear^.Friction) |
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset
|
853 |
or ((Gear^.Message and gm_Attack) = 0) |
486a89f0e843
Fix rope bug which allowed hedgehog to go into land
unc0rr
parents:
1633
diff
changeset
|
854 |
or (HHGear^.Damage > 0) then |
1433 | 855 |
begin |
856 |
with PHedgehog(Gear^.Hedgehog)^.Gear^ do |
|
857 |
begin |
|
858 |
State:= State and not gstAttacking; |
|
859 |
Message:= Message and not gm_Attack |
|
860 |
end; |
|
861 |
DeleteGear(Gear) |
|
862 |
end |
|
4 | 863 |
end; |
864 |
||
865 |
procedure doStepRope(Gear: PGear); |
|
866 |
begin |
|
351 | 867 |
Gear^.dX:= - Gear^.dX; |
868 |
Gear^.dY:= - Gear^.dY; |
|
869 |
Gear^.doStep:= @doStepRopeAttach |
|
4 | 870 |
end; |
871 |
||
872 |
//////////////////////////////////////////////////////////////////////////////// |
|
873 |
procedure doStepSmokeTrace(Gear: PGear); |
|
874 |
begin |
|
351 | 875 |
inc(Gear^.Timer); |
876 |
if Gear^.Timer > 64 then |
|
1133 | 877 |
begin |
878 |
Gear^.Timer:= 0; |
|
879 |
dec(Gear^.State) |
|
880 |
end; |
|
351 | 881 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
882 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
883 |
if Gear^.State = 0 then DeleteGear(Gear) |
|
4 | 884 |
end; |
9 | 885 |
|
886 |
//////////////////////////////////////////////////////////////////////////////// |
|
1045 | 887 |
procedure doStepExplosionWork(Gear: PGear); |
9 | 888 |
begin |
351 | 889 |
inc(Gear^.Timer); |
890 |
if Gear^.Timer > 75 then |
|
1133 | 891 |
begin |
892 |
inc(Gear^.State); |
|
893 |
Gear^.Timer:= 0; |
|
894 |
if Gear^.State > 5 then DeleteGear(Gear) |
|
895 |
end; |
|
9 | 896 |
end; |
10 | 897 |
|
1045 | 898 |
procedure doStepExplosion(Gear: PGear); |
899 |
var i: LongWord; |
|
900 |
begin |
|
1047 | 901 |
for i:= 0 to 31 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtFire); |
902 |
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart); |
|
903 |
for i:= 0 to 8 do AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplPart2); |
|
1045 | 904 |
Gear^.doStep:= @doStepExplosionWork |
905 |
end; |
|
906 |
||
10 | 907 |
//////////////////////////////////////////////////////////////////////////////// |
908 |
procedure doStepMine(Gear: PGear); |
|
909 |
begin |
|
542 | 910 |
if (Gear^.State and gstMoving) <> 0 then |
914 | 911 |
begin |
912 |
DeleteCI(Gear); |
|
913 |
doStepFallingGear(Gear); |
|
914 |
if (Gear^.State and gstMoving) = 0 then |
|
915 |
begin |
|
916 |
AddGearCI(Gear); |
|
917 |
Gear^.dX:= _0; |
|
918 |
Gear^.dY:= _0 |
|
919 |
end; |
|
920 |
CalcRotationDirAngle(Gear); |
|
921 |
AllInactive:= false |
|
922 |
end else |
|
923 |
if ((GameTicks and $3F) = 25) then |
|
924 |
doStepFallingGear(Gear); |
|
351 | 925 |
|
926 |
if ((Gear^.State and gsttmpFlag) <> 0) then |
|
1133 | 927 |
if ((Gear^.State and gstAttacking) = 0) then |
928 |
begin |
|
929 |
if ((GameTicks and $1F) = 0) then |
|
930 |
if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then Gear^.State:= Gear^.State or gstAttacking |
|
931 |
end else // gstAttacking <> 0 |
|
932 |
begin |
|
933 |
AllInactive:= false; |
|
934 |
if (Gear^.Timer and $FF) = 0 then PlaySound(sndMineTick, false); |
|
935 |
if Gear^.Timer = 0 then |
|
936 |
begin |
|
937 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
938 |
DeleteGear(Gear); |
|
939 |
exit |
|
940 |
end; |
|
941 |
dec(Gear^.Timer); |
|
942 |
end else // gsttmpFlag = 0 |
|
943 |
if TurnTimeLeft = 0 then Gear^.State:= Gear^.State or gsttmpFlag; |
|
10 | 944 |
end; |
57 | 945 |
|
39 | 946 |
//////////////////////////////////////////////////////////////////////////////// |
947 |
procedure doStepDynamite(Gear: PGear); |
|
948 |
begin |
|
43 | 949 |
doStepFallingGear(Gear); |
950 |
AllInactive:= false; |
|
351 | 951 |
if Gear^.Timer mod 166 = 0 then inc(Gear^.Tag); |
952 |
if Gear^.Timer = 0 then |
|
1133 | 953 |
begin |
954 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 75, EXPLAutoSound); |
|
955 |
DeleteGear(Gear); |
|
956 |
exit |
|
957 |
end; |
|
351 | 958 |
dec(Gear^.Timer); |
39 | 959 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
960 |
|
351 | 961 |
/////////////////////////////////////////////////////////////////////////////// |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
962 |
procedure doStepCase(Gear: PGear); |
371 | 963 |
var i, x, y: LongInt; |
1436 | 964 |
k: TGearType; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
965 |
begin |
351 | 966 |
if (Gear^.Message and gm_Destroy) > 0 then |
1133 | 967 |
begin |
968 |
DeleteGear(Gear); |
|
969 |
FreeActionsList; |
|
970 |
SetAllToActive; // something (hh, mine, etc...) could be on top of the case |
|
971 |
with CurrentHedgehog^ do |
|
972 |
if Gear <> nil then Gear^.Message:= Gear^.Message and not (gm_LJump or gm_HJump); |
|
973 |
exit |
|
974 |
end; |
|
15 | 975 |
|
351 | 976 |
if Gear^.Damage > 0 then |
1133 | 977 |
begin |
978 |
x:= hwRound(Gear^.X); |
|
979 |
y:= hwRound(Gear^.Y); |
|
1436 | 980 |
k:= Gear^.Kind; |
981 |
DeleteGear(Gear); // <-- delete gear! |
|
982 |
||
983 |
if k = gtCase then |
|
1133 | 984 |
begin |
985 |
doMakeExplosion(x, y, 25, EXPLAutoSound); |
|
986 |
for i:= 0 to 63 do |
|
987 |
AddGear(x, y, gtFlame, 0, _0, _0, 0); |
|
988 |
end; |
|
989 |
exit |
|
990 |
end; |
|
79 | 991 |
|
351 | 992 |
if (Gear^.dY.QWordValue <> 0) or (not TestCollisionYwithGear(Gear, 1)) then |
1133 | 993 |
begin |
994 |
AllInactive:= false; |
|
995 |
Gear^.dY:= Gear^.dY + cGravity; |
|
996 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
997 |
if (Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, -1) then Gear^.dY:= _0 else |
|
998 |
if (not Gear^.dY.isNegative) and TestCollisionYwithGear(Gear, 1) then |
|
999 |
begin |
|
1000 |
Gear^.dY:= - Gear^.dY * Gear^.Elasticity; |
|
1001 |
if Gear^.dY > - _0_001 then Gear^.dY:= _0 |
|
1002 |
else if Gear^.dY < - _0_03 then PlaySound(sndGraveImpact, false); |
|
1003 |
end; |
|
1004 |
CheckGearDrowning(Gear); |
|
1005 |
end; |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
1006 |
|
511 | 1007 |
if (Gear^.dY.QWordValue = 0) then AddGearCI(Gear) |
1133 | 1008 |
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
|
1009 |
end; |
49 | 1010 |
|
1011 |
//////////////////////////////////////////////////////////////////////////////// |
|
557 | 1012 |
const cSorterWorkTime = 640; |
1013 |
var thexchar: array[0..cMaxTeams] of |
|
1133 | 1014 |
record |
1015 |
dy, ny, dw: LongInt; |
|
1016 |
team: PTeam; |
|
1017 |
SortFactor: QWord; |
|
1018 |
end; |
|
601
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
590
diff
changeset
|
1019 |
currsorter: PGear = nil; |
49 | 1020 |
|
1021 |
procedure doStepTeamHealthSorterWork(Gear: PGear); |
|
371 | 1022 |
var i: LongInt; |
49 | 1023 |
begin |
1024 |
AllInactive:= false; |
|
351 | 1025 |
dec(Gear^.Timer); |
1026 |
if (Gear^.Timer and 15) = 0 then |
|
1133 | 1027 |
for i:= 0 to Pred(TeamsCount) do |
1028 |
with thexchar[i] do |
|
1029 |
begin |
|
1030 |
{$WARNINGS OFF} |
|
1031 |
team^.DrawHealthY:= ny + dy * Gear^.Timer div 640; |
|
1032 |
team^.TeamHealthBarWidth:= team^.NewTeamHealthBarWidth + dw * Gear^.Timer div cSorterWorkTime; |
|
1033 |
{$WARNINGS ON} |
|
1034 |
end; |
|
1035 |
||
351 | 1036 |
if (Gear^.Timer = 0) or (currsorter <> Gear) then |
1133 | 1037 |
begin |
1038 |
if currsorter = Gear then currsorter:= nil; |
|
1039 |
DeleteGear(Gear) |
|
1040 |
end |
|
49 | 1041 |
end; |
1042 |
||
1043 |
procedure doStepTeamHealthSorter(Gear: PGear); |
|
1133 | 1044 |
var i: Longword; |
1045 |
b: boolean; |
|
1046 |
t: LongInt; |
|
49 | 1047 |
begin |
1048 |
AllInactive:= false; |
|
557 | 1049 |
|
547 | 1050 |
for t:= 0 to Pred(TeamsCount) do |
1133 | 1051 |
with thexchar[t] do |
1052 |
begin |
|
1053 |
dy:= TeamsArray[t]^.DrawHealthY; |
|
1054 |
dw:= TeamsArray[t]^.TeamHealthBarWidth - TeamsArray[t]^.NewTeamHealthBarWidth; |
|
1055 |
team:= TeamsArray[t]; |
|
1056 |
SortFactor:= TeamsArray[t]^.Clan^.ClanHealth; |
|
1057 |
SortFactor:= (SortFactor shl 3) + TeamsArray[t]^.Clan^.ClanIndex; |
|
1058 |
SortFactor:= (SortFactor shl 30) + TeamsArray[t]^.TeamHealth; |
|
1059 |
end; |
|
547 | 1060 |
|
601
78a68cc4d846
Special game mode allowing the only clan on map for training mode
unc0rr
parents:
590
diff
changeset
|
1061 |
if TeamsCount > 1 then |
1133 | 1062 |
repeat |
1063 |
b:= true; |
|
1064 |
for t:= 0 to TeamsCount - 2 do |
|
1065 |
if (thexchar[t].SortFactor > thexchar[Succ(t)].SortFactor) then |
|
1066 |
begin |
|
1067 |
thexchar[cMaxTeams]:= thexchar[t]; |
|
1068 |
thexchar[t]:= thexchar[Succ(t)]; |
|
1069 |
thexchar[Succ(t)]:= thexchar[cMaxTeams]; |
|
1070 |
b:= false |
|
1071 |
end |
|
1072 |
until b; |
|
557 | 1073 |
|
1120 | 1074 |
t:= - 4; |
557 | 1075 |
for i:= 0 to Pred(TeamsCount) do |
1133 | 1076 |
with thexchar[i] do |
1077 |
begin |
|
1078 |
dec(t, team^.HealthTex^.h + 2); |
|
1079 |
ny:= t; |
|
1080 |
dy:= dy - ny |
|
1081 |
end; |
|
764
7513452b1d51
Now game looks almost like it did before switching to OpenGL
unc0rr
parents:
762
diff
changeset
|
1082 |
|
557 | 1083 |
Gear^.Timer:= cSorterWorkTime; |
351 | 1084 |
Gear^.doStep:= @doStepTeamHealthSorterWork; |
143 | 1085 |
currsorter:= Gear |
49 | 1086 |
end; |
1087 |
||
79 | 1088 |
//////////////////////////////////////////////////////////////////////////////// |
854 | 1089 |
procedure doStepIdle(Gear: PGear); |
1090 |
begin |
|
1091 |
AllInactive:= false; |
|
925 | 1092 |
dec(Gear^.Timer); |
854 | 1093 |
if Gear^.Timer = 0 then |
1094 |
begin |
|
1095 |
DeleteGear(Gear); |
|
1096 |
AfterAttack |
|
1097 |
end |
|
1098 |
end; |
|
1099 |
||
79 | 1100 |
procedure doStepShover(Gear: PGear); |
1101 |
var HHGear: PGear; |
|
1102 |
begin |
|
351 | 1103 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1104 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1105 |
DeleteCI(HHGear); |
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1106 |
|
79 | 1107 |
AmmoShove(Gear, 30, 115); |
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1108 |
|
351 | 1109 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
854 | 1110 |
Gear^.Timer:= 250; |
1111 |
Gear^.doStep:= @doStepIdle |
|
79 | 1112 |
end; |
1113 |
||
1114 |
//////////////////////////////////////////////////////////////////////////////// |
|
925 | 1115 |
procedure doStepWhip(Gear: PGear); |
1116 |
var HHGear: PGear; |
|
1117 |
i: LongInt; |
|
1118 |
begin |
|
1119 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1120 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
980
20128e98988b
Don't push attacking hedgehog when using whip or baseball
unc0rr
parents:
979
diff
changeset
|
1121 |
DeleteCI(HHGear); |
925 | 1122 |
|
1123 |
for i:= 0 to 3 do |
|
1124 |
begin |
|
1125 |
AmmoShove(Gear, 30, 25); |
|
1126 |
Gear^.X:= Gear^.X + Gear^.dX * 5 |
|
1127 |
end; |
|
1128 |
||
1129 |
HHGear^.State:= HHGear^.State and not gstNoDamage; |
|
1130 |
Gear^.Timer:= 250; |
|
1131 |
Gear^.doStep:= @doStepIdle |
|
1132 |
end; |
|
1133 |
||
1134 |
//////////////////////////////////////////////////////////////////////////////// |
|
79 | 1135 |
procedure doStepFlame(Gear: PGear); |
1136 |
begin |
|
1137 |
AllInactive:= false; |
|
1433 | 1138 |
|
79 | 1139 |
if not TestCollisionYwithGear(Gear, 1) then |
1133 | 1140 |
begin |
1586 | 1141 |
if hwAbs(Gear^.dX) > _0_01 then |
1142 |
Gear^.dX:= Gear^.dX * _0_995; |
|
1297 | 1143 |
|
1133 | 1144 |
Gear^.dY:= Gear^.dY + cGravity; |
1586 | 1145 |
if hwAbs(Gear^.dY) > _0_08 then Gear^.dY:= Gear^.dY * _0_995; |
1297 | 1146 |
|
1586 | 1147 |
Gear^.X:= Gear^.X + Gear^.dX + cWindSpeed * 270; |
1133 | 1148 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
1297 | 1149 |
|
1417 | 1150 |
if not (hwRound(Gear^.Y) < cWaterLine) then |
1133 | 1151 |
begin |
1152 |
DeleteGear(Gear); |
|
1153 |
exit |
|
1154 |
end |
|
1155 |
end else begin |
|
1156 |
if Gear^.Timer > 0 then dec(Gear^.Timer) |
|
1157 |
else begin |
|
1586 | 1158 |
Gear^.Radius:= 9; |
1159 |
AmmoShove(Gear, 4, 100); |
|
1297 | 1160 |
Gear^.Radius:= 1; |
1161 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 4, EXPLNoDamage); |
|
1133 | 1162 |
dec(Gear^.Health); |
1586 | 1163 |
Gear^.Timer:= 450 - Gear^.Tag * 8 |
1133 | 1164 |
end |
1165 |
end; |
|
79 | 1166 |
|
1295 | 1167 |
//if (((GameTicks div 8) mod 64) = Gear^.Tag) then |
1168 |
// AmmoFlameWork(Gear); |
|
79 | 1169 |
|
351 | 1170 |
if Gear^.Health = 0 then |
1133 | 1171 |
DeleteGear(Gear) |
79 | 1172 |
end; |
82 | 1173 |
|
1174 |
//////////////////////////////////////////////////////////////////////////////// |
|
1175 |
procedure doStepFirePunchWork(Gear: PGear); |
|
1176 |
var HHGear: PGear; |
|
1177 |
begin |
|
1178 |
AllInactive:= false; |
|
351 | 1179 |
if ((Gear^.Message and gm_Destroy) <> 0) then |
1133 | 1180 |
begin |
1181 |
DeleteGear(Gear); |
|
1182 |
AfterAttack; |
|
1183 |
exit |
|
1184 |
end; |
|
82 | 1185 |
|
351 | 1186 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
1187 |
if hwRound(HHGear^.Y) <= Gear^.Tag - 2 then |
|
1133 | 1188 |
begin |
1189 |
Gear^.Tag:= hwRound(HHGear^.Y); |
|
1190 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y - _1, _0_5, _0, cHHRadius * 4, 2); |
|
1191 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
1192 |
Gear^.Y:= HHGear^.Y; |
|
1193 |
AmmoShove(Gear, 30, 40); |
|
1194 |
HHGear^.State:= HHGear^.State and not gstNoDamage |
|
1195 |
end; |
|
351 | 1196 |
|
1197 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
1198 |
if not (HHGear^.dY.isNegative) then |
|
1133 | 1199 |
begin |
1200 |
HHGear^.State:= HHGear^.State or gstMoving; |
|
1201 |
DeleteGear(Gear); |
|
1202 |
AfterAttack; |
|
1203 |
exit |
|
1204 |
end; |
|
351 | 1205 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY |
82 | 1206 |
end; |
1207 |
||
1208 |
procedure doStepFirePunch(Gear: PGear); |
|
1209 |
var HHGear: PGear; |
|
1210 |
begin |
|
1211 |
AllInactive:= false; |
|
351 | 1212 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
514 | 1213 |
DeleteCI(HHGear); |
498 | 1214 |
HHGear^.X:= int2hwFloat(hwRound(HHGear^.X)) - _0_5; |
1014
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
992
diff
changeset
|
1215 |
HHGear^.dX:= SignAs(cLittle, Gear^.dX); |
3c7d4e7ccdff
- Fix firepunch sprite direction when use in high jump
unc0rr
parents:
992
diff
changeset
|
1216 |
|
351 | 1217 |
HHGear^.dY:= - _0_3; |
82 | 1218 |
|
351 | 1219 |
Gear^.X:= HHGear^.X; |
979
edb8f208c1d9
Fix firepunch direction when attacking from high jump
unc0rr
parents:
974
diff
changeset
|
1220 |
Gear^.dX:= SignAs(_0_45, Gear^.dX); |
351 | 1221 |
Gear^.dY:= - _0_9; |
1222 |
Gear^.doStep:= @doStepFirePunchWork; |
|
498 | 1223 |
DrawTunnel(HHGear^.X - int2hwFloat(cHHRadius), HHGear^.Y + _1, _0_5, _0, cHHRadius * 4, 5); |
1279 | 1224 |
|
1225 |
PlaySound(TSound(ord(sndFirePunch1) + GetRandom(6)), false) |
|
82 | 1226 |
end; |
1227 |
||
263 | 1228 |
//////////////////////////////////////////////////////////////////////////////// |
1229 |
||
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1230 |
procedure doStepParachuteWork(Gear: PGear); |
211 | 1231 |
var HHGear: PGear; |
1232 |
begin |
|
351 | 1233 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
82 | 1234 |
|
516 | 1235 |
inc(Gear^.Timer); |
1236 |
||
212 | 1237 |
if TestCollisionYwithGear(HHGear, 1) |
1133 | 1238 |
or ((HHGear^.State and gstHHDriven) = 0) |
1239 |
or CheckGearDrowning(HHGear) |
|
1240 |
or ((Gear^.Message and gm_Attack) <> 0) then |
|
1241 |
begin |
|
1242 |
with HHGear^ do |
|
1243 |
begin |
|
1244 |
Message:= 0; |
|
1245 |
SetLittle(dX); |
|
1246 |
dY:= _0; |
|
1247 |
State:= State or gstMoving; |
|
1248 |
end; |
|
1249 |
DeleteGear(Gear); |
|
1250 |
exit |
|
1251 |
end; |
|
211 | 1252 |
|
351 | 1253 |
if not TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
1133 | 1254 |
HHGear^.X:= HHGear^.X + cWindSpeed * 200; |
211 | 1255 |
|
351 | 1256 |
if (Gear^.Message and gm_Left) <> 0 then HHGear^.X:= HHGear^.X - cMaxWindSpeed * 40 |
1257 |
else if (Gear^.Message and gm_Right) <> 0 then HHGear^.X:= HHGear^.X + cMaxWindSpeed * 40; |
|
1258 |
if (Gear^.Message and gm_Up) <> 0 then HHGear^.Y:= HHGear^.Y - cGravity * 40 |
|
1259 |
else if (Gear^.Message and gm_Down) <> 0 then HHGear^.Y:= HHGear^.Y + cGravity * 40; |
|
211 | 1260 |
|
351 | 1261 |
HHGear^.Y:= HHGear^.Y + cGravity * 100; |
568 | 1262 |
Gear^.X:= HHGear^.X; |
1263 |
Gear^.Y:= HHGear^.Y |
|
263 | 1264 |
end; |
211 | 1265 |
|
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1266 |
procedure doStepParachute(Gear: PGear); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1267 |
var HHGear: PGear; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1268 |
begin |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1269 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1270 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1271 |
DeleteCI(HHGear); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1272 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1273 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1274 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1275 |
|
931 | 1276 |
HHGear^.State:= HHGear^.State and not (gstAttacking or gstAttacked or gstMoving); |
929
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1277 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1278 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1279 |
Gear^.doStep:= @doStepParachuteWork; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1280 |
|
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1281 |
Gear^.Message:= HHGear^.Message; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1282 |
doStepParachuteWork(Gear) |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1283 |
end; |
9456e1e77369
- Continue preparation for implementing attack from rope and parachute
unc0rr
parents:
928
diff
changeset
|
1284 |
|
263 | 1285 |
//////////////////////////////////////////////////////////////////////////////// |
1286 |
procedure doStepAirAttackWork(Gear: PGear); |
|
1507 | 1287 |
var i: Longint; |
263 | 1288 |
begin |
1289 |
AllInactive:= false; |
|
498 | 1290 |
Gear^.X:= Gear^.X + cAirPlaneSpeed * Gear^.Tag; |
1124 | 1291 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1292 |
if (Gear^.Health > 0)and(not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then |
1124 | 1293 |
begin |
1294 |
dec(Gear^.Health); |
|
1295 |
case Gear^.State of |
|
1296 |
0: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
1297 |
1: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed * Gear^.Tag, _0, 0); |
|
1586 | 1298 |
2: for i:= -19 to 19 do |
1299 |
FollowGear:= AddGear(hwRound(Gear^.X) + i div 3, hwRound(Gear^.Y), gtFlame, 0, _0_001 * i, _0, 0); |
|
1124 | 1300 |
end; |
1301 |
Gear^.dX:= Gear^.dX + int2hwFloat(30 * Gear^.Tag) |
|
1302 |
end; |
|
1303 |
||
1304 |
if (GameTicks and $3F) = 0 then |
|
1305 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
1306 |
||
498 | 1307 |
if (hwRound(Gear^.X) > 3072) or (hwRound(Gear^.X) < -1024) then DeleteGear(Gear) |
263 | 1308 |
end; |
1309 |
||
1310 |
procedure doStepAirAttack(Gear: PGear); |
|
1311 |
begin |
|
1312 |
AllInactive:= false; |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1313 |
|
1507 | 1314 |
if Gear^.X.QWordValue = 0 then |
1315 |
Gear^.Tag:= 1 |
|
1316 |
else |
|
1317 |
Gear^.Tag:= -1; |
|
1318 |
||
498 | 1319 |
Gear^.X:= _1024 - _2048 * Gear^.Tag; |
1124 | 1320 |
Gear^.Y:= -_300; |
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1321 |
Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15); |
357 | 1322 |
|
543
465e2ec8f05f
- Better randomness of placing hedgehogs on the land
unc0rr
parents:
542
diff
changeset
|
1323 |
if int2hwFloat(TargetPoint.Y) - Gear^.Y > _0 then |
1133 | 1324 |
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
|
1325 |
|
351 | 1326 |
Gear^.Health:= 6; |
801 | 1327 |
Gear^.doStep:= @doStepAirAttackWork; |
1328 |
PlaySound(sndIncoming, false) |
|
263 | 1329 |
end; |
1330 |
||
1331 |
//////////////////////////////////////////////////////////////////////////////// |
|
1332 |
||
1333 |
procedure doStepAirBomb(Gear: PGear); |
|
1334 |
begin |
|
1335 |
AllInactive:= false; |
|
1336 |
doStepFallingGear(Gear); |
|
351 | 1337 |
if (Gear^.State and gstCollision) <> 0 then |
1133 | 1338 |
begin |
1339 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
|
1340 |
DeleteGear(Gear); |
|
1341 |
exit |
|
1342 |
end; |
|
263 | 1343 |
if (GameTicks and $3F) = 0 then |
1133 | 1344 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
211 | 1345 |
end; |
409 | 1346 |
|
1347 |
//////////////////////////////////////////////////////////////////////////////// |
|
1348 |
||
1349 |
procedure doStepGirder(Gear: PGear); |
|
415 | 1350 |
var HHGear: PGear; |
409 | 1351 |
begin |
1352 |
AllInactive:= false; |
|
415 | 1353 |
|
1354 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
409 | 1355 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprAmGirder].Width div 2, |
1356 |
TargetPoint.Y - SpritesData[sprAmGirder].Height div 2, |
|
520 | 1357 |
sprAmGirder, Gear^.State, true) then |
1133 | 1358 |
begin |
1359 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1360 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1361 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1362 |
DeleteGear(Gear); |
|
1363 |
isCursorVisible:= true |
|
1364 |
end |
|
1365 |
else begin |
|
1366 |
DeleteGear(Gear); |
|
1367 |
AfterAttack |
|
1368 |
end; |
|
415 | 1369 |
TargetPoint.X:= NoPointX |
409 | 1370 |
end; |
520 | 1371 |
|
1372 |
//////////////////////////////////////////////////////////////////////////////// |
|
525 | 1373 |
procedure doStepTeleportAfter(Gear: PGear); |
912 | 1374 |
var HHGear: PGear; |
1375 |
begin |
|
1376 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1377 |
HHGear^.Y:= HHGear^.Y + HHGear^.dY; // hedgehog falling to collect cases |
|
1378 |
HHGear^.dY:= HHGear^.dY + cGravity; |
|
945
4ead9cde4e14
- Start chat implementation: chat strings are on the screen
unc0rr
parents:
940
diff
changeset
|
1379 |
if TestCollisionYwithGear(HHGear, 1) |
1133 | 1380 |
or CheckGearDrowning(HHGear) then |
1381 |
begin |
|
1382 |
DeleteGear(Gear); |
|
1383 |
AfterAttack |
|
1384 |
end |
|
912 | 1385 |
end; |
1386 |
||
1387 |
procedure doStepTeleportAnim(Gear: PGear); |
|
525 | 1388 |
begin |
853 | 1389 |
inc(Gear^.Timer); |
1390 |
if Gear^.Timer = 65 then |
|
1391 |
begin |
|
1392 |
Gear^.Timer:= 0; |
|
1393 |
inc(Gear^.Pos); |
|
1394 |
if Gear^.Pos = 11 then |
|
912 | 1395 |
Gear^.doStep:= @doStepTeleportAfter |
853 | 1396 |
end |
525 | 1397 |
end; |
520 | 1398 |
|
1399 |
procedure doStepTeleport(Gear: PGear); |
|
1400 |
var HHGear: PGear; |
|
1401 |
begin |
|
1402 |
AllInactive:= false; |
|
1403 |
||
1404 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1405 |
if not TryPlaceOnLand(TargetPoint.X - SpritesData[sprHHTelepMask].Width div 2, |
|
1406 |
TargetPoint.Y - SpritesData[sprHHTelepMask].Height div 2, |
|
1407 |
sprHHTelepMask, 0, false) then |
|
853 | 1408 |
begin |
1409 |
HHGear^.Message:= HHGear^.Message and not gm_Attack; |
|
1410 |
HHGear^.State:= HHGear^.State and not gstAttacking; |
|
1411 |
HHGear^.State:= HHGear^.State or gstHHChooseTarget; |
|
1412 |
DeleteGear(Gear); |
|
1413 |
isCursorVisible:= true |
|
1414 |
end |
|
1415 |
else begin |
|
1416 |
DeleteCI(HHGear); |
|
1417 |
SetAllHHToActive; |
|
912 | 1418 |
Gear^.doStep:= @doStepTeleportAnim; |
853 | 1419 |
Gear^.X:= HHGear^.X; |
1420 |
Gear^.Y:= HHGear^.Y; |
|
1421 |
HHGear^.X:= int2hwFloat(TargetPoint.X); |
|
1422 |
HHGear^.Y:= int2hwFloat(TargetPoint.Y); |
|
1423 |
HHGear^.State:= HHGear^.State or gstMoving |
|
1424 |
end; |
|
520 | 1425 |
TargetPoint.X:= NoPointX |
1426 |
end; |
|
534 | 1427 |
|
1428 |
//////////////////////////////////////////////////////////////////////////////// |
|
1429 |
procedure doStepSwitcherWork(Gear: PGear); |
|
1430 |
var HHGear: PGear; |
|
1431 |
Msg, State: Longword; |
|
1432 |
begin |
|
1433 |
AllInactive:= false; |
|
1434 |
||
540 | 1435 |
if ((Gear^.Message and not gm_Switch) <> 0) or (TurnTimeLeft = 0) then |
1133 | 1436 |
begin |
1437 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1438 |
Msg:= Gear^.Message and not gm_Switch; |
|
1439 |
DeleteGear(Gear); |
|
1440 |
OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^); |
|
1441 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
534 | 1442 |
|
1133 | 1443 |
HHGear:= CurrentHedgehog^.Gear; |
1444 |
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^); |
|
1445 |
HHGear^.Message:= Msg; |
|
1446 |
exit |
|
1447 |
end; |
|
534 | 1448 |
|
1449 |
if (Gear^.Message and gm_Switch) <> 0 then |
|
1133 | 1450 |
begin |
1451 |
HHGear:= CurrentHedgehog^.Gear; |
|
1452 |
HHGear^.Message:= HHGear^.Message and not gm_Switch; |
|
1453 |
Gear^.Message:= Gear^.Message and not gm_Switch; |
|
1454 |
State:= HHGear^.State; |
|
1455 |
HHGear^.State:= 0; |
|
1456 |
HHGear^.Active:= false; |
|
1457 |
HHGear^.Z:= cHHZ; |
|
1458 |
RemoveGearFromList(HHGear); |
|
1459 |
InsertGearToList(HHGear); |
|
534 | 1460 |
|
1133 | 1461 |
repeat |
1462 |
CurrentTeam^.CurrHedgehog:= Succ(CurrentTeam^.CurrHedgehog) mod (CurrentTeam^.HedgehogsNumber); |
|
1463 |
until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil); |
|
652 | 1464 |
|
1133 | 1465 |
CurrentHedgehog:= @CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]; |
534 | 1466 |
|
1133 | 1467 |
HHGear:= CurrentHedgehog^.Gear; |
1468 |
HHGear^.State:= State; |
|
1469 |
HHGear^.Active:= true; |
|
1470 |
FollowGear:= HHGear; |
|
1471 |
HHGear^.Z:= cCurrHHZ; |
|
1472 |
RemoveGearFromList(HHGear); |
|
1473 |
InsertGearToList(HHGear); |
|
1474 |
Gear^.X:= HHGear^.X; |
|
1475 |
Gear^.Y:= HHGear^.Y |
|
1476 |
end; |
|
534 | 1477 |
end; |
1478 |
||
1479 |
procedure doStepSwitcher(Gear: PGear); |
|
1480 |
var HHGear: PGear; |
|
1481 |
begin |
|
1482 |
Gear^.doStep:= @doStepSwitcherWork; |
|
1483 |
||
1484 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1485 |
with HHGear^ do |
|
1133 | 1486 |
begin |
1487 |
State:= State and not gstAttacking; |
|
1488 |
Message:= Message and not gm_Attack |
|
1489 |
end |
|
534 | 1490 |
end; |
924 | 1491 |
|
1492 |
//////////////////////////////////////////////////////////////////////////////// |
|
1493 |
procedure doStepMortar(Gear: PGear); |
|
1494 |
var dX, dY: hwFloat; |
|
1495 |
i: LongInt; |
|
963 | 1496 |
dxn, dyn: boolean; |
924 | 1497 |
begin |
1498 |
AllInactive:= false; |
|
963 | 1499 |
dxn:= Gear^.dX.isNegative; |
1500 |
dyn:= Gear^.dY.isNegative; |
|
1501 |
||
924 | 1502 |
doStepFallingGear(Gear); |
1503 |
if (Gear^.State and gstCollision) <> 0 then |
|
1504 |
begin |
|
1505 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 20, EXPLAutoSound); |
|
963 | 1506 |
|
1507 |
Gear^.dX.isNegative:= not dxn; |
|
1508 |
Gear^.dY.isNegative:= not dyn; |
|
924 | 1509 |
for i:= 0 to 4 do |
1510 |
begin |
|
963 | 1511 |
dX:= Gear^.dX + (GetRandom - _0_5) * _0_03; |
1512 |
dY:= Gear^.dY + (GetRandom - _0_5) * _0_03; |
|
1273 | 1513 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtCluster, 0, dX, dY, 25); |
924 | 1514 |
end; |
1515 |
||
1516 |
DeleteGear(Gear); |
|
1517 |
exit |
|
1518 |
end; |
|
963 | 1519 |
|
924 | 1520 |
if (GameTicks and $3F) = 0 then |
1521 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0) |
|
1522 |
end; |
|
984 | 1523 |
|
1524 |
//////////////////////////////////////////////////////////////////////////////// |
|
1525 |
procedure doStepKamikazeWork(Gear: PGear); |
|
1526 |
const upd: Longword = 0; |
|
987 | 1527 |
var i: LongWord; |
984 | 1528 |
HHGear: PGear; |
1529 |
begin |
|
1530 |
AllInactive:= false; |
|
1531 |
||
1532 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1533 |
HHGear^.State:= HHGear^.State or gstNoDamage; |
|
1534 |
DeleteCI(HHGear); |
|
1535 |
||
1536 |
i:= 2; |
|
1537 |
repeat |
|
1538 |
Gear^.X:= Gear^.X + HHGear^.dX; |
|
1539 |
Gear^.Y:= Gear^.Y + HHGear^.dY; |
|
1540 |
HHGear^.X:= Gear^.X; |
|
1541 |
HHGear^.Y:= Gear^.Y; |
|
1542 |
||
1543 |
inc(Gear^.Damage, 2); |
|
1544 |
||
1200 | 1545 |
// if TestCollisionXwithGear(HHGear, hwSign(Gear^.dX)) |
1546 |
// or TestCollisionYwithGear(HHGear, hwSign(Gear^.dY)) then inc(Gear^.Damage, 3); |
|
984 | 1547 |
|
1548 |
dec(i) |
|
1549 |
until (i = 0) or (Gear^.Damage > Gear^.Health); |
|
1550 |
||
1551 |
inc(upd); |
|
1552 |
if upd > 3 then |
|
1553 |
begin |
|
987 | 1554 |
if Gear^.Health < 1500 then Gear^.Pos:= 2; |
1555 |
||
984 | 1556 |
AmmoShove(Gear, 30, 40); |
1557 |
||
1558 |
DrawTunnel(HHGear^.X - HHGear^.dX * 10, |
|
1200 | 1559 |
HHGear^.Y - _2 - HHGear^.dY * 10 + hwAbs(HHGear^.dY) * 2, |
984 | 1560 |
HHGear^.dX, |
1561 |
HHGear^.dY, |
|
1562 |
20 + cHHRadius * 2, |
|
1200 | 1563 |
cHHRadius * 2 + 6); |
984 | 1564 |
|
1565 |
upd:= 0 |
|
1566 |
end; |
|
1567 |
||
1568 |
if Gear^.Health < Gear^.Damage then |
|
1569 |
begin |
|
1570 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 30, EXPLAutoSound); |
|
1571 |
AfterAttack; |
|
1572 |
DeleteGear(Gear); |
|
1573 |
DeleteGear(HHGear); |
|
1574 |
end else |
|
1575 |
begin |
|
1576 |
dec(Gear^.Health, Gear^.Damage); |
|
1577 |
Gear^.Damage:= 0 |
|
1578 |
end |
|
1579 |
end; |
|
1580 |
||
987 | 1581 |
procedure doStepKamikazeIdle(Gear: PGear); |
1582 |
begin |
|
1583 |
AllInactive:= false; |
|
1584 |
dec(Gear^.Timer); |
|
1585 |
if Gear^.Timer = 0 then |
|
1586 |
begin |
|
1587 |
Gear^.Pos:= 1; |
|
992 | 1588 |
PlaySound(sndKamikaze, false); |
987 | 1589 |
Gear^.doStep:= @doStepKamikazeWork |
1590 |
end |
|
1591 |
end; |
|
1592 |
||
984 | 1593 |
procedure doStepKamikaze(Gear: PGear); |
1594 |
var HHGear: PGear; |
|
1595 |
begin |
|
1596 |
AllInactive:= false; |
|
1597 |
||
1598 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1599 |
||
1600 |
HHGear^.dX:= Gear^.dX; |
|
1601 |
HHGear^.dY:= Gear^.dY; |
|
1602 |
||
1603 |
Gear^.dX:= SignAs(_0_45, Gear^.dX); |
|
1604 |
Gear^.dY:= - _0_9; |
|
1605 |
||
987 | 1606 |
Gear^.Timer:= 550; |
1607 |
||
1608 |
Gear^.doStep:= @doStepKamikazeIdle |
|
984 | 1609 |
end; |
1610 |
||
1103 | 1611 |
//////////////////////////////////////////////////////////////////////////////// |
1612 |
const cakeh = 27; |
|
1110 | 1613 |
cakeDmg = 75; |
1103 | 1614 |
var CakePoints: array[0..Pred(cakeh)] of record x, y: hwFloat; end; |
1615 |
CakeI: Longword; |
|
1616 |
||
1110 | 1617 |
procedure doStepCakeExpl(Gear: PGear); |
1618 |
begin |
|
1619 |
inc(Gear^.Tag); |
|
1620 |
if Gear^.Tag < 2250 then exit; |
|
1621 |
||
1622 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cakeDmg, EXPLAutoSound); |
|
1623 |
AfterAttack; |
|
1624 |
DeleteGear(Gear) |
|
1625 |
end; |
|
1626 |
||
1109 | 1627 |
procedure doStepCakeDown(Gear: PGear); |
1133 | 1628 |
var gi: PGear; |
1629 |
dmg: LongInt; |
|
1109 | 1630 |
begin |
1631 |
AllInactive:= false; |
|
1632 |
||
1633 |
inc(Gear^.Tag); |
|
1634 |
if Gear^.Tag < 100 then exit; |
|
1635 |
Gear^.Tag:= 0; |
|
1636 |
||
1637 |
if Gear^.Pos = 0 then |
|
1638 |
begin |
|
1110 | 1639 |
gi:= GearsList; |
1640 |
while gi <> nil do |
|
1641 |
begin |
|
1642 |
dmg:= cakeDmg * 2 - hwRound(Distance(gi^.X - Gear^.X, gi^.Y - Gear^.Y)); |
|
1643 |
if (dmg > 1) and (gi^.Kind = gtHedgehog) then |
|
1644 |
gi^.State:= gi^.State or gstWinner; |
|
1645 |
gi:= gi^.NextGear |
|
1646 |
end; |
|
1647 |
Gear^.doStep:= @doStepCakeExpl; |
|
1111 | 1648 |
PlaySound(sndCake, false) |
1109 | 1649 |
end else dec(Gear^.Pos) |
1650 |
end; |
|
1651 |
||
1652 |
||
1089 | 1653 |
procedure doStepCakeWork(Gear: PGear); |
1654 |
const dirs: array[0..3] of TPoint = ((x: 0; y: -1), (x: 1; y: 0),(x: 0; y: 1),(x: -1; y: 0)); |
|
1655 |
var xx, yy, xxn, yyn: LongInt; |
|
1656 |
da: LongInt; |
|
1103 | 1657 |
tdx, tdy: hwFloat; |
1089 | 1658 |
|
1659 |
procedure PrevAngle; |
|
1660 |
begin |
|
1133 | 1661 |
Gear^.Angle:= (LongInt(Gear^.Angle) + 4 - dA) mod 4 |
1089 | 1662 |
end; |
1663 |
||
1664 |
procedure NextAngle; |
|
1665 |
begin |
|
1133 | 1666 |
Gear^.Angle:= (LongInt(Gear^.Angle) + 4 + dA) mod 4 |
1089 | 1667 |
end; |
1668 |
||
1088 | 1669 |
begin |
1089 | 1670 |
inc(Gear^.Tag); |
1108 | 1671 |
if Gear^.Tag < 7 then exit; |
1089 | 1672 |
|
1673 |
dA:= hwSign(Gear^.dX); |
|
1674 |
xx:= dirs[Gear^.Angle].x; |
|
1675 |
yy:= dirs[Gear^.Angle].y; |
|
1133 | 1676 |
xxn:= dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].x; |
1677 |
yyn:= dirs[(LongInt(Gear^.Angle) + 4 + dA) mod 4].y; |
|
1089 | 1678 |
|
1679 |
||
1680 |
if (xx = 0) then |
|
1681 |
if TestCollisionYwithGear(Gear, yy) then |
|
1682 |
PrevAngle |
|
1683 |
else begin |
|
1684 |
Gear^.Tag:= 0; |
|
1685 |
Gear^.Y:= Gear^.Y + int2hwFloat(yy); |
|
1686 |
if not TestCollisionXwithGear(Gear, xxn) then NextAngle |
|
1687 |
end; |
|
1688 |
||
1689 |
if (yy = 0) then |
|
1690 |
if TestCollisionXwithGear(Gear, xx) then |
|
1691 |
PrevAngle |
|
1692 |
else begin |
|
1693 |
Gear^.Tag:= 0; |
|
1694 |
Gear^.X:= Gear^.X + int2hwFloat(xx); |
|
1695 |
if not TestCollisionYwithGear(Gear, yyn) then NextAngle |
|
1696 |
end; |
|
1697 |
||
1103 | 1698 |
if Gear^.Tag = 0 then |
1699 |
begin |
|
1700 |
CakeI:= (CakeI + 1) mod cakeh; |
|
1701 |
tdx:= CakePoints[CakeI].x - Gear^.X; |
|
1702 |
tdy:= - CakePoints[CakeI].y + Gear^.Y; |
|
1703 |
CakePoints[CakeI].x:= Gear^.X; |
|
1704 |
CakePoints[CakeI].y:= Gear^.Y; |
|
1705 |
Gear^.DirAngle:= DxDy2Angle(tdx, tdy); |
|
1706 |
end; |
|
1707 |
||
1089 | 1708 |
dec(Gear^.Health); |
1090 | 1709 |
if (Gear^.Health = 0) or ((Gear^.Message and gm_Attack) <> 0) then |
1089 | 1710 |
begin |
1109 | 1711 |
FollowGear:= Gear; |
1712 |
Gear^.doStep:= @doStepCakeDown |
|
1089 | 1713 |
end |
1088 | 1714 |
end; |
1089 | 1715 |
|
1103 | 1716 |
procedure doStepCakeUp(Gear: PGear); |
1717 |
var i: Longword; |
|
1718 |
begin |
|
1719 |
AllInactive:= false; |
|
1720 |
||
1108 | 1721 |
inc(Gear^.Tag); |
1109 | 1722 |
if Gear^.Tag < 100 then exit; |
1108 | 1723 |
Gear^.Tag:= 0; |
1724 |
||
1109 | 1725 |
if Gear^.Pos = 6 then |
1103 | 1726 |
begin |
1727 |
for i:= 0 to Pred(cakeh) do |
|
1728 |
begin |
|
1729 |
CakePoints[i].x:= Gear^.X; |
|
1730 |
CakePoints[i].y:= Gear^.Y |
|
1731 |
end; |
|
1732 |
CakeI:= 0; |
|
1733 |
Gear^.doStep:= @doStepCakeWork |
|
1109 | 1734 |
end else inc(Gear^.Pos) |
1103 | 1735 |
end; |
1736 |
||
1089 | 1737 |
procedure doStepCakeFall(Gear: PGear); |
1738 |
begin |
|
1739 |
AllInactive:= false; |
|
1740 |
||
1741 |
Gear^.dY:= Gear^.dY + cGravity; |
|
1742 |
if TestCollisionYwithGear(Gear, 1) then |
|
1103 | 1743 |
Gear^.doStep:= @doStepCakeUp |
1089 | 1744 |
else |
1745 |
begin |
|
1746 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1747 |
if CheckGearDrowning(Gear) then AfterAttack |
|
1748 |
end |
|
1749 |
end; |
|
1750 |
||
1751 |
procedure doStepCake(Gear: PGear); |
|
1752 |
var HHGear: PGear; |
|
1753 |
begin |
|
1754 |
AllInactive:= false; |
|
1755 |
||
1756 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1103 | 1757 |
HHGear^.Message:= HHGear^.Message and (not gm_Attack); |
1089 | 1758 |
DeleteCI(HHGear); |
1759 |
||
1106 | 1760 |
FollowGear:= Gear; |
1761 |
||
1089 | 1762 |
Gear^.doStep:= @doStepCakeFall |
1763 |
end; |
|
1764 |
||
1259 | 1765 |
//////////////////////////////////////////////////////////////////////////////// |
1284 | 1766 |
procedure doStepSeductionWork(Gear: PGear); |
1767 |
var x, y: LongInt; |
|
1259 | 1768 |
begin |
1769 |
AllInactive:= false; |
|
1284 | 1770 |
|
1771 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
1772 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1773 |
x:= hwRound(Gear^.X); |
|
1774 |
y:= hwRound(Gear^.Y); |
|
1259 | 1775 |
|
1284 | 1776 |
if ((y and $FFFFFC00) = 0) and ((x and $FFFFF800) = 0) then |
1777 |
if (Land[y, x] <> 0) then |
|
1778 |
begin |
|
1779 |
Gear^.dX.isNegative:= not Gear^.dX.isNegative; |
|
1780 |
Gear^.dY.isNegative:= not Gear^.dY.isNegative; |
|
1286 | 1781 |
Gear^.dX:= Gear^.dX * _1_5; |
1782 |
Gear^.dY:= Gear^.dY * _1_5 - _0_3; |
|
1284 | 1783 |
AmmoShove(Gear, 0, 40); |
1286 | 1784 |
AfterAttack; |
1284 | 1785 |
DeleteGear(Gear) |
1786 |
end |
|
1787 |
else |
|
1788 |
else |
|
1286 | 1789 |
begin |
1790 |
AfterAttack; |
|
1284 | 1791 |
DeleteGear(Gear) |
1286 | 1792 |
end |
1793 |
end; |
|
1794 |
||
1795 |
procedure doStepSeductionWear(Gear: PGear); |
|
1796 |
begin |
|
1797 |
AllInactive:= false; |
|
1798 |
inc(Gear^.Timer); |
|
1799 |
if Gear^.Timer > 250 then |
|
1800 |
begin |
|
1801 |
Gear^.Timer:= 0; |
|
1388 | 1802 |
inc(Gear^.Pos); |
1803 |
if Gear^.Pos = 5 then |
|
1804 |
PlaySound(sndYoohoo, false) |
|
1286 | 1805 |
end; |
1367 | 1806 |
|
1807 |
if Gear^.Pos = 14 then |
|
1286 | 1808 |
Gear^.doStep:= @doStepSeductionWork |
1259 | 1809 |
end; |
1284 | 1810 |
|
1811 |
procedure doStepSeduction(Gear: PGear); |
|
1812 |
begin |
|
1813 |
AllInactive:= false; |
|
1814 |
DeleteCI(PHedgehog(Gear^.Hedgehog)^.Gear); |
|
1286 | 1815 |
Gear^.doStep:= @doStepSeductionWear |
1284 | 1816 |
end; |
1298 | 1817 |
|
1818 |
//////////////////////////////////////////////////////////////////////////////// |
|
1819 |
procedure doStepWaterUp(Gear: PGear); |
|
1820 |
var i: LongWord; |
|
1821 |
begin |
|
1822 |
AllInactive:= false; |
|
1823 |
||
1824 |
inc(Gear^.Timer); |
|
1825 |
if Gear^.Timer = 17 then |
|
1826 |
Gear^.Timer:= 0 |
|
1827 |
else |
|
1828 |
exit; |
|
1829 |
||
1830 |
if cWaterLine > 0 then |
|
1831 |
begin |
|
1832 |
dec(cWaterLine); |
|
1833 |
for i:= 0 to 2047 do |
|
1834 |
Land[cWaterLine, i]:= 0; |
|
1835 |
SetAllToActive |
|
1836 |
end; |
|
1837 |
||
1838 |
inc(Gear^.Tag); |
|
1343 | 1839 |
if (Gear^.Tag = 47) or (cWaterLine = 0) then |
1298 | 1840 |
DeleteGear(Gear) |
1841 |
end; |
|
1573 | 1842 |
|
1843 |
//////////////////////////////////////////////////////////////////////////////// |
|
1590 | 1844 |
procedure doStepDrillDrilling(Gear: PGear); |
1633 | 1845 |
var t: PGearArray; |
1846 |
ox, oy: hwFloat; |
|
1573 | 1847 |
begin |
1590 | 1848 |
AllInactive:= false; |
1849 |
||
1633 | 1850 |
if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then |
1590 | 1851 |
begin |
1573 | 1852 |
ox:= Gear^.X; |
1853 |
oy:= Gear^.Y; |
|
1854 |
Gear^.X:= Gear^.X + Gear^.dX; |
|
1855 |
Gear^.Y:= Gear^.Y + Gear^.dY; |
|
1856 |
DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); |
|
1857 |
CheckGearDrowning(Gear); |
|
1590 | 1858 |
end; |
1859 |
||
1633 | 1860 |
t:= CheckGearsCollision(Gear); //fixes drill not exploding when touching HH bug |
1590 | 1861 |
if (Gear^.Timer = 0) |
1633 | 1862 |
or (t^.Count <> 0) |
1590 | 1863 |
or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) |
1864 |
and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then |
|
1865 |
begin //out of time or exited ground |
|
1866 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
1867 |
DeleteGear(Gear); |
|
1868 |
exit |
|
1869 |
end; |
|
1870 |
||
1871 |
dec(Gear^.Timer); |
|
1573 | 1872 |
end; |
1873 |
||
1874 |
procedure doStepDrill(Gear: PGear); |
|
1590 | 1875 |
var t: PGearArray; |
1633 | 1876 |
oldDx, oldDy: hwFloat; |
1877 |
t2: hwFloat; |
|
1573 | 1878 |
begin |
1590 | 1879 |
AllInactive:= false; |
1573 | 1880 |
|
1590 | 1881 |
Gear^.dX:= Gear^.dX + cWindSpeed; |
1882 |
oldDx:= Gear^.dX; |
|
1883 |
oldDy:= Gear^.dY; |
|
1884 |
||
1885 |
doStepFallingGear(Gear); |
|
1886 |
||
1887 |
if (GameTicks and $3F) = 0 then |
|
1888 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
|
1573 | 1889 |
|
1633 | 1890 |
if ((Gear^.State and gstCollision) <> 0) then begin //hit |
1590 | 1891 |
Gear^.dX:= oldDx; |
1892 |
Gear^.dY:= oldDy; |
|
1633 | 1893 |
|
1590 | 1894 |
t:= CheckGearsCollision(Gear); |
1633 | 1895 |
if (t^.Count = 0) then begin //hit the ground not the HH |
1896 |
t2 := _0_5 / Distance(Gear^.dX, Gear^.dY); |
|
1897 |
Gear^.dX:= Gear^.dX * t2; |
|
1898 |
Gear^.dY:= Gear^.dY * t2; |
|
1899 |
end else begin //explode right on contact with HH |
|
1900 |
doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
1901 |
DeleteGear(Gear); |
|
1902 |
exit; |
|
1903 |
end; |
|
1904 |
||
1590 | 1905 |
Gear^.doStep:= @doStepDrillDrilling; |
1633 | 1906 |
dec(Gear^.Timer) |
1590 | 1907 |
end |
1908 |
end; |
|
1601 | 1909 |
|
1633 | 1910 |
//////////////////////////////////////////////////////////////////////////////// |
1601 | 1911 |
procedure doStepBallgunWork(Gear: PGear); |
1912 |
var HHGear: PGear; |
|
1630 | 1913 |
rx, ry: hwFloat; |
1601 | 1914 |
begin |
1915 |
AllInactive:= false; |
|
1916 |
dec(Gear^.Timer); |
|
1917 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1918 |
HedgehogChAngle(HHGear); |
|
1919 |
if (Gear^.Timer mod 100) = 0 then |
|
1920 |
begin |
|
1630 | 1921 |
rx:= rndSign(getRandom * _0_1); |
1922 |
ry:= rndSign(getRandom * _0_1); |
|
1631
6e313b3818ef
Remove debug stuff, ballgun 64but incompatibility fixed in previous revision
unc0rr
parents:
1630
diff
changeset
|
1923 |
|
1630 | 1924 |
AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBall, 0, |
1925 |
SignAs(AngleSin(HHGear^.Angle) * _0_8, HHGear^.dX) + rx, |
|
1926 |
AngleCos(HHGear^.Angle) * ( - _0_8) + ry, |
|
1927 |
0); |
|
1601 | 1928 |
|
1929 |
PlaySound(sndGun, false); |
|
1930 |
end; |
|
1931 |
||
1932 |
if (Gear^.Timer = 0) then |
|
1933 |
begin |
|
1934 |
DeleteGear(Gear); |
|
1935 |
AfterAttack; |
|
1936 |
end |
|
1937 |
end; |
|
1938 |
||
1939 |
procedure doStepBallgun(Gear: PGear); |
|
1940 |
var HHGear: PGear; |
|
1941 |
begin |
|
1942 |
HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
|
1943 |
HHGear^.Message:= HHGear^.Message and not (gm_Up or gm_Down); |
|
1944 |
HHGear^.State:= HHGear^.State or gstNotKickable; |
|
1945 |
Gear^.doStep:= @doStepBallgunWork |
|
1633 | 1946 |
end; |