Merge Atys

ryzom/ui/improvements
Sit Melai 4 years ago
commit 7e10c697eb

@ -177,9 +177,16 @@ IF(WITH_STATIC)
ENDIF()
# under Linux and OS X, recent libxml2 versions are linked against libicu
FIND_PACKAGE(Icu)
IF(ICU_LIBRARIES)
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARIES} ${ICU_LIBRARIES} ${ICU_DATA_LIBRARIES})
# 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()

@ -1275,7 +1275,7 @@ static bool setupNVFragmentProgram2(const char *glext)
{
H_AUTO_OGL(setupNVFragmentProgram2);
CHECK_EXT("GL_NV_fragment_program2");
return true;
}
@ -1284,7 +1284,7 @@ static bool setupARBFragmentShader(const char *glext)
{
H_AUTO_OGL(setupNVFragmentProgram2);
CHECK_EXT("GL_ARB_fragment_shader");
return true;
}
@ -1584,6 +1584,14 @@ void registerGlExtensions(CGlExtensions &ext)
{
H_AUTO_OGL(registerGlExtensions);
#ifdef NL_OS_MAC
CGLContextObj ctx = CGLGetCurrentContext();
if (ctx == NULL)
{
nlerror("No OpenGL context set");
}
#endif
// OpenGL 1.2 ??
const char *nglVersion = (const char *)glGetString (GL_VERSION);
@ -1691,12 +1699,12 @@ void registerGlExtensions(CGlExtensions &ext)
ext.EXTVertexShader = false;
ext.ARBVertexProgram = false;
}
// Check pixel program
// Disable feature ???
if (!ext.DisableHardwarePixelProgram)
{
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext);
ext.ARBFragmentShader = setupARBFragmentShader(glext);
}

@ -1072,6 +1072,9 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
[_ctx flushBuffer];
[_glView display];
// Set context as thread context
CGLSetCurrentContext((CGLContextObj)[_ctx CGLContextObj]);
_EventEmitter.init(this, _glView, _DestroyWindow);
#elif defined(NL_OS_UNIX)

@ -8,7 +8,7 @@ IF(WITH_RYZOM_CLIENT)
ADD_SUBDIRECTORY(unix)
ENDIF()
INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX})
#INSTALL(FILES client_default.cfg DESTINATION ${RYZOM_ETC_PREFIX})
IF(WITH_RYZOM_PATCH)
IF(APPLE)

@ -82,7 +82,7 @@ IF(WITH_RYZOM_CLIENT)
ADD_CUSTOM_COMMAND(TARGET ryzom_client PRE_BUILD COMMAND mkdir -p ${RYZOM_RESOURCES_DIR})
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/PkgInfo ${RYZOM_CONTENTS_DIR})
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${MAC_RESOURCES_DIR}/ryzom.icns ${RYZOM_RESOURCES_DIR})
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR})
#ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND cp ARGS -p ${CMAKE_SOURCE_DIR}/ryzom/client/client_default.cfg ${RYZOM_RESOURCES_DIR})
# remove any present installscript_osx.vdf before signing
ADD_CUSTOM_COMMAND(TARGET ryzom_client POST_BUILD COMMAND rm -f ${RYZOM_OUTPUT_DIR}/installscript_osx.vdf)

@ -451,18 +451,19 @@ void CGameContextMenu::update()
else if (continent == "lepaysmalade.continent")
fameIndex = CStaticFames::getInstance().getFactionIndex("zorai");
if (fameIndex != CStaticFames::INVALID_FACTION_INDEX)
{
CCDBNodeLeaf *pLeafFame = NLGUI::CDBManager::getInstance()->getDbProp(toString("SERVER:FAME:PLAYER%d:VALUE", fameIndex), false);
if (pLeafFame != NULL)
fameValue = pLeafFame->getValue8();
}
if (_TextNews)
_TextNews->setActive(selection && !canAttack() && selection->isNPC() && fameValue >= -30);
_TextNews->setActive(!UserEntity->isFighting() && !UserEntity->isRiding() && selection && !canAttack() && selection->isNPC() && fameValue >= -30);
if (_TextNewsAgressive)
_TextNewsAgressive->setActive(selection && !canAttack() && selection->isNPC() && fameValue < -30);
_TextNewsAgressive->setActive(!UserEntity->isFighting() && !UserEntity->isRiding() && selection && !canAttack() && selection->isNPC() && fameValue < -30);
if (_TextDuel && _TextUnDuel)

