Browse Source

ref: soft: move ref_soft cvars to static allocation, remove dead cvars

pull/2/head
Alibek Omarov 2 years ago
parent
commit
8680757844
  1. 3
      ref/soft/r_bsp.c
  2. 6
      ref/soft/r_edge.c
  3. 2
      ref/soft/r_image.c
  4. 42
      ref/soft/r_local.h
  5. 91
      ref/soft/r_main.c
  6. 7
      ref/soft/r_misc.c
  7. 2
      ref/soft/r_scan.c
  8. 2
      ref/soft/r_sprite.c
  9. 8
      ref/soft/r_studio.c
  10. 4
      ref/soft/r_surf.c

3
ref/soft/r_bsp.c

@ -943,9 +943,6 @@ R_RenderWorld
*/ */
void R_RenderWorld (void) void R_RenderWorld (void)
{ {
//if (!r_drawworld->value)
// return;
if ( !RI.drawWorld ) if ( !RI.drawWorld )
return; return;

6
ref/soft/r_edge.c

@ -111,7 +111,7 @@ void R_BeginEdgeFrame (void)
surfaces[1].flags = 0; // SURF_DRAWBACKGROUND; surfaces[1].flags = 0; // SURF_DRAWBACKGROUND;
// put the background behind everything in the world // put the background behind everything in the world
if (sw_draworder->value) if (sw_draworder.value)
{ {
pdrawfunc = R_GenerateSpansBackward; pdrawfunc = R_GenerateSpansBackward;
surfaces[1].key = 0; surfaces[1].key = 0;
@ -896,7 +896,7 @@ void D_BackgroundSurf (surf_t *s)
d_zistepv = 0; d_zistepv = 0;
d_ziorigin = -0.9; d_ziorigin = -0.9;
D_FlatFillSurface (s, (int)sw_clearcolor->value & 0xFFFF); D_FlatFillSurface (s, (int)sw_clearcolor.value & 0xFFFF);
D_DrawZSpans (s->spans); D_DrawZSpans (s->spans);
} }
@ -1234,7 +1234,7 @@ void D_DrawSurfaces (void)
TransformVector (tr.modelorg, transformed_modelorg); TransformVector (tr.modelorg, transformed_modelorg);
VectorCopy (transformed_modelorg, world_transformed_modelorg); VectorCopy (transformed_modelorg, world_transformed_modelorg);
if (!sw_drawflat->value) if (!sw_drawflat.value)
{ {
for (s = &surfaces[1] ; s<surface_p ; s++) for (s = &surfaces[1] ; s<surface_p ; s++)
{ {

2
ref/soft/r_image.c

@ -605,7 +605,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic )
{ {
unsigned int alpha = (data[i * 4 + 3] * 8 / 256) << (16 - 3); unsigned int alpha = (data[i * 4 + 3] * 8 / 256) << (16 - 3);
tex->alpha_pixels[i] = (tex->pixels[j][i] >> 3) | alpha; tex->alpha_pixels[i] = (tex->pixels[j][i] >> 3) | alpha;
if( !sw_noalphabrushes->value && data[i * 4 + 3] < 128 && FBitSet( pic->flags, IMAGE_ONEBIT_ALPHA ) ) if( !sw_noalphabrushes.value && data[i * 4 + 3] < 128 && FBitSet( pic->flags, IMAGE_ONEBIT_ALPHA ) )
tex->pixels[j][i] = TRANSPARENT_COLOR; //0000 0011 0100 1001; tex->pixels[j][i] = TRANSPARENT_COLOR; //0000 0011 0100 1001;
} }

42
ref/soft/r_local.h

@ -30,7 +30,7 @@ GNU General Public License for more details.
#include "enginefeatures.h" #include "enginefeatures.h"
#include "com_strings.h" #include "com_strings.h"
#include "pm_movevars.h" #include "pm_movevars.h"
//#include "cvar.h" #include "common/cvar.h"
typedef struct mip_s mip_t; typedef struct mip_s mip_t;
typedef int fixed8_t; typedef int fixed8_t;
@ -41,10 +41,6 @@ typedef int fixed16_t;
#include <stdio.h> #include <stdio.h>
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) cvar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) cvar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
#define CVAR_TO_BOOL( x ) ((x) && ((x)->value != 0.0f) ? true : false )
#define WORLD (gEngfuncs.GetWorld()) #define WORLD (gEngfuncs.GetWorld())
#define WORLDMODEL (gEngfuncs.pfnGetModelByIndex( 1 )) #define WORLDMODEL (gEngfuncs.pfnGetModelByIndex( 1 ))
#define MOVEVARS (gEngfuncs.pfnGetMoveVars()) #define MOVEVARS (gEngfuncs.pfnGetMoveVars())
@ -676,7 +672,6 @@ void TriBrightness( float brightness );
extern ref_api_t gEngfuncs; extern ref_api_t gEngfuncs;
extern ref_globals_t *gpGlobals; extern ref_globals_t *gpGlobals;
extern cvar_t *r_dynamic;
DECLARE_ENGINE_SHARED_CVAR_LIST() DECLARE_ENGINE_SHARED_CVAR_LIST()
@ -1089,29 +1084,16 @@ extern int r_clipflags;
//extern qboolean r_fov_greater_than_90; //extern qboolean r_fov_greater_than_90;
extern cvar_t *sw_aliasstats; extern convar_t sw_clearcolor;
extern cvar_t *sw_clearcolor; extern convar_t sw_drawflat;
extern cvar_t *sw_drawflat; extern convar_t sw_draworder;
extern cvar_t *sw_draworder; extern convar_t sw_maxedges;
extern cvar_t *sw_maxedges; extern convar_t sw_mipcap;
extern cvar_t *sw_maxsurfs; extern convar_t sw_mipscale;
extern cvar_t *sw_mipcap; extern convar_t sw_surfcacheoverride;
extern cvar_t *sw_mipscale; extern convar_t sw_texfilt;
extern cvar_t *sw_reportsurfout; extern convar_t r_traceglow;
extern cvar_t *sw_reportedgeout; extern convar_t sw_noalphabrushes;
extern cvar_t *sw_stipplealpha;
extern cvar_t *sw_surfcacheoverride;
extern cvar_t *sw_waterwarp;
extern cvar_t *sw_texfilt;
extern cvar_t *r_traceglow;
extern cvar_t *sw_notransbrushes;
extern cvar_t *sw_noalphabrushes;
extern cvar_t *tracerred;
extern cvar_t *tracergreen;
extern cvar_t *tracerblue;
extern cvar_t *traceralpha;
extern struct qfrustum_s { extern struct qfrustum_s {
mplane_t screenedge[4]; mplane_t screenedge[4];
@ -1120,8 +1102,6 @@ extern struct qfrustum_s {
int *pfrustum_indexes[4]; int *pfrustum_indexes[4];
} qfrustum; } qfrustum;
extern cvar_t *r_fullbright;
#define CACHESPOT(surf) ((surfcache_t**)surf->info->reserved) #define CACHESPOT(surf) ((surfcache_t**)surf->info->reserved)
extern int r_currentkey; extern int r_currentkey;
extern int r_currentbkey; extern int r_currentbkey;

91
ref/soft/r_main.c

@ -56,33 +56,21 @@ int r_screenwidth;
int r_viewcluster, r_oldviewcluster; int r_viewcluster, r_oldviewcluster;
cvar_t *sw_aliasstats; CVAR_DEFINE_AUTO( sw_clearcolor, "48999", 0, "screen clear color");
cvar_t *sw_allow_modex; CVAR_DEFINE_AUTO( sw_drawflat, "0", 0, "");
cvar_t *sw_clearcolor; CVAR_DEFINE_AUTO( sw_draworder, "0", 0, "");
cvar_t *sw_drawflat; CVAR_DEFINE_AUTO( sw_maxedges, "32", 0, "");
cvar_t *sw_draworder; static CVAR_DEFINE_AUTO( sw_maxsurfs, "0", 0, "");
cvar_t *sw_maxedges; CVAR_DEFINE_AUTO( sw_mipscale, "1", FCVAR_GLCONFIG, "nothing");
cvar_t *sw_maxsurfs; CVAR_DEFINE_AUTO( sw_mipcap, "0", FCVAR_GLCONFIG, "nothing" );
cvar_t *sw_reportedgeout; CVAR_DEFINE_AUTO( sw_surfcacheoverride, "0", 0, "");
cvar_t *sw_reportsurfout; static CVAR_DEFINE_AUTO( sw_waterwarp, "1", FCVAR_GLCONFIG, "nothing");
cvar_t *sw_stipplealpha; static CVAR_DEFINE_AUTO( sw_notransbrushes, "0", FCVAR_GLCONFIG, "do not apply transparency to water/glasses (faster)");
cvar_t *sw_surfcacheoverride; CVAR_DEFINE_AUTO( sw_noalphabrushes, "0", FCVAR_GLCONFIG, "do not draw brush holes (faster)");
cvar_t *sw_waterwarp; CVAR_DEFINE_AUTO( r_traceglow, "1", FCVAR_GLCONFIG, "cull flares behind models" );
cvar_t *sw_texfilt; CVAR_DEFINE_AUTO( sw_texfilt, "0", FCVAR_GLCONFIG, "texture dither");
cvar_t *sw_notransbrushes; static CVAR_DEFINE_AUTO( r_novis, "0", 0, "" );
cvar_t *sw_noalphabrushes;
cvar_t *r_drawworld;
cvar_t *r_dspeeds;
cvar_t *r_lerpmodels;
cvar_t *r_novis;
cvar_t *r_traceglow;
cvar_t *r_lightlevel; //FIXME HACK
//PGM
cvar_t *sw_lockpvs;
//PGM
DEFINE_ENGINE_SHARED_CVAR_LIST() DEFINE_ENGINE_SHARED_CVAR_LIST()
@ -164,10 +152,10 @@ static qboolean R_OpaqueEntity( cl_entity_t *ent )
if( rendermode == kRenderNormal ) if( rendermode == kRenderNormal )
return true; return true;
if( sw_notransbrushes->value && ent->model && ent->model->type == mod_brush && rendermode == kRenderTransTexture ) if( sw_notransbrushes.value && ent->model && ent->model->type == mod_brush && rendermode == kRenderTransTexture )
return true; return true;
if( sw_noalphabrushes->value && ent->model && ent->model->type == mod_brush && rendermode == kRenderTransAlpha ) if( sw_noalphabrushes.value && ent->model && ent->model->type == mod_brush && rendermode == kRenderTransAlpha )
return true; return true;
return false; return false;
@ -1529,7 +1517,7 @@ void R_MarkLeaves (void)
mnode_t *node; mnode_t *node;
int i; int i;
if (r_oldviewcluster == r_viewcluster && !r_novis->value && r_viewcluster != -1) if (r_oldviewcluster == r_viewcluster && !r_novis.value && r_viewcluster != -1)
return; return;
tr.visframecount++; tr.visframecount++;
@ -1823,7 +1811,7 @@ void GAME_EXPORT R_NewMap (void)
R_ClearDecals(); // clear all level decals R_ClearDecals(); // clear all level decals
R_StudioResetPlayerModels(); R_StudioResetPlayerModels();
r_cnumsurfs = sw_maxsurfs->value; r_cnumsurfs = sw_maxsurfs.value;
if (r_cnumsurfs <= MINSURFACES) if (r_cnumsurfs <= MINSURFACES)
r_cnumsurfs = MINSURFACES; r_cnumsurfs = MINSURFACES;
@ -1844,7 +1832,7 @@ void GAME_EXPORT R_NewMap (void)
r_surfsonstack = true; r_surfsonstack = true;
} }
r_numallocatededges = sw_maxedges->value; r_numallocatededges = sw_maxedges.value;
if (r_numallocatededges < MINEDGES) if (r_numallocatededges < MINEDGES)
r_numallocatededges = MINEDGES; r_numallocatededges = MINEDGES;
@ -1913,32 +1901,23 @@ qboolean GAME_EXPORT R_Init( void )
RETRIEVE_ENGINE_SHARED_CVAR_LIST(); RETRIEVE_ENGINE_SHARED_CVAR_LIST();
// sw_aliasstats = ri.Cvar_Get ("sw_polymodelstats", "0", 0);
// sw_allow_modex = ri.Cvar_Get( "sw_allow_modex", "1", CVAR_ARCHIVE ); gEngfuncs.Cvar_RegisterVariable( &sw_clearcolor );
sw_clearcolor = gEngfuncs.Cvar_Get ("sw_clearcolor", "48999", 0, "screen clear color"); gEngfuncs.Cvar_RegisterVariable( &sw_drawflat );
sw_drawflat = gEngfuncs.Cvar_Get ("sw_drawflat", "0", 0, ""); gEngfuncs.Cvar_RegisterVariable( &sw_draworder );
sw_draworder = gEngfuncs.Cvar_Get ("sw_draworder", "0", 0, ""); gEngfuncs.Cvar_RegisterVariable( &sw_maxedges );
sw_maxedges = gEngfuncs.Cvar_Get ("sw_maxedges", "32", 0, ""); gEngfuncs.Cvar_RegisterVariable( &sw_maxsurfs );
sw_maxsurfs = gEngfuncs.Cvar_Get ("sw_maxsurfs", "0", 0, ""); gEngfuncs.Cvar_RegisterVariable( &sw_mipscale );
sw_mipscale = gEngfuncs.Cvar_Get ("sw_mipscale", "1", FCVAR_GLCONFIG, "nothing"); gEngfuncs.Cvar_RegisterVariable( &sw_mipcap );
sw_mipcap = gEngfuncs.Cvar_Get( "sw_mipcap", "0", FCVAR_GLCONFIG, "nothing" ); gEngfuncs.Cvar_RegisterVariable( &sw_surfcacheoverride );
sw_reportedgeout = gEngfuncs.Cvar_Get ("sw_reportedgeout", "0", 0, ""); gEngfuncs.Cvar_RegisterVariable( &sw_waterwarp );
sw_reportsurfout = gEngfuncs.Cvar_Get ("sw_reportsurfout", "0", 0, ""); gEngfuncs.Cvar_RegisterVariable( &sw_notransbrushes );
sw_stipplealpha = gEngfuncs.Cvar_Get( "sw_stipplealpha", "1", FCVAR_GLCONFIG, "nothing" ); gEngfuncs.Cvar_RegisterVariable( &sw_noalphabrushes );
sw_surfcacheoverride = gEngfuncs.Cvar_Get ("sw_surfcacheoverride", "0", 0, ""); gEngfuncs.Cvar_RegisterVariable( &r_traceglow );
sw_waterwarp = gEngfuncs.Cvar_Get ("sw_waterwarp", "1", FCVAR_GLCONFIG, "nothing");
sw_notransbrushes = gEngfuncs.Cvar_Get( "sw_notransbrushes", "0", FCVAR_GLCONFIG, "do not apply transparency to water/glasses (faster)");
sw_noalphabrushes = gEngfuncs.Cvar_Get( "sw_noalphabrushes", "0", FCVAR_GLCONFIG, "do not draw brush holes (faster)");
r_traceglow = gEngfuncs.Cvar_Get( "r_traceglow", "1", FCVAR_GLCONFIG, "cull flares behind models" );
#ifndef DISABLE_TEXFILTER #ifndef DISABLE_TEXFILTER
sw_texfilt = gEngfuncs.Cvar_Get ("sw_texfilt", "0", FCVAR_GLCONFIG, "texture dither"); gEngfuncs.Cvar_RegisterVariable( &sw_texfilt );
#endif #endif
// r_speeds = ri.Cvar_Get ("r_speeds", "0", 0); gEngfuncs.Cvar_RegisterVariable( &r_novis );
//r_drawworld = ri.Cvar_Get ("r_drawworld", "1", 0);
//r_dspeeds = ri.Cvar_Get ("r_dspeeds", "0", 0);
// r_lightlevel = ri.Cvar_Get ("r_lightlevel", "0", 0);
//r_lerpmodels = ri.Cvar_Get( "r_lerpmodels", "1", 0 );
r_novis = gEngfuncs.Cvar_Get( "r_novis", "0", 0, "" );
r_temppool = Mem_AllocPool( "ref_soft zone" ); r_temppool = Mem_AllocPool( "ref_soft zone" );

7
ref/soft/r_misc.c

@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NUM_MIPS 4 #define NUM_MIPS 4
cvar_t *sw_mipcap;
cvar_t *sw_mipscale;
surfcache_t *d_initial_rover; surfcache_t *d_initial_rover;
qboolean d_roverwrapped; qboolean d_roverwrapped;
int d_minmip; int d_minmip;
@ -361,14 +358,14 @@ void R_SetupFrameQ (void)
d_roverwrapped = false; d_roverwrapped = false;
d_initial_rover = sc_rover; d_initial_rover = sc_rover;
d_minmip = sw_mipcap->value; d_minmip = sw_mipcap.value;
if (d_minmip > 3) if (d_minmip > 3)
d_minmip = 3; d_minmip = 3;
else if (d_minmip < 0) else if (d_minmip < 0)
d_minmip = 0; d_minmip = 0;
for (i=0 ; i<(NUM_MIPS-1) ; i++) for (i=0 ; i<(NUM_MIPS-1) ; i++)
d_scalemip[i] = basemip[i] * sw_mipscale->value; d_scalemip[i] = basemip[i] * sw_mipscale.value;
//d_aflatcolor = 0; //d_aflatcolor = 0;
} }

