From afca422e353fdfe1033f55f9e1fa1be8c5df1bfc Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 13 Apr 2026 13:47:17 +0500 Subject: [PATCH] ref: soft: read ref_viewpass_t flags instead of cached RI.drawWorld --- ref/soft/r_bsp.c | 2 +- ref/soft/r_local.h | 1 - ref/soft/r_main.c | 17 +++++++---------- ref/soft/r_misc.c | 6 ++---- ref/soft/r_studio.c | 14 +++++++------- 5 files changed, 17 insertions(+), 23 deletions(-) diff --git a/ref/soft/r_bsp.c b/ref/soft/r_bsp.c index 70e15242..a0e94e7e 100644 --- a/ref/soft/r_bsp.c +++ b/ref/soft/r_bsp.c @@ -643,7 +643,7 @@ R_RenderWorld */ void R_RenderWorld( void ) { - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return; // auto cycle the world frame for texture animation diff --git a/ref/soft/r_local.h b/ref/soft/r_local.h index 4011e267..5ed417e0 100644 --- a/ref/soft/r_local.h +++ b/ref/soft/r_local.h @@ -124,7 +124,6 @@ typedef struct { const ref_viewpass_t rvp; - qboolean drawWorld; // ignore world for drawing PlayerModel qboolean onlyClientDraw; // disabled by client request qboolean drawOrtho; // draw world as orthogonal projection diff --git a/ref/soft/r_main.c b/ref/soft/r_main.c index 889e83c7..f9cc0fa1 100644 --- a/ref/soft/r_main.c +++ b/ref/soft/r_main.c @@ -379,7 +379,7 @@ R_GetFarClip */ static float R_GetFarClip( void ) { - if( WORLDMODEL && RI.drawWorld ) + if( WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return tr.movevars->zmax * 1.73f; return 2048.0f; } @@ -501,7 +501,7 @@ static void R_SetupFrame( void ) } // current viewleaf - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) R_FindViewLeaf(); // setup twice until globals fully refactored @@ -573,7 +573,7 @@ static void R_DrawEntitiesOnList( void ) gEngfuncs.CL_DrawEFX( tr.frametime, false ); } - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) gEngfuncs.pfnDrawNormalTriangles(); d_pdrawspans = R_PolysetDrawSpans8_33; @@ -616,10 +616,8 @@ static void R_DrawEntitiesOnList( void ) } } - if( RI.drawWorld ) - { + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) gEngfuncs.pfnDrawTransparentTriangles(); - } if( !RI.onlyClientDraw ) { @@ -887,7 +885,7 @@ void R_DrawBrushModel( cl_entity_t *pent ) surf_t lsurfs[NUMSTACKSURFACES + (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1]; - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return; if( auxedges ) @@ -995,7 +993,7 @@ static void R_EdgeDrawing( void ) surf_t lsurfs[NUMSTACKSURFACES + (( CACHE_SIZE - 1 ) / sizeof( surf_t )) + 1]; - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return; if( auxedges ) @@ -1079,7 +1077,7 @@ R_SetupRefParams must be called right before */ void GAME_EXPORT R_RenderScene( void ) { - if( !WORLDMODEL && RI.drawWorld ) + if( !WORLDMODEL && FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) gEngfuncs.Host_Error( "%s: NULL worldmodel\n", __func__ ); // frametime is valid only for normal pass @@ -1156,7 +1154,6 @@ void R_SetupRefParams( const ref_viewpass_t *rvp ) { RI.rvp = *rvp; - RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD ); RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW ); if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP )) diff --git a/ref/soft/r_misc.c b/ref/soft/r_misc.c index 5af03ce3..7a95ee22 100644 --- a/ref/soft/r_misc.c +++ b/ref/soft/r_misc.c @@ -87,10 +87,8 @@ void D_ViewChanged( void ) /* ** clear Z-buffer and color-buffers if we're doing the gallery */ - if( !RI.drawWorld ) - { + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) memset( d_pzbuffer, 0xff, vid.width * vid.height * sizeof( d_pzbuffer[0] )); - } D_Patch(); } @@ -293,7 +291,7 @@ void R_SetupFrameQ( void ) // AngleVectors (RI.rvp.viewangles, RI.vforward, RI.vright, RI.vup); // current viewleaf - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) { RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.rvp.vieworigin, WORLDMODEL->nodes ); r_viewcluster = RI.viewleaf->cluster; diff --git a/ref/soft/r_studio.c b/ref/soft/r_studio.c index 0e89a233..7e3c0e23 100644 --- a/ref/soft/r_studio.c +++ b/ref/soft/r_studio.c @@ -147,7 +147,7 @@ init current time for a given model */ static void R_StudioSetupTimings( void ) { - if( RI.drawWorld ) + if( FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) { // synchronize with server time g_studio.time = gp_cl->time; @@ -353,7 +353,7 @@ pfnPlayerInfo */ player_info_t *pfnPlayerInfo( int index ) { - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) index = -1; return gEngfuncs.pfnPlayerInfo( index ); @@ -378,7 +378,7 @@ pfnGetPlayerState */ static entity_state_t *R_StudioGetPlayerState( int index ) { - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) return &RI.currententity->curstate; return gEngfuncs.pfnGetPlayerState( index ); @@ -1352,7 +1352,7 @@ static void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight ) if( !plight || !ent || !ent->model ) return; - if( !RI.drawWorld || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ) || r_fullbright->value || FBitSet( ent->curstate.effects, EF_FULLBRIGHT )) { plight->shadelight = 0; plight->ambientlight = 192; @@ -2333,7 +2333,7 @@ static model_t *R_StudioSetupPlayerModel( int index ) state = &g_studio.player_models[index]; // g-cont: force for "dev-mode", non-local games and menu preview - if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !RI.drawWorld ) && info->model[0] ) + if(( gpGlobals->developer || !ENGINE_GET_PARM( PARM_LOCAL_GAME ) || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) && info->model[0] ) { if( Q_strcmp( state->name, info->model )) { @@ -2926,7 +2926,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer ) if( flags & STUDIO_RENDER ) { // change body if it's a menu entity - if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !RI.drawWorld )) + if( cl_himodels->value && ( RI.currentmodel != RI.currententity->model || !FBitSet( RI.rvp.flags, RF_DRAW_WORLD ))) { // show highest resolution multiplayer model RI.currententity->curstate.body = 255; @@ -3087,7 +3087,7 @@ R_StudioDrawModelInternal */ static void R_StudioDrawModelInternal( cl_entity_t *e, int flags ) { - if( !RI.drawWorld ) + if( !FBitSet( RI.rvp.flags, RF_DRAW_WORLD )) { if( e->player ) R_StudioDrawPlayer( flags, &e->curstate );