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. 26
      r_misc.c
  5. 4
      r_triapi.c

2
r_context.c

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

27
r_local.h

@ -185,8 +185,6 @@ typedef struct @@ -185,8 +185,6 @@ typedef struct
vec3_t vforward;
vec3_t vright;
vec3_t vup;
vec3_t base_vup;
vec3_t base_vpn;
vec3_t base_vright;
@ -196,15 +194,6 @@ typedef struct @@ -196,15 +194,6 @@ typedef struct
vec3_t cull_vright;
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_waterlevel; // was in water
@ -220,7 +209,6 @@ typedef struct @@ -220,7 +209,6 @@ typedef struct
byte visbytes[(MAX_MAP_LEAFS+7)/8];// actual PVS for current frame
float viewplanedist;
mplane_t clipPlane;
// q2 oldrefdef
vrect_t vrect; // subwindow in video for refresh
@ -268,9 +256,6 @@ typedef struct @@ -268,9 +256,6 @@ typedef struct
int skyboxTextures[6]; // skybox sides
int cinTexture; // cinematic texture
int skytexturenum; // this not a gl_texturenum!
int skyboxbasenum; // start with 5800
// entity lists
draw_list_t draw_stack[MAX_DRAW_STACK];
int draw_stack_pos;
@ -1070,20 +1055,15 @@ VARS @@ -1070,20 +1055,15 @@ VARS
// started
extern float r_aliasuvscale; // scale-up factor for screen u and v
// on Alias vertices passed to driver
extern qboolean r_dowarp;
extern affinetridesc_t r_affinetridesc;
extern vec3_t r_pright, r_pup, r_ppn;
void D_DrawSurfaces (void);
void R_DrawParticle( void );
void D_ViewChanged (void);
void D_WarpScreen (void);
void R_PolysetUpdateTables (void);
extern void *acolormap; // FIXME: should go away
//=======================================================================//
// callbacks to Quake
@ -1167,13 +1147,6 @@ extern edge_t *r_edges, *edge_p, *edge_max; @@ -1167,13 +1147,6 @@ extern edge_t *r_edges, *edge_p, *edge_max;
extern edge_t *newedges[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_clipflags;

156
r_main.c

@ -115,8 +115,6 @@ short *d_pzbuffer; @@ -115,8 +115,6 @@ short *d_pzbuffer;
unsigned int d_zrowbytes;
unsigned int d_zwidth;
qboolean r_dowarp;
mvertex_t *r_pcurrentvertbase;
//int c_surf;
@ -797,154 +795,6 @@ static image_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t @@ -797,154 +795,6 @@ static image_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t
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
@ -1744,15 +1594,12 @@ void R_RenderScene( void ) @@ -1744,15 +1594,12 @@ void R_RenderScene( void )
R_PushDlights();
// R_SetupGL( true );
R_Clear( ~0 );
//R_Clear( ~0 );
R_MarkLeaves();
R_DrawFog ();
// R_PushDlights (r_worldmodel); ??
R_CheckGLFog();
//R_DrawWorld();
R_EdgeDrawing ();
R_CheckFog();
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 ) @@ -1854,7 +1701,6 @@ void R_SetupRefParams( const ref_viewpass_t *rvp )
RI.params = RP_NONE;
RI.drawWorld = FBitSet( rvp->flags, RF_DRAW_WORLD );
RI.onlyClientDraw = FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW );
RI.farClip = 0;
if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP ))
RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW );

26
r_misc.c

@ -341,29 +341,15 @@ void R_SetupFrameQ (void) @@ -341,29 +341,15 @@ void R_SetupFrameQ (void)
// if (sw_waterwarp->value && (r_newrefdef.rdflags & RDF_UNDERWATER) )
// r_dowarp = true;
// 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;
vrect.x = 0;//r_newrefdef.x;
vrect.y = 0;//r_newrefdef.y;
vrect.width = gpGlobals->width;
vrect.height = gpGlobals->height;
d_viewbuffer = r_warpbuffer;
r_screenwidth = WARP_WIDTH;
}
else
{
vrect.x = 0;//r_newrefdef.x;
vrect.y = 0;//r_newrefdef.y;
vrect.width = gpGlobals->width;
vrect.height = gpGlobals->height;
d_viewbuffer = (void *)vid.buffer;
r_screenwidth = vid.rowbytes;
d_viewbuffer = (void *)vid.buffer;
r_screenwidth = vid.rowbytes;
}
R_ViewChanged (&vrect);
// start off with just the four screen edge clip planes

4
r_triapi.c

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

Loading…
Cancel
Save