# HG changeset patch
# User unc0rr
# Date 1222638997 0
# Node ID 50198e5c7f0213e9926478785ed81ba4090b0f9b
# Parent  5943efa67299f201c6ce42d245c9b324c5ad53ab
 - Hedgehog doesn't take off hat when shooting from shotgun
 - Don't show empty hat sprite

diff -r 5943efa67299 -r 50198e5c7f02 hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Sun Sep 28 15:55:07 2008 +0000
+++ b/hedgewars/uGears.pas	Sun Sep 28 21:56:37 2008 +0000
@@ -650,10 +650,13 @@
 	if CurAmmoGear <> nil then
 	begin
 		case CurAmmoGear^.Kind of
-			gtShotgunShot: if (CurAmmoGear^.State and gstAnimation <> 0) then
-					DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle)
-				else
-					DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle);
+			gtShotgunShot: begin
+					if (CurAmmoGear^.State and gstAnimation <> 0) then
+						DrawRotated(sprShotgun, hx, hy, hwSign(Gear^.dX), aangle)
+					else
+						DrawRotated(sprHandShotgun, hx, hy, hwSign(Gear^.dX), aangle);
+					HatVisible:= true
+				end;
 			gtDEagleShot: DrawRotated(sprDEagle, hx, hy, hwSign(Gear^.dX), aangle);
 			gtRope: begin
 				if Gear^.X < CurAmmoGear^.X then
@@ -839,7 +842,8 @@
 			
 			HatVisible:= true;
 			with PHedgehog(Gear^.Hedgehog)^ do
-				if HatVisibility > 0 then
+				if (HatTex <> nil)
+				and (HatVisibility > 0) then
 					DrawTextureF(HatTex,
 						HatVisibility,
 						hwRound(Gear^.X) + 1 + WorldDx,
@@ -909,7 +913,8 @@
 		if HatVisibility > 0.0 then
 			HatVisibility:= HatVisibility - 0.2;
 	
-	if HatVisibility > 0 then
+	if (HatTex <> nil)
+	and (HatVisibility > 0) then
 		if DefaultPos then
 			DrawTextureF(HatTex,
 				HatVisibility,
diff -r 5943efa67299 -r 50198e5c7f02 hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Sun Sep 28 15:55:07 2008 +0000
+++ b/hedgewars/uStore.pas	Sun Sep 28 21:56:37 2008 +0000
@@ -156,9 +156,12 @@
 				if Gear <> nil then
 					begin
 					NameTagTex:= RenderStringTex(Name, Clan^.Color, fnt16);
-					texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, false, true, false);
-					HatTex:= Surface2Tex(texsurf);
-					SDL_FreeSurface(texsurf)
+					if Hat <> 'NoHat' then
+						begin
+						texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, false, true, false);
+						HatTex:= Surface2Tex(texsurf);
+						SDL_FreeSurface(texsurf)
+						end
 					end;
 		end;
 	end;