Work on d_a_bk, c_damagereaction

This commit is contained in:
LagoLunatic
2025-03-12 22:30:10 -04:00
parent f5e7395ddd
commit a9e1527253
23 changed files with 654 additions and 271 deletions
+47 -34
View File
@@ -28,10 +28,23 @@
#include "weak_data_1811.h" // IWYU pragma: keep
enum Action {
ACTION_DOUSA = 0x0,
ACTION_MODORU_MOVE = 0x1,
ACTION_HANDOU_MOVE = 0x2,
ACTION_ITAI_MOVE = 0x3,
ACTION_DOUSA = 0,
ACTION_MODORU_MOVE = 1,
ACTION_HANDOU_MOVE = 2,
ACTION_ITAI_MOVE = 3,
};
enum State {
STATE_DOUSA_INIT = 0,
STATE_DOUSA_OKIRU = 2,
STATE_DOUSA_SLEEP_INIT = 9,
STATE_DOUSA_SLEEP_MAIN = 10,
STATE_MODORU_MOVE_INIT = 20,
STATE_MODORU_MOVE_MAIN = 21,
STATE_MODORU_MOVE_END = 22,
STATE_HANDOU_MOVE_INIT = 30,
STATE_HANDOU_MOVE_MAIN = 31,
STATE_ITAI_MOVE_INIT = 40,
};
/* 00000078-0000021C .text nodeCallBack__FP7J3DNodei */
@@ -182,7 +195,7 @@ static void body_atari_check(am_class* i_this) {
return;
}
i_this->mAction = ACTION_HANDOU_MOVE;
i_this->mState = 0x1E;
i_this->mState = STATE_HANDOU_MOVE_INIT;
i_this->mHugeKnockback = 0;
if (player->getCutType() == 0x11) {
// If the player hits the Armos Knight with the Skull Hammer's side swing, knock it back much farther than normal.
@@ -271,14 +284,14 @@ static BOOL medama_atari_check(am_class* i_this) {
i_this->mNeedleCyl.OnAtSPrmBit(cCcD_AtSPrm_Set_e);
i_this->mNeedleCyl.OnAtHitBit();
i_this->mAction = ACTION_DOUSA;
i_this->mState = 2;
i_this->mState = STATE_DOUSA_OKIRU;
} else {
dComIfGp_particle_set(dPa_name::ID_COMMON_0010, &i_this->mEyeballPos, &player->shape_angle);
// fopAcM_seStart(i_this, JA_SE_CM_AM_EYE_DAMAGE, 0);
mDoAud_seStart(JA_SE_CM_AM_EYE_DAMAGE, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this)));
fopAcM_monsSeStart(i_this, JA_SE_CV_AM_EYE_DAMAGE, 0x42);
i_this->mAction = ACTION_ITAI_MOVE;
i_this->mState = 0x28;
i_this->mState = STATE_ITAI_MOVE_INIT;
}
break;
default:
@@ -381,7 +394,7 @@ static BOOL bomb_nomi_check(am_class* i_this) {
bomb->setBombNoHit();
bomb_move_set(i_this, 0);
i_this->mAction = ACTION_ITAI_MOVE;
i_this->mState = 0x2C;
i_this->mState = 44;
return TRUE;
}
}
@@ -396,7 +409,7 @@ static BOOL bomb_nomi_check(am_class* i_this) {
bomb2->set_no_hit();
bomb_move_set(i_this, 0);
i_this->mAction = ACTION_ITAI_MOVE;
i_this->mState = 0x2C;
i_this->mState = 44;
return TRUE;
}
}
@@ -469,7 +482,7 @@ static void medama_move(am_class* i_this) {
static void action_dousa(am_class* i_this) {
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
switch (i_this->mState) {
case 0:
case STATE_DOUSA_INIT:
for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) {
i_this->mCountUpTimers[i] = 0;
}
@@ -493,11 +506,11 @@ static void action_dousa(am_class* i_this) {
i_this->attention_info.flags = fopAc_Attn_LOCKON_BATTLE_e;
i_this->mNeedleCyl.OnAtSetBit();
i_this->mNeedleCyl.OnAtHitBit();
i_this->mState += 1;
i_this->mState += 1; // STATE_DOUSA_OKIRU
}
}
break;
case 2:
case STATE_DOUSA_OKIRU:
if (!i_this->mpMorf->isStop()) {
break;
}
@@ -531,18 +544,18 @@ static void action_dousa(am_class* i_this) {
f32 xzDist = std::sqrtf(xDist*xDist + zDist*zDist);
if (xzDist > i_this->mAreaRadius) {
i_this->mAction = ACTION_MODORU_MOVE;
i_this->mState = 0x14;
i_this->mState = STATE_MODORU_MOVE_INIT;
return;
}
} else {
if (fopAcM_searchPlayerDistance(i_this) > 2000.0f) {
i_this->mState = 9;
i_this->mState = STATE_DOUSA_SLEEP_INIT;
break;
}
f32 yDist = player->current.pos.y - i_this->current.pos.y;
yDist = std::sqrtf(yDist*yDist); // ???
if (yDist > 300.0f) {
i_this->mState = 9;
i_this->mState = STATE_DOUSA_SLEEP_INIT;
break;
}
}
@@ -625,7 +638,7 @@ static void action_dousa(am_class* i_this) {
i_this->mState = 3;
}
break;
case 9:
case STATE_DOUSA_SLEEP_INIT:
anm_init(i_this, AM_BCK_SLEEP, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1);
fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_IN, 0);
i_this->mNeedleCyl.OffAtSetBit();
@@ -633,7 +646,7 @@ static void action_dousa(am_class* i_this) {
i_this->attention_info.flags = 0;
i_this->mState += 1;
break;
case 10:
case STATE_DOUSA_SLEEP_MAIN:
if (i_this->mpMorf->isStop()) {
i_this->mState = 0;
}
@@ -652,7 +665,7 @@ static void action_dousa(am_class* i_this) {
/* 00002564-000028C4 .text action_modoru_move__FP8am_class */
static void action_modoru_move(am_class* i_this) {
switch (i_this->mState) {
case 0x14: {
case STATE_MODORU_MOVE_INIT: {
anm_init(i_this, AM_BCK_CLOSE_LOOP, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1);
i_this->mNeedleCyl.OnAtSetBit();
i_this->mNeedleCyl.OnAtHitBit();
@@ -667,7 +680,7 @@ static void action_modoru_move(am_class* i_this) {
i_this->mState += 1;
break;
}
case 0x15: {
case STATE_MODORU_MOVE_MAIN: {
f32 xDistToSpawn = i_this->mSpawnPos.x - i_this->current.pos.x;
f32 zDistToSpawn = i_this->mSpawnPos.z - i_this->current.pos.z;
if (i_this->mAcch.ChkGroundHit()) {
@@ -696,14 +709,14 @@ static void action_modoru_move(am_class* i_this) {
}
break;
}
case 0x16: {
case STATE_MODORU_MOVE_END: {
s16 angleDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->mTargetAngleY);
if (angleDiff < 0x100) {
i_this->mNeedleCyl.OffAtSetBit();
i_this->mNeedleCyl.OffAtSetBit();
i_this->attention_info.flags = 0;
i_this->mAction = ACTION_DOUSA;
i_this->mState = 0;
i_this->mState = STATE_DOUSA_INIT;
}
break;
}
@@ -714,7 +727,7 @@ static void action_modoru_move(am_class* i_this) {
static void action_handou_move(am_class* i_this) {
daPy_py_c* player = daPy_getPlayerActorClass();
switch (i_this->mState) {
case 0x1E: {
case STATE_HANDOU_MOVE_INIT: {
i_this->speedF = 20.0f;
s16 angleToPlayer = fopAcM_searchPlayerAngleY(i_this);
i_this->current.angle.y = angleToPlayer + 0x8000;
@@ -733,7 +746,7 @@ static void action_handou_move(am_class* i_this) {
i_this->mState += 1;
// Fall-through
}
case 0x1F: {
case STATE_HANDOU_MOVE_MAIN: {
cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f);
if (i_this->speedF < 0.1f) {
i_this->speedF = 0.0f;
@@ -750,7 +763,7 @@ static void action_handou_move(am_class* i_this) {
/* 00002A6C-000034F4 .text action_itai_move__FP8am_class */
static void action_itai_move(am_class* i_this) {
switch (i_this->mState) {
case 0x28:
case STATE_ITAI_MOVE_INIT:
i_this->mEyeRot.setall(0);
i_this->mNeedleCyl.OffAtSetBit();
i_this->mNeedleCyl.OffAtSetBit();
@@ -761,7 +774,7 @@ static void action_itai_move(am_class* i_this) {
anm_init(i_this, AM_BCK_DAMAGE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1);
i_this->mState += 1;
// Fall-through
case 0x29:
case 41:
cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f);
if (!i_this->mpMorf->isStop()) {
break;
@@ -771,7 +784,7 @@ static void action_itai_move(am_class* i_this) {
anm_init(i_this, AM_BCK_DAMAGE_LOOP, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1);
i_this->mState += 1;
break;
case 0x2A:
case 42:
if (i_this->mCountDownTimers[0] != 0) {
break;
}
@@ -782,7 +795,7 @@ static void action_itai_move(am_class* i_this) {
mDoAud_seStart(JA_SE_CM_AM_MOUTH_CLOSE, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this)));
i_this->mState += 1;
break;
case 0x2B:
case 43:
if (!i_this->mpMorf->isStop()) {
break;
}
@@ -792,7 +805,7 @@ static void action_itai_move(am_class* i_this) {
i_this->mAction = ACTION_DOUSA;
i_this->mState = 3;
break;
case 0x2C:
case 44:
i_this->mSmokeCbs[3].end();
i_this->mStts.SetWeight(0xFF);
dComIfGp_particle_setToon(
@@ -808,7 +821,7 @@ static void action_itai_move(am_class* i_this) {
i_this->mCountDownTimers[1] = 10;
i_this->mState += 1;
// Fall-through
case 0x2D:
case 45:
bomb_move_set(i_this, 0);
if (i_this->mpMorf->checkFrame(3.0f)) {
// The fopAcM_seStart inline makes the codegen not match.
@@ -835,7 +848,7 @@ static void action_itai_move(am_class* i_this) {
i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this);
i_this->mState += 1;
break;
case 0x2E:
case 46:
bomb_move_set(i_this, 1);
i_this->shape_angle.y += 0x1000;
if (i_this->mAcch.ChkGroundHit()) {
@@ -878,7 +891,7 @@ static void action_itai_move(am_class* i_this) {
i_this->speedF = 0.0f;
i_this->mState += 1;
break;
case 0x2F:
case 47:
bomb_move_set(i_this, 1);
if (!i_this->mpMorf->isStop()) {
break;
@@ -917,7 +930,7 @@ static void action_itai_move(am_class* i_this) {
i_this->m0340->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2));
}
if (i_this->mState == 0x29 || i_this->mState == 0x2A) {
if (i_this->mState == 41 || i_this->mState == 42) {
bomb_nomi_check(i_this);
}
}
@@ -974,11 +987,11 @@ static BOOL daAM_Execute(am_class* i_this) {
i_this->speedF = 0.0f;
i_this->mAction = ACTION_ITAI_MOVE;
i_this->mState = 0x2F;
i_this->mState = 47;
}
cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 1, 0x500);
if (i_this->mState != 0x2E && i_this->mState != 0x2F && i_this->mState != 0x1F) {
if (i_this->mState != 46 && i_this->mState != 47 && i_this->mState != 31) {
cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 1, 0x500);
}