From eb632ccb5021dd3a091364a90cce926fe294ba94 Mon Sep 17 00:00:00 2001 From: Josh Bodner <30329717+jbodner09@users.noreply.github.com> Date: Tue, 16 Aug 2022 13:09:11 -0700 Subject: [PATCH] Adjustable push speed (#1190) --- libultraship/libultraship/ImGuiImpl.cpp | 10 +++++----- .../overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 11 +++-------- .../actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 6 +++--- .../overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c | 9 ++++----- .../ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c | 4 ++-- .../overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c | 6 +++--- .../actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 6 +++--- soh/src/overlays/actors/ovl_En_Am/z_en_am.c | 10 ++++++++-- .../overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 6 +++--- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index b901ece92..2a7a8efad 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1205,8 +1205,8 @@ namespace SohImGui { PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "", 1, false, false, true); EnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "", 3); Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword"); - PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0); - EnhancementCheckbox("Faster Block Push", "gFasterBlockPush"); + PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0, false, false, true); + PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", "gFasterBlockPush", 0, 5, "", 0, false, false, true); PaddedEnhancementCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift", true, false); Tooltip("Speeds up lifting silver rocks and obelisks"); PaddedEnhancementCheckbox("No Forced Navi", "gNoForcedNavi", true, false); @@ -2093,7 +2093,7 @@ namespace SohImGui { CVar_SetS32("gForgeTime", 3); // Vine/Ladder Climb speed (+0 to +12) CVar_SetS32("gClimbSpeed", 0); - // Faster Block Push + // Faster Block Push (+0 to +5) CVar_SetS32("gFasterBlockPush", 0); // No Forced Navi CVar_SetS32("gNoForcedNavi", 0); @@ -2263,8 +2263,8 @@ namespace SohImGui { CVar_SetS32("gTextSpeed", 5); // King Zora Speed (1 to 5) CVar_SetS32("gMweepSpeed", 2); - // Faster Block Push - CVar_SetS32("gFasterBlockPush", 1); + // Faster Block Push (+0 to +5) + CVar_SetS32("gFasterBlockPush", 5); // Better Owl CVar_SetS32("gBetterOwl", 1); // Prevent Dropped Ocarina Inputs diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 894bf51fb..69bb00d4d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -193,12 +193,7 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { s16 turnAngle; this->vTurnRateDeg10++; - if (CVar_GetS32("gFasterBlockPush", 0) != 0) { - this->vTurnRateDeg10 = 10; - CLAMP_MAX(this->vTurnRateDeg10, 5); - } else { - this->vTurnRateDeg10 = CLAMP_MAX(this->vTurnRateDeg10, 5); - } + this->vTurnRateDeg10 = CLAMP_MAX(this->vTurnRateDeg10, 10); turnFinished = Math_StepToS(&this->vTurnAngleDeg10, 600, this->vTurnRateDeg10); turnAngle = this->vTurnAngleDeg10 * this->vTurnDirection; this->dyna.actor.shape.rot.y = (this->vRotYDeg10 + turnAngle) * 0.1f * (0x10000 / 360.0f); @@ -216,9 +211,9 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { if (turnFinished) { player->stateFlags2 &= ~0x10; this->vRotYDeg10 = (this->vRotYDeg10 + turnAngle) % 3600; - this->vTurnRateDeg10 = 0; + this->vTurnRateDeg10 = CVar_GetS32("gFasterBlockPush", 0) * 2; this->vTurnAngleDeg10 = 0; - this->vTimer = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 2 : 5; + this->vTimer = 5 - ((CVar_GetS32("gFasterBlockPush", 0) * 3) / 5); this->actionFunc = BgHakaGate_StatueIdle; this->dyna.unk_150 = 0.0f; } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 9dfce749a..67180641f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -137,8 +137,8 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { } } - this->dyna.actor.speedXZ += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.05f; - this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f); + this->dyna.actor.speedXZ = this->dyna.actor.speedXZ + (CVar_GetS32("gFasterBlockPush", 0) * 0.3) + 0.5f; + this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 3.0f); if (D_8088BFC0 > 0.0f) { temp_v1 = Math_StepToF(&D_8088BFC0, 20.0f, this->dyna.actor.speedXZ); @@ -156,7 +156,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z; D_8088BFC0 = 0.0f; this->dyna.actor.speedXZ = 0.0f; - this->timer = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 2 : 5; + this->timer = 5 - ((CVar_GetS32("gFasterBlockPush", 0) * 3) / 5); } func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index d2eb72f81..748a4de27 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -443,7 +443,7 @@ void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) { if (this->dyna.unk_150 > 0.001f) { this->unk_168++; - if (this->unk_168 >= CVar_GetS32("gFasterBlockPush", 0) != 0 ? 5 : 15) { + if (this->unk_168 >= (15 - CVar_GetS32("gFasterBlockPush", 0) * 2)) { func_808969F8(this, globalCtx); } } else { @@ -476,18 +476,17 @@ void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) { this->unk_174.x = player->actor.world.pos.x - this->dyna.actor.world.pos.x; this->unk_174.y = player->actor.world.pos.y - this->dyna.actor.world.pos.y; this->unk_174.z = player->actor.world.pos.z - this->dyna.actor.world.pos.z; - this->unk_170 = this->unk_16E = 0; + this->unk_170 = 0; this->unk_172 = true; + this->unk_16E = CVar_GetS32("gFasterBlockPush", 0) * 20; } void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { s16 temp_v0; Player* player = GET_PLAYER(globalCtx); - if (CVar_GetS32("gFasterBlockPush", 0) != 0) - this->unk_16E = 150.0f; temp_v0 = (s16)((this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y) - this->dyna.actor.world.rot.y; - if (ABS(temp_v0) < CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3712 : 7424) { + if (ABS(temp_v0) < 7424) { Math_StepToS(&this->unk_16E, 106, 4); } else { Math_StepToS(&this->unk_16E, 21, 10); diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index b69a1103e..42babb904 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -94,7 +94,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { if (this->dyna.unk_150 > 0.001f) { this->timer++; - if ((this->timer > CVar_GetS32("gFasterBlockPush", 0) != 0 ? 14 : 28) && !Player_InCsMode(globalCtx)) { + if ((this->timer > (28 - CVar_GetS32("gFasterBlockPush", 0) * 4)) && !Player_InCsMode(globalCtx)) { BgMoriKaitenkabe_SetupRotate(this); func_8002DF54(globalCtx, &this->dyna.actor, 8); Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); @@ -118,7 +118,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this) { this->actionFunc = BgMoriKaitenkabe_Rotate; - this->rotSpeed = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.0f; + this->rotSpeed = CVar_GetS32("gFasterBlockPush", 0) * 0.1f; this->rotYdeg = 0.0f; } diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 8a8d2251c..f2fb75184 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -387,8 +387,8 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { s32 blockStop; Player* player = GET_PLAYER(globalCtx); - this->dyna.actor.speedXZ += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 0.5f : 0.1f; - this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f); + this->dyna.actor.speedXZ = this->dyna.actor.speedXZ + (CVar_GetS32("gFasterBlockPush", 0) * 0.3) + 0.5f; + this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 3.0f); blockStop = Math_StepToF(&sBgPoEventblockPushDist, 20.0f, this->dyna.actor.speedXZ); displacement = this->direction * sBgPoEventblockPushDist; this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.x; @@ -403,7 +403,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z; sBgPoEventblockPushDist = 0.0f; this->dyna.actor.speedXZ = 0.0f; - this->direction = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3 : 5; + this->direction = 5 - ((CVar_GetS32("gFasterBlockPush", 0) * 3) / 5); sBgPoEventBlocksAtRest++; this->actionFunc = BgPoEvent_BlockIdle; if (this->type == 1) { diff --git a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 3bce9a3a4..8b484524b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -260,9 +260,9 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { s32 approxFResult; Actor* actor = &this->dyna.actor; - this->unk_174 += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 1.0f : 0.5f; + this->unk_174 = this->unk_174 + (CVar_GetS32("gFasterBlockPush", 0) * 0.3) + 0.5f; - this->unk_174 = CLAMP_MAX(this->unk_174, 2.0f); + this->unk_174 = CLAMP_MAX(this->unk_174, 3.0f); approxFResult = Math_StepToF(&this->unk_178, 20.0f, this->unk_174); @@ -294,7 +294,7 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; this->unk_178 = 0.0f; this->unk_174 = 0.0f; - this->unk_168 = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3 : 10; + this->unk_168 = 10 - ((CVar_GetS32("gFasterBlockPush", 0) * 3) / 2); func_808B4084(this, globalCtx); } Audio_PlayActorSound2(actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); diff --git a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c index 230ec7141..d1b18ef2d 100644 --- a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -667,10 +667,11 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); f32 temp158f = this->dyna.unk_158; s16 moveDir = 0; + s32 blockSpeed = CVar_GetS32("gFasterBlockPush", 0); if (this->unk_258 == 0) { if (this->dyna.unk_150 != 0.0f) { - this->unk_258 = 0x8000; + this->unk_258 = 0x8000 - (blockSpeed * 0x1000); } } else { this->unk_258 -= 0x800; @@ -696,7 +697,12 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { } this->dyna.actor.world.rot.y = this->dyna.unk_158; - this->dyna.actor.speedXZ = Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f); + this->dyna.actor.speedXZ = Math_SinS(this->unk_258 * 8 / (8 - blockSpeed)) * (this->dyna.unk_150 * 0.5f) + + (blockSpeed == 5 ? blockSpeed * (this->dyna.unk_150 * 0.5f) * 0.25681 : + (blockSpeed == 4 ? blockSpeed * (this->dyna.unk_150 * 0.5f) * 0.18305 : + (blockSpeed == 3 ? blockSpeed * (this->dyna.unk_150 * 0.5f) * 0.14222 : + (blockSpeed == 2 ? blockSpeed * (this->dyna.unk_150 * 0.5f) * 0.11625 : + (blockSpeed == 1 ? blockSpeed * (this->dyna.unk_150 * 0.5f) * 0.09828 : 0))))); } if (this->dyna.actor.bgCheckFlags & 2) { diff --git a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 1ba98b8d5..93fda2630 100644 --- a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -558,9 +558,9 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { f32 pushDistSigned; s32 stopFlag; - this->pushSpeed += CVar_GetS32("gFasterBlockPush", 0) != 0 ? 1.0f : 0.5f; + this->pushSpeed = this->pushSpeed + (CVar_GetS32("gFasterBlockPush", 0) * 0.3) + 0.5f; this->stateFlags |= PUSHBLOCK_PUSH; - this->pushSpeed = CLAMP_MAX(this->pushSpeed, 2.0f); + this->pushSpeed = CLAMP_MAX(this->pushSpeed, 3.0f); stopFlag = Math_StepToF(&this->pushDist, 20.0f, this->pushSpeed); pushDistSigned = ((this->direction >= 0.0f) ? 1.0f : -1.0f) * this->pushDist; thisx->world.pos.x = thisx->home.pos.x + (pushDistSigned * this->yawSin); @@ -586,7 +586,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { this->dyna.unk_150 = 0.0f; this->pushDist = 0.0f; this->pushSpeed = 0.0f; - this->timer = CVar_GetS32("gFasterBlockPush", 0) != 0 ? 3 : 10; + this->timer = 10 - ((CVar_GetS32("gFasterBlockPush", 0) * 3) / 2); if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { ObjOshihiki_SetupOnScene(this, globalCtx); } else {