mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
feat(glue): implement CCharacterSelection::ShowCharacter
This commit is contained in:
parent
cc2701986b
commit
01190b65ca
18
src/glue/CCharacterComponent.cpp
Normal file
18
src/glue/CCharacterComponent.cpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "glue/CCharacterComponent.hpp"
|
||||||
|
#include "model/CM2Model.hpp"
|
||||||
|
#include <storm/Memory.hpp>
|
||||||
|
|
||||||
|
CCharacterComponent* CCharacterComponent::AllocComponent() {
|
||||||
|
// TODO ObjectAlloc
|
||||||
|
return STORM_NEW(CCharacterComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacterComponent::Init(ComponentData* data, const char* a3) {
|
||||||
|
if (data->model) {
|
||||||
|
data->model->Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->m_data = *data;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
34
src/glue/CCharacterComponent.hpp
Normal file
34
src/glue/CCharacterComponent.hpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef GLUE_C_CHARACTER_COMPONENT_HPP
|
||||||
|
#define GLUE_C_CHARACTER_COMPONENT_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 skinID = 0;
|
||||||
|
int32_t faceID = 0;
|
||||||
|
int32_t facialHairStyleID = 0;
|
||||||
|
int32_t hairStyleID = 0;
|
||||||
|
CM2Model* model = nullptr;
|
||||||
|
uint32_t flags = 0x0;
|
||||||
|
uint8_t byte28 = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CCharacterComponent {
|
||||||
|
public:
|
||||||
|
// Static functions
|
||||||
|
static CCharacterComponent* AllocComponent();
|
||||||
|
|
||||||
|
// Member variables
|
||||||
|
ComponentData m_data;
|
||||||
|
|
||||||
|
// Member functions
|
||||||
|
void Init(ComponentData* data, const char* a3);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -1,10 +1,13 @@
|
|||||||
#include "glue/CCharacterSelection.hpp"
|
#include "glue/CCharacterSelection.hpp"
|
||||||
#include "client/ClientServices.hpp"
|
#include "client/ClientServices.hpp"
|
||||||
|
#include "db/Db.hpp"
|
||||||
|
#include "glue/CCharacterComponent.hpp"
|
||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
#include "glue/CRealmList.hpp"
|
#include "glue/CRealmList.hpp"
|
||||||
#include "glue/Types.hpp"
|
#include "glue/Types.hpp"
|
||||||
#include "model/CM2Shared.hpp"
|
#include "model/CM2Shared.hpp"
|
||||||
#include "net/Connection.hpp"
|
#include "net/Connection.hpp"
|
||||||
|
#include "object/client/Player_C.hpp"
|
||||||
#include "ui/CSimpleModelFFX.hpp"
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
|
|
||||||
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
||||||
@ -109,6 +112,65 @@ void CCharacterSelection::SetFacing(float facing) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterSelection::ShowCharacter() {
|
void CCharacterSelection::ShowCharacter() {
|
||||||
|
if (CCharacterSelection::s_selectionIndex < 0 || CCharacterSelection::s_selectionIndex >= CCharacterSelection::s_characterList.Count()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharacterSelection::ClearCharacterModel();
|
||||||
|
|
||||||
|
CCharacterSelection::s_charFacing = 0.0f;
|
||||||
|
|
||||||
|
auto character = &CCharacterSelection::s_characterList[CCharacterSelection::s_selectionIndex];
|
||||||
|
|
||||||
|
if (character->component) {
|
||||||
|
auto parent = CCharacterSelection::s_modelFrame->m_model;
|
||||||
|
|
||||||
|
if (!parent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto characterModel = character->component->m_data.model;
|
||||||
|
auto petModel = character->petModel;
|
||||||
|
|
||||||
|
characterModel->AttachToParent(parent, 0, nullptr, 0);
|
||||||
|
|
||||||
|
CCharacterSelection::SetFacing(0.0f);
|
||||||
|
|
||||||
|
if (petModel) {
|
||||||
|
petModel->AttachToParent(parent, 1, nullptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO CGlueLoading::StartLoad(&character->component, 0);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto modelData = Player_C_GetModelName(character->info.raceID, character->info.sexID);
|
||||||
|
if (!modelData || !modelData->m_modelName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
character->component = CCharacterComponent::AllocComponent();
|
||||||
|
|
||||||
|
ComponentData componentData = {};
|
||||||
|
componentData.raceID = character->info.raceID;
|
||||||
|
componentData.sexID = character->info.sexID;
|
||||||
|
componentData.skinID = character->info.skinID;
|
||||||
|
componentData.faceID = character->info.faceID;
|
||||||
|
componentData.hairStyleID = character->info.hairStyleID;
|
||||||
|
componentData.hairColorID = character->info.hairColorID;
|
||||||
|
componentData.facialHairStyleID = character->info.facialHairStyleID;
|
||||||
|
|
||||||
|
auto scene = CCharacterSelection::s_modelFrame->GetScene();
|
||||||
|
auto model = scene->CreateModel(modelData->m_modelName, 0);
|
||||||
|
|
||||||
|
componentData.flags |= 0x2;
|
||||||
|
componentData.model = model;
|
||||||
|
|
||||||
|
character->component->Init(&componentData, nullptr);
|
||||||
|
|
||||||
|
// TODO lighting callback/arg
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,10 +4,14 @@
|
|||||||
#include "net/Types.hpp"
|
#include "net/Types.hpp"
|
||||||
#include <storm/Array.hpp>
|
#include <storm/Array.hpp>
|
||||||
|
|
||||||
|
class CCharacterComponent;
|
||||||
|
class CM2Model;
|
||||||
class CSimpleModelFFX;
|
class CSimpleModelFFX;
|
||||||
|
|
||||||
struct CharacterSelectionDisplay {
|
struct CharacterSelectionDisplay {
|
||||||
CHARACTER_INFO info;
|
CHARACTER_INFO info;
|
||||||
|
CCharacterComponent* component = nullptr;
|
||||||
|
CM2Model* petModel = nullptr;
|
||||||
// TODO
|
// TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user