mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2026-11-21 05:24:32 +03:00
feat(glue): implement methods of CCharacterCreation
This commit is contained in:
1 parent
b4ff9994e2
commit
03cb7e699e
5 files changed
+207
-16
No files matched your search
@@ -110,6 +110,9 @@ void CCharacterComponent::FreeComponent(CCharacterComponent* component) {
|
||||
// TODO: ObjectFree()
|
||||
}
|
||||
|
||||
void CCharacterComponent::ValidateComponentData(ComponentData* data, COMPONENT_CONTEXT context) {
|
||||
}
|
||||
|
||||
CCharacterComponent::CCharacterComponent() {
|
||||
}
|
||||
|
||||
@@ -135,3 +138,7 @@ bool CCharacterComponent::Init(ComponentData* data, const char* a3) {
|
||||
this->m_data = *data;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CCharacterComponent::RenderPrep(int32_t a2) {
|
||||
// TODO
|
||||
}
|
||||
@@ -42,6 +42,7 @@ class CCharacterComponent {
|
||||
static void Initialize(EGxTexFormat format, uint32_t mipLevels, int32_t useThreads, int32_t useCompression);
|
||||
static CCharacterComponent* AllocComponent();
|
||||
static void FreeComponent(CCharacterComponent* component);
|
||||
static void ValidateComponentData(ComponentData* data, COMPONENT_CONTEXT context = DEFAULT_CONTEXT);
|
||||
|
||||
CCharacterComponent();
|
||||
~CCharacterComponent();
|
||||
@@ -53,6 +54,7 @@ class CCharacterComponent {
|
||||
void SetRandomFacialFeature(COMPONENT_CONTEXT context = DEFAULT_CONTEXT);
|
||||
|
||||
bool Init(ComponentData* data, const char* a3);
|
||||
void RenderPrep(int32_t a2);
|
||||
|
||||
public:
|
||||
uint32_t m_handle;
|
||||
|
||||
@@ -93,7 +93,9 @@ void CCharacterCreation::ResetCharCustomizeInfo() {
|
||||
CCharacterCreation::CalcClasses(data.m_info.raceID);
|
||||
CCharacterCreation::InitCharacterComponent(&data, 1);
|
||||
|
||||
// TODO
|
||||
CCharacterCreation::SetSelectedClass(CCharacterCreation::GetRandomClassID());
|
||||
|
||||
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
||||
|
||||
CCharacterCreation::m_raceIndex = -1;
|
||||
for (uint32_t i = 0; i < CCharacterCreation::m_races.Count(); ++i) {
|
||||
@@ -103,7 +105,7 @@ void CCharacterCreation::ResetCharCustomizeInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
// TODO: CNameGen::LoadNames
|
||||
}
|
||||
|
||||
void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
|
||||
@@ -193,5 +195,63 @@ void CCharacterCreation::SetSelectedSex(int32_t sexID) {
|
||||
}
|
||||
|
||||
void CCharacterCreation::SetSelectedClass(int32_t classID) {
|
||||
if (!CCharacterCreation::IsClassValid(classID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CCharacterCreation::m_selectedClassID = classID;
|
||||
ComponentData data;
|
||||
data.m_info = CCharacterCreation::m_character->m_data.m_info;
|
||||
data.m_info.classID = classID;
|
||||
CCharacterComponent::ValidateComponentData(&data);
|
||||
CCharacterCreation::InitCharacterComponent(&data, 0);
|
||||
// TODO: sub_4E0FD0
|
||||
// TODO: sub_4E6AE0((int)CCharacterCreation::m_character, 1);
|
||||
}
|
||||
|
||||
void CCharacterCreation::CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterCreation::RandomizeCharCustomization() {
|
||||
CCharacterCreation::RandomizeCharFeatures();
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterCreation::SetCharFacing(float facing) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterCreation::CreateCharacter(const char* name) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterCreation::SetToExistingCharacter(uint32_t index) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
int32_t CCharacterCreation::IsRaceClassValid(int32_t raceID, int32_t classID) {
|
||||
for (int32_t i = 0; i < g_charBaseInfoDB.GetNumRecords(); ++i) {
|
||||
auto record = g_charBaseInfoDB.GetRecordByIndex(i);
|
||||
if (record && record->m_raceID == raceID && record->m_classID == classID) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t CCharacterCreation::IsClassValid(int32_t classID) {
|
||||
for (uint32_t i = 0; i < CCharacterCreation::m_classes.Count(); i) {
|
||||
auto record = CCharacterCreation::m_classes[i];
|
||||
if (record && record->m_ID == classID) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t CCharacterCreation::GetRandomClassID() {
|
||||
return 1;
|
||||
}
|
||||
@@ -13,6 +13,15 @@ class ChrClassesRec;
|
||||
|
||||
|
||||
class CCharacterCreation {
|
||||
public:
|
||||
enum CHAR_CUSTOMIZATION_TYPE {
|
||||
CHAR_CUSTOMIZATION_SKIN = 0,
|
||||
CHAR_CUSTOMIZATION_FACE = 1,
|
||||
CHAR_CUSTOMIZATION_HAIR_STYLE = 2,
|
||||
CHAR_CUSTOMIZATION_HAIR_COLOR = 3,
|
||||
CHAR_CUSTOMIZATION_FACIAL_FEATURE = 4
|
||||
};
|
||||
|
||||
public:
|
||||
// Static variables
|
||||
static int32_t m_selectedClassID;
|
||||
@@ -41,6 +50,14 @@ class CCharacterCreation {
|
||||
static void SetSelectedRace(int32_t raceID);
|
||||
static void SetSelectedSex(int32_t sexID);
|
||||
static void SetSelectedClass(int32_t classID);
|
||||
static void CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta);
|
||||
static void RandomizeCharCustomization();
|
||||
static void SetCharFacing(float facing);
|
||||
static void CreateCharacter(const char* name);
|
||||
static void SetToExistingCharacter(uint32_t index);
|
||||
static int32_t IsRaceClassValid(int32_t raceID, int32_t classID);
|
||||
static int32_t IsClassValid(int32_t classID);
|
||||
static int32_t GetRandomClassID();
|
||||
};
|
||||
|
||||
#endif // GLUE_C_CHARACTER_CREATION_HPP
|
||||
Reference in new issue
Block a user