diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index 9c145fe0..2c8fefde 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -48,7 +48,7 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` * **aimfix**: Fix aiming. When set to to `0` (the default) aiming is slightly inaccurate, bullets and the like have a little drift. When set to `1` they hit exactly were the crosshair is. - + * **busywait**: By default this is set to `1`, causing Quake II to spin in a very tight loop until it's time to process the next frame. This is a very accurate way to determine the internal timing, but comes with @@ -59,42 +59,42 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` * **cl_maxfps**: The approximate framerate for client/server ("packet") frames if *cl_async* is `1`. If set to `-1` (the default), the engine - will choose a packet framerate appropriate for the render framerate. + will choose a packet framerate appropriate for the render framerate. See `cl_async` for more information. -* **cl_async**: Run render frames independently of client/server frames. +* **cl_async**: Run render frames independently of client/server frames. If set to `0`, client, server (gamecode) and the renderer run synchronous, (like Quake2 originally did) which means that for every rendered frame a client- and server-frame is executed, which includes the gamecode and physics/movement-simulation etc. At higher framerates (above 95 or so) this leads to movement bugs, like being able to jump higher than expected - (kind of like the infamous Quake 3 125Hz bug). + (kind of like the infamous Quake 3 125Hz bug). For `cl_async 0`, *vid_maxfps* (or, if vsync is enabled, the display refresh rate) is used and *cl_maxfps* is ignored. - + If *cl_async* is set to `1` (the default) the client is asynchronous, which means that there can be multiple render frames between client- and server-frames. This makes it possible to renderer as many frames - as desired without physics and movement problems. + as desired without physics and movement problems. The client framerate is controlled by *cl_maxfps*, - the renderer framerate is controlled by *vid_maxfps*. - + the renderer framerate is controlled by *vid_maxfps*. + As client/server frames ("packet frames") are only run together with a render frame, the *real* client/server framerate is always rounded to - a fraction of the renderframerate that's closest to *cl_maxfps*. + a fraction of the renderframerate that's closest to *cl_maxfps*. So if for example *vid_maxfps* is `60` and *cl_maxfps* is `50`, it will - be rounded to `60` and every renderframe is also a packet frame. + be rounded to `60` and every renderframe is also a packet frame. If *vid_maxfps* is `60` and *cl_maxfps* is `40`, it will be rounded to `30` and every second render frame is also a packet frame. - + It seems like the best working packet framerate is `60` (which means that the render framerate should be a multiple of that), otherwise values between `45` and `90` seem to work ok, lower and higher values can lead - to buggy movement, jittering and other issues. + to buggy movement, jittering and other issues. Setting *cl_maxfps* to `-1` (the default since 8.02) will automatically choose a packet framerate that's *both* a fraction of *vid_maxfps* (or display refreshrate if vsync is on) *and* between 45 and 90. - + * **cl_http_downloads**: Allow HTTP download. Set to `1` by default, set to `0` to disable. @@ -142,12 +142,12 @@ Set `0` by default. * **cl_showfps**: Shows the framecounter. Set to `2` for more and to `3` for even more informations. - + * **cl_showspeed**: Shows the players speed. Set to `1` to display both overall speed and (horizontal speed) in Quake Units (QU) respectfully at - the top right corner of the screen. Set to `2` to show only the horizontal + the top right corner of the screen. Set to `2` to show only the horizontal speed under the crosshair. - + * **cl_model_preview_start**: start frame value in multiplayer model preview. `-1` - don't show animation. Defaults to `84` for show salute animation. @@ -221,8 +221,8 @@ Set `0` by default. The Reckoning. This cvar is disabled by default to maintain the original gameplay experience. -* **g_machinegun_norecoil**: Disable machine gun recoil in single player. - By default this is set to `0`, this keeps the original machine gun +* **g_machinegun_norecoil**: Disable machine gun recoil in single player. + By default this is set to `0`, this keeps the original machine gun recoil in single player. When set to `1` the recoil is disabled in single player, the same way as in multiplayer. This cvar only works if the game.dll implements this behaviour. @@ -256,6 +256,13 @@ Set `0` by default. * **gametype**: replace menu to different mod type without change mod name in game variable. +* **maptype**: convert surface map flags from different game on load: + * 0: Quake2, + * 1: Heretic2, + * 2: Daikatana, + * 3: Kingpin, + * 4: Anachronox. + * **nextdemo**: Defines the next command to run after maps from the `nextserver` list. By default this is set to the empty string. @@ -415,16 +422,16 @@ Set `0` by default. and scales the window (and thus the requested resolution) by the scaling factor of the underlying display. Example: The displays scaling factor is 1.25 and the user requests 1920x1080. The client - will render at 1920\*1.25x1080\*1.25=2400x1350. + will render at 1920\*1.25x1080\*1.25=2400x1350. When set to `0` (the default) the client leaves the decision if the window should be scaled to the underlying compositor. Scaling applied - by the compositor may introduce blur and sluggishness. + by the compositor may introduce blur and sluggishness. Currently high dpi awareness is only supported under Wayland. -* **vid_maxfps**: The maximum framerate. *Note* that vsync (`r_vsync`) +* **vid_maxfps**: The maximum framerate. *Note* that vsync (`r_vsync`) also restricts the framerate to the monitor refresh rate, so if vsync is enabled, the game won't render more than frame than the display can - show. Defaults to `300`. + show. Defaults to `300`. Related to this: *cl_maxfps* and *cl_async*. * **vid_pauseonfocuslost**: When set to `1` the game is paused as soon @@ -453,7 +460,7 @@ Set `0` by default. - `GL_LINEAR`: Bilinear filtering, mipmaps not used - `GL_LINEAR_MIPMAP_NEAREST`: The default - Bilinear filtering when scaling up, using mipmaps with nearest/no filtering when scaling down - + Other supported values: `GL_NEAREST_MIPMAP_NEAREST`, `GL_NEAREST_MIPMAP_LINEAR`, `GL_LINEAR_MIPMAP_LINEAR` diff --git a/src/client/refresh/files/maps.c b/src/client/refresh/files/maps.c index 72383341..09e0223a 100644 --- a/src/client/refresh/files/maps.c +++ b/src/client/refresh/files/maps.c @@ -26,6 +26,7 @@ */ #include "../ref_shared.h" +#include "maps.h" /* ================= @@ -416,6 +417,38 @@ Mod_CalcSurfaceExtents(const int *surfedges, mvertex_t *vertexes, medge_t *edges } } +static int +Mod_LoadSurfConvertFlags(int flags, maptype_t maptype) +{ + const int *convert; + int sflags = 0; + int i; + + switch (maptype) + { + case map_heretic2: convert = heretic2_flags; break; + case map_daikatana: convert = daikatana_flags; break; + case map_kingpin: convert = kingpin_flags; break; + case map_anachronox: convert = anachronox_flags; break; + default: convert = NULL; break; + } + + if (!convert) + { + return flags; + } + + for (i = 0; i < 32; i++) + { + if (flags & (1 << i)) + { + sflags |= convert[i]; + } + } + + return sflags; +} + /* ================= Mod_LoadTexinfo @@ -426,7 +459,7 @@ extra for skybox in soft render void Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo, const byte *mod_base, const lump_t *l, findimage_t find_image, - struct image_s *notexture) + struct image_s *notexture, maptype_t maptype) { texinfo_t *in; mtexinfo_t *out, *step; @@ -457,7 +490,8 @@ Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo, out->vecs[1][j] = LittleFloat(in->vecs[1][j]); } - out->flags = LittleLong(in->flags); + /* Convert flags for game type */ + out->flags = Mod_LoadSurfConvertFlags(LittleLong(in->flags), maptype); next = LittleLong(in->nexttexinfo); if (next > 0) diff --git a/src/client/refresh/files/maps.h b/src/client/refresh/files/maps.h new file mode 100644 index 00000000..8aec7807 --- /dev/null +++ b/src/client/refresh/files/maps.h @@ -0,0 +1,180 @@ +/* + * Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (c) 2005-2015 David HENRY + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * The maps file format + * + * ======================================================================= + */ + +/* + * Based on https://github.com/TrenchBroom/ +*/ +static const int heretic2_flags[32] = { + SURF_LIGHT, /* 0: Emit light from the surface, brightness is specified in the 'value' field */ + SURF_SLICK, /* 1: The surface is slippery */ + SURF_SKY, /* 2: The surface is sky, the texture will not be drawn, + * but the background sky box is used instead */ + SURF_WARP, /* 3: The surface warps (like water textures do) */ + SURF_TRANS33, /* 4: The surface is 33% transparent */ + SURF_TRANS66, /* 5: The surface is 66% transparent */ + SURF_FLOWING, /* 6: The texture wraps in a downward 'flowing' pattern + * (warp must also be set) */ + SURF_NODRAW, /* 7: Used for non-fixed-size brush triggers and clip brushes */ + 0, /* 8: Make a primary bsp splitter */ + 0, /* 9: Completely ignore, allowing non-closed brushes */ + 0, /* 10: Tall wall. Purpose unknown */ + 0, /* 11: Alpha_tex. Purpose unknown */ + 0, /* 12: Animspeed. Purpose unknown */ + 0, /* 13: Undulate. Purpose unknown */ + 0, /* 14: Skyreflect. Purpose unknown */ + 0, /* 15: Unused */ + 0, /* 16: Unused */ + 0, /* 17: Unused */ + 0, /* 18: Unused */ + 0, /* 19: Unused */ + 0, /* 20: Unused */ + 0, /* 21: Unused */ + 0, /* 22: Unused */ + 0, /* 23: Unused */ + 0, /* 24: Metal. Sound when walked on */ + 0, /* 25: Stone. Sound when walked on */ + 0, /* 26: Unused */ + 0, /* 27: Unused */ + 0, /* 28: Unused */ + 0, /* 29: Unused */ + 0, /* 30: Unused */ + 0, /* 31: Unused */ +}; + +static const int daikatana_flags[32] = { + SURF_LIGHT, /* 0: Emit light from the surface, brightness is + * specified in the 'value' field" */ + SURF_LIGHT, /* 1: Fullbright */ + SURF_SKY, /* 2: The surface is sky, the texture will not be drawn, + * but the background sky box is used instead */ + SURF_WARP, /* 3: The surface warps (like water textures do) */ + SURF_TRANS33, /* 4: The surface is 33% transparent */ + SURF_TRANS66, /* 5: The surface is 66% transparent */ + SURF_FLOWING, /* 6: The texture wraps in a downward 'flowing' pattern + * (warp must also be set) */ + SURF_NODRAW, /* 7: Used for non-fixed-size brush triggers and clip brushes */ + 0, /* 8: Hint */ + 0, /* 9: Skip */ + 0, /* 10: Wood */ + 0, /* 11: Metal */ + 0, /* 12: Stone */ + 0, /* 13: Glass */ + 0, /* 14: Ice */ + 0, /* 15: Snow */ + 0, /* 16: Mirror */ + 0, /* 17: Holy Grond */ + SURF_ALPHATEST, /* 18: Alphachan */ + 0, /* 19: Midtexture (Used together with Clear and Nodraw.) */ + 0, /* 20: Puddle */ + 0, /* 21: Water Surge */ + 0, /* 22: Big Water Surge */ + 0, /* 23: Bullet Light */ + 0, /* 24: Fog */ + 0, /* 25: Sand */ + 0, /* 26: Unused */ + 0, /* 27: Unused */ + 0, /* 28: Unused */ + 0, /* 29: Unused */ + 0, /* 30: Unused */ + 0, /* 31: Unused */ +}; + +static const int kingpin_flags[32] = { + SURF_LIGHT, /* 0: Emit light from the surface, brightness is specified + * in the 'value' field */ + SURF_SLICK, /* 1: The surface is slippery */ + SURF_SKY, /* 2: The surface is sky, the texture will not be drawn, + * but the background sky box is used instead */ + SURF_WARP, /* 3: The surface warps (like water textures do) */ + SURF_TRANS33, /* 4: The surface is 33% transparent */ + SURF_TRANS66, /* 5: The surface is 66% transparent */ + SURF_FLOWING, /* 6: The texture wraps in a downward 'flowing' pattern + * (warp must also be set) */ + SURF_NODRAW, /* 7: Used for non-fixed-size brush triggers and clip brushes */ + 0, /* 8: Make a primary bsp splitter */ + 0, /* 9: Skip, Completely ignore, allowing non-closed brushes */ + 0, /* 10: Specular */ + 0, /* 11: Diffuse */ + SURF_ALPHATEST, /* 12: Alpha texture */ + 0, /* 13: Mirror */ + 0, /* 14: Wndw33 */ + 0, /* 15: Wndw66 */ + 0, /* 16: Unused */ + 0, /* 17: Unused */ + 0, /* 18: Unused */ + 0, /* 19: Water sound */ + 0, /* 20: Concrete sound */ + 0, /* 21: Fabric sound */ + 0, /* 22: Gravel sound */ + 0, /* 23: Metal sound */ + 0, /* 24: Metal light sound */ + 0, /* 25: Tin sound */ + 0, /* 26: Tile sound */ + 0, /* 27: Wood sound */ + 0, /* 28: Reflect fake */ + 0, /* 29: Reflect light */ + 0, /* 30: Unused */ + 0, /* 31: Unused */ +}; + +/* + * Based on https://anachrodox.talonbrave.info/ + */ +static const int anachronox_flags[32] = { + SURF_LIGHT, /* 0: Light */ + SURF_SLICK, /* 1: Slick */ + SURF_SKY, /* 2: Sky Flag */ + SURF_WARP, /* 3: Warp */ + SURF_TRANS33, /* 4: Trans33 */ + SURF_TRANS66, /* 5: Trans66 */ + 0, /* 6: Unused */ + SURF_NODRAW, /* 7: NoDraw */ + 0, /* 8: Hint */ + 0, /* 9: Skip */ + 0, /* 10: Unused */ + 0, /* 11: Unused */ + 0, /* 12: Unused */ + 0, /* 13: Unused */ + 0, /* 14: Unused */ + 0, /* 15: Unused */ + 0, /* 16: Alpha Banner */ + SURF_ALPHATEST, /* 17: Alpha Test */ + 0, /* 18: No V-turbulence */ + 0, /* 19: Unused */ + 0, /* 20: Unused */ + 0, /* 21: Unused */ + 0, /* 22: Unused */ + 0, /* 23: Unused */ + 0, /* 24: Unused */ + 0, /* 25: Unused */ + 0, /* 26: Unused */ + 0, /* 27: Unused */ + 0, /* 28: Half Scroll */ + 0, /* 29: Quarter Scroll */ + 0, /* 30: Surface Fog */ + 0, /* 31: Surface Curve */ +}; diff --git a/src/client/refresh/gl1/gl1_main.c b/src/client/refresh/gl1/gl1_main.c index 5f606d71..84996d09 100644 --- a/src/client/refresh/gl1/gl1_main.c +++ b/src/client/refresh/gl1/gl1_main.c @@ -102,6 +102,7 @@ cvar_t *r_customwidth; cvar_t *r_customheight; cvar_t *r_retexturing; +cvar_t *r_maptype; cvar_t *r_scale8bittextures; cvar_t *r_nolerp_list; @@ -1239,6 +1240,7 @@ R_Register(void) r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); r_validation = ri.Cvar_Get("r_validation", "0", CVAR_ARCHIVE); r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); + r_maptype = ri.Cvar_Get("maptype", "0", CVAR_ARCHIVE); /* don't bilerp characters and crosshairs */ r_nolerp_list = ri.Cvar_Get("r_nolerp_list", DEFAULT_NOLERP_LIST, CVAR_ARCHIVE); diff --git a/src/client/refresh/gl1/gl1_model.c b/src/client/refresh/gl1/gl1_model.c index d831cf3a..e88b0c98 100644 --- a/src/client/refresh/gl1/gl1_model.c +++ b/src/client/refresh/gl1/gl1_model.c @@ -709,7 +709,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) mod_base, &header->lumps[LUMP_PLANES]); Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage, - r_notexture); + r_notexture, r_maptype->value); if (header->ident == IDBSPHEADER) { Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header); diff --git a/src/client/refresh/gl1/header/local.h b/src/client/refresh/gl1/header/local.h index 78e264a0..733f04f1 100644 --- a/src/client/refresh/gl1/header/local.h +++ b/src/client/refresh/gl1/header/local.h @@ -175,6 +175,7 @@ extern cvar_t *r_customwidth; extern cvar_t *r_customheight; extern cvar_t *r_retexturing; +extern cvar_t *r_maptype; extern cvar_t *r_scale8bittextures; extern cvar_t *r_validation; diff --git a/src/client/refresh/gl3/gl3_main.c b/src/client/refresh/gl3/gl3_main.c index a7532885..13a344e7 100644 --- a/src/client/refresh/gl3/gl3_main.c +++ b/src/client/refresh/gl3/gl3_main.c @@ -82,6 +82,7 @@ const hmm_mat4 gl3_identityMat4 = {{ cvar_t *gl_msaa_samples; cvar_t *r_vsync; cvar_t *r_retexturing; +cvar_t *r_maptype; cvar_t *r_scale8bittextures; cvar_t *vid_fullscreen; cvar_t *r_mode; @@ -209,6 +210,7 @@ GL3_Register(void) r_vsync = ri.Cvar_Get("r_vsync", "1", CVAR_ARCHIVE); gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE ); r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_maptype = ri.Cvar_Get("maptype", "0", CVAR_ARCHIVE); r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); gl3_debugcontext = ri.Cvar_Get("gl3_debugcontext", "0", 0); r_mode = ri.Cvar_Get("r_mode", "4", CVAR_ARCHIVE); @@ -323,9 +325,6 @@ GL3_Register(void) //r_customheight = ri.Cvar_Get("r_customheight", "768", CVAR_ARCHIVE); //gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE ); - //r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); - - gl1_stereo = ri.Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE ); gl1_stereo_separation = ri.Cvar_Get( "gl1_stereo_separation", "-0.4", CVAR_ARCHIVE ); gl1_stereo_anaglyph_colors = ri.Cvar_Get( "gl1_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE ); diff --git a/src/client/refresh/gl3/gl3_model.c b/src/client/refresh/gl3/gl3_model.c index de7692d2..d78bd694 100644 --- a/src/client/refresh/gl3/gl3_model.c +++ b/src/client/refresh/gl3/gl3_model.c @@ -710,7 +710,7 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen) mod_base, &header->lumps[LUMP_PLANES]); Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL3_FindImage, - gl3_notexture); + gl3_notexture, r_maptype->value); if (header->ident == IDBSPHEADER) { Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header); diff --git a/src/client/refresh/gl3/header/local.h b/src/client/refresh/gl3/header/local.h index b511edfc..fb71a9d6 100644 --- a/src/client/refresh/gl3/header/local.h +++ b/src/client/refresh/gl3/header/local.h @@ -507,6 +507,7 @@ extern void GL3_UpdateUBOLights(void); extern cvar_t *gl_msaa_samples; extern cvar_t *r_vsync; extern cvar_t *r_retexturing; +extern cvar_t *r_maptype; extern cvar_t *r_scale8bittextures; extern cvar_t *vid_fullscreen; extern cvar_t *r_mode; diff --git a/src/client/refresh/gl4/gl4_main.c b/src/client/refresh/gl4/gl4_main.c index 23d9cc16..49c8c1e5 100644 --- a/src/client/refresh/gl4/gl4_main.c +++ b/src/client/refresh/gl4/gl4_main.c @@ -78,6 +78,7 @@ const hmm_mat4 gl4_identityMat4 = {{ cvar_t *gl_msaa_samples; cvar_t *r_vsync; cvar_t *r_retexturing; +cvar_t *r_maptype; cvar_t *r_scale8bittextures; cvar_t *vid_fullscreen; cvar_t *r_mode; @@ -205,6 +206,7 @@ GL4_Register(void) r_vsync = ri.Cvar_Get("r_vsync", "1", CVAR_ARCHIVE); gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE ); r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_maptype = ri.Cvar_Get("maptype", "0", CVAR_ARCHIVE); r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); gl4_debugcontext = ri.Cvar_Get("gl4_debugcontext", "0", 0); r_mode = ri.Cvar_Get("r_mode", "4", CVAR_ARCHIVE); @@ -319,9 +321,6 @@ GL4_Register(void) //r_customheight = ri.Cvar_Get("r_customheight", "768", CVAR_ARCHIVE); //gl_msaa_samples = ri.Cvar_Get ( "r_msaa_samples", "0", CVAR_ARCHIVE ); - //r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); - - gl1_stereo = ri.Cvar_Get( "gl1_stereo", "0", CVAR_ARCHIVE ); gl1_stereo_separation = ri.Cvar_Get( "gl1_stereo_separation", "-0.4", CVAR_ARCHIVE ); gl1_stereo_anaglyph_colors = ri.Cvar_Get( "gl1_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE ); diff --git a/src/client/refresh/gl4/gl4_model.c b/src/client/refresh/gl4/gl4_model.c index 884d911f..d421f45f 100644 --- a/src/client/refresh/gl4/gl4_model.c +++ b/src/client/refresh/gl4/gl4_model.c @@ -710,7 +710,7 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen) mod_base, &header->lumps[LUMP_PLANES]); Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL4_FindImage, - gl4_notexture); + gl4_notexture, r_maptype->value); if (header->ident == IDBSPHEADER) { Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header); diff --git a/src/client/refresh/gl4/header/local.h b/src/client/refresh/gl4/header/local.h index 736157d1..466f5eb0 100644 --- a/src/client/refresh/gl4/header/local.h +++ b/src/client/refresh/gl4/header/local.h @@ -497,6 +497,7 @@ extern void GL4_UpdateUBOLights(void); extern cvar_t *gl_msaa_samples; extern cvar_t *r_vsync; extern cvar_t *r_retexturing; +extern cvar_t *r_maptype; extern cvar_t *r_scale8bittextures; extern cvar_t *vid_fullscreen; extern cvar_t *r_mode; diff --git a/src/client/refresh/ref_shared.h b/src/client/refresh/ref_shared.h index ef20e839..97f4252e 100644 --- a/src/client/refresh/ref_shared.h +++ b/src/client/refresh/ref_shared.h @@ -356,7 +356,7 @@ extern void Mod_CalcSurfaceExtents(const int *surfedges, mvertex_t *vertexes, medge_t *edges, msurface_t *s); extern void Mod_LoadTexinfo(const char *name, mtexinfo_t **texinfo, int *numtexinfo, const byte *mod_base, const lump_t *l, findimage_t find_image, - struct image_s *notexture); + struct image_s *notexture, maptype_t maptype); extern void Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedges, const byte *mod_base, const lump_t *l); extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node); diff --git a/src/client/refresh/soft/header/local.h b/src/client/refresh/soft/header/local.h index 38764fac..af4575e0 100644 --- a/src/client/refresh/soft/header/local.h +++ b/src/client/refresh/soft/header/local.h @@ -398,6 +398,7 @@ extern cvar_t *sw_waterwarp; extern cvar_t *sw_gunzposition; extern cvar_t *r_validation; extern cvar_t *r_retexturing; +extern cvar_t *r_maptype; extern cvar_t *r_scale8bittextures; extern cvar_t *r_palettedtexture; diff --git a/src/client/refresh/soft/sw_main.c b/src/client/refresh/soft/sw_main.c index 14461d59..7533f2c8 100644 --- a/src/client/refresh/soft/sw_main.c +++ b/src/client/refresh/soft/sw_main.c @@ -148,6 +148,7 @@ cvar_t *sw_custom_particles; static cvar_t *sw_anisotropic; cvar_t *sw_texture_filtering; cvar_t *r_retexturing; +cvar_t *r_maptype; cvar_t *r_scale8bittextures; cvar_t *sw_gunzposition; cvar_t *r_validation; @@ -382,6 +383,7 @@ R_RegisterVariables (void) sw_texture_filtering = ri.Cvar_Get("sw_texture_filtering", "0", CVAR_ARCHIVE); sw_anisotropic = ri.Cvar_Get("r_anisotropic", "0", CVAR_ARCHIVE); r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_maptype = ri.Cvar_Get("maptype", "0", CVAR_ARCHIVE); r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); sw_gunzposition = ri.Cvar_Get("sw_gunzposition", "8", CVAR_ARCHIVE); r_validation = ri.Cvar_Get("r_validation", "0", CVAR_ARCHIVE); diff --git a/src/client/refresh/soft/sw_model.c b/src/client/refresh/soft/sw_model.c index 880a9994..12fc4dca 100644 --- a/src/client/refresh/soft/sw_model.c +++ b/src/client/refresh/soft/sw_model.c @@ -550,7 +550,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) mod_base, &header->lumps[LUMP_PLANES]); Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage, - r_notexture_mip); + r_notexture_mip, r_maptype->value); if (header->ident == IDBSPHEADER) { Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header); diff --git a/src/client/refresh/vk/header/local.h b/src/client/refresh/vk/header/local.h index 73e619d3..9d534ffc 100644 --- a/src/client/refresh/vk/header/local.h +++ b/src/client/refresh/vk/header/local.h @@ -137,6 +137,7 @@ extern cvar_t *vk_molten_fastmath; extern cvar_t *vk_molten_metalbuffers; #endif extern cvar_t *r_retexturing; +extern cvar_t *r_maptype; extern cvar_t *r_scale8bittextures; extern cvar_t *r_nolerp_list; extern cvar_t *r_lerp_list; diff --git a/src/client/refresh/vk/vk_main.c b/src/client/refresh/vk/vk_main.c index 978a6e4d..ce79a90f 100644 --- a/src/client/refresh/vk/vk_main.c +++ b/src/client/refresh/vk/vk_main.c @@ -132,6 +132,7 @@ cvar_t *vk_mip_nearfilter; cvar_t *vk_sampleshading; cvar_t *vk_device_idx; cvar_t *r_retexturing; +cvar_t *r_maptype; cvar_t *r_scale8bittextures; static cvar_t *vk_underwater; cvar_t *r_nolerp_list; @@ -1177,6 +1178,7 @@ R_Register(void) vk_molten_metalbuffers = ri.Cvar_Get("vk_molten_metalbuffer", "0", CVAR_ARCHIVE); #endif r_retexturing = ri.Cvar_Get("r_retexturing", "1", CVAR_ARCHIVE); + r_maptype = ri.Cvar_Get("maptype", "0", CVAR_ARCHIVE); r_scale8bittextures = ri.Cvar_Get("r_scale8bittextures", "0", CVAR_ARCHIVE); vk_underwater = ri.Cvar_Get("vk_underwater", "1", CVAR_ARCHIVE); /* don't bilerp characters and crosshairs */ diff --git a/src/client/refresh/vk/vk_model.c b/src/client/refresh/vk/vk_model.c index 94d9292c..27432f73 100644 --- a/src/client/refresh/vk/vk_model.c +++ b/src/client/refresh/vk/vk_model.c @@ -684,7 +684,7 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) mod_base, &header->lumps[LUMP_PLANES]); Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)Vk_FindImage, - r_notexture); + r_notexture, r_maptype->value); if (header->ident == IDBSPHEADER) { Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header); diff --git a/src/common/header/cmodel.h b/src/common/header/cmodel.h index 5db4f9e9..6d4a471e 100644 --- a/src/common/header/cmodel.h +++ b/src/common/header/cmodel.h @@ -39,6 +39,15 @@ #define EXTRA_LUMP_BRUSHSIDES 6 #define EXTRA_LUMP_LEAFS 1 +typedef enum +{ + map_quake2 = 0, + map_heretic2 = 1, + map_daikatana = 2, + map_kingpin = 3, + map_anachronox = 4, +} maptype_t; + extern int Mod_CalcLumpHunkSize(const lump_t *l, int inSize, int outSize, int extra); extern void Mod_LoadVisibility(const char *name, dvis_t **vis, int *numvisibility, const byte *mod_base, const lump_t *l);