summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorlepelog <25211966+lepelog@users.noreply.github.com>2025-12-04 13:42:58 +0100
committerlepelog <25211966+lepelog@users.noreply.github.com>2025-12-04 13:50:58 +0100
commit413cfaa41f0811e209d16dea6a9aa79df757679d (patch)
tree1fa2369fc0cb166a8b87c3173be7012257e19b07 /include
parent08844fb5da445344613971b66e7fdc9ff55290ac (diff)
insect tag progress
Diffstat (limited to 'include')
-rw-r--r--include/d/a/d_a_base.h8
-rw-r--r--include/d/a/d_a_insect_butterfly.h11
-rw-r--r--include/d/a/obj/d_a_obj_soil.h7
-rw-r--r--include/d/a/obj/d_a_obj_warp.h48
-rw-r--r--include/d/flag/storyflag_map.h8
-rw-r--r--include/d/t/d_t_insect.h95
-rw-r--r--include/nw4r/math/math_geometry.h1
7 files changed, 163 insertions, 15 deletions
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<dAcBase_c*>(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<dAcBase_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<dAcBase_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);