hedgewars/uGearsRender.pas
changeset 6580 6155187bf599
parent 6508 bf5db4517148
child 6700 e04da46ee43c
equal deleted inserted replaced
6579:fc52f7c22c9b 6580:6155187bf599
    27 
    27 
    28 var RopePoints: record
    28 var RopePoints: record
    29                 Count: Longword;
    29                 Count: Longword;
    30                 HookAngle: GLfloat;
    30                 HookAngle: GLfloat;
    31                 ar: array[0..MAXROPEPOINTS] of record
    31                 ar: array[0..MAXROPEPOINTS] of record
    32                                   X, Y: hwFloat;
    32                                 X, Y: hwFloat;
    33                                   dLen: hwFloat;
    33                                 dLen: hwFloat;
    34                                   b: boolean;
    34                                 b: boolean;
    35                                   end;
    35                                 end;
    36                 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
    36                 rounded: array[0..MAXROPEPOINTS + 2] of TVertex2f;
    37                 end;
    37                 end;
    38 
    38 
    39 implementation
    39 implementation
    40 uses uRender, uUtils, uVariables, uAmmos, Math;
    40 uses uRender, uUtils, uVariables, uAmmos, Math;
    87     eX:= 0;
    87     eX:= 0;
    88     eY:= 0;
    88     eY:= 0;
    89     dX:= X2 - X1;
    89     dX:= X2 - X1;
    90     dY:= Y2 - Y1;
    90     dY:= Y2 - Y1;
    91 
    91 
    92     if (dX > 0) then sX:= 1
    92     if (dX > 0) then
       
    93         sX:= 1
    93     else
    94     else
    94     if (dX < 0) then
    95         if (dX < 0) then
    95         begin
    96             begin
    96         sX:= -1;
    97             sX:= -1;
    97         dX:= -dX
    98             dX:= -dX
    98         end else sX:= dX;
    99             end
       
   100         else sX:= dX;
    99 
   101 
   100     if (dY > 0) then 
   102     if (dY > 0) then 
   101         sY:= 1
   103         sY:= 1
   102     else
   104     else
   103         if (dY < 0) then
   105         if (dY < 0) then
   104             begin
   106             begin
   105             sY:= -1;
   107             sY:= -1;
   106             dY:= -dY
   108             dY:= -dY
   107             end else 
   109             end
       
   110         else 
   108             sY:= dY;
   111             sY:= dY;
   109 
   112 
   110     if (dX > dY) then d:= dX
   113     if (dX > dY) then
   111                 else d:= dY;
   114         d:= dX
       
   115     else
       
   116         d:= dY;
   112 
   117 
   113     x:= X1;
   118     x:= X1;
   114     y:= Y1;
   119     y:= Y1;
   115 
   120 
   116     for i:= 0 to d do
   121     for i:= 0 to d do
   131             b:= true
   136             b:= true
   132             end;
   137             end;
   133         if b then
   138         if b then
   134             begin
   139             begin
   135             inc(roplen);
   140             inc(roplen);
   136             if (roplen mod 4) = 0 then DrawSprite(sprRopeNode, x - 2, y - 2, 0)
   141             if (roplen mod 4) = 0 then
       
   142                 DrawSprite(sprRopeNode, x - 2, y - 2, 0)
   137             end
   143             end
   138     end;
   144     end;
   139 DrawRopeLine:= roplen;
   145 DrawRopeLine:= roplen;
   140 end;
   146 end;
   141 
   147 
   159                     end;
   165                     end;
   160             roplen:= DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
   166             roplen:= DrawRopeLine(hwRound(RopePoints.ar[i].X) + WorldDx, hwRound(RopePoints.ar[i].Y) + WorldDy,
   161                         hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, roplen);
   167                         hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, roplen);
   162             roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   168             roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   163                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   169                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   164             end else
   170             end
       
   171         else
   165             if Gear^.Elasticity.QWordValue > 0 then
   172             if Gear^.Elasticity.QWordValue > 0 then
   166             roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   173             roplen:= DrawRopeLine(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy,
   167                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   174                         hwRound(Gear^.Hedgehog^.Gear^.X) + WorldDx, hwRound(Gear^.Hedgehog^.Gear^.Y) + WorldDy, roplen);
   168         end;
   175         end;
   169 
   176 
   170 
   177 
   171 if RopePoints.Count > 0 then
   178 if RopePoints.Count > 0 then
   172     DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle)
   179     DrawRotated(sprRopeHook, hwRound(RopePoints.ar[0].X) + WorldDx, hwRound(RopePoints.ar[0].Y) + WorldDy, 1, RopePoints.HookAngle)
   173     else
   180 else
   174     if Gear^.Elasticity.QWordValue > 0 then
   181     if Gear^.Elasticity.QWordValue > 0 then
   175         DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   182         DrawRotated(sprRopeHook, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   176 end;
   183 end;
   177 
   184 
   178 
   185 
   196     defaultPos, HatVisible: boolean;
   203     defaultPos, HatVisible: boolean;
   197     HH: PHedgehog;
   204     HH: PHedgehog;
   198     CurWeapon: PAmmo;
   205     CurWeapon: PAmmo;
   199 begin
   206 begin
   200     HH:= Gear^.Hedgehog;
   207     HH:= Gear^.Hedgehog;
   201     if HH^.Unplaced then exit;
   208     if HH^.Unplaced then
       
   209         exit;
   202     m:= 1;
   210     m:= 1;
   203     if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then m:= -1;
   211     if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
       
   212         m:= -1;
   204     sx:= ox + 1; // this offset is very common
   213     sx:= ox + 1; // this offset is very common
   205     sy:= oy - 3;
   214     sy:= oy - 3;
   206     sign:= hwSign(Gear^.dX);
   215     sign:= hwSign(Gear^.dX);
   207 
   216 
   208     if (Gear^.State and gstHHDeath) <> 0 then
   217     if (Gear^.State and gstHHDeath) <> 0 then
   261 
   270 
   262     if (Gear^.State and gstHHDriven) <> 0 then
   271     if (Gear^.State and gstHHDriven) <> 0 then
   263         begin
   272         begin
   264         if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and
   273         if ((Gear^.State and (gstHHThinking or gstAnimation)) = 0) and
   265 /// 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
   274 /// 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
   266            (((CurAmmoGear <> nil) and //((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and
   275             (((CurAmmoGear <> nil) and //((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) <> 0) and
   267              ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or
   276              ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_NoCrossHair) = 0)) or
   268 /// If no current ammo is active, and the selected ammo uses a crosshair
   277 /// If no current ammo is active, and the selected ammo uses a crosshair
   269              ((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then
   278             ((CurAmmoGear = nil) and ((Ammoz[HH^.CurAmmoType].Ammo.Propz and ammoprop_NoCrosshair) = 0) and ((Gear^.State and gstAttacked) = 0))) then
   270             begin
   279             begin
   271     (* These calculations are a little complex for a few reasons:
   280     (* These calculations are a little complex for a few reasons:
   272     1: I need to draw the laser from weapon origin to nearest land
   281     1: I need to draw the laser from weapon origin to nearest land
   273     2: I need to start the beam outside the hedgie for attractiveness.
   282     2: I need to start the beam outside the hedgie for attractiveness.
   274     3: I need to extend the beam beyond land.
   283     3: I need to extend the beam beyond land.
   358                     if Gear^.X < CurAmmoGear^.X then
   367                     if Gear^.X < CurAmmoGear^.X then
   359                         begin
   368                         begin
   360                         dAngle:= 0;
   369                         dAngle:= 0;
   361                         hAngle:= 180;
   370                         hAngle:= 180;
   362                         i:= 1
   371                         i:= 1
   363                         end else
   372                         end
       
   373                     else
   364                         begin
   374                         begin
   365                         dAngle:= 180;
   375                         dAngle:= 180;
   366                         hAngle:= 0;
   376                         hAngle:= 0;
   367                         i:= -1
   377                         i:= -1
   368                         end;
   378                         end;
   388                             end
   398                             end
   389                     end;
   399                     end;
   390                     DrawAltWeapon(Gear, ox, oy);
   400                     DrawAltWeapon(Gear, ox, oy);
   391                     defaultPos:= false
   401                     defaultPos:= false
   392                     end;
   402                     end;
   393                 gtBlowTorch: begin
   403                 gtBlowTorch:
       
   404                     begin
   394                     DrawRotated(sprBlowTorch, hx, hy, sign, aangle);
   405                     DrawRotated(sprBlowTorch, hx, hy, sign, aangle);
   395                     DrawHedgehog(sx, sy,
   406                     DrawHedgehog(sx, sy,
   396                             sign,
   407                             sign,
   397                             3,
   408                             3,
   398                             HH^.visStepPos div 2,
   409                             HH^.visStepPos div 2,
   423                                 end
   434                                 end
   424                             end;
   435                             end;
   425                     defaultPos:= false
   436                     defaultPos:= false
   426                     end;
   437                     end;
   427                 gtShover: DrawRotated(sprHandBaseball, hx, hy, sign, aangle + 180);
   438                 gtShover: DrawRotated(sprHandBaseball, hx, hy, sign, aangle + 180);
   428                 gtFirePunch: begin
   439                 gtFirePunch:
       
   440                     begin
   429                     DrawHedgehog(sx, sy,
   441                     DrawHedgehog(sx, sy,
   430                             sign,
   442                             sign,
   431                             1,
   443                             1,
   432                             4,
   444                             4,
   433                             0);
   445                             0);
   434                     defaultPos:= false
   446                     defaultPos:= false
   435                     end;
   447                     end;
   436                 gtPickHammer: begin
   448                 gtPickHammer:
       
   449                     begin
   437                     defaultPos:= false;
   450                     defaultPos:= false;
   438                     dec(sy,20);
   451                     dec(sy,20);
   439                     end;
   452                     end;
   440                 gtTeleport: defaultPos:= false;
   453                 gtTeleport: defaultPos:= false;
   441                 gtWhip: begin
   454                 gtWhip:
       
   455                     begin
   442                     DrawRotatedF(sprWhip,
   456                     DrawRotatedF(sprWhip,
   443                             sx,
   457                             sx,
   444                             sy,
   458                             sy,
   445                             1,
   459                             1,
   446                             sign,
   460                             sign,
   447                             0);
   461                             0);
   448                     defaultPos:= false
   462                     defaultPos:= false
   449                     end;
   463                     end;
   450                 gtHammer: begin
   464                 gtHammer:
       
   465                     begin
   451                     DrawRotatedF(sprHammer,
   466                     DrawRotatedF(sprHammer,
   452                             sx,
   467                             sx,
   453                             sy,
   468                             sy,
   454                             1,
   469                             1,
   455                             sign,
   470                             sign,
   456                             0);
   471                             0);
   457                     defaultPos:= false
   472                     defaultPos:= false
   458                     end;
   473                     end;
   459                 gtResurrector: begin
   474                 gtResurrector:
       
   475                     begin
   460                     DrawRotated(sprHandResurrector, sx, sy, 0, 0);
   476                     DrawRotated(sprHandResurrector, sx, sy, 0, 0);
   461                     defaultPos:= false
   477                     defaultPos:= false
   462                     end;
   478                     end;
   463                 gtKamikaze: begin
   479                 gtKamikaze:
       
   480                     begin
   464                     if CurAmmoGear^.Pos = 0 then
   481                     if CurAmmoGear^.Pos = 0 then
   465                         DrawHedgehog(sx, sy,
   482                         DrawHedgehog(sx, sy,
   466                                 sign,
   483                                 sign,
   467                                 1,
   484                                 1,
   468                                 6,
   485                                 6,
   473                                 CurAmmoGear^.Pos - 1,
   490                                 CurAmmoGear^.Pos - 1,
   474                                 sign,
   491                                 sign,
   475                                 aangle);
   492                                 aangle);
   476                     defaultPos:= false
   493                     defaultPos:= false
   477                     end;
   494                     end;
   478                 gtSeduction: begin
   495                 gtSeduction:
       
   496                     begin
   479                     if CurAmmoGear^.Pos >= 6 then
   497                     if CurAmmoGear^.Pos >= 6 then
   480                         DrawHedgehog(sx, sy,
   498                         DrawHedgehog(sx, sy,
   481                                 sign,
   499                                 sign,
   482                                 2,
   500                                 2,
   483                                 2,
   501                                 2,
   491                                 0);
   509                                 0);
   492                         DrawSprite(sprCensored, ox - 32, oy - 20, 0)
   510                         DrawSprite(sprCensored, ox - 32, oy - 20, 0)
   493                         end;
   511                         end;
   494                     defaultPos:= false
   512                     defaultPos:= false
   495                     end;
   513                     end;
   496                 gtFlamethrower: begin
   514                 gtFlamethrower:
       
   515                     begin
   497                     DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   516                     DrawRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   498                     if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
   517                     if CurAmmoGear^.Tex <> nil then
   499                     end;
   518                         DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
   500                 gtLandGun: begin DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
   519                     end;
   501                     if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
   520                 gtLandGun:
       
   521                     begin DrawRotated(sprHandBallgun, hx, hy, sign, aangle);
       
   522                     if CurAmmoGear^.Tex <> nil then
       
   523                         DrawCentered(sx, sy - 40, CurAmmoGear^.Tex)
   502                     end;
   524                     end;
   503             end;
   525             end;
   504 
   526 
   505             case CurAmmoGear^.Kind of
   527             case CurAmmoGear^.Kind of
   506                 gtShotgunShot,
   528                 gtShotgunShot,
   507                 gtDEagleShot,
   529                 gtDEagleShot,
   508                 gtSniperRifleShot,
   530                 gtSniperRifleShot,
   509                 gtShover: begin
   531                 gtShover:
   510                     DrawHedgehog(sx, sy,
   532                     begin
   511                             sign,
   533                     DrawHedgehog(sx, sy, sign, 0, 4, 0);
   512                             0,
       
   513                             4,
       
   514                             0);
       
   515                     defaultPos:= false;
   534                     defaultPos:= false;
   516                     HatVisible:= true
   535                     HatVisible:= true
   517                 end
   536                 end
   518             end
   537             end
   519         end else
   538         end else
   562         if ((Gear^.State and gstAttacked) = 0) then
   581         if ((Gear^.State and gstAttacked) = 0) then
   563             begin
   582             begin
   564             if HH^.Timer > 0 then
   583             if HH^.Timer > 0 then
   565                 begin
   584                 begin
   566                 // There must be a tidier way to do this. Anyone?
   585                 // There must be a tidier way to do this. Anyone?
   567                 if aangle <= 90 then aangle:= aangle+360;
   586                 if aangle <= 90 then
   568                 if Gear^.dX > _0 then aangle:= aangle-((aangle-240)*HH^.Timer/10)
   587                     aangle:= aangle+360;
   569                 else aangle:= aangle+((240-aangle)*HH^.Timer/10);
   588                 if Gear^.dX > _0 then
       
   589                     aangle:= aangle-((aangle-240)*HH^.Timer/10)
       
   590                 else
       
   591                     aangle:= aangle+((240-aangle)*HH^.Timer/10);
   570                 dec(HH^.Timer)
   592                 dec(HH^.Timer)
   571                 end;
   593                 end;
   572             amt:= CurrentHedgehog^.CurAmmoType;
   594             amt:= CurrentHedgehog^.CurAmmoType;
   573             CurWeapon:= GetAmmoEntry(HH^);
   595             CurWeapon:= GetAmmoEntry(HH^);
   574             case amt of
   596             case amt of
   580                 amDrill: DrawRotated(sprHandDrill, hx, hy, sign, aangle);
   602                 amDrill: DrawRotated(sprHandDrill, hx, hy, sign, aangle);
   581                 amRope: DrawRotated(sprHandRope, hx, hy, sign, aangle);
   603                 amRope: DrawRotated(sprHandRope, hx, hy, sign, aangle);
   582                 amShotgun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
   604                 amShotgun: DrawRotated(sprHandShotgun, hx, hy, sign, aangle);
   583                 amDEagle: DrawRotated(sprHandDEagle, hx, hy, sign, aangle);
   605                 amDEagle: DrawRotated(sprHandDEagle, hx, hy, sign, aangle);
   584                 amSineGun: DrawRotatedF(sprHandSinegun, hx, hy, 73 + (sign * LongInt(RealTicks div 73)) mod 8, sign, aangle);
   606                 amSineGun: DrawRotatedF(sprHandSinegun, hx, hy, 73 + (sign * LongInt(RealTicks div 73)) mod 8, sign, aangle);
   585                 amPortalGun: if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer?
   607                 
   586                                 DrawRotatedF(sprPortalGun, hx, hy, 0, sign, aangle)
   608                 amPortalGun:
   587                         else
   609                     if (CurWeapon^.Timer and 2) <> 0 then // Add a new Hedgehog value instead of abusing timer?
   588                                 DrawRotatedF(sprPortalGun, hx, hy, 1+CurWeapon^.Pos, sign, aangle);
   610                         DrawRotatedF(sprPortalGun, hx, hy, 0, sign, aangle)
       
   611                     else
       
   612                         DrawRotatedF(sprPortalGun, hx, hy, 1+CurWeapon^.Pos, sign, aangle);
       
   613                         
   589                 amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle);
   614                 amSniperRifle: DrawRotatedF(sprSniperRifle, hx, hy, 0, sign, aangle);
   590                 amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, sign, aangle);
   615                 amBlowTorch: DrawRotated(sprHandBlowTorch, hx, hy, sign, aangle);
   591                 amCake: DrawRotated(sprHandCake, hx, hy, sign, aangle);
   616                 amCake: DrawRotated(sprHandCake, hx, hy, sign, aangle);
   592                 amGrenade: DrawRotated(sprHandGrenade, hx, hy, sign, aangle);
   617                 amGrenade: DrawRotated(sprHandGrenade, hx, hy, sign, aangle);
   593                 amWatermelon: DrawRotated(sprHandMelon, hx, hy, sign, aangle);
   618                 amWatermelon: DrawRotated(sprHandMelon, hx, hy, sign, aangle);
   793             case CurAmmoGear^.Kind of
   818             case CurAmmoGear^.Kind of
   794                 gtJetpack: begin
   819                 gtJetpack: begin
   795                         DrawSprite(sprJetpack, sx-32, sy-32, 0);
   820                         DrawSprite(sprJetpack, sx-32, sy-32, 0);
   796                         if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then
   821                         if cWaterLine > hwRound(Gear^.Y) + Gear^.Radius then
   797                             begin
   822                             begin
   798                             if (CurAmmoGear^.MsgParam and gmUp) <> 0 then DrawSprite(sprJetpack, sx-32, sy-28, 1);
   823                             if (CurAmmoGear^.MsgParam and gmUp) <> 0 then
   799                             if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then DrawSprite(sprJetpack, sx-28, sy-28, 2);
   824                                 DrawSprite(sprJetpack, sx-32, sy-28, 1);
   800                             if (CurAmmoGear^.MsgParam and gmRight) <> 0 then DrawSprite(sprJetpack, sx-36, sy-28, 3)
   825                             if (CurAmmoGear^.MsgParam and gmLeft) <> 0 then
       
   826                                 DrawSprite(sprJetpack, sx-28, sy-28, 2);
       
   827                             if (CurAmmoGear^.MsgParam and gmRight) <> 0 then
       
   828                                 DrawSprite(sprJetpack, sx-36, sy-28, 3)
   801                             end;
   829                             end;
   802                         if CurAmmoGear^.Tex <> nil then DrawCentered(sx, sy - 40, CurAmmoGear^.Tex);
   830                         if CurAmmoGear^.Tex <> nil then
       
   831                             DrawCentered(sx, sy - 40, CurAmmoGear^.Tex);
   803                         DrawAltWeapon(Gear, sx, sy)
   832                         DrawAltWeapon(Gear, sx, sy)
   804                         end;
   833                         end;
   805                 end;
   834                 end;
   806             end
   835             end
   807         end;
   836         end;
   940                         end
   969                         end
   941                     end;
   970                     end;
   942              gtBee: DrawRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   971              gtBee: DrawRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   943       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
   972       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
   944             gtRope: DrawRope(Gear);
   973             gtRope: DrawRope(Gear);
       
   974             
   945             gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
   975             gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
   946                            DrawRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
   976                            DrawRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
   947                        else if Gear^.Health <> 0 then DrawRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
   977                        else if Gear^.Health <> 0 then
       
   978                            DrawRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
   948                        else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
   979                        else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
       
   980                        
   949            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
   981            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
   950                            DrawRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
   982                            DrawRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
   951                        else if Gear^.Health <> 0 then DrawRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
   983                        else if Gear^.Health <> 0 then
       
   984                            DrawRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
   952                        else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
   985                        else DrawRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
       
   986                        
   953             gtCase: if ((Gear^.Pos and posCaseAmmo) <> 0) then
   987             gtCase: if ((Gear^.Pos and posCaseAmmo) <> 0) then
   954                         begin
   988                         begin
   955                         i:= (GameTicks shr 6) mod 64;
   989                         i:= (GameTicks shr 6) mod 64;
   956                         if i > 18 then i:= 0;
   990                         if i > 18 then
       
   991                             i:= 0;
   957                         DrawSprite(sprCase, x - 24, y - 24, i);
   992                         DrawSprite(sprCase, x - 24, y - 24, i);
   958                         end
   993                         end
   959                     else if ((Gear^.Pos and posCaseHealth) <> 0) then
   994                     else if ((Gear^.Pos and posCaseHealth) <> 0) then
   960                         begin
   995                         begin
   961                         i:= ((GameTicks shr 6) + 38) mod 64;
   996                         i:= ((GameTicks shr 6) + 38) mod 64;
   962                         if i > 13 then i:= 0;
   997                         if i > 13 then
       
   998                             i:= 0;
   963                         DrawSprite(sprFAid, x - 24, y - 24, i);
   999                         DrawSprite(sprFAid, x - 24, y - 24, i);
   964                         end
  1000                         end
   965                     else if ((Gear^.Pos and posCaseUtility) <> 0) then
  1001                     else if ((Gear^.Pos and posCaseUtility) <> 0) then
   966                         begin
  1002                         begin
   967                         i:= (GameTicks shr 6) mod 70;
  1003                         i:= (GameTicks shr 6) mod 70;
   968                         if i > 23 then i:= 0;
  1004                         if i > 23 then
       
  1005                             i:= 0;
   969                         i:= i mod 12;
  1006                         i:= i mod 12;
   970                         DrawSprite(sprUtility, x - 24, y - 24, i);
  1007                         DrawSprite(sprUtility, x - 24, y - 24, i);
   971                         end;
  1008                         end;
   972       gtExplosives: begin
  1009       gtExplosives: begin
   973                     if ((Gear^.State and gstDrowning) <> 0) then
  1010                     if ((Gear^.State and gstDrowning) <> 0) then
   974                         DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
  1011                         DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
   975                     else if Gear^.State and gstAnimation = 0 then
  1012                     else if Gear^.State and gstAnimation = 0 then
   976                         begin
  1013                         begin
   977                         i:= (GameTicks shr 6 + Gear^.uid*3) mod 64;
  1014                         i:= (GameTicks shr 6 + Gear^.uid*3) mod 64;
   978                         if i > 18 then i:= 0;
  1015                         if i > 18 then
       
  1016                             i:= 0;
   979                         DrawSprite(sprExplosives, x - 24, y - 24, i)
  1017                         DrawSprite(sprExplosives, x - 24, y - 24, i)
   980                         end
  1018                         end
   981                     else if Gear^.State and gsttmpFlag = 0 then
  1019                     else if Gear^.State and gsttmpFlag = 0 then
   982                         DrawRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
  1020                         DrawRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
   983                     else
  1021                     else
  1000                     DrawRotatedF(sprAirplane, x, y, 1, Gear^.Tag, 0);
  1038                     DrawRotatedF(sprAirplane, x, y, 1, Gear^.Tag, 0);
  1001                     end;
  1039                     end;
  1002          gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1040          gtAirBomb: DrawRotated(sprAirBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1003         gtTeleport: begin
  1041         gtTeleport: begin
  1004                     HHGear:= Gear^.Hedgehog^.Gear;
  1042                     HHGear:= Gear^.Hedgehog^.Gear;
  1005                     if not Gear^.Hedgehog^.Unplaced then DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
  1043                     if not Gear^.Hedgehog^.Unplaced then
       
  1044                         DrawRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
  1006                     DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0);
  1045                     DrawRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0);
  1007                     end;
  1046                     end;
  1008         gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
  1047         gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
  1009           gtTarget: begin
  1048           gtTarget: begin
  1010                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
  1049                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
  1014           gtMortar: DrawRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1053           gtMortar: DrawRotated(sprMortar, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1015           gtCake: if Gear^.Pos = 6 then
  1054           gtCake: if Gear^.Pos = 6 then
  1016                      DrawRotatedf(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90)
  1055                      DrawRotatedf(sprCakeWalk, x, y, (GameTicks div 40) mod 6, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90)
  1017                   else
  1056                   else
  1018                      DrawRotatedf(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90);
  1057                      DrawRotatedf(sprCakeDown, x, y, 5 - Gear^.Pos, hwSign(Gear^.dX), Gear^.DirAngle * hwSign(Gear^.dX) + 90);
  1019        gtSeduction: if Gear^.Pos >= 14 then DrawSprite(sprSeduction, x - 16, y - 16, 0);
  1058        gtSeduction: if Gear^.Pos >= 14 then
       
  1059            DrawSprite(sprSeduction, x - 16, y - 16, 0);
       
  1060            
  1020       gtWatermelon: DrawRotatedf(sprWatermelon, x, y, 0, 0, Gear^.DirAngle);
  1061       gtWatermelon: DrawRotatedf(sprWatermelon, x, y, 0, 0, Gear^.DirAngle);
  1021       gtMelonPiece: DrawRotatedf(sprWatermelon, x, y, 1, 0, Gear^.DirAngle);
  1062       gtMelonPiece: DrawRotatedf(sprWatermelon, x, y, 1, 0, Gear^.DirAngle);
  1022      gtHellishBomb: DrawRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle);
  1063      gtHellishBomb: DrawRotated(sprHellishBomb, x, y, 0, Gear^.DirAngle);
  1023            gtBirdy: begin
  1064            gtBirdy: begin
  1024                     if Gear^.State and gstAnimation = gstAnimation then
  1065                     if Gear^.State and gstAnimation = gstAnimation then
  1094                         //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
  1135                         //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
  1095                         Tint($FF, $FF, $FF, $FF);
  1136                         Tint($FF, $FF, $FF, $FF);
  1096                         end
  1137                         end
  1097                     else //if not isInLag then
  1138                     else //if not isInLag then
  1098                         begin
  1139                         begin
  1099                         if isInLag and (Gear^.FlightTime < 256) then inc(Gear^.FlightTime, 8)
  1140                         if isInLag and (Gear^.FlightTime < 256) then
  1100                         else if not isInLag and (Gear^.FlightTime > 0) then dec(Gear^.FlightTime, 8);
  1141                             inc(Gear^.FlightTime, 8)
  1101                         if Gear^.FlightTime > 0 then Tint($FF, $FF, $FF, $FF-min(255,Gear^.FlightTime));
  1142                         else if not isInLag and (Gear^.FlightTime > 0) then
       
  1143                             dec(Gear^.FlightTime, 8);
       
  1144                         if Gear^.FlightTime > 0 then
       
  1145                             Tint($FF, $FF, $FF, $FF-min(255,Gear^.FlightTime));
  1102                         if vobVelocity = 0 then
  1146                         if vobVelocity = 0 then
  1103                             DrawSprite(sprFlake, x, y, Gear^.Timer)
  1147                             DrawSprite(sprFlake, x, y, Gear^.Timer)
  1104                         else
  1148                         else
  1105                             DrawRotatedF(sprFlake, x, y, Gear^.Timer, 1, Gear^.DirAngle);
  1149                             DrawRotatedF(sprFlake, x, y, Gear^.Timer, 1, Gear^.DirAngle);
  1106 //DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer)
  1150 //DrawSprite(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer)
  1107 //DrawRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle);
  1151 //DrawRotatedF(sprFlake, x-SpritesData[sprFlake].Width div 2, y-SpritesData[sprFlake].Height div 2, Gear^.Timer, 1, Gear^.DirAngle);
  1108                         if Gear^.FlightTime > 0 then Tint($FF, $FF, $FF, $FF);
  1152                         if Gear^.FlightTime > 0 then
       
  1153                             Tint($FF, $FF, $FF, $FF);
  1109                         end;
  1154                         end;
  1110        gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0);
  1155        gtStructure: DrawSprite(sprTarget, x - 16, y - 16, 0);
  1111           gtTardis: if Gear^.Pos <> 4 then
  1156           gtTardis: if Gear^.Pos <> 4 then
  1112                         begin
  1157                         begin
  1113                         if Gear^.Pos = 2 then Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF)
  1158                         if Gear^.Pos = 2 then
  1114                         else Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1159                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF)
       
  1160                         else 
       
  1161                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1115                         DrawSprite(sprTardis, x-24, y-63,0);
  1162                         DrawSprite(sprTardis, x-24, y-63,0);
  1116                         if Gear^.Pos = 2 then Tint($FF, $FF, $FF, $FF)
  1163                         if Gear^.Pos = 2 then
  1117 			else Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1164                             Tint($FF, $FF, $FF, $FF)
       
  1165                         else
       
  1166                             Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1118                         DrawSprite(sprTardis, x-24, y-63,1);
  1167                         DrawSprite(sprTardis, x-24, y-63,1);
  1119                         if Gear^.Pos <> 2 then Tint($FF, $FF, $FF, $FF)
  1168                         if Gear^.Pos <> 2 then
       
  1169                             Tint($FF, $FF, $FF, $FF)
  1120 (*
  1170 (*
  1121                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1171                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1122                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);
  1172                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);
  1123                         Tint($FF, $FF, $FF, $FF)
  1173                         Tint($FF, $FF, $FF, $FF)
  1124 *)
  1174 *)
  1125                         end;
  1175                         end;
  1126 
  1176 
  1127 
  1177 
  1128          end;
  1178          end;
  1129       if Gear^.RenderTimer and (Gear^.Tex <> nil) then DrawCentered(x + 8, y + 8, Gear^.Tex);
  1179       if Gear^.RenderTimer and (Gear^.Tex <> nil) then
       
  1180           DrawCentered(x + 8, y + 8, Gear^.Tex);
  1130 end;
  1181 end;
  1131 
  1182 
  1132 end.
  1183 end.