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