hedgewars/uGearsRender.pas
changeset 4388 b14e24444bca
child 4394 c1f2ca416ea8
equal deleted inserted replaced
4387:3698361802ed 4388:b14e24444bca
       
     1 {$INCLUDE "options.inc"}
       
     2 unit uGearsRender;
       
     3 
       
     4 interface
       
     5 uses uTypes, uConsts, GLunit, uFloat;
       
     6 
       
     7 procedure RenderGear(Gear: PGear; x, y: LongInt);
       
     8 
       
     9 var RopePoints: record
       
    10                 Count: Longword;
       
    11                 HookAngle: GLfloat;
       
    12                 ar: array[0..MAXROPEPOINTS] of record
       
    13                                   X, Y: hwFloat;
       
    14                                   dLen: hwFloat;
       
    15                                   b: boolean;
       
    16                                   end;
       
    17                 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
       
    18                 end;
       
    19 
       
    20 implementation
       
    21 uses uRender, uUtils, uVariables, uAmmos, Math;
       
    22 
       
    23 procedure DrawRopeLinesRQ(Gear: PGear);
       
    24 begin
       
    25 with RopePoints do
       
    26     begin
       
    27     rounded[Count].X:= hwRound(Gear^.X);
       
    28     rounded[Count].Y:= hwRound(Gear^.Y);
       
    29     rounded[Count + 1].X:= hwRound(Gear^.Hedgehog^.Gear^.X);
       
    30     rounded[Count + 1].Y:= hwRound(Gear^.Hedgehog^.Gear^.Y);
       
    31     end;
       
    32 
       
    33 if (RopePoints.Count > 0) or (Gear^.Elasticity.QWordValue > 0) then
       
    34     begin
       
    35     glDisable(GL_TEXTURE_2D);
       
    36     //glEnable(GL_LINE_SMOOTH);
       
    37 
       
    38     glPushMatrix;
       
    39 
       
    40     glTranslatef(WorldDx, WorldDy, 0);
       
    41 
       
    42     glLineWidth(4.0);
       
    43 
       
    44     Tint($C0, $C0, $C0, $FF);
       
    45 
       
    46     glVertexPointer(2, GL_FLOAT, 0, @RopePoints.rounded[0]);
       
    47     glDrawArrays(GL_LINE_STRIP, 0, RopePoints.Count + 2);
       
    48     Tint($FF, $FF, $FF, $FF);
       
    49 
       
    50     glPopMatrix;
       
    51 
       
    52     glEnable(GL_TEXTURE_2D);
       
    53     //glDisable(GL_LINE_SMOOTH)
       
    54     end
       
    55 end;
       
    56 
       
    57 
       
    58 procedure DrawRope(Gear: PGear);
       
    59 var roplen: LongInt;
       
    60     i: Longword;
       
    61 
       
    62     procedure DrawRopeLine(X1, Y1, X2, Y2: LongInt);
       
    63     var  eX, eY, dX, dY: LongInt;
       
    64         i, sX, sY, x, y, d: LongInt;
       
    65         b: boolean;
       
    66     begin
       
    67     if (X1 = X2) and (Y1 = Y2) then
       
    68     begin
       
    69     //OutError('WARNING: zero length rope line!', false);
       
    70     exit
       
    71     end;
       
    72     eX:= 0;
       
    73     eY:= 0;
       
    74     dX:= X2 - X1;
       
    75     dY:= Y2 - Y1;
       
    76 
       
    77     if (dX > 0) then sX:= 1
       
    78     else
       
    79     if (dX < 0) then
       
    80         begin
       
    81         sX:= -1;
       
    82         dX:= -dX
       
    83         end else sX:= dX;
       
    84 
       
    85     if (dY > 0) then sY:= 1
       
    86     else
       
    87     if (dY < 0) then
       
    88         begin
       
    89         sY:= -1;
       
    90         dY:= -dY
       
    91         end else sY:= dY;
       
    92 
       
    93         if (dX > dY) then d:= dX
       
    94                     else d:= dY;
       
    95 
       
    96         x:= X1;
       
    97         y:= Y1;
       
    98 
       
    99         for i:= 0 to d do
       
   100             begin
       
   101             inc(eX, dX);
       
   102             inc(eY, dY);
       
   103             b:= false;
       
   104             if (eX > d) then
       
   105                 begin
       
   106                 dec(eX, d);
       
   107                 inc(x, sX);
       
   108                 b:= true
       
   109                 end;
       
   110             if (eY > d) then
       
   111                 begin
       
   112                 dec(eY, d);
       
   113                 inc(y, sY);
       
   114                 b:= true
       
   115                 end;
       
   116             if b then
       
   117                 begin
       
   118                 inc(roplen);
       
   119                 if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
       
   120                 end
       
   121         end
       
   122     end;
       
   123 begin
       
   124     if (cReducedQuality and rqSimpleRope) <> 0 then
       
   125         DrawRopeLinesRQ(Gear)
       
   126     else
       
   127         begin
       
   128         roplen:= 0;
       
   129         if RopePoints.Count > 0 then
       
   130             begin
       
   131             i:= 0;
       
   132             while i < Pred(RopePoints.Count) do
       
   133                     begin
       
   134                     DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
       
   135                                 hwRound(RopePoints.ar[Succ(i)].X) + WorldDx, hwRound(RopePoints.ar[Succ(i)].Y) + WorldDy);
       
   136                     inc(i)
       
   137                     end;
       
   138             DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
       
   139                         hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy);
       
   140             DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
       
   141                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy);
       
   142             end else
       
   143             if Gear^.Elasticity.QWordValue > 0 then
       
   144             DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
       
   145                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy);
       
   146         end;
       
   147 
       
   148 
       
   149 if RopePoints.Count > 0 then
       
   150     DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle)
       
   151     else
       
   152     if Gear^.Elasticity.QWordValue > 0 then
       
   153         DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
   154 end;
       
   155 
       
   156 
       
   157 procedure DrawAltWeapon(Gear: PGear; sx, sy: LongInt);
       
   158 begin
       
   159 with Gear^.Hedgehog^ do
       
   160     begin
       
   161     if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
       
   162         exit;
       
   163     DrawTexture(sx + 16, sy + 16, ropeIconTex);
       
   164     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
       
   165     end;
       
   166 end;
       
   167 
       
   168 
       
   169 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
       
   170 var i, t: LongInt;
       
   171     amt: TAmmoType;
       
   172     sign, hx, hy, cx, cy, tx, ty, sx, sy, m: LongInt;  // hedgehog, crosshair, temp, sprite, direction
       
   173     dx, dy, ax, ay, aAngle, dAngle, hAngle, lx, ly: real;  // laser, change
       
   174     defaultPos, HatVisible: boolean;
       
   175     HH: PHedgehog;
       
   176     CurWeapon: PAmmo;
       
   177 begin
       
   178     HH:= Gear^.Hedgehog;
       
   179     if HH^.Unplaced then exit;
       
   180     m:= 1;
       
   181     if ((Gear^.State and gstHHHJump) <> 0) and not cArtillery then m:= -1;
       
   182     sx:= ox + 1; // this offset is very common
       
   183     sy:= oy - 3;
       
   184     sign:= hwSign(Gear^.dX);
       
   185 
       
   186     if (Gear^.State and gstHHDeath) <> 0 then
       
   187         begin
       
   188         DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos);
       
   189         Tint(HH^.Team^.Clan^.Color);
       
   190         DrawSprite(sprHHDeath, ox - 16, oy - 26, Gear^.Pos + 8);
       
   191         Tint($FF, $FF, $FF, $FF);
       
   192         exit
       
   193         end
       
   194     else if (Gear^.State and gstHHGone) <> 0 then
       
   195         begin
       
   196         DrawRotatedF(sprTeleport, sx, sy, Gear^.Pos, sign, 0);
       
   197         exit
       
   198         end;
       
   199 
       
   200     defaultPos:= true;
       
   201     HatVisible:= false;
       
   202 
       
   203 
       
   204     if HH^.Effects[hePoisoned] then
       
   205         begin
       
   206         Tint($00, $FF, $40, $40);
       
   207         DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360);
       
   208         Tint($FF, $FF, $FF, $FF)
       
   209         end;
       
   210 
       
   211     if ((Gear^.State and gstWinner) <> 0) and
       
   212     ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then
       
   213         begin
       
   214         DrawHedgehog(sx, sy,
       
   215                 sign,
       
   216                 2,
       
   217                 0,
       
   218                 0);
       
   219         defaultPos:= false
       
   220         end;
       
   221     if (Gear^.State and gstDrowning) <> 0 then
       
   222         begin
       
   223         DrawHedgehog(sx, sy,
       
   224                 sign,
       
   225                 1,
       
   226                 7,
       
   227                 0);
       
   228         defaultPos:= false
       
   229         end else
       
   230     if (Gear^.State and gstLoser) <> 0 then
       
   231         begin
       
   232         DrawHedgehog(sx, sy,
       
   233                 sign,
       
   234                 2,
       
   235                 3,
       
   236                 0);
       
   237         defaultPos:= false
       
   238         end else
       
   239 
       
   240     if (Gear^.State and gstHHDriven) <> 0 then
       
   241         begin
       
   242         if ((Gear^.State and gstHHThinking) = 0) and
       
   243         (ShowCrosshair  or ((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtRope))) and
       
   244         ((Gear^.State and (gstAttacked or gstAnimation)) = 0) then
       
   245             begin
       
   246     (* These calculations are a little complex for a few reasons:
       
   247     1: I need to draw the laser from weapon origin to nearest land
       
   248     2: I need to start the beam outside the hedgie for attractiveness.
       
   249     3: I need to extend the beam beyond land.
       
   250     This routine perhaps should be pushed into uStore or somesuch instead of continuuing the increase in size of this function.
       
   251     *)
       
   252             dx:= sign * m * Sin(Gear^.Angle * pi / cMaxAngle);
       
   253             dy:= -Cos(Gear^.Angle * pi / cMaxAngle);
       
   254             if cLaserSighting then
       
   255                 begin
       
   256                 lx:= GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle);
       
   257                 ly:= GetLaunchY(HH^.CurAmmoType, Gear^.Angle);
       
   258 
       
   259                 // ensure we start outside the hedgehog (he's solid after all)
       
   260                 while abs(lx * lx + ly * ly) < (Gear^.radius * Gear^.radius) do
       
   261                     begin
       
   262                     lx:= lx + dx;
       
   263                     ly:= ly + dy
       
   264                     end;
       
   265 
       
   266                 // add hog's position
       
   267                 lx:= lx + ox - WorldDx;
       
   268                 ly:= ly + oy - WorldDy;
       
   269 
       
   270                 // decrease number of iterations required
       
   271                 ax:= dx * 4;
       
   272                 ay:= dy * 4;
       
   273 
       
   274                 tx:= round(lx);
       
   275                 ty:= round(ly);
       
   276                 hx:= tx;
       
   277                 hy:= ty;
       
   278                 while ((ty and LAND_HEIGHT_MASK) = 0) and
       
   279                     ((tx and LAND_WIDTH_MASK) = 0) and
       
   280                     (Land[ty, tx] = 0) do // TODO: check for constant variable instead
       
   281                     begin
       
   282                     lx:= lx + ax;
       
   283                     ly:= ly + ay;
       
   284                     tx:= round(lx);
       
   285                     ty:= round(ly)
       
   286                     end;
       
   287                 // reached edge of land. assume infinite beam. Extend it way out past camera
       
   288                 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then
       
   289                     begin
       
   290                     tx:= round(lx + ax * (LAND_WIDTH div 4));
       
   291                     ty:= round(ly + ay * (LAND_WIDTH div 4));
       
   292                     end;
       
   293 
       
   294                 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then
       
   295                     begin
       
   296                     DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0);
       
   297                     end;
       
   298                 end;
       
   299             // draw crosshair
       
   300             cx:= Round(hwRound(Gear^.X) + dx * 80 + GetLaunchX(HH^.CurAmmoType, sign * m, Gear^.Angle));
       
   301             cy:= Round(hwRound(Gear^.Y) + dy * 80 + GetLaunchY(HH^.CurAmmoType, Gear^.Angle));
       
   302             DrawRotatedTex(HH^.Team^.CrosshairTex,
       
   303                     12, 12, cx + WorldDx, cy + WorldDy, 0,
       
   304                     sign * (Gear^.Angle * 180.0) / cMaxAngle);
       
   305             end;
       
   306         hx:= ox + 8 * sign;
       
   307         hy:= oy - 2;
       
   308         aangle:= Gear^.Angle * 180 / cMaxAngle - 90;
       
   309         if CurAmmoGear <> nil then
       
   310         begin
       
   311             case CurAmmoGear^.Kind of
       
   312                 gtShotgunShot: begin
       
   313                         if (CurAmmoGear^.State and gstAnimation <> 0) then
       
   314                             DrawRotated(sprShotgun, hx, hy, sign, aangle)
       
   315                         else
       
   316                             DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
       
   317                     end;
       
   318                 gtDEagleShot: DrawRotated(sprDEagle, hx, hy, sign, aangle);
       
   319                 gtSniperRifleShot: begin
       
   320                         if (CurAmmoGear^.State and gstAnimation <> 0) then
       
   321                             DrawRotatedF(sprSniperRifle, hx, hy, 1, sign, aangle)
       
   322                         else
       
   323                             DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle)
       
   324                     end;
       
   325                 gtBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
       
   326                 gtRCPlane: begin
       
   327                     DrawRotated(sprHandPlane, hx, hy, sign, 0);
       
   328                     defaultPos:= false
       
   329                     end;
       
   330                 gtRope: begin
       
   331                     if Gear^.X < CurAmmoGear^.X then
       
   332                         begin
       
   333                         dAngle:= 0;
       
   334                         hAngle:= 180;
       
   335                         i:= 1
       
   336                         end else
       
   337                         begin
       
   338                         dAngle:= 180;
       
   339                         hAngle:= 0;
       
   340                         i:= -1
       
   341                         end;
       
   342                 if ((Gear^.State and gstWinner) = 0) then
       
   343                     begin
       
   344                     DrawHedgehog(ox, oy,
       
   345                             i,
       
   346                             1,
       
   347                             0,
       
   348                             DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
       
   349                     with HH^ do
       
   350                         if (HatTex <> nil) then
       
   351                             begin
       
   352                             DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
       
   353                                 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
       
   354                             if HatTex^.w > 64 then
       
   355                                 begin
       
   356                                 Tint(HH^.Team^.Clan^.Color);
       
   357                                 DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
       
   358                                     i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
       
   359                                 Tint($FF, $FF, $FF, $FF)
       
   360                                 end
       
   361                             end
       
   362                     end;
       
   363                     DrawAltWeapon(Gear, ox, oy);
       
   364                     defaultPos:= false
       
   365                     end;
       
   366                 gtBlowTorch: begin
       
   367                     DrawRotated(sprBlowTorch, hx, hy, sign, aangle);
       
   368                     DrawHedgehog(sx, sy,
       
   369                             sign,
       
   370                             3,
       
   371                             HH^.visStepPos div 2,
       
   372                             0);
       
   373                     with HH^ do
       
   374                         if (HatTex <> nil) then
       
   375                             begin
       
   376                             DrawTextureF(HatTex,
       
   377                                 1,
       
   378                                 sx,
       
   379                                 sy - 5,
       
   380                                 0,
       
   381                                 sign,
       
   382                                 32,
       
   383                                 32);
       
   384                             if HatTex^.w > 64 then
       
   385                                 begin
       
   386                                 Tint(HH^.Team^.Clan^.Color);
       
   387                                 DrawTextureF(HatTex,
       
   388                                     1,
       
   389                                     sx,
       
   390                                     sy - 5,
       
   391                                     32,
       
   392                                     sign,
       
   393                                     32,
       
   394                                     32);
       
   395                                 Tint($FF, $FF, $FF, $FF)
       
   396                                 end
       
   397                             end;
       
   398                     defaultPos:= false
       
   399                     end;
       
   400                 gtShover: DrawRotated(sprHandBaseball, hx, hy, sign, aangle + 180);
       
   401                 gtFirePunch: begin
       
   402                     DrawHedgehog(sx, sy,
       
   403                             sign,
       
   404                             1,
       
   405                             4,
       
   406                             0);
       
   407                     defaultPos:= false
       
   408                     end;
       
   409                 gtPickHammer: begin
       
   410                     defaultPos:= false;
       
   411                     dec(sy,20);
       
   412                     end;
       
   413                 gtTeleport: defaultPos:= false;
       
   414                 gtWhip: begin
       
   415                     DrawRotatedF(sprWhip,
       
   416                             sx,
       
   417                             sy,
       
   418                             1,
       
   419                             sign,
       
   420                             0);
       
   421                     defaultPos:= false
       
   422                     end;
       
   423                 gtHammer: begin
       
   424                     DrawRotatedF(sprHammer,
       
   425                             sx,
       
   426                             sy,
       
   427                             1,
       
   428                             sign,
       
   429                             0);
       
   430                     defaultPos:= false
       
   431                     end;
       
   432                 gtResurrector: begin
       
   433                     DrawRotated(sprHandResurrector, sx, sy, 0, 0);
       
   434                     defaultPos:= false
       
   435                     end;
       
   436                 gtKamikaze: begin
       
   437                     if CurAmmoGear^.Pos = 0 then
       
   438                         DrawHedgehog(sx, sy,
       
   439                                 sign,
       
   440                                 1,
       
   441                                 6,
       
   442                                 0)
       
   443                     else
       
   444                         DrawRotatedF(sprKamikaze,
       
   445                                 ox, oy,
       
   446                                 CurAmmoGear^.Pos - 1,
       
   447                                 sign,
       
   448                                 aangle);
       
   449                     defaultPos:= false
       
   450                     end;
       
   451                 gtSeduction: begin
       
   452                     if CurAmmoGear^.Pos >= 6 then
       
   453                         DrawHedgehog(sx, sy,
       
   454                                 sign,
       
   455                                 2,
       
   456                                 2,
       
   457                                 0)
       
   458                     else
       
   459                         begin
       
   460                         DrawRotatedF(sprDress,
       
   461                                 ox, oy,
       
   462                                 CurAmmoGear^.Pos,
       
   463                                 sign,
       
   464                                 0);
       
   465                         DrawSprite(sprCensored, ox - 32, oy - 20, 0)
       
   466                         end;
       
   467                     defaultPos:= false
       
   468                     end;
       
   469                 gtFlamethrower: begin
       
   470                     DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
       
   471                     if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
       
   472                     end;
       
   473             end;
       
   474 
       
   475             case CurAmmoGear^.Kind of
       
   476                 gtShotgunShot,
       
   477                 gtDEagleShot,
       
   478                 gtSniperRifleShot,
       
   479                 gtShover: begin
       
   480                     DrawHedgehog(sx, sy,
       
   481                             sign,
       
   482                             0,
       
   483                             4,
       
   484                             0);
       
   485                     defaultPos:= false;
       
   486                     HatVisible:= true
       
   487                 end
       
   488             end
       
   489         end else
       
   490 
       
   491         if ((Gear^.State and gstHHJumping) <> 0) then
       
   492         begin
       
   493         DrawHedgehog(sx, sy,
       
   494             sign*m,
       
   495             1,
       
   496             1,
       
   497             0);
       
   498         HatVisible:= true;
       
   499         defaultPos:= false
       
   500         end else
       
   501 
       
   502         if (Gear^.Message and (gmLeft or gmRight) <> 0) and (not isCursorVisible) then
       
   503             begin
       
   504             DrawHedgehog(sx, sy,
       
   505                 sign,
       
   506                 0,
       
   507                 HH^.visStepPos div 2,
       
   508                 0);
       
   509             defaultPos:= false;
       
   510             HatVisible:= true
       
   511             end
       
   512         else
       
   513 
       
   514         if ((Gear^.State and gstAnimation) <> 0) then
       
   515             begin
       
   516             if (TWave(Gear^.Tag) < Low(TWave)) or (TWave(Gear^.Tag) > High(TWave)) then
       
   517                 begin
       
   518                 Gear^.State:= Gear^.State and not gstAnimation;
       
   519                 end
       
   520             else
       
   521                 begin
       
   522                 DrawRotatedF(Wavez[TWave(Gear^.Tag)].Sprite,
       
   523                         sx,
       
   524                         sy,
       
   525                         Gear^.Pos,
       
   526                         sign,
       
   527                         0.0);
       
   528                 defaultPos:= false
       
   529                 end
       
   530             end
       
   531         else
       
   532         if ((Gear^.State and gstAttacked) = 0) then
       
   533             begin
       
   534             if HH^.Timer > 0 then
       
   535                 begin
       
   536                 // There must be a tidier way to do this. Anyone?
       
   537                 if aangle <= 90 then aangle:= aangle+360;
       
   538                 if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*HH^.Timer/10)
       
   539                 else aangle:= aangle+((240-aangle)*HH^.Timer/10);
       
   540                 dec(HH^.Timer)
       
   541                 end;
       
   542             amt:= CurrentHedgehog^.CurAmmoType;
       
   543             CurWeapon:= GetAmmoEntry(HH^);
       
   544             case amt of
       
   545                 amBazooka: DrawRotated(sprHandBazooka, hx, hy, sign, aangle);
       
   546                 amMortar: DrawRotated(sprHandMortar, hx, hy, sign, aangle);
       
   547                 amMolotov: DrawRotated(sprHandMolotov, hx, hy, sign, aangle);
       
   548                 amBallgun: DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
       
   549                 amDrill: DrawRotated(sprHandDrill, hx, hy, sign, aangle);
       
   550                 amRope: DrawRotated(sprHandRope, hx, hy, sign, aangle);
       
   551                 amShotgun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
       
   552                 amDEagle: DrawRotated(sprHandDEagle, hx, hy, sign, aangle);
       
   553                 amSineGun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
       
   554                 amPortalGun: if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer?
       
   555                                 DrawRotatedF(sprPortalGun, hx, hy, 0, sign, aangle)
       
   556                         else
       
   557                                 DrawRotatedF(sprPortalGun, hx, hy, 1+(CurWeapon^.Timer and 1), sign, aangle);
       
   558                 amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle);
       
   559                 amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, sign, aangle);
       
   560                 amCake: DrawRotated(sprHandCake, hx, hy, sign, aangle);
       
   561                 amGrenade: DrawRotated(sprHandGrenade, hx, hy, sign, aangle);
       
   562                 amWatermelon: DrawRotated(sprHandMelon, hx, hy, sign, aangle);
       
   563                 amSkip: DrawRotated(sprHandSkip, hx, hy, sign, aangle);
       
   564                 amClusterBomb: DrawRotated(sprHandCluster, hx, hy, sign, aangle);
       
   565                 amDynamite: DrawRotated(sprHandDynamite, hx, hy, sign, aangle);
       
   566                 amHellishBomb: DrawRotated(sprHandHellish, hx, hy, sign, aangle);
       
   567                 amGasBomb: DrawRotated(sprHandCheese, hx, hy, sign, aangle);
       
   568                 amMine: DrawRotated(sprHandMine, hx, hy, sign, aangle);
       
   569                 amSMine: DrawRotated(sprHandSMine, hx, hy, sign, aangle);
       
   570                 amSeduction: DrawRotated(sprHandSeduction, hx, hy, sign, aangle);
       
   571                 amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
       
   572                 amRCPlane: begin
       
   573                     DrawRotated(sprHandPlane, hx, hy, sign, 0);
       
   574                     defaultPos:= false
       
   575                     end;
       
   576                 amGirder: begin
       
   577                     DrawRotated(sprHandConstruction, hx, hy, sign, aangle);
       
   578                     DrawSpriteClipped(sprGirder,
       
   579                                     ox-256,
       
   580                                     oy-256,
       
   581                                     LongInt(topY)+WorldDy,
       
   582                                     LongInt(rightX)+WorldDx,
       
   583                                     cWaterLine+WorldDy,
       
   584                                     LongInt(leftX)+WorldDx)
       
   585                     end;
       
   586                 amBee: DrawRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
       
   587                 amFlamethrower: DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
       
   588                 amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here
       
   589             end;
       
   590 
       
   591             case amt of
       
   592                 amAirAttack,
       
   593                 amMineStrike,
       
   594                 amDrillStrike: DrawRotated(sprHandAirAttack, sx, oy, sign, 0);
       
   595                 amPickHammer: DrawHedgehog(sx, sy,
       
   596                             sign,
       
   597                             1,
       
   598                             2,
       
   599                             0);
       
   600                 amTeleport: DrawRotatedF(sprTeleport, sx, sy, 0, sign, 0);
       
   601                 amKamikaze: DrawHedgehog(sx, sy,
       
   602                             sign,
       
   603                             1,
       
   604                             5,
       
   605                             0);
       
   606                 amWhip: DrawRotatedF(sprWhip,
       
   607                             sx,
       
   608                             sy,
       
   609                             0,
       
   610                             sign,
       
   611                             0);
       
   612                 amHammer: DrawRotatedF(sprHammer,
       
   613                             sx,
       
   614                             sy,
       
   615                             0,
       
   616                             sign,
       
   617                             0);
       
   618             else
       
   619                 DrawHedgehog(sx, sy,
       
   620                     sign,
       
   621                     0,
       
   622                     4,
       
   623                     0);
       
   624 
       
   625                 HatVisible:= true;
       
   626                 (* with HH^ do
       
   627                     if (HatTex <> nil)
       
   628                     and (HatVisibility > 0) then
       
   629                         DrawTextureF(HatTex,
       
   630                             HatVisibility,
       
   631                             sx,
       
   632                             sy - 5,
       
   633                             0,
       
   634                             sign,
       
   635                             32,
       
   636                             32); *)
       
   637             end;
       
   638 
       
   639             case amt of
       
   640                 amBaseballBat: DrawRotated(sprHandBaseball,
       
   641                         sx - 4 * sign,
       
   642                         sy + 9, sign, aangle);
       
   643             end;
       
   644 
       
   645             defaultPos:= false
       
   646         end;
       
   647 
       
   648     end else // not gstHHDriven
       
   649         begin
       
   650         if (Gear^.Damage > 0)
       
   651         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
       
   652             begin
       
   653             DrawHedgehog(sx, sy,
       
   654                 sign,
       
   655                 2,
       
   656                 1,
       
   657                 Gear^.DirAngle);
       
   658             defaultPos:= false
       
   659             end else
       
   660 
       
   661         if ((Gear^.State and gstHHJumping) <> 0) then
       
   662             begin
       
   663             DrawHedgehog(sx, sy,
       
   664                 sign*m,
       
   665                 1,
       
   666                 1,
       
   667                 0);
       
   668             defaultPos:= false
       
   669             end;
       
   670         end;
       
   671 
       
   672     with HH^ do
       
   673         begin
       
   674         if defaultPos then
       
   675             begin
       
   676             DrawRotatedF(sprHHIdle,
       
   677                 sx,
       
   678                 sy,
       
   679                 (RealTicks div 128 + Gear^.Pos) mod 19,
       
   680                 sign,
       
   681                 0);
       
   682             HatVisible:= true;
       
   683             end;
       
   684 
       
   685         if HatVisible then
       
   686             if HatVisibility < 1.0 then
       
   687                 HatVisibility:= HatVisibility + 0.2
       
   688             else
       
   689         else
       
   690             if HatVisibility > 0.0 then
       
   691                 HatVisibility:= HatVisibility - 0.2;
       
   692 
       
   693         if (HatTex <> nil)
       
   694         and (HatVisibility > 0) then
       
   695             if DefaultPos then
       
   696                 begin
       
   697                 DrawTextureF(HatTex,
       
   698                     HatVisibility,
       
   699                     sx,
       
   700                     sy - 5,
       
   701                     (RealTicks div 128 + Gear^.Pos) mod 19,
       
   702                     sign,
       
   703                     32,
       
   704                     32);
       
   705                 if HatTex^.w > 64 then
       
   706                     begin
       
   707                     Tint(HH^.Team^.Clan^.Color);
       
   708                     DrawTextureF(HatTex,
       
   709                         HatVisibility,
       
   710                         sx,
       
   711                         sy - 5,
       
   712                         (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
       
   713                         sign,
       
   714                         32,
       
   715                         32);
       
   716                     Tint($FF, $FF, $FF, $FF)
       
   717                     end
       
   718                 end
       
   719             else
       
   720                 begin
       
   721                 DrawTextureF(HatTex,
       
   722                     HatVisibility,
       
   723                     sx,
       
   724                     sy - 5,
       
   725                     0,
       
   726                     sign*m,
       
   727                     32,
       
   728                     32);
       
   729                 if HatTex^.w > 64 then
       
   730                     begin
       
   731                     Tint(HH^.Team^.Clan^.Color);
       
   732                     DrawTextureF(HatTex,
       
   733                         HatVisibility,
       
   734                         sx,
       
   735                         sy - 5,
       
   736                         32,
       
   737                         sign*m,
       
   738                         32,
       
   739                         32);
       
   740                     Tint($FF, $FF, $FF, $FF)
       
   741                     end
       
   742                 end
       
   743         end;
       
   744     if (Gear^.State and gstHHDriven) <> 0 then
       
   745         begin
       
   746     (*    if (CurAmmoGear = nil) then
       
   747             begin
       
   748             amt:= CurrentHedgehog^.CurAmmoType;
       
   749             case amt of
       
   750                 amJetpack: DrawSprite(sprJetpack, sx-32, sy-32, 0);
       
   751                 end
       
   752             end; *)
       
   753         if CurAmmoGear <> nil then
       
   754             begin
       
   755             case CurAmmoGear^.Kind of
       
   756                 gtJetpack: begin
       
   757                         DrawSprite(sprJetpack, sx-32, sy-32, 0);
       
   758                         if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then
       
   759                             begin
       
   760                             if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-28, 1);
       
   761                             if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-28, sy-28, 2);
       
   762                             if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-36, sy-28, 3)
       
   763                             end;
       
   764                         if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex);
       
   765                         DrawAltWeapon(Gear, sx, sy)
       
   766                         end;
       
   767                 end;
       
   768             end
       
   769         end;
       
   770 
       
   771     with HH^ do
       
   772         begin
       
   773         if ((Gear^.State and not gstWinner) = 0)
       
   774             or ((Gear^.State = gstWait) and (Gear^.dY.QWordValue = 0))
       
   775             or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then
       
   776             begin
       
   777             t:= sy - cHHRadius - 9;
       
   778             if (cTagsMask and htTransparent) <> 0 then
       
   779                 Tint($FF, $FF, $FF, $80);
       
   780             if ((cTagsMask and htHealth) <> 0) then
       
   781                 begin
       
   782                 dec(t, HealthTagTex^.h + 2);
       
   783                 DrawCentered(ox, t, HealthTagTex)
       
   784                 end;
       
   785             if (cTagsMask and htName) <> 0 then
       
   786                 begin
       
   787                 dec(t, NameTagTex^.h + 2);
       
   788                 DrawCentered(ox, t, NameTagTex)
       
   789                 end;
       
   790             if (cTagsMask and htTeamName) <> 0 then
       
   791                 begin
       
   792                 dec(t, Team^.NameTagTex^.h + 2);
       
   793                 DrawCentered(ox, t, Team^.NameTagTex)
       
   794                 end;
       
   795             if (cTagsMask and htTransparent) <> 0 then
       
   796                 Tint($FF, $FF, $FF, $FF)
       
   797             end;
       
   798         if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog
       
   799             begin
       
   800             if bShowFinger and ((Gear^.State and gstHHDriven) <> 0) then
       
   801                 DrawSprite(sprFinger, ox - 16, oy - 64,
       
   802                             GameTicks div 32 mod 16);
       
   803 
       
   804             if (Gear^.State and gstDrowning) = 0 then
       
   805                 if (Gear^.State and gstHHThinking) <> 0 then
       
   806                     DrawSprite(sprQuestion, ox - 10, oy - cHHRadius - 34, (RealTicks shr 9) mod 8)
       
   807             end
       
   808         end;
       
   809 
       
   810     if HH^.Effects[hePoisoned] then
       
   811         begin
       
   812         Tint($00, $FF, $40, $80);
       
   813         DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360);
       
   814         end;
       
   815     if HH^.Effects[heResurrected] then
       
   816         begin
       
   817         Tint($f5, $db, $35, $20);
       
   818         DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
       
   819         end;
       
   820 
       
   821     if Gear^.Invulnerable then
       
   822         begin
       
   823         Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - ((RealTicks div 2 + Gear^.uid * 491) mod 1500) / 750))));
       
   824         DrawSprite(sprInvulnerable, sx - 24, sy - 24, 0);
       
   825         end;
       
   826     if cVampiric and
       
   827     (CurrentHedgehog^.Gear <> nil) and
       
   828     (CurrentHedgehog^.Gear = Gear) then
       
   829         begin
       
   830         Tint($FF, 0, 0, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
       
   831         DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
       
   832         end;
       
   833         Tint($FF, $FF, $FF, $FF)
       
   834 end;
       
   835 
       
   836 
       
   837 procedure RenderGear(Gear: PGear; x, y: LongInt);
       
   838 var
       
   839     HHGear: PGear;
       
   840     i: Longword;
       
   841     startX, endX, startY, endY: LongInt;
       
   842 begin
       
   843     case Gear^.Kind of
       
   844           gtBomb: DrawRotated(sprBomb, x, y, 0, Gear^.DirAngle);
       
   845        gtGasBomb: DrawRotated(sprCheese, x, y, 0, Gear^.DirAngle);
       
   846        gtMolotov: DrawRotated(sprMolotov, x, y, 0, Gear^.DirAngle);
       
   847 
       
   848        gtRCPlane: begin
       
   849                   if (Gear^.Tag = -1) then
       
   850                      DrawRotated(sprPlane, x, y, -1,  DxDy2Angle(Gear^.dX, Gear^.dY) + 90)
       
   851                   else
       
   852                      DrawRotated(sprPlane, x, y,0,DxDy2Angle(Gear^.dY, Gear^.dX));
       
   853                   if ((TrainingFlags and tfRCPlane) <> 0) and (TrainingTargetGear <> nil) and ((Gear^.State and gstDrowning) = 0) then
       
   854                      DrawRotatedf(sprFinger, x, y, GameTicks div 32 mod 16, 0, DxDy2Angle(Gear^.X - TrainingTargetGear^.X, TrainingTargetGear^.Y - Gear^.Y));
       
   855                   end;
       
   856        gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
       
   857 
       
   858        gtPortal: if ((Gear^.Tag and 1) = 0) // still moving?
       
   859                  or (Gear^.IntersectGear = nil) or (Gear^.IntersectGear^.IntersectGear <> Gear) // not linked&backlinked?
       
   860                  or ((Gear^.IntersectGear^.Tag and 1) = 0) then // linked portal still moving?
       
   861                       DrawRotatedf(sprPortal, x, y, Gear^.Tag, hwSign(Gear^.dX), Gear^.DirAngle)
       
   862                  else DrawRotatedf(sprPortal, x, y, 4 + Gear^.Tag div 2, hwSign(Gear^.dX), Gear^.DirAngle);
       
   863 
       
   864            gtDrill: if (Gear^.State and gsttmpFlag) <> 0 then
       
   865                         DrawRotated(sprAirDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX))
       
   866                     else
       
   867                         DrawRotated(sprDrill, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
   868 
       
   869         gtHedgehog: DrawHH(Gear, x, y);
       
   870 
       
   871            gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
   872 
       
   873            gtGrave: begin
       
   874                     DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32);
       
   875                     if Gear^.Health > 0 then
       
   876                         begin
       
   877                         //Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750))));
       
   878                         Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health)))));
       
   879                         //Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
       
   880                         DrawSprite(sprVampiric, x - 24, y - 24, 0);
       
   881                         Tint($FF, $FF, $FF, $FF)
       
   882                         end
       
   883                     end;
       
   884              gtBee: DrawRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
   885       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
       
   886             gtRope: DrawRope(Gear);
       
   887             gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
       
   888                            DrawRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
       
   889                        else if Gear^.Health <> 0 then DrawRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
       
   890                        else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
       
   891            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
       
   892                            DrawRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
       
   893                        else if Gear^.Health <> 0 then DrawRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
       
   894                        else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
       
   895             gtCase: case Gear^.Pos of
       
   896                          posCaseAmmo  : begin
       
   897                                         i:= (GameTicks shr 6) mod 64;
       
   898                                         if i > 18 then i:= 0;
       
   899                                         DrawSprite(sprCase, x - 24, y - 24, i);
       
   900                                         end;
       
   901                          posCaseHealth: begin
       
   902                                         i:= ((GameTicks shr 6) + 38) mod 64;
       
   903                                         if i > 13 then i:= 0;
       
   904                                         DrawSprite(sprFAid, x - 24, y - 24, i);
       
   905                                         end;
       
   906                          posCaseUtility: begin
       
   907                                         i:= (GameTicks shr 6) mod 70;
       
   908                                         if i > 23 then i:= 0;
       
   909                                         i:= i mod 12;
       
   910                                         DrawSprite(sprUtility, x - 24, y - 24, i);
       
   911                                         end;
       
   912                          end;
       
   913       gtExplosives: begin
       
   914                     if ((Gear^.State and gstDrowning) <> 0) then
       
   915                         DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
       
   916                     else if Gear^.State and gstAnimation = 0 then
       
   917                         begin
       
   918                         i:= (GameTicks shr 6 + Gear^.uid*3) mod 64;
       
   919                         if i > 18 then i:= 0;
       
   920                         DrawSprite(sprExplosives, x - 24, y - 24, i)
       
   921                         end
       
   922                     else if Gear^.State and gsttmpFlag = 0 then
       
   923                         DrawRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
       
   924                     else
       
   925                         DrawRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle);
       
   926                     end;
       
   927         gtDynamite: DrawSprite2(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
       
   928      gtClusterBomb: DrawRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
       
   929          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
       
   930            gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16);
       
   931        gtParachute: begin
       
   932                     DrawSprite(sprParachute, x - 24, y - 48, 0);
       
   933                     DrawAltWeapon(Gear, x + 1, y - 3)
       
   934                     end;
       
   935        gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 0)
       
   936                                      else DrawSprite(sprAirplane, x - SpritesData[sprAirplane].Width div 2, y - SpritesData[sprAirplane].Height div 2, 1);
       
   937          gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
   938         gtTeleport: begin
       
   939                     HHGear:= Gear^.Hedgehog^.Gear;
       
   940                     if not Gear^.Hedgehog^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
       
   941                     DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0);
       
   942                     end;
       
   943         gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
       
   944           gtTarget: begin
       
   945                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
       
   946                     DrawSprite(sprTarget, x - 16, y - 16, 0);
       
   947                     Tint($FF, $FF, $FF, $FF);
       
   948                     end;
       
   949           gtMortar: DrawRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
   950           gtCake: if Gear^.Pos = 6 then
       
   951                      DrawRotatedf(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90)
       
   952                   else
       
   953                      DrawRotatedf(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90);
       
   954        gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, x - 16, y - 16, 0);
       
   955       gtWatermelon: DrawRotatedf(sprWatermelon, x, y, 0, 0, Gear^.DirAngle);
       
   956       gtMelonPiece: DrawRotatedf(sprWatermelon, x, y, 1, 0, Gear^.DirAngle);
       
   957      gtHellishBomb: DrawRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle);
       
   958            gtBirdy: begin
       
   959                     if Gear^.State and gstAnimation = gstAnimation then
       
   960                         begin
       
   961                         if Gear^.State and gstTmpFlag = 0 then // Appearing
       
   962                             begin
       
   963                             endX:= x - WorldDx;
       
   964                             endY:= y - WorldDy;
       
   965                             if Gear^.Tag < 0 then
       
   966                                 startX:= max(LAND_WIDTH + 1024, endX + 2048)
       
   967                             else
       
   968                                 startX:= max(-LAND_WIDTH - 1024, endX - 2048);
       
   969                             startY:= endY - 256;
       
   970                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + round((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1)), startY + WorldDy + round((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
       
   971                             end
       
   972                         else // Disappearing
       
   973                             begin
       
   974                             startX:= x - WorldDx;
       
   975                             startY:= y - WorldDy;
       
   976                             if Gear^.Tag > 0 then
       
   977                                 endX:= max(LAND_WIDTH + 1024, startX + 2048)
       
   978                             else
       
   979                                 endX:= max(-LAND_WIDTH - 1024, startX - 2048);
       
   980                             endY:= startY + 256;
       
   981                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + round((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + round((endY - startY) * cos(LongInt(Gear^.Timer)/2000 * (Pi/2)) - (endY - startY)) + hwRound(Gear^.dY * Gear^.Timer), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
       
   982                             end;
       
   983                         end
       
   984                     else
       
   985                         DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
       
   986                     end;
       
   987              gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, x, y, 0, 1, 16, 16, Gear^.DirAngle);
       
   988            gtPiano: begin
       
   989                     if (Gear^.State and gstDrowning) = 0 then
       
   990                         begin
       
   991                         Tint($FF, $FF, $FF, $10);
       
   992                         for i:= 8 downto 1 do
       
   993                             DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0);
       
   994                         Tint($FF, $FF, $FF, $FF)
       
   995                         end;
       
   996                     DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y, 0, 1, 128, 128, 0);
       
   997                     end;
       
   998      gtPoisonCloud: begin
       
   999                     if Gear^.Timer < 1020 then
       
  1000                         Tint($C0, $C0, $00, Gear^.Timer div 8)
       
  1001                     else if Gear^.Timer > 3980 then
       
  1002                         Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8)
       
  1003                     else
       
  1004                         Tint($C0, $C0, $00, $C0);
       
  1005                     DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360);
       
  1006                     Tint($FF, $FF, $FF, $FF)
       
  1007                     end;
       
  1008      gtResurrector: begin
       
  1009                     DrawRotated(sprCross, x, y, 0, 0);
       
  1010                     Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
       
  1011                     DrawTexture(x - 108, y - 108, SpritesData[sprVampiric].Texture, 4.5);
       
  1012                     Tint($FF, $FF, $FF, $FF);
       
  1013                     end;
       
  1014       gtNapalmBomb: DrawRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
       
  1015          end;
       
  1016       if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(x + 8, y + 8, Gear^.Tex);
       
  1017 end;
       
  1018 
       
  1019 end.