From 08844fb5da445344613971b66e7fdc9ff55290ac Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:44:48 +0100 Subject: start with d_t_insect --- include/c/c_lib.h | 1 + include/d/a/obj/d_a_obj_base.h | 7 +++++++ include/d/t/d_t_insect.h | 28 ++++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/c/c_lib.h b/include/c/c_lib.h index 04829ddd..be7b0d5e 100644 --- a/include/c/c_lib.h +++ b/include/c/c_lib.h @@ -8,6 +8,7 @@ namespace cLib { s16 targetAngleY(const mVec3_c &target, const mVec3_c &source); s16 targetAngleX(const mVec3_c &target, const mVec3_c &source); +s16 offsetPos(mVec3_c &target, const mVec3_c &v1, s16 angle, const mVec3_c &v2); void addCalcPos2(mVec3_c *src, const mVec3_c &target, f32 scale, f32 maxStep); f32 addCalcPosXZ(mVec3_c *src, const mVec3_c &target, f32 scale, f32 maxStep, f32 minStep); f32 addCalcPos(mVec3_c *src, const mVec3_c &target, f32 scale, f32 maxStep, f32 minStep); diff --git a/include/d/a/obj/d_a_obj_base.h b/include/d/a/obj/d_a_obj_base.h index 1faa9589..b41b517a 100644 --- a/include/d/a/obj/d_a_obj_base.h +++ b/include/d/a/obj/d_a_obj_base.h @@ -220,7 +220,14 @@ public: fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, u32 roomId ); + // These may not belong here + // fn_8002F190 + // TODO: return type is probably a superclass for all insects + static dAcBase_c* createInsectActor( + dAcBase_c* parent, + fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, s32 roomId + ); static dAcBase_c *createActorUnkGroup3( fProfile::PROFILE_NAME_e actorId, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2 diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index 25287d12..cd3b4e0b 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -2,12 +2,13 @@ #define D_T_INSECT_H #include "d/a/d_a_base.h" +#include "m/m_vec.h" #include "s/s_State.hpp" #include "s/s_StateMgr.hpp" class dTgInsect_c : public dAcBase_c { public: - dTgInsect_c() : mStateMgr(*this, sStateID::null) {} + dTgInsect_c() : mStateMgr(*this, sStateID::null), unk26C(0), unk270(0), unk274(0) {} virtual ~dTgInsect_c() {} STATE_FUNC_DECLARE(dTgInsect_c, Wait); @@ -16,7 +17,30 @@ public: STATE_FUNC_DECLARE(dTgInsect_c, End); private: - /* 0x??? */ STATE_MGR_DECLARE(dTgInsect_c); + /* 0x0FC */ STATE_MGR_DECLARE(dTgInsect_c); + /* 0x138 */ dAcRef_c mLinks[16]; + /* 0x1F8 */ u8 unk1F8[0x208-0x1F8]; + /* 0x208 */ s32 unk208[16]; + /* 0x248 */ s32 mInsectCount; + /* 0x24C */ u8 unk24C; + /* 0x24D */ u8 unk24D; + /* 0x24E */ u8 unk24E; + /* 0x24F */ u8 unk24F; + /* 0x250 */ u8 unk250[16]; + /* 0x260 */ u8 unk260[0x26C-0x260]; + /* 0x26C */ s32 unk26C; + /* 0x270 */ s32 unk270; + /* 0x274 */ s32 unk274; + + s32 getSpawnSubtype() const { + return (mParams >> 8 & 0xF); + } + s32 getSubtype() const { + return (mParams >> 4 & 0xF); + } + void spawnInsect(s32 index); + bool shouldSpawn(); + bool someGroundCheck(const mVec3_c &pos,s32 param_3); }; #endif -- cgit v1.2.3 From 413cfaa41f0811e209d16dea6a9aa79df757679d Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Thu, 4 Dec 2025 13:42:58 +0100 Subject: insect tag progress --- include/d/a/d_a_base.h | 8 ++++ include/d/a/d_a_insect_butterfly.h | 11 ++++- include/d/a/obj/d_a_obj_soil.h | 7 ++- include/d/a/obj/d_a_obj_warp.h | 48 +++++++++++++++++++ include/d/flag/storyflag_map.h | 8 ++-- include/d/t/d_t_insect.h | 95 ++++++++++++++++++++++++++++++++++---- include/nw4r/math/math_geometry.h | 1 + 7 files changed, 163 insertions(+), 15 deletions(-) (limited to 'include') diff --git a/include/d/a/d_a_base.h b/include/d/a/d_a_base.h index c24f8ed7..6df2237e 100644 --- a/include/d/a/d_a_base.h +++ b/include/d/a/d_a_base.h @@ -4,6 +4,7 @@ #include "common.h" #include "d/d_base.h" #include "d/snd/d_snd_source_if.h" +#include "f/f_profile_name.h" #include "m/m_allocator.h" #include "m/m_angle.h" #include "m/m_vec.h" @@ -180,6 +181,9 @@ public: bool checkBeyondRadius(const mVec3_c &point, f32 radius) { return getSquareDistanceTo(point) > radius; } + bool checkInRadius(const mVec3_c &point, f32 radius) { + return getSquareDistanceTo(point) < radius; + } u32 getRoomId() { return mRoomID; @@ -195,6 +199,10 @@ public: return mActorProperties & property; } + dAcBase_c* searchNextActor(dAcBase_c* parent) { + return static_cast(fManager_c::searchBaseByGroupType(dAcBase_c::ACTOR, parent)); + } + public: static void setTempCreateParams( mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, s32 roomId, u32 params2, dAcBase_c *parent, u8 subtype, u16 unkFlag, diff --git a/include/d/a/d_a_insect_butterfly.h b/include/d/a/d_a_insect_butterfly.h index 84c32694..91688269 100644 --- a/include/d/a/d_a_insect_butterfly.h +++ b/include/d/a/d_a_insect_butterfly.h @@ -4,8 +4,9 @@ #include "d/a/obj/d_a_obj_base.h" #include "s/s_State.hpp" #include "s/s_StateMgr.hpp" +#include "d/a/d_a_insect.h" -class dAcInsectButterfly_c : public dAcObjBase_c { +class dAcInsectButterfly_c : public dAcOInsect_c { public: dAcInsectButterfly_c() : mStateMgr(*this, sStateID::null) {} virtual ~dAcInsectButterfly_c() {} @@ -16,8 +17,14 @@ public: STATE_FUNC_DECLARE(dAcInsectButterfly_c, Finalize); STATE_FUNC_DECLARE(dAcInsectButterfly_c, Dead); + void setKillSignal() { + killSignal = 1; + } private: - /* 0x??? */ STATE_MGR_DECLARE(dAcInsectButterfly_c); + /* 0x468 */ u8 field_0x468[0xA34-0x468]; + /* 0xA34 */ STATE_MGR_DECLARE(dAcInsectButterfly_c); + /* 0xA70 */ u8 field_0xA70[0xAC6-0xA70]; + /* 0xAC6 */ u8 killSignal; }; #endif diff --git a/include/d/a/obj/d_a_obj_soil.h b/include/d/a/obj/d_a_obj_soil.h index c4e24b31..64f1f0f9 100644 --- a/include/d/a/obj/d_a_obj_soil.h +++ b/include/d/a/obj/d_a_obj_soil.h @@ -14,8 +14,13 @@ public: STATE_FUNC_DECLARE(dAcOsoil_c, Hole); STATE_FUNC_DECLARE(dAcOsoil_c, Ready); + bool isStateHole() { + return mStateMgr.isState(StateID_Hole); + } + private: - /* 0x??? */ STATE_MGR_DECLARE(dAcOsoil_c); + /* 0x330 */ u8 field_0x330[0x6CC-0x330]; + /* 0x6CC */ STATE_MGR_DECLARE(dAcOsoil_c); }; #endif diff --git a/include/d/a/obj/d_a_obj_warp.h b/include/d/a/obj/d_a_obj_warp.h index 1c64e61c..0b2f4874 100644 --- a/include/d/a/obj/d_a_obj_warp.h +++ b/include/d/a/obj/d_a_obj_warp.h @@ -2,6 +2,7 @@ #define D_A_OBJ_WARP_H #include "d/a/obj/d_a_obj_base.h" +#include "d/flag/storyflag_manager.h" #include "s/s_State.hpp" #include "s/s_StateMgr.hpp" @@ -18,7 +19,54 @@ public: STATE_FUNC_DECLARE(dAcOWarp_c, GateIn); STATE_FUNC_DECLARE(dAcOWarp_c, GateClear); + virtual void fn_0x80(); + virtual void fn_0x84(); + virtual void fn_0x88(); + virtual s32 checkStateGateOpen(); + virtual s32 fn_0x90(); + virtual s32 checkThisHasSongItem(); + + bool isFaronTrial() const { + return mTrialIndexBitmask & 0x10; + } + + bool isEldinTrial() const { + return mTrialIndexBitmask & 0x40; + } + + bool isLanayruTrial() const { + return mTrialIndexBitmask & 0x20; + } + + bool isHyliaTrial() const { + return mTrialIndexBitmask & 0x80; + } + + bool isFaronTrialAndCompleted() const { + return isFaronTrial() && StoryflagManager::sInstance->getFlag(STORYFLAG_FARON_TRIAL_COMPLETE); + } + + bool isEdlinTrialAndCompleted() const { + return isEldinTrial() && StoryflagManager::sInstance->getFlag(STORYFLAG_ELDIN_TRIAL_COMPLETE); + } + + bool isLanayruTrialAndCompleted() const { + return isLanayruTrial() && StoryflagManager::sInstance->getFlag(STORYFLAG_LANAYRU_TRIAL_COMPLETE); + } + + bool isHyliaTrialAndCompleted() const { + return isHyliaTrial() && StoryflagManager::sInstance->getFlag(STORYFLAG_HYLIA_TRIAL_COMPLETE); + } + + bool isTrialComplete() const { + return isFaronTrialAndCompleted() + || isEdlinTrialAndCompleted() + || isLanayruTrialAndCompleted() + || isHyliaTrialAndCompleted(); + } private: + /* 0x330 */ u8 field_0x330[0xC66-0x330]; + /* 0xC66 */ u8 mTrialIndexBitmask; /* 0x??? */ STATE_MGR_DECLARE(dAcOWarp_c); }; diff --git a/include/d/flag/storyflag_map.h b/include/d/flag/storyflag_map.h index 86271424..940380fd 100644 --- a/include/d/flag/storyflag_map.h +++ b/include/d/flag/storyflag_map.h @@ -1050,22 +1050,22 @@ enum StoryFlags_e { * layer 3 / Skyview Boss Room layer 3 / Lake Floria layer 1 / Water Dragon's Lair layer 1)] Story Flag #206 * (0x00CE) - JP 805ACD70 0x04 / US 805A9AF0 0x04 */ - STORYFLAG_206, + STORYFLAG_FARON_TRIAL_COMPLETE, /** [Eldin Trial Completed (removes fi trigger in front of Volcano Summit)] * Story Flag #207 (0x00CF) - JP 805ACD70 0x08 / US 805A9AF0 0x08 */ - STORYFLAG_207, + STORYFLAG_ELDIN_TRIAL_COMPLETE, /** [Lanayru Trial Completed (Lanayru Caves layer 1)] * Story Flag #208 (0x00D0) - JP 805ACD70 0x10 / US 805A9AF0 0x10 */ - STORYFLAG_208, + STORYFLAG_LANAYRU_TRIAL_COMPLETE, /** [Hylia's Trial Completed (Triggers Fi Text after Skyloft Trial)] * Story Flag #209 (0x00D1) - JP 805ACD70 0x20 / US 805A9AF0 0x20 */ - STORYFLAG_209, + STORYFLAG_HYLIA_TRIAL_COMPLETE, /** [Obtain Stone of Trials] * Story Flag #210 (0x00D2) - JP 805ACD70 0x40 / US 805A9AF0 0x40 diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index cd3b4e0b..ef17d2e6 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -6,9 +6,34 @@ #include "s/s_State.hpp" #include "s/s_StateMgr.hpp" -class dTgInsect_c : public dAcBase_c { +class dTgInsectSupertype_c : public dAcBase_c {}; + +extern "C" bool fn_801BB750(nw4r::math::AABB *aabb, f32 f); + +class dTgInsect_c : public dTgInsectSupertype_c { public: - dTgInsect_c() : mStateMgr(*this, sStateID::null), unk26C(0), unk270(0), unk274(0) {} + enum Subtype { + SUBTYPE_VOLCANIC_LADYBUG = 3, + SUBTYPE_GERUDO_DRAGONFLY, + SUBTYPE_WOODLAND_RHINO_BEETLE, + SUBTYPE_SAND_CICADA, + SUBTYPE_FARON_GRASSHOPPER, + SUBTYPE_LANAYRU_ANT, + SUBTYPE_SKY_STAG_BEETLE, + SUBTYPE_BUTTERFLY, + SUBTYPE_SKYLOFT_MANTIS, + SUBTYPE_EDLIN_ROLLER, + SUBTYPE_STARRY_FIREFLY, + }; + enum SpawnSubtype { + SPAWN_SKYLOFT_BUGKID_TREE = 1, + SPAWN_BUG_MINIGAME, + SPAWN_TRIAL_GATE, + SPAWN_GOSSIP_STONE, + SPAWN_GODDESS_WALL, // doesn't seem to be used? + SPAWN_DEFAULT = 0xF, + }; + dTgInsect_c() : mStateMgr(*this, sStateID::null) {} virtual ~dTgInsect_c() {} STATE_FUNC_DECLARE(dTgInsect_c, Wait); @@ -19,7 +44,7 @@ public: private: /* 0x0FC */ STATE_MGR_DECLARE(dTgInsect_c); /* 0x138 */ dAcRef_c mLinks[16]; - /* 0x1F8 */ u8 unk1F8[0x208-0x1F8]; + /* 0x1F8 */ u8 unk1F8[0x208 - 0x1F8]; /* 0x208 */ s32 unk208[16]; /* 0x248 */ s32 mInsectCount; /* 0x24C */ u8 unk24C; @@ -27,20 +52,74 @@ private: /* 0x24E */ u8 unk24E; /* 0x24F */ u8 unk24F; /* 0x250 */ u8 unk250[16]; - /* 0x260 */ u8 unk260[0x26C-0x260]; - /* 0x26C */ s32 unk26C; - /* 0x270 */ s32 unk270; - /* 0x274 */ s32 unk274; + /* 0x260 */ mVec3_c unk260; + /* 0x26C */ dAcRef_c unk26C; s32 getSpawnSubtype() const { return (mParams >> 8 & 0xF); } + bool isSpawnSubtype(s32 spanwSubtype) const { + return getSpawnSubtype() == spanwSubtype; + } s32 getSubtype() const { return (mParams >> 4 & 0xF); } + bool isSubtype(u8 subtype) const { + return getSubtype() == subtype; + } + s32 getInsectCount() const { + return (mParams & 0xF); + } void spawnInsect(s32 index); bool shouldSpawn(); - bool someGroundCheck(const mVec3_c &pos,s32 param_3); + void spawnAll(); + bool someGroundCheck(const mVec3_c &pos, s32 param_3); + void handleForceEscape(s32 i) { + if (mLinks[i].isLinked()) { + mLinks[i].get()->mActorProperties |= AC_PROP_0x4; + } + } + bool isButterfly() const { + return isSubtype(10); + } + bool isTrialGateType() const { + if (getSubtype() != SUBTYPE_BUTTERFLY) { + return false; + } + if (getSpawnSubtype() != SPAWN_TRIAL_GATE) { + return false; + } + return true; + } + bool isGossipStoneType() const { + if (!isButterfly()) { + return false; + } + if (!isSpawnSubtype(SPAWN_GOSSIP_STONE)) { + return false; + } + return true; + } + bool isGoddessWallType() const { + if (!isButterfly()) { + return false; + } + if (!isSpawnSubtype(SPAWN_GODDESS_WALL)) { + return false; + } + return true; + } + f32 getOriginalScaleX() const { + return 100 * mScale.x; + } + f32 getOriginalScaleY() const { + return 100 * mScale.y; + } + inline s32 getTries() { + return 5; + } + int actorCreate(); + int actorPostCreate(); }; #endif diff --git a/include/nw4r/math/math_geometry.h b/include/nw4r/math/math_geometry.h index 922942e8..657c95b3 100644 --- a/include/nw4r/math/math_geometry.h +++ b/include/nw4r/math/math_geometry.h @@ -36,6 +36,7 @@ struct AABB { AABB() {} AABB(const VEC3 &min, const VEC3 &max) : min(min), max(max) {} + AABB(f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ) : min(minX, minY, minZ), max(maxX, maxY, maxZ) {} void Set(const VEC3 *points, unsigned int num); void Set(const AABB *box, const MTX34 *mtx); -- cgit v1.2.3 From 71b1bfa6d1cc8873d4d40d1226b878b0fc4aee3b Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Thu, 4 Dec 2025 14:23:16 +0100 Subject: document d_t_insect --- include/d/t/d_t_insect.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index ef17d2e6..57660447 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -30,12 +30,16 @@ public: SPAWN_BUG_MINIGAME, SPAWN_TRIAL_GATE, SPAWN_GOSSIP_STONE, - SPAWN_GODDESS_WALL, // doesn't seem to be used? + SPAWN_GODDESS_WALL, SPAWN_DEFAULT = 0xF, }; dTgInsect_c() : mStateMgr(*this, sStateID::null) {} virtual ~dTgInsect_c() {} + void setKillSignal() { + mKillSignal = 1; + } + STATE_FUNC_DECLARE(dTgInsect_c, Wait); STATE_FUNC_DECLARE(dTgInsect_c, WaitCreate); STATE_FUNC_DECLARE(dTgInsect_c, WaitForceEscape); @@ -44,16 +48,16 @@ public: private: /* 0x0FC */ STATE_MGR_DECLARE(dTgInsect_c); /* 0x138 */ dAcRef_c mLinks[16]; - /* 0x1F8 */ u8 unk1F8[0x208 - 0x1F8]; - /* 0x208 */ s32 unk208[16]; + /* 0x1F8 */ u8 unk1F8[16]; + /* 0x208 */ s32 mInsectRespanwTimers[16]; /* 0x248 */ s32 mInsectCount; - /* 0x24C */ u8 unk24C; - /* 0x24D */ u8 unk24D; + /* 0x24C */ u8 mRevealed; // used by OBJ_SOIL and OBJ_VSD to signal that the insect should be spawned now + /* 0x24D */ u8 mKillSignal; // used by goddess walls to signal that the insects should despawn /* 0x24E */ u8 unk24E; /* 0x24F */ u8 unk24F; - /* 0x250 */ u8 unk250[16]; - /* 0x260 */ mVec3_c unk260; - /* 0x26C */ dAcRef_c unk26C; + /* 0x250 */ u8 mShouldSpawn[16]; + /* 0x260 */ mVec3_c mRevealedSpawnPos; + /* 0x26C */ dAcRef_c mWarpRef; s32 getSpawnSubtype() const { return (mParams >> 8 & 0xF); -- cgit v1.2.3 From e995c184e15a77313da0a94e17f7cf6550448004 Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Thu, 4 Dec 2025 14:54:25 +0100 Subject: match actorCreate --- include/d/t/d_t_insect.h | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index 57660447..664478d2 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -87,31 +87,13 @@ private: return isSubtype(10); } bool isTrialGateType() const { - if (getSubtype() != SUBTYPE_BUTTERFLY) { - return false; - } - if (getSpawnSubtype() != SPAWN_TRIAL_GATE) { - return false; - } - return true; + return getSubtype() != SUBTYPE_BUTTERFLY ? false : getSpawnSubtype() == SPAWN_TRIAL_GATE; } bool isGossipStoneType() const { - if (!isButterfly()) { - return false; - } - if (!isSpawnSubtype(SPAWN_GOSSIP_STONE)) { - return false; - } - return true; + return getSubtype() != SUBTYPE_BUTTERFLY ? false : getSpawnSubtype() == SPAWN_GOSSIP_STONE; } bool isGoddessWallType() const { - if (!isButterfly()) { - return false; - } - if (!isSpawnSubtype(SPAWN_GODDESS_WALL)) { - return false; - } - return true; + return getSubtype() != SUBTYPE_BUTTERFLY ? false : getSpawnSubtype() == SPAWN_GODDESS_WALL; } f32 getOriginalScaleX() const { return 100 * mScale.x; -- cgit v1.2.3 From 44ec1a000301f7b48d38bc1a6ed8180fb3b9371e Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Thu, 4 Dec 2025 16:28:44 +0100 Subject: tmp --- include/d/t/d_t_insect.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index 664478d2..560ed957 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -104,8 +104,8 @@ private: inline s32 getTries() { return 5; } - int actorCreate(); - int actorPostCreate(); + int actorCreate() override; + int actorPostCreate() override; }; #endif -- cgit v1.2.3 From 940238680d29136226c8712a215bdc0e2b54d6f9 Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Thu, 4 Dec 2025 18:41:01 +0100 Subject: d_t_insect OK --- include/d/t/d_t_insect.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index 560ed957..c4fae81f 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -2,15 +2,14 @@ #define D_T_INSECT_H #include "d/a/d_a_base.h" +#include "d/t/d_tg.h" #include "m/m_vec.h" #include "s/s_State.hpp" #include "s/s_StateMgr.hpp" -class dTgInsectSupertype_c : public dAcBase_c {}; - extern "C" bool fn_801BB750(nw4r::math::AABB *aabb, f32 f); -class dTgInsect_c : public dTgInsectSupertype_c { +class dTgInsect_c : public dTg_c { public: enum Subtype { SUBTYPE_VOLCANIC_LADYBUG = 3, @@ -40,6 +39,9 @@ public: mKillSignal = 1; } + static const f32 SCALE_X; + static const f32 SCALE_Y; + STATE_FUNC_DECLARE(dTgInsect_c, Wait); STATE_FUNC_DECLARE(dTgInsect_c, WaitCreate); STATE_FUNC_DECLARE(dTgInsect_c, WaitForceEscape); @@ -104,8 +106,11 @@ private: inline s32 getTries() { return 5; } + int doDelete() override; + int draw() override; int actorCreate() override; int actorPostCreate() override; + int actorExecute() override; }; #endif -- cgit v1.2.3 From a5ab025d623674f034eea7a141b8dc7521c42891 Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Thu, 4 Dec 2025 18:48:06 +0100 Subject: small cleanup --- include/d/a/obj/d_a_obj_base.h | 2 -- include/d/t/d_t_insect.h | 17 ----------------- 2 files changed, 19 deletions(-) (limited to 'include') diff --git a/include/d/a/obj/d_a_obj_base.h b/include/d/a/obj/d_a_obj_base.h index b41b517a..6b798af5 100644 --- a/include/d/a/obj/d_a_obj_base.h +++ b/include/d/a/obj/d_a_obj_base.h @@ -222,8 +222,6 @@ public: ); // These may not belong here - // fn_8002F190 - // TODO: return type is probably a superclass for all insects static dAcBase_c* createInsectActor( dAcBase_c* parent, fProfile::PROFILE_NAME_e actorId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, s32 roomId diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index c4fae81f..0e591e8e 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -80,14 +80,6 @@ private: bool shouldSpawn(); void spawnAll(); bool someGroundCheck(const mVec3_c &pos, s32 param_3); - void handleForceEscape(s32 i) { - if (mLinks[i].isLinked()) { - mLinks[i].get()->mActorProperties |= AC_PROP_0x4; - } - } - bool isButterfly() const { - return isSubtype(10); - } bool isTrialGateType() const { return getSubtype() != SUBTYPE_BUTTERFLY ? false : getSpawnSubtype() == SPAWN_TRIAL_GATE; } @@ -97,15 +89,6 @@ private: bool isGoddessWallType() const { return getSubtype() != SUBTYPE_BUTTERFLY ? false : getSpawnSubtype() == SPAWN_GODDESS_WALL; } - f32 getOriginalScaleX() const { - return 100 * mScale.x; - } - f32 getOriginalScaleY() const { - return 100 * mScale.y; - } - inline s32 getTries() { - return 5; - } int doDelete() override; int draw() override; int actorCreate() override; -- cgit v1.2.3 From f0889aadb67d0b7295759e00f571ea221fffe204 Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Thu, 4 Dec 2025 23:26:13 +0100 Subject: properly use subtype enum --- include/d/t/d_t_insect.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index 0e591e8e..874d5099 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -61,16 +61,16 @@ private: /* 0x260 */ mVec3_c mRevealedSpawnPos; /* 0x26C */ dAcRef_c mWarpRef; - s32 getSpawnSubtype() const { - return (mParams >> 8 & 0xF); + SpawnSubtype getSpawnSubtype() const { + return (SpawnSubtype)(mParams >> 8 & 0xF); } - bool isSpawnSubtype(s32 spanwSubtype) const { + bool isSpawnSubtype(SpawnSubtype spanwSubtype) const { return getSpawnSubtype() == spanwSubtype; } - s32 getSubtype() const { - return (mParams >> 4 & 0xF); + Subtype getSubtype() const { + return (Subtype)(mParams >> 4 & 0xF); } - bool isSubtype(u8 subtype) const { + bool isSubtype(Subtype subtype) const { return getSubtype() == subtype; } s32 getInsectCount() const { -- cgit v1.2.3 From ad47fd3eb383679d9b502323cd8cbdc3434c10ba Mon Sep 17 00:00:00 2001 From: lepelog <25211966+lepelog@users.noreply.github.com> Date: Fri, 5 Dec 2025 10:49:39 +0100 Subject: review --- include/d/a/d_a_insect_butterfly.h | 4 ++-- include/d/t/d_t_insect.h | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/d/a/d_a_insect_butterfly.h b/include/d/a/d_a_insect_butterfly.h index 91688269..14ccfd5d 100644 --- a/include/d/a/d_a_insect_butterfly.h +++ b/include/d/a/d_a_insect_butterfly.h @@ -18,13 +18,13 @@ public: STATE_FUNC_DECLARE(dAcInsectButterfly_c, Dead); void setKillSignal() { - killSignal = 1; + mKillSignal = 1; } private: /* 0x468 */ u8 field_0x468[0xA34-0x468]; /* 0xA34 */ STATE_MGR_DECLARE(dAcInsectButterfly_c); /* 0xA70 */ u8 field_0xA70[0xAC6-0xA70]; - /* 0xAC6 */ u8 killSignal; + /* 0xAC6 */ u8 mKillSignal; }; #endif diff --git a/include/d/t/d_t_insect.h b/include/d/t/d_t_insect.h index 874d5099..36ef7e62 100644 --- a/include/d/t/d_t_insect.h +++ b/include/d/t/d_t_insect.h @@ -12,7 +12,10 @@ extern "C" bool fn_801BB750(nw4r::math::AABB *aabb, f32 f); class dTgInsect_c : public dTg_c { public: enum Subtype { - SUBTYPE_VOLCANIC_LADYBUG = 3, + SUBTYPE_INVALID0, + SUBTYPE_INVALID1, + SUBTYPE_INVALID2, + SUBTYPE_VOLCANIC_LADYBUG, SUBTYPE_GERUDO_DRAGONFLY, SUBTYPE_WOODLAND_RHINO_BEETLE, SUBTYPE_SAND_CICADA, @@ -35,6 +38,12 @@ public: dTgInsect_c() : mStateMgr(*this, sStateID::null) {} virtual ~dTgInsect_c() {} + virtual int doDelete() override; + virtual int draw() override; + virtual int actorCreate() override; + virtual int actorPostCreate() override; + virtual int actorExecute() override; + void setKillSignal() { mKillSignal = 1; } @@ -50,13 +59,13 @@ public: private: /* 0x0FC */ STATE_MGR_DECLARE(dTgInsect_c); /* 0x138 */ dAcRef_c mLinks[16]; - /* 0x1F8 */ u8 unk1F8[16]; - /* 0x208 */ s32 mInsectRespanwTimers[16]; + /* 0x1F8 */ u8 field_0x1f8[16]; + /* 0x208 */ s32 mInsectRespawnTimers[16]; /* 0x248 */ s32 mInsectCount; /* 0x24C */ u8 mRevealed; // used by OBJ_SOIL and OBJ_VSD to signal that the insect should be spawned now /* 0x24D */ u8 mKillSignal; // used by goddess walls to signal that the insects should despawn - /* 0x24E */ u8 unk24E; - /* 0x24F */ u8 unk24F; + /* 0x24E */ u8 field_0x24e; + /* 0x24F */ u8 field_0x24f; /* 0x250 */ u8 mShouldSpawn[16]; /* 0x260 */ mVec3_c mRevealedSpawnPos; /* 0x26C */ dAcRef_c mWarpRef; @@ -79,7 +88,7 @@ private: void spawnInsect(s32 index); bool shouldSpawn(); void spawnAll(); - bool someGroundCheck(const mVec3_c &pos, s32 param_3); + bool checkValidSpawnLocation(const mVec3_c &pos, bool updateRotation); bool isTrialGateType() const { return getSubtype() != SUBTYPE_BUTTERFLY ? false : getSpawnSubtype() == SPAWN_TRIAL_GATE; } @@ -89,11 +98,6 @@ private: bool isGoddessWallType() const { return getSubtype() != SUBTYPE_BUTTERFLY ? false : getSpawnSubtype() == SPAWN_GODDESS_WALL; } - int doDelete() override; - int draw() override; - int actorCreate() override; - int actorPostCreate() override; - int actorExecute() override; }; #endif -- cgit v1.2.3