Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add checkbox to make holding the D-pad act like holding the joystick on the file and pause screens #454

Merged
merged 2 commits into from
Jun 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion soh/src/code/z_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -7532,7 +7532,7 @@ Vec3s Camera_Update(Camera* camera) {
BINANG_TO_DEGF(camera->camDir.x), camera->camDir.y, BINANG_TO_DEGF(camera->camDir.y));
}

if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT)) {
if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT) && CVar_GetS32("gDebugCamera", 0)) {
camera->timer = 0;
}

Expand Down
50 changes: 48 additions & 2 deletions soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,6 +1615,52 @@ void FileChoose_Main(GameState* thisx) {
this->stickRelX = input->rel.stick_x;
this->stickRelY = input->rel.stick_y;

if (CVar_GetS32("gDpadHoldChange", 1) && CVar_GetS32("gDpadPauseName", 0)) {
if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
this->inputTimerX = 10;
this->stickXDir = -1;
} else if (--(this->inputTimerX) < 0) {
this->inputTimerX = XREG(6);
input->press.button |= BTN_DLEFT;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DLEFT)) {
this->stickXDir = 0;
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
this->inputTimerX = 10;
this->stickXDir = 1;
} else if (--(this->inputTimerX) < 0) {
this->inputTimerX = XREG(6);
input->press.button |= BTN_DRIGHT;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DRIGHT)) {
this->stickXDir = 0;
}

if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
this->inputTimerY = 10;
this->stickYDir = -1;
} else if (--(this->inputTimerY) < 0) {
this->inputTimerY = XREG(6);
input->press.button |= BTN_DDOWN;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DDOWN)) {
this->stickYDir = 0;
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
this->inputTimerY = 10;
this->stickYDir = -1;
} else if (--(this->inputTimerY) < 0) {
this->inputTimerY = XREG(6);
input->press.button |= BTN_DUP;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DUP)) {
this->stickYDir = 0;
}
}

if (this->stickRelX < -30) {
if (this->stickXDir == -1) {
this->inputTimerX--;
Expand Down Expand Up @@ -1645,7 +1691,7 @@ void FileChoose_Main(GameState* thisx) {

if (this->stickRelY < -30) {
if (this->stickYDir == -1) {
this->inputTimerY -= 1;
this->inputTimerY--;
if (this->inputTimerY < 0) {
this->inputTimerY = 2;
} else {
Expand All @@ -1657,7 +1703,7 @@ void FileChoose_Main(GameState* thisx) {
}
} else if (this->stickRelY > 30) {
if (this->stickYDir == 1) {
this->inputTimerY -= 1;
this->inputTimerY--;
if (this->inputTimerY < 0) {
this->inputTimerY = 2;
} else {
Expand Down
51 changes: 49 additions & 2 deletions soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {

bool dpad = CVar_GetS32("gDpadPauseName", 0);
if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DLEFT))) {
if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->cur.button, BTN_DLEFT))) {
pauseCtx->pageSwitchTimer++;
if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
KaleidoScope_SwitchPage(pauseCtx, 0);
Expand All @@ -956,7 +956,7 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
pauseCtx->pageSwitchTimer = -1;
}
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) {
if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT))) {
if ((pauseCtx->stickRelX > 30) || (dpad && CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT))) {
pauseCtx->pageSwitchTimer++;
if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
KaleidoScope_SwitchPage(pauseCtx, 2);
Expand Down Expand Up @@ -1115,6 +1115,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
static s16 D_8082AD4C = 0;
static s16 D_8082AD50 = 0;
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Input* input = &globalCtx->state.input[0];
s16 stepR;
s16 stepG;
s16 stepB;
Expand Down Expand Up @@ -1155,6 +1156,52 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
}
}

if (CVar_GetS32("gDpadHoldChange", 1) && CVar_GetS32("gDpadPauseName", 0)) {
if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) {
D_8082AD44 = XREG(8);
D_8082AD4C = -1;
} else if (--D_8082AD44 < 0) {
D_8082AD44 = XREG(6);
input->press.button |= BTN_DLEFT;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DLEFT)) {
D_8082AD4C = 0;
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) {
D_8082AD44 = XREG(8);
D_8082AD4C = 1;
} else if (--D_8082AD44 < 0) {
D_8082AD44 = XREG(6);
input->press.button |= BTN_DRIGHT;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DRIGHT)) {
D_8082AD4C = 0;
}

if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
D_8082AD48 = XREG(8);
D_8082AD50 = -1;
} else if (--D_8082AD48 < 0) {
D_8082AD48 = XREG(6);
input->press.button |= BTN_DDOWN;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DDOWN)) {
D_8082AD50 = 0;
} else if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
D_8082AD48 = XREG(8);
D_8082AD50 = 1;
} else if (--D_8082AD48 < 0) {
D_8082AD48 = XREG(6);
input->press.button |= BTN_DUP;
}
} else if (CHECK_BTN_ALL(input->rel.button, BTN_DUP)) {
D_8082AD50 = 0;
}
}

if (pauseCtx->stickRelX < -30) {
if (D_8082AD4C == -1) {
if (--D_8082AD44 < 0) {
Expand Down