hedgewars/uGearsRender.pas
changeset 9041 aefe46d64dd9
parent 8854 31133afaa025
child 9044 8a829987d514
equal deleted inserted replaced
9040:282c7ef1822d 9041:aefe46d64dd9
   977     vg: PVisualGear;
   977     vg: PVisualGear;
   978     i: Longword;
   978     i: Longword;
   979     aAngle: real;
   979     aAngle: real;
   980     startX, endX, startY, endY: LongInt;
   980     startX, endX, startY, endY: LongInt;
   981 begin
   981 begin
       
   982     if Gear^.State and gstFrozen <> 0 then Tint($A0, $A0, $FF, $FF);
       
   983     //if Gear^.State and gstFrozen <> 0 then Tint(IceColor or $FF);
   982     if Gear^.Target.X <> NoPointX then
   984     if Gear^.Target.X <> NoPointX then
   983         if Gear^.AmmoType = amBee then
   985         if Gear^.AmmoType = amBee then
   984             DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   986             DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   985     else if Gear^.AmmoType = amIceGun then
   987     else if Gear^.AmmoType = amIceGun then
   986         //DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8)
   988         //DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8)
  1036                     end;
  1038                     end;
  1037              gtBee: DrawSpriteRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1039              gtBee: DrawSpriteRotatedF(sprBee, x, y, (GameTicks shr 5) mod 2, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
  1038       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
  1040       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
  1039             gtRope: DrawRope(Gear);
  1041             gtRope: DrawRope(Gear);
  1040 
  1042 
  1041             gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1043             gtMine: begin
       
  1044                     if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1042                            DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
  1045                            DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
  1043                        else if Gear^.Health <> 0 then
  1046                     else if Gear^.Health <> 0 then
  1044                            DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
  1047                        DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
  1045                        else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
  1048                     else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
       
  1049                     end;
  1046 
  1050 
  1047            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1051            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
  1048                            DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
  1052                            DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
  1049                        else if Gear^.Health <> 0 then
  1053                        else if Gear^.Health <> 0 then
  1050                            DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
  1054                            DrawSpriteRotated(sprSMineOn, x, y, 0, Gear^.DirAngle)
  1054             gtCase: begin
  1058             gtCase: begin
  1055                     if Gear^.Timer > 1000 then
  1059                     if Gear^.Timer > 1000 then
  1056                         begin
  1060                         begin
  1057                         if ((Gear^.Pos and posCaseAmmo) <> 0) then
  1061                         if ((Gear^.Pos and posCaseAmmo) <> 0) then
  1058                             begin
  1062                             begin
       
  1063                             if Gear^.State and gstFrozen <> 0 then
       
  1064                                 begin
       
  1065                                 DrawSprite(sprCase, x - 24, y - 28, 0);
       
  1066                                 exit
       
  1067                                 end;
  1059                             i:= (GameTicks shr 6) mod 64;
  1068                             i:= (GameTicks shr 6) mod 64;
  1060                             if i > 18 then
  1069                             if i > 18 then i:= 0;
  1061                                 i:= 0;
  1070                             DrawSprite(sprCase, x - 24, y - 24, i)
  1062                             DrawSprite(sprCase, x - 24, y - 24, i);
       
  1063                             end
  1071                             end
  1064                         else if ((Gear^.Pos and posCaseHealth) <> 0) then
  1072                         else if ((Gear^.Pos and posCaseHealth) <> 0) then
  1065                             begin
  1073                             begin
       
  1074                             if Gear^.State and gstFrozen <> 0 then
       
  1075                                 begin
       
  1076                                 DrawSprite(sprFAid, x - 24, y - 28, 0);
       
  1077                                 exit
       
  1078                                 end;
  1066                             i:= ((GameTicks shr 6) + 38) mod 64;
  1079                             i:= ((GameTicks shr 6) + 38) mod 64;
  1067                             if i > 13 then
  1080                             if i > 13 then i:= 0;
  1068                                 i:= 0;
       
  1069                             DrawSprite(sprFAid, x - 24, y - 24, i);
  1081                             DrawSprite(sprFAid, x - 24, y - 24, i);
  1070                             end
  1082                             end
  1071                         else if ((Gear^.Pos and posCaseUtility) <> 0) then
  1083                         else if ((Gear^.Pos and posCaseUtility) <> 0) then
  1072                             begin
  1084                             begin
       
  1085                             if Gear^.State and gstFrozen <> 0 then
       
  1086                                 begin
       
  1087                                 DrawSprite(sprUtility, x - 24, y - 28, 0);
       
  1088                                 exit
       
  1089                                 end;
  1073                             i:= (GameTicks shr 6) mod 70;
  1090                             i:= (GameTicks shr 6) mod 70;
  1074                             if i > 23 then
  1091                             if i > 23 then i:= 0;
  1075                                 i:= 0;
       
  1076                             i:= i mod 12;
  1092                             i:= i mod 12;
  1077                             DrawSprite(sprUtility, x - 24, y - 24, i);
  1093                             DrawSprite(sprUtility, x - 24, y - 24, i);
  1078                             end;
  1094                             end
  1079                         end;
  1095                         end;
  1080                     if Gear^.Timer < 1833 then
  1096                     if Gear^.Timer < 1833 then
  1081                         begin
  1097                         begin
  1082                         DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
  1098                         DrawTextureRotatedF(SpritesData[sprPortal].texture, min(abs(1.25 - (Gear^.Timer mod 1333) / 400), 1.25), 0, 0,
  1083                                             x, LongInt(Gear^.Angle) + WorldDy - 16, 4 + Gear^.Tag, 1, 32, 32, 270);
  1099                                             x, LongInt(Gear^.Angle) + WorldDy - 16, 4 + Gear^.Tag, 1, 32, 32, 270);
  1094                         DrawSprite(sprExplosives, x - 24, y - 24, i)
  1110                         DrawSprite(sprExplosives, x - 24, y - 24, i)
  1095                         end
  1111                         end
  1096                     else if Gear^.State and gsttmpFlag = 0 then
  1112                     else if Gear^.State and gsttmpFlag = 0 then
  1097                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
  1113                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
  1098                     else
  1114                     else
  1099                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle);
  1115                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle)
  1100                     end;
  1116                     end;
  1101         gtDynamite: DrawSprite(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
  1117         gtDynamite: DrawSprite(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
  1102      gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
  1118      gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
  1103          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
  1119          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
  1104            gtFlame: if Gear^.Tag and 1 = 0 then
  1120            gtFlame: if Gear^.Tag and 1 = 0 then
  1283                       end;
  1299                       end;
  1284             gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF);  // debug
  1300             gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF);  // debug
  1285          end;
  1301          end;
  1286       if Gear^.RenderTimer and (Gear^.Tex <> nil) then
  1302       if Gear^.RenderTimer and (Gear^.Tex <> nil) then
  1287           DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
  1303           DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
       
  1304     if Gear^.State and gstFrozen <> 0 then Tint($FF, $FF, $FF, $FF)
  1288 end;
  1305 end;
  1289 
  1306 
  1290 end.
  1307 end.