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>
Fri, 9 Jun 2023 07:44:30 +0000 (10:44 +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 3c9358437420da1083560e34d4f695c684402c36..c5061d3d64f3237b026ac1027142515d8dd23972 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 4ef072c7d07df7b3e04b7b2332d223134eaf0e15..85f85894e86ff92a0226c26257836bd0f878f519 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 3ec8c0d720ea4e847b957b6ccff292e22b601b28..325646980cdf833a5e4a52d613ebaeab7a22a40a 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 ca7a64a395d3140d7f6427ef1b39a67967e7129f..b706e7cc274d9252d06fd5c57ad9c6a1c4c6a874 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 7491b72848e5d6527391bfe7ee0c527ccaa4c935..fd336edb334710dc45ca6db6b252d1d38a369628 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 711ecc0ab42e4f9121cb304d9950360f94179729..d55b6bbc27ff7d46dcfc4d36af16fee8314ecaf6 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 3a0d9d906604bdece89f9ad072aec37ec173490e..7f7a459f36b81ee71918e293059f5f2abc9f3861 100644 (file)
@@ -284,8 +284,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 0370927c4524a59a2af59295e97d330535a79b9a..756b37bba5de6ec21fbe05955264a2b75846e5f7 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 991995d9c61392a30b744e3bc71e44b36af3da3f..ef03b2da7f7bfb90bef7dc7bef2a96f66aa8ec88 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 eed9df907f484bceb2b6ff27c27c13bb573fc70c..1c26b0299138aa423571210d70c898f5420aabcf 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 43682f8cc5eaf61c5e53bfecf4e15c8fa17b1e6f..c3c75666ac2e867c8644b9bc3e1ceeeecd6607f4 100644 (file)
@@ -28,7 +28,7 @@ implementation
     {$INCLUDE ../nogl/noGLuses.inc}
     SysUtils, Classes, Math, utils,
     r_graphics,
-    g_basic, g_textures, g_game
+    g_base, g_basic, g_textures, g_game
   ;
 
   procedure Panel_Lerp (p: TPanel; t: Single; out tX, tY, tW, tH: Integer);
index e143227b3592a3a5f3d0815bfb3d42ec6a919b05..b9ff8bb8416099d488c03a3c22cc39cfa4db17f2 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
   ;