author | koda |
Tue, 01 May 2012 19:56:55 +0200 | |
changeset 6982 | 8d41d22a291d |
parent 6792 | f72c8b5d421c |
child 7001 | 89488f5b99ca |
permissions | -rw-r--r-- |
6581 | 1 |
(* |
2 |
* Hedgewars, a free turn based strategy game |
|
6700 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
6581 | 4 |
* |
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 |
|
8 |
* |
|
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. |
|
13 |
* |
|
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 |
|
17 |
*) |
|
18 |
||
19 |
{$INCLUDE "options.inc"} |
|
20 |
unit uGearsList; |
|
21 |
||
22 |
interface |
|
23 |
uses uFloat, uTypes; |
|
24 |
||
25 |
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
|
26 |
procedure DeleteGear(Gear: PGear); |
|
27 |
procedure InsertGearToList(Gear: PGear); |
|
28 |
procedure RemoveGearFromList(Gear: PGear); |
|
29 |
||
30 |
implementation |
|
31 |
||
32 |
uses uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats, |
|
33 |
uTextures, uScript, uRenderUtils, uAI, uCollisions, |
|
34 |
uGearsRender, uGearsUtils; |
|
35 |
||
36 |
procedure InsertGearToList(Gear: PGear); |
|
37 |
var tmp, ptmp: PGear; |
|
38 |
begin |
|
39 |
tmp:= GearsList; |
|
40 |
ptmp:= GearsList; |
|
41 |
while (tmp <> nil) and (tmp^.Z <= Gear^.Z) do |
|
42 |
begin |
|
43 |
ptmp:= tmp; |
|
44 |
tmp:= tmp^.NextGear |
|
45 |
end; |
|
46 |
||
47 |
if ptmp <> tmp then |
|
48 |
begin |
|
49 |
Gear^.NextGear:= ptmp^.NextGear; |
|
50 |
Gear^.PrevGear:= ptmp; |
|
51 |
if ptmp^.NextGear <> nil then |
|
52 |
ptmp^.NextGear^.PrevGear:= Gear; |
|
53 |
ptmp^.NextGear:= Gear |
|
54 |
end |
|
55 |
else |
|
56 |
begin |
|
57 |
Gear^.NextGear:= GearsList; |
|
58 |
if Gear^.NextGear <> nil then |
|
59 |
Gear^.NextGear^.PrevGear:= Gear; |
|
60 |
GearsList:= Gear; |
|
61 |
end; |
|
62 |
end; |
|
63 |
||
64 |
procedure RemoveGearFromList(Gear: PGear); |
|
65 |
begin |
|
66 |
if Gear^.NextGear <> nil then |
|
67 |
Gear^.NextGear^.PrevGear:= Gear^.PrevGear; |
|
68 |
if Gear^.PrevGear <> nil then |
|
69 |
Gear^.PrevGear^.NextGear:= Gear^.NextGear |
|
70 |
else |
|
71 |
GearsList:= Gear^.NextGear |
|
72 |
end; |
|
73 |
||
74 |
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
|
75 |
var gear: PGear; |
|
76 |
begin |
|
77 |
inc(Counter); |
|
78 |
AddFileLog('AddGear: #' + inttostr(Counter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
|
79 |
||
80 |
New(gear); |
|
81 |
FillChar(gear^, sizeof(TGear), 0); |
|
82 |
gear^.X:= int2hwFloat(X); |
|
83 |
gear^.Y:= int2hwFloat(Y); |
|
84 |
gear^.Target.X:= NoPointX; |
|
85 |
gear^.Kind := Kind; |
|
86 |
gear^.State:= State; |
|
87 |
gear^.Active:= true; |
|
88 |
gear^.dX:= dX; |
|
89 |
gear^.dY:= dY; |
|
90 |
gear^.doStep:= doStepHandlers[Kind]; |
|
91 |
gear^.CollisionIndex:= -1; |
|
92 |
gear^.Timer:= Timer; |
|
93 |
gear^.FlightTime:= 0; |
|
94 |
gear^.uid:= Counter; |
|
95 |
gear^.SoundChannel:= -1; |
|
96 |
gear^.ImpactSound:= sndNone; |
|
97 |
gear^.nImpactSounds:= 0; |
|
98 |
gear^.Density:= _1; |
|
99 |
// Define ammo association, if any. |
|
100 |
gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; |
|
101 |
if Ammoz[Gear^.AmmoType].Ammo.Propz and ammoprop_NeedTarget <> 0 then |
|
102 |
gear^.Z:= cHHZ+1 |
|
103 |
else gear^.Z:= cUsualZ; |
|
104 |
||
105 |
if CurrentHedgehog <> nil then |
|
106 |
begin |
|
107 |
gear^.Hedgehog:= CurrentHedgehog; |
|
108 |
gear^.IntersectGear:= CurrentHedgehog^.Gear |
|
109 |
end; |
|
110 |
||
111 |
case Kind of |
|
112 |
gtGrenade, |
|
113 |
gtClusterBomb, |
|
114 |
gtGasBomb: begin |
|
115 |
gear^.ImpactSound:= sndGrenadeImpact; |
|
116 |
gear^.nImpactSounds:= 1; |
|
117 |
gear^.AdvBounce:= 1; |
|
118 |
gear^.Radius:= 5; |
|
119 |
gear^.Elasticity:= _0_8; |
|
120 |
gear^.Friction:= _0_8; |
|
121 |
gear^.Density:= _1_5; |
|
122 |
gear^.RenderTimer:= true; |
|
123 |
if gear^.Timer = 0 then |
|
124 |
gear^.Timer:= 3000 |
|
125 |
end; |
|
126 |
gtWatermelon: begin |
|
127 |
gear^.ImpactSound:= sndMelonImpact; |
|
128 |
gear^.nImpactSounds:= 1; |
|
129 |
gear^.AdvBounce:= 1; |
|
130 |
gear^.Radius:= 6; |
|
131 |
gear^.Elasticity:= _0_8; |
|
132 |
gear^.Friction:= _0_995; |
|
133 |
gear^.Density:= _2; |
|
134 |
gear^.RenderTimer:= true; |
|
135 |
if gear^.Timer = 0 then |
|
136 |
gear^.Timer:= 3000 |
|
137 |
end; |
|
138 |
gtMelonPiece: begin |
|
139 |
gear^.Density:= _2; |
|
140 |
end; |
|
141 |
gtHedgehog: begin |
|
142 |
gear^.AdvBounce:= 1; |
|
143 |
gear^.Radius:= cHHRadius; |
|
144 |
gear^.Elasticity:= _0_35; |
|
145 |
gear^.Friction:= _0_999; |
|
146 |
gear^.Angle:= cMaxAngle div 2; |
|
147 |
gear^.Density:= _3; |
|
148 |
gear^.Z:= cHHZ; |
|
149 |
if (GameFlags and gfAISurvival) <> 0 then |
|
150 |
if gear^.Hedgehog^.BotLevel > 0 then |
|
151 |
gear^.Hedgehog^.Effects[heResurrectable] := true; |
|
152 |
end; |
|
153 |
gtShell: begin |
|
154 |
gear^.Radius:= 4; |
|
155 |
gear^.Density:= _1; |
|
156 |
end; |
|
157 |
gtSnowball: begin |
|
158 |
gear^.ImpactSound:= sndMudballImpact; |
|
159 |
gear^.nImpactSounds:= 1; |
|
160 |
gear^.Radius:= 4; |
|
161 |
gear^.Elasticity:= _1; |
|
162 |
gear^.Friction:= _1; |
|
163 |
gear^.Density:= _0_5; |
|
164 |
end; |
|
165 |
||
166 |
gtFlake: begin |
|
167 |
with Gear^ do |
|
168 |
begin |
|
169 |
Pos:= 0; |
|
170 |
Radius:= 1; |
|
171 |
DirAngle:= random * 360; |
|
172 |
if State and gstTmpFlag = 0 then |
|
173 |
begin |
|
174 |
dx.isNegative:= GetRandom(2) = 0; |
|
175 |
dx.QWordValue:= GetRandom(100000000); |
|
176 |
dy.isNegative:= false; |
|
177 |
dy.QWordValue:= GetRandom(70000000); |
|
178 |
if GetRandom(2) = 0 then |
|
179 |
dx := -dx |
|
180 |
end; |
|
181 |
State:= State or gstInvisible; |
|
182 |
Health:= random(vobFrameTicks); |
|
183 |
Timer:= random(vobFramesCount); |
|
184 |
Angle:= (random(2) * 2 - 1) * (1 + random(10000)) * vobVelocity |
|
185 |
end |
|
186 |
end; |
|
187 |
gtGrave: begin |
|
188 |
gear^.ImpactSound:= sndGraveImpact; |
|
189 |
gear^.nImpactSounds:= 1; |
|
190 |
gear^.Radius:= 10; |
|
191 |
gear^.Elasticity:= _0_6; |
|
192 |
end; |
|
193 |
gtBee: begin |
|
194 |
gear^.Radius:= 5; |
|
195 |
gear^.Timer:= 500; |
|
196 |
gear^.RenderTimer:= true; |
|
197 |
gear^.Elasticity:= _0_9; |
|
198 |
gear^.Tag:= 0; |
|
199 |
end; |
|
200 |
gtSeduction: begin |
|
201 |
gear^.Radius:= 250; |
|
202 |
end; |
|
203 |
gtShotgunShot: begin |
|
204 |
gear^.Timer:= 900; |
|
205 |
gear^.Radius:= 2 |
|
206 |
end; |
|
207 |
gtPickHammer: begin |
|
208 |
gear^.Radius:= 10; |
|
209 |
gear^.Timer:= 4000 |
|
210 |
end; |
|
211 |
gtHammerHit: begin |
|
212 |
gear^.Radius:= 8; |
|
213 |
gear^.Timer:= 125 |
|
214 |
end; |
|
215 |
gtRope: begin |
|
216 |
gear^.Radius:= 3; |
|
217 |
gear^.Friction:= _450 * _0_01 * cRopePercent; |
|
218 |
RopePoints.Count:= 0; |
|
219 |
end; |
|
220 |
gtMine: begin |
|
221 |
gear^.ImpactSound:= sndMineImpact; |
|
222 |
gear^.nImpactSounds:= 1; |
|
223 |
gear^.Health:= 10; |
|
224 |
gear^.State:= gear^.State or gstMoving; |
|
225 |
gear^.Radius:= 2; |
|
226 |
gear^.Elasticity:= _0_55; |
|
227 |
gear^.Friction:= _0_995; |
|
228 |
gear^.Density:= _0_9; |
|
229 |
if cMinesTime < 0 then |
|
230 |
gear^.Timer:= getrandom(51)*100 |
|
231 |
else |
|
232 |
gear^.Timer:= cMinesTime; |
|
233 |
end; |
|
234 |
gtSMine: begin |
|
235 |
gear^.Health:= 10; |
|
236 |
gear^.State:= gear^.State or gstMoving; |
|
237 |
gear^.Radius:= 2; |
|
238 |
gear^.Elasticity:= _0_55; |
|
239 |
gear^.Friction:= _0_995; |
|
240 |
gear^.Density:= _0_9; |
|
241 |
gear^.Timer:= 500; |
|
242 |
end; |
|
243 |
gtCase: begin |
|
244 |
gear^.ImpactSound:= sndGraveImpact; |
|
245 |
gear^.nImpactSounds:= 1; |
|
246 |
gear^.Radius:= 16; |
|
247 |
gear^.Elasticity:= _0_3 |
|
248 |
end; |
|
249 |
gtExplosives: begin |
|
250 |
gear^.ImpactSound:= sndGrenadeImpact; |
|
251 |
gear^.nImpactSounds:= 1; |
|
252 |
gear^.Radius:= 16; |
|
253 |
gear^.Elasticity:= _0_4; |
|
254 |
gear^.Friction:= _0_995; |
|
255 |
gear^.Density:= _6; |
|
256 |
gear^.Health:= cBarrelHealth; |
|
257 |
gear^.Z:= cHHZ-1 |
|
258 |
end; |
|
259 |
gtDEagleShot: begin |
|
260 |
gear^.Radius:= 1; |
|
261 |
gear^.Health:= 50 |
|
262 |
end; |
|
263 |
gtSniperRifleShot: begin |
|
264 |
gear^.Radius:= 1; |
|
265 |
gear^.Health:= 50 |
|
266 |
end; |
|
267 |
gtDynamite: begin |
|
268 |
gear^.Radius:= 3; |
|
269 |
gear^.Elasticity:= _0_55; |
|
270 |
gear^.Friction:= _0_03; |
|
271 |
gear^.Density:= _2; |
|
272 |
gear^.Timer:= 5000; |
|
273 |
end; |
|
274 |
gtCluster: begin |
|
275 |
gear^.Radius:= 2; |
|
276 |
gear^.Density:= _1_5; |
|
277 |
gear^.RenderTimer:= true |
|
278 |
end; |
|
279 |
gtShover: gear^.Radius:= 20; |
|
280 |
gtFlame: begin |
|
281 |
gear^.Tag:= GetRandom(32); |
|
282 |
gear^.Radius:= 1; |
|
283 |
gear^.Health:= 5; |
|
284 |
gear^.Density:= _1; |
|
285 |
if (gear^.dY.QWordValue = 0) and (gear^.dX.QWordValue = 0) then |
|
286 |
begin |
|
287 |
gear^.dY:= (getrandom - _0_8) * _0_03; |
|
288 |
gear^.dX:= (getrandom - _0_5) * _0_4 |
|
289 |
end |
|
290 |
end; |
|
291 |
gtFirePunch: begin |
|
292 |
gear^.Radius:= 15; |
|
293 |
gear^.Tag:= Y |
|
294 |
end; |
|
295 |
gtAirBomb: begin |
|
296 |
gear^.Radius:= 5; |
|
297 |
gear^.Density:= _2; |
|
298 |
end; |
|
299 |
gtBlowTorch: begin |
|
300 |
gear^.Radius:= cHHRadius + cBlowTorchC; |
|
301 |
gear^.Timer:= 7500 |
|
302 |
end; |
|
303 |
gtSwitcher: begin |
|
304 |
gear^.Z:= cCurrHHZ |
|
305 |
end; |
|
306 |
gtTarget: begin |
|
307 |
gear^.ImpactSound:= sndGrenadeImpact; |
|
308 |
gear^.nImpactSounds:= 1; |
|
309 |
gear^.Radius:= 10; |
|
310 |
gear^.Elasticity:= _0_3; |
|
311 |
gear^.Timer:= 0 |
|
312 |
end; |
|
313 |
gtTardis: begin |
|
314 |
gear^.Timer:= 0; |
|
315 |
gear^.Pos:= 1; |
|
316 |
gear^.Z:= cCurrHHZ+1; |
|
317 |
end; |
|
318 |
gtMortar: begin |
|
319 |
gear^.Radius:= 4; |
|
320 |
gear^.Elasticity:= _0_2; |
|
321 |
gear^.Friction:= _0_08; |
|
322 |
gear^.Density:= _1; |
|
323 |
end; |
|
324 |
gtWhip: gear^.Radius:= 20; |
|
325 |
gtHammer: gear^.Radius:= 20; |
|
326 |
gtKamikaze: begin |
|
327 |
gear^.Health:= 2048; |
|
328 |
gear^.Radius:= 20 |
|
329 |
end; |
|
330 |
gtCake: begin |
|
331 |
gear^.Health:= 2048; |
|
332 |
gear^.Radius:= 7; |
|
333 |
gear^.Z:= cOnHHZ; |
|
334 |
gear^.RenderTimer:= true; |
|
335 |
gear^.DirAngle:= -90 * hwSign(Gear^.dX); |
|
336 |
if not dX.isNegative then |
|
337 |
gear^.Angle:= 1 |
|
338 |
else |
|
339 |
gear^.Angle:= 3 |
|
340 |
end; |
|
341 |
gtHellishBomb: begin |
|
342 |
gear^.ImpactSound:= sndHellishImpact1; |
|
343 |
gear^.nImpactSounds:= 4; |
|
344 |
gear^.AdvBounce:= 1; |
|
345 |
gear^.Radius:= 4; |
|
346 |
gear^.Elasticity:= _0_5; |
|
347 |
gear^.Friction:= _0_96; |
|
348 |
gear^.Density:= _1_5; |
|
349 |
gear^.RenderTimer:= true; |
|
350 |
gear^.Timer:= 5000 |
|
351 |
end; |
|
352 |
gtDrill: begin |
|
353 |
if gear^.Timer = 0 then |
|
354 |
gear^.Timer:= 5000; |
|
355 |
// Tag for drill strike. if 1 then first impact occured already |
|
356 |
gear^.Tag := 0; |
|
357 |
gear^.Radius:= 4; |
|
358 |
gear^.Density:= _1; |
|
359 |
end; |
|
360 |
gtBall: begin |
|
361 |
gear^.ImpactSound:= sndGrenadeImpact; |
|
362 |
gear^.nImpactSounds:= 1; |
|
363 |
gear^.AdvBounce:= 1; |
|
364 |
gear^.Radius:= 5; |
|
365 |
gear^.Tag:= random(8); |
|
366 |
gear^.Timer:= 5000; |
|
367 |
gear^.Elasticity:= _0_7; |
|
368 |
gear^.Friction:= _0_995; |
|
369 |
gear^.Density:= _1_5; |
|
370 |
end; |
|
371 |
gtBallgun: begin |
|
372 |
gear^.Timer:= 5001; |
|
373 |
end; |
|
374 |
gtRCPlane: begin |
|
375 |
gear^.Timer:= 15000; |
|
376 |
gear^.Health:= 3; |
|
377 |
gear^.Radius:= 8 |
|
378 |
end; |
|
379 |
gtJetpack: begin |
|
380 |
gear^.Health:= 2000; |
|
381 |
gear^.Damage:= 100 |
|
382 |
end; |
|
383 |
gtMolotov: begin |
|
384 |
gear^.Radius:= 6; |
|
385 |
gear^.Density:= _2; |
|
386 |
end; |
|
387 |
gtBirdy: begin |
|
388 |
gear^.Radius:= 16; // todo: check |
|
389 |
gear^.Timer:= 0; |
|
390 |
gear^.Health := 2000; |
|
391 |
gear^.FlightTime := 2; |
|
392 |
end; |
|
393 |
gtEgg: begin |
|
394 |
gear^.Radius:= 4; |
|
395 |
gear^.Elasticity:= _0_6; |
|
396 |
gear^.Friction:= _0_96; |
|
397 |
gear^.Density:= _1; |
|
398 |
if gear^.Timer = 0 then |
|
399 |
gear^.Timer:= 3000 |
|
400 |
end; |
|
401 |
gtPortal: begin |
|
402 |
gear^.ImpactSound:= sndMelonImpact; |
|
403 |
gear^.nImpactSounds:= 1; |
|
404 |
gear^.AdvBounce:= 0; |
|
405 |
gear^.Radius:= 17; |
|
406 |
// set color |
|
407 |
gear^.Tag:= 2 * gear^.Timer; |
|
408 |
gear^.Timer:= 15000; |
|
409 |
gear^.RenderTimer:= false; |
|
410 |
gear^.Health:= 100; |
|
411 |
end; |
|
412 |
gtPiano: begin |
|
413 |
gear^.Radius:= 32; |
|
414 |
gear^.Density:= _50; |
|
415 |
end; |
|
416 |
gtSineGunShot: begin |
|
417 |
gear^.Radius:= 5; |
|
418 |
gear^.Health:= 6000; |
|
419 |
end; |
|
420 |
gtFlamethrower: begin |
|
421 |
gear^.Tag:= 10; |
|
422 |
gear^.Timer:= 10; |
|
423 |
gear^.Health:= 500; |
|
424 |
gear^.Damage:= 100; |
|
425 |
end; |
|
426 |
gtLandGun: begin |
|
427 |
gear^.Tag:= 10; |
|
428 |
gear^.Timer:= 10; |
|
429 |
gear^.Health:= 1000; |
|
430 |
gear^.Damage:= 100; |
|
431 |
end; |
|
432 |
gtPoisonCloud: begin |
|
433 |
gear^.Timer:= 5000; |
|
434 |
gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000; |
|
435 |
end; |
|
436 |
gtResurrector: begin |
|
437 |
gear^.Radius := 100; |
|
438 |
gear^.Tag := 0 |
|
439 |
end; |
|
440 |
gtWaterUp: begin |
|
441 |
gear^.Tag := 47; |
|
442 |
end; |
|
443 |
gtNapalmBomb: begin |
|
444 |
gear^.Timer:= 1000; |
|
445 |
gear^.Radius:= 5; |
|
446 |
gear^.Density:= _1_5; |
|
447 |
end; |
|
448 |
gtStructure: begin |
|
449 |
gear^.Elasticity:= _0_55; |
|
450 |
gear^.Friction:= _0_995; |
|
451 |
gear^.Density:= _0_9; |
|
452 |
gear^.Radius:= 13; |
|
453 |
gear^.Health:= 200; |
|
454 |
gear^.Timer:= 0; |
|
455 |
gear^.Tag:= TotalRounds + 3; |
|
456 |
gear^.Pos:= 1; |
|
457 |
end; |
|
458 |
end; |
|
459 |
||
460 |
InsertGearToList(gear); |
|
461 |
AddGear:= gear; |
|
462 |
||
463 |
ScriptCall('onGearAdd', gear^.uid); |
|
464 |
end; |
|
465 |
||
466 |
procedure DeleteGear(Gear: PGear); |
|
467 |
var team: PTeam; |
|
468 |
t,i: Longword; |
|
469 |
k: boolean; |
|
470 |
begin |
|
471 |
||
472 |
ScriptCall('onGearDelete', gear^.uid); |
|
473 |
||
474 |
DeleteCI(Gear); |
|
475 |
||
476 |
FreeTexture(Gear^.Tex); |
|
477 |
Gear^.Tex:= nil; |
|
478 |
||
479 |
// make sure that portals have their link removed before deletion |
|
480 |
if (Gear^.Kind = gtPortal) then |
|
481 |
begin |
|
482 |
if (Gear^.IntersectGear <> nil) then |
|
483 |
if (Gear^.IntersectGear^.IntersectGear = Gear) then |
|
484 |
Gear^.IntersectGear^.IntersectGear:= nil; |
|
485 |
end |
|
486 |
else if Gear^.Kind = gtHedgehog then |
|
487 |
(* |
|
488 |
This behaviour dates back to revision 4, and I accidentally encountered it with TARDIS. I don't think it must apply to any modern weapon, since if it was actually hit, the best the gear could do would be to destroy itself immediately, and you'd still end up with two graves. I believe it should be removed |
|
489 |
if (CurAmmoGear <> nil) and (CurrentHedgehog^.Gear = Gear) then |
|
490 |
begin |
|
491 |
AttackBar:= 0; |
|
492 |
Gear^.Message:= gmDestroy; |
|
493 |
CurAmmoGear^.Message:= gmDestroy; |
|
494 |
exit |
|
495 |
end |
|
496 |
else*) |
|
497 |
begin |
|
6792
f72c8b5d421c
Ensure flawless is false if any hog is lost, unless it was lost doing a kamikaze
nemo
parents:
6700
diff
changeset
|
498 |
if (Gear <> CurrentHedgehog^.Gear) or (CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtKamikaze) then |
f72c8b5d421c
Ensure flawless is false if any hog is lost, unless it was lost doing a kamikaze
nemo
parents:
6700
diff
changeset
|
499 |
Gear^.Hedgehog^.Team^.Clan^.Flawless:= false; |
6581 | 500 |
if (hwRound(Gear^.Y) >= cWaterLine) then |
501 |
begin |
|
502 |
t:= max(Gear^.Damage, Gear^.Health); |
|
503 |
Gear^.Damage:= t; |
|
6982 | 504 |
if ((not SuddenDeathDmg and (WaterOpacity < $FF)) or (SuddenDeathDmg and (WaterOpacity < $FF))) |
6581 | 505 |
and (hwRound(Gear^.Y) < cWaterLine + 256) then |
506 |
spawnHealthTagForHH(Gear, t); |
|
507 |
end; |
|
508 |
||
509 |
team:= Gear^.Hedgehog^.Team; |
|
510 |
if CurrentHedgehog^.Gear = Gear then |
|
511 |
begin |
|
512 |
AttackBar:= 0; |
|
513 |
FreeActionsList; // to avoid ThinkThread on drawned gear |
|
514 |
if ((Ammoz[CurrentHedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) <> 0) |
|
515 |
and (CurrentHedgehog^.MultiShootAttacks > 0) then |
|
516 |
OnUsedAmmo(CurrentHedgehog^); |
|
517 |
end; |
|
518 |
||
519 |
Gear^.Hedgehog^.Gear:= nil; |
|
520 |
if Gear^.Hedgehog^.King then |
|
521 |
begin |
|
522 |
// are there any other kings left? Just doing nil check. Presumably a mortally wounded king will get reaped soon enough |
|
523 |
k:= false; |
|
524 |
for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
|
525 |
if (team^.Clan^.Teams[i]^.Hedgehogs[0].Gear <> nil) then |
|
526 |
k:= true; |
|
527 |
if not k then |
|
528 |
for i:= 0 to Pred(team^.Clan^.TeamsNumber) do |
|
529 |
begin |
|
530 |
team^.Clan^.Teams[i]^.hasGone:= true; |
|
531 |
TeamGoneEffect(team^.Clan^.Teams[i]^) |
|
532 |
end |
|
533 |
end; |
|
534 |
||
535 |
// should be not CurrentHedgehog, but hedgehog of the last gear which caused damage to this hog |
|
536 |
// same stand for CheckHHDamage |
|
537 |
if (Gear^.LastDamage <> nil) then |
|
538 |
uStats.HedgehogDamaged(Gear, Gear^.LastDamage, 0, true) |
|
539 |
else |
|
540 |
uStats.HedgehogDamaged(Gear, CurrentHedgehog, 0, true); |
|
541 |
||
542 |
inc(KilledHHs); |
|
543 |
RecountTeamHealth(team); |
|
544 |
if (CurrentHedgehog <> nil) and CurrentHedgehog^.Effects[heResurrectable] and |
|
545 |
(not Gear^.Hedgehog^.Effects[heResurrectable]) then |
|
546 |
with CurrentHedgehog^ do |
|
547 |
begin |
|
548 |
inc(Team^.stats.AIKills); |
|
549 |
FreeTexture(Team^.AIKillsTex); |
|
550 |
Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16); |
|
551 |
end |
|
552 |
end; |
|
553 |
with Gear^ do |
|
554 |
AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
|
555 |
||
556 |
if CurAmmoGear = Gear then |
|
557 |
CurAmmoGear:= nil; |
|
558 |
if FollowGear = Gear then |
|
559 |
FollowGear:= nil; |
|
560 |
if lastGearByUID = Gear then |
|
561 |
lastGearByUID := nil; |
|
562 |
RemoveGearFromList(Gear); |
|
563 |
Dispose(Gear) |
|
564 |
end; |
|
565 |
||
566 |
end. |