mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(glue): partially implement CCharacterCreation::CreateComponent
This commit is contained in:
parent
5ea18cc298
commit
84fea67268
@ -1,6 +1,9 @@
|
||||
#include "glue/CCharacterCreation.hpp"
|
||||
#include "component/CCharacterComponent.hpp"
|
||||
#include "component/Types.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "glue/CGlueLoading.hpp"
|
||||
#include "object/client/Player_C.hpp"
|
||||
#include "ui/simple/CSimpleModelFFX.hpp"
|
||||
|
||||
CCharacterComponent* CCharacterCreation::s_character;
|
||||
@ -14,6 +17,60 @@ void CCharacterCreation::CalcClasses(int32_t raceID) {
|
||||
}
|
||||
|
||||
void CCharacterCreation::CreateComponent(ComponentData* data, bool randomize) {
|
||||
auto modelData = Player_C_GetModelName(data->raceID, data->sexID);
|
||||
|
||||
if (!modelData || !modelData->m_modelName) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto existingComponent = CCharacterCreation::s_character;
|
||||
|
||||
if (existingComponent) {
|
||||
auto model = existingComponent->m_data.model;
|
||||
|
||||
if (model->m_attachParent) {
|
||||
model->DetachFromParent();
|
||||
}
|
||||
|
||||
// TODO CCharacterComponent::FreeComponent(existingComponent);
|
||||
}
|
||||
|
||||
CCharacterCreation::s_character = CCharacterComponent::AllocComponent();
|
||||
|
||||
auto scene = CCharacterCreation::s_charCustomizeFrame->GetScene();
|
||||
auto model = scene->CreateModel(modelData->m_modelName, 0);
|
||||
data->model = model;
|
||||
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO lighting
|
||||
|
||||
data->model->SetBoneSequence(-1, 0, 0, 0, 1.0f, 1, 1);
|
||||
|
||||
data->flags |= 0x2;
|
||||
|
||||
CCharacterCreation::s_character->Init(data, nullptr);
|
||||
|
||||
if (randomize) {
|
||||
// TODO select random variations
|
||||
}
|
||||
|
||||
// TODO track previous variations
|
||||
|
||||
// TODO set facing
|
||||
|
||||
CCharacterCreation::Dress();
|
||||
|
||||
CCharacterCreation::s_character->RenderPrep(0);
|
||||
|
||||
if (CCharacterCreation::s_charCustomizeFrame->m_model) {
|
||||
model->AttachToParent(CCharacterCreation::s_charCustomizeFrame->m_model, 0, nullptr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void CCharacterCreation::Dress() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@ -24,6 +81,8 @@ int32_t CCharacterCreation::GetRandomClassID() {
|
||||
|
||||
void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
|
||||
// TODO
|
||||
data->raceID = 1;
|
||||
data->sexID = UNITSEX_MALE;
|
||||
}
|
||||
|
||||
void CCharacterCreation::ResetCharCustomizeInfo() {
|
||||
|
||||
@ -19,6 +19,7 @@ class CCharacterCreation {
|
||||
// Static functions
|
||||
static void CalcClasses(int32_t raceID);
|
||||
static void CreateComponent(ComponentData* data, bool randomize);
|
||||
static void Dress();
|
||||
static int32_t GetRandomClassID();
|
||||
static void GetRandomRaceAndSex(ComponentData* data);
|
||||
static void ResetCharCustomizeInfo();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user