diff --git a/src/component/CCharacterComponent.cpp b/src/component/CCharacterComponent.cpp index 1c755ae..9e33580 100644 --- a/src/component/CCharacterComponent.cpp +++ b/src/component/CCharacterComponent.cpp @@ -200,12 +200,10 @@ void CCharacterComponent::AddLink(CM2Model* parent, GEOCOMPONENTLINKS link, char parent->DetachAllChildrenById(link); model->AttachToParent(parent, link, nullptr, 0); - // Add link point - if (link == ATTACH_HANDR) { - // TODO CCharacterComponent::AddLinkpt(parent, 0); + CCharacterComponent::ComponentCloseFingers(parent, HAND_RIGHT); } else if (link == ATTACH_HANDL) { - // TODO CCharacterComponent::AddLinkpt(parent, 1); + CCharacterComponent::ComponentCloseFingers(parent, HAND_LEFT); } // Replace item particle color @@ -229,6 +227,23 @@ CCharacterComponent* CCharacterComponent::AllocComponent() { return component; } +void CCharacterComponent::ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot) { + uint32_t firstBone; + uint32_t lastBone; + + if (handSlot == HAND_LEFT) { + firstBone = 13; + lastBone = 17; + } else { + firstBone = 8; + lastBone = 12; + } + + for (uint32_t boneId = firstBone; boneId <= lastBone; boneId++) { + model->SetBoneSequence(boneId, 15, 0xFFFFFFFF, 0, 1.0f, 0, 1); + } +} + HTEXTURE CCharacterComponent::CreateTexture(const char* fileName, CStatus* status) { auto texFlags = CGxTexFlags(GxTex_LinearMipNearest, 0, 0, 0, 0, 0, 1); return TextureCreate(fileName, texFlags, status, 0); diff --git a/src/component/CCharacterComponent.hpp b/src/component/CCharacterComponent.hpp index 51cc780..80ca96e 100644 --- a/src/component/CCharacterComponent.hpp +++ b/src/component/CCharacterComponent.hpp @@ -50,6 +50,7 @@ class CCharacterComponent { static int32_t AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t a8); static void AddLink(CM2Model* parent, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t visualID, const ItemDisplayInfoRec* displayRec); static CCharacterComponent* AllocComponent(); + static void ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot); static HTEXTURE CreateTexture(const char* fileName, CStatus* status); static GEOCOMPONENTLINKS GetSheatheLink(SHEATHE_TYPE sheatheType, bool a2); static void Initialize(); diff --git a/src/component/Types.hpp b/src/component/Types.hpp index ca2f575..951ae43 100644 --- a/src/component/Types.hpp +++ b/src/component/Types.hpp @@ -6,6 +6,11 @@ class CM2Model; +enum COMP_HAND_SLOT { + HAND_RIGHT = 0, + HAND_LEFT = 1, +}; + enum COMPONENT_GEOSET { GEOSET_HEAD = 0, GEOSET_BEARD = 1,