@ -422,6 +422,29 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
return para;
}
ucstring::size_type pos = 0;
// Manage Translations
string::size_type startTr = msg.find(ucstring("{:"));
string::size_type endOfOriginal = msg.find(ucstring("}@{"));
// Original/Translated case, example: {:enHello the world!}@{ Bonjour le monde !
if (startTr != string::npos && endOfOriginal != string::npos)
{
CViewBase *vt = createMsgTextSimple(msg.substr(0, startTr), col, justified, NULL);
para->addChild(vt);
string texture = "flag-"+toLower(msg.substr(startTr+2, 2)).toString()+".tga";
ucstring original = msg.substr(startTr+5, endOfOriginal-startTr-5);
pos = endOfOriginal+3;
CCtrlButton *ctrlButton = new CCtrlButton(CViewBase::TCtorParam());
ctrlButton->setTexture(texture);
ctrlButton->setTextureOver(texture);
ctrlButton->setTexturePushed(texture);
ctrlButton->setDefaultContextHelp(original);
ctrlButton->setId("tr");
para->addChild(ctrlButton);
}
// quickly check if text has links or not
bool hasUrl;
@ -430,8 +453,7 @@ CViewBase *CChatTextManager::createMsgTextComplex(const ucstring &msg, NLMISC::C
hasUrl = (s.find(ucstring("http://")) || s.find(ucstring("https://")));
}
ucstring::size_type pos = 0;
for (ucstring::size_type i = 0; i< textSize;)
for (ucstring::size_type i = pos; i< textSize;)
{
if (hasUrl && isUrlTag(msg, i, textSize))
{

@ -215,29 +215,34 @@ void CChatWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CChatGr
CChatTextManager &ctm = getChatTextMngr();
gl = dynamic_cast<CGroupList *>(_Chat->getGroup("cb:text_list"));
if (gl) gl->addChild(ctm.createMsgText(msg, col));
// if the group is closed, make it blink
if (!_Chat->isOpen())
CViewBase *child = ctm.createMsgText(msg, col);
if (child)
{
if (numBlinks) _Chat->enableBlink(numBlinks);
}
if (_ParentBlink)
{
CGroupContainer *father = dynamic_cast<CGroupContainer *>(_Chat->getParent());
if (father && !father->isOpen())
if (gl) gl->addChild(child);
// if the group is closed, make it blink
if (!_Chat->isOpen())
{
father->enableBlink(numBlinks);
if (numBlinks) _Chat->enableBlink(numBlinks);
}
if (_ParentBlink)
{
CGroupContainer *father = dynamic_cast<CGroupContainer *>(_Chat->getParent());
if (father && !father->isOpen())
{
father->enableBlink(numBlinks);
}
}
if (windowVisible != NULL)
{
*windowVisible = isVisible();
}
/*for(std::vector<IObserver *>::iterator it = _Observers.begin(); it != _Observers.end(); ++it)
{
(*it)->displayMessage(this, msg, col, numBlinks);
}*/
}
if (windowVisible != NULL)
{
*windowVisible = isVisible();
}
/*for(std::vector<IObserver *>::iterator it = _Observers.begin(); it != _Observers.end(); ++it)
{
(*it)->displayMessage(this, msg, col, numBlinks);
}*/
}
//=================================================================================
@ -563,12 +568,17 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
ucstring newmsg = msg;
ucstring prefix;
CViewBase *child = NULL;
if (gl != NULL)
{
gl->addChild(ctm.createMsgText(newmsg, col));
if (!gl->getParent()->getActive())
if (tab != NULL)
tab->setTextColorNormal(newMsgColor);
child = ctm.createMsgText(newmsg, col);
if (child)
{
gl->addChild(child);
if (!gl->getParent()->getActive())
if (tab != NULL)
tab->setTextColorNormal(newMsgColor);
}
}
// *** Display the message in the UserChat (special case)
@ -590,7 +600,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
case CChatGroup::guild: if (ci.Guild.isListeningWindow(cw)) gl = gl2; break;
case CChatGroup::system: if (ci.SystemInfo.isListeningWindow(cw)) gl = gl2; break;
case CChatGroup::universe: if (ci.Universe.isListeningWindow(cw)) gl = gl2; break;
case CChatGroup::dyn_chat:
case CChatGroup::dyn_chat:
if (ci.DynamicChat[dynamicChatDbIndex].isListeningWindow(cw))
{
gl = gl2;
@ -608,7 +618,7 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
pos = newmsg.find(ucstring("}"));
prefix += " ";
}
if (pos == ucstring::npos)
newmsg = prefix + newmsg;
else
@ -635,31 +645,37 @@ void CChatGroupWindow::displayMessage(const ucstring &msg, NLMISC::CRGBA col, CC
if (gl != NULL)
{
gl->addChild(ctm.createMsgText(newmsg, col));
if (!gl->getParent()->getActive())
if (tab != NULL)
tab->setTextColorNormal(newMsgColor);
child = ctm.createMsgText(newmsg, col);
if (child)
{
gl->addChild(child);
if (!gl->getParent()->getActive())
if (tab != NULL)
tab->setTextColorNormal(newMsgColor);
}
}
}
// *** Blink and visibility event
// if the group is closed, make it blink
if (!_Chat->isOpen())
{
if (numBlinks) _Chat->enableBlink(numBlinks);
}
if (_ParentBlink)
if (child)
{
CGroupContainer *father = dynamic_cast<CGroupContainer *>(_Chat->getParent());
if (father && !father->isOpen())
// *** Blink and visibility event
// if the group is closed, make it blink
if (!_Chat->isOpen())
{
father->enableBlink(numBlinks);
if (numBlinks) _Chat->enableBlink(numBlinks);
}
if (_ParentBlink)
{
CGroupContainer *father = dynamic_cast<CGroupContainer *>(_Chat->getParent());
if (father && !father->isOpen())
{
father->enableBlink(numBlinks);
}
}
if (windowVisible != NULL)
{
*windowVisible = isVisible();
}
}
if (windowVisible != NULL)
{
*windowVisible = isVisible();
}
}
@ -685,8 +701,9 @@ void CChatGroupWindow::displayTellMessage(const ucstring &msg, NLMISC::CRGBA col
nlwarning("<CChatGroupWindow::displayTellMessage> can't get text_list.");
return;
}
gl->addChild(getChatTextMngr().createMsgText(msg, col));
CViewBase *child = getChatTextMngr().createMsgText(msg, col);
if (child)
gl->addChild(child);
}
//=================================================================================

