DEADSOFTWARE

render: use only r_render to access render
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Mon, 17 Jan 2022 18:44:14 +0000 (21:44 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 9 Jun 2023 07:54:15 +0000 (10:54 +0300)
13 files changed:
src/game/g_game.pas
src/game/g_gfx.pas
src/game/g_items.pas
src/game/g_monsters.pas
src/game/g_netmsg.pas
src/game/g_player.pas
src/game/g_triggers.pas
src/game/g_weapons.pas
src/game/g_window.pas
src/game/opengl/r_game.pas
src/game/opengl/r_gfx.pas
src/game/opengl/r_monsters.pas
src/game/opengl/r_render.pas

index 473ca90984b1dc77a3cc2c7ca0f0bcc42a753466..36c4899c44cd7485ad9aeac72398a200ebfa2db2 100644 (file)
@@ -130,7 +130,9 @@ procedure g_Game_Announce_KillCombo(Param: Integer);
 procedure g_Game_Announce_BodyKill(SpawnerUID: Word);
 procedure g_Game_StartVote(Command, Initiator: string);
 procedure g_Game_CheckVote;
-procedure g_TakeScreenShot(Filename: string = '');
+{$IFNDEF HEADLESS}
+  procedure g_TakeScreenShot(Filename: string = '');
+{$ENDIF}
 procedure g_FatalError(Text: String);
 procedure g_SimpleError(Text: String);
 function  g_Game_IsTestMap(): Boolean;
@@ -443,11 +445,14 @@ function gPause (): Boolean; inline;
 implementation
 
 uses
-{$IFDEF ENABLE_HOLMES}
-  g_holmes,
-{$ENDIF}
-  e_res, g_window, g_menu, r_render, r_gfx,
-  e_input, e_log, g_console, r_console, g_items, g_map, g_panel,
+  {$IFDEF ENABLE_HOLMES}
+    g_holmes,
+  {$ENDIF}
+  {$IFNDEF HEADLESS}
+    r_render,
+  {$ENDIF}
+  e_res, g_window, g_menu,
+  e_input, e_log, g_console, g_items, g_map, g_panel,
   g_playermodel, g_gfx, g_options, Math,
   g_triggers, g_monsters, e_sound, CONFIG,
   g_language, g_net, g_phys,
@@ -1756,7 +1761,6 @@ begin
   // no need to, as we'll do it in event handler
 
 // Обновляем консоль (движение и сообщения):
-  r_Console_Update;
   g_Console_Update();
 
   if (NetMode = NET_NONE) and (g_Game_IsNet) and (gGameOn or (gState in [STATE_FOLD, STATE_INTERCUSTOM])) then
@@ -2153,7 +2157,6 @@ begin
     g_Weapon_Update();
     g_Monsters_Update();
     g_GFX_Update();
-    r_GFX_Update;
     g_Player_UpdateAll();
     g_Player_UpdatePhysicalObjects();
 
@@ -2264,8 +2267,10 @@ begin
   // Нужно сменить разрешение:
     if gResolutionChange then
     begin
-      e_WriteLog('Changing resolution', TMsgType.Notify);
-      r_Render_Apply;
+      {$IFNDEF HEADLESS}
+        e_WriteLog('Changing resolution', TMsgType.Notify);
+        r_Render_Apply;
+      {$ENDIF}
       gResolutionChange := False;
       g_ActiveWindow := nil;
     end;
@@ -3358,7 +3363,9 @@ begin
   begin
     //result := g_Map_Load(gGameSettings.WAD + ':\' + ResName);
     result := g_Map_Load(NewWAD+':\'+ResName);
-    r_Render_LoadTextures;
+    {$IFNDEF HEADLESS}
+      r_Render_LoadTextures;
+    {$ENDIF}
   end;
   if Result then
     begin
@@ -5783,7 +5790,9 @@ begin
   end
   else if cmd = 'screenshot' then
   begin
-    g_TakeScreenShot()
+    {$IFNDEF HEADLESS}
+      g_TakeScreenShot()
+    {$ENDIF}
   end
   else if (cmd = 'weapnext') or (cmd = 'weapprev') then
   begin
@@ -6067,8 +6076,10 @@ begin
         g_Game_Free();
         g_Game_Quit();
       end;
+{$IFNDEF HEADLESS}
     'r_reset':
-       r_Render_Apply;
+         r_Render_Apply;
+{$ENDIF}
     'r_maxfps':
       begin
         if Length(p) = 2 then
@@ -6114,6 +6125,7 @@ begin
   end;
 end;
 
+{$IFNDEF HEADLESS}
 procedure g_TakeScreenShot(Filename: string = '');
   var t: TDateTime; dir, date, name: String;
 begin
@@ -6134,6 +6146,7 @@ begin
   else
     g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [name]));
 end;
