Skip to content

Commit

Permalink
alink horse mostly done (#2229)
Browse files Browse the repository at this point in the history
* d_a_horse work

* more work on alink horse

* finish alink horse

* little work on d_a_alink_link
  • Loading branch information
TakaRikka authored Oct 30, 2024
1 parent 7f2e42b commit 36519dd
Show file tree
Hide file tree
Showing 10 changed files with 1,784 additions and 255 deletions.
2 changes: 2 additions & 0 deletions include/JSystem/J3DGraphBase/J3DTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct J3DTransformInfo {
return *this;
} */

#ifdef __MWERKS__
inline J3DTransformInfo& operator=(const register J3DTransformInfo& b) {
register const J3DTransformInfo& var_r31 = b;
register J3DTransformInfo& var_r30 = *this;
Expand All @@ -46,6 +47,7 @@ struct J3DTransformInfo {
}
return *this;
}
#endif
}; // Size: 0x20

extern J3DTransformInfo const j3dDefaultTransformInfo;
Expand Down
68 changes: 24 additions & 44 deletions include/d/actor/d_a_alink.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ class daAlink_c : public daPy_py_c {
FTANM_UNK_9 = 9,
FTANM_UNK_13 = 0x13,
FTANM_UNK_14 = 0x14,
FTANM_UNK_20 = 0x20,
FTANM_UNK_21 = 0x21,
FTANM_UNK_22 = 0x22,
FTANM_UNK_23 = 0x23,
FTANM_UNK_27 = 0x27,
FTANM_UNK_2D = 0x2D,
FTANM_UNK_48 = 0x48,
Expand Down Expand Up @@ -1677,8 +1681,8 @@ class daAlink_c : public daPy_py_c {
/* 800CB480 */ bool checkSwordDraw();
/* 800CB53C */ bool checkShieldDraw();
/* 800CB5F8 */ bool checkItemDraw();
/* 800CB694 */ void initShadowScaleLight();
/* 800CBA38 */ void moveShadowScaleLight();
/* 800CB694 */ int initShadowScaleLight();
/* 800CBA38 */ int moveShadowScaleLight();
/* 800CBC18 */ void shadowDraw();
/* 800CC25C */ void modelCalc(J3DModel*);
/* 800CC298 */ void basicModelDraw(J3DModel*);
Expand Down Expand Up @@ -1709,7 +1713,7 @@ class daAlink_c : public daPy_py_c {
/* 800D014C */ void setMidnaTalkStatus(u8 status) {
dComIfGp_setZStatus(status, 0);
}
/* 800D0164 */ void set3DStatus(u8, u8);
/* 800D0164 */ void set3DStatus(u8 status, u8 direction) { dComIfGp_set3DStatus(status, direction, 0); }
/* 800D2684 */ void checkCutTurnCharge();
/* 800D0E08 */ void checkLightSwordMtrl();
/* 800D0E98 */ BOOL checkSwordEquipAnime() const;
Expand Down Expand Up @@ -2093,14 +2097,14 @@ class daAlink_c : public daPy_py_c {
/* 800ECD90 */ BOOL checkHorseNotDamageReaction() const;
/* 800ECDC4 */ BOOL checkHorseWaitLashAnime() const;
/* 800ECDEC */ BOOL checkHorseReinLeftOnly() const;
/* 800ECE10 */ void getReinHandType() const;
/* 800ECE10 */ int getReinHandType() const;
/* 800ECF04 */ BOOL checkHorseLieAnime() const;
/* 800ECF5C */ BOOL checkHorseSubjectivity() const;
/* 800ECF9C */ void setHorseSwordUpAnime();
/* 800ECFF4 */ void setHorseTurnUpperAnime(int);
/* 800ED074 */ BOOL checkHorseNoUpperAnime() const;
/* 800ED0D4 */ void getHorseReinHandPos(cXyz*, cXyz*);
/* 800ED1F0 */ void checkHorseNotGrab() const;
/* 800ED1F0 */ BOOL checkHorseNotGrab() const;
/* 800ED310 */ void setHorseStirrup();
/* 800ED4B8 */ void changeBoarRunRide();
/* 800ED4DC */ int setSyncHorsePos();
Expand All @@ -2127,7 +2131,7 @@ class daAlink_c : public daPy_py_c {
/* 800EF394 */ void horseGetOffEnd();
/* 800EF450 */ int checkNextActionHorse();
/* 800EF598 */ BOOL checkHorseGetOff();
/* 800EF6B0 */ void checkHorseGetOffAndSetDoStatus();
/* 800EF6B0 */ int checkHorseGetOffAndSetDoStatus();
/* 800EF884 */ int setHorseGetOff(int);
/* 800EF95C */ int procHorseRideInit();
/* 800EFDC4 */ int procHorseRide();
Expand Down Expand Up @@ -4115,12 +4119,12 @@ struct daAlink_cutParamTbl {
}; // Size: 0x10

struct daAlink_cutHorseParamTbl {
/* 0x0 */ int field_0x0;
/* 0x4 */ u16 field_0x4;
/* 0x6 */ u16 field_0x6;
/* 0x0 */ daAlink_c::daAlink_FTANM m_faceanm;
/* 0x4 */ u16 m_upperAnm;
/* 0x6 */ u16 m_faceBtk;
/* 0x8 */ u8 field_0x8;
/* 0x9 */ u8 field_0x9;
/* 0xA */ u8 field_0xa;
/* 0xA */ u8 m_cutType;
}; // Size: 0xC

struct daAlinkHIO_anm_c {
Expand Down Expand Up @@ -4446,56 +4450,32 @@ class daAlinkHIO_cutTurn_c0 {
static daAlinkHIO_cutTurn_c1 const m;
};

class daAlinkHIO_hoCutLA_c1 {
class daAlinkHIO_hoCut_c1 {
public:
/* 0x00 */ daAlinkHIO_anm_c field_0x0;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ f32 field_0x18;
/* 0x1C */ f32 field_0x1C;
}; // Size: 0x20
/* 0x00 */ daAlinkHIO_anm_c mCutAnm;
/* 0x14 */ f32 mAttackStartFrame;
/* 0x18 */ f32 mAttackEndFrame;
/* 0x1C */ f32 mAfterCutMorf;
};

class daAlinkHIO_hoCutLA_c0 {
public:
static daAlinkHIO_hoCutLA_c1 const m;
static daAlinkHIO_hoCut_c1 const m;
};

class daAlinkHIO_hoCutLB_c1 {
public:
/* 0x00 */ daAlinkHIO_anm_c field_0x0;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ f32 field_0x18;
/* 0x1C */ f32 field_0x1C;
}; // Size: 0x20

class daAlinkHIO_hoCutLB_c0 {
public:
static daAlinkHIO_hoCutLB_c1 const m;
static daAlinkHIO_hoCut_c1 const m;
};

class daAlinkHIO_hoCutRA_c1 {
public:
/* 0x00 */ daAlinkHIO_anm_c field_0x0;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ f32 field_0x18;
/* 0x1C */ f32 field_0x1C;
}; // Size: 0x20

class daAlinkHIO_hoCutRA_c0 {
public:
static daAlinkHIO_hoCutRA_c1 const m;
static daAlinkHIO_hoCut_c1 const m;
};

class daAlinkHIO_hoCutRB_c1 {
public:
/* 0x00 */ daAlinkHIO_anm_c field_0x0;
/* 0x14 */ f32 field_0x14;
/* 0x18 */ f32 field_0x18;
/* 0x1C */ f32 field_0x1C;
}; // Size: 0x20

class daAlinkHIO_hoCutRB_c0 {
public:
static daAlinkHIO_hoCutRB_c1 const m;
static daAlinkHIO_hoCut_c1 const m;
};

class daAlinkHIO_hoCutCharge_c1 {
Expand Down
5 changes: 4 additions & 1 deletion include/d/actor/d_a_e_wb.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class e_wb_class : public fopEn_enemy_c {
f32 nowAnimeFrame() const { return field_0x5e0->getFrame(); }
s16 getWaitRollAngle() const { return mWaitRollAngle; }
bool checkGetOff() const { return speedF < 3.0f; }
f32 rideSpeedRate() const { return speedF / mSpeedRate; }
f32 getAnimeFrameRate() { return field_0x5e0->getFrame() / field_0x5e0->getEndFrame(); }
BOOL checkAnmLoopFrame() { return field_0x5e0->checkFrame(0.0f); }

J3DModel* getModel() {
if (field_0x5e0 != NULL) {
Expand Down Expand Up @@ -188,4 +191,4 @@ class daE_WB_HIO_c {
};


#endif /* D_A_E_WB_H */
#endif /* D_A_E_WB_H */
90 changes: 63 additions & 27 deletions include/d/actor/d_a_horse.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "d/d_bg_s_lin_chk.h"
#include "d/d_cc_d.h"
#include "d/d_msg_flow.h"
#include "m_Do/m_Do_audio.h"

class daHorseRein_c {
public:
Expand Down Expand Up @@ -47,31 +48,37 @@ class daHorse_c : public fopAc_ac_c {
public:
enum daHorse_ERFLG0 {
/* 0x001 */ ERFLG0_UNK_1 = 0x1,
/* 0x010 */ MOVE_ACCEPT = 0x10,
/* 0x080 */ RIDE_RUN_FLG = 0x80,
/* 0x100 */ CUT_TURN_CANCEL = 0x100,
/* 0x010 */ ERFLG0_MOVE_ACCEPT = 0x10,
/* 0x080 */ ERFLG0_RIDE_RUN_FLG = 0x80,
/* 0x100 */ ERFLG0_CUT_TURN_CANCEL = 0x100,

ERFLG0_UNK_18 = 0x18,
};

enum daHorse_RFLG0 {
/* 0x02 */ ENEMY_SEARCH = 2,
/* 0x08 */ LASH_DASH_START = 8,
/* 0x10 */ TURN_STAND = 0x10,
/* 0x40 */ TURN_STAND_CAMERA = 0x40,
/* 0x02 */ RFLG0_ENEMY_SEARCH = 2,
/* 0x08 */ RFLG0_LASH_DASH_START = 8,
/* 0x10 */ RFLG0_TURN_STAND = 0x10,
/* 0x40 */ RFLG0_TURN_STAND_CAMERA = 0x40,
};

enum daHorse_FLG0 {
/* 0x00000020 */ RODEO_LEFT = 0x20,
/* 0x00000040 */ RIDE_START_FLG = 0x40,
/* 0x00000080 */ NO_DRAW_WAIT = 0x80,
/* 0x00010000 */ PLAYER_BACK_RIDE_LASH = 0x10000,
/* 0x20000000 */ TURN_CANCEL_KEEP = 0x20000000,
/* 0x00000020 */ FLG0_RODEO_LEFT = 0x20,
/* 0x00000040 */ FLG0_RIDE_START_FLG = 0x40,
/* 0x00000080 */ FLG0_NO_DRAW_WAIT = 0x80,
/* 0x00010000 */ FLG0_PLAYER_BACK_RIDE_LASH = 0x10000,
/* 0x00400000 */ FLG0_UNK_400000 = 0x400000,
/* 0x20000000 */ FLG0_TURN_CANCEL_KEEP = 0x20000000,
/* 0x80000000 */ FLG0_RODEO_MODE = 0x80000000
};

fopAc_ac_c* getZeldaActor();
/* 807E27BC */ void cancelOriginalDemo();

void cancelOriginalDemo() {
field_0x16b8 = 2;
field_0x1740 = 1;
}

/* 807E27F8 */ void onDemoJumpDistance(f32, f32);
/* 807E28B8 */ void changeDemoPos0(cXyz const*);
/* 807E28E0 */ void setHorsePosAndAngle(cXyz const*, s16);
Expand Down Expand Up @@ -166,7 +173,7 @@ class daHorse_c : public fopAc_ac_c {
bool checkNoBombProc() const { return field_0x16b4 == 0 || field_0x16b4 == 1; }
bool checkResetStateFlg0(daHorse_RFLG0 flag) const { return mResetStateFlg0 & flag; }
bool checkEndResetStateFlg0(daHorse_ERFLG0 flag) const { return mEndResetStateFlg0 & flag; }
bool checkStateFlg0(daHorse_FLG0 flag) const { return mStateFlg0 & flag; }
u32 checkStateFlg0(daHorse_FLG0 flag) const { return mStateFlg0 & flag; }
f32 getNormalMaxSpeedF() { return mNormalMaxSpeedF; }
f32 getLashMaxSpeedF() { return mLashMaxSpeedF; }
void changeDemoMoveAngle(s16 angle) { mDemoMoveAngle = angle; }
Expand All @@ -179,7 +186,8 @@ class daHorse_c : public fopAc_ac_c {
void onStateFlg0(daHorse_FLG0 flag) { mStateFlg0 |= flag; }
void offStateFlg0(daHorse_FLG0 flag) { mStateFlg0 &= ~flag; }
void onEndResetStateFlg0(daHorse_ERFLG0 i_flag) { mEndResetStateFlg0 |= i_flag;}
void offNoDrawWait() { offStateFlg0(NO_DRAW_WAIT); }
void offEndResetStateFlg0(daHorse_ERFLG0 i_flag) { mEndResetStateFlg0 &= ~i_flag;}
void offNoDrawWait() { offStateFlg0(FLG0_NO_DRAW_WAIT); }
bool checkSpecialWallHit(const cXyz& param_0) { return (this->*mpCheckSpecialWallHitFn)(param_0); }
MtxP getSaddleMtx() { return field_0x570->getAnmMtx(21); }
MtxP getRootMtx() { return field_0x570->getAnmMtx(0); }
Expand All @@ -193,21 +201,23 @@ class daHorse_c : public fopAc_ac_c {

daHoZelda_c* i_getZeldaActor() { return (daHoZelda_c*)mZeldaActorKeep.getActor(); }

bool checkTurnStandCamera() const { return checkResetStateFlg0(TURN_STAND_CAMERA); }
bool checkTurnStand() const { return checkResetStateFlg0(TURN_STAND); }
bool checkRodeoMode() const { return checkStateFlg0(FLG0_RODEO_MODE); }
bool checkCutTurnCancel() const { return checkEndResetStateFlg0(CUT_TURN_CANCEL); }
bool checkTurnCancelKeep() const { return checkStateFlg0(TURN_CANCEL_KEEP); }
bool checkTurn() const { return field_0x16b4 == 3 && field_0x1720 == 0; }
bool checkStop() const { return field_0x16b4 == 2; }
bool checkTurnStandCamera() const { return checkResetStateFlg0(RFLG0_TURN_STAND_CAMERA); }
bool checkTurnStand() const { return checkResetStateFlg0(RFLG0_TURN_STAND); }
u32 checkRodeoMode() const { return checkStateFlg0(FLG0_RODEO_MODE); }
bool checkCutTurnCancel() const { return checkEndResetStateFlg0(ERFLG0_CUT_TURN_CANCEL); }
bool checkTurnCancelKeep() const { return checkStateFlg0(FLG0_TURN_CANCEL_KEEP); }
BOOL checkRodeoLeft() const { return checkStateFlg0(FLG0_RODEO_LEFT); }
BOOL checkTurn() const { return field_0x16b4 == 3 && field_0x1720 == 0; }
BOOL checkStop() const { return field_0x16b4 == 2; }
bool checkJump() const { return field_0x16b4 == 4; }
bool checkWait() const { return field_0x16b4 == 0; }
bool checkLand() const { return field_0x16b4 == 5 && field_0x171a == 0; }
bool checkGetOff() const { return fabsf(speedF) < 3.0f; }
bool checkEnemySearch() { return checkResetStateFlg0(ENEMY_SEARCH); }
bool checkEnemySearch() { return checkResetStateFlg0(RFLG0_ENEMY_SEARCH); }
bool checkOriginalDemo() const { return field_0x16b8 == 3; }
s16 checkCowHit() const { return mCowHit; }
s16 getCowHitAngle() const { return mCowHitAngle; }
u8 getRodeoPointCnt() const { return mRodeoPointCnt; }

void onTagJump(f32 param_0, f32 param_1, f32 param_2) {
field_0x1768 = param_0;
Expand All @@ -216,10 +226,20 @@ class daHorse_c : public fopAc_ac_c {
onEndResetStateFlg0(ERFLG0_UNK_1);
}

void onMoveAccept() { onEndResetStateFlg0(MOVE_ACCEPT); }
void onMoveAccept() { onEndResetStateFlg0(ERFLG0_MOVE_ACCEPT); }
void onPlayerLash() { onEndResetStateFlg0(ERFLG0_UNK_18); }
void offPlayerBackRideLash() { offStateFlg0(PLAYER_BACK_RIDE_LASH); }
void offPlayerBackRideLash() { offStateFlg0(FLG0_PLAYER_BACK_RIDE_LASH); }
void onRodeoMode() { onStateFlg0(FLG0_RODEO_MODE); }
void onRideStartFlg() { onStateFlg0(FLG0_RIDE_START_FLG); }
void onRideRunFlg() { onEndResetStateFlg0(ERFLG0_RIDE_RUN_FLG); }
void onPlayerBackRideLash() { onStateFlg0(FLG0_PLAYER_BACK_RIDE_LASH); }
void onCutTurnCancel() { onEndResetStateFlg0(ERFLG0_CUT_TURN_CANCEL); }
void offCutTurnCancel() { offEndResetStateFlg0(ERFLG0_CUT_TURN_CANCEL); }
void onTurnCancelKeep() { onStateFlg0(FLG0_TURN_CANCEL_KEEP); }
void offTurnCancelKeep() { offStateFlg0(FLG0_TURN_CANCEL_KEEP); }

BOOL checkTurnCancelFrame() const { return checkTurn() && field_0x177C < field_0x5b0[0].getFrame(); }
BOOL checkStopCancelFrame() const { return checkStop() && field_0x177C < field_0x5b0[0].getFrame(); }

void initHorseMtx() {
mDoMtx_stack_c::transS(current.pos);
Expand All @@ -228,9 +248,22 @@ class daHorse_c : public fopAc_ac_c {
field_0x570->calc();
}

void offRodeoMode() {
offStateFlg0(daHorse_FLG0(FLG0_RODEO_MODE | FLG0_UNK_400000));
field_0x16bc = 0;
mDoAud_subBgmStop();
}

void setSpeedF(f32 i_speed) { speedF = i_speed; }
void setWalkSpeedF() { speedF = field_0x1764; }

MtxP getLeftStirrupMtx() { return field_0x570->getAnmMtx(0x17); }
MtxP getRightStirrupMtx() { return field_0x570->getAnmMtx(0x19); }
void calcWeightEnvMtx() { field_0x570->calcWeightEnvelopeMtx(); }

void setReinPosNormal() { (this->*mpSetReinPosNormalFn)(); }
void setReinPosHand(int param_0) { (this->*mpSetReinPosHandFn)(param_0); }

static u8 const m_footJointTable[8];
static f32 const m_callLimitDistance2;

Expand Down Expand Up @@ -266,7 +299,8 @@ class daHorse_c : public fopAc_ac_c {
/* 0x16B8 */ u8 field_0x16b8;
/* 0x16B9 */ u8 field_0x16b9[2];
/* 0x16BB */ u8 mRodeoPointCnt;
/* 0x16BC */ u8 field_0x16bc[0x16C4 - 0x16BC];
/* 0x16BC */ u8 field_0x16bc;
/* 0x16BD */ u8 field_0x16bd[0x16C4 - 0x16BD];
/* 0x16C4 */ u16 mAnmIdx[3];
/* 0x16CA */ u8 field_0x16ca[0x16F2 - 0x16CA];
/* 0x16F2 */ s16 mAimNeckAngleY;
Expand Down Expand Up @@ -294,7 +328,9 @@ class daHorse_c : public fopAc_ac_c {
/* 0x1768 */ f32 field_0x1768;
/* 0x176C */ f32 field_0x176c;
/* 0x1770 */ f32 field_0x1770;
/* 0x1774 */ u8 field_0x1774[0x14];
/* 0x1774 */ u8 field_0x1774[0x177C - 0x1774];
/* 0x177C */ f32 field_0x177C;
/* 0x1780 */ u8 field_0x1780[0x1788 - 0x1780];
/* 0x1788 */ f32 mDemoStickR;
/* 0x178C */ f32 mNormalMaxSpeedF;
/* 0x1790 */ f32 mLashMaxSpeedF;
Expand Down
Loading

0 comments on commit 36519dd

Please sign in to comment.