d_lyt_mini_game WIP

This commit is contained in:
robojumper
2025-11-28 11:22:02 +01:00
parent 4e39bcca32
commit 4001265892
11 changed files with 2242 additions and 143 deletions
+1
View File
@@ -53,6 +53,7 @@ public:
return checkFlag(flag);
}
static void setFlag(s32 id);
static bool checkTreasureTempCollect(u16 itemId);
void setItemPosition(const mVec3_c &);
void getItemFromBWheelItem();
+6
View File
@@ -5,6 +5,7 @@
#include "m/m2d.h"
#include "nw4r/lyt/lyt_pane.h"
#include "nw4r/lyt/lyt_picture.h"
#include "nw4r/lyt/lyt_types.h"
class dTextBox_c;
class dWindow_c;
@@ -260,6 +261,11 @@ struct AnmGroupBase_c {
return (mFlags & ANMGROUP_FLAG_ENABLE) != 0;
}
// Not sure
inline u8 isEnabled_() const {
return (mFlags & ANMGROUP_FLAG_ENABLE);
}
inline bool isStop() const {
return mpFrameCtrl->isStop();
}
+401 -4
View File
@@ -2,9 +2,381 @@
#define D_LYT_MINI_GAME_H
#include "common.h"
#include "d/d_base.h"
#include "d/lyt/d2d.h"
#include "m/m_vec.h"
class dLytMiniGame_c {
/** 2D UI - Mini Game - Pumpkin score popup */
class dLytMiniGamePumpkinParts_c {
public:
dLytMiniGamePumpkinParts_c() {}
virtual ~dLytMiniGamePumpkinParts_c() {}
bool build(d2d::ResAccIf_c *resAcc);
bool remove();
bool execute();
bool draw();
void init();
void setPumpkinPos(const mVec3_c &pos);
void getPoint(u8 combo, bool doubleScore);
bool isActive() const;
private:
void resetPattern();
void setPattern(s32 pat);
void startGetPoint();
void startDoubleScore();
void stopDoubleScore();
void resetGetPoint();
void resetDoubleScore();
/* 0x004 */ d2d::LytBase_c mLyt;
/* 0x094 */ d2d::AnmGroup_c mAnm[3];
/* 0x154 */ bool field_0x154;
/* 0x158 */ mVec3_c mPumpkinWorldPos;
/* 0x164 */ mVec3_c mPumpkinScreenPos;
/* 0x170 */ mVec2_c field_0x170;
/* 0x178 */ bool mHasPlayedDoubleScoreSound;
};
/** 2D UI - Mini Game - Pumpkin score popups */
class dLytMiniGamePumpkin_c {
public:
dLytMiniGamePumpkin_c() {}
virtual ~dLytMiniGamePumpkin_c() {}
bool build(d2d::ResAccIf_c *resAcc);
bool remove();
bool execute();
bool draw();
void init();
void getPoint(const mVec3_c &pumpkinPos, s32 unk, bool doubleScore);
void calcCombo(s32 unk);
private:
static dLytMiniGamePumpkin_c *sInstance;
/* 0x004 */ dLytMiniGamePumpkinParts_c mParts[3];
/* 0x478 */ s32 field_0x478;
/* 0x47C */ s32 mCombo;
};
/** 2D UI - Mini Game - Bug Heaven */
class dLytMiniGameBugs_c {
public:
dLytMiniGameBugs_c() {}
virtual ~dLytMiniGameBugs_c() {}
bool build(d2d::ResAccIf_c *resAcc);
bool remove();
bool execute();
bool draw();
void init();
enum BugIndex_e {
DEKU_HORNET,
BLESSED_BUTTERFLY,
GERUDO_DRAGONFLY,
STARRY_FIREFLY,
WOODLAND_RHINO_BEETLE,
VOLCANIC_LADYBUG,
SAND_CICADA,
SKY_STAG_BEETLE,
FARON_GRASSHOPPER,
SKYLOFT_MANTIS,
LANAYRU_ANT,
ELDIN_ROLLER,
};
private:
void startAllIconsIn();
void startOut();
void startIn();
void startOutForced();
void collectBug(s32 slot);
void startBugsFlash();
void setBug(s32 slot, s32 bugIndex);
bool isSlotIconOnEndReached(s32 slot) const;
bool isSlotIconOnEnabled(s32 slot) const;
bool isSlotBugCollected(s32 slot);
void resetBugIconsIn();
void resetIn();
void resetOut();
void resetBugIconsOn();
void resetBugIconsTex();
void resetBugIconsFlash();
void stopBugIconsIn();
void stopIn();
void stopOut();
void stopBugIconOn(s32);
void stopBugIconsFlash();
bool isIconInEndReached() const;
bool isInEndReached() const;
bool isOutEndReached() const;
bool isSlotOnEndReached(s32 slot) const;
bool isBug0Flashing() const;
bool areAllBugIconsOn() const;
const d2d::AnmGroup_c &getAnm(s32 idx) const {
return mAnm[idx];
}
d2d::AnmGroup_c &getAnm(s32 idx) {
return mAnm[idx];
}
static dLytMiniGameBugs_c *sInstance;
/* 0x004 */ d2d::LytBase_c mLyt;
/* 0x094 */ d2d::AnmGroup_c mAnm[42];
/* 0xB14 */ s32 mBugItemIds[10];
/* 0xB3C */ bool mBugIconsInEnded;
/* 0xB3D */ bool mInTriggered;
/* 0xB3E */ bool mBugCollected[10];
/* 0xB48 */ bool mBugIconsFlashStarted;
/* 0xB49 */ u8 mBugsNumLevel; ///< 0 = 5 bugs, 1 = 10 bugs
/* 0xB4A */ u8 mBugsNum;
/* 0xB4B */ bool field_0xB4B;
/* 0xB4C */ bool field_0xB4C;
};
/** 2D UI - Mini Game - Time */
class dLytMiniGameTime_c {
public:
dLytMiniGameTime_c() {}
virtual ~dLytMiniGameTime_c() {}
bool build(d2d::ResAccIf_c *resAcc);
bool remove();
bool execute();
bool draw();
void init();
private:
enum TimerVariant_e {
TIMER_LONG,
TIMER_SECONDS,
};
void fn_8028DD80();
void fn_8028DE40();
void fn_8028DED0();
void fn_8028DFD0();
void fn_8028E0C0();
void fn_8028E170();
void fn_8028E1D0();
void startLoop();
void setTimerValueInMilliSeconds(s32 time);
void updateLongTimer();
void setTimerSecondsValueInMilliSeconds(s32 time);
void updateSecondsTimer();
void saveSecondsTimer();
void setBestTime(s32 time);
void setShowBestTime(bool show);
void resetIn();
void resetOut();
void resetAlphaIn();
void resetAlphaOut();
void resetDigits();
void fn_8028EBB0();
void resetShowBestTime();
void resetFinish();
void resetLoop();
void initSignChange();
void stopIn();
void stopOut();
void stopAlphaIn();
void stopAlphaOut();
void stopFinish();
void stopLoop();
bool isInEndReached() const;
bool isOutEndReached() const;
bool isAlphaInEndReached() const;
bool isAlphaOutEndReached() const;
bool isFinishEndReached() const;
void setHighestDigitIndex(u8);
void setSignChange(u32);
void fn_8028F240(bool);
void setBestHasSixDigits(bool);
void setDigit(s32 digitIndex, s32 number);
void setDigitBest(s32 digitIndex, s32 number);
static dLytMiniGameTime_c *sInstance;
/* 0x004 */ d2d::LytBase_c mLyt;
/* 0x094 */ d2d::AnmGroup_c mAnm[29];
/* 0x7D4 */ u8 field_0x7D4;
/* 0x7D8 */ s32 mCurrentTimerValueMilliSeconds;
/* 0x7DC */ s32 mCurrentTimerValueSeconds;
/* 0x7E0 */ s32 mLastTimerValueSeconds;
/* 0x7E4 */ u8 mTimerVariant;
/* 0x7E4 */ s32 mHighestDigitIndex;
/* 0x7EC */ bool field_0x7EC;
/* 0x7ED */ bool field_0x7ED;
/* 0x7EE */ bool field_0x7EE;
/* 0x7F0 */ UNKWORD field_0x7F0;
/* 0x7F4 */ u8 field_0x7F4;
/* 0x7F5 */ bool mIsVisible;
};
/** 2D UI - Mini Game - Start Popup */
class dLytMiniGameStart_c {
public:
dLytMiniGameStart_c() {}
virtual ~dLytMiniGameStart_c() {}
bool build(d2d::ResAccIf_c *resAcc);
bool remove();
bool execute();
bool draw();
void init();
private:
static dLytMiniGameStart_c *sInstance;
void fn_8028F990();
void fn_8028F9E0();
void fn_8028FA40();
void fn_8028FA90();
void fn_8028FAE0();
void fn_8028FB40();
void fn_8028FBA0();
void fn_8028FC00();
void fn_8028FC20();
void fn_8028FC80();
void fn_8028FCE0();
void fn_8028FD40();
void fn_8028FD50();
void fn_8028FD60();
void fn_8028FD70();
void fn_8028FDC0();
void fn_8028FE10();
void fn_8028FE60();
void fn_8028FEB0();
void fn_8028FF00();
/* 0x004 */ d2d::LytBase_c mLyt;
/* 0x094 */ d2d::AnmGroup_c mAnm[3];
};
/** 2D UI - Mini Game - Score counter */
class dLytMiniGameScore_c {
public:
dLytMiniGameScore_c() {}
virtual ~dLytMiniGameScore_c() {}
bool build(d2d::ResAccIf_c *resAcc);
bool remove();
bool execute();
bool draw();
void init();
private:
static dLytMiniGameScore_c *sInstance;
void fn_80291410();
void fn_802915B0();
void fn_80291640();
void fn_80291740();
void fn_80291830();
void fn_80291900();
void fn_80291960();
void fn_80291A30();
void fn_80291B40();
void fn_80291BA0();
void fn_80291BC0();
void fn_80291D40();
void fn_80291E50();
void fn_80291E90();
void fn_80291ED0();
void fn_80291EF0();
void fn_80292030();
void fn_80292040();
void fn_802920B0();
void fn_80292110();
void fn_802921A0();
void fn_80292240();
void fn_80292250();
void fn_802922F0();
void fn_80292380();
void fn_80292400();
void fn_80292480();
void fn_80292500();
void fn_80292590();
void fn_80292610();
void fn_80292710();
void fn_80292880();
void fn_80292910();
void fn_80292920();
void fn_80292930();
void fn_80292940();
void fn_80292950();
void fn_802929C0();
void fn_80292A40();
void fn_80292A50();
void fn_80292AA0();
void fn_80292AF0();
void fn_80292B40();
void fn_80292B90();
void fn_80292BE0();
void fn_80292C30();
void fn_802933A0();
void fn_80293410();
void fn_80293450();
/* 0x004 */ d2d::LytBase_c mLyt;
/* 0x094 */ d2d::AnmGroup_c mAnm[26];
};
/** 2D UI - Mini Game - Fun Fun Island score */
class dLytMiniGameScoreSd_c {
public:
dLytMiniGameScoreSd_c() {}
virtual ~dLytMiniGameScoreSd_c() {}
bool build(d2d::ResAccIf_c *resAcc);
bool remove();
bool execute();
bool draw();
void init();
void fn_80293A30();
void fn_80293A90();
void fn_80293AF0();
void fn_80293BB0();
void fn_80293C60();
void fn_80293D40();
void fn_80293DC0();
void fn_80293E40();
void fn_80293ED0();
void fn_80293F50();
void fn_80293FB0();
void fn_80294010();
void fn_80294020();
void fn_80294030();
void fn_80294080();
private:
static dLytMiniGameScoreSd_c *sInstance;
/* 0x004 */ d2d::LytBase_c mLyt;
/* 0x094 */ d2d::AnmGroup_c mAnm[5];
};
class dLytMiniGame_c : public dBase_c {
public:
dLytMiniGame_c()
: field_0x0068(0),
field_0x0069(0),
field_0x006A(0),
field_0x006B(0),
field_0x006C(0),
field_0x006D(0),
field_0x1510(1) {}
virtual ~dLytMiniGame_c() {}
static dLytMiniGame_c *GetInstance() {
return sInstance;
}
@@ -38,10 +410,35 @@ public:
}
private:
u8 _0x0000[0x3866 - 0x0000];
bool field_0x3866;
static dLytMiniGame_c *sInstance;
/* 0x0068 */ u8 field_0x0068;
/* 0x0069 */ u8 field_0x0069;
/* 0x006A */ u8 field_0x006A;
/* 0x006B */ u8 field_0x006B;
/* 0x006C */ u8 field_0x006C;
/* 0x006D */ u8 field_0x006D;
/* 0x0070 */ d2d::ResAccIf_c mResAcc1;
/* 0x03E0 */ d2d::ResAccIf_c mResAcc2;
/* 0x0750 */ d2d::ResAccIf_c mResAcc3;
/* 0x0AC0 */ d2d::ResAccIf_c mResAcc4;
/* 0x0E30 */ d2d::ResAccIf_c mResAcc5;
/* 0x11A0 */ d2d::ResAccIf_c mResAcc6;
/* 0x1510 */ UNKWORD field_0x1510;
/* 0x1514 */ dLytMiniGameScore_c mScore;
/* 0x1D64 */ dLytMiniGameScoreSd_c mScoreSd;
/* 0x1F40 */ dLytMiniGameStart_c mStart;
/* 0x209C */ dLytMiniGameTime_c mTime;
/* 0x2894 */ dLytMiniGameBugs_c mBugs;
/* 0x33E4 */ dLytMiniGamePumpkin_c mPumpkin;
// TODO
u8 _0x___[0x14E];
bool field_0x3866;
};
#endif
+3 -3
View File
@@ -20,9 +20,9 @@ namespace d3d {
bool create(EGG::Heap *);
f32 fn_80016960(mVec3_c &, const mVec3_c &pos);
bool fn_80016A90(const mVec3_c &pos);
void fn_80016B60(mVec3_c &, const mVec3_c &pos);
f32 worldToScreen(mVec3_c &result, const mVec3_c &worldPos);
bool isOnScreen(const mVec3_c &worldPos);
void screenToWorld(mVec3_c &result, const mVec3_c &screenPos);
void createLightTextures();
class AnmMdlWrapper : public m3d::mdlAnmChr {