From f0d4e199f20938613340c53ff24e1eb7a6cc2481 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Tue, 22 Aug 2017 22:00:16 +0300 Subject: [PATCH] debug cosmetix --- src/game/g_grid.pas | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas index 9b99c7c..c1a5f07 100644 --- a/src/game/g_grid.pas +++ b/src/game/g_grid.pas @@ -1149,7 +1149,9 @@ begin // done? if (xd = term) then exit; + {$IF DEFINED(D2F_DEBUG)} if (xptr^ < 0) or (yptr^ < 0) or (xptr^ >= gw*tsize) and (yptr^ > mHeight*tsize) then raise Exception.Create('raycaster internal error (0)'); + {$ENDIF} //if (dbgShowTraceLog) then e_WriteLog(Format('raycast start: (%d,%d)-(%d,%d); xptr^=%d; yptr^=%d', [ax0, ay0, ax1, ay1, xptr^, yptr^]), MSG_NOTIFY); @@ -1174,7 +1176,9 @@ begin while (xd <> term) do begin // check cell(s) + {$IF DEFINED(D2F_DEBUG)} if (xptr^ < 0) or (yptr^ < 0) or (xptr^ >= gw*tsize) and (yptr^ > mHeight*tsize) then raise Exception.Create('raycaster internal error (0)'); + {$ENDIF} // new tile? ga := (yptr^ div tsize)*gw+(xptr^ div tsize); if (ga <> lastGA) then @@ -1361,11 +1365,15 @@ begin xerr += dx; yerr += dy; // invariant: one of those always changed + {$IF DEFINED(D2F_DEBUG)} if (xerr < 0) and (yerr < 0) then raise Exception.Create('internal bug in grid raycaster (0)'); + {$ENDIF} if (xerr >= 0) then begin xerr -= d; x += incx; stepx := incx; end else stepx := 0; if (yerr >= 0) then begin yerr -= d; y += incy; stepy := incy; end else stepy := 0; // invariant: we always doing a step + {$IF DEFINED(D2F_DEBUG)} if ((stepx or stepy) = 0) then raise Exception.Create('internal bug in grid raycaster (1)'); + {$ENDIF} begin // check for crossing tile/grid boundary if (x >= 0) and (y >= 0) and (x <= maxx) and (y <= maxy) then -- 2.29.2