|
|
|
@ -273,6 +273,73 @@ void setOutGameFullScreen()
|
|
|
|
|
CViewRenderer::getInstance()->setInterfaceScale(1.0f, 1024, 768);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
class CSoundGlobalMenu
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CSoundGlobalMenu()
|
|
|
|
|
{
|
|
|
|
|
_MusicWantedAsync= false;
|
|
|
|
|
_NbFrameBeforeChange= NbFrameBeforeChangeMax;
|
|
|
|
|
}
|
|
|
|
|
void reset();
|
|
|
|
|
void setMusic(const string &music, bool async);
|
|
|
|
|
void updateSound();
|
|
|
|
|
private:
|
|
|
|
|
string _MusicPlayed;
|
|
|
|
|
string _MusicWanted;
|
|
|
|
|
bool _MusicWantedAsync;
|
|
|
|
|
sint _NbFrameBeforeChange;
|
|
|
|
|
enum {NbFrameBeforeChangeMax= 10};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void CSoundGlobalMenu::reset()
|
|
|
|
|
{
|
|
|
|
|
_MusicPlayed.clear();
|
|
|
|
|
_MusicWanted.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSoundGlobalMenu::updateSound()
|
|
|
|
|
{
|
|
|
|
|
// **** update the music played
|
|
|
|
|
// The first music played is the music played at loading, before select char
|
|
|
|
|
if (_MusicPlayed.empty())
|
|
|
|
|
_MusicPlayed = toLower(LoadingMusic.empty() ? ClientCfg.StartMusic : LoadingMusic);
|
|
|
|
|
if (_MusicWanted.empty())
|
|
|
|
|
_MusicWanted = toLower(LoadingMusic.empty() ? ClientCfg.StartMusic : LoadingMusic);
|
|
|
|
|
|
|
|
|
|
// because music is changed when the player select other race for instance,
|
|
|
|
|
// wait the 3D to load (stall some secs)
|
|
|
|
|
|
|
|
|
|
// if the wanted music is the same as the one currently playing, just continue playing
|
|
|
|
|
if(_MusicPlayed!=_MusicWanted)
|
|
|
|
|
{
|
|
|
|
|
// wait nbFrameBeforeChangeMax before actually changing the music
|
|
|
|
|
_NbFrameBeforeChange--;
|
|
|
|
|
if(_NbFrameBeforeChange<=0)
|
|
|
|
|
{
|
|
|
|
|
_MusicPlayed= _MusicWanted;
|
|
|
|
|
// play the music
|
|
|
|
|
if (SoundMngr != NULL)
|
|
|
|
|
SoundMngr->playMusic(_MusicPlayed, 500, _MusicWantedAsync, true, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// **** update mngr
|
|
|
|
|
if (SoundMngr != NULL)
|
|
|
|
|
SoundMngr->update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSoundGlobalMenu::setMusic(const string &music, bool async)
|
|
|
|
|
{
|
|
|
|
|
_MusicWanted= toLower(music);
|
|
|
|
|
_MusicWantedAsync= async;
|
|
|
|
|
// reset the counter
|
|
|
|
|
_NbFrameBeforeChange= NbFrameBeforeChangeMax;
|
|
|
|
|
}
|
|
|
|
|
static CSoundGlobalMenu SoundGlobalMenu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// New version of the menu after the server connection
|
|
|
|
|
//
|
|
|
|
@ -405,6 +472,8 @@ bool connection (const string &cookie, const string &fsaddr)
|
|
|
|
|
InterfaceState = GLOBAL_MENU;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// No loading music here, this is right before character selection, using the existing music
|
|
|
|
|
|
|
|
|
|
// Create the loading texture. We can't do that before because we need to add search path first.
|
|
|
|
|
beginLoading (LoadBackground);
|
|
|
|
|
UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING;
|
|
|
|
@ -506,6 +575,7 @@ bool reconnection()
|
|
|
|
|
ProgressBar.setFontFactor(1.0f);
|
|
|
|
|
|
|
|
|
|
// Init out game
|
|
|
|
|
SoundGlobalMenu.reset();
|
|
|
|
|
pIM->initOutGame();
|
|
|
|
|
|
|
|
|
|
// Hide cursor for interface
|
|
|
|
@ -521,6 +591,9 @@ bool reconnection()
|
|
|
|
|
|
|
|
|
|
FarTP.setOutgame();
|
|
|
|
|
|
|
|
|
|
if (SoundMngr)
|
|
|
|
|
SoundMngr->setupFadeSound(1.0f, 1.0f);
|
|
|
|
|
|
|
|
|
|
// these two globals sequence GlobalMenu to display the character select dialog
|
|
|
|
|
WaitServerAnswer = true;
|
|
|
|
|
userChar = true;
|
|
|
|
@ -555,6 +628,8 @@ bool reconnection()
|
|
|
|
|
// this also kicks the state machine to sendReady() so we stop spinning in farTPmainLoop
|
|
|
|
|
FarTP.setIngame();
|
|
|
|
|
|
|
|
|
|
// Not loading music here, this is before character selection, keep existing music
|
|
|
|
|
|
|
|
|
|
// Create the loading texture. We can't do that before because we need to add search path first.
|
|
|
|
|
beginLoading (LoadBackground);
|
|
|
|
|
UseEscapeDuringLoading = USE_ESCAPE_DURING_LOADING;
|
|
|
|
@ -729,66 +804,6 @@ std::string buildPlayerNameForSaveFile(const ucstring &playerNameIn)
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
class CSoundGlobalMenu
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CSoundGlobalMenu()
|
|
|
|
|
{
|
|
|
|
|
_MusicWantedAsync= false;
|
|
|
|
|
_NbFrameBeforeChange= NbFrameBeforeChangeMax;
|
|
|
|
|
}
|
|
|
|
|
void setMusic(const string &music, bool async);
|
|
|
|
|
void updateSound();
|
|
|
|
|
private:
|
|
|
|
|
string _MusicPlayed;
|
|
|
|
|
string _MusicWanted;
|
|
|
|
|
bool _MusicWantedAsync;
|
|
|
|
|
sint _NbFrameBeforeChange;
|
|
|
|
|
enum {NbFrameBeforeChangeMax= 10};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void CSoundGlobalMenu::updateSound()
|
|
|
|
|
{
|
|
|
|
|
// **** update the music played
|
|
|
|
|
// The first music played is the music played at loading, before select char
|
|
|
|
|
if(_MusicPlayed.empty())
|
|
|
|
|
_MusicPlayed= toLower(ClientCfg.SoundOutGameMusic);
|
|
|
|
|
if(_MusicWanted.empty())
|
|
|
|
|
_MusicWanted= toLower(ClientCfg.SoundOutGameMusic);
|
|
|
|
|
|
|
|
|
|
// because music is changed when the player select other race for instance,
|
|
|
|
|
// wait the 3D to load (stall some secs)
|
|
|
|
|
|
|
|
|
|
// if the wanted music is the same as the one currently playing, just continue playing
|
|
|
|
|
if(_MusicPlayed!=_MusicWanted)
|
|
|
|
|
{
|
|
|
|
|
// wait nbFrameBeforeChangeMax before actually changing the music
|
|
|
|
|
_NbFrameBeforeChange--;
|
|
|
|
|
if(_NbFrameBeforeChange<=0)
|
|
|
|
|
{
|
|
|
|
|
_MusicPlayed= _MusicWanted;
|
|
|
|
|
// play the music
|
|
|
|
|
if (SoundMngr != NULL)
|
|
|
|
|
SoundMngr->playMusic(_MusicPlayed, 500, _MusicWantedAsync, true, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// **** update mngr
|
|
|
|
|
if (SoundMngr != NULL)
|
|
|
|
|
SoundMngr->update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSoundGlobalMenu::setMusic(const string &music, bool async)
|
|
|
|
|
{
|
|
|
|
|
_MusicWanted= toLower(music);
|
|
|
|
|
_MusicWantedAsync= async;
|
|
|
|
|
// reset the counter
|
|
|
|
|
_NbFrameBeforeChange= NbFrameBeforeChangeMax;
|
|
|
|
|
}
|
|
|
|
|
static CSoundGlobalMenu SoundGlobalMenu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool LuaBGDSuccessFlag = true; // tmp, for debug
|
|
|
|
|
|
|
|
|
@ -2039,8 +2054,8 @@ public:
|
|
|
|
|
fromString(getParam(Params, "async"), async);
|
|
|
|
|
|
|
|
|
|
// if empty name, return to default mode
|
|
|
|
|
if(sName.empty())
|
|
|
|
|
sName= ClientCfg.SoundOutGameMusic;
|
|
|
|
|
if (sName.empty())
|
|
|
|
|
sName = ClientCfg.EmptySlotMusic;
|
|
|
|
|
|
|
|
|
|
// change the music
|
|
|
|
|
SoundGlobalMenu.setMusic(sName, async);
|
|
|
|
|