Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
authornemo
Fri, 18 May 2012 13:35:22 -0400
changeset 7092 c9ca770fd7fc
parent 7091 7989850b4418
child 7093 2d7f1fb73335
child 7094 f5a5578be66b
Add an emergency return to the timebox in the case of death of rest of team. Also add a small visual effect to AI survival
hedgewars/GSHandlers.inc
hedgewars/uGearsUtils.pas
--- a/hedgewars/GSHandlers.inc	Thu May 17 20:23:58 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Fri May 18 13:35:22 2012 -0400
@@ -5346,14 +5346,8 @@
             and ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0)
             and (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then
                 inc(cnt);
-                
     if (cnt = 0) or SuddenDeathDmg or (Gear^.Timer = 0) then
         begin
-        Gear^.SoundChannel := LoopSound(sndTardis);
-        Gear^.Pos:= 1;
-        Gear^.Power:= 0;
-        Gear^.Timer:= 0;
-        
         if HH^.GearHidden <> nil then
             FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH,true);
             
@@ -5361,9 +5355,19 @@
             begin
             Gear^.X:= HH^.GearHidden^.X;
             Gear^.Y:= HH^.GearHidden^.Y;
-            //HH^.Gear:=HH^.GearHidden;
-            //HH^.GearHidden:= nil;
-            //HH^.Gear^.State:= HH^.Gear^.State or gstInvisible;
+            end;
+        Gear^.Timer:= 0;
+
+        if (HH^.GearHidden <> nil) and (cnt = 0) then // do an emergency jump back in this case. the team needs you!
+            begin
+            AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtExplosion);
+            Gear^.Pos:= 2;
+            Gear^.Power:= 255;
+            end
+        else begin
+            Gear^.SoundChannel := LoopSound(sndTardis);
+            Gear^.Pos:= 1;
+            Gear^.Power:= 0;
             end
         end
     else dec(Gear^.Timer);
--- a/hedgewars/uGearsUtils.pas	Thu May 17 20:23:58 2012 -0400
+++ b/hedgewars/uGearsUtils.pas	Fri May 18 13:35:22 2012 -0400
@@ -443,6 +443,8 @@
 
 procedure ResurrectHedgehog(gear: PGear);
 var tempTeam : PTeam;
+    sparkles: PVisualGear;
+    gX, gY: LongInt;
 begin
     AttackBar:= 0;
     gear^.dX := _0;
@@ -459,9 +461,19 @@
             end;
     tempTeam := gear^.Hedgehog^.Team;
     DeleteCI(gear);
+    gX := hwRound(gear^.X);
+    gY := hwRound(gear^.Y);
+    // might need more sparkles for a column
+    sparkles:= AddVisualGear(gX, gY, vgtDust, 1);
+    if sparkles <> nil then
+        begin
+        sparkles^.Tint:= tempTeam^.Clan^.Color shl 8 or $FF;
+        //sparkles^.Angle:= random(360);
+        end;
     FindPlace(gear, false, 0, LAND_WIDTH, true); 
     if gear <> nil then
         begin
+        AddVisualGear(hwRound(gear^.X), hwRound(gear^.Y), vgtExplosion);
         RenderHealth(gear^.Hedgehog^);
         ScriptCall('onGearResurrect', gear^.uid);
         gear^.State := gstWait;