Skip to content

Commit

Permalink
update d_a_insect
Browse files Browse the repository at this point in the history
  • Loading branch information
elijah-thomas774 committed Nov 9, 2024
1 parent 52d7c0f commit d0c8173
Show file tree
Hide file tree
Showing 10 changed files with 238 additions and 65 deletions.
22 changes: 11 additions & 11 deletions config/SOUE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10221,13 +10221,13 @@ fn_8018EB80 = .text:0x8018EB80; // type:function size:0x5C
fn_8018EBE0 = .text:0x8018EBE0; // type:function size:0x38
fn_8018EC20 = .text:0x8018EC20; // type:function size:0x2C
fn_8018EC50 = .text:0x8018EC50; // type:function size:0x538
fn_8018F190 = .text:0x8018F190; // type:function size:0x60
kill__12dAcOInsect_cFv = .text:0x8018F190; // type:function size:0x60
checkForLinkScare__12dAcOInsect_cFv = .text:0x8018F1F0; // type:function size:0xAC
fn_8018F2A0 = .text:0x8018F2A0; // type:function size:0xA0
checkDeath__12dAcOInsect_cFR9dBgS_Acch = .text:0x8018F2A0; // type:function size:0xA0
isLinkUsingBugNet__12dAcOInsect_cFv = .text:0x8018F340; // type:function size:0x4C
getLinkSpeedLevel__12dAcOInsect_cFv = .text:0x8018F390; // type:function size:0x50
isLinkNearby__12dAcOInsect_cFf = .text:0x8018F3E0; // type:function size:0x40
isLinkNearbyZ__12dAcOInsect_cFf = .text:0x8018F420; // type:function size:0x38
checkPlayerRadius__12dAcOInsect_cFf = .text:0x8018F3E0; // type:function size:0x40
checkPlayerElevationDiff__12dAcOInsect_cFf = .text:0x8018F420; // type:function size:0x38
someBaseFunction__12dAcOInsect_cFv = .text:0x8018F460; // type:function size:0xD8
dAcOInsect_0x8C__12dAcOInsect_cFv = .text:0x8018F540; // type:function size:0x8
someBaseFunction0__12dAcOInsect_cFv = .text:0x8018F550; // type:function size:0xD4
Expand All @@ -10240,16 +10240,16 @@ dAcOInsect_0x84__12dAcOInsect_cFv = .text:0x8018F7D0; // type:function size:0x8
dAcOInsect_0x88__12dAcOInsect_cFv = .text:0x8018F7E0; // type:function size:0x8
isLinkCloseAndFlag__12dAcOInsect_cFv = .text:0x8018F7F0; // type:function size:0xA8
dAcOInsect_0x94__12dAcOInsect_cFv = .text:0x8018F8A0; // type:function size:0x8
fn_8018F8B0 = .text:0x8018F8B0; // type:function size:0x14C
fn_8018FA00 = .text:0x8018FA00; // type:function size:0x7C
checkDeath__12dAcOInsect_cFR8cCcD_Obj = .text:0x8018F8B0; // type:function size:0x14C
checkCaught__12dAcOInsect_cFR8cCcD_Obj = .text:0x8018FA00; // type:function size:0x7C
resetScale__12dAcOInsect_cFv = .text:0x8018FA80; // type:function size:0x18
fn_8018FAA0__12dAcOInsect_cFv = .text:0x8018FAA0; // type:function size:0x28
fn_8018FAD0 = .text:0x8018FAD0; // type:function size:0x314
fn_8018FDF0 = .text:0x8018FDF0; // type:function size:0x2C0
fn_801900B0 = .text:0x801900B0; // type:function size:0xD0
fn_8018FAD0__12dAcOInsect_cFv = .text:0x8018FAD0; // type:function size:0x314
fn_8018FDF0__12dAcOInsect_cFRC7mVec3_c = .text:0x8018FDF0; // type:function size:0x2C0
fn_801900B0__12dAcOInsect_cFRC7mVec3_cRC7mVec3_c = .text:0x801900B0; // type:function size:0xD0
fn_80190180__12dAcOInsect_cFR4mAng = .text:0x80190180; // type:function size:0x2C0
fn_80190440 = .text:0x80190440; // type:function size:0x1D0
fn_80190610 = .text:0x80190610; // type:function size:0x2C
fn_80190440__12dAcOInsect_cFv = .text:0x80190440; // type:function size:0x1D0
fn_80190160__12dAcOInsect_cFv = .text:0x80190610; // type:function size:0x2C
dAcOInsect_0xAC__12dAcOInsect_cFv = .text:0x80190640; // type:function size:0x4
dAcOInsect_0xA8__12dAcOInsect_cFv = .text:0x80190650; // type:function size:0x4
dAcOInsect_0xA4__12dAcOInsect_cFv = .text:0x80190660; // type:function size:0x8
Expand Down
5 changes: 4 additions & 1 deletion include/d/a/d_a_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "stddef.h"
#include "toBeSorted/tlist.h"


