Undeprecate env region functions

This commit is contained in:
Agent X 2024-07-03 19:51:54 -04:00
parent 09d0394aba
commit 543511ff28
8 changed files with 113 additions and 70 deletions

View File

@ -7847,12 +7847,6 @@ function djui_hud_set_render_behind_hud(enable)
-- ... -- ...
end end
--- @param index integer
--- @return number
function get_environment_region(index)
-- ...
end
--- @param localIndex integer --- @param localIndex integer
--- @return string --- @return string
function network_discord_id_from_local_index(localIndex) function network_discord_id_from_local_index(localIndex)
@ -7873,12 +7867,6 @@ function network_player_palette_to_color(np, part, out)
-- ... -- ...
end end
--- @param index integer
--- @param value integer
function set_environment_region(index, value)
-- ...
end
--- @param index integer --- @param index integer
--- @return integer --- @return integer
function get_fog_color(index) function get_fog_color(index)
@ -8201,6 +8189,12 @@ function get_envfx()
-- ... -- ...
end end
--- @param index integer
--- @return number
function get_environment_region(index)
-- ...
end
--- @return integer --- @return integer
function get_global_timer() function get_global_timer()
-- ... -- ...
@ -8407,6 +8401,12 @@ function save_file_set_using_backup_slot(usingBackupSlot)
-- ... -- ...
end end
--- @param index integer
--- @param value integer
function set_environment_region(index, value)
-- ...
end
--- @param value boolean --- @param value boolean
function set_got_file_coin_hi_score(value) function set_got_file_coin_hi_score(value)
-- ... -- ...

View File

