feat(ui): initialize game UI in ClientInitializeGame
Some checks failed
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Has been cancelled
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Has been cancelled

This commit is contained in:
fallenoak 2026-01-23 21:17:43 -06:00
parent 1f7aa984b0
commit bdf0bd27a1
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
6 changed files with 163 additions and 0 deletions

View File

@ -18,6 +18,7 @@
#include "sound/Interface.hpp"
#include "ui/FrameScript.hpp"
#include "ui/FrameXML.hpp"
#include "ui/Game.hpp"
#include "util/Random.hpp"
#include "world/World.hpp"
#include <bc/Debug.hpp>
@ -85,6 +86,10 @@ void ClientInitializeGame(uint32_t mapId, C3Vector position) {
// TODO
CGGameUI::InitializeGame();
// TODO
EventRegister(EVENT_ID_IDLE, ClientIdle);
// TODO

6
src/ui/Game.hpp Normal file
View File

@ -0,0 +1,6 @@
#ifndef UI_GAME_HPP
#define UI_GAME_HPP
#include "ui/game/CGGameUI.hpp"
#endif

94
src/ui/game/CGGameUI.cpp Normal file
View File

@ -0,0 +1,94 @@
#include "ui/game/CGGameUI.hpp"
#include "client/Client.hpp"
#include "ui/FrameXML.hpp"
#include "ui/Key.hpp"
#include "ui/game/CGWorldFrame.hpp"
#include "ui/simple/CSimpleTop.hpp"
#include "util/CStatus.hpp"
#include <common/MD5.hpp>
CSimpleTop* CGGameUI::s_simpleTop;
void CGGameUI::Initialize() {
// TODO
CGGameUI::s_simpleTop = STORM_NEW(CSimpleTop);
// TODO
CGGameUI::RegisterFrameFactories();
// TODO
CStatus status;
// TODO
MD5_CTX md5;
uint8_t digest1[16];
uint8_t digest2[16];
MD5Init(&md5);
switch (FrameXML_CheckSignature("Interface\\FrameXML\\FrameXML.toc", "Interface\\FrameXML\\Bindings.xml", InterfaceKey, digest1)) {
case 0: {
status.Add(STATUS_WARNING, "FrameXML missing signature");
ClientPostClose(10);
return;
}
case 1: {
status.Add(STATUS_WARNING, "FrameXML has corrupt signature");
ClientPostClose(10);
return;
}
case 2: {
status.Add(STATUS_WARNING, "FrameXML is modified or corrupt");
ClientPostClose(10);
return;
}
case 3: {
// Success
break;
}
default: {
ClientPostClose(10);
return;
}
}
// TODO file count and progress bar logic
FrameXML_FreeHashNodes();
FrameXML_CreateFrames("Interface\\FrameXML\\FrameXML.toc", nullptr, &md5, &status);
// TODO CGUIBindings::s_bindings->Load("Interface\\FrameXML\\Bindings.xml", &md5, &status);
MD5Final(digest2, &md5);
// TODO digest validation
// TODO
}
void CGGameUI::InitializeGame() {
// TODO
CGGameUI::Initialize();
// TODO
}
void CGGameUI::RegisterFrameFactories() {
FrameXML_RegisterFactory("WorldFrame", &CGWorldFrame::Create, true);
// TODO register remaining factories
}

17
src/ui/game/CGGameUI.hpp Normal file
View File

@ -0,0 +1,17 @@
#ifndef UI_GAME_C_G_GAME_UI_HPP
#define UI_GAME_C_G_GAME_UI_HPP
class CSimpleTop;
class CGGameUI {
public:
// Static variables
static CSimpleTop* s_simpleTop;
// Static functions
static void Initialize();
static void InitializeGame();
static void RegisterFrameFactories();
};
#endif

View File

@ -0,0 +1,22 @@
#include "ui/game/CGWorldFrame.hpp"
#include <storm/Memory.hpp>
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
// TODO use CDataAllocator
return STORM_NEW(CGWorldFrame)(parent);
}
CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
// TODO
CGWorldFrame::s_currentWorldFrame = this;
// TODO
this->EnableEvent(SIMPLE_EVENT_KEY, -1);
this->EnableEvent(SIMPLE_EVENT_MOUSE, -1);
this->EnableEvent(SIMPLE_EVENT_MOUSEWHEEL, -1);
// TODO
}

View File

@ -0,0 +1,19 @@
#ifndef UI_GAME_C_G_WORLD_FRAME_HPP
#define UI_GAME_C_G_WORLD_FRAME_HPP
#include "ui/simple/CSimpleFrame.hpp"
#include <cstdint>
class CGWorldFrame : public CSimpleFrame {
public:
// Static variables
CGWorldFrame* s_currentWorldFrame;
// Static functions
static CSimpleFrame* Create(CSimpleFrame* parent);
// Member functions
CGWorldFrame(CSimpleFrame* parent);
};
#endif