# HG changeset patch # User unc0rr # Date 1340477051 -14400 # Node ID 3a61c53346a897fa37c9f1893ecebce604c79584 # Parent 74ad631a72bf0e4beda2150ea127ee98e7b42b61 - Fix cake bug introduced in r2ccfc93c6b5e - New debugging tool which dumps land into log file diff -r 74ad631a72bf -r 3a61c53346a8 hedgewars/GSHandlers.inc --- 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) diff -r 74ad631a72bf -r 3a61c53346a8 hedgewars/uCollisions.pas --- 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; diff -r 74ad631a72bf -r 3a61c53346a8 hedgewars/uLandGraphics.pas --- 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.