- Hedgehog doesn't take off hat when shooting from shotgun
authorunc0rr
Sun, 28 Sep 2008 21:56:37 +0000
changeset 1294 50198e5c7f02
parent 1293 5943efa67299
child 1295 27bec661581c
- Hedgehog doesn't take off hat when shooting from shotgun - Don't show empty hat sprite
hedgewars/uGears.pas
hedgewars/uStore.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,
--- 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;