summaryrefslogtreecommitdiff
path: root/src/renderer
diff options
context:
space:
mode:
authorThilo Schulz <arny@ats.s.bawue.de>2011-07-29 12:27:00 +0000
committerTim Angus <tim@ngus.net>2013-01-10 22:36:34 +0000
commite7c06719510940898e1f7f8215f4137202611308 (patch)
tree0aec0bf91daa568d8cb4a1c412037ca26b2f92a6 /src/renderer
parent76544bcec46127587d183a90e5ff817a71e1f139 (diff)
Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings
Diffstat (limited to 'src/renderer')
-rw-r--r--src/renderer/tr_backend.c2
-rw-r--r--src/renderer/tr_curve.c7
-rw-r--r--src/renderer/tr_flares.c3
-rw-r--r--src/renderer/tr_image.c3
-rw-r--r--src/renderer/tr_image_png.c2
-rw-r--r--src/renderer/tr_main.c4
-rw-r--r--src/renderer/tr_marks.c4
-rw-r--r--src/renderer/tr_model.c2
-rw-r--r--src/renderer/tr_model_iqm.c4
-rw-r--r--src/renderer/tr_public.h2
-rw-r--r--src/renderer/tr_shade.c17
-rw-r--r--src/renderer/tr_shade_calc.c2
-rw-r--r--src/renderer/tr_sky.c4
-rw-r--r--src/renderer/tr_surface.c5
-rw-r--r--src/renderer/tr_world.c1
15 files changed, 27 insertions, 35 deletions
diff --git a/src/renderer/tr_backend.c b/src/renderer/tr_backend.c
index a93d3fee..7e896800 100644
--- a/src/renderer/tr_backend.c
+++ b/src/renderer/tr_backend.c
@@ -754,7 +754,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();
}
diff --git a/src/renderer/tr_curve.c b/src/renderer/tr_curve.c
index 00cb2ed8..684329b1 100644
--- a/src/renderer/tr_curve.c
+++ b/src/renderer/tr_curve.c
@@ -205,10 +205,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 );
}
}
diff --git a/src/renderer/tr_flares.c b/src/renderer/tr_flares.c
index afef22a4..8fc8265f 100644
--- a/src/renderer/tr_flares.c
+++ b/src/renderer/tr_flares.c
@@ -115,7 +115,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;
@@ -153,7 +153,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 ) {
diff --git a/src/renderer/tr_image.c b/src/renderer/tr_image.c
index 50ba3a75..136daf5f 100644
--- a/src/renderer/tr_image.c
+++ b/src/renderer/tr_image.c
@@ -1099,14 +1099,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++) {
diff --git a/src/renderer/tr_image_png.c b/src/renderer/tr_image_png.c
index ef44c165..8b65f758 100644
--- a/src/renderer/tr_image_png.c
+++ b/src/renderer/tr_image_png.c
@@ -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));
diff --git a/src/renderer/tr_main.c b/src/renderer/tr_main.c
index 1a1bab8c..880850ef 100644
--- a/src/renderer/tr_main.c
+++ b/src/renderer/tr_main.c
@@ -913,7 +913,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 );
@@ -924,7 +923,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--;
}
@@ -1270,7 +1269,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:
diff --git a/src/renderer/tr_marks.c b/src/renderer/tr_marks.c
index b3b53330..6bcd7cb1 100644
--- a/src/renderer/tr_marks.c
+++ b/src/renderer/tr_marks.c
@@ -273,6 +273,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++;
diff --git a/src/renderer/tr_model.c b/src/renderer/tr_model.c
index 06473367..ce0bbdf7 100644
--- a/src/renderer/tr_model.c
+++ b/src/renderer/tr_model.c
@@ -932,7 +932,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++ ) {
diff --git a/src/renderer/tr_model_iqm.c b/src/renderer/tr_model_iqm.c
index 0e4672a1..a9144f44 100644
--- a/src/renderer/tr_model_iqm.c
+++ b/src/renderer/tr_model_iqm.c
@@ -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,
diff --git a/src/renderer/tr_public.h b/src/renderer/tr_public.h
index b1ccfbc1..fd2e4c05 100644
--- a/src/renderer/tr_public.h
+++ b/src/renderer/tr_public.h
@@ -111,7 +111,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
diff --git a/src/renderer/tr_shade.c b/src/renderer/tr_shade.c
index f12519b4..c71a8d34 100644
--- a/src/renderer/tr_shade.c
+++ b/src/renderer/tr_shade.c
@@ -1175,8 +1175,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();
@@ -1193,10 +1195,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 );
@@ -1208,7 +1210,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);
@@ -1276,7 +1278,7 @@ void RB_StageIteratorGeneric( void )
//
// reset polygon offset
//
- if ( input->shader->polygonOffset )
+ if ( shader->polygonOffset )
{
qglDisable( GL_POLYGON_OFFSET_FILL );
}
@@ -1292,7 +1294,6 @@ void RB_StageIteratorVertexLitTexture( void )
shader_t *shader;
input = &tess;
-
shader = input->shader;
//
@@ -1313,7 +1314,7 @@ void RB_StageIteratorVertexLitTexture( void )
//
// set face culling appropriately
//
- GL_Cull( input->shader->cullType );
+ GL_Cull( shader->cullType );
//
// set arrays and lock
@@ -1366,8 +1367,10 @@ void RB_StageIteratorVertexLitTexture( void )
void RB_StageIteratorLightmappedMultitexture( void ) {
shaderCommands_t *input;
+ shader_t *shader;
input = &tess;
+ shader = input->shader;
//
// log this call
@@ -1381,7 +1384,7 @@ void RB_StageIteratorLightmappedMultitexture( void ) {
//
// set face culling appropriately
//
- GL_Cull( input->shader->cullType );
+ GL_Cull( shader->cullType );
//
// set color, pointers, and lock
diff --git a/src/renderer/tr_shade_calc.c b/src/renderer/tr_shade_calc.c
index 8d02177b..a88aac9f 100644
--- a/src/renderer/tr_shade_calc.c
+++ b/src/renderer/tr_shade_calc.c
@@ -635,7 +635,7 @@ void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors )
for ( i = 0; i < tess.numVertexes; i++, pColors++ )
{
- *pColors = * ( int * ) invModulate;
+ *pColors = c;
}
}
diff --git a/src/renderer/tr_sky.c b/src/renderer/tr_sky.c
index 5c7788c0..ffe84f50 100644
--- a/src/renderer/tr_sky.c
+++ b/src/renderer/tr_sky.c
@@ -619,14 +619,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 );
}
}
}
diff --git a/src/renderer/tr_surface.c b/src/renderer/tr_surface.c
index afb4121e..0fcfc3f0 100644
--- a/src/renderer/tr_surface.c
+++ b/src/renderer/tr_surface.c
@@ -929,10 +929,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 ) {
@@ -1047,7 +1043,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 {
diff --git a/src/renderer/tr_world.c b/src/renderer/tr_world.c
index feebb2ef..8f91285e 100644
--- a/src/renderer/tr_world.c
+++ b/src/renderer/tr_world.c
@@ -64,7 +64,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 )