Eliminate flake kick on themes with no flakes, more than 200 flakes (city) or explosions of 25 or smaller
authornemo
Fri, 26 Mar 2010 17:22:52 +0000
changeset 3083 8da8f2515221
parent 3082 36586b751d64
child 3084 a12771928d40
Eliminate flake kick on themes with no flakes, more than 200 flakes (city) or explosions of 25 or smaller
hedgewars/uGears.pas
hedgewars/uLandObjects.pas
hedgewars/uVisualGears.pas
--- a/hedgewars/uGears.pas	Fri Mar 26 17:18:44 2010 +0000
+++ b/hedgewars/uGears.pas	Fri Mar 26 17:22:52 2010 +0000
@@ -1759,6 +1759,8 @@
 begin
 TargetPoint.X:= NoPointX;
 {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF}
+if Radius > 25 then KickFlakes(Radius, X, Y);
+
 if ((Mask and EXPLNoGfx) = 0) then
     begin
     if Radius > 50 then AddGear(X, Y, gtBigExplosion, 0, _0, _0, 0)
@@ -1771,8 +1773,6 @@
 else
     dmgRadius:= Radius;
 
-KickFlakes(dmgRadius, X, Y);
-
 Gear:= GearsList;
 while Gear <> nil do
     begin
--- a/hedgewars/uLandObjects.pas	Fri Mar 26 17:18:44 2010 +0000
+++ b/hedgewars/uLandObjects.pas	Fri Mar 26 17:22:52 2010 +0000
@@ -353,7 +353,6 @@
 var s: shortstring;
     f: textfile;
     i, ii: LongInt;
-    vobcount: Longword;
     c1, c2: TSDL_Color;
 
     procedure CheckRect(Width, Height, x, y, w, h: LongWord);
--- a/hedgewars/uVisualGears.pas	Fri Mar 26 17:18:44 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Fri Mar 26 17:22:52 2010 +0000
@@ -55,7 +55,7 @@
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
 procedure ProcessVisualGears(Steps: Longword);
-procedure KickFlakes(dmgRadius, X, Y: LongInt);
+procedure KickFlakes(Radius, X, Y: LongInt);
 procedure DrawVisualGears(Layer: LongWord);
 procedure DeleteVisualGear(Gear: PVisualGear);
 procedure AddClouds;
@@ -63,7 +63,7 @@
 procedure FreeVisualGears;
 
 var VisualGearsList: PVisualGear;
-    vobFrameTicks, vobFramesCount: Longword;
+    vobFrameTicks, vobFramesCount, vobCount: Longword;
     vobVelocity, vobFallSpeed: LongInt;
 
 implementation
@@ -657,12 +657,11 @@
       end
 end;
 
-procedure KickFlakes(dmgRadius, X, Y: LongInt);
+procedure KickFlakes(Radius, X, Y: LongInt);
 var Gear, t: PVisualGear;
     dmg: LongInt;
 begin
-if dmgRadius = 0 then exit;
-
+if (vobCount = 0) or (vobCount > 200) then exit;
 t:= VisualGearsList;
 while t <> nil do
       begin
@@ -670,7 +669,7 @@
       if Gear^.Kind = vgtFlake then
           begin
           // Damage calc from doMakeExplosion
-          dmg:= min(100,dmgRadius*2  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))));
+          dmg:= min(100,Radius*2  + cHHRadius div 2 - hwRound(Distance(Gear^.X - int2hwFloat(X), Gear^.Y - int2hwFloat(Y))));
           if dmg > 1 then
               begin
               Gear^.tdX:= Gear^.dX + SignAs(_0_01 * dmg + cHHKick, Gear^.X - int2hwFloat(X));