diff --git a/code/nel/include/nel/gui/group_menu.h b/code/nel/include/nel/gui/group_menu.h index 9c5b37589..70761d650 100644 --- a/code/nel/include/nel/gui/group_menu.h +++ b/code/nel/include/nel/gui/group_menu.h @@ -31,7 +31,7 @@ namespace NLGUI class CViewBitmap; class CGroupList; class CGroupMenu; - + class CGroupSubMenu; /** * CViewTextMenu is an element of a sub menu @@ -50,6 +50,7 @@ namespace NLGUI _Checked = false; _Checkable = false; _CheckBox = NULL; + _ParentMenu = NULL; Over = false; } @@ -60,6 +61,8 @@ namespace NLGUI bool getCheckable() const { return _Checkable; } void setCheckable(bool c); void setCheckBox(CViewBitmap *checkBox) { _CheckBox = checkBox; } + void setParentMenu(CGroupSubMenu *parentMenu) { _ParentMenu = parentMenu; }; + void setActive (bool g); CViewBitmap * getCheckBox() const { return _CheckBox; } bool getFormatted () const { return getMultiLine (); } @@ -86,6 +89,7 @@ namespace NLGUI bool _Grayed; bool _Checked; bool _Checkable; + CGroupSubMenu *_ParentMenu; }; /** diff --git a/code/nel/src/gui/group_menu.cpp b/code/nel/src/gui/group_menu.cpp index c7db05e4f..d09eec039 100644 --- a/code/nel/src/gui/group_menu.cpp +++ b/code/nel/src/gui/group_menu.cpp @@ -114,6 +114,19 @@ namespace NLGUI OldShadowColorGrayed.A = OldColorGrayed.A = (uint8)a; } + // ------------------------------------------------------------------------------------------------ + void CViewTextMenu::setActive (bool state) + { + if (_ParentMenu) + _ParentMenu->setActive(state); + + if (_Active != state) + { + _Active = state; + invalidateCoords(); + } + } + // ------------------------------------------------------------------------------------------------ // CGroupSubMenu // ------------------------------------------------------------------------------------------------ @@ -290,6 +303,9 @@ namespace NLGUI if (cond) strCond = (const char*)cond; CXMLAutoPtr params((const char*) xmlGetProp (cur, (xmlChar*)"params")); if (params) strParams = (const char*)params; + CXMLAutoPtr icon((const char*) xmlGetProp (cur, (xmlChar*)"icon")); + if (icon) + strTexture = (const char*)icon; CXMLAutoPtr strCheckable((const char*) xmlGetProp (cur, (xmlChar*)"checkable")); bool bCheckable = false; if (strCheckable) bCheckable = convertBool (strCheckable); @@ -393,11 +409,11 @@ namespace NLGUI pVB->setSerializable( false ); pVB->setParent (this); pVB->setParentPos (parentPos); - pVB->setParentPosRef (Hotspot_ML); - pVB->setPosRef (Hotspot_MR); + pVB->setParentPosRef (Hotspot_BL); + pVB->setPosRef (Hotspot_BR); pVB->setTexture(texture); pVB->setModulateGlobalColor(false); - pVB->setX (-2); + pVB->setX (MENU_WIDGET_X); addView (pVB); return pVB; } @@ -576,11 +592,14 @@ namespace NLGUI { // compute max height of widgets on the left of text sint32 widgetMaxH = 0; - if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); - if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); - if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); - if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); - widgetMaxH = std::max(widgetMaxH, _Lines[k].ViewText->getHReal()); + if (_Lines[k].ViewText->getActive()) + { + if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); + if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); + if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); + if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); + widgetMaxH = std::max(widgetMaxH, _Lines[k].ViewText->getHReal()); + } _GroupList->setMaxH(widgetMaxH*_MaxVisibleLine+_GroupList->getSpace()*(_MaxVisibleLine-1)); if (_ScrollBar == NULL) { @@ -623,28 +642,35 @@ namespace NLGUI { // compute max height of widgets on the left of text sint32 widgetMaxH = 0; - if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); - if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); - if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); - if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); - - sint32 textHReal= _Lines[k].ViewText->getHReal(); - _Lines[k].HReal= max(widgetMaxH, textHReal); - _Lines[k].TextDY= textDYPos; + sint32 textHReal = 0; + if (_Lines[k].ViewText->getActive()) + { + if (_Lines[k].UserGroupRight) widgetMaxH = _Lines[k].UserGroupRight->getHReal(); + if (_Lines[k].UserGroupLeft) widgetMaxH = std::max(widgetMaxH, _Lines[k].UserGroupLeft->getHReal()); + if (_Lines[k].CheckBox) widgetMaxH = std::max(widgetMaxH, _Lines[k].CheckBox->getHReal()); + if (_Lines[k].RightArrow) widgetMaxH = std::max(widgetMaxH, _Lines[k].RightArrow->getHReal()); + + textHReal = _Lines[k].ViewText->getHReal(); + } + + _Lines[k].HReal = max(widgetMaxH, textHReal); + _Lines[k].TextDY = textDYPos; if(widgetMaxH>textHReal) - _Lines[k].TextDY+= (widgetMaxH-textHReal) / 2; + _Lines[k].TextDY += (widgetMaxH-textHReal) / 2; } } // *** Update Text Positions // sint32 currX = 0; + sint32 maxTextW = 0; for(k = 0; k < _Lines.size(); ++k) { if (_Lines[k].ViewText) { // Setup Y _Lines[k].ViewText->setY(_Lines[k].TextDY); + maxTextW = max(maxTextW, _Lines[k].ViewText->getW()); } } @@ -658,10 +684,12 @@ namespace NLGUI // *** Setup SubMenus and CheckBoxes Positions sint32 maxViewW = 0; + for (i = 1; i < _Views.size(); ++i) { CViewBitmap *pVB = dynamic_cast(_Views[i]); if (pVB == NULL) continue; + if (pVB->getId() == ID_MENU_SUBMENU) { // Look for the next line of the menu that contains a sub menu @@ -1224,7 +1252,7 @@ namespace NLGUI pV->setCaseMode(_GroupMenu->getCaseMode()); if (formatted) { - pV->setMultiLine (true); + pV->setMultiLine (true); pV->setMultiLineMaxWOnly (true); pV->setTextFormatTaged (name); } @@ -1250,6 +1278,7 @@ namespace NLGUI _GroupList->addChild (pV); CViewBitmap *checkBox = NULL; + CViewBitmap *icon = NULL; if (checkable) { @@ -1258,15 +1287,6 @@ namespace NLGUI pV->setCheckBox(checkBox); } - CViewBitmap *icon = NULL; - if (!texture.empty()) - { - if (_GroupList->getNumChildren() == 1) - pV->setX(20); - icon = createIcon(pV, texture); - } - - tmp.ViewText = pV; tmp.Separator = NULL; tmp.AHName = ah; @@ -1280,12 +1300,39 @@ namespace NLGUI tmp.Id = id; pV->setId(_GroupMenu->getId()+":"+tmp.Id); + + { + typedef std::pair TTmplParams; + std::vector vparams; + uint lineIndex = _Lines.size()-1; + vparams.push_back(TTmplParams("id", toString("icon%d", lineIndex))); + vparams.push_back(TTmplParams("sizeref", "")); + vparams.push_back(TTmplParams("icon_texture", texture)); + //vparams.push_back(TTmplParams("icon_color", options.ColorNormal.toString())); + string lineId = toString("%s:icon", pV->getId().c_str()); + + CInterfaceGroup *pUGLeft = CWidgetManager::getInstance()->getParser()->createGroupInstance("menu_row_icon", lineId, vparams); + if (pUGLeft) + { + tmp.UserGroupLeft = pUGLeft; + tmp.UserGroupLeftOwnership = true; + addGroup(pUGLeft); + pUGLeft->setParent(this); + pUGLeft->setParentPos(this); + pUGLeft->setParentPosRef (Hotspot_BL); + pUGLeft->setPosRef (Hotspot_BL); + pUGLeft->setX(LEFT_MENU_WIDGET_X); + } + } + _Lines.push_back (tmp); + // Add an empty sub menu by default _SubMenus.push_back (NULL); + _GroupMenu->invalidateCoords(); return pV; diff --git a/code/ryzom/client/client_default.cfg b/code/ryzom/client/client_default.cfg index 7431807cf..444f8d20a 100644 --- a/code/ryzom/client/client_default.cfg +++ b/code/ryzom/client/client_default.cfg @@ -415,24 +415,10 @@ SystemInfoColors = "R2_INVITE","0 255 0 255 around", // Ring invitation }; -PrintfCommands = { - "52", "15", "55 55 0 255", "28", "uiChapterV", "624", - "428", "0 0 0 255", "18", "", "624", "378", - "0 0 0 255", "14", "", "644", "278", "0 0 0 255", - "18", "", "52", "17", "255 255 255 255", "28", - "uiChapterV", "622", "430", "255 255 255 255", "18", "", - "622", "380", "255 255 255 255", "14", "", "642", - "280", "255 255 255 255", "18", "" -}; - -PrintfCommandsFreeTrial = { - "52", "15", "55 55 0 255", "28", "uiChapterV", "624", - "428", "0 0 0 255", "18", "", "624", "378", - "0 0 0 255", "14", "", "644", "278", "0 0 0 255", - "18", "", "52", "17", "255 255 255 255", "28", - "uiChapterV", "622", "430", "255 255 255 255", "18", "", - "622", "380", "255 255 255 255", "14", "", "642", - "280", "255 255 255 255", "18", "" +loadingTexts = { + "0", "132", "30 144 255 255", "18", "uiS2", + "0", "105", "255 188 0 255", "14", "uiS2E0", + "0", "65", "255 255 255 255", "12", "NEWS" }; DisplayMissingAnimFile = 0; diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 7f0222088..bcb6384de 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -1413,36 +1413,28 @@ void CClientConfig::setValues() #ifndef RZ_NO_CLIENT // printf commands in loading screens - ClientCfg.PrintfCommands.clear(); - ClientCfg.PrintfCommandsFreeTrial.clear(); - std::vector< std::string > printfCommands(2); - printfCommands[0] = "PrintfCommands"; - printfCommands[1] = "PrintfCommandsFreeTrial"; - for(uint p=0; p<2; p++) + ClientCfg.loadingTexts.clear(); + CConfigFile::CVar *pc = ClientCfg.ConfigFile.getVarPtr("loadingTexts"); + if (pc) { - CConfigFile::CVar *pc = ClientCfg.ConfigFile.getVarPtr(printfCommands[p].c_str()); - if (pc) + if( pc->size()%5 == 0 && pc->size() >= 5) { - if( pc->size()%5 == 0 && pc->size() >= 5) + for (uint i = 0; i < pc->size(); i+=5) { - for (uint i = 0; i < pc->size(); i+=5) - { - SPrintfCommand pcom; - pcom.X = pc->asInt(i); - pcom.Y = pc->asInt(i+1); - pcom.Color = CRGBA::stringToRGBA( pc->asString(i+2).c_str() ); - pcom.FontSize = pc->asInt(i+3); - pcom.Text = pc->asString(i+4); - - if(p==0) ClientCfg.PrintfCommands.push_back( pcom ); - else ClientCfg.PrintfCommandsFreeTrial.push_back( pcom ); - } - } - else - { - cfgWarning(("Missing or too many parameters in " + printfCommands[p]).c_str()); + SPrintfCommand pcom; + pcom.X = pc->asInt(i); + pcom.Y = pc->asInt(i+1); + pcom.Color = CRGBA::stringToRGBA( pc->asString(i+2).c_str() ); + pcom.FontSize = pc->asInt(i+3); + pcom.Text = pc->asString(i+4); + + ClientCfg.loadingTexts.push_back( pcom ); } } + else + { + cfgWarning("Missing or too many parameters in loadingTexts"); + } } #endif diff --git a/code/ryzom/client/src/client_cfg.h b/code/ryzom/client/src/client_cfg.h index 7c1fa2ad6..896d0bffd 100644 --- a/code/ryzom/client/src/client_cfg.h +++ b/code/ryzom/client/src/client_cfg.h @@ -699,9 +699,7 @@ struct CClientConfig uint FontSize; std::string Text; }; - std::vector PrintfCommands; - - std::vector PrintfCommandsFreeTrial; + std::vector loadingTexts; // funny loading messages count uint16 LoadingStringCount; diff --git a/code/ryzom/client/src/game_context_menu.cpp b/code/ryzom/client/src/game_context_menu.cpp index a8c1d9322..45133de8a 100644 --- a/code/ryzom/client/src/game_context_menu.cpp +++ b/code/ryzom/client/src/game_context_menu.cpp @@ -30,10 +30,12 @@ #include "interface_v3/bot_chat_manager.h" #include "interface_v3/guild_manager.h" #include "interface_v3/people_interraction.h" +#include "continent_manager.h" #include "main_loop.h" #include "interface_v3/inventory_manager.h" #include "motion/user_controls.h" #include "sheet_manager.h" +#include "connection.h" // GAME SHARE #include "game_share/constants.h" #include "game_share/properties.h" @@ -47,6 +49,7 @@ using namespace NLMISC; using namespace std; +extern CContinentManager ContinentMngr; // filter available programs depending on R2 mode static uint32 filterAvailablePrograms(uint32 src) @@ -141,6 +144,9 @@ void CGameContextMenu::init(const std::string &srcMenuId) _TextQuitTeam = "ui:interface:" + menuId + ":quit_team"; _TextAddToFriendList = "ui:interface:" + menuId + ":add_to_friend_list"; _TextTalk = "ui:interface:" + menuId + ":talk"; + _TextInvisible = "ui:interface:" + menuId + ":invisible"; + _TextInvulnerable = "ui:interface:" + menuId + ":invulnerable"; + _TextGod = "ui:interface:" + menuId + ":god"; // Mission DB and Text link @@ -161,6 +167,7 @@ void CGameContextMenu::init(const std::string &srcMenuId) // BotChat menus _TextNews = "ui:interface:" + menuId + ":news"; + _TextNewsAgressive = "ui:interface:" + menuId + ":news_aggressive"; _TextTradeItem = "ui:interface:" + menuId + ":trade_item"; _TextTradeTeleport = "ui:interface:" + menuId + ":trade_teleport"; _TextTradeFaction = "ui:interface:" + menuId + ":trade_faction"; @@ -257,6 +264,18 @@ void CGameContextMenu::update() setupContextMenuCantTalk(); // can't talk by default + bool showGMOptions = (hasPrivilegeDEV() || hasPrivilegeSGM() || hasPrivilegeGM() || hasPrivilegeVG() || hasPrivilegeSG() || hasPrivilegeEM() || hasPrivilegeEG() || hasPrivilegeOBSERVER()); + + if (_TextInvisible) + _TextInvisible->setActive(showGMOptions); + + if (_TextInvulnerable) + _TextInvulnerable->setActive(showGMOptions); + + if (_TextGod) + _TextGod->setActive(showGMOptions); + + // If mode Combat (no talk, no give, no mount, no extract_rm) if(UserEntity->isFighting()) { @@ -391,7 +410,7 @@ void CGameContextMenu::update() if(_TextExchange) { // Action possible only if the client is not already busy and the selection is able to do this with you.. - if(selection && selection->properties().canExchangeItem()) + if(selection && selection->isPlayer() && selection->properties().canExchangeItem()) _TextExchange->setActive(!UserEntity->isBusy()); else _TextExchange->setActive(false); @@ -415,6 +434,33 @@ void CGameContextMenu::update() if (_TextAttack) _TextAttack->setActive(canAttack()); + + // get current continent to check fame + string continent = ContinentMngr.cur()->SheetName; + sint8 fameValue = 0; + uint fameIndex; + if (continent == "matis.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("matis"); + else if (continent == "fyros.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("fyros"); + else if (continent == "tryker.continent") + fameIndex = CStaticFames::getInstance().getFactionIndex("tryker"); + else if (continent == "zorai.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->isForageSource() && fameValue >= -30); + + if (_TextNewsAgressive) + _TextNewsAgressive->setActive(selection && !canAttack() && !selection->isForageSource() && fameValue < -30); + + if (_TextDuel && _TextUnDuel) { if ((!UserEntity->isRiding()) && (_ServerInDuel->getValue8() != 0)) @@ -494,7 +540,7 @@ void CGameContextMenu::update() { bool invitable = false; // User should not be flagged as invitable by himself, so no need to check that selection is not the user - if(selection && selection->properties().invitable() && propValidation.invitable() ) + if(selection && selection->isPlayer() && selection->properties().invitable() && propValidation.invitable() ) { invitable = true; } @@ -605,6 +651,7 @@ void CGameContextMenu::update() // Apply real activation of Talk Texts. applyTextTalk(); + } // *************************************************************************** @@ -715,8 +762,19 @@ void CGameContextMenu::updateContextMenuMissionsOptions( bool forceHide ) { result = NLMISC::CI18N::get("uiMissionOptionNotReceived"); } - pVTM->setText(result); - pVTM->setActive(true); + if (result == ucstring("Qui etes-vous ?") + || result == ucstring("Wer bist Du?") + || result == ucstring("Who are you?") + || result == ucstring("Quién eres tú?") + || result == ucstring("Кто ты?")) + { + pVTM->setActive(false); + } + else + { + pVTM->setText(result); + pVTM->setActive(true); + } } else { @@ -856,7 +914,7 @@ void CGameContextMenu::updateContextMenuTalkEntries(uint options) options = std::numeric_limits::max(); // in local mode, force all options to be shown (for debug) } // news - _OkTextNews= ((options & (1 << BOTCHATTYPE::NewsFlag))); + _OkTextNews= true; //((options & (1 << BOTCHATTYPE::NewsFlag))); // trade _OkTextTradeItem= ((options & (1 << BOTCHATTYPE::TradeItemFlag)) != 0); _OkTextTradeTeleport= ((options & (1 << BOTCHATTYPE::TradeTeleportFlag)) != 0); @@ -907,7 +965,6 @@ void CGameContextMenu::setupContextMenuTalkWithPlayer() // *************************************************************************** void CGameContextMenu::applyTextTalk() { - if (_TextNews) _TextNews->setActive(_OkTextNews); if (_TextTradeItem) _TextTradeItem->setActive(_OkTextTradeItem); if (_TextTradeTeleport) _TextTradeTeleport->setActive(_OkTextTradeTeleport); if (_TextTradeFaction) _TextTradeFaction->setActive(_OkTextTradeFaction); diff --git a/code/ryzom/client/src/game_context_menu.h b/code/ryzom/client/src/game_context_menu.h index 0f628b6bf..6ddc2200d 100644 --- a/code/ryzom/client/src/game_context_menu.h +++ b/code/ryzom/client/src/game_context_menu.h @@ -132,6 +132,7 @@ private: // BotChat and player talk CViewTextMenuPtr _TextNews; + CViewTextMenuPtr _TextNewsAgressive; CViewTextMenuPtr _TextTradeItem; CViewTextMenuPtr _TextTradeTeleport; CViewTextMenuPtr _TextTradeFaction; @@ -155,6 +156,9 @@ private: CViewTextMenuPtr _TextOutpostBanishPlayer; CViewTextMenuPtr _TextOutpostBanishGuild; CViewTextMenuPtr _TextWebPage; + CViewTextMenuPtr _TextInvisible; + CViewTextMenuPtr _TextInvulnerable; + CViewTextMenuPtr _TextGod; CViewTextMenuPtr _TextMissionRing[BOTCHATTYPE::MaxR2MissionEntryDatabase]; // Forage source diff --git a/code/ryzom/client/src/global.cpp b/code/ryzom/client/src/global.cpp index 4b8e1aad7..d5113e0a9 100644 --- a/code/ryzom/client/src/global.cpp +++ b/code/ryzom/client/src/global.cpp @@ -78,6 +78,7 @@ std::vectorsetId(getId() + ":regen"); + _RegenText->setParent(_Parent); + _RegenText->setOverflowText(ucstring("")); + _RegenText->setModulateGlobalColor(false); + _RegenText->setMultiLine(false); + _RegenText->setTextMode(CViewText::ClipWord); + _RegenText->setFontSizing("0", "0"); + // TODO: font size / color hardcoded. + _RegenText->setFontSize(8); + _RegenText->setColor(CRGBA::White); + _RegenText->setShadow(true); + _RegenText->setActive(true); + _RegenText->updateTextContext(); + } + + // TODO: ticks in second hardcoded + uint32 nextValue = _RegenTickRange.EndTick > LastGameCycle ? (_RegenTickRange.EndTick - LastGameCycle) / 10 : 0; + if (_RegenTextValue != nextValue) + { + _RegenTextValue = nextValue; + _RegenText->setText(toString("%d", _RegenTextValue)); + _RegenText->updateTextContext(); + } + _RegenText->setXReal(_XReal+1); + _RegenText->setYReal(_YReal+2); + _RegenText->setRenderLayer(_RenderLayer+2); + _RegenText->draw(); } } diff --git a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h index 28d7a1ddf..4abc16f4b 100644 --- a/code/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/code/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -51,6 +51,7 @@ class COutpostBuildingSheet; namespace NLGUI { class CViewRenderer; + class CViewText; } class CDBCtrlSheet; @@ -731,6 +732,8 @@ protected: sint8 _ArmourColorIndex; CTickRange _RegenTickRange; + NLGUI::CViewText *_RegenText; + uint32 _RegenTextValue; /// D'n'd sint32 _DragX, _DragY; diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index d88d08d41..401741249 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -436,6 +436,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions(NLGUI::CLuaState &ls) ls.registerFunc("getDesktopIndex", getDesktopIndex); ls.registerFunc("setLuaBreakPoint", setLuaBreakPoint); ls.registerFunc("getMainPageURL", getMainPageURL); + ls.registerFunc("setNewsAtProgress", setNewsAtProgress); ls.registerFunc("getCharSlot", getCharSlot); ls.registerFunc("getServerSeason", getServerSeason); ls.registerFunc("computeCurrSeason", computeCurrSeason); @@ -1145,6 +1146,16 @@ int CLuaIHMRyzom::getMainPageURL(CLuaState &ls) return 1; } +// *************************************************************************** +int CLuaIHMRyzom::setNewsAtProgress(CLuaState &ls) +{ + //H_AUTO(Lua_CLuaIHM_getMainPageURL) + const char *funcName = "NewsAtProgress"; + CLuaIHM::checkArgType(ls, funcName, 1, LUA_TSTRING); + NewsAtProgress = ls.toString(1); + return 0; +} + // *************************************************************************** int CLuaIHMRyzom::getCharSlot(CLuaState &ls) { diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h index 31cda63b1..942a08181 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h @@ -58,6 +58,7 @@ private: static int getDesktopIndex(CLuaState &ls); static int setLuaBreakPoint(CLuaState &ls); // set a breakpoint in lua external debugger (file, line) static int getMainPageURL(CLuaState &ls); + static int setNewsAtProgress(CLuaState &ls); static int getCharSlot(CLuaState &ls); static int displaySystemInfo(CLuaState &ls); static int displayChatMessage(CLuaState &ls); diff --git a/code/ryzom/client/src/progress.cpp b/code/ryzom/client/src/progress.cpp index 2766c60d2..8847a87a9 100644 --- a/code/ryzom/client/src/progress.cpp +++ b/code/ryzom/client/src/progress.cpp @@ -47,6 +47,7 @@ extern NL3D::UMaterial LoadingMaterialFull; extern std::vector LogoBitmaps; extern uint TipsOfTheDayIndex; extern ucstring TipsOfTheDay; +extern string NewsAtProgress; extern bool UseEscapeDuringLoading; CProgress::CProgress () @@ -366,23 +367,27 @@ void CProgress::internalProgress (float value) // apply text commands if( ApplyTextCommands ) { - std::vector printfCommands = ClientCfg.PrintfCommands; - if(FreeTrial) printfCommands = ClientCfg.PrintfCommandsFreeTrial; + std::vector loadingTexts = ClientCfg.loadingTexts; - if( !printfCommands.empty() ) + if( !loadingTexts.empty() ) { TextContext->setHotSpot(UTextContext::MiddleBottom); vector::iterator itpc; - for( itpc = printfCommands.begin(); itpc != printfCommands.end(); ++itpc ) + for( itpc = loadingTexts.begin(); itpc != loadingTexts.end(); ++itpc ) { float x = 0.5f;//((*itpc).X / 1024.f); float y = ((*itpc).Y / 768.f); TextContext->setColor( (*itpc).Color ); - TextContext->setFontSize( (uint)(16.f * fontFactor)); + TextContext->setFontSize( (uint)((*itpc).FontSize * fontFactor)); // build the ucstr(s) - ucstring ucstr = CI18N::get((*itpc).Text); + string text = (*itpc).Text; + ucstring ucstr; + if (text == "NEWS") + ucstr.fromUtf8(NewsAtProgress); + else + ucstr = CI18N::get(text); vector vucstr; ucstring sep("\n"); splitUCString(ucstr,sep,vucstr);