diff options
| author | Adam Bird <Archez@users.noreply.github.com> | 2023-08-13 11:41:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-13 11:41:19 -0400 |
| commit | 91c6eba0d0cbd00c2dbb5278c2f26a7e76aa2585 (patch) | |
| tree | 61d852e0be81c2352848ec95cf1c42601d0aee08 /soh/src/code | |
| parent | 78790fe8aab4f33673a13e875a90240f9060248f (diff) | |
tweak: easy pause buffer to track inputs better (#3054)
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/padmgr.c | 13 | ||||
| -rw-r--r-- | soh/src/code/z_kaleido_setup.c | 15 | ||||
| -rw-r--r-- | soh/src/code/z_play.c | 9 |
3 files changed, 23 insertions, 14 deletions
diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c index 81227f11e..b8d8d8b05 100644 --- a/soh/src/code/padmgr.c +++ b/soh/src/code/padmgr.c @@ -287,6 +287,13 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) { Fault_AddHungupAndCrash(__FILE__, __LINE__); } + // When 3 frames are left on easy pause buffer, re-apply the last held inputs to the prev inputs + // to compute the pressed difference. This makes it so previously held inputs are continued as "held", + // but new inputs when unpausing are "pressed" out of the pause menu. + if (CVarGetInteger("gCheatEasyPauseBufferTimer", 0) == 3) { + input->prev.button = CVarGetInteger("gCheatEasyPauseBufferLastInputs", 0); + } + buttonDiff = input->prev.button ^ input->cur.button; input->press.button |= (u16)(buttonDiff & input->cur.button); input->rel.button |= (u16)(buttonDiff & input->prev.button); @@ -298,12 +305,6 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) { uint8_t rumble = (padMgr->rumbleEnable[0] > 0); OTRControllerCallback(rumble); - if (CVarGetInteger("gPauseBufferBlockInputFrame", 0)) { - ControllerBlockGameInput(PAUSE_BUFFER_INPUT_BLOCK_ID); - } else { - ControllerUnblockGameInput(PAUSE_BUFFER_INPUT_BLOCK_ID); - } - PadMgr_UnlockPadData(padMgr); } diff --git a/soh/src/code/z_kaleido_setup.c b/soh/src/code/z_kaleido_setup.c index 94cb91d49..a335c2460 100644 --- a/soh/src/code/z_kaleido_setup.c +++ b/soh/src/code/z_kaleido_setup.c @@ -18,15 +18,24 @@ void KaleidoSetup_Update(PlayState* play) { play->shootingGalleryStatus <= 1 && gSaveContext.magicState != 8 && gSaveContext.magicState != 9 && (play->sceneNum != SCENE_BOWLING || !Flags_GetSwitch(play, 0x38))) { - if (CVarGetInteger("gCheatEasyPauseBufferFrameAdvance", 0) == 2 && !CHECK_BTN_ALL(input->press.button, BTN_START)) { - CVarSetInteger("gCheatEasyPauseBufferFrameAdvance", 0); + u8 easyPauseBufferEnabled = CVarGetInteger("gCheatEasyPauseBufferEnabled", 0); + u8 easyPauseBufferTimer = CVarGetInteger("gCheatEasyPauseBufferTimer", 0); + + // If start is not seen as pressed on the 2nd to last frame then we should end the easy frame advance flow + if (easyPauseBufferEnabled && easyPauseBufferTimer == 2 && + !CHECK_BTN_ALL(input->press.button, BTN_START)) { + CVarSetInteger("gCheatEasyPauseBufferTimer", 0); } if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { if (BREG(0)) { pauseCtx->debugState = 3; } - } else if ((CHECK_BTN_ALL(input->press.button, BTN_START) && !CVarGetInteger("gCheatEasyPauseBufferFrameAdvance", 0)) || CVarGetInteger("gCheatEasyPauseBufferFrameAdvance", 0) == 1) { + } else if ((CHECK_BTN_ALL(input->press.button, BTN_START) && (!easyPauseBufferEnabled || !easyPauseBufferTimer)) || + (easyPauseBufferEnabled && easyPauseBufferTimer == 1)) { // Force Kaleido open when easy pause buffer reaches 0 + // Remember last held buttons for pause buffer cheat (minus start so easy frame advance works) + CVarSetInteger("gCheatEasyPauseBufferLastInputs", input->cur.button & ~(BTN_START)); + gSaveContext.unk_13EE = gSaveContext.unk_13EA; if (CHECK_BTN_ALL(input->cur.button, BTN_L)) diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 935b8b690..f6c6ed4d9 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -1754,12 +1754,11 @@ time_t Play_GetRealTime() { void Play_Main(GameState* thisx) { PlayState* play = (PlayState*)thisx; - if (CVarGetInteger("gCheatEasyPauseBufferFrameAdvance", 0)) { - CVarSetInteger("gCheatEasyPauseBufferFrameAdvance", CVarGetInteger("gCheatEasyPauseBufferFrameAdvance", 0) - 1); - } - if (CVarGetInteger("gPauseBufferBlockInputFrame", 0)) { - CVarSetInteger("gPauseBufferBlockInputFrame", CVarGetInteger("gPauseBufferBlockInputFrame", 0) - 1); + // Decrease the easy pause buffer timer every frame + if (CVarGetInteger("gCheatEasyPauseBufferTimer", 0) > 0) { + CVarSetInteger("gCheatEasyPauseBufferTimer", CVarGetInteger("gCheatEasyPauseBufferTimer", 0) - 1); } + if (play->envCtx.unk_EE[2] == 0 && CVarGetInteger("gLetItSnow", 0)) { play->envCtx.unk_EE[3] = 64; Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_OBJECT_KANKYO, 0, 0, 0, 0, 0, 0, 3, 0); |
