From 16d403c254fff5022a27a83c46fc18a195bda981 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+AgentXLP@users.noreply.github.com> Date: Mon, 24 Jun 2024 23:40:49 -0400 Subject: [PATCH] Update script warnings --- src/pc/lua/smlua.h | 1 + src/pc/lua/utils/smlua_deprecated.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pc/lua/smlua.h b/src/pc/lua/smlua.h index b7b2eb62..039a7753 100644 --- a/src/pc/lua/smlua.h +++ b/src/pc/lua/smlua.h @@ -22,6 +22,7 @@ #define LOG_LUA(...) { if (!gSmLuaSuppressErrors) { printf("[LUA] "), printf(__VA_ARGS__), printf("\n"), smlua_mod_error(), snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), sys_swap_backslashes(gDjuiConsoleTmpBuffer), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_ERROR); } } #define LOG_LUA_LINE(...) { if (!gSmLuaSuppressErrors) { printf("[LUA] "), printf(__VA_ARGS__), printf("\n"), smlua_mod_error(); snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), sys_swap_backslashes(gDjuiConsoleTmpBuffer), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_ERROR), smlua_logline(); } } +#define LOG_LUA_LINE_WARNING(...) { smlua_mod_warning(); snprintf(gDjuiConsoleTmpBuffer, CONSOLE_MAX_TMP_BUFFER, __VA_ARGS__), sys_swap_backslashes(gDjuiConsoleTmpBuffer), djui_console_message_create(gDjuiConsoleTmpBuffer, CONSOLE_MESSAGE_WARNING); } #ifdef DEVELOPMENT #define LUA_STACK_CHECK_BEGIN() int __LUA_STACK_TOP = lua_gettop(gLuaState) diff --git a/src/pc/lua/utils/smlua_deprecated.c b/src/pc/lua/utils/smlua_deprecated.c index ec3eb20f..252b1ff6 100644 --- a/src/pc/lua/utils/smlua_deprecated.c +++ b/src/pc/lua/utils/smlua_deprecated.c @@ -8,7 +8,7 @@ #include "game/object_list_processor.h" char* network_discord_id_from_local_index(UNUSED u8 localIndex) { - smlua_mod_warning(); + LOG_LUA_LINE_WARNING("[LUA] network_discord_id_from_local_index() is deprecated! Please use get_local_discord_id() instead."); #ifdef DISCORD_SDK static char sDiscordId[64] = ""; if (localIndex == 0) { @@ -20,31 +20,31 @@ char* network_discord_id_from_local_index(UNUSED u8 localIndex) { } void djui_hud_set_render_behind_hud(bool enable) { - smlua_mod_warning(); + LOG_LUA_LINE_WARNING("[LUA] djui_hud_set_render_behind_hud() is deprecated! Please use HOOK_ON_HUD_RENDER_BEHIND instead."); if (!gLuaActiveMod) { return; } gLuaActiveMod->renderBehindHud = enable; } struct ModAudio* audio_stream_load_url(UNUSED const char* url) { - smlua_mod_warning(); + LOG_LUA_LINE_WARNING("[LUA] audio_stream_load_url() is deprecated! There is no replacement for this function."); return NULL; } f32 audio_stream_get_tempo(UNUSED struct ModAudio* audio) { - smlua_mod_warning(); + LOG_LUA_LINE_WARNING("[LUA] audio_stream_get_tempo() is deprecated! There may be a replacement for this function in the future."); return 1; } void audio_stream_set_tempo(UNUSED struct ModAudio* audio, UNUSED f32 tempo) { - smlua_mod_warning(); + LOG_LUA_LINE_WARNING("[LUA] audio_stream_set_tempo() is deprecated! There may be a replacement for this function in the future."); } void audio_stream_set_speed(UNUSED struct ModAudio* audio, UNUSED f32 initial_freq, UNUSED f32 speed, UNUSED bool pitch) { - smlua_mod_warning(); + 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) { - smlua_mod_warning(); + 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]; @@ -53,7 +53,7 @@ f32 get_environment_region(u8 index) { } void set_environment_region(u8 index, s32 value) { - smlua_mod_warning(); + 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; @@ -61,7 +61,7 @@ void set_environment_region(u8 index, s32 value) { } void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart part, Color color) { - smlua_mod_warning(); + 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; } np->palette.parts[part][0] = color[0]; @@ -71,7 +71,7 @@ void network_player_color_to_palette(struct NetworkPlayer *np, enum PlayerPart p } void network_player_palette_to_color(struct NetworkPlayer *np, enum PlayerPart part, Color out) { - smlua_mod_warning(); + LOG_LUA_LINE_WARNING("[LUA] network_player_palette_to_color() is deprecated! Use network_player_get_palette_color() or network_player_get_override_palette_color() instead."); if (np == NULL || !(part < PLAYER_PART_MAX && part >= 0)) { if (np == NULL) { // output config palette instead if np is NULL out[0] = configPlayerPalette.parts[part][0];