@ -843,6 +843,14 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText,
if (pChar == NULL || nUID==CLFECOMMON::INVALID_CLIENT_DATASET_INDEX) return;
if (bubbleTimer == 0) bubbleTimer = CWidgetManager::getInstance()->getSystemOption(CWidgetManager::OptionTimeoutBubbles).getValSInt32();
// Clean bubble from translation system
ucstring::size_type pos = 0;
string::size_type endOfOriginal = ucsText.find(ucstring("}@{"));
if (endOfOriginal != string::npos)
pos = endOfOriginal+4;
// Output the message in a bubble
bool show = false;
@ -862,7 +870,7 @@ void CGroupInSceneBubbleManager::chatOpen (uint32 nUID, const ucstring &ucsText,
return;
// Get a bubble
CGroupInSceneBubble *bubble = newBubble (ucsText);
CGroupInSceneBubble *bubble = newBubble (ucsText.substr(pos));
if (bubble)
{
// Link the bubble

@ -199,7 +199,7 @@ bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b)
{
ucstring name_a = toUpper(a.getName());
ucstring name_b = toUpper(b.getName());
return (name_a < name_b);
}
@ -208,7 +208,7 @@ bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b)
{
ucstring name_a = toUpper(a.getName());
ucstring name_b = toUpper(b.getName());
// We want order: online/alpha, offworld/alpha, offline/alpha
if (a.Online == b.Online)
{
@ -249,7 +249,7 @@ void CPeopleList::sortEx(TSortOrder order)
{
_BaseContainer->detachContainer(_Peoples[k].Container);
}
switch (order)
{
default:
@ -480,17 +480,21 @@ void CPeopleList::displayLocalPlayerTell(const ucstring &receiver, uint index, c
ucstring s = CI18N::get("youTellPlayer");
strFindReplace(s, "%name", receiver);
strFindReplace(finalMsg, CI18N::get("youTell"), s);
gl->addChild(getChatTextMngr().createMsgText(finalMsg, prop.getRGBA()));
CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell));
// if the group is closed, make it blink
if (!gc->isOpen())
CViewBase *child = getChatTextMngr().createMsgText(finalMsg, prop.getRGBA());
if (child)
{
if (numBlinks) gc->enableBlink(numBlinks);
}
if (_BaseContainer && !_BaseContainer->isOpen())
{
_BaseContainer->enableBlink(numBlinks);
gl->addChild(child);
CInterfaceManager::getInstance()->log(finalMsg, CChatGroup::groupTypeToString(CChatGroup::tell));
// if the group is closed, make it blink
if (!gc->isOpen())
{
if (numBlinks) gc->enableBlink(numBlinks);
}
if (_BaseContainer && !_BaseContainer->isOpen())
{
_BaseContainer->enableBlink(numBlinks);
}
}
}
@ -539,8 +543,9 @@ void CPeopleList::displayMessage(uint index, const ucstring &msg, NLMISC::CRGBA
nlwarning("<CPeopleList::displayMessage> can't get text_list.");
return;
}
gl->addChild(getChatTextMngr().createMsgText(msg, col));
CViewBase *child = getChatTextMngr().createMsgText(msg, col);
if (child)
gl->addChild(child);
}
@ -777,7 +782,7 @@ void CPeopleList::setOnline(uint index, TCharConnectionState online)
CCtrlBase *chatButton = hc->getCtrl("chat_button");
if (chatButton != NULL)
chatButton->setActive(online != ccs_offline);
CCtrlBase *inviteButton = hc->getCtrl("invite_button");
if (inviteButton != NULL)
inviteButton->setActive(online != ccs_offline);

