feat(component): add item functions

This commit is contained in:
fallenoak 2025-10-28 22:15:11 -05:00
parent a431b30cf9
commit 794003086b
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 63 additions and 1 deletions

View File

@ -16,6 +16,7 @@ uint32_t* CCharacterComponent::s_characterFacialHairStylesList;
st_race* CCharacterComponent::s_chrVarArray;
uint32_t CCharacterComponent::s_chrVarArrayLength;
EGxTexFormat CCharacterComponent::s_gxFormat;
ITEM_FUNC CCharacterComponent::s_itemFunc[];
uint32_t CCharacterComponent::s_mipLevels;
PREP_FUNC* CCharacterComponent::s_prepFunc[];
CompSectionInfo CCharacterComponent::s_sectionInfo[];
@ -125,7 +126,16 @@ void CCharacterComponent::Initialize(EGxTexFormat textureFormat, uint32_t textur
CCharacterComponent::s_prepFunc[SECTION_HEAD_UPPER] = &CCharacterComponent::RenderPrepHU;
CCharacterComponent::s_prepFunc[SECTION_HEAD_LOWER] = &CCharacterComponent::RenderPrepHL;
// TODO
CCharacterComponent::s_itemFunc[SECTION_ARM_UPPER] = &CCharacterComponent::UpdateItemAU;
CCharacterComponent::s_itemFunc[SECTION_ARM_LOWER] = &CCharacterComponent::UpdateItemAL;
CCharacterComponent::s_itemFunc[SECTION_HAND] = &CCharacterComponent::UpdateItemHA;
CCharacterComponent::s_itemFunc[SECTION_TORSO_UPPER] = &CCharacterComponent::UpdateItemTU;
CCharacterComponent::s_itemFunc[SECTION_TORSO_LOWER] = &CCharacterComponent::UpdateItemTL;
CCharacterComponent::s_itemFunc[SECTION_LEG_UPPER] = &CCharacterComponent::UpdateItemLU;
CCharacterComponent::s_itemFunc[SECTION_LEG_LOWER] = &CCharacterComponent::UpdateItemLL;
CCharacterComponent::s_itemFunc[SECTION_FOOT] = &CCharacterComponent::UpdateItemFO;
CCharacterComponent::s_itemFunc[SECTION_HEAD_UPPER] = &CCharacterComponent::UpdateItemHU;
CCharacterComponent::s_itemFunc[SECTION_HEAD_LOWER] = &CCharacterComponent::UpdateItemHL;
// Clamp mip levels between 6 and 9
uint32_t mipLevels = std::min(std::max(textureLevel, 6u), 9u);
@ -1161,6 +1171,46 @@ void CCharacterComponent::SetSkinColor(int32_t skinColorID, bool a3, bool a4, co
this->m_flags &= ~0x8;
}
void CCharacterComponent::UpdateItemAL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
void CCharacterComponent::UpdateItemAU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
void CCharacterComponent::UpdateItemFO(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
void CCharacterComponent::UpdateItemHA(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
void CCharacterComponent::UpdateItemHL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// No item displays for head sections
}
void CCharacterComponent::UpdateItemHU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// No item displays for head sections
}
void CCharacterComponent::UpdateItemLL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
void CCharacterComponent::UpdateItemLU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
void CCharacterComponent::UpdateItemTL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
void CCharacterComponent::UpdateItemTU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update) {
// TODO
}
int32_t CCharacterComponent::UpdateItemDisplay(COMPONENT_SECTIONS section, const ItemDisplayInfoRec* newDisplayRec, int32_t priority) {
bool isNPC = this->m_data.flags & 0x1;

View File

@ -15,6 +15,7 @@ struct MipBits;
struct st_race;
struct TCTEXTUREINFO;
typedef void (CCharacterComponent::*ITEM_FUNC)(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
typedef void (PREP_FUNC)(CCharacterComponent* component);
struct CompSectionInfo {
@ -35,6 +36,7 @@ class CCharacterComponent {
static st_race* s_chrVarArray;
static uint32_t s_chrVarArrayLength;
static EGxTexFormat s_gxFormat;
static ITEM_FUNC s_itemFunc[NUM_COMPONENT_SECTIONS];
static uint32_t s_mipLevels;
static PREP_FUNC* s_prepFunc[NUM_COMPONENT_SECTIONS];
static CompSectionInfo s_sectionInfo[NUM_COMPONENT_SECTIONS];
@ -98,6 +100,16 @@ class CCharacterComponent {
void SetHairColor(int32_t hairColorID, bool a3, const char* a4);
void SetHairStyle(int32_t hairStyleID, const char* a3);
void SetSkinColor(int32_t skinColorID, bool a3, bool a4, const char* a5);
void UpdateItemAL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemAU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemFO(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemHA(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemHL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemHU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemLL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemLU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemTL(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
void UpdateItemTU(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, bool update);
int32_t UpdateItemDisplay(COMPONENT_SECTIONS section, const ItemDisplayInfoRec* newDisplayRec, int32_t priority);
int32_t VariationsLoaded(int32_t a2);
};