Skip to content

Commit

Permalink
Added binaryLoadGuis and a few CVAR_NEW flags
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertBeckebans committed Jul 10, 2024
1 parent 5060bc8 commit 2b47fb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion neo/renderer/Cinematic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions neo/renderer/ModelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions neo/ui/UserInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -374,7 +381,6 @@ bool idUserInterfaceLocal::IsInteractive() const

bool idUserInterfaceLocal::InitFromFile( const char* qpath, bool rebuild, bool cache )
{

if( !( qpath && *qpath ) )
{
// FIXME: Memory leak!!
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 )
Expand Down

0 comments on commit 2b47fb2

Please sign in to comment.