Changes from Core

13-inventory-fixes
Nuno 3 years ago
parent 3709ea4520
commit d7d1bc60c2

@ -89,6 +89,9 @@ void createDebug (const char *logPath = NULL, bool logInFile = true, bool eraseL
/// Do not call this, unless you know what you're trying to do (it kills debug)!
void destroyDebug();
/// Attach exception handler, for new threads and fibers
void attachExceptionHandler();
// call this if you want to change the dir of the log.log file
void changeLogDirectory(const std::string &dir);
@ -352,7 +355,7 @@ void setCrashAlreadyReported(bool state);
* Same as nlassertex(false,exp);
*/
// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG)
#if defined(NL_DEBUG) /* Debug break is only useful in debug builds */
#if defined(NL_OS_WINDOWS)
#define NLMISC_BREAKPOINT __debugbreak()
#elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC)
@ -360,6 +363,9 @@ void setCrashAlreadyReported(bool state);
#else
#define NLMISC_BREAKPOINT abort()
#endif
#else
#define NLMISC_BREAKPOINT do { } while (0)
#endif
// Internal, don't use it (make smaller assert code)
extern bool _assert_stop(bool &ignoreNextTime, sint line, const char *file, const char *funcName, const char *exp);

@ -30,19 +30,19 @@ namespace NLMISC {
struct CHashKey
{
CHashKey () { HashKeyString.resize(20); }
CHashKey() { HashKeyString.resize(20); }
CHashKey (const unsigned char Message_Digest[20])
CHashKey(const unsigned char Message_Digest[20])
{
HashKeyString.clear();
for(sint i = 0; i < 20 ; ++i)
for (sint i = 0; i < 20; ++i)
{
HashKeyString += Message_Digest[i];
}
}
// Init the hash key with a binary key format or a text key format
CHashKey (const std::string &str)
CHashKey(const std::string &str)
{
if (str.size() == 20)
{
@ -51,25 +51,25 @@ struct CHashKey
else if (str.size() == 40)
{
HashKeyString.clear();
for(uint i = 0; i < str.size(); i+=2)
for (size_t i = 0; i < str.size(); i += 2)
{
uint8 val;
if (isdigit((unsigned char)str[i+0]))
val = str[i+0]-'0';
if (isdigit((unsigned char)str[i + 0]))
val = str[i + 0] - '0';
else
val = 10+tolower(str[i+0])-'a';
val = 10 + tolower(str[i + 0]) - 'a';
val *= 16;
if (isdigit((unsigned char)str[i+1]))
val += str[i+1]-'0';
if (isdigit((unsigned char)str[i + 1]))
val += str[i + 1] - '0';
else
val += 10+tolower(str[i+1])-'a';
val += 10 + tolower(str[i + 1]) - 'a';
HashKeyString += val;
}
}
else
{
nlwarning ("SHA: Bad hash key format");
nlwarning("SHA: Bad hash key format");
}
}
@ -85,23 +85,28 @@ struct CHashKey
}
// serial the hash key in binary format
void serial (NLMISC::IStream &stream)
void serial(NLMISC::IStream &stream)
{
stream.serial (HashKeyString);
stream.serial(HashKeyString);
}
bool operator==(const CHashKey &v) const
bool operator==(const CHashKey &v) const
{
return HashKeyString == v.HashKeyString;
}
bool operator!=(const CHashKey &v) const
{
return !(*this == v);
}
// this string is always 20 bytes long and is the code in binary format (can't print it directly)
std::string HashKeyString;
};
inline bool operator <(const struct CHashKey &a,const struct CHashKey &b)
inline bool operator<(const struct CHashKey &a, const struct CHashKey &b)
{
return a.HashKeyString<b.HashKeyString;
return a.HashKeyString < b.HashKeyString;
}
// This function get a filename (it works with big files) and returns his SHA hash key

@ -246,10 +246,9 @@ inline bool fromString(const std::string &str, sint64 &val) { bool ret = sscanf(
inline bool fromString(const std::string &str, float &val) { bool ret = sscanf(str.c_str(), "%f", &val) == 1; if (!ret) val = 0.0f; return ret; }
inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(str.c_str(), "%lf", &val) == 1; if (!ret) val = 0.0; return ret; }
/// Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, and empty strings, anything else is undefined.
/// - Kaetemi
inline bool toBool(const char *str) { return str[0] == '1' || (str[0] & 0xD2) == 0x50; }
inline bool toBool(const std::string &str) { return toBool(str.c_str()); } // Safe because first byte may be null
// Fast string to bool, reliably defined for strings starting with 0, 1, t, T, f, F, y, Y, n, N, anything else is undefined.
// (str[0] == '1' || (str[0] & 0xD2) == 0x50)
// - Kaetemi
bool fromString(const std::string &str, bool &val);
@ -291,6 +290,14 @@ inline bool endsWith(const char *str, const char *suffix) { return endsWith(str,
inline bool endsWith(const std::string &str, const char *suffix) { return endsWith(str.c_str(), str.size(), suffix, strlen(suffix)); }
inline bool endsWith(const std::string &str, const std::string &suffix) { return endsWith(str.c_str(), str.size(), suffix.c_str(), suffix.size()); }
// ****************************************************************************
// Conversion of strings between
// - UTF-8
// - Local codepage (UTF-8 on Linux)
// - TString (Local codepage or wide on Windows)
// - Wide (wchar_t *, UTF-16 on Windows, UTF-32 on Linux)
// ****************************************************************************
// Convert local codepage to UTF-8
// On Windows, the local codepage is undetermined
// On Linux, the local codepage is always UTF-8 (no-op)

@ -108,7 +108,7 @@ public:
bool play(const std::string &filepath, uint xFadeTime = 0, bool async = true, bool loop = true);
/// Stop the music previously loaded and played (the Memory is also freed)
void stop(uint xFadeTime = 0);
bool stop(uint xFadeTime = 0);
/// Pause the music previously loaded and played (the Memory is not freed)
void pause();

@ -96,6 +96,8 @@ private:
IAudioDecoder *m_AudioDecoder;
std::string m_LookupPath;
bool m_Paused;
bool m_DecodingEnded;

@ -34,7 +34,7 @@ class CCurlHttpClient
public:
/// Constructor
CCurlHttpClient() {}
CCurlHttpClient() : _CurlStruct(NULL) {}
/// Connect to an http server (string by val is intended). If you specify a whole URL, an attempt will be made to determine the server.
bool connect(const std::string &server);

@ -3830,9 +3830,15 @@ void CDriverD3D::CLightState::apply(CDriverD3D *driver)
void CDriverD3D::CRenderTargetState::apply(CDriverD3D *driver)
{
H_AUTO_D3D(CDriverD3D_CRenderTargetState);
driver->_DeviceInterface->SetRenderTarget (0, Target);
nlassert(TargetOwned); // Can only apply once!
driver->_DeviceInterface->SetRenderTarget(0, Target);
driver->setupViewport(driver->_Viewport);
driver->setupScissor(driver->_Scissor);
if (TargetOwned)
{
Target->Release();
TargetOwned = false;
}
}
// ***************************************************************************

@ -1546,11 +1546,13 @@ public:
Texture = NULL;
Level = 0;
CubeFace = 0;
TargetOwned = false;
}
IDirect3DSurface9 *Target;
ITexture *Texture;
uint8 Level;
uint8 CubeFace;
bool TargetOwned;
virtual void apply(CDriverD3D *driver);
};
@ -2076,10 +2078,17 @@ public:
NL_D3D_CACHE_TEST(CacheTest_RenderTarget, _RenderTarget.Target != target)
#endif // NL_D3D_USE_RENDER_STATE_CACHE
{
if (_RenderTarget.TargetOwned)
{
nlassert(_RenderTarget.Target);
_RenderTarget.Target->Release();
}
_RenderTarget.Target = target;
_RenderTarget.Texture = texture;
_RenderTarget.Level = level;
_RenderTarget.CubeFace = cubeFace;
_RenderTarget.TargetOwned = target;
target->AddRef();
touchRenderVariable (&_RenderTarget);

@ -706,9 +706,13 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
// Set the texture states
if (text || (stage == 0))
{
// Doesn't use a pixel shader ? Set the textures stages
if (pShader->PixelShader == NULL)
if (matShader == CMaterial::Program)
{
// Do nothing for user pixel shader
}
else if (!pShader->PixelShader)
{
// Doesn't use a pixel shader ? Set the textures stages
if (pShader->RGBPipe[stage])
{
setTextureState (stage, D3DTSS_COLOROP, pShader->ColorOp[stage]);
@ -1145,7 +1149,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
}
break;
case CMaterial::Cloud:
case CMaterial::Cloud:
{
H_AUTO_D3D(CDriverD3D_setupMaterial_setupCloudShader)
activeShader (&_ShaderCloud);
@ -1167,7 +1171,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
return false;
}
break;
case CMaterial::Water:
case CMaterial::Water:
{
H_AUTO_D3D(CDriverD3D_setupMaterial_setupWaterShader)
activeShader(mat.getTexture(3) ? &_ShaderWaterDiffuse : &_ShaderWaterNoDiffuse);
@ -1296,7 +1300,14 @@ bool CDriverD3D::setupMaterial(CMaterial &mat)
}
}
}
// CMaterial::Water
break; // CMaterial::Water
case CMaterial::Program:
{
H_AUTO_D3D(CDriverD3D_setupMaterial_setupProgramshader)
// No material shader
activeShader(NULL);
}
break;
}
// New material setuped

@ -1084,6 +1084,7 @@ void CDriverD3D::swapTextureHandle(ITexture &tex0, ITexture &tex1)
swap(t0->Height, t1->Height);
swap(t0->SrcCompressed, t1->SrcCompressed);
swap(t0->IsCube, t1->IsCube);
swap(t0->RenderTarget, t1->RenderTarget);
swap(t0->Levels, t1->Levels);
swap(t0->FirstMipMap, t1->FirstMipMap);
swap(t0->TextureMemory, t1->TextureMemory);

@ -246,6 +246,7 @@ void CFXAA::applyEffect()
// create render target
CTextureUser *otherRenderTarget = m_Driver->getRenderTargetManager().getRenderTarget(width, height, mode2D);
nlassert(otherRenderTarget);
// swap render target
CTextureUser texNull;

@ -979,6 +979,9 @@ void CLodCharacterManager::addTextureCompute(CLodCharacterInstance &instance,
// get lookup ptr.
nlassert(lodTexture.Texture.size()==NL3D_CLOD_TEXT_SIZE);
if (lodTexture.Texture.size() < NL3D_CLOD_TEXT_SIZE)
return;
const CLodCharacterTexture::CTUVQ *lookUpPtr= &lodTexture.Texture[0];
// apply the lodTexture, taking only better quality (ie nearer 0)

@ -143,6 +143,9 @@ namespace NLMISC
NL_CT_DEBUG("CoTask : task %p start func called", task);
// Attach exception handler
attachExceptionHandler();
try
{
// run the task
@ -151,6 +154,7 @@ namespace NLMISC
catch(...)
{
nlwarning("CCoTask::startFunc : the task has generated an unhandled exeption and will terminate");
NLMISC_BREAKPOINT;
}
task->_Finished = true;

@ -1157,6 +1157,15 @@ void destroyDebug()
}
}
void attachExceptionHandler()
{
#ifndef NL_COMP_MINGW
# ifdef NL_OS_WINDOWS
_set_se_translator(exceptionTranslator);
# endif // NL_OS_WINDOWS
#endif //!NL_COMP_MINGW
}
void createDebug (const char *logPath, bool logInFile, bool eraseLastLog)
{
// Do some basic compiler time check on type size

@ -558,7 +558,7 @@ bool CIFile::seek (sint32 offset, IStream::TSeekOrigin origin) const
return true;
// seek in the file. NB: if not in bigfile, _BigFileOffset==0.
if (nlfseek64(_F, _BigFileOffset+_ReadPos, SEEK_SET) != 0)
if (nlfseek64(_F, (sint64)_BigFileOffset + _ReadPos, SEEK_SET) != 0)
return false;
return true;
}

@ -171,15 +171,16 @@ bool CIXml::init (IStream &stream)
// Try binary mode
if (_TryBinaryMode)
{
char header[4];
char header[5];
header[0] = buffer[0];
header[1] = buffer[1];
header[2] = buffer[2];
header[3] = buffer[3];
header[4] = '\0';
toLower(header);
// Does it a xml stream ?
if (!strcmp(header, "<?xm"))
if (strcmp(header, "<?xm"))
{
// NO ! Go in binary mode
_BinaryStream = &stream;

@ -67,6 +67,9 @@ static unsigned long __stdcall ProxyFunc (void *arg)
// Set the thread pointer in TLS memory
nlverify (TlsSetValue (TLSThreadPointer, (void*)parent) != 0);
// Attach exception handler
attachExceptionHandler();
// Run the thread
parent->Runnable->run();

@ -56,18 +56,12 @@ IAudioDecoder::~IAudioDecoder()
IAudioDecoder *IAudioDecoder::createAudioDecoder(const std::string &filepath, bool async, bool loop)
{
std::string lookup = CPath::lookup(filepath, false);
if (lookup.empty())
{
nlwarning("Music file %s does not exist!", filepath.c_str());
return NULL;
}
std::string type = CFile::getExtension(filepath);
CIFile *ifile = new CIFile();
ifile->setCacheFileOnOpen(!async);
ifile->allowBNPCacheFileOnOpen(!async);
ifile->open(lookup);
ifile->open(filepath);
IAudioDecoder *mb = createAudioDecoder(type, ifile, loop);

@ -147,7 +147,7 @@ void CMusicChannelFader::updateVolume()
*/
bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool async, bool loop)
{
stop(xFadeTime);
bool stopped = stop(xFadeTime);
// Find the next best free music channel
uint nextFader = _MaxMusicFader;
@ -164,7 +164,7 @@ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool
// Play a song in it :)
_CMusicFader &fader = _MusicFader[_ActiveMusicFader];
if (xFadeTime) fader.fadeIn(xFadeTime);
if (xFadeTime && !stopped) fader.fadeIn(xFadeTime); // only fade in when fading out
else fader.XFadeVolume = 1.0f;
fader.Playing = true;
updateVolume(); // make sure at ok volume to start :)
@ -173,12 +173,17 @@ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool
}
/// Stop the music previously loaded and played (the Memory is also freed)
void CMusicChannelFader::stop(uint xFadeTime)
bool CMusicChannelFader::stop(uint xFadeTime)
{
if (xFadeTime)
{
bool stopped = true;
for (uint i = 0; i < _MaxMusicFader; ++i) if (_MusicFader[i].Playing)
{
_MusicFader[i].fadeOut(xFadeTime);
stopped = false; // fading
}
return stopped;
}
else
{
@ -188,6 +193,7 @@ void CMusicChannelFader::stop(uint xFadeTime)
_MusicFader[i].Fade = false;
_MusicFader[i].Playing = false;
}
return true;
}
}

@ -108,6 +108,13 @@ void CStreamFileSource::play()
//{
// nlwarning("Already waiting for play");
//}
std::string filepath = getStreamFileSound()->getFilePath();
m_LookupPath = NLMISC::CPath::lookup(filepath, false, false);
if (m_LookupPath.empty())
{
nlwarning("Music file %s does not exist!", filepath.c_str());
return;
}
if (!getStreamFileSound()->getAsync())
{
if (!prepareDecoder())
@ -272,7 +279,8 @@ bool CStreamFileSource::prepareDecoder()
if (!m_AudioDecoder)
{
// load the file
m_AudioDecoder = IAudioDecoder::createAudioDecoder(getStreamFileSound()->getFilePath(), getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping());
nlassert(!m_LookupPath.empty());
m_AudioDecoder = IAudioDecoder::createAudioDecoder(m_LookupPath, getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping());
if (!m_AudioDecoder)
{
nlwarning("Failed to create IAudioDecoder, likely invalid format");

@ -192,6 +192,7 @@ bool CCurlHttpClient::receive(string &res, bool verbose)
void CCurlHttpClient::disconnect()
{
curl_easy_cleanup(_Curl);
_CurlStruct = NULL;
curl_global_cleanup();
}

@ -326,8 +326,8 @@ CClientConfig::CClientConfig()
Local = false; // Default is Net Mode.
FSHost = ""; // Default Host.
TexturesInterface.push_back("texture_interfaces_v3_2x");
TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x");
TexturesInterface.push_back("texture_interfaces_v3");
TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc");
TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui");
@ -456,7 +456,13 @@ CClientConfig::CClientConfig()
SoundOn = true; // Default is with sound.
DriverSound = SoundDrvAuto;
SoundForceSoftwareBuffer = true;
SoundOutGameMusic = "main menu loop.ogg";
StartMusic = "main theme air.ogg"; // Use at game startup (originally no music)
EmptySlotMusic = "loading music loop.ogg"; // Use in character selection for empty slots
LoadingMusic = "main menu loop.ogg"; // Main loading used after leaving character selection, and when going back to character selection
KamiTeleportMusic = "kami teleport.ogg"; // Kami teleport
KaravanTeleportMusic = "karavan teleport.ogg"; // Karavan teleport
TeleportLoadingMusic = "loading music loop.ogg"; // Use for generic teleportations
DeathMusic = "death.ogg"; // Player death
SoundSFXVolume = 1.f;
SoundGameMusicVolume = 1.f;
SoundTPFade = 500;
@ -467,7 +473,7 @@ CClientConfig::CClientConfig()
UserEntitySoundLevel = 0.5f; // Default volume for sound in 1st person
UseEax = true; // Default to use EAX;
UseADPCM = false; // Defualt to PCM sample, NO ADPCM
MaxTrack = 32; // DEfault to 32 track
MaxTrack = 32; // Default to 32 track
ColorShout = CRGBA(150,0,0,255); // Default Shout color.
ColorTalk = CRGBA(255,255,255,255); // Default Talk color.
@ -782,8 +788,8 @@ void CClientConfig::setValues()
READ_STRINGVECTOR_FV(TexturesOutGameInterfaceDXTC);
// interface textures ingame and r2
//READ_STRINGVECTOR_FV(TexturesInterface);
//READ_STRINGVECTOR_FV(TexturesInterfaceDXTC);
READ_STRINGVECTOR_FV(TexturesInterface);
READ_STRINGVECTOR_FV(TexturesInterfaceDXTC);
// interface files login menus
READ_STRINGVECTOR_FV(XMLLoginInterfaceFiles);
@ -903,76 +909,16 @@ void CClientConfig::setValues()
READ_STRING_FV(FSHost)
READ_BOOL_DEV(DisplayAccountButtons)
READ_STRING_FV(CreateAccountURL)
READ_STRING_FV(EditAccountURL)
READ_STRING_FV(ForgetPwdURL)
READ_STRING_DEV(CreateAccountURL)
READ_STRING_DEV(EditAccountURL)
READ_STRING_DEV(ForgetPwdURL)
READ_STRING_DEV(BetaAccountURL)
READ_STRING_DEV(FreeTrialURL)
// defined in client_default.cfg
READ_STRING_FV(ConditionsTermsURL)
READ_STRING_FV(NamingPolicyURL)
READ_STRING_FV(LoginSupportURL)
// read NamingPolicyURL from client_default.cfg
//READ_STRING_FV(NamingPolicyURL)
std::string languageCo = "wk";
CConfigFile::CVar *languageCodeVarPtr = ClientCfg.ConfigFile.getVarPtr("LanguageCode");
if (languageCodeVarPtr)
{
languageCo = languageCodeVarPtr->asString();
}
CConfigFile::CVar *policyurl = ClientCfg.ConfigFile.getVarPtr("NamingPolicyURL");
if (policyurl)
{
for (uint i = 0; i < policyurl->size(); ++i)
{
std::string entry = policyurl->asString(i);
if (entry.size() >= languageCo.size())
{
if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0)
{
std::string::size_type pos = entry.find("=");
if (pos != std::string::npos)
{
ClientCfg.NamingPolicyURL = entry.substr(pos + 1);
}
}
}
}
}
// read NamingPolicyURL from client_default.cfg
//READ_STRING_FV(ConditionsTermsURL)
CConfigFile::CVar *coturl = ClientCfg.ConfigFile.getVarPtr("ConditionsTermsURL");
if (coturl)
{
for (uint i = 0; i < coturl->size(); ++i)
{
std::string entry = coturl->asString(i);
if (entry.size() >= languageCo.size())
{
if (nlstricmp(entry.substr(0, languageCo.size()), languageCo) == 0)
{
std::string::size_type pos = entry.find("=");
if (pos != std::string::npos)
{
ClientCfg.ConditionsTermsURL = entry.substr(pos + 1);
}
}
}
}
}
#ifndef RZ_NO_CLIENT
// if cookie is not empty, it means that the client was launch
@ -1298,7 +1244,13 @@ void CClientConfig::setValues()
// SoundForceSoftwareBuffer
READ_BOOL_FV(SoundForceSoftwareBuffer);
// SoundOutGameMusic
READ_STRING_DEV(SoundOutGameMusic)
READ_STRING_DEV(StartMusic)
READ_STRING_DEV(EmptySlotMusic)
READ_STRING_DEV(LoadingMusic)
READ_STRING_DEV(KamiTeleportMusic)
READ_STRING_DEV(KaravanTeleportMusic)
READ_STRING_DEV(TeleportLoadingMusic)
READ_STRING_DEV(DeathMusic)
// SoundSFXVolume
READ_FLOAT_FV(SoundSFXVolume);
// SoundGameMusicVolume

@ -348,8 +348,14 @@ struct CClientConfig
/// SoundForceSoftwareBuffer
bool SoundForceSoftwareBuffer;
/// The outgame music file
string SoundOutGameMusic;
/// Music files
string StartMusic;
string EmptySlotMusic;
string LoadingMusic;
string KamiTeleportMusic;
string KaravanTeleportMusic;
string TeleportLoadingMusic;
string DeathMusic;
/// The Sound SFX Volume (0-1) (ie all but music)
float SoundSFXVolume;

@ -193,7 +193,6 @@ bool hasPrivilegeG() { return (UserPrivileges.find(":G:") != std::string::npos);
bool hasPrivilegeEM() { return (UserPrivileges.find(":EM:") != std::string::npos); }
bool hasPrivilegeEG() { return (UserPrivileges.find(":EG:") != std::string::npos); }
bool hasPrivilegeOBSERVER() { return (UserPrivileges.find(":OBSERVER:") != std::string::npos); }
bool hasPrivilegeTESTER() { return (UserPrivileges.find(":TESTER:") != std::string::npos); }
// Restore the video mode (fullscreen for example) after the connection (done in a window)
@ -279,6 +278,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
//
@ -411,6 +477,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;
@ -513,6 +581,7 @@ bool reconnection()
ProgressBar.setFontFactor(1.0f);
// Init out game
SoundGlobalMenu.reset();
pIM->initOutGame();
// Hide cursor for interface
@ -528,6 +597,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;
@ -562,6 +634,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;
@ -737,66 +811,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
@ -1113,7 +1127,7 @@ TInterfaceState globalMenu()
charSelect = LoginCharsel;
WaitServerAnswer = false;
if (charSelect == -1 || FarTP.isReselectingChar())
if (charSelect == -1)
{
CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false);
if (pNL != NULL)
@ -2047,8 +2061,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);

@ -49,12 +49,12 @@
#include "login_progress_post_thread.h"
#include "interface_v3/action_handler_base.h"
#include "item_group_manager.h"
#include "nel/misc/cmd_args.h"
#ifdef DEBUG_NEW
#define new DEBUG_NEW
#endif
using namespace NLMISC;
using namespace NLNET;
using namespace NL3D;
@ -210,7 +210,6 @@ extern bool IsInRingSession;
extern void selectTipsOfTheDay (uint tips);
#define BAR_STEP_TP 2
extern NLMISC::CCmdArgs Args;
CLoginStateMachine::TEvent CLoginStateMachine::waitEvent()
{
@ -463,14 +462,12 @@ void CLoginStateMachine::run()
case st_check_patch:
/// check the data to check if patch needed
CLoginProgressPostThread::getInstance().step(CLoginStep(LoginStep_PostLogin, "login_step_post_login"));
if (!ClientCfg.PatchWanted || (Args.haveArg("n") && Args.getLongArg("nopatch").front() == "1"))
if (!ClientCfg.PatchWanted)
{
// client don't want to be patched !
_CurrentState = st_display_eula;
break;
}
initPatchCheck();
SM_BEGIN_EVENT_TABLE
if (isBGDownloadEnabled())
@ -1115,15 +1112,6 @@ void CFarTP::disconnectFromPreviousShard()
beginLoading (StartBackground);
UseEscapeDuringLoading = false;
// Play music and fade out the Game Sound
if (SoundMngr)
{
// Loading Music Loop.ogg
LoadingMusic = ClientCfg.SoundOutGameMusic;
SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true);
SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade);
}
// Change the tips
selectTipsOfTheDay (rand());
@ -1132,6 +1120,21 @@ void CFarTP::disconnectFromPreviousShard()
ucstring nmsg("Loading...");
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
ProgressBar.progress(0);
// Play music and fade out the Game Sound
if (SoundMngr)
{
SoundMngr->fadeOutGameSound(ClientCfg.SoundTPFade);
// Stop and enable music
SoundMngr->stopMusic(0);
SoundMngr->setupFadeSound(0.0f, 1.0f);
// Loading Music Loop.ogg
LoadingMusic = ClientCfg.LoadingMusic;
// SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true);
SoundMngr->playMusic(LoadingMusic, 0, false, true, true);
}
}
// Disconnect from the FS
@ -1520,3 +1523,4 @@ void CFarTP::farTPmainLoop()
if(welcomeWindow)
initWelcomeWindow();
}

@ -1410,6 +1410,42 @@ void prelogInit()
StereoDisplay->setDriver(Driver); // VR_DRIVER
}
{
H_AUTO(InitRZSound)
// Init the sound manager
nmsg = "Initializing sound manager...";
ProgressBar.newMessage(ClientCfg.buildLoadingString(nmsg));
if (ClientCfg.SoundOn)
{
nlassert(!SoundMngr);
SoundMngr = new CSoundManager(&ProgressBar);
try
{
SoundMngr->init(&ProgressBar);
}
catch(const Exception &e)
{
nlwarning("init : Error when creating 'SoundMngr' : %s", e.what());
delete SoundMngr;
SoundMngr = NULL;
}
// Play Music just after the SoundMngr is inited
if (SoundMngr)
{
// init the SoundMngr with backuped volume
SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume);
SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume);
// Play the login screen music
SoundMngr->playMusic(ClientCfg.StartMusic, 0, true, true, true);
}
}
CPath::memoryCompress(); // Because sound calls addSearchPath
}
nlinfo ("PROFILE: %d seconds for prelogInit", (uint32)(ryzomGetLocalTime ()-initStart)/1000);
FPU_CHECKER_ONCE
@ -1552,55 +1588,6 @@ void postlogInit()
// set the primitive context
CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig;
{
H_AUTO(InitRZSound)
// Init the sound manager
nmsg = "Initializing sound manager...";
ProgressBar.newMessage ( ClientCfg.buildLoadingString(nmsg) );
if(ClientCfg.SoundOn)
{
SoundMngr = new CSoundManager(&ProgressBar);
try
{
SoundMngr->init(&ProgressBar);
}
catch(const Exception &e)
{
nlwarning("init : Error when creating 'SoundMngr' : %s", e.what());
delete SoundMngr;
SoundMngr = NULL;
}
// Play Music just after the SoundMngr is inited
if(SoundMngr)
{
// init the SoundMngr with backuped volume
SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume);
SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume);
// no fadein, and not async because don't work well because of loading in the main thread
// Force use GameMusic volume
const uint fadeInTime= 500;
SoundMngr->playMusic(ClientCfg.SoundOutGameMusic, fadeInTime, false, true, true);
// Because of blocking loading, force the fadeIn
TTime t0= ryzomGetLocalTime();
TTime t1;
while((t1=ryzomGetLocalTime())<t0+fadeInTime)
{
//ProgressBar.progress(1.f);
SoundMngr->updateAudioMixerOnly();
}
}
}
CPath::memoryCompress(); // Because sound call addSearchPath
initLast = initCurrent;
initCurrent = ryzomGetLocalTime();
//nlinfo ("PROFILE: %d seconds (%d total) for Initializing sound manager", (uint32)(initCurrent-initLast)/1000, (uint32)(initCurrent-initStart)/1000);
}
{
H_AUTO(InitRZShIdI)

@ -473,6 +473,27 @@ void initMainLoop()
FPU_CHECKER_ONCE
if (SoundMngr)
{
// Loading Music
LoadingMusic = ClientCfg.LoadingMusic;
// SoundMngr->playEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade, true);
// no fadein, and not async because don't work well because of loading in the main thread
// Force use GameMusic volume
const uint fadeInTime = 500;
SoundMngr->playMusic(LoadingMusic, fadeInTime, false, true, true);
// Because of blocking loading, force the fadeIn
TTime t0 = ryzomGetLocalTime();
TTime t1;
do
{
ProgressBar.progress(0);
SoundMngr->updateAudioMixerOnly();
nlSleep(10);
} while ((t1 = ryzomGetLocalTime()) < t0 + fadeInTime);
}
// Get the interface manager
CInterfaceManager *pIM = CInterfaceManager::getInstance();

@ -271,16 +271,16 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
{
CViewPointer &rIP = *static_cast< CViewPointer* >( CWidgetManager::getInstance()->getPointer() );
CViewPointer &rIP = *static_cast<CViewPointer *>(CWidgetManager::getInstance()->getPointer());
NLGUI::CEventDescriptorMouse eventDesc;
sint32 x,y;
rIP.getPointerDispPos (x, y);
eventDesc.setX (x);
eventDesc.setY (y);
sint32 x, y;
rIP.getPointerDispPos(x, y);
eventDesc.setX(x);
eventDesc.setY(y);
bool handled= false;
bool handled = false;
// button down ?
static volatile bool doTest = false;
@ -291,7 +291,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
{
if (_RecoverFocusLost)
{
handled |= updateMousePos((CEventMouse&)event, eventDesc); // must update mouse pos here,
handled |= updateMousePos((CEventMouse&)event); // must update mouse pos here,
// because when app window focus is gained by a mouse click, this is
// the only place where we can retrieve mouse pos before a mouse move
_RecoverFocusLost = false;
@ -299,10 +299,19 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
if (!handled)
{
if (R2::getEditor().isInitialized()
&& (R2::isEditionCurrent() || R2::getEditor().getCurrentTool())
)
&& (R2::isEditionCurrent() || R2::getEditor().getCurrentTool()))
{
handled |= R2::getEditor().handleEvent(eventDesc);
const NLMISC::CEventMouseDown *mouseDownEvent = static_cast<const NLMISC::CEventMouseDown *>(&event);
if (mouseDownEvent->Button & NLMISC::leftButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdown);
handled |= R2::getEditor().handleEvent(eventDesc);
}
if (mouseDownEvent->Button & NLMISC::rightButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdown);
handled |= R2::getEditor().handleEvent(eventDesc);
}
}
}
handled |= inputHandler.handleMouseButtonDownEvent( event );
@ -321,7 +330,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
// mouse move?
else if(event == EventMouseMoveId)
{
handled |= updateMousePos((CEventMouse&)event, eventDesc);
handled |= updateMousePos((CEventMouse&)event);
}
else if (event == EventMouseWheelId)
{
@ -330,19 +339,77 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
}
// if Event not handled, post to Action Manager
if( !handled )
if (!handled)
{
bool handled = false;
if (R2::getEditor().isInitialized()
&& (R2::isEditionCurrent() || R2::getEditor().getCurrentTool())
)
&& (R2::isEditionCurrent() || R2::getEditor().getCurrentTool()))
{
handled = R2::getEditor().handleEvent(eventDesc);
if (event == EventMouseDownId)
{
const NLMISC::CEventMouseDown *mouseDownEvent = static_cast<const NLMISC::CEventMouseDown *>(&event);
if (mouseDownEvent->Button & NLMISC::leftButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdown);
handled |= R2::getEditor().handleEvent(eventDesc);
}
if (mouseDownEvent->Button & NLMISC::rightButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdown);
handled |= R2::getEditor().handleEvent(eventDesc);
}
}
else if (event == EventMouseUpId)
{
const NLMISC::CEventMouseUp *mouseUpEvent = static_cast<const NLMISC::CEventMouseUp *>(&event);
if (mouseUpEvent->Button & NLMISC::leftButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftup);
handled |= R2::getEditor().handleEvent(eventDesc);
}
if (mouseUpEvent->Button & NLMISC::rightButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightup);
handled |= R2::getEditor().handleEvent(eventDesc);
}
}
else if (event == EventMouseDblClkId)
{
const NLMISC::CEventMouseDblClk *mouseDblClkEvent = static_cast<const NLMISC::CEventMouseDblClk *>(&event);
if (mouseDblClkEvent->Button & NLMISC::leftButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouseleftdblclk);
handled |= R2::getEditor().handleEvent(eventDesc);
}
if (mouseDblClkEvent->Button & NLMISC::rightButton)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mouserightdblclk);
handled |= R2::getEditor().handleEvent(eventDesc);
}
}
else
{
if (event == EventMouseWheelId)
{
const NLMISC::CEventMouseWheel *wheelEvent = static_cast<const NLMISC::CEventMouseWheel *>(&event);
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mousewheel);
eventDesc.setWheel(wheelEvent->Direction ? 1 : -1);
handled = R2::getEditor().handleEvent(eventDesc);
}
else if (event == EventMouseMoveId)
{
eventDesc.setEventTypeExtended(CEventDescriptorMouse::mousemove);
handled = R2::getEditor().handleEvent(eventDesc);
}
else
{
nlwarning("R2 unknown mouse event '%s'", event.toString().c_str());
}
}
}
if (!handled)
{
// post to Action Manager
FilteredEventServer.postEvent( event.clone() );
FilteredEventServer.postEvent(event.clone());
}
}
}
@ -355,7 +422,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event)
// ***************************************************************************
bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc)
bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event)
{
if (!IsMouseFreeLook())
return inputHandler.handleMouseMoveEvent( event );

@ -181,7 +181,7 @@ private:
void parseKey(xmlNodePtr cur, std::vector<CComboKey> &out);
// return true if handled
bool updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc);
bool updateMousePos(NLMISC::CEventMouse &event);
NLGUI::CInputHandler inputHandler;

