summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2ff5661)
raw | patch | inline | side by side (parent: 2ff5661)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 22 Aug 2017 19:00:16 +0000 (22:00 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Wed, 23 Aug 2017 18:23:55 +0000 (21:23 +0300) |
src/game/g_grid.pas | patch | blob | history |
diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas
index 9b99c7c976f9bf2f8796cab8b17e330db26ad5ff..c1a5f0777cd25a2416e92da03da53834e744a571 100644 (file)
--- a/src/game/g_grid.pas
+++ b/src/game/g_grid.pas
// 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);
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
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