index 4a20c4853a01e09aa08920b90785922338a355d9..9f395fdde5dc474ab1ef27649f64d3b6ea88eaef 100644 (file)
--- a/src/game/g_monsters.pas
+++ b/src/game/g_monsters.pas
public
FNoRespawn: Boolean;
FFireTime: Integer;
+ trapCheckFrameId: DWord; // for `g_weapons.CheckTrap()`
constructor Create(MonsterType: Byte; aID: Integer; ForcedUID: Integer = -1);
destructor Destroy(); override;
function g_Mons_ForEachAt (x, y: Integer; width, height: Integer; cb: TEachMonsterCB): Boolean;
function g_Mons_ForEachAtAlive (x, y: Integer; width, height: Integer; cb: TEachMonsterCB): Boolean;
+function g_Mons_getNewTrapFrameId (): DWord;
+
var
gmon_debug_use_sqaccel: Boolean = true;
g_language, g_netmsg, z_aabbtree;
+// ////////////////////////////////////////////////////////////////////////// //
+var
+ monCheckTrapLastFrameId: DWord;
+
+
// ////////////////////////////////////////////////////////////////////////// //
type
TDynAABBTreeMonsBase = specialize TDynAABBTreeBase<TMonster>;
end;
+function g_Mons_getNewTrapFrameId (): DWord;
+var
+ f: Integer;
+begin
+ Inc(monCheckTrapLastFrameId);
+ if monCheckTrapLastFrameId = 0 then
+ begin
+ // wraparound
+ monCheckTrapLastFrameId := 1;
+ for f := 0 to High(gMonsters) do
+ begin
+ if (gMonsters[f] <> nil) then gMonsters[f].trapCheckFrameId := 0;
+ end;
+ end;
+ result := monCheckTrapLastFrameId;
+end;
+
+
var
pt_x: Integer = 0;
pt_xs: Integer = 1;
monsTree := TDynAABBTreeMons.Create();
clearUidMap();
+ monCheckTrapLastFrameId := 0;
end;
procedure g_Monsters_FreeData();
monsTree.reset();
gMonsters := nil;
clearUidMap();
+ monCheckTrapLastFrameId := 0;
end;
function g_Monsters_Create(MonsterType: Byte; X, Y: Integer;
treeNode := -1;
arrIdx := -1;
+ trapCheckFrameId := 0;
if FMonsterType in [MONSTER_ROBO, MONSTER_BARREL] then
FBloodKind := BLOOD_SPARKS