From 5b86769442fc190635cd7e4a3ba266206fd43e73 Mon Sep 17 00:00:00 2001 From: hatal175 Date: Tue, 1 Jul 2025 01:24:21 +0300 Subject: [PATCH] d_a_arrow matching (#2513) * d_a_arrow matching * d_a_demo_item Matching * Change e_ba_class class to hold fopEn_enemy_c --- config/GZ2E01/rels/d_a_demo_item/symbols.txt | 1 + configure.py | 4 +- include/d/actor/d_a_demo_item.h | 2 +- include/d/actor/d_a_e_ba.h | 3 +- include/d/actor/d_a_itembase.h | 2 +- src/d/actor/d_a_arrow.cpp | 7 +- src/d/actor/d_a_demo_item.cpp | 94 ++++-- src/d/actor/d_a_e_ba.cpp | 323 ++++++++++--------- src/d/d_a_itembase_static.cpp | 6 +- 9 files changed, 251 insertions(+), 191 deletions(-) diff --git a/config/GZ2E01/rels/d_a_demo_item/symbols.txt b/config/GZ2E01/rels/d_a_demo_item/symbols.txt index 6b18be8eb5d..c8478e43ab6 100644 --- a/config/GZ2E01/rels/d_a_demo_item/symbols.txt +++ b/config/GZ2E01/rels/d_a_demo_item/symbols.txt @@ -96,6 +96,7 @@ l_wolf_offset = .bss:0x0000006C; // type:object size:0xC scope:global @3760 = .bss:0x00000078; // type:object size:0xC scope:local l_horse_offset = .bss:0x00000084; // type:object size:0xC scope:global @4275 = .bss:0x00000090; // type:object size:0xC scope:local +init$1935 = .bss:0x0000009C; // type:object size:0x1 scope:local @4278 = .bss:0x000000A0; // type:object size:0xC scope:local @4279 = .bss:0x000000AC; // type:object size:0xC scope:local offset_tbl$4274 = .bss:0x000000B8; // type:object size:0x24 scope:local diff --git a/configure.py b/configure.py index 3e6f9cf206f..fdffa70a39d 100755 --- a/configure.py +++ b/configure.py @@ -1517,7 +1517,7 @@ config.libs = [ ActorRel(MatchingFor("GZ2E01"), "d_a_tbox2"), ActorRel(MatchingFor("GZ2E01"), "d_a_vrbox"), ActorRel(NonMatching, "d_a_vrbox2"), - ActorRel(NonMatching, "d_a_arrow"), + ActorRel(MatchingFor("GZ2E01"), "d_a_arrow"), ActorRel(NonMatching, "d_a_boomerang"), ActorRel(MatchingFor("GZ2E01"), "d_a_crod"), ActorRel(NonMatching, "d_a_demo00"), @@ -1535,7 +1535,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_bd"), ActorRel(MatchingFor("GZ2E01"), "d_a_canoe"), ActorRel(MatchingFor("GZ2E01"), "d_a_cstaF"), - ActorRel(NonMatching, "d_a_demo_item"), + ActorRel(MatchingFor("GZ2E01"), "d_a_demo_item"), ActorRel(MatchingFor("GZ2E01"), "d_a_door_bossL1"), ActorRel(Equivalent, "d_a_e_dn"), # weak func order ActorRel(Equivalent, "d_a_e_fm"), diff --git a/include/d/actor/d_a_demo_item.h b/include/d/actor/d_a_demo_item.h index f0ea257f2f0..f5d6616c78b 100644 --- a/include/d/actor/d_a_demo_item.h +++ b/include/d/actor/d_a_demo_item.h @@ -50,7 +50,7 @@ public: void setAction(u8 i_action) { mAction = i_action; } - u32 chkArgFlag(u8 i_flag) { return field_0x93d & i_flag; } + u8 chkArgFlag(u8 i_flag) { return field_0x93d & i_flag; } void setOffsetPos(cXyz i_pos) { mOffsetPos = i_pos; } void setMaxScale(f32 i_scale) { mMaxScale = i_scale; } diff --git a/include/d/actor/d_a_e_ba.h b/include/d/actor/d_a_e_ba.h index 1b72ccf1d56..e8b0dc3ecf1 100644 --- a/include/d/actor/d_a_e_ba.h +++ b/include/d/actor/d_a_e_ba.h @@ -16,7 +16,7 @@ * @details * */ -class e_ba_class : public fopEn_enemy_c { +class e_ba_class { public: enum Type { /* 0 */ TYPE_NORMAL, @@ -54,6 +54,7 @@ public: /* 0xA */ ANM_WAIT, }; + /* 0x000 */ fopEn_enemy_c mEnemy; /* 0x5AC */ request_of_phase_process_class mPhase; /* 0x5B4 */ u8 mHomeType; /* 0x5B5 */ u8 mDistanceParam; diff --git a/include/d/actor/d_a_itembase.h b/include/d/actor/d_a_itembase.h index 7f248253fe8..737c221ba4e 100644 --- a/include/d/actor/d_a_itembase.h +++ b/include/d/actor/d_a_itembase.h @@ -35,7 +35,7 @@ public: void changeDraw(); u8 chkDraw(); void dead(); - u8 chkDead(); + bool chkDead(); int CreateItemHeap(char const*, s16, s16, s16, s16, s16, s16, s16); int DeleteBase(char const*); void setListEnd(); diff --git a/src/d/actor/d_a_arrow.cpp b/src/d/actor/d_a_arrow.cpp index b6a9418e129..08789741d9e 100644 --- a/src/d/actor/d_a_arrow.cpp +++ b/src/d/actor/d_a_arrow.cpp @@ -5,6 +5,7 @@ #include "d/actor/d_a_arrow.h" #include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "JSystem/JAudio2/JAUSectionHeap.h" #include "SSystem/SComponent/c_math.h" #include "Z2AudioLib/Z2Instances.h" #include "f_op/f_op_kankyo_mng.h" @@ -1121,7 +1122,6 @@ static int daArrow_execute(daArrow_c* i_this) { } /* 8049D0CC-8049D40C 00354C 0340+00 1/1 0/0 0/0 .text draw__9daArrow_cFv */ -// NONMATCHING regalloc int daArrow_c::draw() { g_env_light.settingTevStruct(0, ¤t.pos, &tevStr); @@ -1129,7 +1129,7 @@ int daArrow_c::draw() { return TRUE; } - GXColorS10 tmpColor = {0, 0, 0}; + static const GXColorS10 tmpColor = {0, 0, 0}; J3DGXColorS10 color = (tmpColor); daAlink_c* link = daAlink_getAlinkActorClass(); @@ -1150,7 +1150,7 @@ int daArrow_c::draw() { if (field_0x950 > explode_time >> 1) { r = fabsf(cM_fsin((field_0x950 - (explode_time >> 1)) * M_PI / (explode_time >> 2))); } else if (field_0x950 > explode_time >> 2) { - r = fabsf(cM_fsin((field_0x950 - (explode_time >> 1)) * M_PI / (explode_time >> 3))); + r = fabsf(cM_fsin((field_0x950 - (explode_time >> 2)) * M_PI / (explode_time >> 3))); } else { r = fabsf(cM_fsin((field_0x950 - (explode_time >> 3)) * M_PI / (explode_time >> 4))); } @@ -1276,6 +1276,7 @@ static int daArrow_delete(daArrow_c* i_this) { } AUDIO_INSTANCES; +JAUSectionHeap* JASGlobalInstance::sInstance; /* 8049DE8C-8049DEAC -00001 0020+00 1/0 0/0 0/0 .data l_daArrowMethodTable */ static actor_method_class l_daArrowMethodTable = { diff --git a/src/d/actor/d_a_demo_item.cpp b/src/d/actor/d_a_demo_item.cpp index c72cfb863a5..149f97512fb 100644 --- a/src/d/actor/d_a_demo_item.cpp +++ b/src/d/actor/d_a_demo_item.cpp @@ -12,6 +12,66 @@ #include "JSystem/J3DGraphBase/J3DMaterial.h" #include "Z2AudioLib/Z2Instances.h" +UNK_BSS(1109) +UNK_BSS(1107) +UNK_BSS(1105) +UNK_BSS(1104) +UNK_BSS(1099) +UNK_BSS(1097) +UNK_BSS(1095) +UNK_BSS(1094) +UNK_BSS(1057) +UNK_BSS(1055) +UNK_BSS(1053) +UNK_BSS(1052) +UNK_BSS(1014) +UNK_BSS(1012) +UNK_BSS(1010) +UNK_BSS(1009) + +/* 804E1C34-804E1C40 000054 000C+00 0/2 0/0 0/0 .bss l_player_offset */ +static cXyz l_player_offset = cXyz(0.0f, 115.0f, 54.0f); + +/* 804E1C4C-804E1C58 00006C 000C+00 0/2 0/0 0/0 .bss l_wolf_offset */ +static cXyz l_wolf_offset = cXyz(13.0f, 135.0f, 57.0f); + +/* 804E1C64-804E1C70 000084 000C+00 0/2 0/0 0/0 .bss l_horse_offset */ +static cXyz l_horse_offset = cXyz(0.0f, 20.0f, 54.0f); + +#ifdef DEBUG + +class DitemHIO_c +: public mDoHIO_entry_c +{ +public: + ~DitemHIO_c() {} + void genMessage(JORMContext*) {} + + /* 0x08 */ cXyz field_0x08; + /* 0x14 */ u16 field_0x14; + /* 0x16 */ u16 field_0x16; + /* 0x18 */ u16 field_0x18; + /* 0x1C */ f32 field_0x1c; + /* 0x20 */ u16 field_0x20; + /* 0x22 */ u8 field_0x22; + /* 0x23 */ u8 field_0x23; + /* 0x24 */ u8 field_0x24; + + DitemHIO_c() { + field_0x20 = 0xfa; + field_0x23 = 0; + field_0x08 = l_player_offset; + field_0x24 = 0; + field_0x14 = 0x8c; + field_0x16 = 0x7c; + field_0x18 = 0x6a; + field_0x1c = 8.0f; + field_0x22 = 0; + } +}; + +#endif + /* 804DFBCC-804DFBD4 0000EC 0008+00 1/0 0/0 0/0 .text __CreateHeap__9daDitem_cFv */ int daDitem_c::__CreateHeap() { return 1; @@ -138,7 +198,7 @@ void daDitem_c::actionEvent() { } if (m_itemNo == fpcNm_ITEM_KAKERA_HEART) { - s32 room_no = dComIfGp_roomControl_getStayNo(); + int room_no = dComIfGp_roomControl_getStayNo(); if (strcmp(dComIfGp_getStartStageName(), "F_SP116") == 0 && room_no == 2) { onEventReg(0, 0); @@ -160,8 +220,10 @@ void daDitem_c::actionEvent() { onEventReg(1, 1); } else if (strcmp(dComIfGp_getStartStageName(), "F_SP110") == 0 && room_no == 0) { onEventReg(1, 2); - } else if (strcmp(dComIfGp_getStartStageName(), "F_SP109") == 0 && room_no == 0 && dComIfGs_isTmpBit(0x0604)) { - onEventReg(1, 3); + } else if (strcmp(dComIfGp_getStartStageName(), "F_SP109") == 0 && room_no == 0) { + if (dComIfGs_isTmpBit(0x0604)) { + onEventReg(1, 3); + } } else if (strcmp(dComIfGp_getStartStageName(), "F_SP126") == 0 && room_no == 0) { onEventReg(1, 5); } else if (strcmp(dComIfGp_getStartStageName(), "D_MN05") == 0 && room_no == 5) { @@ -309,32 +371,6 @@ void daDitem_c::onEventReg(int i_regNo, int i_value) { OS_REPORT("ハートの欠片:%d %d\n", i_regNo, i_value); } -UNK_BSS(1109) -UNK_BSS(1107) -UNK_BSS(1105) -UNK_BSS(1104) -UNK_BSS(1099) -UNK_BSS(1097) -UNK_BSS(1095) -UNK_BSS(1094) -UNK_BSS(1057) -UNK_BSS(1055) -UNK_BSS(1053) -UNK_BSS(1052) -UNK_BSS(1014) -UNK_BSS(1012) -UNK_BSS(1010) -UNK_BSS(1009) - -/* 804E1C34-804E1C40 000054 000C+00 0/2 0/0 0/0 .bss l_player_offset */ -static cXyz l_player_offset(0.0f, 115.0f, 54.0f); - -/* 804E1C4C-804E1C58 00006C 000C+00 0/2 0/0 0/0 .bss l_wolf_offset */ -static cXyz l_wolf_offset(13.0f, 135.0f, 57.0f); - -/* 804E1C64-804E1C70 000084 000C+00 0/2 0/0 0/0 .bss l_horse_offset */ -static cXyz l_horse_offset(0.0f, 20.0f, 54.0f); - /* 804E0DB4-804E105C 0012D4 02A8+00 1/1 0/0 0/0 .text set_pos__9daDitem_cFv */ void daDitem_c::set_pos() { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); diff --git a/src/d/actor/d_a_e_ba.cpp b/src/d/actor/d_a_e_ba.cpp index abc2b477795..4461566e5c7 100644 --- a/src/d/actor/d_a_e_ba.cpp +++ b/src/d/actor/d_a_e_ba.cpp @@ -48,9 +48,10 @@ static void anm_init(e_ba_class* i_this, int i_index, f32 i_morf, u8 i_attr, f32 /* 8067EE38-8067EEA8 000238 0070+00 1/0 0/0 0/0 .text daE_BA_Draw__FP10e_ba_class */ static int daE_BA_Draw(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; J3DModel* model = i_this->mpMorf->getModel(); - g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); - g_env_light.setLightTevColorType_MAJI(model, &i_this->tevStr); + g_env_light.settingTevStruct(0, &a_this->current.pos, &a_this->tevStr); + g_env_light.setLightTevColorType_MAJI(model, &a_this->tevStr); i_this->mpMorf->entryDL(); return 1; } @@ -69,7 +70,7 @@ static void* shot_b_sub(void* i_proc, void* i_this) { /* 8067EF20-8067EFF8 000320 00D8+00 1/1 0/0 0/0 .text other_bg_check__FP10e_ba_classP10fopAc_ac_c */ static BOOL other_bg_check(e_ba_class* i_this, fopAc_ac_c* i_other) { - fopAc_ac_c* _this = static_cast(i_this); + fopAc_ac_c* _this = static_cast(&i_this->mEnemy); dBgS_LinChk lin_chk; cXyz vec1, vec2; vec2 = i_other->current.pos; @@ -86,15 +87,16 @@ static BOOL other_bg_check(e_ba_class* i_this, fopAc_ac_c* i_other) { /* 8067EFF8-8067F0AC 0003F8 00B4+00 5/5 0/0 0/0 .text pl_check__FP10e_ba_classfs */ static BOOL pl_check(e_ba_class* i_this, f32 i_maxDistance, s16 i_maxAngle) { + fopEn_enemy_c* a_this = &i_this->mEnemy; fopAc_ac_c* player = dComIfGp_getPlayer(0); if (!daPy_getPlayerActorClass()->checkSwimUp() || dComIfGp_event_runCheck()) { return false; } - if (player->current.pos.y < i_this->current.pos.y && i_this->mPlayerDistanceXZ < i_maxDistance) + if (player->current.pos.y < a_this->current.pos.y && i_this->mPlayerDistanceXZ < i_maxDistance) { - s16 angle = i_this->shape_angle.y - i_this->mPlayerAngleY; + s16 angle = a_this->shape_angle.y - i_this->mPlayerAngleY; if (i_maxAngle == 1 || (angle < i_maxAngle && angle > (s16)-i_maxAngle)) { if (!other_bg_check(i_this, player)) { return true; @@ -107,6 +109,7 @@ static BOOL pl_check(e_ba_class* i_this, f32 i_maxDistance, s16 i_maxAngle) { /* 8067F0AC-8067F2DC 0004AC 0230+00 1/1 0/0 0/0 .text damage_check__FP10e_ba_class */ static void damage_check(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); if (i_this->mIFrames == 0) { i_this->mStts.Move(); @@ -118,22 +121,22 @@ static void damage_check(e_ba_class* i_this) { i_this->mType = e_ba_class::TYPE_NORMAL; i_this->mSph.SetAtType(AT_TYPE_CSTATUE_SWING); } else { - cc_at_check(i_this, &i_this->mAtInfo); + cc_at_check(a_this, &i_this->mAtInfo); if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_HOOKSHOT) || i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_SLINGSHOT)) { - i_this->health--; + a_this->health--; } if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_SHIELD_ATTACK)) { i_this->mAction = e_ba_class::ACT_CHANCE; i_this->mMode = 0; i_this->mKnockbackSpeed = 70.0f; - i_this->mKnockbackAngle = i_this->shape_angle.y; + i_this->mKnockbackAngle = a_this->shape_angle.y; i_this->mIsDying = false; dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); } else if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_WOLF_ATTACK) - && player->onWolfEnemyCatch(i_this)) { + && player->onWolfEnemyCatch(a_this)) { i_this->mAction = e_ba_class::ACT_WOLFBITE; i_this->mMode = 0; i_this->mIFrames = 200; @@ -147,7 +150,7 @@ static void damage_check(e_ba_class* i_this) { } i_this->mKnockbackSpeed = 80.0f; i_this->mKnockbackAngle = i_this->mAtInfo.mHitDirection.y; - if (i_this->health <= 0) { + if (a_this->health <= 0) { i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_DEATH, -1); i_this->mpMorf->setPlaySpeed(0.2f); i_this->mIsDying = true; @@ -161,10 +164,11 @@ static void damage_check(e_ba_class* i_this) { /* 8067F2DC-8067F544 0006DC 0268+00 2/3 0/0 0/0 .text path_check__FP10e_ba_class */ // NONMATCHING regalloc static BOOL path_check(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; if (i_this->mpPath != NULL) { dBgS_LinChk lin_chk; cXyz vec1, vec2; - vec1 = i_this->current.pos; + vec1 = a_this->current.pos; vec1.y += 100.0f; static bool check_index[255]; dPnt* point = i_this->mpPath->m_points; @@ -172,7 +176,7 @@ static BOOL path_check(e_ba_class* i_this) { vec2.x = point->m_position.x; vec2.y = point->m_position.y + 100.0f; vec2.z = point->m_position.z; - lin_chk.Set(&vec1, &vec2, i_this); + lin_chk.Set(&vec1, &vec2, a_this); if (!dComIfG_Bgsp().LineCross(&lin_chk)) { check_index[i] = true; } else { @@ -187,9 +191,9 @@ static BOOL path_check(e_ba_class* i_this) { point = i_this->mpPath->m_points; for (int j = 0; j < i_this->mpPath->m_num; j++, point++) { if (check_index[j]) { - delta_x = i_this->current.pos.x - point->m_position.x; - delta_y = i_this->current.pos.y - point->m_position.y; - delta_z = i_this->current.pos.z - point->m_position.z; + delta_x = a_this->current.pos.x - point->m_position.x; + delta_y = a_this->current.pos.y - point->m_position.y; + delta_z = a_this->current.pos.z - point->m_position.z; f32 dist = JMAFastSqrt(delta_x * delta_x + delta_y * delta_y + delta_z * delta_z); if (dist < threshold) { @@ -222,31 +226,34 @@ static BOOL path_check(e_ba_class* i_this) { /* 8067F544-8067F6D4 000944 0190+00 6/6 0/0 0/0 .text fly_move__FP10e_ba_class */ static void fly_move(e_ba_class* i_this) { - f32 delta_x = i_this->mTargetPos.x - i_this->current.pos.x; - f32 delta_y = i_this->mTargetPos.y - i_this->current.pos.y; - f32 delta_z = i_this->mTargetPos.z - i_this->current.pos.z; + fopEn_enemy_c* a_this = &i_this->mEnemy; + f32 delta_x = i_this->mTargetPos.x - a_this->current.pos.x; + f32 delta_y = i_this->mTargetPos.y - a_this->current.pos.y; + f32 delta_z = i_this->mTargetPos.z - a_this->current.pos.z; s16 angle_y = cM_atan2s(delta_x, delta_z); f32 dist_xz = JMAFastSqrt(delta_x * delta_x + delta_z * delta_z); s16 angle_x = -cM_atan2s(delta_y, dist_xz); - cLib_addCalcAngleS2(&i_this->current.angle.y, angle_y, 10, + cLib_addCalcAngleS2(&a_this->current.angle.y, angle_y, 10, i_this->mBaseAngleSpeed * i_this->mSpeedRatio); i_this->mBaseAngleSpeed = 2000.0f; - cLib_addCalcAngleS2(&i_this->current.angle.x, angle_x, 10, + cLib_addCalcAngleS2(&a_this->current.angle.x, angle_x, 10, i_this->mBaseAngleSpeed * i_this->mSpeedRatio); cLib_addCalc2(&i_this->mSpeedRatio, 1.0f, 1.0f, 0.04f); cXyz vec; vec.x = 0.0f; vec.y = 0.0f; - vec.z = i_this->speedF; - mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); - mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); - MtxPosition(&vec, &i_this->speed); - i_this->current.pos += i_this->speed; + vec.z = a_this->speedF; + mDoMtx_YrotS(*calc_mtx, a_this->current.angle.y); + mDoMtx_XrotM(*calc_mtx, a_this->current.angle.x); + MtxPosition(&vec, &a_this->speed); + a_this->current.pos += a_this->speed; } /* 8067F6D4-8067F81C 000AD4 0148+00 1/1 0/0 0/0 .text e_ba_roof__FP10e_ba_class */ static void e_ba_roof(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; + switch (i_this->mMode) { case 0: anm_init(i_this, e_ba_class::ANM_WAIT, 15.0f, @@ -261,9 +268,9 @@ static void e_ba_roof(e_ba_class* i_this) { break; } - cLib_addCalc2(&i_this->current.pos.x, i_this->home.pos.x, 0.5f, fabsf(i_this->speed.x)); - cLib_addCalc2(&i_this->current.pos.y, i_this->home.pos.y, 0.5f, fabsf(i_this->speed.y)); - cLib_addCalc2(&i_this->current.pos.z, i_this->home.pos.z, 0.5f, fabsf(i_this->speed.z)); + cLib_addCalc2(&a_this->current.pos.x, a_this->home.pos.x, 0.5f, fabsf(a_this->speed.x)); + cLib_addCalc2(&a_this->current.pos.y, a_this->home.pos.y, 0.5f, fabsf(a_this->speed.y)); + cLib_addCalc2(&a_this->current.pos.z, a_this->home.pos.z, 0.5f, fabsf(a_this->speed.z)); if (pl_check(i_this, i_this->mFightFlyDistance, 1)) { i_this->mAction = e_ba_class::ACT_FIGHT_FLY; @@ -273,6 +280,7 @@ static void e_ba_roof(e_ba_class* i_this) { /* 8067F81C-8067F9E0 000C1C 01C4+00 1/1 0/0 0/0 .text e_ba_fight_fly__FP10e_ba_class */ static void e_ba_fight_fly(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; fopAc_ac_c* player = dComIfGp_getPlayer(0); switch (i_this->mMode) { @@ -289,7 +297,7 @@ static void e_ba_fight_fly(e_ba_class* i_this) { break; } - cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + cLib_addCalc2(&a_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); i_this->mTargetPos = player->current.pos; fly_move(i_this); @@ -318,6 +326,7 @@ static void e_ba_fight_fly(e_ba_class* i_this) { /* 8067F9E0-8067FD68 000DE0 0388+00 1/1 0/0 0/0 .text e_ba_fight__FP10e_ba_class */ static void e_ba_fight(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; fopAc_ac_c* player = dComIfGp_getPlayer(0); s16 player_angle = player->shape_angle.y; @@ -339,14 +348,14 @@ static void e_ba_fight(e_ba_class* i_this) { vec.z = cM_rndF(150.0f) + 150.0f; MtxPosition(&vec, &i_this->mTargetPos); i_this->mTargetPos += player->current.pos; - vec = i_this->mTargetPos - i_this->current.pos; + vec = i_this->mTargetPos - a_this->current.pos; mDoMtx_YrotS(*calc_mtx, cM_atan2s(vec.x, vec.z)); f32 dist_xz = JMAFastSqrt(vec.x * vec.x + vec.z * vec.z); mDoMtx_XrotM(*calc_mtx, -cM_atan2s(vec.y, dist_xz)); vec.x = 0.0f; vec.y = 0.0f; vec.z = l_HIO.mFightSpeed; - MtxPosition(&vec, &i_this->speed); + MtxPosition(&vec, &a_this->speed); i_this->mTimer[0] = cM_rndF(30.0f) + 10.0f; i_this->mSpeedRatio = 0.0f; } @@ -361,14 +370,14 @@ static void e_ba_fight(e_ba_class* i_this) { break; } - cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.2f, - i_this->mSpeedRatio * fabsf(i_this->speed.x)); - cLib_addCalc2(&i_this->current.pos.y, i_this->mTargetPos.y, 0.2f, - i_this->mSpeedRatio * fabsf(i_this->speed.y)); - cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.2f, - i_this->mSpeedRatio * fabsf(i_this->speed.z)); + cLib_addCalc2(&a_this->current.pos.x, i_this->mTargetPos.x, 0.2f, + i_this->mSpeedRatio * fabsf(a_this->speed.x)); + cLib_addCalc2(&a_this->current.pos.y, i_this->mTargetPos.y, 0.2f, + i_this->mSpeedRatio * fabsf(a_this->speed.y)); + cLib_addCalc2(&a_this->current.pos.z, i_this->mTargetPos.z, 0.2f, + i_this->mSpeedRatio * fabsf(a_this->speed.z)); cLib_addCalc2(&i_this->mSpeedRatio, 1.0f, 1.0f, 0.1f); - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mPlayerAngleY, 4, 0x800); + cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->mPlayerAngleY, 4, 0x800); if (i_this->mHomeType != e_ba_class::HOME_APPEAR && !pl_check(i_this, i_this->mFightFlyDistance + 50.0f, 1)) @@ -390,6 +399,7 @@ static void e_ba_fight(e_ba_class* i_this) { /* 8067FD68-8067FF60 001168 01F8+00 1/1 0/0 0/0 .text e_ba_attack__FP10e_ba_class */ static void e_ba_attack(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; fopAc_ac_c* player = dComIfGp_getPlayer(0); f32 target_speed = 0.0f; i_this->mSpeedRatio = 0.0f; @@ -418,7 +428,7 @@ static void e_ba_attack(e_ba_class* i_this) { i_this->mAction = e_ba_class::ACT_CHANCE; i_this->mMode = 0; i_this->mKnockbackSpeed = 70.0f; - i_this->mKnockbackAngle = i_this->shape_angle.y; + i_this->mKnockbackAngle = a_this->shape_angle.y; i_this->mIsDying = false; dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); } else { @@ -429,19 +439,20 @@ static void e_ba_attack(e_ba_class* i_this) { break; case 3: - if (i_this->speedF <= 1.0f) { + if (a_this->speedF <= 1.0f) { i_this->mAction = e_ba_class::ACT_FIGHT; i_this->mMode = 0; } break; } - cLib_addCalc2(&i_this->speedF, target_speed, 1.0f, l_HIO.mAttackSpeed * 0.2f); + cLib_addCalc2(&a_this->speedF, target_speed, 1.0f, l_HIO.mAttackSpeed * 0.2f); fly_move(i_this); } /* 8067FF60-8068018C 001360 022C+00 1/1 0/0 0/0 .text e_ba_fly__FP10e_ba_class */ static void e_ba_fly(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; switch (i_this->mMode) { case 0: anm_init(i_this, e_ba_class::ANM_FLY, 3.0f, J3DFrameCtrl::EMode_LOOP, 1.0f); @@ -453,23 +464,23 @@ static void e_ba_fly(e_ba_class* i_this) { i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_NAKU, -1); } if (i_this->mTimer[0] == 0) { - i_this->mTargetPos.x = i_this->home.pos.x + cM_rndFX(500.0f); - i_this->mTargetPos.y = i_this->home.pos.y + cM_rndFX(200.0f); - i_this->mTargetPos.z = i_this->home.pos.z + cM_rndFX(500.0f); - cXyz vec = i_this->mTargetPos - i_this->current.pos; + i_this->mTargetPos.x = a_this->home.pos.x + cM_rndFX(500.0f); + i_this->mTargetPos.y = a_this->home.pos.y + cM_rndFX(200.0f); + i_this->mTargetPos.z = a_this->home.pos.z + cM_rndFX(500.0f); + cXyz vec = i_this->mTargetPos - a_this->current.pos; mDoMtx_YrotS(*calc_mtx, cM_atan2s(vec.x, vec.z)); mDoMtx_XrotM(*calc_mtx, -cM_atan2s(vec.y, JMAFastSqrt(vec.x * vec.x + vec.z * vec.z))); vec.x = 0.0f; vec.y = 0.0f; vec.z = l_HIO.mFightSpeed; - MtxPosition(&vec, &i_this->speed); + MtxPosition(&vec, &a_this->speed); i_this->mTimer[0] = cM_rndF(30.0f) + 10.0f; i_this->mSpeedRatio = 0.0f; } break; } - cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + cLib_addCalc2(&a_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); fly_move(i_this); if (pl_check(i_this, i_this->mFightFlyDistance, 1)) { i_this->mAction = e_ba_class::ACT_FIGHT_FLY; @@ -479,6 +490,8 @@ static void e_ba_fly(e_ba_class* i_this) { /* 8068018C-8068039C 00158C 0210+00 1/1 0/0 0/0 .text e_ba_return__FP10e_ba_class */ static void e_ba_return(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; + switch (i_this->mMode) { case 0: anm_init(i_this, e_ba_class::ANM_FLY, 3.0f, J3DFrameCtrl::EMode_LOOP, 1.0f); @@ -489,11 +502,11 @@ static void e_ba_return(e_ba_class* i_this) { break; } - cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); - i_this->mTargetPos = i_this->home.pos; + cLib_addCalc2(&a_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + i_this->mTargetPos = a_this->home.pos; fly_move(i_this); - cXyz delta = i_this->current.pos - i_this->mTargetPos; + cXyz delta = a_this->current.pos - i_this->mTargetPos; if (delta.abs() < 100.0f) { i_this->mAction = e_ba_class::ACT_ROOF; i_this->mMode = 0; @@ -507,6 +520,7 @@ static void e_ba_return(e_ba_class* i_this) { /* 8068039C-806806B4 00179C 0318+00 1/1 0/0 0/0 .text e_ba_path_fly__FP10e_ba_class */ static void e_ba_path_fly(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; dPnt* point; switch (i_this->mMode) { @@ -529,7 +543,7 @@ static void e_ba_path_fly(e_ba_class* i_this) { } int next_id = i_this->mpPath->m_nextID; if (next_id != 0xffff) { - i_this->mpPath = dPath_GetRoomPath(next_id, fopAcM_GetRoomNo(i_this)); + i_this->mpPath = dPath_GetRoomPath(next_id, fopAcM_GetRoomNo(a_this)); } } else { if (i_this->mPathPoint < 0) { @@ -550,35 +564,37 @@ static void e_ba_path_fly(e_ba_class* i_this) { break; case 3: - cXyz delta = i_this->mTargetPos - i_this->current.pos; + cXyz delta = i_this->mTargetPos - a_this->current.pos; if (delta.abs() < 200.0f) { i_this->mMode = 1; } break; } - cLib_addCalc2(&i_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); + cLib_addCalc2(&a_this->speedF, l_HIO.mFlySpeed, 1.0f, l_HIO.mFlySpeed * 0.3f); fly_move(i_this); } /* 806806B4-806808AC 001AB4 01F8+00 1/1 0/0 0/0 .text e_ba_chance__FP10e_ba_class */ static void e_ba_chance(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; + switch (i_this->mMode) { case 0: anm_init(i_this, e_ba_class::ANM_HOVERING, 2.0f, J3DFrameCtrl::EMode_LOOP, 1.5f); i_this->mMode = 1; i_this->mTimer[0] = cM_rndF(30.0f) + 100.0f; - i_this->speed.x = 0.0f; - i_this->speed.y = 0.0f; - i_this->speed.z = 0.0f; + a_this->speed.x = 0.0f; + a_this->speed.y = 0.0f; + a_this->speed.z = 0.0f; i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_BITE, -1); break; case 1: if (i_this->mAcch.ChkGroundHit()) { - i_this->speed.y = cM_rndF(10.0f) + 10.0f; - i_this->speed.x = cM_rndFX(10.0f); - i_this->speed.z = cM_rndFX(10.0f); + a_this->speed.y = cM_rndF(10.0f) + 10.0f; + a_this->speed.x = cM_rndFX(10.0f); + a_this->speed.z = cM_rndFX(10.0f); if ( cM_rndF(1.0f) < 0.5f) { i_this->mChanceAngle.z = 0; } else { @@ -586,13 +602,13 @@ static void e_ba_chance(e_ba_class* i_this) { } i_this->mChanceAngle.y = cM_rndF(0x10000); fopAcM_effSmokeSet1(&i_this->mSmokeKey1, &i_this->mSmokeKey2, - &i_this->current.pos, &i_this->shape_angle, 0.8f, - &i_this->tevStr, 1); + &a_this->current.pos, &a_this->shape_angle, 0.8f, + &a_this->tevStr, 1); i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_FAINT, -1); } if (i_this->mTimer[0] == 0) { - i_this->current.angle.z = 0; + a_this->current.angle.z = 0; i_this->mAction = e_ba_class::ACT_FIGHT; i_this->mMode = 0; return; @@ -600,14 +616,15 @@ static void e_ba_chance(e_ba_class* i_this) { break; } - i_this->current.pos += i_this->speed; - i_this->speed.y -= 2.0f; - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mChanceAngle.y, 2, 0x1000); - cLib_addCalcAngleS2(&i_this->current.angle.z, i_this->mChanceAngle.z, 2, 0x1000); + a_this->current.pos += a_this->speed; + a_this->speed.y -= 2.0f; + cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->mChanceAngle.y, 2, 0x1000); + cLib_addCalcAngleS2(&a_this->current.angle.z, i_this->mChanceAngle.z, 2, 0x1000); } /* 806808AC-80680AF4 001CAC 0248+00 1/1 0/0 0/0 .text e_ba_wolfbite__FP10e_ba_class */ static void e_ba_wolfbite(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); switch (i_this->mMode) { @@ -617,19 +634,19 @@ static void e_ba_wolfbite(e_ba_class* i_this) { break; case 1: - if (!player->checkWolfEnemyCatchOwn(i_this)) { + if (!player->checkWolfEnemyCatchOwn(a_this)) { if (player->checkWolfEnemyLeftThrow()) { - i_this->current.angle.y = player->shape_angle.y + 0x4000; + a_this->current.angle.y = player->shape_angle.y + 0x4000; } else { - i_this->current.angle.y = player->shape_angle.y - 0x4000; + a_this->current.angle.y = player->shape_angle.y - 0x4000; } - i_this->speedF = 40.0f; - i_this->speed.y = -20.0f; + a_this->speedF = 40.0f; + a_this->speed.y = -20.0f; i_this->mCreatureSound.startCreatureVoice(Z2SE_EN_BA_V_DEATH, -1); anm_init(i_this, e_ba_class::ANM_DEAD, 1.0f, J3DFrameCtrl::EMode_NONE, 1.0f); i_this->mTimer[0] = 60; i_this->mMode = 2; - i_this->health = 0; + a_this->health = 0; } break; @@ -643,8 +660,8 @@ static void e_ba_wolfbite(e_ba_class* i_this) { case 3: if (i_this->mTimer[0] == 0) { - ba_disappear(i_this); - fopAcM_delete(i_this); + ba_disappear(a_this); + fopAcM_delete(a_this); } break; } @@ -652,22 +669,23 @@ static void e_ba_wolfbite(e_ba_class* i_this) { cXyz vec1, vec2; vec1.x = 0.0f; vec1.y = 0.0f; - vec1.z = i_this->speedF; - mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); + vec1.z = a_this->speedF; + mDoMtx_YrotS(*calc_mtx, a_this->current.angle.y); MtxPosition(&vec1, &vec2); - i_this->speed.x = vec2.x; - i_this->speed.z = vec2.z; - i_this->current.pos += i_this->speed; - i_this->speed.y -= 4.0f; + a_this->speed.x = vec2.x; + a_this->speed.z = vec2.z; + a_this->current.pos += a_this->speed; + a_this->speed.y -= 4.0f; if (i_this->mAcch.ChkGroundHit()) { - cLib_addCalc0(&i_this->speedF, 1.0f, 15.0f); + cLib_addCalc0(&a_this->speedF, 1.0f, 15.0f); } } /* 80680AF4-80680C98 001EF4 01A4+00 1/1 0/0 0/0 .text e_ba_wind__FP10e_ba_class */ static void e_ba_wind(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; fopAc_ac_c* boomerang = (fopAc_ac_c*)fpcM_Search(shot_b_sub, i_this); - i_this->speedF = 0.0f; + a_this->speedF = 0.0f; switch (i_this->mMode) { case 0: @@ -684,7 +702,7 @@ static void e_ba_wind(e_ba_class* i_this) { i_this->mMode = 2; i_this->mTimer[0] = 60; } else { - i_this->current.pos = boomerang->current.pos + i_this->mWindOffset; + a_this->current.pos = boomerang->current.pos + i_this->mWindOffset; i_this->mCreatureSound.startCreatureVoiceLevel(Z2SE_EN_BA_V_SPIN, -1); } break; @@ -697,13 +715,14 @@ static void e_ba_wind(e_ba_class* i_this) { } } - i_this->current.angle.y += i_this->mWindSpinSpeed; - i_this->shape_angle.y = i_this->current.angle.y; - i_this->current.angle.z = 0; + a_this->current.angle.y += i_this->mWindSpinSpeed; + a_this->shape_angle.y = a_this->current.angle.y; + a_this->current.angle.z = 0; } /* 80680C98-80680DCC 002098 0134+00 1/1 0/0 0/0 .text e_ba_appear__FP10e_ba_class */ static void e_ba_appear(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; cXyz vec; i_this->mIFrames = 60; @@ -712,18 +731,18 @@ static void e_ba_appear(e_ba_class* i_this) { anm_init(i_this, e_ba_class::ANM_APPEAR, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f); i_this->mMode = 1; i_this->mTimer[0] = cM_rndF(20.0f) + 40.0f; - i_this->speedF = 30.0f; - mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); + a_this->speedF = 30.0f; + mDoMtx_YrotS(*calc_mtx, a_this->current.angle.y); vec.x = 0.0f; vec.y = 0.0f; vec.z = 100000.0f; MtxPosition(&vec, &i_this->mTargetPos); - i_this->mTargetPos += i_this->current.pos; + i_this->mTargetPos += a_this->current.pos; // fallthrough case 1: - cLib_addCalc0(&i_this->speedF, 1.0f, 0.7f); - if (i_this->mTimer[0] == 0 || i_this->speedF < 0.1f || i_this->mAcch.ChkWallHit()) { + cLib_addCalc0(&a_this->speedF, 1.0f, 0.7f); + if (i_this->mTimer[0] == 0 || a_this->speedF < 0.1f || i_this->mAcch.ChkWallHit()) { i_this->mAction = e_ba_class::ACT_FIGHT_FLY; i_this->mMode = 0; } @@ -734,12 +753,12 @@ static void e_ba_appear(e_ba_class* i_this) { } /* 80680DCC-80681128 0021CC 035C+00 2/1 0/0 0/0 .text action__FP10e_ba_class */ -// NONMATCHING problem with getting item to create static void action(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; cXyz vec1, vec2, vec3; - i_this->mPlayerAngleY = fopAcM_searchPlayerAngleY(i_this); - i_this->mPlayerDistanceXZ = fopAcM_searchPlayerDistanceXZ(i_this); - i_this->field_0x566 = 0; + i_this->mPlayerAngleY = fopAcM_searchPlayerAngleY(a_this); + i_this->mPlayerDistanceXZ = fopAcM_searchPlayerDistanceXZ(a_this); + a_this->field_0x566 = 0; damage_check(i_this); i_this->mSph.OffAtVsPlayerBit(); @@ -750,18 +769,18 @@ static void action(e_ba_class* i_this) { break; case e_ba_class::ACT_FIGHT_FLY: e_ba_fight_fly(i_this); - i_this->field_0x566 = 1; + a_this->field_0x566 = 1; link_search = true; break; case e_ba_class::ACT_FIGHT: e_ba_fight(i_this); - i_this->field_0x566 = 1; + a_this->field_0x566 = 1; link_search = true; break; case e_ba_class::ACT_ATTACK: e_ba_attack(i_this); i_this->mSph.OnAtVsPlayerBit(); - i_this->field_0x566 = 1; + a_this->field_0x566 = 1; link_search = true; break; case e_ba_class::ACT_RETURN: @@ -769,7 +788,7 @@ static void action(e_ba_class* i_this) { break; case e_ba_class::ACT_FLY: e_ba_fly(i_this); - i_this->field_0x566 = 1; + a_this->field_0x566 = 1; break; case e_ba_class::ACT_PATH_FLY: e_ba_path_fly(i_this); @@ -801,45 +820,46 @@ static void action(e_ba_class* i_this) { vec1.z = -i_this->mKnockbackSpeed; mDoMtx_YrotS(*calc_mtx, i_this->mKnockbackAngle); MtxPosition(&vec1, &vec2); - i_this->current.pos += vec2; + a_this->current.pos += vec2; cLib_addCalc0(&i_this->mKnockbackSpeed, 1.0f, 5.0f); if (i_this->mIsDying) { - i_this->shape_angle.y += 0x1300; - i_this->shape_angle.z += 0x1700; + a_this->shape_angle.y += 0x1300; + a_this->shape_angle.z += 0x1700; if (i_this->mKnockbackSpeed <= 1.0f || i_this->mAcch.ChkWallHit()) { - fopAcM_delete(i_this); + fopAcM_delete(a_this); if (i_this->mHomeType == e_ba_class::HOME_APPEAR) { // should be fpcNm_ITEM_HEART : fpcNm_ITEM_ARROW_10 but that gives incorrect code int item_no = dComIfGs_getLife() <= 4 ? 0 : 0xE; - fopAcM_createItem(&i_this->current.pos, item_no, -1, -1, NULL, NULL, 0); - fopAcM_createDisappear(i_this, &i_this->current.pos, 6, 0, 0xff); + fopAcM_createItem(&a_this->current.pos, item_no, -1, -1, NULL, NULL, 0); + fopAcM_createDisappear(a_this, &a_this->current.pos, 6, 0, 0xff); } else { - ba_disappear(i_this); + ba_disappear(a_this); } } } } else { if (i_this->mAction != e_ba_class::ACT_WIND) { - cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 4, 0x2000); - cLib_addCalcAngleS2(&i_this->shape_angle.x, 0, 4, 0x2000); - cLib_addCalcAngleS2(&i_this->shape_angle.z, i_this->current.angle.z, 4, 0x2000); + cLib_addCalcAngleS2(&a_this->shape_angle.y, a_this->current.angle.y, 4, 0x2000); + cLib_addCalcAngleS2(&a_this->shape_angle.x, 0, 4, 0x2000); + cLib_addCalcAngleS2(&a_this->shape_angle.z, a_this->current.angle.z, 4, 0x2000); } } - i_this->current.pos.y -= 30.0f; - i_this->old.pos.y -= 30.0f; + a_this->current.pos.y -= 30.0f; + a_this->old.pos.y -= 30.0f; i_this->mAcch.CrrPos(dComIfG_Bgsp()); - i_this->current.pos.y += 30.0f; - i_this->old.pos.y += 30.0f; + a_this->current.pos.y += 30.0f; + a_this->old.pos.y += 30.0f; vec3.x = 0.5f; vec3.y = 0.5f; vec3.z = 0.5f; - setMidnaBindEffect(i_this, &i_this->mCreatureSound, &i_this->eyePos, &vec3); + setMidnaBindEffect(a_this, &i_this->mCreatureSound, &a_this->eyePos, &vec3); } /* 80681128-80681734 002528 060C+00 2/1 0/0 0/0 .text daE_BA_Execute__FP10e_ba_class */ static int daE_BA_Execute(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; daPy_py_c* player = static_cast(dComIfGp_getPlayer(0)); i_this->mCounter++; @@ -854,7 +874,7 @@ static int daE_BA_Execute(e_ba_class* i_this) { action(i_this); - i_this->mpMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + i_this->mpMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(a_this))); if ((i_this->mAnm == e_ba_class::ANM_HOVERING || i_this->mAnm == e_ba_class::ANM_FLY)) { if (i_this->mpMorf->checkFrame(4.0f)) { @@ -872,23 +892,23 @@ static int daE_BA_Execute(e_ba_class* i_this) { J3DModel* model = i_this->mpMorf->getModel(); if (i_this->mAction == e_ba_class::ACT_WOLFBITE && i_this->mMode < 2) { - fopAcM_OffStatus(i_this, 0); - i_this->attention_info.flags = 0; + fopAcM_OffStatus(a_this, 0); + a_this->attention_info.flags = 0; MTXCopy(daPy_getLinkPlayerActorClass()->getWolfMouthMatrix(), mDoMtx_stack_c::get()); model->setBaseTRMtx(mDoMtx_stack_c::get()); - mDoMtx_stack_c::multVecZero(&i_this->current.pos); + mDoMtx_stack_c::multVecZero(&a_this->current.pos); } else { - if (i_this->health > 0 && !i_this->mIsDying - && player->current.pos.y < i_this->current.pos.y) { - fopAcM_OnStatus(i_this, 0); - i_this->attention_info.flags = 4; + if (a_this->health > 0 && !i_this->mIsDying + && player->current.pos.y < a_this->current.pos.y) { + fopAcM_OnStatus(a_this, 0); + a_this->attention_info.flags = 4; } else { - fopAcM_OffStatus(i_this, 0); - i_this->attention_info.flags = 0; + fopAcM_OffStatus(a_this, 0); + a_this->attention_info.flags = 0; } - mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); - mDoMtx_stack_c::YrotM(i_this->shape_angle.y); - mDoMtx_stack_c::ZrotM(i_this->shape_angle.z); + mDoMtx_stack_c::transS(a_this->current.pos.x, a_this->current.pos.y, a_this->current.pos.z); + mDoMtx_stack_c::YrotM(a_this->shape_angle.y); + mDoMtx_stack_c::ZrotM(a_this->shape_angle.z); mDoMtx_stack_c::scaleM(l_HIO.mScale, l_HIO.mScale, l_HIO.mScale); model->setBaseTRMtx(mDoMtx_stack_c::get()); } @@ -898,9 +918,9 @@ static int daE_BA_Execute(e_ba_class* i_this) { cXyz zero; zero.set(0.0f, 0.0f, 0.0f); - MtxPosition(&zero, &i_this->eyePos); - i_this->attention_info.position = i_this->eyePos; - i_this->attention_info.position.y += 20.0f; + MtxPosition(&zero, &a_this->eyePos); + a_this->attention_info.position = a_this->eyePos; + a_this->attention_info.position.y += 20.0f; cXyz center; zero.set(0.0f, 0.0f, 0.0f); @@ -913,7 +933,7 @@ static int daE_BA_Execute(e_ba_class* i_this) { dComIfG_Ccsp()->Set(&i_this->mSph); if (i_this->mType != e_ba_class::TYPE_NORMAL) { - i_this->field_0x6b0 = i_this->current.pos - i_this->old.pos; + i_this->field_0x6b0 = a_this->current.pos - a_this->old.pos; i_this->field_0x6b0 *= 0.6f; if (i_this->mType == e_ba_class::TYPE_FIRE) { static u16 fire_name[4] = {0x8216, 0x8217, 0x8218, 0x8219}; @@ -921,7 +941,7 @@ static int daE_BA_Execute(e_ba_class* i_this) { for (int i = 0; i < 4; i++) { i_this->mParticleKey[i] = dComIfGp_particle_set(i_this->mParticleKey[i], fire_name[i], - &i_this->current.pos, NULL, NULL); + &a_this->current.pos, NULL, NULL); JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleKey[i]); if (emitter != NULL) { emitter->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(18)); @@ -936,7 +956,7 @@ static int daE_BA_Execute(e_ba_class* i_this) { for (int i = 0; i < 3; i++) { i_this->mParticleKey[i] = dComIfGp_particle_set(i_this->mParticleKey[i], ice_name[i], - &i_this->current.pos, NULL, NULL); + &a_this->current.pos, NULL, NULL); JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(i_this->mParticleKey[i]); if (emitter != NULL) { emitter->setGlobalSRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(18)); @@ -947,22 +967,23 @@ static int daE_BA_Execute(e_ba_class* i_this) { } } - i_this->attention_info.flags |= 0x200000; + a_this->attention_info.flags |= 0x200000; return 1; } /* 80681734-8068173C 002B34 0008+00 1/0 0/0 0/0 .text daE_BA_IsDelete__FP10e_ba_class */ static int daE_BA_IsDelete(e_ba_class* i_this) { - return true; + return 1; } /* 8068173C-806817A0 002B3C 0064+00 1/0 0/0 0/0 .text daE_BA_Delete__FP10e_ba_class */ static int daE_BA_Delete(e_ba_class* i_this) { + fopEn_enemy_c* a_this = &i_this->mEnemy; dComIfG_resDelete(&i_this->mPhase, i_this->mArcName); if (i_this->mHIOInit) { hioInit = false; } - if (i_this->heap != NULL) { + if (a_this->heap != NULL) { i_this->mpMorf->stopZelAnime(); } return 1; @@ -970,7 +991,7 @@ static int daE_BA_Delete(e_ba_class* i_this) { /* 806817A0-80681890 002BA0 00F0+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ static int useHeapInit(fopAc_ac_c* i_this) { - e_ba_class* _this = static_cast(i_this); + e_ba_class* _this = (e_ba_class*)i_this; _this->mpMorf = new mDoExt_McaMorfSO( static_cast(dComIfG_getObjectRes(_this->mArcName, 13)), NULL, NULL, static_cast(dComIfG_getObjectRes(_this->mArcName, 10)), @@ -999,7 +1020,7 @@ static cPhs__Step daE_BA_Create(fopAc_ac_c* i_this) { }; fopAcM_SetupActor(i_this, e_ba_class); - e_ba_class* _this = static_cast(i_this); + e_ba_class* _this = (e_ba_class*)i_this; _this->mType = (fopAcM_GetParam(_this) & 0xf000) >> 12; if (_this->mType > 2) { @@ -1011,7 +1032,7 @@ static cPhs__Step daE_BA_Create(fopAc_ac_c* i_this) { if (step == cPhs_COMPLEATE_e) { int sw = fopAcM_GetParam(_this) >> 24; - if (sw != 0xff && dComIfGs_isSwitch(sw, fopAcM_GetRoomNo(_this))) { + if (sw != 0xff && dComIfGs_isSwitch(sw, fopAcM_GetRoomNo(i_this))) { return cPhs_ERROR_e; } @@ -1030,12 +1051,12 @@ static cPhs__Step daE_BA_Create(fopAc_ac_c* i_this) { _this->mFightFlyDistance = 100000.0f; } - if (!fopAcM_entrySolidHeap(_this, useHeapInit, 0x2000)) { + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x2000)) { return cPhs_ERROR_e; } if (_this->mPathIndex != 0xff) { - _this->mpPath = dPath_GetRoomPath(_this->mPathIndex, fopAcM_GetRoomNo(_this)); + _this->mpPath = dPath_GetRoomPath(_this->mPathIndex, fopAcM_GetRoomNo(i_this)); if (_this->mpPath == NULL) { return cPhs_ERROR_e; } @@ -1057,14 +1078,14 @@ static cPhs__Step daE_BA_Create(fopAc_ac_c* i_this) { l_HIO.field_0x04 = -1; } - _this->attention_info.flags = 4; - fopAcM_SetMtx(_this, _this->mpMorf->getModel()->getBaseTRMtx()); - fopAcM_SetMin(_this, -200.0f, -200.0f, -200.0f); - fopAcM_SetMax(_this, 200.0f, 200.0f, 200.0f); - _this->health = 1; - _this->field_0x560 = 1; + i_this->attention_info.flags = 4; + fopAcM_SetMtx(i_this, _this->mpMorf->getModel()->getBaseTRMtx()); + fopAcM_SetMin(i_this, -200.0f, -200.0f, -200.0f); + fopAcM_SetMax(i_this, 200.0f, 200.0f, 200.0f); + i_this->health = 1; + i_this->field_0x560 = 1; - _this->mStts.Init(30, 0, _this); + _this->mStts.Init(30, 0, i_this); _this->mSph.Set(cc_sph_src); _this->mSph.SetStts(&_this->mStts); if (_this->mType == e_ba_class::TYPE_FIRE) { @@ -1075,11 +1096,11 @@ static cPhs__Step daE_BA_Create(fopAc_ac_c* i_this) { _this->mSph.SetAtMtrl(dCcD_MTRL_ICE); } - _this->mAcch.Set(fopAcM_GetPosition_p(_this), fopAcM_GetOldPosition_p(_this), _this, - 1, &_this->mAcchCir, fopAcM_GetSpeed_p(_this), NULL, NULL); + _this->mAcch.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, + 1, &_this->mAcchCir, fopAcM_GetSpeed_p(i_this), NULL, NULL); _this->mAcchCir.SetWall(50.0f, 50.0f); - _this->mCreatureSound.init(&_this->current.pos, &_this->eyePos, 3, 1); + _this->mCreatureSound.init(&i_this->current.pos, &i_this->eyePos, 3, 1); _this->mCreatureSound.setEnemyName("E_ba"); _this->mAtInfo.mpSound = &_this->mCreatureSound; _this->mAtInfo.mPowerType = 1; diff --git a/src/d/d_a_itembase_static.cpp b/src/d/d_a_itembase_static.cpp index 48a9bc6ecd9..49ec0a72422 100644 --- a/src/d/d_a_itembase_static.cpp +++ b/src/d/d_a_itembase_static.cpp @@ -36,8 +36,8 @@ void daItemBase_c::dead() { cLib_onBit(field_0x92b, 2); } -u8 daItemBase_c::chkDead() { - return cLib_checkBit(field_0x92b, 2) != 0; +bool daItemBase_c::chkDead() { + return cLib_checkBit(field_0x92b, 2); } /* 80037B0C-80037B78 03244C 006C+00 0/0 0/0 1/1 .text CheckItemCreateHeap__FP10fopAc_ac_c @@ -84,4 +84,4 @@ const daItemBase_data daItemBase_c::m_data = { -6.0f, // mGetDemoGravity 13, // mSimpleExistTime 10, // mNoGetTime -}; \ No newline at end of file +};