feat(component): populate facial hair styles list on initialize

This commit is contained in:
fallenoak 2025-10-27 21:38:18 -05:00
parent 47aea9966b
commit 0c584ee901
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
4 changed files with 24 additions and 1 deletions

View File

@ -11,6 +11,7 @@
#include <storm/Memory.hpp>
#include <storm/String.hpp>
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) {

View File

@ -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;

View File

@ -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<uint32_t*>(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;
}

View File

@ -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