]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
new argument -celshader, for cel shading without changing the .map file
authordivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Fri, 20 Mar 2009 17:01:59 +0000 (17:01 +0000)
committerdivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Fri, 20 Mar 2009 17:01:59 +0000 (17:01 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@224 61c419a2-8eb2-4b30-bcec-8cead039b335

tools/quake3/q3map2/bsp.c
tools/quake3/q3map2/map.c
tools/quake3/q3map2/model.c
tools/quake3/q3map2/q3map2.h

index b82eeec8c88bb05a681d80a7c347dc8125b894fb..5bf40c33d7277069adea961ebe4798586b9069be 100644 (file)
@@ -672,6 +672,7 @@ int BSPMain( int argc, char **argv )
        numMapDrawSurfs = 0;
        
        tempSource[ 0 ] = '\0';
+       globalCelShader[0] = 0;
        
        /* set standard game flags */
        maxSurfaceVerts = game->maxSurfaceVerts;
@@ -836,6 +837,15 @@ int BSPMain( int argc, char **argv )
                        Sys_Printf( "Flatshading enabled\n" );
                        flat = qtrue;
                }
+               else if( !strcmp( argv[ i ], "-celshader" ) )
+               {
+                       ++i;
+                       if(argv[i][0])
+                               sprintf( globalCelShader, "textures/%s", argv[ i ] );
+                       else
+                               *globalCelShader = 0;
+                       Sys_Printf( "Global cel shader set to \"%s\"\n", globalCelShader );
+               }
                else if( !strcmp( argv[ i ], "-meta" ) )
                {
                        Sys_Printf( "Creating meta surfaces from brush faces\n" );
index 1bf1ddcde5eebccb767752acf82551425d67f472..b986b18dccddf97cab3f6ba646b6753e5886c904 100644 (file)
@@ -1578,7 +1578,7 @@ static qboolean ParseMapEntity( qboolean onlyLights )
                Sys_Printf( "Entity %d (%s) has cel shader %s\n", mapEnt->mapEntityNum, classname, celShader->shader );
        }
        else
-               celShader = NULL;
+               celShader = *globalCelShader ? ShaderInfoForShader(globalCelShader) : NULL;
        
        /* attach stuff to everything in the entity */
        for( brush = mapEnt->brushes; brush != NULL; brush = brush->next )
index 9847f6649338358489fe6ba231ac770029da68e1..82bf307baa79506a674fd3459a040b58079f1626 100644 (file)
@@ -729,7 +729,7 @@ void AddTriangleModels( entity_t *e )
                        celShader = ShaderInfoForShader( shader );
                }
                else
-                       celShader = NULL;
+                       celShader = *globalCelShader ? ShaderInfoForShader(globalCelShader) : NULL;
                
                /* get lightmap scale */
                lightmapScale = FloatForKey( e2, "_lightmapscale" );
index 53ec4c54bfc3e6817fa9f0b806d90a543570e13d..9ecfbfe0f881e5e453761a1b0a8f015dc9e022b9 100644 (file)
@@ -2035,6 +2035,7 @@ Q_EXTERN qboolean                 nosort;
 Q_EXTERN qboolean                      saveprt;
 Q_EXTERN qboolean                      hint;   /* ydnar */
 Q_EXTERN char                          inbase[ MAX_QPATH ];
+Q_EXTERN char                          globalCelShader[ MAX_QPATH ];
 
 /* other bits */
 Q_EXTERN int                           totalvis;