Skip startup if not compiled with Doom Classic support, closes #874

This commit is contained in:
Robert Beckebans 2024-04-02 12:55:39 +02:00
parent f0b733f47a
commit 2cb52c73dc
10 changed files with 181 additions and 70 deletions

View file

@ -35,9 +35,6 @@ option(FFMPEG
option(BINKDEC
"Use included libbinkdec to render Bink videos" OFF)
option(SPIRV_SHADERC
"Compile SPIR-V shader byte code using shaderc instead of using Glslang directly" OFF)
option(USE_MoltenVK
"Link directly to MoltenVK library instead of Vulkan loader on macOS" OFF)
@ -66,7 +63,7 @@ option(USE_VULKAN
"Use Vulkan" ON)
option(USE_VMA
"Use VMA allocator instead of the NVRHI builtin one" ON)
"Use AMD's Vulkan Memory Allocator instead of the NVRHI builtin one" ON)
option(OPTICK
"Enable profiling with Optick" OFF)

View file

@ -5960,9 +5960,11 @@ void idGameLocal::Shell_SyncWithSession()
}
switch( session->GetState() )
{
#if defined( USE_DOOMCLASSIC)
case idSession::PRESS_START:
shellHandler->SetShellState( SHELL_STATE_PRESS_START );
break;
#endif
case idSession::INGAME:
shellHandler->SetShellState( SHELL_STATE_PAUSED );
break;

View file

@ -71,6 +71,7 @@ void idMenuHandler_Shell::Update()
PlaySound( GUI_SOUND_MUSIC );
}
#if defined( USE_DOOMCLASSIC )
if( nextState == SHELL_STATE_PRESS_START )
{
HidePacifier();
@ -82,75 +83,83 @@ void idMenuHandler_Shell::Update()
menuBar->ClearSprite();
}
}
else if( nextState == SHELL_STATE_IDLE )
{
HidePacifier();
if( nextScreen == SHELL_AREA_START || nextScreen == SHELL_AREA_PARTY_LOBBY || nextScreen == SHELL_AREA_GAME_LOBBY || nextScreen == SHELL_AREA_INVALID )
else
#endif
if( nextState == SHELL_STATE_IDLE )
{
nextScreen = SHELL_AREA_ROOT;
}
HidePacifier();
if(
#if defined( USE_DOOMCLASSIC )
nextScreen == SHELL_AREA_START ||
#endif
nextScreen == SHELL_AREA_PARTY_LOBBY ||
nextScreen == SHELL_AREA_GAME_LOBBY ||
nextScreen == SHELL_AREA_INVALID )
{
nextScreen = SHELL_AREA_ROOT;
}
if( menuBar != NULL && gui != NULL )
{
idSWFScriptObject& root = gui->GetRootObject();
menuBar->BindSprite( root );
SetupPCOptions();
}
transition = MENU_TRANSITION_SIMPLE;
state = nextState;
}
else if( nextState == SHELL_STATE_PARTY_LOBBY )
{
HidePacifier();
nextScreen = SHELL_AREA_PARTY_LOBBY;
transition = MENU_TRANSITION_SIMPLE;
state = nextState;
}
else if( nextState == SHELL_STATE_GAME_LOBBY )
{
HidePacifier();
if( state != SHELL_STATE_IN_GAME )
{
timeRemaining = WAIT_START_TIME_LONG;
idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms();
/*if ( MatchTypeIsPrivate( matchParameters.matchFlags ) && ActiveScreen() == SHELL_AREA_PARTY_LOBBY ) {
timeRemaining = 0;
session->StartMatch();
state = SHELL_STATE_IN_GAME;
} else {*/
nextScreen = SHELL_AREA_GAME_LOBBY;
if( menuBar != NULL && gui != NULL )
{
idSWFScriptObject& root = gui->GetRootObject();
menuBar->BindSprite( root );
SetupPCOptions();
}
transition = MENU_TRANSITION_SIMPLE;
//}
state = nextState;
}
else if( nextState == SHELL_STATE_PARTY_LOBBY )
{
HidePacifier();
nextScreen = SHELL_AREA_PARTY_LOBBY;
transition = MENU_TRANSITION_SIMPLE;
state = nextState;
}
else if( nextState == SHELL_STATE_GAME_LOBBY )
{
HidePacifier();
if( state != SHELL_STATE_IN_GAME )
{
timeRemaining = WAIT_START_TIME_LONG;
idMatchParameters matchParameters = session->GetActivePlatformLobbyBase().GetMatchParms();
/*if ( MatchTypeIsPrivate( matchParameters.matchFlags ) && ActiveScreen() == SHELL_AREA_PARTY_LOBBY ) {
timeRemaining = 0;
session->StartMatch();
state = SHELL_STATE_IN_GAME;
} else {*/
nextScreen = SHELL_AREA_GAME_LOBBY;
transition = MENU_TRANSITION_SIMPLE;
//}
state = nextState;
}
}
else if( nextState == SHELL_STATE_PAUSED )
{
HidePacifier();
transition = MENU_TRANSITION_SIMPLE;
if( gameComplete )
{
nextScreen = SHELL_AREA_CREDITS;
}
else
{
nextScreen = SHELL_AREA_ROOT;
}
state = nextState;
}
}
else if( nextState == SHELL_STATE_PAUSED )
{
HidePacifier();
transition = MENU_TRANSITION_SIMPLE;
if( gameComplete )
else if( nextState == SHELL_STATE_CONNECTING )
{
nextScreen = SHELL_AREA_CREDITS;
ShowPacifier( "#str_dlg_connecting" );
state = nextState;
}
else
else if( nextState == SHELL_STATE_SEARCHING )
{
nextScreen = SHELL_AREA_ROOT;
ShowPacifier( "#str_online_mpstatus_searching" );
state = nextState;
}
state = nextState;
}
else if( nextState == SHELL_STATE_CONNECTING )
{
ShowPacifier( "#str_dlg_connecting" );
state = nextState;
}
else if( nextState == SHELL_STATE_SEARCHING )
{
ShowPacifier( "#str_online_mpstatus_searching" );
state = nextState;
}
}
if( activeScreen != nextScreen )
@ -488,7 +497,9 @@ void idMenuHandler_Shell::Initialize( const char* swfFile, idSoundWorld* sw )
}
else
{
#if defined( USE_DOOMCLASSIC )
BIND_SHELL_SCREEN( SHELL_AREA_START, idMenuScreen_Shell_PressStart, this );
#endif
BIND_SHELL_SCREEN( SHELL_AREA_ROOT, idMenuScreen_Shell_Root, this );
BIND_SHELL_SCREEN( SHELL_AREA_CAMPAIGN, idMenuScreen_Shell_Singleplayer, this );
BIND_SHELL_SCREEN( SHELL_AREA_SETTINGS, idMenuScreen_Shell_Settings, this );
@ -938,10 +949,12 @@ void idMenuHandler_Shell::HandleExitGameBtn()
{
common->Quit();
}
#if defined( USE_DOOMCLASSIC )
else if( accept == -1 )
{
session->MoveToPressStart();
}
#endif
return idSWFScriptVar();
}
private:
@ -1291,7 +1304,11 @@ void idMenuHandler_Shell::UpdateBGState()
}
}
if( smallFrameShowing || largeFrameShowing || nextScreen == SHELL_AREA_START )
if( smallFrameShowing || largeFrameShowing
#if defined( USE_DOOMCLASSIC )
|| nextScreen == SHELL_AREA_START
#endif
)
{
ShowLogo( false );
}

