Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More settings to the Camera settings menu #555

Open
wants to merge 18 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion autogen/convert_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"src/game/obj_behaviors_2.c": [ "wiggler_jumped_on_attack_handler", "huge_goomba_weakly_attacked" ],
"src/game/level_info.h": [ "_name_table" ],
"src/pc/lua/utils/smlua_obj_utils.h": [ "spawn_object_remember_field" ],
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline" ],
"src/game/camera.h": [ "update_camera", "init_camera", "stub_camera", "^reset_camera", "move_point_along_spline", "romhack_camera_init_settings" ],
"src/game/behavior_actions.h": [ "bhv_dust_smoke_loop", "bhv_init_room" ],
"src/pc/lua/utils/smlua_audio_utils.h": [ "smlua_audio_utils_override", "audio_custom_shutdown", "smlua_audio_custom_deinit", "audio_sample_destroy_pending_copies", "audio_custom_update_volume" ],
"src/pc/djui/djui_hud_utils.h": [ "djui_hud_render_texture", "djui_hud_render_texture_raw", "djui_hud_render_texture_tile", "djui_hud_render_texture_tile_raw" ],
Expand Down
9 changes: 9 additions & 0 deletions autogen/lua_definitions/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2527,6 +2527,15 @@ RCO_ALL_EXCEPT_BOWSER = 1
--- @type RomhackCameraOverride
RCO_NONE = 2

--- @type RomhackCameraOverride
RCO_ALL_INCLUDING_VANILLA = 3

--- @type RomhackCameraOverride
RCO_ALL_VANILLA_EXCEPT_BOWSER = 4

--- @type RomhackCameraOverride
RCO_DISABLE = 5

--- @class CharacterSound

--- @type CharacterSound
Expand Down
135 changes: 128 additions & 7 deletions autogen/lua_definitions/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3392,12 +3392,6 @@ function resolve_geometry_collisions(pos, lastGood)
-- ...
end

--- @param enable integer
--- Toggles collision settings for the ROM hack camera. This enables or disables specific collision behaviors in modded levels
function rom_hack_cam_set_collisions(enable)
-- ...
end

--- @param c Camera
--- @param cPos Vec3f
--- @param avoidYaw Pointer_integer
Expand Down Expand Up @@ -3614,6 +3608,13 @@ function skip_camera_interpolation()
-- ...
end

--- @param angle integer
--- @return integer
--- Takes in an SM64 angle unit and returns the nearest 45 degree angle, also in SM64 angle units. Useful when needing to align angles (camera, yaw, ect.)
function snap_to_45_degrees(angle)
-- ...
end

--- @param c Camera
--- Resets the camera's state while retaining some settings, such as position or mode. This is often used when soft-resetting gameplay without reinitialization
function soft_reset_camera(c)
Expand Down Expand Up @@ -8887,12 +8888,30 @@ function camera_config_enable_analog_cam(enable)
-- ...
end

--- @param enable boolean
--- Overrides if Camera Collision is enabled
function camera_config_enable_camera_collisions(enable)
-- ...
end

--- @param enable boolean
--- Overrides if the L button will center the camera
function camera_config_enable_centering(enable)
-- ...
end

--- @param enable boolean
--- Overrides if Free Camera is enabled
function camera_config_enable_free_cam(enable)
-- ...
end

--- @param enable boolean
--- Overrides if Freecam DPad Behavior is enabled
function camera_config_enable_freecam_dpad(enable)
-- ...
end

--- @param enable boolean
--- Overrides if camera mouse look is enabled
function camera_config_enable_mouse_look(enable)
Expand All @@ -8904,6 +8923,12 @@ function camera_config_get_aggression()
-- ...
end

--- @return boolean
--- Gets if the L button will center the camera
function camera_config_get_centering()
-- ...
end

--- @return integer
function camera_config_get_deceleration()
-- ...
Expand Down Expand Up @@ -8948,6 +8973,18 @@ function camera_config_is_free_cam_enabled()
-- ...
end

--- @return boolean
--- Checks if Camera Collision is enabled
function camera_config_is_free_camera_collision_enabled()
-- ...
end

--- @return boolean
--- Checks if Freecam DPad Behavior is enabled
function camera_config_is_freecam_dpad_enabled()
-- ...
end

--- @return boolean
--- Checks if Mouse Look is enabled
function camera_config_is_mouse_look_enabled()
Expand Down Expand Up @@ -9001,12 +9038,24 @@ function camera_freeze()
-- ...
end

--- @return integer
--- Gets if the romhack camera should fly above poison gas
function camera_get_allow_toxic_gas_camera()
-- ...
end

--- @return boolean
--- Checks if the camera should account for surfaces
function camera_get_checking_surfaces()
-- ...
end

