From edd29c071943fd4ada27437c9616f638c941fff5 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Fri, 8 Mar 2024 19:47:46 -0500 Subject: [PATCH] Remove set gfx adjust for aspect ratio function Too much power. --- autogen/lua_definitions/functions.lua | 11 -------- docs/lua/functions-5.md | 38 --------------------------- docs/lua/functions.md | 2 -- src/pc/gfx/gfx_pc.c | 6 +---- src/pc/gfx/gfx_pc.h | 2 -- src/pc/lua/smlua_functions_autogen.c | 34 ------------------------ src/pc/lua/utils/smlua_misc_utils.c | 10 ------- src/pc/lua/utils/smlua_misc_utils.h | 3 --- src/pc/network/network.c | 1 - 9 files changed, 1 insertion(+), 106 deletions(-) diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua index 55e54df8..c7021348 100644 --- a/autogen/lua_definitions/functions.lua +++ b/autogen/lua_definitions/functions.lua @@ -8862,17 +8862,6 @@ function get_vertex_color(index) -- ... end ---- @param enable boolean ---- @return nil -function gfx_enable_adjust_for_aspect_ratio(enable) - -- ... -end - ---- @return boolean -function gfx_get_adjust_for_aspect_ratio() - -- ... -end - --- @return integer function hud_get_flash() -- ... diff --git a/docs/lua/functions-5.md b/docs/lua/functions-5.md index 6b7df8c3..ad01f762 100644 --- a/docs/lua/functions-5.md +++ b/docs/lua/functions-5.md @@ -1210,44 +1210,6 @@
-## [gfx_enable_adjust_for_aspect_ratio](#gfx_enable_adjust_for_aspect_ratio) - -### Lua Example -`gfx_enable_adjust_for_aspect_ratio(enable)` - -### Parameters -| Field | Type | -| ----- | ---- | -| enable | `boolean` | - -### Returns -- None - -### C Prototype -`void gfx_enable_adjust_for_aspect_ratio(bool enable);` - -[:arrow_up_small:](#) - -
- -## [gfx_get_adjust_for_aspect_ratio](#gfx_get_adjust_for_aspect_ratio) - -### Lua Example -`local booleanValue = gfx_get_adjust_for_aspect_ratio()` - -### Parameters -- None - -### Returns -- `boolean` - -### C Prototype -`bool gfx_get_adjust_for_aspect_ratio(void);` - -[:arrow_up_small:](#) - -
- ## [hud_get_flash](#hud_get_flash) ### Lua Example diff --git a/docs/lua/functions.md b/docs/lua/functions.md index 6ca36d5a..ee92d364 100644 --- a/docs/lua/functions.md +++ b/docs/lua/functions.md @@ -1663,8 +1663,6 @@ - [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) - - [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) diff --git a/src/pc/gfx/gfx_pc.c b/src/pc/gfx/gfx_pc.c index 13185aa1..1178f76a 100644 --- a/src/pc/gfx/gfx_pc.c +++ b/src/pc/gfx/gfx_pc.c @@ -189,8 +189,6 @@ Color gVertexColor = { 255, 255, 255 }; Color gFogColor = { 255, 255, 255 }; f32 gFogIntensity = 1; -bool gAdjustForAspectRatio = true; - // 4x4 pink-black checkerboard texture to indicate missing textures #define MISSING_W 4 #define MISSING_H 4 @@ -753,8 +751,6 @@ static void gfx_sp_pop_matrix(uint32_t count) { } static float gfx_adjust_x_for_aspect_ratio(float x) { - if (!gAdjustForAspectRatio) return x * (4.0 / 3.0f) / (4.0f / 3.0f); - return x * (4.0f / 3.0f) / ((float)gfx_current_dimensions.width / (float)gfx_current_dimensions.height); } @@ -1820,7 +1816,7 @@ void gfx_start_frame(void) { // Avoid division by zero gfx_current_dimensions.height = 1; } - gfx_current_dimensions.aspect_ratio = gAdjustForAspectRatio ? ((float)gfx_current_dimensions.width / (float)gfx_current_dimensions.height) : (4.0f / 3.0f); + gfx_current_dimensions.aspect_ratio = ((float)gfx_current_dimensions.width / (float)gfx_current_dimensions.height); } void gfx_run(Gfx *commands) { diff --git a/src/pc/gfx/gfx_pc.h b/src/pc/gfx/gfx_pc.h index 931cd4be..3fcbf7c1 100644 --- a/src/pc/gfx/gfx_pc.h +++ b/src/pc/gfx/gfx_pc.h @@ -19,8 +19,6 @@ extern Color gVertexColor; extern Color gFogColor; extern f32 gFogIntensity; -extern bool gAdjustForAspectRatio; - #ifdef __cplusplus extern "C" { #endif diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c index 2f4b2bec..b81c92b6 100644 --- a/src/pc/lua/smlua_functions_autogen.c +++ b/src/pc/lua/smlua_functions_autogen.c @@ -29232,38 +29232,6 @@ int smlua_func_get_vertex_color(lua_State* L) { return 1; } -int smlua_func_gfx_enable_adjust_for_aspect_ratio(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", "gfx_enable_adjust_for_aspect_ratio", 1, top); - return 0; - } - - bool enable = smlua_to_boolean(L, 1); - if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "gfx_enable_adjust_for_aspect_ratio"); return 0; } - - gfx_enable_adjust_for_aspect_ratio(enable); - - return 1; -} - -int smlua_func_gfx_get_adjust_for_aspect_ratio(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", "gfx_get_adjust_for_aspect_ratio", 0, top); - return 0; - } - - - lua_pushboolean(L, gfx_get_adjust_for_aspect_ratio()); - - return 1; -} - int smlua_func_hud_get_flash(UNUSED lua_State* L) { if (L == NULL) { return 0; } @@ -33095,8 +33063,6 @@ void smlua_bind_functions_autogen(void) { smlua_bind_function(L, "get_time", smlua_func_get_time); smlua_bind_function(L, "get_ttc_speed_setting", smlua_func_get_ttc_speed_setting); 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); diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c index 157c2935..340fc69a 100644 --- a/src/pc/lua/utils/smlua_misc_utils.c +++ b/src/pc/lua/utils/smlua_misc_utils.c @@ -635,16 +635,6 @@ bool get_coop_compatibility_enabled(void) { /// -bool gfx_get_adjust_for_aspect_ratio(void) { - return gAdjustForAspectRatio; -} - -void gfx_enable_adjust_for_aspect_ratio(bool enable) { - gAdjustForAspectRatio = enable; -} - -/// - void set_window_title(const char* title) { WAPI.set_window_title(title); } diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h index 25d14c35..f83b032b 100644 --- a/src/pc/lua/utils/smlua_misc_utils.h +++ b/src/pc/lua/utils/smlua_misc_utils.h @@ -160,9 +160,6 @@ u32 get_global_timer(void); bool get_coop_compatibility_enabled(void); -bool gfx_get_adjust_for_aspect_ratio(void); -void gfx_enable_adjust_for_aspect_ratio(bool enable); - void set_window_title(const char* title); void reset_window_title(void); diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 4d8ef2d7..12541120 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -676,7 +676,6 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect gFogIntensity = 1; gOverrideBackground = -1; gOverrideEnvFx = -1; - gAdjustForAspectRatio = true; gRomhackCameraAllowCentering = TRUE; gOverrideAllowToxicGasCamera = FALSE; gRomhackCameraAllowDpad = FALSE;