View file

@ -418,6 +418,7 @@ private:
bool isMpPause;
};
#if defined(USE_DOOMCLASSIC)
//*
//================================================
//idMenuScreen_Shell_PressStart
@ -479,6 +480,7 @@ private:
const idMaterial* doom2Cover;
const idMaterial* doom3Cover;
};
#endif
//*
//================================================

View file

@ -28,6 +28,9 @@ If you have questions concerning this license or the applicable additional terms
*/
#include "precompiled.h"
#pragma hdrstop
#if defined(USE_DOOMCLASSIC)
#include "../Game_local.h"
#include "../../framework/Common_local.h"
@ -365,3 +368,5 @@ bool idMenuScreen_Shell_PressStart::HandleAction( idWidgetAction& action, const
return idMenuWidget::HandleAction( action, event, widget, forceHandled );
}
#endif

View file

@ -342,10 +342,12 @@ void idMenuScreen_Shell_Root::HandleExitGameBtn()
{
common->Quit();
}
#if defined( USE_DOOMCLASSIC )
else if( accept == -1 )
{
session->MoveToPressStart();
}
#endif
return idSWFScriptVar();
}
private:
@ -357,10 +359,14 @@ void idMenuScreen_Shell_Root::HandleExitGameBtn()
idStaticList< idStrId, 4 > optionText;
callbacks.Append( new( TAG_SWF ) idSWFScriptFunction_QuitDialog( GDM_QUIT_GAME, 1 ) );
callbacks.Append( new( TAG_SWF ) idSWFScriptFunction_QuitDialog( GDM_QUIT_GAME, 0 ) );
#if defined( USE_DOOMCLASSIC )
callbacks.Append( new( TAG_SWF ) idSWFScriptFunction_QuitDialog( GDM_QUIT_GAME, -1 ) );
#endif
optionText.Append( idStrId( "#STR_SWF_ACCEPT" ) );
optionText.Append( idStrId( "#STR_SWF_CANCEL" ) );
#if defined( USE_DOOMCLASSIC )
optionText.Append( idStrId( "#str_swf_change_game" ) );
#endif
common->Dialog().AddDynamicDialog( GDM_QUIT_GAME, callbacks, optionText, true, "" );
}
@ -400,7 +406,6 @@ idMenuScreen_Shell_Root::HandleAction
*/
bool idMenuScreen_Shell_Root::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
{
if( menuData == NULL )
{
return true;
@ -416,16 +421,17 @@ bool idMenuScreen_Shell_Root::HandleAction( idWidgetAction& action, const idWidg
switch( actionType )
{
#if defined( USE_DOOMCLASSIC )
case WIDGET_ACTION_GO_BACK:
{
session->MoveToPressStart();
return true;
}
#endif
case WIDGET_ACTION_PRESS_FOCUSED:
{
if( menuData->GetPlatform() == 2 )
{
idMenuHandler_Shell* shell = dynamic_cast< idMenuHandler_Shell* >( menuData );
if( !shell )
{
@ -453,7 +459,6 @@ bool idMenuScreen_Shell_Root::HandleAction( idWidgetAction& action, const idWidg
}
case WIDGET_ACTION_SCROLL_HORIZONTAL:
{
if( menuData->GetPlatform() != 2 )
{
return true;

View file

@ -248,7 +248,11 @@ void idSessionLocalWin::Shutdown()
MoveToMainMenu();
// Wait until we fully shutdown
#if defined( USE_DOOMCLASSIC )
while( localState != STATE_IDLE && localState != STATE_PRESS_START )
#else
while( localState != STATE_IDLE )
#endif
{
Pump();
}

View file

@ -425,7 +425,9 @@ public:
enum sessionState_t
{
#if defined( USE_DOOMCLASSIC )
PRESS_START,
#endif
IDLE,
SEARCHING,
CONNECTING,
@ -474,7 +476,9 @@ public:
virtual void ClearSessionOption( sessionOption_t option ) = 0;
virtual sessionState_t GetBackState() = 0;
virtual void Cancel() = 0;
#if defined( USE_DOOMCLASSIC )
virtual void MoveToPressStart() = 0;
#endif
virtual void FinishDisconnect() = 0;
virtual void LoadingFinished() = 0;
virtual bool IsCurrentLobbyMigrating() const = 0;

View file

@ -65,6 +65,7 @@ idCVar net_headlessServer( "net_headlessServer", "0", CVAR_BOOL, "toggle to auto
const char* idSessionLocal::stateToString[ NUM_STATES ] =
{
#if defined( USE_DOOMCLASSIC )
ASSERT_ENUM_STRING( STATE_PRESS_START, 0 ),
ASSERT_ENUM_STRING( STATE_IDLE, 1 ),
ASSERT_ENUM_STRING( STATE_PARTY_LOBBY_HOST, 2 ),
@ -83,6 +84,25 @@ const char* idSessionLocal::stateToString[ NUM_STATES ] =
ASSERT_ENUM_STRING( STATE_BUSY, 15 ),
ASSERT_ENUM_STRING( STATE_LOADING, 16 ),
ASSERT_ENUM_STRING( STATE_INGAME, 17 ),
#else
ASSERT_ENUM_STRING( STATE_IDLE, 0 ),
ASSERT_ENUM_STRING( STATE_PARTY_LOBBY_HOST, 1 ),
ASSERT_ENUM_STRING( STATE_PARTY_LOBBY_PEER, 2 ),
ASSERT_ENUM_STRING( STATE_GAME_LOBBY_HOST, 3 ),
ASSERT_ENUM_STRING( STATE_GAME_LOBBY_PEER, 4 ),
ASSERT_ENUM_STRING( STATE_GAME_STATE_LOBBY_HOST, 5 ),
ASSERT_ENUM_STRING( STATE_GAME_STATE_LOBBY_PEER, 6 ),
ASSERT_ENUM_STRING( STATE_CREATE_AND_MOVE_TO_PARTY_LOBBY, 7 ),
ASSERT_ENUM_STRING( STATE_CREATE_AND_MOVE_TO_GAME_LOBBY, 8 ),
ASSERT_ENUM_STRING( STATE_CREATE_AND_MOVE_TO_GAME_STATE_LOBBY, 9 ),
ASSERT_ENUM_STRING( STATE_FIND_OR_CREATE_MATCH, 10 ),
ASSERT_ENUM_STRING( STATE_CONNECT_AND_MOVE_TO_PARTY, 11 ),
ASSERT_ENUM_STRING( STATE_CONNECT_AND_MOVE_TO_GAME, 12 ),
ASSERT_ENUM_STRING( STATE_CONNECT_AND_MOVE_TO_GAME_STATE, 13 ),
ASSERT_ENUM_STRING( STATE_BUSY, 14 ),
ASSERT_ENUM_STRING( STATE_LOADING, 15 ),
ASSERT_ENUM_STRING( STATE_INGAME, 16 ),
#endif
};
struct netVersion_s
@ -178,7 +198,11 @@ void idSessionLocal::InitBaseState()
//assert( mem.IsGlobalHeap() );
#if defined( USE_DOOMCLASSIC )
localState = STATE_PRESS_START;
#else
localState = STATE_IDLE;
#endif
sessionOptions = 0;
currentID = 0;
@ -478,7 +502,11 @@ idSessionLocal::sessionState_t idSessionLocal::GetBackState()
return IDLE; // From here, go to idle if we aren't there yet
}
#if defined( USE_DOOMCLASSIC )
return PRESS_START; // Otherwise, go back to press start
#else
return IDLE; // Otherwise, go to idle
#endif
}
/*
@ -490,7 +518,11 @@ void idSessionLocal::Cancel()
{
NET_VERBOSE_PRINT( "NET: Cancel\n" );
#if defined( USE_DOOMCLASSIC )
if( localState == STATE_PRESS_START )
#else
if( localState == STATE_IDLE )
#endif
{
return; // We're as far back as we can go
}
@ -544,6 +576,7 @@ void idSessionLocal::Cancel()
SetState( STATE_IDLE );
break;
#if defined( USE_DOOMCLASSIC )
case PRESS_START:
// Go back to press start/main
GetGameLobby().Shutdown();
@ -551,12 +584,14 @@ void idSessionLocal::Cancel()
GetPartyLobby().Shutdown();
SetState( STATE_PRESS_START );
break;
#endif
}
// Validate the current lobby immediately
ValidateLobbies();
}
#if defined( USE_DOOMCLASSIC )
/*
========================
idSessionLocal::MoveToPressStart
@ -574,6 +609,7 @@ void idSessionLocal::MoveToPressStart()
SetState( STATE_PRESS_START );
}
}
#endif
/*
========================
@ -1974,7 +2010,11 @@ Determines if any of the session instances need to become the host
*/
void idSessionLocal::ValidateLobbies()
{
#if defined( USE_DOOMCLASSIC )
if( localState == STATE_PRESS_START || localState == STATE_IDLE )
#else
if( localState == STATE_IDLE )
#endif
{
// At press start or main menu, don't do anything
return;
@ -2267,8 +2307,10 @@ bool idSessionLocal::HandleState()
switch( localState )
{
#if defined( USE_DOOMCLASSIC )
case STATE_PRESS_START:
return false;
#endif
case STATE_IDLE:
HandlePackets();
return false; // Call handle packets, since packets from old sessions could still be in flight, which need to be emptied
@ -2319,8 +2361,10 @@ idSessionLocal::sessionState_t idSessionLocal::GetState() const
// Convert our internal state to one of the external states
switch( localState )
{
#if defined( USE_DOOMCLASSIC )
case STATE_PRESS_START:
return PRESS_START;
#endif
case STATE_IDLE:
return IDLE;
case STATE_PARTY_LOBBY_HOST:
@ -2366,6 +2410,7 @@ const char* idSessionLocal::GetStateString() const
{
static const char* stateToString[] =
{
#if defined( USE_DOOMCLASSIC )
ASSERT_ENUM_STRING( STATE_PRESS_START, 0 ),
ASSERT_ENUM_STRING( STATE_IDLE, 1 ),
ASSERT_ENUM_STRING( STATE_PARTY_LOBBY_HOST, 2 ),
@ -2384,6 +2429,25 @@ const char* idSessionLocal::GetStateString() const
ASSERT_ENUM_STRING( STATE_BUSY, 15 ),
ASSERT_ENUM_STRING( STATE_LOADING, 16 ),
ASSERT_ENUM_STRING( STATE_INGAME, 17 )
#else
ASSERT_ENUM_STRING( STATE_IDLE, 0 ),
ASSERT_ENUM_STRING( STATE_PARTY_LOBBY_HOST, 1 ),
ASSERT_ENUM_STRING( STATE_PARTY_LOBBY_PEER, 2 ),
ASSERT_ENUM_STRING( STATE_GAME_LOBBY_HOST, 3 ),
ASSERT_ENUM_STRING( STATE_GAME_LOBBY_PEER, 4 ),
ASSERT_ENUM_STRING( STATE_GAME_STATE_LOBBY_HOST, 5 ),
ASSERT_ENUM_STRING( STATE_GAME_STATE_LOBBY_PEER, 6 ),
ASSERT_ENUM_STRING( STATE_CREATE_AND_MOVE_TO_PARTY_LOBBY, 7 ),
ASSERT_ENUM_STRING( STATE_CREATE_AND_MOVE_TO_GAME_LOBBY, 8 ),
ASSERT_ENUM_STRING( STATE_CREATE_AND_MOVE_TO_GAME_STATE_LOBBY, 9 ),
ASSERT_ENUM_STRING( STATE_FIND_OR_CREATE_MATCH, 10 ),
ASSERT_ENUM_STRING( STATE_CONNECT_AND_MOVE_TO_PARTY, 11 ),
ASSERT_ENUM_STRING( STATE_CONNECT_AND_MOVE_TO_GAME, 12 ),
ASSERT_ENUM_STRING( STATE_CONNECT_AND_MOVE_TO_GAME_STATE, 13 ),
ASSERT_ENUM_STRING( STATE_BUSY, 14 ),
ASSERT_ENUM_STRING( STATE_LOADING, 15 ),
ASSERT_ENUM_STRING( STATE_INGAME, 16 )
#endif
};
return stateToString[ localState ];
}
@ -2609,24 +2673,27 @@ void idSessionLocal::UpdateSignInManager()
if( masterUser == NULL )
{
#if defined( USE_DOOMCLASSIC )
// If we don't have a master user at all, then we need to be at "Press Start"
MoveToPressStart( GDM_SP_SIGNIN_CHANGE_POST );
#endif
return;
}
#if defined( USE_DOOMCLASSIC )
else if( localState == STATE_PRESS_START )
{
// If we have a master user, and we are at press start, move to the menu area
SetState( STATE_IDLE );
}
#endif
// See if the master user either isn't persistent (but needs to be), OR, if the owner changed
// RequirePersistentMaster is poorly named, this really means RequireSignedInMaster
if( masterUser->HasOwnerChanged() || ( RequirePersistentMaster() && !masterUser->IsProfileReady() ) )
{
#if defined( USE_DOOMCLASSIC )
MoveToPressStart( GDM_SP_SIGNIN_CHANGE_POST );
#endif
return;
}
@ -2666,6 +2733,7 @@ idPlayerProfile* idSessionLocal::GetProfileFromMasterLocalUser()
return profile;
}
#if defined( USE_DOOMCLASSIC )
/*
========================
idSessionLocal::MoveToPressStart
@ -2680,6 +2748,7 @@ void idSessionLocal::MoveToPressStart( gameDialogMessages_t msg )
common->Dialog().AddDialog( msg, DIALOG_ACCEPT, NULL, NULL, false, "", 0, true );
}
}
#endif
/*
========================

View file

@ -259,7 +259,9 @@ protected:
// Overall state of the session
enum state_t
{
#if defined( USE_DOOMCLASSIC )
STATE_PRESS_START, // We are at press start
#endif
STATE_IDLE, // We are at the main menu
STATE_PARTY_LOBBY_HOST, // We are in the party lobby menu as host
STATE_PARTY_LOBBY_PEER, // We are in the party lobby menu as a peer
@ -347,7 +349,9 @@ public:
}
virtual sessionState_t GetBackState();
virtual void Cancel();
#if defined( USE_DOOMCLASSIC )
virtual void MoveToPressStart();
#endif
virtual void FinishDisconnect();
virtual bool ShouldShowMigratingDialog() const; // Note this is not in sys_session.h
virtual bool IsCurrentLobbyMigrating() const;
@ -833,7 +837,9 @@ protected:
void MatchFinishedInternal();
void EndMatchForMigration();
#if defined( USE_DOOMCLASSIC )
void MoveToPressStart( gameDialogMessages_t msg );
#endif
// Voice chat
void SendVoiceAudio();