mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(component): populate facial hair styles list on initialize
This commit is contained in:
parent
47aea9966b
commit
0c584ee901
@ -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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user