mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-07-27 10:48:28 +03:00
Compare commits
4 Commits
838558115d
...
e7434860ff
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e7434860ff | ||
![]() |
386edba3d1 | ||
![]() |
c2c2fad400 | ||
![]() |
d955f0cbd2 |
@ -209,3 +209,9 @@ void CCharacterComponent::GeosRenderPrep(int32_t a2) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterComponent::GetInfo(CHARACTER_CREATE_INFO* info) {
|
||||||
|
if (info) {
|
||||||
|
*info = this->m_data.m_info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -60,6 +60,7 @@ class CCharacterComponent {
|
|||||||
bool Init(ComponentData* data, const char* a3);
|
bool Init(ComponentData* data, const char* a3);
|
||||||
bool RenderPrep(int32_t a2);
|
bool RenderPrep(int32_t a2);
|
||||||
void GeosRenderPrep(int32_t a2);
|
void GeosRenderPrep(int32_t a2);
|
||||||
|
void GetInfo(CHARACTER_CREATE_INFO* info);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint32_t m_handle;
|
uint32_t m_handle;
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
#include "glue/CCharacterCreation.hpp"
|
#include "glue/CCharacterCreation.hpp"
|
||||||
#include "glue/CCharacterComponent.hpp"
|
#include "glue/CCharacterComponent.hpp"
|
||||||
|
#include "glue/CCharacterSelection.hpp"
|
||||||
#include "ui/CSimpleModelFFX.hpp"
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
#include "model/CM2Model.hpp"
|
#include "model/CM2Model.hpp"
|
||||||
|
#include "model/CM2Shared.hpp"
|
||||||
#include "clientobject/Player_C.hpp"
|
#include "clientobject/Player_C.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
|
|
||||||
int32_t CCharacterCreation::m_selectedClassID;
|
int32_t CCharacterCreation::m_selectedClassID;
|
||||||
int32_t CCharacterCreation::m_existingCharacterIndex;
|
int32_t CCharacterCreation::m_existingCharacterIndex;
|
||||||
|
CHARACTER_CREATE_INFO* CCharacterCreation::m_charPreferences[44];
|
||||||
int32_t CCharacterCreation::m_raceIndex;
|
int32_t CCharacterCreation::m_raceIndex;
|
||||||
CSimpleModelFFX* CCharacterCreation::m_charCustomizeFrame;
|
CSimpleModelFFX* CCharacterCreation::m_charCustomizeFrame;
|
||||||
float CCharacterCreation::m_charFacing;
|
float CCharacterCreation::m_charFacing;
|
||||||
@ -24,7 +27,9 @@ void CCharacterCreation::Initialize() {
|
|||||||
int32_t factionSwitch = 0;
|
int32_t factionSwitch = 0;
|
||||||
CCharacterCreation::m_charCustomizeFrame = nullptr;
|
CCharacterCreation::m_charCustomizeFrame = nullptr;
|
||||||
CCharacterCreation::m_existingCharacterIndex = -1;
|
CCharacterCreation::m_existingCharacterIndex = -1;
|
||||||
// TODO: memset
|
|
||||||
|
memset(CCharacterCreation::m_charPreferences, 0, sizeof(CCharacterCreation::m_charPreferences));
|
||||||
|
|
||||||
int32_t factionSwitch2 = 0;
|
int32_t factionSwitch2 = 0;
|
||||||
|
|
||||||
bool weirdCondition = false;
|
bool weirdCondition = false;
|
||||||
@ -66,6 +71,19 @@ void CCharacterCreation::Initialize() {
|
|||||||
} while (weirdCondition || factionSwitch == 1);
|
} while (weirdCondition || factionSwitch == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterCreation::Shutdown() {
|
||||||
|
if (CCharacterCreation::m_character) {
|
||||||
|
CCharacterComponent::FreeComponent(CCharacterCreation::m_character);
|
||||||
|
CCharacterCreation::m_character = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 44; ++i) {
|
||||||
|
DEL(CCharacterCreation::m_charPreferences[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CCharacterCreation::SetCharCustomizeFrame(CSimpleModelFFX* frame) {
|
void CCharacterCreation::SetCharCustomizeFrame(CSimpleModelFFX* frame) {
|
||||||
CCharacterCreation::m_charCustomizeFrame = frame;
|
CCharacterCreation::m_charCustomizeFrame = frame;
|
||||||
}
|
}
|
||||||
@ -75,8 +93,29 @@ void CCharacterCreation::SetCharCustomizeModel(char const* filename) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
auto model = CCharacterCreation::m_charCustomizeFrame->m_model;
|
||||||
|
if (model) {
|
||||||
|
if (!SStrCmpI(filename, model->m_shared->m_filePath, STORM_MAX_STR)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CCharacterCreation::m_charCustomizeFrame->SetModel(filename);
|
CCharacterCreation::m_charCustomizeFrame->SetModel(filename);
|
||||||
|
// BYTE1(CCharacterCreation::m_charCustomizeFrame[1].m_onAttributeChange.unk) = 1;
|
||||||
|
|
||||||
|
model = CCharacterCreation::m_charCustomizeFrame->m_model;
|
||||||
|
if (!model) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// LOBYTE(CCharacterCreation::m_charCustomizeFrame[1].m_onEnable.unk) = 1;
|
||||||
|
// TODO: LightingCallback + Particles
|
||||||
|
model->IsDrawable(1, 1);
|
||||||
|
|
||||||
|
auto characterModel = CCharacterCreation::m_character->m_data.m_model;
|
||||||
|
if (characterModel) {
|
||||||
|
characterModel->AttachToParent(model, 0, nullptr, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::ResetCharCustomizeInfo() {
|
void CCharacterCreation::ResetCharCustomizeInfo() {
|
||||||
@ -86,14 +125,18 @@ void CCharacterCreation::ResetCharCustomizeInfo() {
|
|||||||
|
|
||||||
CCharacterCreation::m_existingCharacterIndex = -1;
|
CCharacterCreation::m_existingCharacterIndex = -1;
|
||||||
|
|
||||||
// TODO: CM2Model__DetachAllChildrenById
|
auto model = CCharacterCreation::m_charCustomizeFrame->m_model;
|
||||||
|
if (model) {
|
||||||
|
model->DetachAllChildrenById(0);
|
||||||
|
}
|
||||||
|
|
||||||
ComponentData data;
|
ComponentData data;
|
||||||
CCharacterCreation::GetRandomRaceAndSex(&data);
|
CCharacterCreation::GetRandomRaceAndSex(&data);
|
||||||
CCharacterCreation::CalcClasses(data.m_info.raceID);
|
CCharacterCreation::CalcClasses(data.m_info.raceID);
|
||||||
CCharacterCreation::InitCharacterComponent(&data, 1);
|
CCharacterCreation::InitCharacterComponent(&data, 1);
|
||||||
|
|
||||||
CCharacterCreation::SetSelectedClass(CCharacterCreation::GetRandomClassID());
|
auto classID = CCharacterCreation::GetRandomClassID();
|
||||||
|
CCharacterCreation::SetSelectedClass(classID);
|
||||||
|
|
||||||
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
||||||
|
|
||||||
@ -106,11 +149,13 @@ void CCharacterCreation::ResetCharCustomizeInfo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: CNameGen::LoadNames
|
// TODO: CNameGen::LoadNames
|
||||||
|
CCharacterCreation::Sub4E6AE0(CCharacterCreation::m_character, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
|
void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
|
||||||
// TODO
|
// TODO
|
||||||
// WORKAROUND
|
// WORKAROUND
|
||||||
|
data->m_info.sexID = 0;
|
||||||
data->m_info.raceID = 1;
|
data->m_info.raceID = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +184,10 @@ void CCharacterCreation::CalcClasses(uint32_t raceID) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterCreation::Dress() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void CCharacterCreation::InitCharacterComponent(ComponentData* data, int32_t randomize) {
|
void CCharacterCreation::InitCharacterComponent(ComponentData* data, int32_t randomize) {
|
||||||
auto record = Player_C_GetModelName(data->m_info.raceID, data->m_info.sexID);
|
auto record = Player_C_GetModelName(data->m_info.raceID, data->m_info.sexID);
|
||||||
if (!record || !record->m_modelName[0]) {
|
if (!record || !record->m_modelName[0]) {
|
||||||
@ -161,6 +210,9 @@ void CCharacterCreation::InitCharacterComponent(ComponentData* data, int32_t ran
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: LightingCallback + particles
|
||||||
|
data->m_model->SetBoneSequence(0xFFFFFFFF, 0, 0, 0, 1.0f, 1, 1);
|
||||||
|
|
||||||
data->m_unkFlag |= 2u;
|
data->m_unkFlag |= 2u;
|
||||||
CCharacterCreation::m_character->Init(data, nullptr);
|
CCharacterCreation::m_character->Init(data, nullptr);
|
||||||
|
|
||||||
@ -168,7 +220,23 @@ void CCharacterCreation::InitCharacterComponent(ComponentData* data, int32_t ran
|
|||||||
CCharacterCreation::RandomizeCharFeatures();
|
CCharacterCreation::RandomizeCharFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
const auto& info = CCharacterCreation::m_character->m_data.m_info;
|
||||||
|
CCharacterCreation::m_prevSkinIndex = info.skinID;
|
||||||
|
CCharacterCreation::m_prevFaceIndex = info.faceID;
|
||||||
|
CCharacterCreation::m_prevHairColorIndex = info.hairColorID;
|
||||||
|
CCharacterCreation::m_prevHairStyleIndex = info.hairStyleID;
|
||||||
|
CCharacterCreation::m_prevFacialFeatureIndex = info.facialFeatureID;
|
||||||
|
|
||||||
|
CCharacterCreation::SetCharFacing(CCharacterCreation::m_charFacing);
|
||||||
|
CCharacterCreation::Dress();
|
||||||
|
|
||||||
|
CCharacterCreation::m_character->RenderPrep(0);
|
||||||
|
|
||||||
|
auto frameModel = CCharacterCreation::m_charCustomizeFrame->m_model;
|
||||||
|
if (frameModel) {
|
||||||
|
auto model = CCharacterCreation::m_character->m_data.m_model;
|
||||||
|
model->AttachToParent(frameModel, 0, nullptr, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::RandomizeCharFeatures() {
|
void CCharacterCreation::RandomizeCharFeatures() {
|
||||||
@ -186,12 +254,139 @@ void CCharacterCreation::RandomizeCharFeatures() {
|
|||||||
CCharacterCreation::m_prevFacialFeatureIndex = info.facialFeatureID;
|
CCharacterCreation::m_prevFacialFeatureIndex = info.facialFeatureID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::SetSelectedRace(int32_t raceID) {
|
void CCharacterCreation::SetSelectedRace(int32_t raceIndex) {
|
||||||
// TODO
|
if (raceIndex < 0 ||
|
||||||
|
raceIndex >= CCharacterCreation::m_races.Count() ||
|
||||||
|
raceIndex == CCharacterCreation::m_raceIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto previousRace = CCharacterCreation::m_races[CCharacterCreation::m_raceIndex];
|
||||||
|
auto sexID = CCharacterCreation::m_character->m_data.m_info.sexID;
|
||||||
|
|
||||||
|
auto preferences = CCharacterCreation::m_charPreferences[2 * previousRace + sexID];
|
||||||
|
if (!preferences) {
|
||||||
|
preferences = NEW(CHARACTER_CREATE_INFO);
|
||||||
|
CCharacterCreation::m_charPreferences[2 * previousRace + sexID] = preferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharacterCreation::m_character->GetInfo(preferences);
|
||||||
|
CCharacterCreation::m_raceIndex = raceIndex;
|
||||||
|
|
||||||
|
ComponentData data;
|
||||||
|
|
||||||
|
if (CCharacterCreation::m_existingCharacterIndex >= 0) {
|
||||||
|
auto display = CCharacterSelection::GetCharacterDisplay(CCharacterCreation::m_existingCharacterIndex);
|
||||||
|
if (display && display->m_characterInfo.sexID == sexID &&
|
||||||
|
(display->m_characterInfo.customizeFlags & 1)) {
|
||||||
|
data.m_info.raceID = display->m_characterInfo.raceID;
|
||||||
|
data.m_info.sexID = display->m_characterInfo.sexID;
|
||||||
|
data.m_info.classID = display->m_characterInfo.classID;
|
||||||
|
data.m_info.skinID = display->m_characterInfo.skinID;
|
||||||
|
data.m_info.hairStyleID = display->m_characterInfo.hairStyleID;
|
||||||
|
data.m_info.hairColorID = display->m_characterInfo.hairColorID;
|
||||||
|
data.m_info.facialFeatureID = display->m_characterInfo.facialHairStyleID;
|
||||||
|
data.m_info.faceID = display->m_characterInfo.faceID;
|
||||||
|
|
||||||
|
CCharacterCreation::InitCharacterComponent(&data, 0);
|
||||||
|
CCharacterCreation::SetSelectedSex(display->m_characterInfo.sexID);
|
||||||
|
|
||||||
|
// TODO: CNameGen::LoadNames
|
||||||
|
CCharacterCreation::Dress();
|
||||||
|
CCharacterCreation::Sub4E6AE0(CCharacterCreation::m_character, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto raceID = CCharacterCreation::m_races[CCharacterCreation::m_raceIndex];
|
||||||
|
preferences = CCharacterCreation::m_charPreferences[2 * raceID + sexID];
|
||||||
|
if (preferences) {
|
||||||
|
data.m_info = *preferences;
|
||||||
|
CCharacterCreation::CalcClasses(data.m_info.raceID);
|
||||||
|
if (!CCharacterCreation::IsRaceClassValid(data.m_info.raceID, CCharacterCreation::m_selectedClassID)) {
|
||||||
|
CCharacterCreation::m_selectedClassID = CCharacterCreation::GetRandomClassID();
|
||||||
|
}
|
||||||
|
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
||||||
|
CCharacterComponent::ValidateComponentData(&data);
|
||||||
|
CCharacterCreation::InitCharacterComponent(&data, 0);
|
||||||
|
} else {
|
||||||
|
data.m_info.sexID = sexID;
|
||||||
|
data.m_info.raceID = raceID;
|
||||||
|
CCharacterCreation::CalcClasses(data.m_info.raceID);
|
||||||
|
if (!CCharacterCreation::IsRaceClassValid(data.m_info.raceID, CCharacterCreation::m_selectedClassID)) {
|
||||||
|
CCharacterCreation::SetSelectedClass(CCharacterCreation::GetRandomClassID());
|
||||||
|
}
|
||||||
|
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
||||||
|
CCharacterCreation::InitCharacterComponent(&data, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: CNameGen::LoadNames
|
||||||
|
CCharacterCreation::Dress();
|
||||||
|
CCharacterCreation::Sub4E6AE0(CCharacterCreation::m_character, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::SetSelectedSex(int32_t sexID) {
|
void CCharacterCreation::SetSelectedSex(int32_t sexID) {
|
||||||
// TODO
|
if (sexID < 0 || sexID >= 3) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto previousSex = CCharacterCreation::m_character->m_data.m_info.sexID;
|
||||||
|
|
||||||
|
if (sexID == previousSex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto raceID = CCharacterCreation::m_races[CCharacterCreation::m_raceIndex];
|
||||||
|
|
||||||
|
auto preferences = CCharacterCreation::m_charPreferences[2 * raceID + previousSex];
|
||||||
|
if (!preferences) {
|
||||||
|
preferences = NEW(CHARACTER_CREATE_INFO);
|
||||||
|
CCharacterCreation::m_charPreferences[2 * raceID + previousSex] = preferences;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharacterCreation::m_character->GetInfo(preferences);
|
||||||
|
|
||||||
|
ComponentData data;
|
||||||
|
data.m_info.raceID = CCharacterCreation::m_character->m_data.m_info.raceID;
|
||||||
|
data.m_info.sexID = sexID;
|
||||||
|
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
||||||
|
|
||||||
|
if (CCharacterCreation::m_existingCharacterIndex >= 0) {
|
||||||
|
auto display = CCharacterSelection::GetCharacterDisplay(CCharacterCreation::m_existingCharacterIndex);
|
||||||
|
if (display && display->m_characterInfo.sexID == sexID &&
|
||||||
|
(display->m_characterInfo.customizeFlags & 1)) {
|
||||||
|
data.m_info.raceID = display->m_characterInfo.raceID;
|
||||||
|
data.m_info.sexID = display->m_characterInfo.sexID;
|
||||||
|
data.m_info.classID = display->m_characterInfo.classID;
|
||||||
|
data.m_info.skinID = display->m_characterInfo.skinID;
|
||||||
|
data.m_info.hairStyleID = display->m_characterInfo.hairStyleID;
|
||||||
|
data.m_info.hairColorID = display->m_characterInfo.hairColorID;
|
||||||
|
data.m_info.facialFeatureID = display->m_characterInfo.facialHairStyleID;
|
||||||
|
data.m_info.faceID = display->m_characterInfo.faceID;
|
||||||
|
|
||||||
|
CCharacterCreation::InitCharacterComponent(&data, 0);
|
||||||
|
|
||||||
|
// TODO: CNameGen::LoadNames
|
||||||
|
CCharacterCreation::Sub4E6AE0(CCharacterCreation::m_character, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
preferences = CCharacterCreation::m_charPreferences[2 * raceID + sexID];
|
||||||
|
if (preferences) {
|
||||||
|
data.m_info = *preferences;
|
||||||
|
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
||||||
|
CCharacterComponent::ValidateComponentData(&data);
|
||||||
|
CCharacterCreation::InitCharacterComponent(&data, 0);
|
||||||
|
} else {
|
||||||
|
data.m_info.raceID = CCharacterCreation::m_character->m_data.m_info.raceID;
|
||||||
|
data.m_info.sexID = sexID;
|
||||||
|
data.m_info.classID = CCharacterCreation::m_selectedClassID;
|
||||||
|
CCharacterCreation::InitCharacterComponent(&data, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: CNameGen::LoadNames
|
||||||
|
CCharacterCreation::Sub4E6AE0(CCharacterCreation::m_character, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::SetSelectedClass(int32_t classID) {
|
void CCharacterCreation::SetSelectedClass(int32_t classID) {
|
||||||
@ -205,8 +400,9 @@ void CCharacterCreation::SetSelectedClass(int32_t classID) {
|
|||||||
data.m_info.classID = classID;
|
data.m_info.classID = classID;
|
||||||
CCharacterComponent::ValidateComponentData(&data);
|
CCharacterComponent::ValidateComponentData(&data);
|
||||||
CCharacterCreation::InitCharacterComponent(&data, 0);
|
CCharacterCreation::InitCharacterComponent(&data, 0);
|
||||||
// TODO: sub_4E0FD0
|
CCharacterCreation::Dress();
|
||||||
// TODO: sub_4E6AE0((int)CCharacterCreation::m_character, 1);
|
|
||||||
|
CCharacterCreation::Sub4E6AE0(CCharacterCreation::m_character, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta) {
|
void CCharacterCreation::CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta) {
|
||||||
@ -215,11 +411,16 @@ void CCharacterCreation::CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customiz
|
|||||||
|
|
||||||
void CCharacterCreation::RandomizeCharCustomization() {
|
void CCharacterCreation::RandomizeCharCustomization() {
|
||||||
CCharacterCreation::RandomizeCharFeatures();
|
CCharacterCreation::RandomizeCharFeatures();
|
||||||
// TODO
|
CCharacterCreation::Dress();
|
||||||
|
CCharacterCreation::Sub4E6AE0(CCharacterCreation::m_character, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::SetCharFacing(float facing) {
|
void CCharacterCreation::SetCharFacing(float facing) {
|
||||||
// TODO
|
CCharacterCreation::m_charFacing = facing;
|
||||||
|
auto model = CCharacterCreation::m_character->m_data.m_model;
|
||||||
|
if (model) {
|
||||||
|
model->SetWorldTransform(C3Vector(), facing, 1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterCreation::CreateCharacter(const char* name) {
|
void CCharacterCreation::CreateCharacter(const char* name) {
|
||||||
@ -230,6 +431,20 @@ void CCharacterCreation::SetToExistingCharacter(uint32_t index) {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterCreation::Sub4E6AE0(CCharacterComponent* component, int32_t a2) {
|
||||||
|
// This method can be an analogue of CGlueLoading::StartLoad
|
||||||
|
|
||||||
|
if (SFile::IsTrial) {
|
||||||
|
// TODO
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component) {
|
||||||
|
component->RenderPrep(1);
|
||||||
|
component->m_data.m_model->IsDrawable(1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t CCharacterCreation::IsRaceClassValid(int32_t raceID, int32_t classID) {
|
int32_t CCharacterCreation::IsRaceClassValid(int32_t raceID, int32_t classID) {
|
||||||
for (int32_t i = 0; i < g_charBaseInfoDB.GetNumRecords(); ++i) {
|
for (int32_t i = 0; i < g_charBaseInfoDB.GetNumRecords(); ++i) {
|
||||||
auto record = g_charBaseInfoDB.GetRecordByIndex(i);
|
auto record = g_charBaseInfoDB.GetRecordByIndex(i);
|
||||||
@ -242,7 +457,7 @@ int32_t CCharacterCreation::IsRaceClassValid(int32_t raceID, int32_t classID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t CCharacterCreation::IsClassValid(int32_t classID) {
|
int32_t CCharacterCreation::IsClassValid(int32_t classID) {
|
||||||
for (uint32_t i = 0; i < CCharacterCreation::m_classes.Count(); i) {
|
for (uint32_t i = 0; i < CCharacterCreation::m_classes.Count(); ++i) {
|
||||||
auto record = CCharacterCreation::m_classes[i];
|
auto record = CCharacterCreation::m_classes[i];
|
||||||
if (record && record->m_ID == classID) {
|
if (record && record->m_ID == classID) {
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -26,6 +26,7 @@ class CCharacterCreation {
|
|||||||
// Static variables
|
// Static variables
|
||||||
static int32_t m_selectedClassID;
|
static int32_t m_selectedClassID;
|
||||||
static int32_t m_existingCharacterIndex;
|
static int32_t m_existingCharacterIndex;
|
||||||
|
static CHARACTER_CREATE_INFO* m_charPreferences[44];
|
||||||
static int32_t m_raceIndex;
|
static int32_t m_raceIndex;
|
||||||
static CSimpleModelFFX* m_charCustomizeFrame;
|
static CSimpleModelFFX* m_charCustomizeFrame;
|
||||||
static float m_charFacing;
|
static float m_charFacing;
|
||||||
@ -40,14 +41,16 @@ class CCharacterCreation {
|
|||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
|
static void Shutdown();
|
||||||
static void SetCharCustomizeFrame(CSimpleModelFFX* frame);
|
static void SetCharCustomizeFrame(CSimpleModelFFX* frame);
|
||||||
static void SetCharCustomizeModel(char const* filename);
|
static void SetCharCustomizeModel(char const* filename);
|
||||||
static void ResetCharCustomizeInfo();
|
static void ResetCharCustomizeInfo();
|
||||||
static void GetRandomRaceAndSex(ComponentData* data);
|
static void GetRandomRaceAndSex(ComponentData* data);
|
||||||
static void CalcClasses(uint32_t raceID);
|
static void CalcClasses(uint32_t raceID);
|
||||||
|
static void Dress();
|
||||||
static void InitCharacterComponent(ComponentData* data, int32_t randomize);
|
static void InitCharacterComponent(ComponentData* data, int32_t randomize);
|
||||||
static void RandomizeCharFeatures();
|
static void RandomizeCharFeatures();
|
||||||
static void SetSelectedRace(int32_t raceID);
|
static void SetSelectedRace(int32_t raceIndex);
|
||||||
static void SetSelectedSex(int32_t sexID);
|
static void SetSelectedSex(int32_t sexID);
|
||||||
static void SetSelectedClass(int32_t classID);
|
static void SetSelectedClass(int32_t classID);
|
||||||
static void CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta);
|
static void CycleCharCustomization(CHAR_CUSTOMIZATION_TYPE customization, int32_t delta);
|
||||||
@ -55,6 +58,7 @@ class CCharacterCreation {
|
|||||||
static void SetCharFacing(float facing);
|
static void SetCharFacing(float facing);
|
||||||
static void CreateCharacter(const char* name);
|
static void CreateCharacter(const char* name);
|
||||||
static void SetToExistingCharacter(uint32_t index);
|
static void SetToExistingCharacter(uint32_t index);
|
||||||
|
static void Sub4E6AE0(CCharacterComponent* component, int32_t a2);
|
||||||
static int32_t IsRaceClassValid(int32_t raceID, int32_t classID);
|
static int32_t IsRaceClassValid(int32_t raceID, int32_t classID);
|
||||||
static int32_t IsClassValid(int32_t classID);
|
static int32_t IsClassValid(int32_t classID);
|
||||||
static int32_t GetRandomClassID();
|
static int32_t GetRandomClassID();
|
||||||
|
@ -190,7 +190,7 @@ void CCharacterSelection::SetCharFacing(float facing) {
|
|||||||
auto index = CCharacterSelection::m_selectionIndex;
|
auto index = CCharacterSelection::m_selectionIndex;
|
||||||
auto component = CCharacterSelection::s_characterList[index].m_component;
|
auto component = CCharacterSelection::s_characterList[index].m_component;
|
||||||
if (component && component->m_data.m_model) {
|
if (component && component->m_data.m_model) {
|
||||||
component->m_data.m_model->SetWorldTransform(C3Vector(), facing, 1.0);
|
component->m_data.m_model->SetWorldTransform(C3Vector(), facing, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,3 +279,11 @@ void CCharacterSelection::OnGetCharacterList() {
|
|||||||
uint32_t CCharacterSelection::GetNumCharacters() {
|
uint32_t CCharacterSelection::GetNumCharacters() {
|
||||||
return CCharacterSelection::s_characterList.Count();
|
return CCharacterSelection::s_characterList.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CharacterSelectionDisplay* CCharacterSelection::GetCharacterDisplay(uint32_t index) {
|
||||||
|
if (index >= CCharacterSelection::s_characterList.Count()) {
|
||||||
|
return nullptr;
|
||||||
|
} else {
|
||||||
|
return CCharacterSelection::s_characterList.Ptr() + index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ class CCharacterSelection {
|
|||||||
static void UpdateCharacterList();
|
static void UpdateCharacterList();
|
||||||
static void OnGetCharacterList();
|
static void OnGetCharacterList();
|
||||||
static uint32_t GetNumCharacters();
|
static uint32_t GetNumCharacters();
|
||||||
|
static CharacterSelectionDisplay* GetCharacterDisplay(uint32_t index);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -925,7 +925,7 @@ LPDIRECT3DVERTEXBUFFER9 CGxDeviceD3d::ICreateD3dVB(EGxPoolUsage usage, uint32_t
|
|||||||
|
|
||||||
LPDIRECT3DVERTEXBUFFER9 vertexBuf = nullptr;
|
LPDIRECT3DVERTEXBUFFER9 vertexBuf = nullptr;
|
||||||
|
|
||||||
if (SUCCEEDED(this->m_d3dDevice->CreateVertexBuffer(size, d3dUsage, D3DFMT_INDEX16, d3dPool, &vertexBuf, nullptr))) {
|
if (SUCCEEDED(this->m_d3dDevice->CreateVertexBuffer(size, d3dUsage, 0, d3dPool, &vertexBuf, nullptr))) {
|
||||||
return vertexBuf;
|
return vertexBuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,9 +139,9 @@ void BATCHEDRENDERFONTDESC::RenderBatch() {
|
|||||||
this->m_face->m_textureCache[i].UpdateDirty();
|
this->m_face->m_textureCache[i].UpdateDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t maxBatchCapacity = 2048;
|
const int32_t maxBatchCapacity = 4096; // WORKAROUND! It should be 2048;
|
||||||
|
|
||||||
CGxBuf* vertexStream = g_theGxDevicePtr->BufStream(GxPoolTarget_Vertex, 0x18, maxBatchCapacity);
|
CGxBuf* vertexStream = g_theGxDevicePtr->BufStream(GxPoolTarget_Vertex, sizeof(CGxVertexPCT), maxBatchCapacity);
|
||||||
char* vertexData = g_theGxDevicePtr->BufLock(vertexStream);
|
char* vertexData = g_theGxDevicePtr->BufLock(vertexStream);
|
||||||
CGxVertexPCT* vertexBuf = reinterpret_cast<CGxVertexPCT*>(vertexData);
|
CGxVertexPCT* vertexBuf = reinterpret_cast<CGxVertexPCT*>(vertexData);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "ui/CSimpleCheckbox.hpp"
|
#include "ui/CSimpleCheckbox.hpp"
|
||||||
#include "ui/CSimpleCheckboxScript.hpp"
|
#include "ui/CSimpleCheckboxScript.hpp"
|
||||||
|
#include "ui/CSimpleTexture.hpp"
|
||||||
|
|
||||||
int32_t CSimpleCheckbox::s_metatable;
|
int32_t CSimpleCheckbox::s_metatable;
|
||||||
int32_t CSimpleCheckbox::s_objectType;
|
int32_t CSimpleCheckbox::s_objectType;
|
||||||
@ -23,14 +24,53 @@ void CSimpleCheckbox::RegisterScriptMethods(lua_State* L) {
|
|||||||
FrameScript_Object::FillScriptMethodTable(L, SimpleCheckboxMethods, NUM_SIMPLE_CHECKBOX_SCRIPT_METHODS);
|
FrameScript_Object::FillScriptMethodTable(L, SimpleCheckboxMethods, NUM_SIMPLE_CHECKBOX_SCRIPT_METHODS);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSimpleCheckbox::CSimpleCheckbox(CSimpleFrame* parent) : CSimpleButton(parent) {
|
CSimpleCheckbox::CSimpleCheckbox(CSimpleFrame* parent)
|
||||||
// TODO
|
: CSimpleButton(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleCheckbox::GetScriptMetaTable() {
|
int32_t CSimpleCheckbox::GetScriptMetaTable() {
|
||||||
return CSimpleCheckbox::s_metatable;
|
return CSimpleCheckbox::s_metatable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSimpleCheckbox::Enable(int32_t enabled) {
|
||||||
|
this->CSimpleButton::Enable(enabled);
|
||||||
|
this->SetChecked(this->m_checked, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCheckbox::SetChecked(int32_t state, int32_t force) {
|
||||||
|
if (state == this->m_checked && !force) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->m_checked = state;
|
||||||
|
if (this->m_checkedTexture) {
|
||||||
|
this->m_checkedTexture->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->m_disabledTexture) {
|
||||||
|
this->m_disabledTexture->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->m_checked) {
|
||||||
|
if (!this->m_disabledTexture || this->m_state) {
|
||||||
|
if (this->m_checkedTexture) {
|
||||||
|
this->m_checkedTexture->Show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this->m_disabledTexture->Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CSimpleCheckbox::GetChecked() {
|
||||||
|
return this->m_checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSimpleCheckbox::OnClick(const char* btn, int32_t a3) {
|
||||||
|
this->SetChecked(this->m_checked == 0, 0);
|
||||||
|
this->CSimpleButton::OnClick(btn, a3);
|
||||||
|
}
|
||||||
|
|
||||||
bool CSimpleCheckbox::IsA(int32_t type) {
|
bool CSimpleCheckbox::IsA(int32_t type) {
|
||||||
return type == CSimpleCheckbox::s_objectType
|
return type == CSimpleCheckbox::s_objectType
|
||||||
|| type == CSimpleButton::s_objectType
|
|| type == CSimpleButton::s_objectType
|
||||||
|
@ -15,10 +15,17 @@ class CSimpleCheckbox : public CSimpleButton {
|
|||||||
static void RegisterScriptMethods(lua_State* L);
|
static void RegisterScriptMethods(lua_State* L);
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
|
int32_t m_checked = 0;
|
||||||
|
CSimpleTexture* m_checkedTexture = nullptr;
|
||||||
|
CSimpleTexture* m_disabledTexture = nullptr;
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual bool IsA(int32_t type);
|
virtual bool IsA(int32_t type);
|
||||||
virtual int32_t GetScriptMetaTable();
|
virtual int32_t GetScriptMetaTable();
|
||||||
|
virtual void Enable(int32_t enabled);
|
||||||
|
virtual void SetChecked(int32_t state, int32_t force);
|
||||||
|
virtual int32_t GetChecked();
|
||||||
|
virtual void OnClick(const char* btn, int32_t a3);
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
CSimpleCheckbox(CSimpleFrame* parent);
|
CSimpleCheckbox(CSimpleFrame* parent);
|
||||||
|
@ -1,13 +1,26 @@
|
|||||||
#include "ui/CSimpleCheckboxScript.hpp"
|
#include "ui/CSimpleCheckboxScript.hpp"
|
||||||
|
#include "ui/CSimpleCheckbox.hpp"
|
||||||
|
#include "util/Lua.hpp"
|
||||||
|
#include "util/StringTo.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
int32_t CSimpleCheckbox_SetChecked(lua_State* L) {
|
int32_t CSimpleCheckbox_SetChecked(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleCheckbox::GetObjectType();
|
||||||
|
auto checkbox = static_cast<CSimpleCheckbox*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
int32_t state = StringToBOOL(L, 2, 0);
|
||||||
|
checkbox->SetChecked(state, 0);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleCheckbox_GetChecked(lua_State* L) {
|
int32_t CSimpleCheckbox_GetChecked(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
auto type = CSimpleCheckbox::GetObjectType();
|
||||||
|
auto checkbox = static_cast<CSimpleCheckbox*>(FrameScript_GetObjectThis(L, type));
|
||||||
|
|
||||||
|
lua_Number state = checkbox->GetChecked() ? 1.0 : 0.0;
|
||||||
|
lua_pushnumber(L, state);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t CSimpleCheckbox_GetCheckedTexture(lua_State* L) {
|
int32_t CSimpleCheckbox_GetCheckedTexture(lua_State* L) {
|
||||||
|
Loading…
Reference in New Issue
Block a user