hedgewars/uGearsRender.pas
branchqmlfrontend
changeset 11071 3851ce4f2061
parent 11059 659427d9fd17
child 11174 5cadfe82eaf6
equal deleted inserted replaced
11050:9b7c8c5a94e0 11071:3851ce4f2061
     1 (*
     1 (*
     2  * Hedgewars, a free turn based strategy game
     2  * Hedgewars, a free turn based strategy game
     3  * Copyright (c) 2004-2014 Andrey Korotaev <unC0Rr@gmail.com>
     3  * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com>
     4  *
     4  *
     5  * This program is free software; you can redistribute it and/or modify
     5  * This program is free software; you can redistribute it and/or modify
     6  * it under the terms of the GNU General Public License as published by
     6  * it under the terms of the GNU General Public License as published by
     7  * the Free Software Foundation; version 2 of the License
     7  * the Free Software Foundation; version 2 of the License
     8  *
     8  *
   245             begin
   245             begin
   246             inc(c);
   246             inc(c);
   247             HHGear:= hh^.Gear;
   247             HHGear:= hh^.Gear;
   248             x:= hwRound(HHGear^.X) + WorldDx;
   248             x:= hwRound(HHGear^.X) + WorldDx;
   249             y:= hwRound(HHGear^.Y) + WorldDy - 2;
   249             y:= hwRound(HHGear^.Y) + WorldDy - 2;
   250             if (SpeechHogNumber <> c) or ((RealTicks and 512) < 256) then
   250             DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x - fSprOff, y, 0, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
   251                 begin
   251             DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x + fSprOff, y, 1, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
   252                 DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x - fSprOff, y, 0, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
   252             DrawTextureF(SpritesData[sprBigDigit].Texture, 0.5, x, y, c, 1, sprW, sprH);
   253                 DrawTextureF(SpritesData[sprFrame].Texture, 0.5, x + fSprOff, y, 1, 1, SpritesData[sprFrame].Width, SpritesData[sprFrame].Height);
   253             if SpeechHogNumber = c then
   254                 DrawTextureF(SpritesData[sprBigDigit].Texture, 0.5, x, y, c, 1, sprW, sprH);
       
   255                 end
       
   256             else
       
   257                 DrawCircle(x, y, 20, 3, 0, $FF, $FF, $80);
   254                 DrawCircle(x, y, 20, 3, 0, $FF, $FF, $80);
   258             end;
   255             end;
   259         until (i > cMaxHHIndex);
   256         until (i > cMaxHHIndex);
   260     end
   257     end
   261 
   258 
   747                     defaultPos:= false
   744                     defaultPos:= false
   748                     end;
   745                     end;
   749                 amRubber,
   746                 amRubber,
   750                 amGirder: begin
   747                 amGirder: begin
   751                     DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle);
   748                     DrawSpriteRotated(sprHandConstruction, hx, hy, sign, aangle);
   752                     if WorldEdge = weWrap then
   749                     if cBuildMaxDist = cDefaultBuildMaxDist then
   753                         begin
   750                         begin
   754                         if hwRound(Gear^.X) < LongInt(leftX) + 256 then
   751                         if WorldEdge = weWrap then
   755                             DrawSpriteClipped(sprGirder,
   752                             begin
   756                                             rightX+(ox-leftX)-256,
   753                             if hwRound(Gear^.X) < LongInt(leftX) + 256 then
   757                                             oy-256,
   754                                 DrawSpriteClipped(sprGirder,
   758                                             LongInt(topY)+WorldDy,
   755                                                 rightX+(ox-leftX)-256,
   759                                             LongInt(rightX)+WorldDx,
   756                                                 oy-256,
   760                                             cWaterLine+WorldDy,
   757                                                 LongInt(topY)+WorldDy,
   761                                             LongInt(leftX)+WorldDx);
   758                                                 LongInt(rightX)+WorldDx,
   762                         if hwRound(Gear^.X) > LongInt(rightX) - 256 then
   759                                                 cWaterLine+WorldDy,
   763                             DrawSpriteClipped(sprGirder,
   760                                                 LongInt(leftX)+WorldDx);
   764                                             leftX-(rightX-ox)-256,
   761                             if hwRound(Gear^.X) > LongInt(rightX) - 256 then
   765                                             oy-256,
   762                                 DrawSpriteClipped(sprGirder,
   766                                             LongInt(topY)+WorldDy,
   763                                                 leftX-(rightX-ox)-256,
   767                                             LongInt(rightX)+WorldDx,
   764                                                 oy-256,
   768                                             cWaterLine+WorldDy,
   765                                                 LongInt(topY)+WorldDy,
   769                                             LongInt(leftX)+WorldDx)
   766                                                 LongInt(rightX)+WorldDx,
       
   767                                                 cWaterLine+WorldDy,
       
   768                                                 LongInt(leftX)+WorldDx)
       
   769                             end;
       
   770                         DrawSpriteClipped(sprGirder,
       
   771                                         ox-256,
       
   772                                         oy-256,
       
   773                                         LongInt(topY)+WorldDy,
       
   774                                         LongInt(rightX)+WorldDx,
       
   775                                         cWaterLine+WorldDy,
       
   776                                         LongInt(leftX)+WorldDx)
       
   777                         end
       
   778                     else if cBuildMaxDist > 0 then
       
   779                         begin
       
   780                             DrawCircle(hx, hy, cBuildMaxDist, 3, $FF, 0, 0, $80);
   770                         end;
   781                         end;
   771                     DrawSpriteClipped(sprGirder,
       
   772                                     ox-256,
       
   773                                     oy-256,
       
   774                                     LongInt(topY)+WorldDy,
       
   775                                     LongInt(rightX)+WorldDx,
       
   776                                     cWaterLine+WorldDy,
       
   777                                     LongInt(leftX)+WorldDx)
       
   778                     end;
   782                     end;
   779                 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   783                 amBee: DrawSpriteRotatedF(sprHandBee, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   780                 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   784                 amFlamethrower: DrawSpriteRotatedF(sprHandFlamethrower, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
   781                 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   785                 amLandGun: DrawSpriteRotated(sprHandBallgun, hx, hy, sign, aangle);
   782                 amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle);
   786                 amIceGun: DrawSpriteRotated(sprIceGun, hx, hy, sign, aangle);
  1382                         begin
  1386                         begin
  1383                         if Gear^.Pos = 2 then
  1387                         if Gear^.Pos = 2 then
  1384                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF)
  1388                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or $FF)
  1385                         else
  1389                         else
  1386                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1390                             Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1387                         DrawSprite(sprTardis, x-24, y-63,0);
  1391                         DrawSprite(sprTardis, x-25, y-64,0);
  1388                         if Gear^.Pos = 2 then
  1392                         if Gear^.Pos = 2 then
  1389                             untint
  1393                             untint
  1390                         else
  1394                         else
  1391                             Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1395                             Tint($FF,$FF,$FF,max($00, round(Gear^.Power * (1-abs(0.5 - (GameTicks mod 2000) / 2000)))));
  1392                         DrawSprite(sprTardis, x-24, y-63,1);
  1396                         DrawSprite(sprTardis, x-25, y-64,1);
  1393                         if Gear^.Pos <> 2 then
  1397                         if Gear^.Pos <> 2 then
  1394                             untint
  1398                             untint
  1395 (*
  1399 (*
  1396                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1400                         Tint(Gear^.Hedgehog^.Team^.Clan^.Color shl 8 or max($00, round(Gear^.Power * abs(1 - (RealTicks mod 500) / 250))));
  1397                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);
  1401                         DrawTexture(x-6, y-70, SpritesData[sprVampiric].Texture, 0.25);