diff --git a/include/d/tg/d_t_dowsing.h b/include/d/tg/d_t_dowsing.h new file mode 100644 index 00000000..21a583a1 --- /dev/null +++ b/include/d/tg/d_t_dowsing.h @@ -0,0 +1,66 @@ +#ifndef D_T_DOWSING_H +#define D_T_DOWSING_H + +#include +#include + +class dTgDowsing_c : public dTg_c { +public: + dTgDowsing_c(); + virtual ~dTgDowsing_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + + bool checkDowsing() const; + +private: + enum DowsingOption { + TRIAL_0, + TRIAL_1, + TRIAL_2, + TRIAL_3, + PROPELLER, + WATER_BASIN, + CRYSTAL_BALL, + PUMPKIN, + NEW_PLANT_SPECIES, + PARTY_WHEEL, + ZELDA, + DOWSING_MAX + }; + + DowsingTarget mDowsingTarget; // 0x0FC + DowsingOption mDowsingOption; // 0x11C + u16 mUntriggerStoryFlag; // 0x120 + u16 mTriggerStoryFlag; // 0x122 + bool mTargetActive; // 0x124 + + u16 getTriggerSceneFlag() { + return params & 0xFF; + } + + u16 getUntriggerSceneFlag() { + return params >> 0x8 & 0xFF; + } + + DowsingOption getDowsingOption() { + return (DowsingOption)(params >> 0x10 & 0xF); + } + + u32 getDowsingOptionNum() { + return mDowsingOption; + } + + u16 getUntriggerStoryFlag() { + return params >> 0x14 & 0x7FF; + } + + u16 getTriggerStoryFlag() { + return rotation.z.mVal & 0x7FF; + } +}; + +#endif diff --git a/include/d/tg/d_t_genki_dws_tgt.h b/include/d/tg/d_t_genki_dws_tgt.h new file mode 100644 index 00000000..b6d9899f --- /dev/null +++ b/include/d/tg/d_t_genki_dws_tgt.h @@ -0,0 +1,23 @@ +#ifndef D_T_GENKI_DWS_TGT_H +#define D_T_GENKI_DWS_TGT_H + +#include +#include + +class dTgGenkiDwsTgt_c : public dTg_c { +public: + dTgGenkiDwsTgt_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} + virtual ~dTgGenkiDwsTgt_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + + +private: + u16 getSceneFlagFromParams(); + + DowsingTarget mDowsingTarget; // 0xFC +}; + +#endif diff --git a/include/d/tg/d_t_holy_water.h b/include/d/tg/d_t_holy_water.h new file mode 100644 index 00000000..fd6bacfe --- /dev/null +++ b/include/d/tg/d_t_holy_water.h @@ -0,0 +1,24 @@ +#ifndef D_T_HOLY_WATER_H +#define D_T_HOLY_WATER_H + +#include +#include + +class dTgHolyWater_c : public dTg_c { +public: + dTgHolyWater_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} + virtual ~dTgHolyWater_c() {} + + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int draw() override; + + bool isLinkNearby(); + bool dowsingActive(); + +private: + DowsingTarget mDowsingTarget; // 0x0FC +}; + +#endif diff --git a/src/REL/d/t/d_t_dowsing.cpp b/src/REL/d/t/d_t_dowsing.cpp index cc17dc59..e6762980 100644 --- a/src/REL/d/t/d_t_dowsing.cpp +++ b/src/REL/d/t/d_t_dowsing.cpp @@ -1,68 +1,8 @@ -#include -#include +#include #include #include #include -class dTgDowsing_c : public dTg_c { -public: - dTgDowsing_c(); - virtual ~dTgDowsing_c() {} - - virtual int create() override; - virtual int doDelete() override; - virtual int actorExecute() override; - virtual int draw() override; - - bool checkDowsing() const; - -private: - enum DowsingOption { - TRIAL_0, - TRIAL_1, - TRIAL_2, - TRIAL_3, - PROPELLER, - WATER_BASIN, - CRYSTAL_BALL, - PUMPKIN, - NEW_PLANT_SPECIES, - PARTY_WHEEL, - ZELDA, - DOWSING_MAX - }; - - DowsingTarget mDowsingTarget; // 0x0FC - DowsingOption mDowsingOption; // 0x11C - u16 mUntriggerStoryFlag; // 0x120 - u16 mTriggerStoryFlag; // 0x122 - bool mTargetActive; // 0x124 - - u16 getTriggerSceneFlag() { - return params & 0xFF; - } - - u16 getUntriggerSceneFlag() { - return params >> 0x8 & 0xFF; - } - - DowsingOption getDowsingOption() { - return (DowsingOption)(params >> 0x10 & 0xF); - } - - u32 getDowsingOptionNum() { - return mDowsingOption; - } - - u16 getUntriggerStoryFlag() { - return params >> 0x14 & 0x7FF; - } - - u16 getTriggerStoryFlag() { - return rotation.z.mVal & 0x7FF; - } -}; - SPECIAL_ACTOR_PROFILE(T_DOWSING, dTgDowsing_c, fProfile::T_DOWSING, 0x0293, 0, 0); dTgDowsing_c::dTgDowsing_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} diff --git a/src/REL/d/t/d_t_genki_dws_tgt.cpp b/src/REL/d/t/d_t_genki_dws_tgt.cpp index eb61f91b..27636a16 100644 --- a/src/REL/d/t/d_t_genki_dws_tgt.cpp +++ b/src/REL/d/t/d_t_genki_dws_tgt.cpp @@ -1,27 +1,9 @@ -#include -#include +#include #include #include #include #include - -class dTgGenkiDwsTgt_c : public dTg_c { -public: - dTgGenkiDwsTgt_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} - virtual ~dTgGenkiDwsTgt_c() {} - - virtual int create() override; - virtual int doDelete() override; - virtual int actorExecute() override; - - -private: - u16 getSceneFlagFromParams(); - - DowsingTarget mDowsingTarget; // 0xFC -}; - SPECIAL_ACTOR_PROFILE(TAG_GENKI_DOWSING_TARGET, dTgGenkiDwsTgt_c, fProfile::TAG_GENKI_DOWSING_TARGET, 0x02A5, 0, 0); int dTgGenkiDwsTgt_c::create() { diff --git a/src/REL/d/t/d_t_holy_water.cpp b/src/REL/d/t/d_t_holy_water.cpp index c2c7712b..7f6996ae 100644 --- a/src/REL/d/t/d_t_holy_water.cpp +++ b/src/REL/d/t/d_t_holy_water.cpp @@ -1,23 +1,5 @@ #include -#include -#include - -class dTgHolyWater_c : public dTg_c { -public: - dTgHolyWater_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE) {} - virtual ~dTgHolyWater_c() {} - - virtual int create() override; - virtual int doDelete() override; - virtual int actorExecute() override; - virtual int draw() override; - - bool isLinkNearby(); - bool dowsingActive(); - -private: - DowsingTarget mDowsingTarget; // 0x0FC -}; +#include SPECIAL_ACTOR_PROFILE(TAG_HOLY_WATER, dTgHolyWater_c, fProfile::TAG_HOLY_WATER, 0x0224, 0, 4);