From 3709ea452015e388f0e51062e5ad451d54c579e4 Mon Sep 17 00:00:00 2001 From: Nuno Date: Wed, 20 Oct 2021 15:00:13 +0200 Subject: [PATCH] Revert All core changes (to be reapplied on next commit) --- nel/include/nel/misc/debug.h | 8 +- nel/include/nel/misc/sha1.h | 39 +++-- nel/include/nel/misc/string_common.h | 15 +- nel/include/nel/misc/xml_macros.h | 74 +++++++++ nel/include/nel/sound/music_channel_fader.h | 2 +- nel/include/nel/sound/stream_file_source.h | 2 - nel/include/nel/web/http_client_curl.h | 2 +- .../3d/driver/direct3d/driver_direct3d.cpp | 8 +- nel/src/3d/driver/direct3d/driver_direct3d.h | 9 -- .../direct3d/driver_direct3d_material.cpp | 21 +-- .../direct3d/driver_direct3d_texture.cpp | 1 - nel/src/3d/fxaa.cpp | 1 - nel/src/3d/lod_character_manager.cpp | 3 - nel/src/misc/co_task.cpp | 4 - nel/src/misc/debug.cpp | 9 -- nel/src/misc/file.cpp | 2 +- nel/src/misc/i_xml.cpp | 5 +- nel/src/misc/win_thread.cpp | 3 - nel/src/sound/audio_decoder.cpp | 8 +- nel/src/sound/music_channel_fader.cpp | 12 +- nel/src/sound/stream_file_source.cpp | 10 +- nel/src/web/http_client_curl.cpp | 1 - ryzom/client/src/client_cfg.cpp | 96 +++++++++--- ryzom/client/src/client_cfg.h | 10 +- ryzom/client/src/connection.cpp | 142 ++++++++---------- ryzom/client/src/far_tp.cpp | 32 ++-- ryzom/client/src/init.cpp | 85 ++++++----- ryzom/client/src/init_main_loop.cpp | 21 --- .../interface_v3/input_handler_manager.cpp | 103 +++---------- .../src/interface_v3/input_handler_manager.h | 2 +- .../src/interface_v3/inventory_manager.cpp | 22 ++- ryzom/client/src/login.cpp | 52 ++++--- ryzom/client/src/main_loop.cpp | 16 +- ryzom/client/src/net_manager.cpp | 44 +++--- ryzom/client/src/user_entity.cpp | 22 +-- 35 files changed, 411 insertions(+), 475 deletions(-) create mode 100644 nel/include/nel/misc/xml_macros.h diff --git a/nel/include/nel/misc/debug.h b/nel/include/nel/misc/debug.h index 1d533c149..a8c23eced 100644 --- a/nel/include/nel/misc/debug.h +++ b/nel/include/nel/misc/debug.h @@ -89,9 +89,6 @@ 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); @@ -355,7 +352,7 @@ void setCrashAlreadyReported(bool state); * Same as nlassertex(false,exp); */ -#if defined(NL_DEBUG) /* Debug break is only useful in debug builds */ +// removed because we always check assert (even in release mode) #if defined (NL_OS_WINDOWS) && defined (NL_DEBUG) #if defined(NL_OS_WINDOWS) #define NLMISC_BREAKPOINT __debugbreak() #elif defined(NL_OS_UNIX) && defined(NL_COMP_GCC) @@ -363,9 +360,6 @@ 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); diff --git a/nel/include/nel/misc/sha1.h b/nel/include/nel/misc/sha1.h index d458c6f8f..87edba44c 100644 --- a/nel/include/nel/misc/sha1.h +++ b/nel/include/nel/misc/sha1.h @@ -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 (size_t i = 0; i < str.size(); i += 2) + for(uint 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,28 +85,23 @@ 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 +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + + + +#ifndef XML_MACROS_H +#define XML_MACROS_H + +// +// xmlNodePtr cur; +// CXMLAutoPtr prop; +// +// sint i; +// XML_READ_SINT(cur, "prop_name", i, -1); +// + +#define XML_READ_UINT(node, name, var, def) { \ + uint tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_SINT(node, name, var, def) { \ + sint tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_BOOL(node, name, var, def) { \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop) \ + var = NLMISC::toBool((const char*)prop); \ + else \ + var = def; \ +} + +#define XML_READ_COLOR(node, name, var, def) { \ + NLMISC::CRGBA tmp; \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop && fromString((const char*)prop, tmp)) \ + var = tmp; \ + else \ + var = def; \ +} + +#define XML_READ_STRING(node, name, var, def) { \ + prop = (char *) xmlGetProp(node, (xmlChar*)name); \ + if (prop) \ + var = (const char*)prop; \ + else \ + var = def; \ +} + +#endif // XML_MACROS_H + diff --git a/nel/include/nel/sound/music_channel_fader.h b/nel/include/nel/sound/music_channel_fader.h index 577d23949..6bb5677f9 100644 --- a/nel/include/nel/sound/music_channel_fader.h +++ b/nel/include/nel/sound/music_channel_fader.h @@ -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) - bool stop(uint xFadeTime = 0); + void stop(uint xFadeTime = 0); /// Pause the music previously loaded and played (the Memory is not freed) void pause(); diff --git a/nel/include/nel/sound/stream_file_source.h b/nel/include/nel/sound/stream_file_source.h index c8cf91cf5..4069a2f58 100644 --- a/nel/include/nel/sound/stream_file_source.h +++ b/nel/include/nel/sound/stream_file_source.h @@ -96,8 +96,6 @@ private: IAudioDecoder *m_AudioDecoder; - std::string m_LookupPath; - bool m_Paused; bool m_DecodingEnded; diff --git a/nel/include/nel/web/http_client_curl.h b/nel/include/nel/web/http_client_curl.h index e130cd768..77cf335ca 100644 --- a/nel/include/nel/web/http_client_curl.h +++ b/nel/include/nel/web/http_client_curl.h @@ -34,7 +34,7 @@ class CCurlHttpClient public: /// Constructor - CCurlHttpClient() : _CurlStruct(NULL) {} + CCurlHttpClient() {} /// 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); diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.cpp b/nel/src/3d/driver/direct3d/driver_direct3d.cpp index 3a4f67aee..1ab29c3a0 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d.cpp @@ -3830,15 +3830,9 @@ void CDriverD3D::CLightState::apply(CDriverD3D *driver) void CDriverD3D::CRenderTargetState::apply(CDriverD3D *driver) { H_AUTO_D3D(CDriverD3D_CRenderTargetState); - nlassert(TargetOwned); // Can only apply once! - driver->_DeviceInterface->SetRenderTarget(0, Target); + driver->_DeviceInterface->SetRenderTarget (0, Target); driver->setupViewport(driver->_Viewport); driver->setupScissor(driver->_Scissor); - if (TargetOwned) - { - Target->Release(); - TargetOwned = false; - } } // *************************************************************************** diff --git a/nel/src/3d/driver/direct3d/driver_direct3d.h b/nel/src/3d/driver/direct3d/driver_direct3d.h index c021f052d..636695670 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -1546,13 +1546,11 @@ public: Texture = NULL; Level = 0; CubeFace = 0; - TargetOwned = false; } IDirect3DSurface9 *Target; ITexture *Texture; uint8 Level; uint8 CubeFace; - bool TargetOwned; virtual void apply(CDriverD3D *driver); }; @@ -2078,17 +2076,10 @@ 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); diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp index 2285688d4..f902e9fb0 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_material.cpp @@ -706,13 +706,9 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) // Set the texture states if (text || (stage == 0)) { - if (matShader == CMaterial::Program) + // Doesn't use a pixel shader ? Set the textures stages + if (pShader->PixelShader == NULL) { - // 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]); @@ -1149,7 +1145,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) } break; - case CMaterial::Cloud: + case CMaterial::Cloud: { H_AUTO_D3D(CDriverD3D_setupMaterial_setupCloudShader) activeShader (&_ShaderCloud); @@ -1171,7 +1167,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); @@ -1300,14 +1296,7 @@ bool CDriverD3D::setupMaterial(CMaterial &mat) } } } - break; // CMaterial::Water - case CMaterial::Program: - { - H_AUTO_D3D(CDriverD3D_setupMaterial_setupProgramshader) - // No material shader - activeShader(NULL); - } - break; + // CMaterial::Water } // New material setuped diff --git a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index 15dcb7768..f45663f1b 100644 --- a/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -1084,7 +1084,6 @@ 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); diff --git a/nel/src/3d/fxaa.cpp b/nel/src/3d/fxaa.cpp index 6478abf8e..255f0234d 100644 --- a/nel/src/3d/fxaa.cpp +++ b/nel/src/3d/fxaa.cpp @@ -246,7 +246,6 @@ void CFXAA::applyEffect() // create render target CTextureUser *otherRenderTarget = m_Driver->getRenderTargetManager().getRenderTarget(width, height, mode2D); - nlassert(otherRenderTarget); // swap render target CTextureUser texNull; diff --git a/nel/src/3d/lod_character_manager.cpp b/nel/src/3d/lod_character_manager.cpp index f5d6a23c5..92dee846a 100644 --- a/nel/src/3d/lod_character_manager.cpp +++ b/nel/src/3d/lod_character_manager.cpp @@ -979,9 +979,6 @@ 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) diff --git a/nel/src/misc/co_task.cpp b/nel/src/misc/co_task.cpp index 4548fbe86..524cc69c6 100644 --- a/nel/src/misc/co_task.cpp +++ b/nel/src/misc/co_task.cpp @@ -143,9 +143,6 @@ namespace NLMISC NL_CT_DEBUG("CoTask : task %p start func called", task); - // Attach exception handler - attachExceptionHandler(); - try { // run the task @@ -154,7 +151,6 @@ namespace NLMISC catch(...) { nlwarning("CCoTask::startFunc : the task has generated an unhandled exeption and will terminate"); - NLMISC_BREAKPOINT; } task->_Finished = true; diff --git a/nel/src/misc/debug.cpp b/nel/src/misc/debug.cpp index 1f7cf38db..cc3203a14 100644 --- a/nel/src/misc/debug.cpp +++ b/nel/src/misc/debug.cpp @@ -1157,15 +1157,6 @@ 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 diff --git a/nel/src/misc/file.cpp b/nel/src/misc/file.cpp index 24222bdfe..89af07129 100644 --- a/nel/src/misc/file.cpp +++ b/nel/src/misc/file.cpp @@ -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, (sint64)_BigFileOffset + _ReadPos, SEEK_SET) != 0) + if (nlfseek64(_F, _BigFileOffset+_ReadPos, SEEK_SET) != 0) return false; return true; } diff --git a/nel/src/misc/i_xml.cpp b/nel/src/misc/i_xml.cpp index 24a2b7910..87f848ab9 100644 --- a/nel/src/misc/i_xml.cpp +++ b/nel/src/misc/i_xml.cpp @@ -171,16 +171,15 @@ bool CIXml::init (IStream &stream) // Try binary mode if (_TryBinaryMode) { - char header[5]; + char header[4]; 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, "Runnable->run(); diff --git a/nel/src/sound/audio_decoder.cpp b/nel/src/sound/audio_decoder.cpp index db87bd990..1314cd448 100644 --- a/nel/src/sound/audio_decoder.cpp +++ b/nel/src/sound/audio_decoder.cpp @@ -56,12 +56,18 @@ 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(filepath); + ifile->open(lookup); IAudioDecoder *mb = createAudioDecoder(type, ifile, loop); diff --git a/nel/src/sound/music_channel_fader.cpp b/nel/src/sound/music_channel_fader.cpp index 70ab890d2..ea2cc6341 100644 --- a/nel/src/sound/music_channel_fader.cpp +++ b/nel/src/sound/music_channel_fader.cpp @@ -147,7 +147,7 @@ void CMusicChannelFader::updateVolume() */ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool async, bool loop) { - bool stopped = stop(xFadeTime); + 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 && !stopped) fader.fadeIn(xFadeTime); // only fade in when fading out + if (xFadeTime) fader.fadeIn(xFadeTime); else fader.XFadeVolume = 1.0f; fader.Playing = true; updateVolume(); // make sure at ok volume to start :) @@ -173,17 +173,12 @@ bool CMusicChannelFader::play(const std::string &filepath, uint xFadeTime, bool } /// Stop the music previously loaded and played (the Memory is also freed) -bool CMusicChannelFader::stop(uint xFadeTime) +void 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 { @@ -193,7 +188,6 @@ bool CMusicChannelFader::stop(uint xFadeTime) _MusicFader[i].Fade = false; _MusicFader[i].Playing = false; } - return true; } } diff --git a/nel/src/sound/stream_file_source.cpp b/nel/src/sound/stream_file_source.cpp index 50d9bda97..fbd720a89 100644 --- a/nel/src/sound/stream_file_source.cpp +++ b/nel/src/sound/stream_file_source.cpp @@ -108,13 +108,6 @@ 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()) @@ -279,8 +272,7 @@ bool CStreamFileSource::prepareDecoder() if (!m_AudioDecoder) { // load the file - nlassert(!m_LookupPath.empty()); - m_AudioDecoder = IAudioDecoder::createAudioDecoder(m_LookupPath, getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping()); + m_AudioDecoder = IAudioDecoder::createAudioDecoder(getStreamFileSound()->getFilePath(), getStreamFileSound()->getAsync(), getStreamFileSound()->getLooping()); if (!m_AudioDecoder) { nlwarning("Failed to create IAudioDecoder, likely invalid format"); diff --git a/nel/src/web/http_client_curl.cpp b/nel/src/web/http_client_curl.cpp index e61baa89f..1ec244cd2 100644 --- a/nel/src/web/http_client_curl.cpp +++ b/nel/src/web/http_client_curl.cpp @@ -192,7 +192,6 @@ bool CCurlHttpClient::receive(string &res, bool verbose) void CCurlHttpClient::disconnect() { curl_easy_cleanup(_Curl); - _CurlStruct = NULL; curl_global_cleanup(); } diff --git a/ryzom/client/src/client_cfg.cpp b/ryzom/client/src/client_cfg.cpp index 9d030cdca..055260673 100644 --- a/ryzom/client/src/client_cfg.cpp +++ b/ryzom/client/src/client_cfg.cpp @@ -326,8 +326,8 @@ CClientConfig::CClientConfig() Local = false; // Default is Net Mode. FSHost = ""; // Default Host. - TexturesInterface.push_back("texture_interfaces_v3"); - TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc"); + TexturesInterface.push_back("texture_interfaces_v3_2x"); + TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc_2x"); TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui"); @@ -456,13 +456,7 @@ CClientConfig::CClientConfig() SoundOn = true; // Default is with sound. DriverSound = SoundDrvAuto; SoundForceSoftwareBuffer = true; - 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 + SoundOutGameMusic = "main menu loop.ogg"; SoundSFXVolume = 1.f; SoundGameMusicVolume = 1.f; SoundTPFade = 500; @@ -473,7 +467,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. @@ -788,8 +782,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); @@ -909,16 +903,76 @@ void CClientConfig::setValues() READ_STRING_FV(FSHost) READ_BOOL_DEV(DisplayAccountButtons) - READ_STRING_DEV(CreateAccountURL) - READ_STRING_DEV(EditAccountURL) - READ_STRING_DEV(ForgetPwdURL) + + + READ_STRING_FV(CreateAccountURL) + READ_STRING_FV(EditAccountURL) + READ_STRING_FV(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 @@ -1244,13 +1298,7 @@ void CClientConfig::setValues() // SoundForceSoftwareBuffer READ_BOOL_FV(SoundForceSoftwareBuffer); // 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) + READ_STRING_DEV(SoundOutGameMusic) // SoundSFXVolume READ_FLOAT_FV(SoundSFXVolume); // SoundGameMusicVolume diff --git a/ryzom/client/src/client_cfg.h b/ryzom/client/src/client_cfg.h index 16a1e9e0c..2b79dbf05 100644 --- a/ryzom/client/src/client_cfg.h +++ b/ryzom/client/src/client_cfg.h @@ -348,14 +348,8 @@ struct CClientConfig /// SoundForceSoftwareBuffer bool SoundForceSoftwareBuffer; - /// Music files - string StartMusic; - string EmptySlotMusic; - string LoadingMusic; - string KamiTeleportMusic; - string KaravanTeleportMusic; - string TeleportLoadingMusic; - string DeathMusic; + /// The outgame music file + string SoundOutGameMusic; /// The Sound SFX Volume (0-1) (ie all but music) float SoundSFXVolume; diff --git a/ryzom/client/src/connection.cpp b/ryzom/client/src/connection.cpp index ee1be3318..f57238991 100644 --- a/ryzom/client/src/connection.cpp +++ b/ryzom/client/src/connection.cpp @@ -193,6 +193,7 @@ 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) @@ -278,73 +279,6 @@ 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 // @@ -477,8 +411,6 @@ 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; @@ -581,7 +513,6 @@ bool reconnection() ProgressBar.setFontFactor(1.0f); // Init out game - SoundGlobalMenu.reset(); pIM->initOutGame(); // Hide cursor for interface @@ -597,9 +528,6 @@ 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; @@ -634,8 +562,6 @@ 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; @@ -811,6 +737,66 @@ 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 @@ -1127,7 +1113,7 @@ TInterfaceState globalMenu() charSelect = LoginCharsel; WaitServerAnswer = false; - if (charSelect == -1) + if (charSelect == -1 || FarTP.isReselectingChar()) { CCDBNodeLeaf *pNL = NLGUI::CDBManager::getInstance()->getDbProp("UI:SERVER_RECEIVED_CHARS", false); if (pNL != NULL) @@ -2061,8 +2047,8 @@ public: fromString(getParam(Params, "async"), async); // if empty name, return to default mode - if (sName.empty()) - sName = ClientCfg.EmptySlotMusic; + if(sName.empty()) + sName= ClientCfg.SoundOutGameMusic; // change the music SoundGlobalMenu.setMusic(sName, async); diff --git a/ryzom/client/src/far_tp.cpp b/ryzom/client/src/far_tp.cpp index 80134f26b..1c2a6e612 100644 --- a/ryzom/client/src/far_tp.cpp +++ b/ryzom/client/src/far_tp.cpp @@ -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,6 +210,7 @@ extern bool IsInRingSession; extern void selectTipsOfTheDay (uint tips); #define BAR_STEP_TP 2 +extern NLMISC::CCmdArgs Args; CLoginStateMachine::TEvent CLoginStateMachine::waitEvent() { @@ -462,12 +463,14 @@ 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) + + if (!ClientCfg.PatchWanted || (Args.haveArg("n") && Args.getLongArg("nopatch").front() == "1")) { // client don't want to be patched ! _CurrentState = st_display_eula; break; } + initPatchCheck(); SM_BEGIN_EVENT_TABLE if (isBGDownloadEnabled()) @@ -1112,6 +1115,15 @@ 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()); @@ -1120,21 +1132,6 @@ 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 @@ -1523,4 +1520,3 @@ void CFarTP::farTPmainLoop() if(welcomeWindow) initWelcomeWindow(); } - diff --git a/ryzom/client/src/init.cpp b/ryzom/client/src/init.cpp index 5e7b03549..efc137ee6 100644 --- a/ryzom/client/src/init.cpp +++ b/ryzom/client/src/init.cpp @@ -1410,42 +1410,6 @@ 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 @@ -1588,6 +1552,55 @@ 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())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) diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index deeda2149..2b391114c 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -473,27 +473,6 @@ 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(); diff --git a/ryzom/client/src/interface_v3/input_handler_manager.cpp b/ryzom/client/src/interface_v3/input_handler_manager.cpp index 67a1b2350..9d1e9292d 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.cpp +++ b/ryzom/client/src/interface_v3/input_handler_manager.cpp @@ -271,16 +271,16 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) { - CViewPointer &rIP = *static_cast(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); // must update mouse pos here, + handled |= updateMousePos((CEventMouse&)event, eventDesc); // 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,19 +299,10 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) if (!handled) { if (R2::getEditor().isInitialized() - && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool())) + && (R2::isEditionCurrent() || R2::getEditor().getCurrentTool()) + ) { - const NLMISC::CEventMouseDown *mouseDownEvent = static_cast(&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 |= R2::getEditor().handleEvent(eventDesc); } } handled |= inputHandler.handleMouseButtonDownEvent( event ); @@ -330,7 +321,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) // mouse move? else if(event == EventMouseMoveId) { - handled |= updateMousePos((CEventMouse&)event); + handled |= updateMousePos((CEventMouse&)event, eventDesc); } else if (event == EventMouseWheelId) { @@ -339,77 +330,19 @@ 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()) + ) { - if (event == EventMouseDownId) - { - const NLMISC::CEventMouseDown *mouseDownEvent = static_cast(&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(&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(&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(&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()); - } - } + handled = R2::getEditor().handleEvent(eventDesc); } if (!handled) { // post to Action Manager - FilteredEventServer.postEvent(event.clone()); + FilteredEventServer.postEvent( event.clone() ); } } } @@ -422,7 +355,7 @@ void CInputHandlerManager::operator ()(const NLMISC::CEvent &event) // *************************************************************************** -bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event) +bool CInputHandlerManager::updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc) { if (!IsMouseFreeLook()) return inputHandler.handleMouseMoveEvent( event ); diff --git a/ryzom/client/src/interface_v3/input_handler_manager.h b/ryzom/client/src/interface_v3/input_handler_manager.h index 4b078ee84..7971ef9a8 100644 --- a/ryzom/client/src/interface_v3/input_handler_manager.h +++ b/ryzom/client/src/interface_v3/input_handler_manager.h @@ -181,7 +181,7 @@ private: void parseKey(xmlNodePtr cur, std::vector &out); // return true if handled - bool updateMousePos(NLMISC::CEventMouse &event); + bool updateMousePos(NLMISC::CEventMouse &event, NLGUI::CEventDescriptorMouse &eventDesc); NLGUI::CInputHandler inputHandler; diff --git a/ryzom/client/src/interface_v3/inventory_manager.cpp b/ryzom/client/src/interface_v3/inventory_manager.cpp index 5c4799fe4..20480dc38 100644 --- a/ryzom/client/src/interface_v3/inventory_manager.cpp +++ b/ryzom/client/src/interface_v3/inventory_manager.cpp @@ -3648,23 +3648,19 @@ 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); diff --git a/ryzom/client/src/login.cpp b/ryzom/client/src/login.cpp index 9eb9688ae..244bb593c 100644 --- a/ryzom/client/src/login.cpp +++ b/ryzom/client/src/login.cpp @@ -1932,8 +1932,11 @@ class CAHOpenURL : public IActionHandler #else // TODO: for Linux and Mac OS #endif - - if (sParams == "cfg_EditAccountURL") + if (sParams == "cfg_CreateAccountURL") + { + url = ClientCfg.CreateAccountURL; + } + else if (sParams == "cfg_EditAccountURL") { url = ClientCfg.EditAccountURL; } @@ -1971,32 +1974,35 @@ class CAHOpenURL : public IActionHandler nlwarning("no URL found"); return; } + + if(sParams != "cfg_ConditionsTermsURL" && sParams != "cfg_NamingPolicyURL") + { + // modify existing languages - // modify existing languages - - // old site - string::size_type pos_lang = url.find("/en/"); + // old site + string::size_type pos_lang = url.find("/en/"); - // or new forums - if (pos_lang == string::npos) - pos_lang = url.find("=en#"); + // 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 += "&"; + if (pos_lang != string::npos) + { + url.replace(pos_lang + 1, 2, ClientCfg.getHtmlLanguageCode()); + } else - url += "?"; + { + // append language + if (url.find('?') != string::npos) + url += "&"; + else + url += "?"; - url += "language=" + ClientCfg.LanguageCode; + url += "language=" + ClientCfg.LanguageCode; - if (!LoginCustomParameters.empty()) - url += LoginCustomParameters; + if (!LoginCustomParameters.empty()) + url += LoginCustomParameters; + } } openURL(url); @@ -3283,7 +3289,6 @@ 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) @@ -3321,7 +3326,6 @@ void loginIntro() NLGUI::CDBManager::getInstance()->flushObserverCalls(); } } -#endif beginLoading(StartBackground); ProgressBar.finish(); } diff --git a/ryzom/client/src/main_loop.cpp b/ryzom/client/src/main_loop.cpp index a62b72e73..5c4f99446 100644 --- a/ryzom/client/src/main_loop.cpp +++ b/ryzom/client/src/main_loop.cpp @@ -2255,21 +2255,19 @@ 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 (SoundMngr->getEventMusicPlayed() == LoadingMusic) - { + if(LoadingMusic==SoundMngr->getEventMusicPlayed()) SoundMngr->stopEventMusic(LoadingMusic, CSoundManager::LoadingMusicXFade); - } - - SoundMngr->playBackgroundSound(); - - // Fade in Game Sound now (before endLoading) // fade in game sound SoundMngr->fadeInGameSound(ClientCfg.SoundTPFade); } @@ -2533,7 +2531,7 @@ bool mainLoop() EditActions.enable(true); // For stoping the outgame music, start after 30 frames, and duration of 3 seconds - outgameFader = CMusicFader(60, 3); +// CMusicFader outgameFader(60, 3); // check for banned player if (testPermanentBanMarkers()) diff --git a/ryzom/client/src/net_manager.cpp b/ryzom/client/src/net_manager.cpp index c6da153bc..ada437ec7 100644 --- a/ryzom/client/src/net_manager.cpp +++ b/ryzom/client/src/net_manager.cpp @@ -33,6 +33,7 @@ #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" @@ -1488,33 +1489,32 @@ 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 = ElevatorBackground; + if( LoadingBackground!=ResurectKamiBackground && LoadingBackground!=ResurectKaravanBackground && + LoadingBackground!=TeleportKamiBackground && LoadingBackground!=TeleportKaravanBackground) + LoadingBackground= TeleportKaravanBackground; // 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 = ElevatorBackground; + if( UserEntity && !UserEntity->isDead() && + (LoadingBackground==ResurectKamiBackground || LoadingBackground==ResurectKaravanBackground) ) + LoadingBackground= TeleportKaravanBackground; // Play music according to the background - if (SoundMngr) + if(SoundMngr) { LoadingMusic.clear(); - switch (LoadingBackground) + 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) { - 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; + // noop + } + // default: loading music + else + { + LoadingMusic= "Loading Music Loop.ogg"; } // start to play @@ -3206,9 +3206,11 @@ 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); @@ -3220,7 +3222,7 @@ void impulseOutpostChooseSide(NLMISC::CBitMemStream &impulse) impulse.serial( declTimer ); // start - OutpostManager.startPvpJoinProposal(outpostInFire, playerGuildInConflict, playerGuildIsAttacker, + OutpostManager.startPvpJoinProposal((OUTPOSTENUMS::TPVPType)type, outpostInFire, playerGuildInConflict, playerGuildIsAttacker, ownerGuildNameId, attackerGuildNameId, declTimer); } diff --git a/ryzom/client/src/user_entity.cpp b/ryzom/client/src/user_entity.cpp index 312fffca8..0ddd61c41 100644 --- a/ryzom/client/src/user_entity.cpp +++ b/ryzom/client/src/user_entity.cpp @@ -2674,17 +2674,6 @@ 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 */ @@ -4313,19 +4302,20 @@ 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() != ClientCfg.DeathMusic) + if( isDead && SoundMngr->getEventMusicPlayed()!=deadMusic ) { - SoundMngr->playEventMusic(ClientCfg.DeathMusic, 0, true); + SoundMngr->playEventMusic(deadMusic, 0, true); } // must end music? - if (!isDead && SoundMngr->getEventMusicPlayed() == ClientCfg.DeathMusic) + if( !isDead && SoundMngr->getEventMusicPlayed()==deadMusic ) { - SoundMngr->stopEventMusic(ClientCfg.DeathMusic, CSoundManager::LoadingMusicXFade); + SoundMngr->stopEventMusic(deadMusic, CSoundManager::LoadingMusicXFade); } } }