From ec61fa02b6dc812ccf16c7d2e2e912a231759bc3 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Fri, 17 Apr 2020 20:25:41 +0800 Subject: [PATCH 1/2] Fix hand slots for fauna, ref kaetemi/ryzomclassic#125 --- ryzom/client/src/character_cl.cpp | 13 +++++++------ .../client/src/client_sheets/character_sheet.cpp | 15 +++++++++++++++ ryzom/client/src/entity_cl.cpp | 2 ++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ryzom/client/src/character_cl.cpp b/ryzom/client/src/character_cl.cpp index 447ce8e3d..76263ee56 100644 --- a/ryzom/client/src/character_cl.cpp +++ b/ryzom/client/src/character_cl.cpp @@ -1120,7 +1120,7 @@ void CCharacterCL::computeAnimSet() // Use the generic method to compute the animation set. if(!::computeAnimSet(_CurrentAnimSet[MOVE], _Mode, _Sheet->getAnimSetBaseName(), _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet, _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet, !modeWithHiddenItems())) { - //nlwarning("CH:computeAnimSet:%d: pb when trying to compute the animset. Sheet Id '%u(%s)'.", _Slot, _SheetId.asInt(), _SheetId.toString().c_str()); + nlwarning("CH:computeAnimSet:%d: pb when trying to compute the animset. Sheet Id '%u(%s)'.", _Slot, _SheetId.asInt(), _SheetId.toString().c_str()); } }// computeAnimSet // @@ -3360,7 +3360,7 @@ void CCharacterCL::showOrHideBodyParts( bool objectsVisible ) lHandInstIdx = SLOTTYPE::LEFT_HAND_SLOT; // hide gloves(armor) if player has magician amplifier - if( _Items[rHandInstIdx].Sheet && (_Items[rHandInstIdx].Sheet->ItemType == ITEM_TYPE::MAGICIAN_STAFF) ) + if( _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet && (_Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet->ItemType == ITEM_TYPE::MAGICIAN_STAFF) ) { if( !_Instances[SLOTTYPE::HANDS_SLOT].Current.empty() ) _Instances[SLOTTYPE::HANDS_SLOT].Current.hide(); @@ -3378,8 +3378,9 @@ void CCharacterCL::showOrHideBodyParts( bool objectsVisible ) if( !objectsVisible ) { // Right Hand + nlassert(SLOTTYPE::RIGHT_HAND_SLOT < _Items.size() && SLOTTYPE::LEFT_HAND_SLOT < _Items.size()); if(rHandInstIdx<_Instances.size()) - if( !(_Items[rHandInstIdx].Sheet && _Items[rHandInstIdx].Sheet->NeverHideWhenEquipped ) ) + if( !(_Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet && _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet->NeverHideWhenEquipped ) ) if(!_Instances[rHandInstIdx].Current.empty()) { _Instances[rHandInstIdx].Current.hide(); @@ -3387,7 +3388,7 @@ void CCharacterCL::showOrHideBodyParts( bool objectsVisible ) } // Left Hand if(lHandInstIdx <_Instances.size()) - if( !(_Items[lHandInstIdx].Sheet && _Items[lHandInstIdx].Sheet->NeverHideWhenEquipped ) ) + if( !(_Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet && _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet->NeverHideWhenEquipped ) ) if(!_Instances[lHandInstIdx].Current.empty()) { _Instances[lHandInstIdx].Current.hide(); @@ -9293,14 +9294,14 @@ const char *CCharacterCL::getBoneNameFromBodyPart(BODY::TBodyPart part, BODY::TS const CItemSheet *CCharacterCL::getRightHandItemSheet() const { if (_RHandInstIdx == CEntityCL::BadIndex) return NULL; - return _Items[_RHandInstIdx].Sheet; + return _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet; } // ********************************************************************************************* const CItemSheet *CCharacterCL::getLeftHandItemSheet() const { if (_LHandInstIdx == CEntityCL::BadIndex) return NULL; - return _Items[_LHandInstIdx].Sheet; + return _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet; } // *************************************************************************** diff --git a/ryzom/client/src/client_sheets/character_sheet.cpp b/ryzom/client/src/client_sheets/character_sheet.cpp index ab935268b..e6e5cbd00 100644 --- a/ryzom/client/src/client_sheets/character_sheet.cpp +++ b/ryzom/client/src/client_sheets/character_sheet.cpp @@ -213,6 +213,21 @@ void CCharacterSheet::build(const NLGEORGES::UFormElm &item) // IN LEFT HAND readEquipment(item, "Basics.Equipment.HandL", ObjectInLeftHand); + if (!ObjectInRightHand.IdItem) + { + std::string right; + item.getValueByName(right, "item_right"); + if (!right.empty()) + ObjectInRightHand.IdItem = ClientSheetsStrings.add(NLMISC::toLower(right)); + } + + if (!ObjectInLeftHand.IdItem) + { + std::string left; + item.getValueByName(left, "item_left"); + if (!left.empty()) + ObjectInLeftHand.IdItem = ClientSheetsStrings.add(NLMISC::toLower(left)); + } // Get the animation set Base Name. string AnimSetBaseName; diff --git a/ryzom/client/src/entity_cl.cpp b/ryzom/client/src/entity_cl.cpp index 14f3a1769..10d1573cf 100644 --- a/ryzom/client/src/entity_cl.cpp +++ b/ryzom/client/src/entity_cl.cpp @@ -378,6 +378,8 @@ void CEntityCL::SInstanceCL::updateCurrentFromLoading(NL3D::USkeleton Skeleton) sint stickID = Skeleton.getBoneIdByName(StickPoint); if(stickID != -1) Skeleton.stickObject(Current, stickID); + else + nlwarning("Skeleton '%s' is missing bone '%s' for object attachment.", Skeleton.getShapeName().c_str(), StickPoint.c_str()); } } From 3cbfa82a6ed5c092bfb944c83bb56e29bc8c0455 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sat, 18 Apr 2020 13:09:08 +0800 Subject: [PATCH 2/2] Fix georges editor --- .../georges_dll/file_tree_view.cpp | 2 +- .../leveldesign/georges_dll/form_dialog.cpp | 23 ++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp b/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp index 673c12d9a..e1a52d887 100644 --- a/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp +++ b/ryzom/tools/leveldesign/georges_dll/file_tree_view.cpp @@ -187,7 +187,7 @@ BOOL CFileTreeCtrl::OnNotify ( WPARAM wParam, LPARAM lParam, LRESULT* pResult ) { LPNMHDR pnmh = (LPNMHDR) lParam; // Tree ? - if (wParam == 0) + // if (wParam == 0) { switch (pnmh->code) { diff --git a/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp b/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp index a4d35fdcc..b4def1a14 100644 --- a/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp +++ b/ryzom/tools/leveldesign/georges_dll/form_dialog.cpp @@ -720,6 +720,8 @@ void CFormDialog::onLastFocus () int CFormDialog::getWidget (uint dialogId) const { + if (dialogId == 0xFFFE) + dialogId = 0; for (uint i=0; iisDialog (dialogId)) @@ -1198,6 +1200,11 @@ void CFormDialog::onGetSubFocus (uint id) { // Get the widget int widget = getWidget (id); + if (widget < 0) + { + nldebug("Invalid widget id %d", (int)id); + return; + } WidgetFocused = widget; // Window view @@ -1584,7 +1591,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, { // Create the mem combobox parent->setComboSpinSize (currentPos); - Combo.create (WS_CHILD|WS_TABSTOP, currentPos, parent, dialog_index, reg, theApp.RememberListSize); + Combo.create (WS_CHILD|WS_TABSTOP, currentPos, parent, dialog_index ? dialog_index : 0xFFFE, reg, theApp.RememberListSize); parent->initWidget (Combo); // Create the spin @@ -1599,7 +1606,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, { // Create the mem combobox parent->setComboBrowseSize (currentPos); - Combo.create (WS_CHILD|WS_TABSTOP, currentPos, parent, dialog_index, reg, theApp.RememberListSize); + Combo.create (WS_CHILD|WS_TABSTOP, currentPos, parent, dialog_index ? dialog_index : 0xFFFE, reg, theApp.RememberListSize); parent->initWidget (Combo); // Create the spin @@ -1621,7 +1628,7 @@ void CFormMemCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, { // Create the mem combobox parent->setComboSize (currentPos, parent->SmallWidget); - Combo.create (WS_CHILD|WS_TABSTOP, currentPos, parent, dialog_index, reg, theApp.RememberListSize); + Combo.create (WS_CHILD|WS_TABSTOP, currentPos, parent, dialog_index ? dialog_index : 0xFFFE, reg, theApp.RememberListSize); parent->initWidget (Combo); parent->getNextPos (currentPos); } @@ -1914,7 +1921,7 @@ void CFormCombo::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui parent->setComboSize (currentPos, parent->SmallWidget); RECT comboPos = currentPos; parent->adjusteComboSize (comboPos); - Combo.Create (WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_HASSTRINGS|WS_CHILD|WS_TABSTOP, comboPos, parent, dialog_index); + Combo.Create (WS_CHILD|WS_VSCROLL|WS_VISIBLE|CBS_DROPDOWNLIST|CBS_HASSTRINGS|WS_CHILD|WS_TABSTOP, comboPos, parent, dialog_index ? dialog_index : 0xFFFE); parent->initWidget (Combo); parent->getNextPos (currentPos); @@ -2097,7 +2104,7 @@ void CFormBigEdit::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, // Create the mem combobox parent->setBigEditSize (currentPos, parent->SmallWidget); - Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, parent, dialog_index); + Edit.CreateEx (WS_EX_CLIENTEDGE, _T("EDIT"), _T(""), WS_VSCROLL|ES_OEMCONVERT|ES_MULTILINE|ES_WANTRETURN|WS_CHILD|WS_VISIBLE|WS_TABSTOP|ES_AUTOHSCROLL|ES_AUTOVSCROLL, currentPos, parent, dialog_index ? dialog_index : 0xFFFE); parent->initWidget (Edit); parent->getNextPos (currentPos); @@ -2271,7 +2278,7 @@ void CColorEdit::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, ui // Create the mem combobox parent->setColorSize (currentPos, parent->SmallWidget); - Color.create (WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index); + Color.create (WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index ? dialog_index : 0xFFFE); parent->initWidget (Color); // Create the reset button @@ -2501,7 +2508,7 @@ void CListWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u // Create the mem combobox parent->setListSize (currentPos, parent->SmallWidget); - ListCtrl.create (WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index); + ListCtrl.create (WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index ? dialog_index : 0xFFFE); parent->initWidget (ListCtrl); parent->getNextPos (currentPos); @@ -2759,7 +2766,7 @@ void CIconWidget::create (DWORD wStyle, RECT ¤tPos, CFormDialog *parent, u // Create the mem combobox parent->setEditSize (currentPos, parent->IconHeight, parent->IconHeight); - Icon.create (WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index); + Icon.create (WS_CHILD|WS_VISIBLE|WS_TABSTOP, currentPos, parent, dialog_index ? dialog_index : 0xFFFE); parent->initWidget (Icon); parent->getNextPos (currentPos);