+{$ENDIF}
 
 procedure g_Game_InGameMenu(Show: Boolean);
 begin
index 00630f3f5fa20b7677214c601e27b36ee4c0dc3c..d0bf54b182c1657158b93f0f0c469d74222d9cfe 100644 (file)
@@ -28,9 +28,6 @@ const
   BLOOD_CSPARKS = 2;
   BLOOD_COMBINE = 3;
 
-  ONCEANIM_NONE  = 0;
-  ONCEANIM_SMOKE = 1;
-
   MARK_FREE     = 0;
   MARK_WALL     = 1;
   MARK_WATER    = 2;
@@ -44,6 +41,30 @@ const
   MARK_LIQUID   = MARK_WATER or MARK_ACID;
   MARK_LIFT     = MARK_LIFTDOWN or MARK_LIFTUP or MARK_LIFTLEFT or MARK_LIFTRIGHT;
 
+  R_GFX_NONE = 0;
+  R_GFX_TELEPORT = 1;
+  R_GFX_FLAME = 2;
+  R_GFX_EXPLODE_ROCKET = 3;
+  R_GFX_EXPLODE_BFG = 4;
+  R_GFX_BFG_HIT = 5;
+  R_GFX_FIRE = 6;
+  R_GFX_ITEM_RESPAWN = 7;
+  R_GFX_SMOKE = 8;
+  R_GFX_EXPLODE_SKELFIRE = 9;
+  R_GFX_EXPLODE_PLASMA = 10;
+  R_GFX_EXPLODE_BSPFIRE = 11;
+  R_GFX_EXPLODE_IMPFIRE = 12;
+  R_GFX_EXPLODE_CACOFIRE = 13;
+  R_GFX_EXPLODE_BARONFIRE = 14;
+  R_GFX_TELEPORT_FAST = 15;
+  R_GFX_SMOKE_TRANS = 16;
+  R_GFX_FLAME_RAND = 17;
+  R_GFX_LAST = 17;
+
+  R_GFX_FLAME_WIDTH = 32;
+  R_GFX_FLAME_HEIGHT = 32;
+  R_GFX_SMOKE_WIDTH = 32;
+  R_GFX_SMOKE_HEIGHT = 32;
 
 procedure g_GFX_Init ();
 procedure g_GFX_Free ();
@@ -61,6 +82,8 @@ function  g_GFX_GetMax (): Integer;
 
 procedure g_Mark (x, y, Width, Height: Integer; t: Byte; st: Boolean=true);
 
+procedure g_GFX_QueueEffect (AnimType, X, Y: Integer);
+
 procedure g_GFX_Update ();
 
 var
@@ -125,6 +148,9 @@ function awmIsSetHolmes (x, y: Integer): Boolean; inline;
 implementation
 
 uses
+  {$IFNDEF HEADLESS}
+    r_render,
+  {$ENDIF}
   g_map, g_panel, g_basic, Math,
   g_options, g_console, SysUtils, g_triggers, MAPDEF,
   g_game, g_language, g_net, utils, xprofiler;
@@ -148,6 +174,12 @@ var
   awakeMapHlm: packed array of LongWord = nil;
   {$ENDIF}
 
+  procedure g_GFX_QueueEffect (AnimType, X, Y: Integer);
+  begin
+    {$IFNDEF HEADLESS}
+      r_Render_QueueEffect(AnimType, X, Y)
+    {$ENDIF}
+  end;
 
 // ////////////////////////////////////////////////////////////////////////// //
 function awmIsSetHolmes (x, y: Integer): Boolean; inline;
index 7a1fd513a1a3aebdc0b1f0a133e152f5c93c76a7..636b682b61a97f1471a33927cc8c8c0a72574932 100644 (file)
@@ -93,7 +93,7 @@ implementation
 
 uses
   Math,
-  g_basic, g_sound, g_gfx, g_map, r_gfx,
+  g_basic, g_sound, g_gfx, g_map,
   g_game, g_triggers, g_console, g_player, g_net, g_netmsg,
   e_log, g_options,
   g_grid, binheap, idpool, utils, xstreams;
