diff options
| author | robojumper <robojumper@gmail.com> | 2025-09-14 17:03:33 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-09-14 17:09:09 +0200 |
| commit | c05597754e2da9e781af83ed8a85d84514829b3f (patch) | |
| tree | 26d6cb714af0d00ca955c4afb62dceef4e31b6a2 /include | |
| parent | 67c9e3346c32ff52c37e21ec5804a2fd59cf9031 (diff) | |
d_a_knight_leader_bird OK
Diffstat (limited to 'include')
| -rw-r--r-- | include/d/a/d_a_bird_base.h | 112 | ||||
| -rw-r--r-- | include/d/a/d_a_knight_leader_bird.h | 21 | ||||
| -rw-r--r-- | include/m/m3d/m_anmmdl.h | 4 | ||||
| -rw-r--r-- | include/m/m3d/m_fanm.h | 4 | ||||
| -rw-r--r-- | include/m/m_mtx.h | 24 | ||||
| -rw-r--r-- | include/s/s_State.hpp | 5 |
6 files changed, 167 insertions, 3 deletions
diff --git a/include/d/a/d_a_bird_base.h b/include/d/a/d_a_bird_base.h new file mode 100644 index 00000000..bfb904df --- /dev/null +++ b/include/d/a/d_a_bird_base.h @@ -0,0 +1,112 @@ +#ifndef D_A_BIRD_BASE_H +#define D_A_BIRD_BASE_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 "m/m3d/m_fanm.h" +#include "m/m3d/m_mdl.h" +#include "m/m_mtx.h" +#include "m/m_quat.h" +#include "m/m_vec.h" +#include "toBeSorted/d_d3d.h" +#include "toBeSorted/d_path.h" + +class dAcBirdBase_c : public dAcObjBase_c { + class callback_c : public m3d::callback_c { + public: + virtual ~callback_c() {} + virtual void timingB(u32, nw4r::g3d::WorldMtxManip *, nw4r::g3d::ResMdl) override; + + /* 0x04 */ u8 _0x04[0x94 - 0x04]; + }; + +public: + enum Action_e { + BIRD_ACTION_FLAP, + BIRD_ACTION_GLIDE, + BIRD_ACTION_KEEP, + BIRD_ACTION_DAMAGE, + BIRD_ACTION_4, + BIRD_ACTION_DOWN, + BIRD_ACTION_HOVER, + BIRD_ACTION_GLIDE_DIVE, + BIRD_ACTION_SWITCH_DIVE, + + // Certain birds use special actions starting from 9 + + BIRD_ACTION_BASE_MAX = 9, + }; + + dAcBirdBase_c() : field_0xF30(0) {} + virtual ~dAcBirdBase_c() {} + + virtual int doDelete() override; + virtual int draw() override; + + /* 0x80 */ virtual bool resetBird(); + /* 0x84 */ virtual bool hasPath() const { + return getPath() >= 0 && getPath() < 0xFF; + } + /* 0x88 */ virtual const char* getAnmArcNameBase() const { + return "BirdAnm"; + } + /* 0x8C */ virtual const char* getAnmArcNameLink() const { + return "BirdLinkAnm"; + } + /* 0x90 */ virtual const char* getAnmArcNameSpecial() const { + return "BirdLinkAnm"; + } + +protected: + s32 getPath() const { + return params & 0xFF; + } + + void updateMatrixBird(); + void loadMdlNodeIds(); + bool chkWallGndRoofHit(); + void handleWallGndRoofHit(); + bool changeBirdAction(const char *animName, s32 action, m3d::playMode_e playMode, f32 blend); + void executeBirdAction(); + + void fn_80176D30(); + void fn_80176F80(); + void fn_80177EA0(); + void fn_80178000(); + void fn_801780C0(); + void fn_80177F30(); + + /* 0x330 */ d3d::AnmMdlWrapper mMdl; + /* 0x3A0 */ s16 mBirdAction; + /* 0x3A4 */ dShadowCircle_c mShadow; + /* 0x3AC */ dCcD_Cps mCcCps; + /* 0x51C */ dCcD_Sph mCcSph; + /* 0x66C */ dBgS_AcchCir mAcchCir1; + /* 0x6C8 */ dBgS_ObjAcch mObjAcch1; + /* 0xA78 */ callback_c mMdlCallback; + /* 0xB0C */ dBgS_ObjAcch mObjAcch2; + /* 0xEBC */ dBgS_AcchCir mAcchCir2; + /* 0xF18 */ mVec3_c field_0xF18; + /* 0xF24 */ mVec3_c field_0xF24; + /* 0xF30 */ u16 field_0xF30; + /* 0xF32 */ s16 mBirdActionTimer; + /* 0xF34 */ s16 mChkWallGndRoofTimer; + /* 0xF36 */ u8 _0xF36[0xF40 - 0xF36]; + /* 0xF40 */ f32 field_0xF40; + /* 0xF44 */ u8 _0xF44[0xF50 - 0xF44]; + /* 0xF50 */ mVec3_c field_0xF50; + /* 0xF5C */ mVec3_c field_0xF5C; + /* 0xF68 */ mVec3_c field_0xF68; + /* 0xF74 */ mVec3_c field_0xF74; + /* 0xF80 */ mMtx_c field_0xF80; + /* 0xFB0 */ mQuat_c field_0xFB0; + /* 0xFC0 */ mVec3_c field_0xFC0; + /* 0xFCC */ u8 field_0xFCC; + /* 0xFCE */ s16 field_0xFCE; + /* 0xFD0 */ u8 _0xFD0[0xFE4 - 0xFD0]; + /* 0xFE4 */ ActorOnRail_Ext mPath; +}; + +#endif diff --git a/include/d/a/d_a_knight_leader_bird.h b/include/d/a/d_a_knight_leader_bird.h index 4a473cc4..461f2001 100644 --- a/include/d/a/d_a_knight_leader_bird.h +++ b/include/d/a/d_a_knight_leader_bird.h @@ -1,19 +1,34 @@ #ifndef D_A_KNIGHT_LEADER_BIRD_H #define D_A_KNIGHT_LEADER_BIRD_H +#include "d/a/d_a_base.h" +#include "d/a/d_a_bird_base.h" #include "d/a/obj/d_a_obj_base.h" +#include "m/m_mtx.h" #include "s/s_State.hpp" -#include "s/s_StateMgr.hpp" -class dAcKnightLeaderBird_c : public dAcObjBase_c { +class dAcKnightLeaderBird_c : public dAcBirdBase_c { public: dAcKnightLeaderBird_c() : mStateMgr(*this, sStateID::null) {} virtual ~dAcKnightLeaderBird_c() {} + virtual bool createHeap() override; + virtual int create() override; + virtual int doDelete() override; + virtual int actorExecute() override; + virtual int preDraw() override; + virtual int draw() override; + STATE_FUNC_DECLARE(dAcKnightLeaderBird_c, Wait); + STATE_MGR_DEFINE_UTIL_GETOLDSTATEID(dAcKnightLeaderBird_c); private: - /* 0x??? */ STATE_MGR_DECLARE(dAcKnightLeaderBird_c); + void updateSpineMtx(); + + /* 0x1030 */ u8 _0x1030[0x1040 - 0x1030]; + /* 0x1040 */ STATE_MGR_DECLARE(dAcKnightLeaderBird_c); + /* 0x1064 */ dAcRef_c<dAcObjBase_c> mUnkRef; + /* 0x1070 */ mMtx_c mSpineWorldMtx; }; #endif diff --git a/include/m/m3d/m_anmmdl.h b/include/m/m3d/m_anmmdl.h index 09180be0..cb8ec945 100644 --- a/include/m/m3d/m_anmmdl.h +++ b/include/m/m3d/m_anmmdl.h @@ -57,6 +57,10 @@ public: return mAnm; } + void setAnmFile(void *data) { + mAnmFile = nw4r::g3d::ResFile(data); + } + protected: nw4r::g3d::ResFile mMdlFile; nw4r::g3d::ResFile mAnmFile; diff --git a/include/m/m3d/m_fanm.h b/include/m/m3d/m_fanm.h index 49c89c0d..fd02f880 100644 --- a/include/m/m3d/m_fanm.h +++ b/include/m/m3d/m_fanm.h @@ -33,6 +33,10 @@ public: mPlayState = state; } + playMode_e getPlayMode() const { + return (playMode_e)mPlayState; + } + inline f32 getEndFrame() { return mEndFrame; } diff --git a/include/m/m_mtx.h b/include/m/m_mtx.h index 95830252..effe67e6 100644 --- a/include/m/m_mtx.h +++ b/include/m/m_mtx.h @@ -110,6 +110,30 @@ public: *this += m; } + void concat(const mMtx_c &rhs) { + MTXConcat(*this, rhs, *this); + } + + void scaleS(const mVec3_c &v) { + MTXScale(*this, v.x, v.y, v.z); + } + + void scaleS(f32 x, f32 y, f32 z) { + MTXScale(*this, x, y, z); + } + + void scaleM(const mVec3_c &v) { + mMtx_c m; + MTXScale(m, v.x, v.y, v.z); + *this += m; + } + + void scaleM(f32 x, f32 y, f32 z) { + mMtx_c m; + MTXScale(m, x, y, z); + *this += m; + } + void multVec(const mVec3_c &in, mVec3_c &out) const { MTXMultVec(*this, in, out); } diff --git a/include/s/s_State.hpp b/include/s/s_State.hpp index 262885af..03c90acd 100644 --- a/include/s/s_State.hpp +++ b/include/s/s_State.hpp @@ -44,6 +44,11 @@ return *mStateMgr.getStateID() == value; \ } +#define STATE_MGR_DEFINE_UTIL_GETOLDSTATEID(class_name) \ + const sFStateID_c<class_name> &getOldStateID() const { \ + return (sFStateID_c<class_name> &)*mStateMgr.getOldStateID(); \ + } + // TODO this is probably not the whole solution. // The problems with this approach are: // * You can't define the same state name for multiple files in the same TU due to baseID_ symbol clash. |
