- Fix cake bug introduced in r2ccfc93c6b5e
authorunc0rr
Sat, 23 Jun 2012 22:44:11 +0400
changeset 7268 3a61c53346a8
parent 7266 74ad631a72bf
child 7270 93e92e82d5c8
- Fix cake bug introduced in r2ccfc93c6b5e - New debugging tool which dumps land into log file
hedgewars/GSHandlers.inc
hedgewars/uCollisions.pas
hedgewars/uLandGraphics.pas
--- a/hedgewars/GSHandlers.inc	Fri Jun 22 08:13:51 2012 +0400
+++ b/hedgewars/GSHandlers.inc	Sat Jun 23 22:44:11 2012 +0400
@@ -3087,7 +3087,7 @@
         begin
         Gear^.Tag := 0;
         Gear^.X := Gear^.X + int2hwFloat(xx);
-        if not TestCollisionY(Gear, yyn) then
+        if TestCollisionYwithGear(Gear, yyn) = 0 then
             begin
             Gear^.Y := Gear^.Y + int2hwFloat(yyn);
             NextAngle(Gear, dA)
--- a/hedgewars/uCollisions.pas	Fri Jun 22 08:13:51 2012 +0400
+++ b/hedgewars/uCollisions.pas	Sat Jun 23 22:44:11 2012 +0400
@@ -148,7 +148,8 @@
             end
         else
             TestWord:= 255
-    else TestWord:= 0;
+else 
+    TestWord:= 0;
 
 x:= hwRound(Gear^.X);
 if Dir < 0 then
@@ -193,6 +194,7 @@
     y:= y - Gear^.Radius
 else
     y:= y + Gear^.Radius;
+
 if (y and LAND_HEIGHT_MASK) = 0 then
     begin
     x:= hwRound(Gear^.X) - Gear^.Radius + 1;
--- a/hedgewars/uLandGraphics.pas	Fri Jun 22 08:13:51 2012 +0400
+++ b/hedgewars/uLandGraphics.pas	Sat Jun 23 22:44:11 2012 +0400
@@ -40,6 +40,7 @@
 function  LandBackPixel(x, y: LongInt): LongWord;
 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
 procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword);
+procedure DumpLandToLog(x, y, r: LongInt);
 
 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
 
@@ -1157,4 +1158,28 @@
         DrawLines(x1, y1, x2, y2, dx, dy, color);
 end;
 
+
+procedure DumpLandToLog(x, y, r: LongInt);
+var xx, yy, dx: LongInt;
+    s: shortstring;
+begin
+    s[0]:= char(r * 2 + 1);
+    for yy:= y - r to y + r do
+        begin
+        for dx:= 0 to r*2 do
+            begin
+            xx:= dx - r + x;
+            if (xx = x) and (yy = y) then
+                s[dx + 1]:= 'X'
+            else if Land[yy, xx] > 255 then
+                s[dx + 1]:= 'O'
+            else if Land[yy, xx] > 0 then
+                s[dx + 1]:= '*'
+            else
+                s[dx + 1]:= '.'
+            end;
+        AddFileLog('Land dump: ' + s);
+        end;
+end;
+
 end.