mirror of
https://github.com/zeldaret/mm.git
synced 2026-05-23 23:05:08 -04:00
4fa13e4132
* Delete unused headers * Move PR and io to ultra64 * move headers to ultra64 * more cleanups * more reorganizing * i think that should be all * format * ifdef guards cleanup * Add IO_READ and IO_WRITE macros for future use * warnings * review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * warnings again * warn * ifdef guards * fix merge * fix merge * fix merge * bss * padutils.h * bss * bss * bss * fix merge * bss * bss * bss * fix merge * fixes * fixes * bss * bss * fix merge * fix * fix * fix includepaths * fix paths * bss * fix * ultra64/ -> PR/ * header guards * fix ehader guards * fix * fix++ * format * bss is borken * prevent 2 * :despair: * bss * rename assert to dbg_hungup * fix * a * fix * bss * fix * bss * bss --------- Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
44 lines
1.6 KiB
C
44 lines
1.6 KiB
C
/*
|
|
* 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 "z64frameadvance.h"
|
|
#include "libc/stdbool.h"
|
|
#include "padutils.h"
|
|
#include "macros.h"
|
|
|
|
void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) {
|
|
frameAdvCtx->timer = 0;
|
|
frameAdvCtx->enabled = false;
|
|
}
|
|
|
|
/*
|
|
* 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;
|
|
}
|