hedgewars/uGearsRender.pas
changeset 11882 bbd0cb0564c5
parent 11876 ed98962b45c0
child 12119 3374e0f67f39
equal deleted inserted replaced
11881:34ede05e4d4f 11882:bbd0cb0564c5
   914 
   914 
   915         if (curhat <> nil)
   915         if (curhat <> nil)
   916         and (HatVisibility > 0) then
   916         and (HatVisibility > 0) then
   917             if DefaultPos then
   917             if DefaultPos then
   918                 begin
   918                 begin
   919                 DrawTextureF(curhat,
   919                 // Simple hat with automatic offset
   920                     HatVisibility,
   920                 if (curhat^.h = 32) and ((curhat^.w = 32) or (curhat^.w = 64)) then
   921                     sx,
   921                     begin
   922                     sy - 5,
   922                     // Frame
   923                     (RealTicks div 128 + Gear^.Pos) mod 19,
   923                     tx := (RealTicks div 128 + Gear^.Pos) mod 19;
   924                     sign,
   924                     // Hat offset
   925                     32,
   925                     ty := 0;
   926                     32);
   926                     if (tx = 2) or (tx = 7) or (tx = 12) then
   927                 if curhat^.w > 64 then
   927                         ty := 1
   928                     begin
   928                     else if tx = 16 then
   929                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   929                         ty := -1;
       
   930                     // First frame: No tint
       
   931                     DrawTextureF(curhat,
       
   932                         HatVisibility,
       
   933                         sx,
       
   934                         sy - 5 + ty,
       
   935                         0,
       
   936                         sign,
       
   937                         32,
       
   938                         32);
       
   939                     // Second frame: Clan tint (if present)
       
   940                     if (curhat^.w = 64) then
       
   941                         begin
       
   942                         Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
       
   943                         DrawTextureF(curhat,
       
   944                             HatVisibility,
       
   945                             sx,
       
   946                             sy - 5 + ty,
       
   947                             1,
       
   948                             sign,
       
   949                             32,
       
   950                             32);
       
   951                         untint
       
   952                         end
       
   953                     end
       
   954                 else
       
   955                     // Classic animated hat (all frames drawn manually)
       
   956                     begin
   930                     DrawTextureF(curhat,
   957                     DrawTextureF(curhat,
   931                         HatVisibility,
   958                         HatVisibility,
   932                         sx,
   959                         sx,
   933                         sy - 5,
   960                         sy - 5,
   934                         (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
   961                         (RealTicks div 128 + Gear^.Pos) mod 19,
   935                         sign,
   962                         sign,
   936                         32,
   963                         32,
   937                         32);
   964                         32);
   938                     untint
   965                     // Apply clan tint
       
   966                     if curhat^.w > 64 then
       
   967                         begin
       
   968                         Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
       
   969                         DrawTextureF(curhat,
       
   970                             HatVisibility,
       
   971                             sx,
       
   972                             sy - 5,
       
   973                             (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
       
   974                             sign,
       
   975                             32,
       
   976                             32);
       
   977                         untint
       
   978                         end
   939                     end;
   979                     end;
   940                 if HH^.Team^.hasGone then untint
   980                 if HH^.Team^.hasGone then untint
   941                 end
   981                 end
   942             else
   982             else
   943                 begin
   983                 begin
   947                     sy - 5,
   987                     sy - 5,
   948                     0,
   988                     0,
   949                     sign*m,
   989                     sign*m,
   950                     32,
   990                     32,
   951                     32);
   991                     32);
   952                 if curhat^.w > 64 then
   992                 if (curhat^.w > 64) or ((curhat^.w = 64) and (curhat^.h = 32)) then
   953                     begin
   993                     begin
       
   994                     if ((curhat^.w = 64) and (curhat^.h = 32)) then
       
   995                         tx := 1
       
   996                     else
       
   997                         tx := 32;
   954                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   998                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   955                     DrawTextureF(curhat,
   999                     DrawTextureF(curhat,
   956                         HatVisibility,
  1000                         HatVisibility,
   957                         sx,
  1001                         sx,
   958                         sy - 5,
  1002                         sy - 5,
   959                         32,
  1003                         tx,
   960                         sign*m,
  1004                         sign*m,
   961                         32,
  1005                         32,
   962                         32);
  1006                         32);
   963                     untint
  1007                     untint
   964                     end
  1008                     end