summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5fe5735)
raw | patch | inline | side by side (parent: 5fe5735)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 18 Jan 2018 11:20:35 +0000 (13:20 +0200) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Thu, 18 Jan 2018 12:48:26 +0000 (14:48 +0200) |
src/game/g_grid.pas | patch | blob | history |
diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas
index 5af372b63a33e5a2ccac7d592829198e60d496b7..4c3b82643e593b51df955446367e982c7b2a2e87 100644 (file)
--- a/src/game/g_grid.pas
+++ b/src/game/g_grid.pas
interface
-{$IFDEF USE_MEMPOOL}
uses
mempool;
-{$ENDIF}
+
+(*
+ * In order to make this usable for kind-of-recursive calls,
+ * we'll use "frame memory pool" to return results. That is,
+ * we will allocate a memory pool that will be cleared on
+ * frame start, and then used as a simple "no-free" allocator.
+ * Grid will put results into this pool, and will never bother
+ * to free it. Caller should call "release" on result, and
+ * the pool will throw away everything.
+ * No more callbacks, of course.
+ *)
const
GridTileSize = 32; // must be power of two!
// no callback: return object of the nearest hit or nil
// if `inverted` is true, trace will register bodies *exluding* tagmask
//WARNING: don't change tags in callbacks here!
+ {
function traceRayOld (const x0, y0, x1, y1: Integer; cb: TGridRayQueryCB; tagmask: Integer=-1): ITP; overload;
function traceRayOld (out ex, ey: Integer; const ax0, ay0, ax1, ay1: Integer; cb: TGridRayQueryCB; tagmask: Integer=-1): ITP;
+ }
//WARNING: don't modify grid while any query is in progress (no checks are made!)
// you can set enabled/disabled flag, tho (but iterator can still return objects disabled inside it)
// ////////////////////////////////////////////////////////////////////////// //
// no callback: return `true` on the nearest hit
+(*
function TBodyGridBase.traceRayOld (const x0, y0, x1, y1: Integer; cb: TGridRayQueryCB; tagmask: Integer=-1): ITP;
var
ex, ey: Integer;
prevx := xptr^+minx;
prevy := yptr^+miny;
- (*
+ ( *
// move coords
if (e >= 0) then begin yd += sty; e -= dx2; end else e += dy2;
xd += stx;
// done?
if (xd = term) then exit;
- *)
+ * )
{$IF DEFINED(D2F_DEBUG)}
if (xptr^ < 0) or (yptr^ < 0) or (xptr^ >= gw*mTileSize) and (yptr^ >= gh*mTileSize) then raise Exception.Create('raycaster internal error (0)');
mInQuery := false;
end;
+*)
end.