diff --git a/configure.py b/configure.py index e93a53bd7..ef311b58a 100644 --- a/configure.py +++ b/configure.py @@ -1326,7 +1326,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_ykgr"), ActorRel(Matching, "d_a_alldie"), ActorRel(Matching, "d_a_am", extra_cflags=["-sym off"]), - ActorRel(NonMatching, "d_a_am2"), + ActorRel(Matching, "d_a_am2", extra_cflags=["-sym off"]), ActorRel(NonMatching, "d_a_amiprop"), ActorRel(NonMatching, "d_a_arrow_iceeff"), ActorRel(NonMatching, "d_a_arrow_lighteff"), diff --git a/include/d/d_particle.h b/include/d/d_particle.h index 738412454..59d7dc5ce 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -172,6 +172,8 @@ public: void execute(JPABaseEmitter*); void draw(JPABaseEmitter*); + void setRate(f32 rate) { mRate = rate; } + /* 0x04 */ JPABaseEmitter* mpBaseEmitter; /* 0x08 */ cXyz* mPos; /* 0x0C */ u32 mFlags; diff --git a/include/f_op/f_op_camera.h b/include/f_op/f_op_camera.h index bd49da529..c68d98fd4 100644 --- a/include/f_op/f_op_camera.h +++ b/include/f_op/f_op_camera.h @@ -271,4 +271,6 @@ struct camera_process_profile_definition { /* 0x3C */ leafdraw_method_class* mSubMtd; // Subclass methods }; +dCamera_c* dCam_getBody(); + #endif diff --git a/src/d/actor/d_a_agbsw0.cpp b/src/d/actor/d_a_agbsw0.cpp index 3ad3ed0fb..15e2acdaf 100644 --- a/src/d/actor/d_a_agbsw0.cpp +++ b/src/d/actor/d_a_agbsw0.cpp @@ -339,7 +339,7 @@ public: mCyl.SetStts(&mStts); if(behavior == 0x8) { if(0 < xRot) { - mTimer = xRot2 * 0x1E & 0xFFFF; + mTimer = xRot2 * 30 & 0xFFFF; } } else if(behavior == 0xA && xRot2 == 4) { @@ -1106,7 +1106,7 @@ BOOL daAgbsw0_c::ExeSubT() { return true; } - mTimer = 0x1E; + mTimer = 30; } else { g_dComIfG_gameInfo.play.mCcS.Set(&mCyl); diff --git a/src/d/actor/d_a_am.cpp b/src/d/actor/d_a_am.cpp index 0ea773e63..b8483da25 100644 --- a/src/d/actor/d_a_am.cpp +++ b/src/d/actor/d_a_am.cpp @@ -46,7 +46,7 @@ public: /* 0x02C7 */ bool mbIsBodyBeingHit; /* 0x02C8 */ s16 mCountDownTimers[4]; /* 0x02D0 */ s16 mCountUpTimers[5]; - /* 0x02DA */ s16 mDesiredRotY; + /* 0x02DA */ s16 mTargetAngleY; /* 0x02DC */ s16 mSpawnRotY; /* 0x02DE */ u8 m02DE[0x02E0 - 0x02DE]; /* 0x02E0 */ int mCurrBckIdx; @@ -60,7 +60,7 @@ public: /* 0x0318 */ cXyz mJawPos; /* 0x0324 */ cXyz mSpawnPos; /* 0x0330 */ csXyz mEyeRot; - /* 0x0336 */ csXyz mDesiredEyeRot; + /* 0x0336 */ csXyz mTargetEyeRot; /* 0x033C */ JPABaseEmitter* m033C; /* 0x0340 */ JPABaseEmitter* m0340; /* 0x0344 */ dPa_smokeEcallBack mSmokeCbs[4]; @@ -495,8 +495,8 @@ static BOOL bomb_nomi_check(am_class* i_this) { /* 00001138-000011E4 .text BG_check__FP8am_class */ static void BG_check(am_class* i_this) { - f32 halfHeight = g_regHIO.mChild[12].mFloatRegs[3] + 30.0f; - f32 radius = g_regHIO.mChild[12].mFloatRegs[4] + 150.0f; + f32 halfHeight = 30.0f + g_regHIO.mChild[12].mFloatRegs[3]; + f32 radius = 150.0f + g_regHIO.mChild[12].mFloatRegs[4]; i_this->mAcchCir.SetWall(halfHeight, radius); i_this->current.pos.y -= i_this->m02EC; @@ -532,22 +532,22 @@ static void medama_move(am_class* i_this) { f32 diffY = i_this->mEyePos.y - player->current.pos.y; f32 diffZ = i_this->current.pos.z - player->current.pos.z; - i_this->mDesiredEyeRot.y = cM_atan2s(diffX, diffZ); - if (i_this->mDesiredEyeRot.y < -0x71C) { - i_this->mDesiredEyeRot.y = -0x71C; - } else if (i_this->mDesiredEyeRot.y > 0x71C) { - i_this->mDesiredEyeRot.y = 0x71C; + i_this->mTargetEyeRot.y = cM_atan2s(diffX, diffZ); + if (i_this->mTargetEyeRot.y < -0x71C) { + i_this->mTargetEyeRot.y = -0x71C; + } else if (i_this->mTargetEyeRot.y > 0x71C) { + i_this->mTargetEyeRot.y = 0x71C; } - i_this->mDesiredEyeRot.x = cM_atan2s(diffY, sqrtf(diffX*diffX + diffZ*diffZ)); - if (i_this->mDesiredEyeRot.x < -0x38E) { - i_this->mDesiredEyeRot.x = -0x38E; - } else if (i_this->mDesiredEyeRot.x > 0x38E) { - i_this->mDesiredEyeRot.x = 0x38E; + i_this->mTargetEyeRot.x = cM_atan2s(diffY, sqrtf(diffX*diffX + diffZ*diffZ)); + if (i_this->mTargetEyeRot.x < -0x38E) { + i_this->mTargetEyeRot.x = -0x38E; + } else if (i_this->mTargetEyeRot.x > 0x38E) { + i_this->mTargetEyeRot.x = 0x38E; } - cLib_addCalcAngleS2(&i_this->mEyeRot.x, i_this->mDesiredEyeRot.x, 1, 0x500); - cLib_addCalcAngleS2(&i_this->mEyeRot.y, i_this->mDesiredEyeRot.y, 1, 0x500); + cLib_addCalcAngleS2(&i_this->mEyeRot.x, i_this->mTargetEyeRot.x, 1, 0x500); + cLib_addCalcAngleS2(&i_this->mEyeRot.y, i_this->mTargetEyeRot.y, 1, 0x500); } /* 00001B00-00002564 .text action_dousa__FP8am_class */ @@ -605,7 +605,7 @@ static void action_dousa(am_class* i_this) { anm_init(i_this, AM_BCK_CLOSE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->mCountDownTimers[2] = 6; } - i_this->mDesiredRotY = fopAcM_searchPlayerAngleY(i_this); + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this); i_this->mState += 1; // Fall-through case 4: @@ -637,7 +637,7 @@ static void action_dousa(am_class* i_this) { break; } } - s16 yRotDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->mDesiredRotY); + s16 yRotDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->mTargetAngleY); if (yRotDiff < 0x100) { i_this->mState += 1; } @@ -713,7 +713,7 @@ static void action_dousa(am_class* i_this) { i_this->mGravity = -6.0f; i_this->speed.y = 15.0f; fopAcM_seStart(i_this, JA_SE_CM_AM_JUMP_S, 0); - i_this->mDesiredRotY = fopAcM_searchPlayerAngleY(i_this); + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this); } if (i_this->mCountDownTimers[0] == 0) { i_this->mSmokeCbs[2].end(); @@ -763,7 +763,7 @@ static void action_modoru_move(am_class* i_this) { f32 xDistToSpawn = i_this->mSpawnPos.x - i_this->current.pos.x; f32 zDistToSpawn = i_this->mSpawnPos.z - i_this->current.pos.z; - i_this->mDesiredRotY = cM_atan2s(xDistToSpawn, zDistToSpawn); + i_this->mTargetAngleY = cM_atan2s(xDistToSpawn, zDistToSpawn); i_this->mState += 1; break; case 0x15: @@ -784,18 +784,18 @@ static void action_modoru_move(am_class* i_this) { i_this->speed.y = 40.0f; i_this->speedF = 15.0f; - i_this->mDesiredRotY = cM_atan2s(xDistToSpawn, zDistToSpawn); + i_this->mTargetAngleY = cM_atan2s(xDistToSpawn, zDistToSpawn); } f32 xzDist = sqrtf(xDistToSpawn*xDistToSpawn + zDistToSpawn*zDistToSpawn); if (xzDist < 20.0f) { - i_this->mDesiredRotY = i_this->mSpawnRotY; + i_this->mTargetAngleY = i_this->mSpawnRotY; i_this->speedF = 0.0f; i_this->mState += 1; } break; case 0x16: - s16 angleDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->mDesiredRotY); + s16 angleDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->mTargetAngleY); if (angleDiff < 0x100) { i_this->mNeedleCyl.OffAtSetBit(); i_this->mNeedleCyl.OffAtSetBit(); @@ -820,7 +820,7 @@ static void action_handou_move(am_class* i_this) { i_this->current.angle.y = player->shape_angle.y - 0x4000; i_this->speedF = 40.0f; } - i_this->mDesiredRotY = i_this->current.angle.y; + i_this->mTargetAngleY = i_this->current.angle.y; if (i_this->mCurrBckIdx != AM_BCK_CLOSE && i_this->mCurrBckIdx != AM_BCK_CLOSE_LOOP) { // Using the fopAcM_seStart inline multiple times makes the codegen not match. // fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_OUT, 0); @@ -851,7 +851,7 @@ static void action_itai_move(am_class* i_this) { i_this->mNeedleCyl.OffAtSetBit(); i_this->speedF = -20.0f; i_this->current.angle.y = fopAcM_searchPlayerAngleY(i_this); - i_this->mDesiredRotY = i_this->current.angle.y; + i_this->mTargetAngleY = i_this->current.angle.y; fopAcM_seStart(i_this, JA_SE_CM_AM_NEEDLE_IN, 0); anm_init(i_this, AM_BCK_DAMAGE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); i_this->mState += 1; @@ -943,7 +943,7 @@ static void action_itai_move(am_class* i_this) { break; } i_this->mCountDownTimers[0] = 100; - i_this->mDesiredRotY = fopAcM_searchPlayerAngleY(i_this); + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this); i_this->mState += 1; break; case 0x2E: @@ -978,7 +978,7 @@ static void action_itai_move(am_class* i_this) { // The fopAcM_seStart inline makes the codegen not match. // fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); mDoAud_seStart(JA_SE_CM_AM_BEF_EXPLODE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); - i_this->mDesiredRotY = i_this->current.angle.y; + i_this->mTargetAngleY = i_this->current.angle.y; if (i_this->m033C) { i_this->m033C->becomeInvalidEmitter(); @@ -1080,7 +1080,7 @@ static BOOL daAM_Execute(am_class* i_this) { fopAcM_seStart(i_this, JA_SE_CM_AM_BEF_EXPLODE, 0); - i_this->mDesiredRotY = i_this->current.angle.y; + i_this->mTargetAngleY = i_this->current.angle.y; if (i_this->m033C) { i_this->m033C->becomeInvalidEmitter(); @@ -1096,7 +1096,7 @@ static BOOL daAM_Execute(am_class* i_this) { i_this->mState = 0x2F; } - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mDesiredRotY, 1, 0x500); + 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) { cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 1, 0x500); } @@ -1427,7 +1427,7 @@ static s32 daAM_Create(fopAc_ac_c* i_actor) { i_this->mNeedleCyl.OffAtSetBit(); i_this->mNeedleCyl.OffAtSetBit(); - i_this->mDesiredRotY = i_this->current.angle.y; + i_this->mTargetAngleY = i_this->current.angle.y; i_this->mSpawnPos = i_this->current.pos; i_this->mSpawnRotY = i_this->current.angle.y; diff --git a/src/d/actor/d_a_am2.cpp b/src/d/actor/d_a_am2.cpp index 4f8f429dc..45504bfc4 100644 --- a/src/d/actor/d_a_am2.cpp +++ b/src/d/actor/d_a_am2.cpp @@ -3,446 +3,1589 @@ // Translation Unit: d_a_am2.cpp // -#include "d_a_am2.h" -#include "dolphin/types.h" +#include "f_op/f_op_actor_mng.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "d/d_procname.h" +#include "d/d_bg_s_lin_chk.h" +#include "d/d_s_play.h" +#include "d/d_com_inf_game.h" +#include "d/d_item_data.h" +#include "c/c_damagereaction.h" +#include "m_Do/m_Do_mtx.h" +#include "m_Do/m_Do_ext.h" +#include "d/d_snap.h" +#include "d/actor/d_a_player.h" +#include "d/d_jnt_hit.h" +#include "d/d_cc_uty.h" +#include "SSystem/SComponent/c_lib.h" +#include "f_op/f_op_camera_mng.h" +#include "f_op/f_op_kankyo_mng.h" + +// Needed for the .data section to match. +static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; +static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; +static u8 dummy3[4] = {0x02, 0x00, 0x02, 0x01}; +static f64 dummy4[2] = {3.0, 0.5}; + +class am2_class : public fopEn_enemy_c { +public: + /* 0x2AC */ request_of_phase_process_class mPhs; + /* 0x2B4 */ JntHit_c* mEyeJntHit; + /* 0x2B8 */ mDoExt_McaMorf* mpMorf; + /* 0x2BC */ u8 m2BC[0x2C0 - 0x2BC]; + /* 0x2C0 */ mDoExt_btkAnm* mpBtkAnm; + /* 0x2C4 */ mDoExt_brkAnm* mpBrkAnm; + /* 0x2C8 */ u8 mType; + /* 0x2C9 */ u8 mPrmAreaRadius; + /* 0x2CA */ u8 mStartsInactive; + /* 0x2CB */ u8 mSwitch; + /* 0x2CC */ u8 mAction; + /* 0x2CD */ u8 mState; + /* 0x2CE */ u8 m2CE; + /* 0x2CF */ bool mbIsWeakBeingHit; + /* 0x2D0 */ bool mbNotInHomeRoom; + /* 0x2D1 */ bool mbMadeWaterSplash; + /* 0x2D2 */ u8 mInAbyssTimer; + /* 0x2D3 */ u8 m2D3[0x2E0 - 0x2D3]; + /* 0x2E0 */ cXyz mEyeballPos; + /* 0x2EC */ cXyz mNeedlePos; + /* 0x2F8 */ cXyz mWeakPos; + /* 0x304 */ cXyz m304; + /* 0x310 */ cXyz mSpawnPos; + /* 0x31C */ cXyz mLinChkCenter; + /* 0x328 */ cXyz mLinChkDest; + /* 0x334 */ s16 mCountDownTimers[5]; + /* 0x33E */ s16 mCountUpTimers[4]; + /* 0x346 */ s16 mTargetAngleY; + /* 0x348 */ s16 mSpawnRotY; + /* 0x34A */ u8 m34A[0x34C - 0x34A]; + /* 0x34C */ int mCurrBckIdx; + /* 0x350 */ f32 mCorrectionOffsetY; + /* 0x354 */ f32 mAreaRadius; + /* 0x358 */ f32 mPickedUpYPos; + /* 0x35C */ f32 mAcchRadius; + /* 0x360 */ dBgS_AcchCir mAcchCir; + /* 0x3A0 */ dBgS_ObjAcch mAcch; + /* 0x564 */ dCcD_Stts mStts; + /* 0x5A0 */ dCcD_Cyl mBodyCyl; + /* 0x6D0 */ dCcD_Cyl mNeedleCyl; + /* 0x800 */ dCcD_Sph mEyeSph; + /* 0x92C */ dCcD_Sph mWeakSph; + /* 0xA58 */ dPa_smokeEcallBack mSmokeCb; + /* 0xA78 */ dPa_rippleEcallBack mRippleCb; + /* 0xA8C */ enemyice mEnemyIce; +}; + +enum Action { + ACTION_DOUSA = 0x0, + ACTION_MAHI = 0x1, + ACTION_ITAI = 0x2, + ACTION_HANDOU_MOVE = 0x3, + ACTION_MODORU_MOVE = 0x4, +}; + +enum AM2_RES_FILE_ID { // IDs and indexes are synced + /* BCK */ + AM2_BCK_BURUBURU=0x6, + AM2_BCK_DAMAGE=0x7, + AM2_BCK_DEAD1=0x8, + AM2_BCK_DEAD2=0x9, + AM2_BCK_DEAD3=0xA, + AM2_BCK_JUMP=0xB, + AM2_BCK_MAHI=0xC, + AM2_BCK_SLEEP=0xD, + AM2_BCK_START=0xE, + AM2_BCK_WAIT=0xF, + + /* BDLM */ + AM2_BDL_AM2=0x12, + + /* BRK */ + AM2_BRK_AM2=0x15, + + /* BTK */ + AM2_BTK_AM2=0x18, +}; /* 00000078-000001B0 .text nodeCallBack__FP7J3DNodei */ -void nodeCallBack(J3DNode*, int) { - /* Nonmatching */ +static BOOL nodeCallBack(J3DNode* node, int param_1) { + if (!param_1) { + J3DJoint* joint = (J3DJoint*)node; + s32 jntNo = joint->getJntNo(); + J3DModel* model = j3dSys.getModel(); + am2_class* i_this = (am2_class*)model->getUserArea(); + if (i_this) { + cMtx_copy(model->getAnmMtx(jntNo), *calc_mtx); + + cXyz offset; + switch (jntNo) { + case 1: // coa (core/weak spot) + offset.x = 0.0f; + offset.y = 50.0f; + offset.z = -40.0f; + MtxPosition(&offset, &i_this->mWeakPos); + break; + case 2: // eye + offset.x = 30.0f; + offset.y = 0.0f; + offset.z = 0.0f; + MtxPosition(&offset, &i_this->mEyeballPos); + break; + case 3: // toge (needles) + offset.x = -10.0f; + offset.y = 0.0f; + offset.z = 0.0f; + MtxPosition(&offset, &i_this->mNeedlePos); + break; + } + + model->setAnmMtx(jntNo, *calc_mtx); + cMtx_copy(*calc_mtx, J3DSys::mCurrentMtx); + } + } + return TRUE; } /* 000001B0-00000278 .text draw_SUB__FP9am2_class */ -void draw_SUB(am2_class*) { - /* Nonmatching */ +static void draw_SUB(am2_class* i_this) { + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseScale(i_this->mScale); + mDoMtx_stack_c::transS(i_this->current.pos); + cMtx_YrotM(mDoMtx_stack_c::get(), i_this->shape_angle.y); + cMtx_XrotM(mDoMtx_stack_c::get(), i_this->shape_angle.x); + cMtx_ZrotM(mDoMtx_stack_c::get(), i_this->shape_angle.z); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + + i_this->mpMorf->calc(); + + g_env_light.settingTevStruct(TEV_TYPE_ACTOR, &i_this->current.pos, &i_this->mTevStr); } /* 00000278-00000374 .text daAM2_Draw__FP9am2_class */ -void daAM2_Draw(am2_class*) { - /* Nonmatching */ +static BOOL daAM2_Draw(am2_class* i_this) { + J3DModel* model = i_this->mpMorf->getModel(); + g_env_light.setLightTevColorType(model, &i_this->mTevStr); + + dSnap_RegistFig(0xB6, i_this, 1.0f, 1.0f, 1.0f); + + i_this->mpBrkAnm->entry(model->getModelData()); + i_this->mpBtkAnm->entry(model->getModelData()); + + i_this->mpMorf->entryDL(); + + i_this->mpBrkAnm->remove(model->getModelData()); + i_this->mpBtkAnm->remove(model->getModelData()); + + if (!fopAcM_checkStatus(i_this, fopAcStts_CARRY_e)) { + dComIfGd_setSimpleShadow2( + &i_this->current.pos, i_this->mAcch.GetGroundH(), 50.0f, i_this->mAcch.m_gnd, + 0, 1.0f, dDlst_shadowControl_c::getSimpleTex() + ); + } + + return TRUE; } /* 00000374-000004A0 .text anm_init__FP9am2_classifUcfi */ -void anm_init(am2_class*, int, float, unsigned char, float, int) { - /* Nonmatching */ +static void anm_init(am2_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { + i_this->mCurrBckIdx = bckFileIdx; + if (soundFileIdx >= 0) { + void* soundAnm = dComIfG_getObjectRes("AM2", soundFileIdx); + J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("AM2", bckFileIdx); + i_this->mpMorf->setAnm(bckAnm, loopMode, morf, speed, 0.0f, -1.0f, soundAnm); + } else { + J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("AM2", bckFileIdx); + i_this->mpMorf->setAnm(bckAnm, loopMode, morf, speed, 0.0f, -1.0f, NULL); + } } /* 000004A0-00000818 .text medama_atari_check__FP9am2_class */ -void medama_atari_check(am2_class*) { - /* Nonmatching */ +static BOOL medama_atari_check(am2_class* i_this) { + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + bool ret = false; + + if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF && !dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { + return ret; + } + + i_this->mStts.Move(); + if (i_this->mEyeSph.ChkTgHit()) { + cCcD_Obj* hitObj = i_this->mEyeSph.GetTgHitObj(); + if (hitObj) { + CcAtInfo atInfo; + cXyz hitPos = *i_this->mEyeSph.GetTgHitPosP(); + + if (hitObj->GetAtType() & AT_TYPE_GRAPPLING_HOOK) { + if (i_this->mCurrBckIdx != AM2_BCK_SLEEP) { + if (i_this->mItemStealLeft > 0) { + s8 origHealth = i_this->mHealth; + i_this->mHealth = 10; + atInfo.mpObj = i_this->mEyeSph.GetTgHitObj(); + atInfo.pParticlePos = NULL; + cc_at_check(i_this, &atInfo); + i_this->mHealth = origHealth; + dComIfGp_particle_set(0x27B, &i_this->mAttentionInfo.mPosition); + } else { + dComIfGp_particle_set(0xC, &hitPos); + } + fopAcM_seStart(i_this, JA_SE_LK_MS_WEP_HIT, 0x42); + } + return TRUE; + } + + if (hitObj->GetAtType() & AT_TYPE_LIGHT_ARROW) { + ret = true; + i_this->mEnemyIce.mLightShrinkTimer = 1; + i_this->mEnemyIce.mParticleScale = 1.0f; + i_this->mEnemyIce.mYOffset = 80.0f; + i_this->mAttentionInfo.mFlags = 0; + return TRUE; + } + + if (hitObj->GetAtType() & (AT_TYPE_NORMAL_ARROW | AT_TYPE_FIRE_ARROW | AT_TYPE_ICE_ARROW)) { + ret = true; + if (i_this->mCurrBckIdx == AM2_BCK_SLEEP) { + anm_init(i_this, AM2_BCK_WAIT, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + i_this->mAttentionInfo.mFlags = 4; + fopAcM_OnStatus(i_this, fopAcStts_SHOWMAP_e); + i_this->mNeedleCyl.OnAtSetBit(); + i_this->mNeedleCyl.OnAtHitBit(); + i_this->mNeedleCyl.OnTgSetBit(); + i_this->mAction = ACTION_DOUSA; + i_this->mState = 2; + } else { + dComIfGp_particle_set(0x10, &hitPos, &player->shape_angle); + // Using the fopAcM_seStart breaks the codegen. + // fopAcM_seStart(i_this, JA_SE_CM_AM2_PARALYZED, 0); + mDoAud_seStart(JA_SE_CM_AM2_PARALYZED, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_monsSeStart(i_this, JA_SE_CV_AM2_PARALYZED, 0x42); + i_this->mAction = ACTION_MAHI; + i_this->mState = 10; + } + return TRUE; + } + } + } + + return FALSE; } /* 00000818-00000D30 .text week_atari_check__FP9am2_class */ -void week_atari_check(am2_class*) { - /* Nonmatching */ +static BOOL week_atari_check(am2_class* i_this) { + fopAc_ac_c* actor = i_this; // Fixes regswap + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + + s16 targetAngle = fopAcM_searchPlayerAngleY(actor); + s16 angleDelta = cLib_distanceAngleS(actor->shape_angle.y, targetAngle); + if (angleDelta < 0x4000) { + return FALSE; + } + + i_this->mStts.Move(); + i_this->m2CE = 0; + + if (i_this->mWeakSph.ChkTgHit()) { + if (!i_this->mbIsWeakBeingHit) { + cCcD_Obj* hitObj = i_this->mWeakSph.GetTgHitObj(); + i_this->mbIsWeakBeingHit = true; + if (!hitObj) { + return FALSE; + } + + u8 hitType = 0; + u32 atType = hitObj->GetAtType(); + if (atType & AT_TYPE_LIGHT_ARROW) { + i_this->mEnemyIce.mLightShrinkTimer = 1; + i_this->mEnemyIce.mParticleScale = 1.0f; + i_this->mEnemyIce.mYOffset = 80.0f; + actor->mAttentionInfo.mFlags = 0; + return TRUE; + } + + switch (atType) { + case AT_TYPE_SWORD: + case AT_TYPE_MACHETE: + case AT_TYPE_UNK800: + case AT_TYPE_DARKNUT_SWORD: + case AT_TYPE_MOBLIN_SPEAR: + fopAcM_seStart(actor, JA_SE_LK_SW_HIT_S, 0x35); + if (player->getCutType() == 0x06 || player->getCutType() == 0x07 || player->getCutType() == 0x08 || + player->getCutType() == 0x09 || player->getCutType() == 0x0A || player->getCutType() == 0x0C || + player->getCutType() == 0x0E || player->getCutType() == 0x0F || player->getCutType() == 0x10 || + player->getCutType() == 0x15 || player->getCutType() == 0x19 || player->getCutType() == 0x1A || + player->getCutType() == 0x1B || player->getCutType() == 0x1E || player->getCutType() == 0x1F) + { + hitType = 1; + i_this->m2CE = 1; + } + break; + case AT_TYPE_LEAF_WIND: + hitType = 2; + i_this->m2CE = 3; + break; + case AT_TYPE_BOOMERANG: + i_this->m2CE = 4; + return FALSE; + case AT_TYPE_BOKO_STICK: + case AT_TYPE_STALFOS_MACE: + case AT_TYPE_UNK2000: + fopAcM_seStart(actor, JA_SE_LK_W_WEP_HIT, 0x35); + break; + case AT_TYPE_SKULL_HAMMER: + fopAcM_seStart(actor, JA_SE_LK_HAMMER_HIT, 0x35); + hitType = 1; + i_this->m2CE = 7; + if (player->getCutType() == 0x11) { + i_this->m2CE = 8; + } + break; + case AT_TYPE_BOMB: + hitType = 1; + i_this->m2CE = 6; + break; + case AT_TYPE_NORMAL_ARROW: + case AT_TYPE_FIRE_ARROW: + case AT_TYPE_ICE_ARROW: + hitType = 1; + i_this->m2CE = 5; + // Fall-through + default: + fopAcM_seStart(actor, JA_SE_LK_MS_WEP_HIT, 0x35); + break; + } + + if (hitType != 2) { // Not hit by Deku Leaf wind + CcAtInfo atInfo; + cXyz hitPos = *i_this->mWeakSph.GetTgHitPosP(); + atInfo.mpObj = i_this->mWeakSph.GetTgHitObj(); + atInfo.pParticlePos = NULL; + cc_at_check(actor, &atInfo); + + if (hitType == 1) { + dComIfGp_particle_set(0x10, &hitPos); + cXyz particleScale(2.0f, 2.0f, 2.0f); + dComIfGp_particle_set(0xF, &hitPos, &player->shape_angle, &particleScale); + } else { + dComIfGp_particle_set(0xD, &hitPos, &player->shape_angle); + } + + i_this->mAction = ACTION_ITAI; + i_this->mState = 0x14; + if (i_this->m2CE == 7 || i_this->m2CE == 8) { + actor->mHealth = 0; + } + } + return TRUE; + } + } else { + i_this->mbIsWeakBeingHit = false; + } + + return FALSE; } /* 00000D30-00000F54 .text body_atari_check__FP9am2_class */ -void body_atari_check(am2_class*) { - /* Nonmatching */ +static BOOL body_atari_check(am2_class* i_this) { + // For VERSION_JPN, the redundant daPy_py_c* cast is required to fix a regswap. + // For the other versions, the cast has no effect (it doesn't create another regswap). + daPy_py_c* player = (daPy_py_c*)daPy_getPlayerActorClass(); + + i_this->mStts.Move(); + + i_this->m2CE = 0; + + if (i_this->mBodyCyl.ChkTgHit()) { + cCcD_Obj* hitObj = i_this->mBodyCyl.GetTgHitObj(); + if (!hitObj) { + return FALSE; + } + + switch (hitObj->GetAtType()) { + case AT_TYPE_SWORD: + fopAcM_seStart(i_this, JA_SE_LK_SW_HIT_S, 0x42); + break; + case AT_TYPE_BOOMERANG: + case AT_TYPE_BOKO_STICK: + fopAcM_seStart(i_this, JA_SE_LK_W_WEP_HIT, 0x42); + break; + case AT_TYPE_SKULL_HAMMER: + fopAcM_seStart(i_this, JA_SE_LK_HAMMER_HIT, 0x42); + if (i_this->mAction == ACTION_HANDOU_MOVE) { + break; + } + if (i_this->mAction == ACTION_ITAI) { + break; + } + i_this->mAction = ACTION_HANDOU_MOVE; + i_this->mState = 0x1E; + i_this->m2CE = 7; + if (player->getCutType() == 0x11) { + i_this->m2CE = 8; + } + break; + default: + fopAcM_seStart(i_this, JA_SE_LK_MS_WEP_HIT, 0x42); + break; + } + return TRUE; + } + + return FALSE; } /* 00000F54-00000FF4 .text BG_check__FP9am2_class */ -void BG_check(am2_class*) { - /* Nonmatching */ +static void BG_check(am2_class* i_this) { + f32 halfHeight = 40.0f + g_regHIO.mChild[8].mFloatRegs[12]; + i_this->mAcchCir.SetWall(halfHeight, i_this->mAcchRadius); + + i_this->current.pos.y -= i_this->mCorrectionOffsetY; + i_this->next.pos.y -= i_this->mCorrectionOffsetY; + i_this->mAcch.CrrPos(*dComIfG_Bgsp()); + i_this->current.pos.y += i_this->mCorrectionOffsetY; + i_this->next.pos.y += i_this->mCorrectionOffsetY; } /* 00000FF4-00001344 .text Line_check__FP9am2_class4cXyz */ -void Line_check(am2_class*, cXyz) { - /* Nonmatching */ -} - -/* 00001344-00001470 .text __dt__11dBgS_LinChkFv */ -dBgS_LinChk::~dBgS_LinChk() { - /* Nonmatching */ -} - -/* 00001470-00001510 .text __dt__8dBgS_ChkFv */ -dBgS_Chk::~dBgS_Chk() { - /* Nonmatching */ -} - -/* 00001510-0000156C .text __dt__15dBgS_GrpPassChkFv */ -dBgS_GrpPassChk::~dBgS_GrpPassChk() { - /* Nonmatching */ -} - -/* 0000156C-000015B4 .text __dt__15cBgS_GrpPassChkFv */ -cBgS_GrpPassChk::~cBgS_GrpPassChk() { - /* Nonmatching */ -} - -/* 000015B4-00001610 .text __dt__16dBgS_PolyPassChkFv */ -dBgS_PolyPassChk::~dBgS_PolyPassChk() { - /* Nonmatching */ -} - -/* 00001610-00001658 .text __dt__16cBgS_PolyPassChkFv */ -cBgS_PolyPassChk::~cBgS_PolyPassChk() { - /* Nonmatching */ -} - -/* 00001658-000016EC .text __dt__11cBgS_LinChkFv */ -cBgS_LinChk::~cBgS_LinChk() { - /* Nonmatching */ -} - -/* 000016EC-00001734 .text __dt__8cM3dGLinFv */ -cM3dGLin::~cM3dGLin() { - /* Nonmatching */ -} - -/* 00001734-0000177C .text __dt__13cBgS_PolyInfoFv */ -cBgS_PolyInfo::~cBgS_PolyInfo() { - /* Nonmatching */ +static BOOL Line_check(am2_class* i_this, cXyz destPos) { + fopAc_ac_c* actor = i_this; + dBgS_LinChk linChk; + cXyz centerPos = actor->current.pos; + centerPos.y += 100.0f + g_regHIO.mChild[12].mFloatRegs[19]; + i_this->mLinChkCenter = centerPos; + i_this->mLinChkDest = destPos; + linChk.Set(¢erPos, &destPos, actor); + if (!dComIfG_Bgsp()->LineCross(&linChk)) { + return TRUE; + } + return FALSE; } /* 0000177C-00001A24 .text naraku_check__FP9am2_class */ -void naraku_check(am2_class*) { - /* Nonmatching */ +static BOOL naraku_check(am2_class* i_this) { + // Checks if the Armos has fallen into an abyss. + if (i_this->mAcch.GetGroundH() != -1000000000.0f && + dComIfG_Bgsp()->ChkPolySafe(i_this->mAcch.m_gnd) && + dComIfG_Bgsp()->GetGroundCode(i_this->mAcch.m_gnd) == 4) // Abyss ground code + { + i_this->mInAbyssTimer++; + dComIfGp_getCamera(0)->mCamera.ForceLockOff(fopAcM_GetID(i_this)); + + if (i_this->current.pos.y < -500.0f || i_this->mInAbyssTimer > 50) { + i_this->speedF = 0.0f; + i_this->speed.setAll(0.0f); + i_this->mGravity = 0.0f; + return TRUE; + } + } + + if (i_this->mAcch.ChkWaterIn()) { + if (!i_this->mbMadeWaterSplash) { + cXyz waterPillarPos = i_this->current.pos; + if (i_this->mCountDownTimers[4] == 0) { + i_this->mCountDownTimers[4] = 1*30; + waterPillarPos.y = i_this->mAcch.m_wtr.GetHeight(); + f32 centerY = i_this->current.pos.y + 80.0f; + f32 scaleY = (0.1f + g_regHIO.mChild[8].mFloatRegs[1]) * (waterPillarPos.y - centerY); + if (scaleY < 0.0f) { + scaleY = 0.3f; + } else if (scaleY > 1.0f) { + scaleY = 1.0f; + } + fopKyM_createWpillar(&waterPillarPos, 1.0f, scaleY, 0); + fopAcM_seStart(i_this, JA_SE_OBJ_FALL_WATER_M, 0); + + i_this->mbMadeWaterSplash = true; + + cXyz particleScale(1.0f, 1.0f, 1.0f); + i_this->mRippleCb.end(); + dComIfGp_particle_setShipTail(0x33, &i_this->current.pos, NULL, &particleScale, 0xFF, &i_this->mRippleCb); + i_this->mRippleCb.setRate(0.0f); + } + } + + f32 waterSinkDepth = 80.0f + g_regHIO.mChild[12].mFloatRegs[0]; + if (i_this->current.pos.y < i_this->mAcch.m_wtr.GetHeight() - waterSinkDepth) { + i_this->speedF = 0.0f; + i_this->speed.setAll(0.0f); + i_this->mGravity = 0.0f; + return TRUE; + } + } else if (i_this->mbMadeWaterSplash) { + i_this->mbMadeWaterSplash = false; + i_this->mRippleCb.end(); + } + + return FALSE; } /* 00001A24-00002240 .text action_dousa__FP9am2_class */ -void action_dousa(am2_class*) { - /* Nonmatching */ +static void action_dousa(am2_class* i_this) { + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + + cXyz offset; + cXyz rotOffset; + if (i_this->mState == 4 || i_this->mState == 5) { + cMtx_YrotS(*calc_mtx, i_this->current.angle.y); + offset.set(0.0f, 0.0f, 200.0f); + MtxPosition(&offset, &rotOffset); + rotOffset += i_this->current.pos; + rotOffset.y += 100.0f + g_regHIO.mChild[12].mFloatRegs[19]; + } + + switch (i_this->mState) { + case 0: + for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { + i_this->mCountUpTimers[i] = 0; + } + i_this->mAcchRadius = 80.0f + g_regHIO.mChild[8].mFloatRegs[11]; + if (i_this->mCurrBckIdx != AM2_BCK_WAIT) { + anm_init(i_this, AM2_BCK_WAIT, 10.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + } + i_this->mState++; + // Fall-through + case 1: + f32 playerDist = fopAcM_searchPlayerDistance(i_this); + if (playerDist < i_this->mAreaRadius) { + cXyz centerPos = player->current.pos; + centerPos.y += 100.0f + g_regHIO.mChild[12].mFloatRegs[19]; + if (Line_check(i_this, centerPos)) { + i_this->mAttentionInfo.mFlags = fopAc_Attn_LOCKON_ENEMY_e; + fopAcM_OnStatus(i_this, fopAcStts_SHOWMAP_e); + anm_init(i_this, AM2_BCK_START, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + fopAcM_monsSeStart(i_this, JA_SE_CV_AM2_AWAKE, 0); + i_this->mEyeSph.OnTgSetBit(); + i_this->mWeakSph.OnTgSetBit(); + i_this->mState += 1; + } + } + break; + case 2: + if (i_this->mpMorf->checkFrame(24.0f)) { + fopAcM_seStart(i_this, JA_SE_CM_AM2_SPIKE_OUT, 0); + } + // Using the mDoExt_McaMorf::isStop inline causes regswap. + // if (!i_this->mpMorf->isStop()) { + mDoExt_McaMorf* morf = i_this->mpMorf; + bool stopped = true; + if (!morf->mFrameCtrl.checkState(1) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } + if (!stopped) { + break; + } + i_this->mState++; + // Fall-through + case 3: + for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { + i_this->mCountUpTimers[i] = 0; + } + i_this->speedF = 0.0f; + playerDist = fopAcM_searchPlayerDistance(i_this); + f32 radiusAdjust = 200.0f; + if (playerDist > i_this->mAreaRadius + radiusAdjust) { + i_this->mState = 6; + } else { + i_this->mNeedleCyl.OnAtSetBit(); + i_this->mNeedleCyl.OnAtHitBit(); + i_this->mNeedleCyl.OnTgSetBit(); + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this); + i_this->mGravity = -3.0f; + i_this->speed.y = 12.0f; + if (i_this->mCurrBckIdx != AM2_BCK_JUMP) { + anm_init(i_this, AM2_BCK_JUMP, 2.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); + } + i_this->mState++; + } + break; + case 4: + if (i_this->mAcch.ChkGroundHit()) { + i_this->mGravity = -3.0f; + i_this->speed.y = 12.0f; + fopAcM_seStart(i_this, JA_SE_CM_AM2_LANDING, 0); + i_this->mState = 3; + s16 angleDiff = cLib_distanceAngleS(i_this->shape_angle.y, i_this->current.angle.y); + if (angleDiff < 0x1000) { + if (Line_check(i_this, rotOffset) || player->getDamageWaitTimer() == 0) { + i_this->mState = 5; + } + } + } + break; + case 5: + if (i_this->speedF > 0.0f && i_this->mNeedleCyl.ChkAtShieldHit()) { + i_this->speedF = 9.0f; + i_this->speedF *= -1.0f; + i_this->speed.y = 0.0f; + } + if (i_this->mAcch.ChkGroundHit()) { + fopAcM_seStart(i_this, JA_SE_CM_AM2_LANDING, 0); + i_this->mSmokeCb.end(); + // Using the fopAcM_seStart inline multiple times in a single case makes the codegen not match. + // fopAcM_seStart(i_this, JA_SE_CM_AM_JUMP_S, 0); + mDoAud_seStart(JA_SE_CM_AM_JUMP_S, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + + dComIfGp_particle_setToon(0xA125, &i_this->current.pos, &i_this->shape_angle, NULL, 0xB9, &i_this->mSmokeCb, fopAcM_GetRoomNo(i_this)); + if (i_this->mSmokeCb.getEmitter()) { + i_this->mSmokeCb.getEmitter()->setRate(12.0f); + JGeometry::TVec3 scale; + scale.set(0.45f, 0.45f, 0.45f); + i_this->mSmokeCb.getEmitter()->setGlobalScale(scale); + } + + if (i_this->mCountUpTimers[0] > 8) { + i_this->mState = 3; + } else { + i_this->speedF = 9.0f; + i_this->mGravity = -8.0f; + i_this->speed.y = 20.0f; + i_this->mCountUpTimers[1] = 0; + if (!Line_check(i_this, rotOffset) || player->getDamageWaitTimer() != 0) { + i_this->speedF = 0.0f; + } + i_this->mCountUpTimers[0]++; + } + } + break; + case 6: + anm_init(i_this, AM2_BCK_SLEEP, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + fopAcM_seStart(i_this, JA_SE_CM_AM2_SPIKE_IN, 0); + i_this->mWeakSph.OffTgSetBit(); + i_this->mWeakSph.ClrTgHit(); + i_this->mState++; + // Fall-through + case 7: + // Using the mDoExt_McaMorf::isStop inline causes regswap. + // if (!i_this->mpMorf->isStop()) { + morf = i_this->mpMorf; + stopped = true; + if (!morf->mFrameCtrl.checkState(1) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } + if (stopped) { + for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { + i_this->mCountUpTimers[i] = 0; + } + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffTgSetBit(); + i_this->mNeedleCyl.ClrTgHit(); + i_this->m304 = i_this->current.pos; + i_this->mAction = ACTION_DOUSA; + i_this->mState = 1; + } + break; + } + + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 1, 0x500); + cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 1, 0x500); + + if (naraku_check(i_this)) { + if (i_this->mbNotInHomeRoom) { + // If it fell into an abyss when it's not in its original room, just delete it, don't try to respawn. + // Note: You cannot actually carry Armos through doors in the final game, so this may just be a sanity check. + fopAcM_delete(i_this); + } else { + i_this->mAction = ACTION_MODORU_MOVE; + i_this->mState = 0x28; + } + } else if (!medama_atari_check(i_this)) { + if (i_this->mState < 3 || !week_atari_check(i_this)) { + body_atari_check(i_this); + } + } } /* 00002240-00002B08 .text action_mahi__FP9am2_class */ -void action_mahi(am2_class*) { - /* Nonmatching */ +static void action_mahi(am2_class* i_this) { + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + fopAc_ac_c* actor = i_this; // Fixes regswaps + + switch (i_this->mState) { + case 0xA: + for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { + i_this->mCountUpTimers[i] = 0; + } + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffTgSetBit(); + i_this->mNeedleCyl.ClrTgHit(); + + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(actor) + 0x8000; + actor->current.angle.y = fopAcM_searchPlayerAngleY(actor) + 0x8000; + i_this->mCountDownTimers[2] = 0; + i_this->mCountDownTimers[3] = 0; + actor->speedF = 20.0f; + + fopAcM_seStart(actor, JA_SE_CM_AM2_SPIKE_IN, 0); + anm_init(i_this, AM2_BCK_DAMAGE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + + i_this->mState++; + break; + case 0xB: + cLib_addCalc0(&actor->speedF, 0.5f, 1.0f); + if (actor->speedF < 0.2f) { + // Using the mDoExt_McaMorf::isStop inline causes regswap. + // if (!i_this->mpMorf->isStop()) { + mDoExt_McaMorf* morf = i_this->mpMorf; + bool stopped = true; + if (!morf->mFrameCtrl.checkState(1) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } + if (stopped) { + actor->speedF = 0.0f; + i_this->mCountDownTimers[2] = 20*30; + anm_init(i_this, AM2_BCK_MAHI, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); + i_this->mState++; + } + } + break; + case 0xC: + if (i_this->mCountDownTimers[3] == 0 || i_this->mCountDownTimers[3] > 3) { + actor->mAttentionInfo.mFlags |= fopAc_Attn_ACTION_CARRY_e; + } + if (naraku_check(i_this)) { + if (i_this->mbNotInHomeRoom) { + fopAcM_delete(actor); + } else { + i_this->mAction = ACTION_MODORU_MOVE; + i_this->mState = 0x28; + } + } else { + if (i_this->mCountUpTimers[1] != 0 && i_this->mAcch.ChkGroundHit()) { + fopAcM_seStart(actor, JA_SE_CM_AM2_JUMP, 0); + i_this->mCountUpTimers[1] = 0; + } + if (fopAcM_checkStatus(actor, fopAcStts_CARRY_e)) { + i_this->mAcchRadius = 40.0f + g_regHIO.mChild[8].mFloatRegs[10]; + i_this->mbMadeWaterSplash = false; + i_this->mRippleCb.end(); + i_this->mPickedUpYPos = actor->current.pos.y; + fopAcM_OffStatus(actor, fopAcStts_SHOWMAP_e); + actor->current.angle.y = player->shape_angle.y; + actor->mGravity = 0.0f; + actor->speed.setAll(0.0f); + actor->speedF = 0.0f; + i_this->mbNotInHomeRoom = false; + i_this->mBodyCyl.OffCoSetBit(); + i_this->mState++; + } + } + break; + case 0xD: + actor->current.angle.y = player->shape_angle.y; + if (actor->orig.roomNo != actor->current.roomNo) { + i_this->mbNotInHomeRoom = true; + } + if (i_this->mPickedUpYPos + 10.0f <= actor->current.pos.y) { + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 1, 0x1000); + } + if (!fopAcM_checkStatus(actor, fopAcStts_CARRY_e)) { + i_this->mAcchRadius = 40.0f + g_regHIO.mChild[8].mFloatRegs[10]; + i_this->mBodyCyl.OnCoSetBit(); + if (actor->speedF > 0.0f) { + actor->mGravity = -5.0f; + actor->speed.y = 25.0f; + actor->speedF = 35.0f; + i_this->mAcch.OnLineCheck(); + i_this->mState = 0xE; + } else { + actor->mGravity = -3.0f; + i_this->mCountUpTimers[1] = 1; + i_this->mState = 0xC; + } + } + break; + case 0xE: + if (i_this->mAcch.ChkWallHit()) { + actor->speedF = 0.0f; + } + if (naraku_check(i_this)) { + if (i_this->mbNotInHomeRoom) { + fopAcM_delete(actor); + } else { + i_this->mAcch.OffLineCheck(); + i_this->mAction = ACTION_MODORU_MOVE; + i_this->mState = 0x28; + } + } else { + if (i_this->mAcch.ChkGroundHit()) { + dComIfGp_getVibration().StartShock(1, -0x21, cXyz(0.0f, 1.0f, 0.0f)); + dComIfGp_getCamera(0)->mCamera.ForceLockOff(fopAcM_GetID(actor)); + + i_this->mAcch.OffLineCheck(); + i_this->mbMadeWaterSplash = false; + i_this->mRippleCb.end(); + + if (i_this->mCountUpTimers[0] == 0) { + i_this->mSmokeCb.end(); + fopAcM_seStart(actor, JA_SE_CM_AM2_LANDING, 0); + + dComIfGp_particle_setToon(0xA125, &actor->current.pos, &actor->shape_angle, NULL, 0xB9, &i_this->mSmokeCb, fopAcM_GetRoomNo(actor)); + if (i_this->mSmokeCb.getEmitter()) { + i_this->mSmokeCb.getEmitter()->setRate(12.0f); + JGeometry::TVec3 scale; + scale.set(0.8f, 0.8f, 0.8f); + i_this->mSmokeCb.getEmitter()->setGlobalScale(scale); + } + + actor->speedF = 7.0f; + actor->speed.y = 25.0f; + actor->mGravity = -14.0f; + i_this->mCountUpTimers[0]++; + } else { + actor->speedF = 0.0f; + i_this->mCountUpTimers[0] = 0; + i_this->mState = 0xC; + } + } + + cLib_addCalc0(&actor->speedF, 0.5f, 1.0f); + } + break; + case 0xF: + if (naraku_check(i_this)) { + if (i_this->mbNotInHomeRoom) { + fopAcM_delete(actor); + } else { + i_this->mAction = ACTION_MODORU_MOVE; + i_this->mState = 0x28; + return; + } + } + + actor->shape_angle.y += 0x1000; + if (i_this->mAcch.ChkGroundHit()) { + actor->mGravity = -3.0f; + actor->mAttentionInfo.mFlags = fopAc_Attn_LOCKON_ENEMY_e; + fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e); + i_this->mAction = ACTION_DOUSA; + i_this->mState = 3; + } + break; + } + + i_this->mTargetAngleY = actor->current.angle.y; + + if (i_this->mState >= 0xC && i_this->mState != 0xF) { + if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF) { + if (!dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { + i_this->mCountDownTimers[2] = 20*30; + body_atari_check(i_this); + return; + } + + i_this->mSwitch = 0xFF; + i_this->mAction = ACTION_DOUSA; + i_this->mState = 0; + + if (fopAcM_checkStatus(actor, fopAcStts_CARRY_e)) { + fopAcM_cancelCarryNow(actor); + actor->mAttentionInfo.mFlags &= ~fopAc_Attn_ACTION_CARRY_e; + actor->mGravity = -4.0f; + actor->speed.y = 20.0f; + } + + return; + } + + if (i_this->mCountDownTimers[2] == 0) { + if (i_this->mCurrBckIdx != AM2_BCK_BURUBURU) { + anm_init(i_this, AM2_BCK_BURUBURU, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); + i_this->mCountDownTimers[3] = 20*30; + actor->mAttentionInfo.mFlags &= ~fopAc_Attn_ACTION_CARRY_e; + // Using the fopAcM_seStart inline multiple times makes the codegen not match. + // fopAcM_seStart(i_this, JA_SE_CM_AM2_RECOVER, 0); + mDoAud_seStart(JA_SE_CM_AM2_RECOVER, &actor->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); + fopAcM_monsSeStart(actor, JA_SE_CV_AM2_AWAKE, 0); + } + + if (i_this->mCountDownTimers[3] == 1) { + if (fopAcM_checkStatus(actor, fopAcStts_CARRY_e)) { + fopAcM_cancelCarryNow(actor); + actor->mAttentionInfo.mFlags &= ~fopAc_Attn_ACTION_CARRY_e; + } + fopAcM_OnStatus(actor, fopAcStts_SHOWMAP_e); + actor->mGravity = -4.0f; + actor->speed.y = 20.0f; + i_this->mBodyCyl.OnCoSetBit(); + i_this->mState = 0xF; + } + } + } + + if (fopAcM_checkStatus(actor, fopAcStts_CARRY_e) || i_this->mState == 0xF || !week_atari_check(i_this)) { + body_atari_check(i_this); + } } /* 00002B08-000032AC .text action_itai__FP9am2_class */ -void action_itai(am2_class*) { - /* Nonmatching */ +static void action_itai(am2_class* i_this) { + switch (i_this->mState) { + case 0x14: + for (int i = 0; i < ARRAY_SIZE(i_this->mCountUpTimers); i++) { + i_this->mCountUpTimers[i] = 0; + } + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffTgSetBit(); + i_this->mNeedleCyl.ClrTgHit(); + + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this) + 0x8000; + i_this->current.angle.y = fopAcM_searchPlayerAngleY(i_this) + 0x8000; + i_this->speedF = 20.0f; + + fopAcM_monsSeStart(i_this, JA_SE_CV_AM2_DAMAGE, 0x42); + dComIfGp_particle_set(0x81AE, &i_this->mWeakPos, &i_this->shape_angle); + + if (i_this->mHealth > 0) { + anm_init(i_this, AM2_BCK_DAMAGE, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + if (i_this->mCountDownTimers[2] > 5) { + i_this->speedF = 5.0f; + } + i_this->mState++; + } else { + i_this->mState = 0x16; + } + break; + case 0x15: + cLib_addCalc0(&i_this->speedF, 0.5f, 1.0f); + if (i_this->speedF < 0.2f) { + i_this->speedF = 0.0f; + i_this->mGravity = -3.0f; + if (i_this->mCountDownTimers[2] < 5) { + i_this->mAction = ACTION_DOUSA; + i_this->mState = 3; + } else { + anm_init(i_this, AM2_BCK_MAHI, 1.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, -1); + i_this->mAction = ACTION_MAHI; + i_this->mState = 0xC; + } + } + break; + case 0x16: + i_this->mEyeSph.OffTgSetBit(); + i_this->mWeakSph.OffTgSetBit(); + i_this->mEyeSph.ClrTgHit(); + i_this->mWeakSph.ClrTgHit(); + anm_init(i_this, AM2_BCK_DEAD1, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + i_this->mState++; + break; + case 0x17: + // Using the mDoExt_McaMorf::isStop inline causes regswap. + // if (!i_this->mpMorf->isStop()) { + mDoExt_McaMorf* morf = i_this->mpMorf; + bool stopped = true; + if (!morf->mFrameCtrl.checkState(1) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } + if (!stopped) { + break; + } + i_this->mNeedleCyl.OnAtSetBit(); + i_this->mNeedleCyl.OnAtHitBit(); + i_this->speed.y = 25.0f; + i_this->mGravity = -10.0f; + i_this->speedF = 10.0f; + i_this->mCountDownTimers[0] = 100; + i_this->current.angle.y = fopAcM_searchPlayerAngleY(i_this); + anm_init(i_this, AM2_BCK_DEAD2, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + i_this->mState++; + // Fall-through + case 0x18: + if (i_this->speed.y > 0.0f && i_this->mCountUpTimers[1] == 0) { + fopAcM_monsSeStart(i_this, JA_SE_CV_AM2_JUMP, 0x42); + i_this->mCountUpTimers[1] = 1; + } + + i_this->shape_angle.y += 0x1000; + + if (i_this->mAcch.ChkGroundHit()) { + i_this->mSmokeCb.end(); + dComIfGp_particle_setToon(0xA125, &i_this->current.pos, &i_this->shape_angle, NULL, 0xB9, &i_this->mSmokeCb, fopAcM_GetRoomNo(i_this)); + if (i_this->mSmokeCb.getEmitter()) { + i_this->mSmokeCb.getEmitter()->setRate(12.0f); + JGeometry::TVec3 scale; + scale.set(0.45f, 0.45f, 0.45f); + i_this->mSmokeCb.getEmitter()->setGlobalScale(scale); + } + + // Using the fopAcM_seStart inline multiple times in a single case makes the codegen not match. + // fopAcM_seStart(i_this, JA_SE_CM_AM2_JUMP2, 0); + mDoAud_seStart(JA_SE_CM_AM2_JUMP2, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_monsSeStart(i_this, JA_SE_CV_AM_JITABATA, 0x42); + + i_this->speed.y = 25.0f; + i_this->mGravity = -10.0f; + i_this->speedF = 10.0f; + } + + if (i_this->mCountDownTimers[0] == 0) { + anm_init(i_this, AM2_BCK_DEAD3, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + fopAcM_seStart(i_this, JA_SE_CM_AM2_BEF_EXPLODE, 0); + + i_this->speedF = 0.0f; + + i_this->mState++; + } + break; + case 0x19: + // Using the mDoExt_McaMorf::isStop inline causes regswap. + // if (!i_this->mpMorf->isStop()) { + morf = i_this->mpMorf; + stopped = true; + if (!morf->mFrameCtrl.checkState(1) && morf->mFrameCtrl.getRate() != 0.0f) { stopped = false; } + if (!stopped) { + break; + } + + cXyz centerPos = i_this->current.pos; + centerPos.y += 50.0f; + dComIfGp_particle_set(0x81AF, &i_this->current.pos, &i_this->shape_angle); + dComIfGp_particle_set(0x81B0, &i_this->current.pos, &i_this->shape_angle); + mDoAud_seStart(JA_SE_CM_AM2_EXPLODE, &i_this->mEyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_createDisappear(i_this, ¢erPos, 5, 0, 0xFF); + fopAcM_onActor(i_this); + fopAcM_delete(i_this); + break; + } + + if (naraku_check(i_this)) { + if (i_this->mbNotInHomeRoom || i_this->mHealth <= 0) { + if (i_this->mState != 0x19) { + anm_init(i_this, AM2_BCK_DEAD3, 1.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + fopAcM_seStart(i_this, JA_SE_CM_AM2_BEF_EXPLODE, 0); + i_this->speedF = 0.0f; + i_this->mState = 0x19; + } + } else { + i_this->mAction = ACTION_MODORU_MOVE; + i_this->mState = 0x28; + } + } } /* 000032AC-000034A4 .text action_handou_move__FP9am2_class */ -void action_handou_move(am2_class*) { - /* Nonmatching */ +static void action_handou_move(am2_class* i_this) { + daPy_py_c* player = daPy_getPlayerActorClass(); + switch (i_this->mState) { + case 0x1E: + i_this->speedF = 40.0f; + s16 angleToPlayer = fopAcM_searchPlayerAngleY(i_this); + i_this->current.angle.y = angleToPlayer + 0x8000; + if (i_this->m2CE == 8) { + i_this->current.angle.y = player->shape_angle.y - 0x4000; + i_this->speedF = 40.0f; + } + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffTgSetBit(); + i_this->mNeedleCyl.ClrTgHit(); + i_this->mTargetAngleY = i_this->current.angle.y; + i_this->mState++; + case 0x1F: + fopAcM_seStart(i_this, JA_SE_CM_AM2_SLIP, 0); + cLib_addCalc0(&i_this->speedF, 0.8f, 2.0f); + if (i_this->speedF < 0.1f) { + i_this->speedF = 0.0f; + i_this->current.angle.y = i_this->shape_angle.y; + i_this->mAction = ACTION_DOUSA; + i_this->mState = 3; + if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF && !dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { + i_this->mAttentionInfo.mFlags = 0; + i_this->mCountDownTimers[2] = 20*30; + i_this->mAction = ACTION_MAHI; + i_this->mState = 0xC; + } + } + } + + if (naraku_check(i_this)) { + if (i_this->mbNotInHomeRoom) { + fopAcM_delete(i_this); + } else { + i_this->mAction = ACTION_MODORU_MOVE; + i_this->mState = 0x28; + } + } } /* 000034A4-0000379C .text action_modoru_move__FP9am2_class */ -void action_modoru_move(am2_class*) { - /* Nonmatching */ +static void action_modoru_move(am2_class* i_this) { + // Respawns the Armos back at its spawn point after it falls into an abyss. + switch (i_this->mState) { + case 0x28: + dCam_getBody()->ForceLockOff(fopAcM_GetID(i_this)); + i_this->mInAbyssTimer = 0; + i_this->mbMadeWaterSplash = false; + i_this->mRippleCb.end(); + anm_init(i_this, AM2_BCK_WAIT, 10.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, -1); + fopAcM_seStart(i_this, JA_SE_CM_AM2_WTR_RECOVER, 0); + i_this->mState++; + // Fall-through + case 0x29: + cLib_addCalc0(&i_this->mScale.x, 1.0f, 0.1f); + i_this->mScale.y = i_this->mScale.z = i_this->mScale.x; + + if (i_this->mScale.x < 0.1f) { + i_this->speedF = 0.0f; + i_this->speed.setAll(0.0f); + i_this->mGravity = -3.0f; + i_this->mbMadeWaterSplash = false; + i_this->mRippleCb.end(); + + i_this->current.angle.y = i_this->shape_angle.y; + i_this->current.pos = i_this->mSpawnPos; + i_this->mScale.setAll(0.0f); + i_this->shape_angle.y = i_this->mSpawnRotY; + i_this->current.angle.y = i_this->shape_angle.y; + i_this->current.pos = i_this->mSpawnPos; + i_this->mTargetAngleY = i_this->current.angle.y; + + i_this->mState++; + } + break; + case 0x2A: + i_this->shape_angle.y = i_this->mSpawnRotY; + i_this->current.angle.y = i_this->shape_angle.y; + i_this->current.pos = i_this->mSpawnPos; + i_this->mTargetAngleY = i_this->current.angle.y; + + cLib_addCalc2(&i_this->mScale.x, 1.0f, 1.0f, 0.1f); + i_this->mScale.y = i_this->mScale.z = i_this->mScale.x; + + if (i_this->mScale.x > 0.9f) { + i_this->mCountUpTimers[1] = 0; + i_this->mScale.setAll(1.0f); + i_this->mWeakSph.OffTgSetBit(); + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffCoSetBit(); + i_this->mNeedleCyl.OffTgSetBit(); + i_this->mWeakSph.ClrTgHit(); + i_this->mNeedleCyl.ClrTgHit(); + i_this->mAction = ACTION_DOUSA; + i_this->mState = 0; + + if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF && !dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { + i_this->mAttentionInfo.mFlags = 0; + i_this->mCountDownTimers[2] = 20*30; + i_this->mAction = ACTION_MAHI; + i_this->mState = 0xC; + } + } + break; + } } /* 0000379C-00003AB8 .text daAM2_Execute__FP9am2_class */ -void daAM2_Execute(am2_class*) { - /* Nonmatching */ +static BOOL daAM2_Execute(am2_class* i_this) { + fopAc_ac_c* actor = i_this; // Fixes regswaps + + for (int i = 0; i < ARRAY_SIZE(i_this->mCountDownTimers); i++) { + if (i_this->mCountDownTimers[i] != 0) { + i_this->mCountDownTimers[i]--; + } + } + + fopAcM_setGbaName(i_this, BOW, 0xB, 0x29); + + if (enemy_ice(&i_this->mEnemyIce)) { + i_this->mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpMorf->calc(); + return TRUE; + } + + fopAcM_OnStatus(actor, fopAcStts_FREEZE_e); + + switch (i_this->mAction) { + case ACTION_DOUSA: + action_dousa(i_this); + break; + case ACTION_MAHI: + action_mahi(i_this); + break; + case ACTION_ITAI: + action_itai(i_this); + break; + case ACTION_HANDOU_MOVE: + action_handou_move(i_this); + break; + case ACTION_MODORU_MOVE: + action_modoru_move(i_this); + break; + } + + i_this->mpMorf->play(NULL, 0, 0); + + i_this->mpBtkAnm->play(); + i_this->mpBrkAnm->play(); + + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + cXyz offset; + offset.x = 0.0f; + offset.y = 0.0f; + offset.z = actor->speedF; + cXyz rotOffset; + MtxPosition(&offset, &rotOffset); + actor->speed.x = rotOffset.x; + actor->speed.z = rotOffset.z; + actor->speed.y += actor->mGravity; + if (actor->speed.y < -50.0f) { + actor->speed.y = -50.0f; + } + + actor->mAttentionInfo.mPosition = actor->current.pos; + actor->mAttentionInfo.mPosition.y += 120.0f; + actor->mEyePos = i_this->mEyeballPos; + actor->mEyePos.y -= 15.0f + g_regHIO.mChild[8].mFloatRegs[2]; + + i_this->mBodyCyl.SetC(i_this->current.pos); + i_this->mBodyCyl.SetH(150.0f); + i_this->mBodyCyl.SetR(35.0f); + dComIfG_Ccsp()->Set(&i_this->mBodyCyl); + + i_this->mNeedleCyl.SetC(i_this->mNeedlePos); + i_this->mNeedleCyl.SetH(20.0f); + i_this->mNeedleCyl.SetR(55.0f + g_regHIO.mChild[8].mFloatRegs[3]); + dComIfG_Ccsp()->Set(&i_this->mNeedleCyl); + + i_this->mEyeSph.SetC(i_this->mEyeballPos); + i_this->mEyeSph.SetR(30.0f); + dComIfG_Ccsp()->Set(&i_this->mEyeSph); + + i_this->mWeakSph.SetC(i_this->mWeakPos); + i_this->mWeakSph.SetR(30.0f); + dComIfG_Ccsp()->Set(&i_this->mWeakSph); + + if (i_this->mBodyCyl.ChkCoSet()) { + fopAcM_posMove(actor, i_this->mStts.GetCCMoveP()); + } else { + fopAcM_posMove(actor, NULL); + } + + if (i_this->mAction != ACTION_MODORU_MOVE) { + BG_check(i_this); + } + + draw_SUB(i_this); + + return TRUE; } /* 00003AB8-00003AC0 .text daAM2_IsDelete__FP9am2_class */ -void daAM2_IsDelete(am2_class*) { - /* Nonmatching */ +static BOOL daAM2_IsDelete(am2_class* i_this) { + return TRUE; } /* 00003AC0-00003B18 .text daAM2_Delete__FP9am2_class */ -void daAM2_Delete(am2_class*) { - /* Nonmatching */ +static BOOL daAM2_Delete(am2_class* i_this) { + dComIfG_resDelete(&i_this->mPhs, "AM2"); + + i_this->mSmokeCb.end(); + i_this->mRippleCb.end(); + + return TRUE; } /* 00003B18-00003E28 .text useHeapInit__FP10fopAc_ac_c */ -void useHeapInit(fopAc_ac_c*) { - /* Nonmatching */ -} +static BOOL useHeapInit(fopAc_ac_c* i_actor) { + am2_class* i_this = (am2_class*)i_actor; -/* 00003E28-00003E70 .text __dt__14mDoExt_baseAnmFv */ -mDoExt_baseAnm::~mDoExt_baseAnm() { - /* Nonmatching */ + i_this->mpMorf = new mDoExt_McaMorf( + (J3DModelData*)dComIfG_getObjectRes("AM2", AM2_BDL_AM2), + NULL, NULL, + (J3DAnmTransformKey*)dComIfG_getObjectRes("AM2", AM2_BCK_WAIT), + J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, 1, + NULL, + 0x00000000, + 0x11020203 + ); + if (!i_this->mpMorf || !i_this->mpMorf->getModel()) { + return FALSE; + } + J3DModel* model = i_this->mpMorf->getModel(); + + i_this->mpBtkAnm = new mDoExt_btkAnm(); + if (!i_this->mpBtkAnm) { return FALSE; } + J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("AM2", AM2_BTK_AM2); + int ret = i_this->mpBtkAnm->init(model->getModelData(), pbtk, TRUE, 2, 1.0, 0, -1, false, 0); + if (!ret) { return FALSE; } + if (!i_this->mpBtkAnm) { return FALSE; } + + i_this->mpBrkAnm = new mDoExt_brkAnm(); + if (!i_this->mpBrkAnm) { return FALSE; } + J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes("AM2", AM2_BRK_AM2); + ret = i_this->mpBrkAnm->init(model->getModelData(), pbrk, TRUE, 2, 1.0, 0, -1, false, 0); + if (!ret) { return FALSE; } + if (!i_this->mpBrkAnm) { return FALSE; } + + i_this->mpMorf->getModel()->setUserArea((u32)i_this); + for (u16 i = 0; i < i_this->mpMorf->getModel()->getModelData()->getJointNum(); i++) { + i_this->mpMorf->getModel()->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); + } + + static Vec cyl_eye_offset[] = { + {80.0f, -25.0f, 0.0f}, + {80.0f, -30.0f, 0.0f}, + }; + static Vec sph_offset[] = { + {50.0f, 30.0f, 0.0f}, + }; + static __jnt_hit_data_c search_data[] = { + { + /* mShapeType */ 2, // Cylinder + /* mJointIndex */ 0x00, // body joint + /* mRadius */ 20.0f, + /* mpOffsets */ (cXyz*)&cyl_eye_offset, + }, + { + /* mShapeType */ 1, // Sphere + /* mJointIndex */ 0x00, // body joint + /* mRadius */ 20.0f, + /* mpOffsets */ (cXyz*)&sph_offset, + }, + }; + i_this->mEyeJntHit = JntHit_create(i_this->mpMorf->getModel(), search_data, ARRAY_SIZE(search_data)); + if (i_this->mEyeJntHit) { + i_this->mJntHit = i_this->mEyeJntHit; + } else { + return FALSE; + } + + return TRUE; } /* 00003E70-00004250 .text daAM2_Create__FP10fopAc_ac_c */ -void daAM2_Create(fopAc_ac_c*) { - /* Nonmatching */ +static s32 daAM2_Create(fopAc_ac_c* i_actor) { + fopAcM_SetupActor(i_actor, am2_class); + + am2_class* i_this = (am2_class*)i_actor; + + s32 phase_state = dComIfG_resLoad(&i_this->mPhs, "AM2"); + if (phase_state == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x1AA0)) { + return cPhs_ERROR_e; + } + + i_this->mSmokeCb.setRateOff(0); + + i_this->mType = (fopAcM_GetParam(i_this) >> 0x00) & 0xFF; + i_this->mPrmAreaRadius = (fopAcM_GetParam(i_this) >> 0x08) & 0xFF; + i_this->mStartsInactive = (fopAcM_GetParam(i_this) >> 0x10) & 0xFF; + i_this->mSwitch = (fopAcM_GetParam(i_this) >> 0x18) & 0xFF; + + if (i_this->mType == 0xFF) { + i_this->mType = 0; + } + if (i_this->mStartsInactive == 0xFF) { + i_this->mStartsInactive = 0; + } + if (g_regHIO.mChild[8].mShortRegs[9] != 0) { + i_this->mType = 1; + } + if (i_this->mPrmAreaRadius == 0xFF || i_this->mPrmAreaRadius == 0) { + i_this->mAreaRadius = 600.0f; + } else { + i_this->mAreaRadius = i_this->mPrmAreaRadius * 100.0f; + } + + if (i_this->mStartsInactive == 0 && i_this->mSwitch != 0xFF && dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { + return cPhs_ERROR_e; + } + + i_this->mItemTableIdx = dComIfGp_CharTbl()->GetNameIndex("amos2", 0); + i_this->mMaxHealth = 2; + i_this->mHealth = 2; + i_this->mItemStealLeft = 3; + i_this->model = i_this->mpMorf->getModel(); + + i_this->mCullMtx = i_this->mpMorf->mpModel->getBaseTRMtx(); + fopAcM_setCullSizeBox(i_this, -50.0f, 0.0f, -20.0f, 60.0f, 180.0f, 60.0f); + + i_this->mAttentionInfo.mFlags = 0; + + i_this->mAcch.Set( + &fopAcM_GetPosition_p(i_this), &fopAcM_GetOldPosition_p(i_this), + i_this, 1, &i_this->mAcchCir, &fopAcM_GetSpeed_p(i_this), + NULL, NULL + ); + i_this->mStts.Init(0xFE, 1, i_this); + + i_this->mGravity = -3.0f; + + i_this->mEnemyIce.mpActor = i_this; + i_this->mEnemyIce.mWallRadius = 50.0f; + i_this->mEnemyIce.mCylHeight = 100.0f; + i_this->mAttentionInfo.mDistances[4] = 9; + + fopAcM_OnStatus(i_this, fopAcStts_UNK8000000_e); + + static dCcD_SrcSph eye_co_sph_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_UNK1000, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0, + /* SrcObjTg Type */ AT_TYPE_NORMAL_ARROW | AT_TYPE_FIRE_ARROW | AT_TYPE_ICE_ARROW | AT_TYPE_LIGHT_ARROW | AT_TYPE_GRAPPLING_HOOK, + /* SrcObjTg SPrm */ 0x03, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0x06, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGSphS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 15.0f, + }, + }; + i_this->mEyeSph.Set(eye_co_sph_src); + i_this->mEyeSph.SetStts(&i_this->mStts); + i_this->mEyeSph.OffTgSetBit(); + + static dCcD_SrcSph week_co_sph_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_UNK1000, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0, + /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_LEAF_WIND | AT_TYPE_UNK400000 | AT_TYPE_UNK800000), + /* SrcObjTg SPrm */ 0x03, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0x06, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGSphS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 15.0f, + }, + }; + i_this->mWeakSph.Set(week_co_sph_src); + i_this->mWeakSph.SetStts(&i_this->mStts); + i_this->mWeakSph.OffTgSetBit(); + + static dCcD_SrcCyl body_co_cyl_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_UNK1000, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0, + /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_LEAF_WIND | AT_TYPE_UNK400000 | AT_TYPE_UNK800000), + /* SrcObjTg SPrm */ 0x03, + /* SrcObjCo SPrm */ 0x75, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0x0C, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0x03, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCylS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 15.0f, + /* Height */ 0.0f, + }, + }; + i_this->mBodyCyl.Set(body_co_cyl_src); + i_this->mBodyCyl.SetStts(&i_this->mStts); + + static dCcD_SrcCyl sword_co_cyl_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_UNK1000, + /* SrcObjAt Atp */ 1, + /* SrcObjAt SPrm */ 0x05, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ 0, + /* SrcObjCo SPrm */ 0x61, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0x06, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0x0C, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0x03, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCylS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 15.0f, + /* Height */ 0.0f, + }, + }; + i_this->mNeedleCyl.Set(sword_co_cyl_src); + i_this->mNeedleCyl.SetStts(&i_this->mStts); + + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffAtSetBit(); + i_this->mNeedleCyl.OffCoSetBit(); + i_this->mNeedleCyl.OffTgSetBit(); + + i_this->m304 = i_this->current.pos; + i_this->mTargetAngleY = i_this->current.angle.y; + i_this->mSpawnPos = i_this->current.pos; + i_this->mSpawnRotY = i_this->shape_angle.y; + + BG_check(i_this); + draw_SUB(i_this); + + if (i_this->mStartsInactive == 1 && i_this->mSwitch != 0xFF && !dComIfGs_isSwitch(i_this->mSwitch, dComIfGp_roomControl_getStayNo())) { + i_this->mAttentionInfo.mFlags = 0; + i_this->mCountDownTimers[2] = 20*30; + i_this->mAction = ACTION_MAHI; + i_this->mState = 0xC; + } + + i_this->mAcchRadius = 40.0f + g_regHIO.mChild[8].mFloatRegs[10]; + } + + return phase_state; } -/* 00004250-00004534 .text __ct__9am2_classFv */ -am2_class::am2_class() { - /* Nonmatching */ -} - -/* 00004534-00004590 .text __dt__18dPa_levelEcallBackFv */ -dPa_levelEcallBack::~dPa_levelEcallBack() { - /* Nonmatching */ -} - -/* 00004590-000045D8 .text __dt__34JPACallBackBaseFv */ -JPACallBackBase::~JPACallBackBase() { - /* Nonmatching */ -} - -/* 000045D8-000046A4 .text __dt__8dCcD_SphFv */ -dCcD_Sph::~dCcD_Sph() { - /* Nonmatching */ -} - -/* 000046A4-000046EC .text __dt__8cM3dGSphFv */ -cM3dGSph::~cM3dGSph() { - /* Nonmatching */ -} - -/* 000046EC-000047B8 .text __dt__8dCcD_CylFv */ -dCcD_Cyl::~dCcD_Cyl() { - /* Nonmatching */ -} - -/* 000047B8-00004800 .text __dt__8cM3dGCylFv */ -cM3dGCyl::~cM3dGCyl() { - /* Nonmatching */ -} - -/* 00004800-0000485C .text __dt__14cCcD_ShapeAttrFv */ -cCcD_ShapeAttr::~cCcD_ShapeAttr() { - /* Nonmatching */ -} - -/* 0000485C-000048A4 .text __dt__8cM3dGAabFv */ -cM3dGAab::~cM3dGAab() { - /* Nonmatching */ -} - -/* 000048A4-00004900 .text __dt__10dCcD_GSttsFv */ -dCcD_GStts::~dCcD_GStts() { - /* Nonmatching */ -} - -/* 00004900-00004970 .text __dt__12dBgS_ObjAcchFv */ -dBgS_ObjAcch::~dBgS_ObjAcch() { - /* Nonmatching */ -} - -/* 00004970-000049F8 .text __dt__12dBgS_AcchCirFv */ -dBgS_AcchCir::~dBgS_AcchCir() { - /* Nonmatching */ -} - -/* 000049F8-00004A40 .text __dt__10cCcD_GSttsFv */ -cCcD_GStts::~cCcD_GStts() { - /* Nonmatching */ -} - -/* 00004A40-00004A88 .text __dt__8cM2dGCirFv */ -cM2dGCir::~cM2dGCir() { - /* Nonmatching */ -} - -/* 00004A88-00004AE4 .text __dt__8cM3dGCirFv */ -cM3dGCir::~cM3dGCir() { - /* Nonmatching */ -} - -/* 00004AE4-00004AE8 .text draw__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::draw(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 00004AE8-00004AEC .text executeAfter__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::executeAfter(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 00004AEC-00004AF0 .text execute__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::execute(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 00004AF0-00004AF4 .text init__34JPACallBackBaseFP14JPABaseEmitter */ -void JPACallBackBase::init(JPABaseEmitter*) { - /* Nonmatching */ -} - -/* 00004AF4-00004B04 .text GetShapeAttr__8dCcD_SphFv */ -void dCcD_Sph::GetShapeAttr() { - /* Nonmatching */ -} - -/* 00004B04-00004B0C .text GetCoCP__12cCcD_SphAttrFv */ -void cCcD_SphAttr::GetCoCP() { - /* Nonmatching */ -} - -/* 00004B0C-00004B14 .text GetCoCP__12cCcD_SphAttrCFv */ -void cCcD_SphAttr::GetCoCP() const { - /* Nonmatching */ -} - -/* 00004B14-00004B1C .text CrossAtTg__12cCcD_SphAttrCFRC12cCcD_AabAttrP4cXyz */ -void cCcD_SphAttr::CrossAtTg(const cCcD_AabAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00004B1C-00004B24 .text CrossAtTg__12cCcD_SphAttrCFRC12cCcD_PntAttrP4cXyz */ -void cCcD_SphAttr::CrossAtTg(const cCcD_PntAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00004B24-00004B5C .text CrossAtTg__12cCcD_SphAttrCFRC14cCcD_ShapeAttrP4cXyz */ -void cCcD_SphAttr::CrossAtTg(const cCcD_ShapeAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00004B5C-00004B64 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_AabAttrPf */ -void cCcD_SphAttr::CrossCo(const cCcD_AabAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004B64-00004B6C .text CrossCo__12cCcD_SphAttrCFRC12cCcD_TriAttrPf */ -void cCcD_SphAttr::CrossCo(const cCcD_TriAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004B6C-00004B74 .text CrossCo__12cCcD_SphAttrCFRC12cCcD_PntAttrPf */ -void cCcD_SphAttr::CrossCo(const cCcD_PntAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004B74-00004BAC .text CrossCo__12cCcD_SphAttrCFRC14cCcD_ShapeAttrPf */ -void cCcD_SphAttr::CrossCo(const cCcD_ShapeAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004BAC-00004BB0 .text GetGObjInf__12cCcD_GObjInfCFv */ -void cCcD_GObjInf::GetGObjInf() const { - /* Nonmatching */ -} - -/* 00004BB0-00004BB8 .text GetShapeAttr__8cCcD_ObjCFv */ -void cCcD_Obj::GetShapeAttr() const { - /* Nonmatching */ -} - -/* 00004BB8-00004BC8 .text GetShapeAttr__8dCcD_CylFv */ -void dCcD_Cyl::GetShapeAttr() { - /* Nonmatching */ -} - -/* 00004BC8-00004BD0 .text GetCoCP__12cCcD_CylAttrFv */ -void cCcD_CylAttr::GetCoCP() { - /* Nonmatching */ -} - -/* 00004BD0-00004BD8 .text GetCoCP__12cCcD_CylAttrCFv */ -void cCcD_CylAttr::GetCoCP() const { - /* Nonmatching */ -} - -/* 00004BD8-00004BE0 .text CrossAtTg__12cCcD_CylAttrCFRC12cCcD_AabAttrP4cXyz */ -void cCcD_CylAttr::CrossAtTg(const cCcD_AabAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00004BE0-00004BE8 .text CrossAtTg__12cCcD_CylAttrCFRC12cCcD_PntAttrP4cXyz */ -void cCcD_CylAttr::CrossAtTg(const cCcD_PntAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00004BE8-00004C20 .text CrossAtTg__12cCcD_CylAttrCFRC14cCcD_ShapeAttrP4cXyz */ -void cCcD_CylAttr::CrossAtTg(const cCcD_ShapeAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00004C20-00004C28 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_AabAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_AabAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004C28-00004C30 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_TriAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_TriAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004C30-00004C38 .text CrossCo__12cCcD_CylAttrCFRC12cCcD_PntAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_PntAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004C38-00004C70 .text CrossCo__12cCcD_CylAttrCFRC14cCcD_ShapeAttrPf */ -void cCcD_CylAttr::CrossCo(const cCcD_ShapeAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004C70-00004C78 .text CrossAtTg__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrP4cXyz */ -void cCcD_ShapeAttr::CrossAtTg(const cCcD_ShapeAttr&, cXyz*) const { - /* Nonmatching */ -} - -/* 00004C78-00004C80 .text CrossCo__14cCcD_ShapeAttrCFRC14cCcD_ShapeAttrPf */ -void cCcD_ShapeAttr::CrossCo(const cCcD_ShapeAttr&, float*) const { - /* Nonmatching */ -} - -/* 00004C80-00004C8C .text GetCoCP__14cCcD_ShapeAttrFv */ -void cCcD_ShapeAttr::GetCoCP() { - /* Nonmatching */ -} - -/* 00004C8C-00004C98 .text GetCoCP__14cCcD_ShapeAttrCFv */ -void cCcD_ShapeAttr::GetCoCP() const { - /* Nonmatching */ -} - -/* 00004C98-00004CF4 .text __dt__13mDoExt_brkAnmFv */ -mDoExt_brkAnm::~mDoExt_brkAnm() { - /* Nonmatching */ -} - -/* 00004CF4-00004D50 .text __dt__13mDoExt_btkAnmFv */ -mDoExt_btkAnm::~mDoExt_btkAnm() { - /* Nonmatching */ -} - -/* 00004D50-00004D58 .text @20@__dt__11cBgS_LinChkFv */ -void @20@__dt__11cBgS_LinChkFv { - /* Nonmatching */ -} - -/* 00004D58-00004D60 .text @12@__dt__8dBgS_ChkFv */ -void @12@__dt__8dBgS_ChkFv { - /* Nonmatching */ -} - -/* 00004D60-00004D68 .text @20@__dt__11dBgS_LinChkFv */ -void @20@__dt__11dBgS_LinChkFv { - /* Nonmatching */ -} - -/* 00004D68-00004D70 .text @100@__dt__11dBgS_LinChkFv */ -void @100@__dt__11dBgS_LinChkFv { - /* Nonmatching */ -} - -/* 00004D70-00004D78 .text @88@__dt__11dBgS_LinChkFv */ -void @88@__dt__11dBgS_LinChkFv { - /* Nonmatching */ -} - -/* 00004D78-00004D80 .text @32@__dt__12dBgS_ObjAcchFv */ -void @32@__dt__12dBgS_ObjAcchFv { - /* Nonmatching */ -} - -/* 00004D80-00004D88 .text @20@__dt__12dBgS_ObjAcchFv */ -void @20@__dt__12dBgS_ObjAcchFv { - /* Nonmatching */ -} - -/* 00004D88-00004D90 .text @280@__dt__8dCcD_CylFv */ -void @280@__dt__8dCcD_CylFv { - /* Nonmatching */ -} - -/* 00004D90-00004D98 .text @248@__dt__8dCcD_CylFv */ -void @248@__dt__8dCcD_CylFv { - /* Nonmatching */ -} - -/* 00004D98-00004DA0 .text @280@__dt__8dCcD_SphFv */ -void @280@__dt__8dCcD_SphFv { - /* Nonmatching */ -} - -/* 00004DA0-00004DA8 .text @248@__dt__8dCcD_SphFv */ -void @248@__dt__8dCcD_SphFv { - /* Nonmatching */ -} +static actor_method_class l_daAM2_Method = { + (process_method_func)daAM2_Create, + (process_method_func)daAM2_Delete, + (process_method_func)daAM2_Execute, + (process_method_func)daAM2_IsDelete, + (process_method_func)daAM2_Draw, +}; +actor_process_profile_definition g_profile_AM2 = { + /* LayerID */ fpcLy_CURRENT_e, + /* ListID */ 7, + /* ListPrio */ fpcPi_CURRENT_e, + /* ProcName */ PROC_AM2, + /* Proc SubMtd */ &g_fpcLf_Method.mBase, + /* Size */ sizeof(am2_class), + /* SizeOther */ 0, + /* Parameters */ 0, + /* Leaf SubMtd */ &g_fopAc_Method.base, + /* Priority */ 0x00BE, + /* Actor SubMtd */ &l_daAM2_Method, + /* Status */ fopAcStts_CULL_e | fopAcStts_FREEZE_e | fopAcStts_UNK40000_e, + /* Group */ fopAc_ENEMY_e, + /* CullType */ fopAc_CULLBOX_CUSTOM_e, +}; diff --git a/src/d/actor/d_a_andsw0.cpp b/src/d/actor/d_a_andsw0.cpp index d232c9380..8cba1bf80 100644 --- a/src/d/actor/d_a_andsw0.cpp +++ b/src/d/actor/d_a_andsw0.cpp @@ -72,7 +72,7 @@ static void daAndsw0_check(andsw0_class* i_this) { break; case 3: i_this->mAction = ACT_TIMER_SET; - i_this->mTimer = 0x41; + i_this->mTimer = 65; break; default: i_this->mAction = ACT_OFF_ALL; @@ -99,7 +99,7 @@ static void daAndsw0_check(andsw0_class* i_this) { break; case ACT_TIMER: - i_this->mTimer = (i_this->orig.angle.z & 0xFF) * 0xF; + i_this->mTimer = (i_this->orig.angle.z & 0xFF) * 15; if(fopAcM_isSwitch(i_this, i_this->mSwitchToSet)) { i_this->mAction = ACT_WAIT; } @@ -331,7 +331,7 @@ static s32 daAndsw0_Create(fopAc_ac_c* ac) { i_this->mBehaviorType = (fopAcM_GetParam(ac) >> 8) & 0xFF; i_this->mSwitchToSet = (fopAcM_GetParam(ac) >> 24) & 0xFF; i_this->mFirstSwitchToCheck = (fopAcM_GetParam(ac) >> 16) & 0xFF; - i_this->mTimer = (i_this->orig.angle.z & 0xFF) * 0xF; + i_this->mTimer = (i_this->orig.angle.z & 0xFF) * 15; i_this->mEventNo = i_this->orig.angle.x; i_this->mEventIdx = dComIfGp_evmng_getEventIdx(NULL, i_this->mEventNo); if (i_this->mBehaviorType == 2) diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index 2f3c42ce8..2512a8cc3 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -400,7 +400,7 @@ bool daArrow_c::check_water_in() { dKy_arrowcol_chg_on(¤t.pos, 0); } } else if (mArrowType == TYPE_ICE) { - mInWaterTimer = 300; + mInWaterTimer = 10*30; fopAcM_createChild( PROC_ARROW_ICEEFF, fpcM_GetID(this), mArrowType, &waterHitPos, current.roomNo, ¤t.angle, NULL, -1, NULL diff --git a/src/d/actor/d_a_disappear.cpp b/src/d/actor/d_a_disappear.cpp index b016c4db6..5a921f703 100644 --- a/src/d/actor/d_a_disappear.cpp +++ b/src/d/actor/d_a_disappear.cpp @@ -75,7 +75,7 @@ void set_disappear(disappear_class* i_this, float scale) { mDoAud_seStart(JA_SE_CM_MONS_EXPLODE, &i_this->mEyePos, 0, rev); cXyz particleScale(scale, scale, scale); - i_this->mTimer = g_regHIO.mChild[8].mShortRegs[0] + 0x3A; + i_this->mTimer = 58 + g_regHIO.mChild[8].mShortRegs[0]; switch (i_this->mHealth) { case 0: diff --git a/src/d/actor/d_a_nh.cpp b/src/d/actor/d_a_nh.cpp index a6edef3a9..bf6550868 100644 --- a/src/d/actor/d_a_nh.cpp +++ b/src/d/actor/d_a_nh.cpp @@ -434,7 +434,7 @@ BOOL daNh_c::escapeAction(void*) { mActionStatus += 1; // ACTION_ONGOING mWobbleDir = 0; mWobbleTimer = 0; - mEscapeTimer = 150; + mEscapeTimer = 5*30; } else if (mActionStatus != ACTION_ENDING) { if (!checkEscapeEnd()) { s16 targetAngle = fopAcM_searchPlayerAngleY(this) + 0x8000; @@ -456,7 +456,7 @@ BOOL daNh_c::returnAction(void*) { mActionStatus += 1; // ACTION_ONGOING mWobbleDir = 0; mWobbleTimer = 0; - mEscapeTimer = 150; + mEscapeTimer = 5*30; } else if (mActionStatus != ACTION_ENDING) { if (getHomeDistance() < 50.0f) { setAction(&waitAction, NULL); diff --git a/src/d/actor/d_a_npc_kamome.cpp b/src/d/actor/d_a_npc_kamome.cpp index 75e196cf8..6dc98b536 100644 --- a/src/d/actor/d_a_npc_kamome.cpp +++ b/src/d/actor/d_a_npc_kamome.cpp @@ -1047,7 +1047,7 @@ void daNpc_kam_c::initialDescendEvent(int evtStaffId) { onNoBgCheck(); - mWaitTimer = 900; + mWaitTimer = 30*30; } // Needed for the .rodata section to match.