mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
[Enhancement] Dpad Ocarina (#324)
* Add dpad ocarina option Co-authored-by: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> * uint8_t --------- Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
This commit is contained in:
co-authored by
Garrett Cox
parent
14927f0962
commit
67e64c58c1
@@ -548,6 +548,8 @@ void DrawEnhancementsMenu() {
|
||||
{ .tooltip = "Enables the partially implemented Sun's Song. RIGHT-DOWN-UP-RIGHT-DOWN-UP to play it. "
|
||||
"This song will make time move very fast until either Link moves to a different scene, "
|
||||
"or when the time switches to a new time period." });
|
||||
UIWidgets::CVarCheckbox("Dpad Ocarina", "gEnhancements.Playback.DpadOcarina",
|
||||
{ .tooltip = "Enables using the Dpad for Ocarina playback." });
|
||||
UIWidgets::CVarCheckbox("Prevent Dropped Ocarina Inputs", "gEnhancements.Playback.NoDropOcarinaInput",
|
||||
{ .tooltip = "Prevent dropping inputs when playing the ocarina quickly" });
|
||||
|
||||
|
||||
@@ -2595,14 +2595,18 @@ void AudioOcarina_PlayControllerInput(u8 isOcarinaSfxSuppressedWhenCancelled) {
|
||||
|
||||
// Ensures the button pressed to start the ocarina does not also play an ocarina note
|
||||
if ((sOcarinaInputButtonStart == 0) ||
|
||||
((sOcarinaInputButtonStart & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)) !=
|
||||
(sOcarinaInputButtonCur & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)))) {
|
||||
((sOcarinaInputButtonStart &
|
||||
(BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP)) !=
|
||||
(sOcarinaInputButtonCur &
|
||||
(BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP)))) {
|
||||
sOcarinaInputButtonStart = 0;
|
||||
if (1) {}
|
||||
sCurOcarinaPitch = OCARINA_PITCH_NONE;
|
||||
sCurOcarinaButtonIndex = OCARINA_BTN_INVALID;
|
||||
ocarinaBtnsHeld = (sOcarinaInputButtonCur & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)) &
|
||||
(sOcarinaInputButtonPrev & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP));
|
||||
ocarinaBtnsHeld = (sOcarinaInputButtonCur & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_DRIGHT |
|
||||
BTN_DLEFT | BTN_DDOWN | BTN_DUP)) &
|
||||
(sOcarinaInputButtonPrev & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP |
|
||||
BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP));
|
||||
|
||||
if (!(sOcarinaInputButtonPress & ocarinaBtnsHeld) && (sOcarinaInputButtonCur != 0)) {
|
||||
sOcarinaInputButtonPress = sOcarinaInputButtonCur;
|
||||
@@ -2610,24 +2614,26 @@ void AudioOcarina_PlayControllerInput(u8 isOcarinaSfxSuppressedWhenCancelled) {
|
||||
sOcarinaInputButtonPress &= ocarinaBtnsHeld;
|
||||
}
|
||||
|
||||
uint8_t dpadCvarActive = CVarGetInteger("gEnhancements.Playback.DpadOcarina", 0);
|
||||
|
||||
// Interprets and transforms controller input into ocarina buttons and notes
|
||||
if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_A)) {
|
||||
sCurOcarinaPitch = OCARINA_PITCH_D4;
|
||||
sCurOcarinaButtonIndex = OCARINA_BTN_A;
|
||||
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CDOWN)) {
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CDOWN | (dpadCvarActive ? BTN_DDOWN : 0))) {
|
||||
sCurOcarinaPitch = OCARINA_PITCH_F4;
|
||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_DOWN;
|
||||
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CRIGHT)) {
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CRIGHT | (dpadCvarActive ? BTN_DRIGHT : 0))) {
|
||||
sCurOcarinaPitch = OCARINA_PITCH_A4;
|
||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_RIGHT;
|
||||
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CLEFT)) {
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CLEFT | (dpadCvarActive ? BTN_DLEFT : 0))) {
|
||||
sCurOcarinaPitch = OCARINA_PITCH_B4;
|
||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_LEFT;
|
||||
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CUP)) {
|
||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CUP | (dpadCvarActive ? BTN_DUP : 0))) {
|
||||
sCurOcarinaPitch = OCARINA_PITCH_D5;
|
||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_UP;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user