diff --git a/src/game/g_weapons.pas b/src/game/g_weapons.pas
index 5f3f99a2565ec8ec56a67399680ed9ac866071df..3b1330170a988940f5d158494d4972a722faff6d 100644 (file)
--- a/src/game/g_weapons.pas
+++ b/src/game/g_weapons.pas
-(* Copyright (C) DooM 2D:Forever Developers
+(* Copyright (C) Doom 2D: Forever Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
interface
uses
- SysUtils, Classes,
+ SysUtils, Classes, mempool,
g_textures, g_basic, e_graphics, g_phys, xprofiler;
end;
end;
- function sqchecker (mon: TMonster; tag: Integer): Boolean;
+ procedure sqchecker (mon: TMonster);
var
mx, my, mw, mh: Integer;
inx, iny: Integer;
distSq: Integer;
begin
- result := false; // don't stop
mon.getMapBox(mx, my, mw, mh);
if lineAABBIntersects(x0, y0, x2, y2, mx, my, mw, mh, inx, iny) then
begin
{$IF DEFINED(D2F_DEBUG)}
stt: UInt64;
{$ENDIF}
+ mit: PMonster;
+ it: TMonsterGrid.Iter;
begin
(*
if not gwep_debug_fast_trace then
if playerPossibleHit() then exit; // instant hit
// collect monsters
- g_Mons_AlongLine(x, y, x2, y2, sqchecker);
+ //g_Mons_AlongLine(x, y, x2, y2, sqchecker);
+
+ it := monsGrid.forEachAlongLine(x, y, x2, y2, -1);
+ for mit in it do sqchecker(mit^);
+ it.release();
// here, we collected all monsters and players in `wgunHitHeap` and `wgunHitTime`
// also, if `wallWasHit` is `true`, then `wallHitX` and `wallHitY` contains spark coords