warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
authornemo
Sun, 03 Jun 2012 11:02:12 -0400
changeset 7168 8defaabce92e
parent 7167 0b3b306f129a
child 7170 84ac6c6d2d8e
warp sound when AI survival hog respawns. attempt at a bit of a crate spawn animation (moar sparkles and a quick fadein)
hedgewars/GSHandlers.inc
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/GSHandlers.inc	Sat Jun 02 22:31:41 2012 +0200
+++ b/hedgewars/GSHandlers.inc	Sun Jun 03 11:02:12 2012 -0400
@@ -2077,6 +2077,7 @@
     exBoom: boolean;
     dX, dY: HWFloat;
     hog: PHedgehog;
+    sparkles: PVisualGear;
 begin
     k := Gear^.Kind;
     exBoom := false;
@@ -2108,6 +2109,21 @@
         Gear^.Damage := 0;
         if Gear^.Health <= 0 then
             exBoom := true;
+        end
+    else
+        begin 
+        if Gear^.Timer = 0 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
+            begin
+            sparkles^.Tint:= $FAB22CFF
+            end
+        end;
+        if (GameTicks and $1 = 0) and (Gear^.Timer < 255) then inc(Gear^.Timer)
         end;
 
     if (Gear^.Damage > 0) or exBoom then
--- a/hedgewars/uGearsList.pas	Sat Jun 02 22:31:41 2012 +0200
+++ b/hedgewars/uGearsList.pas	Sun Jun 03 11:02:12 2012 -0400
@@ -246,7 +246,8 @@
                 gear^.ImpactSound:= sndGraveImpact;
                 gear^.nImpactSounds:= 1;
                 gear^.Radius:= 16;
-                gear^.Elasticity:= _0_3
+                gear^.Elasticity:= _0_3;
+                gear^.Timer:= 0
                 end;
   gtExplosives: begin
                 gear^.ImpactSound:= sndGrenadeImpact;
--- a/hedgewars/uGearsRender.pas	Sat Jun 02 22:31:41 2012 +0200
+++ b/hedgewars/uGearsRender.pas	Sun Jun 03 11:02:12 2012 -0400
@@ -989,7 +989,9 @@
                            DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
                        else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
                        
-            gtCase: if ((Gear^.Pos and posCaseAmmo) <> 0) then
+            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
@@ -1011,6 +1013,8 @@
                         i:= i mod 12;
                         DrawSprite(sprUtility, x - 24, y - 24, i);
                         end;
+                    if Gear^.Timer < 255 then Tint($FF, $FF, $FF, $FF);
+                    end;
       gtExplosives: begin
                     if ((Gear^.State and gstDrowning) <> 0) then
                         DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
--- a/hedgewars/uGearsUtils.pas	Sat Jun 02 22:31:41 2012 +0200
+++ b/hedgewars/uGearsUtils.pas	Sun Jun 03 11:02:12 2012 -0400
@@ -474,6 +474,7 @@
     if gear <> nil then
         begin
         AddVisualGear(hwRound(gear^.X), hwRound(gear^.Y), vgtExplosion);
+        PlaySound(sndWarp);
         RenderHealth(gear^.Hedgehog^);
         ScriptCall('onGearResurrect', gear^.uid);
         gear^.State := gstWait;