fixed the active region on widgets when they are animated, added active.x:= in uWorld too
authorXeli
Sat, 18 Feb 2012 13:52:37 +0100
changeset 6710 42504695122d
parent 6708 314929f0a3e1
child 6712 c582869fbe7f
fixed the active region on widgets when they are animated, added active.x:= in uWorld too
hedgewars/uRender.pas
hedgewars/uWorld.pas
--- a/hedgewars/uRender.pas	Sat Feb 18 11:59:59 2012 +0100
+++ b/hedgewars/uRender.pas	Sat Feb 18 13:52:37 2012 +0100
@@ -470,8 +470,11 @@
             if RealTicks > (startTime + MOVE_ANIM_TIME) then
                 begin
                 startTime:= 0;
+                animate:= false;
                 frame.x:= target.x;
                 frame.y:= target.y;
+                active.x:= active.x + (target.x - source.x);
+                active.y:= active.y + (target.y - source.y);
                 end
             else
                 begin
--- a/hedgewars/uWorld.pas	Sat Feb 18 11:59:59 2012 +0100
+++ b/hedgewars/uWorld.pas	Sat Feb 18 13:52:37 2012 +0100
@@ -221,7 +221,10 @@
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - frame.w;
     frame.y:= cScreenHeight - frame.h;
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     end;
 
 with backjump do
@@ -232,7 +235,10 @@
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - frame.w * 2;
     frame.y:= cScreenHeight - Round(frame.h * 1.2);
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     end;
 
 with forwardjump do
@@ -243,7 +249,10 @@
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - Round(frame.w * 1.2);
     frame.y:= cScreenHeight - frame.h * 2;
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     end;
 
 with arrowLeft do
@@ -254,7 +263,10 @@
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= -(cScreenWidth shr 1) + Round(frame.w * 0.25);
     frame.y:= cScreenHeight - Round(frame.h * 1.5);
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     end;
 
 with arrowRight do
@@ -265,7 +277,10 @@
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= -(cScreenWidth shr 1) + Round(frame.w * 1.5);
     frame.y:= cScreenHeight - Round(frame.h * 1.5);
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     end;
 
 with arrowUp do
@@ -276,7 +291,10 @@
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - frame.w * 2;
     frame.y:= backjump.frame.y - Round(frame.h * 2.25);
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     with moveAnim do
          begin
          target.x:= frame.x;
@@ -294,7 +312,10 @@
     frame.h:= Round(spritesData[sprite].Texture^.h * buttonScale);
     frame.x:= (cScreenWidth shr 1) - frame.w * 2;
     frame.y:= backjump.frame.y - Round(frame.h * 2.25);
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     with moveAnim do
         begin
         target.x:= frame.x;
@@ -312,7 +333,10 @@
     frame.h:= Round(spritesData[sprPauseButton].Texture^.h * buttonScale);
     frame.x:= cScreenWidth div 2 - frame.w;
     frame.y:= 0;
-    active:= frame;
+    active.x:= frame.x;
+    active.y:= frame.y;
+    active.w:= frame.w;
+    active.h:= frame.h;
     end;
 
 {$ENDIF}