Change gPauseAnyCursor into combobox (#2423)

* Change gPauseAnyCursor into combobox

* Add enums

* Change naming
This commit is contained in:
aMannus 2023-01-31 12:53:22 +01:00 committed by GitHub
parent 4e08eca1b9
commit 612700c2ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 14 deletions

View File

@ -2222,6 +2222,13 @@ typedef struct {
const char** palettes;
} SkyboxTableEntry;
typedef enum {
/* 0x00 */ PAUSE_ANY_CURSOR_RANDO_ONLY,
/* 0x01 */ PAUSE_ANY_CURSOR_ALWAYS_ON,
/* 0x02 */ PAUSE_ANY_CURSOR_ALWAYS_OFF,
/* 0x03 */ PAUSE_ANY_CURSOR_MAX
} PauseCursorAnySlotOptions;
#define ROM_FILE(name) \
{ 0, 0, #name }

View File

@ -5,6 +5,7 @@
#include <unordered_map>
#include <utility>
#include <iterator>
#include <variables.h>
#include <ImGui/imgui.h>
#include <ImGui/imgui_internal.h>
@ -296,6 +297,12 @@ namespace GameControlEditor {
ImVec2 cursor = ImGui::GetCursorPos();
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
SohImGui::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail());
UIWidgets::PaddedText("Allow the cursor to be on any slot");
static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" };
UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_MAX, PAUSE_ANY_CURSOR_RANDO_ONLY);
DrawHelpIcon("Allows the cursor on the pause menu to be over any slot. Sometimes required in rando to select "
"certain items.");
UIWidgets::Spacer(0);
UIWidgets::PaddedEnhancementCheckbox("Enable walk speed modifiers", "gEnableWalkModify", true, false);
DrawHelpIcon("Hold the assigned button to change the maximum walking speed\nTo change the assigned button, go into the Ports tabs above");
if (CVarGetInteger("gEnableWalkModify", 0)) {
@ -307,8 +314,6 @@ namespace GameControlEditor {
SohImGui::EndGroupPanel();
}
UIWidgets::Spacer(0);
UIWidgets::PaddedEnhancementCheckbox("Allow the cursor to be on any slot", "gPauseAnyCursor");
DrawHelpIcon("Allows the cursor on the pause menu to be over any slot\nSimilar to Rando and Spaceworld 97");
UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL");
DrawHelpIcon("Speak to Navi with L but enter first-person camera with C-Up");
SohImGui::EndGroupPanel();

View File

@ -599,8 +599,6 @@ const std::vector<PresetEntry> randomizerPresetEntries = {
// Autosave
PRESET_ENTRY_S32("gAutosave", 1),
// Allow the cursor to be on any slot
PRESET_ENTRY_S32("gPauseAnyCursor", 1),
// Customize Fishing Behaviour
PRESET_ENTRY_S32("gCustomizeFishing", 1),

View File

@ -177,6 +177,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
s16 cursorY;
s16 oldCursorPoint;
bool dpad = (CVarGetInteger("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP));
bool pauseAnyCursor = (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && gSaveContext.n64ddFlag) ||
(CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON);
OPEN_DISPS(play->state.gfxCtx);
@ -226,7 +228,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
cursorMoveResult = 1;
}
}
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) || CVarGetInteger("gPauseAnyCursor", 0)) {
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) || pauseAnyCursor) {
cursorMoveResult = 2;
}
} else {
@ -260,7 +262,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
if (CUR_UPG_VALUE(pauseCtx->cursorY[PAUSE_EQUIP]) != 0) {
cursorMoveResult = 1;
}
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) || CVarGetInteger("gPauseAnyCursor", 0)) {
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] & gSaveContext.inventory.equipment) || pauseAnyCursor) {
cursorMoveResult = 2;
}
} else {
@ -311,7 +313,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
cursorMoveResult = 1;
}
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
gSaveContext.inventory.equipment) || CVarGetInteger("gPauseAnyCursor", 0)) {
gSaveContext.inventory.equipment) || pauseAnyCursor) {
cursorMoveResult = 2;
}
} else {
@ -329,7 +331,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
cursorMoveResult = 1;
}
} else if ((gBitFlags[pauseCtx->cursorPoint[PAUSE_EQUIP] - 1] &
gSaveContext.inventory.equipment) || CVarGetInteger("gPauseAnyCursor", 0)) {
gSaveContext.inventory.equipment) || pauseAnyCursor) {
cursorMoveResult = 2;
}
} else {

View File

@ -101,6 +101,8 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
s16 oldCursorPoint;
s16 moveCursorResult;
bool dpad = (CVarGetInteger("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP));
bool pauseAnyCursor = (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && gSaveContext.n64ddFlag) ||
(CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON);
OPEN_DISPS(play->state.gfxCtx);
@ -142,7 +144,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorX[PAUSE_ITEM] -= 1;
pauseCtx->cursorPoint[PAUSE_ITEM] -= 1;
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
CVarGetInteger("gPauseAnyCursor", 0)) {
pauseAnyCursor) {
moveCursorResult = 1;
}
} else {
@ -174,7 +176,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorX[PAUSE_ITEM] += 1;
pauseCtx->cursorPoint[PAUSE_ITEM] += 1;
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
CVarGetInteger("gPauseAnyCursor", 0)) {
pauseAnyCursor) {
moveCursorResult = 1;
}
} else {
@ -296,7 +298,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorY[PAUSE_ITEM] -= 1;
pauseCtx->cursorPoint[PAUSE_ITEM] -= 6;
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
CVarGetInteger("gPauseAnyCursor", 0)) {
pauseAnyCursor) {
moveCursorResult = 1;
}
} else {
@ -310,7 +312,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorY[PAUSE_ITEM] += 1;
pauseCtx->cursorPoint[PAUSE_ITEM] += 6;
if ((gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE) ||
CVarGetInteger("gPauseAnyCursor", 0)) {
pauseAnyCursor) {
moveCursorResult = 1;
}
} else {

View File

@ -1912,7 +1912,10 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
}
}
} else {
if (!pauseCtx->pageIndex && (!CVarGetInteger("gPauseAnyCursor", 0) || (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE))) { // pageIndex == PAUSE_ITEM
bool pauseAnyCursor =
(CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && gSaveContext.n64ddFlag) ||
(CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON);
if (!pauseCtx->pageIndex && (!pauseAnyCursor || (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE))) { // pageIndex == PAUSE_ITEM
pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] =
WREG(49 + gSaveContext.language);
@ -2048,6 +2051,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
void KaleidoScope_UpdateNamePanel(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
u16 sp2A;
bool pauseAnyCursor = (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && gSaveContext.n64ddFlag) ||
(CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON);
if ((pauseCtx->namedItem != pauseCtx->cursorItem[pauseCtx->pageIndex]) ||
((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->cursorSpecialPos != 0))) {
@ -2057,7 +2062,7 @@ void KaleidoScope_UpdateNamePanel(PlayState* play) {
osCreateMesgQueue(&pauseCtx->loadQueue, &pauseCtx->loadMsg, 1);
if (CVarGetInteger("gPauseAnyCursor", 0) &&
if (pauseAnyCursor &&
((pauseCtx->pageIndex == PAUSE_EQUIP && pauseCtx->cursorX[PAUSE_EQUIP] != 0 && !CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) ||
(pauseCtx->pageIndex == PAUSE_ITEM && gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] == ITEM_NONE))) {
pauseCtx->namedItem = PAUSE_ITEM_NONE;