@ -3648,19 +3648,23 @@ void CInventoryManager::onTradeChangeSession()
// ***************************************************************************
void CInventoryManager::updateItemInfoQueue()
{
if (!ConnectionReadySent) // CONNECTION:READY not yet sent, so we cannot send requests yet!
{
// Caused by CNetworkConnection::reinit, and NLMISC::CCDBNodeBranch::resetData
// TODO: Item sheets are effectively being set to 0, any way to detect this in particular?
// Slots with sheet 0 won't have any info to request anyway!
// Remove this check in favour of the assert lower down when properly implemented.
nlwarning("Update item info queue (%i), but connection not ready", (int)_ItemInfoWaiters.size());
return;
}
// CONNECTION:READY not yet sent, so we cannot send requests yet!
nlassert(ConnectionReadySent || !_ItemInfoWaiters.size());
// For All waiters, look if one need update.
TItemInfoWaiters::iterator it;
for(it= _ItemInfoWaiters.begin();it!=_ItemInfoWaiters.end();it++)
{
/* yoyo remove: temp patch to be sure that the client does not send messages before the
CONNECTION:READY is sent
Ulukyn: this only happens if player ask to reselect a char before end of update items.
On this case, skip it...
*/
if (!ConnectionReadySent)
continue;
IItemInfoWaiter *waiter=*it;
uint itemSlotId= waiter->ItemSlotId;
TItemInfoMap::iterator it= _ItemInfoMap.find(itemSlotId);

@ -1932,11 +1932,8 @@ class CAHOpenURL : public IActionHandler
#else
// TODO: for Linux and Mac OS
#endif
if (sParams == "cfg_CreateAccountURL")
{
url = ClientCfg.CreateAccountURL;
}
else if (sParams == "cfg_EditAccountURL")
if (sParams == "cfg_EditAccountURL")
{
url = ClientCfg.EditAccountURL;
}
@ -1974,35 +1971,32 @@ class CAHOpenURL : public IActionHandler
nlwarning("no URL found");
return;
}
if(sParams != "cfg_ConditionsTermsURL" && sParams != "cfg_NamingPolicyURL")
{
// modify existing languages
// old site
string::size_type pos_lang = url.find("/en/");
// modify existing languages
// or new forums
if (pos_lang == string::npos)
pos_lang = url.find("=en#");
// old site
string::size_type pos_lang = url.find("/en/");
if (pos_lang != string::npos)
{
url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode());
}
// or new forums
if (pos_lang == string::npos)
pos_lang = url.find("=en#");
if (pos_lang != string::npos)
{
url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode());
}
else
{
// append language
if (url.find('?') != string::npos)
url += "&";
else
{
// append language
if (url.find('?') != string::npos)
url += "&";
else
url += "?";
url += "?";
url += "language=" + ClientCfg.LanguageCode;
url += "language=" + ClientCfg.LanguageCode;
if (!LoginCustomParameters.empty())
url += LoginCustomParameters;
}
if (!LoginCustomParameters.empty())
url += LoginCustomParameters;
}
openURL(url);
@ -3289,6 +3283,7 @@ bool loginIntroSkip;
void loginIntro()
{
// Display of nevrax logo is done at init time (see init.cpp) just before addSearchPath (second one)
#if 0
for (uint i = 0; i < 1; i++) // previously display nevrax then nvidia
{
if (i != 0)
@ -3326,6 +3321,7 @@ void loginIntro()
NLGUI::CDBManager::getInstance()->flushObserverCalls();
}
}
#endif
beginLoading(StartBackground);
ProgressBar.finish();
}

