author | unc0rr |
Sun, 06 Aug 2006 20:08:15 +0000 | |
changeset 100 | f324a18698fe |
parent 95 | 1ef5e2c41115 |
child 107 | b08ce0293a51 |
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 |
|
49 |
if TestCollisionXwithGear(Gear, Sign(Gear.X)) or TestCollisionYwithGear(Gear, Sign(Gear.Y)) |
|
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); |
|
62 |
var dAngle: real; |
|
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 |
|
83 |
if TestCollisionYwithGear(Gear, Sign(Gear.dY)) then |
|
84 |
begin |
|
85 |
Gear.dX:= Gear.dX * Gear.Friction; |
|
86 |
Gear.dY:= - Gear.dY * Gear.Elasticity; |
|
87 |
b:= false |
|
88 |
end else b:= true; |
|
89 |
if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then |
|
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); |
|
227 |
var t: real; |
|
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; |
|
304 |
oX, oY: real; |
|
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; |
|
387 |
HHGear.dX:= 0.0000001 * Sign(PGear(Gear.Hedgehog).dX); |
|
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; |
431 |
len, cs, cc, tx, ty: real; |
|
432 |
lx, ly: integer; |
|
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; |
|
80 | 448 |
if ((HHGear.State and gstHHDriven) = 0) |
449 |
or (CheckGearDrowning(HHGear)) then |
|
4 | 450 |
begin |
451 |
DeleteMe; |
|
452 |
exit |
|
453 |
end; |
|
454 |
Gear.dX:= HHGear.X - Gear.X; |
|
455 |
Gear.dY:= HHGear.Y - Gear.Y; |
|
456 |
||
457 |
if (Gear.Message and gm_Left <> 0) then HHGear.dX:= HHGear.dX - 0.0002 else |
|
458 |
if (Gear.Message and gm_Right <> 0) then HHGear.dX:= HHGear.dX + 0.0002; |
|
459 |
||
460 |
if not TestCollisionYwithGear(HHGear, 1) then HHGear.dY:= HHGear.dY + cGravity; |
|
461 |
||
100 | 462 |
HHGear.DirAngle:= arctan2(Gear.dY + HHGear.dY, Gear.dX + HHGear.dX); |
4 | 463 |
cs:= sin(HHGear.DirAngle); |
464 |
cc:= cos(HHGear.DirAngle); |
|
465 |
||
466 |
flCheck:= not flCheck; |
|
467 |
if flCheck then // check whether rope needs dividing |
|
468 |
begin |
|
469 |
len:= Gear.Elasticity - 20; |
|
470 |
while len > 5 do |
|
471 |
begin |
|
472 |
tx:= cc*len; |
|
473 |
ty:= cs*len; |
|
70 | 474 |
lx:= round(Gear.X + tx) + Sign(HHGear.dX); |
475 |
ly:= round(Gear.Y + ty) + Sign(HHGear.dY); |
|
4 | 476 |
if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then |
477 |
begin |
|
478 |
with RopePoints.ar[RopePoints.Count] do |
|
479 |
begin |
|
480 |
X:= Gear.X; |
|
481 |
Y:= Gear.Y; |
|
482 |
if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle32(Gear.dY, Gear.dX); |
|
483 |
b:= (cc * HHGear.dY) > (cs * HHGear.dX); |
|
484 |
dLen:= len |
|
485 |
end; |
|
486 |
Gear.X:= Gear.X + tx; |
|
487 |
Gear.Y:= Gear.Y + ty; |
|
488 |
inc(RopePoints.Count); |
|
489 |
Gear.Elasticity:= Gear.Elasticity - len; |
|
490 |
Gear.Friction:= Gear.Friction - len; |
|
491 |
break |
|
492 |
end; |
|
493 |
len:= len - 3 |
|
494 |
end; |
|
495 |
end else |
|
496 |
if RopePoints.Count > 0 then // check whether the last dividing point could be removed |
|
497 |
begin |
|
498 |
tx:= RopePoints.ar[Pred(RopePoints.Count)].X; |
|
499 |
ty:= RopePoints.ar[Pred(RopePoints.Count)].Y; |
|
500 |
if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear.X) * (ty - HHGear.Y) > (tx - HHGear.X) * (ty - Gear.Y)) then |
|
501 |
begin |
|
502 |
dec(RopePoints.Count); |
|
503 |
Gear.X:=RopePoints.ar[RopePoints.Count].X; |
|
504 |
Gear.Y:=RopePoints.ar[RopePoints.Count].Y; |
|
505 |
Gear.Elasticity:= Gear.Elasticity + RopePoints.ar[RopePoints.Count].dLen; |
|
506 |
Gear.Friction:= Gear.Friction + RopePoints.ar[RopePoints.Count].dLen |
|
507 |
end |
|
508 |
end; |
|
509 |
||
510 |
Gear.dX:= HHGear.X - Gear.X; |
|
511 |
Gear.dY:= HHGear.Y - Gear.Y; |
|
100 | 512 |
HHGear.DirAngle:= arctan2(Gear.dY + HHGear.dY, Gear.dX + HHGear.dX); |
4 | 513 |
cs:= sin(HHGear.DirAngle); |
514 |
cc:= cos(HHGear.DirAngle); |
|
515 |
||
516 |
HHGear.dX:= HHGear.X; |
|
517 |
HHGear.dY:= HHGear.Y; |
|
518 |
||
519 |
if ((Gear.Message and gm_Down) <> 0) and (Gear.Elasticity < Gear.Friction) then |
|
520 |
if not (TestCollisionXwithGear(HHGear, Sign(Gear.dX)) |
|
521 |
or TestCollisionYwithGear(HHGear, Sign(Gear.dY))) then Gear.Elasticity:= Gear.Elasticity + 0.3; |
|
522 |
||
523 |
if ((Gear.Message and gm_Up) <> 0) and (Gear.Elasticity > 30) then |
|
524 |
if not (TestCollisionXwithGear(HHGear, -Sign(Gear.dX)) |
|
525 |
or TestCollisionYwithGear(HHGear, -Sign(Gear.dY))) then Gear.Elasticity:= Gear.Elasticity - 0.3; |
|
526 |
||
527 |
HHGear.X:= Gear.X + cc*Gear.Elasticity; |
|
528 |
HHGear.Y:= Gear.Y + cs*Gear.Elasticity; |
|
529 |
||
530 |
HHGear.dX:= HHGear.X - HHGear.dX; |
|
531 |
HHGear.dY:= HHGear.Y - HHGear.dY; |
|
532 |
||
533 |
if TestCollisionXwithGear(HHGear, Sign(HHGear.dX)) then |
|
75 | 534 |
HHGear.dX:= -0.6 * HHGear.dX; |
4 | 535 |
if TestCollisionYwithGear(HHGear, Sign(HHGear.dY)) then |
75 | 536 |
HHGear.dY:= -0.6 * HHGear.dY; |
4 | 537 |
|
538 |
if (Gear.Message and gm_Attack) <> 0 then |
|
539 |
if (Gear.State and gsttmpFlag) <> 0 then DeleteMe else |
|
540 |
else if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag; |
|
541 |
end; |
|
542 |
||
543 |
||
544 |
procedure doStepRopeAttach(Gear: PGear); |
|
545 |
var HHGear: PGear; |
|
546 |
tx, ty, tt: real; |
|
547 |
begin |
|
548 |
Gear.X:= Gear.X + Gear.dX; |
|
549 |
Gear.Y:= Gear.Y + Gear.dY; |
|
550 |
Gear.Elasticity:= Gear.Elasticity + 1.0; |
|
551 |
HHGear:= PHedgehog(Gear.Hedgehog)^.Gear; |
|
552 |
if (HHGear.State and gstFalling) <> 0 then |
|
68 | 553 |
if TestCollisionYwithGear(HHGear, 1) then |
4 | 554 |
begin |
555 |
HHGear.dY:= 0; |
|
556 |
CheckHHDamage(HHGear); |
|
557 |
HHGear.State:= HHGear.State and not (gstFalling or gstHHJumping); |
|
558 |
end else |
|
559 |
begin |
|
560 |
if TestCollisionXwithGear(HHGear, Sign(HHGear.dX)) then HHGear.dX:= 0.0000001 * Sign(HHGear.dX); |
|
561 |
HHGear.X:= HHGear.X + HHGear.dX; |
|
562 |
HHGear.Y:= HHGear.Y + HHGear.dY; |
|
563 |
Gear.X:= Gear.X + HHGear.dX; |
|
564 |
Gear.Y:= Gear.Y + HHGear.dY; |
|
565 |
HHGear.dY:= HHGear.dY + cGravity; |
|
566 |
tt:= Gear.Elasticity; |
|
567 |
tx:= 0; |
|
568 |
ty:= 0; |
|
569 |
while tt > 20 do |
|
570 |
begin |
|
571 |
if TestCollisionXwithXYShift(Gear, round(tx), round(ty), Sign(Gear.dX)) |
|
572 |
or TestCollisionYwithXYShift(Gear, round(tx), round(ty), Sign(Gear.dY)) then |
|
573 |
begin |
|
574 |
Gear.X:= Gear.X + tx; |
|
575 |
Gear.Y:= Gear.Y + ty; |
|
576 |
Gear.Elasticity:= tt; |
|
577 |
Gear.doStep:= doStepRopeWork; |
|
578 |
with HHGear^ do State:= State and not gstAttacking; |
|
579 |
tt:= 0 |
|
580 |
end; |
|
581 |
tx:= tx - Gear.dX - Gear.dX; |
|
582 |
ty:= ty - Gear.dY - Gear.dY; |
|
583 |
tt:= tt - 2.0; |
|
584 |
end; |
|
585 |
end; |
|
586 |
CheckCollision(Gear); |
|
587 |
if (Gear.State and gstCollision) <> 0 then |
|
588 |
begin |
|
589 |
Gear.doStep:= doStepRopeWork; |
|
590 |
with HHGear^ do State:= State and not gstAttacking; |
|
591 |
if Gear.Elasticity < 10 then |
|
592 |
Gear.Elasticity:= 10000; |
|
593 |
end; |
|
594 |
||
595 |
if (Gear.Elasticity >= Gear.Friction) or ((Gear.Message and gm_Attack) = 0) then |
|
596 |
begin |
|
597 |
with PHedgehog(Gear.Hedgehog).Gear^ do |
|
598 |
begin |
|
599 |
State:= State and not gstAttacking; |
|
600 |
Message:= Message and not gm_Attack |
|
601 |
end; |
|
602 |
DeleteGear(Gear) |
|
603 |
end |
|
604 |
end; |
|
605 |
||
606 |
procedure doStepRope(Gear: PGear); |
|
607 |
begin |
|
608 |
Gear.doStep:= doStepRopeAttach |
|
609 |
end; |
|
610 |
||
611 |
//////////////////////////////////////////////////////////////////////////////// |
|
612 |
procedure doStepSmokeTrace(Gear: PGear); |
|
613 |
begin |
|
614 |
inc(Gear.Timer); |
|
615 |
if Gear.Timer > 64 then |
|
616 |
begin |
|
617 |
Gear.Timer:= 0; |
|
9 | 618 |
dec(Gear.State) |
4 | 619 |
end; |
620 |
Gear.dX:= Gear.dX + cWindSpeed; |
|
621 |
Gear.X:= Gear.X + Gear.dX; |
|
9 | 622 |
if Gear.State = 0 then DeleteGear(Gear) |
4 | 623 |
end; |
9 | 624 |
|
625 |
//////////////////////////////////////////////////////////////////////////////// |
|
626 |
procedure doStepExplosion(Gear: PGear); |
|
627 |
begin |
|
628 |
inc(Gear.Timer); |
|
629 |
if Gear.Timer > 75 then |
|
630 |
begin |
|
631 |
inc(Gear.State); |
|
632 |
Gear.Timer:= 0; |
|
633 |
if Gear.State > 5 then DeleteGear(Gear) |
|
634 |
end; |
|
635 |
end; |
|
10 | 636 |
|
637 |
//////////////////////////////////////////////////////////////////////////////// |
|
638 |
procedure doStepMine(Gear: PGear); |
|
639 |
begin |
|
39 | 640 |
if (Gear.dX <> 0) or (Gear.dY <> 0) then |
10 | 641 |
begin |
53 | 642 |
if Gear.CollIndex < High(Longword) then DeleteCI(Gear); |
10 | 643 |
doStepFallingGear(Gear); |
13 | 644 |
if Gear.Active = false then |
645 |
begin |
|
53 | 646 |
if Gear.CollIndex = High(Longword) then AddGearCI(Gear); |
13 | 647 |
Gear.dX:= 0; |
648 |
Gear.dY:= 0 |
|
649 |
end; |
|
650 |
CalcRotationDirAngle(Gear); |
|
10 | 651 |
AllInactive:= false |
652 |
end; |
|
39 | 653 |
|
10 | 654 |
if ((Gear.State and gsttmpFlag) <> 0) then |
655 |
if ((Gear.State and gstAttacking) = 0) then |
|
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
656 |
begin |
39 | 657 |
if ((GameTicks and $F) = 0) then |
15 | 658 |
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
|
659 |
end else // gstAttacking <> 0 |
10 | 660 |
begin |
661 |
AllInactive:= false; |
|
37 | 662 |
if (Gear.Timer and $FF) = 0 then PlaySound(sndMineTick); |
10 | 663 |
if Gear.Timer = 0 then |
664 |
begin |
|
13 | 665 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
10 | 666 |
DeleteGear(Gear) |
667 |
end; |
|
13 | 668 |
dec(Gear.Timer); |
669 |
end else // gsttmpFlag = 0 |
|
670 |
if TurnTimeLeft = 0 then Gear.State:= Gear.State or gsttmpFlag; |
|
10 | 671 |
end; |
57 | 672 |
|
39 | 673 |
//////////////////////////////////////////////////////////////////////////////// |
674 |
procedure doStepDynamite(Gear: PGear); |
|
675 |
begin |
|
43 | 676 |
doStepFallingGear(Gear); |
677 |
AllInactive:= false; |
|
678 |
if Gear.Timer mod 166 = 0 then inc(Gear.Tag); |
|
679 |
if Gear.Timer = 0 then |
|
39 | 680 |
begin |
46 | 681 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 75, EXPLAutoSound); |
43 | 682 |
DeleteGear(Gear); |
683 |
exit |
|
39 | 684 |
end; |
43 | 685 |
dec(Gear.Timer); |
39 | 686 |
end; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
687 |
|
15 | 688 |
//////////////////////////////////////////////////////////////////////////////// |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
689 |
procedure doStepCase(Gear: PGear); |
89 | 690 |
var i, x, y: integer; |
14
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
691 |
begin |
15 | 692 |
if (Gear.Message and gm_Destroy) > 0 then |
693 |
begin |
|
694 |
DeleteGear(Gear); |
|
695 |
exit |
|
696 |
end; |
|
697 |
||
79 | 698 |
if Gear.Damage > 0 then |
699 |
begin |
|
89 | 700 |
x:= round(Gear.X); |
701 |
y:= round(Gear.Y); |
|
79 | 702 |
DeleteGear(Gear); |
89 | 703 |
doMakeExplosion(x, y, 25, EXPLAutoSound); |
79 | 704 |
for i:= 0 to 63 do |
89 | 705 |
AddGear(x, y, gtFlame, 0); |
79 | 706 |
exit |
707 |
end; |
|
708 |
||
53 | 709 |
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
|
710 |
begin |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
711 |
AllInactive:= false; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
712 |
Gear.dY:= Gear.dY + cGravity; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
713 |
Gear.Y:= Gear.Y + Gear.dY; |
53 | 714 |
if (Gear.dY < 0) and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0 else |
715 |
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
|
716 |
begin |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
717 |
Gear.dY:= - Gear.dY * Gear.Elasticity; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
718 |
if Gear.dY > - 0.001 then Gear.dY:= 0 |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
719 |
else if Gear.dY < - 0.03 then PlaySound(sndGraveImpact); |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
720 |
end; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
721 |
CheckGearDrowning(Gear); |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
722 |
end; |
81f125629b25
- Mine checks whether a hedgehog is near less frequently
unc0rr
parents:
13
diff
changeset
|
723 |
|
53 | 724 |
if (Gear.CollIndex = High(Longword)) and (Gear.dY = 0) then AddGearCI(Gear) |
725 |
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
|
726 |
end; |
49 | 727 |
|
728 |
//////////////////////////////////////////////////////////////////////////////// |
|
729 |
var thexchar: array[0..5] of record |
|
730 |
oy, ny: integer; |
|
731 |
team: PTeam; |
|
732 |
end; |
|
733 |
thexchcnt: Longword; |
|
734 |
||
735 |
procedure doStepTeamHealthSorterWork(Gear: PGear); |
|
736 |
var i: integer; |
|
737 |
begin |
|
738 |
AllInactive:= false; |
|
739 |
dec(Gear.Timer); |
|
740 |
if (Gear.Timer and 15) = 0 then |
|
741 |
for i:= 0 to Pred(thexchcnt) do |
|
742 |
with thexchar[i] do |
|
743 |
{$WARNINGS OFF} |
|
744 |
team.DrawHealthY:= ny + (oy - ny) * Gear.Timer div 640; |
|
745 |
{$WARNINGS ON} |
|
746 |
if Gear.Timer = 0 then |
|
747 |
DeleteGear(Gear) |
|
748 |
end; |
|
749 |
||
750 |
procedure doStepTeamHealthSorter(Gear: PGear); |
|
751 |
var team: PTeam; |
|
752 |
i, t: Longword; |
|
753 |
begin |
|
754 |
AllInactive:= false; |
|
755 |
team:= TeamsList; |
|
756 |
i:= 0; |
|
757 |
while team <> nil do |
|
758 |
begin |
|
759 |
thexchar[i].oy:= team.DrawHealthY; |
|
760 |
thexchar[i].team:= team; |
|
761 |
inc(i); |
|
762 |
team:= team.Next |
|
763 |
end; |
|
764 |
thexchcnt:= i; |
|
765 |
for i:= 1 to thexchcnt do |
|
766 |
for t:= 0 to thexchcnt - 2 do |
|
767 |
if thexchar[t].team.TeamHealth > thexchar[Succ(t)].team.TeamHealth then |
|
768 |
begin |
|
769 |
thexchar[5]:= thexchar[t]; |
|
770 |
thexchar[t]:= thexchar[Succ(t)]; |
|
771 |
thexchar[Succ(t)]:= thexchar[5] |
|
772 |
end; |
|
773 |
t:= cScreenHeight - 4; |
|
774 |
for i:= 0 to Pred(thexchcnt) do |
|
775 |
with thexchar[i] do |
|
776 |
begin |
|
777 |
dec(t, team.HealthRect.h + 2); |
|
778 |
ny:= t |
|
779 |
end; |
|
780 |
Gear.Timer:= 640; |
|
781 |
Gear.doStep:= doStepTeamHealthSorterWork |
|
782 |
end; |
|
783 |
||
79 | 784 |
//////////////////////////////////////////////////////////////////////////////// |
785 |
procedure doStepShover(Gear: PGear); |
|
786 |
var HHGear: PGear; |
|
787 |
begin |
|
788 |
HHGear:= PHedgehog(Gear.Hedgehog)^.Gear; |
|
789 |
HHGear.State:= HHGear.State or gstNoDamage; |
|
790 |
AmmoShove(Gear, 30, 115); |
|
791 |
HHGear.State:= HHGear.State and not gstNoDamage; |
|
792 |
DeleteGear(Gear) |
|
793 |
end; |
|
794 |
||
795 |
//////////////////////////////////////////////////////////////////////////////// |
|
796 |
procedure doStepFlame(Gear: PGear); |
|
797 |
begin |
|
798 |
AllInactive:= false; |
|
799 |
if not TestCollisionYwithGear(Gear, 1) then |
|
800 |
begin |
|
801 |
Gear.dX:= Gear.dX + cWindSpeed; |
|
802 |
Gear.dY:= Gear.dY + cGravity; |
|
803 |
if abs(Gear.dX) > 0.12 then Gear.dX:= Gear.dX * 0.5; |
|
804 |
if Gear.dY > 0.12 then Gear.dY:= Gear.dY * 0.995; |
|
805 |
Gear.X:= Gear.X + Gear.dX; |
|
806 |
Gear.Y:= Gear.Y + Gear.dY; |
|
807 |
if Gear.Y > 1023 then |
|
808 |
begin |
|
809 |
DeleteGear(Gear); |
|
810 |
exit |
|
811 |
end |
|
812 |
end else begin |
|
813 |
if Gear.Timer > 0 then dec(Gear.Timer) |
|
814 |
else begin |
|
815 |
doMakeExplosion(round(Gear.X), round(Gear.Y), 2, 0); |
|
816 |
dec(Gear.Health); |
|
817 |
Gear.Timer:= 1250 - Gear.Angle * 12 |
|
818 |
end |
|
819 |
end; |
|
820 |
||
821 |
if (((GameTicks div 8) mod 64) = Gear.Angle) then |
|
822 |
AmmoFlameWork(Gear); |
|
823 |
||
82 | 824 |
if Gear.Health = 0 then |
79 | 825 |
DeleteGear(Gear) |
826 |
end; |
|
82 | 827 |
|
828 |
//////////////////////////////////////////////////////////////////////////////// |
|
829 |
procedure doStepFirePunchWork(Gear: PGear); |
|
830 |
var HHGear: PGear; |
|
831 |
begin |
|
832 |
AllInactive:= false; |
|
833 |
if ((Gear.Message and gm_Destroy) <> 0) then |
|
834 |
begin |
|
835 |
DeleteGear(Gear); |
|
836 |
AfterAttack; |
|
837 |
exit |
|
838 |
end; |
|
839 |
||
840 |
HHGear:= PHedgehog(Gear.Hedgehog).Gear; |
|
841 |
if round(HHGear.Y) <= Gear.Tag - 2 then |
|
842 |
begin |
|
843 |
Gear.Tag:= round(HHGear.Y); |
|
844 |
DrawTunnel(HHGear.X - cHHRadius, HHGear.Y - 1, 0.5, 0.0, cHHRadius * 4, 2); |
|
845 |
HHGear.State:= HHGear.State or gstNoDamage; |
|
846 |
Gear.Y:= HHGear.Y; |
|
847 |
AmmoShove(Gear, 30, 40); |
|
848 |
HHGear.State:= HHGear.State and not gstNoDamage |
|
849 |
end; |
|
850 |
||
851 |
HHGear.dY:= HHGear.dY + cGravity; |
|
852 |
if HHGear.dY >= 0 then |
|
853 |
begin |
|
854 |
HHGear.State:= HHGear.State or gstFalling; |
|
855 |
DeleteGear(Gear); |
|
856 |
AfterAttack; |
|
857 |
exit |
|
858 |
end; |
|
859 |
HHGear.Y:= HHGear.Y + HHGear.dY |
|
860 |
end; |
|
861 |
||
862 |
procedure doStepFirePunch(Gear: PGear); |
|
863 |
var HHGear: PGear; |
|
864 |
begin |
|
865 |
AllInactive:= false; |
|
866 |
HHGear:= PHedgehog(Gear.Hedgehog).Gear; |
|
867 |
HHGear.X:= round(HHGear.X) - 0.5; |
|
868 |
HHGear.dX:= 0.0000001 * Sign(HHGear.dX); |
|
869 |
HHGear.dY:= -0.30; |
|
870 |
||
871 |
Gear.X:= HHGear.X; |
|
872 |
Gear.dX:= Sign(HHGear.dX)* 0.45; |
|
873 |
Gear.dY:= -0.9; |
|
874 |
Gear.doStep:= doStepFirePunchWork; |
|
875 |
DrawTunnel(HHGear.X - cHHRadius, HHGear.Y + 1, 0.5, 0.0, cHHRadius * 4, 5); |
|
876 |
end; |
|
877 |
||
878 |