mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-23 05:59:40 +00:00
Fix Dpad Ocarina L Btn & GI Dpad Stuff (#578)
This commit is contained in:
parent
a39a9a58e9
commit
a3add6092b
@ -234,3 +234,22 @@ int GameInteractor_InvertControl(GIInvertType type) {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t GameInteractor_Dpad(GIDpadType type, uint32_t buttonCombo) {
|
||||||
|
uint32_t result = 0;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case GI_DPAD_OCARINA:
|
||||||
|
if (CVarGetInteger("gEnhancements.Playback.DpadOcarina", 0)) {
|
||||||
|
result = buttonCombo;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GI_DPAD_EQUIP:
|
||||||
|
if (CVarGetInteger("gEnhancements.Dpad.DpadEquips", 0)) {
|
||||||
|
result = buttonCombo;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -59,6 +59,11 @@ typedef enum {
|
|||||||
GI_INVERT_CAMERA_RIGHT_STICK_Y,
|
GI_INVERT_CAMERA_RIGHT_STICK_Y,
|
||||||
} GIInvertType;
|
} GIInvertType;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
GI_DPAD_OCARINA,
|
||||||
|
GI_DPAD_EQUIP,
|
||||||
|
} GIDpadType;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -330,6 +335,7 @@ bool GameInteractor_Should(GIVanillaBehavior flag, bool result, void* optionalAr
|
|||||||
flag, [](GIVanillaBehavior _, bool* should, void* opt) body)
|
flag, [](GIVanillaBehavior _, bool* should, void* opt) body)
|
||||||
|
|
||||||
int GameInteractor_InvertControl(GIInvertType type);
|
int GameInteractor_InvertControl(GIInvertType type);
|
||||||
|
uint32_t GameInteractor_Dpad(GIDpadType type, uint32_t buttonCombo);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -559,11 +559,12 @@ typedef enum {
|
|||||||
(void)0
|
(void)0
|
||||||
|
|
||||||
// #region 2S2H [DPad]
|
// #region 2S2H [DPad]
|
||||||
|
#define BTN_DPAD (BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP)
|
||||||
#define DPAD_TO_HELD_ITEM(btn) (btn + EQUIP_SLOT_MAX)
|
#define DPAD_TO_HELD_ITEM(btn) (btn + EQUIP_SLOT_MAX)
|
||||||
#define HELD_ITEM_TO_DPAD(heldBtn) (heldBtn - EQUIP_SLOT_MAX)
|
#define HELD_ITEM_TO_DPAD(heldBtn) (heldBtn - EQUIP_SLOT_MAX)
|
||||||
#define IS_HELD_DPAD(heldBtn) ((heldBtn >= DPAD_TO_HELD_ITEM(EQUIP_SLOT_D_RIGHT)) && (heldBtn <= DPAD_TO_HELD_ITEM(EQUIP_SLOT_D_UP)))
|
#define IS_HELD_DPAD(heldBtn) ((heldBtn >= DPAD_TO_HELD_ITEM(EQUIP_SLOT_D_RIGHT)) && (heldBtn <= DPAD_TO_HELD_ITEM(EQUIP_SLOT_D_UP)))
|
||||||
|
|
||||||
#define BTN_DPAD_EQUIP (CVarGetInteger("gEnhancements.Dpad.DpadEquips", 0) ? (BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP) : 0)
|
#define BTN_DPAD_EQUIP (GameInteractor_Dpad(GI_DPAD_EQUIP, BTN_DPAD))
|
||||||
#define CHECK_BTN_DPAD(input) (CVarGetInteger("gEnhancements.Dpad.DpadEquips", 0) && \
|
#define CHECK_BTN_DPAD(input) (CVarGetInteger("gEnhancements.Dpad.DpadEquips", 0) && \
|
||||||
(CHECK_BTN_ALL(input, BTN_DRIGHT) || \
|
(CHECK_BTN_ALL(input, BTN_DRIGHT) || \
|
||||||
CHECK_BTN_ALL(input, BTN_DLEFT) || \
|
CHECK_BTN_ALL(input, BTN_DLEFT) || \
|
||||||
|
@ -2521,7 +2521,8 @@ void AudioOcarina_CheckSongsWithoutMusicStaff(void) {
|
|||||||
u8 k;
|
u8 k;
|
||||||
|
|
||||||
if (CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_L) &&
|
if (CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_L) &&
|
||||||
CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP)) {
|
CHECK_BTN_ANY(sOcarinaInputButtonCur, BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP |
|
||||||
|
GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DPAD))) {
|
||||||
AudioOcarina_StartDefault(sOcarinaFlags);
|
AudioOcarina_StartDefault(sOcarinaFlags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2596,17 +2597,17 @@ void AudioOcarina_PlayControllerInput(u8 isOcarinaSfxSuppressedWhenCancelled) {
|
|||||||
// Ensures the button pressed to start the ocarina does not also play an ocarina note
|
// Ensures the button pressed to start the ocarina does not also play an ocarina note
|
||||||
if ((sOcarinaInputButtonStart == 0) ||
|
if ((sOcarinaInputButtonStart == 0) ||
|
||||||
((sOcarinaInputButtonStart &
|
((sOcarinaInputButtonStart &
|
||||||
(BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP)) !=
|
(BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DPAD))) !=
|
||||||
(sOcarinaInputButtonCur &
|
(sOcarinaInputButtonCur &
|
||||||
(BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP)))) {
|
(BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DPAD))))) {
|
||||||
sOcarinaInputButtonStart = 0;
|
sOcarinaInputButtonStart = 0;
|
||||||
if (1) {}
|
if (1) {}
|
||||||
sCurOcarinaPitch = OCARINA_PITCH_NONE;
|
sCurOcarinaPitch = OCARINA_PITCH_NONE;
|
||||||
sCurOcarinaButtonIndex = OCARINA_BTN_INVALID;
|
sCurOcarinaButtonIndex = OCARINA_BTN_INVALID;
|
||||||
ocarinaBtnsHeld = (sOcarinaInputButtonCur & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_DRIGHT |
|
ocarinaBtnsHeld = (sOcarinaInputButtonCur & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP |
|
||||||
BTN_DLEFT | BTN_DDOWN | BTN_DUP)) &
|
GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DPAD))) &
|
||||||
(sOcarinaInputButtonPrev & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP |
|
(sOcarinaInputButtonPrev & (BTN_A | BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP |
|
||||||
BTN_DRIGHT | BTN_DLEFT | BTN_DDOWN | BTN_DUP));
|
GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DPAD)));
|
||||||
|
|
||||||
if (!(sOcarinaInputButtonPress & ocarinaBtnsHeld) && (sOcarinaInputButtonCur != 0)) {
|
if (!(sOcarinaInputButtonPress & ocarinaBtnsHeld) && (sOcarinaInputButtonCur != 0)) {
|
||||||
sOcarinaInputButtonPress = sOcarinaInputButtonCur;
|
sOcarinaInputButtonPress = sOcarinaInputButtonCur;
|
||||||
@ -2621,19 +2622,22 @@ void AudioOcarina_PlayControllerInput(u8 isOcarinaSfxSuppressedWhenCancelled) {
|
|||||||
sCurOcarinaPitch = OCARINA_PITCH_D4;
|
sCurOcarinaPitch = OCARINA_PITCH_D4;
|
||||||
sCurOcarinaButtonIndex = OCARINA_BTN_A;
|
sCurOcarinaButtonIndex = OCARINA_BTN_A;
|
||||||
|
|
||||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CDOWN | (dpadCvarActive ? BTN_DDOWN : 0))) {
|
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress,
|
||||||
|
BTN_CDOWN | GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DDOWN))) {
|
||||||
sCurOcarinaPitch = OCARINA_PITCH_F4;
|
sCurOcarinaPitch = OCARINA_PITCH_F4;
|
||||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_DOWN;
|
sCurOcarinaButtonIndex = OCARINA_BTN_C_DOWN;
|
||||||
|
|
||||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CRIGHT | (dpadCvarActive ? BTN_DRIGHT : 0))) {
|
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress,
|
||||||
|
BTN_CRIGHT | GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DRIGHT))) {
|
||||||
sCurOcarinaPitch = OCARINA_PITCH_A4;
|
sCurOcarinaPitch = OCARINA_PITCH_A4;
|
||||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_RIGHT;
|
sCurOcarinaButtonIndex = OCARINA_BTN_C_RIGHT;
|
||||||
|
|
||||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CLEFT | (dpadCvarActive ? BTN_DLEFT : 0))) {
|
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress,
|
||||||
|
BTN_CLEFT | GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DLEFT))) {
|
||||||
sCurOcarinaPitch = OCARINA_PITCH_B4;
|
sCurOcarinaPitch = OCARINA_PITCH_B4;
|
||||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_LEFT;
|
sCurOcarinaButtonIndex = OCARINA_BTN_C_LEFT;
|
||||||
|
|
||||||
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CUP | (dpadCvarActive ? BTN_DUP : 0))) {
|
} else if (CHECK_BTN_ANY(sOcarinaInputButtonPress, BTN_CUP | GameInteractor_Dpad(GI_DPAD_OCARINA, BTN_DUP))) {
|
||||||
sCurOcarinaPitch = OCARINA_PITCH_D5;
|
sCurOcarinaPitch = OCARINA_PITCH_D5;
|
||||||
sCurOcarinaButtonIndex = OCARINA_BTN_C_UP;
|
sCurOcarinaButtonIndex = OCARINA_BTN_C_UP;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "z_arms_hook.h"
|
#include "z_arms_hook.h"
|
||||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||||
#include "objects/object_link_child/object_link_child.h"
|
#include "objects/object_link_child/object_link_child.h"
|
||||||
|
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"
|
||||||
|
|
||||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
|
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20)
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
|
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"
|
||||||
#include "objects/gameplay_keep/gameplay_keep.h"
|
#include "objects/gameplay_keep/gameplay_keep.h"
|
||||||
#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h"
|
#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h"
|
||||||
|
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"
|
||||||
|
|
||||||
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
|
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20)
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "interface/parameter_static/parameter_static.h"
|
#include "interface/parameter_static/parameter_static.h"
|
||||||
|
|
||||||
#include "BenGui/HudEditor.h"
|
#include "BenGui/HudEditor.h"
|
||||||
|
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"
|
||||||
|
|
||||||
s16 sMaskEquipState = EQUIP_STATE_MAGIC_ARROW_GROW_ORB;
|
s16 sMaskEquipState = EQUIP_STATE_MAGIC_ARROW_GROW_ORB;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user