diff --git a/src/gl/compatibility/gl_20.cpp b/src/gl/compatibility/gl_20.cpp index d0de0589c..7e8ad093a 100644 --- a/src/gl/compatibility/gl_20.cpp +++ b/src/gl/compatibility/gl_20.cpp @@ -53,6 +53,54 @@ #include "gl/renderer/gl_renderstate.h" #include "gl/scene/gl_drawinfo.h" + +//========================================================================== +// +// Do some tinkering with the menus so that certain options only appear +// when they are actually valid. +// +//========================================================================== + +void gl_PatchMenu() +{ + if (gl.compatibility == CMPT_GL2) + { + // Radial fog and Doom lighting are not available in SM < 4 cards + // The way they are implemented does not work well on older hardware. + + FOptionValues **opt = OptionValues.CheckKey("LightingModes"); + if (opt != NULL) + { + for(int i = (*opt)->mValues.Size()-1; i>=0; i--) + { + // Delete 'Doom' lighting mode + if ((*opt)->mValues[i].Value == 2.0 || (*opt)->mValues[i].Value == 8.0) + { + (*opt)->mValues.Delete(i); + } + } + } + + opt = OptionValues.CheckKey("FogMode"); + if (opt != NULL) + { + for(int i = (*opt)->mValues.Size()-1; i>=0; i--) + { + // Delete 'Radial' fog mode + if ((*opt)->mValues[i].Value == 2.0) + { + (*opt)->mValues.Delete(i); + } + } + } + + // disable features that don't work without shaders. + if (gl_lightmode == 2 || gl_lightmode == 8) gl_lightmode = 3; + if (gl_fogmode == 2) gl_fogmode = 1; + } +} + + //========================================================================== // // @@ -499,4 +547,5 @@ void FGLRenderer::RenderMultipassStuff() gl_drawinfo->dldrawlists[GLLDL_FLATS_FOGMASKED].DrawFlats(GLPASS_LIGHTTEX_ADDITIVE); } else gl_lights = false; -} \ No newline at end of file +} + diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 4db7a5f66..dc937ea40 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -325,8 +325,8 @@ FTexture * LoadSkin(const char * path, const char * fn) static int ModelFrameHash(FSpriteModelFrame * smf) { - const DWORD *table = GetCRCTable (); - DWORD hash = 0xffffffff; + const uint32_t *table = GetCRCTable (); + uint32_t hash = 0xffffffff; const char * s = (const char *)(&smf->type); // this uses type, sprite and frame for hashing const char * se= (const char *)(&smf->hashnext); diff --git a/src/gl/models/gl_models_md3.cpp b/src/gl/models/gl_models_md3.cpp index 7e8a4845e..024f8ac81 100644 --- a/src/gl/models/gl_models_md3.cpp +++ b/src/gl/models/gl_models_md3.cpp @@ -77,45 +77,45 @@ static void UnpackVector(unsigned short packed, float & nx, float & ny, float & #pragma pack(4) struct md3_header_t { - DWORD Magic; - DWORD Version; + uint32_t Magic; + uint32_t Version; char Name[MAX_QPATH]; - DWORD Flags; - DWORD Num_Frames; - DWORD Num_Tags; - DWORD Num_Surfaces; - DWORD Num_Skins; - DWORD Ofs_Frames; - DWORD Ofs_Tags; - DWORD Ofs_Surfaces; - DWORD Ofs_Eof; + uint32_t Flags; + uint32_t Num_Frames; + uint32_t Num_Tags; + uint32_t Num_Surfaces; + uint32_t Num_Skins; + uint32_t Ofs_Frames; + uint32_t Ofs_Tags; + uint32_t Ofs_Surfaces; + uint32_t Ofs_Eof; }; struct md3_surface_t { - DWORD Magic; + uint32_t Magic; char Name[MAX_QPATH]; - DWORD Flags; - DWORD Num_Frames; - DWORD Num_Shaders; - DWORD Num_Verts; - DWORD Num_Triangles; - DWORD Ofs_Triangles; - DWORD Ofs_Shaders; - DWORD Ofs_Texcoord; - DWORD Ofs_XYZNormal; - DWORD Ofs_End; + uint32_t Flags; + uint32_t Num_Frames; + uint32_t Num_Shaders; + uint32_t Num_Verts; + uint32_t Num_Triangles; + uint32_t Ofs_Triangles; + uint32_t Ofs_Shaders; + uint32_t Ofs_Texcoord; + uint32_t Ofs_XYZNormal; + uint32_t Ofs_End; }; struct md3_triangle_t { - DWORD vt_index[3]; + uint32_t vt_index[3]; }; struct md3_shader_t { char Name[MAX_QPATH]; - DWORD index; + uint32_t index; }; struct md3_texcoord_t diff --git a/src/gl/system/gl_interface.cpp b/src/gl/system/gl_interface.cpp index 19f6134c3..e6e802e5c 100644 --- a/src/gl/system/gl_interface.cpp +++ b/src/gl/system/gl_interface.cpp @@ -47,12 +47,10 @@ #include "gl/system/gl_interface.h" #include "gl/system/gl_cvars.h" +void gl_PatchMenu(); static TArray m_Extensions; - RenderContext gl; -int occlusion_type=0; - //========================================================================== // // @@ -273,6 +271,7 @@ void gl_LoadExtensions() FUDGE_FUNC(glDeleteRenderbuffers, EXT); FUDGE_FUNC(glRenderbufferStorage, EXT); FUDGE_FUNC(glBindRenderbuffer, EXT); + gl_PatchMenu(); } //==========================================================================