Reduced the warning count further

This commit is contained in:
sago007
2018-02-06 20:59:19 +01:00
parent 509f7baeed
commit a099619f9e
3 changed files with 121 additions and 119 deletions

View File

@@ -194,20 +194,21 @@ qhandle_t R_RegisterMDO(const char *name, model_t *mod)
unsigned *u;
void *v;
} buf;
int ident;
qboolean loaded = qfalse;
int filesize;
filesize = ri.FS_ReadFile(name, (void **) &buf.v);
#if 0
int filesize =
#endif
ri.FS_ReadFile(name, (void **) &buf.v);
if(!buf.u)
{
mod->type = MOD_BAD;
return 0;
}
ident = LittleLong(*(unsigned *)buf.u);
#if 0
int ident = LittleLong(*(unsigned *)buf.u);
if(ident == MDO_IDENT)
loaded = R_LoadMDO(mod, buf.u, filesize, name);
#endif
ri.FS_FreeFile (buf.v);

View File

@@ -115,13 +115,14 @@ void RB_CalcLightscaleTexCoords(float *st )
float p;
texModInfo_t tmi;
float light = 1.0f;
float ilength;
#if 0
vec3_t lightDir;
vec3_t ambientLight;
vec3_t directedLight;
VectorCopy( backEnd.currentEntity->ambientLight, ambientLight );
VectorCopy( backEnd.currentEntity->directedLight, directedLight );
VectorCopy( backEnd.currentEntity->lightDir, lightDir );
#endif
vec3_t directedLight;
VectorCopy( backEnd.currentEntity->directedLight, directedLight );
//light = DotProduct (directedLight, lightDir);
light = ((directedLight[0] + directedLight[1] + directedLight[2]) * 0.333) / 255;
if (light > 1)
@@ -653,39 +654,41 @@ void RB_DeformTessGeometry( void ) {
ds = &tess.shader->deforms[ i ];
switch ( ds->deformation ) {
case DEFORM_NONE:
break;
case DEFORM_NORMALS:
RB_CalcDeformNormals( ds );
break;
case DEFORM_WAVE:
RB_CalcDeformVertexes( ds );
break;
case DEFORM_BULGE:
RB_CalcBulgeVertexes( ds );
break;
case DEFORM_MOVE:
RB_CalcMoveVertexes( ds );
break;
case DEFORM_PROJECTION_SHADOW:
RB_ProjectionShadowDeform();
break;
case DEFORM_AUTOSPRITE:
AutospriteDeform();
break;
case DEFORM_AUTOSPRITE2:
Autosprite2Deform();
break;
case DEFORM_TEXT0:
case DEFORM_TEXT1:
case DEFORM_TEXT2:
case DEFORM_TEXT3:
case DEFORM_TEXT4:
case DEFORM_TEXT5:
case DEFORM_TEXT6:
case DEFORM_TEXT7:
DeformText( backEnd.refdef.text[ds->deformation - DEFORM_TEXT0] );
break;
case DEFORM_NONE:
break;
case DEFORM_NORMALS:
RB_CalcDeformNormals( ds );
break;
case DEFORM_WAVE:
RB_CalcDeformVertexes( ds );
break;
case DEFORM_BULGE:
RB_CalcBulgeVertexes( ds );
break;
case DEFORM_MOVE:
RB_CalcMoveVertexes( ds );
break;
case DEFORM_PROJECTION_SHADOW:
RB_ProjectionShadowDeform();
break;
case DEFORM_AUTOSPRITE:
AutospriteDeform();
break;
case DEFORM_AUTOSPRITE2:
Autosprite2Deform();
break;
case DEFORM_TEXT0:
case DEFORM_TEXT1:
case DEFORM_TEXT2:
case DEFORM_TEXT3:
case DEFORM_TEXT4:
case DEFORM_TEXT5:
case DEFORM_TEXT6:
case DEFORM_TEXT7:
DeformText( backEnd.refdef.text[ds->deformation - DEFORM_TEXT0] );
break;
default:
break;
}
}
}
@@ -1034,7 +1037,7 @@ void RB_CalcEnvironmentTexCoordsNew( float *st )
int i;
float *v, *normal;
vec3_t viewer, reflected, where, what, why, who;
float d, a;
float d = 0.0f;
v = tess.xyz[0];
normal = tess.normal[0];
@@ -1056,7 +1059,6 @@ void RB_CalcEnvironmentTexCoordsNew( float *st )
VectorNormalizeFast (who);
d = DotProduct (normal, viewer);
a = DotProduct (normal, where);
if ( backEnd.currentEntity == &tr.worldEntity ){

View File

@@ -3142,8 +3142,7 @@ qboolean ParseStageSimple( shaderStage_t *stage, char **text )
imgFlags_t flags = IMGFLAG_CLAMPTOEDGE;
token = COM_ParseExt( text, qfalse );
if ( !token[0] )
{
if ( !token[0] ) {
ri.Printf( PRINT_WARNING, "WARNING: missing parameter for 'clampmap' keyword in shader '%s'\n", shader.name );
return qfalse;
}
@@ -3151,13 +3150,14 @@ qboolean ParseStageSimple( shaderStage_t *stage, char **text )
if (!shader.noMipMaps)
flags |= IMGFLAG_MIPMAP;
if (!shader.noPicMip)
if (!shader.noPicMip) {
flags |= IMGFLAG_PICMIP;
}
stage->bundle[0].image[0] = tr.whiteImage;
COM_StripExtension( token, imageName, MAX_QPATH );
itype = type; iflags = flags;
loadlater = 1;
stage->bundle[0].image[0] = tr.whiteImage;
COM_StripExtension( token, imageName, MAX_QPATH );
itype = type; iflags = flags;
loadlater = 1;
}
//
// animMap <frequency> <image1> .... <imageN>
@@ -5232,7 +5232,7 @@ shader_t *R_FindShaderReal( const char *name, int lightmapIndex, qboolean mipRaw
// LEILEI's DETAIL TEXTURE STUFFS
//
int material; // leilei - for picking detail texture
int shouldIDetail = 0; // leilei - checking if I should detail.
qboolean shouldIDetail = qfalse; // leilei - checking if I should detail.
int wi, hi; // leilei - for determining detail texture size by uploaded texture
int detailScale; // leilei - detail scale hack
int detailLayer; // leilei - detail layer hack
@@ -5318,96 +5318,95 @@ shader_t *R_FindShaderReal( const char *name, int lightmapIndex, qboolean mipRaw
shader.defaultShader = qtrue;
}
if (shader.surfaceFlags || SURF_METALSTEPS)
if (shader.surfaceFlags | SURF_METALSTEPS) {
material = 1;
}
// leilei - SUPER detail hack to existing shaders,very aggressive and won't look good on 100% of shaders
if((shader.lightmapIndex != LIGHTMAP_WHITEIMAGE && shader.lightmapIndex != LIGHTMAP_BY_VERTEX && shader.lightmapIndex != LIGHTMAP_2D && shader.lightmapIndex != LIGHTMAP_NONE) ){
if (r_detailTextures->integer)
{
image_t *imageDetail; // for snagging it into more layers if we find a defined one
int e = 0;
int f = 0;
int gotdetailalready = 0;
int hasaDetailImage = 0;
int thisstage = 0;
material = 0;
wi = hi = 32; // reset to none....
// leilei - SUPER detail hack to existing shaders,very aggressive and won't look good on 100% of shaders
if((shader.lightmapIndex != LIGHTMAP_WHITEIMAGE && shader.lightmapIndex != LIGHTMAP_BY_VERTEX && shader.lightmapIndex != LIGHTMAP_2D && shader.lightmapIndex != LIGHTMAP_NONE) ){
if (r_detailTextures->integer) {
image_t *imageDetail = NULL; // for snagging it into more layers if we find a defined one
int e = 0;
int f = 0;
qboolean gotdetailalready = qfalse;
qboolean hasaDetailImage = qfalse;
int thisstage = 0;
material = 0;
wi = hi = 32; // reset to none....
shouldIDetail = 0; //yeah
for (f=0;f<detailLayer;f++){
for (e=0;e<(MAX_SHADER_STAGES-1);e++)
{
shouldIDetail = qfalse; //yeah
for (f=0;f<detailLayer;f++) {
for (e=0;e<(MAX_SHADER_STAGES-1);e++) {
if (shader.defaultShader)
break; // DON'T! This fixes a crash, trying to stage up placeholder/default textures
// Pick the first free stage to do, hopefully the last
if (stages[e].active == qfalse){ thisstage = e; shouldIDetail = 1; break;}
if (stages[e].active == qfalse){
thisstage = e;
shouldIDetail = qtrue;
break;
}
// find detail texture scale by determining which of the stages have the largest image
if (stages[e].bundle[0].image[0]->uploadHeight > wi) wi = stages[e].bundle[0].image[0]->uploadWidth;
if (stages[e].bundle[0].image[0]->uploadHeight > hi) hi = stages[e].bundle[0].image[0]->uploadHeight;
// for adjusting the detail textures and skipping some redundancy
if (stages[e].isDetail){
if (f < 1){ gotdetailalready = 1; shouldIDetail = 0;
imageDetail = stages[e].bundle[0].image[0]; // this is it
hasaDetailImage = 1;
}
if (r_detailTextureScale->integer){
if (stages[e].bundle[0].texMods[0].type == TMOD_SCALE)
{
wi = 0.25 * wi / (detailScale / (f + 1));
hi = 0.25 * hi / (detailScale / (f + 1));
stages[e].bundle[0].texMods[0].scale[0] = wi;
stages[e].bundle[0].texMods[0].scale[1] = hi;
if (f < 1) {
gotdetailalready = qtrue;
shouldIDetail = qfalse;
imageDetail = stages[e].bundle[0].image[0]; // this is it
hasaDetailImage = qtrue;
}
if (r_detailTextureScale->integer) {
if (stages[e].bundle[0].texMods[0].type == TMOD_SCALE) {
wi = 0.25 * wi / (detailScale / (f + 1));
hi = 0.25 * hi / (detailScale / (f + 1));
stages[e].bundle[0].texMods[0].scale[0] = wi;
stages[e].bundle[0].texMods[0].scale[1] = hi;
}
}
}
}
if (r_detailTextures->integer < 3) shouldIDetail = 0; // don't add detail for low settings
if ((!gotdetailalready || thisstage) && (shouldIDetail)){
// detail it up because i don't care.
{
wi = 0.25 * (f + 1) * wi / detailScale;
hi = 0.25 * (f + 1) * hi / detailScale;
detailhack = 1;
if (material == 1) // metalsteps
stages[thisstage].bundle[0].image[0] = R_FindImageFile( "gfx/fx/detail/d_genericmetal.tga", IMGFLAG_MIPMAP , IMGFLAG_MIPMAP);
else if (hasaDetailImage && imageDetail)
stages[thisstage].bundle[0].image[0] = imageDetail;
else
stages[thisstage].bundle[0].image[0] = R_FindImageFile( "gfx/fx/detail/d_generic.tga", IMGFLAG_MIPMAP , IMGFLAG_MIPMAP);
stages[thisstage].active = qtrue;
stages[thisstage].rgbGen = CGEN_IDENTITY;
stages[thisstage].stateBits |= GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR | GLS_DEPTHFUNC_EQUAL;
stages[thisstage].bundle[0].texMods[0].scale[0] = wi;
stages[thisstage].bundle[0].texMods[0].scale[1] = hi;
stages[thisstage].bundle[0].texMods[0].type = TMOD_SCALE;
stages[thisstage].isDetail = qtrue;
stages[thisstage].bundle[0].numTexMods = 1;
detailhack = 0;
}
}
if (r_detailTextures->integer < 3) {
// don't add detail for low settings
shouldIDetail = qfalse;
}
if ((!gotdetailalready || thisstage) && (shouldIDetail)) {
// detail it up because i don't care.
wi = 0.25 * (f + 1) * wi / detailScale;
hi = 0.25 * (f + 1) * hi / detailScale;
detailhack = 1;
if (material == 1) {
// metalsteps
stages[thisstage].bundle[0].image[0] = R_FindImageFile( "gfx/fx/detail/d_genericmetal.tga", IMGFLAG_MIPMAP , IMGFLAG_MIPMAP);
}
else if (hasaDetailImage && imageDetail) {
stages[thisstage].bundle[0].image[0] = imageDetail;
}
else {
stages[thisstage].bundle[0].image[0] = R_FindImageFile( "gfx/fx/detail/d_generic.tga", IMGFLAG_MIPMAP , IMGFLAG_MIPMAP);
}
stages[thisstage].active = qtrue;
stages[thisstage].rgbGen = CGEN_IDENTITY;
stages[thisstage].stateBits |= GLS_SRCBLEND_DST_COLOR | GLS_DSTBLEND_SRC_COLOR | GLS_DEPTHFUNC_EQUAL;
stages[thisstage].bundle[0].texMods[0].scale[0] = wi;
stages[thisstage].bundle[0].texMods[0].scale[1] = hi;
stages[thisstage].bundle[0].texMods[0].type = TMOD_SCALE;
stages[thisstage].isDetail = qtrue;
stages[thisstage].bundle[0].numTexMods = 1;
detailhack = 0;
}
}
}
}
}
sh = FinishShader();
return sh;
}