hedgewars/uGearsRender.pas
branchwebgl
changeset 9127 e350500c4edb
parent 8833 c13ebed437cb
parent 9080 9b42757d7e71
child 9521 8054d9d775fd
--- a/hedgewars/uGearsRender.pas	Thu Apr 04 14:37:19 2013 +0200
+++ b/hedgewars/uGearsRender.pas	Tue Jun 04 22:28:12 2013 +0200
@@ -1,6 +1,6 @@
 (*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2004-2013 Andrey Korotaev <unC0Rr@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -365,13 +365,7 @@
                     lx:= lx + ax;
                     ly:= ly + ay;
                     tx:= round(lx);
-                    ty:= round(ly);
-                    if (abs(tx-hx) > 1000) or (abs(hy-ty) > 1000) then
-                        begin
-                        DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0);
-                        hx:= tx;
-                        hy:= ty
-                        end
+                    ty:= round(ly)
                     end;
                 // reached edge of land. assume infinite beam. Extend it way out past camera
                 if ((ty and LAND_HEIGHT_MASK) <> 0) or ((tx and LAND_WIDTH_MASK) <> 0) then
@@ -381,7 +375,6 @@
                     end;
 
                 //if (abs(lx-tx)>8) or (abs(ly-ty)>8) then
-                if (tx <> hx) or (ty <> hy) then
                     begin
                     DrawLine(hx, hy, tx, ty, 1.0, $FF, $00, $00, $C0);
                     end;
@@ -999,6 +992,8 @@
     aAngle: real;
     startX, endX, startY, endY: LongInt;
 begin
+    if Gear^.State and gstFrozen <> 0 then Tint($A0, $A0, $FF, $FF);
+    //if Gear^.State and gstFrozen <> 0 then Tint(IceColor or $FF);
     if Gear^.Target.X <> NoPointX then
         if Gear^.AmmoType = amBee then
             DrawSpriteRotatedF(sprTargetBee, Gear^.Target.X + WorldDx, Gear^.Target.Y + WorldDy, 0, 0, (RealTicks shr 3) mod 360)
@@ -1058,11 +1053,13 @@
       gtPickHammer: DrawSprite(sprPHammer, x - 16, y - 50 + LongInt(((GameTicks shr 5) and 1) * 2), 0);
             gtRope: DrawRope(Gear);
 
-            gtMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
+            gtMine: begin
+                    if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
                            DrawSpriteRotated(sprMineOff, x, y, 0, Gear^.DirAngle)
-                       else if Gear^.Health <> 0 then
-                           DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
-                       else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
+                    else if Gear^.Health <> 0 then
+                       DrawSpriteRotated(sprMineOn, x, y, 0, Gear^.DirAngle)
+                    else DrawSpriteRotated(sprMineDead, x, y, 0, Gear^.DirAngle);
+                    end;
 
            gtSMine: if (((Gear^.State and gstAttacking) = 0)or((Gear^.Timer and $3FF) < 420)) and (Gear^.Health <> 0) then
                            DrawSpriteRotated(sprSMineOff, x, y, 0, Gear^.DirAngle)
@@ -1076,26 +1073,38 @@
                         begin
                         if ((Gear^.Pos and posCaseAmmo) <> 0) then
                             begin
-                            i:= (GameTicks shr 6) mod 64;
-                            if i > 18 then
-                                i:= 0;
-                            DrawSprite(sprCase, x - 24, y - 24, i);
+                            if Gear^.State and gstFrozen <> 0 then
+                                DrawSprite(sprCase, x - 24, y - 28, 0)
+                            else
+                                begin
+                                i:= (GameTicks shr 6) mod 64;
+                                if i > 18 then i:= 0;
+                                DrawSprite(sprCase, x - 24, y - 24, i)
+                                end
                             end
                         else if ((Gear^.Pos and posCaseHealth) <> 0) then
                             begin
-                            i:= ((GameTicks shr 6) + 38) mod 64;
-                            if i > 13 then
-                                i:= 0;
-                            DrawSprite(sprFAid, x - 24, y - 24, i);
+                            if Gear^.State and gstFrozen <> 0 then
+                                DrawSprite(sprFAid, x - 24, y - 28, 0)
+                            else
+                                begin
+                                i:= ((GameTicks shr 6) + 38) mod 64;
+                                if i > 13 then i:= 0;
+                                DrawSprite(sprFAid, x - 24, y - 24, i)
+                                end
                             end
                         else if ((Gear^.Pos and posCaseUtility) <> 0) then
                             begin
-                            i:= (GameTicks shr 6) mod 70;
-                            if i > 23 then
-                                i:= 0;
-                            i:= i mod 12;
-                            DrawSprite(sprUtility, x - 24, y - 24, i);
-                            end;
+                            if Gear^.State and gstFrozen <> 0 then
+                                DrawSprite(sprUtility, x - 24, y - 28, 0)
+                            else
+                                begin
+                                i:= (GameTicks shr 6) mod 70;
+                                if i > 23 then i:= 0;
+                                i:= i mod 12;
+                                DrawSprite(sprUtility, x - 24, y - 24, i)
+                                end
+                            end
                         end;
                     if Gear^.Timer < 1833 then
                         begin
@@ -1116,7 +1125,7 @@
                     else if Gear^.State and gsttmpFlag = 0 then
                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
                     else
-                        DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle);
+                        DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle)
                     end;
         gtDynamite: DrawSprite(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
      gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
@@ -1305,6 +1314,7 @@
          end;
       if Gear^.RenderTimer and (Gear^.Tex <> nil) then
           DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
+    if Gear^.State and gstFrozen <> 0 then Tint($FF, $FF, $FF, $FF)
 end;
 
 end.