Added binaryLoadGuis and a few CVAR_NEW flags

This commit is contained in:
Robert Beckebans 2024-07-10 21:06:29 +02:00
parent 5060bc8047
commit 2b47fb26c1
3 changed files with 15 additions and 6 deletions

View file

@ -38,7 +38,7 @@ If you have questions concerning this license or the applicable additional terms
// SRS - Add cvar to control whether cinematic audio is played: default is ON
idCVar s_playCinematicAudio( "s_playCinematicAudio", "1", CVAR_BOOL, "Play audio if available in cinematic video files" );
idCVar s_playCinematicAudio( "s_playCinematicAudio", "1", CVAR_BOOL | CVAR_NEW, "Play audio if available in cinematic video files" );
// DG: get rid of libjpeg; as far as I can tell no roqs that actually use it exist
//#define ID_USE_LIBJPEG 1

View file

@ -42,11 +42,11 @@ If you have questions concerning this license or the applicable additional terms
extern idCVar r_vkUploadBufferSizeMB;
idCVar binaryLoadRenderModels( "binaryLoadRenderModels", "1", 0, "enable binary load/write of render models" );
idCVar binaryLoadRenderModels( "binaryLoadRenderModels", "1", CVAR_NEW, "enable binary load/write of render models" );
idCVar preload_MapModels( "preload_MapModels", "1", CVAR_SYSTEM | CVAR_BOOL, "preload models during begin or end levelload" );
// RB begin
idCVar postLoadExportModels( "postLoadExportModels", "0", CVAR_BOOL | CVAR_RENDERER, "export models after loading to OBJ model format" );
idCVar postLoadExportModels( "postLoadExportModels", "0", CVAR_BOOL | CVAR_RENDERER | CVAR_NEW, "export models after loading to OBJ model format" );
// RB end
class idRenderModelManagerLocal : public idRenderModelManager

View file

@ -44,6 +44,7 @@ idUserInterfaceManager* uiManager = &uiManagerLocal;
idDeviceContext* dc;
idCVar g_useNewGuiCode( "g_useNewGuiCode", "1", CVAR_GAME | CVAR_INTEGER, "use optimized device context code, 2 = toggle on/off every frame" );
idCVar binaryLoadGuis( "binaryLoadGuis", "1", CVAR_NEW, "enable binary load/write of particle decls" );
extern idCVar sys_lang;
@ -123,6 +124,12 @@ void idUserInterfaceManagerLocal::SetSize( float width, float height )
void idUserInterfaceManagerLocal::Preload( const char* mapName )
{
// RB: allow skipping binary preloading so modders can add new .gui files
if( !binaryLoadGuis.GetBool() )
{
return;
}
if( mapName != NULL && mapName[ 0 ] != '\0' )
{
mapParser.LoadFromFile( va( "generated/guis/%s.bgui", mapName ) );
@ -374,7 +381,6 @@ bool idUserInterfaceLocal::IsInteractive() const
bool idUserInterfaceLocal::InitFromFile( const char* qpath, bool rebuild, bool cache )
{
if( !( qpath && *qpath ) )
{
// FIXME: Memory leak!!
@ -417,7 +423,7 @@ bool idUserInterfaceLocal::InitFromFile( const char* qpath, bool rebuild, bool c
state.Set( "text", "Test Text!" );
idTokenParser& bsrc = uiManagerLocal.GetBinaryParser();
if( !bsrc.IsLoaded() || !bsrc.StartParsing( source ) )
if( !bsrc.IsLoaded() || !bsrc.StartParsing( source ) || !binaryLoadGuis.GetBool() )
{
idParser src( LEXFL_NOFATALERRORS | LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWMULTICHARLITERALS | LEXFL_ALLOWBACKSLASHSTRINGCONCAT );
src.LoadFile( source );
@ -458,18 +464,21 @@ bool idUserInterfaceLocal::InitFromFile( const char* qpath, bool rebuild, bool c
desktop->SetupFromState();
common->Warning( "Couldn't load gui: '%s'", source.c_str() );
}
interactive = desktop->Interactive();
if( uiManagerLocal.guis.Find( this ) == NULL )
{
uiManagerLocal.guis.Append( this );
}
loading = false;
return true;
}
const char* idUserInterfaceLocal::HandleEvent( const sysEvent_t* event, int _time, bool* updateVisuals )
{
time = _time;
if( bindHandler && event->evType == SE_KEY && event->evValue2 == 1 )