chore(ui): replace sub_960420 with existing FrameScript_GetColor

This commit is contained in:
VDm 2025-03-28 00:34:20 +04:00
parent 6c76720c04
commit 03ba4ccbb1

View File

@ -9,42 +9,6 @@
#include <cstdint>
#include <limits>
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<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
auto object = static_cast<CSimpleFrame*>(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<CSimpleFrame*>(FrameScript_GetObjectThis(L, type));
auto object = static_cast<CSimpleFrame*>(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);