Flatten flakes for halloween theme, based on feedback from sheepluva
authornemo
Sat, 05 Nov 2011 11:41:56 -0400
changeset 6288 fcc50b96d20a
parent 6287 68db7625060d
child 6289 95ffd59d0f4a
Flatten flakes for halloween theme, based on feedback from sheepluva
hedgewars/uLandObjects.pas
hedgewars/uVariables.pas
hedgewars/uVisualGears.pas
share/hedgewars/Data/Themes/Halloween/theme.cfg
--- a/hedgewars/uLandObjects.pas	Sat Nov 05 09:38:07 2011 +0300
+++ b/hedgewars/uLandObjects.pas	Sat Nov 05 11:41:56 2011 -0400
@@ -588,6 +588,7 @@
             vobFallSpeed:= StrToInt(Trim(s));
             end;
         end
+    else if key = 'flatten-flakes' then cFlattenFlakes:= true
     else if key = 'sd-water-top' then
         begin
         i:= Pos(',', s);
--- a/hedgewars/uVariables.pas	Sat Nov 05 09:38:07 2011 +0300
+++ b/hedgewars/uVariables.pas	Sat Nov 05 11:41:56 2011 -0400
@@ -46,6 +46,7 @@
     PathPrefix      : shortstring = './';
     UserPathPrefix  : shortstring = './';
     cShowFPS        : boolean     = false;
+    cFlattenFlakes  : boolean     = false;
     cAltDamage      : boolean     = true;
     cReducedQuality : LongWord    = rqNone;
     UserNick        : shortstring = '';
@@ -2551,6 +2552,7 @@
     PathPrefix      := './';
     UserPathPrefix  := './';
     cShowFPS        := false;
+    cFlattenFlakes  := false;
     cAltDamage      := true;
     cReducedQuality := rqNone;
     UserNick        := '';
--- a/hedgewars/uVisualGears.pas	Sat Nov 05 09:38:07 2011 +0300
+++ b/hedgewars/uVisualGears.pas	Sat Nov 05 11:41:56 2011 -0400
@@ -337,7 +337,8 @@
 if State <> 0 then gear^.State:= State;
 
 case Gear^.Kind of
-    vgtFlake: if random(2) = 0 then gear^.Layer:= 0   // 50%
+    vgtFlake: if cFlattenFlakes then gear^.Layer:= 0
+              else if random(2) = 0 then gear^.Layer:= 0   // 50%
               else if random(2) = 0 then gear^.Layer:= 1  // 25%
               else gear^.Layer:= random(2)+2;  // 12.5% each
 
@@ -484,16 +485,32 @@
            begin
            if Gear^.Tint <> $FFFFFFFF then Tint(Gear^.Tint);
            case Gear^.Kind of
-               vgtFlake: if SuddenDeathDmg then
-                             if vobSDVelocity = 0 then
-                                 DrawTextureF(SpritesData[sprSDFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
+               vgtFlake: if cFlattenFlakes then
+                             begin
+                             if SuddenDeathDmg then
+                                 if vobSDVelocity = 0 then
+                                     DrawSprite(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
+                                 else
+                                     DrawRotatedF(sprSDFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
                              else
-                                 DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
+                                 if vobVelocity = 0 then
+                                     DrawSprite(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
+                                 else
+                                     DrawRotatedF(sprFlake, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, Gear^.Angle)
+                             end
                          else
-                             if vobVelocity = 0 then
-                                 DrawTextureF(SpritesData[sprFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
+                             begin
+                             if SuddenDeathDmg then
+                                 if vobSDVelocity = 0 then
+                                     DrawTextureF(SpritesData[sprSDFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
+                                 else
+                                     DrawRotatedTextureF(SpritesData[sprSDFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
                              else
-                                 DrawRotatedTextureF(SpritesData[sprFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle);
+                                 if vobVelocity = 0 then
+                                     DrawTextureF(SpritesData[sprFlake].Texture, 0.5, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height)
+                                 else
+                                     DrawRotatedTextureF(SpritesData[sprFlake].Texture, 0.5, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame, 1, SpritesData[sprFlake].Width, SpritesData[sprFlake].Height, Gear^.Angle)
+                             end;
                vgtCloud: if SuddenDeathDmg then
                              DrawSprite(sprSDCloud, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy + SkyOffset, Gear^.Frame)
                          else
--- a/share/hedgewars/Data/Themes/Halloween/theme.cfg	Sat Nov 05 09:38:07 2011 +0300
+++ b/share/hedgewars/Data/Themes/Halloween/theme.cfg	Sat Nov 05 11:41:56 2011 -0400
@@ -8,3 +8,4 @@
 object = Rock, 3, 65, 258, 175, 2, 1, 0, 0, 240, 215
 object = RockShort, 3, 0, 165, 163, 2, 1, 0, 0, 163, 140
 flakes = 20, 7, 130, 0, 5
+flatten-flakes = yes