DEADSOFTWARE

render: remove from render some common types
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Tue, 8 Jun 2021 11:22:49 +0000 (14:22 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Tue, 29 Jun 2021 09:51:11 +0000 (12:51 +0300)
23 files changed:
src/game/Doom2DF.lpr
src/game/g_base.pas [new file with mode: 0644]
src/game/g_game.pas
src/game/g_gui.pas
src/game/g_map.pas
src/game/g_menu.pas
src/game/g_monsters.pas
src/game/g_netmsg.pas
src/game/g_phys.pas
src/game/g_player.pas
src/game/g_playermodel.pas
src/game/g_textures.pas
src/game/opengl/r_console.pas
src/game/opengl/r_game.pas
src/game/opengl/r_gfx.pas
src/game/opengl/r_graphics.pas
src/game/opengl/r_items.pas
src/game/opengl/r_map.pas
src/game/opengl/r_monsters.pas
src/game/opengl/r_panel.pas
src/game/opengl/r_player.pas
src/game/opengl/r_playermodel.pas
src/game/opengl/r_weapons.pas

index c5854789fedc0b0b23b3ebe9038a47af4c45a331..0434ce285b0f3a831c3a7852af6ab692603d3817 100644 (file)
@@ -113,6 +113,7 @@ uses
   wadreader in '../shared/wadreader.pas',
   MAPDEF in '../shared/MAPDEF.pas',
   CONFIG in '../shared/CONFIG.pas',
+  g_base in 'g_base.pas',
   g_basic in 'g_basic.pas',
   g_console in 'g_console.pas',
   g_net in 'g_net.pas',
diff --git a/src/game/g_base.pas b/src/game/g_base.pas
new file mode 100644 (file)
index 0000000..238d69e
--- /dev/null
@@ -0,0 +1,85 @@
+(* 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
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$INCLUDE ../shared/a_modes.inc}
+unit g_base;
+
+interface
+
+  type
+    TMirrorType = (None, Horizontal, Vertical);
+    TBlending = (None, Blend, Filter, Invert);
+
+    TPoint2i = record
+      X, Y: Integer;
+    end;
+
+    TPoint2f = record
+      X, Y: Double;
+    end;
+
+    TRect = record
+      Left, Top, Right, Bottom: Integer;
+    end;
+
+    TRectWH = record
+      X, Y: Integer;
+      Width, Height: Word;
+    end;
+
+    TRGB = packed record
+      R, G, B: Byte;
+    end;
+
+    PPoint2f = ^TPoint2f;
+    PRect = ^TRect;
+    PRectWH = ^TRectWH;
+
+  function _RGB (Red, Green, Blue: Byte): TRGB;
+  function _Point (X, Y: Integer): TPoint2i;
+  function _Rect (X, Y: Integer; Width, Height: Word): TRectWH;
+  function _TRect (L, T, R, B: LongInt): TRect;
+
+implementation
+
+  function _RGB (Red, Green, Blue: Byte): TRGB;
+  begin
+    Result.R := Red;
+    Result.G := Green;
+    Result.B := Blue;
+  end;
+
+  function _Point (X, Y: Integer): TPoint2i;
+  begin
+    Result.X := X;
+    Result.Y := Y;
+  end;
+
+  function _Rect (X, Y: Integer; Width, Height: Word): TRectWH;
+  begin
+    Result.X := X;
+    Result.Y := Y;
+    Result.Width := Width;
+    Result.Height := Height;
+  end;
+
+  function _TRect (L, T, R, B: LongInt): TRect;
+  begin
+    Result.Top := T;
+    Result.Left := L;
+    Result.Right := R;
+    Result.Bottom := B;
+  end;
+
+end.
index 4c0871cadee413d049215045122de52313e69251..534dfeafc800978a0a460ea8169c00400e55c692 100644 (file)
@@ -20,7 +20,7 @@ interface
 uses
   SysUtils, Classes,
   MAPDEF,
-  g_basic, g_player, r_graphics, g_res_downloader,
+  g_base, g_basic, g_player, r_graphics, g_res_downloader,
   g_sound, g_gui, utils, md5, mempool, xprofiler,
   g_touch, g_weapons;
 
index 1acdf1b537781e92be4b3edf5eaf214c82b9d810..8e45c5df9e5cfee2c55dff8928cb1dbdfdbf08e8 100644 (file)
@@ -19,7 +19,7 @@ interface
 
 uses
   {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
-  r_graphics, e_input, e_log, g_playermodel, g_basic, g_touch, MAPDEF, utils;
+  g_base, r_graphics, e_input, e_log, g_playermodel, g_basic, g_touch, MAPDEF, utils;
 
 const
   MAINMENU_HEADER_COLOR: TRGB = (R:255; G:255; B:255);
index 9459c10a158f0c9715fad5bf90bd88ab8d655850..a6e1dabcd1e197b05ed9b19e2a1f867dae033410 100644 (file)
@@ -20,7 +20,7 @@ interface
 
 uses
   SysUtils, Classes, mempool,
-  r_graphics, g_basic, MAPDEF, g_textures,
+  g_base, r_graphics, g_basic, MAPDEF, g_textures,
   g_phys, utils, g_panel, g_grid, md5, binheap, xprofiler, xparser, xdynrec;
 
 type
index c086cb028e0ec05fa93cd00f126a996498d0d306..4ae82a20b1e19aceb1220905de7a8e292b8a933c 100644 (file)
@@ -44,7 +44,7 @@ implementation
 
 uses
   g_gui, g_textures, r_graphics, g_main, g_window, g_game, g_map,
-  g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
+  g_base, g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons,
   e_log, SysUtils, CONFIG, g_playermodel, DateUtils,
   MAPDEF, Math, g_saveload,
   e_texture, g_language, e_res,
index 13ab23ee0ccdf57421a7af06f9b0caf8b0f5637f..f858d122dd8e8680a85b0ac52a1bdfba90f8b83e 100644 (file)
@@ -23,7 +23,7 @@ uses
   SysUtils, Classes,
   mempool,
   MAPDEF,
-  g_basic, r_graphics, g_phys, g_textures, g_grid,
+  g_base, g_basic, g_phys, g_textures, g_grid,
   g_saveload, g_panel, xprofiler;
 
 const
index 772bda821f9b8798c0474fefb23373dc328b94d4..b5edf0afdcfcc5950293be410d82d0f7b35eb202 100644 (file)
@@ -276,8 +276,8 @@ function IsValidFilePath(const S: String): Boolean;
 implementation
 
 uses
-  Math, ENet, e_input, r_graphics, e_log,
-  g_textures, g_gfx, g_sound, g_console, g_basic, g_options, g_main,
+  Math, ENet, e_input, e_log, g_base, g_basic,
+  g_textures, g_gfx, g_sound, g_console, g_options, g_main,
   g_game, g_player, g_map, g_panel, g_items, g_weapons, g_phys, g_gui,
   g_language, g_monsters, g_netmaster, utils, wadreader, MAPDEF;
 
index 81bdb78d6b095492405bb06c4afaf4d9601749d4..69199797b06237a4ac9023f44ced5fc1868a4ad2 100644 (file)
@@ -17,8 +17,7 @@ unit g_phys;
 
 interface
 
-uses
-  r_graphics;
+  uses g_base;
 
 type
   PObj = ^TObj;
index 551b9c6ab89c90cf3eabfb9a27ae8fc4f39001e4..e2e9e97e645187117633e7b6d47fbeb930d41eeb 100644 (file)
@@ -21,7 +21,7 @@ interface
 uses
   SysUtils, Classes,
   {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
-  r_graphics, g_playermodel, g_basic, g_textures,
+  g_base, g_playermodel, g_basic, g_textures,
   g_weapons, g_phys, g_sound, g_saveload, MAPDEF,
   g_panel;
 
index a436aa180900c31cc07081c75fd3dd775a08670f..9b018cb216d53d5dc161702bace1ed287250be0f 100644 (file)
@@ -19,7 +19,7 @@ unit g_playermodel;
 interface
 
 uses
-  MAPDEF, g_textures, g_basic, g_weapons, r_graphics, utils, g_gfx,
+  MAPDEF, g_textures, g_base, g_basic, g_weapons, r_graphics, utils, g_gfx,
   ImagingTypes, Imaging, ImagingUtility;
 
 const
index b8ebfa0f563d55374148ba1d46bf9da1b866b17c..6417fa9363e9c9de5458dd57564c0017090fe997 100644 (file)
@@ -20,7 +20,7 @@ interface
 uses
   SysUtils, Classes,
   {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
-  r_graphics, MAPDEF, ImagingTypes, Imaging, ImagingUtility;
+  g_base, r_graphics, MAPDEF, ImagingTypes, Imaging, ImagingUtility;
 
 type
   TLevelTexture = record
index 3904841477767136a783c87fc544120aa18a5072..e7a0b6a81e28522ef7b1c2e9e6c3f64998629065 100644 (file)
@@ -27,7 +27,7 @@ implementation
     SysUtils, Classes, Math,
     e_log, r_graphics,
     conbuf,
-    g_main, g_console, g_game, g_menu, g_textures
+    g_base, g_main, g_console, g_game, g_menu, g_textures
   ;
 
 (* ====== Console ====== *)
index ca85e9e806aa6bd8539dcd9b89cdf06c5f332e5e..6260d48e18b0b114a422597a6ab0c21c50023d7e 100644 (file)
@@ -29,7 +29,7 @@ implementation
     g_holmes,
 {$ENDIF}
     SysUtils, Classes, Math,
-    r_graphics,
+    g_base, r_graphics,
     g_system, g_touch,
     MAPDEF, xprofiler, utils, wadreader,
     g_textures, e_input, e_sound,
index f15a802c93d4751d5c50e8540eb165318ac16217..955bdec20c6554ff098df35bc54bb2c7c358b3ca 100644 (file)
@@ -25,7 +25,7 @@ implementation
     {$INCLUDE ../nogl/noGLuses.inc}
     SysUtils, Classes, Math,
     utils,
-    r_graphics,
+    g_base, r_graphics,
     g_game,
     g_gfx
   ;
index b16bd6fc010d074b8c89cb60be6b5bb5851e5297..5bd4aee4f8a610310a43142106f3f6ce6dc7eac2 100644 (file)
@@ -22,39 +22,11 @@ uses
   {$IFDEF USE_SDL2}
     SDL2,
   {$ENDIF}
-  SysUtils, Classes, Math, e_log, e_texture,
+  SysUtils, Classes, Math, e_log, e_texture, g_base,
   MAPDEF, ImagingTypes, Imaging, ImagingUtility;
 
 type
-  TMirrorType=(None, Horizontal, Vertical);
-  TBlending=(None, Blend, Filter, Invert);
-
-  TPoint2i = record
-    X, Y: Integer;
-  end;
-
-  TPoint2f = record
-    X, Y: Double;
-  end;
-
-  TRect = record
-    Left, Top, Right, Bottom: Integer;
-  end;
-
-  TRectWH = record
-   X, Y: Integer;
-   Width, Height: Word;
-  end;
-
-  TRGB = packed record
-   R, G, B: Byte;
-  end;
-
   PDFPoint = ^TDFPoint;
-  PPoint2f = ^TPoint2f;
-  PRect = ^TRect;
-  PRectWH = ^TRectWH;
-
 
 //------------------------------------------------------------------
 // прототипы функций
@@ -143,11 +115,6 @@ procedure e_SetGamma(win: PSDL_Window;Gamma: Byte);
 
 procedure e_MakeScreenshot(st: TStream; Width, Height: Word);
 
-function _RGB(Red, Green, Blue: Byte): TRGB;
-function _Point(X, Y: Integer): TPoint2i;
-function _Rect(X, Y: Integer; Width, Height: Word): TRectWH;
-function _TRect(L, T, R, B: LongInt): TRect;
-
 //function e_getTextGLId (ID: DWORD): GLuint;
 
 var
@@ -1943,36 +1910,6 @@ begin
  e_TextureFonts := nil;
 end;
 
-function _RGB(Red, Green, Blue: Byte): TRGB;
-begin
- Result.R := Red;
- Result.G := Green;
- Result.B := Blue;
-end;
-
-function _Point(X, Y: Integer): TPoint2i;
-begin
- Result.X := X;
- Result.Y := Y;
-end;
-
-function _Rect(X, Y: Integer; Width, Height: Word): TRectWH;
-begin
- Result.X := X;
- Result.Y := Y;
- Result.Width := Width;
- Result.Height := Height;
-end;
-
-function _TRect(L, T, R, B: LongInt): TRect;
-begin
- Result.Top := T;
- Result.Left := L;
- Result.Right := R;
- Result.Bottom := B;
-end;
-
-
 procedure e_MakeScreenshot (st: TStream; Width, Height: Word);
 var
   pixels, obuf, scln, ps, pd: PByte;
index 19599f006a29d27abe49a1b4854913ec8fb61554..6e3dfee703f939d272ffa52604a0c3a1bd005d5d 100644 (file)
@@ -26,7 +26,7 @@ implementation
     SysUtils, Classes, Math,
     r_graphics,
     MAPDEF,
-    g_basic, g_game,
+    g_base, g_basic, g_game,
     g_items
   ;
 
index 12f31371628ff386ac1f7ad95b2ae9866a331d6a..ef75c14c223452db1e12a37d1c66411b552b21aa 100644 (file)
@@ -31,7 +31,7 @@ implementation
     {$INCLUDE ../nogl/noGLuses.inc}
     SysUtils, Classes, Math,
     r_graphics,
-    g_basic, g_game, g_options,
+    g_base, g_basic, g_game, g_options,
     g_panel, g_map,
     r_panel
   ;
index 9d65d477f04cea2c9d9cca83e902a329a77eca48..45f8dd33d17427a2bb1e375d330d18a9eb2bff35 100644 (file)
@@ -26,7 +26,7 @@ implementation
     SysUtils, Classes, Math,
     r_graphics,
     MAPDEF,
-    g_basic, g_game, g_phys,
+    g_base, g_basic, g_game, g_phys,
     g_monsters
   ;
 
index a2ba6e0a89323a3c34409c05a59a81538d1da96d..e9d92de45f9c9788b8b492bc563835b92738c7dd 100644 (file)
@@ -28,7 +28,7 @@ implementation
     {$INCLUDE ../nogl/noGLuses.inc}
     SysUtils, Classes, Math,
     r_graphics,
-    g_basic, g_textures
+    g_base, g_basic, g_textures
   ;
 
   // TODO: remove WITH operator
index 96dfa92ec0bf190fe7253747399a1948f254b93e..bb25f29eebfb6c6eec199fd8e812c5072d910c06 100644 (file)
@@ -17,7 +17,7 @@ unit r_player;
 
 interface
 
-  uses g_player, r_graphics; // TPlayer, TRGB
+  uses g_player, g_base; // TPlayer, TRGB
 
   procedure r_Player_DrawAll;
   procedure r_Player_DrawDebug (p: TPlayer);
@@ -46,7 +46,7 @@ implementation
 {$IFDEF ENABLE_HOLMES}
     g_holmes,
 {$ENDIF}
-    r_playermodel
+    r_playermodel, r_graphics
   ;
 
   procedure r_Player_DrawAll;
index b11ac28b3f49b9bdaa445a72c02f47ac72606916..9b0f244eed5d4ea446a524f161f5b1386125f1a4 100644 (file)
@@ -29,7 +29,7 @@ implementation
     SysUtils, Classes, Math,
     MAPDEF,
     r_graphics,
-    g_basic, g_map, g_weapons, g_textures, g_main
+    g_base, g_basic, g_map, g_weapons, g_textures, g_main
   ;
 
   const
index 974d744fcdc8beecf68c10a58267c333e8b2596e..38882f1689a78935f91b9ba909207e534fa72629 100644 (file)
@@ -25,7 +25,7 @@ implementation
     SysUtils, Classes, Math,
     MAPDEF,
     r_graphics,
-    g_basic, g_game,
+    g_base, g_basic, g_game,
     g_weapons
   ;