Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings

This commit is contained in:
Thilo Schulz 2011-07-29 12:27:00 +00:00
parent 1ea7ab1f42
commit 23f6fd1633
85 changed files with 246 additions and 496 deletions

View file

@ -753,7 +753,7 @@ void RE_StretchRaw (int x, int y, int w, int h, int cols, int rows, const byte *
// we definately want to sync every frame for the cinematics
qglFinish();
start = end = 0;
start = 0;
if ( r_speeds->integer ) {
start = ri.Milliseconds();
}

View file

@ -204,10 +204,9 @@ static int neighbors[8][2] = {
VectorAdd( normal, sum, sum );
count++;
}
if ( count == 0 ) {
//printf("bad normal\n");
count = 1;
}
//if ( count == 0 ) {
// printf("bad normal\n");
//}
VectorNormalize2( sum, dv->normal );
}
}

View file

@ -114,7 +114,7 @@ This is called at surface tesselation time
*/
void RB_AddFlare( void *surface, int fogNum, vec3_t point, vec3_t color, vec3_t normal ) {
int i;
flare_t *f, *oldest;
flare_t *f;
vec3_t local;
float d = 1;
vec4_t eye, clip, normalized, window;
@ -152,7 +152,6 @@ void RB_AddFlare( void *surface, int fogNum, vec3_t point, vec3_t color, vec3_t
}
// see if a flare with a matching surface, scene, and view exists
oldest = r_flareStructs;
for ( f = r_activeFlares ; f ; f = f->next ) {
if ( f->surface == surface && f->frameSceneNum == backEnd.viewParms.frameSceneNum
&& f->inPortal == backEnd.viewParms.isPortal ) {

View file

@ -1098,14 +1098,11 @@ R_CreateFogImage
static void R_CreateFogImage( void ) {
int x,y;
byte *data;
float g;
float d;
float borderColor[4];
data = ri.Hunk_AllocateTempMemory( FOG_S * FOG_T * 4 );
g = 2.0;
// S is distance, T is depth
for (x=0 ; x<FOG_S ; x++) {
for (y=0 ; y<FOG_T ; y++) {

View file

@ -791,8 +791,6 @@ static uint8_t PredictPaeth(uint8_t a, uint8_t b, uint8_t c)
int p;
int pa, pb, pc;
Pr = 0;
p = ((int) a) + ((int) b) - ((int) c);
pa = abs(p - ((int) a));
pb = abs(p - ((int) b));

View file

@ -912,7 +912,6 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
for ( i = 0; i < tess.numIndexes; i += 3 )
{
vec3_t normal;
float dot;
float len;
VectorSubtract( tess.xyz[tess.indexes[i]], tr.viewParms.or.origin, normal );
@ -923,7 +922,7 @@ static qboolean SurfIsOffscreen( const drawSurf_t *drawSurf, vec4_t clipDest[128
shortest = len;
}
if ( ( dot = DotProduct( normal, tess.normal[tess.indexes[i]] ) ) >= 0 )
if ( DotProduct( normal, tess.normal[tess.indexes[i]] ) >= 0 )
{
numTriangles--;
}
@ -1269,7 +1268,6 @@ void R_AddEntitySurfaces (void) {
if ( (ent->e.renderfx & RF_THIRD_PERSON) && !tr.viewParms.isPortal) {
break;
}
shader = R_GetShaderByHandle( ent->e.customShader );
R_AddDrawSurf( &entitySurface, tr.defaultShader, 0, 0 );
break;
default:

View file

@ -272,6 +272,10 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio
vec3_t v1, v2;
int *indexes;
if (numPoints <= 0) {
return 0;
}
//increment view count for double check prevention
tr.viewCount++;

View file

@ -931,7 +931,7 @@ static qboolean R_LoadMD4( model_t *mod, void *buffer, const char *mod_name ) {
// swap all the frames
frameSize = (size_t)( &((md4Frame_t *)0)->bones[ md4->numBones ] );
for ( i = 0 ; i < md4->numFrames ; i++, frame++) {
for ( i = 0 ; i < md4->numFrames ; i++) {
frame = (md4Frame_t *) ( (byte *)md4 + md4->ofsFrames + i * frameSize );
frame->radius = LittleFloat( frame->radius );
for ( j = 0 ; j < 3 ; j++ ) {

View file

@ -885,8 +885,8 @@ static void ComputeJointMats( iqmData_t *data, int frame, int oldframe,
int *joint = data->jointParents;
int i;
if ( oldframe == frame ) {
mat1 = mat2 = data->poseMats + 12 * data->num_joints * frame;
if ( oldframe == frame ) {
mat1 = data->poseMats + 12 * data->num_joints * frame;
for( i = 0; i < data->num_joints; i++, joint++ ) {
if( *joint >= 0 ) {
Matrix34Multiply( mat + 12 * *joint,

View file

@ -109,7 +109,7 @@ typedef struct {
void (QDECL *Printf)( int printLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
// abort the game
void (QDECL *Error)( int errorLevel, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
void (QDECL *Error)( int errorLevel, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 2, 3)));
// milliseconds should only be used for profiling, never
// for anything game related. Get time from the refdef

View file

@ -1174,8 +1174,10 @@ static void RB_IterateStagesGeneric( shaderCommands_t *input )
void RB_StageIteratorGeneric( void )
{
shaderCommands_t *input;
shader_t *shader;
input = &tess;
shader = input->shader;
RB_DeformTessGeometry();
@ -1192,10 +1194,10 @@ void RB_StageIteratorGeneric( void )
//
// set face culling appropriately
//
GL_Cull( input->shader->cullType );
GL_Cull( shader->cullType );
// set polygon offset if necessary
if ( input->shader->polygonOffset )
if ( shader->polygonOffset )
{
qglEnable( GL_POLYGON_OFFSET_FILL );
qglPolygonOffset( r_offsetFactor->value, r_offsetUnits->value );
@ -1207,7 +1209,7 @@ void RB_StageIteratorGeneric( void )
// to avoid compiling those arrays since they will change
// during multipass rendering
//
if ( tess.numPasses > 1 || input->shader->multitextureEnv )
if ( tess.numPasses > 1 || shader->multitextureEnv )
{
setArraysOnce = qfalse;
qglDisableClientState (GL_COLOR_ARRAY);
@ -1275,7 +1277,7 @@ void RB_StageIteratorGeneric( void )
//
// reset polygon offset
//
if ( input->shader->polygonOffset )
if ( shader->polygonOffset )
{
qglDisable( GL_POLYGON_OFFSET_FILL );
}
@ -1291,7 +1293,6 @@ void RB_StageIteratorVertexLitTexture( void )
shader_t *shader;
input = &tess;
shader = input->shader;
//
@ -1312,7 +1313,7 @@ void RB_StageIteratorVertexLitTexture( void )
//
// set face culling appropriately
//
GL_Cull( input->shader->cullType );
GL_Cull( shader->cullType );
//
// set arrays and lock
@ -1365,8 +1366,10 @@ void RB_StageIteratorVertexLitTexture( void )
void RB_StageIteratorLightmappedMultitexture( void ) {
shaderCommands_t *input;
shader_t *shader;
input = &tess;
shader = input->shader;
//
// log this call
@ -1380,7 +1383,7 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
//
// set face culling appropriately
//
GL_Cull( input->shader->cullType );
GL_Cull( shader->cullType );
//
// set color, pointers, and lock

View file

@ -634,7 +634,7 @@ void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors )
for ( i = 0; i < tess.numVertexes; i++, pColors++ )
{
*pColors = * ( int * ) invModulate;
*pColors = c;
}
}

View file

@ -618,14 +618,14 @@ void R_BuildCloudData( shaderCommands_t *input )
tess.numIndexes = 0;
tess.numVertexes = 0;
if ( input->shader->sky.cloudHeight )
if ( shader->sky.cloudHeight )
{
for ( i = 0; i < MAX_SHADER_STAGES; i++ )
{
if ( !tess.xstages[i] ) {
break;
}
FillCloudBox( input->shader, i );
FillCloudBox( shader, i );
}
}
}

View file

@ -928,10 +928,6 @@ static void RB_SurfaceFace( srfSurfaceFace_t *surf ) {
tess.numIndexes += surf->numIndices;
v = surf->points[0];
ndx = tess.numVertexes;
numPoints = surf->numPoints;
if ( tess.shader->needsNormal ) {
@ -1046,7 +1042,6 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
// in the tess structure, so we may have to issue it in multiple passes
used = 0;
rows = 0;
while ( used < lodHeight - 1 ) {
// see how many rows of both verts and indexes we can add without overflowing
do {

View file

@ -63,7 +63,6 @@ static qboolean R_CullGrid( srfGridMesh_t *cv ) {
} else {
sphereCull = R_CullPointAndRadius( cv->localOrigin, cv->meshRadius );
}
boxCull = CULL_OUT;
// check for trivial reject
if ( sphereCull == CULL_OUT )