Skip to content

Commit c12af17

Browse files
don't put duplicate entries into cl_visedicts
Resolves issue #9. Summary: skychain is a linked list (through texturechain pointers) of surfaces. Surfaces are appended to skychain while processing cl_visedicts. If there are duplicates in cl_visedicts then loops can be formed in the skychain. If there are loops in the skychain then R_DrawSky will never terminate. (This is all contingent on certain cvars used to choose the sky style, but this is the default behavior.) Solution: Dups in cl_visedicts are generally bad, so let's eliminate those. This will also fix the skychain issue. Things other than R_StoreEfrags that modify cl_visedicts all happen under _Host_Frame: ``` _Host_Frame CL_ReadFromServer (if connected) CL_RelinkEntities resets cl_numvisedicts and then adds to cl_visedicts CL_LinkProjectiles (if qw) adds to cl_visedicts CL_UpdateStreams (if hexen2) adds to cl_visedicts CL_UpdateEffects (if hexen2 and connected) adds to cl_visedicts ``` That's all cool! Then there's R_StoreEfrags. It is down the callstack from SCR_UpdateScreen. SCR_UpdateScreen is called from: _Host_Frame, Con_Keydown, Con_Print, Movie_TestFPS, SCR_BeginLoadingPlaque, and SCR_ModalMessage. The only time we actually want R_StoreEfrags to add to cl_visedicts is in the case where SCR_UpdateScreen is called from _Host_Frame. So let's enforce that with a global flag. This change fixes the specific reported issue with czg07. Giving it some burn-in testing now to see if it causes (or solves?) other issues.
1 parent 1def006 commit c12af17

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

gl_refrag.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2323

2424
#ifndef RQM_SV_ONLY
2525

26+
extern qboolean scr_update_in_frame;
27+
2628
mnode_t *r_pefragtopnode;
2729

2830

@@ -211,7 +213,7 @@ void R_StoreEfrags (efrag_t **ppefrag)
211213
case mod_md3:
212214
case mod_brush:
213215
case mod_sprite:
214-
if (pent->visframe != r_framecount)
216+
if (scr_update_in_frame && pent->visframe != r_framecount)
215217
{
216218
if (cl_numvisedicts < MAX_VISEDICTS)
217219
cl_visedicts[cl_numvisedicts++] = pent;

host.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Memory is cleared / released when a server or client begins, not when they end.
4040
quakeparms_t host_parms;
4141

4242
qboolean host_initialized; // true if into command execution
43+
qboolean scr_update_in_frame; // true while calling SCR_UpdateScreen from _Host_Frame
4344

4445
double host_frametime;
4546
double host_time;
@@ -839,7 +840,9 @@ void _Host_Frame (double time)
839840
time1 = Sys_DoubleTime ();
840841

841842
// update video
843+
scr_update_in_frame = true;
842844
SCR_UpdateScreen ();
845+
scr_update_in_frame = false;
843846

844847
if (host_speeds.value)
845848
time2 = Sys_DoubleTime ();

0 commit comments

Comments
 (0)