Get further with debug
authorunc0rr
Mon, 15 Jan 2007 23:25:44 +0000
changeset 344 a98ade8c99b6
parent 343 8a91d153f787
child 345 fa39c61be4de
Get further with debug
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Mon Jan 15 23:03:20 2007 +0000
+++ b/hedgewars/GSHandlers.inc	Mon Jan 15 23:25:44 2007 +0000
@@ -523,8 +523,8 @@
    end;
 Gear.dX:= HHGear.X - Gear.X;
 Gear.dY:= HHGear.Y - Gear.Y;
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 1: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')');
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 2: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')');
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 1: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')');
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 2: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')');
 
 if (Gear.Message and gm_Left  <> 0) then HHGear.dX:= HHGear.dX - 0.0002 else
 if (Gear.Message and gm_Right <> 0) then HHGear.dX:= HHGear.dX + 0.0002;
@@ -532,10 +532,10 @@
 if not TestCollisionYwithGear(HHGear, 1) then
    begin
    HHGear.dY:= HHGear.dY + cGravity;
-   if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 4: free fall');
+   if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 4: free fall');
    end;
 
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 3: ' + floattostr(HHGear.dY));
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 3: ' + floattostr(HHGear.dY));
 
 cs:= Gear.dY + HHGear.dY;
 cc:= Gear.dX + HHGear.dX;
@@ -543,7 +543,7 @@
 cc:= cc * len;
 cs:= cs * len;
 
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 5: (' + floattostr(cc) + ',' + floattostr(cs) + ')');
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 5: (' + floattostr(cc) + ',' + floattostr(cs) + ')');
 
 flCheck:= not flCheck;
 if flCheck then  // check whether rope needs dividing
@@ -555,16 +555,17 @@
          ty:= cs*len;
          lx:= round(Gear.X + tx) + hwSign(HHGear.dX);
          ly:= round(Gear.Y + ty) + hwSign(HHGear.dY);
-         if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope b: (' + inttostr(lx) + ',' + inttostr(ly) + ')');
+         if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope b: (' + inttostr(lx) + ',' + inttostr(ly) + ')');
          if ((ly and $FFFFFC00) = 0) and ((lx and $FFFFF800) = 0)and (Land[ly, lx] <> 0) then
            begin
-           if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope b: !!');
+           if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope b: !!');
            with RopePoints.ar[RopePoints.Count] do
                 begin
                 X:= Gear.X;
                 Y:= Gear.Y;
                 if RopePoints.Count = 0 then RopePoints.HookAngle:= DxDy2Angle32(Gear.dY, Gear.dX);
                 b:= (cc * HHGear.dY) > (cs * HHGear.dX);
+                AddFileLog('Rope: b = ' + inttostr(ord(b)));
                 dLen:= len
                 end;
            Gear.X:= Gear.X + tx;
@@ -581,7 +582,8 @@
       begin
       tx:= RopePoints.ar[Pred(RopePoints.Count)].X;
       ty:= RopePoints.ar[Pred(RopePoints.Count)].Y;
-      if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope a: (' + floattostr(tx) + ',' + floattostr(ty) + ')');
+      if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope a: (' + floattostr(tx) + ',' + floattostr(ty) + ')');
+      if GameTicks = 189245 then AddFileLog('Rope A: ' + inttostr(ord((tx - Gear.X) * (ty - HHGear.Y) > (tx - HHGear.X) * (ty - Gear.Y))));
       if RopePoints.ar[Pred(RopePoints.Count)].b xor ((tx - Gear.X) * (ty - HHGear.Y) > (tx - HHGear.X) * (ty - Gear.Y)) then
          begin
          dec(RopePoints.Count);
@@ -595,7 +597,7 @@
 Gear.dX:= HHGear.X - Gear.X;
 Gear.dY:= HHGear.Y - Gear.Y;
 
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 6: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')');
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 6: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')');
 
 cs:= Gear.dY + HHGear.dY;
 cc:= Gear.dX + HHGear.dX;
@@ -620,15 +622,15 @@
 HHGear.dX:= HHGear.X - HHGear.dX;
 HHGear.dY:= HHGear.Y - HHGear.dY;
 
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 7: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')');
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 8: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')');
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 7: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')');
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 8: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')');
 
 if TestCollisionXwithGear(HHGear, hwSign(HHGear.dX)) then
    HHGear.dX:= -0.6 * HHGear.dX;
 if TestCollisionYwithGear(HHGear, hwSign(HHGear.dY)) then
    HHGear.dY:= -0.6 * HHGear.dY;
 
-if (GameTicks > 189200)and(GameTicks < 189500) then AddFileLog('Rope 9: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')');
+if (GameTicks > 189200)and(GameTicks < 189300) then AddFileLog('Rope 9: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')');
 
 if (Gear.Message and gm_Attack) <> 0 then
    if (Gear.State and gsttmpFlag) <> 0 then DeleteMe else