Render gear timers in front of water
authorWuzzy <almikes@aol.com>
Mon, 10 Apr 2017 14:15:00 +0200
changeset 12210 442bab755bb4
parent 12209 7e6362c0ba96
child 12211 00bcaa0e0ef6
Render gear timers in front of water
hedgewars/uGears.pas
hedgewars/uGearsRender.pas
hedgewars/uWorld.pas
--- a/hedgewars/uGears.pas	Mon Apr 10 13:51:07 2017 +0200
+++ b/hedgewars/uGears.pas	Mon Apr 10 14:15:00 2017 +0200
@@ -42,6 +42,7 @@
 procedure ProcessGears;
 procedure EndTurnCleanup;
 procedure DrawGears;
+procedure DrawGearsTimers;
 procedure FreeGearsList;
 procedure AddMiscGears;
 procedure AssignHHCoords;
@@ -585,6 +586,20 @@
     DrawHHOrder();
 end;
 
+procedure DrawGearsTimers;
+var Gear: PGear;
+    x, y: LongInt;
+begin
+Gear:= GearsList;
+while Gear <> nil do
+    begin
+    x:= hwRound(Gear^.X) + WorldDx;
+    y:= hwRound(Gear^.Y) + WorldDy;
+    RenderGearTimer(Gear, x, y);
+    Gear:= Gear^.NextGear
+    end;
+end;
+
 procedure FreeGearsList;
 var t, tt: PGear;
 begin
--- a/hedgewars/uGearsRender.pas	Mon Apr 10 13:51:07 2017 +0200
+++ b/hedgewars/uGearsRender.pas	Mon Apr 10 14:15:00 2017 +0200
@@ -36,6 +36,7 @@
             rounded   : array[0..MAXROPEPOINTS + 2] of TVertex2f;
          end;
 procedure RenderGear(Gear: PGear; x, y: LongInt);
+procedure RenderGearTimer(Gear: PGear; x, y: LongInt);
 procedure DrawHHOrder();
 
 var RopePoints: record
@@ -1532,9 +1533,13 @@
             gtDuck: DrawSpriteRotatedF(sprDuck, x, y, 1, Gear^.Tag, Gear^.Angle);
             gtGenericFaller: DrawCircle(x, y, 3, 3, $FF, $00, $00, $FF);  // debug
          end;
-      if Gear^.RenderTimer and (Gear^.Tex <> nil) then
-          DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
     if Gear^.State and gstFrozen <> 0 then untint
 end;
 
+procedure RenderGearTimer(Gear: PGear; x, y: LongInt);
+begin
+if Gear^.RenderTimer and (Gear^.Tex <> nil) then
+    DrawTextureCentered(x + 8, y + 8, Gear^.Tex);
+end;
+
 end.
--- a/hedgewars/uWorld.pas	Mon Apr 10 13:51:07 2017 +0200
+++ b/hedgewars/uWorld.pas	Mon Apr 10 14:15:00 2017 +0200
@@ -1325,6 +1325,8 @@
     else
         DrawWaves(-1, 50, cWaveHeight div 2, cWaveHeight div 2, 0);
 
+DrawGearsTimers;
+
 // everything after this ChangeDepth will be drawn outside the screen
 // note: negative parallax gears should last very little for a smooth stereo effect
     ChangeDepth(RM, cStereo_Outside);