diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 3b6413da1..bccb854f3 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -8744,6 +8744,11 @@ function get_fog_intensity() -- ... end +--- @return integer +function get_global_timer() + -- ... +end + --- @return boolean function get_got_file_coin_hi_score() -- ... @@ -8850,6 +8855,11 @@ function gfx_get_adjust_for_aspect_ratio() -- ... end +--- @return integer +function hud_get_flash() + -- ... +end + --- @param type HudDisplayValue --- @return integer function hud_get_value(type) @@ -8890,6 +8900,12 @@ function hud_render_power_meter_interpolated(health, prevX, prevY, prevWidth, pr -- ... end +--- @param value integer +--- @return nil +function hud_set_flash(value) + -- ... +end + --- @param type HudDisplayValue --- @param value integer --- @return nil diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 1b3ae89e0..6b7df8c37 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -869,6 +869,24 @@
+## [get_global_timer](#get_global_timer) + +### Lua Example +`local integerValue = get_global_timer()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`u32 get_global_timer(void);` + +[:arrow_up_small:](#) + +
+ ## [get_got_file_coin_hi_score](#get_got_file_coin_hi_score) ### Lua Example @@ -1230,6 +1248,24 @@
+## [hud_get_flash](#hud_get_flash) + +### Lua Example +`local integerValue = hud_get_flash()` + +### Parameters +- None + +### Returns +- `integer` + +### C Prototype +`s8 hud_get_flash(void);` + +[:arrow_up_small:](#) + +
+ ## [hud_get_value](#hud_get_value) ### Lua Example @@ -1338,6 +1374,26 @@
+## [hud_set_flash](#hud_set_flash) + +### Lua Example +`hud_set_flash(value)` + +### Parameters +| Field | Type | +| ----- | ---- | +| value | `integer` | + +### Returns +- None + +### C Prototype +`void hud_set_flash(s8 value);` + +[:arrow_up_small:](#) + +
+ ## [hud_set_value](#hud_set_value) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 0c977c6b2..2f54fbc22 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1642,6 +1642,7 @@ - [get_environment_region](functions-5.md#get_environment_region) - [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) - [get_hand_foot_pos_y](functions-5.md#get_hand_foot_pos_y) @@ -1661,11 +1662,13 @@ - [get_vertex_color](functions-5.md#get_vertex_color) - [gfx_enable_adjust_for_aspect_ratio](functions-5.md#gfx_enable_adjust_for_aspect_ratio) - [gfx_get_adjust_for_aspect_ratio](functions-5.md#gfx_get_adjust_for_aspect_ratio) + - [hud_get_flash](functions-5.md#hud_get_flash) - [hud_get_value](functions-5.md#hud_get_value) - [hud_hide](functions-5.md#hud_hide) - [hud_is_hidden](functions-5.md#hud_is_hidden) - [hud_render_power_meter](functions-5.md#hud_render_power_meter) - [hud_render_power_meter_interpolated](functions-5.md#hud_render_power_meter_interpolated) + - [hud_set_flash](functions-5.md#hud_set_flash) - [hud_set_value](functions-5.md#hud_set_value) - [hud_show](functions-5.md#hud_show) - [is_game_paused](functions-5.md#is_game_paused) diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index baec2ae33..fbecdeeb1 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -28890,6 +28890,21 @@ int smlua_func_get_fog_intensity(UNUSED lua_State* L) { return 1; } +int smlua_func_get_global_timer(UNUSED lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_global_timer", 0, top); + return 0; + } + + + lua_pushinteger(L, get_global_timer()); + + return 1; +} + int smlua_func_get_got_file_coin_hi_score(UNUSED lua_State* L) { if (L == NULL) { return 0; } @@ -29197,6 +29212,21 @@ int smlua_func_gfx_get_adjust_for_aspect_ratio(UNUSED lua_State* L) { return 1; } +int smlua_func_hud_get_flash(UNUSED lua_State* L) { + if (L == NULL) { return 0; } + + int top = lua_gettop(L); + if (top != 0) { + LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "hud_get_flash", 0, top); + return 0; + } + + + lua_pushinteger(L, hud_get_flash()); + + return 1; +} + int smlua_func_hud_get_value(lua_State* L) { if (L == NULL) { return 0; } @@ -29302,6 +29332,23 @@ int smlua_func_hud_render_power_meter_interpolated(lua_State* L) { return 1; } +int smlua_func_hud_set_flash(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", "hud_set_flash", 1, top); + return 0; + } + + s8 value = smlua_to_integer(L, 1); + if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "hud_set_flash"); return 0; } + + hud_set_flash(value); + + return 1; +} + int smlua_func_hud_set_value(lua_State* L) { if (L == NULL) { return 0; } @@ -32975,6 +33022,7 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "get_environment_region", smlua_func_get_environment_region); smlua_bind_function(L, "get_fog_color", smlua_func_get_fog_color); smlua_bind_function(L, "get_fog_intensity", smlua_func_get_fog_intensity); + smlua_bind_function(L, "get_global_timer", smlua_func_get_global_timer); smlua_bind_function(L, "get_got_file_coin_hi_score", smlua_func_get_got_file_coin_hi_score); smlua_bind_function(L, "get_hand_foot_pos_x", smlua_func_get_hand_foot_pos_x); smlua_bind_function(L, "get_hand_foot_pos_y", smlua_func_get_hand_foot_pos_y); @@ -32994,11 +33042,13 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "get_vertex_color", smlua_func_get_vertex_color); smlua_bind_function(L, "gfx_enable_adjust_for_aspect_ratio", smlua_func_gfx_enable_adjust_for_aspect_ratio); smlua_bind_function(L, "gfx_get_adjust_for_aspect_ratio", smlua_func_gfx_get_adjust_for_aspect_ratio); + smlua_bind_function(L, "hud_get_flash", smlua_func_hud_get_flash); smlua_bind_function(L, "hud_get_value", smlua_func_hud_get_value); smlua_bind_function(L, "hud_hide", smlua_func_hud_hide); smlua_bind_function(L, "hud_is_hidden", smlua_func_hud_is_hidden); smlua_bind_function(L, "hud_render_power_meter", smlua_func_hud_render_power_meter); smlua_bind_function(L, "hud_render_power_meter_interpolated", smlua_func_hud_render_power_meter_interpolated); + smlua_bind_function(L, "hud_set_flash", smlua_func_hud_set_flash); smlua_bind_function(L, "hud_set_value", smlua_func_hud_set_value); smlua_bind_function(L, "hud_show", smlua_func_hud_show); smlua_bind_function(L, "is_game_paused", smlua_func_is_game_paused); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index 5eb66c7bd..c0ed9fde7 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -172,17 +172,18 @@ void hud_set_value(enum HudDisplayValue type, s32 value) { } } +extern const u8 texture_power_meter_left_side[]; +extern const u8 texture_power_meter_right_side[]; +extern const u8 texture_power_meter_full[]; +extern const u8 texture_power_meter_seven_segments[]; +extern const u8 texture_power_meter_six_segments[]; +extern const u8 texture_power_meter_five_segments[]; +extern const u8 texture_power_meter_four_segments[]; +extern const u8 texture_power_meter_three_segments[]; +extern const u8 texture_power_meter_two_segments[]; +extern const u8 texture_power_meter_one_segments[]; + void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height) { - extern const u8 texture_power_meter_left_side[]; - extern const u8 texture_power_meter_right_side[]; - extern const u8 texture_power_meter_full[]; - extern const u8 texture_power_meter_seven_segments[]; - extern const u8 texture_power_meter_six_segments[]; - extern const u8 texture_power_meter_five_segments[]; - extern const u8 texture_power_meter_four_segments[]; - extern const u8 texture_power_meter_three_segments[]; - extern const u8 texture_power_meter_two_segments[]; - extern const u8 texture_power_meter_one_segments[]; static struct TextureInfo sPowerMeterTexturesInfo[] = { { (u8*)texture_power_meter_left_side, 8, 32, 64, "texture_power_meter_left_side" }, { (u8*)texture_power_meter_right_side, 8, 32, 64, "texture_power_meter_right_side" }, @@ -204,16 +205,6 @@ void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height) { } void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height) { - extern const u8 texture_power_meter_left_side[]; - extern const u8 texture_power_meter_right_side[]; - extern const u8 texture_power_meter_full[]; - extern const u8 texture_power_meter_seven_segments[]; - extern const u8 texture_power_meter_six_segments[]; - extern const u8 texture_power_meter_five_segments[]; - extern const u8 texture_power_meter_four_segments[]; - extern const u8 texture_power_meter_three_segments[]; - extern const u8 texture_power_meter_two_segments[]; - extern const u8 texture_power_meter_one_segments[]; static struct TextureInfo sPowerMeterTexturesInfo[] = { { (u8*)texture_power_meter_left_side, 8, 32, 64, "texture_power_meter_left_side" }, { (u8*)texture_power_meter_right_side, 8, 32, 64, "texture_power_meter_right_side" }, @@ -243,6 +234,14 @@ void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 p } } +s8 hud_get_flash(void) { + return gHudFlash; +} + +void hud_set_flash(s8 value) { + gHudFlash = value; +} + /// struct CameraOverride { @@ -622,6 +621,12 @@ void set_override_envfx(s32 envfx) { /// +u32 get_global_timer(void) { + return gGlobalTimer; +} + +/// + bool get_coop_compatibility_enabled(void) { return configCoopCompatibility; } diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index d8d90fa41..08f9016ea 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -68,6 +68,8 @@ s32 hud_get_value(enum HudDisplayValue type); void hud_set_value(enum HudDisplayValue type, s32 value); void hud_render_power_meter(s32 health, f32 x, f32 y, f32 width, f32 height); void hud_render_power_meter_interpolated(s32 health, f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height); +s8 hud_get_flash(void); +void hud_set_flash(s8 value); void camera_reset_overrides(void); void camera_freeze(void); @@ -153,6 +155,8 @@ struct DateTime* get_date_and_time(void); u16 get_envfx(void); void set_override_envfx(s32 envfx); +u32 get_global_timer(void); + bool get_coop_compatibility_enabled(void); bool gfx_get_adjust_for_aspect_ratio(void);