Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@
#include "GameClient/KeyDefs.h"
#include "GameClient/GameWindowManager.h"

#include "GameLogic/GameLogic.h"

//-----------------------------------------------------------------------------
// DEFINES ////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
static NameKeyType parentMainMenuID = NAMEKEY_INVALID;

// window pointers --------------------------------------------------------------------------------
static GameWindow *parentMainMenu = nullptr;
static Bool creditsActivationPending = FALSE;

//-----------------------------------------------------------------------------
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
Expand All @@ -81,39 +84,22 @@ void CreditsMenuInit( WindowLayout *layout, void *userData )
{
TheShell->showShellMap(FALSE);

delete TheCredits;
TheCredits = new CreditsManager;
TheCredits->load();
TheCredits->init();

parentMainMenuID = TheNameKeyGenerator->nameToKey( "CreditsMenu.wnd:ParentCreditsWindow" );
parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, parentMainMenuID );


// show menu
layout->hide( FALSE );

// set keyboard focus to main parent
TheWindowManager->winSetFocus( parentMainMenu );



TheAudio->removeAudioEvent( AHSV_StopTheMusicFade );
AudioEventRTS event( "Credits" );
event.setShouldFade( TRUE );
TheAudio->addAudioEvent( &event );


creditsActivationPending = TRUE;
layout->hide( TRUE );
}

//-------------------------------------------------------------------------------------------------
/** single player menu shutdown method */
//-------------------------------------------------------------------------------------------------
void CreditsMenuShutdown( WindowLayout *layout, void *userData )
{
TheCredits->reset();
delete TheCredits;
TheCredits = nullptr;
creditsActivationPending = FALSE;
if (TheCredits)
{
TheCredits->reset();
delete TheCredits;
TheCredits = nullptr;
}
TheShell->showShellMap(TRUE);

// hide menu
Expand All @@ -131,6 +117,25 @@ void CreditsMenuShutdown( WindowLayout *layout, void *userData )
//-------------------------------------------------------------------------------------------------
void CreditsMenuUpdate( WindowLayout *layout, void *userData )
{
if (creditsActivationPending && !TheGameLogic->isInGame())
{
// TheSuperHackers @bugfix DrGoldFish1 11/10/2026 Defers Credits initialization until shell game teardown completes.
TheCredits = new CreditsManager;
TheCredits->load();
TheCredits->init();

parentMainMenuID = TheNameKeyGenerator->nameToKey( "CreditsMenu.wnd:ParentCreditsWindow" );
parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, parentMainMenuID );

layout->hide( FALSE );
TheWindowManager->winSetFocus( parentMainMenu );

TheAudio->removeAudioEvent( AHSV_StopTheMusicFade );
AudioEventRTS event( "Credits" );
event.setShouldFade( TRUE );
TheAudio->addAudioEvent( &event );
creditsActivationPending = FALSE;
}

if(TheCredits)
{
Expand All @@ -139,7 +144,7 @@ void CreditsMenuUpdate( WindowLayout *layout, void *userData )
if(TheCredits->isFinished())
TheShell->pop();
}
else
else if (!creditsActivationPending)
TheShell->pop();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@
#include "GameClient/KeyDefs.h"
#include "GameClient/GameWindowManager.h"

#include "GameLogic/GameLogic.h"

//-----------------------------------------------------------------------------
// DEFINES ////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
static NameKeyType parentMainMenuID = NAMEKEY_INVALID;

// window pointers --------------------------------------------------------------------------------
static GameWindow *parentMainMenu = nullptr;
static Bool creditsActivationPending = FALSE;

//-----------------------------------------------------------------------------
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
Expand All @@ -81,39 +84,22 @@ void CreditsMenuInit( WindowLayout *layout, void *userData )
{
TheShell->showShellMap(FALSE);

delete TheCredits;
TheCredits = new CreditsManager;
TheCredits->load();
TheCredits->init();

parentMainMenuID = TheNameKeyGenerator->nameToKey( "CreditsMenu.wnd:ParentCreditsWindow" );
parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, parentMainMenuID );


// show menu
layout->hide( FALSE );

// set keyboard focus to main parent
TheWindowManager->winSetFocus( parentMainMenu );



TheAudio->removeAudioEvent( AHSV_StopTheMusicFade );
AudioEventRTS event( "Credits" );
event.setShouldFade( TRUE );
TheAudio->addAudioEvent( &event );


creditsActivationPending = TRUE;
layout->hide( TRUE );
}

//-------------------------------------------------------------------------------------------------
/** single player menu shutdown method */
//-------------------------------------------------------------------------------------------------
void CreditsMenuShutdown( WindowLayout *layout, void *userData )
{
TheCredits->reset();
delete TheCredits;
TheCredits = nullptr;
creditsActivationPending = FALSE;
if (TheCredits)
{
TheCredits->reset();
delete TheCredits;
TheCredits = nullptr;
}
TheShell->showShellMap(TRUE);

// hide menu
Expand All @@ -131,6 +117,25 @@ void CreditsMenuShutdown( WindowLayout *layout, void *userData )
//-------------------------------------------------------------------------------------------------
void CreditsMenuUpdate( WindowLayout *layout, void *userData )
{
if (creditsActivationPending && !TheGameLogic->isInGame())
{
// TheSuperHackers @bugfix DrGoldFish1 11/10/2026 Defers Credits initialization until shell game teardown completes.
TheCredits = new CreditsManager;
TheCredits->load();
TheCredits->init();

parentMainMenuID = TheNameKeyGenerator->nameToKey( "CreditsMenu.wnd:ParentCreditsWindow" );
parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, parentMainMenuID );

layout->hide( FALSE );
TheWindowManager->winSetFocus( parentMainMenu );

TheAudio->removeAudioEvent( AHSV_StopTheMusicFade );
AudioEventRTS event( "Credits" );
event.setShouldFade( TRUE );
TheAudio->addAudioEvent( &event );
creditsActivationPending = FALSE;
}

if(TheCredits)
{
Expand All @@ -139,7 +144,7 @@ void CreditsMenuUpdate( WindowLayout *layout, void *userData )
if(TheCredits->isFinished())
TheShell->pop();
}
else
else if (!creditsActivationPending)
TheShell->pop();

}
Expand Down
Loading