@@ -509,7 +509,7 @@ begin
         if (RespawnTime = 0) and (not alive) then
         begin
           if not QuietRespawn then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', InitX, InitY);
-          r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, InitX + (Obj.Rect.Width div 2) - 16, InitY + (Obj.Rect.Height div 2) - 16);
+          g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, InitX + (Obj.Rect.Width div 2) - 16, InitY + (Obj.Rect.Height div 2) - 16);
           Obj.oldX := InitX;
           Obj.oldY := InitY;
           Obj.X := InitX;
index b450139ee2779e5dee6dc15fb44d09c88c465074..b97e48dec90db625917302dfb22e9bd6687dc8b9 100644 (file)
@@ -521,7 +521,7 @@ var
 implementation
 
 uses
-  e_log, g_sound, g_gfx, g_player, g_game, r_gfx,
+  e_log, g_sound, g_gfx, g_player, g_game,
   g_weapons, g_triggers, g_items, g_options,
   g_console, g_map, Math, g_menu, wadreader,
   g_language, g_netmsg, idpool, utils, xstreams;
@@ -1984,7 +1984,7 @@ begin
   if not silent then
   begin
     g_Sound_PlayExAt('SOUND_GAME_TELEPORT', Obj.X, Obj.Y);
-    r_GFX_OnceAnim(
+    g_GFX_QueueEffect(
       R_GFX_TELEPORT,
       FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
       FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32
@@ -2019,7 +2019,7 @@ begin
 // Эффект телепорта в точке назначения:
   if not silent then
   begin
-    r_GFX_OnceAnim(
+    g_GFX_QueueEffect(
       R_GFX_TELEPORT,
       FObj.X+FObj.Rect.X+(FObj.Rect.Width div 2)-32,
       FObj.Y+FObj.Rect.Y+(FObj.Rect.Height div 2)-32
@@ -4297,7 +4297,7 @@ begin
   begin
     x := Obj.X + Obj.Rect.X + Random(Obj.Rect.Width + Times * 2) - (R_GFX_FLAME_WIDTH div 2);
     y := Obj.Y + 8 + Random(8 + Times * 2) + IfThen(FState = MONSTATE_DEAD, 16, 0);
-    r_GFX_OnceAnim(R_GFX_FLAME, x, y);
+    g_GFX_QueueEffect(R_GFX_FLAME, x, y);
   end;
 end;
 
index 6d4f5c1d3cb188e4a737738e00bfb1bdca804677..2e6d0a45ee71974f5f8d43704f9d960904139224 100644 (file)
@@ -284,7 +284,7 @@ function IsValidFilePath(const S: String): Boolean;
 implementation
 
 uses
-  Math, ENet, e_input, e_log, g_base, g_basic, r_gfx,
+  Math, ENet, e_input, e_log, g_base, g_basic,
   g_textures, g_gfx, g_sound, g_console, g_options,
   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;
@@ -1736,40 +1736,40 @@ begin
 
     NET_GFX_TELE:
     begin
-      r_GFX_OnceAnim(R_GFX_TELEPORT_FAST, X, Y);
+      g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X, Y);
       if Ang = 1 then
         g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y);
     end;
 
     NET_GFX_EXPLODE:
     begin
-      r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, X - 64, Y - 64);
+      g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, X - 64, Y - 64);
       if Ang = 1 then
         g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', X, Y);
     end;
 
     NET_GFX_BFGEXPL:
     begin
-      r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, X - 64, Y - 64);
+      g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, X - 64, Y - 64);
       if Ang = 1 then
         g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', X, Y);
     end;
 
     NET_GFX_BFGHIT:
     begin
-      r_GFX_OnceAnim(R_GFX_BFG_HIT, X - 32, Y - 32);
+      g_GFX_QueueEffect(R_GFX_BFG_HIT, X - 32, Y - 32);
     end;
 
     NET_GFX_FIRE:
     begin
-      r_GFX_OnceAnim(R_GFX_FIRE, X, Y);
+      g_GFX_QueueEffect(R_GFX_FIRE, X, Y);
       if Ang = 1 then
         g_Sound_PlayExAt('SOUND_FIRE', X, Y);
     end;
 
     NET_GFX_RESPAWN:
     begin
-      r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X, Y);
+      g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X, Y);
       if Ang = 1 then
         g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y);
     end;
@@ -2732,7 +2732,7 @@ begin
   if not Quiet then
   begin
     g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y);
