Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
Nimetu 6 years ago
commit c43ffc5a85

@ -201,9 +201,9 @@ void connectionRestoreVideoMode ()
mode.Height = height; mode.Height = height;
} }
// don't allow sizes smaller than 800x600 // don't allow sizes smaller than 1024x768
if (ClientCfg.Width < 800) ClientCfg.Width = 800; if (ClientCfg.Width < 1024) ClientCfg.Width = 1024;
if (ClientCfg.Height < 600) ClientCfg.Height = 600; if (ClientCfg.Height < 768) ClientCfg.Height = 768;
if (StereoDisplay) if (StereoDisplay)
StereoDisplayAttached = StereoDisplay->attachToDisplay(); StereoDisplayAttached = StereoDisplay->attachToDisplay();
@ -253,41 +253,13 @@ REGISTER_ACTION_HANDLER (CAHOnReloadTestPage, "on_reload_test_page");
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void setOutGameFullScreen() void setOutGameFullScreen()
{ {
// Setup full screen (special 1024x768 for outgame) if we have to.
// NB: don't setup fullscreen if player wants to play in window
if (!ClientCfg.Local && ClientCfg.SelectCharacter == -1) if (!ClientCfg.Local && ClientCfg.SelectCharacter == -1)
{ {
if (StereoDisplayAttached) if (StereoDisplayAttached)
StereoDisplay->detachFromDisplay(); StereoDisplay->detachFromDisplay();
StereoDisplayAttached = false; StereoDisplayAttached = false;
UDriver::CMode currMode;
Driver->getCurrentScreenMode(currMode);
UDriver::CMode wantedMode;
wantedMode.Windowed = true;
wantedMode.Width = 1024;
wantedMode.Height = 768;
wantedMode.Depth = uint8(ClientCfg.Depth);
wantedMode.Frequency = ClientCfg.Frequency;
// change mode only if necessary
if ((wantedMode.Windowed != currMode.Windowed) ||
(wantedMode.Width != currMode.Width) ||
(wantedMode.Height != currMode.Height))
{
setVideoMode(wantedMode);
}
InitMouseWithCursor(ClientCfg.HardwareCursor && !StereoDisplayAttached); InitMouseWithCursor(ClientCfg.HardwareCursor && !StereoDisplayAttached);
/*
InitMouseWithCursor (true);
Driver->showCursor(false);
Driver->showCursor(true);
Driver->clearBuffers(CRGBA::Black);
Driver->swapBuffers();
Driver->showCursor(false);
Driver->showCursor(true);
*/
} }
} }
@ -307,8 +279,8 @@ bool connection (const string &cookie, const string &fsaddr)
game_exit = false; game_exit = false;
// Setup full screen (special 1024x768 for outgame) if we have to. // set resolution from cfg after login
setOutGameFullScreen(); connectionRestoreVideoMode ();
// Preload continents // Preload continents
{ {
@ -342,13 +314,14 @@ bool connection (const string &cookie, const string &fsaddr)
// init the string manager cache. // init the string manager cache.
STRING_MANAGER::CStringManagerClient::instance()->initCache("", ClientCfg.LanguageCode); // VOIR BORIS STRING_MANAGER::CStringManagerClient::instance()->initCache("", ClientCfg.LanguageCode); // VOIR BORIS
#endif #endif
connectionRestoreVideoMode ();
return true; return true;
} }
ProgressBar.setFontFactor(1.0f); ProgressBar.setFontFactor(1.0f);
// Init out game // Init out game
setOutGameFullScreen();
ucstring nmsg("Initializing outgame..."); ucstring nmsg("Initializing outgame...");
ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) ); ProgressBar.newMessage (ClientCfg.buildLoadingString(nmsg) );
pIM->initOutGame(); pIM->initOutGame();
@ -484,7 +457,6 @@ bool reconnection()
game_exit = false; game_exit = false;
// Setup full screen (special 1024x768 for outgame) if we have to.
setOutGameFullScreen(); setOutGameFullScreen();
// Preload continents // Preload continents
@ -1269,6 +1241,16 @@ TInterfaceState globalMenu()
// Restore video mode // Restore video mode
if (ClientCfg.SelectCharacter == -1) if (ClientCfg.SelectCharacter == -1)
{ {
if (ClientCfg.Windowed)
{
// if used changed window resolution in char select
// if we don't update ClientCfg, then UI from icfg is restored wrong
uint32 width, height;
Driver->getWindowSize(width, height);
ClientCfg.Width = width;
ClientCfg.Height = height;
}
connectionRestoreVideoMode (); connectionRestoreVideoMode ();
} }

@ -2779,18 +2779,8 @@ CCtrlButton *CGroupMap::addUserLandMark(const NLMISC::CVector2f &pos, const ucst
addLandMark(_UserLM, pos, title, getUserLandMarkOptions((uint32)_CurContinent->UserLandMarks.size() - 1)); addLandMark(_UserLM, pos, title, getUserLandMarkOptions((uint32)_CurContinent->UserLandMarks.size() - 1));
// Save the config file each time a user landmark is created // Save the config file each time a user landmark is created
CInterfaceManager *pIM = CInterfaceManager::getInstance(); CInterfaceManager::getInstance()->saveConfig();
uint8 currMode = pIM->getMode();
std::string filename = "save/interface_" + PlayerSelectedFileName + ".icfg";
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg"))
{
filename = "save/shared_interface.icfg";
}
pIM->saveConfig (filename);
if (currMode != pIM->getMode())
{
pIM->setMode(currMode);
}
return _UserLM.back(); return _UserLM.back();
} }

