Draw hat when hedgehog is aiming
authorunc0rr
Thu, 11 Sep 2008 20:13:23 +0000
changeset 1253 79f47495b346
parent 1252 2e2719c0a397
child 1254 3ffaf75572dd
Draw hat when hedgehog is aiming
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Thu Sep 11 17:02:39 2008 +0000
+++ b/hedgewars/uGears.pas	Thu Sep 11 20:13:23 2008 +0000
@@ -592,7 +592,7 @@
 	amt: TAmmoType;
 	hx, hy, m: LongInt;
 	aAngle, dAngle: real;
-	defaultPos: boolean;
+	defaultPos, HatVisible: boolean;
 begin
 if (Gear^.State and gstHHDeath) <> 0 then
 	begin
@@ -601,6 +601,7 @@
 	end;
 
 defaultPos:= true;
+HatVisible:= false;
 
 if (Gear^.State and gstDrowning) <> 0 then
 	begin
@@ -802,6 +803,17 @@
 				0,
 				4,
 				0);
+			
+			HatVisible:= true;
+			with PHedgehog(Gear^.Hedgehog)^ do
+				if HatVisibility > 0 then
+					DrawTextureF(HatTex,
+						HatVisibility,
+						hwRound(Gear^.X) + 1 + WorldDx,
+						hwRound(Gear^.Y) - 8 + WorldDy,
+						0,
+						hwSign(Gear^.dX),
+						32);
 		end;
 
 		case amt of
@@ -853,13 +865,17 @@
 			(RealTicks div 128 + Gear^.Pos) mod 19,
 			hwSign(Gear^.dX),
 			0);
+		HatVisible:= true;
+		end;
+
+	if HatVisible then
 		if HatVisibility < 1.0 then
-			HatVisibility:= HatVisibility + 0.05;
-		end
+			HatVisibility:= HatVisibility + 0.1
+		else
 	else
 		if HatVisibility > 0.0 then
-			HatVisibility:= HatVisibility - 0.05;
-
+			HatVisibility:= HatVisibility - 0.1;
+	
 	if HatVisibility > 0 then
 		DrawTextureF(HatTex,
 			HatVisibility,