Merge remote-tracking branch 'origin/lugstuff' into neo-kart
This commit is contained in:
commit
c7fcf814ef
7 files changed
+212
-77
No files matched your search
@@ -439,7 +439,7 @@ void HWR_LoadAllCustomShaders(void)
|
||||
|
||||
// read every custom shader
|
||||
for (i = 0; i < numwadfiles; i++)
|
||||
HWR_LoadCustomShadersFromFile(i, (wadfiles[i]->type == RET_PK3));
|
||||
HWR_LoadCustomShadersFromFile(i, W_FileHasFolders(wadfiles[i]));
|
||||
}
|
||||
|
||||
void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
@@ -454,7 +454,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
int i;
|
||||
boolean modified_shaders[NUMSHADERTARGETS] = {0};
|
||||
|
||||
if (!HWR_UseShader())
|
||||
if (!gr_shadersavailable)
|
||||
return;
|
||||
|
||||
lump = HWR_FindShaderDefs(wadnum);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \file r_opengl.c
|
||||
/// \brief OpenGL API for Sonic Robo Blast 2
|
||||
|
||||
#if defined (_WIN32)
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "../../r_local.h" // For rendertimefrac, used for the leveltime shader uniform
|
||||
#include "r_opengl.h"
|
||||
#include "r_vbo.h"
|
||||
|
||||
#include "../hw_shaders.h"
|
||||
#include "../hw_main.h"
|
||||
|
||||
// Eeeeh not sure is this right way, but it works < sry :c < sry again it had to go :c
|
||||
@@ -722,30 +722,6 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
|
||||
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
//
|
||||
// Generic vertex shader
|
||||
//
|
||||
|
||||
#define GLSL_FALLBACK_VERTEX_SHADER \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
"gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n" \
|
||||
"gl_FrontColor = gl_Color;\n" \
|
||||
"gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n" \
|
||||
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
|
||||
"}\0"
|
||||
|
||||
//
|
||||
// Generic fragment shader
|
||||
//
|
||||
|
||||
#define GLSL_FALLBACK_FRAGMENT_SHADER \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
"void main(void) {\n" \
|
||||
"gl_FragColor = texture2D(tex, gl_TexCoord[0].st) * poly_color;\n" \
|
||||
"}\0"
|
||||
|
||||
|
||||
void SetupGLFunc4(void)
|
||||
{
|
||||
@@ -887,6 +863,11 @@ EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
||||
|
||||
EXPORT void HWRAPI(SetShader) (int slot)
|
||||
{
|
||||
if (slot == SHADER_NONE)
|
||||
{
|
||||
UnSetShader();
|
||||
return;
|
||||
}
|
||||
if (gl_allowshaders)
|
||||
{
|
||||
gl_shader_t *next_shader = &gl_shaders[slot]; // the gl_shader_t we are going to switch to
|
||||
@@ -907,21 +888,26 @@ EXPORT void HWRAPI(SetShader) (int slot)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gl_shadersenabled = false;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(UnSetShader) (void)
|
||||
{
|
||||
gl_shaderstate.current = NULL;
|
||||
gl_shaderstate.type = 0;
|
||||
gl_shaderstate.program = 0;
|
||||
if (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed
|
||||
{
|
||||
gl_shaderstate.current = NULL;
|
||||
gl_shaderstate.type = 0;
|
||||
gl_shaderstate.program = 0;
|
||||
|
||||
if (pglUseProgram)
|
||||
pglUseProgram(0);
|
||||
if (pglUseProgram)
|
||||
pglUseProgram(0);
|
||||
}
|
||||
|
||||
gl_shadersenabled = false;
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetNoTexture : Disable texture
|
||||
// -----------------+
|
||||
@@ -949,7 +935,7 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect)
|
||||
const GLfloat zNear = NEAR_CLIPPING_PLANE;
|
||||
const GLfloat zFar = FAR_CLIPPING_PLANE;
|
||||
const GLfloat radians = (GLfloat)(fovy / 2.0f * M_PIl / 180.0f);
|
||||
const GLfloat sine = sin(radians);
|
||||
const GLfloat sine = (GLfloat)sin(radians);
|
||||
const GLfloat deltaZ = zFar - zNear;
|
||||
GLfloat cotangent;
|
||||
|
||||
@@ -1850,9 +1836,9 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
|
||||
if (Surface != NULL)
|
||||
{
|
||||
UNIFORM_1(shader->uniforms[gluniform_lighting], Surface->LightInfo.light_level, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_start], Surface->LightInfo.fade_start, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_end], Surface->LightInfo.fade_end, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_lighting], (GLfloat)Surface->LightInfo.light_level, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_start], (GLfloat)Surface->LightInfo.fade_start, pglUniform1f);
|
||||
UNIFORM_1(shader->uniforms[gluniform_fade_end], (GLfloat)Surface->LightInfo.fade_end, pglUniform1f);
|
||||
}
|
||||
|
||||
UNIFORM_1(shader->uniforms[gluniform_leveltime], ((float)shader_leveltime) / TICRATE, pglUniform1f);
|
||||
@@ -2008,39 +1994,41 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FBITFIELD
|
||||
|
||||
SetBlend(PolyFlags); //TODO: inline (#pragma..)
|
||||
|
||||
// PolyColor
|
||||
if (pSurf)
|
||||
{
|
||||
// If Modulated, mix the surface colour to the texture
|
||||
// If modulated, mix the surface colour to the texture
|
||||
if (CurrentPolyFlags & PF_Modulated)
|
||||
{
|
||||
// Poly color
|
||||
poly.red = byte2float[pSurf->PolyColor.s.red];
|
||||
poly.green = byte2float[pSurf->PolyColor.s.green];
|
||||
poly.blue = byte2float[pSurf->PolyColor.s.blue];
|
||||
poly.alpha = byte2float[pSurf->PolyColor.s.alpha];
|
||||
|
||||
pglColor4ubv((GLubyte*)&pSurf->PolyColor.s);
|
||||
|
||||
// If the surface is either modulated or colormapped, or both
|
||||
if (CurrentPolyFlags & (PF_Modulated | PF_ColorMapped))
|
||||
{
|
||||
poly.red = byte2float[pSurf->PolyColor.s.red];
|
||||
poly.green = byte2float[pSurf->PolyColor.s.green];
|
||||
poly.blue = byte2float[pSurf->PolyColor.s.blue];
|
||||
poly.alpha = byte2float[pSurf->PolyColor.s.alpha];
|
||||
}
|
||||
|
||||
// Tint color
|
||||
tint.red = byte2float[pSurf->TintColor.s.red];
|
||||
tint.green = byte2float[pSurf->TintColor.s.green];
|
||||
tint.blue = byte2float[pSurf->TintColor.s.blue];
|
||||
tint.alpha = byte2float[pSurf->TintColor.s.alpha];
|
||||
|
||||
// Fade color
|
||||
fade.red = byte2float[pSurf->FadeColor.s.red];
|
||||
fade.green = byte2float[pSurf->FadeColor.s.green];
|
||||
fade.blue = byte2float[pSurf->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
|
||||
|
||||
if (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded)
|
||||
// Only if the surface is colormapped
|
||||
if (CurrentPolyFlags & PF_ColorMapped)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
lt_downloaded = pSurf->LightTableId;
|
||||
tint.red = byte2float[pSurf->TintColor.s.red];
|
||||
tint.green = byte2float[pSurf->TintColor.s.green];
|
||||
tint.blue = byte2float[pSurf->TintColor.s.blue];
|
||||
tint.alpha = byte2float[pSurf->TintColor.s.alpha];
|
||||
|
||||
fade.red = byte2float[pSurf->FadeColor.s.red];
|
||||
fade.green = byte2float[pSurf->FadeColor.s.green];
|
||||
fade.blue = byte2float[pSurf->FadeColor.s.blue];
|
||||
fade.alpha = byte2float[pSurf->FadeColor.s.alpha];
|
||||
|
||||
if (pSurf->LightTableId && pSurf->LightTableId != lt_downloaded)
|
||||
{
|
||||
pglActiveTexture(GL_TEXTURE2);
|
||||
pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId);
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
lt_downloaded = pSurf->LightTableId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3457,7 +3445,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
UnSetShader();
|
||||
pglUseProgram(0);
|
||||
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
+52
-9
@@ -17,6 +17,11 @@
|
||||
#include "byteptr.h"
|
||||
#include "z_zone.h"
|
||||
|
||||
#include "d_netfil.h"
|
||||
|
||||
#include "m_menu.h"
|
||||
#include "w_wad.h"
|
||||
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_hud.h" // hud_running errors
|
||||
@@ -186,8 +191,8 @@ static int lib_comAddCommand(lua_State *L)
|
||||
const char *luaname = luaL_checkstring(L, 1);
|
||||
|
||||
// must store in all lowercase
|
||||
char *name = Z_StrDup(luaname);
|
||||
strlwr(name);
|
||||
char *comname = Z_StrDup(luaname);
|
||||
strlwr(comname);
|
||||
|
||||
luaL_checktype(L, 2, LUA_TFUNCTION);
|
||||
NOHUD
|
||||
@@ -220,25 +225,26 @@ static int lib_comAddCommand(lua_State *L)
|
||||
|
||||
lua_pushvalue(L, 3);
|
||||
lua_rawseti(L, -2, 2);
|
||||
lua_setfield(L, -2, name);
|
||||
lua_setfield(L, -2, comname);
|
||||
|
||||
// Try to add the Lua command
|
||||
com_return = COM_AddLuaCommand(name);
|
||||
com_return = COM_AddLuaCommand(comname);
|
||||
|
||||
if (com_return < 0)
|
||||
{ // failed to add -- free the lowercased name and return error
|
||||
Z_Free(name);
|
||||
Z_Free(comname);
|
||||
return luaL_error(L, "Couldn't add a new console command \"%s\"", luaname);
|
||||
}
|
||||
else if (com_return == 1)
|
||||
{ // command existed already -- free our name as the old string will continue to be used
|
||||
CONS_Printf("Replaced command \"%s\"\n", name);
|
||||
Z_Free(name);
|
||||
CONS_Printf("Replaced command \"%s\"\n", comname);
|
||||
Z_Free(comname);
|
||||
}
|
||||
else
|
||||
{ // new command was added -- do NOT free the string as it will forever be used by the console
|
||||
CONS_Printf("Added command \"%s\"\n", name);
|
||||
CONS_Printf("Added command \"%s\"\n", comname);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -314,12 +320,17 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
const char *k;
|
||||
lua_Integer i;
|
||||
consvar_t *cvar;
|
||||
|
||||
const char* category = NULL;
|
||||
const char* menu_name = NULL;
|
||||
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
lua_settop(L, 1); // Clear out all other possible arguments, leaving only the first one.
|
||||
NOHUD
|
||||
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)))
|
||||
@@ -385,13 +396,17 @@ 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}");
|
||||
cvpv[i].strvalue = Z_StrDup(lua_tostring(L, 5));
|
||||
char *strvalue = Z_StrDup(lua_tostring(L, 5));
|
||||
if (fasticmp(strvalue, "MIN"))
|
||||
hasminmax = true;
|
||||
cvpv[i].strvalue = strvalue;
|
||||
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)))
|
||||
@@ -405,6 +420,18 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
lua_pop(L, 1);
|
||||
cvar->func = Lua_OnChange;
|
||||
}
|
||||
else if (((i == 5 && !(cvar->flags & CV_CALL))
|
||||
|| (cvar->flags & CV_CALL && i == 7))
|
||||
|| (k && fasticmp(k, "category")))
|
||||
{
|
||||
category = lua_isnoneornil(L, 4) ? NULL : lua_tostring(L, 4);
|
||||
}
|
||||
else if (((i == 6 && !(cvar->flags & CV_CALL))
|
||||
|| (cvar->flags & CV_CALL && i == 8))
|
||||
|| (k && fasticmp(k, "menuname")))
|
||||
{
|
||||
menu_name = lua_isnoneornil(L, 4) ? NULL : lua_tostring(L, 4);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
#undef FIELDERROR
|
||||
@@ -429,6 +456,22 @@ static int lib_cvRegisterVar(lua_State *L)
|
||||
if (cvar->flags & CV_MODIFIED)
|
||||
return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
|
||||
|
||||
if (!(((cvar->flags & CV_HIDEN)) || (cvar->flags & CV_NOSHOWHELP)))
|
||||
{
|
||||
if (!category)
|
||||
{
|
||||
char *temp = strdup(wadfiles[numwadfiles - 1]->filename);
|
||||
nameonly(temp);
|
||||
|
||||
category = temp;
|
||||
}
|
||||
|
||||
if (menu_name && menu_name[0] != '\0')
|
||||
M_SlotCvarIntoModMenu(cvar, category, menu_name, hasminmax);
|
||||
else
|
||||
M_SlotCvarIntoModMenu(cvar, category, cvar->name, hasminmax);
|
||||
}
|
||||
|
||||
// return cvar userdata
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
#include "p_setup.h"
|
||||
#include "f_finale.h"
|
||||
|
||||
#include "lua_libs.h"
|
||||
|
||||
#include "fastcmp.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
@@ -302,6 +306,7 @@ static void M_SetupMultiHandler(INT32 choice);
|
||||
menu_t OP_ControlsDef, OP_AllControlsDef;
|
||||
menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef;
|
||||
menu_t OP_Joystick1Def, OP_Joystick2Def, OP_Joystick3Def, OP_Joystick4Def;
|
||||
menu_t OP_CustomCvarMenuDef;
|
||||
static void M_VideoModeMenu(INT32 choice);
|
||||
static void M_Setup1PControlsMenu(INT32 choice);
|
||||
static void M_Setup2PControlsMenu(INT32 choice);
|
||||
@@ -346,6 +351,8 @@ static void M_AddonsInternal();
|
||||
static void M_Addons(INT32 choice);
|
||||
static void M_LocalSkins(INT32 choice);
|
||||
static void M_AddonsOptions(INT32 choice);
|
||||
|
||||
static void M_CustomCvarMenu(INT32 choice);
|
||||
static patch_t *addonsp[NUM_EXT+5];
|
||||
|
||||
static void M_DeleteProtocol(void);
|
||||
@@ -1095,6 +1102,7 @@ static menuitem_t OP_MainMenu[] =
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 70},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Data Options...", &OP_DataOptionsDef, 90},
|
||||
{IT_CALL|IT_STRING, NULL, "Custom Options...", M_CustomCvarMenu, 100},
|
||||
|
||||
{IT_CALL|IT_STRING, NULL, "Tricks & Secrets (F1)", M_Manual, 110},
|
||||
{IT_CALL|IT_STRING, NULL, "Play Credits", M_Credits, 120},
|
||||
@@ -1425,6 +1433,11 @@ static menuitem_t OP_ExpOptionsMenu[] =
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "FFloorclip", &cv_ffloorclip, 95},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spriteclip", &cv_spriteclip, 105},
|
||||
|
||||
#if defined(HAVE_SDL)
|
||||
{IT_STRING | IT_CVAR, NULL, "Scale Quality", &cv_scalequality, 115},
|
||||
#endif
|
||||
|
||||
#ifdef HWRENDER
|
||||
{IT_STRING | IT_CVAR, NULL, "Screen Textures", &cv_grscreentextures, 95},
|
||||
|
||||
@@ -1449,6 +1462,7 @@ static const char* OP_ExpTooltips[] =
|
||||
"Which version of R_PointToAngle should\nbe used for Sector Clipping?\n64 may fix rendering issues on larger maps\nat the cost of performance.",
|
||||
"Hides 3DFloors which are not visible\npotentially resulting in a performance boost.",
|
||||
"Hides Sprites which are not visible\npotentially resulting in a performance boost.",
|
||||
"Scale Quality",
|
||||
#ifdef HWRENDER
|
||||
"Should the game do Screen Textures? Provides a good boost to frames\nat the cost of some visual effects not working when disabled.",
|
||||
"Change the depth of the Palette in Palette rendering mod\n 16 bits is like software looks ingame\nwhile 24 bits is how software looks in screenshots.",
|
||||
@@ -1470,6 +1484,7 @@ enum
|
||||
op_exp_angleshit,
|
||||
op_exp_ffclip,
|
||||
op_exp_sprclip,
|
||||
op_exp_sclqal,
|
||||
#ifdef HWRENDER
|
||||
op_exp_grscrtx,
|
||||
op_exp_spltwal,
|
||||
@@ -2374,6 +2389,8 @@ enum
|
||||
syncspecialonly,
|
||||
};
|
||||
|
||||
menuitem_t OP_CustomCvarMenu[MAXMENUCCVARS];
|
||||
|
||||
// ==========================================================================
|
||||
// ALL MENU DEFINITIONS GO HERE
|
||||
// ==========================================================================
|
||||
@@ -2871,6 +2888,23 @@ menu_t OP_DriftGaugeDef = DEFAULTMENUSTYLE(NULL, OP_DriftGaugeMenu, &OP_SaturnDe
|
||||
menu_t OP_TiltDef = DEFAULTMENUSTYLE(NULL, OP_TiltMenu, &OP_BirdDef, 30, 60);
|
||||
menu_t OP_AdvancedBirdDef = DEFAULTMENUSTYLE(NULL, OP_AdvancedBirdMenu, &OP_BirdDef, 30, 60);
|
||||
|
||||
INT16 ccvarposition = 0;
|
||||
|
||||
static void M_CustomCvarMenu(INT32 choice)
|
||||
{
|
||||
(void)choice;
|
||||
|
||||
if (ccvarposition)
|
||||
M_SetupNextMenu(&OP_CustomCvarMenuDef);
|
||||
else
|
||||
M_StartMessage(M_GetText("No custom options were found\n"), NULL, MM_NOTHING);
|
||||
}
|
||||
|
||||
/*menu_t OP_CustomCvarMenuDef = DEFAULTSCROLLMENUSTYLE(
|
||||
MTREE3(MN_OP_MAIN, MN_OP_DATA, MN_OP_ADDONS),
|
||||
"M_ADDONS", OP_CustomCvarMenu, &OP_MainDef, 30, 30);*/
|
||||
menu_t OP_CustomCvarMenuDef = DEFAULTSCROLLSTYLE("M_ADDONS", OP_CustomCvarMenu, &OP_MainDef, 30, 30);
|
||||
|
||||
menu_t OP_ForkedBirdDef = {
|
||||
NULL,
|
||||
sizeof(OP_ForkedBirdMenu)/sizeof(menuitem_t),
|
||||
@@ -4444,6 +4478,7 @@ void M_Init(void)
|
||||
if (rendermode == render_opengl){
|
||||
OP_ExpOptionsMenu[op_exp_ffclip].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_sprclip].status = IT_DISABLED;
|
||||
OP_ExpOptionsMenu[op_exp_sclqal].status = IT_DISABLED;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7760,6 +7795,58 @@ void M_PopupMasterServerRules(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#define CCVHEIGHT 5
|
||||
#define CCVHEIGHTHEADER 1
|
||||
#define CCVHEIGHTHEADERAFTER 6
|
||||
|
||||
UINT16 ccvaralphakey = 4;
|
||||
INT16 ccvarlaststheader = 0;
|
||||
|
||||
INT32 CVARSETUP;
|
||||
|
||||
void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name, boolean minmax)
|
||||
{
|
||||
if (ccvarposition == INT16_MAX)
|
||||
return;
|
||||
|
||||
if (ccvarposition >= MAXMENUCCVARS - 2)
|
||||
{
|
||||
CONS_Printf("failed to register cvar into custom settings menu as menu reached limit\n");
|
||||
ccvarposition = INT16_MAX;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CVARSETUP)
|
||||
{
|
||||
CONS_Printf("custom settings menu initiation\n");
|
||||
for (CVARSETUP = 0; CVARSETUP < MAXMENUCCVARS; ++CVARSETUP)
|
||||
OP_CustomCvarMenu[CVARSETUP] = (menuitem_t){IT_DISABLED, NULL, "", 0, INT16_MAX};
|
||||
}
|
||||
|
||||
if (category && ((ccvarposition == 0 && category[0] != '\0') || !fasticmp(category, OP_CustomCvarMenu[ccvarlaststheader].text)))
|
||||
{
|
||||
ccvarlaststheader = ccvarposition;
|
||||
ccvaralphakey += CCVHEIGHTHEADER;
|
||||
|
||||
OP_CustomCvarMenu[ccvarposition] = (menuitem_t){IT_HEADER, NULL, Z_StrDup(category), NULL, ccvaralphakey};
|
||||
ccvaralphakey += CCVHEIGHTHEADERAFTER;
|
||||
|
||||
++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)
|
||||
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 };
|
||||
|
||||
ccvaralphakey += CCVHEIGHT;
|
||||
++ccvarposition;
|
||||
}
|
||||
|
||||
// ======
|
||||
// CHEATS
|
||||
// ======
|
||||
|
||||
+6
-1
@@ -147,6 +147,8 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
|
||||
|
||||
#define MAXSTRINGLENGTH 32
|
||||
|
||||
#define MAXMENUCCVARS 999
|
||||
|
||||
#define MAXTOOLTIPS 255
|
||||
|
||||
typedef union
|
||||
@@ -171,7 +173,7 @@ typedef struct menuitem_s
|
||||
void *itemaction;
|
||||
|
||||
// hotkey in menu or y of the item
|
||||
UINT8 alphaKey;
|
||||
UINT16 alphaKey;
|
||||
} menuitem_t;
|
||||
|
||||
extern menuitem_t PlayerMenu[MAXSKINS];
|
||||
@@ -289,6 +291,8 @@ void M_PopupMasterServerRules(void);
|
||||
void M_PopupMasterServerConnectError(void);
|
||||
#endif
|
||||
|
||||
void M_SlotCvarIntoModMenu(consvar_t* cvar, const char* category, const char* name, boolean minmax);
|
||||
|
||||
// These defines make it a little easier to make menus
|
||||
#define DEFAULTMENUSTYLE(header, source, prev, x, y)\
|
||||
{\
|
||||
@@ -316,6 +320,7 @@ void M_PopupMasterServerConnectError(void);
|
||||
{NULL}\
|
||||
}
|
||||
|
||||
|
||||
#define PAUSEMENUSTYLE(source, x, y)\
|
||||
{\
|
||||
NULL,\
|
||||
|
||||
@@ -87,6 +87,8 @@
|
||||
#include "../discord.h"
|
||||
#endif
|
||||
|
||||
static void ScaleQuality_OnChange(void);
|
||||
|
||||
// maximum number of windowed modes (see windowedModes[][])
|
||||
#define MAXWINMODES (22)
|
||||
|
||||
@@ -117,6 +119,9 @@ static void Impl_SetVsync(void);
|
||||
consvar_t cv_vidwait = {"vid_wait", "Off", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff, Impl_SetVsync, 0, NULL, NULL, 0, 0, NULL};
|
||||
static consvar_t cv_stretch = {"stretch", "Off", CV_SAVE|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t scalequality_cons_t[] = {{0, "Nearest"}, {1, "Linear"}, {2, "Best"}, {0, NULL}};
|
||||
consvar_t cv_scalequality = {"vid_scalequality", "Nearest", CV_SAVE|CV_CALL|CV_NOINIT, scalequality_cons_t, ScaleQuality_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// these cant be used since config is read after window creation, so need to use command line parameter instead
|
||||
//static CV_PossibleValue_t msaa_cons_t[] = {{0, "Off"}, {2, "2X"}, {4, "4X"}, {8, "8X"}, {16, "16X"}, {0, NULL}};
|
||||
//consvar_t cv_msaa = {"msaa", "Off", CV_SAVE, msaa_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -164,6 +169,12 @@ static SDL_Texture *texture;
|
||||
static SDL_bool havefocus = SDL_TRUE;
|
||||
static const char *fallback_resolution_name = "Fallback";
|
||||
|
||||
static void ScaleQuality_OnChange(void)
|
||||
{
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, cv_scalequality.string);
|
||||
COM_ImmedExecute(va("vid_mode %d", vid.modenum)); // Hack to make it apply without restarting
|
||||
}
|
||||
|
||||
// windowed video modes from which to choose from.
|
||||
static INT32 windowedModes[MAXWINMODES][2] =
|
||||
{
|
||||
@@ -2109,6 +2120,7 @@ void I_StartupGraphics(void)
|
||||
COM_AddCommand ("vid_mode", VID_Command_Mode_f);
|
||||
CV_RegisterVar (&cv_vidwait);
|
||||
CV_RegisterVar (&cv_stretch);
|
||||
CV_RegisterVar(&cv_scalequality);
|
||||
disable_mouse = M_CheckParm("-nomouse");
|
||||
disable_fullscreen = M_CheckParm("-win") ? 1 : 0;
|
||||
|
||||
|
||||
+3
-3
@@ -27,10 +27,10 @@
|
||||
|
||||
extern UINT8 *screens[5];
|
||||
|
||||
extern consvar_t cv_ticrate, cv_allcaps, cv_constextsize, cv_menucaps,\
|
||||
cv_globalgamma, cv_globalsaturation, \
|
||||
extern consvar_t cv_ticrate, cv_allcaps, cv_constextsize, cv_menucaps, cv_scalequality,\
|
||||
cv_globalgamma, cv_globalsaturation,\
|
||||
cv_rhue, cv_yhue, cv_ghue, cv_chue, cv_bhue, cv_mhue,\
|
||||
cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma, \
|
||||
cv_rgamma, cv_ygamma, cv_ggamma, cv_cgamma, cv_bgamma, cv_mgamma,\
|
||||
cv_rsaturation, cv_ysaturation, cv_gsaturation, cv_csaturation, cv_bsaturation, cv_msaturation;
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user