DEADSOFTWARE

gl: reset gfx on map start
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Thu, 16 Feb 2023 18:31:11 +0000 (21:31 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 9 Jun 2023 09:14:31 +0000 (12:14 +0300)
src/game/g_game.pas
src/game/renders/opengl/r_map.pas
src/game/renders/opengl/r_render.pas

index 380126ee18a6a1d6ea60a876883518ce6dd53106..3ad4510cf54159ab67d54f1f09bd721ebbdd5af0 100644 (file)
@@ -3513,12 +3513,13 @@ begin
   begin
     //result := g_Map_Load(gGameSettings.WAD + ':\' + ResName);
     result := g_Map_Load(NewWAD+':\'+ResName);
-    {$IFDEF ENABLE_RENDER}
-      r_Render_LoadTextures;
-    {$ENDIF}
   end;
   if Result then
     begin
+      {$IFDEF ENABLE_RENDER}
+        r_Render_LoadTextures;
+        r_Render_Reset;
+      {$ENDIF}
       g_Player_ResetAll(Force or gLastMap, gGameSettings.GameType = GT_SINGLE);
 
       gState := STATE_NONE;
index c008f432def97874c3cce8089a30e1ce109847d5..eff895d9b528d404a0560b035f1958efe48bf619 100644 (file)
@@ -38,6 +38,7 @@ interface
   procedure r_Map_DrawPlayerModel (pm: TPlayerModel; x, y: Integer; alpha: Byte);
 {$ENDIF}
 
+  procedure r_Map_Reset;
   procedure r_Map_Update;
 
   procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer; out acx, acy: Integer);
@@ -1077,6 +1078,11 @@ implementation
     end;
   end;
 
+  procedure r_Map_ResetGFX;
+  begin
+    SetLength(gfxlist, 0);
+  end;
+
   procedure r_Map_UpdateGFX (tick: LongWord);
     var i: Integer; count: LongInt;
   begin
@@ -1575,6 +1581,13 @@ implementation
     r_Map_DrawScreenEffects(x, y, w, h, player);
   end;
 
+  procedure r_Map_Reset;
+  begin
+    {$IFDEF ENABLE_GFX}
+      r_Map_ResetGFX;
+    {$ENDIF}
+  end;
+
   procedure r_Map_Update;
     var i, count, tick: LongInt;
   begin
index d63137edc2aae8f48fd46c2441c9753e4f807a2c..3c2cd6fefbc27760a0871ea29e28a5e707400d8b 100644 (file)
@@ -39,6 +39,7 @@ interface
   procedure r_Render_LoadTextures;
   procedure r_Render_FreeTextures;
 
+  procedure r_Render_Reset;
   procedure r_Render_Update;
   procedure r_Render_Draw;
 
@@ -247,6 +248,11 @@ implementation
     {$ENDIF}
   end;
 
+  procedure r_Render_Reset;
+  begin
+    r_Map_Reset;
+  end;
+
   procedure r_Render_Update;
   begin
     r_Console_Update;