From: Ketmar Dark Date: Mon, 21 Aug 2017 20:17:26 +0000 (+0300) Subject: better wall tracer X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=6a553cae9dbb5171d17826cfd19dd0a0b7c0ed8c;p=d2df-sdl.git better wall tracer --- diff --git a/src/game/z_aabbtree.pas b/src/game/z_aabbtree.pas index 7220653..88c7b88 100644 --- a/src/game/z_aabbtree.pas +++ b/src/game/z_aabbtree.pas @@ -318,7 +318,7 @@ type function aabbQuery (ax, ay, aw, ah: TreeNumber; cb: TQueryOverlapCB; tagmask: Integer=-1): TTreeFlesh; function pointQuery (ax, ay: TreeNumber; cb: TQueryOverlapCB; tagmask: Integer=-1): TTreeFlesh; - function segmentQuery (out qr: TSegmentQueryResult; ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean; + function segmentQuery (out qr: TSegmentQueryResult; const ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean; function computeTreeHeight (): Integer; // compute the height of the tree @@ -1749,7 +1749,7 @@ end; // segment querying method -function TDynAABBTreeBase.segmentQuery (out qr: TSegmentQueryResult; ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean; +function TDynAABBTreeBase.segmentQuery (out qr: TSegmentQueryResult; const ax, ay, bx, by: TreeNumber; cb: TSegQueryCallback; tagmask: Integer=-1): Boolean; var oldcurax, oldcuray: Single; oldcurbx, oldcurby: Single; @@ -1807,7 +1807,15 @@ begin diry := olddiry; traceRay := oldray; - result := qr.valid; + if qr.valid and (qr.time <= (bx-ax)*(bx-ax)+(by-ay)*(by-ay)) then + begin + result := true; + end + else + begin + result := false; + qr.flesh := nil; + end; end;