author | unc0rr |
Sat, 12 Aug 2006 17:41:02 +0000 | |
changeset 109 | ab0340f580c2 |
parent 108 | 08f1fe6f21f8 |
child 113 | d975a426ebf7 |
permissions | -rw-r--r-- |
4 | 1 |
(* |
2 |
* Hedgewars, a worms-like game |
|
79 | 3 |
* Copyright (c) 2004, 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com> |
4 | 4 |
* |
5 |
* Distributed under the terms of the BSD-modified licence: |
|
6 |
* |
|
7 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
8 |
* of this software and associated documentation files (the "Software"), to deal |
|
9 |
* with the Software without restriction, including without limitation the |
|
10 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
11 |
* sell copies of the Software, and to permit persons to whom the Software is |
|
12 |
* furnished to do so, subject to the following conditions: |
|
13 |
* |
|
14 |
* 1. Redistributions of source code must retain the above copyright notice, |
|
15 |
* this list of conditions and the following disclaimer. |
|
16 |
* 2. Redistributions in binary form must reproduce the above copyright notice, |
|
17 |
* this list of conditions and the following disclaimer in the documentation |
|
18 |
* and/or other materials provided with the distribution. |
|
19 |
* 3. The name of the author may not be used to endorse or promote products |
|
20 |
* derived from this software without specific prior written permission. |
|
21 |
* |
|
22 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
|
23 |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
24 |
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
|
25 |
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
26 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
27 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
|
28 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
|
29 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
30 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
|
31 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
32 |
*) |
|
33 |
||
34 |
procedure doStepDrowningGear(Gear: PGear); forward; |
|
35 |
||
36 |
function CheckGearDrowning(Gear: PGear): boolean; |
|
37 |
begin |
|
53 | 38 |
Result:= Gear.Y + Gear.Radius >= cWaterLine; |
4 | 39 |
if Result then |
40 |
begin |
|
41 |
Gear.State:= gstDrowning; |
|
42 |
Gear.doStep:= doStepDrowningGear; |
|
43 |
PlaySound(sndSplash) |
|
44 |
end |
|
45 |
end; |
|
46 |
||
47 |
procedure CheckCollision(Gear: PGear); |
|
48 |
begin |
|
108 | 49 |
if TestCollisionXwithGear(Gear, hwSign(Gear.X)) or TestCollisionYwithGear(Gear, hwSign(Gear.Y)) |
4 | 50 |
then Gear.State:= Gear.State or gstCollision |
51 |
else Gear.State:= Gear.State and not gstCollision |
|
52 |
end; |
|
53 |
||
54 |
procedure CheckHHDamage(Gear: PGear); |
|
55 |
begin |
|
71 | 56 |
if Gear.dY > 0.40 then Gear.Damage:= Gear.Damage + 1 + round(70 * (abs(Gear.dY) - 0.40)); |
4 | 57 |
end; |
58 |
||
59 |
//////////////////////////////////////////////////////////////////////////////// |
|
60 |
//////////////////////////////////////////////////////////////////////////////// |
|
61 |
procedure CalcRotationDirAngle(Gear: PGear); |
|
107 | 62 |
var dAngle: Double; |
4 | 63 |
begin |
64 |
dAngle:= (abs(Gear.dX) + abs(Gear.dY))*0.1; |
|
65 |
if Gear.dX >= 0 then Gear.DirAngle:= Gear.DirAngle + dAngle |
|
66 |
else Gear.DirAngle:= Gear.DirAngle - dAngle; |
|
67 |
if Gear.DirAngle < 0 then Gear.DirAngle:= Gear.DirAngle + 16 |
|
68 |
else if Gear.DirAngle >= 16 then Gear.DirAngle:= Gear.DirAngle - 16 |
|
69 |
end; |
|
70 |
||
71 |
//////////////////////////////////////////////////////////////////////////////// |
|
72 |
procedure doStepDrowningGear(Gear: PGear); |
|
73 |
begin |
|
74 |
AllInactive:= false; |
|
75 |
Gear.Y:= Gear.Y + cDrownSpeed; |
|
75 | 76 |
if round(Gear.Y) > Gear.Radius + cWaterLine + cVisibleWater then DeleteGear(Gear) |
4 | 77 |
end; |
78 |
||
79 |
//////////////////////////////////////////////////////////////////////////////// |
|
80 |
procedure doStepFallingGear(Gear: PGear); |
|
81 |
var b: boolean; |
|
82 |
begin |
|
108 | 83 |
if TestCollisionYwithGear(Gear, hwSign(Gear.dY)) then |
4 | 84 |
begin |
85 |
Gear.dX:= Gear.dX * Gear.Friction; |
|
86 |
Gear.dY:= - Gear.dY * Gear.Elasticity; |
|
87 |
b:= false |
|
88 |
end else b:= true; |
|
108 | 89 |
if TestCollisionXwithGear(Gear, hwSign(Gear.dX)) then |
4 | 90 |
begin |
91 |
Gear.dX:= - Gear.dX * Gear.Elasticity; |
|
92 |
// Gear.dY:= Gear.dY; |
|
93 |
b:= false |
|
94 |
end; |
|
95 |
if b then |
|
96 |
begin |
|
97 |
Gear.dY:= Gear.dY + cGravity; |
|
98 |
Gear.State:= Gear.State and not gstCollision |
|
99 |
end else |
|
100 |
begin |
|
101 |
if sqr(Gear.dX) + sqr(Gear.dY) < 0.00001 then |
|
102 |
if (Gear.Timer = 0) then Gear.Active:= false |
|
103 |
else begin |
|
104 |
Gear.dX:= 0; |
|
105 |
Gear.dY:= 0 |
|
106 |
end; |
|
107 |
Gear.State:= Gear.State or gstCollision |
|
108 |
end; |
|
109 |
Gear.X:= Gear.X + Gear.dX; |
|
110 |
Gear.Y:= Gear.Y + Gear.dY; |
|
111 |
CheckGearDrowning(Gear); |
|
112 |
if (sqr(Gear.dX) + sqr(Gear.dY) < 0.003) then Gear.State:= Gear.State and not gstMoving |
|
113 |
else Gear.State:= Gear.State or gstMoving |
|
114 |
end; |
|
115 |
||
116 |
//////////////////////////////////////////////////////////////////////////////// |
|
117 |
procedure doStepCloud(Gear: PGear); |
|
118 |
begin |
|
119 |
Gear.X:= Gear.X + cWindSpeed * 200 + Gear.dX; |
|
74 | 120 |
if Gear.Y > -160 then Gear.dY:= Gear.dY - 0.00002 |
121 |
else Gear.dY:= Gear.dY + 0.00002; |
|
122 |
Gear.Y:= Gear.Y + Gear.dY; |
|
123 |
if Gear.X < -cScreenWidth - 256 then Gear.X:= cScreenWidth + 2048 else |
|
4 | 124 |
if Gear.X > cScreenWidth + 2048 then Gear.X:= -cScreenWidth - 256 |
125 |
end; |
|
126 |
||
127 |
//////////////////////////////////////////////////////////////////////////////// |
|
128 |
procedure doStepBomb(Gear: PGear); |
|
78 | 129 |
var i: integer; |
4 | 130 |
begin |
131 |
AllInactive:= false; |
|
132 |
doStepFallingGear(Gear); |
|
133 |
dec(Gear.Timer); |
|
134 |
if Gear.Timer = 0 then |
|
135 |
begin |
|
78 | 136 |
case Gear.Kind of |
137 |
gtAmmo_Bomb: doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
|
138 |
gtClusterBomb: begin |
|
139 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 30, EXPLAutoSound); |
|
140 |
for i:= 0 to 4 do |
|
79 | 141 |
AddGear(round(Gear.X), round(Gear.Y), gtCluster, 0, (getrandom - 0.5)*0.2, (getrandom - 3) * 0.08); |
78 | 142 |
end |
143 |
end; |
|
4 | 144 |
DeleteGear(Gear); |
145 |
exit |
|
146 |
end; |
|
147 |
CalcRotationDirAngle(Gear); |
|
148 |
if (Gear.State and (gstCollision or gstMoving)) = (gstCollision or gstMoving) then PlaySound(sndGrenadeImpact) |
|
149 |
end; |
|
150 |
||
78 | 151 |
procedure doStepCluster(Gear: PGear); |
152 |
begin |
|
153 |
AllInactive:= false; |
|
154 |
doStepFallingGear(Gear); |
|
155 |
if (Gear.State and gstCollision) <> 0 then |
|
156 |
begin |
|
157 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 20, EXPLAutoSound); |
|
158 |
DeleteGear(Gear); |
|
159 |
exit |
|
160 |
end; |
|
161 |
if (GameTicks and $1F) = 0 then |
|
162 |
AddGear(round(Gear.X), round(Gear.Y), gtSmokeTrace, 0) |
|
163 |
end; |
|
164 |
||
4 | 165 |
//////////////////////////////////////////////////////////////////////////////// |
166 |
procedure doStepGrenade(Gear: PGear); |
|
167 |
begin |
|
168 |
AllInactive:= false; |
|
169 |
Gear.dX:= Gear.dX + cWindSpeed; |
|
170 |
doStepFallingGear(Gear); |
|
171 |
if (Gear.State and gstCollision) <> 0 then |
|
172 |
begin |
|
173 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
|
174 |
DeleteGear(Gear); |
|
175 |
exit |
|
176 |
end; |
|
177 |
if (GameTicks and $3F) = 0 then |
|
178 |
AddGear(round(Gear.X), round(Gear.Y), gtSmokeTrace, 0) |
|
179 |
end; |
|
180 |
||
181 |
//////////////////////////////////////////////////////////////////////////////// |
|
95 | 182 |
procedure doStepHealthTagWork(Gear: PGear); |
4 | 183 |
begin |
184 |
AllInactive:= false; |
|
185 |
dec(Gear.Timer); |
|
186 |
Gear.Y:= Gear.Y - 0.07; |
|
187 |
if Gear.Timer = 0 then |
|
188 |
begin |
|
189 |
PHedgehog(Gear.Hedgehog).Gear.Active:= true; |
|
190 |
DeleteGear(Gear) |
|
191 |
end |
|
192 |
end; |
|
193 |
||
95 | 194 |
procedure doStepHealthTag(Gear: PGear); |
195 |
var s: shortstring; |
|
196 |
begin |
|
197 |
AllInactive:= false; |
|
198 |
str(Gear.State, s); |
|
199 |
Gear.Surf:= RenderString(s, PHedgehog(Gear.Hedgehog).Team.Color, fnt16); |
|
200 |
Gear.doStep:= doStepHealthTagWork |
|
201 |
end; |
|
202 |
||
4 | 203 |
//////////////////////////////////////////////////////////////////////////////// |
204 |
procedure doStepGrave(Gear: PGear); |
|
205 |
begin |
|
206 |
AllInactive:= false; |
|
207 |
if Gear.dY < 0 then |
|
68 | 208 |
if TestCollisionY(Gear, -1) then Gear.dY:= 0; |
4 | 209 |
|
210 |
if Gear.dY >=0 then |
|
68 | 211 |
if TestCollisionY(Gear, 1) then |
4 | 212 |
begin |
213 |
Gear.dY:= - Gear.dY * Gear.Elasticity; |
|
214 |
if Gear.dY > - 0.001 then |
|
215 |
begin |
|
216 |
Gear.Active:= false; |
|
217 |
exit |
|
218 |
end else if Gear.dY < - 0.03 then PlaySound(sndGraveImpact) |
|
219 |
end; |
|
220 |
Gear.Y:= Gear.Y + Gear.dY; |
|
221 |
CheckGearDrowning(Gear); |
|
222 |
Gear.dY:= Gear.dY + cGravity |
|
223 |
end; |
|
224 |
||
225 |
//////////////////////////////////////////////////////////////////////////////// |
|
226 |
procedure doStepUFOWork(Gear: PGear); |
|
107 | 227 |
var t: Double; |
4 | 228 |
begin |
229 |
AllInactive:= false; |
|
230 |
t:= sqrt(sqr(Gear.dX) + sqr(Gear.dY)); |
|
231 |
Gear.dX:= Gear.Elasticity * (Gear.dX + 0.000004 * (TargetPoint.X - trunc(Gear.X))); |
|
232 |
Gear.dY:= Gear.Elasticity * (Gear.dY + 0.000004 * (TargetPoint.Y - trunc(Gear.Y))); |
|
233 |
t:= t / (sqrt(sqr(Gear.dX) + sqr(Gear.dY))); |
|
234 |
Gear.dX:= Gear.dX * t; |
|
235 |
Gear.dY:= Gear.dY * t; |
|
236 |
Gear.X:= Gear.X + Gear.dX; |
|
237 |
Gear.Y:= Gear.Y + Gear.dY; |
|
238 |
CheckCollision(Gear); |
|
239 |
dec(Gear.Timer); |
|
240 |
if ((Gear.State and gstCollision) <> 0) or (Gear.Timer = 0) then |
|
241 |
begin |
|
242 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
|
243 |
DeleteGear(Gear); |
|
244 |
end; |
|
245 |
end; |
|
246 |
||
247 |
procedure doStepUFO(Gear: PGear); |
|
248 |
begin |
|
249 |
AllInactive:= false; |
|
250 |
Gear.X:= Gear.X + Gear.dX; |
|
251 |
Gear.Y:= Gear.Y + Gear.dY; |
|
252 |
Gear.dY:= Gear.dY + cGravity; |
|
253 |
CheckCollision(Gear); |
|
254 |
if (Gear.State and gstCollision) <> 0 then |
|
255 |
begin |
|
256 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
|
257 |
DeleteGear(Gear); |
|
258 |
exit |
|
259 |
end; |
|
260 |
dec(Gear.Timer); |
|
261 |
if Gear.Timer = 0 then |
|
262 |
begin |
|
263 |
Gear.Timer:= 5000; |
|
264 |
Gear.doStep:= doStepUFOWork |
|
265 |
end; |
|
266 |
end; |
|
267 |
||
268 |
//////////////////////////////////////////////////////////////////////////////// |
|
269 |
procedure doStepShotgunShot(Gear: PGear); |
|
270 |
var i: LongWord; |
|
271 |
begin |
|
272 |
AllInactive:= false; |
|
273 |
if Gear.Timer > 0 then |
|
274 |
begin |
|
275 |
dec(Gear.Timer); |
|
95 | 276 |
if Gear.Timer = 0 then PlaySound(sndShotgunFire); |
4 | 277 |
exit |
278 |
end; |
|
279 |
i:= 200; |
|
280 |
repeat |
|
281 |
Gear.X:= Gear.X + Gear.dX; |
|
282 |
Gear.Y:= Gear.Y + Gear.dY; |
|
283 |
CheckCollision(Gear); |
|
284 |
if (Gear.State and gstCollision) <> 0 then |
|
285 |
begin |
|
75 | 286 |
AmmoShove(Gear, 25, 25); |
42 | 287 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 25, EXPLNoDamage or EXPLDoNotTouchHH); |
4 | 288 |
DeleteGear(Gear); |
75 | 289 |
AfterAttack; |
4 | 290 |
exit |
291 |
end; |
|
292 |
dec(i) |
|
293 |
until i = 0; |
|
294 |
if (Gear.X < 0) or (Gear.Y < 0) or (Gear.X > 2048) or (Gear.Y > 1024) then |
|
95 | 295 |
begin |
296 |
DeleteGear(Gear); |
|
297 |
AfterAttack |
|
298 |
end |
|
4 | 299 |
end; |
300 |
||
301 |
//////////////////////////////////////////////////////////////////////////////// |
|
38 | 302 |
procedure doStepDEagleShot(Gear: PGear); |
303 |
var i, x, y: LongWord; |
|
107 | 304 |
oX, oY: Double; |
38 | 305 |
begin |
306 |
AllInactive:= false; |
|
37 | 307 |
i:= 80; |
38 | 308 |
oX:= Gear.X; |
309 |
oY:= Gear.Y; |
|
37 | 310 |
repeat |
38 | 311 |
Gear.X:= Gear.X + Gear.dX; |
312 |
Gear.Y:= Gear.Y + Gear.dY; |
|
313 |
x:= round(Gear.X); |
|
314 |
y:= round(Gear.Y); |
|
315 |
if ((y and $FFFFFC00) = 0) and ((x and $FFFFF800) = 0) |
|
316 |
and (Land[y, x] <> 0) then inc(Gear.Damage); |
|
75 | 317 |
AmmoShove(Gear, 7, 20); |
38 | 318 |
dec(i) |
319 |
until (i = 0) or (Gear.Damage > Gear.Health); |
|
320 |
if Gear.Damage > 0 then |
|
37 | 321 |
begin |
38 | 322 |
DrawTunnel(oX, oY, Gear.dX, Gear.dY, 82 - i, 1); |
323 |
dec(Gear.Health, Gear.Damage); |
|
324 |
Gear.Damage:= 0 |
|
37 | 325 |
end; |
38 | 326 |
if (Gear.Health <= 0) or (Gear.X < 0) or (Gear.Y < 0) or (Gear.X > 2048) or (Gear.Y > 1024) then |
37 | 327 |
DeleteGear(Gear) |
328 |
end; |
|
329 |
||
330 |
//////////////////////////////////////////////////////////////////////////////// |
|
4 | 331 |
procedure doStepActionTimer(Gear: PGear); |
332 |
begin |
|
83 | 333 |
dec(Gear.Timer); |
334 |
case Gear.Kind of |
|
335 |
gtATStartGame: begin |
|
4 | 336 |
AllInactive:= false; |
83 | 337 |
if Gear.Timer = 0 then |
338 |
AddCaption(trmsg[sidStartFight], $FFFFFF, capgrpGameState); |
|
4 | 339 |
end; |
83 | 340 |
gtATSmoothWindCh: begin |
6 | 341 |
if Gear.Timer = 0 then |
342 |
begin |
|
343 |
if WindBarWidth < Gear.Tag then inc(WindBarWidth) |
|
83 | 344 |
else if WindBarWidth > Gear.Tag then dec(WindBarWidth); |
345 |
if WindBarWidth <> Gear.Tag then Gear.Timer:= 10; |
|
346 |
end |
|
347 |
end; |
|
348 |
gtATFinishGame: begin |
|
349 |
AllInactive:= false; |
|
350 |
if Gear.Timer = 0 then |
|
351 |
GameState:= gsExit |
|
6 | 352 |
end; |
4 | 353 |
end; |
83 | 354 |
if Gear.Timer = 0 then DeleteGear(Gear) |
4 | 355 |
end; |
356 |
||
357 |
//////////////////////////////////////////////////////////////////////////////// |
|
358 |
procedure doStepPickHammerWork(Gear: PGear); |
|
359 |
var i, ei: integer; |
|
360 |
HHGear: PGear; |
|
361 |
begin |
|
70 | 362 |
AllInactive:= false; |
4 | 363 |
dec(Gear.Timer); |
364 |
if (Gear.Timer = 0)or((Gear.Message and gm_Destroy) <> 0) then |
|
365 |
begin |
|
366 |
DeleteGear(Gear); |
|
367 |
AfterAttack; |
|
368 |
exit |
|
369 |
end; |
|
370 |
HHGear:= PHedgehog(Gear.Hedgehog).Gear; |
|
371 |
if (Gear.Timer and $3F) = 0 then |
|
372 |
begin |
|
53 | 373 |
i:= round(Gear.X) - Gear.Radius - GetRandom(2); |
374 |
ei:= round(Gear.X) + Gear.Radius + GetRandom(2); |
|
4 | 375 |
while i <= ei do |
376 |
begin |
|
377 |
doMakeExplosion(i, round(Gear.Y) + 3, 3, 0); |
|
378 |
inc(i, 1) |
|
379 |
end; |
|
380 |
Gear.X:= Gear.X + Gear.dX; |
|
42 | 381 |
Gear.Y:= Gear.Y + 1.9; |
382 |
SetAllHHToActive; |
|
4 | 383 |
end; |
384 |
if TestCollisionYwithGear(Gear, 1) then |
|
385 |
begin |
|
386 |
Gear.dY:= 0; |
|
108 | 387 |
HHGear.dX:= 0.0000001 * hwSign(PGear(Gear.Hedgehog).dX); |
4 | 388 |
HHGear.dY:= 0; |
389 |
end else |
|
390 |
begin |
|
391 |
Gear.dY:= Gear.dY + cGravity; |
|
392 |
Gear.Y:= Gear.Y + Gear.dY; |
|
393 |
if Gear.Y > 1024 then Gear.Timer:= 1 |
|
394 |
end; |
|
395 |
||
396 |
Gear.X:= Gear.X + HHGear.dX; |
|
397 |
HHGear.X:= Gear.X; |
|
53 | 398 |
HHGear.Y:= Gear.Y - cHHRadius; |
4 | 399 |
|
400 |
if (Gear.Message and gm_Attack) <> 0 then |
|
401 |
if (Gear.State and gsttmpFlag) <> 0 then Gear.Timer:= 1 else else |
|
402 |
if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag; |
|
403 |
if ((Gear.Message and gm_Left) <> 0) then Gear.dX:= -0.3 else |
|
404 |
if ((Gear.Message and gm_Right) <> 0) then Gear.dX:= 0.3 |
|
405 |
else Gear.dX:= 0; |
|
406 |
end; |
|
407 |
||
408 |
procedure doStepPickHammer(Gear: PGear); |
|
409 |
var i, y: integer; |
|
410 |
ar: TRangeArray; |
|
411 |
begin |
|
412 |
i:= 0; |
|
53 | 413 |
y:= round(Gear.Y) - cHHRadius*2; |
4 | 414 |
while y < round(Gear.Y) do |
415 |
begin |
|
53 | 416 |
ar[i].Left := round(Gear.X) - Gear.Radius - GetRandom(2); |
417 |
ar[i].Right:= round(Gear.X) + Gear.Radius + GetRandom(2); |
|
4 | 418 |
inc(y, 2); |
419 |
inc(i) |
|
420 |
end; |
|
53 | 421 |
DrawHLinesExplosions(@ar, 3, round(Gear.Y) - cHHRadius*2, 2, Pred(i)); |
4 | 422 |
Gear.dY:= PHedgehog(Gear.Hedgehog).Gear.dY; |
423 |
doStepPickHammerWork(Gear); |
|
424 |
Gear.doStep:= doStepPickHammerWork |
|
425 |
end; |
|
426 |
||
427 |
//////////////////////////////////////////////////////////////////////////////// |
|
428 |
procedure doStepRopeWork(Gear: PGear); |
|
70 | 429 |
const flCheck: boolean = false; |
4 | 430 |
var HHGear: PGear; |
107 | 431 |
len, cs, cc, tx, ty: Double; |
108 | 432 |
lx, ly: LongInt; |
4 | 433 |
|
434 |
procedure DeleteMe; |
|
435 |
begin |
|
436 |
with HHGear^ do |
|
437 |
begin |
|
438 |
Message:= Message and not gm_Attack; |
|
439 |
State:= State or gstFalling; |
|
440 |
end; |
|
441 |
DeleteGear(Gear); |
|
442 |
OnUsedAmmo(PHedgehog(Gear.Hedgehog)^.Ammo); |
|
70 | 443 |
ApplyAmmoChanges(PHedgehog(Gear.Hedgehog)^) |
4 | 444 |
end; |
445 |
||
446 |
begin |
|
447 |
HHGear:= PHedgehog(Gear.Hedgehog).Gear; |
|
108 | 448 |
|
80 | 449 |
if ((HHGear.State and gstHHDriven) = 0) |
450 |
or (CheckGearDrowning(HHGear)) then |
|
4 | 451 |
begin |
452 |
DeleteMe; |
|
453 |
exit |
|
454 |
end; |
|
455 |
Gear.dX:= HHGear.X - Gear.X; |
|
456 |
Gear.dY:= HHGear.Y - Gear.Y; |
|
457 |
||
458 |
if (Gear.Message and gm_Left <> 0) then HHGear.dX:= HHGear.dX - 0.0002 else |
|
459 |
if (Gear.Message and gm_Right <> 0) then HHGear.dX:= HHGear.dX + 0.0002; |
|
460 |
||
461 |
if not TestCollisionYwithGear(HHGear, 1) then HHGear.dY:= HHGear.dY + cGravity; |
|
462 |
||
108 | 463 |
cs:= Gear.dY + HHGear.dY; |
464 |
cc:= Gear.dX + HHGear.dX; |
|
465 |
len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
|
466 |
cc:= cc * len; |
|
467 |
cs:= cs * len; |
|
4 | 468 |
|
469 |
flCheck:= not flCheck; |
|
470 |
if flCheck then // check whether rope needs dividing |
|
471 |
begin |
|
472 |
len:= Gear.Elasticity - 20; |
|
473 |
while len > 5 do |
|
474 |
begin |
|
475 |
tx:= cc*len; |
|
476 |
ty:= cs*len; |
|
108 | 477 |
lx:= round(Gear.X + tx) + hwSign(HHGear.dX); |
478 |
ly:= round(Gear.Y + ty) + hwSign(HHGear.dY); |
|
4 | 479 |
if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then |
480 |
begin |
|
481 |
with RopePoints.ar[RopePoints.Count] do |
|
482 |
begin |
|
483 |
X:= Gear.X; |
|
484 |
Y:= Gear.Y; |
|
485 |
if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle32(Gear.dY, Gear.dX); |
|
486 |
b:= (cc * HHGear.dY) > (cs * HHGear.dX); |
|
487 |
dLen:= len |
|
488 |
end; |
|
489 |
Gear.X:= Gear.X + tx; |
|
490 |
Gear.Y:= Gear.Y + ty; |
|
491 |
inc(RopePoints.Count); |
|
492 |
Gear.Elasticity:= Gear.Elasticity - len; |
|
493 |
Gear.Friction:= Gear.Friction - len; |
|
494 |
break |
|
495 |
end; |
|
496 |
len:= len - 3 |
|
497 |
end; |
|
498 |
end else |
|
499 |
if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
|
500 |
begin |
|
501 |
tx:= RopePoints.ar[Pred(RopePoints.Count)].X; |
|
502 |
ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; |
|
503 |
if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear.X) * (ty - HHGear.Y) > (tx - HHGear.X) * (ty - Gear.Y)) then |
|
504 |
begin |
|
505 |
dec(RopePoints.Count); |
|
506 |
Gear.X:=RopePoints.ar[RopePoints.Count].X; |
|
507 |
Gear.Y:=RopePoints.ar[RopePoints.Count].Y; |
|
508 |
Gear.Elasticity:= Gear.Elasticity + RopePoints.ar[RopePoints.Count].dLen; |
|
509 |
Gear.Friction:= Gear.Friction + RopePoints.ar[RopePoints.Count].dLen |
|
510 |
end |
|
511 |
end; |
|
512 |
||
513 |
Gear.dX:= HHGear.X - Gear.X; |
|
514 |
Gear.dY:= HHGear.Y - Gear.Y; |
|
108 | 515 |
|
516 |
cs:= Gear.dY + HHGear.dY; |
|
517 |
cc:= Gear.dX + HHGear.dX; |
|
518 |
len:= 1 / sqrt(sqr(cc)+sqr(cs)); |
|
519 |
cc:= cc * len; |
|
520 |
cs:= cs * len; |
|
4 | 521 |
|
522 |
HHGear.dX:= HHGear.X; |
|
523 |
HHGear.dY:= HHGear.Y; |
|
524 |
||
525 |
if ((Gear.Message and gm_Down) <> 0) and (Gear.Elasticity < Gear.Friction) then |
|
108 | 526 |
if not (TestCollisionXwithGear(HHGear, hwSign(Gear.dX)) |
527 |
or TestCollisionYwithGear(HHGear, hwSign(Gear.dY))) then Gear.Elasticity:= Gear.Elasticity + 0.3; |
|
4 | 528 |
|
529 |
if ((Gear.Message and gm_Up) <> 0) and (Gear.Elasticity > 30) then |
|
108 | 530 |
if not (TestCollisionXwithGear(HHGear, -hwSign(Gear.dX)) |
531 |
or TestCollisionYwithGear(HHGear, -hwSign(Gear.dY))) then Gear.Elasticity:= Gear.Elasticity - 0.3; |
|
4 | 532 |
|
533 |
HHGear.X:= Gear.X + cc*Gear.Elasticity; |
|
534 |
HHGear.Y:= Gear.Y + cs*Gear.Elasticity; |
|
535 |
||
536 |
HHGear.dX:= HHGear.X - HHGear.dX; |
|
537 |
HHGear.dY:= HHGear.Y - HHGear.dY; |
|
538 |
||
108 | 539 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear.dX)) then |
75 | 540 |
HHGear.dX:= -0.6 * HHGear.dX; |
108 | 541 |
if TestCollisionYwithGear(HHGear, hwSign(HHGear.dY)) then |
75 | 542 |
HHGear.dY:= -0.6 * HHGear.dY; |
4 | 543 |
|
544 |
if (Gear.Message and gm_Attack) <> 0 then |
|
545 |
if (Gear.State and gsttmpFlag) <> 0 then DeleteMe else |
|
546 |
else if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag; |
|
547 |
end; |
|
548 |
||
549 |
||
550 |
procedure doStepRopeAttach(Gear: PGear); |
|
551 |
var HHGear: PGear; |
|
107 | 552 |
tx, ty, tt: Double; |
4 | 553 |
begin |
554 |
Gear.X:= Gear.X + Gear.dX; |
|
555 |
Gear.Y:= Gear.Y + Gear.dY; |
|
556 |
Gear.Elasticity:= Gear.Elasticity + 1.0; |
|
557 |
HHGear:= PHedgehog(Gear.Hedgehog)^.Gear; |
|
558 |
if (HHGear.State and gstFalling) <> 0 then |
|
68 | 559 |
if TestCollisionYwithGear(HHGear, 1) then |
4 | 560 |
begin |
561 |
HHGear.dY:= 0; |
|
562 |
CheckHHDamage(HHGear); |
|
563 |
HHGear.State:= HHGear.State and not (gstFalling or gstHHJumping); |
|
564 |
end else |
|
565 |
begin |
|
108 | 566 |
if TestCollisionXwithGear(HHGear, hwSign(HHGear.dX)) then HHGear.dX:= 0.0000001 * hwSign(HHGear.dX); |
4 | 567 |
HHGear.X:= HHGear.X + HHGear.dX; |
568 |
HHGear.Y:= HHGear.Y + HHGear.dY; |
|
569 |
Gear.X:= Gear.X + HHGear.dX; |
|
570 |
Gear.Y:= Gear.Y + HHGear.dY; |
|
571 |
HHGear.dY:= HHGear.dY + cGravity; |
|
572 |
tt:= Gear.Elasticity; |
|
573 |
tx:= 0; |
|
574 |
ty:= 0; |
|
575 |
while tt > 20 do |
|
576 |
begin |
|
108 | 577 |
if TestCollisionXwithXYShift(Gear, round(tx), round(ty), hwSign(Gear.dX)) |
578 |
or TestCollisionYwithXYShift(Gear, round(tx), round(ty), hwSign(Gear.dY)) then |
|
4 | 579 |
begin |
580 |
Gear.X:= Gear.X + tx; |
|
581 |
Gear.Y:= Gear.Y + ty; |
|
582 |
Gear.Elasticity:= tt; |
|
583 |
Gear.doStep:= doStepRopeWork; |
|
584 |
with HHGear^ do State:= State and not gstAttacking; |
|
585 |
tt:= 0 |
|
586 |
end; |
|
587 |
tx:= tx - Gear.dX - Gear.dX; |
|
588 |
ty:= ty - Gear.dY - Gear.dY; |
|
589 |
tt:= tt - 2.0; |
|
590 |
end; |
|
591 |
end; |
|
592 |
CheckCollision(Gear); |
|
593 |
if (Gear.State and gstCollision) <> 0 then |
|
594 |
begin |
|
595 |
Gear.doStep:= doStepRopeWork; |
|
596 |
with HHGear^ do State:= State and not gstAttacking; |
|
597 |
if Gear.Elasticity < 10 then |
|
598 |
Gear.Elasticity:= 10000; |
|
599 |
end; |
|
600 |
||
601 |
if (Gear.Elasticity >= Gear.Friction) or ((Gear.Message and gm_Attack) = 0) then |
|
602 |
begin |
|
603 |
with PHedgehog(Gear.Hedgehog).Gear^ do |
|
604 |
begin |
|
605 |
State:= State and not gstAttacking; |
|
606 |
Message:= Message and not gm_Attack |
|
607 |
end; |
|
608 |
DeleteGear(Gear) |
|
609 |
end |
|
610 |
end; |
|
611 |
||
612 |
procedure doStepRope(Gear: PGear); |
|
613 |
begin |
|
614 |
Gear.doStep:= doStepRopeAttach |
|
615 |
end; |
|
616 |
||
617 |
//////////////////////////////////////////////////////////////////////////////// |
|
618 |
procedure doStepSmokeTrace(Gear: PGear); |
|
619 |
begin |
|
620 |
inc(Gear.Timer); |
|
621 |
if Gear.Timer > 64 then |
|
622 |
begin |
|
623 |
Gear.Timer:= 0; |
|
9 | 624 |
dec(Gear.State) |
4 | 625 |
end; |
626 |
Gear.dX:= Gear.dX + cWindSpeed; |
|
627 |
Gear.X:= Gear.X + Gear.dX; |
|
9 | 628 |
if Gear.State = 0 then DeleteGear(Gear) |
4 | 629 |
end; |
9 | 630 |
|
631 |
//////////////////////////////////////////////////////////////////////////////// |
|
632 |
procedure doStepExplosion(Gear: PGear); |
|
633 |
begin |
|
634 |
inc(Gear.Timer); |
|
635 |
if Gear.Timer > 75 then |
|
636 |
begin |
|
637 |
inc(Gear.State); |
|
638 |
Gear.Timer:= 0; |
|
639 |
if Gear.State > 5 then DeleteGear(Gear) |
|
640 |
end; |
|
641 |
end; |
|
10 | 642 |
|
643 |
//////////////////////////////////////////////////////////////////////////////// |
|
644 |
procedure doStepMine(Gear: PGear); |
|
645 |
begin |
|
39 | 646 |
if (Gear.dX <> 0) or (Gear.dY <> 0) then |
10 | 647 |
begin |
53 | 648 |
if Gear.CollIndex < High(Longword) then DeleteCI(Gear); |
10 | 649 |
doStepFallingGear(Gear); |
13 | 650 |
if Gear.Active = false then |
651 |
begin |
|
53 | 652 |
if Gear.CollIndex = High(Longword) then AddGearCI(Gear); |
13 | 653 |
Gear.dX:= 0; |
654 |
Gear.dY:= 0 |
|
655 |
end; |
|
656 |
CalcRotationDirAngle(Gear); |
|
10 | 657 |
AllInactive:= false |
658 |
end; |
|
39 | 659 |
|
10 | 660 |
if ((Gear.State and gsttmpFlag) <> 0) then |
661 |
if ((Gear.State and gstAttacking) = 0) then |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
662 |
begin |
39 | 663 |
if ((GameTicks and $F) = 0) then |
15 | 664 |
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
|
665 |
end else // gstAttacking <> 0 |
10 | 666 |
begin |
667 |
AllInactive:= false; |
|
37 | 668 |
if (Gear.Timer and $FF) = 0 then PlaySound(sndMineTick); |
10 | 669 |
if Gear.Timer = 0 then |
670 |
begin |
|
13 | 671 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
10 | 672 |
DeleteGear(Gear) |
673 |
end; |
|
13 | 674 |
dec(Gear.Timer); |
675 |
end else // gsttmpFlag = 0 |
|
676 |
if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag; |
|
10 | 677 |
end; |
57 | 678 |
|
39 | 679 |
//////////////////////////////////////////////////////////////////////////////// |
680 |
procedure doStepDynamite(Gear: PGear); |
|
681 |
begin |
|
43 | 682 |
doStepFallingGear(Gear); |
683 |
AllInactive:= false; |
|
684 |
if Gear.Timer mod 166 = 0 then inc(Gear.Tag); |
|
685 |
if Gear.Timer = 0 then |
|
39 | 686 |
begin |
46 | 687 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 75, EXPLAutoSound); |
43 | 688 |
DeleteGear(Gear); |
689 |
exit |
|
39 | 690 |
end; |
43 | 691 |
dec(Gear.Timer); |
39 | 692 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
693 |
|
15 | 694 |
//////////////////////////////////////////////////////////////////////////////// |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
695 |
procedure doStepCase(Gear: PGear); |
89 | 696 |
var i, x, y: integer; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
697 |
begin |
15 | 698 |
if (Gear.Message and gm_Destroy) > 0 then |
699 |
begin |
|
700 |
DeleteGear(Gear); |
|
701 |
exit |
|
702 |
end; |
|
703 |
||
79 | 704 |
if Gear.Damage > 0 then |
705 |
begin |
|
89 | 706 |
x:= round(Gear.X); |
707 |
y:= round(Gear.Y); |
|
79 | 708 |
DeleteGear(Gear); |
89 | 709 |
doMakeExplosion(x, y, 25, EXPLAutoSound); |
79 | 710 |
for i:= 0 to 63 do |
89 | 711 |
AddGear(x, y, gtFlame, 0); |
79 | 712 |
exit |
713 |
end; |
|
714 |
||
53 | 715 |
if (Gear.dY <> 0) or (not TestCollisionYwithGear(Gear, 1)) then |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
716 |
begin |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
717 |
AllInactive:= false; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
718 |
Gear.dY:= Gear.dY + cGravity; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
719 |
Gear.Y:= Gear.Y + Gear.dY; |
53 | 720 |
if (Gear.dY < 0) and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0 else |
721 |
if (Gear.dY >= 0) and TestCollisionYwithGear(Gear, 1) then |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
722 |
begin |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
723 |
Gear.dY:= - Gear.dY * Gear.Elasticity; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
724 |
if Gear.dY > - 0.001 then Gear.dY:= 0 |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
725 |
else if Gear.dY < - 0.03 then PlaySound(sndGraveImpact); |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
726 |
end; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
727 |
CheckGearDrowning(Gear); |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
728 |
end; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
729 |
|
53 | 730 |
if (Gear.CollIndex = High(Longword)) and (Gear.dY = 0) then AddGearCI(Gear) |
731 |
else if (Gear.CollIndex < High(Longword)) and (Gear.dY <> 0) then DeleteCI(Gear); |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
732 |
end; |
49 | 733 |
|
734 |
//////////////////////////////////////////////////////////////////////////////// |
|
735 |
var thexchar: array[0..5] of record |
|
736 |
oy, ny: integer; |
|
737 |
team: PTeam; |
|
738 |
end; |
|
739 |
thexchcnt: Longword; |
|
740 |
||
741 |
procedure doStepTeamHealthSorterWork(Gear: PGear); |
|
742 |
var i: integer; |
|
743 |
begin |
|
744 |
AllInactive:= false; |
|
745 |
dec(Gear.Timer); |
|
746 |
if (Gear.Timer and 15) = 0 then |
|
747 |
for i:= 0 to Pred(thexchcnt) do |
|
748 |
with thexchar[i] do |
|
749 |
{$WARNINGS OFF} |
|
750 |
team.DrawHealthY:= ny + (oy - ny) * Gear.Timer div 640; |
|
751 |
{$WARNINGS ON} |
|
752 |
if Gear.Timer = 0 then |
|
753 |
DeleteGear(Gear) |
|
754 |
end; |
|
755 |
||
756 |
procedure doStepTeamHealthSorter(Gear: PGear); |
|
757 |
var team: PTeam; |
|
758 |
i, t: Longword; |
|
759 |
begin |
|
760 |
AllInactive:= false; |
|
761 |
team:= TeamsList; |
|
762 |
i:= 0; |
|
763 |
while team <> nil do |
|
764 |
begin |
|
765 |
thexchar[i].oy:= team.DrawHealthY; |
|
766 |
thexchar[i].team:= team; |
|
767 |
inc(i); |
|
768 |
team:= team.Next |
|
769 |
end; |
|
770 |
thexchcnt:= i; |
|
771 |
for i:= 1 to thexchcnt do |
|
772 |
for t:= 0 to thexchcnt - 2 do |
|
773 |
if thexchar[t].team.TeamHealth > thexchar[Succ(t)].team.TeamHealth then |
|
774 |
begin |
|
775 |
thexchar[5]:= thexchar[t]; |
|
776 |
thexchar[t]:= thexchar[Succ(t)]; |
|
777 |
thexchar[Succ(t)]:= thexchar[5] |
|
778 |
end; |
|
779 |
t:= cScreenHeight - 4; |
|
780 |
for i:= 0 to Pred(thexchcnt) do |
|
781 |
with thexchar[i] do |
|
782 |
begin |
|
783 |
dec(t, team.HealthRect.h + 2); |
|
784 |
ny:= t |
|
785 |
end; |
|
786 |
Gear.Timer:= 640; |
|
787 |
Gear.doStep:= doStepTeamHealthSorterWork |
|
788 |
end; |
|
789 |
||
79 | 790 |
//////////////////////////////////////////////////////////////////////////////// |
791 |
procedure doStepShover(Gear: PGear); |
|
792 |
var HHGear: PGear; |
|
793 |
begin |
|
794 |
HHGear:= PHedgehog(Gear.Hedgehog)^.Gear; |
|
795 |
HHGear.State:= HHGear.State or gstNoDamage; |
|
796 |
AmmoShove(Gear, 30, 115); |
|
797 |
HHGear.State:= HHGear.State and not gstNoDamage; |
|
798 |
DeleteGear(Gear) |
|
799 |
end; |
|
800 |
||
801 |
//////////////////////////////////////////////////////////////////////////////// |
|
802 |
procedure doStepFlame(Gear: PGear); |
|
803 |
begin |
|
804 |
AllInactive:= false; |
|
805 |
if not TestCollisionYwithGear(Gear, 1) then |
|
806 |
begin |
|
807 |
Gear.dX:= Gear.dX + cWindSpeed; |
|
808 |
Gear.dY:= Gear.dY + cGravity; |
|
809 |
if abs(Gear.dX) > 0.12 then Gear.dX:= Gear.dX * 0.5; |
|
810 |
if Gear.dY > 0.12 then Gear.dY:= Gear.dY * 0.995; |
|
811 |
Gear.X:= Gear.X + Gear.dX; |
|
812 |
Gear.Y:= Gear.Y + Gear.dY; |
|
813 |
if Gear.Y > 1023 then |
|
814 |
begin |
|
815 |
DeleteGear(Gear); |
|
816 |
exit |
|
817 |
end |
|
818 |
end else begin |
|
819 |
if Gear.Timer > 0 then dec(Gear.Timer) |
|
820 |
else begin |
|
821 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 2, 0); |
|
822 |
dec(Gear.Health); |
|
823 |
Gear.Timer:= 1250 - Gear.Angle * 12 |
|
824 |
end |
|
825 |
end; |
|
826 |
||
827 |
if (((GameTicks div 8) mod 64) = Gear.Angle) then |
|
828 |
AmmoFlameWork(Gear); |
|
829 |
||
82 | 830 |
if Gear.Health = 0 then |
79 | 831 |
DeleteGear(Gear) |
832 |
end; |
|
82 | 833 |
|
834 |
//////////////////////////////////////////////////////////////////////////////// |
|
835 |
procedure doStepFirePunchWork(Gear: PGear); |
|
836 |
var HHGear: PGear; |
|
837 |
begin |
|
838 |
AllInactive:= false; |
|
839 |
if ((Gear.Message and gm_Destroy) <> 0) then |
|
840 |
begin |
|
841 |
DeleteGear(Gear); |
|
842 |
AfterAttack; |
|
843 |
exit |
|
844 |
end; |
|
845 |
||
846 |
HHGear:= PHedgehog(Gear.Hedgehog).Gear; |
|
847 |
if round(HHGear.Y) <= Gear.Tag - 2 then |
|
848 |
begin |
|
849 |
Gear.Tag:= round(HHGear.Y); |
|
850 |
DrawTunnel(HHGear.X - cHHRadius, HHGear.Y - 1, 0.5, 0.0, cHHRadius * 4, 2); |
|
851 |
HHGear.State:= HHGear.State or gstNoDamage; |
|
852 |
Gear.Y:= HHGear.Y; |
|
853 |
AmmoShove(Gear, 30, 40); |
|
854 |
HHGear.State:= HHGear.State and not gstNoDamage |
|
855 |
end; |
|
856 |
||
857 |
HHGear.dY:= HHGear.dY + cGravity; |
|
858 |
if HHGear.dY >= 0 then |
|
859 |
begin |
|
860 |
HHGear.State:= HHGear.State or gstFalling; |
|
861 |
DeleteGear(Gear); |
|
862 |
AfterAttack; |
|
863 |
exit |
|
864 |
end; |
|
865 |
HHGear.Y:= HHGear.Y + HHGear.dY |
|
866 |
end; |
|
867 |
||
868 |
procedure doStepFirePunch(Gear: PGear); |
|
869 |
var HHGear: PGear; |
|
870 |
begin |
|
871 |
AllInactive:= false; |
|
872 |
HHGear:= PHedgehog(Gear.Hedgehog).Gear; |
|
873 |
HHGear.X:= round(HHGear.X) - 0.5; |
|
108 | 874 |
HHGear.dX:= 0.0000001 * hwSign(HHGear.dX); |
82 | 875 |
HHGear.dY:= -0.30; |
876 |
||
877 |
Gear.X:= HHGear.X; |
|
108 | 878 |
Gear.dX:= hwSign(HHGear.dX)* 0.45; |
82 | 879 |
Gear.dY:= -0.9; |
880 |
Gear.doStep:= doStepFirePunchWork; |
|
881 |
DrawTunnel(HHGear.X - cHHRadius, HHGear.Y + 1, 0.5, 0.0, cHHRadius * 4, 5); |
|
882 |
end; |
|
883 |
||
884 |