From 8b4d189c31f78921a999799d92f9ef7e536c4c1a Mon Sep 17 00:00:00 2001 From: Riasan Date: Tue, 23 May 2017 19:38:26 +0200 Subject: [PATCH 1/3] Changed: edit force_camera_fp command --HG-- branch : develop --- .../client/src/interface_v3/action_handler_move.cpp | 6 +++--- code/ryzom/client/src/user_entity.cpp | 11 ++++++----- code/ryzom/client/src/user_entity.h | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_move.cpp b/code/ryzom/client/src/interface_v3/action_handler_move.cpp index b33f71da5..d402f1750 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_move.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_move.cpp @@ -226,15 +226,15 @@ class CAHToggleCamera : public IActionHandler REGISTER_ACTION_HANDLER (CAHToggleCamera, "toggle_camera"); // ------------------------------------------------------------------------------------------------ -class CAHToggleForceFP : public IActionHandler +class CAHTForceFP : public IActionHandler { virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */) { // Change the camera view to first person - UserEntity->forceCamareaFirstPerson(); + UserEntity->forceCameraFirstPerson(); } }; -REGISTER_ACTION_HANDLER (CAHToggleForceFP, "force_camera_fp"); +REGISTER_ACTION_HANDLER (CAHTForceFP, "force_camera_fp"); // ------------------------------------------------------------------------------------------------ class CAHToggleNames : public IActionHandler diff --git a/code/ryzom/client/src/user_entity.cpp b/code/ryzom/client/src/user_entity.cpp index 5fd8c7dfb..cad200aeb 100644 --- a/code/ryzom/client/src/user_entity.cpp +++ b/code/ryzom/client/src/user_entity.cpp @@ -3214,10 +3214,10 @@ void CUserEntity::toggleCamera() }// toggleCamera // //----------------------------------------------- -// forceCamareaFirstPerson : +// forceCameraFirstPerson : // Force Camera to First Person View //----------------------------------------------- -void CUserEntity::forceCamareaFirstPerson() +void CUserEntity::forceCameraFirstPerson() { // You cannot change the camera view when dead. if(isDead()) @@ -3225,10 +3225,11 @@ void CUserEntity::forceCamareaFirstPerson() // Only if not inside a building. if(!UserEntity->forceIndoorFPV()) { - //Enter the 1st Person View Mode - UserEntity->viewMode(CUserEntity::FirstPV); + if (UserEntity->viewMode() != CUserEntity::FirstPV) + //Enter the 1st Person View Mode + UserEntity->viewMode(CUserEntity::FirstPV); } -}// forceCamareaFirstPerson // +}// forceCameraFirstPerson // //--------------------------------------------------- // getScale : diff --git a/code/ryzom/client/src/user_entity.h b/code/ryzom/client/src/user_entity.h index e79af8dba..7e693536b 100644 --- a/code/ryzom/client/src/user_entity.h +++ b/code/ryzom/client/src/user_entity.h @@ -370,7 +370,7 @@ public: /// Toggle Camera (First/Third Person) void toggleCamera(); /// Force Camera First Person View - void forceCamareaFirstPerson(); + void forceCameraFirstPerson(); //@} /// Return the entity scale. (return 1.0 if there is any problem). From 5ea48c75995c30310c97ad1eb291725fa337b670 Mon Sep 17 00:00:00 2001 From: kishan_grimout Date: Mon, 29 May 2017 16:15:02 +0200 Subject: [PATCH 2/3] fix crash in EGS when client asks to create an item with a sheet ID EGS doesn't know by avoiding access the null item pointer outside the if(null) scope. --HG-- branch : develop --- .../game_item_manager/game_item_manager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp index 17d4d7d55..1124ce298 100644 --- a/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/game_item_manager/game_item_manager.cpp @@ -233,6 +233,7 @@ CGameItemPtr CGameItemManager::createItem( const CSheetId& sheetId, uint16 quali // nlerror(" Can't find the owner item %s",owner.toString().c_str()); // } // } + log_Item_Create(item->getItemId(), item->getSheetId(), item->getStackSize(), item->quality()); } else { @@ -240,8 +241,6 @@ CGameItemPtr CGameItemManager::createItem( const CSheetId& sheetId, uint16 quali nlwarning(" Can't create an item with invalid sheet '%s'", sheetId.toString().c_str()); } - log_Item_Create(item->getItemId(), item->getSheetId(), item->getStackSize(), item->quality()); - return item; } // createItem // From 9394906182171d53e9c607abdbd7733b807f9c95 Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 1 Jun 2017 13:51:32 +0300 Subject: [PATCH 3/3] Added: -ryzom-modulate-color style to enable modulation with global color --HG-- branch : develop --- code/nel/include/nel/gui/group_html.h | 6 ++- code/nel/src/gui/group_html.cpp | 72 ++++++++++++++++----------- 2 files changed, 48 insertions(+), 30 deletions(-) diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index 42da5da20..e996b6214 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -84,6 +84,7 @@ namespace NLGUI FontOblique=false; Underlined=false; StrikeThrough=false; + GlobalColor=false; Width=-1; Height=-1; MaxWidth=-1; @@ -94,6 +95,7 @@ namespace NLGUI bool FontOblique; std::string FontFamily; NLMISC::CRGBA TextColor; + bool GlobalColor; bool Underlined; bool StrikeThrough; sint32 Width; @@ -339,7 +341,7 @@ namespace NLGUI void addString(const ucstring &str); // Add an image in the current paragraph - void addImage(const char *image, bool globalColor, bool reloadImg=false, const CStyleParams &style = CStyleParams()); + void addImage(const char *image, bool reloadImg=false, const CStyleParams &style = CStyleParams()); // Add a text area in the current paragraph CInterfaceGroup *addTextArea (const std::string &templateName, const char *name, uint rows, uint cols, bool multiLine, const ucstring &content, uint maxlength); @@ -350,7 +352,7 @@ namespace NLGUI // Add a button in the current paragraph. actionHandler, actionHandlerParams and tooltip can be NULL. CCtrlButton *addButton(CCtrlButton::EType type, const std::string &name, const std::string &normalBitmap, const std::string &pushedBitmap, - const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, const char *tooltip, + const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams, const char *tooltip, const CStyleParams &style = CStyleParams()); // Set the background color diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 3895f9521..92b5dee3f 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -1397,6 +1397,7 @@ namespace NLGUI style.TextColor = LinkColor; style.Underlined = true; style.StrikeThrough = getFontStrikeThrough(); + style.GlobalColor = LinkColorGlobalColor; if (present[HTML_A_STYLE] && value[HTML_A_STYLE]) getStyleParams(value[HTML_A_STYLE], style); @@ -1406,7 +1407,7 @@ namespace NLGUI _TextColor.push_back(style.TextColor); _FontUnderlined.push_back(style.Underlined); _FontStrikeThrough.push_back(style.StrikeThrough); - _GlobalColor.push_back(LinkColorGlobalColor); + _GlobalColor.push_back(style.GlobalColor); _A.push_back(true); _Link.push_back (""); _LinkTitle.push_back(""); @@ -1676,14 +1677,14 @@ namespace NLGUI getPercentage(style.Width, tmpf, value[MY_HTML_IMG_WIDTH]); if (present[MY_HTML_IMG_HEIGHT] && value[MY_HTML_IMG_HEIGHT]) getPercentage(style.Height, tmpf, value[MY_HTML_IMG_HEIGHT]); + + // Get the global color name + if (present[MY_HTML_IMG_GLOBAL_COLOR]) + style.GlobalColor = true; + // width, height from inline css if (present[MY_HTML_IMG_STYLE] && value[MY_HTML_IMG_STYLE]) getStyleParams(value[MY_HTML_IMG_STYLE], style); - - // Get the global color name - bool globalColor = false; - if (present[MY_HTML_IMG_GLOBAL_COLOR]) - globalColor = true; if (getA() && getParent () && getParent ()->getParent()) { @@ -1694,7 +1695,7 @@ namespace NLGUI string params = "name=" + getId() + "|url=" + getLink (); addButton(CCtrlButton::PushButton, value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], value[MY_HTML_IMG_SRC], - "", globalColor, "browse", params.c_str(), tooltip, style); + "", "browse", params.c_str(), tooltip, style); } else { @@ -1715,7 +1716,7 @@ namespace NLGUI reloadImg = true; } - addImage (value[MY_HTML_IMG_SRC], globalColor, reloadImg, style); + addImage (value[MY_HTML_IMG_SRC], reloadImg, style); } } } @@ -1741,16 +1742,6 @@ namespace NLGUI // Get the type if (present[MY_HTML_INPUT_TYPE] && value[MY_HTML_INPUT_TYPE]) { - // Global color flag - bool globalColor = false; - if (present[MY_HTML_INPUT_GLOBAL_COLOR]) - globalColor = true; - - // Tooltip - const char *tooltip = NULL; - if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT]) - tooltip = value[MY_HTML_INPUT_ALT]; - // by default not inherited, font family defaults to system font CStyleParams style; style.TextColor = TextColor; @@ -1758,6 +1749,15 @@ namespace NLGUI style.FontWeight = FONT_WEIGHT_NORMAL; style.FontOblique = false; + // Global color flag + if (present[MY_HTML_INPUT_GLOBAL_COLOR]) + style.GlobalColor = true; + + // Tooltip + const char *tooltip = NULL; + if (present[MY_HTML_INPUT_ALT] && value[MY_HTML_INPUT_ALT]) + tooltip = value[MY_HTML_INPUT_ALT]; + if (present[MY_HTML_INPUT_STYLE] && value[MY_HTML_INPUT_STYLE]) getStyleParams(value[MY_HTML_INPUT_STYLE], style); @@ -1785,7 +1785,7 @@ namespace NLGUI // Add the ctrl button addButton (CCtrlButton::PushButton, name, normal, pushed.empty()?normal:pushed, over, - globalColor, "html_submit_form", param.c_str(), tooltip, style); + "html_submit_form", param.c_str(), tooltip, style); } if (type == "button" || type == "submit") { @@ -1840,7 +1840,7 @@ namespace NLGUI if (!ctrlButton) ctrlButton = dynamic_cast(buttonGroup->getCtrl("b")); if (ctrlButton) { - ctrlButton->setModulateGlobalColorAll (globalColor); + ctrlButton->setModulateGlobalColorAll (style.GlobalColor); // Translate the tooltip if (tooltip) @@ -1923,8 +1923,7 @@ namespace NLGUI checked = (present[MY_HTML_INPUT_CHECKED] && value[MY_HTML_INPUT_CHECKED]); // Add the ctrl button - CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, - globalColor, "", "", tooltip); + CCtrlButton *checkbox = addButton (btnType, name, normal, pushed, over, "", "", tooltip, style); if (checkbox) { if (btnType == CCtrlButton::RadioButton) @@ -2349,6 +2348,7 @@ namespace NLGUI style.FontOblique = getFontOblique(); style.Underlined = getFontUnderlined(); style.StrikeThrough = getFontStrikeThrough(); + style.GlobalColor = getGlobalColor(); if (present[MY_HTML_SPAN_STYLE] && value[MY_HTML_SPAN_STYLE]) getStyleParams(value[MY_HTML_SPAN_STYLE], style); @@ -2360,6 +2360,7 @@ namespace NLGUI _FontOblique.push_back(style.FontOblique); _FontUnderlined.push_back(style.Underlined); _FontStrikeThrough.push_back(style.StrikeThrough); + _GlobalColor.push_back(style.GlobalColor); } break; case HTML_DEL: @@ -2763,6 +2764,7 @@ namespace NLGUI popIfNotEmpty (_TextColor); popIfNotEmpty (_FontUnderlined); popIfNotEmpty (_FontStrikeThrough); + popIfNotEmpty (_GlobalColor); break; case HTML_DEL: popIfNotEmpty (_FontStrikeThrough); @@ -4321,7 +4323,7 @@ namespace NLGUI // *************************************************************************** - void CGroupHTML::addImage(const char *img, bool globalColor, bool reloadImg, const CStyleParams &style) + void CGroupHTML::addImage(const char *img, bool reloadImg, const CStyleParams &style) { // In a paragraph ? if (!_Paragraph) @@ -4382,7 +4384,7 @@ namespace NLGUI addImageDownload(img, newImage, style); } newImage->setTexture (image); - newImage->setModulateGlobalColor(globalColor); + newImage->setModulateGlobalColor(style.GlobalColor); getParagraph()->addChild(newImage); paragraphChange (); @@ -4530,7 +4532,7 @@ namespace NLGUI // *************************************************************************** CCtrlButton *CGroupHTML::addButton(CCtrlButton::EType type, const std::string &/* name */, const std::string &normalBitmap, const std::string &pushedBitmap, - const std::string &overBitmap, bool useGlobalColor, const char *actionHandler, const char *actionHandlerParams, + const std::string &overBitmap, const char *actionHandler, const char *actionHandlerParams, const char *tooltip, const CStyleParams &style) { // In a paragraph ? @@ -4602,7 +4604,7 @@ namespace NLGUI ctrlButton->setTexturePushed (pushed); if (!over.empty()) ctrlButton->setTextureOver (over); - ctrlButton->setModulateGlobalColorAll (useGlobalColor); + ctrlButton->setModulateGlobalColorAll (style.GlobalColor); ctrlButton->setActionOnLeftClick (actionHandler); ctrlButton->setParamsOnLeftClick (actionHandlerParams); @@ -5767,16 +5769,20 @@ namespace NLGUI newParagraph(0); paragraphChange(); } + + CStyleParams style; + style.GlobalColor = ls.toBoolean(2); + string url = getLink(); if (!url.empty()) { string params = "name=" + getId() + "|url=" + getLink (); addButton(CCtrlButton::PushButton, ls.toString(1), ls.toString(1), ls.toString(1), - "", ls.toBoolean(2), "browse", params.c_str(), ""); + "", "browse", params.c_str(), "", style); } else { - addImage(ls.toString(1), ls.toBoolean(2)); + addImage(ls.toString(1), false, style); } @@ -6085,6 +6091,16 @@ namespace NLGUI else if (it->first == "max-height") getPercentage(style.MaxHeight, tmpf, it->second.c_str()); + else + if (it->first == "-ryzom-modulate-color") + { + bool b; + if (it->second == "inherit") + style.GlobalColor = getGlobalColor(); + else + if (fromString(it->second, b)) + style.GlobalColor = b; + } } if (inherit) {