From 34d6212ab2c843a8f6f4befeb3b8dd979614c032 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Mon, 19 Sep 2022 19:08:47 -0500 Subject: [PATCH] [#1336] Fix issues with gFasterHeavyBlockLift (#1476) --- soh/src/code/z_onepointdemo.c | 19 ---------- soh/src/code/z_onepointdemo_data.inc | 6 +-- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 37 +++++++++++-------- .../actors/ovl_player_actor/z_player.c | 8 +++- 4 files changed, 31 insertions(+), 39 deletions(-) diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 2fd692da8..5dcdeb2e4 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -1041,37 +1041,18 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); break; case 4020: - if (CVar_GetS32("gFasterHeavyBlockLift", 0)) { - D_8012368C[0].timerInit *= (1.0f / 3.0f); - D_8012368C[1].timerInit *= (1.0f / 3.0f); - D_8012368C[2].timerInit *= (1.0f / 3.0f); - D_8012368C[3].timerInit *= (1.0f / 3.0f); - } csInfo->keyFrames = D_8012368C; csInfo->keyFrameCnt = 4; func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); break; case 4021: - if (CVar_GetS32("gFasterHeavyBlockLift", 0)) { - D_8012372C[0].timerInit *= (1.0f / 3.0f); - D_8012372C[1].timerInit *= (1.0f / 3.0f); - D_8012372C[2].timerInit *= (1.0f / 3.0f); - D_8012372C[3].timerInit *= (1.0f / 3.0f); - } csInfo->keyFrames = D_8012372C; csInfo->keyFrameCnt = 4; func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); break; case 4022: - if (CVar_GetS32("gFasterHeavyBlockLift", 0)) { - D_801237CC[0].timerInit *= (1.0f / 3.0f); - D_801237CC[1].timerInit *= (1.0f / 3.0f); - D_801237CC[2].timerInit *= (1.0f / 3.0f); - D_801237CC[3].timerInit *= (1.0f / 3.0f); - D_801237CC[4].timerInit *= (1.0f / 3.0f); - } csCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + D_801237CC[2].timerInit + D_801237CC[4].timerInit; diff --git a/soh/src/code/z_onepointdemo_data.inc b/soh/src/code/z_onepointdemo_data.inc index 216340f40..2488be71b 100644 --- a/soh/src/code/z_onepointdemo_data.inc +++ b/soh/src/code/z_onepointdemo_data.inc @@ -624,21 +624,21 @@ static OnePointCsFull D_801235C4[5] = { { 0x12, 0xFF, 0x0000, 1, 0, 60.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, }; -OnePointCsFull D_8012368C[4] = { +static OnePointCsFull D_8012368C[4] = { { 0x0F, 0xFF, 0x0101, 10, 0, 60.0f, 1.0f, { -1110.0f, -180.0f, -840.0f }, { -985.0f, -220.0f, -840.0f } }, { 0x02, 0xFF, 0x0101, 70, -45, 75.0f, 1.0f, { -1060.0f, -160.0f, -840.0f }, { -1005.0f, -230.0f, -840.0f } }, { 0x0F, 0xFF, 0x0000, 10, -45, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x0F, 0xFF, 0x0101, 180, 9, 80.0f, 1.0f, { -1205.0f, -175.0f, -840.0f }, { -1305.0f, -230.0f, -828.0f } }, }; -OnePointCsFull D_8012372C[4] = { +static OnePointCsFull D_8012372C[4] = { { 0x0F, 0xFF, 0x0142, 10, 0, 70.0f, 1.0f, { 0.0f, 80.0f, 0.0f }, { -1650.0f, 200.0f, -2920.0f } }, { 0x02, 0xFF, 0x0142, 110, -2, 50.0f, 0.5f, { 0.0f, 150.0f, 0.0f }, { -1320.0f, 170.0f, -2900.0f } }, { 0x0B, 0xFF, 0x4242, 100, 2, 70.0f, 0.1f, { 0.0f, 150.0f, 50.0f }, { -1.0f, -1.0f, -1.0f } }, { 0x03, 0xFF, 0x4242, 60, 2, 45.0f, 0.01f, { 0.0f, 150.0f, 50.0f }, { 0.0f, 200.0f, -80.0f } }, }; -OnePointCsFull D_801237CC[5] = { +static OnePointCsFull D_801237CC[5] = { { 0x8F, 0xFF, 0x4242, 20, 0, 50.0f, 1.0f, { 0.0f, 50.0f, -10.0f }, { 0.0f, 0.0f, 100.0f } }, { 0x0A, 0xFF, 0x0101, 80, 0, 75.0f, 1.0f, { 2900.0f, 1300.0f, 530.0f }, { 2800.0f, 1190.0f, 540.0f } }, { 0x0F, 0xFF, 0x0000, 10, 0, 75.0f, 1.0f, { -1.0f, -1.0f, -1.0f }, { -1.0f, -1.0f, -1.0f } }, diff --git a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index f0b913627..fb7196a20 100644 --- a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -320,16 +320,18 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->dyna.actor, globalCtx)) { this->timer = 0; - switch (this->dyna.actor.params & 0xFF) { - case HEAVYBLOCK_BREAKABLE: - OnePointCutscene_Init(globalCtx, 4020, 270, &this->dyna.actor, MAIN_CAM); - break; - case HEAVYBLOCK_UNBREAKABLE: - OnePointCutscene_Init(globalCtx, 4021, 220, &this->dyna.actor, MAIN_CAM); - break; - case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - OnePointCutscene_Init(globalCtx, 4022, 210, &this->dyna.actor, MAIN_CAM); - break; + if (!CVar_GetS32("gFasterHeavyBlockLift", 0)) { + switch (this->dyna.actor.params & 0xFF) { + case HEAVYBLOCK_BREAKABLE: + OnePointCutscene_Init(globalCtx, 4020, 270, &this->dyna.actor, MAIN_CAM); + break; + case HEAVYBLOCK_UNBREAKABLE: + OnePointCutscene_Init(globalCtx, 4021, 220, &this->dyna.actor, MAIN_CAM); + break; + case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: + OnePointCutscene_Init(globalCtx, 4022, 210, &this->dyna.actor, MAIN_CAM); + break; + } } quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); @@ -367,7 +369,9 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { this->timer++; - func_8002DF54(globalCtx, &player->actor, 8); + if (!CVar_GetS32("gFasterHeavyBlockLift", 0)) { + func_8002DF54(globalCtx, &player->actor, 8); + } // if parent is NULL, link threw it if (Actor_HasNoParent(&this->dyna.actor, globalCtx)) { @@ -404,10 +408,13 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 30); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); - Quake_SetSpeed(quakeIndex, 12000); - Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 999); + // We don't want this arbitrarily long quake with the enhancement enabled + if (!CVar_GetS32("gFasterHeavyBlockLift", 0)) { + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); + Quake_SetSpeed(quakeIndex, 12000); + Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); + Quake_SetCountdown(quakeIndex, 999); + } SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 30, NA_SE_EV_ELECTRIC_EXPLOSION); diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index e6162b5a5..6b0f4e474 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -4617,8 +4617,8 @@ void func_8083A0F4(GlobalContext* globalCtx, Player* this) { anim = D_80853914[PLAYER_ANIMGROUP_13][this->modelAnimType]; } - if (CVar_GetS32("gFasterHeavyBlockLift", 0) && interactActorId == ACTOR_BG_HEAVY_BLOCK) { - LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 3.0f); + if (CVar_GetS32("gFasterHeavyBlockLift", 0) && (interactActorId == ACTOR_EN_ISHI || interactActorId == ACTOR_BG_HEAVY_BLOCK)) { + LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, anim, 5.0f); } else { LinkAnimation_PlayOnce(globalCtx, &this->skelAnime, anim); } @@ -9136,6 +9136,10 @@ void func_80846120(Player* this, GlobalContext* globalCtx) { if (LinkAnimation_OnFrame(&this->skelAnime, 229.0f)) { Actor* heldActor = this->heldActor; + if (CVar_GetS32("gFasterHeavyBlockLift", 0)) { + // This is the difference in rotation when the animation is sped up 5x + heldActor->shape.rot.x -= 3510; + } heldActor->speedXZ = Math_SinS(heldActor->shape.rot.x) * 40.0f; heldActor->velocity.y = Math_CosS(heldActor->shape.rot.x) * 40.0f; heldActor->gravity = -2.0f;