diff --git a/src/component/CCharacterComponent.cpp b/src/component/CCharacterComponent.cpp index a967636..3ede2c8 100644 --- a/src/component/CCharacterComponent.cpp +++ b/src/component/CCharacterComponent.cpp @@ -83,6 +83,10 @@ void CCharacterComponent::Init(ComponentData* data, const char* a3) { this->m_data = *data; // TODO + + this->SetSkinColor(this->m_data.skinColorID, false, true, a3); + + // TODO } int32_t CCharacterComponent::ItemsLoaded(int32_t a2) { @@ -91,6 +95,10 @@ int32_t CCharacterComponent::ItemsLoaded(int32_t a2) { return 1; } +void CCharacterComponent::LoadBaseVariation(COMPONENT_VARIATIONS sectionIndex, int32_t textureIndex, int32_t variationIndex, int32_t colorIndex, COMPONENT_SECTIONS section, const char* a7) { + // TODO +} + void CCharacterComponent::PrepSections() { // TODO } @@ -143,6 +151,65 @@ void CCharacterComponent::RenderPrepSections() { s_bInRenderPrep = 0; } +void CCharacterComponent::ReplaceExtraSkinTexture(const char* a2) { + // TODO +} + +void CCharacterComponent::SetFace(int32_t faceID, bool a3, const char* a4) { + // TODO +} + +void CCharacterComponent::SetSkinColor(int32_t skinColorID, bool a3, bool a4, const char* a5) { + bool isNPC = this->m_data.flags & 0x1; + + this->m_data.skinColorID = skinColorID; + + if (isNPC) { + return; + } + + if (!ComponentValidateBase(CCharacterComponent::s_chrVarArray, this->m_data.raceID, this->m_data.sexID, VARIATION_SKIN, 0, skinColorID)) { + return; + } + + auto numColors = ComponentGetNumColors( + CCharacterComponent::s_chrVarArray, + this->m_data.raceID, + this->m_data.sexID, + VARIATION_SKIN, + 0 + ); + + auto sectionsRec = ComponentGetSectionsRecord( + CCharacterComponent::s_chrVarArray, + this->m_data.raceID, + this->m_data.sexID, + VARIATION_SKIN, + 0, + skinColorID, + nullptr + ); + + if (skinColorID < numColors && sectionsRec && !(sectionsRec->m_flags & 0x8)) { + // TODO underwear + } + + this->ReplaceExtraSkinTexture(a5); + + this->LoadBaseVariation( + VARIATION_SKIN, + 0, + 0, + this->m_data.skinColorID, + SECTION_TORSO_UPPER, + a5 + ); + + this->SetFace(this->m_data.faceID, a3, a5); + + // TODO +} + int32_t CCharacterComponent::VariationsLoaded(int32_t a2) { // TODO diff --git a/src/component/CCharacterComponent.hpp b/src/component/CCharacterComponent.hpp index fab85d5..480349e 100644 --- a/src/component/CCharacterComponent.hpp +++ b/src/component/CCharacterComponent.hpp @@ -69,9 +69,13 @@ class CCharacterComponent { CharSectionsRec* GetSectionsRecord(COMPONENT_VARIATIONS sectionIndex, int32_t variationIndex, int32_t colorIndex, bool* found); void 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(); int32_t RenderPrep(int32_t a2); void RenderPrepSections(); + void ReplaceExtraSkinTexture(const char* a2); + void SetFace(int32_t faceID, bool a3, const char* a4); + void SetSkinColor(int32_t skinColorID, bool a3, bool a4, const char* a5); int32_t VariationsLoaded(int32_t a2); };