Skip to content

Commit bf443ae

Browse files
committed
Fix Werehog rotating into walls when leaving them at HFR
1 parent e4c43ae commit bf443ae

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

UnleashedRecomp/patches/fps_patches.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,11 @@ bool SparkleLocusMidAsmHook()
195195
// This has the side effect of the locus particle eventually snapping to the rest position during pause, but it's better than vertices exploding.
196196
return App::s_deltaTime < (1.0 / 60.0);
197197
}
198+
199+
void CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook(PPCRegister& f1)
200+
{
201+
// The code in the Werehog's "wall" state for leaving walls adds a constant
202+
// value of 0.05 to his transform every frame. This makes the value respect
203+
// delta time whilst maintaining the original behaviour at 30 FPS.
204+
f1.f64 = f1.f64 * (App::s_deltaTime / (1.0 / 30.0));
205+
}

UnleashedRecompLib/config/SWA.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,3 +1141,15 @@ registers = ["r3"]
11411141
name = "EndingTextPositionMidAsmHook"
11421142
address = 0x82580168
11431143
registers = ["r31", "f13"]
1144+
1145+
# Wall Leave - Left
1146+
[[midasm_hook]]
1147+
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
1148+
address = 0x824067BC
1149+
registers = ["f1"]
1150+
1151+
# Wall Leave - Right
1152+
[[midasm_hook]]
1153+
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
1154+
address = 0x82406774
1155+
registers = ["f1"]

0 commit comments

Comments
 (0)