hedgewars/uGearsRender.pas
changeset 10443 42dadeb6e8ae
parent 10441 d2f599997b54
child 10523 00ac079fa51f
--- a/hedgewars/uGearsRender.pas	Sat Oct 25 10:42:30 2014 -0400
+++ b/hedgewars/uGearsRender.pas	Sat Oct 25 11:29:45 2014 -0400
@@ -6,7 +6,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; version 2 of the License
  *
- * This program is distributed in the hope that it will be useful,
+	 * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
@@ -219,10 +219,14 @@
     CurWeapon: PAmmo;
     iceOffset:Longint;
     r:TSDL_Rect;
+    curhat: PTexture;
 begin
     HH:= Gear^.Hedgehog;
     if HH^.Unplaced then
         exit;
+    if (HH^.CurAmmoType = amKnife) and (HH = CurrentHedgehog) then
+         curhat:= ChefHatTexture
+    else curhat:= HH^.HatTex;
     m:= 1;
     if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
         m:= -1;
@@ -431,14 +435,14 @@
                                 0,
                                 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
                         with HH^ do
-                            if (HatTex <> nil) then
+                            if (curhat <> nil) then
                                 begin
-                                DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
+                                DrawTextureRotatedF(curhat, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
                                     i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
-                                if HatTex^.w > 64 then
+                                if curhat^.w > 64 then
                                     begin
                                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
-                                    DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
+                                    DrawTextureRotatedF(curhat, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
                                         i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
                                     untint
                                     end
@@ -456,9 +460,9 @@
                             HH^.visStepPos div 2,
                             0);
                     with HH^ do
-                        if (HatTex <> nil) then
+                        if (curhat <> nil) then
                             begin
-                            DrawTextureF(HatTex,
+                            DrawTextureF(curhat,
                                 1,
                                 sx,
                                 sy - 5,
@@ -466,10 +470,10 @@
                                 sign,
                                 32,
                                 32);
-                            if HatTex^.w > 64 then
+                            if curhat^.w > 64 then
                                 begin
                                 Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
-                                DrawTextureF(HatTex,
+                                DrawTextureF(curhat,
                                     1,
                                     sx,
                                     sy - 5,
@@ -828,11 +832,11 @@
             if HatVisibility > 0.0 then
                 HatVisibility:= HatVisibility - 0.2;
 
-        if (HatTex <> nil)
+        if (curhat <> nil)
         and (HatVisibility > 0) then
             if DefaultPos then
                 begin
-                DrawTextureF(HatTex,
+                DrawTextureF(curhat,
                     HatVisibility,
                     sx,
                     sy - 5,
@@ -840,10 +844,10 @@
                     sign,
                     32,
                     32);
-                if HatTex^.w > 64 then
+                if curhat^.w > 64 then
                     begin
                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
-                    DrawTextureF(HatTex,
+                    DrawTextureF(curhat,
                         HatVisibility,
                         sx,
                         sy - 5,
@@ -857,7 +861,7 @@
                 end
             else
                 begin
-                DrawTextureF(HatTex,
+                DrawTextureF(curhat,
                     HatVisibility,
                     sx,
                     sy - 5,
@@ -865,10 +869,10 @@
                     sign*m,
                     32,
                     32);
-                if HatTex^.w > 64 then
+                if curhat^.w > 64 then
                     begin
                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
-                    DrawTextureF(HatTex,
+                    DrawTextureF(curhat,
                         HatVisibility,
                         sx,
                         sy - 5,