@ -245,7 +245,7 @@ void CPatchManager::init(const std::vector<std::string>& patchURIs, const std::s
#endif
// App name matches Domain on the SQL server
std::string appName = cf->getVarPtr("Application")
std::string appName = cf->getVarPtr("Application")
? cf->getVar("Application").asString(0)
: "default";
@ -1354,7 +1354,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const
{
//nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative: %i: %s",UsedServer,PatchServers[UsedServer].DisplayedServerPath.c_str());
nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative :");
nlwarning("EXCEPTION CATCH: getServerFile() failed - try to find an alternative : %s", (serverPath+srcName).c_str());
nlwarning("%i", UsedServer);
if (UsedServer >= 0 && UsedServer < (int) PatchServers.size())
{
@ -2676,6 +2676,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
string OutFilename;
bool usePatchFile = true;
bool haveAllreadyTryiedDownloadingOfFile = false;
// compute the total size of patch to download
uint32 totalPatchSize = 0;
@ -2743,6 +2744,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
{
// can not load the 7zip file, use normal patching
usePatchFile = true;
haveAllreadyTryiedDownloadingOfFile = true;
break;
}
@ -2754,6 +2756,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
{
// fallback to standard patch method
usePatchFile = true;
haveAllreadyTryiedDownloadingOfFile = true;
break;
}
}
@ -2766,6 +2769,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
nlwarning("Failed to unpack lzma file %s", (pPM->ClientPatchPath+lzmaFile).c_str());
// fallback to standard patch method
usePatchFile = true;
haveAllreadyTryiedDownloadingOfFile = true;
break;
}
@ -2874,32 +2878,108 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
sTranslate = CI18N::get("uiApplyingDelta") + " " + CFile::getFilename(PatchName);
pPM->setState(true, sTranslate);
xDeltaPatch(PatchName, SourceNameXD, OutFilename);
bool deltaPatchResult = xDeltaPatch(PatchName, SourceNameXD, OutFilename);
if (rFTP.LocalFileExists)
pPM->deleteFile(SourceName);
pPM->deleteFile(PatchName);
if (j > 0)
if (!deltaPatchResult && !haveAllreadyTryiedDownloadingOfFile) // Patch failed, try to download and apply lzma
{
pPM->deleteFile(SourceNameXD, false, false); // File can exists if bad BNP loading
}
tmpSourceName = OutFilename;
PatchSizeProgress += rFTP.PatcheSizes[j];
currentPatchedSize += rFTP.PatcheSizes[j];
}
breakable
{
// compute the seven zip filename
string lzmaFile = rFTP.FileName+".lzma";
if (tmpSourceName != DestinationName)
{
pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading
if (!_CommitPatch)
{
// let the patch in the unpack directory
pPM->renameFile(tmpSourceName, pPM->ClientPatchPath + rFTP.FileName + ".tmp");
// download the 7zip file
try
{
// first, try in the file version subfolfer
try
{
progress.Scale = 1.f;
progress.Bias = 0.f;
if (!rFTP.Patches.empty())
{
pPM->getServerFile(toString("%05u/", rFTP.Patches.back())+lzmaFile, false, "", &progress);
}
// else -> file comes from a previous download (with .tmp extension, and is up to date)
// the remaining code will just rename it with good name and exit
}
catch (const NLMISC::EWriteError &)
{
// this is a local error, rethrow ...
throw;
}
catch(...)
{
// failed with version subfolder, try in the root patch directory
pPM->getServerFile(lzmaFile, false, "", &progress);
}
}
catch (const NLMISC::EWriteError &)
{
// this is a local error, rethrow ...
throw;
}
catch (...)
{
break;
}
OutFilename = pPM->ClientPatchPath + NLMISC::CFile::getFilename(rFTP.FileName);
// try to unpack the file
try
{
if (!unpackLZMA(pPM->ClientPatchPath+lzmaFile, OutFilename+".tmp"))
{
break;
}
}
catch (const NLMISC::EWriteError&)
{
throw;
}
catch (...)
{
nlwarning("Failed to unpack lzma file %s", (pPM->ClientPatchPath+lzmaFile).c_str());
break;
}
if (rFTP.LocalFileExists)
pPM->deleteFile(SourceName);
pPM->deleteFile(pPM->ClientPatchPath+lzmaFile); // delete the archive file
pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading
if (_CommitPatch)
{
pPM->renameFile(OutFilename+".tmp", DestinationName);
}
}
}
else
{
pPM->renameFile(tmpSourceName, DestinationName);
if (rFTP.LocalFileExists)
pPM->deleteFile(SourceName);
pPM->deleteFile(PatchName);
if (j > 0)
{
pPM->deleteFile(SourceNameXD, false, false); // File can exists if bad BNP loading
}
tmpSourceName = OutFilename;
PatchSizeProgress += rFTP.PatcheSizes[j];
currentPatchedSize += rFTP.PatcheSizes[j];
}
if (tmpSourceName != DestinationName)
{
pPM->deleteFile(SourceName, false, false); // File can exists if bad BNP loading
if (!_CommitPatch)
{
// let the patch in the unpack directory
pPM->renameFile(tmpSourceName, pPM->ClientPatchPath + rFTP.FileName + ".tmp");
}
else
{
pPM->renameFile(tmpSourceName, DestinationName);
}
}
}
}
@ -2915,7 +2995,7 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
}
// ****************************************************************************
void CPatchThread::xDeltaPatch(const string &patch, const string &src, const string &out)
bool CPatchThread::xDeltaPatch(const string &patch, const string &src, const string &out)
{
// Internal xdelta
@ -2941,12 +3021,13 @@ void CPatchThread::xDeltaPatch(const string &patch, const string &src, const str
break;
default:
{
std::string str = toString("Error applying %s to %s giving %s", patch.c_str(), src.c_str(), out.c_str());
throw Exception (str);
nlinfo("Error applying %s to %s giving %s", patch.c_str(), src.c_str(), out.c_str());
return false;
}
break;
}
}
} else
return true;
// Launching xdelta