--- @return RomhackCameraOverride
--- Gets the current romhack camera override status
function camera_get_romhack_override()
-- ...
end

--- @return boolean
--- Checks if the camera is frozen
function camera_is_frozen()
Expand All @@ -9019,7 +9068,7 @@ function camera_reset_overrides()
end

--- @param allow integer
--- Sets if the romhack camera should allow centering
--- Sets if the romhack camera should allow centering, triggered with the L button
function camera_romhack_allow_centering(allow)
-- ...
end
Expand All @@ -9030,6 +9079,72 @@ function camera_romhack_allow_dpad_usage(allow)
-- ...
end

--- @return integer
--- Gets if the romhack camera should allow centering
function camera_romhack_get_allow_centering()
-- ...
end

--- @return integer
--- Gets if the romhack camera should allow D-Pad movement
function camera_romhack_get_allow_dpad_usage()
-- ...
end

--- @return integer
--- Gets if the romhack camera has surface collisions
function camera_romhack_get_collisions()
-- ...
end

--- @return integer
--- Gets the romhack camera's zoomed in distance
function camera_romhack_get_zoomed_in_dist()
-- ...
end

--- @return integer
--- Gets the romhack camera's zoomed in height
function camera_romhack_get_zoomed_in_height()
-- ...
end

--- @return integer
--- Gets the romhack camera's additional zoomed out distance
function camera_romhack_get_zoomed_out_dist()
-- ...
end

--- @return integer
--- Gets the romhack camera's additional zoomed out height
function camera_romhack_get_zoomed_out_height()
-- ...
end

--- @param val integer
--- Sets the romhack camera's zoomed in distance, between 700 and 1200 units
function camera_romhack_set_zoomed_in_dist(val)
-- ...
end

--- @param val integer
--- Sets the romhack camera's zoomed in height, between 150 and 500 units
function camera_romhack_set_zoomed_in_height(val)
-- ...
end

--- @param val integer
--- Sets the romhack camera's zoomed out additional distance, between 100 and 600 units
function camera_romhack_set_zoomed_out_dist(val)
-- ...
end

--- @param val integer
--- Sets the romhack camera's zoomed out additional height, between 100 and 500 units
function camera_romhack_set_zoomed_out_height(val)
-- ...
end

--- @param value boolean
--- Sets if the camera should account for surfaces
function camera_set_checking_surfaces(value)
Expand All @@ -9047,6 +9162,12 @@ function camera_unfreeze()
-- ...
end

--- @param enable integer
--- Toggles collision settings for the ROM hack camera. This enables or disables specific collision behaviors in modded levels
function rom_hack_cam_set_collisions(enable)
-- ...
end

--- @param x number
--- @param y number
--- @param z number
Expand Down
3 changes: 3 additions & 0 deletions docs/lua/constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,9 @@
| RCO_ALL | 0 |
| RCO_ALL_EXCEPT_BOWSER | 1 |
| RCO_NONE | 2 |
| RCO_ALL_INCLUDING_VANILLA | 3 |
| RCO_ALL_VANILLA_EXCEPT_BOWSER | 4 |
| RCO_DISABLE | 5 |

[:arrow_up_small:](#)

Expand Down
46 changes: 23 additions & 23 deletions docs/lua/functions-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -1534,29 +1534,6 @@ Resolves collisions between the camera and level geometry. Adjusts the camera's

<br />

## [rom_hack_cam_set_collisions](#rom_hack_cam_set_collisions)

### Description
Toggles collision settings for the ROM hack camera. This enables or disables specific collision behaviors in modded levels

### Lua Example
`rom_hack_cam_set_collisions(enable)`

### Parameters
| Field | Type |
| ----- | ---- |
| enable | `integer` |

### Returns
- None

### C Prototype
`void rom_hack_cam_set_collisions(u8 enable);`

[:arrow_up_small:](#)

<br />

## [rotate_camera_around_walls](#rotate_camera_around_walls)

### Description
Expand Down Expand Up @@ -2240,6 +2217,29 @@ Skips camera interpolation for a frame, locking the camera instantly to the targ

<br />

## [snap_to_45_degrees](#snap_to_45_degrees)

### Description
Takes in an SM64 angle unit and returns the nearest 45 degree angle, also in SM64 angle units. Useful when needing to align angles (camera, yaw, ect.)

### Lua Example
`local integerValue = snap_to_45_degrees(angle)`

### Parameters
| Field | Type |
| ----- | ---- |
| angle | `integer` |

### Returns
- `integer`

### C Prototype
`s32 snap_to_45_degrees(s16 angle);`

[:arrow_up_small:](#)

<br />

## [soft_reset_camera](#soft_reset_camera)

### Description
Expand Down
Loading