# HG changeset patch # User unc0rr # Date 1168900420 0 # Node ID 0a21586b3f1d8aa0208f752e198b7bc287dc95e3 # Parent 184230eb41516d4044749443356eb7f73af1367d Rope debug stuff diff -r 184230eb4151 -r 0a21586b3f1d hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon Jan 15 21:20:36 2007 +0000 +++ b/hedgewars/GSHandlers.inc Mon Jan 15 22:33:40 2007 +0000 @@ -523,11 +523,19 @@ end; Gear.dX:= HHGear.X - Gear.X; Gear.dY:= HHGear.Y - Gear.Y; +AddFileLog('Rope 1: (' + floattostr(HHGear.X) + ',' + floattostr(HHGear.Y) + ')'); +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; -if not TestCollisionYwithGear(HHGear, 1) then HHGear.dY:= HHGear.dY + cGravity; +if not TestCollisionYwithGear(HHGear, 1) then + begin + HHGear.dY:= HHGear.dY + cGravity; + AddFileLog('Rope 4: free fall'); + end; + +AddFileLog('Rope 3: ' + floattostr(HHGear.dY)); cs:= Gear.dY + HHGear.dY; cc:= Gear.dX + HHGear.dX; @@ -535,6 +543,8 @@ cc:= cc * len; cs:= cs * len; +AddFileLog('Rope 5: (' + floattostr(cc) + ',' + floattostr(cs) + ')'); + flCheck:= not flCheck; if flCheck then // check whether rope needs dividing begin @@ -582,6 +592,8 @@ Gear.dX:= HHGear.X - Gear.X; Gear.dY:= HHGear.Y - Gear.Y; +AddFileLog('Rope 6: (' + floattostr(Gear.dX) + ',' + floattostr(Gear.dY) + ')'); + cs:= Gear.dY + HHGear.dY; cc:= Gear.dX + HHGear.dX; len:= 1 / sqrt(sqr(cc)+sqr(cs)); @@ -605,11 +617,16 @@ HHGear.dX:= HHGear.X - HHGear.dX; HHGear.dY:= HHGear.Y - HHGear.dY; +AddFileLog('Rope 7: (' + floattostr(HHGear.dX) + ',' + floattostr(HHGear.dY) + ')'); +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; +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 else if (Gear.State and gsttmpFlag) = 0 then Gear.State:= Gear.State or gsttmpFlag;