* fix RBSP style keys on -exportents and decompilation, so that they are alright for -onlyents and compilation
This commit is contained in:
parent
a5bad3d471
commit
d40538eea0
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
/* dependencies */
|
||||
#include "q3map2.h"
|
||||
#include "bspfile_rbsp.h"
|
||||
|
||||
|
||||
|
||||
|
|
@ -864,6 +865,9 @@ static int ConvertBSPToMap_Ext( char *bspName, bool brushPrimitives ){
|
|||
buildBrush.original = &buildBrush;
|
||||
}
|
||||
|
||||
if( g_game->load == LoadRBSPFile )
|
||||
UnSetLightStyles();
|
||||
|
||||
/* note it */
|
||||
Sys_Printf( "--- Convert BSP to MAP ---\n" );
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
/* dependencies */
|
||||
#include "q3map2.h"
|
||||
#include "bspfile_rbsp.h"
|
||||
|
||||
|
||||
|
||||
|
|
@ -55,6 +56,12 @@ static void ExportEntities(){
|
|||
return;
|
||||
}
|
||||
|
||||
if( g_game->load == LoadRBSPFile ){ // intent here is to make RBSP specific stuff usable for entity modding with -onlyents
|
||||
ParseEntities();
|
||||
UnSetLightStyles();
|
||||
UnparseEntities();
|
||||
}
|
||||
|
||||
/* write it */
|
||||
auto filename = StringOutputStream( 256 )( PathExtensionless( source ), ".ent" );
|
||||
Sys_Printf( "Writing %s\n", filename.c_str() );
|
||||
|
|
|
|||
|
|
@ -1492,6 +1492,7 @@ void WritePortalFile( const tree_t& tree );
|
|||
/* writebsp.c */
|
||||
void SetModelNumbers();
|
||||
void SetLightStyles();
|
||||
void UnSetLightStyles();
|
||||
|
||||
int EmitShader( const char *shader, const int *contentFlags, const int *surfaceFlags );
|
||||
|
||||
|
|
|
|||
|
|
@ -301,6 +301,17 @@ void SetLightStyles(){
|
|||
Sys_FPrintf( SYS_VRB, "%9d light entities stripped\n", numStrippedLights );
|
||||
}
|
||||
|
||||
// reverts SetLightStyles() effect for decompilation purposes
|
||||
void UnSetLightStyles(){
|
||||
for ( entity_t& e : entities ){
|
||||
if ( e.classname_prefixed( "light" ) && !strEmpty( e.valueForKey( "targetname" ) ) && !strEmpty( e.valueForKey( "style" ) ) ) {
|
||||
char value[ 10 ];
|
||||
sprintf( value, "%d", e.intForKey( "switch_style" ) ); // value or 0, latter is fine too
|
||||
e.setKeyValue( "style", value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user