Merge some things from atys branch

develop
kaetemi 4 years ago
parent eac2aed175
commit 7249546db6

@ -60,7 +60,7 @@ SET(YEAR "2001-${CURRENT_YEAR}")
SET(AUTHOR "Winch Gate and The Ryzom Core Community")
SET(RYZOM_VERSION_MAJOR 3)
SET(RYZOM_VERSION_MINOR 5)
SET(RYZOM_VERSION_MINOR 6)
SET(RYZOM_VERSION_PATCH 0)
#-----------------------------------------------------------------------------
@ -175,6 +175,20 @@ IF(WITH_STATIC)
IF(LIBLZMA_LIBRARIES)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${LIBLZMA_LIBRARIES})
ENDIF()
# under Linux and OS X, recent libxml2 versions are linked against libicu
# FIND_PACKAGE(Icu)
FIND_LIBRARY(ICU_LIBRARY icuuc)
IF(ICU_LIBRARY)
FIND_LIBRARY(ICU_DATA_LIBRARY icudata)
IF(ICU_LIBRARY)
MESSAGE(STATUS "ICU UC was found: ${ICU_LIBRARY}")
ELSE()
MESSAGE(STATUS "ICU UC was NOT found")
ENDIF()
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_DATA_LIBRARY} ${ICU_LIBRARY})
ENDIF()
ENDIF()
ENDIF()

@ -177,6 +177,7 @@ namespace NLGUI
bool _MouseDown : 1;
bool _CallingAH : 1;
bool _Cancelable : 1; // true if the slider may be cancelled when pressed on the mouse right button
bool _Keyboard : 1;
bool _Frozen : 1;
bool _Scale : 1;

@ -57,6 +57,7 @@ namespace NLGUI
_MouseDown = false;
_CallingAH = false;
_Cancelable = false;
_Keyboard = false;
_Target = NULL;
_Inverted = false;
_IsDBLink = false;
@ -225,6 +226,11 @@ namespace NLGUI
return toString( _Cancelable );
}
else
if( name == "keyboard" )
{
return toString( _Keyboard );
}
else
if( name == "frozen" )
{
return toString( _Frozen );
@ -405,6 +411,14 @@ namespace NLGUI
return;
}
else
if( name == "keyboard" )
{
bool b;
if( fromString( value, b ) )
_Keyboard = b;
return;
}
else
if( name == "frozen" )
{
bool b;
@ -474,6 +488,7 @@ namespace NLGUI
xmlSetProp( node, BAD_CAST "target_stepy", BAD_CAST toString( _TargetStepY ).c_str() );
xmlSetProp( node, BAD_CAST "step_value", BAD_CAST toString( _StepValue ).c_str() );
xmlSetProp( node, BAD_CAST "cancelable", BAD_CAST toString( _Cancelable ).c_str() );
xmlSetProp( node, BAD_CAST "keyboard", BAD_CAST toString( _Keyboard ).c_str() );
xmlSetProp( node, BAD_CAST "frozen", BAD_CAST toString( _Frozen ).c_str() );
return node;
@ -589,6 +604,9 @@ namespace NLGUI
prop = (char*) xmlGetProp( node, (xmlChar*)"cancelable" );
if (prop) _Cancelable = convertBool(prop);
prop = (char*) xmlGetProp( node, (xmlChar*)"keyboard" );
if (prop) _Keyboard = convertBool(prop);
prop= (char*) xmlGetProp (node, (xmlChar*)"frozen");
_Frozen = false;
if (prop)
@ -912,6 +930,30 @@ namespace NLGUI
return true;
}
}
else if (event.getType() == NLGUI::CEventDescriptor::key)
{
const NLGUI::CEventDescriptorKey &eventDesc = (const NLGUI::CEventDescriptorKey &)event;
if (eventDesc.getKeyEventType() == NLGUI::CEventDescriptorKey::keydown)
{
if (_Keyboard)
{
sint32 i = 0;
// direction
if (eventDesc.getKey() == KeyNEXT) i++;
else if (eventDesc.getKey() == KeyPRIOR) i--;
else
return false;
if (_Vertical)
moveTrackY(-(i * _TargetStepY));
else
moveTrackX(-(i * _TargetStepX));
return true;
}
}
}
return false;
}

