hedgewars/uGearsRender.pas
branchsdl2transition
changeset 11362 ed5a6478e710
parent 11317 62287d4044e7
child 11506 24bef86e3f3a
equal deleted inserted replaced
11361:31570b766315 11362:ed5a6478e710
     1 (*
     1 (*
     2  * Hedgewars, a free turn based strategy game
     2  * Hedgewars, a free turn based strategy game
     3  * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
     4  *
     4  *
     5  * This program is free software; you can redistribute it and/or modify
     5  * This program is free software; you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation; version 2 of the License
     7  * the Free Software Foundation; version 2 of the License
     8  *
     8  *
     9  * This program is distributed in the hope that it will be useful,
     9 	 * This program is distributed in the hope that it will be useful,
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    12  * GNU General Public License for more details.
    12  * GNU General Public License for more details.
    13  *
    13  *
    14  * You should have received a copy of the GNU General Public License
    14  * You should have received a copy of the GNU General Public License
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    17  *)
    17  *)
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uGearsRender;
    21 unit uGearsRender;
    22 
    22 
    23 interface
    23 interface
    24 uses uTypes, uConsts, GLunit, uFloat, SDLh;
    24 uses uTypes, uConsts, GLunit, uFloat, SDLh;
    25 
    25 
       
    26 type
       
    27    Tar = record
       
    28             X, Y: hwFloat;
       
    29             dLen: hwFloat;
       
    30             b : boolean;
       
    31          end;
       
    32    TRopePoints = record
       
    33             Count     : Longword;
       
    34             HookAngle : GLfloat;
       
    35             ar        : array[0..MAXROPEPOINTS] of Tar;
       
    36             rounded   : array[0..MAXROPEPOINTS + 2] of TVertex2f;
       
    37          end;
    26 procedure RenderGear(Gear: PGear; x, y: LongInt);
    38 procedure RenderGear(Gear: PGear; x, y: LongInt);
       
    39 procedure DrawHHOrder();
    27 
    40 
    28 var RopePoints: record
    41 var RopePoints: record
    29                 Count: Longword;
    42                 Count: Longword;
    30                 HookAngle: GLfloat;
    43                 HookAngle: GLfloat;
    31                 ar: array[0..MAXROPEPOINTS] of record
    44                 ar: array[0..MAXROPEPOINTS] of record
    39 
    52 
    40 implementation
    53 implementation
    41 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGearsList;
    54 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGearsList;
    42 
    55 
    43 procedure DrawRopeLinesRQ(Gear: PGear);
    56 procedure DrawRopeLinesRQ(Gear: PGear);
       
    57 var n: LongInt;
    44 begin
    58 begin
    45 with RopePoints do
    59 with RopePoints do
    46     begin
    60     begin
    47     rounded[Count].X:= hwRound(Gear^.X);
    61     rounded[Count].X:= hwRound(Gear^.X);
    48     rounded[Count].Y:= hwRound(Gear^.Y);
    62     rounded[Count].Y:= hwRound(Gear^.Y);
    50     rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y);
    64     rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y);
    51     end;
    65     end;
    52 
    66 
    53 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
    67 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
    54     begin
    68     begin
    55     glDisable(GL_TEXTURE_2D);
    69     EnableTexture(false);
    56     //glEnable(GL_LINE_SMOOTH);
    70     //glEnable(GL_LINE_SMOOTH);
    57 
    71 
    58     glPushMatrix;
    72     
    59 
    73     Tint(Gear^.Tint shr 24 div 3, Gear^.Tint shr 16 and $FF div 3, Gear^.Tint shr 8 and $FF div 3, Gear^.Tint and $FF);
    60     glTranslatef(WorldDx, WorldDy, 0);
    74 
    61 
    75     n:= RopePoints.Count + 2;
    62     glLineWidth(4.0);
    76 
    63 
    77     SetVertexPointer(@RopePoints.rounded[0], n);
    64     Tint($C0, $C0, $C0, $FF);
    78 
    65 
    79     openglPushMatrix();
    66     glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]);
    80     openglTranslatef(WorldDx, WorldDy, 0);
    67     glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2);
    81 
       
    82     glLineWidth(3.0 * cScaleFactor);
       
    83     glDrawArrays(GL_LINE_STRIP, 0, n);
       
    84     Tint(Gear^.Tint);
       
    85     glLineWidth(2.0 * cScaleFactor);
       
    86     glDrawArrays(GL_LINE_STRIP, 0, n);
       
    87 
    68     untint;
    88     untint;
    69 
    89 
    70     glPopMatrix;
    90     openglPopMatrix();
    71 
    91 
    72     glEnable(GL_TEXTURE_2D);
    92     EnableTexture(true);
    73     //glDisable(GL_LINE_SMOOTH)
    93     //glDisable(GL_LINE_SMOOTH)
    74     end
    94     end
    75 end;
    95 end;
    76 
    96 
    77 
    97 
    81     b: boolean;
   101     b: boolean;
    82 begin
   102 begin
    83     if (X1 = X2) and (Y1 = Y2) then
   103     if (X1 = X2) and (Y1 = Y2) then
    84         begin
   104         begin
    85         //OutError('WARNING: zero length rope line!', false);
   105         //OutError('WARNING: zero length rope line!', false);
       
   106         DrawRopeLine:= 0;
    86         exit
   107         exit
    87         end;
   108         end;
    88     eX:= 0;
   109     eX:= 0;
    89     eY:= 0;
   110     eY:= 0;
    90     dX:= X2 - X1;
   111     dX:= X2 - X1;
   141             inc(roplen);
   162             inc(roplen);
   142             if (roplen mod 4) = 0 then
   163             if (roplen mod 4) = 0 then
   143                 DrawSprite(sprRopeNode, x - 2, y - 2, 0)
   164                 DrawSprite(sprRopeNode, x - 2, y - 2, 0)
   144             end
   165             end
   145     end;
   166     end;
   146 DrawRopeLine:= roplen;
   167     DrawRopeLine:= roplen;
   147 end;
   168 end;
   148 
   169 
   149 procedure DrawRope(Gear: PGear);
   170 procedure DrawRope(Gear: PGear);
   150 var roplen: LongInt;
   171 var roplen, i: LongInt;
   151     i: Longword;
       
   152 begin
   172 begin
   153     if (cReducedQuality and rqSimpleRope) <> 0 then
   173     if Gear^.Hedgehog^.Gear = nil then exit;
       
   174     if (Gear^.Tag = 1) or ((cReducedQuality and rqSimpleRope) <> 0) then
   154         DrawRopeLinesRQ(Gear)
   175         DrawRopeLinesRQ(Gear)
   155     else
   176     else
   156         begin
   177         begin
   157         roplen:= 0;
   178         roplen:= 0;
   158         if RopePoints.Count > 0 then
   179         if RopePoints.Count > 0 then
   193     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   214     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   194     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
   215     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
   195     end;
   216     end;
   196 end;
   217 end;
   197 
   218 
       
   219 procedure DrawHHOrder();
       
   220 var HHGear: PGear;
       
   221     hh: PHedgehog;
       
   222     c, i, t, x, y, sprH, sprW, fSprOff: LongInt;
       
   223 begin
       
   224 t:= LocalTeam;
       
   225 
       
   226 if not CurrentTeam^.ExtDriven then
       
   227     for i:= 0 to Pred(TeamsCount) do
       
   228         if (TeamsArray[i] = CurrentTeam) then
       
   229             t:= i;
       
   230 
       
   231 if t < 0 then
       
   232     exit;
       
   233 
       
   234 if TeamsArray[t] <> nil then
       
   235     begin
       
   236     sprH:= SpritesData[sprBigDigit].Height;
       
   237     sprW:= SpritesData[sprBigDigit].Width;
       
   238     fSprOff:= sprW div 4 + SpritesData[sprFrame].Width div 4 - 1; // - 1 for overlap to avoid artifacts
       
   239     i:= 0;
       
   240     c:= 0;
       
   241         repeat
       
   242         hh:= @TeamsArray[t]^.Hedgehogs[i];
       
   243         inc(i);
       
   244         if (hh <> nil) and (hh^.Gear <> nil) then
       
   245             begin
       
   246             inc(c);
       
   247             HHGear:= hh^.Gear;
       
   248             x:= hwRound(HHGear^.X) + WorldDx;
       
   249             y:= hwRound(HHGear^.Y) + WorldDy - 2;
       
   250             DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x - fSprOff, y, 0, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
       
   251             DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x + fSprOff, y, 1, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
       
   252             DrawTextureF(SpritesData[sprBigDigit].Texture, 0.5, x, y, c, 1, sprW, sprH);
       
   253             if SpeechHogNumber = c then
       
   254                 DrawCircle(x, y, 20, 3, 0, $FF, $FF, $80);
       
   255             end;
       
   256         until (i > cMaxHHIndex);
       
   257     end
       
   258 
       
   259 end;
       
   260 
   198 
   261 
   199 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   262 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   200 var i, t: LongInt;
   263 var i, t: LongInt;
   201     amt: TAmmoType;
   264     amt: TAmmoType;
   202     sign, hx, hy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
   265     sign, hx, hy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
   204     defaultPos, HatVisible: boolean;
   267     defaultPos, HatVisible: boolean;
   205     HH: PHedgehog;
   268     HH: PHedgehog;
   206     CurWeapon: PAmmo;
   269     CurWeapon: PAmmo;
   207     iceOffset:Longint;
   270     iceOffset:Longint;
   208     r:TSDL_Rect;
   271     r:TSDL_Rect;
       
   272     curhat: PTexture;
   209 begin
   273 begin
   210     HH:= Gear^.Hedgehog;
   274     HH:= Gear^.Hedgehog;
   211     if HH^.Unplaced then
   275     if HH^.Unplaced then
   212         exit;
   276         exit;
       
   277     if (HH^.CurAmmoType = amKnife) and (HH = CurrentHedgehog) then
       
   278          curhat:= ChefHatTexture
       
   279     else curhat:= HH^.HatTex;
   213     m:= 1;
   280     m:= 1;
   214     if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
   281     if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
   215         m:= -1;
   282         m:= -1;
   216     sx:= ox + 1; // this offset is very common
   283     sx:= ox + 1; // this offset is very common
   217     sy:= oy - 3;
   284     sy:= oy - 3;
   260 
   327 
   261 
   328 
   262     if HH^.Effects[hePoisoned] <> 0 then
   329     if HH^.Effects[hePoisoned] <> 0 then
   263         begin
   330         begin
   264         Tint($00, $FF, $40, $40);
   331         Tint($00, $FF, $40, $40);
   265         DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360);
   332         DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 4) mod 360);
   266         untint
   333         untint
   267         end;
   334         end;
   268 
   335 
   269 
   336 
   270     if ((Gear^.State and gstWinner) <> 0) and
   337     if ((Gear^.State and gstWinner) <> 0) and
   299     if (Gear^.State and gstHHDriven) <> 0 then
   366     if (Gear^.State and gstHHDriven) <> 0 then
   300         begin
   367         begin
   301         if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and
   368         if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and
   302 /// If current ammo is active, and current ammo has alt attack and uses a crosshair  (rope, basically, right now, with no crosshair for parachute/saucer
   369 /// If current ammo is active, and current ammo has alt attack and uses a crosshair  (rope, basically, right now, with no crosshair for parachute/saucer
   303             (((CurAmmoGear <> nil) and //((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and
   370             (((CurAmmoGear <> nil) and //((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and
       
   371             // don't render crosshair/laser during kamikaze
       
   372             ((CurAmmoGear^.AmmoType <> amKamikaze) or ((Gear^.State and gstAttacking) = 0)) and
   304              ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or
   373              ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or
   305 /// If no current ammo is active, and the selected ammo uses a crosshair
   374 /// If no current ammo is active, and the selected ammo uses a crosshair
   306             ((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then
   375             ((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then
   307             begin
   376             begin
   308     (* These calculations are a little complex for a few reasons:
   377     (* These calculations are a little complex for a few reasons:
   414                                 i,
   483                                 i,
   415                                 1,
   484                                 1,
   416                                 0,
   485                                 0,
   417                                 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
   486                                 DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
   418                         with HH^ do
   487                         with HH^ do
   419                             if (HatTex <> nil) then
   488                             if (curhat <> nil) then
   420                                 begin
   489                                 begin
   421                                 DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
   490                                 DrawTextureRotatedF(curhat, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
   422                                     i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   491                                     i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   423                                 if HatTex^.w > 64 then
   492                                 if curhat^.w > 64 then
   424                                     begin
   493                                     begin
   425                                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   494                                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   426                                     DrawTextureRotatedF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
   495                                     DrawTextureRotatedF(curhat, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
   427                                         i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   496                                         i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   428                                     untint
   497                                     untint
   429                                     end
   498                                     end
   430                                 end
   499                                 end
   431                     end;
   500                     end;
   439                             sign,
   508                             sign,
   440                             3,
   509                             3,
   441                             HH^.visStepPos div 2,
   510                             HH^.visStepPos div 2,
   442                             0);
   511                             0);
   443                     with HH^ do
   512                     with HH^ do
   444                         if (HatTex <> nil) then
   513                         if (curhat <> nil) then
   445                             begin
   514                             begin
   446                             DrawTextureF(HatTex,
   515                             DrawTextureF(curhat,
   447                                 1,
   516                                 1,
   448                                 sx,
   517                                 sx,
   449                                 sy - 5,
   518                                 sy - 5,
   450                                 0,
   519                                 0,
   451                                 sign,
   520                                 sign,
   452                                 32,
   521                                 32,
   453                                 32);
   522                                 32);
   454                             if HatTex^.w > 64 then
   523                             if curhat^.w > 64 then
   455                                 begin
   524                                 begin
   456                                 Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   525                                 Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   457                                 DrawTextureF(HatTex,
   526                                 DrawTextureF(curhat,
   458                                     1,
   527                                     1,
   459                                     sx,
   528                                     sx,
   460                                     sy - 5,
   529                                     sy - 5,
   461                                     32,
   530                                     32,
   462                                     sign,
   531                                     sign,
   597             end
   666             end
   598         else
   667         else
   599 
   668 
   600         if ((Gear^.State and gstAnimation) <> 0) then
   669         if ((Gear^.State and gstAnimation) <> 0) then
   601             begin
   670             begin
   602             if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then
   671             if (Gear^.Tag < LongInt(ord(Low(TWave)))) or (Gear^.Tag > LongInt(ord(High(TWave)))) then
   603                 begin
   672                 begin
   604                 Gear^.State:= Gear^.State and (not gstAnimation);
   673                 Gear^.State:= Gear^.State and (not gstAnimation);
   605                 end
   674                 end
   606             else
   675             else
   607                 begin
   676                 begin
   657                 amClusterBomb: DrawSpriteRotated(sprHandCluster, hx, hy, sign, aangle);
   726                 amClusterBomb: DrawSpriteRotated(sprHandCluster, hx, hy, sign, aangle);
   658                 amDynamite: DrawSpriteRotated(sprHandDynamite, hx, hy, sign, aangle);
   727                 amDynamite: DrawSpriteRotated(sprHandDynamite, hx, hy, sign, aangle);
   659                 amHellishBomb: DrawSpriteRotated(sprHandHellish, hx, hy, sign, aangle);
   728                 amHellishBomb: DrawSpriteRotated(sprHandHellish, hx, hy, sign, aangle);
   660                 amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle);
   729                 amGasBomb: DrawSpriteRotated(sprHandCheese, hx, hy, sign, aangle);
   661                 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle);
   730                 amMine: DrawSpriteRotated(sprHandMine, hx, hy, sign, aangle);
       
   731                 amAirMine: DrawSpriteRotated(sprHandAirMine, hx, hy, sign, aangle);
   662                 amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle);
   732                 amSMine: DrawSpriteRotated(sprHandSMine, hx, hy, sign, aangle);
   663                 amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle);
   733                 amKnife: DrawSpriteRotatedF(sprHandKnife, hx, hy, 0, sign, aangle);
   664                 amSeduction: begin
   734                 amSeduction: begin
   665                              DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle);
   735                              DrawSpriteRotated(sprHandSeduction, hx, hy, sign, aangle);
   666                              DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA);
   736                              DrawCircle(ox, oy, 248, 4, $FF, $00, $00, $AA);
   674                     defaultPos:= false
   744                     defaultPos:= false
   675                     end;
   745                     end;
   676                 amRubber,
   746                 amRubber,
   677                 amGirder: begin
   747                 amGirder: begin
   678                     DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle);
   748                     DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle);
   679                     if WorldEdge = weWrap then
   749                     if cBuildMaxDist = cDefaultBuildMaxDist then
   680                         begin
   750                         begin
   681                         if hwRound(Gear^.X) < leftX+256 then
   751                         if WorldEdge = weWrap then
   682                             DrawSpriteClipped(sprGirder,
   752                             begin
   683                                             rightX+(ox-leftX)-256,
   753                             if hwRound(Gear^.X) < LongInt(leftX) + 256 then
   684                                             oy-256,
   754                                 DrawSpriteClipped(sprGirder,
   685                                             LongInt(topY)+WorldDy,
   755                                                 rightX+(ox-leftX)-256,
   686                                             LongInt(rightX)+WorldDx,
   756                                                 oy-256,
   687                                             cWaterLine+WorldDy,
   757                                                 LongInt(topY)+WorldDy,
   688                                             LongInt(leftX)+WorldDx);
   758                                                 LongInt(rightX)+WorldDx,
   689                         if hwRound(Gear^.X) > rightX-256 then
   759                                                 cWaterLine+WorldDy,
   690                             DrawSpriteClipped(sprGirder,
   760                                                 LongInt(leftX)+WorldDx);
   691                                             leftX-(rightX-ox)-256,
   761                             if hwRound(Gear^.X) > LongInt(rightX) - 256 then
   692                                             oy-256,
   762                                 DrawSpriteClipped(sprGirder,
   693                                             LongInt(topY)+WorldDy,
   763                                                 leftX-(rightX-ox)-256,
   694                                             LongInt(rightX)+WorldDx,
   764                                                 oy-256,
   695                                             cWaterLine+WorldDy,
   765                                                 LongInt(topY)+WorldDy,
   696                                             LongInt(leftX)+WorldDx)
   766                                                 LongInt(rightX)+WorldDx,
       
   767                                                 cWaterLine+WorldDy,
       
   768                                                 LongInt(leftX)+WorldDx)
       
   769                             end;
       
   770                         DrawSpriteClipped(sprGirder,
       
   771                                         ox-256,
       
   772                                         oy-256,
       
   773                                         LongInt(topY)+WorldDy,
       
   774                                         LongInt(rightX)+WorldDx,
       
   775                                         cWaterLine+WorldDy,
       
   776                                         LongInt(leftX)+WorldDx)
       
   777                         end
       
   778                     else if cBuildMaxDist > 0 then
       
   779                         begin
       
   780                             DrawCircle(hx, hy, cBuildMaxDist, 3, $FF, 0, 0, $80);
   697                         end;
   781                         end;
   698                     DrawSpriteClipped(sprGirder,
       
   699                                     ox-256,
       
   700                                     oy-256,
       
   701                                     LongInt(topY)+WorldDy,
       
   702                                     LongInt(rightX)+WorldDx,
       
   703                                     cWaterLine+WorldDy,
       
   704                                     LongInt(leftX)+WorldDx)
       
   705                     end;
   782                     end;
   706                 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   783                 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   707                 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   784                 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   708                 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   785                 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   709                 amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle);
   786                 amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle);
   770     end else // not gstHHDriven
   847     end else // not gstHHDriven
   771         begin
   848         begin
   772         if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0)
   849         if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0)
   773         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
   850         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
   774             begin
   851             begin
   775             DrawHedgehog(sx, sy,
   852             defaultPos:= false;
   776                 sign,
   853                 DrawHedgehog(sx, sy,
   777                 2,
   854                     sign,
   778                 1,
   855                     2,
   779                 Gear^.DirAngle);
   856                     1,
   780             defaultPos:= false
   857                     Gear^.DirAngle);
   781             end else
   858             if AprilOne and (curhat <> nil) then
       
   859                 DrawTextureRotatedF(curhat, 1.0, -1.0, 0, sx, sy, 18, sign, 32, 32,
       
   860                     sign*Gear^.DirAngle)
       
   861             end;
       
   862 
   782 
   863 
   783         if ((Gear^.State and gstHHJumping) <> 0) then
   864         if ((Gear^.State and gstHHJumping) <> 0) then
   784             begin
   865             begin
   785             DrawHedgehog(sx, sy,
   866             DrawHedgehog(sx, sy,
   786                 sign*m,
   867                 sign*m,
   793 
   874 
   794     with HH^ do
   875     with HH^ do
   795         begin
   876         begin
   796         if defaultPos then
   877         if defaultPos then
   797             begin
   878             begin
   798             if HH^.Team^.hasGone then Tint($FF, $FF, $FF, $80);
   879             if HH^.Team^.hasGone then Tint($FFFFFF80);
   799             DrawSpriteRotatedF(sprHHIdle,
   880             DrawSpriteRotatedF(sprHHIdle,
   800                 sx,
   881                 sx,
   801                 sy,
   882                 sy,
   802                 (RealTicks div 128 + Gear^.Pos) mod 19,
   883                 (RealTicks div 128 + Gear^.Pos) mod 19,
   803                 sign,
   884                 sign,
   811             else
   892             else
   812         else
   893         else
   813             if HatVisibility > 0.0 then
   894             if HatVisibility > 0.0 then
   814                 HatVisibility:= HatVisibility - 0.2;
   895                 HatVisibility:= HatVisibility - 0.2;
   815 
   896 
   816         if (HatTex <> nil)
   897         if (curhat <> nil)
   817         and (HatVisibility > 0) then
   898         and (HatVisibility > 0) then
   818             if DefaultPos then
   899             if DefaultPos then
   819                 begin
   900                 begin
   820                 DrawTextureF(HatTex,
   901                 DrawTextureF(curhat,
   821                     HatVisibility,
   902                     HatVisibility,
   822                     sx,
   903                     sx,
   823                     sy - 5,
   904                     sy - 5,
   824                     (RealTicks div 128 + Gear^.Pos) mod 19,
   905                     (RealTicks div 128 + Gear^.Pos) mod 19,
   825                     sign,
   906                     sign,
   826                     32,
   907                     32,
   827                     32);
   908                     32);
   828                 if HatTex^.w > 64 then
   909                 if curhat^.w > 64 then
   829                     begin
   910                     begin
   830                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   911                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   831                     DrawTextureF(HatTex,
   912                     DrawTextureF(curhat,
   832                         HatVisibility,
   913                         HatVisibility,
   833                         sx,
   914                         sx,
   834                         sy - 5,
   915                         sy - 5,
   835                         (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
   916                         (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
   836                         sign,
   917                         sign,
   840                     end;
   921                     end;
   841                 if HH^.Team^.hasGone then untint
   922                 if HH^.Team^.hasGone then untint
   842                 end
   923                 end
   843             else
   924             else
   844                 begin
   925                 begin
   845                 DrawTextureF(HatTex,
   926                 DrawTextureF(curhat,
   846                     HatVisibility,
   927                     HatVisibility,
   847                     sx,
   928                     sx,
   848                     sy - 5,
   929                     sy - 5,
   849                     0,
   930                     0,
   850                     sign*m,
   931                     sign*m,
   851                     32,
   932                     32,
   852                     32);
   933                     32);
   853                 if HatTex^.w > 64 then
   934                 if curhat^.w > 64 then
   854                     begin
   935                     begin
   855                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   936                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   856                     DrawTextureF(HatTex,
   937                     DrawTextureF(curhat,
   857                         HatVisibility,
   938                         HatVisibility,
   858                         sx,
   939                         sx,
   859                         sy - 5,
   940                         sy - 5,
   860                         32,
   941                         32,
   861                         sign*m,
   942                         sign*m,
   927             begin
  1008             begin
   928             if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then
  1009             if (CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtResurrector) then
   929                 DrawTextureCentered(ox, sy - cHHRadius - 7 - HealthTagTex^.h, HealthTagTex);
  1010                 DrawTextureCentered(ox, sy - cHHRadius - 7 - HealthTagTex^.h, HealthTagTex);
   930 
  1011 
   931             if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
  1012             if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
   932                 DrawSprite(sprFinger, ox - 16, oy - 64,
  1013                 begin
   933                             GameTicks div 32 mod 16);
  1014                 ty := oy - 32;
       
  1015                 // move finger higher up if tags are above hog
       
  1016                 if (cTagsMask and htTeamName) <> 0 then
       
  1017                     ty := ty - Team^.NameTagTex^.h - 2;
       
  1018                 if (cTagsMask and htName) <> 0 then
       
  1019                     ty := ty - NameTagTex^.h - 2;
       
  1020                 if (cTagsMask and htHealth) <> 0 then
       
  1021                     ty := ty - HealthTagTex^.h - 2;
       
  1022                 tx := ox;
       
  1023 
       
  1024                 // don't go offscreen
       
  1025                 //tx := round(max(((-cScreenWidth + 16) / cScaleFactor) + SpritesData[sprFinger].Width div 2, min(((cScreenWidth - 16) / cScaleFactor) - SpritesData[sprFinger].Width div 2, tx)));
       
  1026                 //ty := round(max(cScreenHeight div 2 - ((cScreenHeight - 16) / cScaleFactor) + SpritesData[sprFinger].Height div 2, min(cScreenHeight div 2 - ((-cScreenHeight + SpritesData[sprFinger].Height) / (cScaleFactor)) - SpritesData[sprFinger].Width div 2 - 96, ty)));
       
  1027                 t:= 32;//trunc((SpritesData[sprFinger].Width + t) / cScaleFactor);
       
  1028                 tx := min(max(tx, ViewLeftX + t), ViewRightX  - t);
       
  1029                 t:= 32;//trunc((SpritesData[sprFinger].Height + t) / cScaleFactor);
       
  1030                 ty := min(ty, ViewBottomY - 96);
       
  1031                 // don't overlap with HH or HH tags
       
  1032                 if ty < ViewTopY + t then
       
  1033                     begin
       
  1034                     if abs(tx - ox) < abs(ty - oy)  then
       
  1035                         ty:= max(ViewTopY + t, oy + t)
       
  1036                     else
       
  1037                         ty:= max(ViewTopY + t, ty);
       
  1038                     end;
       
  1039 
       
  1040                 dAngle := DxDy2Angle(int2hwfloat(ty - oy), int2hwfloat(tx - ox)) + 90;
       
  1041 
       
  1042                 DrawSpriteRotatedF(sprFinger, tx, ty, RealTicks div 32 mod 16, 1, dAngle);
       
  1043                 end;
       
  1044 
   934 
  1045 
   935             if (Gear^.State and gstDrowning) = 0 then
  1046             if (Gear^.State and gstDrowning) = 0 then
   936                 if (Gear^.State and gstHHThinking) <> 0 then
  1047                 if (Gear^.State and gstHHThinking) <> 0 then
   937                     DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8)
  1048                     DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8)
   938             end
  1049             end
   939         end;
  1050         end;
   940 
  1051 
   941     if HH^.Effects[hePoisoned] <> 0 then
  1052     if HH^.Effects[hePoisoned] <> 0 then
   942         begin
  1053         begin
   943         Tint($00, $FF, $40, $80);
  1054         Tint($00, $FF, $40, $80);
   944         DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360);
  1055         DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 5) mod 360);
   945         end;
  1056         end;
   946     if HH^.Effects[heResurrected] <> 0 then
  1057     if HH^.Effects[heResurrected] <> 0 then
   947         begin
  1058         begin
   948         Tint($f5, $db, $35, $20);
  1059         Tint($f5, $db, $35, $20);
   949         DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
  1060         DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
   963         iceOffset:= min(32, HH^.Effects[heFrozen] div 8);
  1074         iceOffset:= min(32, HH^.Effects[heFrozen] div 8);
   964         r.x := 128;
  1075         r.x := 128;
   965         r.y := 96 - iceOffset;
  1076         r.y := 96 - iceOffset;
   966         r.w := 32;
  1077         r.w := 32;
   967         r.h := iceOffset;
  1078         r.h := iceOffset;
   968         if sign = -1 then
  1079         DrawTextureFromRectDir(sx - 16 + sign*2, sy + 16 - iceoffset, r.w, r.h, @r, HHTexture, sign);
   969         DrawTextureFromRectDir(sx + sign*2, sy+16-iceoffset, r.w, r.h, @r, HHTexture, sign)
       
   970         else
       
   971         DrawTextureFromRectDir(sx-16 + sign*2, sy+16-iceoffset, r.w, r.h, @r, HHTexture, sign);
       
   972 
  1080 
   973 
  1081 
   974         if HH^.Effects[heFrozen] < 150000 then
  1082         if HH^.Effects[heFrozen] < 150000 then
   975             untint;
  1083             untint;
   976         end;
  1084         end;
  1017                   else DrawSprite(sprMolotov, x, y, 8);
  1125                   else DrawSprite(sprMolotov, x, y, 8);
  1018 
  1126 
  1019        gtRCPlane: begin
  1127        gtRCPlane: begin
  1020                   aangle:= Gear^.Angle * 360 / 4096;
  1128                   aangle:= Gear^.Angle * 360 / 4096;
  1021                   if Gear^.Tag < 0 then aangle:= 360-aangle;
  1129                   if Gear^.Tag < 0 then aangle:= 360-aangle;
  1022                   Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
  1130                   Tint(Gear^.Tint);
  1023                   DrawSpriteRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle - 90);
  1131                   DrawSpriteRotatedF(sprPlane, x, y, 0, Gear^.Tag, aangle - 90);
  1024                   untint;
  1132                   untint;
  1025                   DrawSpriteRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle - 90)
  1133                   DrawSpriteRotatedF(sprPlane, x, y, 1, Gear^.Tag, aangle - 90)
  1026                   end;
  1134                   end;
  1027        gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
  1135        gtBall: DrawSpriteRotatedF(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
  1061                            DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
  1169                            DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
  1062                     else if Gear^.Health <> 0 then
  1170                     else if Gear^.Health <> 0 then
  1063                        DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
  1171                        DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
  1064                     else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
  1172                     else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
  1065                     end;
  1173                     end;
       
  1174          gtAirMine: if Gear^.State and gstTmpFlag = 0 then                // mine is inactive
       
  1175                         begin
       
  1176                         Tint(150,150,150,255);
       
  1177                         DrawSprite(sprAirMine, x-16, y-16, 15);
       
  1178                         untint
       
  1179                         end
       
  1180                     else if (Gear^.Hedgehog <> nil) and (Gear^.Hedgehog^.Gear <> nil) then  // mine is chasing a hog
       
  1181                          DrawSprite(sprAirMine, x-16, y-16, (RealTicks div 25) mod 16)
       
  1182                     else if Gear^.State and gstChooseTarget <> 0 then   // mine is seeking for hogs
       
  1183                          DrawSprite(sprAirMine, x-16, y-16, (RealTicks div 125) mod 16)
       
  1184                     else
       
  1185                          DrawSprite(sprAirMine, x-16, y-16, 4);           // mine is active but not seeking
  1066 
  1186 
  1067            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1187            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1068                            DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
  1188                            DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
  1069                        else if Gear^.Health <> 0 then
  1189                        else if Gear^.Health <> 0 then
  1070                            DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
  1190                            DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
  1109                                 end
  1229                                 end
  1110                             end
  1230                             end
  1111                         end;
  1231                         end;
  1112                     if Gear^.Timer < 1833 then
  1232                     if Gear^.Timer < 1833 then
  1113                         begin
  1233                         begin
  1114                         DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
  1234                         DrawTextureRotatedF(SpritesData[sprPortal].texture, MinD(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
  1115                                             x, LongInt(Gear^.Angle) + WorldDy - 16, 4 + Gear^.Tag, 1, 32, 32, 270);
  1235                                             x, LongInt(Gear^.Angle) + WorldDy - 16, 4 + Gear^.Tag, 1, 32, 32, 270);
  1116                         end
  1236                         end
  1117                     end;
  1237                     end;
  1118       gtExplosives: begin
  1238       gtExplosives: begin
  1119                     if ((Gear^.State and gstDrowning) <> 0) then
  1239                     if ((Gear^.State and gstDrowning) <> 0) then
  1139        gtParachute: begin
  1259        gtParachute: begin
  1140                     DrawSprite(sprParachute, x - 24, y - 48, 0);
  1260                     DrawSprite(sprParachute, x - 24, y - 48, 0);
  1141                     DrawAltWeapon(Gear, x + 1, y - 3)
  1261                     DrawAltWeapon(Gear, x + 1, y - 3)
  1142                     end;
  1262                     end;
  1143        gtAirAttack: begin
  1263        gtAirAttack: begin
  1144                     Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF);
  1264                     Tint(Gear^.Tint);
  1145                     DrawSpriteRotatedF(sprAirplane, x, y, 0, Gear^.Tag, 0);
  1265                     DrawSpriteRotatedF(sprAirplane, x, y, 0, Gear^.Tag, 0);
  1146                     untint;
  1266                     untint;
  1147                     DrawSpriteRotatedF(sprAirplane, x, y, 1, Gear^.Tag, 0);
  1267                     DrawSpriteRotatedF(sprAirplane, x, y, 1, Gear^.Tag, 0);
  1148                     end;
  1268                     end;
  1149          gtAirBomb: DrawSpriteRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1269          gtAirBomb: DrawSpriteRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1150         gtTeleport: begin
  1270         gtTeleport: begin
  1151                     HHGear:= Gear^.Hedgehog^.Gear;
  1271                     HHGear:= Gear^.Hedgehog^.Gear;
  1152                     if not Gear^.Hedgehog^.Unplaced then
  1272                     if HHGear <> nil then
  1153                         DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
  1273                         begin
  1154                     DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0);
  1274                         if ((Gear^.State and gstAnimation) <> 0) then
       
  1275                             DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
       
  1276                         DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0)
       
  1277                         end
  1155                     end;
  1278                     end;
  1156         gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
  1279         gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
  1157           gtTarget: begin
  1280           gtTarget: begin
  1158                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
  1281                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
  1159                     DrawSprite(sprTarget, x - 16, y - 16, 0);
  1282                     DrawSprite(sprTarget, x - 16, y - 16, 0);
  1215                         end;
  1338                         end;
  1216                     DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y, 0, 1, 128, 128);
  1339                     DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y, 0, 1, 128, 128);
  1217                     end;
  1340                     end;
  1218      gtPoisonCloud: begin
  1341      gtPoisonCloud: begin
  1219                     if Gear^.Timer < 1020 then
  1342                     if Gear^.Timer < 1020 then
  1220                         Tint($C0, $C0, $00, Gear^.Timer div 8)
  1343                         Tint(Gear^.Tint and $FFFFFF00 or Gear^.Timer div 8)
  1221                     else if Gear^.Timer > 3980 then
  1344                     else if Gear^.Timer > 3980 then
  1222                         Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8)
  1345                         Tint(Gear^.Tint and $FFFFFF00 or (5000 - Gear^.Timer) div 8)
  1223                     else
  1346                     else
  1224                         Tint($C0, $C0, $00, $C0);
  1347                         Tint(Gear^.Tint);
  1225                     DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360);
  1348                     DrawTextureRotatedF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 4 + Gear^.UID * 100) mod 360);
  1226                     untint
  1349                     untint
  1227                     end;
  1350                     end;
  1228      gtResurrector: begin
  1351      gtResurrector: begin
  1229                     DrawSpriteRotated(sprCross, x, y, 0, 0);
  1352                     DrawSpriteRotated(sprCross, x, y, 0, 0);
  1230                     Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
  1353                     Tint(Gear^.Tint and $FFFFFF00 or max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
  1231                     DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5);
  1354                     DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5);
  1232                     untint;
  1355                     untint;
  1233                     end;
  1356                     end;
  1234       gtNapalmBomb: DrawSpriteRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1357       gtNapalmBomb: DrawSpriteRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1235            gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0  then
  1358            gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0  then
  1236                         begin
  1359                         begin
  1237                         Tint((ExplosionBorderColor shr RShift) and $FF,
  1360                         Tint(Gear^.Tint);
  1238                              (ExplosionBorderColor shr GShift) and $FF,
       
  1239                              (ExplosionBorderColor shr BShift) and $FF,
       
  1240                              $FF);
       
  1241                         // Needs a nicer white texture to tint
  1361                         // Needs a nicer white texture to tint
  1242                         DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle);
  1362                         DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle);
  1243                         //DrawSpriteRotated(sprSnowDust, x, y, 0, Gear^.DirAngle);
  1363                         //DrawSpriteRotated(sprSnowDust, x, y, 0, Gear^.DirAngle);
  1244                         //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
  1364                         //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
  1245                         untint;
  1365                         untint;
  1246                         end
  1366                         end
  1247                     else //if not isInLag then
  1367                     else //if not isInLag then
  1248                         begin
  1368                         begin
  1249                         if isInLag and (Gear^.FlightTime < 256) then
  1369                         if isInLag and (Gear^.FlightTime < 256) then
  1250                             inc(Gear^.FlightTime, 8)
  1370                             inc(Gear^.FlightTime, 8)
  1251                         else if not isInLag and (Gear^.FlightTime > 0) then
  1371                         else if (not isInLag) and (Gear^.FlightTime > 0) then
  1252                             dec(Gear^.FlightTime, 8);
  1372                             dec(Gear^.FlightTime, 8);
  1253                         if Gear^.FlightTime > 0 then
  1373                         if Gear^.FlightTime > 0 then
  1254                             Tint($FF, $FF, $FF, $FF-min(255,Gear^.FlightTime));
  1374                             Tint($FF, $FF, $FF, $FF-min(255,Gear^.FlightTime));
  1255                         if vobVelocity = 0 then
  1375                         if vobVelocity = 0 then
  1256                             DrawSprite(sprFlake, x, y, Gear^.Timer)
  1376                             DrawSprite(sprFlake, x, y, Gear^.Timer)
  1266                         begin
  1386                         begin
  1267                         if Gear^.Pos = 2 then
  1387                         if Gear^.Pos = 2 then
  1268                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF)
  1388                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF)
  1269                         else
  1389                         else
  1270                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1390                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1271                         DrawSprite(sprTardis, x-24, y-63,0);
  1391                         DrawSprite(sprTardis, x-25, y-64,0);
  1272                         if Gear^.Pos = 2 then
  1392                         if Gear^.Pos = 2 then
  1273                             untint
  1393                             untint
  1274                         else
  1394                         else
  1275                             Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1395                             Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1276                         DrawSprite(sprTardis, x-24, y-63,1);
  1396                         DrawSprite(sprTardis, x-25, y-64,1);
  1277                         if Gear^.Pos <> 2 then
  1397                         if Gear^.Pos <> 2 then
  1278                             untint
  1398                             untint
  1279 (*
  1399 (*
  1280                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1400                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1281                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);
  1401                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);