equal
deleted
inserted
replaced
18 |
18 |
19 {$INCLUDE "options.inc"} |
19 {$INCLUDE "options.inc"} |
20 unit uGearsList; |
20 unit uGearsList; |
21 |
21 |
22 interface |
22 interface |
23 uses uFloat, uTypes; |
23 uses uFloat, uTypes, SDLh; |
24 |
24 |
25 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
25 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
26 procedure DeleteGear(Gear: PGear); |
26 procedure DeleteGear(Gear: PGear); |
27 procedure InsertGearToList(Gear: PGear); |
27 procedure InsertGearToList(Gear: PGear); |
28 procedure RemoveGearFromList(Gear: PGear); |
28 procedure RemoveGearFromList(Gear: PGear); |
154 end; |
154 end; |
155 |
155 |
156 |
156 |
157 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
157 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
158 var gear: PGear; |
158 var gear: PGear; |
|
159 c: byte; |
159 begin |
160 begin |
160 inc(GCounter); |
161 inc(GCounter); |
161 AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
162 AddFileLog('AddGear: #' + inttostr(GCounter) + ' (' + inttostr(x) + ',' + inttostr(y) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + EnumToStr(Kind)); |
162 |
163 |
163 New(gear); |
164 New(gear); |
178 gear^.ImpactSound:= sndNone; |
179 gear^.ImpactSound:= sndNone; |
179 gear^.Density:= _1; |
180 gear^.Density:= _1; |
180 // Define ammo association, if any. |
181 // Define ammo association, if any. |
181 gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; |
182 gear^.AmmoType:= GearKindAmmoTypeMap[Kind]; |
182 gear^.CollisionMask:= $FFFF; |
183 gear^.CollisionMask:= $FFFF; |
|
184 gear^.Tint:= $FFFFFFFF; |
183 |
185 |
184 if CurrentHedgehog <> nil then |
186 if CurrentHedgehog <> nil then |
185 begin |
187 begin |
186 gear^.Hedgehog:= CurrentHedgehog; |
188 gear^.Hedgehog:= CurrentHedgehog; |
187 if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then |
189 if (CurrentHedgehog^.Gear <> nil) and (hwRound(CurrentHedgehog^.Gear^.X) = X) and (hwRound(CurrentHedgehog^.Gear^.Y) = Y) then |
233 gear^.Density:= _3; |
235 gear^.Density:= _3; |
234 gear^.Z:= cHHZ; |
236 gear^.Z:= cHHZ; |
235 if (GameFlags and gfAISurvival) <> 0 then |
237 if (GameFlags and gfAISurvival) <> 0 then |
236 if gear^.Hedgehog^.BotLevel > 0 then |
238 if gear^.Hedgehog^.BotLevel > 0 then |
237 gear^.Hedgehog^.Effects[heResurrectable] := 1; |
239 gear^.Hedgehog^.Effects[heResurrectable] := 1; |
|
240 // this would presumably be set in the frontend |
|
241 // if we weren't going to do that yet, would need to reinit GetRandom |
|
242 // oh, and, randomising slightly R and B might be nice too. |
|
243 //gear^.Tint:= $fa00efff or ((random(80)+128) shl 16) |
|
244 //gear^.Tint:= $faa4efff |
|
245 //gear^.Tint:= (($e0+random(32)) shl 24) or |
|
246 // ((random(80)+128) shl 16) or |
|
247 // (($d5+random(32)) shl 8) or $ff |
|
248 c:= random(32); |
|
249 gear^.Tint:= (($e0+c) shl 24) or |
|
250 ((random(90)+128) shl 16) or |
|
251 (($d5+c) shl 8) or $ff |
238 end; |
252 end; |
239 gtShell: begin |
253 gtShell: begin |
240 gear^.Elasticity:= _0_8; |
254 gear^.Elasticity:= _0_8; |
241 gear^.Friction:= _0_8; |
255 gear^.Friction:= _0_8; |
242 gear^.Radius:= 4; |
256 gear^.Radius:= 4; |
270 end; |
284 end; |
271 State:= State or gstInvisible; |
285 State:= State or gstInvisible; |
272 Health:= random(vobFrameTicks); |
286 Health:= random(vobFrameTicks); |
273 if gear^.Timer = 0 then Timer:= random(vobFramesCount); |
287 if gear^.Timer = 0 then Timer:= random(vobFramesCount); |
274 Damage:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) * 8; |
288 Damage:= (random(2) * 2 - 1) * (vobVelocity + random(vobVelocity)) * 8; |
|
289 Tint:= (ExplosionBorderColor and RMask shl RShift) or |
|
290 (ExplosionBorderColor and GMask shl GShift) or |
|
291 (ExplosionBorderColor and BMask shl BShift) or $FF; |
275 end |
292 end |
276 end; |
293 end; |
277 gtGrave: begin |
294 gtGrave: begin |
278 gear^.ImpactSound:= sndGraveImpact; |
295 gear^.ImpactSound:= sndGraveImpact; |
279 gear^.nImpactSounds:= 1; |
296 gear^.nImpactSounds:= 1; |
398 gtFirePunch: begin |
415 gtFirePunch: begin |
399 if gear^.Timer = 0 then gear^.Timer:= 3000; |
416 if gear^.Timer = 0 then gear^.Timer:= 3000; |
400 gear^.Radius:= 15; |
417 gear^.Radius:= 15; |
401 gear^.Tag:= Y |
418 gear^.Tag:= Y |
402 end; |
419 end; |
403 gtAirAttack: gear^.Z:= cHHZ+2; |
420 gtAirAttack: begin |
|
421 gear^.Z:= cHHZ+2; |
|
422 gear^.Tint:= gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF |
|
423 end; |
404 gtAirBomb: begin |
424 gtAirBomb: begin |
405 gear^.Radius:= 5; |
425 gear^.Radius:= 5; |
406 gear^.Density:= _2; |
426 gear^.Density:= _2; |
407 end; |
427 end; |
408 gtBlowTorch: begin |
428 gtBlowTorch: begin |
483 if gear^.Timer = 0 then gear^.Timer:= 5001; |
503 if gear^.Timer = 0 then gear^.Timer:= 5001; |
484 end; |
504 end; |
485 gtRCPlane: begin |
505 gtRCPlane: begin |
486 if gear^.Timer = 0 then gear^.Timer:= 15000; |
506 if gear^.Timer = 0 then gear^.Timer:= 15000; |
487 gear^.Health:= 3; |
507 gear^.Health:= 3; |
488 gear^.Radius:= 8 |
508 gear^.Radius:= 8; |
|
509 gear^.Tint:= gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF |
489 end; |
510 end; |
490 gtJetpack: begin |
511 gtJetpack: begin |
491 gear^.Health:= 2000; |
512 gear^.Health:= 2000; |
492 gear^.Damage:= 100; |
513 gear^.Damage:= 100; |
493 gear^.State:= Gear^.State or gstSubmersible |
514 gear^.State:= Gear^.State or gstSubmersible |
542 gear^.Damage:= 100; |
563 gear^.Damage:= 100; |
543 end; |
564 end; |
544 gtPoisonCloud: begin |
565 gtPoisonCloud: begin |
545 if gear^.Timer = 0 then gear^.Timer:= 5000; |
566 if gear^.Timer = 0 then gear^.Timer:= 5000; |
546 gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000; |
567 gear^.dY:= int2hwfloat(-4 + longint(getRandom(8))) / 1000; |
|
568 gear^.Tint:= $C0C000C0 |
547 end; |
569 end; |
548 gtResurrector: begin |
570 gtResurrector: begin |
549 gear^.Radius := 100; |
571 gear^.Radius := 100; |
550 gear^.Tag := 0 |
572 gear^.Tag := 0; |
|
573 gear^.Tint:= $F5DB35FF |
551 end; |
574 end; |
552 gtWaterUp: begin |
575 gtWaterUp: begin |
553 gear^.Tag := 47; |
576 gear^.Tag := 47; |
554 end; |
577 end; |
555 gtNapalmBomb: begin |
578 gtNapalmBomb: begin |