From 27d55260e8249303a28c386e180ece9942b935f5 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 4 Mar 2024 19:45:49 +0100 Subject: [PATCH] remove minmax sliders --- src/lua_consolelib.c | 11 +++-------- src/m_menu.c | 8 ++------ src/m_menu.h | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/lua_consolelib.c b/src/lua_consolelib.c index 8f66d8be1..8217c5d03 100644 --- a/src/lua_consolelib.c +++ b/src/lua_consolelib.c @@ -330,7 +330,6 @@ static int lib_cvRegisterVar(lua_State *L) cvar = lua_newuserdata(L, sizeof(consvar_t)); luaL_getmetatable(L, META_CVAR); lua_setmetatable(L, -2); - boolean hasminmax = false; #define FIELDERROR(f, e) luaL_error(L, "bad value for " LUA_QL(f) " in table passed to " LUA_QL("CV_RegisterVar") " (%s)", e); #define TYPEERROR(f, t) FIELDERROR(f, va("%s expected, got %s", lua_typename(L, t), luaL_typename(L, -1))) @@ -396,17 +395,13 @@ static int lib_cvRegisterVar(lua_State *L) if (lua_type(L, 5) != LUA_TSTRING || lua_type(L, 6) != LUA_TNUMBER) FIELDERROR("PossibleValue", "custom PossibleValue table requires a format of string=integer, i.e. {MIN=0, MAX=9999}"); - char *strvalue = Z_StrDup(lua_tostring(L, 5)); - if (fasticmp(strvalue, "MIN")) - hasminmax = true; - cvpv[i].strvalue = strvalue; + cvpv[i].strvalue = Z_StrDup(lua_tostring(L, 5)); cvpv[i].value = (INT32)lua_tonumber(L, 6); i++; lua_pop(L, 1); } cvpv[i].value = 0; cvpv[i].strvalue = NULL; - hasminmax = false; cvar->PossibleValue = cvpv; } else FIELDERROR("PossibleValue", va("%s or CV_PossibleValue_t expected, got %s", lua_typename(L, LUA_TTABLE), luaL_typename(L, -1))) @@ -467,9 +462,9 @@ static int lib_cvRegisterVar(lua_State *L) } if (menu_name && menu_name[0] != '\0') - M_SlotCvarIntoModMenu(cvar, category, menu_name, hasminmax); + M_SlotCvarIntoModMenu(cvar, category, menu_name); else - M_SlotCvarIntoModMenu(cvar, category, cvar->name, hasminmax); + M_SlotCvarIntoModMenu(cvar, category, cvar->name); } // return cvar userdata diff --git a/src/m_menu.c b/src/m_menu.c index c5a53b115..3d12c27aa 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7703,7 +7703,7 @@ INT16 ccvarlaststheader = 0; INT32 CVARSETUP; -void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name, boolean minmax) +void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name) { if (ccvarposition == INT16_MAX) return; @@ -7733,11 +7733,7 @@ void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* na ++ccvarposition; } - if (minmax) - OP_CustomCvarMenu[ccvarposition] = (menuitem_t){ IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, Z_StrDup(name), cvar, ccvaralphakey }; - //else if (cvar->flags & CV_FLOAT) - //OP_CustomCvarMenu[ccvarposition] = (menuitem_t){ IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER , NULL, Z_StrDup(name), cvar, ccvaralphakey }; - else if (cvar->flags & CV_NETVAR) + if (cvar->flags & CV_NETVAR) OP_CustomCvarMenu[ccvarposition] = (menuitem_t){ IT_STRING | IT_CVAR , NULL, Z_StrDup(va("\x85 %s", name)), cvar, ccvaralphakey }; else OP_CustomCvarMenu[ccvarposition] = (menuitem_t){ IT_STRING | IT_CVAR, NULL, Z_StrDup(name), cvar, ccvaralphakey }; diff --git a/src/m_menu.h b/src/m_menu.h index cca46fd8e..bb504642d 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -293,7 +293,7 @@ void M_PopupMasterServerRules(void); void M_PopupMasterServerConnectError(void); #endif -void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name, boolean minmax); +void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name); // These defines make it a little easier to make menus #define DEFAULTMENUSTYLE(header, source, prev, x, y)\