mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
feat(glue): add CCharacterCreation::Initialize
This commit is contained in:
parent
4255bf4d25
commit
30db32c4d4
@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
CCharacterComponent* CCharacterCreation::s_character;
|
CCharacterComponent* CCharacterCreation::s_character;
|
||||||
CSimpleModelFFX* CCharacterCreation::s_charCustomizeFrame;
|
CSimpleModelFFX* CCharacterCreation::s_charCustomizeFrame;
|
||||||
|
float CCharacterCreation::s_charFacing;
|
||||||
TSFixedArray<const ChrClassesRec*> CCharacterCreation::s_classes;
|
TSFixedArray<const ChrClassesRec*> CCharacterCreation::s_classes;
|
||||||
int32_t CCharacterCreation::s_existingCharacterIndex;
|
int32_t CCharacterCreation::s_existingCharacterIndex;
|
||||||
int32_t CCharacterCreation::s_raceIndex;
|
int32_t CCharacterCreation::s_raceIndex;
|
||||||
|
TSGrowableArray<int32_t> CCharacterCreation::s_races;
|
||||||
int32_t CCharacterCreation::s_selectedClassID;
|
int32_t CCharacterCreation::s_selectedClassID;
|
||||||
|
|
||||||
void CCharacterCreation::CalcClasses(int32_t raceID) {
|
void CCharacterCreation::CalcClasses(int32_t raceID) {
|
||||||
@ -109,6 +111,53 @@ void CCharacterCreation::GetRandomRaceAndSex(ComponentData* data) {
|
|||||||
data->sexID = UNITSEX_MALE;
|
data->sexID = UNITSEX_MALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterCreation::Initialize() {
|
||||||
|
CCharacterCreation::s_charFacing = 0.0f;
|
||||||
|
CCharacterCreation::s_charCustomizeFrame = nullptr;
|
||||||
|
CCharacterCreation::s_existingCharacterIndex = -1;
|
||||||
|
|
||||||
|
CCharacterCreation::s_races.SetCount(0);
|
||||||
|
|
||||||
|
// TODO enum or define for faction sides
|
||||||
|
for (int32_t side = 0; side < 2; side++) {
|
||||||
|
for (int32_t race = 0; race < g_chrRacesDB.GetNumRecords(); race++) {
|
||||||
|
auto raceRec = g_chrRacesDB.GetRecordByIndex(race);
|
||||||
|
|
||||||
|
// TODO NPCOnly?
|
||||||
|
if (raceRec->m_flags & 0x1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto factionTemplateRec = g_factionTemplateDB.GetRecord(raceRec->m_factionID);
|
||||||
|
|
||||||
|
for (int32_t group = 0; group < g_factionGroupDB.GetNumRecords(); group++) {
|
||||||
|
auto factionGroupRec = g_factionGroupDB.GetRecordByIndex(group);
|
||||||
|
|
||||||
|
if (!factionGroupRec || !factionGroupRec->m_maskID) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool templateMatch = (1 << factionGroupRec->m_maskID) & factionTemplateRec->m_factionGroup;
|
||||||
|
|
||||||
|
if (!templateMatch) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool sideMatch =
|
||||||
|
(side == 0 && !SStrCmpI(factionGroupRec->m_internalName, "Alliance"))
|
||||||
|
|| (side == 1 && !SStrCmpI(factionGroupRec->m_internalName, "Horde"));
|
||||||
|
|
||||||
|
if (!sideMatch) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Race is playable and part of a faction aligned to either Alliance or Horde
|
||||||
|
*CCharacterCreation::s_races.New() = raceRec->m_ID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CCharacterCreation::IsClassValid(int32_t classID) {
|
bool CCharacterCreation::IsClassValid(int32_t classID) {
|
||||||
for (int32_t i = 0; i < CCharacterCreation::s_classes.Count(); i++) {
|
for (int32_t i = 0; i < CCharacterCreation::s_classes.Count(); i++) {
|
||||||
auto classRec = CCharacterCreation::s_classes[i];
|
auto classRec = CCharacterCreation::s_classes[i];
|
||||||
|
|||||||
@ -14,9 +14,11 @@ class CCharacterCreation {
|
|||||||
// Static variables
|
// Static variables
|
||||||
static CCharacterComponent* s_character;
|
static CCharacterComponent* s_character;
|
||||||
static CSimpleModelFFX* s_charCustomizeFrame;
|
static CSimpleModelFFX* s_charCustomizeFrame;
|
||||||
|
static float s_charFacing;
|
||||||
static TSFixedArray<const ChrClassesRec*> s_classes;
|
static TSFixedArray<const ChrClassesRec*> s_classes;
|
||||||
static int32_t s_existingCharacterIndex;
|
static int32_t s_existingCharacterIndex;
|
||||||
static int32_t s_raceIndex;
|
static int32_t s_raceIndex;
|
||||||
|
static TSGrowableArray<int32_t> s_races;
|
||||||
static int32_t s_selectedClassID;
|
static int32_t s_selectedClassID;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
@ -25,6 +27,7 @@ class CCharacterCreation {
|
|||||||
static void Dress();
|
static void Dress();
|
||||||
static int32_t GetRandomClassID();
|
static int32_t GetRandomClassID();
|
||||||
static void GetRandomRaceAndSex(ComponentData* data);
|
static void GetRandomRaceAndSex(ComponentData* data);
|
||||||
|
static void Initialize();
|
||||||
static bool IsClassValid(int32_t classID);
|
static bool IsClassValid(int32_t classID);
|
||||||
static void ResetCharCustomizeInfo();
|
static void ResetCharCustomizeInfo();
|
||||||
static void SetSelectedClass(int32_t classID);
|
static void SetSelectedClass(int32_t classID);
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "ffx/Effect.hpp"
|
#include "ffx/Effect.hpp"
|
||||||
|
#include "glue/CCharacterCreation.hpp"
|
||||||
#include "glue/CCharacterCreationScript.hpp"
|
#include "glue/CCharacterCreationScript.hpp"
|
||||||
#include "glue/CCharacterSelection.hpp"
|
#include "glue/CCharacterSelection.hpp"
|
||||||
#include "glue/CCharacterSelectionScript.hpp"
|
#include "glue/CCharacterSelectionScript.hpp"
|
||||||
@ -953,6 +954,8 @@ void CGlueMgr::Resume() {
|
|||||||
|
|
||||||
FrameScript_CreateEvents(g_glueScriptEvents, NUM_GLUESCRIPTEVENTS);
|
FrameScript_CreateEvents(g_glueScriptEvents, NUM_GLUESCRIPTEVENTS);
|
||||||
|
|
||||||
|
CCharacterCreation::Initialize();
|
||||||
|
|
||||||
OsCreateDirectory("Logs", 0);
|
OsCreateDirectory("Logs", 0);
|
||||||
|
|
||||||
CWOWClientStatus status;
|
CWOWClientStatus status;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user