[Enhancement] Adds options for when the deku palace guard search balls will appear (#866)

* [Enhancement] Adds options for when the deku palace guard search balls will appear

* Addresses review comments

* Moves DekuGuardSearchBalls enhancement to difficulty options

* Remove unused variadic argument
This commit is contained in:
Liam Scholte 2024-11-25 20:25:59 -08:00 committed by GitHub
parent 7c222f9656
commit af0ea33e08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 66 additions and 2 deletions

View File

@ -68,6 +68,12 @@ static const std::unordered_map<int32_t, const char*> timeStopOptions = {
{ TIME_STOP_TEMPLES_DUNGEONS, "Temples + Mini Dungeons" },
};
static const std::unordered_map<int32_t, const char*> dekuGuardSearchBallsOptions = {
{ DEKU_GUARD_SEARCH_BALLS_NEVER, "Never" },
{ DEKU_GUARD_SEARCH_BALLS_NIGHT_ONLY, "Night Only" },
{ DEKU_GUARD_SEARCH_BALLS_ALWAYS, "Always" },
};
namespace BenGui {
std::shared_ptr<std::vector<Ship::WindowBackend>> availableWindowBackends;
std::unordered_map<Ship::WindowBackend, const char*> availableWindowBackendsMap;
@ -789,6 +795,14 @@ void DrawEnhancementsMenu() {
"swords. It may still steal other items." })) {
RegisterDisableTakkuriSteal();
}
UIWidgets::CVarCombobox(
"Deku Guard Search Balls", "gEnhancements.Cheats.DekuGuardSearchBalls", dekuGuardSearchBallsOptions,
{ .tooltip = "Choose when to show the Deku Palace Guards' search balls\n"
"- Never: Never show the search balls. This matches Majora's Mask 3D behaviour\n"
"- Night Only: Only show the search balls at night. This matches original N64 behaviour.\n"
"- Always: Always show the search balls.",
.defaultIndex = DEKU_GUARD_SEARCH_BALLS_NIGHT_ONLY });
ImGui::EndMenu();
}

View File

@ -426,6 +426,12 @@ static const std::unordered_map<int32_t, const char*> notificationPosition = {
{ 0, "Top Left" }, { 1, "Top Right" }, { 2, "Bottom Left" }, { 3, "Bottom Right" }, { 4, "Hidden" },
};
static const std::unordered_map<int32_t, const char*> dekuGuardSearchBallsOptions = {
{ DEKU_GUARD_SEARCH_BALLS_NEVER, "Never" },
{ DEKU_GUARD_SEARCH_BALLS_NIGHT_ONLY, "Night Only" },
{ DEKU_GUARD_SEARCH_BALLS_ALWAYS, "Always" },
};
void FreeLookPitchMinMax() {
f32 maxY = CVarGetFloat("gEnhancements.Camera.FreeLook.MaxPitch", 72.0f);
f32 minY = CVarGetFloat("gEnhancements.Camera.FreeLook.MinPitch", -49.0f);
@ -1404,6 +1410,7 @@ void AddEnhancements() {
WIDGET_CVAR_CHECKBOX,
{},
[](widgetInfo& info) { RegisterWoodfallMountainAppearance(); } } } } });
enhancementsSidebar.push_back(
{ "Difficulty Options",
3,
@ -1412,7 +1419,16 @@ void AddEnhancements() {
"Prevents the Takkuri from stealing key items like bottles and swords. It may still steal other items.",
WIDGET_CVAR_CHECKBOX,
{},
[](widgetInfo& info) { RegisterDisableTakkuriSteal(); } } } } });
[](widgetInfo& info) { RegisterDisableTakkuriSteal(); } },
{ "Deku Guard Search Balls",
"gEnhancements.Cheats.DekuGuardSearchBalls",
"Choose when to show the Deku Palace Guards' search balls\n"
"- Never: Never show the search balls. This matches Majora's Mask 3D behaviour\n"
"- Night Only: Only show the search balls at night. This matches original N64 behaviour.\n"
"- Always: Always show the search balls.",
WIDGET_CVAR_COMBOBOX,
{ .defaultVariant = DEKU_GUARD_SEARCH_BALLS_NIGHT_ONLY,
.comboBoxOptions = dekuGuardSearchBallsOptions } } } } });
enhancementsSidebar.push_back({ "HUD Editor",
1,
{ // HUD Editor

View File

@ -0,0 +1,22 @@
#include <libultraship/bridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "Enhancements/Enhancements.h"
extern "C" {
#include "variables.h"
}
void RegisterShowDekuGuardSearchBalls() {
REGISTER_VB_SHOULD(VB_DEKU_GUARD_SHOW_SEARCH_BALLS, {
uint8_t selectedOption =
CVarGetInteger("gEnhancements.Cheats.DekuGuardSearchBalls", DEKU_GUARD_SEARCH_BALLS_NIGHT_ONLY);
switch (selectedOption) {
case DEKU_GUARD_SEARCH_BALLS_NEVER:
*should = false;
break;
case DEKU_GUARD_SEARCH_BALLS_ALWAYS:
*should = true;
break;
}
});
}

View File

@ -2,5 +2,6 @@
#define DIFFICULTY_OPTIONS_H
void RegisterDisableTakkuriSteal();
void RegisterShowDekuGuardSearchBalls();
#endif // DIFFICULTY_OPTIONS_H

View File

@ -83,4 +83,5 @@ void InitEnhancements() {
// Difficulty Options
RegisterDisableTakkuriSteal();
RegisterShowDekuGuardSearchBalls();
}

View File

@ -42,6 +42,12 @@ enum CremiaRewardsOptions {
CREMIA_REWARD_ALWAYS_RUPEE,
};
enum DekuGuardSearchBallsOptions {
DEKU_GUARD_SEARCH_BALLS_NIGHT_ONLY,
DEKU_GUARD_SEARCH_BALLS_NEVER,
DEKU_GUARD_SEARCH_BALLS_ALWAYS,
};
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -74,6 +74,7 @@ typedef enum {
VB_TRANSFORM_THUNDER_MATRIX,
VB_PLAY_HEART_CONTAINER_GET_FANFARE,
VB_BE_HOOKSHOT_SURFACE,
VB_DEKU_GUARD_SHOW_SEARCH_BALLS,
} GIVanillaBehavior;
typedef enum {

View File

@ -7,6 +7,8 @@
#include "z_en_look_nuts.h"
#include "overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.h"
#include "2s2h/GameInteractor/GameInteractor.h"
#define FLAGS (ACTOR_FLAG_80000000)
#define THIS ((EnLookNuts*)thisx)
@ -354,9 +356,10 @@ void EnLookNuts_Update(Actor* thisx, PlayState* play) {
if (!this->isPlayerDetected) {
s16 effectFlags = SOLDERSRCHBALL_INVISIBLE;
if (gSaveContext.save.isNight) {
if (GameInteractor_Should(VB_DEKU_GUARD_SHOW_SEARCH_BALLS, gSaveContext.save.isNight)) {
effectFlags = 0;
}
if (Player_GetMask(play) != PLAYER_MASK_STONE) {
EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, 50, &this->isPlayerDetected,
effectFlags);