hedgewars/uGearsRender.pas
changeset 6318 ca12368acc16
parent 6308 ef2804785a4e
child 6322 b310f0bc8dde
equal deleted inserted replaced
6317:83b93a2d2741 6318:ca12368acc16
   178 with Gear^.Hedgehog^ do
   178 with Gear^.Hedgehog^ do
   179     begin
   179     begin
   180     if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
   180     if not (((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) and ((Gear^.State and gstAttacked) = 0)) then
   181         exit;
   181         exit;
   182     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   182     DrawTexture(sx + 16, sy + 16, ropeIconTex);
   183     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 1, 32, 32);
   183     DrawTextureF(SpritesData[sprAMAmmos].Texture, 0.75, sx + 30, sy + 30, ord(CurAmmoType) - 1, 2, 32, 32);
   184     end;
   184     end;
   185 end;
   185 end;
   186 
   186 
   187 
   187 
   188 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   188 procedure DrawHH(Gear: PGear; ox, oy: LongInt);
   221 
   221 
   222 
   222 
   223     if HH^.Effects[hePoisoned] then
   223     if HH^.Effects[hePoisoned] then
   224         begin
   224         begin
   225         Tint($00, $FF, $40, $40);
   225         Tint($00, $FF, $40, $40);
   226         DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 1, 22, 22, (RealTicks shr 36) mod 360);
   226         DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 2, 0, 0, sx, sy, 0, 2, 22, 22, (RealTicks shr 36) mod 360);
   227         Tint($FF, $FF, $FF, $FF)
   227         Tint($FF, $FF, $FF, $FF)
   228         end;
   228         end;
   229 
   229 
   230     if ((Gear^.State and gstWinner) <> 0) and
   230     if ((Gear^.State and gstWinner) <> 0) and
   231     ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then
   231     ((CurAmmoGear = nil) or (CurAmmoGear^.Kind <> gtPickHammer)) then
   369                             0,
   369                             0,
   370                             DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
   370                             DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + dAngle);
   371                     with HH^ do
   371                     with HH^ do
   372                         if (HatTex <> nil) then
   372                         if (HatTex <> nil) then
   373                             begin
   373                             begin
   374                             DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i, 32, 32,
   374                             DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 0, i*2, 32, 32,
   375                                 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   375                                 i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   376                             if HatTex^.w > 64 then
   376                             if HatTex^.w > 64 then
   377                                 begin
   377                                 begin
   378                                 Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   378                                 Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   379                                 DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i, 32, 32,
   379                                 DrawRotatedTextureF(HatTex, 1.0, -1.0, -6.0, ox, oy, 32, i*2, 32, 32,
   380                                     i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   380                                     i*DxDy2Angle(CurAmmoGear^.dY, CurAmmoGear^.dX) + hAngle);
   381                                 Tint($FF, $FF, $FF, $FF)
   381                                 Tint($FF, $FF, $FF, $FF)
   382                                 end
   382                                 end
   383                             end
   383                             end
   384                     end;
   384                     end;
   398                             DrawTextureF(HatTex,
   398                             DrawTextureF(HatTex,
   399                                 1,
   399                                 1,
   400                                 sx,
   400                                 sx,
   401                                 sy - 5,
   401                                 sy - 5,
   402                                 0,
   402                                 0,
   403                                 sign,
   403                                 sign*2,
   404                                 32,
   404                                 32,
   405                                 32);
   405                                 32);
   406                             if HatTex^.w > 64 then
   406                             if HatTex^.w > 64 then
   407                                 begin
   407                                 begin
   408                                 Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   408                                 Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   409                                 DrawTextureF(HatTex,
   409                                 DrawTextureF(HatTex,
   410                                     1,
   410                                     1,
   411                                     sx,
   411                                     sx,
   412                                     sy - 5,
   412                                     sy - 5,
   413                                     32,
   413                                     32,
   414                                     sign,
   414                                     sign*2,
   415                                     32,
   415                                     32,
   416                                     32);
   416                                     32);
   417                                 Tint($FF, $FF, $FF, $FF)
   417                                 Tint($FF, $FF, $FF, $FF)
   418                                 end
   418                                 end
   419                             end;
   419                             end;
   662                         DrawTextureF(HatTex,
   662                         DrawTextureF(HatTex,
   663                             HatVisibility,
   663                             HatVisibility,
   664                             sx,
   664                             sx,
   665                             sy - 5,
   665                             sy - 5,
   666                             0,
   666                             0,
   667                             sign,
   667                             sign*2,
   668                             32,
   668                             32,
   669                             32); *)
   669                             32); *)
   670             end;
   670             end;
   671 
   671 
   672             case amt of
   672             case amt of
   730                 DrawTextureF(HatTex,
   730                 DrawTextureF(HatTex,
   731                     HatVisibility,
   731                     HatVisibility,
   732                     sx,
   732                     sx,
   733                     sy - 5,
   733                     sy - 5,
   734                     (RealTicks div 128 + Gear^.Pos) mod 19,
   734                     (RealTicks div 128 + Gear^.Pos) mod 19,
   735                     sign,
   735                     sign*2,
   736                     32,
   736                     32,
   737                     32);
   737                     32);
   738                 if HatTex^.w > 64 then
   738                 if HatTex^.w > 64 then
   739                     begin
   739                     begin
   740                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   740                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   741                     DrawTextureF(HatTex,
   741                     DrawTextureF(HatTex,
   742                         HatVisibility,
   742                         HatVisibility,
   743                         sx,
   743                         sx,
   744                         sy - 5,
   744                         sy - 5,
   745                         (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
   745                         (RealTicks div 128 + Gear^.Pos) mod 19 + 32,
   746                         sign,
   746                         sign*2,
   747                         32,
   747                         32,
   748                         32);
   748                         32);
   749                     Tint($FF, $FF, $FF, $FF)
   749                     Tint($FF, $FF, $FF, $FF)
   750                     end
   750                     end
   751                 end
   751                 end
   754                 DrawTextureF(HatTex,
   754                 DrawTextureF(HatTex,
   755                     HatVisibility,
   755                     HatVisibility,
   756                     sx,
   756                     sx,
   757                     sy - 5,
   757                     sy - 5,
   758                     0,
   758                     0,
   759                     sign*m,
   759                     sign*m*2,
   760                     32,
   760                     32,
   761                     32);
   761                     32);
   762                 if HatTex^.w > 64 then
   762                 if HatTex^.w > 64 then
   763                     begin
   763                     begin
   764                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   764                     Tint(HH^.Team^.Clan^.Color shl 8 or $FF);
   765                     DrawTextureF(HatTex,
   765                     DrawTextureF(HatTex,
   766                         HatVisibility,
   766                         HatVisibility,
   767                         sx,
   767                         sx,
   768                         sy - 5,
   768                         sy - 5,
   769                         32,
   769                         32,
   770                         sign*m,
   770                         sign*m*2,
   771                         32,
   771                         32,
   772                         32);
   772                         32);
   773                     Tint($FF, $FF, $FF, $FF)
   773                     Tint($FF, $FF, $FF, $FF)
   774                     end
   774                     end
   775                 end
   775                 end
   844         end;
   844         end;
   845 
   845 
   846     if HH^.Effects[hePoisoned] then
   846     if HH^.Effects[hePoisoned] then
   847         begin
   847         begin
   848         Tint($00, $FF, $40, $80);
   848         Tint($00, $FF, $40, $80);
   849         DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 1, 22, 22, 360 - (RealTicks shr 37) mod 360);
   849         DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 1.5, 0, 0, sx, sy, 0, 2, 22, 22, 360 - (RealTicks shr 37) mod 360);
   850         end;
   850         end;
   851     if HH^.Effects[heResurrected] then
   851     if HH^.Effects[heResurrected] then
   852         begin
   852         begin
   853         Tint($f5, $db, $35, $20);
   853         Tint($f5, $db, $35, $20);
   854         DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
   854         DrawSprite(sprVampiric, sx - 24, sy - 24, 0);
   922         gtHedgehog: DrawHH(Gear, x, y);
   922         gtHedgehog: DrawHH(Gear, x, y);
   923 
   923 
   924            gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   924            gtShell: DrawRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
   925 
   925 
   926            gtGrave: begin
   926            gtGrave: begin
   927                     DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 1, 32, 32);
   927                     DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 7, 2, 32, 32);
   928                     if Gear^.Health > 0 then
   928                     if Gear^.Health > 0 then
   929                         begin
   929                         begin
   930                         //Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750))));
   930                         //Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750))));
   931                         Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health)))));
   931                         Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health)))));
   932                         //Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
   932                         //Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
   979                         DrawRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle);
   979                         DrawRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle);
   980                     end;
   980                     end;
   981         gtDynamite: DrawSprite2(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
   981         gtDynamite: DrawSprite2(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
   982      gtClusterBomb: DrawRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
   982      gtClusterBomb: DrawRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
   983          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
   983          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
   984            gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16);
   984            gtFlame: DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 2, 16, 16);
   985        gtParachute: begin
   985        gtParachute: begin
   986                     DrawSprite(sprParachute, x - 24, y - 48, 0);
   986                     DrawSprite(sprParachute, x - 24, y - 48, 0);
   987                     DrawAltWeapon(Gear, x + 1, y - 3)
   987                     DrawAltWeapon(Gear, x + 1, y - 3)
   988                     end;
   988                     end;
   989        gtAirAttack: begin
   989        gtAirAttack: begin
  1023                             if Gear^.Tag < 0 then
  1023                             if Gear^.Tag < 0 then
  1024                                 startX:= max(LAND_WIDTH + 1024, endX + 2048)
  1024                                 startX:= max(LAND_WIDTH + 1024, endX + 2048)
  1025                             else
  1025                             else
  1026                                 startX:= max(-LAND_WIDTH - 1024, endX - 2048);
  1026                                 startX:= max(-LAND_WIDTH - 1024, endX - 2048);
  1027                             startY:= endY - 256;
  1027                             startY:= endY - 256;
  1028                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1))), startY + WorldDy + LongInt(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);
  1028                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * (-power(2, -10 * LongInt(Gear^.Timer)/2000) + 1))), startY + WorldDy + LongInt(round((endY - startY) * sqrt(1 - power((LongInt(Gear^.Timer)/2000)-1, 2)))), ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag*2, 75, 75);
  1029                             end
  1029                             end
  1030                         else // Disappearing
  1030                         else // Disappearing
  1031                             begin
  1031                             begin
  1032                             startX:= x - WorldDx;
  1032                             startX:= x - WorldDx;
  1033                             startY:= y - WorldDy;
  1033                             startY:= y - WorldDy;
  1034                             if Gear^.Tag > 0 then
  1034                             if Gear^.Tag > 0 then
  1035                                 endX:= max(LAND_WIDTH + 1024, startX + 2048)
  1035                                 endX:= max(LAND_WIDTH + 1024, startX + 2048)
  1036                             else
  1036                             else
  1037                                 endX:= max(-LAND_WIDTH - 1024, startX - 2048);
  1037                                 endX:= max(-LAND_WIDTH - 1024, startX - 2048);
  1038                             endY:= startY + 256;
  1038                             endY:= startY + 256;
  1039                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1)))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + LongInt(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);
  1039                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, startX + WorldDx + LongInt(round((endX - startX) * power(2, 10 * (LongInt(Gear^.Timer)/2000 - 1)))) + hwRound(Gear^.dX * Gear^.Timer), startY + WorldDy + LongInt(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*2, 75, 75);
  1040                             end;
  1040                             end;
  1041                         end
  1041                         end
  1042                     else
  1042                     else
  1043                         begin
  1043                         begin
  1044                         if Gear^.Health < 250 then
  1044                         if Gear^.Health < 250 then
  1045                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 7)) mod 2, Gear^.Tag, 75, 75)
  1045                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 7)) mod 2, Gear^.Tag*2, 75, 75)
  1046                         else
  1046                         else
  1047                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag, 75, 75);
  1047                             DrawTextureF(SpritesData[sprBirdy].Texture, 1, x, y, ((Gear^.Pos shr 6) or (RealTicks shr 8)) mod 2, Gear^.Tag*2, 75, 75);
  1048                         end;
  1048                         end;
  1049                     end;
  1049                     end;
  1050              gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, x, y, 0, 1, 16, 16, Gear^.DirAngle);
  1050              gtEgg: DrawRotatedTextureF(SpritesData[sprEgg].Texture, 1, 0, 0, x, y, 0, 2, 16, 16, Gear^.DirAngle);
  1051            gtPiano: begin
  1051            gtPiano: begin
  1052                     if (Gear^.State and gstDrowning) = 0 then
  1052                     if (Gear^.State and gstDrowning) = 0 then
  1053                         begin
  1053                         begin
  1054                         Tint($FF, $FF, $FF, $10);
  1054                         Tint($FF, $FF, $FF, $10);
  1055                         for i:= 8 downto 1 do
  1055                         for i:= 8 downto 1 do
  1056                             DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y - hwRound(Gear^.dY * 4 * i), 0, 1, 128, 128, 0);
  1056                             DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y - hwRound(Gear^.dY * 4 * i), 0, 2, 128, 128);
  1057                         Tint($FF, $FF, $FF, $FF)
  1057                         Tint($FF, $FF, $FF, $FF)
  1058                         end;
  1058                         end;
  1059                     DrawRotatedTextureF(SpritesData[sprPiano].Texture, 1, 0, 0, x, y, 0, 1, 128, 128, 0);
  1059                     DrawTextureF(SpritesData[sprPiano].Texture, 1, x, y, 0, 2, 128, 128);
  1060                     end;
  1060                     end;
  1061      gtPoisonCloud: begin
  1061      gtPoisonCloud: begin
  1062                     if Gear^.Timer < 1020 then
  1062                     if Gear^.Timer < 1020 then
  1063                         Tint($C0, $C0, $00, Gear^.Timer div 8)
  1063                         Tint($C0, $C0, $00, Gear^.Timer div 8)
  1064                     else if Gear^.Timer > 3980 then
  1064                     else if Gear^.Timer > 3980 then
  1065                         Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8)
  1065                         Tint($C0, $C0, $00, (5000 - Gear^.Timer) div 8)
  1066                     else
  1066                     else
  1067                         Tint($C0, $C0, $00, $C0);
  1067                         Tint($C0, $C0, $00, $C0);
  1068                     DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 1, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360);
  1068                     DrawRotatedTextureF(SpritesData[sprSmokeWhite].texture, 3, 0, 0, x, y, 0, 2, 22, 22, (RealTicks shr 36 + Gear^.UID * 100) mod 360);
  1069                     Tint($FF, $FF, $FF, $FF)
  1069                     Tint($FF, $FF, $FF, $FF)
  1070                     end;
  1070                     end;
  1071      gtResurrector: begin
  1071      gtResurrector: begin
  1072                     DrawRotated(sprCross, x, y, 0, 0);
  1072                     DrawRotated(sprCross, x, y, 0, 0);
  1073                     Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
  1073                     Tint($f5, $db, $35, max($00, round($C0 * abs(1 - (GameTicks mod 6000) / 3000))));
  1080                         Tint((cExplosionBorderColor shr RShift) and $FF, 
  1080                         Tint((cExplosionBorderColor shr RShift) and $FF, 
  1081                              (cExplosionBorderColor shr GShift) and $FF, 
  1081                              (cExplosionBorderColor shr GShift) and $FF, 
  1082                              (cExplosionBorderColor shr BShift) and $FF, 
  1082                              (cExplosionBorderColor shr BShift) and $FF, 
  1083                              $FF);
  1083                              $FF);
  1084                         // Needs a nicer white texture to tint
  1084                         // Needs a nicer white texture to tint
  1085                         DrawRotatedTextureF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle);
  1085                         DrawRotatedTextureF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 2, 8, 8, Gear^.DirAngle);
  1086                         //DrawRotated(sprSnowDust, x, y, 0, Gear^.DirAngle);
  1086                         //DrawRotated(sprSnowDust, x, y, 0, Gear^.DirAngle);
  1087                         //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
  1087                         //DrawTexture(x, y, SpritesData[sprVampiric].Texture, 0.1);
  1088                         Tint($FF, $FF, $FF, $FF);
  1088                         Tint($FF, $FF, $FF, $FF);
  1089                         end
  1089                         end
  1090                     else //if not isInLag then
  1090                     else //if not isInLag then