class dAcBase_c;

struct SoundSource {
Expand Down Expand Up @@ -147,6 +146,10 @@ class dAcBase_c : public dBase_c {
return diff.x * diff.x + diff.z * diff.z;
}

f32 getDistanceTo(const mVec3_c &to) const {
return position.distance(to);
}

bool IsOutOfRange(const mVec3_c &point, f32 radius) {
return getSquareDistanceTo(point) > radius;
}
Expand Down
36 changes: 28 additions & 8 deletions include/d/a/d_a_insect.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "d/a/d_a_base.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/col/bg/d_bg_w_base.h"
#include "d/col/c/c_cc_d.h"
#include "d/col/c/c_m3d_g_pla.h"
#include "m/m_mtx.h"
#include "m/m_vec.h"

Expand Down Expand Up @@ -36,12 +39,14 @@ class dAcOInsect_c : public dAcObjBase_c {
return checkForLinkScare();
}
/* 0xAC */ virtual void dAcOInsect_0xAC() {}
/* 0xB0 */ virtual void dAcOInsect_0xB0();
/* 0xB0 */ virtual bool checkCaught(cCcD_Obj &col);

protected:
void goPoof();
bool isLinkNearby(f32 radius);
bool isLinkNearbyZ(f32 distance);
void kill();
void checkDeath(dBgS_Acch &acch);
bool checkDeath(cCcD_Obj &col);
bool checkPlayerRadius(f32 radius);
bool checkPlayerElevationDiff(f32 distance);
void someBaseFunction();
bool someBaseFunction0();
bool checkForLinkScare();
Expand All @@ -50,6 +55,11 @@ class dAcOInsect_c : public dAcObjBase_c {
static bool isLinkUsingBugNet();
bool resetScale();
bool fn_8018FAA0();
bool fn_8018FAD0();
void fn_8018FDF0(const mVec3_c &);
int fn_801900B0(const mVec3_c &, const mVec3_c &);
void fn_80190440();
void fn_80190160();
bool fn_80190180(mAng &outAng);

private:
Expand All @@ -58,16 +68,26 @@ class dAcOInsect_c : public dAcObjBase_c {
/* 0x335 */ u8 field_0x335;
/* 0x338 */ u32 field_0x338;
/* 0x33C */ mVec3_c field_0x33C;
/* 0x348 */ u8 field_0x348[0x35C - 0x348];
/* 0x348 */ mVec3_c field_0x348;
/* 0x354 */ f32 field_0x354;
/* 0x358 */ f32 field_0x358;
/* 0x35C */ f32 field_0x35C;
/* 0x360 */ u8 field_0x360[0x3BE - 0x360];
/* 0x360 */ mVec3_c field_0x360;
/* 0x36C */ mVec3_c field_0x36C;
/* 0x378 */ u8 field_0x378[0x3A8 - 0x378];
/* 0x3A8 */ cM3dGPla mPlane_0x3A8;
/* 0x3B8 */ int mMaterial;
/* 0x3BC */ u8 field_0x3BC;
/* 0x3BD */ u8 field_0x3BD;
/* 0x3BE */ u8 field_0x3BE;
/* 0x3BF */ u8 field_0x3BF;
/* 0x3C0 */ mMtx_c field_0x3C0;
/* 0x3F0 */ u8 field_0x3F0[0x3F8 - 0x3F0];
/* 0x3F0 */ u8 field_0x3F0[0x3F4 - 0x3F0];
/* 0x3F4 */ u8 field_0x3F4;
/* 0x3F8 */ u32 mLinkNearby;
/* 0x3FC */ dAcRef_c<dAcBase_c> field_0x3FC;
/* 0x408 */ u8 field_0x408[0x40D - 0x408];
/* 0x408 */ u8 field_0x408[0x40C - 0x408];
/* 0x40C */ u8 field_0x40C;
/* 0x40D */ u8 field_0x40D;
/* 0x410 */ mVec3_c field_0x410[3];
/* 0x434 */ mVec3_c field_0x434[3];
Expand Down
5 changes: 5 additions & 0 deletions include/d/a/d_a_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class dAcPy_c : public dAcObjBase_c {
/* 0x360 */ UNKWORD field_0x360;
/* 0x364 */ u32 mActionFlags;
/* 0x368 */ u32 mActionFlagsCont;
/* 0x36C */ int mCurrentAction; // TODO (Document Enum)

inline bool checkFlags0x340(u32 mask) const {
return (someFlags_0x340 & mask) != 0;
Expand All @@ -237,5 +238,9 @@ class dAcPy_c : public dAcObjBase_c {
return mActionFlags & FLG0_FLY;
}

int getCurrentAction() const {
return mCurrentAction;
}

static dAcPy_c *LINK;
};
4 changes: 4 additions & 0 deletions include/d/a/obj/d_a_obj_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class dAcObjBase_c : public dAcBase_c {
return getVelocityMag() <= EGG::Math<f32>::epsilon();
}

bool isSlowerThan(f32 speed) const {
return fabsf(forwardSpeed) <= speed;
}

// 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);
Expand Down
4 changes: 4 additions & 0 deletions include/d/col/bg/d_bg_s_spl_grp_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ class dBgS_SplGrpChk : public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
void CopyGnd() {
mGroundCopy = mGnd;
}

f32 GetGroundH() const {
return mGroundH;
}
};

#endif
5 changes: 5 additions & 0 deletions include/m/m_angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ struct mAng {
f32 radian() const {
return ((2.f * M_PI) / 65536.0f) * mVal;
}

f32 radian2() const {
return mVal * sAngToRad;
}

static s16 fromRad(f32 rad) {
return rad * sRadToAng;
}
Expand Down
6 changes: 6 additions & 0 deletions include/m/m_mtx.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "m/m_vec.h"
#include "nw4r/types_nw4r.h"
#include "rvl/MTX/mtx.h"
#include "rvl/MTX/mtxvec.h"

class mMtx_c : public EGG::Matrix34f {
typedef f32 (*MtxRef)[4];
Expand Down Expand Up @@ -70,6 +71,11 @@ class mMtx_c : public EGG::Matrix34f {
void trans(f32 x, f32 y, f32 z) {
PSMTXTrans(*this, x, y, z);
}
mVec3_c multVec(const mVec3_c &v) const {
mVec3_c ret = v;
PSMTXMultVec(*this, ret, ret);
return ret;
}

mMtx_c &operator+=(const mMtx_c &rhs) {
PSMTXConcat(*this, rhs, *this);
Expand Down
7 changes: 7 additions & 0 deletions include/m/m_vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ class mVec3_c : public EGG::Vector3f {
return PSVECMag(*this);
}

f32 distance(const mVec3_c &to) const {
return EGG::Math<f32>::sqrt(PSVECSquareDistance(*this, to));
}

f32 squareMagXZ() const {
return x * x + z * z;
}
void rotY(const mAng &angle);

void CopyTo(nw4r::math::VEC3 *p) {
Expand Down
Loading

0 comments on commit d0c8173

Please sign in to comment.