From: Thomas Debesse Date: Mon, 20 Jun 2022 02:24:45 +0000 (+0200) Subject: Merge commit '4f80165b29510dac0d86a230993a04717143e542' into master-merge X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=cbbeee54a1cc625adb39513a0200635b97266d9c;p=xonotic%2Fnetradiant.git Merge commit '4f80165b29510dac0d86a230993a04717143e542' into master-merge --- cbbeee54a1cc625adb39513a0200635b97266d9c diff --cc tools/quake3/q3map2/bsp.c index fcc2454f,c1d99060..a5032b7b --- a/tools/quake3/q3map2/bsp.c +++ b/tools/quake3/q3map2/bsp.c @@@ -716,8 -712,10 +716,9 @@@ 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 ); + mapDrawSurfs = safe_malloc0( sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS ); numMapDrawSurfs = 0; tempSource[ 0 ] = '\0'; diff --cc tools/quake3/q3map2/writebsp.c index cc1b352d,c3262a04..3e043a40 --- a/tools/quake3/q3map2/writebsp.c +++ b/tools/quake3/q3map2/writebsp.c @@@ -111,18 -56,19 +111,23 @@@ int EmitShader( const char *shader, in /* try to find an existing shader */ for ( i = 0; i < numBSPShaders; i++ ) { - /* ydnar: handle custom surface/content flags */ + /* if not Smokin'Guns like tex file */ + if ( !game->texFile ) + { - /* ydnar: handle custom surface/content flags */ - if ( surfaceFlags != NULL && bspShaders[ i ].surfaceFlags != *surfaceFlags ) { - continue; - } - if ( contentFlags != NULL && bspShaders[ i ].contentFlags != *contentFlags ) { - continue; ++ /* 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; @@@ -138,26 -84,15 +143,26 @@@ numBSPShaders++; strcpy( bspShaders[ i ].shader, shader ); bspShaders[ i ].surfaceFlags = si->surfaceFlags; + + if ( game->texFile ) + { + /* Smokin'Guns like tex file */ + bspShaders[ i ].surfaceFlags |= GetSurfaceParm(si->shader); + } + bspShaders[ i ].contentFlags = si->contentFlags; + /* if not Smokin'Guns like tex file */ + if ( !game->texFile ) + { - /* handle custom content/surface flags */ - if ( surfaceFlags != NULL ) { - bspShaders[ i ].surfaceFlags = *surfaceFlags; - } - if ( contentFlags != NULL ) { - bspShaders[ i ].contentFlags = *contentFlags; - } + /* handle custom content/surface flags */ + if ( surfaceFlags != NULL ) { + bspShaders[ i ].surfaceFlags = *surfaceFlags; + } + if ( contentFlags != NULL ) { + bspShaders[ i ].contentFlags = *contentFlags; + } + } /* recursively emit any damage shaders */ if ( si->damageShader != NULL && si->damageShader[ 0 ] != '\0' ) {