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" );
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 );
else
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;
bspShader_t *shader;
char *texture;
bspPlane_t *plane;
plane_t *buildPlane;
vec3_t pts[ 3 ];
bspDrawVert_t *vert[3];
int valid;
/* 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" ) )
// continue;
/* get plane */
plane = &bspPlanes[ side->planeNum ];
/* add build side */
buildSide = &buildBrush->sides[ buildBrush->numsides ];
buildBrush->numsides++;
@ -300,7 +295,6 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, qb
// - (triangles)
// - find the triangle that has most in common with our side
GetBestSurfaceTriangleMatchForBrushside(buildSide, vert);
valid = 0;
/* get texture name */
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);
}
valid = 1;
}
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",
@ -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[1][0], buildSide->texMat[1][1], FRAC(buildSide->texMat[1][2]),
texture,
// DEBUG: valid ? 0 : C_DETAIL
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);
}
valid = 1;
}
else
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 ],
texture,
shift[0], shift[1], rotate, scale[0], scale[1],
// DEBUG: valid ? 0 : C_DETAIL
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,
0.0f, 1.0f/16.0f, 0.0f,
texture,
// DEBUG: valid ? 0 : C_DETAIL
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 ],
texture,
0.0f, 0.0f, 0.0f, 0.25f, 0.25f,
// DEBUG: valid ? 0 : C_DETAIL
0
);
}

View File

@ -51,7 +51,7 @@ int objVertexCount = 0;
int objLastShaderNum = -1;
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;
/* 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);
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 );
firstLightmap = ds->lightmapNum[0] + deluxemap;
@ -114,7 +114,6 @@ static void ConvertSurfaceToOBJ( FILE *f, bspModel_t *model, int modelNum, bspDr
/* export faces */
for( i = 0; i < ds->numIndexes; i += 3 )
{
face = (i / 3);
a = bspDrawIndexes[ i + ds->firstIndex ];
c = bspDrawIndexes[ i + ds->firstIndex + 1 ];
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 )
{
shaderInfo_t *si;
char *c, filename[ 1024 ];
char filename[ 1024 ];
/* get shader */

View File

@ -626,14 +626,12 @@ void RadLightForTriangles( int num, int lightmapNum, rawLightmap_t *lm, shaderIn
{
int i, j, k, v;
bspDrawSurface_t *ds;
surfaceInfo_t *info;
float *radVertexLuxel;
radWinding_t rw;
/* get surface */
ds = &bspDrawSurfaces[ num ];
info = &surfaceInfos[ num ];
/* each triangle is a potential emitter */
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 origin[ 4 ], normal[ 4 ];
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 */

View File

@ -593,10 +593,10 @@ based on AllocateLightmapForSurface()
qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
{
bspDrawSurface_t *ds, *ds2;
surfaceInfo_t *info, *info2;
surfaceInfo_t *info;
int num2, n, i, axisNum;
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;
bspDrawVert_t *verts;
@ -672,7 +672,6 @@ qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
/* round to the lightmap resolution */
for( i = 0; i < 3; i++ )
{
exactSize[ i ] = lm->maxs[ i ] - lm->mins[ i ];
mins[ i ] = sampleSize * floor( lm->mins[ i ] / sampleSize );
maxs[ i ] = sampleSize * ceil( lm->maxs[ i ] / sampleSize );
size[ i ] = (maxs[ i ] - mins[ i ]) / sampleSize + 1.0f;
@ -763,7 +762,6 @@ qboolean AddSurfaceToRawLightmap( int num, rawLightmap_t *lm )
/* get surface */
num2 = lightSurfaces[ lm->firstLightSurface + n ];
ds2 = &bspDrawSurfaces[ num2 ];
info2 = &surfaceInfos[ num2 ];
verts = &yDrawVerts[ ds2->firstVert ];
/* 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 */
num2 = lightSurfaces[ lm->firstLightSurface ];
ds2 = &bspDrawSurfaces[ num2 ];
info2 = &surfaceInfos[ num2 ];
verts = &yDrawVerts[ ds2->firstVert ];
/* calculate lightmap origin */
@ -940,7 +937,7 @@ void SetupSurfaceLightmaps( void )
int i, j, k, s,num, num2;
bspModel_t *model;
bspLeaf_t *leaf;
bspDrawSurface_t *ds, *ds2;
bspDrawSurface_t *ds;
surfaceInfo_t *info, *info2;
rawLightmap_t *lm;
qboolean added;
@ -1154,7 +1151,6 @@ void SetupSurfaceLightmaps( void )
{
/* get info and attempt early out */
num2 = sortSurfaces[ j ];
ds2 = &bspDrawSurfaces[ num2 ];
info2 = &surfaceInfos[ num2 ];
if( info2->hasLightmap == qfalse || info2->lm != NULL )
continue;
@ -1215,7 +1211,7 @@ void StitchSurfaceLightmaps( void )
numStitched, numCandidates, numLuxels, f, fOld, start;
rawLightmap_t *lm, *a, *b, *c[ MAX_STITCH_CANDIDATES ];
float *luxel, *luxel2, *origin, *origin2, *normal, *normal2,
sampleSize, average[ 3 ], totalColor, ootc, *luxels[ MAX_STITCH_LUXELS ];
sampleSize, average[ 3 ], totalColor, ootc;
/* disabled for now */
@ -1330,7 +1326,6 @@ void StitchSurfaceLightmaps( void )
/* add luxel */
//% VectorSet( luxel2, 255, 0, 255 );
luxels[ numLuxels++ ] = luxel2;
VectorAdd( average, luxel2, average );
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
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;
surfaceInfo_t *info;
float *luxel, *deluxel;

View File

@ -989,7 +989,7 @@ int AnalyzeBSP( int argc, char **argv )
lump = (byte*) header + offset;
lumpInt = LittleLong( (int) *((int*) 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';
/* print basic lump info */

View File

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