chore(component): move ComponentData::GetPreferences to appropriate location

This commit is contained in:
fallenoak 2025-12-30 15:06:06 -06:00
parent c6110b561e
commit 01d0268d5c
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
6 changed files with 67 additions and 52 deletions

View File

@ -1048,21 +1048,6 @@ void CCharacterComponent::GeosRenderPrep() {
this->m_flags &= ~0x4;
}
void CCharacterComponent::GetPreferences(CharacterPreferences* preferences) {
if (!preferences) {
return;
}
preferences->raceID = this->m_data.raceID;
preferences->sexID = this->m_data.sexID;
preferences->classID = this->m_data.classID;
preferences->hairColorID = this->m_data.hairColorID;
preferences->skinColorID = this->m_data.skinColorID;
preferences->faceID = this->m_data.faceID;
preferences->facialHairStyleID = this->m_data.facialHairStyleID;
preferences->hairStyleID = this->m_data.hairStyleID;
}
CharSectionsRec* CCharacterComponent::GetSectionsRecord(COMPONENT_VARIATIONS sectionIndex, int32_t variationIndex, int32_t colorIndex, bool* found) {
return ComponentGetSectionsRecord(
CCharacterComponent::s_chrVarArray,

View File

@ -1,6 +1,7 @@
#ifndef COMPONENT_C_CHARACTER_COMPONENT_HPP
#define COMPONENT_C_CHARACTER_COMPONENT_HPP
#include "component/ComponentData.hpp"
#include "component/Types.hpp"
#include "gx/Texture.hpp"
#include "object/Types.hpp"
@ -87,7 +88,6 @@ class CCharacterComponent {
void CreateBaseTexture();
void* CreateTexture(const ItemDisplayInfoRec* displayRec, int32_t section);
void GeosRenderPrep();
void GetPreferences(CharacterPreferences* preferences);
CharSectionsRec* GetSectionsRecord(COMPONENT_VARIATIONS sectionIndex, int32_t variationIndex, int32_t colorIndex, bool* found);
int32_t Init(ComponentData* data, const char* a3);
int32_t ItemsLoaded(int32_t a2);

View File

@ -0,0 +1,17 @@
#include "component/ComponentData.hpp"
#include "component/Types.hpp"
void ComponentData::GetPreferences(CharacterPreferences* preferences) {
if (!preferences) {
return;
}
preferences->raceID = this->raceID;
preferences->sexID = this->sexID;
preferences->classID = this->classID;
preferences->hairColorID = this->hairColorID;
preferences->skinColorID = this->skinColorID;
preferences->faceID = this->faceID;
preferences->facialHairStyleID = this->facialHairStyleID;
preferences->hairStyleID = this->hairStyleID;
}

View File

@ -0,0 +1,48 @@
#ifndef COMPONENT_COMPONENT_DATA_HPP
#define COMPONENT_COMPONENT_DATA_HPP
#include "component/Types.hpp"
#include <storm/String.hpp>
#include <cstdint>
class CM2Model;
struct ComponentData {
int32_t raceID = 0;
int32_t sexID = 0;
int32_t classID = 0;
int32_t hairColorID = 0;
int32_t skinColorID = 0;
int32_t faceID = 0;
int32_t facialHairStyleID = 0;
int32_t hairStyleID = 0;
CM2Model* model = nullptr;
uint32_t flags = 0x0;
char npcBakedTexturePath[STORM_MAX_PATH] = { '\0' };
uint32_t geosets[NUM_GEOSET] = {
001,
101,
201,
301,
401,
501,
601,
702,
801,
901,
1001,
1101,
1201,
1301,
1401,
1501,
1601,
1701,
1801,
};
void GetPreferences(CharacterPreferences* preferences);
};
#endif

View File

@ -102,40 +102,4 @@ struct CharacterPreferences {
int32_t hairStyleID;
};
struct ComponentData {
int32_t raceID = 0;
int32_t sexID = 0;
int32_t classID = 0;
int32_t hairColorID = 0;
int32_t skinColorID = 0;
int32_t faceID = 0;
int32_t facialHairStyleID = 0;
int32_t hairStyleID = 0;
CM2Model* model = nullptr;
uint32_t flags = 0x0;
char npcBakedTexturePath[STORM_MAX_PATH] = { '\0' };
uint32_t geosets[NUM_GEOSET] = {
001,
101,
201,
301,
401,
501,
601,
702,
801,
901,
1001,
1101,
1201,
1301,
1401,
1501,
1601,
1701,
1801,
};
};
#endif

View File

@ -1,4 +1,5 @@
#include "component/Util.hpp"
#include "component/ComponentData.hpp"
#include "component/Types.hpp"
#include "db/Db.hpp"
#include "object/Types.hpp"