mirror of
https://github.com/zeldaret/oot.git
synced 2025-02-23 15:55:47 +00:00
* ActorContext * frameadvance * SfxSource * GameOverContext * RoomContext * TransitionActorContext * fix bss * Move PlayState * Move play functions to new header * SAC_ENABLE * no longer needed * SAC_ENABLE again * z_demo being silly * comment * format headers * fix retail bss * actually fix bss * Cutscene_ProcessScript comment * bss again * Update src/code/z_demo.c Co-authored-by: cadmic <cadmic24@gmail.com> * rename to frame_advance and remove it from z64.h * move macros too * review * Rename SequenceContext to SceneSequences --------- Co-authored-by: cadmic <cadmic24@gmail.com>
34 lines
1.1 KiB
C
34 lines
1.1 KiB
C
#include "z64frame_advance.h"
|
|
|
|
#include "stdbool.h"
|
|
|
|
#include "padmgr.h"
|
|
#include "macros.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 enable, hold R and press Dpad Down on the specified controller.
|
|
* To advance a frame, hold Z and press R.
|
|
* 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)
|
|
*/
|
|
s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) {
|
|
if (CHECK_BTN_ALL(input->cur.button, BTN_R) && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
|
|
frameAdvCtx->enabled = !frameAdvCtx->enabled;
|
|
}
|
|
|
|
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;
|
|
}
|