hedgewars/uGearsRender.pas
changeset 12849 40c410cd6402
parent 12764 272fcd3833d2
child 12898 8a40ce061d94
equal deleted inserted replaced
12848:076d00110223 12849:40c410cd6402
  1241         gtHedgehog: DrawHH(Gear, x, y);
  1241         gtHedgehog: DrawHH(Gear, x, y);
  1242 
  1242 
  1243            gtShell: DrawSpriteRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1243            gtShell: DrawSpriteRotated(sprBazookaShell, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1244 
  1244 
  1245            gtGrave: begin
  1245            gtGrave: begin
  1246                     DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (GameTicks shr 7+Gear^.uid) and 15, 1, 32, 32);
  1246                     DrawTextureF(Gear^.Hedgehog^.Team^.GraveTex, 1, x, y, (RealTicks shr 7+Gear^.uid) and 15, 1, 32, 32);
  1247                     if Gear^.Health > 0 then
  1247                     if Gear^.Health > 0 then
  1248                         begin
  1248                         begin
  1249                         //Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750))));
  1249                         //Tint($33, $33, $FF, max($40, round($FF * abs(1 - (GameTicks mod (6000 div Gear^.Health)) / 750))));
  1250                         Tint($f5, $db, $35, max($40, round($FF * abs(1 - (GameTicks mod 1500) / (750 + Gear^.Health)))));
  1250                         Tint($f5, $db, $35, max($40, round($FF * abs(1 - (RealTicks mod 1500) / (750 + Gear^.Health)))));
  1251                         //Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
  1251                         //Tint($FF, $FF, $FF, max($40, round($FF * abs(1 - (RealTicks mod 1500) / 750))));
  1252                         DrawSprite(sprVampiric, x - 24, y - 24, 0);
  1252                         DrawSprite(sprVampiric, x - 24, y - 24, 0);
  1253                         untint
  1253                         untint
  1254                         end
  1254                         end
  1255                     end;
  1255                     end;
  1256              gtBee: DrawSpriteRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1256              gtBee: DrawSpriteRotatedF(sprBee, x, y, (RealTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1257       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
  1257       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
  1258             gtRope: DrawRope(Gear);
  1258             gtRope: DrawRope(Gear);
  1259 
  1259 
  1260             gtMine: begin
  1260             gtMine: begin
  1261                     if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1261                     if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1291                             begin
  1291                             begin
  1292                             if Gear^.State and gstFrozen <> 0 then
  1292                             if Gear^.State and gstFrozen <> 0 then
  1293                                 DrawSprite(sprCase, x - 24, y - 28, 0)
  1293                                 DrawSprite(sprCase, x - 24, y - 28, 0)
  1294                             else
  1294                             else
  1295                                 begin
  1295                                 begin
  1296                                 i:= (GameTicks shr 6) mod 64;
  1296                                 i:= (RealTicks shr 6) mod 64;
  1297                                 if i > 18 then i:= 0;
  1297                                 if i > 18 then i:= 0;
  1298                                 DrawSprite(sprCase, x - 24, y - 24, i)
  1298                                 DrawSprite(sprCase, x - 24, y - 24, i)
  1299                                 end
  1299                                 end
  1300                             end
  1300                             end
  1301                         else if ((Gear^.Pos and posCaseHealth) <> 0) then
  1301                         else if ((Gear^.Pos and posCaseHealth) <> 0) then
  1302                             begin
  1302                             begin
  1303                             if Gear^.State and gstFrozen <> 0 then
  1303                             if Gear^.State and gstFrozen <> 0 then
  1304                                 DrawSprite(sprFAid, x - 24, y - 28, 0)
  1304                                 DrawSprite(sprFAid, x - 24, y - 28, 0)
  1305                             else
  1305                             else
  1306                                 begin
  1306                                 begin
  1307                                 i:= ((GameTicks shr 6) + 38) mod 64;
  1307                                 i:= ((RealTicks shr 6) + 38) mod 64;
  1308                                 if i > 13 then i:= 0;
  1308                                 if i > 13 then i:= 0;
  1309                                 DrawSprite(sprFAid, x - 24, y - 24, i)
  1309                                 DrawSprite(sprFAid, x - 24, y - 24, i)
  1310                                 end
  1310                                 end
  1311                             end
  1311                             end
  1312                         else if ((Gear^.Pos and posCaseUtility) <> 0) then
  1312                         else if ((Gear^.Pos and posCaseUtility) <> 0) then
  1313                             begin
  1313                             begin
  1314                             if Gear^.State and gstFrozen <> 0 then
  1314                             if Gear^.State and gstFrozen <> 0 then
  1315                                 DrawSprite(sprUtility, x - 24, y - 28, 0)
  1315                                 DrawSprite(sprUtility, x - 24, y - 28, 0)
  1316                             else
  1316                             else
  1317                                 begin
  1317                                 begin
  1318                                 i:= (GameTicks shr 6) mod 70;
  1318                                 i:= (RealTicks shr 6) mod 70;
  1319                                 if i > 23 then i:= 0;
  1319                                 if i > 23 then i:= 0;
  1320                                 i:= i mod 12;
  1320                                 i:= i mod 12;
  1321                                 DrawSprite(sprUtility, x - 24, y - 24, i)
  1321                                 DrawSprite(sprUtility, x - 24, y - 24, i)
  1322                                 end
  1322                                 end
  1323                             end
  1323                             end
  1331       gtExplosives: begin
  1331       gtExplosives: begin
  1332                     if ((Gear^.State and gstDrowning) <> 0) then
  1332                     if ((Gear^.State and gstDrowning) <> 0) then
  1333                         DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
  1333                         DrawSprite(sprExplosivesRoll, x - 24, y - 24, 0)
  1334                     else if Gear^.State and gstAnimation = 0 then
  1334                     else if Gear^.State and gstAnimation = 0 then
  1335                         begin
  1335                         begin
  1336                         i:= (GameTicks shr 6 + Gear^.uid*3) mod 64;
  1336                         i:= (RealTicks shr 6 + Gear^.uid*3) mod 64;
  1337                         if i > 18 then
  1337                         if i > 18 then
  1338                             i:= 0;
  1338                             i:= 0;
  1339                         DrawSprite(sprExplosives, x - 24, y - 24, i)
  1339                         DrawSprite(sprExplosives, x - 24, y - 24, i)
  1340                         end
  1340                         end
  1341                     else if Gear^.State and gsttmpFlag = 0 then
  1341                     else if Gear^.State and gsttmpFlag = 0 then
  1367 
  1367 
  1368                     end;
  1368                     end;
  1369      gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
  1369      gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
  1370          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
  1370          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
  1371            gtFlame: if Gear^.Tag and 1 = 0 then
  1371            gtFlame: if Gear^.Tag and 1 = 0 then
  1372                          DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
  1372                          DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
  1373                     else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);
  1373                     else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (RealTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);
  1374        gtParachute: begin
  1374        gtParachute: begin
  1375                     DrawSprite(sprParachute, x - 24, y - 48, 0);
  1375                     DrawSprite(sprParachute, x - 24, y - 48, 0);
  1376                     DrawAltWeapon(Gear, x + 1, y - 3)
  1376                     DrawAltWeapon(Gear, x + 1, y - 3)
  1377                     end;
  1377                     end;
  1378        gtAirAttack: begin
  1378        gtAirAttack: begin
  1389                         if ((Gear^.State and gstAnimation) <> 0) then
  1389                         if ((Gear^.State and gstAnimation) <> 0) then
  1390                             DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
  1390                             DrawSpriteRotatedF(sprTeleport, x + 1, y - 3, Gear^.Pos, hwSign(Gear^.dX), 0);
  1391                         DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0)
  1391                         DrawSpriteRotatedF(sprTeleport, hwRound(HHGear^.X) + 1 + WorldDx, hwRound(HHGear^.Y) - 3 + WorldDy, 11 - Gear^.Pos, hwSign(HHGear^.dX), 0)
  1392                         end
  1392                         end
  1393                     end;
  1393                     end;
  1394         gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (GameTicks shr 6) mod 12);
  1394         gtSwitcher: DrawSprite(sprSwitch, x - 16, y - 56, (RealTicks shr 6) mod 12);
  1395           gtTarget: begin
  1395           gtTarget: begin
  1396                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
  1396                     Tint($FF, $FF, $FF, round($FF * Gear^.Timer / 1000));
  1397                     DrawSprite(sprTarget, x - 16, y - 16, 0);
  1397                     DrawSprite(sprTarget, x - 16, y - 16, 0);
  1398                     untint;
  1398                     untint;
  1399                     end;
  1399                     end;
  1546                                     DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40);
  1546                                     DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40);
  1547                                     end;
  1547                                     end;
  1548                                 end
  1548                                 end
  1549                           end
  1549                           end
  1550                       end;
  1550                       end;
  1551             gtDuck: DrawSpriteRotatedF(sprDuck, x, y, 1, Gear^.Tag, Gear^.DirAngle);
  1551             gtDuck: DrawSpriteRotatedF(sprDuck, x, y, 1, Gear^.Tag, 
       
  1552                     // replace with something based on dx/dy?
       
  1553                     Gear^.DirAngle + 10-round(20 * abs(1 - (RealTicks mod round(0.1/max(0.00005,cWindSpeedf))) / round(0.05/max(0.00005,cWindSpeedf))) ));
  1552             gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF);  // debug
  1554             gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF);  // debug
  1553          end;
  1555          end;
  1554     if Gear^.State and gstFrozen <> 0 then untint
  1556     if Gear^.State and gstFrozen <> 0 then untint
  1555 end;
  1557 end;
  1556 
  1558