From 7ca7a54fe6db387a22ea979e62ecbbb30f6d6d30 Mon Sep 17 00:00:00 2001 From: Garux Date: Tue, 1 Aug 2017 13:32:31 +0300 Subject: [PATCH] Q3map2: fix * q3map_remapshader remaps anything fine, on all stages (effect is: postrenaming shader when things are have been done) * typo at -dirtmode Radiant: misc... * translucent textures are visible, while selected, too; +matching trans polys are visible simultaneously --- radiant/renderstate.cpp | 1 + tools/quake3/q3map2/bsp.c | 1 + tools/quake3/q3map2/bspfile_abstract.c | 3 ++- tools/quake3/q3map2/light.c | 5 ++--- tools/quake3/q3map2/main.c | 4 ++-- tools/quake3/q3map2/q3map2.h | 3 +++ tools/quake3/q3map2/writebsp.c | 9 +++++++-- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/radiant/renderstate.cpp b/radiant/renderstate.cpp index 0c274918..ce7ff974 100644 --- a/radiant/renderstate.cpp +++ b/radiant/renderstate.cpp @@ -2363,6 +2363,7 @@ void OpenGLShader::construct( const char* name ){ BlendFunc blendFunc = m_shader->getBlendFunc(); state.m_blend_src = convertBlendFactor( blendFunc.m_src ); state.m_blend_dst = convertBlendFactor( blendFunc.m_dst ); + state.m_depthfunc = GL_LEQUAL; if ( state.m_blend_src == GL_SRC_ALPHA || state.m_blend_dst == GL_SRC_ALPHA ) { state.m_state |= RENDER_DEPTHWRITE; } diff --git a/tools/quake3/q3map2/bsp.c b/tools/quake3/q3map2/bsp.c index a65b27f5..98d399c9 100644 --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@ -707,6 +707,7 @@ int BSPMain( int argc, char **argv ){ /* note it */ Sys_Printf( "--- BSP ---\n" ); + doingBSP = qtrue; SetDrawSurfacesBuffer(); mapDrawSurfs = safe_malloc( sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS ); memset( mapDrawSurfs, 0, sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS ); diff --git a/tools/quake3/q3map2/bspfile_abstract.c b/tools/quake3/q3map2/bspfile_abstract.c index c5df215e..d09afc95 100644 --- a/tools/quake3/q3map2/bspfile_abstract.c +++ b/tools/quake3/q3map2/bspfile_abstract.c @@ -177,11 +177,12 @@ void SwapBSPFile( void ){ /* shaders (don't swap the name) */ for ( i = 0; i < numBSPShaders ; i++ ) { + if ( doingBSP ){ si = ShaderInfoForShader( bspShaders[ i ].shader ); if ( si->remapShader && si->remapShader[ 0 ] ) { strcpy( bspShaders[ i ].shader, si->remapShader ); } - + } bspShaders[ i ].contentFlags = LittleLong( bspShaders[ i ].contentFlags ); bspShaders[ i ].surfaceFlags = LittleLong( bspShaders[ i ].surfaceFlags ); } diff --git a/tools/quake3/q3map2/light.c b/tools/quake3/q3map2/light.c index f4c81889..cdd9819f 100644 --- a/tools/quake3/q3map2/light.c +++ b/tools/quake3/q3map2/light.c @@ -2791,12 +2791,11 @@ int LightMain( int argc, char **argv ){ lightAngleHL = ( atoi( argv[ i + 1 ] ) != 0 ); if ( lightAngleHL ) { Sys_Printf( "Enabling half lambert light angle attenuation\n" ); - i++; } else{ Sys_Printf( "Disabling half lambert light angle attenuation\n" ); - i++; } + i++; } } else if ( !strcmp( argv[ i ], "-nostyle" ) || !strcmp( argv[ i ], "-nostyles" ) ) { @@ -2842,7 +2841,7 @@ int LightMain( int argc, char **argv ){ Sys_Printf( "Enabling randomized dirtmapping\n" ); } else{ - Sys_Printf( "Enabling ordered dir mapping\n" ); + Sys_Printf( "Enabling ordered dirtmapping\n" ); } i++; } diff --git a/tools/quake3/q3map2/main.c b/tools/quake3/q3map2/main.c index fe7eee41..ae12f52d 100644 --- a/tools/quake3/q3map2/main.c +++ b/tools/quake3/q3map2/main.c @@ -1291,13 +1291,13 @@ int ScaleBSPMain( int argc, char **argv ){ GetVectorForKey( &entities[ i ], "origin", vec ); if ( ( vec[ 0 ] || vec[ 1 ] || vec[ 2 ] ) ) { if ( !strncmp( ValueForKey( &entities[i], "classname" ), "info_player_", 12 ) ) { -// vec[2] += spawn_ref; + vec[2] += spawn_ref; } vec[0] *= scale[0]; vec[1] *= scale[1]; vec[2] *= scale[2]; if ( !strncmp( ValueForKey( &entities[i], "classname" ), "info_player_", 12 ) ) { - vec[2] += spawn_ref; + vec[2] -= spawn_ref; } sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] ); SetKeyValue( &entities[ i ], "origin", str ); diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index bd7c030e..5221bb4f 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -1999,6 +1999,9 @@ Q_EXTERN qboolean warnImage Q_ASSIGN( qtrue ); /* ydnar: sinusoid samples */ Q_EXTERN float jitters[ MAX_JITTERS ]; +/*can't code*/ +Q_EXTERN qboolean doingBSP Q_ASSIGN( qfalse ); + /* commandline arguments */ Q_EXTERN qboolean nocmdline Q_ASSIGN( qfalse ); diff --git a/tools/quake3/q3map2/writebsp.c b/tools/quake3/q3map2/writebsp.c index 24692449..6b4ea592 100644 --- a/tools/quake3/q3map2/writebsp.c +++ b/tools/quake3/q3map2/writebsp.c @@ -56,14 +56,19 @@ int EmitShader( const char *shader, int *contentFlags, int *surfaceFlags ){ /* try to find an existing shader */ for ( i = 0; i < numBSPShaders; i++ ) { - /* ydnar: handle custom surface/content flags */ + /* ydnar: handle custom surface/content flags */ if ( surfaceFlags != NULL && bspShaders[ i ].surfaceFlags != *surfaceFlags ) { continue; } if ( contentFlags != NULL && bspShaders[ i ].contentFlags != *contentFlags ) { continue; } - + if ( !doingBSP ){ + si = ShaderInfoForShader( shader ); + if ( si->remapShader && si->remapShader[ 0 ] ) { + shader = si->remapShader; + } + } /* compare name */ if ( !Q_stricmp( shader, bspShaders[ i ].shader ) ) { return i; -- 2.39.2