summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorElijah Thomas <42302100+elijah-thomas774@users.noreply.github.com>2024-11-12 22:30:01 -0500
committerGitHub <noreply@github.com>2024-11-12 22:30:01 -0500
commit2ecf6509dd625096fe6c7841a36bb4c7ec954cb6 (patch)
treeb9f2af52c8ef6bbaed59cb9d708e2c3500f06b53 /include
parent9525f8e9e5c20dccd8a9848fb6a3625f88c3e803 (diff)
Tubo! (d_a_obj_tubo) (#95)
* begin work * fixup modifications to d_a_base header * progress * update from main again (forgor to fetch) * progress * Basically done * clean up some inlines * some at/tg hit typing and tubo naming * more naming
Diffstat (limited to 'include')
-rw-r--r--include/c/c_lib.h1
-rw-r--r--include/c/c_math.h13
-rw-r--r--include/d/a/d_a_base.h18
-rw-r--r--include/d/a/d_a_item.h4
-rw-r--r--include/d/a/npc/d_a_npc_ce_friend.h3
-rw-r--r--include/d/a/npc/d_a_npc_ce_lady.h4
-rw-r--r--include/d/a/obj/d_a_obj_base.h63
-rw-r--r--include/d/a/obj/d_a_obj_bomb.h2
-rw-r--r--include/d/a/obj/d_a_obj_log.h7
-rw-r--r--include/d/a/obj/d_a_obj_tubo.h119
-rw-r--r--include/d/col/bg/d_bg_s.h2
-rw-r--r--include/d/col/bg/d_bg_s_acch.h22
-rw-r--r--include/d/col/bg/d_bg_s_gnd_chk.h2
-rw-r--r--include/d/col/c/c_cc_d.h59
-rw-r--r--include/d/col/c/c_m3d_g_sph.h6
-rw-r--r--include/d/flag/dungeonflag_manager.h6
-rw-r--r--include/m/m_angle.h11
-rw-r--r--include/m/m_vec.h4
-rw-r--r--include/toBeSorted/effects_struct.h28
-rw-r--r--include/toBeSorted/event_manager.h17
-rw-r--r--include/toBeSorted/special_item_drop_mgr.h18
-rw-r--r--include/toBeSorted/time_area_mgr.h1
22 files changed, 360 insertions, 50 deletions
diff --git a/include/c/c_lib.h b/include/c/c_lib.h
index 9d15e72a..d9ded19b 100644
--- a/include/c/c_lib.h
+++ b/include/c/c_lib.h
@@ -7,6 +7,7 @@
namespace cLib {
s32 targetAngleY(const mVec3_c &target, const mVec3_c &source);
+f32 addCalcPosXZ(mVec3_c *src, const mVec3_c &target, f32 scale, f32 maxStep, f32 minStep);
} // namespace cLib
diff --git a/include/c/c_math.h b/include/c/c_math.h
index f9e6309a..ba284408 100644
--- a/include/c/c_math.h
+++ b/include/c/c_math.h
@@ -2,6 +2,9 @@
#define C_LIB_CMATH
#include "common.h"
+#include "egg/math/eggMath.h"
+
+#include <cmath.h>
namespace cM {
s16 atan2s(f32, f32);
@@ -24,6 +27,16 @@ inline T minMaxLimit(T val, T min, T max) {
return (T)((T)val < (T)min ? (T)min : ((T)val > (T)max ? (T)max : (T)val));
}
+inline bool isZero(f32 val) {
+ return std::fabsf(val) <= EGG::Math<f32>::epsilon();
+}
+
+// When possivle, use the `isZero` func above.
+// There are small cases where the result of fabs needs to be used again
+inline bool isLessThanZero(f32 val) {
+ return val <= EGG::Math<f32>::epsilon();
+}
+
} // namespace cM
#endif
diff --git a/include/d/a/d_a_base.h b/include/d/a/d_a_base.h
index da64e4e8..b2798eda 100644
--- a/include/d/a/d_a_base.h
+++ b/include/d/a/d_a_base.h
@@ -87,6 +87,8 @@ public:
/* 0xE8 */ u32 field_0xe8;
/* 0xEC */ s8 roomid;
/* 0xED */ u8 actor_subtype;
+ /* 0xEE */ u8 field_0xEE;
+ /* 0xEF */ u8 field_0xEF;
/* 0xF0 */ u32 JStudio_actor;
/* 0xF4 */ char someStr[4];
/* 0xF8 */ char field_0xf8[0xfc - 0xf8];
@@ -108,7 +110,7 @@ protected:
/* 0x5C | 8002ce90 */ virtual void unkVirtFunc_0x5C();
/* 0x60 | 8002cea0 */ virtual void unkVirtFunc_0x60();
/* 0x64 | 8002ceb0 */ virtual bool restorePosRotFromCopy();
- /* 0x68 | 8002db80 */ virtual void *getCurrentEventActor();
+ /* 0x68 | 8002db80 */ virtual void registerInEvent();
/* 0x6C | 8002db90 */ virtual void unkVirtFunc_0x6C();
/* 0x70 | 8002dba0 */ virtual void doInteraction(s32);
@@ -160,8 +162,14 @@ public:
return roomid;
}
- bool ChkProperty_0x40000000() const {
- return actor_properties & 0x40000000;
+ void clearActorProperty(u32 property) {
+ actor_properties &= ~property;
+ }
+ void setActorProperty(u32 property) {
+ actor_properties |= property;
+ }
+ bool checkActorProperty(u32 property) const {
+ return actor_properties & property;
}
public:
@@ -180,7 +188,7 @@ public:
/* 8002cf90 */ void fillUpperParams2Byte();
/* 8002cfa0 */ u32 getParams2_ignoreLower();
/* 8002cfb0 */ void setParams2Upper_ignoreLower(u32 val);
- /* 8002cfc0 */ u8 getParams2UpperByte();
+ /* 8002cfc0 */ int getParams2UpperByte();
/* 8002cfd0 */ void setParams2UpperByte(u32 val);
/* 8002cff0 */ static u32 buildParams2(u32 lower, u32 upper);
/* 8002d010 */ u32 getParams2Lower();
@@ -213,7 +221,7 @@ public:
/* 8002d6d0 */ void FUN_8002d6d0();
/* 8002d710 */ void playSoundEffect1(u16 effect);
/* 8002d740 */ void FUN_8002d740();
- /* 8002d770 */ void FUN_8002d770();
+ /* 8002d770 */ void FUN_8002d770(u16, f32);
/* 8002d7a0 */ void FUN_8002d7a0();
/* 8002d7d0 */ void FUN_8002d7d0();
/* 8002d7f0 */ void FUN_8002d7f0();
diff --git a/include/d/a/d_a_item.h b/include/d/a/d_a_item.h
index fd2fa95c..468f0419 100644
--- a/include/d/a/d_a_item.h
+++ b/include/d/a/d_a_item.h
@@ -51,6 +51,10 @@ public:
void getItemFromBWheelItem();
bool isStateWait();
+ static int getTotalBombCount();
+ static int getTotalArrowCount();
+ static int getTotalSeedCount();
+
private:
/* 0x334 */ UNKTYPE *mpMdl; // Model has its own handling system
/* 0x338 */ dShadowCircle_c mShdw;
diff --git a/include/d/a/npc/d_a_npc_ce_friend.h b/include/d/a/npc/d_a_npc_ce_friend.h
index ebda1753..32d2b597 100644
--- a/include/d/a/npc/d_a_npc_ce_friend.h
+++ b/include/d/a/npc/d_a_npc_ce_friend.h
@@ -2,6 +2,7 @@
#define D_A_NPC_CE_FRIEND_H
#include "d/a/npc/d_a_npc.h"
+#include "d/col/c/c_cc_d.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
@@ -10,6 +11,8 @@ public:
dAcNpcCeFriend_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dAcNpcCeFriend_c() {}
+ bool fn_11_17C0(dAcObjBase_c *);
+
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcNpcCeFriend_c);
};
diff --git a/include/d/a/npc/d_a_npc_ce_lady.h b/include/d/a/npc/d_a_npc_ce_lady.h
index a6e411f4..0e11ac72 100644
--- a/include/d/a/npc/d_a_npc_ce_lady.h
+++ b/include/d/a/npc/d_a_npc_ce_lady.h
@@ -2,6 +2,7 @@
#define D_A_NPC_CE_LADY_H
#include "d/a/npc/d_a_npc.h"
+#include "d/col/c/c_cc_d.h"
#include "s/s_State.hpp"
#include "s/s_StateMgr.hpp"
@@ -10,6 +11,9 @@ public:
dAcNpcCeLady_c() : mStateMgr(*this, sStateID::null) {}
virtual ~dAcNpcCeLady_c() {}
+ bool fn_12_1C20(dAcObjBase_c *);
+ void fn_12_1E00(dAcObjBase_c *, bool *);
+
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcNpcCeLady_c);
};
diff --git a/include/d/a/obj/d_a_obj_base.h b/include/d/a/obj/d_a_obj_base.h
index 031cf4b5..8dd4372e 100644
--- a/include/d/a/obj/d_a_obj_base.h
+++ b/include/d/a/obj/d_a_obj_base.h
@@ -1,6 +1,7 @@
#ifndef D_A_OBJ_BASE_H
#define D_A_OBJ_BASE_H
+#include "c/c_math.h"
#include "d/a/d_a_base.h"
#include "d/col/c/c_cc_d.h"
#include "d/col/c/c_m3d_g_aab.h"
@@ -12,6 +13,9 @@
#include "m/m_vec.h"
#include "m/types_m.h"
+class dAcObjBase_c;
+class dBgS_Acch;
+
// Size: 0xA8
struct ActorCarryStruct {
/* 0x00 */ fLiNdBa_c actorLink;
@@ -24,14 +28,29 @@ struct ActorCarryStruct {
/* 0x28 */ mMtx_c carryTransMtx;
/* 0x58 */ mMtx_c field_0x58;
/* 0x88 */ s32 isCarried;
- /* 0x8C */ u8 field_0x8C[0x10]; // mQuat_c
- /* 0x9C */ void *dtor; // ???
+ /* 0x8C */ f32 field_0x8C;
+ /* 0x90 */ f32 field_0x90;
+ /* 0x94 */ f32 field_0x94;
+ /* 0x98 */ f32 field_0x98;
+ /* 0x9C */ void *dtor; // ???
/* 0xA0 */ u32 field_0xA0;
/* 0xA4 */ u32 field_0xA4;
+ void set(u32 flags, f32 x, f32 y, f32 z, void *unk);
+
+ // not real name, but sure
+ void bushTpFunc(dBgS_Acch &);
+
+ void fn_80050EA0(dAcObjBase_c *);
+ void fn_800511E0(dAcObjBase_c *);
+
bool testCarryFlag(u32 flag) {
return (carryFlags & flag) != 0;
}
+
+ bool checkCarryType(int type) const {
+ return (isCarried == 1 && carryType == type);
+ }
};
// Ghidra has it as `unk_ActorObjectBase`
@@ -48,7 +67,7 @@ struct LightingInfo {
class dAcObjBase_c : public dAcBase_c {
public:
/* 0x0FC */ f32 yoffset;
- /* 0x100 */ char _0[4];
+ /* 0x100 */ f32 field_0x100;
/* 0x104 */ f32 unkfloat;
/* 0x108 */ char _1[12];
/* 0x114 */ u16 targetFiTextId;
@@ -66,11 +85,9 @@ public:
/* 0x1A4 */ f32 mCullingDistance;
/* 0x1A8 */ f32 field_0x1A8;
/* 0x1AC */ u32 mObjectActorFlags;
-
- /* 0x1B0 */ u8 unk_0x1B0[0x1C0 - 0x1B0];
-
+ /* 0x1B0 */ f32 mField_0x1B0;
+ /* 0x1B4 */ mVec3_c mField_0x1B4;
/* 0x1C0 */ cCcD_Stts mStts;
-
/* 0x1FC */ mVec3_c mStartingPos;
/* 0x208 */ mAng3_c mStartingRot;
/* 0x210 */ ActorCarryStruct mActorCarryInfo;
@@ -101,6 +118,20 @@ public:
return fabsf(forwardSpeed) <= speed;
}
+ bool checkYOffsetField_0x100() const {
+ return yoffset <= field_0x100;
+ }
+
+ void clearObjectProperty(u32 property) {
+ mObjectActorFlags &= ~property;
+ }
+ void setObjectProperty(u32 property) {
+ mObjectActorFlags |= property;
+ }
+ bool checkObjectProperty(u32 property) const {
+ return mObjectActorFlags & property;
+ }
+
// could be their own thing?
/* 8002de40 */ static void *getOarcFile(const char *oarcName, const char *fileName);
/* 8002de60 */ static void *getOarcSubEntry(const char *oarcName, const char *fileName);
@@ -192,4 +223,22 @@ public:
} \
} while (0)
+class dAcObjRef_unk {
+public:
+ dAcObjRef_unk(dAcObjBase_c *ref) : mObj(nullptr), refOwner(ref) {}
+ ~dAcObjRef_unk() {
+ refOwner = nullptr;
+ }
+
+ bool fn_80051780(const cCcD_Obj &);
+ void fn_800051630();
+
+ void modifyMtx();
+
+ /* 0x00 */ dAcRef_c<dAcObjBase_c> mObj;
+ /* 0x0C */ u8 _0C[4];
+ /* 0x10 */ dAcObjBase_c *refOwner;
+ /* 0x14 */ u8 _14[0x2C - 0x14];
+};
+
#endif
diff --git a/include/d/a/obj/d_a_obj_bomb.h b/include/d/a/obj/d_a_obj_bomb.h
index 686a4987..ce545e52 100644
--- a/include/d/a/obj/d_a_obj_bomb.h
+++ b/include/d/a/obj/d_a_obj_bomb.h
@@ -35,7 +35,7 @@ public:
/* vt 0x44 */ virtual bool createHeap() override;
/* vt 0x54 */ virtual int actorExecute() override;
/* vt 0x5C */ virtual void unkVirtFunc_0x5C() override;
- /* vt 0x68 */ virtual void *getCurrentEventActor() override;
+ /* vt 0x68 */ virtual void registerInEvent() override;
/* vt 0x6C */ virtual void unkVirtFunc_0x6C() override;
STATE_FUNC_DECLARE(dAcBomb_c, Wait);
diff --git a/include/d/a/obj/d_a_obj_log.h b/include/d/a/obj/d_a_obj_log.h
index 2ae9d120..e052cb04 100644
--- a/include/d/a/obj/d_a_obj_log.h
+++ b/include/d/a/obj/d_a_obj_log.h
@@ -16,7 +16,14 @@ public:
STATE_FUNC_DECLARE(dAcOlog_c, Fall);
STATE_FUNC_DECLARE(dAcOlog_c, Shake);
+ u8 getField_0xE4E() const {
+ return mField_0xE4E;
+ }
+
private:
+ // TODO: Fixup stuff
+ /* 0x330 */ u8 _330[0xE4E - 0x330];
+ /* 0xE4E */ u8 mField_0xE4E;
/* 0x??? */ STATE_MGR_DECLARE(dAcOlog_c);
};
diff --git a/include/d/a/obj/d_a_obj_tubo.h b/include/d/a/obj/d_a_obj_tubo.h
index c7e56ba2..fc027e78 100644
--- a/include/d/a/obj/d_a_obj_tubo.h
+++ b/include/d/a/obj/d_a_obj_tubo.h
@@ -1,15 +1,80 @@
#ifndef D_A_OBJ_TUBO_H
#define D_A_OBJ_TUBO_H
+#include "common.h"
+#include "d/a/d_a_base.h"
+#include "d/a/npc/d_a_npc_ce_friend.h"
+#include "d/a/npc/d_a_npc_ce_lady.h"
#include "d/a/obj/d_a_obj_base.h"
+#include "d/col/bg/d_bg_s_acch.h"
+#include "d/col/cc/d_cc_d.h"
+#include "d/d_shadow.h"
+#include "d/flag/sceneflag_manager.h"
+#include "m/m3d/m_smdl.h"
+#include "m/m_quat.h"
+#include "m/m_vec.h"
+#include "nw4r/g3d/g3d_resfile.h"
#include "s/s_State.hpp"
-#include "s/s_StateMgr.hpp"
+#include "toBeSorted/effects_struct.h"
class dAcOtubo_c : public dAcObjBase_c {
public:
- dAcOtubo_c() : mStateMgr(*this, sStateID::null) {}
+ dAcOtubo_c() : mStateMgr(*this, sStateID::null), mField_0x8F0(this) {}
virtual ~dAcOtubo_c() {}
+ virtual int doDelete() override;
+ virtual int draw() override;
+ virtual bool createHeap() override;
+ virtual int actorCreate() override;
+ virtual int actorPostCreate() override;
+ virtual int actorExecute() override;
+ virtual void registerInEvent() override;
+
+ bool checkCarryType() const;
+ void destroy();
+
+ void calcRoll();
+ void adjustRoll();
+ void attemptDestroy();
+ void fn_272_2670();
+ mVec3_c getCenter() const;
+ void attemptDestroyOnWall(u32 *, const u8 *);
+ void fn_272_2E60(const mVec3_c &);
+ void fn_272_3020();
+ void addPickupTarget();
+ void adjustAngle();
+ void adjustSpeed();
+ bool checkSlope();
+ bool fn_272_3660();
+ bool checkInvalidGround();
+ bool checkOnLava();
+ bool checkSubmerged();
+ bool fn_272_38A0();
+ bool fn_272_38C0();
+ bool checkRollHitMaybe();
+ void playRollSound();
+
+ bool checkOnLog_0xE4E() const;
+
+ u8 getSubtype() const {
+ return params & 0xF; // 0 -> Tubo00, Else -> Tubo01
+ }
+
+ int getParams_0x3000() const {
+ return params >> 12 & 0x3;
+ }
+ u8 getParams_0xC000() const {
+ return params >> 14 & 0x3;
+ }
+
+ u8 getSceneflag() const {
+ return params >> 4 & 0xFF;
+ }
+
+ bool checkSceneflag() {
+ return SceneflagManager::sInstance->checkFlag(roomid, mSceneflag);
+ }
+
STATE_FUNC_DECLARE(dAcOtubo_c, Wait);
STATE_FUNC_DECLARE(dAcOtubo_c, Grab);
STATE_FUNC_DECLARE(dAcOtubo_c, Put);
@@ -17,7 +82,55 @@ public:
STATE_FUNC_DECLARE(dAcOtubo_c, Rebirth);
private:
- /* 0x??? */ STATE_MGR_DECLARE(dAcOtubo_c);
+ /* 0x330 */ nw4r::g3d::ResFile mRes;
+ /* 0x334 */ m3d::smdl_c mMdl;
+ /* 0x350 */ dShadowCircle_c mShdw;
+ /* 0x358 */ dBgS_AcchCir mAcchCir;
+ /* 0x3B4 */ dBgS_ObjAcch mObjAcch;
+ /* 0x764 */ dCcD_Sph mSph;
+ /* 0x8B4 */ STATE_MGR_DECLARE(dAcOtubo_c);
+ /* 0x8F0 */ dAcObjRef_unk mField_0x8F0;
+ /* 0x91C */ EffectsStruct_Ext mEff_0x91C;
+ /* 0x964 */ dAcRef_c<dAcNpcCeLady_c> mCeLady;
+ /* 0x970 */ dAcRef_c<dAcNpcCeFriend_c> mCeFriend;
+ /* 0x97C */ mQuat_c mQuat_0x97C;
+ /* 0x98C */ mQuat_c mQuat_0x98C;
+ /* 0x99C */ mQuat_c mQuat_0x99C;
+ /* 0x9AC */ mVec3_c mField_0x9AC;
+ /* 0x9B8 */ mVec3_c mField_0x9B8;
+ /* 0x9C4 */ mAng mField_0x9C4;
+ /* 0x9C6 */ mAng mField_0x9C6;
+ /* 0x9C8 */ mAng mField_0x9C8;
+ /* 0x9CA */ mAng mField_0x9CA;
+ /* 0x9CC */ mAng mField_0x9CC;
+ /* 0x9D0 */ f32 mField_0x9D0;
+ /* 0x9D4 */ f32 mField_0x9D4;
+ /* 0x9D8 */ f32 mField_0x9D8;
+ /* 0x9DC */ f32 mField_0x9DC;
+ /* 0x9E0 */ f32 mField_0x9E0;
+ /* 0x9E4 */ f32 mField_0x9E4;
+ /* 0x9E8 */ u16 mTimer_0x9E8;
+ /* 0x9EA */ bool mbMovingForward;
+ /* 0x9EB */ bool mbField_0x9EB;
+ /* 0x9EC */ bool mbField_0x9EC;
+ /* 0x9ED */ bool mbField_0x9ED;
+ /* 0x9EE */ bool mbField_0x9EE;
+ /* 0x9EF */ bool mbField_0x9EF;
+ /* 0x9F0 */ bool mbField_0x9F0;
+ /* 0x9F1 */ bool mbField_0x9F1;
+ /* 0x9F2 */ bool mbSubmerged;
+ /* 0x9F2 */ bool mbField_0x9F3;
+ /* 0x9F4 */ u8 mTimer_0x9F4;
+ /* 0x9F5 */ u8 mTimer_0x9F5;
+ /* 0x9F6 */ u8 mField_0x9F6;
+ /* 0x9F7 */ u8 mTimer_0x9F7;
+ /* 0x9F8 */ u8 mSceneflag;
+ /* 0x9F9 */ u8 mSubtype;
+ /* 0x9FC */ int mField_0x9FC;
+
+ static u8 sUnk0;
+ static u32 sUnk1;
+ static dCcD_SrcSph sSphSrc;
};
#endif
diff --git a/include/d/col/bg/d_bg_s.h b/include/d/col/bg/d_bg_s.h
index 939c5ea1..abb6dc59 100644
--- a/include/d/col/bg/d_bg_s.h
+++ b/include/d/col/bg/d_bg_s.h
@@ -32,7 +32,7 @@ public:
return false;
}
const dAcObjBase_c *pObj = mObj.get();
- return !(pObj && pObj->ChkProperty_0x40000000());
+ return !(pObj && pObj->checkActorProperty(0x40000000));
}
// ??? Template seems bad
diff --git a/include/d/col/bg/d_bg_s_acch.h b/include/d/col/bg/d_bg_s_acch.h
index d24402f3..c21a4bd3 100644
--- a/include/d/col/bg/d_bg_s_acch.h
+++ b/include/d/col/bg/d_bg_s_acch.h
@@ -1,7 +1,6 @@
#ifndef D_BG_S_ACCH_H
#define D_BG_S_ACCH_H
-#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_s_gnd_chk.h"
#include "d/col/bg/d_bg_s_roof_chk.h"
#include "d/col/bg/d_bg_s_sph_chk.h"
@@ -11,6 +10,8 @@
#include "d/col/c/c_m3d_g_lin.h"
#include "d/col/c/c_m3d_g_pla.h"
+class dAcObjBase_c;
+
class dBgS_AcchCir : public cBgS_PolyInfo {
private:
/* 0x2C */ cM3dGCir m_cir;
@@ -237,6 +238,9 @@ public:
mVec3_c *GetOldPos() {
return mpOldPos;
}
+ f32 GetWtrGroundH() const {
+ return mWtr.mGroundH;
+ }
f32 GetGroundH() const {
return mGroundHeight;
}
@@ -309,6 +313,16 @@ public:
bool Chk_0x10000000() {
return mFlags & ACCH_FLAG_0x10000000;
}
+
+ void Clr_0x20000() {
+ mFlags &= ~ACCH_FLAG_0x20000;
+ }
+ void Set_0x20000() {
+ mFlags |= ACCH_FLAG_0x20000;
+ }
+ bool Chk_0x20000() {
+ return mFlags & ACCH_FLAG_0x20000;
+ }
void Clr_0x80000000() {
mFlags &= ~ACCH_FLAG_0x80000000;
}
@@ -355,9 +369,9 @@ public:
u32 MaskRoofHit() {
return mFlags & ROOF_HIT;
}
- bool ChkRoofHit() {
- return MaskRoofHit();
- }
+ // bool ChkRoofHit() {
+ // return MaskRoofHit();
+ // }
void OffClrSpeedY() {
mFlags |= CLR_SPEED_Y;
}
diff --git a/include/d/col/bg/d_bg_s_gnd_chk.h b/include/d/col/bg/d_bg_s_gnd_chk.h
index b9677e27..f304c2a3 100644
--- a/include/d/col/bg/d_bg_s_gnd_chk.h
+++ b/include/d/col/bg/d_bg_s_gnd_chk.h
@@ -32,7 +32,7 @@ public:
}
static void ClearInstance();
- static bool CheckPos(const mVec3_c *);
+ static bool CheckPos(const mVec3_c &);
static int GetMaterial();
static int GetPolyAtt1();
static bool GetTriPlane(cM3dGPla *);
diff --git a/include/d/col/c/c_cc_d.h b/include/d/col/c/c_cc_d.h
index fe7723ec..49791e31 100644
--- a/include/d/col/c/c_cc_d.h
+++ b/include/d/col/c/c_cc_d.h
@@ -327,36 +327,37 @@ struct cCcD_SrcGObjTg {
/* 0x0E */ u16 mField_0x0E;
};
-enum cCcD_AtType_e {
+enum dCcD_ObjAtType {
/* 0x 0000 0001 */ AT_TYPE_0x1 = (1 << 0),
- /* 0x 0000 0002 */ AT_TYPE_0x2 = (1 << 1),
+ /* 0x 0000 0002 */ AT_TYPE_SWORD = (1 << 1),
/* 0x 0000 0004 */ AT_TYPE_0x4 = (1 << 2),
- /* 0x 0000 0008 */ AT_TYPE_0x8 = (1 << 3),
+ /* 0x 0000 0008 */ AT_TYPE_PHYSICS = (1 << 3),
/* 0x 0000 0010 */ AT_TYPE_0x10 = (1 << 4),
- /* 0x 0000 0020 */ AT_TYPE_0x20 = (1 << 5),
+ /* 0x 0000 0020 */ AT_TYPE_BOMB = (1 << 5),
/* 0x 0000 0040 */ AT_TYPE_0x40 = (1 << 6),
- /* 0x 0000 0080 */ AT_TYPE_0x80 = (1 << 7),
+ /* 0x 0000 0080 */ AT_TYPE_SLINGSHOT = (1 << 7),
/* 0x 0000 0100 */ AT_TYPE_0x100 = (1 << 8),
- /* 0x 0000 0200 */ AT_TYPE_0x200 = (1 << 9),
- /* 0x 0000 0400 */ AT_TYPE_0x400 = (1 << 10),
- /* 0x 0000 0800 */ AT_TYPE_0x800 = (1 << 11),
+ /* 0x 0000 0200 */ AT_TYPE_WIND = (1 << 9),
+ /* 0x 0000 0400 */ AT_TYPE_DAMAGE = (1 << 10),
+ /* 0x 0000 0800 */ AT_TYPE_WHIP = (1 << 11),
/* 0x 0000 1000 */ AT_TYPE_0x1000 = (1 << 12),
- /* 0x 0000 2000 */ AT_TYPE_0x2000 = (1 << 13),
- /* 0x 0000 4000 */ AT_TYPE_0x4000 = (1 << 14),
+ /* 0x 0000 2000 */ AT_TYPE_ARROW = (1 << 13),
+ /* 0x 0000 4000 */ AT_TYPE_CLAWSHOT = (1 << 14),
/* 0x 0000 8000 */ AT_TYPE_0x8000 = (1 << 15),
- /* 0x 0001 0000 */ AT_TYPE_0x10000 = (1 << 16),
+ /* 0x 0001 0000 */ AT_TYPE_BELLOWS = (1 << 16),
/* 0x 0002 0000 */ AT_TYPE_0x20000 = (1 << 17),
/* 0x 0004 0000 */ AT_TYPE_0x40000 = (1 << 18),
/* 0x 0008 0000 */ AT_TYPE_0x80000 = (1 << 19),
- /* 0x 0010 0000 */ AT_TYPE_0x100000 = (1 << 20),
+ /* 0x 0010 0000 */ AT_TYPE_BUBBLE = (1 << 20),
/* 0x 0020 0000 */ AT_TYPE_0x200000 = (1 << 21),
- /* 0x 0040 0000 */ AT_TYPE_0x400000 = (1 << 22),
+ /* 0x 0040 0000 */ AT_TYPE_BEETLE = (1 << 22),
/* 0x 0080 0000 */ AT_TYPE_0x800000 = (1 << 23),
/* 0x 0100 0000 */ AT_TYPE_BUGNET = (1 << 24),
/* 0x 0200 0000 */ AT_TYPE_0x2000000 = (1 << 25),
- /* 0x 0400 0000 */ AT_TYPE_0x4000000 = (1 << 26),
+ /* 0x 0400 0000 */ AT_TYPE_KOLOKTOS_SWORD = (1 << 26),
/* 0x 0800 0000 */ AT_TYPE_0x8000000 = (1 << 27),
};
+
enum cCcD_AtModifiers_e {
/* 0x 0000 0001 */ AT_MOD_FIRE = (1 << 0),
/* 0x 0000 0002 */ AT_MOD_0x2 = (1 << 1),
@@ -630,9 +631,13 @@ public:
mField_0x4B = val;
}
+ void SetInfo_0x2(u16 val) {
+ mSrc.mInfo.mField_0x2 = val;
+ }
+
public:
/* 0x1C */ cCcD_SrcGObjTg mSrc;
- /* 0x2C */ mVec3_c mField_0x2C;
+ /* 0x2C */ mVec3_c mAtHitDir;
/* 0x38 */ mVec3_c mHitPos;
/* 0x44 */ s16 *mShieldFrontRangeYAngle;
/* 0x48 */ s16 mShieldRange;
@@ -737,7 +742,7 @@ public:
dAcObjBase_c *GetAtActor();
bool ChkTgAtHitType(u32) const;
- u32 GetTg_0x58() const;
+ u32 GetTgAtHitType() const;
bool ChkTgBit14() const;
u8 GetTgDamage() const;
u16 GetTgDamageFlags() const;
@@ -754,7 +759,7 @@ public:
bool ChkTgBit8() const;
u8 GetTg_0x4A() const;
dAcObjBase_c *GetTgActor();
- const mVec3_c &GetTg_0x2C() const;
+ const mVec3_c &GetTgAtHitDir() const;
dAcObjBase_c *GetCoActor();
bool ChkCoBit4() const;
@@ -780,7 +785,7 @@ public:
mCo.OnSPrm(f);
}
- void SetTgFlag(u32 flag) {
+ void SetTgType(u32 flag) {
mTg.SetType(flag);
}
void SetAtFlag(u32 flag) {
@@ -860,6 +865,9 @@ public:
// At
+ void OnAtSet() {
+ mAt.OnSPrm(1);
+ }
u32 ChkAtNoMass() const {
return mAt.MskSPrm(0x400);
}
@@ -878,6 +886,9 @@ public:
// Tg
+ void OnTgSet() {
+ mTg.OnSPrm(1);
+ }
u32 GetTgGrp() const {
return mTg.MskSPrm(0x3E);
}
@@ -894,9 +905,15 @@ public:
void SetTg_0x4B(u8 val) {
mTg.Set_0x4B(val);
}
+ void SetTgInfo_0x2(u16 val) {
+ mTg.SetInfo_0x2(val);
+ }
// Co
+ void OnCoSet() {
+ mCo.OnSPrm(1);
+ }
u32 ChkCoSet2() const {
return mCo.MskSPrm(0x800);
}
@@ -906,6 +923,12 @@ public:
u32 ChkCoSameActorHit() const {
return mCo.MskSPrm(0x1000);
}
+ void ClrCo_0x400() {
+ mCo.OffSPrm(0x400);
+ }
+ void SetCo_0x400() {
+ mCo.OnSPrm(0x400);
+ }
/**
* SET HIT
diff --git a/include/d/col/c/c_m3d_g_sph.h b/include/d/col/c/c_m3d_g_sph.h
index 8be04f83..6216cb7d 100644
--- a/include/d/col/c/c_m3d_g_sph.h
+++ b/include/d/col/c/c_m3d_g_sph.h
@@ -11,15 +11,11 @@ public:
/* 0x10 */ f32 mRatio;
cM3dGSph();
- void SetC(const mVec3_c *);
+ void SetC(const mVec3_c &);
void Set(const mVec3_c *, f32);
void SetR(f32);
void SetC(f32, f32, f32);
- void SetC(const mVec3_c &p) {
- SetC(&p);
- }
-
f32 GetYDist(f32) const;
bool Cross(const cM3dGTri *, f32 *, mVec3_c *);
void Clamp(const mVec3_c &, mVec3_c &) const;
diff --git a/include/d/flag/dungeonflag_manager.h b/include/d/flag/dungeonflag_manager.h
index 55dfa150..a572277a 100644
--- a/include/d/flag/dungeonflag_manager.h
+++ b/include/d/flag/dungeonflag_manager.h
@@ -30,6 +30,12 @@ public:
return FileManager::sInstance->getDungeonFlagsConst() + offset;
}
+ u16 getCounterOrFlag(u16 idx, u32 count) const {
+ u16 offset = mStageIndex * 8;
+ const u16 *space = FileManager::sInstance->getDungeonFlagsConst() + offset;
+ return mpFlagIndex->getCounterOrFlag(idx, space, count);
+ }
+
static DungeonflagManager *sInstance;
};
diff --git a/include/m/m_angle.h b/include/m/m_angle.h
index 387ee6be..06648b08 100644
--- a/include/m/m_angle.h
+++ b/include/m/m_angle.h
@@ -23,6 +23,10 @@ struct mAng {
return mVal;
}
+ s16 *ref() {
+ return &mVal;
+ }
+
mAng operator-() {
return mAng(-mVal);
}
@@ -50,8 +54,6 @@ struct mAng {
return nw4r::math::CosIdx(*this);
}
- s16 mVal;
-
f32 degree() const {
return (360.0f / 65536.0f) * mVal;
}
@@ -59,6 +61,9 @@ struct mAng {
static mAng fromDeg(f32 deg) {
return deg * sDegToAng;
}
+ f32 degree2() const {
+ return mVal * sAngToDeg;
+ }
static s16 angle(const mVec3_c &a, const mVec3_c &b) {
f32 rads = a.angle(b);
@@ -99,6 +104,8 @@ struct mAng {
return rad * (65536.0f / (2.f * M_PI));
}
+ s16 mVal;
+
private:
static const f32 sHalfCircleDeg;
static const f32 sAngToDeg;
diff --git a/include/m/m_vec.h b/include/m/m_vec.h
index b2564cfa..9b25e29c 100644
--- a/include/m/m_vec.h
+++ b/include/m/m_vec.h
@@ -236,6 +236,10 @@ public:
return cM::atan2s(x * x, z * z);
}
+ f32 inprodXZ(const mVec3_c &other) const {
+ return x * other.x + z * other.z;
+ }
+
static mVec3_c Zero;
static mVec3_c Ex;
static mVec3_c Ey;
diff --git a/include/toBeSorted/effects_struct.h b/include/toBeSorted/effects_struct.h
index a3070d3d..c9caafb3 100644
--- a/include/toBeSorted/effects_struct.h
+++ b/include/toBeSorted/effects_struct.h
@@ -23,7 +23,7 @@ public:
void remove(bool);
void fn_80029929(u16 effect, mVec3_c *pos, void *, void *, void *, void *);
- void setMtx(const mMtx_c&);
+ void setMtx(const mMtx_c &);
bool checkField0x00() const {
return field_0x00 != 0;
@@ -35,4 +35,30 @@ private:
u8 field_0x2C[0x34 - 0x2C];
};
+// Not sure if these belongs here, but it uses EffectsStruct
+// Related Functions in the 8002B100 area
+class EffectsStruct_Ext {
+public:
+ EffectsStruct_Ext() : mField_0x00(1), mField_0x01(0) {}
+
+ void init(dBase_c *, f32, f32, f32);
+
+ void setField_0x00(u8 val) {
+ mField_0x00 = val;
+ }
+ void setField_0x01(u8 val) {
+ mField_0x01 = val;
+ }
+
+ void fn_8002B120(f32, f32);
+
+ /* 0x00 */ u8 mField_0x00;
+ /* 0x01 */ u8 mField_0x01;
+ /* 0x04 */ f32 mField_0x04;
+ /* 0x08 */ f32 mField_0x08;
+ /* 0x0C */ f32 mField_0x0C;
+ /* 0x10 */ EffectsStruct mEff;
+ virtual ~EffectsStruct_Ext() {}
+};
+
#endif
diff --git a/include/toBeSorted/event_manager.h b/include/toBeSorted/event_manager.h
index 43dbcabb..19a888bd 100644
--- a/include/toBeSorted/event_manager.h
+++ b/include/toBeSorted/event_manager.h
@@ -2,6 +2,8 @@
#ifndef EVENT_MANAGER_H
#define EVENT_MANAGER_H
+#include "common.h"
+#include "sized_string.h"
#include "toBeSorted/event.h"
class dAcBase_c;
@@ -21,9 +23,20 @@ public:
return isInEvent() && sInstance != nullptr && sInstance->mState != 7;
}
+ static const char *getCurrentEventName() {
+ return isInEvent() ? sInstance->mCurrentEvent.eventName : nullptr;
+ }
+
+ static bool isCurrentEvent(const char *name) {
+ return strequals(getCurrentEventName(), name);
+ }
+
private:
- u8 field_0x000[0x184 - 0x000];
- int mState;
+ /* 0x000 */ u8 _000[0x084 - 0x000];
+ /* 0x084 */ Event mCurrentEvent;
+ /* 0x0C4 */ u8 _0C4[0x184 - 0x0C4];
+ /* 0x184 */ int mState;
+ /* 0x18C */ u8 _18C[0x19C - 0x18C];
};
#endif
diff --git a/include/toBeSorted/special_item_drop_mgr.h b/include/toBeSorted/special_item_drop_mgr.h
index 8132cff0..40b8c660 100644
--- a/include/toBeSorted/special_item_drop_mgr.h
+++ b/include/toBeSorted/special_item_drop_mgr.h
@@ -5,6 +5,24 @@
#include "m/m_angle.h"
#include "m/m_vec.h"
+enum SpecialItemDropTable {
+ SPECIAL_ITEM_0 = 0,
+ SPECIAL_ITEM_1,
+ SPECIAL_ITEM_2,
+ SPECIAL_ITEM_3,
+ SPECIAL_ITEM_4,
+ SPECIAL_ITEM_5,
+ SPECIAL_ITEM_6,
+ SPECIAL_ITEM_7,
+ SPECIAL_ITEM_8,
+ SPECIAL_ITEM_9,
+ SPECIAL_ITEM_10,
+ SPECIAL_ITEM_11,
+ SPECIAL_ITEM_12,
+ SPECIAL_ITEM_13,
+ // ...
+};
+
class SpecialItemDropMgr {
public:
static SpecialItemDropMgr *sInstance;
diff --git a/include/toBeSorted/time_area_mgr.h b/include/toBeSorted/time_area_mgr.h
index 64389546..d28abfb3 100644
--- a/include/toBeSorted/time_area_mgr.h
+++ b/include/toBeSorted/time_area_mgr.h
@@ -37,6 +37,7 @@ struct TimeAreaStruct {
/* 0x08 */ u8 field_0x08;
bool isNearZero() {
+ // is cM3d_IsZero
return fabsf(field_0x00) <= FLT_EPSILON;
}