Skip to content

Commit 57b2e3c

Browse files
committed
Com compiles without warnings on gcc 7.2.0. Might just test clang too
1 parent a099619 commit 57b2e3c

2 files changed

Lines changed: 36 additions & 76 deletions

File tree

code/renderer_oa/tr_model_mdo.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ R_LoadMDO
4040
=================
4141
*/
4242
qboolean R_LoadMDO( model_t *mod, void *buffer, int filesize, const char *mod_name ) {
43-
int i, j, k, lodindex;
43+
int i, j, lodindex;
4444
mdoHeader_t *pinmodel, *mdo;
4545
mdoFrame_t *frame;
4646
mdoLOD_t *lod;
@@ -103,7 +103,7 @@ qboolean R_LoadMDO( model_t *mod, void *buffer, int filesize, const char *mod_na
103103
mod->numLods = mdo->numLODs; // ... don't forget this or LODs won't work
104104

105105
// swap all the frames
106-
frameSize = (int)( &((mdoFrame_t *)0)->bones[ mdo->numBones ] );
106+
frameSize = (size_t)( &((mdoFrame_t *)0)->bones[ mdo->numBones ] );
107107
for ( i = 0 ; i < mdo->numFrames ; i++, frame++) {
108108
frame = (mdoFrame_t *) ( (byte *)mdo + mdo->ofsFrames + i * frameSize );
109109
frame->radius = LittleFloat( frame->radius );
@@ -206,7 +206,7 @@ qboolean R_LoadMDO( model_t *mod, void *buffer, int filesize, const char *mod_na
206206
// find the next LOD
207207
lod = (mdoLOD_t *)( (byte *)lod + lod->ofsEnd );
208208
}
209-
209+
210210
return qtrue;
211211
}
212212

@@ -357,7 +357,7 @@ void R_AddMDOSurfaces( trRefEntity_t *ent ) {
357357
mdoLOD_t *lod;
358358
shader_t *shader;
359359
skin_t *skin;
360-
int i, j, k;
360+
int i, j;
361361
int lodnum = 0;
362362
int fogNum = 0;
363363
int cull;
@@ -581,8 +581,6 @@ md3Tag_t *R_GetMDOTag( mdoHeader_t *mod, int framenum, const char *tagName, md3T
581581

582582
if ( !strcmp( bone->name, tagName ) )
583583
{
584-
vec4_t quat;
585-
vec3_t trans;
586584
float matrix[3][4];
587585

588586
Q_strncpyz(dest->name, bone->name, sizeof(dest->name));
@@ -618,7 +616,7 @@ void RB_SurfaceMDO( mdoSurface_t *surface )
618616
{
619617
int i, j, k;
620618
int frameSize;
621-
float frontlerp, backlerp;
619+
float backlerp;
622620
int *triangles;
623621
int indexes;
624622
int baseIndex, baseVertex;
@@ -629,8 +627,7 @@ void RB_SurfaceMDO( mdoSurface_t *surface )
629627
mdoHeader_t *header;
630628
mdoFrame_t *frame;
631629
mdoFrame_t *oldFrame;
632-
boneMatrix_t bones[MDO_MAX_BONES], *bonePtr, *bone;
633-
mdoBoneInfo_t *boneInfo;
630+
boneMatrix_t bones[MDO_MAX_BONES], *bonePtr, *bone;
634631
refEntity_t *ent;
635632

636633
ent = &backEnd.currentEntity->e;
@@ -640,12 +637,10 @@ void RB_SurfaceMDO( mdoSurface_t *surface )
640637
if (ent->oldframe == ent->frame)
641638
{
642639
backlerp = 0; // if backlerp is 0, lerping is off and frontlerp is never used
643-
frontlerp = 1;
644640
}
645641
else
646642
{
647643
backlerp = ent->backlerp;
648-
frontlerp = 1.0f - backlerp;
649644
}
650645

651646
header = (mdoHeader_t *)((byte *)surface - surface->ofsHeader);
@@ -678,9 +673,6 @@ void RB_SurfaceMDO( mdoSurface_t *surface )
678673
boneRefList = ( int * )( (byte *)surface + surface->ofsBoneRefs );
679674
boneRef = boneRefList;
680675

681-
// boneInfos
682-
boneInfo = (mdoBoneInfo_t *)((byte *)header + header->ofsBones);
683-
684676
bonePtr = bones;
685677
for( i = 0 ; i < surface->numBoneRefs ; i++, boneRef++ )
686678
{

code/renderer_oa/tr_shade_calc.c

Lines changed: 30 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ void RB_CalcEnvironmentTexCoordsR( float *st )
11501150
vec3_t sundy;
11511151
float size;
11521152
float dist;
1153-
vec3_t origin, vec1, vec2;
1153+
vec3_t vec1, vec2;
11541154

11551155
v = tess.xyz[0];
11561156
normal = tess.normal[0];
@@ -1196,7 +1196,7 @@ void RB_CalcCelTexCoords( float *st )
11961196
{
11971197
int i;
11981198
float *v, *normal;
1199-
vec3_t viewer, reflected, lightdir, directedLight, lightdured;
1199+
vec3_t viewer, reflected, lightdir, directedLight;
12001200
float d, l, p;
12011201

12021202

@@ -1385,12 +1385,12 @@ void RB_CalcRotateTexCoords( float degsPerSecond, float *st )
13851385

13861386
void RB_CalcAtlasTexCoords( const atlas_t *at, float *st )
13871387
{
1388-
float p;
13891388
texModInfo_t tmi;
13901389
int w = (int)at->width;
13911390
int h = (int)at->height;
13921391

1393-
int framex, framey;
1392+
int framex = 0;
1393+
int framey = 0;
13941394

13951395
// modes:
13961396
// 0 - static / animated
@@ -1707,28 +1707,16 @@ static void RB_CalcDiffuseColor_scalar( unsigned char *colors )
17071707
// leilei - reveal normals to GLSL for light processing. HACK HACK HACK HACK HACK HACK
17081708
void RB_CalcNormal( unsigned char *colors )
17091709
{
1710-
int i, j;
17111710
float *v;
1712-
float *normal = ( float * ) tess.normal;
1713-
float incoming;
1714-
trRefEntity_t *ent;
1715-
int ambientLightInt;
1716-
vec3_t ambientLight;
1717-
vec3_t lightDir;
1718-
vec3_t directedLight;
1711+
float *normal = ( float * ) tess.normal;
17191712
vec3_t n, m;
17201713
int numVertexes;
1721-
float mult = r_shownormals->value - 1;
1722-
ent = backEnd.currentEntity;
1723-
ambientLightInt = ent->ambientLightInt;
17241714

17251715
v = tess.xyz[0];
17261716
//normal = tess.normal[0];
17271717

1728-
1729-
17301718
numVertexes = tess.numVertexes;
1731-
for (i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) {
1719+
for (int i = 0 ; i < numVertexes ; i++, v += 4, normal += 4) {
17321720
int y;
17331721
float mid;
17341722
for (y=0;y<3;y++){
@@ -1765,7 +1753,6 @@ void RB_CalcNormal( unsigned char *colors )
17651753
void RB_CalcDiffuseColor_Specular( unsigned char *colors )
17661754
{
17671755
int i, j;
1768-
int speccap = 0;
17691756
float spec;
17701757
float *v, *normal;
17711758
float incoming;
@@ -1825,16 +1812,13 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18251812

18261813
{
18271814
float ilength;
1828-
int b;
18291815
vec3_t viewer, reflected;
1830-
float l, d;
1831-
// int b;
18321816

18331817
VectorCopy( backEnd.currentEntity->lightDir, lightDir );
18341818
VectorNormalizeFast( lightDir );
18351819

18361820
// calculate the specular color
1837-
d = DotProduct (normal, lightDir);
1821+
float d = DotProduct (normal, lightDir);
18381822

18391823
// we don't optimize for the d < 0 case since this tends to
18401824
// cause visual artifacts such as faceted "snapping"
@@ -1844,7 +1828,7 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18441828

18451829
VectorSubtract (backEnd.or.viewOrigin, v, viewer);
18461830
ilength = Q_rsqrt( DotProduct( viewer, viewer ) );
1847-
l = DotProduct (reflected, viewer);
1831+
float l = DotProduct (reflected, viewer);
18481832
l *= ilength;
18491833

18501834
if (l < 0) {
@@ -1869,14 +1853,20 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18691853
}
18701854

18711855
j = ri.ftol(ambientLight[0] + incoming * directedLight[0]);
1872-
if ( j > shadecap ) {j = shadecap ; j += ri.ftol(spec * specularLight[0]); }
1856+
if ( j > shadecap ) {
1857+
j = shadecap;
1858+
j += ri.ftol(spec * specularLight[0]);
1859+
}
18731860

18741861
// j += specularLight[0];
18751862
if ( j > 255) j = 255;
18761863
colors[i*4+0] = j;
18771864

18781865
j = ri.ftol(ambientLight[1] + incoming * directedLight[1]);
1879-
if ( j > shadecap ) { j = shadecap ; j += ri.ftol(spec * specularLight[1]); }
1866+
if ( j > shadecap ) {
1867+
j = shadecap;
1868+
j += ri.ftol(spec * specularLight[1]);
1869+
}
18801870

18811871
// j += specularLight[1];
18821872
if ( j > 255) j = 255;
@@ -1885,7 +1875,10 @@ void RB_CalcDiffuseColor_Specular( unsigned char *colors )
18851875
colors[i*4+1] = j;
18861876

18871877
j = ri.ftol(ambientLight[2] + incoming * directedLight[2]);
1888-
if ( j > shadecap ) {j = shadecap ; j += ri.ftol(spec * specularLight[2]); }
1878+
if ( j > shadecap ) {
1879+
j = shadecap;
1880+
j += ri.ftol(spec * specularLight[2]);
1881+
}
18891882

18901883
// j += specularLight[2];
18911884
if ( j > 255) j = 255;
@@ -1925,15 +1918,15 @@ void RB_CalcUniformColor( unsigned char *colors )
19251918
int i;
19261919
trRefEntity_t *ent;
19271920
vec3_t ambientLight;
1928-
vec3_t directedLight;
1921+
//vec3_t directedLight;
19291922
vec4_t uniformLight;
19301923
int numVertexes;
19311924
float normalize;
19321925

19331926
ent = backEnd.currentEntity;
19341927

19351928
VectorCopy( ent->ambientLight, ambientLight );
1936-
VectorCopy( ent->directedLight, directedLight );
1929+
//VectorCopy( ent->directedLight, directedLight );
19371930

19381931
VectorAdd( ambientLight, ambientLight/*directedLight*/, uniformLight );
19391932

@@ -1990,22 +1983,11 @@ void RB_CalcFlatAmbient( unsigned char *colors )
19901983
{
19911984
int i, j;
19921985
float *v, *normal;
1993-
float incoming;
19941986
trRefEntity_t *ent;
1995-
int ambientLightInt;
19961987
vec3_t ambientLight;
1997-
vec3_t lightDir;
1998-
vec3_t directedLight;
19991988
int numVertexes;
20001989
ent = backEnd.currentEntity;
2001-
ambientLightInt = ent->ambientLightInt;
20021990
VectorCopy( ent->ambientLight, ambientLight );
2003-
//VectorCopy( ent->directedLight, directedLight );
2004-
2005-
2006-
lightDir[0] = 0;
2007-
lightDir[1] = 0;
2008-
lightDir[2] = 1;
20091991

20101992
v = tess.xyz[0];
20111993
normal = tess.normal[0];
@@ -2038,15 +2020,11 @@ void RB_CalcFlatDirect( unsigned char *colors )
20382020
{
20392021
int i, j;
20402022
float *v, *normal;
2041-
float incoming;
20422023
trRefEntity_t *ent;
2043-
int ambientLightInt;
20442024
vec3_t ambientLight;
2045-
vec3_t lightDir;
20462025
vec3_t directedLight;
20472026
int numVertexes;
20482027
ent = backEnd.currentEntity;
2049-
ambientLightInt = ent->ambientLightInt;
20502028
VectorCopy( ent->ambientLight, ambientLight );
20512029
VectorCopy( ent->directedLight, directedLight );
20522030

@@ -2060,10 +2038,6 @@ void RB_CalcFlatDirect( unsigned char *colors )
20602038
if (directedLight[1] < 0) directedLight[1] = 0;
20612039
if (directedLight[2] < 0) directedLight[2] = 0;
20622040

2063-
lightDir[0] = 0;
2064-
lightDir[1] = 0;
2065-
lightDir[2] = 1;
2066-
20672041
v = tess.xyz[0];
20682042
normal = tess.normal[0];
20692043

@@ -2118,14 +2092,12 @@ void RB_CalcEyes( float *st, qboolean theothereye)
21182092
{
21192093
int i;
21202094
float *v, *normal;
2121-
vec3_t viewer, reflected, eyepos, eyelook, stare;
2122-
float d, l, erp;
2095+
vec3_t viewer, reflected, eyepos, stare;
2096+
float d;
21232097
int idk;
21242098

2125-
vec3_t stareat, staree;
2126-
float dilation = 2;
2099+
vec3_t stareat;
21272100

2128-
VectorCopy(lightOrigin, staree);
21292101
VectorCopy(backEnd.or.viewOrigin, stareat);
21302102

21312103

@@ -2156,11 +2128,11 @@ void RB_CalcEyes( float *st, qboolean theothereye)
21562128
// We need to adjust the stareat vectors to local coordinates
21572129

21582130

2159-
vec3_t temp;
2160-
VectorSubtract( stareat, backEnd.currentEntity->e.origin, temp );
2161-
stareat[0] = DotProduct( temp, backEnd.currentEntity->e.axis[0] );
2162-
stareat[1] = DotProduct( temp, backEnd.currentEntity->e.axis[1] );
2163-
stareat[2] = DotProduct( temp, backEnd.currentEntity->e.axis[2] );
2131+
vec3_t temp;
2132+
VectorSubtract( stareat, backEnd.currentEntity->e.origin, temp );
2133+
stareat[0] = DotProduct( temp, backEnd.currentEntity->e.axis[0] );
2134+
stareat[1] = DotProduct( temp, backEnd.currentEntity->e.axis[1] );
2135+
stareat[2] = DotProduct( temp, backEnd.currentEntity->e.axis[2] );
21642136

21652137

21662138

@@ -2195,8 +2167,6 @@ if (r_leidebugeye->integer == 2)
21952167

21962168
for (i = 0 ; i < tess.numVertexes ; i++, v += 4, normal += 4, st += 2 )
21972169
{
2198-
2199-
float norm1, norm2;
22002170
// Base eye position
22012171
VectorSubtract (backEnd.or.viewOrigin, v, viewer);
22022172
//VectorSubtract (backEnd.currentEntity->e.eyepos[0], v, viewer);
@@ -2228,8 +2198,6 @@ if (r_leidebugeye->integer == 2)
22282198
VectorSubtract (stareat, v, stare);
22292199
VectorNormalizeFast (stare);
22302200

2231-
erp = DotProduct (normal, stare);
2232-
22332201
// Limit the eye's turning so it doesn't have dead eyes
22342202
for (idk=0;idk<3;idk++){
22352203
stare[idk] *= 22;

0 commit comments

Comments
 (0)