hedgewars/uGears.pas
changeset 3475 95345f98da19
parent 3472 b1832a3761e6
child 3476 1ec68b8d3bd1
equal deleted inserted replaced
3474:c6d308f5a431 3475:95345f98da19
   111                 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
   111                 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
   112                 end;
   112                 end;
   113  
   113  
   114 procedure DeleteGear(Gear: PGear); forward;
   114 procedure DeleteGear(Gear: PGear); forward;
   115 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward;
   115 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); forward;
       
   116 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord); forward;
   116 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
   117 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
   117 //procedure AmmoFlameWork(Ammo: PGear); forward;
   118 //procedure AmmoFlameWork(Ammo: PGear); forward;
   118 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
   119 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear; forward;
   119 procedure SpawnBoxOfSmth; forward;
   120 procedure SpawnBoxOfSmth; forward;
   120 procedure AfterAttack; forward;
   121 procedure AfterAttack; forward;
   268      gtClusterBomb,
   269      gtClusterBomb,
   269      gtGasBomb: begin
   270      gtGasBomb: begin
   270                 gear^.ImpactSound:= sndGrenadeImpact;
   271                 gear^.ImpactSound:= sndGrenadeImpact;
   271                 gear^.nImpactSounds:= 1;
   272                 gear^.nImpactSounds:= 1;
   272                 gear^.AdvBounce:= 1;
   273                 gear^.AdvBounce:= 1;
   273                 gear^.Radius:= 4;
   274                 gear^.Radius:= 6;
   274                 gear^.Elasticity:= _0_6;
   275                 gear^.Elasticity:= _0_8;
   275                 gear^.Friction:= _0_96;
   276                 gear^.Friction:= _0_8;
   276                 gear^.RenderTimer:= true;
   277                 gear^.RenderTimer:= true;
   277                 if gear^.Timer = 0 then gear^.Timer:= 3000
   278                 if gear^.Timer = 0 then gear^.Timer:= 3000
   278                 end;
   279                 end;
   279   gtWatermelon: begin
   280   gtWatermelon: begin
   280                 gear^.ImpactSound:= sndMelonImpact;
   281                 gear^.ImpactSound:= sndMelonImpact;
  1137 if (GameFlags and gfArtillery) <> 0 then
  1138 if (GameFlags and gfArtillery) <> 0 then
  1138     cArtillery:= true
  1139     cArtillery:= true
  1139 end;
  1140 end;
  1140 
  1141 
  1141 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord);
  1142 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord);
       
  1143 begin
       
  1144 doMakeExplosion(X, Y, Radius, Mask, $FFFFFFFF);
       
  1145 end;
       
  1146 
       
  1147 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask, Tint: LongWord);
  1142 var Gear: PGear;
  1148 var Gear: PGear;
  1143     dmg, dmgRadius, dmgBase: LongInt;
  1149     dmg, dmgRadius, dmgBase: LongInt;
  1144     fX, fY: hwFloat;
  1150     fX, fY: hwFloat;
       
  1151     vg: PVisualGear;
  1145 begin
  1152 begin
  1146 TargetPoint.X:= NoPointX;
  1153 TargetPoint.X:= NoPointX;
  1147 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
  1154 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
  1148 if Radius > 25 then KickFlakes(Radius, X, Y);
  1155 if Radius > 25 then KickFlakes(Radius, X, Y);
  1149 
  1156 
  1150 if ((Mask and EXPLNoGfx) = 0) then
  1157 if ((Mask and EXPLNoGfx) = 0) then
  1151     begin
  1158     begin
  1152     if Radius > 50 then AddVisualGear(X, Y, vgtBigExplosion)
  1159     vg:= nil;
  1153     else if Radius > 10 then AddVisualGear(X, Y, vgtExplosion);
  1160     if Radius > 50 then vg:= AddVisualGear(X, Y, vgtBigExplosion)
       
  1161     else if Radius > 10 then vg:= AddVisualGear(X, Y, vgtExplosion);
       
  1162     if vg <> nil then
       
  1163         vg^.Tint:= Tint;
  1154     end;
  1164     end;
  1155 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion);
  1165 if (Mask and EXPLAutoSound) <> 0 then PlaySound(sndExplosion);
  1156 
  1166 
  1157 if (Mask and EXPLAllDamageInRadius) = 0 then
  1167 if (Mask and EXPLAllDamageInRadius) = 0 then
  1158     dmgRadius:= Radius shl 1
  1168     dmgRadius:= Radius shl 1