From 03ba4ccbb12c5e936bc3982e4fb7f98b1dfe6799 Mon Sep 17 00:00:00 2001 From: VDm Date: Fri, 28 Mar 2025 00:34:20 +0400 Subject: [PATCH] chore(ui): replace sub_960420 with existing FrameScript_GetColor --- src/ui/CSimpleFrameScript.cpp | 48 +++++------------------------------ 1 file changed, 6 insertions(+), 42 deletions(-) diff --git a/src/ui/CSimpleFrameScript.cpp b/src/ui/CSimpleFrameScript.cpp index 7e1b401..2f85412 100644 --- a/src/ui/CSimpleFrameScript.cpp +++ b/src/ui/CSimpleFrameScript.cpp @@ -9,42 +9,6 @@ #include #include -static int32_t sub_960420(lua_State* L, int idx, CImVector& color) { - auto red = lua_tonumber(L, idx++); - if (red < 0.0) { - red = 0.0; - } - if (red >= 1.0) { - red = 1.0; - } - - auto green = lua_tonumber(L, idx++); - if (green < 0.0) { - green = 0.0; - } - if (green >= 1.0) { - green = 1.0; - } - - auto blue = lua_tonumber(L, idx++); - if (blue < 0.0) { - blue = 0.0; - } - if (blue >= 1.0) { - blue = 1.0; - } - - auto alpha = lua_isnumber(L, idx) ? lua_tonumber(L, idx++) : 1.0; - if (alpha < 0.0) { - alpha = 0.0; - } - if (alpha >= 1.0) { - alpha = 1.0; - } - - color.Set(alpha, red, green, blue); - return idx; -} int32_t CSimpleFrame_GetTitleRegion(lua_State* L) { WHOA_UNIMPLEMENTED(0); @@ -499,10 +463,10 @@ int32_t CSimpleFrame_GetBackdropColor(lua_State* L) { int32_t CSimpleFrame_SetBackdropColor(lua_State* L) { int32_t type = CSimpleFrame::GetObjectType(); - CSimpleFrame* object = static_cast(FrameScript_GetObjectThis(L, type)); + auto object = static_cast(FrameScript_GetObjectThis(L, type)); - CImVector color; - sub_960420(L, 2, color); + CImVector color = { 0 }; + FrameScript_GetColor(L, 2, color); if (object->m_backdrop) { object->m_backdrop->SetVertexColor(color); @@ -517,10 +481,10 @@ int32_t CSimpleFrame_GetBackdropBorderColor(lua_State* L) { int32_t CSimpleFrame_SetBackdropBorderColor(lua_State* L) { int32_t type = CSimpleFrame::GetObjectType(); - CSimpleFrame* object = static_cast(FrameScript_GetObjectThis(L, type)); + auto object = static_cast(FrameScript_GetObjectThis(L, type)); - CImVector color; - sub_960420(L, 2, color); + CImVector color = { 0 }; + FrameScript_GetColor(L, 2, color); if (object->m_backdrop) { object->m_backdrop->SetBorderVertexColor(color);