2016-03-10 03:47:37 +00:00
|
|
|
#ifndef __URDE_CGUIFRAME_HPP__
|
|
|
|
#define __URDE_CGUIFRAME_HPP__
|
|
|
|
|
|
|
|
#include "CGuiWidget.hpp"
|
2016-03-11 22:50:15 +00:00
|
|
|
#include "CGuiAutoRepeatData.hpp"
|
|
|
|
#include "CGuiPhysicalMsg.hpp"
|
|
|
|
#include "CGuiControllerInfo.hpp"
|
|
|
|
#include "CGuiLogicalEventTrigger.hpp"
|
|
|
|
#include "CGuiWidgetIdDB.hpp"
|
2016-03-16 20:49:35 +00:00
|
|
|
#include "IObj.hpp"
|
2016-03-10 03:47:37 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
2016-03-11 05:32:18 +00:00
|
|
|
class CGuiSys;
|
2016-03-11 22:50:15 +00:00
|
|
|
class CLight;
|
|
|
|
class CGuiCamera;
|
|
|
|
class CGuiHeadWidget;
|
|
|
|
class CFinalInput;
|
|
|
|
class CGuiLight;
|
2016-03-16 20:49:35 +00:00
|
|
|
class CVParamTransfer;
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-11 05:32:18 +00:00
|
|
|
enum class EFrameTransitionOptions
|
|
|
|
{
|
|
|
|
Zero
|
|
|
|
};
|
|
|
|
|
2016-03-15 04:55:57 +00:00
|
|
|
struct CGuiFrameTransitionOptions
|
2016-03-11 05:32:18 +00:00
|
|
|
{
|
|
|
|
EFrameTransitionOptions x0_opts;
|
|
|
|
bool x4_ = true;
|
|
|
|
float x8_ = 1.f;
|
2016-03-15 04:55:57 +00:00
|
|
|
float xc_ = 0.f;
|
|
|
|
float x10_ = 0.f;
|
|
|
|
float x14_ = 0.f;
|
2016-03-11 05:32:18 +00:00
|
|
|
public:
|
|
|
|
CGuiFrameTransitionOptions(EFrameTransitionOptions opts)
|
|
|
|
: x0_opts(opts) {}
|
|
|
|
};
|
|
|
|
|
2016-03-11 22:50:15 +00:00
|
|
|
class CGuiFrameMessageMapNode
|
|
|
|
{
|
|
|
|
CGuiLogicalEventTrigger x0_trigger;
|
|
|
|
public:
|
|
|
|
CGuiFrameMessageMapNode(const CGuiPhysicalMsg& msg, int val)
|
|
|
|
: x0_trigger(msg, val, false) {}
|
2016-03-14 00:58:19 +00:00
|
|
|
const CGuiLogicalEventTrigger& GetTrigger() const {return x0_trigger;}
|
2016-03-11 22:50:15 +00:00
|
|
|
};
|
|
|
|
|
2016-03-11 05:32:18 +00:00
|
|
|
class CGuiFrame
|
|
|
|
{
|
2016-03-11 22:50:15 +00:00
|
|
|
public:
|
|
|
|
enum class EFrameStates
|
|
|
|
{
|
2016-03-15 04:55:57 +00:00
|
|
|
Zero = 0,
|
|
|
|
One = 1,
|
|
|
|
Two = 2,
|
|
|
|
Three = 3,
|
|
|
|
Four = 4
|
2016-03-11 22:50:15 +00:00
|
|
|
};
|
|
|
|
private:
|
2016-03-12 04:58:56 +00:00
|
|
|
bool x0_controllerStatus[4] = {};
|
2016-03-11 05:32:18 +00:00
|
|
|
std::string x4_name;
|
2016-04-14 21:42:47 +00:00
|
|
|
ResId x14_id;
|
2016-03-14 23:32:44 +00:00
|
|
|
u32 x18_ = 0;
|
2016-03-11 05:32:18 +00:00
|
|
|
CGuiFrameTransitionOptions x1c_transitionOpts;
|
2016-03-15 04:55:57 +00:00
|
|
|
EFrameStates x34_ = EFrameStates::Zero;
|
|
|
|
EFrameStates x38_ = EFrameStates::Zero;
|
2016-03-11 22:50:15 +00:00
|
|
|
CGuiSys& x3c_guiSys;
|
|
|
|
u32 x40_ = 0;
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiHeadWidget* x44_headWidget = nullptr;
|
2016-03-11 22:50:15 +00:00
|
|
|
std::unique_ptr<CGuiWidget> x48_rootWidget;
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiCamera* x4c_camera = nullptr;
|
|
|
|
CGuiWidget* x50_background = nullptr;
|
2016-03-11 22:50:15 +00:00
|
|
|
zeus::CQuaternion x54_;
|
|
|
|
CGuiWidgetIdDB x64_idDB;
|
2016-03-14 00:58:19 +00:00
|
|
|
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;
|
2016-03-12 04:58:56 +00:00
|
|
|
std::vector<CGuiLight*> xa0_lights;
|
2016-03-11 22:50:15 +00:00
|
|
|
int xb0_a;
|
|
|
|
int xb4_b;
|
|
|
|
int xb8_c;
|
2016-03-15 04:55:57 +00:00
|
|
|
bool xbc_24_loaded : 1;
|
2016-03-11 22:50:15 +00:00
|
|
|
bool xbd_flag2 = false;
|
|
|
|
|
2016-03-14 23:32:44 +00:00
|
|
|
static void InterpretGUIControllerState(const CFinalInput& input,
|
|
|
|
CGuiPhysicalMsg::PhysicalMap& state,
|
|
|
|
char& lx, char& ly, char& rx, char& ry);
|
|
|
|
|
2016-03-11 05:32:18 +00:00
|
|
|
public:
|
2016-04-14 21:42:47 +00:00
|
|
|
CGuiFrame(ResId id, const std::string& name, CGuiSys& sys, int a, int b, int c);
|
2016-03-11 22:50:15 +00:00
|
|
|
|
2016-03-12 04:58:56 +00:00
|
|
|
CGuiSys& GetGuiSys() {return x3c_guiSys;}
|
|
|
|
|
|
|
|
CGuiLight* GetFrameLight(int idx) {return xa0_lights[idx];}
|
2016-03-11 22:50:15 +00:00
|
|
|
CGuiWidget* FindWidget(const std::string& name) const;
|
|
|
|
CGuiWidget* FindWidget(s16 id) const;
|
|
|
|
void ResetControllerStatus();
|
2016-03-12 04:58:56 +00:00
|
|
|
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;}
|
2016-03-14 00:58:19 +00:00
|
|
|
WidgetToLogicalEventMap* FindWidget2LogicalEventMap(u64 events);
|
|
|
|
LogicalEventList* FindLogicalEventList(u64 events, s16 id);
|
2016-03-14 23:32:44 +00:00
|
|
|
bool SendWidgetMessage(s16,
|
2016-03-11 22:50:15 +00:00
|
|
|
std::list<std::unique_ptr<CGuiFrameMessageMapNode>>&,
|
|
|
|
CGuiPhysicalMsg::PhysicalMap& state,
|
|
|
|
CGuiControllerInfo::CGuiControllerStateInfo& csInfo);
|
|
|
|
void ClearAllMessageMap();
|
2016-03-14 00:58:19 +00:00
|
|
|
void ClearMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id);
|
|
|
|
void AddMessageMap(const CGuiLogicalEventTrigger* trigger, s16 id);
|
2016-03-11 22:50:15 +00:00
|
|
|
void SortDrawOrder();
|
2016-03-15 04:55:57 +00:00
|
|
|
void EnableLights(u32 lights) const;
|
2016-03-11 22:50:15 +00:00
|
|
|
void DisableLights() const;
|
|
|
|
void RemoveLight(CGuiLight* light);
|
|
|
|
void AddLight(CGuiLight* light);
|
|
|
|
bool GetIsFinishedLoading() const;
|
|
|
|
void Touch() const;
|
|
|
|
void ProcessControllerInput(const CFinalInput& input);
|
|
|
|
|
2016-03-15 04:55:57 +00:00
|
|
|
bool Update(float dt);
|
2016-03-11 22:50:15 +00:00
|
|
|
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;}
|
|
|
|
|
2016-04-14 21:42:47 +00:00
|
|
|
static CGuiFrame* CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in);
|
|
|
|
static std::string CreateFrameName(ResId frmeId);
|
2016-03-11 05:32:18 +00:00
|
|
|
};
|
2016-03-10 03:47:37 +00:00
|
|
|
|
2016-03-16 20:49:35 +00:00
|
|
|
std::unique_ptr<IObj> RGuiFrameFactoryInGame(const SObjectTag& tag, CInputStream& in,
|
|
|
|
const CVParamTransfer& vparms);
|
|
|
|
|
2016-03-10 03:47:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CGUIFRAME_HPP__
|