Skip to content

Commit

Permalink
all d_a_alink functions attempted (#2239)
Browse files Browse the repository at this point in the history
* more work on alink

* alink wip

* little more work

* setEyeMove

* 14 left

* auto ground hit

* all d_a_alink functions attempted
  • Loading branch information
TakaRikka authored Nov 9, 2024
1 parent 80f3040 commit 083991a
Show file tree
Hide file tree
Showing 19 changed files with 5,315 additions and 436 deletions.
2 changes: 1 addition & 1 deletion include/SSystem/SComponent/c_m3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void cM3d_CalcVecAngle(const Vec&, short*, short*);
void cM3d_CalcVecZAngle(const Vec&, csXyz*);
static void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32*, f32*);
static int cM3d_2PlaneCrossLine(const cM3dGPla&, const cM3dGPla&, cM3dGLin*);
bool cM3d_3PlaneCrossPos(const cM3dGPla&, const cM3dGPla&, const cM3dGPla&, Vec*);
BOOL cM3d_3PlaneCrossPos(const cM3dGPla&, const cM3dGPla&, const cM3dGPla&, Vec*);
f32 cM3d_lineVsPosSuisenCross(const cM3dGLin*, const Vec*, Vec*);
f32 cM3d_lineVsPosSuisenCross(const Vec&, const Vec&, const Vec&, Vec*);
int cM3d_2PlaneLinePosNearPos(const cM3dGPla&, const cM3dGPla&, const Vec*, Vec*);
Expand Down
7 changes: 7 additions & 0 deletions include/SSystem/SComponent/c_m3d_g_pla.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,22 @@ class cM3dGPla {
cXyz* GetNP() { return &mNormal; }
const cXyz* GetNP() const { return &mNormal; }
f32 GetD() const { return mD; }

void SetupFrom3Vtx(const Vec* v1, const Vec* v2, const Vec* v3) {
cM3d_CalcPla(v1, v2, v3, &mNormal, &mD);
}

f32 getCrossY_NonIsZero(const cXyz *param_1) {
return ((-mNormal.x * param_1->x - mNormal.z * param_1->z) - mD) / mNormal.y;
}

bool cross(cM3dGLin const& line, Vec& point) {
return cM3d_Cross_LinPla(&line, this, &point, true, true);
}

f32 getSignedLenPos(const cXyz* param_0) const {
return cM3d_SignedLenPlaAndPos(this, param_0);
}
};