2
ref/soft/r_scan.c

@ -519,7 +519,7 @@ int kernel[2][2][2] =
} }
}; };
#ifndef DISABLE_TEXFILTER #ifndef DISABLE_TEXFILTER
#define SW_TEXFILT (sw_texfilt->value == 1.0f) #define SW_TEXFILT (sw_texfilt.value == 1.0f)
#else #else
#define SW_TEXFILT 0 #define SW_TEXFILT 0
#endif #endif

2
ref/soft/r_sprite.c

@ -666,7 +666,7 @@ static float R_SpriteGlowBlend( vec3_t origin, int rendermode, int renderfx, flo
if( RP_NORMALPASS( )) if( RP_NORMALPASS( ))
{ {
tr = gEngfuncs.EV_VisTraceLine( RI.vieworg, origin, r_traceglow->value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE)); tr = gEngfuncs.EV_VisTraceLine( RI.vieworg, origin, r_traceglow.value ? PM_GLASS_IGNORE : (PM_GLASS_IGNORE|PM_STUDIO_IGNORE));
if(( 1.0f - tr->fraction ) * dist > 8.0f ) if(( 1.0f - tr->fraction ) * dist > 8.0f )
return 0.0f; return 0.0f;

8
ref/soft/r_studio.c

@ -117,9 +117,8 @@ typedef struct
} studio_draw_state_t; } studio_draw_state_t;
// studio-related cvars // studio-related cvars
static cvar_t *r_studio_sort_textures; static CVAR_DEFINE_AUTO( r_studio_sort_textures, "0", FCVAR_GLCONFIG, "change draw order for additive meshes" );
static cvar_t *cl_righthand = NULL; static cvar_t *cl_righthand = NULL;
static cvar_t *r_studio_drawelements;
static r_studio_interface_t *pStudioDraw; static r_studio_interface_t *pStudioDraw;
static studio_draw_state_t g_studio; // global studio state static studio_draw_state_t g_studio; // global studio state
@ -142,8 +141,7 @@ R_StudioInit
*/ */
void R_StudioInit( void ) void R_StudioInit( void )
{ {
r_studio_sort_textures = gEngfuncs.Cvar_Get( "r_studio_sort_textures", "0", FCVAR_ARCHIVE, "change draw order for additive meshes" ); gEngfuncs.Cvar_RegisterVariable( &r_studio_sort_textures );
r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" );
Matrix3x4_LoadIdentity( g_studio.rotationmatrix ); Matrix3x4_LoadIdentity( g_studio.rotationmatrix );
@ -2112,7 +2110,7 @@ static void R_StudioDrawPoints( void )
} }
} }
if( r_studio_sort_textures->value && need_sort ) if( r_studio_sort_textures.value && need_sort )
{ {
// resort opaque and translucent meshes draw order // resort opaque and translucent meshes draw order
qsort( g_studio.meshes, m_pSubModel->nummesh, sizeof( sortedmesh_t ), (void*)R_StudioMeshCompare ); qsort( g_studio.meshes, m_pSubModel->nummesh, sizeof( sortedmesh_t ), (void*)R_StudioMeshCompare );

4
ref/soft/r_surf.c

@ -962,9 +962,9 @@ void R_InitCaches (void)
int pix; int pix;
// calculate size to allocate // calculate size to allocate
if (sw_surfcacheoverride->value) if (sw_surfcacheoverride.value)
{ {
size = sw_surfcacheoverride->value; size = sw_surfcacheoverride.value;
} }
else else
{ {

Loading…
Cancel
Save