Browse Source

ref_soft: Remove more unused globals/functions

pull/2/head
mittorn 6 years ago
parent
commit
8d88ecb951
  1. 2
      r_context.c
  2. 27
      r_local.h
  3. 156
      r_main.c
  4. 14
      r_misc.c
  5. 4
      r_triapi.c

2
r_context.c

@ -185,7 +185,7 @@ static int GL_RenderGetParm( int parm, int arg )
Assert( arg >= 0 && arg < 6 ); Assert( arg >= 0 && arg < 6 );
return tr.skyboxTextures[arg]; return tr.skyboxTextures[arg];
case PARM_TEX_SKYTEXNUM: case PARM_TEX_SKYTEXNUM:
return tr.skytexturenum; return 0;
case PARM_TEX_LIGHTMAP: case PARM_TEX_LIGHTMAP:
arg = bound( 0, arg, MAX_LIGHTMAPS - 1 ); arg = bound( 0, arg, MAX_LIGHTMAPS - 1 );
return tr.lightmapTextures[arg]; return tr.lightmapTextures[arg];

27
r_local.h

@ -185,8 +185,6 @@ typedef struct
vec3_t vforward; vec3_t vforward;
vec3_t vright; vec3_t vright;
vec3_t vup; vec3_t vup;
vec3_t base_vup; vec3_t base_vup;
vec3_t base_vpn; vec3_t base_vpn;
vec3_t base_vright; vec3_t base_vright;
@ -196,15 +194,6 @@ typedef struct
vec3_t cull_vright; vec3_t cull_vright;
vec3_t cull_vup; vec3_t cull_vup;
float farClip;
qboolean fogCustom;
qboolean fogEnabled;
qboolean fogSkybox;
vec4_t fogColor;
float fogDensity;
float fogStart;
float fogEnd;
int cached_contents; // in water int cached_contents; // in water
int cached_waterlevel; // was in water int cached_waterlevel; // was in water
@ -220,7 +209,6 @@ typedef struct
byte visbytes[(MAX_MAP_LEAFS+7)/8];// actual PVS for current frame byte visbytes[(MAX_MAP_LEAFS+7)/8];// actual PVS for current frame
float viewplanedist; float viewplanedist;
mplane_t clipPlane;
// q2 oldrefdef // q2 oldrefdef
vrect_t vrect; // subwindow in video for refresh vrect_t vrect; // subwindow in video for refresh
@ -268,9 +256,6 @@ typedef struct
int skyboxTextures[6]; // skybox sides int skyboxTextures[6]; // skybox sides
int cinTexture; // cinematic texture int cinTexture; // cinematic texture
int skytexturenum; // this not a gl_texturenum!
int skyboxbasenum; // start with 5800
// entity lists // entity lists
draw_list_t draw_stack[MAX_DRAW_STACK]; draw_list_t draw_stack[MAX_DRAW_STACK];
int draw_stack_pos; int draw_stack_pos;
@ -1070,20 +1055,15 @@ VARS
// started // started
extern float r_aliasuvscale; // scale-up factor for screen u and v extern float r_aliasuvscale; // scale-up factor for screen u and v
// on Alias vertices passed to driver // on Alias vertices passed to driver
extern qboolean r_dowarp;
extern affinetridesc_t r_affinetridesc; extern affinetridesc_t r_affinetridesc;
extern vec3_t r_pright, r_pup, r_ppn;
void D_DrawSurfaces (void); void D_DrawSurfaces (void);
void R_DrawParticle( void ); void R_DrawParticle( void );
void D_ViewChanged (void); void D_ViewChanged (void);
void D_WarpScreen (void); void D_WarpScreen (void);
void R_PolysetUpdateTables (void); void R_PolysetUpdateTables (void);
extern void *acolormap; // FIXME: should go away
//=======================================================================// //=======================================================================//
// callbacks to Quake // callbacks to Quake
@ -1167,13 +1147,6 @@ extern edge_t *r_edges, *edge_p, *edge_max;
extern edge_t *newedges[MAXHEIGHT]; extern edge_t *newedges[MAXHEIGHT];
extern edge_t *removeedges[MAXHEIGHT]; extern edge_t *removeedges[MAXHEIGHT];
// FIXME: make stack vars when debugging done
extern edge_t edge_head;
extern edge_t edge_tail;
extern edge_t edge_aftertail;
extern qboolean r_surfsonstack;
extern int r_viewcluster, r_oldviewcluster; extern int r_viewcluster, r_oldviewcluster;
extern int r_clipflags; extern int r_clipflags;

