# HG changeset patch # User nemo # Date 1414250985 14400 # Node ID 42dadeb6e8aefb653c796eee65f83b736dd9d9d1 # Parent d2f599997b54c43848cb895404c973b0d607422d Remove switching of hog's hat to chef. do it in draw instead. diff -r d2f599997b54 -r 42dadeb6e8ae hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Sat Oct 25 10:42:30 2014 -0400 +++ b/hedgewars/uAmmos.pas Sat Oct 25 11:29:45 2014 -0400 @@ -366,7 +366,6 @@ end; TryDo(slot <= cMaxSlotIndex, 'Ammo slot index overflow', true); CurAmmoType:= Ammo^[slot, ammoidx].AmmoType; - if CurAmmoType = amKnife then LoadHedgehogHat(Hedgehog, 'Reserved/chef') end end; diff -r d2f599997b54 -r 42dadeb6e8ae hedgewars/uGearsHedgehog.pas --- a/hedgewars/uGearsHedgehog.pas Sat Oct 25 10:42:30 2014 -0400 +++ b/hedgewars/uGearsHedgehog.pas Sat Oct 25 11:29:45 2014 -0400 @@ -118,13 +118,6 @@ end; if ammoidx >= 0 then CurAmmoType:= Ammo^[slot, ammoidx].AmmoType; - if (prevAmmo <> CurAmmoType) then - begin - if CurAmmoType = amKnife then - LoadHedgehogHat(HHGear^.Hedgehog^, 'Reserved/chef') - else if prevAmmo = amKnife then - LoadHedgehogHat(HHGear^.Hedgehog^, Hat); - end; // Try again in the next slot if (CurAmmoType = prevAmmo) and (slot < cMaxSlotIndex) then begin diff -r d2f599997b54 -r 42dadeb6e8ae hedgewars/uGearsRender.pas --- 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, diff -r d2f599997b54 -r 42dadeb6e8ae hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sat Oct 25 10:42:30 2014 -0400 +++ b/hedgewars/uStore.pas Sat Oct 25 11:29:45 2014 -0400 @@ -364,6 +364,9 @@ begin MakeCrossHairs; LoadGraves; + tmpHatSurf:= LoadDataImage(ptHats, 'Reserved/chef', ifNone); + ChefHatTexture:= Surface2Tex(tmpHatSurf, true); + freeTmpHatSurf(); end; if not reload then @@ -507,6 +510,7 @@ SDL_FreeSurface(MissionIcons); // free the textures declared in uVariables +FreeAndNilTexture(ChefHatTexture); FreeAndNilTexture(CrosshairTexture); FreeAndNilTexture(WeaponTooltipTex); FreeAndNilTexture(PauseTexture); diff -r d2f599997b54 -r 42dadeb6e8ae hedgewars/uTeams.pas --- a/hedgewars/uTeams.pas Sat Oct 25 10:42:30 2014 -0400 +++ b/hedgewars/uTeams.pas Sat Oct 25 11:29:45 2014 -0400 @@ -752,8 +752,6 @@ if newCI then DeleteCI(newHog^.Gear); oldHH:= CurrentHedgehog; CurrentHedgehog:= newHog; - if (CurrentHedgehog <> nil) and (CurrentHedgehog^.CurAmmoType = amKnife) then - LoadHedgehogHat(CurrentHedgehog^, 'Reserved/chef'); if oldCI then AddCI(oldHH^.Gear); if newCI then AddCI(newHog^.Gear) end; diff -r d2f599997b54 -r 42dadeb6e8ae hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Sat Oct 25 10:42:30 2014 -0400 +++ b/hedgewars/uVariables.pas Sat Oct 25 11:29:45 2014 -0400 @@ -137,6 +137,7 @@ LAND_WIDTH_MASK : LongWord; LAND_HEIGHT_MASK : LongWord; + ChefHatTexture : PTexture; CrosshairTexture : PTexture; GenericHealthTexture : PTexture;