mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-24 06:41:52 -05:00
Fix issue with pause buffer input window not applying correctly to closing save prompt state and move code around to be in order of operations (#4975)
This commit is contained in:
parent
a7f837014f
commit
ac72ebaaa3
@ -25,20 +25,22 @@ static u16 pauseInputs = 0;
|
|||||||
#define PAUSE_STATE_OFF 0
|
#define PAUSE_STATE_OFF 0
|
||||||
#define PAUSE_STATE_OPENING_1 2
|
#define PAUSE_STATE_OPENING_1 2
|
||||||
#define PAUSE_STATE_UNPAUSE_SETUP 18
|
#define PAUSE_STATE_UNPAUSE_SETUP 18
|
||||||
|
#define PAUSE_STATE_SAVEPROMPT 7
|
||||||
|
|
||||||
void RegisterPauseBufferInputs() {
|
void RegisterPauseBufferInputs() {
|
||||||
COND_VB_SHOULD(VB_KALEIDO_UNPAUSE_CLOSE, CVAR_BUFFER_VALUE || CVAR_INCLUDE_VALUE, {
|
COND_VB_SHOULD(VB_KALEIDO_UNPAUSE_CLOSE, CVAR_BUFFER_VALUE || CVAR_INCLUDE_VALUE, {
|
||||||
Input* input = &gPlayState->state.input[0];
|
Input* input = &gPlayState->state.input[0];
|
||||||
|
|
||||||
// Store all inputs that were pressed during the buffer window
|
// STEP #3: If the user opts to include held inputs in the buffer window, store the currnently held inputs, minus
|
||||||
pauseInputs |= input->press.button;
|
// the held inputs when the pause menu was opened. This only applies to the first frame of the buffer window
|
||||||
|
|
||||||
// If the user opts to include held inputs in the buffer window, store the held inputs, minus the held inputs when the pause menu was opened
|
|
||||||
if (CVAR_INCLUDE_VALUE && inputBufferTimer == 0) {
|
if (CVAR_INCLUDE_VALUE && inputBufferTimer == 0) {
|
||||||
pauseInputs |= input->cur.button & ~prePauseInputs;
|
pauseInputs |= input->cur.button & ~prePauseInputs;
|
||||||
prePauseInputs = 0;
|
prePauseInputs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// STEP #4: Store all inputs that were pressed during the buffer window
|
||||||
|
pauseInputs |= input->press.button;
|
||||||
|
|
||||||
// Wait a specified number of frames before continuing the unpause
|
// Wait a specified number of frames before continuing the unpause
|
||||||
inputBufferTimer++;
|
inputBufferTimer++;
|
||||||
if (inputBufferTimer < CVAR_BUFFER_VALUE) {
|
if (inputBufferTimer < CVAR_BUFFER_VALUE) {
|
||||||
@ -54,10 +56,21 @@ void RegisterPauseBufferInputs() {
|
|||||||
Input* input = &gPlayState->state.input[0];
|
Input* input = &gPlayState->state.input[0];
|
||||||
PauseContext* pauseCtx = &gPlayState->pauseCtx;
|
PauseContext* pauseCtx = &gPlayState->pauseCtx;
|
||||||
|
|
||||||
// if the input buffer timer is not 0 and the pause state is off, then the player just unpaused
|
// STEP #1: If the user opts to include held inputs in the buffer window, store the held inputs at the beginning
|
||||||
if (inputBufferTimer != 0 && pauseCtx->state == PAUSE_STATE_OFF) {
|
// of the pause process, minus the START input
|
||||||
inputBufferTimer = 0;
|
if (pauseCtx->state == PAUSE_STATE_OPENING_1 && CVAR_INCLUDE_VALUE) {
|
||||||
|
prePauseInputs = input->cur.button & ~BTN_START;
|
||||||
|
}
|
||||||
|
|
||||||
|
// STEP #2: The unpause process has begun, so let's reset the input buffer timer
|
||||||
|
if (pauseCtx->state == PAUSE_STATE_UNPAUSE_SETUP || (
|
||||||
|
pauseCtx->state == PAUSE_STATE_SAVEPROMPT && (pauseCtx->unk_1EC == 2 || pauseCtx->unk_1EC == 5)
|
||||||
|
)) {
|
||||||
|
inputBufferTimer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// STEP #5: If the input buffer timer is not 0 and the pause state is off, then the player just unpaused
|
||||||
|
if (inputBufferTimer != 0 && pauseCtx->state == PAUSE_STATE_OFF) {
|
||||||
// If the user opts into easy frame advance, remove START input
|
// If the user opts into easy frame advance, remove START input
|
||||||
if (CVAR_FRAME_ADVANCE_VALUE) {
|
if (CVAR_FRAME_ADVANCE_VALUE) {
|
||||||
pauseInputs &= ~BTN_START;
|
pauseInputs &= ~BTN_START;
|
||||||
@ -65,17 +78,10 @@ void RegisterPauseBufferInputs() {
|
|||||||
|
|
||||||
// So we need to re-apply the inputs that were pressed during the buffer window
|
// So we need to re-apply the inputs that were pressed during the buffer window
|
||||||
input->press.button |= pauseInputs;
|
input->press.button |= pauseInputs;
|
||||||
}
|
|
||||||
|
|
||||||
// Reset the timer and stored inputs at the beginning of the unpause process
|
// Reset the used variables
|
||||||
if (pauseCtx->state == PAUSE_STATE_UNPAUSE_SETUP && pauseCtx->unk_1F4 != 160.0f) {
|
|
||||||
inputBufferTimer = 0;
|
|
||||||
pauseInputs = 0;
|
pauseInputs = 0;
|
||||||
}
|
inputBufferTimer = 0;
|
||||||
|
|
||||||
// If the user opts to include held inputs in the buffer window, store the held inputs at the beginning of the pause process, minus the START input
|
|
||||||
if (pauseCtx->state == PAUSE_STATE_OPENING_1 && CVAR_INCLUDE_VALUE) {
|
|
||||||
prePauseInputs = input->cur.button & ~BTN_START;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user