-    r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16);
+    g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X+(it.Obj.Rect.Width div 2)-16, Y+(it.Obj.Rect.Height div 2)-16);
   end;
 end;
 
index 6aa7323bcc01b75c1632346332229302a93d6d3d..2e9afdc5cdd6052544ad63fca213083fca35c678 100644 (file)
@@ -648,10 +648,13 @@ function g_Bot_GetCount(): Integer;
 implementation
 
 uses
-{$IFDEF ENABLE_HOLMES}
-  g_holmes,
-{$ENDIF}
-  e_log, g_map, g_items, g_console, g_gfx, Math, r_playermodel, r_gfx,
+  {$IFDEF ENABLE_HOLMES}
+    g_holmes,
+  {$ENDIF}
+  {$IFNDEF HEADLESS}
+    r_render,
+  {$ENDIF}
+  e_log, g_map, g_items, g_console, g_gfx, Math,
   g_options, g_triggers, g_menu, g_game, g_grid, e_res,
   wadreader, g_monsters, CONFIG, g_language,
   g_net, g_netmsg,
@@ -1593,7 +1596,14 @@ begin
       Color := fColor;
       alive := True;
       g_Obj_Init(@Obj);
-      Obj.Rect := r_PlayerModel_GetGibRect(ModelID, GibID);
+      {$IFNDEF HEADLESS}
+        Obj.Rect := r_Render_GetGibRect(ModelID, GibID);
+      {$ELSE}
+        Obj.Rect.X := 16;
+        Obj.Rect.Y := 16;
+        Obj.Rect.Width := 16;
+        Obj.Rect.Height := 16;
+      {$ENDIF}
       Obj.X := fX - Obj.Rect.X - (Obj.Rect.Width div 2);
       Obj.Y := fY - Obj.Rect.Y - (Obj.Rect.Height div 2);
       g_Obj_PushA(@Obj, 25 + Random(10), Random(361));
@@ -3988,7 +3998,7 @@ begin
 
 // Анимация возрождения:
   if (not gLoadGameMode) and (not Silent) then
