diff --git a/src/component/CCharacterComponent.cpp b/src/component/CCharacterComponent.cpp index f53cb90..1f34f79 100644 --- a/src/component/CCharacterComponent.cpp +++ b/src/component/CCharacterComponent.cpp @@ -11,6 +11,7 @@ #include #include +uint32_t* CCharacterComponent::s_characterFacialHairStylesList; st_race* CCharacterComponent::s_chrVarArray; uint32_t CCharacterComponent::s_chrVarArrayLength; EGxTexFormat CCharacterComponent::s_gxFormat; @@ -156,7 +157,7 @@ void CCharacterComponent::InitDbData() { CCharacterComponent::s_chrVarArrayLength = varArrayLength; BuildComponentArray(varArrayLength, &CCharacterComponent::s_chrVarArray); - // TODO CountFacialFeatures(varArrayLength, &CCharacterComponent::s_characterFacialHairStylesList); + CountFacialFeatures(varArrayLength, &CCharacterComponent::s_characterFacialHairStylesList); } void CCharacterComponent::Paste(void* srcTexture, MipBits* dstMips, const C2iVector& dstPos, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel) { diff --git a/src/component/CCharacterComponent.hpp b/src/component/CCharacterComponent.hpp index c9cdefe..563b035 100644 --- a/src/component/CCharacterComponent.hpp +++ b/src/component/CCharacterComponent.hpp @@ -30,6 +30,7 @@ struct ComponentItemDisplay { class CCharacterComponent { public: // Static variables + static uint32_t* s_characterFacialHairStylesList; static st_race* s_chrVarArray; static uint32_t s_chrVarArrayLength; static EGxTexFormat s_gxFormat; diff --git a/src/component/Util.cpp b/src/component/Util.cpp index 1d22f58..18e7a41 100644 --- a/src/component/Util.cpp +++ b/src/component/Util.cpp @@ -197,3 +197,22 @@ int32_t ComponentValidateBase(st_race* varArray, int32_t raceId, int32_t sexId, return 1; } + +int32_t CountFacialFeatures(uint32_t varArrayLength, uint32_t** featuresListPtr) { + auto featuresList = static_cast(STORM_ALLOC_ZERO(sizeof(uint32_t) * varArrayLength)); + + if (g_characterFacialHairStylesDB.GetNumRecords() <= 0) { + *featuresListPtr = featuresList; + + return 1; + } + + for (int32_t i = 0; i < g_characterFacialHairStylesDB.GetNumRecords(); i++) { + auto facialHairStyleRec = g_characterFacialHairStylesDB.GetRecordByIndex(i); + auto listIndex = facialHairStyleRec->m_raceID * 2 + facialHairStyleRec->m_sexID; + + featuresList[listIndex]++; + } + + return 0; +} diff --git a/src/component/Util.hpp b/src/component/Util.hpp index 4c84802..d91c445 100644 --- a/src/component/Util.hpp +++ b/src/component/Util.hpp @@ -37,4 +37,6 @@ CharSectionsRec* ComponentGetSectionsRecord(st_race* varArray, int32_t raceId, i int32_t ComponentValidateBase(st_race* varArray, int32_t raceId, int32_t sexId, COMPONENT_VARIATIONS sectionIndex, int32_t variationIndex, int32_t colorIndex); +int32_t CountFacialFeatures(uint32_t varArrayLength, uint32_t** featuresListPtr); + #endif