feat(component): add CCharacterComponent::SetBeardStyle

This commit is contained in:
fallenoak 2025-10-27 22:14:57 -05:00
parent 29535710fe
commit 95c89c50b9
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 48 additions and 3 deletions

View File

@ -714,7 +714,7 @@ CharSectionsRec* CCharacterComponent::GetSectionsRecord(COMPONENT_VARIATIONS sec
);
}
void CCharacterComponent::Init(ComponentData* data, const char* a3) {
int32_t CCharacterComponent::Init(ComponentData* data, const char* a3) {
if (data->model) {
data->model->Release();
}
@ -725,8 +725,9 @@ void CCharacterComponent::Init(ComponentData* data, const char* a3) {
this->SetSkinColor(this->m_data.skinColorID, false, true, a3);
this->SetHairStyle(this->m_data.hairStyleID, a3);
this->SetBeardStyle(this->m_data.facialHairStyleID, false, a3);
// TODO
return 1;
}
int32_t CCharacterComponent::ItemsLoaded(int32_t a2) {
@ -874,6 +875,49 @@ void CCharacterComponent::ReplaceHairTexture(int32_t hairStyleID, const char* a3
}
}
void CCharacterComponent::SetBeardStyle(int32_t facialHairStyleID, bool a3, const char* a4) {
auto listIndex = this->m_data.raceID * 2 + this->m_data.sexID;
if (facialHairStyleID < 0 || facialHairStyleID > CCharacterComponent::s_characterFacialHairStylesList[listIndex]) {
return;
}
this->m_data.facialHairStyleID = facialHairStyleID;
auto facialHairStyleRec = ComponentGetFacialHairStyleRecord(&this->m_data);
if (facialHairStyleRec) {
this->m_data.geosets[1] = 100 + facialHairStyleRec->m_geoset[0];
this->m_data.geosets[2] = 200 + facialHairStyleRec->m_geoset[2];
this->m_data.geosets[3] = 300 + facialHairStyleRec->m_geoset[1];
this->m_data.geosets[16] = 1600 + facialHairStyleRec->m_geoset[3];
this->m_data.geosets[17] = 1700 + facialHairStyleRec->m_geoset[4];
this->m_flags |= 0x4;
if (
(facialHairStyleRec->m_geoset[0] || facialHairStyleRec->m_geoset[1] || facialHairStyleRec->m_geoset[2])
&& (!this->m_texture[TEXTURE_INDEX(VARIATION_HAIR, 1)] || !this->m_texture[TEXTURE_INDEX(VARIATION_HAIR, 2)])
) {
this->ReplaceHairTexture(1, a4);
}
}
bool isNPC = this->m_data.flags & 0x1;
if (!isNPC) {
if (a3) {
this->LoadBaseVariation(VARIATION_FACIAL_HAIR, 0, this->m_data.facialHairStyleID, this->m_data.hairColorID, SECTION_HEAD_LOWER, a4);
this->LoadBaseVariation(VARIATION_FACIAL_HAIR, 1, this->m_data.facialHairStyleID, this->m_data.hairColorID, SECTION_HEAD_UPPER, a4);
}
this->m_sectionDirty |= (1 << SECTION_HEAD_LOWER) | (1 << SECTION_HEAD_UPPER);
// TODO component request logic
this->m_flags &= ~0x8;
}
}
void CCharacterComponent::SetFace(int32_t faceID, bool a3, const char* a4) {
bool isNPC = this->m_data.flags & 0x1;

View File

@ -81,7 +81,7 @@ class CCharacterComponent {
void CreateBaseTexture();
void GeosRenderPrep();
CharSectionsRec* GetSectionsRecord(COMPONENT_VARIATIONS sectionIndex, int32_t variationIndex, int32_t colorIndex, bool* found);
void Init(ComponentData* data, const char* a3);
int32_t Init(ComponentData* data, const char* a3);
int32_t ItemsLoaded(int32_t a2);
void LoadBaseVariation(COMPONENT_VARIATIONS sectionIndex, int32_t textureIndex, int32_t variationIndex, int32_t colorIndex, COMPONENT_SECTIONS section, const char* a7);
void PrepSections();
@ -90,6 +90,7 @@ class CCharacterComponent {
void RenderPrepSections();
void ReplaceExtraSkinTexture(const char* a2);
void ReplaceHairTexture(int32_t hairStyleID, const char* a3);
void SetBeardStyle(int32_t facialHairStyleID, bool a3, const char* a4);
void SetFace(int32_t faceID, bool a3, const char* a4);
void SetHairColor(int32_t hairColorID, bool a3, const char* a4);
void SetHairStyle(int32_t hairStyleID, const char* a3);