1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-22 21:35:27 +00:00
oot/src/code/z_frame_advance.c
fig02 1639417327
code_80110450 (game over) OK* (#739)
* OK (sort of)

* remove hack

* clean up comments
2021-03-28 19:50:46 -04:00

30 lines
1.1 KiB
C

#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 enable, hold R and press Dpad Down on the provided 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;
}