@ -1270,32 +1270,19 @@ void CInterfaceManager::loadInterfaceConfig()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void CInterfaceManager::uninitInGame0 () void CInterfaceManager::uninitInGame0 ()
{ {
// Autosave of the keys // Autosave of the keys
if (_KeysLoaded) if (_KeysLoaded)
{ {
if (!ClientCfg.R2EDEnabled) saveKeys();
{
string filename = "save/keys_" + PlayerSelectedFileName + ".xml";
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_keys.xml"))
filename = "save/shared_keys.xml";
saveKeys(filename);
}
_KeysLoaded = false; _KeysLoaded = false;
} }
// Autosave of the interface in interface.cfg // Autosave of the interface in interface.cfg
if (_ConfigLoaded) if (_ConfigLoaded)
{ {
if (!ClientCfg.R2EDEnabled) saveConfig();
{
string filename = "save/interface_" + PlayerSelectedFileName + ".icfg";
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg"))
filename = "save/shared_interface.icfg";
saveConfig(filename);
}
_ConfigLoaded = false; _ConfigLoaded = false;
} }
} }
@ -1884,6 +1871,29 @@ public:
} }
}; };
// ------------------------------------------------------------------------------------------------
//
bool CInterfaceManager::saveConfig (bool verbose)
{
bool ret = true;
if (!ClientCfg.R2EDEnabled)
{
uint8 currMode = getMode();
string filename = "save/interface_" + PlayerSelectedFileName + ".icfg";
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_interface.icfg"))
filename = "save/shared_interface.icfg";
if (verbose) CInterfaceManager::getInstance()->displaySystemInfo("Saving " + filename);
ret = saveConfig(filename);
if (currMode != getMode())
setMode(currMode);
}
return ret;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool CInterfaceManager::saveConfig (const string &filename) bool CInterfaceManager::saveConfig (const string &filename)
@ -2723,7 +2733,25 @@ void writeMacros (xmlNodePtr node)
} }
// *************************************************************************** // ***************************************************************************
bool CInterfaceManager::saveKeys(bool verbose)
{
bool ret = true;
if (!ClientCfg.R2EDEnabled)
{
string filename = "save/keys_" + PlayerSelectedFileName + ".xml";
if (!CFile::fileExists(filename) && CFile::fileExists("save/shared_keys.xml"))
filename = "save/shared_keys.xml";
if (verbose) CInterfaceManager::getInstance()->displaySystemInfo("Saving " + filename);
ret = saveKeys(filename);
}
return ret;
}
// ***************************************************************************
bool CInterfaceManager::saveKeys(const std::string &filename) bool CInterfaceManager::saveKeys(const std::string &filename)
{ {
bool ret = false; bool ret = false;
@ -2925,6 +2953,18 @@ void CInterfaceManager::displayWebWindow(const string & name, const string & url
CAHManager::getInstance()->runActionHandler("browse", NULL, "name="+name+":content:html|url="+url); CAHManager::getInstance()->runActionHandler("browse", NULL, "name="+name+":content:html|url="+url);
} }
// ***************************************************************************
class CAHSaveUI : public IActionHandler
{
virtual void execute (CCtrlBase *pCaller, const string &Params)
{
CInterfaceManager::getInstance()->saveKeys(true);
CInterfaceManager::getInstance()->saveConfig(true);
}
};
REGISTER_ACTION_HANDLER (CAHSaveUI, "save_ui");
/* /*
// *************************************************************************** // ***************************************************************************
class CHandlerDispWebOnQuit : public IActionHandler class CHandlerDispWebOnQuit : public IActionHandler

@ -205,10 +205,14 @@ public:
// Load/Save position, size, etc.. of windows // Load/Save position, size, etc.. of windows
bool loadConfig (const std::string &filename); bool loadConfig (const std::string &filename);
// Save config to default location, if verbose is true, display message in game sysinfo
bool saveConfig (bool verbose = false);
bool saveConfig (const std::string &filename); bool saveConfig (const std::string &filename);
// delete the user config (give the player ident fileName) // delete the user config (give the player ident fileName)
bool deletePlayerConfig (const std::string &playerFileIdent); bool deletePlayerConfig (const std::string &playerFileIdent);
// Save keys to default location, if verbose is true, display message in game sysinfo
bool saveKeys (bool verbose = false);
// Save the keys config file // Save the keys config file
bool saveKeys (const std::string &filename); bool saveKeys (const std::string &filename);
// delete the user Keysconfig (give the player ident fileName) // delete the user Keysconfig (give the player ident fileName)

@ -1404,13 +1404,12 @@ bool getRyzomModes(std::vector<NL3D::UDriver::CMode> &videoModes, std::vector<st
// **** Init Video Modes // **** Init Video Modes
Driver->getModes(videoModes); Driver->getModes(videoModes);
// Remove modes under 800x600 and get the unique strings // Remove modes under 1024x768 (outgame ui limitation) and get the unique strings
sint i, j; sint i, j;
for (i = 0; i < (sint)videoModes.size(); ++i) for (i = 0; i < (sint)videoModes.size(); ++i)
{ {
if ((videoModes[i].Width < 800) || (videoModes[i].Height < 600)) if ((videoModes[i].Width < 1024) || (videoModes[i].Height < 768))
{ {
// discard modes under 800x600
videoModes.erase(videoModes.begin()+i); videoModes.erase(videoModes.begin()+i);
--i; --i;
} }

Loading…
Cancel
Save