mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-10 07:07:42 +00:00
Refactor GuiSys (remove general logic handling)
This commit is contained in:
@@ -2,10 +2,6 @@
|
||||
#define __URDE_CGUIFRAME_HPP__
|
||||
|
||||
#include "CGuiWidget.hpp"
|
||||
#include "CGuiAutoRepeatData.hpp"
|
||||
#include "CGuiPhysicalMsg.hpp"
|
||||
#include "CGuiControllerInfo.hpp"
|
||||
#include "CGuiLogicalEventTrigger.hpp"
|
||||
#include "CGuiWidgetIdDB.hpp"
|
||||
#include "IObj.hpp"
|
||||
|
||||
@@ -19,99 +15,35 @@ class CFinalInput;
|
||||
class CGuiLight;
|
||||
class CVParamTransfer;
|
||||
class CObjectReference;
|
||||
|
||||
enum class EFrameTransitionOptions
|
||||
{
|
||||
Zero
|
||||
};
|
||||
|
||||
struct CGuiFrameTransitionOptions
|
||||
{
|
||||
EFrameTransitionOptions x0_opts;
|
||||
bool x4_ = true;
|
||||
float x8_ = 1.f;
|
||||
float xc_ = 0.f;
|
||||
float x10_ = 0.f;
|
||||
float x14_ = 0.f;
|
||||
public:
|
||||
CGuiFrameTransitionOptions(EFrameTransitionOptions opts)
|
||||
: x0_opts(opts) {}
|
||||
};
|
||||
|
||||
class CGuiFrameMessageMapNode
|
||||
{
|
||||
CGuiLogicalEventTrigger x0_trigger;
|
||||
public:
|
||||
CGuiFrameMessageMapNode(const CGuiPhysicalMsg& msg, int val)
|
||||
: x0_trigger(msg, val, false) {}
|
||||
const CGuiLogicalEventTrigger& GetTrigger() const {return x0_trigger;}
|
||||
};
|
||||
class CSimplePool;
|
||||
|
||||
class CGuiFrame
|
||||
{
|
||||
public:
|
||||
enum class EFrameStates
|
||||
{
|
||||
Zero = 0,
|
||||
One = 1,
|
||||
Two = 2,
|
||||
Three = 3,
|
||||
Four = 4
|
||||
};
|
||||
private:
|
||||
bool x0_controllerStatus[4] = {};
|
||||
std::string x4_name;
|
||||
ResId x14_id;
|
||||
u32 x18_ = 0;
|
||||
CGuiFrameTransitionOptions x1c_transitionOpts;
|
||||
EFrameStates x34_ = EFrameStates::Zero;
|
||||
EFrameStates x38_ = EFrameStates::Zero;
|
||||
CGuiSys& x3c_guiSys;
|
||||
u32 x40_ = 0;
|
||||
CGuiHeadWidget* x44_headWidget = nullptr;
|
||||
std::unique_ptr<CGuiWidget> x48_rootWidget;
|
||||
CGuiCamera* x4c_camera = nullptr;
|
||||
CGuiWidget* x50_background = nullptr;
|
||||
zeus::CQuaternion x54_;
|
||||
CGuiWidgetIdDB x64_idDB;
|
||||
using LogicalEventList = std::list<std::unique_ptr<CGuiFrameMessageMapNode>>;
|
||||
using WidgetToLogicalEventMap =
|
||||
std::unordered_map<s16, std::unique_ptr<LogicalEventList>>;
|
||||
std::unordered_map<u64, std::unique_ptr<WidgetToLogicalEventMap>> x7c_messageMap;
|
||||
std::vector<CGuiWidget*> x90_widgets;
|
||||
std::vector<CGuiLight*> xa0_lights;
|
||||
int xb0_a;
|
||||
int xb4_b;
|
||||
int xb8_c;
|
||||
bool xbc_24_loaded : 1;
|
||||
bool xbd_flag2 = false;
|
||||
|
||||
static void InterpretGUIControllerState(const CFinalInput& input,
|
||||
CGuiPhysicalMsg::PhysicalMap& state,
|
||||
char& lx, char& ly, char& rx, char& ry);
|
||||
ResId x0_id;
|
||||
u32 x4_ = 0;
|
||||
CGuiSys& x8_guiSys;
|
||||
CGuiHeadWidget* xc_headWidget = nullptr;
|
||||
std::unique_ptr<CGuiWidget> x10_rootWidget;
|
||||
CGuiCamera* x14_camera = nullptr;
|
||||
CGuiWidgetIdDB x18_idDB;
|
||||
std::vector<CGuiWidget*> x2c_widgets;
|
||||
std::vector<CGuiLight*> x3c_lights;
|
||||
int x4c_a;
|
||||
int x50_b;
|
||||
int x54_c;
|
||||
bool x58_24_loaded : 1;
|
||||
|
||||
public:
|
||||
CGuiFrame(ResId id, const std::string& name, CGuiSys& sys, int a, int b, int c);
|
||||
CGuiFrame(ResId id, CGuiSys& sys, int a, int b, int c, CSimplePool* sp);
|
||||
|
||||
CGuiSys& GetGuiSys() {return x3c_guiSys;}
|
||||
CGuiSys& GetGuiSys() {return x8_guiSys;}
|
||||
|
||||
CGuiLight* GetFrameLight(int idx) {return xa0_lights[idx];}
|
||||
CGuiLight* GetFrameLight(int idx) {return x3c_lights[idx];}
|
||||
CGuiWidget* FindWidget(const std::string& name) const;
|
||||
CGuiWidget* FindWidget(s16 id) const;
|
||||
void ResetControllerStatus();
|
||||
void SetControllerStatus(int idx, bool set) {x0_controllerStatus[idx] = set;}
|
||||
void SetFrameBackground(CGuiWidget* bg) {x50_background = bg;}
|
||||
void SetFrameCamera(CGuiCamera* camr) {x4c_camera = camr;}
|
||||
void SetHeadWidget(CGuiHeadWidget* hwig) {x44_headWidget = hwig;}
|
||||
WidgetToLogicalEventMap* FindWidget2LogicalEventMap(u64 events);
|
||||
LogicalEventList* FindLogicalEventList(u64 events, s16 id);
|
||||
bool SendWidgetMessage(s16,
|
||||
std::list<std::unique_ptr<CGuiFrameMessageMapNode>>&,
|
||||
CGuiPhysicalMsg::PhysicalMap& state,
|
||||
CGuiControllerInfo::CGuiControllerStateInfo& csInfo);
|
||||
void ClearAllMessageMap();
|
||||
void ClearMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id);
|
||||
void AddMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id);
|
||||
void SetFrameCamera(CGuiCamera* camr) {x14_camera = camr;}
|
||||
void SetHeadWidget(CGuiHeadWidget* hwig) {xc_headWidget = hwig;}
|
||||
void SortDrawOrder();
|
||||
void EnableLights(u32 lights) const;
|
||||
void DisableLights() const;
|
||||
@@ -119,19 +51,15 @@ public:
|
||||
void AddLight(CGuiLight* light);
|
||||
bool GetIsFinishedLoading() const;
|
||||
void Touch() const;
|
||||
void ProcessControllerInput(const CFinalInput& input);
|
||||
|
||||
bool Update(float dt);
|
||||
void Update(float dt);
|
||||
void Draw(const CGuiWidgetDrawParms& parms) const;
|
||||
void Stop(const CGuiFrameTransitionOptions&, EFrameStates, bool);
|
||||
void Run(CGuiFrame*, const CGuiFrameTransitionOptions&, EFrameStates, bool);
|
||||
void Initialize();
|
||||
void LoadWidgetsInGame(CInputStream& in);
|
||||
|
||||
CGuiWidgetIdDB& GetWidgetIdDB() {return x64_idDB;}
|
||||
CGuiWidgetIdDB& GetWidgetIdDB() {return x18_idDB;}
|
||||
|
||||
static CGuiFrame* CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in);
|
||||
static std::string CreateFrameName(ResId frmeId);
|
||||
static CGuiFrame* CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp);
|
||||
};
|
||||
|
||||
std::unique_ptr<IObj> RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream& in,
|
||||
|
||||
Reference in New Issue
Block a user