d_a_obj_tumble_weed mostly done (#88)

* mostly done

* Update d_t_tumble_weed.cpp

* remove cM::calcTimer

* just regswap on adjustSpeed

* Create inlines for angle between vectors

* name data symbols

---------

Co-authored-by: robojumper <robojumper@gmail.com>
This commit is contained in:
Elijah Thomas
2024-11-06 16:36:17 -05:00
committed by GitHub
parent f509c053e5
commit c235e32d95
34 changed files with 804 additions and 214 deletions
+9 -1
View File
@@ -4,6 +4,7 @@
#include "d/a/d_a_base.h"
#include "d/col/c/c_cc_d.h"
#include "d/col/c/c_m3d_g_aab.h"
#include "egg/math/eggMath.h"
#include "m/m3d/m_shadow.h"
#include "m/m3d/m_smdl.h"
#include "m/m_angle.h"
@@ -11,7 +12,6 @@
#include "m/m_vec.h"
#include "m/types_m.h"
// Size: 0xA8
struct ActorCarryStruct {
/* 0x00 */ fLiNdBa_c actorLink;
@@ -89,6 +89,14 @@ public:
return angle;
}
f32 getVelocityMag() const {
return fabsf(nw4r::math::VEC3LenSq(velocity));
}
bool isStopped() const {
return getVelocityMag() <= EGG::Math<f32>::epsilon();
}
// 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);
+73 -3
View File
@@ -1,20 +1,90 @@
#ifndef D_A_OBJ_TUMBLE_WEED_H
#define D_A_OBJ_TUMBLE_WEED_H
#include "common.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_smdl.h"
#include "m/m_mtx.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/dowsing_target.h"
#include "toBeSorted/time_area_mgr.h"
class dAcOTumbleWeed_c : public dAcObjBase_c {
public:
dAcOTumbleWeed_c() : mStateMgr(*this, sStateID::null) {}
dAcOTumbleWeed_c() : mDowsingTarget(this, DowsingTarget::SLOT_NONE), mStateMgr(*this, sStateID::null) {}
virtual ~dAcOTumbleWeed_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;
bool checkCollect();
bool checkBreak();
void doBreak();
void adjustTimeScale();
void adjustTumble(const mVec3_c &dir);
void calcWind();
mVec3_c getPosition() const;
void calcMatrix();
void adjustAngle();
void adjustSpeed();
void tumbleBounceMaybe();
void setWind(const mVec3_c &);
bool checkSlope();
bool fn_475_E40() const;
bool checkInvalidGround() const;
// Look at `isStopped` in dAcObjBase. This may be a diff inline
f32 getWindMag() const {
return fabsf(nw4r::math::VEC3LenSq(mWind));
}
bool isWindStop() const {
return getWindMag() <= EGG::Math<f32>::epsilon();
}
STATE_FUNC_DECLARE(dAcOTumbleWeed_c, Wait);
STATE_FUNC_DECLARE(dAcOTumbleWeed_c, Slope);
private:
/* 0x??? */ STATE_MGR_DECLARE(dAcOTumbleWeed_c);
/* 0x330 */ nw4r::g3d::ResFile mResFile;
/* 0x334 */ m3d::smdl_c mMdl;
/* 0x350 */ dShadowCircle_c mShdw;
/* 0x358 */ dCcD_Sph mSph;
/* 0x4A8 */ dBgS_AcchCir mAcchCir;
/* 0x504 */ dBgS_ObjAcch mObjAcch;
/* 0x8B4 */ DowsingTarget mDowsingTarget;
/* 0x8D4 */ STATE_MGR_DECLARE(dAcOTumbleWeed_c);
/* 0x910 */ mQuat_c mField_0x910;
/* 0x920 */ TimeAreaStruct mTimeArea;
/* 0x92C */ mMtx_c mShadowMtx;
/* 0x95C */ mVec3_c mWind;
/* 0x968 */ mVec3_c mField_0x968;
/* 0x974 */ f32 mField_0x974;
/* 0x978 */ f32 mField_0x978;
/* 0x97C */ f32 mField_0x97C;
/* 0x980 */ f32 mField_0x980;
/* 0x984 */ f32 mSpeedTarget;
/* 0x988 */ u16 mTumbleTimer;
/* 0x98A */ u8 mWindTimer;
/* 0x98B */ u8 mField_0x98B;
/* 0x98C */ u8 mField_0x98C;
/* 0x98D */ bool mbOnGround;
static dCcD_SrcSph sSphSrc;
};
#endif