This commit is contained in:
hatcyl 2024-10-06 13:07:59 -04:00 committed by GitHub
commit 0380d5bd20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 87 additions and 15 deletions

View File

@ -5,7 +5,7 @@
<form class="config__form" id="conf-general__form">
<div class="config__hz-wrapper" id="conf-general__hz-wrapper">
<!-- Options -->
<div class="config__wrapper" data-event-mouseout="set_cur_config_index(-1)" id="conf-general__wrapper">
<div class="config__wrapper" data-event-mouseout="set_cur_config_index(-1)" id="conf-general__wrapper" style="overflow:auto;max-height:100%">
<!-- targeting mode -->
<div class="config-option" data-event-mouseover="set_cur_config_index(0)" id="conf-general__Targeting-Mode">
<label class="config-option__title">Targeting Mode</label>
@ -268,7 +268,7 @@
data-checked="analog_camera_invert_mode"
value="InvertNone"
id="analog_camera_inversion_none"
style="nav-up: #analog_cam_enabled;"
style="nav-up: #analog_cam_enabled; nav-down: #special_item_hud_enabled"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_none">None</label>
@ -280,7 +280,7 @@
data-checked="analog_camera_invert_mode"
value="InvertX"
id="analog_camera_inversion_x"
style="nav-up: #analog_cam_disabled;"
style="nav-up: #analog_cam_disabled; nav-down: #special_item_hud_enabled"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_x">Invert X</label>
@ -292,7 +292,7 @@
data-checked="analog_camera_invert_mode"
value="InvertY"
id="analog_camera_inversion_y"
style="nav-up: #analog_cam_disabled;"
style="nav-up: #analog_cam_disabled; nav-down: #special_item_hud_disabled"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_y">Invert Y</label>
@ -304,11 +304,41 @@
data-checked="analog_camera_invert_mode"
value="InvertBoth"
id="analog_camera_inversion_both"
style="nav-up: #analog_cam_disabled;"
style="nav-up: #analog_cam_disabled; nav-down: #special_item_hud_disabled"
/>
<label class="config-option__tab-label" for="analog_camera_inversion_both">Invert Both</label>
</div>
</div>
<!-- special item hud -->
<div class="config-option" data-event-mouseover="set_cur_config_index(10)">
<label class="config-option__title">Special Item HUD</label>
<div class="config-option__list">
<input
type="radio"
data-event-blur="set_cur_config_index(-1)"
data-event-focus="set_cur_config_index(10)"
name="special_item_hud_mode"
data-checked="special_item_hud_mode"
value="On"
id="special_item_hud_enabled"
style="nav-up: #analog_camera_inversion_none;"
/>
<label class="config-option__tab-label" for="special_item_hud_enabled">On</label>
<input
type="radio"
data-event-blur="set_cur_config_index(-1)"
data-event-focus="set_cur_config_index(10)"
name="special_item_hud_mode"
data-checked="special_item_hud_mode"
value="Off"
id="special_item_hud_disabled"
style="nav-up: #analog_camera_inversion_x;"
/>
<label class="config-option__tab-label" for="special_item_hud_disabled">Off</label>
</div>
</div>
</div>
<!-- Descriptions -->
<div class="config__wrapper">
@ -362,6 +392,9 @@
<p data-if="cur_config_index == 9">
Inverts the camera controls for the analog camera if it's enabled. <b>None</b> is the default.
</p>
<p data-if="cur_config_index == 10">
Enables visibility of the special item HUD. Affects visibility only, functionality can be modified in the <b>Controls</b> setting tab. <b>On</b> is the default.
</p>
</div>
</div>
</form>

View File

@ -35,6 +35,9 @@ namespace zelda64 {
{zelda64::AutosaveMode::Off, "Off"}
});
AutosaveMode get_autosave_mode();
void set_autosave_mode(AutosaveMode mode);
enum class TargetingMode {
Switch,
Hold,
@ -81,12 +84,23 @@ namespace zelda64 {
{zelda64::AnalogCamMode::Off, "Off"}
});
AutosaveMode get_autosave_mode();
void set_autosave_mode(AutosaveMode mode);
AnalogCamMode get_analog_cam_mode();
void set_analog_cam_mode(AnalogCamMode mode);
enum class SpecialItemHudMode {
On,
Off,
OptionCount
};
NLOHMANN_JSON_SERIALIZE_ENUM(zelda64::SpecialItemHudMode, {
{zelda64::SpecialItemHudMode::On, "On"},
{zelda64::SpecialItemHudMode::Off, "Off"}
});
SpecialItemHudMode get_special_item_hud_mode();
void set_special_item_hud_mode(SpecialItemHudMode mode);
void open_quit_game_prompt();
};

View File

