force 20fps in the crawl tunnel

This commit is contained in:
Blake Warner 2022-05-15 20:25:03 -04:00
parent c005911242
commit 7099313e99
3 changed files with 19 additions and 1 deletions

View File

@ -107,6 +107,7 @@ u32 framerate_get();
void framerate_set_profile(FramerateProfile profile);
FramerateProfile framerate_get_profile();
float frameRateDivisor();
void force20FPS(bool force);
class Timer
{

View File

@ -21,6 +21,9 @@ bool INTERPOLATE_ANIM = false;
u8 SKIP_GFX_FRAME_MASK = 0;
#endif
static bool g_force20FPS = false;
static float g_force20FPSLast = 20.0f;
static FramerateProfile g_profile = PROFILE_BOOT;
static Framerate g_profileRates[] = {
@ -97,8 +100,10 @@ namespace oot
return SET_FRAMERATE;
}
void setMaxFramerate(float framerate)
void setMaxFramerate(float targetFramerate)
{
const float framerate = g_force20FPS ? 20.0f : targetFramerate;
if(framerate == SET_FRAMERATE)
{
return;
@ -258,3 +263,13 @@ float Round(float value)
{
return roundf(value * 100) / 100.0f;
}
void force20FPS(bool force)
{
if(force)
{
g_force20FPSLast = oot::getMaxFramerate();
}
g_force20FPS = force;
oot::setMaxFramerate(g_force20FPSLast);
}

View File

@ -5222,6 +5222,7 @@ void func_8083A3B0(GlobalContext* globalCtx, Player* pthis)
void func_8083A40C(GlobalContext* globalCtx, Player* pthis)
{
force20FPS(true);
Player_SetUpdateFunctWithMove0(globalCtx, pthis, Player_ActionCrawlTunnelEnter, 0);
}
@ -6014,6 +6015,7 @@ void func_8083BF50(Player* pthis, GlobalContext* globalCtx)
void func_8083C0E8(Player* pthis, GlobalContext* globalCtx)
{
force20FPS(false);
Player_SetUpdateFunct(globalCtx, pthis, Player_UpdateFunc_Standing, 1);
func_80832264(globalCtx, pthis, func_80833338(pthis));
pthis->currentYaw = pthis->actor.shape.rot.y;