156
r_main.c

@ -115,8 +115,6 @@ short *d_pzbuffer;
unsigned int d_zrowbytes; unsigned int d_zrowbytes;
unsigned int d_zwidth; unsigned int d_zwidth;
qboolean r_dowarp;
mvertex_t *r_pcurrentvertbase; mvertex_t *r_pcurrentvertbase;
//int c_surf; //int c_surf;
@ -797,154 +795,6 @@ static image_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t
return NULL; return NULL;
} }
/*
=============
R_CheckFog
check for underwater fog
Using backward recursion to find waterline leaf
from underwater leaf (idea: XaeroX)
=============
*/
static void R_CheckFog( void )
{
cl_entity_t *ent;
image_t *tex;
int i, cnt, count;
// quake global fog
if( ENGINE_GET_PARM( PARM_QUAKE_COMPATIBLE ))
{
if( !MOVEVARS->fog_settings )
{
// if( pglIsEnabled( GL_FOG ))
// pglDisable( GL_FOG );
RI.fogEnabled = false;
return;
}
// quake-style global fog
RI.fogColor[0] = ((MOVEVARS->fog_settings & 0xFF000000) >> 24) / 255.0f;
RI.fogColor[1] = ((MOVEVARS->fog_settings & 0xFF0000) >> 16) / 255.0f;
RI.fogColor[2] = ((MOVEVARS->fog_settings & 0xFF00) >> 8) / 255.0f;
RI.fogDensity = ((MOVEVARS->fog_settings & 0xFF) / 255.0f) * 0.01f;
RI.fogStart = RI.fogEnd = 0.0f;
RI.fogColor[3] = 1.0f;
RI.fogCustom = false;
RI.fogEnabled = true;
RI.fogSkybox = true;
return;
}
RI.fogEnabled = false;
if( RI.onlyClientDraw || ENGINE_GET_PARM( PARM_WATER_LEVEL ) < 3 || !RI.drawWorld || !RI.viewleaf )
{
if( RI.cached_waterlevel == 3 )
{
// in some cases waterlevel jumps from 3 to 1. Catch it
RI.cached_waterlevel = ENGINE_GET_PARM( PARM_WATER_LEVEL );
RI.cached_contents = CONTENTS_EMPTY;
//if( !RI.fogCustom ) pglDisable( GL_FOG );
}
return;
}
ent = gEngfuncs.CL_GetWaterEntity( RI.vieworg );
if( ent && ent->model && ent->model->type == mod_brush && ent->curstate.skin < 0 )
cnt = ent->curstate.skin;
else cnt = RI.viewleaf->contents;
RI.cached_waterlevel = ENGINE_GET_PARM( PARM_WATER_LEVEL );
if( !IsLiquidContents( RI.cached_contents ) && IsLiquidContents( cnt ))
{
tex = NULL;
// check for water texture
if( ent && ent->model && ent->model->type == mod_brush )
{
msurface_t *surf;
count = ent->model->nummodelsurfaces;
for( i = 0, surf = &ent->model->surfaces[ent->model->firstmodelsurface]; i < count; i++, surf++ )
{
if( surf->flags & SURF_DRAWTURB && surf->texinfo && surf->texinfo->texture )
{
tex = R_GetTexture( surf->texinfo->texture->gl_texturenum );
RI.cached_contents = ent->curstate.skin;
break;
}
}
}
else
{
tex = R_RecursiveFindWaterTexture( RI.viewleaf->parent, NULL, false );
if( tex ) RI.cached_contents = RI.viewleaf->contents;
}
if( !tex ) return; // no valid fogs
// copy fog params
RI.fogColor[0] = tex->fogParams[0] / 255.0f;
RI.fogColor[1] = tex->fogParams[1] / 255.0f;
RI.fogColor[2] = tex->fogParams[2] / 255.0f;
RI.fogDensity = tex->fogParams[3] * 0.000025f;
RI.fogStart = RI.fogEnd = 0.0f;
RI.fogColor[3] = 1.0f;
RI.fogCustom = false;
RI.fogEnabled = true;
RI.fogSkybox = true;
}
else
{
RI.fogCustom = false;
RI.fogEnabled = true;
RI.fogSkybox = true;
}
}
/*
=============
R_CheckGLFog
special condition for Spirit 1.9
that used direct calls of glFog-functions
=============
*/
static void R_CheckGLFog( void )
{
#ifdef HACKS_RELATED_HLMODS
if(( !RI.fogEnabled && !RI.fogCustom ) && pglIsEnabled( GL_FOG ) && VectorIsNull( RI.fogColor ))
{
// fill the fog color from GL-state machine
pglGetFloatv( GL_FOG_COLOR, RI.fogColor );
RI.fogSkybox = true;
}
#endif
}
/*
=============
R_DrawFog
=============
*/
void R_DrawFog( void )
{
if( !RI.fogEnabled ) return;
#if 0
pglEnable( GL_FOG );
if( gEngfuncs.Host_IsQuakeCompatible( ))
pglFogi( GL_FOG_MODE, GL_EXP2 );
else pglFogi( GL_FOG_MODE, GL_EXP );
pglFogf( GL_FOG_DENSITY, RI.fogDensity );
pglFogfv( GL_FOG_COLOR, RI.fogColor );
pglHint( GL_FOG_HINT, GL_NICEST );
#endif
}
/* /*
============= =============
R_DrawEntitiesOnList R_DrawEntitiesOnList
@ -1744,15 +1594,12 @@ void R_RenderScene( void )
R_PushDlights(); R_PushDlights();
// R_SetupGL( true ); // R_SetupGL( true );
R_Clear( ~0 ); //R_Clear( ~0 );
R_MarkLeaves(); R_MarkLeaves();
R_DrawFog ();
// R_PushDlights (r_worldmodel); ?? // R_PushDlights (r_worldmodel); ??
R_CheckGLFog();
//R_DrawWorld(); //R_DrawWorld();
R_EdgeDrawing (); R_EdgeDrawing ();
R_CheckFog();
gEngfuncs.CL_ExtraUpdate (); // don't let sound get messed up if going slow gEngfuncs.CL_ExtraUpdate (); // don't let sound get messed up if going slow
@ -1854,7 +1701,6 @@ void R_SetupRefParams( const ref_viewpass_t *rvp )
RI.params = RP_NONE; RI.params = RP_NONE;
RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD ); RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD );
RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW ); RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW );
RI.farClip = 0;
if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP )) if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP ))
RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW ); RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW );

14
r_misc.c

@ -341,20 +341,7 @@ void R_SetupFrameQ (void)
// if (sw_waterwarp->value && (r_newrefdef.rdflags & RDF_UNDERWATER) ) // if (sw_waterwarp->value && (r_newrefdef.rdflags & RDF_UNDERWATER) )
// r_dowarp = true; // r_dowarp = true;
// else // else
r_dowarp = false;
if (r_dowarp)
{ // warp into off screen buffer
vrect.x = 0;
vrect.y = 0;
//vrect.width = r_newrefdef.width < WARP_WIDTH ? r_newrefdef.width : WARP_WIDTH;
//vrect.height = r_newrefdef.height < WARP_HEIGHT ? r_newrefdef.height : WARP_HEIGHT;
d_viewbuffer = r_warpbuffer;
r_screenwidth = WARP_WIDTH;
}
else
{
vrect.x = 0;//r_newrefdef.x; vrect.x = 0;//r_newrefdef.x;
vrect.y = 0;//r_newrefdef.y; vrect.y = 0;//r_newrefdef.y;
vrect.width = gpGlobals->width; vrect.width = gpGlobals->width;
@ -362,7 +349,6 @@ void R_SetupFrameQ (void)
d_viewbuffer = (void *)vid.buffer; d_viewbuffer = (void *)vid.buffer;
r_screenwidth = vid.rowbytes; r_screenwidth = vid.rowbytes;
}
R_ViewChanged (&vrect); R_ViewChanged (&vrect);

4
r_triapi.c

@ -455,8 +455,8 @@ TriForParams
*/ */
void TriFogParams( float flDensity, int iFogSkybox ) void TriFogParams( float flDensity, int iFogSkybox )
{ {
RI.fogDensity = flDensity; //RI.fogDensity = flDensity;
RI.fogSkybox = iFogSkybox; //RI.fogSkybox = iFogSkybox;
} }
/* /*

Loading…
Cancel
Save