pause (Frame Advance) OK (#455)

* Matched

* Rename and format

* typo

* Missed renames

* Revert "Missed renames"

This reverts commit 64d9f70464.

* Revert "typo"

This reverts commit 81696364d3.

* Revert "Rename and format"

This reverts commit aec7d245e8.

* Rename functions

* Add header explaining frame advance

* Header

* Format
This commit is contained in:
Derek Hensley 2021-12-19 11:54:52 -08:00 committed by GitHub
parent e579bf5587
commit 98ba231fb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 6 deletions

View File

@ -2129,8 +2129,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(void);
// UNK_TYPE4 func_80122670(s32* param_1, 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);

View File

@ -1,5 +1,39 @@
/*
* File: z_pause.c
* Description: Frame Advance debug feature
*
* This 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 specified controller (see z_play).
* Holding Z and R will advance a frame every half second.
*
* Note: While the system is fully hooked up, there is no way to enable it in game
* Instead one would have to add something like:
*
* if (CHECK_BTN_ALL(input->cur.button, BTN_R) && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
* frameAdvCtx->enabled = !frameAdvCtx->enabled;
* }
*
* to the start of FrameAdvance_Update, which would allow the system to be toggled on and off by holding R
* and pressing Dpad Down on the specified controller.
*
* Note2: Controllers 2-4's inputs are normally zeroed out, so this would also need to be fixed to use frame advance
*/
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_pause/func_80122660.s")
void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) {
frameAdvCtx->timer = 0;
frameAdvCtx->enabled = false;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_pause/func_80122670.s")
/*
* Returns true when frame advance is not active (game will run normally)
*/
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;
}

View File

@ -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",),