mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Allow mods to disable romhack camera centering (#423)
This commit is contained in:
parent
a2dc56e1ac
commit
f6a78e0c77
9 changed files with 54 additions and 1 deletions
|
@ -8451,6 +8451,12 @@ function camera_reset_overrides()
|
|||
-- ...
|
||||
end
|
||||
|
||||
--- @param allow integer
|
||||
--- @return nil
|
||||
function camera_romhack_allow_centering(allow)
|
||||
-- ...
|
||||
end
|
||||
|
||||
--- @param rco RomhackCameraOverride
|
||||
--- @return nil
|
||||
function camera_set_romhack_override(rco)
|
||||
|
|
|
@ -488,6 +488,26 @@
|
|||
|
||||
<br />
|
||||
|
||||
## [camera_romhack_allow_centering](#camera_romhack_allow_centering)
|
||||
|
||||
### Lua Example
|
||||
`camera_romhack_allow_centering(allow)`
|
||||
|
||||
### Parameters
|
||||
| Field | Type |
|
||||
| ----- | ---- |
|
||||
| allow | `integer` |
|
||||
|
||||
### Returns
|
||||
- None
|
||||
|
||||
### C Prototype
|
||||
`void camera_romhack_allow_centering(u8 allow);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [camera_set_romhack_override](#camera_set_romhack_override)
|
||||
|
||||
### Lua Example
|
||||
|
|
|
@ -1578,6 +1578,7 @@
|
|||
- [camera_freeze](functions-5.md#camera_freeze)
|
||||
- [camera_is_frozen](functions-5.md#camera_is_frozen)
|
||||
- [camera_reset_overrides](functions-5.md#camera_reset_overrides)
|
||||
- [camera_romhack_allow_centering](functions-5.md#camera_romhack_allow_centering)
|
||||
- [camera_set_romhack_override](functions-5.md#camera_set_romhack_override)
|
||||
- [camera_unfreeze](functions-5.md#camera_unfreeze)
|
||||
- [course_is_main_course](functions-5.md#course_is_main_course)
|
||||
|
|
|
@ -41,6 +41,7 @@ static u8 sSoftResettingCamera = FALSE;
|
|||
u8 gCameraUseCourseSpecificSettings = TRUE;
|
||||
u8 gOverrideFreezeCamera = FALSE;
|
||||
enum RomhackCameraOverride gOverrideRomhackCamera = RCO_ALL;
|
||||
u8 gRomhackCameraAllowCentering = TRUE;
|
||||
|
||||
/**
|
||||
* @file camera.c
|
||||
|
@ -12252,7 +12253,7 @@ void mode_rom_hack_camera(struct Camera *c) {
|
|||
}
|
||||
|
||||
// center
|
||||
if (gMarioStates[0].controller->buttonPressed & L_TRIG) {
|
||||
if (gMarioStates[0].controller->buttonPressed & L_TRIG && gRomhackCameraAllowCentering) {
|
||||
center_rom_hack_camera();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ enum RomhackCameraOverride {
|
|||
|
||||
extern u8 gOverrideFreezeCamera;
|
||||
extern enum RomhackCameraOverride gOverrideRomhackCamera;
|
||||
extern u8 gRomhackCameraAllowCentering;
|
||||
|
||||
/**
|
||||
* @file camera.h
|
||||
|
|
|
@ -28045,6 +28045,23 @@ int smlua_func_camera_reset_overrides(UNUSED lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_camera_romhack_allow_centering(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 1) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "camera_romhack_allow_centering", 1, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 allow = smlua_to_integer(L, 1);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "camera_romhack_allow_centering"); return 0; }
|
||||
|
||||
camera_romhack_allow_centering(allow);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int smlua_func_camera_set_romhack_override(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
@ -31969,6 +31986,7 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "camera_freeze", smlua_func_camera_freeze);
|
||||
smlua_bind_function(L, "camera_is_frozen", smlua_func_camera_is_frozen);
|
||||
smlua_bind_function(L, "camera_reset_overrides", smlua_func_camera_reset_overrides);
|
||||
smlua_bind_function(L, "camera_romhack_allow_centering", smlua_func_camera_romhack_allow_centering);
|
||||
smlua_bind_function(L, "camera_set_romhack_override", smlua_func_camera_set_romhack_override);
|
||||
smlua_bind_function(L, "camera_unfreeze", smlua_func_camera_unfreeze);
|
||||
smlua_bind_function(L, "course_is_main_course", smlua_func_course_is_main_course);
|
||||
|
|
|
@ -261,6 +261,10 @@ void camera_set_romhack_override(enum RomhackCameraOverride rco) {
|
|||
gOverrideRomhackCamera = rco;
|
||||
}
|
||||
|
||||
void camera_romhack_allow_centering(u8 allow) {
|
||||
gRomhackCameraAllowCentering = allow;
|
||||
}
|
||||
|
||||
bool camera_config_is_free_cam_enabled(void) {
|
||||
#ifdef BETTERCAMERA
|
||||
return sOverrideEnableCamera.override ? sOverrideEnableCamera.value : configEnableCamera;
|
||||
|
|
|
@ -47,6 +47,7 @@ void camera_freeze(void);
|
|||
void camera_unfreeze(void);
|
||||
bool camera_is_frozen(void);
|
||||
void camera_set_romhack_override(enum RomhackCameraOverride rco);
|
||||
void camera_romhack_allow_centering(u8 allow);
|
||||
|
||||
bool camera_config_is_free_cam_enabled(void);
|
||||
bool camera_config_is_analog_cam_enabled(void);
|
||||
|
|
|
@ -640,6 +640,7 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
|
|||
gOverrideBackground = -1;
|
||||
gOverrideEnvFx = -1;
|
||||
gDjuiRenderBehindHud = false;
|
||||
gRomhackCameraAllowCentering = TRUE;
|
||||
camera_reset_overrides();
|
||||
dynos_mod_shutdown();
|
||||
mods_clear(&gActiveMods);
|
||||
|
|
Loading…
Reference in a new issue