Separate some smlua_misc_utils functions into their own files & add get/set_skybox_color

This commit is contained in:
Agent X 2024-06-21 23:26:13 -04:00
parent e42f114b2d
commit 3707ca9b2e
25 changed files with 2664 additions and 2500 deletions

View File

@ -42,6 +42,8 @@ in_files = [
"include/behavior_table.h",
"src/pc/lua/utils/smlua_obj_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"src/pc/lua/utils/smlua_camera_utils.h",
"src/pc/lua/utils/smlua_gfx_utils.h",
"src/pc/lua/utils/smlua_collision_utils.h",
"src/pc/lua/utils/smlua_math_utils.h",
"src/pc/lua/utils/smlua_model_utils.h",

View File

@ -17,6 +17,7 @@ in_files = [
"src/game/mario_step.h",
"src/pc/lua/utils/smlua_anim_utils.h",
"src/pc/lua/utils/smlua_misc_utils.h",
"src/pc/lua/utils/smlua_camera_utils.h",
"src/pc/lua/utils/smlua_collision_utils.h",
"src/pc/lua/utils/smlua_level_utils.h",
"src/game/spawn_sound.h",

View File

@ -7594,6 +7594,143 @@ function smlua_audio_utils_reset_all()
-- ...
end
--- @param allow integer
function camera_allow_toxic_gas_camera(allow)
-- ...
end
--- @param enable boolean
function camera_config_enable_analog_cam(enable)
-- ...
end
--- @param enable boolean
function camera_config_enable_free_cam(enable)
-- ...
end
--- @param enable boolean
function camera_config_enable_mouse_look(enable)
-- ...
end
--- @return integer
function camera_config_get_aggression()
-- ...
end
--- @return integer
function camera_config_get_deceleration()
-- ...
end
--- @return integer
function camera_config_get_pan_level()
-- ...
end
--- @return integer
function camera_config_get_x_sensitivity()
-- ...
end
--- @return integer
function camera_config_get_y_sensitivity()
-- ...
end
--- @param invert boolean
function camera_config_invert_x(invert)
-- ...
end
--- @param invert boolean
function camera_config_invert_y(invert)
-- ...
end
--- @return boolean
function camera_config_is_analog_cam_enabled()
-- ...
end
--- @return boolean
function camera_config_is_free_cam_enabled()
-- ...
end
--- @return boolean
function camera_config_is_mouse_look_enabled()
-- ...
end
--- @return boolean
function camera_config_is_x_inverted()
-- ...
end
--- @return boolean
function camera_config_is_y_inverted()
-- ...
end
--- @param value integer
function camera_config_set_aggression(value)
-- ...
end
--- @param value integer
function camera_config_set_deceleration(value)
-- ...
end
--- @param value integer
function camera_config_set_pan_level(value)
-- ...
end
--- @param value integer
function camera_config_set_x_sensitivity(value)
-- ...
end
--- @param value integer
function camera_config_set_y_sensitivity(value)
-- ...
end
function camera_freeze()
-- ...
end
--- @return boolean
function camera_is_frozen()
-- ...
end
function camera_reset_overrides()
-- ...
end
--- @param allow integer
function camera_romhack_allow_centering(allow)
-- ...
end
--- @param allow integer
function camera_romhack_allow_dpad_usage(allow)
-- ...
end
--- @param rco RomhackCameraOverride
function camera_set_romhack_override(rco)
-- ...
end
function camera_unfreeze()
-- ...
end
--- @param x number
--- @param y number
--- @param z number
@ -7696,6 +7833,101 @@ function set_environment_region(index, value)
-- ...
end
--- @param index integer
--- @return integer
function get_fog_color(index)
-- ...
end
--- @return number
function get_fog_intensity()
-- ...
end
--- @param index integer
--- @return integer
function get_lighting_color(index)
-- ...
end
--- @param index integer
--- @return number
function get_lighting_dir(index)
-- ...
end
--- @return integer
function get_skybox()
-- ...
end
--- @param index integer
--- @return integer
function get_skybox_color(index)
-- ...
end
--- @param index integer
--- @return integer
function get_vertex_color(index)
-- ...
end
--- @param index integer
--- @param value integer
function set_fog_color(index, value)
-- ...
end
--- @param intensity number
function set_fog_intensity(intensity)
-- ...
end
--- @param index integer
--- @param value integer
function set_lighting_color(index, value)
-- ...
end
--- @param index integer
--- @param value number
function set_lighting_dir(index, value)
-- ...
end
--- @param far number
function set_override_far(far)
-- ...
end
--- @param fov number
function set_override_fov(fov)
-- ...
end
--- @param near number
function set_override_near(near)
-- ...
end
--- @param background integer
function set_override_skybox(background)
-- ...
end
--- @param index integer
--- @param value integer
function set_skybox_color(index, value)
-- ...
end
--- @param index integer
--- @param value integer
function set_vertex_color(index, value)
-- ...
end
--- @param levelNum integer
--- @return boolean
function level_is_vanilla_level(levelNum)
@ -7839,143 +8071,6 @@ function allocate_mario_action(actFlags)
-- ...
end
--- @param allow integer
function camera_allow_toxic_gas_camera(allow)
-- ...
end
--- @param enable boolean
function camera_config_enable_analog_cam(enable)
-- ...
end
--- @param enable boolean
function camera_config_enable_free_cam(enable)
-- ...
end
--- @param enable boolean
function camera_config_enable_mouse_look(enable)
-- ...
end
--- @return integer
function camera_config_get_aggression()
-- ...
end
--- @return integer
function camera_config_get_deceleration()
-- ...
end
--- @return integer
function camera_config_get_pan_level()
-- ...
end
--- @return integer
function camera_config_get_x_sensitivity()
-- ...
end
--- @return integer
function camera_config_get_y_sensitivity()
-- ...
end
--- @param invert boolean
function camera_config_invert_x(invert)
-- ...
end
--- @param invert boolean
function camera_config_invert_y(invert)
-- ...
end
--- @return boolean
function camera_config_is_analog_cam_enabled()
-- ...
end
--- @return boolean
function camera_config_is_free_cam_enabled()
-- ...
end
--- @return boolean
function camera_config_is_mouse_look_enabled()
-- ...
end
--- @return boolean
function camera_config_is_x_inverted()
-- ...
end
--- @return boolean
function camera_config_is_y_inverted()
-- ...
end
--- @param value integer
function camera_config_set_aggression(value)
-- ...
end
--- @param value integer
function camera_config_set_deceleration(value)
-- ...
end
--- @param value integer
function camera_config_set_pan_level(value)
-- ...
end
--- @param value integer
function camera_config_set_x_sensitivity(value)
-- ...
end
--- @param value integer
function camera_config_set_y_sensitivity(value)
-- ...
end
function camera_freeze()
-- ...
end
--- @return boolean
function camera_is_frozen()
-- ...
end
function camera_reset_overrides()
-- ...
end
--- @param allow integer
function camera_romhack_allow_centering(allow)
-- ...
end
--- @param allow integer
function camera_romhack_allow_dpad_usage(allow)
-- ...
end
--- @param rco RomhackCameraOverride
function camera_set_romhack_override(rco)
-- ...
end
function camera_unfreeze()
-- ...
end
--- @param courseNum integer
--- @return boolean
function course_is_main_course(courseNum)
@ -8043,17 +8138,6 @@ function get_envfx()
-- ...
end
--- @param index integer
--- @return integer
function get_fog_color(index)
-- ...
end
--- @return number
function get_fog_intensity()
-- ...
end
--- @return integer
function get_global_timer()
-- ...
@ -8100,18 +8184,6 @@ function get_last_star_or_key()
-- ...
end
--- @param index integer
--- @return integer
function get_lighting_color(index)
-- ...
end
--- @param index integer
--- @return number
function get_lighting_dir(index)
-- ...
end
--- @return string
function get_local_discord_id()
-- ...
@ -8132,11 +8204,6 @@ function get_save_file_modified()
-- ...
end
--- @return integer
function get_skybox()
-- ...
end
--- @param initialValue integer
--- @return Pointer_integer
function get_temp_s32_pointer(initialValue)
@ -8153,12 +8220,6 @@ function get_ttc_speed_setting()
-- ...
end
--- @param index integer
--- @return integer
function get_vertex_color(index)
-- ...
end
--- @return number
function get_volume_env()
-- ...
@ -8283,17 +8344,6 @@ function save_file_set_using_backup_slot(usingBackupSlot)
-- ...
end
--- @param index integer
--- @param value integer
function set_fog_color(index, value)
-- ...
end
--- @param intensity number
function set_fog_intensity(intensity)
-- ...
end
--- @param value boolean
function set_got_file_coin_hi_score(value)
-- ...
@ -8314,43 +8364,11 @@ function set_last_star_or_key(value)
-- ...
end
--- @param index integer
--- @param value integer
function set_lighting_color(index, value)
-- ...
end
--- @param index integer
--- @param value number
function set_lighting_dir(index, value)
-- ...
end
--- @param envfx integer
function set_override_envfx(envfx)
-- ...
end
--- @param far number
function set_override_far(far)
-- ...
end
--- @param fov number
function set_override_fov(fov)
-- ...
end
--- @param near number
function set_override_near(near)
-- ...
end
--- @param background integer
function set_override_skybox(background)
-- ...
end
--- @param value boolean
function set_save_file_modified(value)
-- ...
@ -8361,12 +8379,6 @@ function set_ttc_speed_setting(speed)
-- ...
end
--- @param index integer
--- @param value integer
function set_vertex_color(index, value)
-- ...
end
--- @param volume number
function set_volume_env(volume)
-- ...

File diff suppressed because it is too large Load Diff

View File

@ -1594,6 +1594,38 @@
<br />
- smlua_camera_utils.h
- [camera_allow_toxic_gas_camera](functions-5.md#camera_allow_toxic_gas_camera)
- [camera_config_enable_analog_cam](functions-5.md#camera_config_enable_analog_cam)
- [camera_config_enable_free_cam](functions-5.md#camera_config_enable_free_cam)
- [camera_config_enable_mouse_look](functions-5.md#camera_config_enable_mouse_look)
- [camera_config_get_aggression](functions-5.md#camera_config_get_aggression)
- [camera_config_get_deceleration](functions-5.md#camera_config_get_deceleration)
- [camera_config_get_pan_level](functions-5.md#camera_config_get_pan_level)
- [camera_config_get_x_sensitivity](functions-5.md#camera_config_get_x_sensitivity)
- [camera_config_get_y_sensitivity](functions-5.md#camera_config_get_y_sensitivity)
- [camera_config_invert_x](functions-5.md#camera_config_invert_x)
- [camera_config_invert_y](functions-5.md#camera_config_invert_y)
- [camera_config_is_analog_cam_enabled](functions-5.md#camera_config_is_analog_cam_enabled)
- [camera_config_is_free_cam_enabled](functions-5.md#camera_config_is_free_cam_enabled)
- [camera_config_is_mouse_look_enabled](functions-5.md#camera_config_is_mouse_look_enabled)
- [camera_config_is_x_inverted](functions-5.md#camera_config_is_x_inverted)
- [camera_config_is_y_inverted](functions-5.md#camera_config_is_y_inverted)
- [camera_config_set_aggression](functions-5.md#camera_config_set_aggression)
- [camera_config_set_deceleration](functions-5.md#camera_config_set_deceleration)
- [camera_config_set_pan_level](functions-5.md#camera_config_set_pan_level)
- [camera_config_set_x_sensitivity](functions-5.md#camera_config_set_x_sensitivity)
- [camera_config_set_y_sensitivity](functions-5.md#camera_config_set_y_sensitivity)
- [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_romhack_allow_dpad_usage](functions-5.md#camera_romhack_allow_dpad_usage)
- [camera_set_romhack_override](functions-5.md#camera_set_romhack_override)
- [camera_unfreeze](functions-5.md#camera_unfreeze)
<br />
- smlua_collision_utils.h
- [collision_find_ceil](functions-5.md#collision_find_ceil)
- [collision_find_floor](functions-5.md#collision_find_floor)
@ -1608,6 +1640,27 @@
<br />
- smlua_gfx_utils.h
- [get_fog_color](functions-5.md#get_fog_color)
- [get_fog_intensity](functions-5.md#get_fog_intensity)
- [get_lighting_color](functions-5.md#get_lighting_color)
- [get_lighting_dir](functions-5.md#get_lighting_dir)
- [get_skybox](functions-5.md#get_skybox)
- [get_skybox_color](functions-5.md#get_skybox_color)
- [get_vertex_color](functions-5.md#get_vertex_color)
- [set_fog_color](functions-5.md#set_fog_color)
- [set_fog_intensity](functions-5.md#set_fog_intensity)
- [set_lighting_color](functions-5.md#set_lighting_color)
- [set_lighting_dir](functions-5.md#set_lighting_dir)
- [set_override_far](functions-5.md#set_override_far)
- [set_override_fov](functions-5.md#set_override_fov)
- [set_override_near](functions-5.md#set_override_near)
- [set_override_skybox](functions-5.md#set_override_skybox)
- [set_skybox_color](functions-5.md#set_skybox_color)
- [set_vertex_color](functions-5.md#set_vertex_color)
<br />
- smlua_level_utils.h
- [level_is_vanilla_level](functions-5.md#level_is_vanilla_level)
- [level_register](functions-5.md#level_register)
@ -1638,34 +1691,6 @@
- smlua_misc_utils.h
- [allocate_mario_action](functions-5.md#allocate_mario_action)
- [camera_allow_toxic_gas_camera](functions-5.md#camera_allow_toxic_gas_camera)
- [camera_config_enable_analog_cam](functions-5.md#camera_config_enable_analog_cam)
- [camera_config_enable_free_cam](functions-5.md#camera_config_enable_free_cam)
- [camera_config_enable_mouse_look](functions-5.md#camera_config_enable_mouse_look)
- [camera_config_get_aggression](functions-5.md#camera_config_get_aggression)
- [camera_config_get_deceleration](functions-5.md#camera_config_get_deceleration)
- [camera_config_get_pan_level](functions-5.md#camera_config_get_pan_level)
- [camera_config_get_x_sensitivity](functions-5.md#camera_config_get_x_sensitivity)
- [camera_config_get_y_sensitivity](functions-5.md#camera_config_get_y_sensitivity)
- [camera_config_invert_x](functions-5.md#camera_config_invert_x)
- [camera_config_invert_y](functions-5.md#camera_config_invert_y)
- [camera_config_is_analog_cam_enabled](functions-5.md#camera_config_is_analog_cam_enabled)
- [camera_config_is_free_cam_enabled](functions-5.md#camera_config_is_free_cam_enabled)
- [camera_config_is_mouse_look_enabled](functions-5.md#camera_config_is_mouse_look_enabled)
- [camera_config_is_x_inverted](functions-5.md#camera_config_is_x_inverted)
- [camera_config_is_y_inverted](functions-5.md#camera_config_is_y_inverted)
- [camera_config_set_aggression](functions-5.md#camera_config_set_aggression)
- [camera_config_set_deceleration](functions-5.md#camera_config_set_deceleration)
- [camera_config_set_pan_level](functions-5.md#camera_config_set_pan_level)
- [camera_config_set_x_sensitivity](functions-5.md#camera_config_set_x_sensitivity)
- [camera_config_set_y_sensitivity](functions-5.md#camera_config_set_y_sensitivity)
- [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_romhack_allow_dpad_usage](functions-5.md#camera_romhack_allow_dpad_usage)
- [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)
- [deref_s32_pointer](functions-5.md#deref_s32_pointer)
- [djui_is_playerlist_open](functions-5.md#djui_is_playerlist_open)
@ -1679,8 +1704,6 @@
- [get_dialog_id](functions-5.md#get_dialog_id)
- [get_dialog_response](functions-5.md#get_dialog_response)
- [get_envfx](functions-5.md#get_envfx)
- [get_fog_color](functions-5.md#get_fog_color)
- [get_fog_intensity](functions-5.md#get_fog_intensity)
- [get_global_timer](functions-5.md#get_global_timer)
- [get_got_file_coin_hi_score](functions-5.md#get_got_file_coin_hi_score)
- [get_hand_foot_pos_x](functions-5.md#get_hand_foot_pos_x)
@ -1689,17 +1712,13 @@
- [get_last_completed_course_num](functions-5.md#get_last_completed_course_num)
- [get_last_completed_star_num](functions-5.md#get_last_completed_star_num)
- [get_last_star_or_key](functions-5.md#get_last_star_or_key)
- [get_lighting_color](functions-5.md#get_lighting_color)
- [get_lighting_dir](functions-5.md#get_lighting_dir)
- [get_local_discord_id](functions-5.md#get_local_discord_id)
- [get_network_area_timer](functions-5.md#get_network_area_timer)
- [get_os_name](functions-5.md#get_os_name)
- [get_save_file_modified](functions-5.md#get_save_file_modified)
- [get_skybox](functions-5.md#get_skybox)
- [get_temp_s32_pointer](functions-5.md#get_temp_s32_pointer)
- [get_time](functions-5.md#get_time)
- [get_ttc_speed_setting](functions-5.md#get_ttc_speed_setting)
- [get_vertex_color](functions-5.md#get_vertex_color)
- [get_volume_env](functions-5.md#get_volume_env)
- [get_volume_level](functions-5.md#get_volume_level)
- [get_volume_master](functions-5.md#get_volume_master)
@ -1721,22 +1740,13 @@
- [reset_window_title](functions-5.md#reset_window_title)
- [save_file_get_using_backup_slot](functions-5.md#save_file_get_using_backup_slot)
- [save_file_set_using_backup_slot](functions-5.md#save_file_set_using_backup_slot)
- [set_fog_color](functions-5.md#set_fog_color)
- [set_fog_intensity](functions-5.md#set_fog_intensity)
- [set_got_file_coin_hi_score](functions-5.md#set_got_file_coin_hi_score)
- [set_last_completed_course_num](functions-5.md#set_last_completed_course_num)
- [set_last_completed_star_num](functions-5.md#set_last_completed_star_num)
- [set_last_star_or_key](functions-5.md#set_last_star_or_key)
- [set_lighting_color](functions-5.md#set_lighting_color)
- [set_lighting_dir](functions-5.md#set_lighting_dir)
- [set_override_envfx](functions-5.md#set_override_envfx)
- [set_override_far](functions-5.md#set_override_far)
- [set_override_fov](functions-5.md#set_override_fov)
- [set_override_near](functions-5.md#set_override_near)
- [set_override_skybox](functions-5.md#set_override_skybox)
- [set_save_file_modified](functions-5.md#set_save_file_modified)
- [set_ttc_speed_setting](functions-5.md#set_ttc_speed_setting)
- [set_vertex_color](functions-5.md#set_vertex_color)
- [set_volume_env](functions-5.md#set_volume_env)
- [set_volume_level](functions-5.md#set_volume_level)
- [set_volume_master](functions-5.md#set_volume_master)

View File

@ -9,7 +9,7 @@
#include "engine/surface_collision.h"
#include "pc/configfile.h"
#include "pc/controller/controller_mouse.h"
#include "pc/lua/utils/smlua_misc_utils.h"
#include "pc/lua/utils/smlua_camera_utils.h"
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
//quick and dirty fix for some older MinGW.org mingwrt

View File

@ -15,7 +15,7 @@
#include "pc/controller/controller_mouse.h"
#include "pc/djui/djui.h"
#include "pc/djui/djui_hud_utils.h"
#include "pc/lua/utils/smlua_misc_utils.h"
#include "pc/lua/utils/smlua_camera_utils.h"
#include "pc/lua/smlua_hooks.h"
#define CLAMP(_val, _min, _max) MAX(MIN((_val), _max), _min)

View File

@ -29,7 +29,7 @@
#include "spawn_sound.h"
#include "pc/network/network.h"
#include "pc/lua/smlua_hooks.h"
#include "pc/lua/utils/smlua_misc_utils.h"
#include "pc/lua/utils/smlua_camera_utils.h"
#include "first_person_cam.h"
u8 (*gContinueDialogFunction)(void) = NULL;

View File

@ -68,6 +68,7 @@ extern u8 gRenderingInterpolated;
s8 gReadOnlyBackground;
s8 gOverrideBackground = -1;
Color gSkyboxColor = { 255, 255, 255 };
extern SkyboxTexture bbh_skybox_ptrlist;
extern SkyboxTexture bitdw_skybox_ptrlist;
@ -213,14 +214,17 @@ Vtx *make_skybox_rect(s32 tileIndex, s8 colorIndex, s32 row, s32 col) {
f32 y = SKYBOX_HEIGHT - tileIndex / SKYBOX_COLS * SKYBOX_TILE_HEIGHT;
if (verts != NULL) {
make_vertex(verts, 0, x, y, -1, 0, 0, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1],
sSkyboxColors[colorIndex][2], 255);
make_vertex(verts, 1, x, y - SKYBOX_TILE_HEIGHT, -1, 0, 31 << 5, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1],
sSkyboxColors[colorIndex][2], 255);
make_vertex(verts, 2, x + SKYBOX_TILE_WIDTH, y - SKYBOX_TILE_HEIGHT, -1, 31 << 5, 31 << 5, sSkyboxColors[colorIndex][0],
sSkyboxColors[colorIndex][1], sSkyboxColors[colorIndex][2], 255);
make_vertex(verts, 3, x + SKYBOX_TILE_WIDTH, y, -1, 31 << 5, 0, sSkyboxColors[colorIndex][0], sSkyboxColors[colorIndex][1],
sSkyboxColors[colorIndex][2], 255);
f32 r = gSkyboxColor[0] / 255.0f;
f32 g = gSkyboxColor[1] / 255.0f;
f32 b = gSkyboxColor[2] / 255.0f;
make_vertex(verts, 0, x, y, -1, 0, 0, sSkyboxColors[colorIndex][0] * r, sSkyboxColors[colorIndex][1] * g,
sSkyboxColors[colorIndex][2] * b, 255);
make_vertex(verts, 1, x, y - SKYBOX_TILE_HEIGHT, -1, 0, 31 << 5, sSkyboxColors[colorIndex][0] * r, sSkyboxColors[colorIndex][1] * g,
sSkyboxColors[colorIndex][2] * b, 255);
make_vertex(verts, 2, x + SKYBOX_TILE_WIDTH, y - SKYBOX_TILE_HEIGHT, -1, 31 << 5, 31 << 5, sSkyboxColors[colorIndex][0] * r,
sSkyboxColors[colorIndex][1] * g, sSkyboxColors[colorIndex][2] * b, 255);
make_vertex(verts, 3, x + SKYBOX_TILE_WIDTH, y, -1, 31 << 5, 0, sSkyboxColors[colorIndex][0] * r, sSkyboxColors[colorIndex][1] * g,
sSkyboxColors[colorIndex][2] * b, 255);
} else {
}
return verts;
@ -251,7 +255,7 @@ void draw_skybox_tile_grid(Gfx **dlist, s8 background, s8 player, s8 colorIndex)
Vtx *vertices = make_skybox_rect(tileIndex, colorIndex, row, col);
gLoadBlockTexture((*dlist)++, 32, 32, G_IM_FMT_RGBA, texture);
gSPVertex((*dlist)++, VIRTUAL_TO_PHYSICAL(vertices), 4, 0);
gSPVertexNonGlobal((*dlist)++, VIRTUAL_TO_PHYSICAL(vertices), 4, 0);
gSPDisplayList((*dlist)++, dl_draw_quad_verts_0123);
}
}

View File

@ -6,6 +6,7 @@
extern s8 gReadOnlyBackground;
extern s8 gOverrideBackground;
extern Color gSkyboxColor;
extern Texture* gCustomSkyboxPtrList[];

View File

@ -12,6 +12,7 @@
#include "src/game/mario_step.h"
#include "src/pc/lua/utils/smlua_anim_utils.h"
#include "src/pc/lua/utils/smlua_misc_utils.h"
#include "src/pc/lua/utils/smlua_camera_utils.h"
#include "src/pc/lua/utils/smlua_collision_utils.h"
#include "src/pc/lua/utils/smlua_level_utils.h"
#include "src/game/spawn_sound.h"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,154 @@
#include "smlua_camera_utils.h"
#include "game/bettercamera.h"
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 };
static struct CameraOverride sOverrideEnableCamera = { 0 };
static struct CameraOverride sOverrideCameraAnalog = { 0 };
static struct CameraOverride sOverrideCameraMouse = { 0 };
void camera_reset_overrides(void) {
sOverrideCameraXSens.override = false;
sOverrideCameraYSens.override = false;
sOverrideCameraAggr.override = false;
sOverrideCameraPan.override = false;
sOverrideCameraDegrade.override = false;
sOverrideCameraInvertX.override = false;
sOverrideCameraInvertY.override = false;
sOverrideEnableCamera.override = false;
sOverrideCameraAnalog.override = false;
sOverrideCameraMouse.override = false;
}
void camera_freeze(void) {
gOverrideFreezeCamera = TRUE;
}
void camera_unfreeze(void) {
gOverrideFreezeCamera = FALSE;
}
bool camera_is_frozen(void) {
return gOverrideFreezeCamera;
}
void camera_set_romhack_override(enum RomhackCameraOverride rco) {
gOverrideRomhackCamera = rco;
}
void camera_romhack_allow_centering(u8 allow) {
gRomhackCameraAllowCentering = allow;
}
void camera_allow_toxic_gas_camera(u8 allow) {
gOverrideAllowToxicGasCamera = allow;
}
void camera_romhack_allow_dpad_usage(u8 allow) {
gRomhackCameraAllowDpad = allow;
}
bool camera_config_is_free_cam_enabled(void) {
return sOverrideEnableCamera.override ? sOverrideEnableCamera.value : configEnableCamera;
}
bool camera_config_is_analog_cam_enabled(void) {
return sOverrideCameraAnalog.override ? sOverrideCameraAnalog.value : configCameraAnalog;
}
bool camera_config_is_mouse_look_enabled(void) {
return sOverrideCameraMouse.override ? sOverrideCameraMouse.value : configCameraMouse;
}
bool camera_config_is_x_inverted(void) {
return sOverrideCameraInvertX.override ? sOverrideCameraInvertX.value : configCameraInvertX;
}
bool camera_config_is_y_inverted(void) {
return sOverrideCameraInvertY.override ? sOverrideCameraInvertY.value : configCameraInvertY;
}
u32 camera_config_get_x_sensitivity(void) {
return sOverrideCameraXSens.override ? sOverrideCameraXSens.value : configCameraXSens;
}
u32 camera_config_get_y_sensitivity(void) {
return sOverrideCameraYSens.override ? sOverrideCameraYSens.value : configCameraYSens;
}
u32 camera_config_get_aggression(void) {
return sOverrideCameraAggr.override ? sOverrideCameraAggr.value : configCameraAggr;
}
u32 camera_config_get_pan_level(void) {
return sOverrideCameraPan.override ? sOverrideCameraPan.value : configCameraPan;
}
u32 camera_config_get_deceleration(void) {
return sOverrideCameraDegrade.override ? sOverrideCameraDegrade.value : configCameraDegrade;
}
void camera_config_enable_free_cam(bool enable) {
sOverrideEnableCamera.value = enable;
sOverrideEnableCamera.override = true;
newcam_init_settings();
}
void camera_config_enable_analog_cam(bool enable) {
sOverrideCameraAnalog.value = enable;
sOverrideCameraAnalog.override = true;
newcam_init_settings();
}
void camera_config_enable_mouse_look(bool enable) {
sOverrideCameraMouse.value = enable;
sOverrideCameraMouse.override = true;
newcam_init_settings();
}
void camera_config_invert_x(bool invert) {
sOverrideCameraInvertX.value = invert;
sOverrideCameraInvertX.override = true;
newcam_init_settings();
}
void camera_config_invert_y(bool invert) {
sOverrideCameraInvertY.value = invert;
sOverrideCameraInvertY.override = true;
newcam_init_settings();
}
void camera_config_set_x_sensitivity(u32 value) {
sOverrideCameraXSens.value = MIN(MAX(value, 1), 100);
sOverrideCameraXSens.override = true;
newcam_init_settings();
}
void camera_config_set_y_sensitivity(u32 value) {
sOverrideCameraYSens.value = MIN(MAX(value, 1), 100);
sOverrideCameraYSens.override = true;
newcam_init_settings();
}
void camera_config_set_aggression(u32 value) {
sOverrideCameraAggr.value = MIN(MAX(value, 0), 100);
sOverrideCameraAggr.override = true;
newcam_init_settings();
}
void camera_config_set_pan_level(u32 value) {
sOverrideCameraPan.value = MIN(MAX(value, 0), 100);
sOverrideCameraPan.override = true;
newcam_init_settings();
}
void camera_config_set_deceleration(u32 value) {
sOverrideCameraDegrade.value = MIN(MAX(value, 0), 100);
sOverrideCameraDegrade.override = true;
newcam_init_settings();
}

View File

@ -0,0 +1,43 @@
#ifndef SMLUA_CAMERA_UTILS_H
#define SMLUA_CAMERA_UTILS_H
#include "types.h"
#include "game/camera.h"
struct CameraOverride {
unsigned int value;
bool override;
};
void camera_reset_overrides(void);
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);
void camera_allow_toxic_gas_camera(u8 allow);
void camera_romhack_allow_dpad_usage(u8 allow);
bool camera_config_is_free_cam_enabled(void);
bool camera_config_is_analog_cam_enabled(void);
bool camera_config_is_mouse_look_enabled(void);
bool camera_config_is_x_inverted(void);
bool camera_config_is_y_inverted(void);
u32 camera_config_get_x_sensitivity(void);
u32 camera_config_get_y_sensitivity(void);
u32 camera_config_get_aggression(void);
u32 camera_config_get_pan_level(void);
u32 camera_config_get_deceleration(void);
void camera_config_enable_free_cam(bool enable);
void camera_config_enable_analog_cam(bool enable);
void camera_config_enable_mouse_look(bool enable);
void camera_config_invert_x(bool invert);
void camera_config_invert_y(bool invert);
void camera_config_set_x_sensitivity(u32 value);
void camera_config_set_y_sensitivity(u32 value);
void camera_config_set_aggression(u32 value);
void camera_config_set_pan_level(u32 value);
void camera_config_set_deceleration(u32 value);
#endif

View File

@ -0,0 +1,94 @@
#include "smlua_gfx_utils.h"
#include "pc/gfx/gfx_pc.h"
#include "game/rendering_graph_node.h"
#include "game/skybox.h"
void set_override_fov(f32 fov) {
gOverrideFOV = fov;
}
///
void set_override_near(f32 nearClip) {
gOverrideNear = nearClip;
}
///
void set_override_far(f32 farClip) {
gOverrideFar = farClip;
}
///
f32 get_lighting_dir(u8 index) {
if (index > 2) { return 0; }
return gLightingDir[index];
}
void set_lighting_dir(u8 index, f32 value) {
if (index > 2) { return; }
gLightingDir[index] = value;
}
u8 get_lighting_color(u8 index) {
if (index > 2) { return 0; }
return gLightingColor[index];
}
void set_lighting_color(u8 index, u8 value) {
if (index > 2) { return; }
gLightingColor[index] = value;
}
///
u8 get_vertex_color(u8 index) {
if (index > 2) { return 0; }
return gVertexColor[index];
}
void set_vertex_color(u8 index, u8 value) {
if (index > 2) { return; }
gVertexColor[index] = value;
}
///
u8 get_fog_color(u8 index) {
if (index > 2) { return 0; }
return gFogColor[index];
}
void set_fog_color(u8 index, u8 value) {
if (index > 2) { return; }
gFogColor[index] = value;
}
f32 get_fog_intensity(void) {
return gFogIntensity;
}
void set_fog_intensity(f32 intensity) {
gFogIntensity = intensity;
}
///
s8 get_skybox(void) {
return gReadOnlyBackground;
}
void set_override_skybox(s8 background) {
gOverrideBackground = background;
}
u8 get_skybox_color(u8 index) {
if (index > 2) { return 0; }
return gSkyboxColor[index];
}
void set_skybox_color(u8 index, u8 value) {
if (index > 2) { return; }
gSkyboxColor[index] = value;
}

View File

@ -0,0 +1,29 @@
#ifndef SMLUA_GFX_UTILS_H
#define SMLUA_GFX_UTILS_H
#include "types.h"
void set_override_fov(f32 fov);
void set_override_near(f32 near);
void set_override_far(f32 far);
f32 get_lighting_dir(u8 index);
void set_lighting_dir(u8 index, f32 value);
u8 get_lighting_color(u8 index);
void set_lighting_color(u8 index, u8 value);
u8 get_vertex_color(u8 index);
void set_vertex_color(u8 index, u8 value);
u8 get_fog_color(u8 index);
void set_fog_color(u8 index, u8 value);
f32 get_fog_intensity(void);
void set_fog_intensity(f32 intensity);
s8 get_skybox(void);
void set_override_skybox(s8 background);
u8 get_skybox_color(u8 index);
void set_skybox_color(u8 index, u8 value);
#endif

View File

@ -253,160 +253,6 @@ void hud_set_flash(s8 value) {
///
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;
sOverrideCameraYSens.override = false;
sOverrideCameraAggr.override = false;
sOverrideCameraPan.override = false;
sOverrideCameraDegrade.override = false;
sOverrideCameraInvertX.override = false;
sOverrideCameraInvertY.override = false;
gOverrideEnableCamera.override = false;
sOverrideCameraAnalog.override = false;
sOverrideCameraMouse.override = false;
}
void camera_freeze(void) {
gOverrideFreezeCamera = TRUE;
}
void camera_unfreeze(void) {
gOverrideFreezeCamera = FALSE;
}
bool camera_is_frozen(void) {
return gOverrideFreezeCamera;
}
void camera_set_romhack_override(enum RomhackCameraOverride rco) {
gOverrideRomhackCamera = rco;
}
void camera_romhack_allow_centering(u8 allow) {
gRomhackCameraAllowCentering = allow;
}
void camera_allow_toxic_gas_camera(u8 allow) {
gOverrideAllowToxicGasCamera = allow;
}
void camera_romhack_allow_dpad_usage(u8 allow) {
gRomhackCameraAllowDpad = allow;
}
bool camera_config_is_free_cam_enabled(void) {
return gOverrideEnableCamera.override ? gOverrideEnableCamera.value : configEnableCamera;
}
bool camera_config_is_analog_cam_enabled(void) {
return sOverrideCameraAnalog.override ? sOverrideCameraAnalog.value : configCameraAnalog;
}
bool camera_config_is_mouse_look_enabled(void) {
return sOverrideCameraMouse.override ? sOverrideCameraMouse.value : configCameraMouse;
}
bool camera_config_is_x_inverted(void) {
return sOverrideCameraInvertX.override ? sOverrideCameraInvertX.value : configCameraInvertX;
}
bool camera_config_is_y_inverted(void) {
return sOverrideCameraInvertY.override ? sOverrideCameraInvertY.value : configCameraInvertY;
}
u32 camera_config_get_x_sensitivity(void) {
return sOverrideCameraXSens.override ? sOverrideCameraXSens.value : configCameraXSens;
}
u32 camera_config_get_y_sensitivity(void) {
return sOverrideCameraYSens.override ? sOverrideCameraYSens.value : configCameraYSens;
}
u32 camera_config_get_aggression(void) {
return sOverrideCameraAggr.override ? sOverrideCameraAggr.value : configCameraAggr;
}
u32 camera_config_get_pan_level(void) {
return sOverrideCameraPan.override ? sOverrideCameraPan.value : configCameraPan;
}
u32 camera_config_get_deceleration(void) {
return sOverrideCameraDegrade.override ? sOverrideCameraDegrade.value : configCameraDegrade;
}
void camera_config_enable_free_cam(bool enable) {
gOverrideEnableCamera.value = enable;
gOverrideEnableCamera.override = true;
newcam_init_settings();
}
void camera_config_enable_analog_cam(bool enable) {
sOverrideCameraAnalog.value = enable;
sOverrideCameraAnalog.override = true;
newcam_init_settings();
}
void camera_config_enable_mouse_look(bool enable) {
sOverrideCameraMouse.value = enable;
sOverrideCameraMouse.override = true;
newcam_init_settings();
}
void camera_config_invert_x(bool invert) {
sOverrideCameraInvertX.value = invert;
sOverrideCameraInvertX.override = true;
newcam_init_settings();
}
void camera_config_invert_y(bool invert) {
sOverrideCameraInvertY.value = invert;
sOverrideCameraInvertY.override = true;
newcam_init_settings();
}
void camera_config_set_x_sensitivity(u32 value) {
sOverrideCameraXSens.value = MIN(MAX(value, 1), 100);
sOverrideCameraXSens.override = true;
newcam_init_settings();
}
void camera_config_set_y_sensitivity(u32 value) {
sOverrideCameraYSens.value = MIN(MAX(value, 1), 100);
sOverrideCameraYSens.override = true;
newcam_init_settings();
}
void camera_config_set_aggression(u32 value) {
sOverrideCameraAggr.value = MIN(MAX(value, 0), 100);
sOverrideCameraAggr.override = true;
newcam_init_settings();
}
void camera_config_set_pan_level(u32 value) {
sOverrideCameraPan.value = MIN(MAX(value, 0), 100);
sOverrideCameraPan.override = true;
newcam_init_settings();
}
void camera_config_set_deceleration(u32 value) {
sOverrideCameraDegrade.value = MIN(MAX(value, 0), 100);
sOverrideCameraDegrade.override = true;
newcam_init_settings();
}
///
extern s16 gMenuMode;
bool is_game_paused(void) {
return gMenuMode != -1;
@ -499,88 +345,6 @@ void set_water_level(u8 index, s16 height, bool sync) {
///
void set_override_fov(f32 fov) {
gOverrideFOV = fov;
}
///
void set_override_near(f32 nearClip) {
gOverrideNear = nearClip;
}
///
void set_override_far(f32 farClip) {
gOverrideFar = farClip;
}
///
f32 get_lighting_dir(u8 index) {
if (index > 2) { return 0; }
return gLightingDir[index];
}
void set_lighting_dir(u8 index, f32 value) {
if (index > 2) { return; }
gLightingDir[index] = value;
}
u8 get_lighting_color(u8 index) {
if (index > 2) { return 0; }
return gLightingColor[index];
}
void set_lighting_color(u8 index, u8 value) {
if (index > 2) { return; }
gLightingColor[index] = value;
}
///
u8 get_vertex_color(u8 index) {
if (index > 2) { return 0; }
return gVertexColor[index];
}
void set_vertex_color(u8 index, u8 value) {
if (index > 2) { return; }
gVertexColor[index] = value;
}
///
u8 get_fog_color(u8 index) {
if (index > 2) { return 0; }
return gFogColor[index];
}
void set_fog_color(u8 index, u8 value) {
if (index > 2) { return; }
gFogColor[index] = value;
}
f32 get_fog_intensity(void) {
return gFogIntensity;
}
void set_fog_intensity(f32 intensity) {
gFogIntensity = intensity;
}
///
s8 get_skybox(void) {
return gReadOnlyBackground;
}
void set_override_skybox(s8 background) {
gOverrideBackground = background;
}
///
bool course_is_main_course(u16 courseNum) {
return COURSE_IS_MAIN_COURSE(courseNum);
}

View File

@ -38,12 +38,7 @@ struct DateTime {
s32 second;
};
struct CameraOverride {
unsigned int value;
bool override;
};
extern struct CameraOverride gOverrideEnableCamera;
u32 get_network_area_timer(void);
@ -79,37 +74,6 @@ void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 p
s8 hud_get_flash(void);
void hud_set_flash(s8 value);
void camera_reset_overrides(void);
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);
void camera_allow_toxic_gas_camera(u8 allow);
void camera_romhack_allow_dpad_usage(u8 allow);
bool camera_config_is_free_cam_enabled(void);
bool camera_config_is_analog_cam_enabled(void);
bool camera_config_is_mouse_look_enabled(void);
bool camera_config_is_x_inverted(void);
bool camera_config_is_y_inverted(void);
u32 camera_config_get_x_sensitivity(void);
u32 camera_config_get_y_sensitivity(void);
u32 camera_config_get_aggression(void);
u32 camera_config_get_pan_level(void);
u32 camera_config_get_deceleration(void);
void camera_config_enable_free_cam(bool enable);
void camera_config_enable_analog_cam(bool enable);
void camera_config_enable_mouse_look(bool enable);
void camera_config_invert_x(bool invert);
void camera_config_invert_y(bool invert);
void camera_config_set_x_sensitivity(u32 value);
void camera_config_set_y_sensitivity(u32 value);
void camera_config_set_aggression(u32 value);
void camera_config_set_pan_level(u32 value);
void camera_config_set_deceleration(u32 value);
bool is_game_paused(void);
bool is_transition_playing(void);
@ -127,27 +91,6 @@ void movtexqc_register(const char* name, s16 level, s16 area, s16 type);
s16 get_water_level(u8 index);
void set_water_level(u8 index, s16 height, bool sync);
void set_override_fov(f32 fov);
void set_override_near(f32 near);
void set_override_far(f32 far);
f32 get_lighting_dir(u8 index);
void set_lighting_dir(u8 index, f32 value);
u8 get_lighting_color(u8 index);
void set_lighting_color(u8 index, u8 value);
u8 get_vertex_color(u8 index);
void set_vertex_color(u8 index, u8 value);
u8 get_fog_color(u8 index);
void set_fog_color(u8 index, u8 value);
f32 get_fog_intensity(void);
void set_fog_intensity(f32 intensity);
s8 get_skybox(void);
void set_override_skybox(s8 background);
void play_transition(s16 transType, s16 time, u8 red, u8 green, u8 blue);
bool course_is_main_course(u16 courseNum);

View File

@ -2,7 +2,7 @@
#define MOD_H
#include <PR/ultratypes.h>
#include <types.h>
#include "types.h"
#include "pc/platform.h"
#define MOD_NAME_MAX_LENGTH 64

View File

@ -1,5 +1,5 @@
#include "PR/ultratypes.h"
#include <types.h>
#include "types.h"
#include "pc/platform.h"
#include "pc/utils/miniz/miniz.h"
#include "pc/debuglog.h"

View File

@ -2,7 +2,7 @@
#define MODS_H
#include <PR/ultratypes.h>
#include <types.h>
#include "types.h"
#include "pc/platform.h"
#include "mod.h"

View File

@ -2,7 +2,7 @@
#define MODS_UTILS_H
#include <PR/ultratypes.h>
#include <types.h>
#include "types.h"
#include "pc/platform.h"
void mods_size_enforce(struct Mods* mods);

View File

@ -17,6 +17,7 @@
#include "pc/lua/smlua.h"
#include "pc/lua/utils/smlua_model_utils.h"
#include "pc/lua/utils/smlua_misc_utils.h"
#include "pc/lua/utils/smlua_camera_utils.h"
#include "pc/mods/mods.h"
#include "pc/crash_handler.h"
#include "pc/debuglog.h"

View File

@ -3,7 +3,7 @@
#include <PR/ultratypes.h>
#include <time.h>
#include <types.h>
#include "types.h"
#include <assert.h>
#include "network_player.h"
#include "network_utils.h"

View File

@ -3,7 +3,7 @@
#include <PR/ultratypes.h>
#include <time.h>
#include <types.h>
#include "types.h"
#include <assert.h>
#include <stdbool.h>