-    r_GFX_OnceAnim(
+    g_GFX_QueueEffect(
       R_GFX_TELEPORT_FAST,
       FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
       FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32
@@ -4188,7 +4198,7 @@ begin
   if not silent then
   begin
     g_Sound_PlayExAt('SOUND_GAME_TELEPORT', FObj.X, FObj.Y);
-    r_GFX_OnceAnim(
+    g_GFX_QueueEffect(
       R_GFX_TELEPORT_FAST,
       FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
       FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32
@@ -4240,7 +4250,7 @@ begin
 
   if not silent then
   begin
-    r_GFX_OnceAnim(
+    g_GFX_QueueEffect(
       R_GFX_TELEPORT_FAST,
       FObj.X+PLAYER_RECT.X+(PLAYER_RECT.Width div 2)-32,
       FObj.Y+PLAYER_RECT.Y+(PLAYER_RECT.Height div 2)-32
@@ -5742,7 +5752,7 @@ begin
 
   for i := 1 to Times do
   begin
-    r_GFX_OnceAnim(
+    g_GFX_QueueEffect(
       R_GFX_SMOKE_TRANS,
       Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_SMOKE_WIDTH div 2),
       Obj.Y+Obj.Rect.Height-4+Random(8+Times*2)
@@ -5758,7 +5768,7 @@ begin
 
   for i := 1 to Times do
   begin
-    r_GFX_OnceAnim(
+    g_GFX_QueueEffect(
       R_GFX_FLAME,
       Obj.X+Obj.Rect.X+Random(Obj.Rect.Width+Times*2)-(R_GFX_FLAME_WIDTH div 2),
       Obj.Y+8+Random(8+Times*2)
index e37dff59fe5e45d1a9507c901bc3bd2397d4a16b..b8165887c5aba2f975d77f5cfbba6cce3aa06451 100644 (file)
@@ -103,7 +103,7 @@ implementation
 
 uses
   Math,
-  g_player, g_map, g_panel, g_gfx, g_game, r_gfx,
+  g_player, g_map, g_panel, g_gfx, g_game,
   g_console, g_monsters, g_items, g_phys, g_weapons,
   wadreader, e_log, g_language, e_res,
   g_options, g_net, g_netmsg, utils, xparser, xstreams;
@@ -776,7 +776,7 @@ begin
 
     TRIGGER_SHOT_EXPL:
       begin
-        r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, wx - 64, wy - 64);
+        g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, wx - 64, wy - 64);
         Projectile := False;
         g_Weapon_Explode(wx, wy, 60, 0);
         snd := 'SOUND_WEAPON_EXPLODEROCKET';
@@ -784,7 +784,7 @@ begin
 
     TRIGGER_SHOT_BFGEXPL:
       begin
-        r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, wx - 64, wy - 64);
+        g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, wx - 64, wy - 64);
         Projectile := False;
         g_Weapon_BFG9000(wx, wy, 0);
         snd := 'SOUND_WEAPON_EXPLODEBFG';
@@ -881,17 +881,17 @@ begin
     case ST of
       EFFECT_TELEPORT: begin
         if not Silent then g_Sound_PlayExAt('SOUND_GAME_TELEPORT', X, Y);
-        r_GFX_OnceAnim(R_GFX_TELEPORT_FAST, X - 32, Y - 32);
+        g_GFX_QueueEffect(R_GFX_TELEPORT_FAST, X - 32, Y - 32);
         if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X, Y, Byte(not Silent), NET_GFX_TELE);
       end;
       EFFECT_RESPAWN: begin
         if not Silent then g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', X, Y);
-        r_GFX_OnceAnim(R_GFX_ITEM_RESPAWN, X - 16, Y - 16);
+        g_GFX_QueueEffect(R_GFX_ITEM_RESPAWN, X - 16, Y - 16);
         if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X-16, Y-16, Byte(not Silent), NET_GFX_RESPAWN);
       end;
       EFFECT_FIRE: begin
         if not Silent then g_Sound_PlayExAt('SOUND_FIRE', X, Y);
-        r_GFX_OnceAnim(R_GFX_FIRE, X - 32, Y - 128);
+        g_GFX_QueueEffect(R_GFX_FIRE, X - 32, Y - 128);
         if Send and g_Game_IsServer and g_Game_IsNet then MH_SEND_Effect(X-32, Y-128, Byte(not Silent), NET_GFX_FIRE);
       end;
     end;
@@ -1475,7 +1475,7 @@ begin
               case tgcEffect of
                 EFFECT_TELEPORT: begin
                   g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY);
-                  r_GFX_OnceAnim(
+                  g_GFX_QueueEffect(
                     R_GFX_TELEPORT_FAST,
                     mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32,
                     mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-32
@@ -1487,7 +1487,7 @@ begin
                 end;
                 EFFECT_RESPAWN: begin
                   g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY);
-                  r_GFX_OnceAnim(
+                  g_GFX_QueueEffect(
                     R_GFX_ITEM_RESPAWN,
                     mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-16,
                     mon.Obj.Y+mon.Obj.Rect.Y+(mon.Obj.Rect.Height div 2)-16
@@ -1499,7 +1499,7 @@ begin
                 end;
                 EFFECT_FIRE: begin
                   g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY);
-                  r_GFX_OnceAnim(
+                  g_GFX_QueueEffect(
                     R_GFX_FIRE,
                     mon.Obj.X+mon.Obj.Rect.X+(mon.Obj.Rect.Width div 2)-32,
                     mon.Obj.Y+mon.Obj.Rect.Y+mon.Obj.Rect.Height-128
@@ -1562,7 +1562,7 @@ begin
                   EFFECT_TELEPORT: begin
                     it := g_Items_ByIdx(iid);
                     g_Sound_PlayExAt('SOUND_GAME_TELEPORT', tgcTX, tgcTY);
-                    r_GFX_OnceAnim(
+                    g_GFX_QueueEffect(
                       R_GFX_TELEPORT_FAST,
                       it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32,
                       it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-32
@@ -1575,7 +1575,7 @@ begin
                   EFFECT_RESPAWN: begin
                     it := g_Items_ByIdx(iid);
                     g_Sound_PlayExAt('SOUND_ITEM_RESPAWNITEM', tgcTX, tgcTY);
-                    r_GFX_OnceAnim(
+                    g_GFX_QueueEffect(
                       R_GFX_ITEM_RESPAWN,
                       it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-16,
                       it.Obj.Y+it.Obj.Rect.Y+(it.Obj.Rect.Height div 2)-16
@@ -1588,7 +1588,7 @@ begin
                   EFFECT_FIRE: begin
                     it := g_Items_ByIdx(iid);
                     g_Sound_PlayExAt('SOUND_FIRE', tgcTX, tgcTY);
-                    r_GFX_OnceAnim(
+                    g_GFX_QueueEffect(
                       R_GFX_FIRE,
                       it.Obj.X+it.Obj.Rect.X+(it.Obj.Rect.Width div 2)-32,
                       it.Obj.Y+it.Obj.Rect.Y+it.Obj.Rect.Height-128
index 43079841001091d1f1366f7905fd0f090a5f1b0f..ce840d000dea95b1b2612266c5f6359338c90633 100644 (file)
@@ -112,7 +112,7 @@ implementation
 
 uses
   Math, g_map, g_player, g_gfx, g_sound, g_panel,
-  g_console, g_options, g_game, r_gfx,
+  g_console, g_options, g_game,
   g_triggers, MAPDEF, e_log, g_monsters, g_saveload,
   g_language, g_netmsg, g_grid,
   geom, binheap, hashtable, utils, xstreams;
@@ -2011,7 +2011,7 @@ end;
 
 procedure g_Weapon_bfghit(x, y: Integer);
 begin
-  r_GFX_OnceAnim(R_GFX_BFG_HIT, x - 32, y - 32);
+  g_GFX_QueueEffect(R_GFX_BFG_HIT, x - 32, y - 32);
 end;
 
 procedure g_Weapon_pistol(x, y, xd, yd: Integer; SpawnerUID: Word;
@@ -2204,7 +2204,7 @@ begin
             end
             else
             begin
-              r_GFX_OnceAnim(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), cy-20+Random(9));
+              g_GFX_QueueEffect(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), cy-20+Random(9));
             end;
 
           // Ïîïàëè â êîãî-òî èëè â ñòåíó:
@@ -2219,12 +2219,12 @@ begin
 
               if ShotType = WEAPON_SKEL_FIRE then
                 begin // Âçðûâ ñíàðÿäà Ñêåëåòà
-                  r_GFX_OnceAnim(R_GFX_EXPLODE_SKELFIRE, Obj.X + 32 - 58, Obj.Y + 8 - 36);
+                  g_GFX_QueueEffect(R_GFX_EXPLODE_SKELFIRE, Obj.X + 32 - 58, Obj.Y + 8 - 36);
                   g_DynLightExplosion((Obj.X+32), (Obj.Y+8), 64, 1, 0, 0);
                 end
               else
                 begin // Âçðûâ Ðàêåòû
-                  r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
+                  g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
                   g_DynLightExplosion(cx, cy, 64, 1, 0, 0);
                 end;
 
@@ -2270,9 +2270,9 @@ begin
                (Timeout < 1) then
             begin
               if ShotType = WEAPON_PLASMA then
-                r_GFX_OnceAnim(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16)
+                g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16)
               else
-                r_GFX_OnceAnim(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16);
+                g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16);
               g_DynLightExplosion(cx, cy, 32, 0, 0.5, 0.5);
               g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEPLASMA', Obj.X, Obj.Y);
               ShotType := 0;
@@ -2294,7 +2294,7 @@ begin
               begin
                 tcx := Random(8);
                 tcy := Random(8);
-                r_GFX_OnceAnim(R_GFX_SMOKE, cx-4+tcx-(R_GFX_SMOKE_WIDTH div 2), cy-4+tcy-(R_GFX_SMOKE_HEIGHT div 2));
+                g_GFX_QueueEffect(R_GFX_SMOKE, cx-4+tcx-(R_GFX_SMOKE_WIDTH div 2), cy-4+tcy-(R_GFX_SMOKE_HEIGHT div 2));
               end
               else
               begin
@@ -2348,7 +2348,7 @@ begin
                 MOVE_HITCEIL: begin tcx := cx-12+Random(24); tcy := cy+6+Random(8); end;
                 else begin tcx := cx-4+Random(8); tcy := cy-4+Random(8); end;
               end;
-              r_GFX_OnceAnim(R_GFX_FLAME_RAND, tcx - (R_GFX_FLAME_WIDTH div 2), tcy - (R_GFX_FLAME_HEIGHT div 2));
+              g_GFX_QueueEffect(R_GFX_FLAME_RAND, tcx - (R_GFX_FLAME_WIDTH div 2), tcy - (R_GFX_FLAME_HEIGHT div 2));
               //g_DynLightExplosion(tcx, tcy, 1, 1, 0.8, 0.3);
             end;
           end;
@@ -2371,7 +2371,7 @@ begin
             begin
             // Ëó÷è BFG:
               if g_Game_IsServer then g_Weapon_BFG9000(cx, cy, SpawnerUID);
-              r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, cx - 64, cy - 64);
+              g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64);
               g_DynLightExplosion(cx, cy, 96, 0, 1, 0);
               g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', Obj.X, Obj.Y);
               ShotType := 0;
@@ -2399,9 +2399,9 @@ begin
                (Timeout < 1) then
             begin
               case ShotType of
-                WEAPON_IMP_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32);
-                WEAPON_CACO_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32);
-                WEAPON_BARON_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32);
+                WEAPON_IMP_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32);
+                WEAPON_CACO_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32);
+                WEAPON_BARON_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32);
               end;
               g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y);
               ShotType := 0;