@ -2174,6 +2174,26 @@
<br /> <br />
## [get_environment_region](#get_environment_region)
### Lua Example
`local numberValue = get_environment_region(index)`
### Parameters
| Field | Type |
| ----- | ---- |
| index | `integer` |
### Returns
- `number`
### C Prototype
`f32 get_environment_region(u8 index);`
[:arrow_up_small:](#)
<br />
## [get_global_timer](#get_global_timer) ## [get_global_timer](#get_global_timer)
### Lua Example ### Lua Example
@ -2871,6 +2891,27 @@
<br /> <br />
## [set_environment_region](#set_environment_region)
### Lua Example
`set_environment_region(index, value)`
### Parameters
| Field | Type |
| ----- | ---- |
| index | `integer` |
| value | `integer` |
### Returns
- None
### C Prototype
`void set_environment_region(u8 index, s32 value);`
[:arrow_up_small:](#)
<br />
## [set_got_file_coin_hi_score](#set_got_file_coin_hi_score) ## [set_got_file_coin_hi_score](#set_got_file_coin_hi_score)
### Lua Example ### Lua Example

View File

@ -1720,6 +1720,7 @@
- [get_dialog_id](functions-5.md#get_dialog_id) - [get_dialog_id](functions-5.md#get_dialog_id)
- [get_dialog_response](functions-5.md#get_dialog_response) - [get_dialog_response](functions-5.md#get_dialog_response)
- [get_envfx](functions-5.md#get_envfx) - [get_envfx](functions-5.md#get_envfx)
- [get_environment_region](functions-5.md#get_environment_region)
- [get_global_timer](functions-5.md#get_global_timer) - [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_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_x](functions-5.md#get_hand_foot_pos_x)
@ -1756,6 +1757,7 @@
- [reset_window_title](functions-5.md#reset_window_title) - [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_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) - [save_file_set_using_backup_slot](functions-5.md#save_file_set_using_backup_slot)
- [set_environment_region](functions-5.md#set_environment_region)
- [set_got_file_coin_hi_score](functions-5.md#set_got_file_coin_hi_score) - [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_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_completed_star_num](functions-5.md#set_last_completed_star_num)

View File

@ -29146,23 +29146,6 @@ int smlua_func_djui_hud_set_render_behind_hud(lua_State* L) {
return 1; return 1;
} }
int smlua_func_get_environment_region(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", "get_environment_region", 1, top);
return 0;
}
u8 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_environment_region"); return 0; }
lua_pushnumber(L, get_environment_region(index));
return 1;
}
int smlua_func_network_discord_id_from_local_index(lua_State* L) { int smlua_func_network_discord_id_from_local_index(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -29238,25 +29221,6 @@ int smlua_func_network_player_palette_to_color(lua_State* L) {
return 1; return 1;
} }
int smlua_func_set_environment_region(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 2) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_environment_region", 2, top);
return 0;
}
u8 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_environment_region"); return 0; }
s32 value = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_environment_region"); return 0; }
set_environment_region(index, value);
return 1;
}
/////////////////////// ///////////////////////
// smlua_gfx_utils.h // // smlua_gfx_utils.h //
/////////////////////// ///////////////////////
@ -30217,6 +30181,23 @@ int smlua_func_get_envfx(UNUSED lua_State* L) {
return 1; return 1;
} }
int smlua_func_get_environment_region(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", "get_environment_region", 1, top);
return 0;
}
u8 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_environment_region"); return 0; }
lua_pushnumber(L, get_environment_region(index));
return 1;
}
int smlua_func_get_global_timer(UNUSED lua_State* L) { int smlua_func_get_global_timer(UNUSED lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -30829,6 +30810,25 @@ int smlua_func_save_file_set_using_backup_slot(lua_State* L) {
return 1; return 1;
} }
int smlua_func_set_environment_region(lua_State* L) {
if (L == NULL) { return 0; }
int top = lua_gettop(L);
if (top != 2) {
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "set_environment_region", 2, top);
return 0;
}
u8 index = smlua_to_integer(L, 1);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "set_environment_region"); return 0; }
s32 value = smlua_to_integer(L, 2);
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "set_environment_region"); return 0; }
set_environment_region(index, value);
return 1;
}
int smlua_func_set_got_file_coin_hi_score(lua_State* L) { int smlua_func_set_got_file_coin_hi_score(lua_State* L) {
if (L == NULL) { return 0; } if (L == NULL) { return 0; }
@ -34448,11 +34448,9 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "audio_stream_set_speed", smlua_func_audio_stream_set_speed); smlua_bind_function(L, "audio_stream_set_speed", smlua_func_audio_stream_set_speed);
smlua_bind_function(L, "audio_stream_set_tempo", smlua_func_audio_stream_set_tempo); smlua_bind_function(L, "audio_stream_set_tempo", smlua_func_audio_stream_set_tempo);
smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud); smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud);
smlua_bind_function(L, "get_environment_region", smlua_func_get_environment_region);
smlua_bind_function(L, "network_discord_id_from_local_index", smlua_func_network_discord_id_from_local_index); smlua_bind_function(L, "network_discord_id_from_local_index", smlua_func_network_discord_id_from_local_index);
smlua_bind_function(L, "network_player_color_to_palette", smlua_func_network_player_color_to_palette); smlua_bind_function(L, "network_player_color_to_palette", smlua_func_network_player_color_to_palette);
smlua_bind_function(L, "network_player_palette_to_color", smlua_func_network_player_palette_to_color); smlua_bind_function(L, "network_player_palette_to_color", smlua_func_network_player_palette_to_color);
smlua_bind_function(L, "set_environment_region", smlua_func_set_environment_region);
// smlua_gfx_utils.h // smlua_gfx_utils.h
smlua_bind_function(L, "get_fog_color", smlua_func_get_fog_color); smlua_bind_function(L, "get_fog_color", smlua_func_get_fog_color);
@ -34515,6 +34513,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_dialog_id", smlua_func_get_dialog_id); smlua_bind_function(L, "get_dialog_id", smlua_func_get_dialog_id);
smlua_bind_function(L, "get_dialog_response", smlua_func_get_dialog_response); smlua_bind_function(L, "get_dialog_response", smlua_func_get_dialog_response);
smlua_bind_function(L, "get_envfx", smlua_func_get_envfx); smlua_bind_function(L, "get_envfx", smlua_func_get_envfx);
smlua_bind_function(L, "get_environment_region", smlua_func_get_environment_region);
smlua_bind_function(L, "get_global_timer", smlua_func_get_global_timer); 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_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_x", smlua_func_get_hand_foot_pos_x);
@ -34551,6 +34550,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "reset_window_title", smlua_func_reset_window_title); smlua_bind_function(L, "reset_window_title", smlua_func_reset_window_title);
smlua_bind_function(L, "save_file_get_using_backup_slot", smlua_func_save_file_get_using_backup_slot); smlua_bind_function(L, "save_file_get_using_backup_slot", smlua_func_save_file_get_using_backup_slot);
smlua_bind_function(L, "save_file_set_using_backup_slot", smlua_func_save_file_set_using_backup_slot); smlua_bind_function(L, "save_file_set_using_backup_slot", smlua_func_save_file_set_using_backup_slot);
smlua_bind_function(L, "set_environment_region", smlua_func_set_environment_region);
smlua_bind_function(L, "set_got_file_coin_hi_score", smlua_func_set_got_file_coin_hi_score); smlua_bind_function(L, "set_got_file_coin_hi_score", smlua_func_set_got_file_coin_hi_score);
smlua_bind_function(L, "set_last_completed_course_num", smlua_func_set_last_completed_course_num); smlua_bind_function(L, "set_last_completed_course_num", smlua_func_set_last_completed_course_num);
smlua_bind_function(L, "set_last_completed_star_num", smlua_func_set_last_completed_star_num); smlua_bind_function(L, "set_last_completed_star_num", smlua_func_set_last_completed_star_num);