#endif
61 changes: 40 additions & 21 deletions include/d/actor/d_a_alink.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class dAlink_bottleWaterPcallBack_c : public JPAParticleCallBack {
s16 getAppearFlg() const { return mAppearFlg; }
s16 getHitFlg() const { return mHitFlg; }
cXyz& getHitPos() { return mHitPos; }
f32 getKeepMinY() { return mKeepMinY; }

void onAppearFlg() { mAppearFlg = true; }

Expand Down Expand Up @@ -156,7 +157,18 @@ class daAlink_matAnm_c : public J3DMaterialAnm {

static void decMorfFrame() { cLib_calcTimer<u8>(&m_morf_frame); }
static void setMorfFrame(u8 i_frame) { m_morf_frame = i_frame; }

static u8 getMorfFrame() { return m_morf_frame; }

static void onEyeMoveFlg() { m_eye_move_flg = true; }
static void offEyeMoveFlg() { m_eye_move_flg = false; }
static bool getEyeMoveFlg() { return m_eye_move_flg; }

f32* getNowOffsetXP() { return &mNowOffsetX; }
f32* getNowOffsetYP() { return &mNowOffsetY; }
void setNowOffsetX(f32 i_offset) { mNowOffsetX = i_offset; }
void setNowOffsetY(f32 i_offset) { mNowOffsetY = i_offset; }

static bool m_eye_move_flg;
static u8 m_morf_frame;

/* 0x0F4 */ f32 field_0xf4;
Expand Down Expand Up @@ -669,8 +681,10 @@ class daAlink_c : public daPy_py_c {

enum daAlink_FTANM {
FTANM_UNK_0 = 0,
FTANM_UNK_1 = 1,
FTANM_UNK_3 = 3,
FTANM_UNK_4 = 4,
FTANM_UNK_5 = 5,
FTANM_UNK_8 = 8,
FTANM_UNK_9 = 9,
FTANM_UNK_13 = 0x13,
Expand All @@ -681,6 +695,7 @@ class daAlink_c : public daPy_py_c {
FTANM_UNK_23 = 0x23,
FTANM_UNK_27 = 0x27,
FTANM_UNK_2D = 0x2D,
FTANM_UNK_39 = 0x39,
FTANM_UNK_48 = 0x48,
FTANM_UNK_75 = 0x75,
FTANM_UNK_76 = 0x76,
Expand All @@ -690,6 +705,7 @@ class daAlink_c : public daPy_py_c {
FTANM_UNK_7C = 0x7C,
FTANM_UNK_8A = 0x8A,
FTANM_UNK_8B = 0x8B,
FTANM_UNK_8C = 0x8C,
FTANM_UNK_8D = 0x8D,
FTANM_UNK_8E = 0x8E,
FTANM_UNK_8F = 0x8F,
Expand All @@ -700,6 +716,7 @@ class daAlink_c : public daPy_py_c {
FTANM_UNK_95 = 0x95,
FTANM_UNK_96 = 0x96,
FTANM_UNK_97 = 0x97,
FTANM_UNK_98 = 0x98,
FTANM_UNK_99 = 0x99,
FTANM_UNK_9A = 0x9A,
FTANM_UNK_9B = 0x9B,
Expand Down Expand Up @@ -1310,29 +1327,29 @@ class daAlink_c : public daPy_py_c {
/* 8009DA98 */ void tgHitCallback(fopAc_ac_c*, dCcD_GObjInf*, dCcD_GObjInf*);
/* 8009DB64 */ void coHitCallback(fopAc_ac_c*, dCcD_GObjInf*);
/* 8009DC6C */ void setMatrixWorldAxisRot(f32 (*)[4], s16, s16, s16, int, cXyz const*);
/* 8009DD90 */ void jointControll(int);
/* 8009DD90 */ int jointControll(int);
/* 8009E7B8 */ void setUpperFront();
/* 8009E91C */ void changeBlendRate(int);
/* 8009EB18 */ void resetRootMtx();
/* 8009EB58 */ bool modelCallBack(int);
/* 8009ECA0 */ void headModelCallBack(int);
/* 8009ECA0 */ int headModelCallBack(int);
/* 8009EF7C */ int wolfModelCallBack(int);
/* 8009F034 */ void setHatAngle();
/* 8009FFF8 */ void calcHairAngle(s16*);
/* 800A002C */ void setHairAngle(cXyz*, f32, f32);
/* 800A0744 */ void setLookPosFromOut(cXyz*);
/* 800A07D8 */ bool checkAttentionPosAngle(cXyz*);
/* 800A0868 */ void checkActorPosAngle(fopAc_ac_c*, cXyz**);
/* 800A093C */ void getNeckAimPos(cXyz*, int*, int);
/* 800A142C */ void getNeckAimAngle(cXyz*, s16*, s16*, s16*, s16*);
/* 800A0868 */ bool checkActorPosAngle(fopAc_ac_c*, cXyz**);
/* 800A093C */ cXyz* getNeckAimPos(cXyz*, int*, int);
/* 800A142C */ s16 getNeckAimAngle(cXyz*, s16*, s16*, s16*, s16*);
/* 800A1AEC */ void setEyeMove(cXyz*, s16, s16);
/* 800A1F90 */ void setNeckAngle();
/* 800A2198 */ bool commonLineCheck(cXyz*, cXyz*);
/* 800A21E0 */ static s16 getMoveBGActorName(cBgS_PolyInfo&, int);
/* 800A2280 */ fopAc_ac_c* checkGoronRide();
/* 800A22E8 */ void setMoveSlantAngle();
/* 800A2710 */ void setArmMatrix();
/* 800A29DC */ void setFootMatrix();
/* 800A2710 */ int setArmMatrix();
/* 800A29DC */ int setFootMatrix();
/* 800A2C24 */ void setMatrixOffset(f32*, f32);
/* 800A2CE0 */ int setLegAngle(f32, daAlink_footData_c*, s16*, s16*, int);
/* 800A3430 */ void footBgCheck();
Expand Down Expand Up @@ -1362,7 +1379,7 @@ class daAlink_c : public daPy_py_c {
/* 800A7950 */ bool checkWindSpeedOnAngle() const;
/* 800A79EC */ bool checkWindSpeedOnAngleAnime(int) const;
/* 800A7A5C */ bool checkDashAnime() const;
/* 800A7ABC */ void checkWindWallRate(cXyz const&);
/* 800A7ABC */ f32 checkWindWallRate(cXyz const&);
/* 800A7CB0 */ void setWindSpeed();
/* 800A8310 */ void setBodyPartPos();
/* 800A87F8 */ void setAttentionPos();
Expand Down Expand Up @@ -1409,9 +1426,9 @@ class daAlink_c : public daPy_py_c {
/* 800AD340 */ void setUpperAnimeBase(u16);
/* 800AD374 */ void setUpperAnimeBaseMorf(u16, f32);
/* 800AD3A8 */ void setUpperAnimeBaseSpeed(u16, f32, f32);
/* 800AD3D8 */ void setUpperAnime(u16, daAlink_c::daAlink_UPPER, f32, f32, s16, f32);
/* 800AD3D8 */ int setUpperAnime(u16, daAlink_c::daAlink_UPPER, f32, f32, s16, f32);
/* 800AD6F0 */ void setUpperAnimeParam(u16, daAlink_c::daAlink_UPPER, daAlinkHIO_anm_c const*);
/* 800AD724 */ void resetUpperAnime(daAlink_c::daAlink_UPPER, f32);
/* 800AD724 */ int resetUpperAnime(daAlink_c::daAlink_UPPER, f32);
/* 800AD8F4 */ void setUnderAnimeMorf(f32);
/* 800AD964 */ int setUnderAnime(u16, daAlink_c::daAlink_UNDER, f32, f32, s16, f32);
/* 800ADAB8 */ int setUnderAnimeParam(u16, daAlink_c::daAlink_UNDER, daAlinkHIO_anm_c const*);
Expand All @@ -1426,7 +1443,7 @@ class daAlink_c : public daPy_py_c {
/* 800AF4B0 */ void setFaceBck(u16, int, u16);
/* 800AF61C */ void setFaceBtp(u16, int, u16);
/* 800AF7D0 */ void setFaceBtk(u16, int, u16);
/* 800AF8A0 */ void setFaceBasicTexture(daAlink_c::daAlink_FTANM);
/* 800AF8A0 */ daAlink_FTANM setFaceBasicTexture(daAlink_c::daAlink_FTANM);
/* 800AF9A8 */ void setFaceBasicAnime(daAlink_c::daAlink_ANM);
/* 800AFAA8 */ void setFacePriTexture(daAlink_c::daAlink_FTANM);
/* 800AFB14 */ void setFacePriAnime(daAlink_c::daAlink_ANM);
Expand Down Expand Up @@ -2191,7 +2208,7 @@ class daAlink_c : public daPy_py_c {
/* 800F3BEC */ f32 getCanoeCres() const;
/* 800F3C18 */ f32 getCanoeSpeedRate() const;
/* 800F3C44 */ s16 getCanoeMaxRotSpeed() const;
/* 800F3CCC */ cXyz* getCanoeLocalPaddleTop();
/* 800F3CCC */ static cXyz* getCanoeLocalPaddleTop();
/* 800F3CF8 */ BOOL checkCanoeRideTandem();
/* 800F3D58 */ BOOL checkFishingRodAndLureItem() const;
/* 800F3DA0 */ void initFishingRodHand();
Expand Down Expand Up @@ -3237,6 +3254,7 @@ class daAlink_c : public daPy_py_c {
BOOL checkCopyRodControllAnime() const { return checkUpperAnime(0x202); }
BOOL checkWolfHeadDamageAnime() const { return checkUpperAnime(0x2A7); }
BOOL checkExchangeRodAnime() const { return checkUpperAnime(0x68); }
BOOL checkReelAnime() const { return checkUpperAnime(0x1FB); }

int checkWolfEyeUp() const { return mWolfEyeUp; }
void onModeFlg(u32 flag) { mModeFlg |= flag; }
Expand Down Expand Up @@ -3486,6 +3504,7 @@ class daAlink_c : public daPy_py_c {
bool checkRootTransZClearMode() { return field_0x2f99 & 4; }
bool checkRootTransXClearMode() { return field_0x2f99 & 1; }
bool checkRootTransYClearMode() { return field_0x2f99 & 2; }
bool checkRootTransClearContinueMode() { return field_0x2f99 & 8; }
s16 checkWindStoneHowl() {return mProcVar4.field_0x3010; }
u8 getCorrectCurveID() { return mZ2WolfHowlMgr.getCorrectCurveID(); }
u8 getCorrectLineNum() { return mZ2WolfHowlMgr.getCorrectLineNum(); }
Expand All @@ -3506,6 +3525,8 @@ class daAlink_c : public daPy_py_c {
u8 getBStatus() { return dComIfGp_getAStatus(); }
void setRStatus(u8 param_0, u8 param_1) { dComIfGp_setRStatus(param_0, param_1); }

BOOL checkWindSpeedMoveXZ() const { return mWindSpeed.abs2XZ() > 1.0f; }

inline bool checkWindSpeedOnXZ() const;
inline void startRestartRoomFromOut(int, u32, int);
inline u16 getReadyItem();
Expand Down Expand Up @@ -3690,14 +3711,14 @@ class daAlink_c : public daPy_py_c {
/* 0x028F0 */ fpc_ProcID mMsgClassID;
/* 0x028F4 */ int mAtnActorID;
/* 0x028F8 */ fpc_ProcID field_0x28f8;
/* 0x028FC */ int field_0x28fc;
/* 0x028FC */ fpc_ProcID field_0x28fc;
/* 0x02900 */ u32 field_0x2900;
/* 0x02904 */ daAlink_footData_c mFootData1[2];
/* 0x02A4C */ daAlink_footData_c mFootData2[2];
/* 0x02B94 */ f32 field_0x2b94;
/* 0x02B98 */ f32 field_0x2b98;
/* 0x02B98 */ f32 field_0x2b9c;
/* 0x02BA0 */ f32* field_0x2ba0;
/* 0x02BA0 */ f32 field_0x2ba0;
/* 0x02BA4 */ f32 field_0x2ba4;
/* 0x02BA8 */ f32 mSinkShapeOffset;
/* 0x02BAC */ f32 mAcchCirWallH[3];
Expand All @@ -3709,7 +3730,7 @@ class daAlink_c : public daPy_py_c {
/* 0x02CA8 */ Z2CreatureLink mZ2Link;
/* 0x02D78 */ u8* field_0x2d78;
/* 0x02D7C */ daPy_frameCtrl_c* field_0x2d7c;
/* 0x02D80 */ int field_0x2d80;
/* 0x02D80 */ void* field_0x2d80;
/* 0x02D84 */ Z2WolfHowlMgr mZ2WolfHowlMgr;
/* 0x02E44 */ dJntCol_c field_0x2e44;
/* 0x02E54 */ dPaPoF_c field_0x2e54;
Expand Down Expand Up @@ -3871,9 +3892,7 @@ class daAlink_c : public daPy_py_c {
/* 0x03060 */ s16 field_0x3060;
/* 0x03062 */ s16 field_0x3062;
/* 0x03064 */ s16 field_0x3064;
/* 0x03066 */ s16 field_0x3066;
/* 0x03068 */ u8 field_0x3068[2];
/* 0x0306A */ s16 field_0x306a;
/* 0x03066 */ s16 field_0x3066[3];
/* 0x0306C */ s16 field_0x306c;
/* 0x0306E */ s16 field_0x306e;
/* 0x03070 */ s16 field_0x3070;
Expand Down Expand Up @@ -3903,7 +3922,7 @@ class daAlink_c : public daPy_py_c {
/* 0x030A8 */ u16 field_0x30a8;
/* 0x030AA */ u16 field_0x30aa;
/* 0x030AC */ s16 mWolfEyeUp;
/* 0x030AE */ u16 field_0x30ae;
/* 0x030AE */ s16 field_0x30ae;
/* 0x030B0 */ s16 field_0x30b0;
/* 0x030B2 */ s16 field_0x30b2;
/* 0x030B4 */ u16 field_0x30b4;
Expand Down Expand Up @@ -3977,7 +3996,7 @@ class daAlink_c : public daPy_py_c {
/* 0x0319C */ int field_0x319c;
/* 0x031A0 */ u32 mModeFlg;
/* 0x031A4 */ int field_0x31a4;
/* 0x031A8 */ u8 field_0x31a8[8];
/* 0x031A8 */ u32 field_0x31a8[2];
/* 0x031B0 */ u32 field_0x31b0[3];
/* 0x031BC */ u32 field_0x31bc;
/* 0x031C0 */ u32 field_0x31c0;
Expand Down
6 changes: 5 additions & 1 deletion include/d/actor/d_a_b_mgn.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ class daB_MGN_c : public fopEn_enemy_c {
/* 8060EAE0 */ void CreateHeap();
/* 8060F0D0 */ void create();

bool isDown() { return field_0xb01 != 0; }

private:
/* 0x5ac */ u8 field_0x5ac[0x26cc - 0x5ac];
/* 0x05AC */ u8 field_0x5ac[0xB01 - 0x5AC];
/* 0x0B01 */ u8 field_0xb01;
/* 0x0B02 */ u8 field_0xb02[0x26CC - 0xB02];
};

STATIC_ASSERT(sizeof(daB_MGN_c) == 0x26cc);
Expand Down
2 changes: 1 addition & 1 deletion include/d/actor/d_a_midna.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class daMidna_c : public fopAc_ac_c {
/* 0x00 */ ANM_NONE = 0,
};

void onForcePanic();
void onForcePanic() { onEndResetStateFlg0(ERFLG0_FORCE_PANIC); }
u32 checkForceNormalColor() const;
u32 checkForceTiredColor() const;
static bool checkMidnaTired();
Expand Down
66 changes: 45 additions & 21 deletions include/d/actor/d_a_npc_bou.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @details
*
*/
class daNpc_Bou_c : public fopAc_ac_c {
class daNpc_Bou_c : public daNpcT_c {
public:
/* 8096CF8C */ ~daNpc_Bou_c();
/* 8096D0D8 */ void create();
Expand All @@ -26,20 +26,7 @@ class daNpc_Bou_c : public fopAc_ac_c {
/* 8096DA78 */ void getType();
/* 8096DADC */ void isDelete();
/* 8096DBBC */ void reset();
/* 8096DD44 */ void afterJntAnm(int);
/* 8096DDC8 */ void setParam();
/* 8096DF9C */ void checkChangeEvt();
/* 8096E0EC */ void setAfterTalkMotion();
/* 8096E18C */ void srchActors();
/* 8096E27C */ void evtTalk();
/* 8096E31C */ bool evtEndProc();
/* 8096E324 */ void evtCutProc();
/* 8096E3EC */ void action();
/* 8096E7E0 */ void beforeMove();
/* 8096E8A4 */ void setAttnPos();
/* 8096EB14 */ void setCollision();
/* 8096EC6C */ bool drawDbgInfo();
/* 8096EC74 */ void changeAnm(int*, int*);
/* 8096ECC0 */ void selectAction();
/* 8096ED3C */ void chkAction(int (daNpc_Bou_c::*)(void*));
/* 8096ED68 */ void setAction(int (daNpc_Bou_c::*)(void*));
Expand All @@ -58,18 +45,55 @@ class daNpc_Bou_c : public fopAc_ac_c {
daNpcT_MotionSeqMngr_c::sequenceStepData_c const*, int,
daNpcT_MotionSeqMngr_c::sequenceStepData_c const*, int,
daNpcT_evtData_c const*, char**);
/* 809727B4 */ s32 getEyeballMaterialNo();
/* 809727BC */ s32 getHeadJointNo();
/* 809727C4 */ s32 getNeckJointNo();
/* 809727CC */ bool getBackboneJointNo();
/* 809727D4 */ void checkChangeJoint(int);
/* 809727E4 */ void checkRemoveJoint(int);

/* 809727D4 */ virtual int checkChangeJoint(int);
/* 809727E4 */ virtual int checkRemoveJoint(int);
/* 809727CC */ virtual s32 getBackboneJointNo();
/* 809727C4 */ virtual s32 getNeckJointNo();
/* 809727BC */ virtual s32 getHeadJointNo();
/* 809727B4 */ virtual s32 getEyeballMaterialNo();
/* 8096DD44 */ virtual void afterJntAnm(int);
/* 8096DDC8 */ virtual void setParam();
/* 8096DF9C */ virtual bool checkChangeEvt();
/* 8096E27C */ virtual bool evtTalk();
/* 8096E31C */ virtual bool evtEndProc();
/* 8096E324 */ virtual bool evtCutProc();
/* 8096E0EC */ virtual void setAfterTalkMotion();
/* 8096E3EC */ virtual void action();
/* 8096E7E0 */ virtual void beforeMove();
/* 8096E8A4 */ virtual void setAttnPos();
/* 8096EB14 */ virtual void setCollision();
/* 8096EC6C */ virtual int drawDbgInfo();
/* 8096EC74 */ virtual void changeAnm(int*, int*);

static void* mCutNameList[9];
static u8 mCutList[108];

BOOL speakTo() {
if (field_0xf80 == 4) {
if (current.pos.absXZ(daPy_getPlayerActorClass()->current.pos) < 1100.0f && strlen(field_0x570[5].eventName) != 0) {
u32 len = strlen(field_0x574[field_0x570[5].num]);
if (len != 0) {
eventInfo.setArchiveName(field_0x574[field_0x570[5].num]);
dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName());
}

field_0xe1c = dComIfGp_getEventManager().getEventIdx(this, field_0x570[5].eventName, 0xFF);
fopAcM_orderOtherEventId(this, field_0xe1c, 0xFF, 0xFFFF, 4, 1);
return 1;
}
}

return 0;
}

private:
/* 0x568 */ u8 field_0x568[0xffc - 0x568];
/* 0xE40 */ u8 field_0xE40[0xE44 - 0xE40];
/* 0xE44 */ dCcD_Cyl field_0xe44;
/* 0xF80 */ u8 field_0xf80;
/* 0xF84 */ daNpcT_ActorMngr_c field_0xf84[3];
/* 0xF9C */ daNpcT_Path_c field_0xf9c;
/* 0xFC4 */ u8 field_0xfc4[0xFFC - 0xFC4];
};

STATIC_ASSERT(sizeof(daNpc_Bou_c) == 0xffc);
Expand Down
Loading

0 comments on commit 083991a

Please sign in to comment.