some warning fixes

This commit is contained in:
Rudolf Polzer 2011-06-05 19:32:39 +02:00
parent dbaf1a8f00
commit c75d4746fd
8 changed files with 11 additions and 36 deletions

View File

@ -165,7 +165,7 @@ static void ConvertSurface( FILE *f, bspModel_t *model, int modelNum, bspDrawSur
fprintf( f, "\t*PROP_RECVSHADOW\t1\r\n" ); fprintf( f, "\t*PROP_RECVSHADOW\t1\r\n" );
if(lightmapsAsTexcoord) if(lightmapsAsTexcoord)
{ {
if(ds->lightmapNum[0] >= 0 && ds->lightmapNum[0] + deluxemap < numLightmapsASE) if(ds->lightmapNum[0] >= 0 && ds->lightmapNum[0] + (int)deluxemap < numLightmapsASE)
fprintf( f, "\t*MATERIAL_REF\t%d\r\n", ds->lightmapNum[0] + deluxemap ); fprintf( f, "\t*MATERIAL_REF\t%d\r\n", ds->lightmapNum[0] + deluxemap );
else else
Sys_Printf( "WARNING: lightmap %d out of range, not exporting\n", ds->lightmapNum[0] + deluxemap ); Sys_Printf( "WARNING: lightmap %d out of range, not exporting\n", ds->lightmapNum[0] + deluxemap );

View File

@ -215,11 +215,9 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
side_t *buildSide; side_t *buildSide;
bspShader_t *shader; bspShader_t *shader;
char *texture; char *texture;
bspPlane_t *plane;
plane_t *buildPlane; plane_t *buildPlane;
vec3_t pts[ 3 ]; vec3_t pts[ 3 ];
bspDrawVert_t *vert[3]; bspDrawVert_t *vert[3];
int valid;
/* start brush */ /* start brush */
@ -256,9 +254,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
//if( !Q_stricmp( shader->shader, "default" ) || !Q_stricmp( shader->shader, "noshader" ) ) //if( !Q_stricmp( shader->shader, "default" ) || !Q_stricmp( shader->shader, "noshader" ) )
// continue; // continue;
/* get plane */
plane = &bspPlanes[ side->planeNum ];
/* add build side */ /* add build side */
buildSide = &buildBrush->sides[ buildBrush->numsides ]; buildSide = &buildBrush->sides[ buildBrush->numsides ];
buildBrush->numsides++; buildBrush->numsides++;
@ -300,7 +295,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
// - (triangles) // - (triangles)
// - find the triangle that has most in common with our side // - find the triangle that has most in common with our side
GetBestSurfaceTriangleMatchForBrushside(buildSide, vert); GetBestSurfaceTriangleMatchForBrushside(buildSide, vert);
valid = 0;
/* get texture name */ /* get texture name */
if( !Q_strncasecmp( buildSide->shaderInfo->shader, "textures/", 9 ) ) if( !Q_strncasecmp( buildSide->shaderInfo->shader, "textures/", 9 ) )
@ -369,7 +363,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
); );
VectorSet(buildSide->texMat[i], D0 / D, D1 / D, D2 / D); VectorSet(buildSide->texMat[i], D0 / D, D1 / D, D2 / D);
} }
valid = 1;
} }
else else
fprintf(stderr, "degenerate triangle found when solving texMat equations for\n(%f %f %f) (%f %f %f) (%f %f %f)\n( %f %f %f )\n( %f %f %f ) -> ( %f %f )\n( %f %f %f ) -> ( %f %f )\n( %f %f %f ) -> ( %f %f )\n", fprintf(stderr, "degenerate triangle found when solving texMat equations for\n(%f %f %f) (%f %f %f) (%f %f %f)\n( %f %f %f )\n( %f %f %f ) -> ( %f %f )\n( %f %f %f ) -> ( %f %f )\n( %f %f %f ) -> ( %f %f )\n",
@ -390,7 +383,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
buildSide->texMat[0][0], buildSide->texMat[0][1], FRAC(buildSide->texMat[0][2]), buildSide->texMat[0][0], buildSide->texMat[0][1], FRAC(buildSide->texMat[0][2]),
buildSide->texMat[1][0], buildSide->texMat[1][1], FRAC(buildSide->texMat[1][2]), buildSide->texMat[1][0], buildSide->texMat[1][1], FRAC(buildSide->texMat[1][2]),
texture, texture,
// DEBUG: valid ? 0 : C_DETAIL
0 0
); );
} }
@ -450,7 +442,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
); );
VectorSet(sts[i], D0 / D, D1 / D, D2 / D); VectorSet(sts[i], D0 / D, D1 / D, D2 / D);
} }
valid = 1;
} }
else else
fprintf(stderr, "degenerate triangle found when solving texDef equations\n"); // FIXME add stuff here fprintf(stderr, "degenerate triangle found when solving texDef equations\n"); // FIXME add stuff here
@ -482,7 +473,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
pts[ 2 ][ 0 ], pts[ 2 ][ 1 ], pts[ 2 ][ 2 ], pts[ 2 ][ 0 ], pts[ 2 ][ 1 ], pts[ 2 ][ 2 ],
texture, texture,
shift[0], shift[1], rotate, scale[0], scale[1], shift[0], shift[1], rotate, scale[0], scale[1],
// DEBUG: valid ? 0 : C_DETAIL
0 0
); );
} }
@ -511,7 +501,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
1.0f/16.0f, 0.0f, 0.0f, 1.0f/16.0f, 0.0f, 0.0f,
0.0f, 1.0f/16.0f, 0.0f, 0.0f, 1.0f/16.0f, 0.0f,
texture, texture,
// DEBUG: valid ? 0 : C_DETAIL
0 0
); );
} }
@ -523,7 +512,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
pts[ 2 ][ 0 ], pts[ 2 ][ 1 ], pts[ 2 ][ 2 ], pts[ 2 ][ 0 ], pts[ 2 ][ 1 ], pts[ 2 ][ 2 ],
texture, texture,
0.0f, 0.0f, 0.0f, 0.25f, 0.25f, 0.0f, 0.0f, 0.0f, 0.25f, 0.25f,
// DEBUG: valid ? 0 : C_DETAIL
0 0
); );
} }

