Another take at prettier crate appearance
authornemo
Sun, 24 Jun 2012 09:12:53 -0400
changeset 7276 e570bc0df33c
parent 7274 a07777b818f1
child 7277 b817a478dcfb
child 7278 000e4543f204
Another take at prettier crate appearance
hedgewars/GSHandlers.inc
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uVisualGears.pas
--- a/hedgewars/GSHandlers.inc	Sat Jun 23 23:04:06 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Sun Jun 24 09:12:53 2012 -0400
@@ -2114,18 +2114,32 @@
         end
     else
         begin 
-        if Gear^.Timer = 0 then
-        begin
+        if Gear^.Timer = 500 then
+            begin
 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up
    voices. Reinforcements voices is heard for active team, not team-to-be.  Either that or change crate spawn from end of turn to start, although that
    has its own complexities. *)
-        sparkles:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
-        if sparkles <> nil then
+            // Abuse a couple of gear values to track origin
+            Gear^.Angle:= hwRound(Gear^.X);
+            Gear^.Power:= hwRound(Gear^.Y);
+            Gear^.Tag:= random(2);
+            inc(Gear^.Timer)
+            end;
+        if Gear^.Timer < 1833 then inc(Gear^.Timer);
+        if Gear^.Timer = 1000 then
             begin
-            sparkles^.Tint:= $FAB22CFF
-            end
-        end;
-        if (GameTicks and $1 = 0) and (Gear^.Timer < 255) then inc(Gear^.Timer)
+            sparkles:= AddVisualGear(Gear^.Angle, Gear^.Power, vgtDust, 1);
+            if sparkles <> nil then
+                begin
+                sparkles^.dX:= 0;
+                sparkles^.dY:= 0;
+                sparkles^.Angle:= 270;
+                if Gear^.Tag = 1 then 
+                    sparkles^.Tint:= $3744D7FF
+                else sparkles^.Tint:= $FAB22CFF
+                end;
+            end;
+        if Gear^.Timer < 1000 then exit;
         end;
 
     if (Gear^.Damage > 0) or exBoom then
--- a/hedgewars/uGearsList.pas	Sat Jun 23 23:04:06 2012 -0400
+++ b/hedgewars/uGearsList.pas	Sun Jun 24 09:12:53 2012 -0400
@@ -246,7 +246,7 @@
                 gear^.nImpactSounds:= 1;
                 gear^.Radius:= 16;
                 gear^.Elasticity:= _0_3;
-                gear^.Timer:= 0
+                gear^.Timer:= 500
                 end;
   gtExplosives: begin
                 gear^.ImpactSound:= sndGrenadeImpact;
--- a/hedgewars/uGearsRender.pas	Sat Jun 23 23:04:06 2012 -0400
+++ b/hedgewars/uGearsRender.pas	Sun Jun 24 09:12:53 2012 -0400
@@ -990,30 +990,36 @@
                        else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
                        
             gtCase: begin
-                    if Gear^.Timer < 255 then Tint($FF, $FF, $FF, Gear^.Timer);
-                    if ((Gear^.Pos and posCaseAmmo) <> 0) then
-                        begin
-                        i:= (GameTicks shr 6) mod 64;
-                        if i > 18 then
-                            i:= 0;
-                        DrawSprite(sprCase, x - 24, y - 24, i);
-                        end
-                    else if ((Gear^.Pos and posCaseHealth) <> 0) then
+                    if Gear^.Timer > 1000 then
                         begin
-                        i:= ((GameTicks shr 6) + 38) mod 64;
-                        if i > 13 then
-                            i:= 0;
-                        DrawSprite(sprFAid, x - 24, y - 24, i);
-                        end
-                    else if ((Gear^.Pos and posCaseUtility) <> 0) then
+                        if ((Gear^.Pos and posCaseAmmo) <> 0) then
+                            begin
+                            i:= (GameTicks shr 6) mod 64;
+                            if i > 18 then
+                                i:= 0;
+                            DrawSprite(sprCase, x - 24, y - 24, i);
+                            end
+                        else if ((Gear^.Pos and posCaseHealth) <> 0) then
+                            begin
+                            i:= ((GameTicks shr 6) + 38) mod 64;
+                            if i > 13 then
+                                i:= 0;
+                            DrawSprite(sprFAid, x - 24, y - 24, i);
+                            end
+                        else if ((Gear^.Pos and posCaseUtility) <> 0) then
+                            begin
+                            i:= (GameTicks shr 6) mod 70;
+                            if i > 23 then
+                                i:= 0;
+                            i:= i mod 12;
+                            DrawSprite(sprUtility, x - 24, y - 24, i);
+                            end;
+                        end;
+                    if Gear^.Timer <= 1833 then
                         begin
-                        i:= (GameTicks shr 6) mod 70;
-                        if i > 23 then
-                            i:= 0;
-                        i:= i mod 12;
-                        DrawSprite(sprUtility, x - 24, y - 24, i);
-                        end;
-                    if Gear^.Timer < 255 then Tint($FF, $FF, $FF, $FF);
+                        DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
+                                            Gear^.Angle+WorldDx, Gear^.Power+WorldDy-16, 4+Gear^.Tag, 1, 32, 32, 270);
+                        end
                     end;
       gtExplosives: begin
                     if ((Gear^.State and gstDrowning) <> 0) then
--- a/hedgewars/uVisualGears.pas	Sat Jun 23 23:04:06 2012 -0400
+++ b/hedgewars/uVisualGears.pas	Sun Jun 24 09:12:53 2012 -0400
@@ -642,7 +642,7 @@
                   vgtSmoke: DrawTextureF(SpritesData[sprSmoke].Texture, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 7 - Gear^.Frame, 1, SpritesData[sprSmoke].Width, SpritesData[sprSmoke].Height);
                   vgtSmokeWhite: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
                   vgtDust: if Gear^.State = 1 then
-                               DrawSprite(sprSnowDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame)
+                               DrawSpriteRotatedF(sprSnowDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame, 1, Gear^.Angle)
                            else
                                DrawSprite(sprDust, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame);
                   vgtFire: if (Gear^.State and gstTmpFlag) = 0 then