with this patch I'm unable to make rope stuck in land
authorunc0rr
Sun, 04 Apr 2010 15:51:19 +0000
changeset 3303 397a8f048bb3
parent 3302 0973c5af5141
child 3304 8690a3aa93b5
with this patch I'm unable to make rope stuck in land
CMakeLists.txt
hedgewars/GSHandlers.inc
hedgewars/uFloat.pas
--- a/CMakeLists.txt	Sun Apr 04 14:47:45 2010 +0000
+++ b/CMakeLists.txt	Sun Apr 04 15:51:19 2010 +0000
@@ -30,7 +30,7 @@
 
 set(CPACK_PACKAGE_VERSION_MAJOR "0")
 set(CPACK_PACKAGE_VERSION_MINOR "9")
-set(CPACK_PACKAGE_VERSION_PATCH "13${version_suffix}")
+set(CPACK_PACKAGE_VERSION_PATCH "14${version_suffix}")
 
 #forbid in-tree building
 #IF (${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
@@ -152,7 +152,7 @@
 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
 
 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
-set(HEDGEWARS_PROTO_VER 31)
+set(HEDGEWARS_PROTO_VER 32)
 
 if(WITH_SERVER)
 	set(HAVE_NETSERVER true)
--- a/hedgewars/GSHandlers.inc	Sun Apr 04 14:47:45 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Apr 04 15:51:19 2010 +0000
@@ -1070,7 +1070,7 @@
     nx:= ropeDx * len;
     ny:= ropeDy * len;
 
-    len:= Gear^.Elasticity - _0_3x70;
+    len:= Gear^.Elasticity - _5;
     while len > _3 do
             begin
             lx:= hwRound(Gear^.X + mdX * len);
@@ -1108,13 +1108,23 @@
         begin
         tx:= RopePoints.ar[Pred(RopePoints.Count)].X;
         ty:= RopePoints.ar[Pred(RopePoints.Count)].Y;
-        if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear^.X) * (ty - HHGear^.Y) > (tx - HHGear^.X) * (ty - Gear^.Y)) then
+        mdX:= tx - Gear^.X;
+        mdY:= ty - Gear^.Y;
+        if RopePoints.ar[Pred(RopePoints.Count)].b xor (mdX * (ty - HHGear^.Y) > (tx - HHGear^.X) * mdY) then
             begin
             dec(RopePoints.Count);
             Gear^.X:= RopePoints.ar[RopePoints.Count].X;
             Gear^.Y:= RopePoints.ar[RopePoints.Count].Y;
             Gear^.Elasticity:= Gear^.Elasticity + RopePoints.ar[RopePoints.Count].dLen;
-            Gear^.Friction:= Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen
+            Gear^.Friction:= Gear^.Friction + RopePoints.ar[RopePoints.Count].dLen;
+
+            // restore hog position
+            len:= _1 / Distance(mdX, mdY);
+            mdX:= mdX * len; 
+            mdY:= mdY * len;
+
+            HHGear^.X:= Gear^.X - mdX * Gear^.Elasticity;
+            HHGear^.Y:= Gear^.Y - mdY * Gear^.Elasticity;
             end
         end;
 
--- a/hedgewars/uFloat.pas	Sun Apr 04 14:47:45 2010 +0000
+++ b/hedgewars/uFloat.pas	Sun Apr 04 15:51:19 2010 +0000
@@ -120,7 +120,6 @@
              _16: hwFloat = (isNegative: false; QWordValue:  4294967296 * 16);
              _19: hwFloat = (isNegative: false; QWordValue:  4294967296 * 19);
              _20: hwFloat = (isNegative: false; QWordValue:  4294967296 * 20);
-         _0_3x70: hwFloat = (isNegative: false; QWordValue:  1288490189 * 70);
              _25: hwFloat = (isNegative: false; QWordValue:  4294967296 * 25);
              _30: hwFloat = (isNegative: false; QWordValue:  4294967296 * 30);
              _40: hwFloat = (isNegative: false; QWordValue:  4294967296 * 40);