feat(glue): implement Script_ResetCharCustomize

This commit is contained in:
fallenoak 2025-12-28 22:12:48 -06:00
parent 35941bb74c
commit 5ea18cc298
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
3 changed files with 76 additions and 1 deletions

View File

@ -1,3 +1,60 @@
#include "glue/CCharacterCreation.hpp" #include "glue/CCharacterCreation.hpp"
#include "component/Types.hpp"
#include "glue/CGlueLoading.hpp"
#include "ui/simple/CSimpleModelFFX.hpp"
CCharacterComponent* CCharacterCreation::s_character;
CSimpleModelFFX* CCharacterCreation::s_charCustomizeFrame; CSimpleModelFFX* CCharacterCreation::s_charCustomizeFrame;
int32_t CCharacterCreation::s_existingCharacterIndex;
int32_t CCharacterCreation::s_raceIndex;
int32_t CCharacterCreation::s_selectedClassID;
void CCharacterCreation::CalcClasses(int32_t raceID) {
// TODO
}
void CCharacterCreation::CreateComponent(ComponentData* data, bool randomize) {
// TODO
}
int32_t CCharacterCreation::GetRandomClassID() {
// TODO
return 1;
}
void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
// TODO
}
void CCharacterCreation::ResetCharCustomizeInfo() {
if (!CCharacterCreation::s_charCustomizeFrame) {
return;
}
CCharacterCreation::s_existingCharacterIndex = -1;
auto model = CCharacterCreation::s_charCustomizeFrame->m_model;
if (model) {
model->DetachAllChildrenById(0);
}
ComponentData data;
CCharacterCreation::GetRandomRaceAndSex(&data);
CCharacterCreation::CalcClasses(data.raceID);
CCharacterCreation::CreateComponent(&data, true);
CCharacterCreation::SetSelectedClass(CCharacterCreation::GetRandomClassID());
data.classID = CCharacterCreation::s_selectedClassID;
CCharacterCreation::s_raceIndex = -1;
// TODO race and name gen stuff
CGlueLoading::StartLoad(CCharacterCreation::s_character, true);
}
void CCharacterCreation::SetSelectedClass(int32_t classID) {
// TODO
}

View File

@ -1,12 +1,28 @@
#ifndef GLUE_C_CHARACTER_CREATION_HPP #ifndef GLUE_C_CHARACTER_CREATION_HPP
#define GLUE_C_CHARACTER_CREATION_HPP #define GLUE_C_CHARACTER_CREATION_HPP
#include <cstdint>
class CCharacterComponent;
class CSimpleModelFFX; class CSimpleModelFFX;
struct ComponentData;
class CCharacterCreation { class CCharacterCreation {
public: public:
// Static variables // Static variables
static CCharacterComponent* s_character;
static CSimpleModelFFX* s_charCustomizeFrame; static CSimpleModelFFX* s_charCustomizeFrame;
static int32_t s_existingCharacterIndex;
static int32_t s_raceIndex;
static int32_t s_selectedClassID;
// Static functions
static void CalcClasses(int32_t raceID);
static void CreateComponent(ComponentData* data, bool randomize);
static int32_t GetRandomClassID();
static void GetRandomRaceAndSex(ComponentData* data);
static void ResetCharCustomizeInfo();
static void SetSelectedClass(int32_t classID);
}; };
#endif #endif

View File

@ -28,7 +28,9 @@ int32_t Script_SetCharCustomizeBackground(lua_State* L) {
} }
int32_t Script_ResetCharCustomize(lua_State* L) { int32_t Script_ResetCharCustomize(lua_State* L) {
WHOA_UNIMPLEMENTED(0); CCharacterCreation::ResetCharCustomizeInfo();
return 0;
} }
int32_t Script_GetNameForRace(lua_State* L) { int32_t Script_GetNameForRace(lua_State* L) {