Resurrector: Use zombie-hat for resurrected hogs
authorTobias Neumann <mail@tobias-neumann.eu>
Sat, 30 Oct 2010 20:01:34 +0200
changeset 4021 014325c23705
parent 4020 898a55b81d10
child 4022 6042256178a8
Resurrector: Use zombie-hat for resurrected hogs
hedgewars/GSHandlers.inc
share/hedgewars/Data/Graphics/Hats/Reserved/Zombie.png
--- a/hedgewars/GSHandlers.inc	Sat Oct 30 10:58:53 2010 -0400
+++ b/hedgewars/GSHandlers.inc	Sat Oct 30 20:01:34 2010 +0200
@@ -4118,8 +4118,7 @@
         exit;
         end;
 
-    if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) then 
-        begin
+    if ((Gear^.Message and gmAttack) <> 0) and (hh^.Gear^.Health > 0) then begin
         i := getRandom(Length(graves));
         dec(hh^.Gear^.Health);
         if (hh^.Gear^.Health = 0) and (hh^.Gear^.Damage = 0) then
@@ -4132,13 +4131,10 @@
                 inc(graves[i]^.Health);
             end;
         end; -}
-        end 
-    else 
-        begin
+    end else begin
         // now really resurrect the hogs with the hp saved in the graves
         for i:= 0 to High(graves) do
-            if graves[i]^.Health > 0 then
-                begin
+            if graves[i]^.Health > 0 then begin
                 resgear := AddGear(hwRound(graves[i]^.X), hwRound(graves[i]^.Y),
                         gtHedgehog, gstWait, _0, _0, 0);
                 resgear^.Hedgehog := graves[i]^.Hedgehog;
@@ -4147,11 +4143,15 @@
                 DeleteGear(graves[i]);
                 RenderHealth(PHedgehog(resgear^.Hedgehog)^);
                 RecountTeamHealth(Phedgehog(resgear^.Hedgehog)^.Team);
-                end;
+                FreeTexture(PHedgehog(resgear^.Hedgehog)^.HatTex);
+                PHedgehog(resgear^.Hedgehog)^.HatTex := Surface2Tex(
+                    LoadImage(Pathz[ptHats] + '/Reserved/Zombie', ifNone),
+                    True);
+            end;
         StopSound(Gear^.SoundChannel);
         Gear^.Timer := 250;
         Gear^.doStep := @doStepIdle;
-        end;
+    end;
     //if hh^.Gear^.Health = 0 then doStepHedgehogFree(hh^.Gear);
 end;
 
Binary file share/hedgewars/Data/Graphics/Hats/Reserved/Zombie.png has changed