Skip to content

Fix Werehog rotating into walls when leaving them at HFR #1570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions UnleashedRecomp/patches/fps_patches.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,11 @@ bool SparkleLocusMidAsmHook()
// This has the side effect of the locus particle eventually snapping to the rest position during pause, but it's better than vertices exploding.
return App::s_deltaTime < (1.0 / 60.0);
}

void CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook(PPCRegister& f1)
{
// The code in the Werehog's "wall" state for leaving walls adds a constant
// value of 0.05 to his transform every frame. This makes the value respect
// delta time whilst maintaining the original behaviour at 30 FPS.
f1.f64 = f1.f64 * (std::min(App::s_deltaTime, 1.0 / 15.0) / (1.0 / 30.0));
}
12 changes: 12 additions & 0 deletions UnleashedRecompLib/config/SWA.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1141,3 +1141,15 @@ registers = ["r3"]
name = "EndingTextPositionMidAsmHook"
address = 0x82580168
registers = ["r31", "f13"]

# Wall Leave - Left
[[midasm_hook]]
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
address = 0x824067BC
registers = ["f1"]

# Wall Leave - Right
[[midasm_hook]]
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
address = 0x82406774
registers = ["f1"]
Loading