mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 00:32:45 +03:00
feat(glue): implement CCharacterSelection::UpdateCharacterList
This commit is contained in:
parent
4e104f3640
commit
d4dde8d331
@ -1,10 +1,24 @@
|
|||||||
#include "glue/CCharacterSelection.hpp"
|
#include "glue/CCharacterSelection.hpp"
|
||||||
|
#include "client/ClientServices.hpp"
|
||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
|
#include "glue/CRealmList.hpp"
|
||||||
#include "model/CM2Shared.hpp"
|
#include "model/CM2Shared.hpp"
|
||||||
|
#include "net/Connection.hpp"
|
||||||
#include "ui/CSimpleModelFFX.hpp"
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
|
|
||||||
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
||||||
CSimpleModelFFX* CCharacterSelection::s_modelFrame;
|
CSimpleModelFFX* CCharacterSelection::s_modelFrame;
|
||||||
|
uint32_t CCharacterSelection::s_restrictHuman;
|
||||||
|
uint32_t CCharacterSelection::s_restrictDwarf;
|
||||||
|
uint32_t CCharacterSelection::s_restrictGnome;
|
||||||
|
uint32_t CCharacterSelection::s_restrictNightElf;
|
||||||
|
uint32_t CCharacterSelection::s_restrictDraenei;
|
||||||
|
uint32_t CCharacterSelection::s_restrictOrc;
|
||||||
|
uint32_t CCharacterSelection::s_restrictTroll;
|
||||||
|
uint32_t CCharacterSelection::s_restrictTauren;
|
||||||
|
uint32_t CCharacterSelection::s_restrictUndead;
|
||||||
|
uint32_t CCharacterSelection::s_restrictBloodElf;
|
||||||
|
int32_t CCharacterSelection::s_selectionIndex;
|
||||||
|
|
||||||
void CCharacterSelection::ClearCharacterList() {
|
void CCharacterSelection::ClearCharacterList() {
|
||||||
// TODO
|
// TODO
|
||||||
@ -14,6 +28,13 @@ void CCharacterSelection::ClearCharacterModel() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterSelection::EnumerateCharactersCallback(const CHARACTER_INFO& info, void* param) {
|
||||||
|
auto display = CCharacterSelection::s_characterList.New();
|
||||||
|
display->info = info;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void CCharacterSelection::OnGetCharacterList() {
|
void CCharacterSelection::OnGetCharacterList() {
|
||||||
CCharacterSelection::s_characterList.SetCount(0);
|
CCharacterSelection::s_characterList.SetCount(0);
|
||||||
|
|
||||||
@ -53,4 +74,61 @@ void CCharacterSelection::SetBackgroundModel(const char* modelPath) {
|
|||||||
|
|
||||||
void CCharacterSelection::UpdateCharacterList() {
|
void CCharacterSelection::UpdateCharacterList() {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
CCharacterSelection::s_characterList.SetCount(0);
|
||||||
|
|
||||||
|
CCharacterSelection::s_restrictHuman = 0;
|
||||||
|
CCharacterSelection::s_restrictDwarf = 0;
|
||||||
|
CCharacterSelection::s_restrictGnome = 0;
|
||||||
|
CCharacterSelection::s_restrictNightElf = 0;
|
||||||
|
CCharacterSelection::s_restrictDraenei = 0;
|
||||||
|
CCharacterSelection::s_restrictOrc = 0;
|
||||||
|
CCharacterSelection::s_restrictTroll = 0;
|
||||||
|
CCharacterSelection::s_restrictTauren = 0;
|
||||||
|
CCharacterSelection::s_restrictUndead = 0;
|
||||||
|
CCharacterSelection::s_restrictBloodElf = 0;
|
||||||
|
|
||||||
|
// Enumerate characters
|
||||||
|
|
||||||
|
ClientServices::Connection()->EnumerateCharacters(CCharacterSelection::EnumerateCharactersCallback, nullptr);
|
||||||
|
|
||||||
|
// No characters
|
||||||
|
|
||||||
|
if (CCharacterSelection::s_characterList.Count() == 0) {
|
||||||
|
CCharacterSelection::s_selectionIndex = 0;
|
||||||
|
|
||||||
|
// TODO Sub4E3CD0();
|
||||||
|
|
||||||
|
FrameScript_SignalEvent(8, "%d", CCharacterSelection::s_selectionIndex + 1);
|
||||||
|
|
||||||
|
CCharacterSelection::ClearCharacterModel();
|
||||||
|
|
||||||
|
FrameScript_SignalEvent(7, nullptr);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At least one character
|
||||||
|
|
||||||
|
CCharacterSelection::s_restrictHuman = ClientServices::Connection()->m_restrictHuman;
|
||||||
|
CCharacterSelection::s_restrictDwarf = ClientServices::Connection()->m_restrictDwarf;
|
||||||
|
CCharacterSelection::s_restrictGnome = ClientServices::Connection()->m_restrictGnome;
|
||||||
|
CCharacterSelection::s_restrictNightElf = ClientServices::Connection()->m_restrictNightElf;
|
||||||
|
CCharacterSelection::s_restrictDraenei = ClientServices::Connection()->m_restrictDraenei;
|
||||||
|
CCharacterSelection::s_restrictOrc = ClientServices::Connection()->m_restrictOrc;
|
||||||
|
CCharacterSelection::s_restrictTroll = ClientServices::Connection()->m_restrictTroll;
|
||||||
|
CCharacterSelection::s_restrictTauren = ClientServices::Connection()->m_restrictTauren;
|
||||||
|
CCharacterSelection::s_restrictUndead = ClientServices::Connection()->m_restrictUndead;
|
||||||
|
CCharacterSelection::s_restrictBloodElf = ClientServices::Connection()->m_restrictBloodElf;
|
||||||
|
|
||||||
|
CRealmList::s_preferredCategory = 0;
|
||||||
|
|
||||||
|
// TODO g_lastCharacterIndex stuff
|
||||||
|
int32_t selectionIndex = 0;
|
||||||
|
|
||||||
|
CCharacterSelection::s_selectionIndex = selectionIndex;
|
||||||
|
|
||||||
|
// TODO Sub4E3CD0();
|
||||||
|
|
||||||
|
FrameScript_SignalEvent(8, "%d", CCharacterSelection::s_selectionIndex + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
#ifndef GLUE_C_CHARACTER_SELECTION_HPP
|
#ifndef GLUE_C_CHARACTER_SELECTION_HPP
|
||||||
#define GLUE_C_CHARACTER_SELECTION_HPP
|
#define GLUE_C_CHARACTER_SELECTION_HPP
|
||||||
|
|
||||||
|
#include "net/Types.hpp"
|
||||||
#include <storm/Array.hpp>
|
#include <storm/Array.hpp>
|
||||||
|
|
||||||
class CSimpleModelFFX;
|
class CSimpleModelFFX;
|
||||||
|
|
||||||
struct CharacterSelectionDisplay {
|
struct CharacterSelectionDisplay {
|
||||||
|
CHARACTER_INFO info;
|
||||||
// TODO
|
// TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -14,10 +16,22 @@ class CCharacterSelection {
|
|||||||
// Static variables
|
// Static variables
|
||||||
static TSGrowableArray<CharacterSelectionDisplay> s_characterList;
|
static TSGrowableArray<CharacterSelectionDisplay> s_characterList;
|
||||||
static CSimpleModelFFX* s_modelFrame;
|
static CSimpleModelFFX* s_modelFrame;
|
||||||
|
static uint32_t s_restrictHuman;
|
||||||
|
static uint32_t s_restrictDwarf;
|
||||||
|
static uint32_t s_restrictGnome;
|
||||||
|
static uint32_t s_restrictNightElf;
|
||||||
|
static uint32_t s_restrictDraenei;
|
||||||
|
static uint32_t s_restrictOrc;
|
||||||
|
static uint32_t s_restrictTroll;
|
||||||
|
static uint32_t s_restrictTauren;
|
||||||
|
static uint32_t s_restrictUndead;
|
||||||
|
static uint32_t s_restrictBloodElf;
|
||||||
|
static int32_t s_selectionIndex;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static void ClearCharacterList();
|
static void ClearCharacterList();
|
||||||
static void ClearCharacterModel();
|
static void ClearCharacterModel();
|
||||||
|
static void EnumerateCharactersCallback(const CHARACTER_INFO& info, void* param);
|
||||||
static void OnGetCharacterList();
|
static void OnGetCharacterList();
|
||||||
static void RenderPrep();
|
static void RenderPrep();
|
||||||
static void SetBackgroundModel(const char* modelPath);
|
static void SetBackgroundModel(const char* modelPath);
|
||||||
|
|||||||
@ -170,6 +170,14 @@ int32_t ClientConnection::Disconnect() {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientConnection::EnumerateCharacters(ENUMERATE_CHARACTERS_CALLBACK callback, void* param) {
|
||||||
|
// TODO Assertion-like thing
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < this->m_characterList.Count(); i++) {
|
||||||
|
callback(this->m_characterList[i], param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::GetCharacterList() {
|
void ClientConnection::GetCharacterList() {
|
||||||
this->Initiate(COP_GET_CHARACTERS, 43, nullptr);
|
this->Initiate(COP_GET_CHARACTERS, 43, nullptr);
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
class RealmResponse;
|
class RealmResponse;
|
||||||
|
|
||||||
|
typedef void (*ENUMERATE_CHARACTERS_CALLBACK)(const CHARACTER_INFO&, void*);
|
||||||
|
|
||||||
class ClientConnection : public RealmConnection {
|
class ClientConnection : public RealmConnection {
|
||||||
public:
|
public:
|
||||||
// Member variables
|
// Member variables
|
||||||
@ -32,6 +34,7 @@ class ClientConnection : public RealmConnection {
|
|||||||
void Complete(int32_t result, int32_t errorCode);
|
void Complete(int32_t result, int32_t errorCode);
|
||||||
void Connect();
|
void Connect();
|
||||||
int32_t Disconnect();
|
int32_t Disconnect();
|
||||||
|
void EnumerateCharacters(ENUMERATE_CHARACTERS_CALLBACK callback, void* param);
|
||||||
void GetCharacterList();
|
void GetCharacterList();
|
||||||
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
||||||
int32_t IsConnected();
|
int32_t IsConnected();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user