d_lyt_control_game OK

This commit is contained in:
robojumper
2025-11-23 15:59:09 +01:00
parent 57557d1128
commit 88075f00a9
27 changed files with 1417 additions and 400 deletions
+58 -17
View File
@@ -1,29 +1,58 @@
#ifndef D_LYT_CONTROL_GAME_H
#define D_LYT_CONTROL_GAME_H
// clang-format off
// vtable order
#include "common.h"
#include "d/d_base.h"
#include "d/lyt/d_lyt_map.h"
#include "d/lyt/d_lyt_wipe.h"
#include "d/lyt/meter/d_lyt_meter.h"
#include "d/lyt/msg_window/d_lyt_msg_window.h"
#include "d/lyt/msg_window/d_lyt_simple_window.h"
#include "d/lyt/d_lyt_wipe.h"
#include "d/lyt/d_lyt_help.h"
#include "d/lyt/d_lyt_map.h"
#include "s/s_State.hpp"
#include "toBeSorted/arc_managers/layout_arc_manager.h"
#include "toBeSorted/raii_ptr.h"
// clang-format on
class dLytDrawMark_c;
class dLytControlGame_c : public dBase_c {
public:
dLytControlGame_c();
virtual ~dLytControlGame_c();
enum Cmd_e {
CMD_NONE = 0,
CMD_MAP = 1,
CMD_PAUSE = 2,
CMD_HELP = 3,
};
virtual int create() override;
virtual int doDelete() override;
virtual int execute() override;
virtual int draw() override;
bool isInSomeMapState() const;
bool isNotInStateMap() const;
void openCollectionScreenDemo();
bool isStateNormalOrNotInEvent() const;
void somehowRelatedToEnteringLightPillars(s32, s32, s32);
void fn_802CCD40(bool);
bool isStateNotNormalOrInEvent() const;
bool fn_802CFF60() const;
void setMapEventDone(bool);
void fn_802D04F0();
void checkForBeaconNextToMark();
void hideHelp();
void changeHelpText(s32 textIndex);
void openPause();
void openPauseDemo();
void openHelp(s32 textIndex);
void openMap();
void openMapEvent(s32 mapEvent, s32 arg1, s32 arg2);
void resetFootsteps();
const dMapFootPrintsQueue_c *getFootprintsQueue() const {
return mFootprintsMgr.getQueue();
@@ -80,31 +109,43 @@ public:
}
private:
bool checkStoryflag(s32 flag) const;
void fn_802CFA90();
bool canOpenPause();
bool releaseRes();
bool decrementRes();
/* 0x00068 */ UI_STATE_MGR_DECLARE(dLytControlGame_c);
/* 0x000A4 */ RaiiPtr<void*> field_0x000A4;
/* 0x000A4 */ RaiiPtr<dLytMap_c> mpMap;
/* 0x000A8 */ dLytMeter_c mMeter;
/* 0x13C10 */ dLytMsgWindow_c mMsgWindow;
/* 0x14E34 */ dLytSimpleWindow_c mSimpleWindow;
/* 0x152A0 */ dLytWipe_c mWipe;
/* 0x15848 */ u8 _0x15848[0x15850 - 0x15848];
/* 0x15848 */ dLytHelp_c *mpHelp;
/* 0x1584C */ dLytDrawMark_c *mpDrawMark;
/* 0x15850 */ dMapFootPrintsMgr_c mFootprintsMgr;
/* 0x15C24 */ UNKWORD field_0x15C24;
/* 0x15C28 */ UNKWORD field_0x15C28;
/* 0x15C24 */ s32 mCommand;
/* 0x15C28 */ s32 mHelpTextIndex;
/* 0x15C2C */ s32 mCurrentPauseDisp;
/* 0x15C30 */ s32 mPauseDisp00Tab;
/* 0x15C34 */ u8 mIsEvent;
/* 0x15C38 */ s32 mMapEvent;
/* 0x15C34 */ u8 _0x15C34[0x15C40 - 0x15C34];
/* 0x15C3C */ u8 _0x15C3C[0x15C40 - 0x15C3C];
/* 0x15C40 */ LayoutArcControl mLytArcControl;
/* 0x15C4C */ u8 _0x15C4C[0x15C60 - 0x15C4C];
/* 0x15C4C */ s32 mMapEventArg1;
/* 0x15C50 */ s32 mMapEventArg2;
/* 0x15C54 */ UNKWORD field_0x15C54;
/* 0x15C58 */ UNKWORD field_0x15C58;
/* 0x15C5C */ u8 _0x15C5C[0x15C60 - 0x15C5C];
/* 0x15C60 */ u16 mItemForPauseDemo;
/* 0x15C62 */ u8 _0x15C62[0x15C64 - 0x15C62];
/* 0x15C62 */ u16 mPickupItemCount;
/* 0x15C64 */ u16 mItemCountForPauseDemo;
/* 0x15C66 */ u8 field_0x15C66;
/* 0x15C67 */ bool mIsPauseDemo;
+48
View File
@@ -0,0 +1,48 @@
#ifndef D_LYT_DRAW_MARK_H
#define D_LYT_DRAW_MARK_H
#include "d/lyt/d2d.h"
#include "m/m_vec.h"
#include "s/s_State.hpp"
class dLytDrawMark_c {
public:
dLytDrawMark_c() : mStateMgr(*this) {}
~dLytDrawMark_c() {}
bool build(UNKWORD);
bool remove();
bool execute();
bool draw();
u8 getField_0x940() const {
return field_0x940;
}
void setField_0x941(u8 v) {
field_0x941 = v;
}
private:
/* 0x000 */ UI_STATE_MGR_DECLARE(dLytDrawMark_c);
/* 0x018 */ d2d::LytBase_c mLyt;
/* 0x0CC */ d2d::AnmGroup_c mAnm[16];
/* 0x4CC */ u8 _0x4CC[0x504 - 0x4CC];
/* 0x504 */ d2d::ResAccIf_c mResAcc;
/* 0x874 */ u8 _0x874[0x88C - 0x874];
/* 0x88C */ mVec2_c field_0x88C[6];
/* 0x8BC */ mVec2_c field_0x8BC[6];
/* 0x8EC */ u8 _0x8EC[0x940 - 0x8EC];
/* 0x940 */ u8 field_0x940;
/* 0x941 */ u8 field_0x941;
/* 0x942 */ u8 _0x942[0x958 - 0x942];
};
#endif
+18 -2
View File
@@ -65,6 +65,22 @@ public:
bool setText(s32 textIndex);
void changeText(s32 textIndex);
static dLytHelp_c *GetInstance() {
return sInstance;
}
bool isStateEnd() const {
return *mStateMgr.getStateID() == StateID_End;
}
void requestOut() {
mOutRequest = true;
}
bool isWaiting() const {
return mIsWaiting;
}
private:
static dLytHelp_c *sInstance;
@@ -80,8 +96,8 @@ private:
/* 0x04C */ d2d::ResAccIf_c mResAcc;
/* 0x3BC */ dLytHelpMain_c *mpMain;
/* 0x3C0 */ bool field_0x3C0;
/* 0x3C1 */ bool field_0x3C1;
/* 0x3C2 */ bool field_0x3C2;
/* 0x3C1 */ bool mOutRequest;
/* 0x3C2 */ bool mIsWaiting;
/* 0x3C4 */ s32 mTextIndex;
/* 0x3C8 */ s32 field_0x3C8;
};
+49 -5
View File
@@ -4,6 +4,7 @@
#include "common.h"
#include "d/d_cursor_hit_check.h"
#include "d/d_message.h"
#include "d/d_sc_game.h"
#include "d/lyt/d2d.h"
#include "d/lyt/d_lyt_map_capture.h"
#include "d/lyt/d_lyt_map_global.h"
@@ -13,6 +14,7 @@
#include "egg/core/eggColorFader.h"
#include "egg/core/eggFader.h"
#include "m/m2d.h"
#include "m/m_allocator.h"
#include "m/m_angle.h"
#include "m/m_vec.h"
#include "nw4r/lyt/lyt_bounding.h"
@@ -87,10 +89,18 @@ public:
void execute();
void reset() {
mQueue.init();
}
const dMapFootPrintsQueue_c *getQueue() const {
return &mQueue;
}
void setFootstepMinDistSq(f32 value) {
mMinStepDistanceSq = value;
}
private:
/* 0x004 */ dMapFootPrintsQueue_c mQueue;
/* 0x3D0 */ f32 mMinStepDistanceSq;
@@ -636,10 +646,9 @@ public:
/** arg1 = surface province */
MAP_EVENT_SAVE_OBJ = 10,
MAP_EVENT_11 = 11,
};
private:
// TODO - need to come up with better names for all of these enums and concepts
MAP_EVENT_MAX = 12,
};
enum SurfaceProvince_e {
SURFACE_PROVINCE_FARON = 0,
@@ -647,6 +656,9 @@ private:
SURFACE_PROVINCE_LANAYRU = 2,
};
private:
// TODO - need to come up with better names for all of these enums and concepts
enum AreaGroup_e {
AREAGROUP_SKY = 1,
AREAGROUP_FARON = 2,
@@ -716,7 +728,7 @@ private:
void loadTextboxes();
void saveMapState();
void initMapState();
static void initMapState();
void loadMapState();
void checkCursorPointedAtMap();
@@ -747,6 +759,10 @@ private:
mMapEvent == MAP_EVENT_11;
}
void setMapEventDone(bool done) {
mEventDone = done;
}
/* 0x0010 */ UI_STATE_MGR_DECLARE(dLytMapMain_c);
/* 0x004C */ dFlowMgrBase_c mFlowMgr;
/* 0x00A4 */ dFlow_c mFlow;
@@ -896,9 +912,13 @@ private:
class dLytMap_c {
public:
dLytMap_c() {
mMapFader.setVisible(false);
sInstance = this;
}
virtual ~dLytMap_c() {
if (dScGame_c::GetInstance() != nullptr) {
dScGame_c::GetInstance()->setTargetingScreenPrio(0x85);
}
sInstance = nullptr;
}
@@ -918,6 +938,22 @@ public:
return mMapMain.isOpen();
}
bool checkClose() const {
return mMapMain.checkClose();
}
bool isMapIntroDone() const {
return mMapMain.isMapIntroDone();
}
void close() {
mMapMain.close();
}
static void initMapState() {
dLytMapMain_c::initMapState();
}
bool isVisibleNoIntro() const {
return mMapMain.isVisibleNoIntro();
}
@@ -938,6 +974,14 @@ public:
return mMapMain.mMapEvent == dLytMapMain_c::MAP_EVENT_SAVE_OBJ;
}
void startMapEvent(s32 mapEvent, s32 arg1, s32 arg2) {
mMapMain.startMapEvent(mapEvent, arg1, arg2);
}
void setMapEventDone(bool done) {
mMapMain.setMapEventDone(done);
}
void queueMapEvent(s32 mapEvent, s32 arg1, s32 arg2) {
mMapMain.queueMapEvent(mapEvent, arg1, arg2);
}
@@ -951,7 +995,7 @@ public:
private:
/* 0x0004 */ d2d::ResAccIf_c mResAcc;
/* 0x0374 */ dLytMapMain_c mMapMain;
/* 0x91A4 */ u8 _0x91A4[0x91C0 - 0x91A4];
/* 0x91A4 */ mHeapAllocator_c field_0x91A4;
/* 0x91C0 */ dLytMapFader_c mMapFader;
static dLytMap_c *sInstance;
+7 -3
View File
@@ -176,8 +176,12 @@ public:
mMapEvent = v;
}
u8 getField_0x54() const {
return field_0x54;
bool isInMapEvent() const {
return mInMapEvent;
}
void setInMapEvent(bool v) {
mInMapEvent = v;
}
void projectOntoMap(mVec2_c &result, const mVec3_c &position) const;
@@ -213,7 +217,7 @@ private:
/* 0x4E */ u8 mAlpha;
/* 0x4F */ u8 field_0x4F;
/* 0x50 */ s32 mMapEvent;
/* 0x54 */ u8 field_0x54;
/* 0x54 */ bool mInMapEvent;
/* 0x55 */ u8 field_0x55;
/* 0x56 */ mAng field_0x56;
/* 0x58 */ f32 field_0x58;
+5 -1
View File
@@ -215,6 +215,10 @@ public:
void inRequest();
bool isActive() const {
return mIsActive;
}
static f32 sDisp00ArrowRotation;
static f32 sDisp00ArrowLength;
@@ -256,7 +260,7 @@ private:
/* 0x0833 */ u8 mCurrentSelectionTab;
/* 0x0834 */ u8 mTimer;
/* 0x0835 */ u8 field_0x0835;
/* 0x0836 */ bool field_0x0836;
/* 0x0836 */ bool mIsActive;
/* 0x0837 */ bool field_0x0837;
/* 0x0838 */ bool field_0x0838;
/* 0x0839 */ bool field_0x0839;
+25
View File
@@ -74,6 +74,13 @@ public:
POSITION_MAP = 1,
};
enum Mode_e {
MODE_MAP_INIT = 0,
MODE_MAP = 1,
MODE_PAUSE = 2,
MODE_NONE = 4,
};
dLytMeterMain_c();
virtual ~dLytMeterMain_c() {}
@@ -250,6 +257,18 @@ public:
return mMain.mItemSelect.fn_800F0220(arg);
}
bool itemSelectFn800EFDF0(bool b) const {
return mMain.mItemSelect.fn_800EFDF0(b);
}
bool minusBtnFn800F7600() const {
return mMain.mMinusBtn.fn_800F7600();
}
bool dowsingFn800FE4B0() const {
return mMain.mDowsing.fn_800FE4B0();
}
bool dowsingDemoRelated(s32 arg) {
return mMain.mDowsing.fn_800FE3C0(arg);
}
@@ -484,6 +503,12 @@ public:
}
}
static void setPlusBtnCall(bool call) {
if (sInstance != nullptr) {
sInstance->mMain.mPlusBtn.setCall(call);
}
}
static void setSelectBtn(f32 angle, f32 length) {
if (sInstance != nullptr) {
dLytMeterMain_c *main = &sInstance->mMain;