@ -2297,7 +2297,7 @@ namespace NLGUI
// Hide menu if the key is pushed
// if ((eventDesc.getKeyEventType() == CEventDescriptorKey::keydown) && !_ModalStack.empty() && !eventDesc.getKeyAlt() && !eventDesc.getKeyCtrl() && !eventDesc.getKeyShift())
// Hide menu (or popup menu) is ESCAPE pressed
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE )
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE )
{
if( hasModal() )
{
@ -2308,7 +2308,7 @@ namespace NLGUI
}
// Manage "quit window" If the Key is ESCAPE, no captureKeyboard
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyESCAPE )
if( eventDesc.getKeyEventType() == CEventDescriptorKey::keydown && eventDesc.getKey() == NLMISC::KeyESCAPE )
{
// Get the last escapable active top window. NB: this is ergonomically better.
CInterfaceGroup *win= getLastEscapableTopWindow();

@ -326,17 +326,8 @@ CClientConfig::CClientConfig()
Local = false; // Default is Net Mode.
FSHost = ""; // Default Host.
#if 1 // Yubo hack
// The order is important here, because in a layer, global texture are rendered through this order
TexturesInterface.push_back("texture_interfaces_v3");
// DXTC contain all items and bricks bitmaps, they must come after standard texture
TexturesInterface.push_back("new_texture_interfaces_dxtc");
// Added icons by Yubo's Team 2009
TexturesInterface.push_back("texture_extra");
#else
TexturesInterface.push_back("texture_interfaces_v3");
TexturesInterfaceDXTC.push_back("texture_interfaces_dxtc");
#endif
TexturesOutGameInterface.push_back("texture_interfaces_v3_outgame_ui");

@ -157,9 +157,11 @@ std::string RingEditorKeySet = "keys_r2ed.xml";
string ScenarioFileName;
sint LoginCharsel = -1;
static const char *KeySetVarName = "BuiltInKeySets";
std::string ImportCharacter;
static const char *KeySetVarName = "BuiltInKeySets";
#define GROUP_LIST_CHARACTER "ui:outgame:charsel_import:import_list"
#define GROUP_LIST_MAINLAND "ui:outgame:appear_mainland:mainland_list"
#define GROUP_LIST_KEYSET "ui:outgame:appear_keyset:keyset_list"
vector<CMainlandSummary> Mainlands;
@ -2138,7 +2140,7 @@ public:
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
//CInterfaceManager *pIM = CInterfaceManager::getInstance();
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
if (pList == NULL)
@ -2217,7 +2219,7 @@ public:
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
//CInterfaceManager *pIM = CInterfaceManager::getInstance();
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_MAINLAND));
pList->clearGroups();
}
@ -2458,7 +2460,7 @@ public:
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
CInterfaceManager *pIM = CInterfaceManager::getInstance();
//CInterfaceManager *pIM = CInterfaceManager::getInstance();
CInterfaceGroup *pList = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_KEYSET));
pList->clearGroups();
}
@ -3435,3 +3437,239 @@ class CAHOpenRingSessions : public IActionHandler
}
};
REGISTER_ACTION_HANDLER (CAHOpenRingSessions, "open_ring_sessions");
// ***************************************************************************
class CAHInitImportCharacter : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
CInterfaceGroup *list = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER));
if (!list)
{
nlwarning("element " GROUP_LIST_CHARACTER " not found probably bad outgame.xml");
return;
}
// retrieve saved files
std::vector<string> savedCharacters;
CPath::getPathContent("save/", false, false, true, savedCharacters);
CInterfaceGroup *newLine;
CInterfaceGroup *prevLine;
for (uint i = 0; i < savedCharacters.size(); ++i)
{
// search saved characters only
if (testWildCard(CFile::getFilename(savedCharacters[i]), "character_*.save"))
{
const std::string id = CFile::getFilenameWithoutExtension(savedCharacters[i]).substr(strlen("character_"));
if (id.empty())
continue;
std::vector<pair<string, string>> params;
params.clear();
params.push_back(std::pair<string, string>("id", id));
// adjust ref
if (list->getNumGroup() > 0)
params.push_back(std::pair<string, string>("posref", "BL TL"));
newLine = CWidgetManager::getInstance()->getParser()->createGroupInstance("t_import", GROUP_LIST_CHARACTER, params);
if (newLine)
{
CViewText *text = dynamic_cast<CViewText*>(newLine->getView("name"));
if (text)
text->setText(ucstring(savedCharacters[i]));
// first button is pushed
CCtrlButton *button = dynamic_cast<CCtrlButton*>(newLine->getCtrl("but"));
if (button && list->getNumGroup() == 0)
button->setPushed(true);
// add to the list now
newLine->setParent(list);
newLine->setParentSize(list);
newLine->setParentPos(prevLine);
list->addGroup(newLine);
prevLine = newLine;
}
}
}
// none case
if (list->getNumGroup() == 0)
CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(3)");
list->invalidateCoords();
}
};
REGISTER_ACTION_HANDLER( CAHInitImportCharacter, "import_char_init" );
// ***************************************************************************
class CAHResetImportCharacter : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
CInterfaceGroup *list = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER));
if (list)
list->clearGroups();
if (!ImportCharacter.empty())
ImportCharacter = "";
}
};
REGISTER_ACTION_HANDLER( CAHResetImportCharacter, "import_char_reset" );
// ***************************************************************************
class CAHSelectImportCharacter : public IActionHandler
{
virtual void execute (CCtrlBase *pCaller, const std::string &Params)
{
struct CUnpush : public CInterfaceElementVisitor
{
CCtrlBase *Ref;
virtual void visitCtrl(CCtrlBase *ctrl)
{
if (ctrl == Ref) return;
CCtrlBaseButton *but = dynamic_cast<CCtrlBaseButton*>(ctrl);
if (but)
{
but->setPushed(false);
}
}
};
CInterfaceGroup *list = dynamic_cast<CInterfaceGroup*>(CWidgetManager::getInstance()->getElementFromId(GROUP_LIST_CHARACTER));
if (!list)
return;
// unselect
if (Params.empty())
{
CUnpush unpusher;
unpusher.Ref = pCaller;
list->visit(&unpusher);
}
// now select
std::string name;
if (Params.empty())
{
CCtrlButton *pCB = dynamic_cast<CCtrlButton*>(pCaller);
if (!pCB)
return;
std::string id = pCB->getId();
id = id.substr(0, id.rfind(':'));
if (!fromString(id.substr(id.rfind(':')+1, id.size()), name))
return;
pCB->setPushed(true);
}
else
if (!fromString(Params, name))
return;
ImportCharacter = "";
// check filename and store
if (CFile::fileExists(toString("save/character_%s.save", name.c_str())))
ImportCharacter = name;
}
};
REGISTER_ACTION_HANDLER( CAHSelectImportCharacter, "import_char_select" );
// ***************************************************************************
class CAHImportCharacter : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
{
if (ImportCharacter.empty())
return;
if (!CFile::fileExists(toString("save/character_%s.save", ImportCharacter.c_str())))
return;
bool success = false;
CIFile fd;
CCharacterSummary CS;
// use temporary file until close()
if (fd.open(toString("save/character_%s.save", ImportCharacter.c_str())))
{
try
{
CS.serial(fd);
SCharacter3DSetup::setupDBFromCharacterSummary("UI:TEMP:CHAR3D", CS);
// validate import
CDBManager::getInstance()->getDbProp("UI:TEMP:IMPORT")->setValue32(1);
success = true;
}
catch (const EStream &e)
{
nlwarning(e.what());
}
fd.close();
}
else
nlwarning("Failed to open file: save/character_%s.save", ImportCharacter.c_str());
// user notification
if (!success)
CLuaManager::getInstance().executeLuaScript("outgame:procCharselNotifaction(2)");
else
CAHManager::getInstance()->runActionHandler("proc", NULL, "proc_charsel_create_new");
}
};
REGISTER_ACTION_HANDLER( CAHImportCharacter, "import_char" );
// ***************************************************************************
class CAHExportCharacter : public IActionHandler
{
virtual void execute (CCtrlBase * /* pCaller */, const std::string &Params)
{
if (Params.empty())
return;
sint32 slot = -1;
if (!fromString(getParam(Params, "slot"), slot))
return;
if (slot >= CharacterSummaries.size() || slot < 0)
return;
// retrieve infos
CCharacterSummary &CS = CharacterSummaries[slot];
if (CS.Name.empty())
return;
// extract name
const std::string name = buildPlayerNameForSaveFile(CS.Name.toString());
COFile fd;
bool success = false;
// use temporary file until close()
if (fd.open(toString("save/character_%s.save", name.c_str()), false, false, true))
{
try
{
fd.serial(CS);
fd.flush();
// validate
success = true;
}
catch (const EStream &e)
{
nlwarning(e.what());
}
fd.close();
}
else
nlwarning("Failed to open file: save/character_%s.save", name.c_str());
const uint8 val = (success == true) ? 0 : 1;
// user notification
CLuaManager::getInstance().executeLuaScript(toString("outgame:procCharselNotifaction(%i)", val));
}
};
REGISTER_ACTION_HANDLER( CAHExportCharacter, "export_char" );

