remove minmax sliders

This commit is contained in:
Alug committed 2024-03-04 19:45:49 +01:00
1 parent 233583657e
commit 27d55260e8
3 files changed
+6 -15

No files matched your search

+3 -8
View File
@@ -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
+2 -6
View File
@@ -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 };
+1 -1
View File
@@ -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)\