@@ -2420,7 +2420,7 @@ begin
                (Timeout < 1) then
             begin
             // Âçðûâ:
-              r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
+              g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
               g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y);
               ShotType := 0;
             end;
@@ -2602,9 +2602,9 @@ begin
         if Loud then
         begin
           if ShotType = WEAPON_SKEL_FIRE then
-            r_GFX_OnceAnim(R_GFX_EXPLODE_SKELFIRE, (Obj.X + 32) - 32, (Obj.Y + 8) - 32)
+            g_GFX_QueueEffect(R_GFX_EXPLODE_SKELFIRE, (Obj.X + 32) - 32, (Obj.Y + 8) - 32)
           else
-            r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
+            g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
           g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEROCKET', Obj.X, Obj.Y);
         end;
       end;
@@ -2614,16 +2614,16 @@ begin
         if loud then
         begin
           if ShotType = WEAPON_PLASMA then
-            r_GFX_OnceAnim(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16)
+            g_GFX_QueueEffect(R_GFX_EXPLODE_PLASMA, cx - 16, cy - 16)
           else
-            r_GFX_OnceAnim(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16);
+            g_GFX_QueueEffect(R_GFX_EXPLODE_BSPFIRE, cx - 16, cy - 16);
           g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEPLASMA', Obj.X, Obj.Y);
         end;
       end;
 
       WEAPON_BFG: // BFG
       begin