View File

@ -51,7 +51,7 @@ int objVertexCount = 0;
int objLastShaderNum = -1; int objLastShaderNum = -1;
static void ConvertSurfaceToOBJ( FILE *f, bspModel_t *model, int modelNum, bspDrawSurface_t *ds, int surfaceNum, vec3_t origin ) static void ConvertSurfaceToOBJ( FILE *f, bspModel_t *model, int modelNum, bspDrawSurface_t *ds, int surfaceNum, vec3_t origin )
{ {
int i, v, face, a, b, c; int i, v, a, b, c;
bspDrawVert_t *dv; bspDrawVert_t *dv;
/* ignore patches for now */ /* ignore patches for now */
@ -77,7 +77,7 @@ static void ConvertSurfaceToOBJ( FILE *f, bspModel_t *model, int modelNum, bspDr
fprintf(f, "usemtl lm_%04d\r\n", ds->lightmapNum[0] + deluxemap); fprintf(f, "usemtl lm_%04d\r\n", ds->lightmapNum[0] + deluxemap);
objLastShaderNum = ds->lightmapNum[0] + deluxemap; objLastShaderNum = ds->lightmapNum[0] + deluxemap;
} }
if(ds->lightmapNum[0] + deluxemap < firstLightmap) if(ds->lightmapNum[0] + (int)deluxemap < firstLightmap)
{ {
Sys_Printf( "WARNING: lightmap %d out of range (exporting anyway)\n", ds->lightmapNum[0] + deluxemap ); Sys_Printf( "WARNING: lightmap %d out of range (exporting anyway)\n", ds->lightmapNum[0] + deluxemap );
firstLightmap = ds->lightmapNum[0] + deluxemap; firstLightmap = ds->lightmapNum[0] + deluxemap;
@ -114,7 +114,6 @@ static void ConvertSurfaceToOBJ( FILE *f, bspModel_t *model, int modelNum, bspDr
/* export faces */ /* export faces */
for( i = 0; i < ds->numIndexes; i += 3 ) for( i = 0; i < ds->numIndexes; i += 3 )
{ {
face = (i / 3);
a = bspDrawIndexes[ i + ds->firstIndex ]; a = bspDrawIndexes[ i + ds->firstIndex ];
c = bspDrawIndexes[ i + ds->firstIndex + 1 ]; c = bspDrawIndexes[ i + ds->firstIndex + 1 ];
b = bspDrawIndexes[ i + ds->firstIndex + 2 ]; b = bspDrawIndexes[ i + ds->firstIndex + 2 ];
@ -160,7 +159,7 @@ exports a bsp shader to an ase chunk
static void ConvertShaderToMTL( FILE *f, bspShader_t *shader, int shaderNum ) static void ConvertShaderToMTL( FILE *f, bspShader_t *shader, int shaderNum )
{ {
shaderInfo_t *si; shaderInfo_t *si;
char *c, filename[ 1024 ]; char filename[ 1024 ];
/* get shader */ /* get shader */

View File

@ -626,14 +626,12 @@ void RadLightForTriangles( int num, int lightmapNum, rawLightmap_t *lm, shaderIn
{ {
int i, j, k, v; int i, j, k, v;
bspDrawSurface_t *ds; bspDrawSurface_t *ds;
surfaceInfo_t *info;
float *radVertexLuxel; float *radVertexLuxel;
radWinding_t rw; radWinding_t rw;
/* get surface */ /* get surface */
ds = &bspDrawSurfaces[ num ]; ds = &bspDrawSurfaces[ num ];
info = &surfaceInfos[ num ];
/* each triangle is a potential emitter */ /* each triangle is a potential emitter */
rw.numVerts = 3; rw.numVerts = 3;

View File

@ -1788,7 +1788,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, vec3_t sampl
vec3_t deluxel[ 3 ]; vec3_t deluxel[ 3 ];
vec3_t origin[ 4 ], normal[ 4 ]; vec3_t origin[ 4 ], normal[ 4 ];
float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } }; float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
vec3_t color, direction, total; vec3_t color, direction = { 0, 0, 0 }, total;
/* limit check */ /* limit check */

View File

@ -593,10 +593,10 @@ based on AllocateLightmapForSurface()
qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm ) qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
{ {
bspDrawSurface_t *ds, *ds2; bspDrawSurface_t *ds, *ds2;
surfaceInfo_t *info, *info2; surfaceInfo_t *info;
int num2, n, i, axisNum; int num2, n, i, axisNum;
float s, t, d, len, sampleSize; float s, t, d, len, sampleSize;
vec3_t mins, maxs, origin, faxis, size, exactSize, delta, normalized, vecs[ 2 ]; vec3_t mins, maxs, origin, faxis, size, delta, normalized, vecs[ 2 ];
vec4_t plane; vec4_t plane;
bspDrawVert_t *verts; bspDrawVert_t *verts;
@ -672,7 +672,6 @@ qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
/* round to the lightmap resolution */ /* round to the lightmap resolution */
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {
exactSize[ i ] = lm->maxs[ i ] - lm->mins[ i ];
mins[ i ] = sampleSize * floor( lm->mins[ i ] / sampleSize ); mins[ i ] = sampleSize * floor( lm->mins[ i ] / sampleSize );
maxs[ i ] = sampleSize * ceil( lm->maxs[ i ] / sampleSize ); maxs[ i ] = sampleSize * ceil( lm->maxs[ i ] / sampleSize );
size[ i ] = (maxs[ i ] - mins[ i ]) / sampleSize + 1.0f; size[ i ] = (maxs[ i ] - mins[ i ]) / sampleSize + 1.0f;
@ -763,7 +762,6 @@ qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
/* get surface */ /* get surface */
num2 = lightSurfaces[ lm->firstLightSurface + n ]; num2 = lightSurfaces[ lm->firstLightSurface + n ];
ds2 = &bspDrawSurfaces[ num2 ]; ds2 = &bspDrawSurfaces[ num2 ];
info2 = &surfaceInfos[ num2 ];
verts = &yDrawVerts[ ds2->firstVert ]; verts = &yDrawVerts[ ds2->firstVert ];
/* set the lightmap texture coordinates in yDrawVerts in [0, superSample * lm->customWidth] space */ /* set the lightmap texture coordinates in yDrawVerts in [0, superSample * lm->customWidth] space */
@ -786,7 +784,6 @@ qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
/* get first drawsurface */ /* get first drawsurface */
num2 = lightSurfaces[ lm->firstLightSurface ]; num2 = lightSurfaces[ lm->firstLightSurface ];
ds2 = &bspDrawSurfaces[ num2 ]; ds2 = &bspDrawSurfaces[ num2 ];
info2 = &surfaceInfos[ num2 ];
verts = &yDrawVerts[ ds2->firstVert ]; verts = &yDrawVerts[ ds2->firstVert ];
/* calculate lightmap origin */ /* calculate lightmap origin */
@ -940,7 +937,7 @@ void SetupSurfaceLightmaps( void )
int i, j, k, s,num, num2; int i, j, k, s,num, num2;
bspModel_t *model; bspModel_t *model;
bspLeaf_t *leaf; bspLeaf_t *leaf;
bspDrawSurface_t *ds, *ds2; bspDrawSurface_t *ds;
surfaceInfo_t *info, *info2; surfaceInfo_t *info, *info2;
rawLightmap_t *lm; rawLightmap_t *lm;
qboolean added; qboolean added;
@ -1154,7 +1151,6 @@ void SetupSurfaceLightmaps( void )
{ {
/* get info and attempt early out */ /* get info and attempt early out */
num2 = sortSurfaces[ j ]; num2 = sortSurfaces[ j ];
ds2 = &bspDrawSurfaces[ num2 ];
info2 = &surfaceInfos[ num2 ]; info2 = &surfaceInfos[ num2 ];
if( info2->hasLightmap == qfalse || info2->lm != NULL ) if( info2->hasLightmap == qfalse || info2->lm != NULL )
continue; continue;
@ -1215,7 +1211,7 @@ void StitchSurfaceLightmaps( void )
numStitched, numCandidates, numLuxels, f, fOld, start; numStitched, numCandidates, numLuxels, f, fOld, start;
rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ]; rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ];
float *luxel, *luxel2, *origin, *origin2, *normal, *normal2, float *luxel, *luxel2, *origin, *origin2, *normal, *normal2,
sampleSize, average[ 3 ], totalColor, ootc, *luxels[ MAX_STITCH_LUXELS ]; sampleSize, average[ 3 ], totalColor, ootc;
/* disabled for now */ /* disabled for now */
@ -1330,7 +1326,6 @@ void StitchSurfaceLightmaps( void )
/* add luxel */ /* add luxel */
//% VectorSet( luxel2, 255, 0, 255 ); //% VectorSet( luxel2, 255, 0, 255 );
luxels[ numLuxels++ ] = luxel2;
VectorAdd( average, luxel2, average ); VectorAdd( average, luxel2, average );
totalColor += luxel2[ 3 ]; totalColor += luxel2[ 3 ];
} }
@ -1921,7 +1916,7 @@ for a given surface lightmap, find output lightmap pages and positions for it
#define LIGHTMAP_RESERVE_COUNT 1 #define LIGHTMAP_RESERVE_COUNT 1
static void FindOutLightmaps( rawLightmap_t *lm ) static void FindOutLightmaps( rawLightmap_t *lm )
{ {
int i, j, k, lightmapNum, xMax, yMax, x, y, sx, sy, ox, oy, offset; int i, j, k, lightmapNum, xMax, yMax, x = -1, y = -1, sx, sy, ox, oy, offset;
outLightmap_t *olm; outLightmap_t *olm;
surfaceInfo_t *info; surfaceInfo_t *info;
float *luxel, *deluxel; float *luxel, *deluxel;

View File

@ -989,7 +989,7 @@ int AnalyzeBSP( int argc, char **argv )
lump = (byte*) header + offset; lump = (byte*) header + offset;
lumpInt = LittleLong( (int) *((int*) lump) ); lumpInt = LittleLong( (int) *((int*) lump) );
lumpFloat = LittleFloat( (float) *((float*) lump) ); lumpFloat = LittleFloat( (float) *((float*) lump) );
memcpy( lumpString, (char*) lump, (length < sizeof(lumpString) ? length : sizeof(lumpString)-1) ); memcpy( lumpString, (char*) lump, ((size_t)length < sizeof(lumpString) ? (size_t)length : sizeof(lumpString)-1) );
lumpString[ sizeof(lumpString)-1 ] = '\0'; lumpString[ sizeof(lumpString)-1 ] = '\0';
/* print basic lump info */ /* print basic lump info */

View File

@ -330,23 +330,18 @@ void FixSurfaceJunctions( mapDrawSurface_t *ds ) {
int i, j, k; int i, j, k;
edgeLine_t *e; edgeLine_t *e;
edgePoint_t *p; edgePoint_t *p;
int originalVerts;
int counts[MAX_SURFACE_VERTS]; int counts[MAX_SURFACE_VERTS];
int originals[MAX_SURFACE_VERTS]; int originals[MAX_SURFACE_VERTS];
int firstVert[MAX_SURFACE_VERTS];
bspDrawVert_t verts[MAX_SURFACE_VERTS], *v1, *v2; bspDrawVert_t verts[MAX_SURFACE_VERTS], *v1, *v2;
int numVerts; int numVerts;
float start, end, frac, c; float start, end, frac, c;
vec3_t delta; vec3_t delta;
originalVerts = ds->numVerts;
numVerts = 0; numVerts = 0;
for ( i = 0 ; i < ds->numVerts ; i++ ) for ( i = 0 ; i < ds->numVerts ; i++ )
{ {
counts[i] = 0; counts[i] = 0;
firstVert[i] = numVerts;
// copy first vert // copy first vert
if ( numVerts == MAX_SURFACE_VERTS ) { if ( numVerts == MAX_SURFACE_VERTS ) {