@ -547,7 +547,7 @@ private:
void run();
void processFile (CPatchManager::SFileToPatch &rFTP);
void xDeltaPatch(const std::string &patch, const std::string &src, const std::string &out);
bool xDeltaPatch(const std::string &patch, const std::string &src, const std::string &out);
};
/**

@ -147,6 +147,7 @@ extern bool CharNameValidArrived;
extern bool CharNameValid;
bool IsInRingSession = false;
TSessionId HighestMainlandSessionId; // highest in the position stack
ucstring lastUniversMessage;
extern const char *CDBBankNames[INVALID_CDB_BANK+1];
@ -770,7 +771,11 @@ void CInterfaceChatDisplayer::displayChat(TDataSetIndex compressedSenderIndex, c
}
else if (mode == CChatGroup::universe)
{
PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible);
if (lastUniversMessage != finalString)
{
PeopleInterraction.ChatInput.Universe.displayMessage(finalString, col, 2, &windowVisible);
lastUniversMessage = finalString;
}
}
else if (mode == CChatGroup::dyn_chat)
{

@ -750,7 +750,7 @@ restartLoop:
// if the string contains a special rename of creature, remove it
if (str.size() > 2 && str[0] == '<' && str[1] == '#')
{
str = str.substr(2);
str = toUpper(str[2])+str.substr(3);
}
// append this string

Loading…
Cancel
Save