-        r_GFX_OnceAnim(R_GFX_EXPLODE_BFG, cx - 64, cy - 64);
+        g_GFX_QueueEffect(R_GFX_EXPLODE_BFG, cx - 64, cy - 64);
         g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBFG', Obj.X, Obj.Y);
       end;
 
@@ -2632,9 +2632,9 @@ begin
         if loud then
         begin
           case ShotType of
-            WEAPON_IMP_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32);
-            WEAPON_CACO_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32);
-            WEAPON_BARON_FIRE: r_GFX_OnceAnim(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32);
+            WEAPON_IMP_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_IMPFIRE, cx - 32, cy - 32);
+            WEAPON_CACO_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_CACOFIRE, cx - 32, cy - 32);
+            WEAPON_BARON_FIRE: g_GFX_QueueEffect(R_GFX_EXPLODE_BARONFIRE, cx - 32, cy - 32);
           end;
           g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y);
         end;
@@ -2642,7 +2642,7 @@ begin
 
       WEAPON_MANCUB_FIRE: // Âûñòðåë Ìàíêóáóñà
       begin
-        r_GFX_OnceAnim(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
+        g_GFX_QueueEffect(R_GFX_EXPLODE_ROCKET, cx - 64, cy - 64);
         g_Sound_PlayExAt('SOUND_WEAPON_EXPLODEBALL', Obj.X, Obj.Y);
       end;
     end; // case ShotType of...
index 98d27cc1287f61af97d568de9fffb3727750dbbb..2cbc4a75bfc3414fea1b6e83e8ce634a9e8e25d9 100644 (file)
@@ -21,14 +21,19 @@ interface
 
 implementation
 
-  uses e_sound, g_system, g_net, r_window;
+  uses
+    {$IFNDEF HEADLESS}
+      r_render,
+    {$ENDIF}
+    e_sound, g_system, g_net
+  ;
 
   procedure ProcessLoading (forceUpdate: Boolean = False);
   begin
     if sys_HandleInput() = False then
     begin
       {$IFNDEF HEADLESS}
-        r_Window_DrawLoading(forceUpdate);
+        r_Render_DrawLoading(forceUpdate);
       {$ENDIF}
       e_SoundUpdate();
       // TODO: At the moment, I left here only host network processing, because the client code must
index adeb1092b4171f29edf13ee14c454f171a1d709d..246449864c7b6db3137230cd65265f2346dfcacc 100644 (file)
@@ -711,7 +711,9 @@ begin
   // HACK: take stats screenshot immediately after the first frame of the stats showing
   if gScreenshotStats and (not StatShotDone) and (Length(CustomStat.PlayerStat) > 1) then
   begin
+{$IFNDEF HEADLESS}
     g_TakeScreenShot('stats/' + StatFilename);
+{$ENDIF}
     StatShotDone := True;
   end;
 end;
index 91b9c38c670d5a0e64ddd4b042d2bb4e72ff3a22..5ec00178c0d905258d602e97c2889366cf6f24a9 100644 (file)
@@ -17,31 +17,13 @@ unit r_gfx;
 
 interface
 
+{
   const
-    R_GFX_NONE = 0;
-    R_GFX_TELEPORT = 1;
-    R_GFX_FLAME = 2;
-    R_GFX_EXPLODE_ROCKET = 3;
-    R_GFX_EXPLODE_BFG = 4;
-    R_GFX_BFG_HIT = 5;
-    R_GFX_FIRE = 6;
-    R_GFX_ITEM_RESPAWN = 7;
-    R_GFX_SMOKE = 8;
-    R_GFX_EXPLODE_SKELFIRE = 9;
-    R_GFX_EXPLODE_PLASMA = 10;
-    R_GFX_EXPLODE_BSPFIRE = 11;
-    R_GFX_EXPLODE_IMPFIRE = 12;
-    R_GFX_EXPLODE_CACOFIRE = 13;
-    R_GFX_EXPLODE_BARONFIRE = 14;
-    R_GFX_TELEPORT_FAST = 15;
-    R_GFX_SMOKE_TRANS = 16;
-    R_GFX_FLAME_RAND = 17;
-    R_GFX_LAST = 17;
-
     R_GFX_FLAME_WIDTH = 32;
     R_GFX_FLAME_HEIGHT = 32;
     R_GFX_SMOKE_WIDTH = 32;
     R_GFX_SMOKE_HEIGHT = 32;
+}
 
   procedure r_GFX_Load;
   procedure r_GFX_Free;
index d2f2dfd1535ed599a71766ffad09aa0b9026a270..8acec37b1d446cdece210df2958015afb23d5bae 100644 (file)
@@ -178,7 +178,7 @@ implementation
   end;
 
   procedure r_Monsters_Load;
-    var m, a: Integer; s, info: String; FramesID: DWORD;
+    var m, a: Integer; s: String; FramesID: DWORD;
   begin
     g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_SLEEP', GameWAD+':MTEXTURES\BARREL_SLEEP', 64, 64, 3);
     g_Frames_CreateWAD(nil, 'FRAMES_MONSTER_BARREL_DIE', GameWAD+':MTEXTURES\BARREL_DIE', 64, 64, 4);
index 3535a2d2969b02b4559b2fdef0bf5e870aa4259c..89faffbf5ec6eb8097ba25ca58e42323dfce382f 100644 (file)
@@ -17,6 +17,8 @@ unit r_render;
 
 interface
 
+  uses g_base; // TRectWH
+
   procedure r_Render_Initialize;
   procedure r_Render_Finalize;
 
@@ -33,6 +35,11 @@ interface
 
   function r_Render_WriteScreenShot (filename: String): Boolean;
 
+  function r_Render_GetGibRect (m, id: Integer): TRectWH;
+  procedure r_Render_QueueEffect (AnimType, X, Y: Integer);
+
+  procedure r_Render_DrawLoading (force: Boolean); // !!! remove it
+
 implementation
 
   uses
@@ -139,8 +146,10 @@ implementation
 
   procedure r_Render_Update;
   begin
+    r_GFX_Update;
     r_Map_Update;
     r_PlayerModel_Update;
+    r_Console_Update;
   end;
 
   procedure r_Render_Resize (w, h: Integer);
@@ -196,4 +205,19 @@ implementation
     end
   end;
 
+  function r_Render_GetGibRect (m, id: Integer): TRectWH;
+  begin
+    Result := r_PlayerModel_GetGibRect(m, id)
+  end;
+
+  procedure r_Render_QueueEffect (AnimType, X, Y: Integer);
+  begin
+    r_GFX_OnceAnim(AnimType, X, Y)
+  end;
+
+  procedure r_Render_DrawLoading (force: Boolean);
+  begin
+    r_Window_DrawLoading(force)
+  end;
+
 end.