summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorAdam Bird <Archez@users.noreply.github.com>2023-08-14 22:01:36 -0400
committerGitHub <noreply@github.com>2023-08-14 22:01:36 -0400
commit74d6678543417e5b26924480a41f3d237294d71f (patch)
tree4468632e763d025e3666afd1ffbf11a7dedd6fdd /soh/src/code
parentb2aa24b8b0efd8529dc355256287711df1e48749 (diff)
parent633bec3a1c4a9058c9edb93a858d26405222291b (diff)
Merge pull request #3121 from Archez/mergeSuluBravo
Merge Sulu Bravo -> develop
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/padmgr.c13
-rw-r--r--soh/src/code/z_camera.c25
-rw-r--r--soh/src/code/z_kaleido_setup.c15
-rw-r--r--soh/src/code/z_parameter.c32
-rw-r--r--soh/src/code/z_play.c9
5 files changed, 51 insertions, 43 deletions
diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c
index abfa029e1..4735a259c 100644
--- a/soh/src/code/padmgr.c
+++ b/soh/src/code/padmgr.c
@@ -284,6 +284,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);
@@ -295,12 +302,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_camera.c b/soh/src/code/z_camera.c
index e0d827107..325eca828 100644
--- a/soh/src/code/z_camera.c
+++ b/soh/src/code/z_camera.c
@@ -1678,12 +1678,13 @@ s32 Camera_Normal1(Camera* camera) {
Camera_ClampDist(camera, eyeAdjustment.r, norm1->distMin, norm1->distMax, anim->unk_28);
if (anim->startSwingTimer <= 0) {
+ // idle camera re-center
if (CVarGetInteger("gA11yDisableIdleCam", 0)) return;
eyeAdjustment.pitch = atEyeNextGeo.pitch;
eyeAdjustment.yaw =
Camera_LERPCeilS(anim->swingYawTarget, atEyeNextGeo.yaw, 1.0f / camera->yawUpdateRateInv, 0xA);
} else if (anim->swing.unk_18 != 0) {
- if (CVarGetInteger("gA11yDisableIdleCam", 0)) return;
+ // camera adjustments when obstructed/pushed by scene geometry
eyeAdjustment.yaw =
Camera_LERPCeilS(anim->swing.unk_16, atEyeNextGeo.yaw, 1.0f / camera->yawUpdateRateInv, 0xA);
eyeAdjustment.pitch =
@@ -1708,19 +1709,19 @@ s32 Camera_Normal1(Camera* camera) {
if ((camera->status == CAM_STAT_ACTIVE) && (!(norm1->interfaceFlags & 0x10))) {
anim->swingYawTarget = BINANG_ROT180(camera->playerPosRot.rot.y);
if (!CVarGetInteger("gFixCameraSwing", 0)) {
- if (anim->startSwingTimer > 0) {
- func_80046E20(camera, &eyeAdjustment, norm1->distMin, norm1->unk_0C, &sp98, &anim->swing);
- } else {
- sp88 = *eyeNext;
- anim->swing.swingUpdateRate = camera->yawUpdateRateInv = norm1->unk_0C * 2.0f;
- if (Camera_BGCheck(camera, at, &sp88)) {
- anim->swingYawTarget = atEyeNextGeo.yaw;
- anim->startSwingTimer = -1;
+ if (anim->startSwingTimer > 0) {
+ func_80046E20(camera, &eyeAdjustment, norm1->distMin, norm1->unk_0C, &sp98, &anim->swing);
} else {
- *eye = *eyeNext;
+ sp88 = *eyeNext;
+ anim->swing.swingUpdateRate = camera->yawUpdateRateInv = norm1->unk_0C * 2.0f;
+ if (Camera_BGCheck(camera, at, &sp88)) {
+ anim->swingYawTarget = atEyeNextGeo.yaw;
+ anim->startSwingTimer = -1;
+ } else {
+ *eye = *eyeNext;
+ }
+ anim->swing.unk_18 = 0;
}
- anim->swing.unk_18 = 0;
- }
} else {
if (anim->startSwingTimer <= 0) {
anim->swing.swingUpdateRate = camera->yawUpdateRateInv = norm1->unk_0C * 2.0f;
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_parameter.c b/soh/src/code/z_parameter.c
index a124ff5ce..9ac51adab 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -6442,26 +6442,24 @@ void Interface_Update(PlayState* play) {
gSaveContext.rupees--;
Audio_PlaySoundGeneral(NA_SE_SY_RUPY_COUNT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
- if (gSaveContext.rupeeAccumulator == 0) {
- if (gSaveContext.pendingSale != ITEM_NONE) {
- u16 tempSaleItem = gSaveContext.pendingSale;
- u16 tempSaleMod = gSaveContext.pendingSaleMod;
- gSaveContext.pendingSale = ITEM_NONE;
- gSaveContext.pendingSaleMod = MOD_NONE;
- if (tempSaleMod == MOD_NONE) {
- s16 giid = GetGIID(tempSaleItem);
- if (giid == -1) {
- tempSaleMod = MOD_RANDOMIZER;
- } else {
- tempSaleItem = giid;
- }
- }
- GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
- }
- }
} else {
gSaveContext.rupeeAccumulator = 0;
}
+ if (gSaveContext.rupeeAccumulator == 0 && gSaveContext.pendingSale != ITEM_NONE) {
+ u16 tempSaleItem = gSaveContext.pendingSale;
+ u16 tempSaleMod = gSaveContext.pendingSaleMod;
+ gSaveContext.pendingSale = ITEM_NONE;
+ gSaveContext.pendingSaleMod = MOD_NONE;
+ if (tempSaleMod == MOD_NONE) {
+ s16 giid = GetGIID(tempSaleItem);
+ if (giid == -1) {
+ tempSaleMod = MOD_RANDOMIZER;
+ } else {
+ tempSaleItem = giid;
+ }
+ }
+ GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
+ }
}
switch (interfaceCtx->unk_1EC) {
diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c
index 352ae03cd..dc5b890ec 100644
--- a/soh/src/code/z_play.c
+++ b/soh/src/code/z_play.c
@@ -1761,12 +1761,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);