View File

@ -43,23 +43,6 @@ void audio_stream_set_speed(UNUSED struct ModAudio* audio, UNUSED f32 initial_fr
LOG_LUA_LINE_WARNING("[LUA] audio_stream_set_speed() is deprecated! There may be a replacement for this function in the future."); LOG_LUA_LINE_WARNING("[LUA] audio_stream_set_speed() is deprecated! There may be a replacement for this function in the future.");
} }
f32 get_environment_region(u8 index) {
LOG_LUA_LINE_WARNING("[LUA] get_environment_region() is deprecated! Use get_water_level() instead.");
s32 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
return gEnvironmentRegions[idx];
}
return gLevelValues.floorLowerLimit;
}
void set_environment_region(u8 index, s32 value) {
LOG_LUA_LINE_WARNING("[LUA] get_environment_region() is deprecated! Use set_water_level() instead.");
s32 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
gEnvironmentRegions[idx] = value;
}
}
void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color) { void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color) {
LOG_LUA_LINE_WARNING("[LUA] network_player_color_to_palette() is deprecated! Use network_player_set_override_palette_color() instead."); LOG_LUA_LINE_WARNING("[LUA] network_player_color_to_palette() is deprecated! Use network_player_set_override_palette_color() instead.");
if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { return; } if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { return; }

View File

@ -8,8 +8,5 @@ f32 audio_stream_get_tempo(struct ModAudio* audio);
void audio_stream_set_tempo(struct ModAudio* audio, f32 tempo); void audio_stream_set_tempo(struct ModAudio* audio, f32 tempo);
void audio_stream_set_speed(struct ModAudio* audio, f32 initial_freq, f32 speed, bool pitch); void audio_stream_set_speed(struct ModAudio* audio, f32 initial_freq, f32 speed, bool pitch);
f32 get_environment_region(u8 index);
void set_environment_region(u8 index, s32 value);
void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color); void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color);
void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out); void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out);

View File

@ -462,6 +462,23 @@ void set_volume_env(f32 volume) {
/// ///
f32 get_environment_region(u8 index) {
s32 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
return gEnvironmentRegions[idx];
}
return gLevelValues.floorLowerLimit;
}
void set_environment_region(u8 index, s32 value) {
s32 idx = 6 * index;
if (gEnvironmentRegions != NULL && index > 0 && index <= gEnvironmentRegions[0] && gEnvironmentRegionsLength > idx) {
gEnvironmentRegions[idx] = value;
}
}
///
void set_window_title(const char* title) { void set_window_title(const char* title) {
WAPI.set_window_title(title); WAPI.set_window_title(title);
} }

View File

@ -121,6 +121,9 @@ void set_volume_level(f32 volume);
void set_volume_sfx(f32 volume); void set_volume_sfx(f32 volume);
void set_volume_env(f32 volume); void set_volume_env(f32 volume);
f32 get_environment_region(u8 index);
void set_environment_region(u8 index, s32 value);
void set_window_title(const char* title); void set_window_title(const char* title);
void reset_window_title(void); void reset_window_title(void);