diff --git a/include/functions.h b/include/functions.h index b49a91e7c3..d213d6c88b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2176,8 +2176,8 @@ void func_80121FC4(GlobalContext* globalCtx); Path* Path_GetByIndex(GlobalContext* globalCtx, s16 index, s16 max); f32 Path_OrientAndGetDistSq(Actor* actor, Path* path, s16 waypoint, s16* yaw); void Path_CopyLastPoint(Path* path, Vec3f* dest); -void func_80122660(FrameAdvanceContext* frameAdvCtx); -s32 func_80122670(FrameAdvanceContext* frameAdvCtx, Input* input); +void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx); +s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input); // void func_801226E0(void); void func_80122744(GlobalContext* globalCtx, UNK_PTR arg1, u32 arg2, Vec3s* arg3); s32 func_80122760(GlobalContext* globalCtx, UNK_PTR arg1, f32 arg2); diff --git a/spec b/spec index f3cd6c8ba9..2eb0ccb3c6 100644 --- a/spec +++ b/spec @@ -521,7 +521,7 @@ beginseg include "build/data/code/z_parameter.data.o" include "build/data/code/z_parameter.bss.o" include "build/src/code/z_path.o" - include "build/src/code/z_pause.o" + include "build/src/code/z_frame_advance.o" include "build/src/code/z_player_lib.o" include "build/data/code/z_player_lib.data.o" include "build/data/code/z_player_lib.bss.o" diff --git a/src/code/z_frame_advance.c b/src/code/z_frame_advance.c new file mode 100644 index 0000000000..6c89bab0fb --- /dev/null +++ b/src/code/z_frame_advance.c @@ -0,0 +1,25 @@ +#include "global.h" + +void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { + frameAdvCtx->timer = 0; + frameAdvCtx->enabled = false; +} + +/** + * Frame advance allows you to advance through the game one frame at a time on command. + * To advance a frame, hold Z and press R on the spceified controller. + * Holding Z and R will advance a frame every half second. + * + * This function returns true when frame advance is not active (game will run normally) + * + * Note: There is no way to enable it + */ +s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) { + if (!frameAdvCtx->enabled || (CHECK_BTN_ALL(input->cur.button, BTN_Z) && + (CHECK_BTN_ALL(input->press.button, BTN_R) || + (CHECK_BTN_ALL(input->cur.button, BTN_R) && (++frameAdvCtx->timer >= 9))))) { + frameAdvCtx->timer = 0; + return true; + } + return false; +} diff --git a/src/code/z_pause.c b/src/code/z_pause.c deleted file mode 100644 index 739945c10a..0000000000 --- a/src/code/z_pause.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "global.h" - -void func_80122660(FrameAdvanceContext* frameAdvCtx) { - frameAdvCtx->timer = 0; - frameAdvCtx->enabled = false; -} - -s32 func_80122670(FrameAdvanceContext* frameAdvCtx, Input* input) { - if (!frameAdvCtx->enabled || (CHECK_BTN_ALL(input->cur.button, BTN_Z) && - (CHECK_BTN_ALL(input->press.button, BTN_R) || - (CHECK_BTN_ALL(input->cur.button, BTN_R) && (++frameAdvCtx->timer >= 9))))) { - frameAdvCtx->timer = 0; - return true; - } - return false; -} diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index b6ec70b65b..6e39eb7c18 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2170,8 +2170,8 @@ 0x801224E0:("Path_GetByIndex",), 0x80122524:("Path_OrientAndGetDistSq",), 0x801225CC:("Path_CopyLastPoint",), - 0x80122660:("func_80122660",), - 0x80122670:("func_80122670",), + 0x80122660:("FrameAdvance_Init",), + 0x80122670:("FrameAdvance_Update",), 0x801226E0:("func_801226E0",), 0x80122744:("func_80122744",), 0x80122760:("func_80122760",),