summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2024-02-29 16:28:38 -0500
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2024-02-29 16:28:38 -0500
commite47938b60dfd62c8060675ee441547becbbbb800 (patch)
treee29ed6a7b04e308f5e8d0d42cf3f095cde207bec
parent533cd90a5fc209043b0b3f766b867698c1973909 (diff)
d_a_bk work
-rw-r--r--include/c/c_damagereaction.h2
-rw-r--r--include/d/actor/d_a_bk.h28
-rw-r--r--include/d/actor/d_a_hitobj.h5
-rw-r--r--include/d/actor/d_a_obj_search.h4
-rw-r--r--include/f_op/f_op_actor.h38
-rw-r--r--src/c/c_damagereaction.cpp2
-rw-r--r--src/d/actor/d_a_am.cpp8
-rw-r--r--src/d/actor/d_a_bk.cpp438
-rw-r--r--src/d/actor/d_a_hitobj.cpp12
-rw-r--r--src/d/actor/d_a_npc_btsw2.cpp16
10 files changed, 473 insertions, 80 deletions
diff --git a/include/c/c_damagereaction.h b/include/c/c_damagereaction.h
index 5276619b..b6982dec 100644
--- a/include/c/c_damagereaction.h
+++ b/include/c/c_damagereaction.h
@@ -198,6 +198,6 @@ void hang_ang_get(damagereaction*);
void dr_damage_set(damagereaction*);
void dr_damage_anime(damagereaction*);
void dr_matrix_set(damagereaction*);
-void damage_reaction(damagereaction*);
+int damage_reaction(damagereaction*);
#endif /* C_DAMAGEREACTION_H */
diff --git a/include/d/actor/d_a_bk.h b/include/d/actor/d_a_bk.h
index 356f0c5d..e6b7ea51 100644
--- a/include/d/actor/d_a_bk.h
+++ b/include/d/actor/d_a_bk.h
@@ -7,6 +7,7 @@
#include "m_Do/m_Do_hostIO.h"
class dPath;
+namespace daObj_Search { class Act_c; };
class bk_class : public fopEn_enemy_c {
public:
@@ -38,14 +39,12 @@ public:
/* 0x02E0 */ u32 mShadowId;
/* 0x02E4 */ u8 m02E4[0x02E8 - 0x02E4];
/* 0x02E8 */ J3DModel* m02E8;
- /* 0x02EC */ u8 m02EC[0x02F8 - 0x02EC];
+ /* 0x02EC */ f32 m02EC;
+ /* 0x02F0 */ int m02F0;
+ /* 0x02F4 */ int m02F4;
/* 0x02F8 */ int m02F8;
/* 0x02FC */ int m02FC;
- /* 0x0300 */ s16 m0300;
- /* 0x0302 */ s16 m0302;
- /* 0x0304 */ s16 m0304;
- /* 0x0306 */ s16 m0306;
- /* 0x0308 */ s16 m0308;
+ /* 0x0300 */ s16 m0300[5];
/* 0x030A */ s16 m030A;
/* 0x030C */ s16 m030C;
/* 0x030E */ s16 m030E;
@@ -73,7 +72,11 @@ public:
/* 0x0B34 */ int m0B34;
/* 0x0B38 */ u8 m0B38[0x0B44 - 0x0B38];
/* 0x0B44 */ cXyz m0B44[2];
- /* 0x0B5C */ u8 m0B5C[0x0B88 - 0x0B5C];
+ /* 0x0B5C */ u8 m0B5C[0x0B78 - 0x0B5C];
+ /* 0x0B78 */ s16 m0B78;
+ /* 0x0B7A */ s8 m0B7A;
+ /* 0x0B7B */ s8 m0B7B;
+ /* 0x0B7C */ u8 m0B7C[0x0B88 - 0x0B7C];
/* 0x0B88 */ dCcD_Cyl m0B88;
/* 0x0CB8 */ dCcD_Cyl m0CB8;
/* 0x0DE8 */ dCcD_Sph m0DE8;
@@ -83,7 +86,9 @@ public:
/* 0x1178 */ cXyz m1178;
/* 0x1184 */ u8 m1184[0x11A8 - 0x1184];
/* 0x11A8 */ cXyz m11A8;
- /* 0x11B4 */ u8 m11B4[0x11F0 - 0x11B4];
+ /* 0x11B4 */ u8 m11B4[0x11CC - 0x11B4];
+ /* 0x11CC */ cXyz m11CC;
+ /* 0x11D8 */ u8 m11D8[0x11F0 - 0x11D8];
/* 0x11F0 */ u8 m11F0;
/* 0x11F1 */ u8 m11F1;
/* 0x11F2 */ u8 m11F2;
@@ -92,7 +97,7 @@ public:
/* 0x11F8 */ fopAc_ac_c* m11F8;
/* 0x11FC */ u32 m11FC;
/* 0x1200 */ u32 m1200;
- /* 0x1204 */ u8 m1204[0x1208 - 0x1204];
+ /* 0x1204 */ u32 m1204;
/* 0x1208 */ u16 m1208;
/* 0x120C */ int m120C;
/* 0x1210 */ u8 m1210;
@@ -102,11 +107,12 @@ public:
/* 0x1216 */ s8 m1216;
/* 0x1217 */ s8 m1217;
/* 0x1218 */ dPath* ppd;
- /* 0x121C */ u8 m121C;
+ /* 0x121C */ s8 m121C;
/* 0x121D */ u8 m121D;
/* 0x121E */ u8 m121E[0x121F - 0x121E];
/* 0x121F */ s8 m121F;
- /* 0x1220 */ u8 m1220[0x1230 - 0x1220];
+ /* 0x1220 */ daObj_Search::Act_c* m1220;
+ /* 0x1224 */ u8 m1224[0x1230 - 0x1224];
/* 0x1230 */ J3DMaterialTable* m1230;
/* 0x1234 */ u8 m1234[0x1264 - 0x1234];
/* 0x1264 */ enemyice mEnemyIce;
diff --git a/include/d/actor/d_a_hitobj.h b/include/d/actor/d_a_hitobj.h
index 4d16da6a..e8636c24 100644
--- a/include/d/actor/d_a_hitobj.h
+++ b/include/d/actor/d_a_hitobj.h
@@ -12,9 +12,8 @@
class hitobj_class : public fopAc_ac_c {
public:
/* 0x0290 */ request_of_phase_process_class mPhs;
- /* 0x0298 */ u8 m0298;
- /* 0x0299 */ u8 m0299;
- /* 0x029A */ s16 m029a;
+ /* 0x0298 */ u8 mUnusedParam;
+ /* 0x029A */ s16 mTimer;
/* 0x029C */ dCcD_Stts mStts;
/* 0x02D8 */ dCcD_Sph mSph;
}; // Size: 0x0404
diff --git a/include/d/actor/d_a_obj_search.h b/include/d/actor/d_a_obj_search.h
index 051bb5b0..13557849 100644
--- a/include/d/actor/d_a_obj_search.h
+++ b/include/d/actor/d_a_obj_search.h
@@ -13,7 +13,7 @@ namespace daObj_Search {
};
static bool getFindFlag() { return m_find_flag == true; }
- void setFindFlag(bool flag) { m_find_flag = flag; }
+ static void setFindFlag(bool flag) { m_find_flag = flag; }
static bool m_find_flag;
@@ -66,6 +66,8 @@ namespace daObj_Search {
public:
/* Place member variables here */
+ /* 0x290 */ u8 m290[0x664 - 0x290];
+ /* 0x664 */ u8 m664;
};
class Bgc_c {
diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h
index 1b1f64d3..df0ea36a 100644
--- a/include/f_op/f_op_actor.h
+++ b/include/f_op/f_op_actor.h
@@ -324,26 +324,30 @@ public:
f32 getBtBodyR() const { return mBtBodyR; }
void setBtBodyR(f32 radius) { mBtBodyR = radius; }
- // TODO
- void setBtAttackData(f32, f32, f32, u8) {}
- void getBtStartFrame() const {}
- void setBtStartFrame(f32) {}
- void getBtEndFrame() const {}
- void setBtEndFrame(f32) {}
- void getBtNowFrame() const {}
- void setBtNowFrame(f32) {}
- void getBtAttackType() const {}
- void setBtAttackType(u8) {}
- void getBtMaxDis() const {}
- void setBtMaxDis(f32) {}
+ void setBtAttackData(f32 startFrame, f32 endFrame, f32 maxDis, u8 attackType) {
+ setBtStartFrame(startFrame);
+ setBtEndFrame(endFrame);
+ setBtMaxDis(maxDis);
+ setBtAttackType(attackType);
+ }
+ f32 getBtStartFrame() const { return mBtStartFrame; }
+ void setBtStartFrame(f32 frame) { mBtStartFrame = frame; }
+ f32 getBtEndFrame() const { return mBtEndFrame; }
+ void setBtEndFrame(f32 frame) { mBtEndFrame = frame; }
+ f32 getBtNowFrame() const { return mBtNowFrame; }
+ void setBtNowFrame(f32 frame) { mBtNowFrame = frame; }
+ u8 getBtAttackType() const { return mBtAttackType; }
+ void setBtAttackType(u8 type) { mBtAttackType = type; }
+ f32 getBtMaxDis() const { return mBtMaxDis; }
+ void setBtMaxDis(f32 dis) { mBtMaxDis = dis; }
/* 0x290 */ f32 mBtHeight;
/* 0x294 */ f32 mBtBodyR;
- /* 0x298 */ f32 m298;
- /* 0x29C */ f32 m29C;
- /* 0x2A0 */ f32 m2A0;
- /* 0x2A4 */ f32 m2A4;
- /* 0x2A8 */ u8 mCurrParryOpeningType;
+ /* 0x298 */ f32 mBtMaxDis;
+ /* 0x29C */ f32 mBtStartFrame;
+ /* 0x2A0 */ f32 mBtEndFrame;
+ /* 0x2A4 */ f32 mBtNowFrame;
+ /* 0x2A8 */ u8 mBtAttackType; // Which type of parry opening to give the player
/* 0x2A9 */ u8 field_2A9[0x2AC - 0x2A9];
}; // Size: 0x2AC
diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp
index 094a7b1d..946f60c6 100644
--- a/src/c/c_damagereaction.cpp
+++ b/src/c/c_damagereaction.cpp
@@ -635,6 +635,6 @@ void dr_matrix_set(damagereaction* dr) {
}
/* 800225D0-800226C8 .text damage_reaction__FP14damagereaction */
-void damage_reaction(damagereaction* dr) {
+int damage_reaction(damagereaction* dr) {
/* Nonmatching */
}
diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp
index 258a59ef..fde36b5d 100644
--- a/src/d/actor/d_a_am.cpp
+++ b/src/d/actor/d_a_am.cpp
@@ -324,9 +324,11 @@ static BOOL medama_atari_check(am_class* i_this) {
break;
}
- // return ret; // Doesn't match, too few instructions
- // return ret ? TRUE : FALSE; // Doesn't match, optimized into arithmetic instead of a branch
- return ret ? (ret ? TRUE : TRUE) : FALSE; // Matches, tricking the compiler into using a branch
+ if (ret) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
}
/* 00000D14-00000F04 .text bomb_move_set__FP8am_classUc */
diff --git a/src/d/actor/d_a_bk.cpp b/src/d/actor/d_a_bk.cpp
index 6066e195..0a77f202 100644
--- a/src/d/actor/d_a_bk.cpp
+++ b/src/d/actor/d_a_bk.cpp
@@ -184,7 +184,7 @@ static void yari_off_check(bk_class* i_this) {
linChk.Set(&i_this->mEyePos, &boko->current.pos, i_this);
if (dComIfG_Bgsp()->LineCross(&linChk)) {
MtxP mtx = i_this->mpMorf->getModel()->getAnmMtx(0x10); // mune (chest) joint
- cMtx_copy(mtx, *calc_mtx);
+ MTXCopy(mtx, *calc_mtx);
boko->setMatrix(*calc_mtx);
cXyz offset;
offset.set(0.0f, 0.0f, 0.0f);
@@ -532,7 +532,7 @@ static void wait_set(bk_class* i_this) {
} else {
anm_init(i_this, BK_BCK_BK_KYORO2, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, BK_BAS_BK_KYORO2);
}
- i_this->m0302 = 40.0f + cM_rndF(60.0f);
+ i_this->m0300[1] = 40.0f + cM_rndF(60.0f);
}
/* 00003B2C-00003C34 .text walk_set__FP8bk_class */
@@ -644,7 +644,7 @@ static void jyunkai(bk_class* i_this) {
} else if (i_this->mType == 9) {
i_this->dr.mState = 3;
i_this->dr.m004 = 0;
- i_this->m0304 = 0;
+ i_this->m0300[2] = 0;
i_this->m120C = 0;
i_this->m1210 = 0;
path_check(i_this, 0);
@@ -684,9 +684,9 @@ static void jyunkai(bk_class* i_this) {
}
} else {
way_pos_check(i_this, &i_this->m0320);
- i_this->m0302 = 30.0f + cM_rndF(25.0f);
+ i_this->m0300[1] = 30.0f + cM_rndF(25.0f);
}
- i_this->m0304 = 30;
+ i_this->m0300[2] = 30;
// Fall-through
case 1:
s16 r29;
@@ -714,7 +714,7 @@ static void jyunkai(bk_class* i_this) {
}
} else if (sqrtf(sp10.x*sp10.x + sp10.z*sp10.z) < f31 * 0.25f * 2.0f ||
(
- i_this->m0304 == 0 && (
+ i_this->m0300[2] == 0 && (
i_this->dr.mAcch.ChkWallHit() ||
ground_4_check(i_this, 1, i_this->current.angle.y, 200.0f)
)
@@ -734,7 +734,7 @@ static void jyunkai(bk_class* i_this) {
fopAcM_monsSeStart(i_this, JA_SE_CV_BK_SEARCH, 0);
}
}
- if (i_this->m0302 == 0) {
+ if (i_this->m0300[1] == 0) {
i_this->dr.m004 = 0;
if (i_this->m0B30 == 0 && i_this->m11F3 == 0 && i_this->m030A == 0) {
i_this->m11F3 = 1;
@@ -747,7 +747,7 @@ static void jyunkai(bk_class* i_this) {
if (frame == 3 || frame == 0x35) {
fopAcM_monsSeStart(i_this, JA_SE_CV_BK_SEARCH, 0);
}
- if (i_this->m0302 == 0) {
+ if (i_this->m0300[1] == 0) {
i_this->dr.m004 = 0;
}
break;
@@ -764,7 +764,7 @@ static void jyunkai(bk_class* i_this) {
)
) {
i_this->dr.mState = 4;
- i_this->m0302 = 0;
+ i_this->m0300[1] = 0;
i_this->dr.m004 = 0;
}
} else if (i_this->m11F3 == 0 && i_this->dr.m004 == 2) {
@@ -863,7 +863,7 @@ static void fight_run(bk_class* i_this) {
switch (i_this->dr.m004) {
case 0x00:
- if (i_this->m0302 == 0) {
+ if (i_this->m0300[1] == 0) {
fight_run_set(i_this);
i_this->dr.m004 = 1;
i_this->m120C = 0;
@@ -889,7 +889,7 @@ static void fight_run(bk_class* i_this) {
}
if (i_this->m031C < l_bkHIO.m02C) {
i_this->dr.m004 = 2;
- i_this->m0308 = 50;
+ i_this->m0300[4] = 50;
}
break;
} else {
@@ -946,7 +946,7 @@ static void fight_run(bk_class* i_this) {
if (cM_rndF(1.0f) < 0.3f && i_this->m0B30 == 0) {
i_this->dr.m004 = 8;
wait_set(i_this);
- i_this->m0302 = 20.0f + cM_rndF(20.0f);
+ i_this->m0300[1] = 20.0f + cM_rndF(20.0f);
break;
}
if ((i_this->m02DD & 0xC) == 0 && fabsf(stickPosX) > 0.1f) {
@@ -975,7 +975,7 @@ static void fight_run(bk_class* i_this) {
}
i_this->dr.m004 = 3;
}
- i_this->m0302 = 20.0f + cM_rndF(20.0f);
+ i_this->m0300[1] = 20.0f + cM_rndF(20.0f);
break;
case 0x03:
cLib_addCalc2(&i_this->speedF, l_bkHIO.m060, 1.0f, 20.0f);
@@ -986,7 +986,7 @@ static void fight_run(bk_class* i_this) {
i_this->dr.m004 = 0x21;
break;
}
- if (i_this->m0302 == 0) {
+ if (i_this->m0300[1] == 0) {
i_this->dr.m004 = 2;
}
break;
@@ -1003,7 +1003,7 @@ static void fight_run(bk_class* i_this) {
} else if ((i_this->m02DD & 0x2) == 0) {
cLib_addCalc2(&i_this->speedF, -l_bkHIO.m060, 1.0f, 20.0f);
}
- if (i_this->m0302 == 0) {
+ if (i_this->m0300[1] == 0) {
i_this->dr.m004 = 2;
} else {
i_this->dr.m004 = 3;
@@ -1021,7 +1021,7 @@ static void fight_run(bk_class* i_this) {
i_this->m0334 = 0x4000;
goto temp_860;
} else {
- i_this->m0302 = 0;
+ i_this->m0300[1] = 0;
goto temp_860;
}
case 0x06:
@@ -1029,18 +1029,18 @@ static void fight_run(bk_class* i_this) {
i_this->m0334 = -0x4000;
goto temp_860;
} else {
- i_this->m0302 = 0;
+ i_this->m0300[1] = 0;
goto temp_860;
}
temp_860:
cLib_addCalc2(&i_this->speedF, l_bkHIO.m064, 1.0f, 30.0f);
- if (i_this->m0302 == 0) {
+ if (i_this->m0300[1] == 0) {
i_this->dr.m004 = 2;
}
break;
case 0x08:
i_this->speedF = 0.0f;
- if (i_this->m0302 == 0) {
+ if (i_this->m0300[1] == 0) {
i_this->dr.m004 = 2;
}
break;
@@ -1053,8 +1053,8 @@ static void fight_run(bk_class* i_this) {
path_check(i_this, 0);
}
if (i_this->m031C < l_bkHIO.m030 + 62.5f && i_this->m031C > l_bkHIO.m030 - 62.5f) {
- if (i_this->m0308 == 0) {
- i_this->m0308 = l_bkHIO.m078;
+ if (i_this->m0300[4] == 0) {
+ i_this->m0300[4] = l_bkHIO.m078;
if (cM_rndF(100.0f) < l_bkHIO.m07C) {
i_this->dr.mState = 5;
i_this->dr.m004 = 0;
@@ -1089,9 +1089,9 @@ static void fight_run(bk_class* i_this) {
i_this->dr.mState = 0xA;
i_this->dr.m004 = 0;
if (player->getCutType() == 0xA) {
- i_this->m0302 = 0x1E;
+ i_this->m0300[1] = 0x1E;
} else {
- i_this->m0302 = 0x0F;
+ i_this->m0300[1] = 0x0F;
}
} else {
i_this->m030E = 0xA;
@@ -1334,17 +1334,401 @@ static void demo_camera(bk_class* i_this) {
/* 0000CC68-0000CD00 .text tate_mtx_set__FP8bk_class */
static void tate_mtx_set(bk_class* i_this) {
- /* Nonmatching */
+ if (i_this->m02D4 != 0) {
+ int jointIdx = 0x25; // tate joint
+ MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(jointIdx), *calc_mtx);
+ i_this->m02D0->setBaseTRMtx(*calc_mtx);
+ cXyz sp08;
+ sp08.x = g_regHIO.mChild[8].mFloatRegs[12];
+ sp08.y = g_regHIO.mChild[8].mFloatRegs[13];
+ sp08.z = g_regHIO.mChild[8].mFloatRegs[14];
+ MtxPosition(&sp08, &i_this->m11CC);
+ }
}
/* 0000CD00-0000CE18 .text bou_mtx_set__FP8bk_class */
static void bou_mtx_set(bk_class* i_this) {
- /* Nonmatching */
+ if (i_this->m02DC != 0) {
+ int jointIdx = 0x2C + g_regHIO.mChild[7].mShortRegs[4]; // buki joint
+ MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(jointIdx), *calc_mtx);
+ s16 angleY = 0x4000 + g_regHIO.mChild[7].mShortRegs[0];
+ cMtx_YrotM(*calc_mtx, angleY);
+ s16 angleX = g_regHIO.mChild[7].mShortRegs[1];
+ cMtx_XrotM(*calc_mtx, angleX);
+ s16 angleZ = g_regHIO.mChild[7].mShortRegs[2];
+ cMtx_ZrotM(*calc_mtx, angleZ);
+ MtxTrans(
+ 0.01f * g_regHIO.mChild[7].mFloatRegs[9],
+ 0.01f * g_regHIO.mChild[7].mFloatRegs[10],
+ 0.01f * g_regHIO.mChild[7].mFloatRegs[11] + 50.0f,
+ 1
+ );
+ i_this->m02D8->setBaseTRMtx(*calc_mtx);
+ }
}
/* 0000CE18-0000DD1C .text daBk_Execute__FP8bk_class */
static BOOL daBk_Execute(bk_class* i_this) {
- /* Nonmatching */
+ another_hit = 0;
+
+ if (i_this->m1220 != NULL) {
+ i_this->m1220->m664 = 0;
+ }
+
+ if (i_this->m121C != 0 || i_this->home.pos.y - i_this->current.pos.y > 4000.0f) {
+ if (i_this->m0B30 != 0) {
+ fopAc_ac_c* temp = fopAcM_SearchByID(i_this->m1200);
+ if (temp != NULL) {
+ fopAcM_delete(temp);
+ }
+ }
+ fopAcM_delete(i_this);
+ return TRUE;
+ }
+
+ if (enemy_ice(&i_this->mEnemyIce)) {
+ i_this->mpMorf->setPlayMode(J3DFrameCtrl::LOOP_ONCE_e);
+ i_this->mpMorf->setPlaySpeed(3.0f);
+ i_this->mpMorf->play(&i_this->mEyePos, 0, 0);
+ i_this->mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get());
+ i_this->mpMorf->calc();
+ tate_mtx_set(i_this);
+ bou_mtx_set(i_this);
+ return TRUE;
+ }
+
+ g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->mTevStr);
+
+ if (i_this->mType == 8) {
+ for (int i = 0; i < ARRAY_SIZE(i_this->m0300); i++) {
+ if (i_this->m0300[i] != 0) {
+ i_this->m0300[i]--;
+ }
+ }
+ waki_set(i_this);
+ return TRUE;
+ }
+
+ if (l_bkHIO.m006 == 0 || CPad_CHECK_TRIG_B(0) || CPad_CHECK_HOLD_Y(0)) {
+ i_this->m02F8++;
+ for (int i = 0; i < ARRAY_SIZE(i_this->m0300); i++) {
+ if (i_this->m0300[i] != 0) {
+ i_this->m0300[i]--;
+ }
+ }
+ if (i_this->m0314 != 0) {
+ i_this->m0314--;
+ }
+ if (i_this->m0316 != 0) {
+ i_this->m0316--;
+ }
+ if (i_this->m030A != 0) {
+ i_this->m030A--;
+ }
+ if (i_this->m02CC != 0) {
+ i_this->m02CC--;
+ }
+ if (i_this->dr.m48A != 0) {
+ i_this->dr.m48A--;
+ }
+ if (i_this->m030E != 0) {
+ i_this->m030E--;
+ }
+ if (i_this->m0310 != 0) {
+ i_this->m0310--;
+ }
+ if (i_this->m0B78 != 0) {
+ i_this->m0B78--;
+ }
+
+ if (i_this->m02B7 != 0xFF && i_this->mType == 6 && dComIfGs_isSwitch(i_this->m02B7, dComIfGp_roomControl_getStayNo())) {
+ return TRUE;
+ }
+
+ if (i_this->m1214 != 0) {
+ daBoko_c* temp = (daBoko_c*)fopAcM_SearchByID(i_this->m1200);
+ if (temp != NULL) {
+ i_this->m1214 = 0;
+ i_this->m0B30 = 1;
+ fopAcM_setCarryNow(temp, FALSE);
+ MtxTrans(-10000.0f, -10000.0f, 0.0f, 0);
+ temp->setMatrix(*calc_mtx);
+ }
+ }
+
+ if (i_this->m02BA != 0x00) {
+ if (i_this->m02BA == 0xFF) {
+ f32 f30;
+ if (i_this->m02B5 != 0xFF) {
+ f30 = i_this->m02B5 * 10.0f;
+ } else {
+ f30 = 300.0f;
+ }
+
+ fopAc_ac_c* r23 = fopAcM_SearchByID(i_this->m1204);
+ if (i_this->m030E == 0 && (fopAcM_searchPlayerDistance(i_this) < f30 || r23 == NULL)) {
+ i_this->m02BA = 0;
+ if (r23 == NULL) {
+ i_this->m0300[0] = 50;
+ i_this->m0310 = 20;
+ if (fabsf(i_this->speedF) > 10.0f) {
+ another_hit = 1;
+ } else {
+ i_this->mScale.x = i_this->mScale.y = i_this->mScale.z = 0.5f;
+ }
+ }
+ i_this->m0B88.SetR(62.5f);
+ } else {
+ if (r23 != NULL) {
+ i_this->current.pos = r23->current.pos;
+ if (r23->speedF > 1.0f) {
+ i_this->speedF = r23->speedF;
+ i_this->shape_angle = r23->shape_angle;
+ i_this->current.angle = r23->shape_angle;
+ }
+ } else {
+ i_this->m0B88.SetC(i_this->current.pos);
+ i_this->m0B88.SetR(10.0f);
+ dComIfG_Ccsp()->Set(&i_this->m0B88);
+ cCcD_Obj* r3 = i_this->m0B88.GetCoHitObj();
+ if (r3 != NULL) {
+ fopAc_ac_c* temp = r3->GetAc();
+ if (temp != NULL) {
+ i_this->m1204 = fopAcM_GetID(temp);
+ }
+ }
+ }
+ return TRUE;
+ }
+ } else {
+ if (dComIfGs_isSwitch(i_this->m02BA - 1, fopAcM_GetRoomNo(i_this))) {
+ i_this->m02BA = 0;
+ } else {
+ return TRUE;
+ }
+ }
+ }
+
+ i_this->mAttentionInfo.mFlags = fopAc_Attn_LOCKON_ENEMY_e;
+ fopAcM_OnStatus(i_this, fopAcStts_SHOWMAP_e);
+ i_this->m02F0 = 0;
+ i_this->m02F4 = 0;
+ i_this->m0B7B = 0;
+
+ bk_eye_tex_anm(i_this);
+ i_this->dr.m438 = 0;
+ i_this->setBtAttackData(100.0f, 100.0f, 10000.0f, 0);
+ i_this->setBtNowFrame(0.0f);
+ damage_check(i_this);
+ Bk_move(i_this);
+ demo_camera(i_this);
+ ground_smoke_set(i_this);
+ if (i_this->m030C != 0) {
+ i_this->m030C--;
+ }
+ i_this->dr.mpEnemy = i_this;
+ i_this->dr.mEnemyType = 2;
+ }
+ if (i_this->dr.mState != 0x1F) {
+ i_this->shape_angle = i_this->current.angle;
+ }
+
+ int r3 = damage_reaction(&i_this->dr);
+ if (r3 != 0) {
+ i_this->m034C = 1;
+ i_this->m11FC = -1;
+ switch (r3) {
+ case 1:
+ anm_init(i_this, BK_BCK_BK_AOMUKE, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_AOMUKE);
+ if (i_this->m0B30 != 0) {
+ i_this->m0B34 = 1;
+ }
+ i_this->dr.mState = 0;
+ break;
+ case 2:
+ anm_init(i_this, BK_BCK_BK_UTUBUSE, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_UTUBUSE);
+ break;
+ case 5:
+ if (i_this->dr.mState != 4 && i_this->dr.mState != 0xB) {
+ wait_set(i_this);
+ i_this->dr.mState = 4;
+ i_this->dr.m004 = 0;
+ i_this->m0300[1] = 30;
+ }
+ i_this->m0336 = 5;
+ i_this->m0344.x = -0x4000;
+ break;
+ case 10:
+ wait_set(i_this);
+ i_this->dr.m004 = 2;
+ i_this->dr.mState = 0;
+ path_check(i_this, 0);
+ break;
+ case 20:
+ i_this->m0336 = 1;
+ i_this->m0344.x = -0x4000;
+ i_this->m034C = l_bkHIO.m00C + 0x10;
+ i_this->m034E = 1;
+ i_this->dr.m4C8[2] = l_bkHIO.m08C;
+ break;
+ case 21:
+ i_this->m0336 = 1;
+ i_this->m0344.x = 0;
+ i_this->dr.m4C8[2] = l_bkHIO.m08C;
+ break;
+ case 30:
+ anm_init(i_this, BK_BCK_BK_AOMUKE, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, BK_BAS_BK_AOMUKE);
+ if (i_this->m0B30 != 0) {
+ i_this->m0B34 = 1;
+ }
+ i_this->dr.mState = 0;
+ fopAcM_monsSeStart(i_this, JA_SE_CV_BK_FAINTED, 0);
+ break;
+ }
+ }
+
+ J3DModel* model = i_this->mpMorf->getModel();
+ model->setBaseScale(i_this->mScale);
+ model->setBaseTRMtx(*calc_mtx);
+ if (i_this->m030C == 0) {
+ i_this->mpMorf->play(&i_this->mEyePos, 0, 0);
+ }
+ i_this->mpMorf->calc();
+
+ enemy_fire(&i_this->mEnemyFire);
+
+ if (i_this->m0B30 != 0) {
+ daBoko_c* r29 = (daBoko_c*)fopAcM_SearchByID(i_this->m1200);
+ if (r29 != NULL) {
+ if (fopAcM_checkCarryNow(r29)) {
+ if (i_this->m0B7B == 0) {
+ int jointIdx = 0x2C; // buki joint
+ MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(jointIdx), *calc_mtx);
+ s16 angleY = 0x3E80 + g_regHIO.mChild[8].mShortRegs[1];
+ cMtx_YrotM(*calc_mtx, angleY);
+ s16 angleX = g_regHIO.mChild[8].mShortRegs[2];
+ cMtx_XrotM(*calc_mtx, angleX);
+ s16 angleZ = g_regHIO.mChild[8].mShortRegs[3];
+ cMtx_ZrotM(*calc_mtx, angleZ);
+ MtxTrans(
+ g_regHIO.mChild[8].mFloatRegs[9],
+ g_regHIO.mChild[8].mFloatRegs[10],
+ g_regHIO.mChild[8].mFloatRegs[11] + 65.0f,
+ 1
+ );
+ } else {
+ MtxTrans(
+ i_this->home.pos.x,
+ i_this->home.pos.y,
+ i_this->home.pos.z,
+ 0
+ );
+ cMtx_YrotM(*calc_mtx, i_this->shape_angle.y);
+ MtxTrans(
+ g_regHIO.mChild[6].mFloatRegs[7] - 40.0f,
+ g_regHIO.mChild[6].mFloatRegs[8] + 68.0f,
+ g_regHIO.mChild[6].mFloatRegs[9] + 82.0f,
+ 1
+ );
+ s16 angleX = 0x5B1B + g_regHIO.mChild[8].mShortRegs[5];
+ cMtx_XrotM(*calc_mtx, angleX);
+ }
+ r29->setMatrix(*calc_mtx);
+ cXyz sp64;
+ sp64.x = g_regHIO.mChild[8].mFloatRegs[12];
+ sp64.y = g_regHIO.mChild[8].mFloatRegs[13];
+ sp64.z = g_regHIO.mChild[8].mFloatRegs[14];
+ MtxPosition(&sp64, &i_this->m1178);
+ }
+ } else {
+ i_this->m0B30 = 0;
+ }
+ }
+
+ tate_mtx_set(i_this);
+ bou_mtx_set(i_this);
+ yari_off_check(i_this);
+ MtxTrans(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z, 0);
+ cMtx_YrotM(*calc_mtx, i_this->current.angle.y);
+ cXyz sp58(0.0f, 0.0f, 35.0f);
+ cXyz sp4C;
+ MtxPosition(&sp58, &sp4C);
+ i_this->m0B88.SetC(sp4C);
+ dComIfG_Ccsp()->Set(&i_this->m0B88);
+ // Using the inline breaks the match.
+ // dComIfG_Ccsp()->SetMass(&i_this->m0B88, 3);
+ dComIfG_Ccsp()->mMass_Mng.Set(&i_this->m0B88, 3);
+
+ cXyz sp40 = i_this->m116C;
+ cXyz sp34 = i_this->current.pos;
+ if (i_this->m030E != 0) {
+ sp40.y -= 20000.0f;
+ sp34.y -= 20000.0f;
+ }
+ if (i_this->dr.mState == 0xA) {
+ sp40.y -= 20000.0f;
+ sp34.y -= 100.0f;
+ }
+ i_this->m0CB8.SetC(sp34);
+ dComIfG_Ccsp()->Set(&i_this->m0CB8);
+ i_this->m0DE8.SetC(sp40);
+ dComIfG_Ccsp()->Set(&i_this->m0DE8);
+
+ if (i_this->m0336 != 0) {
+ i_this->m0336--;
+ if (i_this->m0336 == 0) {
+ i_this->m0344.y = i_this->current.angle.y;
+ dComIfGp_particle_set(0xE, &i_this->m116C, &i_this->m0344);
+ }
+ }
+
+ if (i_this->dr.mAcch.ChkGroundHit() || i_this->dr.mState == 0x13) {
+ dBgS_GndChk gndChk;
+ s16 r21 = 0x7FFF;
+ s16 r23 = 0x7FFF;
+ f32 f31 = i_this->dr.m480 != 0 ? 100.0f : 10.0f;
+ cXyz sp28 = i_this->current.pos;
+ sp28.y += 50.0f - i_this->dr.m44C.y;
+ gndChk.SetPos(&sp28);
+ sp28.y = dComIfG_Bgsp()->GroundCross(&gndChk);
+ if (sp28.y != -1e9f) {
+ Vec temp;
+ temp.x = sp28.x;
+ temp.y = 50.0f + sp28.y;
+ temp.z = sp28.z + f31;
+ gndChk.SetPos(&temp);
+ f32 f1 = dComIfG_Bgsp()->GroundCross(&gndChk);
+ if (f1 != -1e9f) {
+ r21 = (s16)-cM_atan2s(f1 - sp28.y, temp.z - sp28.z);
+ if (r21 > 0x2000 || r21 < -0x2000) {
+ r21 = 0;
+ }
+ }
+ temp.x = sp28.x + f31;
+ temp.y = 50.0f + sp28.y;
+ temp.z = sp28.z;
+ gndChk.SetPos(&temp);
+ f1 = dComIfG_Bgsp()->GroundCross(&gndChk);
+ if (f1 != -1e9f) {
+ r23 = (s16)cM_atan2s(f1 - sp28.y, temp.x - sp28.x);
+ if (r23 > 0x2000 || r23 < -0x2000) {
+ r23 = 0;
+ }
+ }
+ }
+ if (i_this->dr.mState == 0x13) {
+ r23 = 0;
+ r21 = 0;
+ }
+ if (r21 != 0x7FFF) {
+ cLib_addCalcAngleS2(&i_this->dr.m48C.x, r21, 1, 0x400);
+ }
+ if (r23 != 0x7FFF) {
+ cLib_addCalcAngleS2(&i_this->dr.m48C.z, r23, 1, 0x400);
+ }
+ }
+
+ return TRUE;
}
/* 0000DD1C-0000DD24 .text daBk_IsDelete__FP8bk_class */
@@ -1676,7 +2060,7 @@ static s32 daBk_Create(fopAc_ac_c* i_actor) {
} else {
i_this->dr.m004 = -1;
}
- i_this->m0302 = 1000.0f + cM_rndF(1000.0f);
+ i_this->m0300[1] = 1000.0f + cM_rndF(1000.0f);
} else if (i_this->mType == 6) {
i_this->dr.mState = 2;
i_this->dr.mMaxFallDistance = 300.0f;
diff --git a/src/d/actor/d_a_hitobj.cpp b/src/d/actor/d_a_hitobj.cpp
index 7394de45..ad75ef96 100644
--- a/src/d/actor/d_a_hitobj.cpp
+++ b/src/d/actor/d_a_hitobj.cpp
@@ -47,8 +47,8 @@ static BOOL daHitobj_Draw(hitobj_class* i_this) {
/* 00000080-000000E8 .text daHitobj_Execute__FP12hitobj_class */
static BOOL daHitobj_Execute(hitobj_class* i_this) {
- if (i_this->m029a != 0) {
- i_this->m029a--;
+ if (i_this->mTimer != 0) {
+ i_this->mTimer--;
i_this->mSph.SetC(i_this->current.pos);
@@ -67,7 +67,7 @@ static BOOL daHitobj_IsDelete(hitobj_class* i_this) {
/* 000000F0-00000120 .text daHitobj_Delete__FP12hitobj_class */
static BOOL daHitobj_Delete(hitobj_class* i_this) {
- dComIfG_resDelete(&(i_this->mPhs), "Hitobj");
+ dComIfG_resDelete(&i_this->mPhs, "Hitobj");
return TRUE;
}
@@ -78,15 +78,13 @@ static s32 daHitobj_Create(fopAc_ac_c* pActor) {
int res = dComIfG_resLoad(&(i_this->mPhs), "Hitobj");
if (res == cPhs_COMPLEATE_e) {
- i_this->m0298 = fopAcM_GetParam(i_this) & 0xFF;
+ i_this->mUnusedParam = fopAcM_GetParam(i_this) & 0xFF;
i_this->mStts.Init(0xFF, 0xFF, i_this);
-
i_this->mSph.Set(m_co_sph_src);
-
i_this->mSph.SetStts(&i_this->mStts);
- i_this->m029a = 3;
+ i_this->mTimer = 3;
}
return res;
}
diff --git a/src/d/actor/d_a_npc_btsw2.cpp b/src/d/actor/d_a_npc_btsw2.cpp
index c9145647..51f3e3ea 100644
--- a/src/d/actor/d_a_npc_btsw2.cpp
+++ b/src/d/actor/d_a_npc_btsw2.cpp
@@ -349,18 +349,16 @@ void daNpc_Btsw2_c::anmAtr(u16) {
/* 0000097C-000009EC .text getMsg__13daNpc_Btsw2_cFv */
u32 daNpc_Btsw2_c::getMsg() {
+ u32 ret;
if (!dComIfGs_isEventBit(0x3102)) {
dComIfGs_onEventBit(0x3102);
- return 0x1AB0;
- }
-
- // Fakematch? Need to force the compiler to use a branch here, but it optimizes an if statement away.
- switch (dKy_daynight_check()) {
- default:
- return 0x1AB2;
- case FALSE:
- return 0x1AB1;
+ ret = 0x1AB0;
+ } else if (dKy_daynight_check()) {
+ ret = 0x1AB2;
+ } else {
+ ret = 0x1AB1;
}
+ return ret;
}
/* 000009EC-000009F4 .text next_msgStatus__13daNpc_Btsw2_cFPUl */