summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8b1632a)
raw | patch | inline | side by side (parent: 8b1632a)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 18 Aug 2017 19:13:09 +0000 (22:13 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 18 Aug 2017 19:13:30 +0000 (22:13 +0300) |
src/game/g_grid.pas | patch | blob | history | |
src/game/g_map.pas | patch | blob | history |
diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas
index 56d8ecbc42bbebf2ac1c9075c588b5725f68f227..0fbbae7e8c03218958cce6f7662f8a9f61f3ccee 100644 (file)
--- a/src/game/g_grid.pas
+++ b/src/game/g_grid.pas
procedure resizeBody (body: TBodyProxy; sx, sy: Integer);
procedure moveResizeBody (body: TBodyProxy; dx, dy, sx, sy: Integer);
- function forEachInAABB (x, y, w, h: Integer; cb: GridQueryCB): Boolean;
+ function forEachInAABB (x, y, w, h: Integer; cb: GridQueryCB; tagmask: Integer=-1): Boolean;
function getProxyForBody (aObj: TObject; x, y, w, h: Integer): TBodyProxy;
end;
-function TBodyGrid.forEachInAABB (x, y, w, h: Integer; cb: GridQueryCB): Boolean;
+function TBodyGrid.forEachInAABB (x, y, w, h: Integer; cb: GridQueryCB; tagmask: Integer=-1): Boolean;
function iterator (grida: Integer): Boolean;
var
idx: Integer;
@@ -414,7 +414,7 @@ function TBodyGrid.forEachInAABB (x, y, w, h: Integer; cb: GridQueryCB): Boolean
if (mCells[idx].body <> -1) then
begin
px := @mProxies[mCells[idx].body];
- if (px.mQueryMark <> mLastQuery) then
+ if (px.mQueryMark <> mLastQuery) and ((px.mTag and tagmask) <> 0) then
begin
//e_WriteLog(Format(' query #%d body hit: (%d,%d)-(%dx%d) tag:%d', [mLastQuery, mCells[idx].body.mX, mCells[idx].body.mY, mCells[idx].body.mWidth, mCells[idx].body.mHeight, mCells[idx].body.mTag]), MSG_NOTIFY);
px.mQueryMark := mLastQuery;
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 7334c3e184c3dad142fbf51a546bb195793f4b2b..0e5dd09d1dcb1aaf2d6fd22528ae542a0c446200 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
end
else
begin
- gMapGrid.forEachInAABB(x0, y0, wdt, hgt, checker);
+ gMapGrid.forEachInAABB(x0, y0, wdt, hgt, checker, ptag);
end;
// sort and draw the list (we need to sort it, or rendering is fucked)
while gDrawPanelList.count > 0 do
end
else
begin
- gMapGrid.forEachInAABB(lightX-radius, lightY-radius, radius*2, radius*2, checker);
+ gMapGrid.forEachInAABB(lightX-radius, lightY-radius, radius*2, radius*2, checker, GridTagWallDoor);
end;
end;
end
else
begin
- result := gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
+ result := gMapGrid.forEachInAABB(X, Y, Width, Height, checker, (GridTagWallDoor or GridTagWater or GridTagAcid1 or GridTagAcid2 or GridTagStep or GridTagLift or GridTagBlockMon));
end;
end
else
texid := TEXTURE_NONE;
if gdbg_map_use_tree_coldet then
begin
- mapTree.aabbQuery(X, Y, Width, Height, checker);
+ mapTree.aabbQuery(X, Y, Width, Height, checker, (GridTagWater or GridTagAcid1 or GridTagAcid2));
{
cctype1 := cctype;
texid1 := texid;
end
else
begin
- gMapGrid.forEachInAABB(X, Y, Width, Height, checker);
+ gMapGrid.forEachInAABB(X, Y, Width, Height, checker, (GridTagWater or GridTagAcid1 or GridTagAcid2));
end;
result := texid;
end