@ -172,16 +172,12 @@ void CEventsListener::operator()(const CEvent& event)
// Get in pixel space, centered
uint32 drW, drH;
Driver->getWindowSize(drW, drH);
float fX = mouseEvent->X; // from 0 to 1.0
float fY = (ClientCfg.FreeLookInverted ? -mouseEvent->Y : mouseEvent->Y);
sint scX = (sint32)(fX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered
sint scY = (sint32)(fY * (float)drH) - ((sint32)drH >> 1);
sint scX = (sint32)(mouseEvent->X * (float)drW) - ((sint32)drW >> 1); // in pixels, centered
sint scY = (sint32)(mouseEvent->Y * (float)drH) - ((sint32)drH >> 1);
if (!s_MouseFreeLookReady)
{
float pfX = _MouseX;
float pfY = (ClientCfg.FreeLookInverted ? -_MouseY : _MouseY);
sint pscX = (sint32)(pfX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered
sint pscY = (sint32)(pfY * (float)drH) - ((sint32)drH >> 1);
sint pscX = (sint32)(_MouseX * (float)drW) - ((sint32)drW >> 1); // in pixels, centered
sint pscY = (sint32)(_MouseY * (float)drH) - ((sint32)drH >> 1);
s_MouseFreeLookReady = true;
s_MouseFreeLookLastX = pscX;
s_MouseFreeLookLastY = pscY;
@ -199,13 +195,12 @@ void CEventsListener::operator()(const CEvent& event)
}
// Get delta since last center
sint scXd = scX - s_MouseFreeLookLastX;
sint scYd = scY - s_MouseFreeLookLastY;
s_MouseFreeLookFrameX += (scX - s_MouseFreeLookLastX);
s_MouseFreeLookFrameY += (scY - s_MouseFreeLookLastY) * (ClientCfg.FreeLookInverted ? -1 : 1);
s_MouseFreeLookLastX = scX;
s_MouseFreeLookLastY = scY;
s_MouseFreeLookFrameX += scXd;
s_MouseFreeLookFrameY += scYd;
// updateFreeLookPos is called in updateMouseSmoothing per frame
// Center cursor

Loading…
Cancel
Save