@ -27,6 +27,7 @@
#define gRandFloat sRandFloat
#include "global.h"
#include "rt64_extended_gbi.h"
#include "patch_helpers.h"
#ifndef gEXFillRectangle
#define gEXFillRectangle(cmd, lorigin, rorigin, ulx, uly, lrx, lry) \
@ -101,4 +102,6 @@ void draw_autosave_icon(PlayState* play);
void recomp_crash(const char* err);
DECLARE_FUNC(s32, recomp_special_item_hud_enabled);
#endif

View File

@ -44,3 +44,4 @@ recomp_get_inverted_axes = 0x8F0000A4;
recomp_high_precision_fb_enabled = 0x8F0000A8;
recomp_get_resolution_scale = 0x8F0000AC;
recomp_get_analog_inverted_axes = 0x8F0000B0;
recomp_special_item_hud_enabled = 0x8F0000B4;

View File

@ -488,8 +488,10 @@ RECOMP_PATCH void Interface_Draw(PlayState* play) {
// @recomp Draw the D-Pad and its item icons as well as the autosave icon if the game is unpaused.
if (pauseCtx->state != PAUSE_STATE_MAIN) {
draw_dpad(play);
draw_dpad_icons(play);
if (recomp_special_item_hud_enabled()) {
draw_dpad(play);
draw_dpad_icons(play);
}
draw_autosave_icon(play);
}

View File

@ -219,6 +219,7 @@ bool save_general_config(const std::filesystem::path& path) {
config_json["autosave_mode"] = zelda64::get_autosave_mode();
config_json["camera_invert_mode"] = zelda64::get_camera_invert_mode();
config_json["analog_cam_mode"] = zelda64::get_analog_cam_mode();
config_json["special_item_hud_mode"] = zelda64::get_special_item_hud_mode();
config_json["analog_camera_invert_mode"] = zelda64::get_analog_camera_invert_mode();
config_json["debug_mode"] = zelda64::get_debug_mode_enabled();
@ -235,6 +236,7 @@ void set_general_settings_from_json(const nlohmann::json& config_json) {
zelda64::set_autosave_mode(from_or_default(config_json, "autosave_mode", zelda64::AutosaveMode::On));
zelda64::set_camera_invert_mode(from_or_default(config_json, "camera_invert_mode", zelda64::CameraInvertMode::InvertY));
zelda64::set_analog_cam_mode(from_or_default(config_json, "analog_cam_mode", zelda64::AnalogCamMode::Off));
zelda64::set_special_item_hud_mode(from_or_default(config_json, "special_item_hud_mode", zelda64::SpecialItemHudMode::On));
zelda64::set_analog_camera_invert_mode(from_or_default(config_json, "analog_camera_invert_mode", zelda64::CameraInvertMode::InvertNone));
zelda64::set_debug_mode_enabled(from_or_default(config_json, "debug_mode", false));
}

View File

@ -135,6 +135,10 @@ extern "C" void recomp_analog_cam_enabled(uint8_t* rdram, recomp_context* ctx) {
_return<s32>(ctx, zelda64::get_analog_cam_mode() == zelda64::AnalogCamMode::On);
}
extern "C" void recomp_special_item_hud_enabled(uint8_t * rdram, recomp_context * ctx) {
_return<s32>(ctx, zelda64::get_special_item_hud_mode() == zelda64::SpecialItemHudMode::On);
}
extern "C" void recomp_get_camera_inputs(uint8_t* rdram, recomp_context* ctx) {
float* x_out = _arg<0, float*>(rdram, ctx);
float* y_out = _arg<1, float*>(rdram, ctx);

View File

@ -290,6 +290,7 @@ struct ControlOptionsContext {
zelda64::AutosaveMode autosave_mode;
zelda64::CameraInvertMode camera_invert_mode;
zelda64::AnalogCamMode analog_cam_mode;
zelda64::SpecialItemHudMode special_item_hud_mode;
zelda64::CameraInvertMode analog_camera_invert_mode;
};
@ -400,6 +401,17 @@ void zelda64::set_analog_cam_mode(zelda64::AnalogCamMode mode) {
}
}
zelda64::SpecialItemHudMode zelda64::get_special_item_hud_mode() {
return control_options_context.special_item_hud_mode;
}
void zelda64::set_special_item_hud_mode(zelda64::SpecialItemHudMode mode) {
control_options_context.special_item_hud_mode = mode;
if (general_model_handle) {
general_model_handle.DirtyVariable("special_item_hud_mode");
}
}
zelda64::CameraInvertMode zelda64::get_analog_camera_invert_mode() {
return control_options_context.analog_camera_invert_mode;
}
@ -937,6 +949,7 @@ public:
bind_option(constructor, "autosave_mode", &control_options_context.autosave_mode);
bind_option(constructor, "camera_invert_mode", &control_options_context.camera_invert_mode);
bind_option(constructor, "analog_cam_mode", &control_options_context.analog_cam_mode);
bind_option(constructor, "special_item_hud_mode", &control_options_context.special_item_hud_mode);
bind_option(constructor, "analog_camera_invert_mode", &control_options_context.analog_camera_invert_mode);
general_model_handle = constructor.GetModelHandle();