From f6fb534035630d04f81964bf656a333e9559c8a1 Mon Sep 17 00:00:00 2001 From: tmyqlfpir <80724828+tmyqlfpir@users.noreply.github.com> Date: Mon, 21 Aug 2023 01:49:59 +1000 Subject: [PATCH 1/3] Fix spamming footsteps for slow mode --- src/game/footstep.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/game/footstep.c b/src/game/footstep.c index c81ef8cc2..1c3a228f9 100644 --- a/src/game/footstep.c +++ b/src/game/footstep.c @@ -2,6 +2,7 @@ #include "constants.h" #include "game/debug.h" #include "game/game_006900.h" +#include "game/lv.h" #include "game/propsnd.h" #include "game/bg.h" #include "bss.h" @@ -176,6 +177,16 @@ void footstepCheckDefault(struct chrdata *chr) chr->footstep = 2; } } else { +#ifndef PLATFORM_N64 // fix spamming footsteps for 60fps port + if (lvGetSlowMotionType() != SLOWMOTION_OFF && g_Vars.speedpillon == false) { + s32 roundedframe = (s32)(frame*2); + if (roundedframe == (g_FootstepAnims[i].frame1*2) && prevframe < g_FootstepAnims[i].frame1) { + chr->footstep = 1; + } else if (roundedframe == (g_FootstepAnims[i].frame2*2) && prevframe < g_FootstepAnims[i].frame2) { + chr->footstep = 2; + } + } else +#endif if (frame >= g_FootstepAnims[i].frame1 && prevframe < g_FootstepAnims[i].frame1) { chr->footstep = 1; } else if (frame >= g_FootstepAnims[i].frame2 && prevframe < g_FootstepAnims[i].frame2) { From 18ae54f656964c84470d3467cade96752fca1c16 Mon Sep 17 00:00:00 2001 From: tmyqlfpir <80724828+tmyqlfpir@users.noreply.github.com> Date: Mon, 21 Aug 2023 02:33:11 +1000 Subject: [PATCH 2/3] Fix footsteps with combat boost --- src/game/footstep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/footstep.c b/src/game/footstep.c index 1c3a228f9..f75c3d06a 100644 --- a/src/game/footstep.c +++ b/src/game/footstep.c @@ -178,7 +178,7 @@ void footstepCheckDefault(struct chrdata *chr) } } else { #ifndef PLATFORM_N64 // fix spamming footsteps for 60fps port - if (lvGetSlowMotionType() != SLOWMOTION_OFF && g_Vars.speedpillon == false) { + if ((lvGetSlowMotionType() != SLOWMOTION_OFF && g_Vars.speedpillon == false) || (lvGetSlowMotionType() == SLOWMOTION_OFF && g_Vars.speedpillon == true)) { s32 roundedframe = (s32)(frame*2); if (roundedframe == (g_FootstepAnims[i].frame1*2) && prevframe < g_FootstepAnims[i].frame1) { chr->footstep = 1; From 682c0c83a16d7e0c2a2209ccc0200ac522280210 Mon Sep 17 00:00:00 2001 From: tmyqlfpir <80724828+tmyqlfpir@users.noreply.github.com> Date: Mon, 21 Aug 2023 06:24:08 +1000 Subject: [PATCH 3/3] Expose LV_SLOMO_TICK_CAP macro in lv.h Needed for slomo footsteps fix --- src/game/footstep.c | 2 +- src/game/lv.c | 8 -------- src/include/game/lv.h | 8 ++++++++ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/game/footstep.c b/src/game/footstep.c index f75c3d06a..ddbcc3546 100644 --- a/src/game/footstep.c +++ b/src/game/footstep.c @@ -178,7 +178,7 @@ void footstepCheckDefault(struct chrdata *chr) } } else { #ifndef PLATFORM_N64 // fix spamming footsteps for 60fps port - if ((lvGetSlowMotionType() != SLOWMOTION_OFF && g_Vars.speedpillon == false) || (lvGetSlowMotionType() == SLOWMOTION_OFF && g_Vars.speedpillon == true)) { + if (g_Vars.lvupdate240 == LV_SLOMO_TICK_CAP) { s32 roundedframe = (s32)(frame*2); if (roundedframe == (g_FootstepAnims[i].frame1*2) && prevframe < g_FootstepAnims[i].frame1) { chr->footstep = 1; diff --git a/src/game/lv.c b/src/game/lv.c index a5ace237a..a461990b8 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -97,14 +97,6 @@ #include "lib/vi.h" #include "types.h" -#ifdef PLATFORM_N64 -// game runs at ~30, so slomo = 1/2 of 30fps -#define LV_SLOMO_TICK_CAP TICKS(4) -#else -// game runs at 60+, so slomo = 1/2 of 60fps -#define LV_SLOMO_TICK_CAP TICKS(2) -#endif - struct sndstate *g_MiscSfxAudioHandles[3]; u32 var800aa5bc; s32 g_MiscSfxActiveTypes[3]; diff --git a/src/include/game/lv.h b/src/include/game/lv.h index bc14d4356..961af91d0 100644 --- a/src/include/game/lv.h +++ b/src/include/game/lv.h @@ -4,6 +4,14 @@ #include "data.h" #include "types.h" +#ifdef PLATFORM_N64 +// game runs at ~30, so slomo = 1/2 of 30fps +#define LV_SLOMO_TICK_CAP TICKS(4) +#else +// game runs at 60+, so slomo = 1/2 of 60fps +#define LV_SLOMO_TICK_CAP TICKS(2) +#endif + u32 getVar80084040(void); void lvInit(void); void lvResetMiscSfx(void);