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>
Mon, 17 Jan 2022 18:44:14 +0000 (21:44 +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 4c2d6ded66bbb5817f54b28f3471330c11b6a2d7..fcd73a7bb8147add3027353f37401c4ea3791c8d 100644 (file)
@@ -125,7 +125,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;
@@ -434,11 +436,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,
@@ -1721,7 +1726,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
@@ -2121,7 +2125,6 @@ begin
     g_Weapon_Update();
     g_Monsters_Update();
     g_GFX_Update();
-    r_GFX_Update;
     g_Player_UpdateAll();
     g_Player_UpdatePhysicalObjects();
 
@@ -2220,8 +2223,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;
@@ -3281,7 +3286,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
@@ -5451,7 +5458,9 @@ begin
   end
   else if cmd = 'screenshot' then
   begin
-    g_TakeScreenShot()
+    {$IFNDEF HEADLESS}
+      g_TakeScreenShot()
+    {$ENDIF}
   end
   else if cmd = 'weapon' then
   begin
@@ -5688,8 +5697,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
@@ -5735,6 +5746,7 @@ begin
   end;
 end;
 
+{$IFNDEF HEADLESS}
 procedure g_TakeScreenShot(Filename: string = '');
   var t: TDateTime; dir, date, name: String;
 begin
@@ -5755,6 +5767,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 6bb50708008e2509e4e34b148d4c3c46c272ecb2..347fec50ff557e91a9849c71268ad2c8132f82d3 100644 (file)
@@ -90,7 +90,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;
@@ -485,7 +485,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 3b1aad732636098f528204c006badae4448c2e8c..9690b745bd93ac05cfde1b9b75fbb2dfa25cda33 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
@@ -4293,7 +4293,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 d88e6af38e973a1e3258c75985d38829b65c0615..da87a4a0bdb417fbe47d265c6c92c3bd47104478 100644 (file)
@@ -276,7 +276,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;
@@ -1556,40 +1556,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;
@@ -2534,7 +2534,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 92afc636f73aa29a5a0922fbc8493cb8b8b7bf28..80f38b7691245f5a45b8a80687aa63c0fb3d0cfc 100644 (file)
@@ -624,10 +624,13 @@ procedure g_Bot_RemoveAll();
 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,
@@ -1631,7 +1634,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));
@@ -3909,7 +3919,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
@@ -4109,7 +4119,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
@@ -4161,7 +4171,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
@@ -5662,7 +5672,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)
@@ -5678,7 +5688,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 64e87c6679d3249581d15ba0eb1dac13b9276e10..ce31a88c3012f4002c7f06aa7883398b811d6304 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';
@@ -875,17 +875,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;
@@ -1469,7 +1469,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
@@ -1481,7 +1481,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
@@ -1493,7 +1493,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
@@ -1556,7 +1556,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
@@ -1569,7 +1569,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
@@ -1582,7 +1582,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 6e555a4d607d5ac83432f5ee9cc64809aae79125..12d20a4b6be36f90b176903f3c4a3b68ba8fb33b 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;
@@ -1984,7 +1984,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;
@@ -2155,7 +2155,7 @@ begin
                             Obj.Y+(Obj.Rect.Height div 2),
                             1+Random(3), 16, 16)
             else
-              r_GFX_OnceAnim(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), Obj.Y+(Obj.Rect.Height div 2)-20+Random(9));
+              g_GFX_QueueEffect(R_GFX_SMOKE_TRANS, Obj.X-14+Random(9), Obj.Y+(Obj.Rect.Height div 2)-20+Random(9));
 
           // Ïîïàëè â êîãî-òî èëè â ñòåíó:
             if WordBool(st and (MOVE_HITWALL or MOVE_HITLAND or MOVE_HITCEIL)) or
@@ -2169,12 +2169,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;
 
@@ -2220,9 +2220,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;
@@ -2244,7 +2244,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
                 g_GFX_Bubbles(cx, cy, 1+Random(3), 16, 16);
@@ -2293,7 +2293,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;
@@ -2316,7 +2316,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;
@@ -2344,9 +2344,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;
@@ -2365,7 +2365,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;
@@ -2547,9 +2547,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;
@@ -2559,16 +2559,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;
 
@@ -2577,9 +2577,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;
@@ -2587,7 +2587,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 5b62d6310563997644e74682509c81e3497edcc5..63de883338008a7f57c01742c4cf8eae7c5bf960 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();
       if NetMode = NET_SERVER then
index 46ac2fd3d479ebdd7fc6cd0049970b4159c37650..6e587868d4114524cb45887784d91528fdc99a9c 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 76ef595268ff0ee9640d7d49ce70eb2ae84b0f42..1a35098c0216ed5f3575dc7cc90bf15b4f3bc29f 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.