change scr_depth to gr_texturedepth and allow it to change stuff midgame

its not used for software renderer anymore and before you had to restart the game to be able to see a change in gl
8bits and 24bits options have been removed since they had no effect
and it also allowed me to unglobal things
This commit is contained in:
Alug committed 2025-04-02 18:42:03 +02:00
1 parent bd39a9c2f8
commit 8033348aa1
10 files changed
+35 -23

No files matched your search

-1
View File
@@ -1069,7 +1069,6 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_renderview);
CV_RegisterVar(&cv_vhseffect);
CV_RegisterVar(&cv_shittyscreen);
CV_RegisterVar(&cv_scr_depth);
CV_RegisterVar(&cv_scr_width);
CV_RegisterVar(&cv_scr_height);
+2
View File
@@ -319,6 +319,8 @@ enum hwdsetspecialstate
HWD_SET_PORTAL_MODE,// new portal thing
HWD_SET_STENCIL_LEVEL,
HWD_SET_TEXTURE_FORMAT,
HWD_NUMSTATE
};
typedef enum hwdsetspecialstate hwdspecialstate_t;
+13
View File
@@ -156,6 +156,7 @@ static void CV_glshaders_OnChange(void);
static void CV_gllightdithering_OnChange(void);
static void CV_filtermode_OnChange(void);
static void CV_anisotropic_OnChange(void);
static void CV_gltextureformat_OnChange(void);
static void CV_glpaletterendering_OnChange(void);
static void CV_glpalettedepth_OnChange(void);
@@ -178,6 +179,8 @@ static CV_PossibleValue_t glrenderdistance_cons_t[] = {
{0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"},
{6, "12288"}, {7, "16384"}, {0, NULL}};
static CV_PossibleValue_t gltexdepth_cons_t[] = {{16, "16 bits"}, {32, "32 bits"}, {0, NULL}};
static CV_PossibleValue_t glpalettedepth_cons_t[] = {{16, "16 bits"}, {24, "24 bits"}, {0, NULL}};
//
@@ -227,6 +230,8 @@ consvar_t cv_glpaletterendering = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, C
consvar_t cv_glpalettedepth = {"gr_palettedepth", "16 bits", CV_SAVE|CV_CALL, glpalettedepth_cons_t, CV_glpalettedepth_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_glflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_glpaletterendering_OnChange, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_gltexturedepth = {"gr_texturedepth", "32 bits", CV_CALL|CV_SAVE, gltexdepth_cons_t, CV_gltextureformat_OnChange, 0, NULL, NULL, 0, 0, NULL};
#define ONLY_IF_GL_LOADED if (vid.glstate != VID_GL_LIBRARY_LOADED) return;
static void CV_screentextures_OnChange(void)
@@ -280,6 +285,12 @@ static void CV_gllightdithering_OnChange(void)
}
}
static void CV_gltextureformat_OnChange(void)
{
ONLY_IF_GL_LOADED
GL_SetSpecialState(HWD_SET_TEXTURE_FORMAT, cv_gltexturedepth.value);
}
static void CV_filtermode_OnChange(void)
{
ONLY_IF_GL_LOADED
@@ -5680,6 +5691,8 @@ static void HWR_TogglePaletteRendering(void)
//added by Hurdler: console varibale that are saved
void HWR_AddCommands(void)
{
CV_RegisterVar(&cv_gltexturedepth);
CV_RegisterVar(&cv_glscreentextures);
#ifdef USE_FBO_OGL
+2
View File
@@ -178,6 +178,8 @@ RGBA_t *HWR_GetTexturePalette(void);
// Console variables
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
extern consvar_t cv_gltexturedepth;
extern consvar_t cv_glscreentextures;
#ifdef USE_FBO_OGL
extern consvar_t cv_glframebuffer;
+15 -11
View File
@@ -99,14 +99,14 @@ static GLuint screenPaletteTex = 0; // 1D texture containing the screen palette
static GLuint paletteLookupTex = 0; // 3D texture containing RGB -> palette index lookup table
RGBA_t myPaletteData[256]; // the palette for converting textures to RGBA
GLint screen_width = 0; // used by Draw2DLine()
GLint screen_height = 0;
GLbyte screen_depth = 0;
GLint textureformatGL = 0;
GLint maximumAnisotropy = 0;
static GLboolean MipMap = GL_FALSE;
static GLint min_filter = GL_LINEAR;
static GLint mag_filter = GL_LINEAR;
static GLint gltexformat = GL_RGB5_A1;
GLint screen_width = 0; // used by Draw2DLine()
GLint screen_height = 0;
GLbyte screen_depth = 0;
GLint maximumAnisotropy = 0;
static GLboolean MipMap = GL_FALSE;
static GLint min_filter = GL_LINEAR;
static GLint mag_filter = GL_LINEAR;
static GLint anisotropic_filter = 0;
boolean supportMipMap = false;
@@ -1658,7 +1658,6 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo)
RGBA_t *tex = NULL;
GLint texformat = 0;
GLTextureFormat_t texinfoformat = 0;
// Generate a new texture name.
if (!num)
@@ -1670,8 +1669,8 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo)
//GL_DBG_Printf("UpdateTexture %d %x\n", (INT32)num, pImgData);
texformat = textureformatGL;
texinfoformat = pTexInfo->format;
texformat = gltexformat;
const GLTextureFormat_t texinfoformat = pTexInfo->format;
switch (texinfoformat)
{
@@ -2309,6 +2308,11 @@ void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
GL_Flush(); //??? if we want to change filter mode by texture, remove this
break;
case HWD_SET_TEXTURE_FORMAT:
gltexformat = (Value == 32) ? GL_RGBA : GL_RGB5_A1;
GL_Flush();
break;
case HWD_SET_MSAA:
if (Value)
-1
View File
@@ -136,7 +136,6 @@ extern boolean supportMipMap;
/** \brief OpenGL flags for video driver
*/
extern INT32 oglflags;
extern GLint textureformatGL;
extern GLfloat projMatrix[16];
+1 -1
View File
@@ -1616,7 +1616,7 @@ static menuitem_t OP_OpenGLOptionsMenu[] =
{IT_STRING | IT_CVAR, NULL, "Palette Rendering Flashpals",&cv_glflashpal, 35},
{IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_glsecbright, 40},
{IT_STRING | IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 50},
{IT_STRING | IT_CVAR, NULL, "Texture Quality", &cv_gltexturedepth, 50},
{IT_STRING | IT_CVAR, NULL, "Texture Filter", &cv_glfiltermode, 55},
{IT_STRING | IT_CVAR, NULL, "Anisotropic", &cv_glanisotropicmode, 60},
{IT_STRING | IT_CVAR, NULL, "Visual Portals", &cv_glportals, 65},
+1 -6
View File
@@ -56,14 +56,11 @@ void (*twosmultipatchtransfunc)(void); // for cols with transparent pixels AND t
viddef_t vid;
INT32 setmodeneeded; //video mode change needed if > 0 (the mode number to set + 1)
static CV_PossibleValue_t scr_depth_cons_t[] = {{8, "8 bits"}, {16, "16 bits"}, {24, "24 bits"}, {32, "32 bits"}, {0, NULL}};
static CV_PossibleValue_t shittyscreen_cons_t[] = {{0, "Okay"}, {1, "Shitty"}, {2, "Extra Shitty"}, {0, NULL}};
//added : 03-02-98: default screen mode, as loaded/saved in config
consvar_t cv_scr_width = {"scr_width", "1280", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_height = {"scr_height", "800", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_vhseffect = {"vhspause", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_shittyscreen = {"televisionsignal", "Okay", CV_NOSHOWHELP, shittyscreen_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -322,8 +319,7 @@ void SCR_CheckDefaultMode(void)
}
else
{
CONS_Printf(M_GetText("Default resolution: %d x %d (%d bits)\n"), cv_scr_width.value,
cv_scr_height.value, cv_scr_depth.value);
CONS_Printf(M_GetText("Default resolution: %d x %d\n"), cv_scr_width.value, cv_scr_height.value);
// see note above
setmodeneeded = VID_GetModeForSize(cv_scr_width.value, cv_scr_height.value) + 1;
}
@@ -335,7 +331,6 @@ void SCR_SetDefaultMode(void)
// remember the default screen size
CV_SetValue(&cv_scr_width, vid.width);
CV_SetValue(&cv_scr_height, vid.height);
//CV_SetValue(&cv_scr_depth, vid.bpp*8);
}
// Change fullscreen on/off according to cv_fullscreen
+1 -1
View File
@@ -145,7 +145,7 @@ extern double averageFPS;
extern INT32 scr_bpp;
extern UINT8 *scr_borderpatch; // patch used to fill the view borders
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_fullscreen, cv_vhseffect, cv_shittyscreen;
extern consvar_t cv_scr_width, cv_scr_height, cv_renderview, cv_fullscreen, cv_vhseffect, cv_shittyscreen;
extern consvar_t cv_highreshudscale;
// wait for page flipping to end or not
extern consvar_t cv_vidwait;
-2
View File
@@ -128,7 +128,6 @@ static boolean first_init = false;
boolean OglSdlSurface(INT32 w, INT32 h)
{
INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value;
const char *gllogdir = NULL;
oglflags = 0;
@@ -248,7 +247,6 @@ boolean OglSdlSurface(INT32 w, INT32 h)
if (!first_init)
HWR_Startup();
textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1;
first_init = true;