@ -2255,19 +2255,21 @@ bool mainLoop()
{
StartPlayTime = NLMISC::CTime::getLocalTime();
}
// Start background sound play now ! (nb: restarted if load just ended, or if sound re-enabled)
if (SoundMngr)
{
H_AUTO_USE ( RZ_Client_Main_Loop_Sound )
SoundMngr->playBackgroundSound();
}
// Fade in Game Sound now (before endLoading)
if(SoundMngr)
{
// fade out loading music
if(LoadingMusic==SoundMngr->getEventMusicPlayed())
if (SoundMngr->getEventMusicPlayed() == LoadingMusic)
{
SoundMngr->stopEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade);
}
SoundMngr->playBackgroundSound();
// Fade in Game Sound now (before endLoading)
// fade in game sound
SoundMngr->fadeInGameSound(ClientCfg.SoundTPFade);
}
@ -2531,7 +2533,7 @@ bool mainLoop()
EditActions.enable(true);
// For stoping the outgame music, start after 30 frames, and duration of 3 seconds
// CMusicFader outgameFader(60, 3);
outgameFader = CMusicFader(60, 3);
// check for banned player
if (testPermanentBanMarkers())

@ -33,7 +33,6 @@
#include "game_share/chat_group.h"
#include "game_share/character_summary.h"
#include "game_share/sphrase_com.h"
#include "game_share/outpost.h"
#include "game_share/msg_client_server.h"
#include "game_share/ryzom_database_banks.h"
#include "game_share/msg_encyclopedia.h"
@ -1489,32 +1488,33 @@ void impulseTPCommon(NLMISC::CBitMemStream &impulse, bool hasSeason)
void impulseTPCommon2(NLMISC::CBitMemStream &impulse, bool hasSeason)
{
// choose a default screen if not setuped
if( LoadingBackground!=ResurectKamiBackground && LoadingBackground!=ResurectKaravanBackground &&
LoadingBackground!=TeleportKamiBackground && LoadingBackground!=TeleportKaravanBackground)
LoadingBackground= TeleportKaravanBackground;
if (LoadingBackground != ResurectKamiBackground && LoadingBackground != ResurectKaravanBackground
&& LoadingBackground != TeleportKamiBackground && LoadingBackground != TeleportKaravanBackground)
LoadingBackground = ElevatorBackground;
// if resurect but user not dead, choose default. NB: this is a bug, the tp impulse should tell
// which background to choose. \todo yoyo: this is a temp fix
if( UserEntity && !UserEntity->isDead() &&
(LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) )
LoadingBackground= TeleportKaravanBackground;
if (UserEntity && !UserEntity->isDead() && (LoadingBackground == ResurectKamiBackground || LoadingBackground == ResurectKaravanBackground))
LoadingBackground = ElevatorBackground;
// Play music according to the background
if(SoundMngr)
if (SoundMngr)
{
LoadingMusic.clear();
if(LoadingBackground==TeleportKamiBackground)
LoadingMusic= "Kami Teleport.ogg";
else if(LoadingBackground==TeleportKaravanBackground)
LoadingMusic= "Karavan Teleport.ogg";
// if resurection, continue to play death music
else if(LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground)
{
// noop
}
// default: loading music
else
switch (LoadingBackground)
{
LoadingMusic= "Loading Music Loop.ogg";
case TeleportKamiBackground:
LoadingMusic = ClientCfg.KamiTeleportMusic;
break;
case TeleportKaravanBackground:
LoadingMusic = ClientCfg.KaravanTeleportMusic;
break;
case ResurectKamiBackground:
case ResurectKaravanBackground:
// TODO: Resurrect music
break;
default:
LoadingMusic = ClientCfg.TeleportLoadingMusic;
break;
}
// start to play
@ -3206,11 +3206,9 @@ void impulseUserBars(NLMISC::CBitMemStream &impulse)
void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse)
{
// read message
uint8 type;
bool outpostInFire;
bool playerGuildInConflict;
bool playerGuildIsAttacker;
impulse.serial(type);
impulse.serial(outpostInFire);
impulse.serial(playerGuildInConflict);
impulse.serial(playerGuildIsAttacker);
@ -3222,7 +3220,7 @@ void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse)
impulse.serial( declTimer );
// start
OutpostManager.startPvpJoinProposal((OUTPOSTENUMS::TPVPType)type, outpostInFire, playerGuildInConflict, playerGuildIsAttacker,
OutpostManager.startPvpJoinProposal(outpostInFire, playerGuildInConflict, playerGuildIsAttacker,
ownerGuildNameId, attackerGuildNameId, declTimer);
}

@ -2674,6 +2674,17 @@ void CUserEntity::selection(const CLFECOMMON::TCLEntityId &slot) // virtual
{
playerGiftNeeded->setValue32(0);
}
//
missionOption = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:TITLE", (int) k), false);
if (missionOption)
{
missionOption->setValue32(0);
}
playerGiftNeeded = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:TARGET:CONTEXT_MENU:MISSIONS_OPTIONS:%d:PLAYER_GIFT_NEEDED", (int) k), false);
if (playerGiftNeeded)
{
playerGiftNeeded->setValue32(0);
}
}
/* TODO ULU : Add RP tags */
@ -4302,20 +4313,19 @@ void CUserEntity::updatePreCollision(const NLMISC::TTime &time, CEntityCL *targe
// test each frame if the mode has changed
if(SoundMngr)
{
string deadMusic= "death.ogg";
// Play/stop music if comes from or goes to dead
bool isDead= _Mode==MBEHAV::DEATH || _Mode==MBEHAV::SWIM_DEATH;
bool isDead = _Mode == MBEHAV::DEATH || _Mode == MBEHAV::SWIM_DEATH;
// must start music?
if( isDead && SoundMngr->getEventMusicPlayed()!=deadMusic )
if (isDead && SoundMngr->getEventMusicPlayed() != ClientCfg.DeathMusic)
{
SoundMngr->playEventMusic(deadMusic, 0, true);
SoundMngr->playEventMusic(ClientCfg.DeathMusic, 0, true);
}
// must end music?
if( !isDead && SoundMngr->getEventMusicPlayed()==deadMusic )
if (!isDead && SoundMngr->getEventMusicPlayed() == ClientCfg.DeathMusic)
{
SoundMngr->stopEventMusic(deadMusic, CSoundManager::LoadingMusicXFade);
SoundMngr->stopEventMusic(ClientCfg.DeathMusic, CSoundManager::LoadingMusicXFade);
}
}
}

Loading…
Cancel
Save