From 4a5b039ba143fc880796be66e970411349850ba3 Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 20 Mar 2009 17:01:59 +0000 Subject: [PATCH] new argument -celshader, for cel shading without changing the .map file git-svn-id: svn://svn.icculus.org/netradiant/trunk@224 61c419a2-8eb2-4b30-bcec-8cead039b335 --- tools/quake3/q3map2/bsp.c | 10 ++++++++++ tools/quake3/q3map2/map.c | 2 +- tools/quake3/q3map2/model.c | 2 +- tools/quake3/q3map2/q3map2.h | 1 + 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/quake3/q3map2/bsp.c b/tools/quake3/q3map2/bsp.c index b82eeec8..5bf40c33 100644 --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@ -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" ); diff --git a/tools/quake3/q3map2/map.c b/tools/quake3/q3map2/map.c index 1bf1ddcd..b986b18d 100644 --- a/tools/quake3/q3map2/map.c +++ b/tools/quake3/q3map2/map.c @@ -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 ) diff --git a/tools/quake3/q3map2/model.c b/tools/quake3/q3map2/model.c index 9847f664..82bf307b 100644 --- a/tools/quake3/q3map2/model.c +++ b/tools/quake3/q3map2/model.c @@ -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" ); diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 53ec4c54..9ecfbfe0 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -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; -- 2.39.2