From 9acffa737e08ef4f9fdce023946eed6b47dc012c Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sun, 2 Nov 2025 23:34:35 -0600 Subject: [PATCH] feat(component): partially implement CCharacterComponent::AddHandItem --- src/component/CCharacterComponent.cpp | 25 ++++++++++++++++++++++++- src/component/CCharacterComponent.hpp | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/component/CCharacterComponent.cpp b/src/component/CCharacterComponent.cpp index 1e3d4fd..2c35369 100644 --- a/src/component/CCharacterComponent.cpp +++ b/src/component/CCharacterComponent.cpp @@ -99,8 +99,31 @@ CStatus s_status; #define TEXTURE_INDEX(section, texture) (3 * section + texture) -void CCharacterComponent::AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool a5, bool a6, bool a7, int32_t a8) { +int32_t CCharacterComponent::AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool a5, bool a6, bool a7, int32_t a8) { // TODO + + GEOCOMPONENTLINKS itemLink; + GEOCOMPONENTLINKS sheatheLink; + + if (invSlot == INVSLOT_MAINHAND) { + itemLink = ATTACH_HANDR; + sheatheLink = CCharacterComponent::GetSheatheLink(sheatheType, true); + } else if (invSlot == INVSLOT_OFFHAND) { + itemLink = ATTACH_HANDL; + sheatheLink = CCharacterComponent::GetSheatheLink(sheatheType, false); + } else if (invSlot == INVSLOT_RANGED) { + if (a7) { + itemLink = ATTACH_HANDR; + sheatheLink = CCharacterComponent::GetSheatheLink(sheatheType, true); + } else { + itemLink = ATTACH_HANDL; + sheatheLink = CCharacterComponent::GetSheatheLink(sheatheType, false); + } + } else { + return -1; + } + + // TODO } CCharacterComponent* CCharacterComponent::AllocComponent() { diff --git a/src/component/CCharacterComponent.hpp b/src/component/CCharacterComponent.hpp index fe59107..2415401 100644 --- a/src/component/CCharacterComponent.hpp +++ b/src/component/CCharacterComponent.hpp @@ -47,7 +47,7 @@ class CCharacterComponent { static uint32_t s_textureSize; // Static functions - static void AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool a5, bool a6, bool a7, int32_t a8); + static int32_t AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool a5, bool a6, bool a7, int32_t a8); static CCharacterComponent* AllocComponent(); static HTEXTURE CreateTexture(const char* fileName, CStatus* status); static GEOCOMPONENTLINKS GetSheatheLink(SHEATHE_TYPE sheatheType, bool a2);