From 15463d89bf44c73f613e7a72d535c3bb50663a36 Mon Sep 17 00:00:00 2001 From: Carco_21 <144170194+carter-ktb21@users.noreply.github.com> Date: Tue, 20 May 2025 13:47:48 -0400 Subject: [PATCH] Very small d_a_e_mk work and d_a_b_bq fix (#2451) * Started work on d_a_e_mk * demo work * All functions worked on * PR cleanup * Added some fopAc_ac_c casting - Almost equivalent * Implemented no inheritance and fixed demo_camera_start regression * PR cleanup * fixed demo_camera_end switch cases & fixed bug in d_a_b_bq * fixed demo_camera_end switch cases & fixed bug in d_a_b_bq * Remove unnecessary semicolon --------- Co-authored-by: hatal175 --- include/d/actor/d_a_b_bq.h | 2 +- include/d/actor/d_a_e_mk.h | 2 +- src/d/actor/d_a_e_mk.cpp | 93 +++++++++++++++++++------------------- 3 files changed, 49 insertions(+), 48 deletions(-) diff --git a/include/d/actor/d_a_b_bq.h b/include/d/actor/d_a_b_bq.h index c9ea4ae7fdd..6eea070ba7b 100644 --- a/include/d/actor/d_a_b_bq.h +++ b/include/d/actor/d_a_b_bq.h @@ -123,7 +123,7 @@ STATIC_ASSERT(sizeof(b_bq_class) == 0x13A0); class daB_BQ_HIO_c { public: /* 805B356C */ daB_BQ_HIO_c(); - /* 805B9FFC */ virtual ~daB_BQ_HIO_c(); + /* 805B9FFC */ virtual ~daB_BQ_HIO_c() {} /* 0x04 */ s8 field_0x4; /* 0x08 */ f32 mModelSize; diff --git a/include/d/actor/d_a_e_mk.h b/include/d/actor/d_a_e_mk.h index 2fdb4e9cda7..a708961be91 100644 --- a/include/d/actor/d_a_e_mk.h +++ b/include/d/actor/d_a_e_mk.h @@ -35,7 +35,7 @@ public: /* 0x000 */ fopEn_enemy_c enemy; /* 0x5AC */ request_of_phase_process_class mPhase; /* 0x5B4 */ s16 mMode; - /* 0x5B6 */ u8 field_0x5b6; + /* 0x5B6 */ u8 mParam; /* 0x5B7 */ u8 field_0x5b7; /* 0x5B8 */ cXyz field_0x5b8; /* 0x5C4 */ u8 field_0x5c4[0x5c8 - 0x5c4]; diff --git a/src/d/actor/d_a_e_mk.cpp b/src/d/actor/d_a_e_mk.cpp index ac0d67bd778..5a062d19753 100644 --- a/src/d/actor/d_a_e_mk.cpp +++ b/src/d/actor/d_a_e_mk.cpp @@ -46,17 +46,17 @@ static void ok_anm_init(e_mk_class* i_this, int i_index, f32 i_morf, u8 i_mode, /* 807142D0-80714498 000290 01C8+00 1/0 0/0 0/0 .text daE_MK_Draw__FP10e_mk_class */ static int daE_MK_Draw(e_mk_class* i_this) { - J3DModel* model = i_this->mpModelMorf->getModel(); + J3DModel* model_p = i_this->mpModelMorf->getModel(); g_env_light.settingTevStruct(0, &i_this->enemy.current.pos, &i_this->enemy.tevStr); - g_env_light.setLightTevColorType_MAJI(model, &i_this->enemy.tevStr); - J3DModelData* modelData = model->getModelData(); - i_this->mBtp->entry(modelData); + g_env_light.setLightTevColorType_MAJI(model_p, &i_this->enemy.tevStr); + J3DModelData* i_modelData = model_p->getModelData(); + i_this->mBtp->entry(i_modelData); i_this->mpModelMorf->entryDL(); cXyz sp38; if (i_this->field_0x6f8 != 0) { sp38.set(i_this->enemy.current.pos.x, i_this->enemy.current.pos.y + 50.0f, i_this->enemy.current.pos.z); - i_this->mShadowKey1 = dComIfGd_setShadow(i_this->mShadowKey1, 1, model, &sp38, + i_this->mShadowKey1 = dComIfGd_setShadow(i_this->mShadowKey1, 1, model_p, &sp38, 1200.0f, 0.0f, i_this->enemy.current.pos.y, i_this->mAcch.GetGroundH(), i_this->mAcch.m_gnd, &i_this->enemy.tevStr, 0, 1.0f, @@ -64,8 +64,8 @@ static int daE_MK_Draw(e_mk_class* i_this) { } if (i_this->field_0x60c != 0) { - model = i_this->mpCrownModelMorf->getModel(); - g_env_light.setLightTevColorType_MAJI(model, &i_this->enemy.tevStr); + model_p = i_this->mpCrownModelMorf->getModel(); + g_env_light.setLightTevColorType_MAJI(model_p, &i_this->enemy.tevStr); i_this->mpCrownModelMorf->entryDL(); if (i_this->field_0x5e0 != 0) { sp38.set(i_this->field_0x5e4.x, i_this->enemy.current.pos.y + 50.0f, i_this->field_0x5e4.z); @@ -152,8 +152,8 @@ static daPillar_c* search_hasira(e_mk_class* i_this) { f32 fVar1 = 1500.0f; if (target_info_count != 0) { cXyz sp44; - daPillar_c *pPillar; - daPillar_c *rv = NULL; + daPillar_c* pPillar; + daPillar_c* rv = NULL; int iVar1 = 0; int i = 0; while (i < target_info_count) { @@ -212,7 +212,7 @@ static e_db_class* search_db(e_mk_class* i_this) { f32 fVar1 = 2000.0f; if (target_info_count != 0) { cXyz sp44; - e_db_class *pDekuBaba; + e_db_class* pDekuBaba; int i = 0; while (i < target_info_count) { pDekuBaba = (e_db_class*)target_info[i]; @@ -436,8 +436,8 @@ static void e_mk_wait(e_mk_class* i_this) { static void e_mk_shoot(e_mk_class* i_this) { cXyz sp48; int frame = i_this->mpModelMorf->getFrame(); - fopAc_ac_c *actor = fopAcM_SearchByID(i_this->field_0x708); - daPillar_c *pPillar = i_this->mHasira; + fopAc_ac_c* actor = fopAcM_SearchByID(i_this->field_0x708); + daPillar_c* pHasira = i_this->mHasira; s8 bVar5 = 0; switch(i_this->mMode) { case 0: @@ -559,7 +559,7 @@ static void e_mk_shoot(e_mk_class* i_this) { } } - if ((pPillar != NULL) && pPillar->checkRollAttack()) { + if ((pHasira != NULL) && pHasira->checkRollAttack()) { i_this->mAction = e_mk_class::ACT_YORO; i_this->mMode = 0; if (i_this->field_0x60d != 0) { @@ -733,7 +733,7 @@ static void e_mk_damage(e_mk_class* i_this) { /* 807161F8-8071637C 0021B8 0184+00 1/1 0/0 0/0 .text damage_check__FP10e_mk_class */ static void damage_check(e_mk_class* i_this) { - daPy_py_c *player = (daPy_py_c*)dComIfGp_getPlayer(0); + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); if (i_this->field_0x704 == 0) { i_this->field_0x95c.Move(); if (i_this->mAction >= 9) { @@ -935,7 +935,7 @@ static int e_mk_e_demo(e_mk_class* i_this) { i_this->field_0x6fc[0] = 40; cVar6 = 60; target_info_count = 0; - fpcM_Search(s_h_sub,i_this); + fpcM_Search(s_h_sub, i_this); static_cast(target_info[8])->setShake(1); } } @@ -1196,10 +1196,10 @@ static void demo_camera_start(e_mk_class* i_this) { // EQUIVALENT - REGALLOC fopAc_ac_c* a_this = &i_this->enemy; fopAc_ac_c* actor1, * actor2, * actor3; - daPy_py_c *player = (daPy_py_c*)dComIfGp_getPlayer(0); + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); actor1 = fopAcM_SearchByID(i_this->field_0x708); - camera_class *camera1 = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); - camera_class *camera2 = dComIfGp_getCamera(0); + camera_class* camera1 = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + camera_class* camera2 = dComIfGp_getCamera(0); cXyz sp34, sp40, sp4c, sp58; switch (i_this->mDemoMode) { @@ -1456,9 +1456,9 @@ static void demo_camera_start(e_mk_class* i_this) { } if (dComIfGp_getEvent().checkSkipEdge()) { - u8 uVar1 = fopAcM_GetParam(i_this) >> 16; - if (uVar1 != 0xff) { - dComIfGs_onSwitch(uVar1, fopAcM_GetRoomNo(a_this)); + u8 i_no = fopAcM_GetParam(i_this) >> 16; + if (i_no != 0xff) { + dComIfGs_onSwitch(i_no, fopAcM_GetRoomNo(a_this)); } dStage_changeScene(2, 0.0f, 0, fopAcM_GetRoomNo(a_this), 0, -1); @@ -1856,10 +1856,11 @@ static void demo_camera_end(e_mk_class* i_this) { fopAcM_delete(static_cast(target_info[0])); fopAcM_delete(static_cast(target_info[7])); } + break; case 0: case 100: - return; + break; } } @@ -1893,7 +1894,7 @@ static void* s_brg_sub2(void* i_actor, void* i_data) { /* 80719594-8071A06C 005554 0AD8+00 1/1 0/0 0/0 .text demo_camera_r04__FP10e_mk_class */ static void demo_camera_r04(e_mk_class* i_this) { - u8 uVar1; + u8 i_no; fopAc_ac_c* a_this = (fopAc_ac_c*)i_this; daPy_py_c* player = (daPy_py_c *)dComIfGp_getPlayer(0); fopAc_ac_c* actor = fopAcM_SearchByID(i_this->field_0x708); @@ -2143,12 +2144,12 @@ static void demo_camera_r04(e_mk_class* i_this) { dComIfGp_event_reset(); daPy_getPlayerActorClass()->cancelOriginalDemo(); fopAcM_delete(a_this); - uVar1 = fopAcM_GetParam(i_this) >> 16; - if (uVar1 == 0xFF) { + i_no = fopAcM_GetParam(i_this) >> 16; + if (i_no == 0xFF) { return; } - dComIfGs_onSwitch(uVar1, fopAcM_GetRoomNo(a_this)); + dComIfGs_onSwitch(i_no, fopAcM_GetRoomNo(a_this)); return; case 0: @@ -2160,7 +2161,7 @@ static void demo_camera_r04(e_mk_class* i_this) { /* 8071A06C-8071A22C 00602C 01C0+00 1/1 0/0 0/0 .text demo_camera_bohit__FP10e_mk_class */ static void demo_camera_bohit(e_mk_class* i_this) { - camera_class *camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); cXyz sp20; switch (i_this->mDemoMode) { @@ -2213,7 +2214,7 @@ static void demo_camera_bohit(e_mk_class* i_this) { /* 8071A22C-8071A538 0061EC 030C+00 2/1 0/0 0/0 .text demo_camera__FP10e_mk_class */ static void demo_camera(e_mk_class* i_this) { - camera_class *camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); cXyz sp34, sp40; switch (i_this->field_0xc30) { @@ -2228,7 +2229,7 @@ static void demo_camera(e_mk_class* i_this) { case 3: demo_camera_r04(i_this); if (dComIfGp_getEvent().checkSkipEdge()) { - npc_ks_class *i_actor = (npc_ks_class*)fpcM_Search(s_ks_sub, i_this); + npc_ks_class* i_actor = (npc_ks_class*)fpcM_Search(s_ks_sub, i_this); if (i_actor != NULL) { u8 i_no = fopAcM_GetParam(i_this) >> 16; if (i_no != 0xFF) { @@ -2470,7 +2471,7 @@ static void anm_se_set(e_mk_class* i_this) { for (int i = 0; i < 2; i++) { i_this->field_0xc18[i] = dComIfGp_particle_set(i_this->field_0xc18[i], bo_eno_1[i], &i_this->enemy.current.pos, NULL, 0); - JPABaseEmitter *pEmitter1 = dComIfGp_particle_getEmitter(i_this->field_0xc18[i]); + JPABaseEmitter* pEmitter1 = dComIfGp_particle_getEmitter(i_this->field_0xc18[i]); if (pEmitter1 != NULL) { pEmitter1->setGlobalSRTMatrix(i_this->mpBoomerangModel->getBaseTRMtx()); } @@ -2481,7 +2482,7 @@ static void anm_se_set(e_mk_class* i_this) { for (int i = 0; i < 4; i++) { i_this->field_0xc20[i] = dComIfGp_particle_set(i_this->field_0xc20[i], bo_eno_0[i], &i_this->enemy.eyePos, NULL, 0); - JPABaseEmitter *pEmitter2 = dComIfGp_particle_getEmitter(i_this->field_0xc20[i]); + JPABaseEmitter* pEmitter2 = dComIfGp_particle_getEmitter(i_this->field_0xc20[i]); if (pEmitter2 != NULL) { if (i == 0) { pEmitter2->setGlobalSRTMatrix(i_this->mpModelMorf->getModel()->getAnmMtx(22)); @@ -2541,7 +2542,7 @@ static int daE_MK_Execute(e_mk_class* i_this) { mDoMtx_stack_c::XrotM(i_this->enemy.shape_angle.x); mDoMtx_stack_c::scaleM(l_HIO.mSize, l_HIO.mSize, l_HIO.mSize); - J3DModel *model = i_this->mpModelMorf->getModel(); + J3DModel* model = i_this->mpModelMorf->getModel(); model->setBaseTRMtx(mDoMtx_stack_c::get()); i_this->mpModelMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(&i_this->enemy))); @@ -2712,7 +2713,7 @@ static int daE_MK_Delete(e_mk_class* i_this) { /* 8071BA34-8071BCCC 0079F4 0298+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ static int useHeapInit(fopAc_ac_c* actor) { - e_mk_class *i_this = (e_mk_class*)actor; + e_mk_class* i_this = (e_mk_class*)actor; i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_mk", 48), NULL, NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_mk", 40), 0, 1.0f, 0, -1, &i_this->mSound, 0x80000, 0x11020084); @@ -2736,9 +2737,9 @@ static int useHeapInit(fopAc_ac_c* actor) { return 0; } - J3DModelData *modelData = (J3DModelData *)dComIfG_getObjectRes("E_mk", 46); - JUT_ASSERT(4743, modelData != 0); - i_this->mpBoomerangModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + J3DModelData* i_modelData = (J3DModelData*)dComIfG_getObjectRes("E_mk", 46); + JUT_ASSERT(4743, i_modelData != 0); + i_this->mpBoomerangModel = mDoExt_J3DModel__create(i_modelData, 0x80000, 0x11000084); if (i_this->mpBoomerangModel == NULL) { return 0; } @@ -2773,15 +2774,15 @@ static int daE_MK_Create(fopAc_ac_c* actor) { return cPhs_ERROR_e; } - u32 uVar1 = fopAcM_GetParam(i_this) >> 24; - if (uVar1 != 0xFF) { - if (dComIfGs_isSwitch(uVar1, fopAcM_GetRoomNo(a_this))) { + u32 i_no = fopAcM_GetParam(i_this) >> 24; + if (i_no != 0xFF) { + if (dComIfGs_isSwitch(i_no, fopAcM_GetRoomNo(a_this))) { OS_REPORT("E_MK やられ後なので再セットしません\n"); // Since it's after the E_MK was done, I won't reset it. return cPhs_ERROR_e; } } - i_this->field_0x5b6 = fopAcM_GetParam(i_this); + i_this->mParam = fopAcM_GetParam(i_this); OS_REPORT("E_MK//////////////E_MK SET 1 !!\n"); if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x56f0)) { @@ -2832,21 +2833,21 @@ static int daE_MK_Create(fopAc_ac_c* actor) { STAGE_CENTER_POS.y -= 500.0f; STAGE_ANGLE_Y = a_this->home.angle.y; - u8 uVar2 = fopAcM_GetParamBit(i_this, 16, 8); - if (uVar2 != 0xFF && dComIfGs_isSwitch(uVar2, fopAcM_GetRoomNo(a_this))) { - dComIfGs_offSwitch(uVar2, fopAcM_GetRoomNo(a_this)); + u8 i_no = fopAcM_GetParamBit(i_this, 16, 8); + if (i_no != 0xFF && dComIfGs_isSwitch(i_no, fopAcM_GetRoomNo(a_this))) { + dComIfGs_offSwitch(i_no, fopAcM_GetRoomNo(a_this)); i_this->mAction = e_mk_class::ACT_WAIT; Z2GetAudioMgr()->subBgmStart(Z2BGM_BOOMERAMG_MONKEY); } else { i_this->mAction = e_mk_class::ACT_S_DEMO; - u32 uVar3 = fopAcM_GetParam(i_this) & 0xFF000000 | 0xFFFF01; + u32 i_parameters = fopAcM_GetParam(i_this) & 0xFF000000 | 0xFFFF01; cXyz sp30(-21.0f, 5114.0f, -4941.0f); - i_this->mBabaChildID = fopAcM_createChild(PROC_E_DB, fopAcM_GetID(i_this), uVar3, + i_this->mBabaChildID = fopAcM_createChild(PROC_E_DB, fopAcM_GetID(i_this), i_parameters, &sp30, fopAcM_GetRoomNo(a_this), NULL, NULL, -1, NULL); sp30.set(-10.0f, 5114.0f, -4401.0f); - i_this->mBabaChildID2 = fopAcM_createChild(PROC_E_DB, fopAcM_GetID(i_this), uVar3, + i_this->mBabaChildID2 = fopAcM_createChild(PROC_E_DB, fopAcM_GetID(i_this), i_parameters, &sp30, fopAcM_GetRoomNo(a_this), NULL, NULL, -1, NULL);