]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/shaders.c
Merge commit 'fe73dd74d0e40a33c090993390e4d5721a1f9e05' into garux-merge
[xonotic/netradiant.git] / tools / quake3 / q3map2 / shaders.c
index 923fe8a49d854fb257f55b760c5e5b816158ad7a..10b2b414fcf70181aaec69e0e10a3ead9ad1ddd8 100644 (file)
@@ -70,7 +70,7 @@ void ColorMod( colorMod_t *cm, int numVerts, bspDrawVert_t *drawVerts ){
                        VectorSet( mult, 1.0f, 1.0f, 1.0f );
                        mult[ 3 ] = 1.0f;
                        VectorSet( add, 0.0f, 0.0f, 0.0f );
-                       mult[ 3 ] = 0.0f;
+                       add[ 3 ] = 0.0f;
 
                        /* switch on type */
                        switch ( cm2->type )
@@ -660,7 +660,7 @@ static shaderInfo_t *AllocShaderInfo( void ){
        si->patchShadows = qfalse;
        si->vertexShadows = qtrue;  /* ydnar: changed default behavior */
        si->forceSunlight = qfalse;
-       si->vertexScale = 1.0;
+       si->vertexScale = vertexglobalscale;
        si->notjunc = qfalse;
 
        /* ydnar: set texture coordinate transform matrix to identity */
@@ -727,6 +727,9 @@ void FinishShader( shaderInfo_t *si ){
                        }
                }
        }
+               if (noob && !(si->compileFlags & C_OB)){
+                       ApplySurfaceParm( "noob", &si->contentFlags, &si->surfaceFlags, &si->compileFlags );
+               }
 
        /* set to finished */
        si->finished = qtrue;
@@ -808,10 +811,12 @@ static void LoadShaderImages( shaderInfo_t *si ){
        if ( VectorLength( si->color ) <= 0.0f ) {
                ColorNormalize( color, si->color );
                VectorScale( color, ( 1.0f / count ), si->averageColor );
+               si->averageColor[ 3 ] = color[ 3 ] / count;
        }
        else
        {
                VectorCopy( si->color, si->averageColor );
+               si->averageColor[ 3 ] = 1.0f;
        }
 }
 
@@ -1057,7 +1062,6 @@ static void ParseShaderFile( const char *filename ){
                                                         !Q_stricmp( token, "clampMap" ) ||
                                                         !Q_stricmp( token, "animMap" ) ||
                                                         !Q_stricmp( token, "clampAnimMap" ) ||
-                                                        !Q_stricmp( token, "clampMap" ) ||
                                                         !Q_stricmp( token, "mapComp" ) ||
                                                         !Q_stricmp( token, "mapNoComp" ) ) {
                                                        /* skip one token for animated stages */
@@ -1603,11 +1607,11 @@ static void ParseShaderFile( const char *filename ){
                                /* q3map_vertexScale (scale vertex lighting by this fraction) */
                                else if ( !Q_stricmp( token, "q3map_vertexScale" ) ) {
                                        GetTokenAppend( shaderText, qfalse );
-                                       si->vertexScale = atof( token );
+                                       si->vertexScale *= atof( token );
                                }
 
                                /* q3map_noVertexLight */
-                               else if ( !Q_stricmp( token, "q3map_noVertexLight" )  ) {
+                               else if ( !Q_stricmp( token, "q3map_noVertexLight" ) ) {
                                        si->noVertexLight = qtrue;
                                }
 
@@ -2039,7 +2043,7 @@ static void ParseCustomInfoParms( void ){
                custSurfaceParms[ numCustSurfaceParms ].name = safe_malloc( MAX_OS_PATH );
                strcpy( custSurfaceParms[ numCustSurfaceParms ].name, token );
                GetToken( qfalse );
-               sscanf( token, "%x", &custSurfaceParms[ numCustSurfaceParms ].contentFlags );
+               sscanf( token, "%x", (unsigned int *) &custSurfaceParms[ numCustSurfaceParms ].contentFlags );
                numCustSurfaceParms++;
        }
 
@@ -2065,7 +2069,7 @@ static void ParseCustomInfoParms( void ){
                custSurfaceParms[ numCustSurfaceParms ].name = safe_malloc( MAX_OS_PATH );
                strcpy( custSurfaceParms[ numCustSurfaceParms ].name, token );
                GetToken( qfalse );
-               sscanf( token, "%x", &custSurfaceParms[ numCustSurfaceParms ].surfaceFlags );
+               sscanf( token, "%x", (unsigned int *) &custSurfaceParms[ numCustSurfaceParms ].surfaceFlags );
                numCustSurfaceParms++;
        }