From 56ec1dee6d63a32353f94eac7e87d6a42b801a25 Mon Sep 17 00:00:00 2001 From: Ketmar Dark Date: Sun, 24 Sep 2017 12:49:02 +0300 Subject: [PATCH] mempool is optional now --- src/engine/e_sound_fmod.inc | 4 ++-- src/engine/e_sound_sdl.inc | 4 ++-- src/game/g_grid.pas | 4 +++- src/game/g_gui.pas | 8 ++++---- src/game/g_holmes.pas | 2 +- src/game/g_monsters.pas | 4 ++-- src/game/g_player.pas | 6 +++--- src/game/g_playermodel.pas | 4 ++-- src/game/g_textures.pas | 4 ++-- src/shared/CONFIG.pas | 10 +++------- src/shared/exoma.pas | 12 +++++++----- src/shared/idpool.pas | 4 +++- src/shared/mempool.pas | 5 ++++- src/shared/wadreader.pas | 5 +++-- src/shared/xdynrec.pas | 11 ++++++----- src/shared/xparser.pas | 4 ++-- 16 files changed, 49 insertions(+), 42 deletions(-) diff --git a/src/engine/e_sound_fmod.inc b/src/engine/e_sound_fmod.inc index bb12c81..ab3f4fe 100644 --- a/src/engine/e_sound_fmod.inc +++ b/src/engine/e_sound_fmod.inc @@ -19,7 +19,7 @@ uses fmod, fmodtypes, fmoderrors, - mempool, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} e_log, SysUtils; @@ -31,7 +31,7 @@ type nRefs: Integer; end; - TBasicSound = class(TPoolObject) + TBasicSound = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FChannel: FMOD_CHANNEL; diff --git a/src/engine/e_sound_sdl.inc b/src/engine/e_sound_sdl.inc index 4d2e93d..1b8d376 100644 --- a/src/engine/e_sound_sdl.inc +++ b/src/engine/e_sound_sdl.inc @@ -18,7 +18,7 @@ interface uses sdl2, SDL2_mixer, - mempool, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} e_log, SysUtils; @@ -31,7 +31,7 @@ type nRefs: Integer; end; - TBasicSound = class(TPoolObject) + TBasicSound = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FChanNum: Integer; // <0: no channel allocated diff --git a/src/game/g_grid.pas b/src/game/g_grid.pas index 5ef72f2..27fa615 100644 --- a/src/game/g_grid.pas +++ b/src/game/g_grid.pas @@ -26,8 +26,10 @@ unit g_grid; interface +{$IFDEF USE_MEMPOOL} uses mempool; +{$ENDIF} const GridTileSize = 32; // must be power of two! @@ -35,7 +37,7 @@ const type TBodyProxyId = Integer; - generic TBodyGridBase = class(TPoolObject) + generic TBodyGridBase = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public type TGridQueryCB = function (obj: ITP; tag: Integer): Boolean is nested; // return `true` to stop type TGridRayQueryCB = function (obj: ITP; tag: Integer; x, y, prevx, prevy: Integer): Boolean is nested; // return `true` to stop diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas index 893bdd8..35c1da4 100644 --- a/src/game/g_gui.pas +++ b/src/game/g_gui.pas @@ -19,7 +19,7 @@ unit g_gui; interface uses - mempool, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} e_graphics, e_input, e_log, g_playermodel, g_basic, MAPDEF, utils; const @@ -85,7 +85,7 @@ type TFontType = (Texture, Character); - TFont = class(TPoolObject) + TFont = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private ID: DWORD; FScale: Single; @@ -109,7 +109,7 @@ type TOnChangeEvent = procedure(Sender: TGUIControl); TOnEnterEvent = procedure(Sender: TGUIControl); - TGUIControl = class(TPoolObject) + TGUIControl = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FX, FY: Integer; FEnabled: Boolean; @@ -134,7 +134,7 @@ type property RightAlign: Boolean read FRightAlign write FRightAlign; // for menu end; - TGUIWindow = class(TPoolObject) + TGUIWindow = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FActiveControl: TGUIControl; FDefControl: string; diff --git a/src/game/g_holmes.pas b/src/game/g_holmes.pas index 3b630ab..94e6171 100644 --- a/src/game/g_holmes.pas +++ b/src/game/g_holmes.pas @@ -19,7 +19,7 @@ unit g_holmes; interface uses - mempool, geom, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} geom, e_log, e_input, g_textures, g_basic, e_graphics, g_phys, g_grid, g_player, g_monsters, g_window, g_map, g_triggers, g_items, g_game, g_panel, g_console, g_gfx, diff --git a/src/game/g_monsters.pas b/src/game/g_monsters.pas index 66ab556..175420e 100644 --- a/src/game/g_monsters.pas +++ b/src/game/g_monsters.pas @@ -22,7 +22,7 @@ interface uses SysUtils, Classes, - mempool, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} g_basic, e_graphics, g_phys, g_textures, g_grid, g_saveload, g_panel, xprofiler; @@ -50,7 +50,7 @@ const } type - TMonster = class(TPoolObject) + TMonster = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FMonsterType: Byte; FUID: Word; diff --git a/src/game/g_player.pas b/src/game/g_player.pas index b4d00c9..bcad3ca 100644 --- a/src/game/g_player.pas +++ b/src/game/g_player.pas @@ -21,7 +21,7 @@ interface uses SysUtils, Classes, - mempool, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} e_graphics, g_playermodel, g_basic, g_textures, g_weapons, g_phys, g_sound, g_saveload, MAPDEF, g_panel; @@ -135,7 +135,7 @@ type Time: Word; end; - TPlayer = class(TPoolObject) + TPlayer = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FIamBot: Boolean; FUID: Word; @@ -491,7 +491,7 @@ type procedure positionChanged (); inline; //WARNING! call this after entity position was changed, or coldet will not work right! end; - TCorpse = class(TPoolObject) + TCorpse = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FModelName: String; FMess: Boolean; diff --git a/src/game/g_playermodel.pas b/src/game/g_playermodel.pas index 4465143..ebb3915 100644 --- a/src/game/g_playermodel.pas +++ b/src/game/g_playermodel.pas @@ -20,7 +20,7 @@ unit g_playermodel; interface uses - mempool, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} MAPDEF, g_textures, g_basic, g_weapons, e_graphics, utils; const @@ -82,7 +82,7 @@ type Array [A_STAND..A_LAST] of Array [TDirection.D_LEFT..TDirection.D_RIGHT] of Array of TDFPoint; - TPlayerModel = class(TPoolObject) + TPlayerModel = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FName: String; FDirection: TDirection; diff --git a/src/game/g_textures.pas b/src/game/g_textures.pas index 6f239e4..f129b9e 100644 --- a/src/game/g_textures.pas +++ b/src/game/g_textures.pas @@ -20,7 +20,7 @@ interface uses SysUtils, Classes, - mempool, + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} e_graphics, MAPDEF, ImagingTypes, Imaging, ImagingUtility; Type @@ -37,7 +37,7 @@ Type TLevelTextureArray = Array of TLevelTexture; - TAnimation = class(TPoolObject) + TAnimation = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private ID: DWORD; FAlpha: Byte; diff --git a/src/shared/CONFIG.pas b/src/shared/CONFIG.pas index 7ecc51e..4aa7e65 100644 --- a/src/shared/CONFIG.pas +++ b/src/shared/CONFIG.pas @@ -16,16 +16,12 @@ {$INCLUDE a_modes.inc} unit CONFIG; -{ ------------------------------------ -CONFIG.PAS ÂÅÐÑÈß ÎÒ 24.09.06 ------------------------------------ -} - interface +{$IFDEF USE_MEMPOOL} uses mempool; +{$ENDIF} type TParam = record @@ -34,7 +30,7 @@ type Section: Word; end; - TConfig = class(TPoolObject) + TConfig = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private FParams: array of TParam; FSections: array of ShortString; diff --git a/src/shared/exoma.pas b/src/shared/exoma.pas index ffa11a9..6b6c12d 100644 --- a/src/shared/exoma.pas +++ b/src/shared/exoma.pas @@ -19,7 +19,9 @@ unit exoma; interface uses - typinfo, SysUtils, Variants, mempool, hashtable, xparser; + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} + typinfo, SysUtils, Variants, + hashtable, xparser; // ////////////////////////////////////////////////////////////////////////// // @@ -41,7 +43,7 @@ type // ////////////////////////////////////////////////////////////////////////// // type - TPropHash = class(TPoolObject) + TPropHash = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private mClass: TClass; mNames: THashStrInt; @@ -59,7 +61,7 @@ type // ////////////////////////////////////////////////////////////////////////// // type - TExprConstList = class(TPoolObject) + TExprConstList = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public function valid (const cname: AnsiString): Boolean; virtual; abstract; function get (const cname: AnsiString; out v: Variant): Boolean; virtual; abstract; @@ -68,7 +70,7 @@ type // ////////////////////////////////////////////////////////////////////////// // type - TExprScope = class(TPoolObject) + TExprScope = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public class procedure error (const amsg: AnsiString); class procedure errorfmt (const afmt: AnsiString; const args: array of const); @@ -78,7 +80,7 @@ type procedure setField (obj: TObject; const afldname: AnsiString; var aval: Variant); virtual; end; - TExprBase = class(TPoolObject) + TExprBase = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public class function coerce2bool (var v0: Variant): Boolean; class function toInt (var v: Variant): LongInt; diff --git a/src/shared/idpool.pas b/src/shared/idpool.pas index 4722be8..9e0a012 100644 --- a/src/shared/idpool.pas +++ b/src/shared/idpool.pas @@ -19,14 +19,16 @@ unit idpool; interface +{$IFDEF USE_MEMPOOL} uses mempool; +{$ENDIF} // ////////////////////////////////////////////////////////////////////////// // type //TODO: implement getting n sequential ids - TIdPool = class(TPoolObject) + TIdPool = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public const InvalidId = $ffffffff; diff --git a/src/shared/mempool.pas b/src/shared/mempool.pas index 0ca3f2f..37527dd 100644 --- a/src/shared/mempool.pas +++ b/src/shared/mempool.pas @@ -19,6 +19,7 @@ unit mempool; interface +{$IFDEF USE_MEMPOOL} uses SysUtils; @@ -56,10 +57,11 @@ type public procedure FreeInstance (); override; {$ENDIF} end; - +{$ENDIF} implementation +{$IFDEF USE_MEMPOOL} uses hashtable; @@ -189,4 +191,5 @@ finalization {$IF DEFINED(D2F_DEBUG) and NOT DEFINED(MEM_DISABLE_ACCOUNTING)} dumpPools(); {$ENDIF} +{$ENDIF} // USE_MEMPOOL end. diff --git a/src/shared/wadreader.pas b/src/shared/wadreader.pas index 818e912..09bb503 100644 --- a/src/shared/wadreader.pas +++ b/src/shared/wadreader.pas @@ -23,11 +23,12 @@ interface uses Classes, - mempool, sfs, xstreams, utils; + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} + sfs, xstreams, utils; type - TWADFile = class(TPoolObject) + TWADFile = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private fFileName: AnsiString; // empty: not opened fIter: TSFSFileList; diff --git a/src/shared/xdynrec.pas b/src/shared/xdynrec.pas index 12d99d0..7d1098e 100644 --- a/src/shared/xdynrec.pas +++ b/src/shared/xdynrec.pas @@ -21,7 +21,8 @@ interface uses SysUtils, Variants, Classes, - xparser, xstreams, utils, hashtable, mempool; + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} + xparser, xstreams, utils, hashtable; // ////////////////////////////////////////////////////////////////////////// // @@ -54,7 +55,7 @@ type TDynEBSList = specialize TSimpleList; // this is base type for all scalars (and arrays) - TDynField = class(TPoolObject) + TDynField = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public type TType = (TBool, TChar, TByte, TUByte, TShort, TUShort, TInt, TUInt, TString, TPoint, TSize, TColor, TList, TTrigData); @@ -238,7 +239,7 @@ type // record, either with actual values, or with type definitions - TDynRecord = class(TPoolObject) + TDynRecord = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private mOwner: TDynMapDef; mId: AnsiString; @@ -375,7 +376,7 @@ type // bitset/enum definition - TDynEBS = class(TPoolObject) + TDynEBS = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private mOwner: TDynMapDef; mIsEnum: Boolean; @@ -420,7 +421,7 @@ type // parsed "mapdef.txt" - TDynMapDef = class(TPoolObject) + TDynMapDef = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public recTypes: TDynRecList; // [0] is always header trigTypes: TDynRecList; // trigdata diff --git a/src/shared/xparser.pas b/src/shared/xparser.pas index 6ecf7f0..7d7a9ed 100644 --- a/src/shared/xparser.pas +++ b/src/shared/xparser.pas @@ -20,12 +20,12 @@ unit xparser; interface uses - Classes, mempool; + Classes{$IFDEF USE_MEMPOOL}, mempool{$ENDIF}; // ////////////////////////////////////////////////////////////////////////// // type - TTextParser = class(TPoolObject) + TTextParser = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public const TTNone = -1; -- 2.29.2