mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Make camera options disable if no first person or override
This commit is contained in:
parent
e617e5a5b4
commit
563196048d
3 changed files with 28 additions and 22 deletions
|
@ -4,15 +4,19 @@
|
|||
#include "pc/utils/misc.h"
|
||||
#include "pc/configfile.h"
|
||||
#include "game/bettercamera.h"
|
||||
#include "game/first_person_cam.h"
|
||||
#include "pc/lua/utils/smlua_misc_utils.h"
|
||||
|
||||
#define FREE_CAMERA_OPTIONS 9
|
||||
|
||||
#define ENABLE_FREE_CAMERA configEnableCamera || gFirstPersonCamera.enabled || (gOverrideEnableCamera.override && gOverrideEnableCamera.value)
|
||||
|
||||
static struct DjuiBase* sFreeCameraOptions[FREE_CAMERA_OPTIONS] = { 0 };
|
||||
static u8 sIndex = 0;
|
||||
|
||||
static struct DjuiCheckbox* djui_linked_checkbox_create(struct DjuiBase* parent, const char* message, bool* value, void (*on_value_change)(struct DjuiBase*)) {
|
||||
struct DjuiCheckbox* checkbox = djui_checkbox_create(parent, message, value, on_value_change);
|
||||
djui_base_set_enabled(&checkbox->base, configEnableCamera);
|
||||
djui_base_set_enabled(&checkbox->base, ENABLE_FREE_CAMERA);
|
||||
sFreeCameraOptions[sIndex] = &checkbox->base;
|
||||
sIndex++;
|
||||
return checkbox;
|
||||
|
@ -20,7 +24,7 @@ static struct DjuiCheckbox* djui_linked_checkbox_create(struct DjuiBase* parent,
|
|||
|
||||
static struct DjuiSlider* djui_linked_slider_create(struct DjuiBase* parent, const char* message, unsigned int* value, unsigned int min, unsigned int max, void (*on_value_change)(struct DjuiBase*)) {
|
||||
struct DjuiSlider* slider = djui_slider_create(parent, message, value, min, max, on_value_change);
|
||||
djui_base_set_enabled(&slider->base, configEnableCamera);
|
||||
djui_base_set_enabled(&slider->base, ENABLE_FREE_CAMERA);
|
||||
sFreeCameraOptions[sIndex] = &slider->base;
|
||||
sIndex++;
|
||||
return slider;
|
||||
|
@ -29,7 +33,7 @@ static struct DjuiSlider* djui_linked_slider_create(struct DjuiBase* parent, con
|
|||
static void djui_panel_camera_value_changed(UNUSED struct DjuiBase* caller) {
|
||||
newcam_init_settings();
|
||||
for (s32 i = 0; i < FREE_CAMERA_OPTIONS; i++) {
|
||||
djui_base_set_enabled(sFreeCameraOptions[i], configEnableCamera);
|
||||
djui_base_set_enabled(sFreeCameraOptions[i], ENABLE_FREE_CAMERA);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -247,21 +247,16 @@ void hud_set_flash(s8 value) {
|
|||
|
||||
///
|
||||
|
||||
struct CameraOverride {
|
||||
unsigned int value;
|
||||
bool override;
|
||||
};
|
||||
|
||||
struct CameraOverride sOverrideCameraXSens = { 0 };
|
||||
struct CameraOverride sOverrideCameraYSens = { 0 };
|
||||
struct CameraOverride sOverrideCameraAggr = { 0 };
|
||||
struct CameraOverride sOverrideCameraPan = { 0 };
|
||||
struct CameraOverride sOverrideCameraDegrade = { 0 };
|
||||
struct CameraOverride sOverrideCameraInvertX = { 0 };
|
||||
struct CameraOverride sOverrideCameraInvertY = { 0 };
|
||||
struct CameraOverride sOverrideEnableCamera = { 0 };
|
||||
struct CameraOverride sOverrideCameraAnalog = { 0 };
|
||||
struct CameraOverride sOverrideCameraMouse = { 0 };
|
||||
static struct CameraOverride sOverrideCameraXSens = { 0 };
|
||||
static struct CameraOverride sOverrideCameraYSens = { 0 };
|
||||
static struct CameraOverride sOverrideCameraAggr = { 0 };
|
||||
static struct CameraOverride sOverrideCameraPan = { 0 };
|
||||
static struct CameraOverride sOverrideCameraDegrade = { 0 };
|
||||
static struct CameraOverride sOverrideCameraInvertX = { 0 };
|
||||
static struct CameraOverride sOverrideCameraInvertY = { 0 };
|
||||
struct CameraOverride gOverrideEnableCamera = { 0 };
|
||||
static struct CameraOverride sOverrideCameraAnalog = { 0 };
|
||||
static struct CameraOverride sOverrideCameraMouse = { 0 };
|
||||
|
||||
void camera_reset_overrides(void) {
|
||||
sOverrideCameraXSens.override = false;
|
||||
|
@ -271,7 +266,7 @@ void camera_reset_overrides(void) {
|
|||
sOverrideCameraDegrade.override = false;
|
||||
sOverrideCameraInvertX.override = false;
|
||||
sOverrideCameraInvertY.override = false;
|
||||
sOverrideEnableCamera.override = false;
|
||||
gOverrideEnableCamera.override = false;
|
||||
sOverrideCameraAnalog.override = false;
|
||||
sOverrideCameraMouse.override = false;
|
||||
}
|
||||
|
@ -305,7 +300,7 @@ void camera_romhack_allow_dpad_usage(u8 allow) {
|
|||
}
|
||||
|
||||
bool camera_config_is_free_cam_enabled(void) {
|
||||
return sOverrideEnableCamera.override ? sOverrideEnableCamera.value : configEnableCamera;
|
||||
return gOverrideEnableCamera.override ? gOverrideEnableCamera.value : configEnableCamera;
|
||||
}
|
||||
|
||||
bool camera_config_is_analog_cam_enabled(void) {
|
||||
|
@ -345,8 +340,8 @@ u32 camera_config_get_deceleration(void) {
|
|||
}
|
||||
|
||||
void camera_config_enable_free_cam(bool enable) {
|
||||
sOverrideEnableCamera.value = enable;
|
||||
sOverrideEnableCamera.override = true;
|
||||
gOverrideEnableCamera.value = enable;
|
||||
gOverrideEnableCamera.override = true;
|
||||
newcam_init_settings();
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,13 @@ struct DateTime {
|
|||
s32 second;
|
||||
};
|
||||
|
||||
struct CameraOverride {
|
||||
unsigned int value;
|
||||
bool override;
|
||||
};
|
||||
|
||||
extern struct CameraOverride gOverrideEnableCamera;
|
||||
|
||||
u32 get_network_area_timer(void);
|
||||
|
||||
s32* get_temp_s32_pointer(s32 initialValue);
|
||||
|
|
Loading…
Reference in a new issue