diff --git a/src/d/actor/d_a_fganon.cpp b/src/d/actor/d_a_fganon.cpp index 0cedac3e6..88a810b7a 100644 --- a/src/d/actor/d_a_fganon.cpp +++ b/src/d/actor/d_a_fganon.cpp @@ -54,7 +54,7 @@ daFganon_HIO_c::daFganon_HIO_c() { } /* 000001A0-000002C8 .text anm_init__FP12fganon_classifUcfi */ -void anm_init(fganon_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { +void anm_init(fganon_class* i_this, int bckFileIdx, f32 morf, u8 loopMode, f32 speed, int soundFileIdx) { if (soundFileIdx >= 0) { void* soundAnm = dComIfG_getObjectRes("Fganon", soundFileIdx); J3DAnmTransform* bckAnm = (J3DAnmTransform*)dComIfG_getObjectRes("Fganon", bckFileIdx); @@ -181,7 +181,7 @@ void fly_se_set(fganon_class* i_this) { } /* 00000C14-00001170 .text fly__FP12fganon_class */ -void fly(fganon_class* i_this) { +void fly(fganon_class* i_this) { fopAc_ac_c* a_this = (fopAc_ac_c*)i_this; fopAc_ac_c* player = (fopAc_ac_c*)dComIfGp_getPlayer(0); dBgS_LinChk linChk; @@ -247,15 +247,16 @@ void fly(fganon_class* i_this) { } /* 000015A8-00001BD0 .text shot__FP12fganon_class */ -void shot(fganon_class* i_this) { - cLib_addCalcAngleS2(&i_this->shape_angle.y, fopAcM_searchPlayerAngleY(i_this), 10, 0x400); +void shot(fganon_class* i_this) { + fopAc_ac_c* actor = i_this; + cLib_addCalcAngleS2(&i_this->shape_angle.y, fopAcM_searchPlayerAngleY(actor), 10, 0x400); switch(i_this->mMode) { case 0: { if (!i_this->m408) { anm_init(i_this, FGANON_BCK_TAME1, 10.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mMode++; i_this->m3A4[0] = 40; - fopAcM_monsSeStart(i_this, JA_SE_CV_PG_EBALL_MAKE_S, 0); + fopAcM_monsSeStart(actor, JA_SE_CV_PG_EBALL_MAKE_S, 0); // Fall-through } else { break; @@ -266,13 +267,13 @@ void shot(fganon_class* i_this) { i_this->m408 = 1; } if (i_this->m3A4[0] < 30) { - fopAcM_seStart(i_this, JA_SE_CM_PG_EBALL_MAKING_S, 0); + fopAcM_seStart(actor, JA_SE_CM_PG_EBALL_MAKING_S, 0); } if (i_this->m3A4[0] == 0) { anm_init(i_this, FGANON_BCK_NAGERU1, 3.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); i_this->mMode++; - fopAcM_monsSeStart(i_this, JA_SE_CV_PG_EBALL_FIRE_S, 0); - mDoAud_seStart(JA_SE_CM_PG_EBALL_FIRE_S, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_monsSeStart(actor, JA_SE_CV_PG_EBALL_FIRE_S, 0); + fopAcM_seStart(actor, JA_SE_CM_PG_EBALL_FIRE_S, 0); } break; } @@ -283,7 +284,7 @@ void shot(fganon_class* i_this) { i_this->m688 = 0; i_this->m687 = 0; i_this->m689 = 0; - } + } if (i_this->mpMorf->isStop()) { anm_init(i_this, FGANON_BCK_WAIT1, 3.0f, J3DFrameCtrl::EMode_LOOP, 1.0f, -1); i_this->mMode++; @@ -292,7 +293,7 @@ void shot(fganon_class* i_this) { } case 3: { if (i_this->m408 == 5) { - cXyz local_34 = i_this->m3E0 - i_this->eyePos; + cXyz local_34 = i_this->m3E0 - actor->eyePos; if (local_34.abs() < REG0_F(1) + (i_this->m404 * (REG0_F(0) + 10.0f) + 400.0f)) { if (i_this->m689 == 0) { if (cM_rndF(1.0f) < 0.5f) { @@ -302,8 +303,8 @@ void shot(fganon_class* i_this) { anm_init(i_this, FGANON_BCK_TENNISRL1, 0.0f, J3DFrameCtrl::EMode_NONE, 1.0f, -1); } i_this->mMode++; - fopAcM_monsSeStart(i_this, JA_SE_CV_PG_REFLECT_EBALL, 0); - mDoAud_seStart(JA_SE_CM_PG_SWING_S, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_monsSeStart(actor, JA_SE_CV_PG_REFLECT_EBALL, 0); + fopAcM_seStart(actor, JA_SE_CM_PG_SWING_S, 0); i_this->m687++; if ((i_this->m688 >= 7) || ((i_this->m687 >= 4) && (cM_rndF(1.0f) < 0.3f))) { i_this->m689 = 1; @@ -330,7 +331,7 @@ void shot(fganon_class* i_this) { // Fall-through } } - cLib_addCalc0(&i_this->speedF, 1.0f, REG0_F(14) + 1.0f); + cLib_addCalc0(&actor->speedF, 1.0f, REG0_F(14) + 1.0f); pos_move(i_this, 0); fly_se_set(i_this); if ((i_this->mMode >= 2) && (i_this->m408 == 0)) { @@ -338,7 +339,7 @@ void shot(fganon_class* i_this) { i_this->mMode = 0; } if ((i_this->mMode == 3) || (i_this->mMode == 4)) { - mDoAud_monsSeStart(JA_SE_OBJ_PG_EBALL_FLY_S, &i_this->m3E0, 100, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + mDoAud_monsSeStart(JA_SE_OBJ_PG_EBALL_FLY_S, &i_this->m3E0, 100, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } } @@ -567,6 +568,8 @@ void mahou_set(fganon_class* i_this) { /* 00002A38-000030C4 .text shot2__FP12fganon_class */ void shot2(fganon_class* i_this) { + fopAc_ac_c* actor = i_this; + cLib_addCalcAngleS2(&i_this->shape_angle.y, fopAcM_searchPlayerAngleY(i_this), 10, 0x400); int mFrame = i_this->mpMorf->mFrameCtrl.getFrame(); switch(i_this->mMode) { @@ -623,7 +626,7 @@ void shot2(fganon_class* i_this) { case 3: { if (mFrame == REG8_S(5) + 15) { fopAcM_monsSeStart(i_this, JA_SE_CV_PG_EBALL_FIRE_L, 0); - mDoAud_seStart(JA_SE_CM_PG_EBALL_FIRE_L, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_seStart(actor, JA_SE_CM_PG_EBALL_FIRE_L, 0); } if (mFrame >= REG8_S(5) + 15) { cLib_addCalc2(&i_this->m680, REG8_F(6) + 250.0f, 1.0f, REG8_F(7) + 50.0f); @@ -1044,7 +1047,7 @@ void fail(fganon_class* i_this) { } break; } - default: + default: break; } } @@ -1245,7 +1248,7 @@ void last_end(fganon_class* i_this) { break; } case 3: { - cLib_addCalc0(&i_this->scale.x, 0.1f, 0.05f); + cLib_addCalc0(&i_this->scale.x, 0.1f, 0.05f); cLib_addCalc0(&i_this->scale.z, 0.1f, 0.05f); cLib_addCalc2(&i_this->scale.y, 10.0f, 0.1f, 1.0f); if (i_this->m3A4[1] == 0) { @@ -1536,7 +1539,7 @@ void damage_check(fganon_class* i_this) { } /* 00006288-00006560 .text move__FP12fganon_class */ -s32 move(fganon_class* i_this) { +s32 move(fganon_class* i_this) { int res = 0; if (!dComIfGp_checkPlayerStatus0(0, daPyStts0_SHIP_RIDE_e) && !dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e) && i_this->mAction) { if (i_this->mAction == 10) { @@ -1608,7 +1611,7 @@ s32 move(fganon_class* i_this) { break; case 22: last_end(i_this); - break; + break; default: break; } @@ -1673,7 +1676,7 @@ void demo_camera(fganon_class* i_this) { } case 2: { transformedPos.x = -300306.0f; - transformedPos.y = 715.0f; + transformedPos.y = 715.0f; transformedPos.z = -303407.0f; player->setPlayerPosAndAngle(&transformedPos, -0x7BCD); @@ -1846,7 +1849,7 @@ void demo_camera(fganon_class* i_this) { i_this->mB5C.y = 929.0f; i_this->mB5C.z = -301770.0f; - if (i_this->mB56 != 30) { + if (i_this->mB56 != 30) { break; } i_this->mB54++; @@ -2044,7 +2047,7 @@ void energy_ball_move(fganon_class* i_this) { atInfo.pParticlePos = NULL; - if (i_this->m408 == 35) { + if (i_this->m408 == 35) { if (i_this->m688 != 0) { mDoAud_changeSubBgmStatus(8); i_this->m688 = 0; @@ -2090,7 +2093,7 @@ void energy_ball_move(fganon_class* i_this) { local_5c = player->eyePos - i_this->m3E0; local_5c.y -= REG0_F(18) + 50.0f; - cMtx_YrotS(*calc_mtx, cM_atan2s(local_5c.x, local_5c.z)); + cMtx_YrotS(*calc_mtx, cM_atan2s(local_5c.x, local_5c.z)); cMtx_XrotM(*calc_mtx, -cM_atan2s(local_5c.y, std::sqrtf(local_5c.x * local_5c.x + local_5c.z * local_5c.z))); if (i_this->m2BC == 0) { @@ -2302,7 +2305,7 @@ void energy_ball_move(fganon_class* i_this) { /* 00008614-000086B4 .text mahou_se_set__FPvPv */ /* Play PG's magic sound effect */ -void* mahou_se_set(void* i_act, void* i_other) { +void* mahou_se_set(void* i_act, void* i_other) { fganon_class* i_this = (fganon_class*)i_act; if ((fopAc_IsActor(i_this)) && (((base_process_class*)i_this)->mProcName == PROC_FGMAHOU)) { if (i_this->health == 0) { @@ -2541,7 +2544,7 @@ static BOOL daFganon_IsDelete(fganon_class*) { } /* 00009254-000093B4 .text daFganon_Delete__FP12fganon_class */ -static BOOL daFganon_Delete(fganon_class* i_this) { +static BOOL daFganon_Delete(fganon_class* i_this) { if ((i_this->mB8A) && (dComIfG_resDelete(&i_this->mPhs2, "Pgsw"), i_this->mB8A != 1)) dComIfG_resDelete(&i_this->mPhs1, "Fganon"); @@ -2579,8 +2582,8 @@ static BOOL useHeapInit(fopAc_ac_c* i_act) { fganon_class* i_this = (fganon_class*)i_act; - mDoExt_McaMorf* morf = new mDoExt_McaMorf((J3DModelData *)dComIfG_getObjectRes("Fganon", FGANON_BDL_BPG), NULL, NULL, - (J3DAnmTransformKey *)dComIfG_getObjectRes("Fganon", FGANON_BCK_WAIT1), + mDoExt_McaMorf* morf = new mDoExt_McaMorf((J3DModelData *)dComIfG_getObjectRes("Fganon", FGANON_BDL_BPG), NULL, NULL, + (J3DAnmTransformKey *)dComIfG_getObjectRes("Fganon", FGANON_BCK_WAIT1), J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, 1, NULL, 0, 0x11020203); i_this->mpMorf = morf; @@ -2603,7 +2606,7 @@ static BOOL useHeapInit(fopAc_ac_c* i_act) { pModelData = i_this->mpKenModel->getModelData(); i_this->mpBrkAnm2 = new mDoExt_brkAnm(); - if (i_this->mpBrkAnm2 == NULL) + if (i_this->mpBrkAnm2 == NULL) return FALSE; ptrkAnm = (J3DAnmTevRegKey *)dComIfG_getObjectRes("Fganon", FGANON_BRK_DERU_KEN1); @@ -2819,7 +2822,7 @@ static cPhs_State daFganon_Create(fopAc_ac_c* i_act) { i_this->mCyl.SetStts(&i_this->mStts); i_this->mCyl.OnTgNoHitMark(); - i_this->mBallTgSph.Set(ball_tg_sph_src); + i_this->mBallTgSph.Set(ball_tg_sph_src); i_this->mBallTgSph.SetStts(&i_this->mStts); i_this->mBallTgSph.OnTgNoHitMark(); diff --git a/src/d/actor/d_a_ks.cpp b/src/d/actor/d_a_ks.cpp index 7846c3c75..6cbe45552 100644 --- a/src/d/actor/d_a_ks.cpp +++ b/src/d/actor/d_a_ks.cpp @@ -75,11 +75,14 @@ void draw_SUB(ks_class* i_this) { /* 000002CC-00000568 .text daKS_Draw__FP8ks_class */ static BOOL daKS_Draw(ks_class* i_this) { - cXyz local_24 = i_this->current.pos - dComIfGp_getCamera(0)->mLookat.mEye; + fopAc_ac_c* actor = i_this; +#if VERSION > VERSION_DEMO + cXyz local_24 = i_this->current.pos - dComIfGp_getCamera(0)->mLookat.mEye; if (local_24.abs() < REG0_F(10) + 100.0f) { return TRUE; } +#endif J3DModel* pBodyModel = i_this->mpBodyMorf->getModel(); J3DModel* pEyeModel = i_this->mpEyeMorf->getModel(); @@ -87,7 +90,7 @@ static BOOL daKS_Draw(ks_class* i_this) { cXyz local_18 = i_this->current.pos; local_18.y += 40.0f; - dSnap_RegistFig(DSNAP_TYPE_KS, i_this, 1.0f, 1.0f, 1.0f); + dSnap_RegistFig(DSNAP_TYPE_KS, actor, 1.0f, 1.0f, 1.0f); if (i_this->m2C8 == 6) { return TRUE; @@ -246,6 +249,7 @@ BOOL shock_damage_check(ks_class* i_this) { /* 00000A98-00000DE8 .text body_atari_check__FP8ks_class */ BOOL body_atari_check(ks_class* i_this) { + daPy_py_c* player = daPy_getPlayerActorClass(); fopAc_ac_c* a_this = (fopAc_ac_c*)i_this; cXyz mTgHitPos; cXyz mParticleScale; @@ -253,7 +257,7 @@ BOOL body_atari_check(ks_class* i_this) { i_this->mStts.Move(); if (i_this->mSph.ChkTgHit()) { - daPy_py_c* mpCurPlayerActor = (daPy_py_c*)daPy_getPlayerActorClass(); + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); cCcD_Obj* mTgHitObj = i_this->mSph.GetTgHitObj(); @@ -276,6 +280,7 @@ BOOL body_atari_check(ks_class* i_this) { return FALSE; } +#if VERSION > VERSION_DEMO case AT_TYPE_UNK8: { i_this->mMode = 32; @@ -285,19 +290,22 @@ BOOL body_atari_check(ks_class* i_this) { return FALSE; } +#endif case AT_TYPE_SWORD: { if (i_this->mMode != 43 || i_this->m2CE) { dScnPly_ply_c::setPauseTimer(2); +#if VERSION > VERSION_DEMO a_this->stealItemBitNo = 1; +#endif } mParticleScale.setall(REG8_F(0) + 0.8f); - dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, &mTgHitPos, &mpCurPlayerActor->shape_angle, &mParticleScale); + dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, &mTgHitPos, &player->shape_angle, &mParticleScale); break; } case AT_TYPE_SKULL_HAMMER: { - if (mpCurPlayerActor->getCutType() == 0x12 || mpCurPlayerActor->getCutType() == 0x13) { + if (player->getCutType() == 0x12 || player->getCutType() == 0x13) { a_this->speedF = 0.0f; a_this->gravity = 0.0f; a_this->speed.setall(0.0f); @@ -306,7 +314,9 @@ BOOL body_atari_check(ks_class* i_this) { dScnPly_ply_c::setPauseTimer(2); +#if VERSION > VERSION_DEMO a_this->stealItemBitNo = 1; +#endif i_this->mMode = 32; @@ -344,7 +354,7 @@ BOOL body_atari_check(ks_class* i_this) { } default: { mParticleScale.setall(REG8_F(0) + 0.8f); - dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, &mTgHitPos, &mpCurPlayerActor->shape_angle, &mParticleScale); + dComIfGp_particle_set(dPa_name::ID_COMMON_NORMAL_HIT, &mTgHitPos, &player->shape_angle, &mParticleScale); break; } } @@ -397,7 +407,7 @@ void action_dousa_move(ks_class* i_this) { case 1: cLib_addCalcAngleS2(&i_this->shape_angle.z, 0, 1, 0x1000); - if (fopAcM_searchActorDistance(i_this, dComIfGp_getPlayer(0)) > 10000.0f) { + if (fopAcM_searchPlayerDistance(i_this) > 10000.0f) { break; } @@ -427,7 +437,7 @@ void action_dousa_move(ks_class* i_this) { if (KUTTUKU_ALL_COUNT >= 0 && KUTTUKU_ALL_COUNT < 0x14 && (link->getSpeedF() > 12.0f || HEAVY_IN) && - fopAcM_searchActorDistance(i_this, dComIfGp_getPlayer(0)) < 500.0f && + fopAcM_searchPlayerDistance(i_this) < 500.0f && !dComIfGp_checkPlayerStatus0(0, daPyStts0_SWIM_e) && tyaku_check(i_this)) { @@ -470,7 +480,7 @@ void action_dousa_move(ks_class* i_this) { } break; case 3: - if (fopAcM_searchActorDistance(i_this, dComIfGp_getPlayer(0)) < 500.0f) { + if (fopAcM_searchPlayerDistance(i_this) < 500.0f) { i_this->current.angle.y = fopAcM_searchPlayerAngleY(i_this); } break; @@ -487,11 +497,12 @@ void action_dousa_move(ks_class* i_this) { /* 00001314-00001630 .text action_kougeki_move__FP8ks_class */ void action_kougeki_move(ks_class* i_this) { + fopAc_ac_c* actor = i_this; cXyz head_top_pos = daPy_getPlayerActorClass()->getHeadTopPos(); i_this->m31C = 20.0f; - if (head_top_pos.y > i_this->current.pos.y) { + if (head_top_pos.y > actor->current.pos.y) { i_this->m31C = 60.0f; } @@ -499,9 +510,9 @@ void action_kougeki_move(ks_class* i_this) { case 10: { i_this->mSph.OffCoSetBit(); - i_this->speedF = 26.0f; - i_this->gravity = -4.0f; - i_this->speed.y = 28.0f; + actor->speedF = 26.0f; + actor->gravity = -4.0f; + actor->speed.y = 28.0f; for (int i = 0; i < 5; i++) { i_this->m2F0[i] = 0; @@ -509,21 +520,21 @@ void action_kougeki_move(ks_class* i_this) { i_this->m30C = 0.0f; - i_this->current.angle.y = fopAcM_searchPlayerAngleY(i_this); + actor->current.angle.y = fopAcM_searchPlayerAngleY(actor); - mDoAud_seStart(JA_SE_CM_KS_ATTACK, &i_this->eyePos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + fopAcM_seStart(actor, JA_SE_CM_KS_ATTACK, 0); - fopAcM_monsSeStart(i_this, JA_SE_CV_KS_ATTACK, 0); + fopAcM_monsSeStart(actor, JA_SE_CV_KS_ATTACK, 0); i_this->mMode++; break; } case 11: { - if (i_this->speedF > 0.0f && i_this->m2F0[1] == 0 && i_this->mSph.ChkAtShieldHit()) { - i_this->gravity = -4.0f; - i_this->speed.y = 25.0f; - i_this->speedF *= -0.5f; + if (actor->speedF > 0.0f && i_this->m2F0[1] == 0 && i_this->mSph.ChkAtShieldHit()) { + actor->gravity = -4.0f; + actor->speed.y = 25.0f; + actor->speedF *= -0.5f; i_this->m2F0[1] = 1; } @@ -547,14 +558,14 @@ void action_kougeki_move(ks_class* i_this) { ks_kuttuki_check(i_this); if (tyaku_check(i_this)) { - i_this->gravity = -4.0f; - i_this->speed.y = 1.0f; - i_this->speed.y += cM_rndF(5.0f); - i_this->speedF = 16.0f; + actor->gravity = -4.0f; + actor->speed.y = 1.0f; + actor->speed.y += cM_rndF(5.0f); + actor->speedF = 16.0f; } if (i_this->m2E8[2] == 0) { - i_this->speedF = 0.0f; + actor->speedF = 0.0f; i_this->m31C = 20.0f; i_this->mAction = 0; i_this->mMode = 0; @@ -562,10 +573,10 @@ void action_kougeki_move(ks_class* i_this) { break; } - cLib_addCalcAngleS2(&i_this->shape_angle.y, i_this->current.angle.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 1, 0x1000); if (body_atari_check(i_this)) { - fopAcM_seStart(i_this, JA_SE_LK_LAST_HIT, 0); + fopAcM_seStart(actor, JA_SE_LK_LAST_HIT, 0); } } @@ -1108,7 +1119,7 @@ void action_tubo_search(ks_class* i_this) { return; } - if (fopAcM_searchActorDistance(a_this, daPy_getPlayerActorClass()) > i_this->m318) { + if (fopAcM_searchPlayerDistance(a_this) > i_this->m318) { return; } } @@ -1359,7 +1370,7 @@ static BOOL daKS_IsDelete(ks_class* i_this) { /* 0000305C-000030F4 .text daKS_Delete__FP8ks_class */ static BOOL daKS_Delete(ks_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "KS"); + dComIfG_resDeleteDemo(&i_this->mPhs, "KS"); i_this->m52C.remove();