hedgewars/uGearsRender.pas
changeset 7093 2d7f1fb73335
parent 7010 10a0a31804f3
child 7098 f8c453ade379
equal deleted inserted replaced
7092:c9ca770fd7fc 7093:2d7f1fb73335
    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, uVisualGears;
    41 
    41 
    42 procedure DrawRopeLinesRQ(Gear: PGear);
    42 procedure DrawRopeLinesRQ(Gear: PGear);
    43 begin
    43 begin
    44 with RopePoints do
    44 with RopePoints do
    45     begin
    45     begin
   516                     DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   516                     DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   517                     if CurAmmoGear^.Tex <> nil then
   517                     if CurAmmoGear^.Tex <> nil then
   518                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
   518                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
   519                     end;
   519                     end;
   520                 gtLandGun:
   520                 gtLandGun:
       
   521                     begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
       
   522                     if CurAmmoGear^.Tex <> nil then
       
   523                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
       
   524                     end;
       
   525                 gtIceGun:
   521                     begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   526                     begin DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   522                     if CurAmmoGear^.Tex <> nil then
   527                     if CurAmmoGear^.Tex <> nil then
   523                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
   528                         DrawTextureCentered(sx, sy - 40, CurAmmoGear^.Tex)
   524                     end;
   529                     end;
   525             end;
   530             end;
   646                                     LongInt(leftX)+WorldDx)
   651                                     LongInt(leftX)+WorldDx)
   647                     end;
   652                     end;
   648                 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   653                 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   649                 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   654                 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   650                 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   655                 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
       
   656                 amIceGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   651                 amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here
   657                 amResurrector: DrawCircle(ox, oy, 98, 4, $F5, $DB, $35, $AA); // I'd rather not like to hardcode 100 here
   652             end;
   658             end;
   653 
   659 
   654             case amt of
   660             case amt of
   655                 amAirAttack,
   661                 amAirAttack,
   905 
   911 
   906 
   912 
   907 procedure RenderGear(Gear: PGear; x, y: LongInt);
   913 procedure RenderGear(Gear: PGear; x, y: LongInt);
   908 var
   914 var
   909     HHGear: PGear;
   915     HHGear: PGear;
       
   916     vg: PVisualGear;
   910     i: Longword;
   917     i: Longword;
   911     aAngle: real;
   918     aAngle: real;
   912     startX, endX, startY, endY: LongInt;
   919     startX, endX, startY, endY: LongInt;
   913 begin
   920 begin
   914     if Gear^.Target.X <> NoPointX then
   921     if Gear^.Target.X <> NoPointX then
   915         if Gear^.AmmoType = amBee then
   922         if Gear^.AmmoType = amBee then
   916             DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   923             DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
   917 	else if Gear^.AmmoType = amIceGun then
   924 	else if Gear^.AmmoType = amIceGun then
   918 	    DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 3) mod 360)
   925 	    //DrawSprite(sprSnowDust, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8)
       
   926         //DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1, 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360)
       
   927         DrawTextureRotatedF(SpritesData[sprSnowDust].Texture, 1/(1+(RealTicks shr 8) mod 5), 0, 0, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, (RealTicks shr 2) mod 8, 1, 22, 22, (RealTicks shr 3) mod 360)
   919     else
   928     else
   920         DrawSpriteRotatedF(sprTargetP, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
   929         DrawSpriteRotatedF(sprTargetP, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360);
   921 
   930 
   922     case Gear^.Kind of
   931     case Gear^.Kind of
   923           gtGrenade: DrawSpriteRotated(sprBomb, x, y, 0, Gear^.DirAngle);
   932           gtGrenade: DrawSpriteRotated(sprBomb, x, y, 0, Gear^.DirAngle);
  1167                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1176                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1168                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);
  1177                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);
  1169                         Tint($FF, $FF, $FF, $FF)
  1178                         Tint($FF, $FF, $FF, $FF)
  1170 *)
  1179 *)
  1171                         end;
  1180                         end;
       
  1181             gtIceGun: begin
       
  1182                       HHGear := Gear^.Hedgehog^.Gear;
       
  1183                       if HHGear <> nil then
       
  1184                           begin
       
  1185                           i:= hwRound(hwSqr(Gear^.X-HHGear^.X)+hwSqr(Gear^.Y-HHGear^.Y));
       
  1186                           if RealTicks mod max(1,50-(round(sqrt(i)) div 4)) = 0 then // experiment in "intensifying" might not get used
       
  1187                             begin
       
  1188                             vg:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtDust, 1);
       
  1189                             if vg <> nil then
       
  1190                                 begin
       
  1191                                 i:= random(100)+155;
       
  1192                                 vg^.Tint:= i shl 24 or i shl 16 or $FF shl 8 or ((random(200)+55));
       
  1193                                 vg^.Angle:= random(360);
       
  1194                                 vg^.dx:= 0.001 * (random(80));
       
  1195                                 vg^.dy:= 0.001 * (random(80))
       
  1196                                 end
       
  1197                             end;
       
  1198                           if RealTicks mod 2 = 0 then
       
  1199                                 begin
       
  1200                                 i:= random(100)+100;
       
  1201                                 DrawLine(hwRound(HHGear^.X), hwRound(HHGear^.Y), hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40);
       
  1202                                 if Gear^.Target.X <> NoPointX then
       
  1203                                     DrawLine(Gear^.Target.X, Gear^.Target.Y, hwRound(Gear^.X), hwRound(Gear^.Y), 4.0, i, i, $FF, $40);
       
  1204                                 end
       
  1205                           end
       
  1206                       end
  1172 
  1207 
  1173 
  1208 
  1174          end;
  1209          end;
  1175       if Gear^.RenderTimer and (Gear^.Tex <> nil) then
  1210       if Gear^.RenderTimer and (Gear^.Tex <> nil) then
  1176           DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
  1211           DrawTextureCentered(x + 8, y + 8, Gear^.Tex);