From 8267939edb61a96a50498692fa6dd49bdc03ed53 Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 5 Oct 2021 05:05:43 +0000 Subject: [PATCH] Misc tweaks, including a corrupt-bsp crash fix. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6070 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 8 +++--- engine/client/snd_al.c | 2 +- engine/common/pr_bgcmd.c | 1 + engine/common/translate.c | 4 +++ engine/gl/gl_model.c | 9 ++++++ engine/gl/gl_videgl.c | 60 ++++++++++++++++++++++++++++++++------- engine/server/pr_cmds.c | 2 +- imgtool.c | 7 +++-- 8 files changed, 74 insertions(+), 19 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 0de46acfb..01ea3de84 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -62,7 +62,7 @@ cvar_t cl_pure = CVARD("cl_pure", "0", "0=standard quake rules.\n1=clients shou cvar_t cl_sbar = CVARFC("cl_sbar", "0", CVAR_ARCHIVE, CL_Sbar_Callback); cvar_t cl_hudswap = CVARF("cl_hudswap", "0", CVAR_ARCHIVE); cvar_t cl_maxfps = CVARFD("cl_maxfps", "250", CVAR_ARCHIVE, "Sets the maximum allowed framerate. If you're using vsync or want to uncap framerates entirely then you should probably set this to 0. Set cl_yieldcpu 0 if you're trying to benchmark."); -cvar_t cl_idlefps = CVARFD("cl_idlefps", "60", CVAR_ARCHIVE, "This is the maximum framerate to attain while idle/paused/unfocused."); +cvar_t cl_idlefps = CVARAFD("cl_idlefps", "60", "cl_maxidlefps"/*dp*/, CVAR_ARCHIVE, "This is the maximum framerate to attain while idle/paused/unfocused."); cvar_t cl_yieldcpu = CVARFD("cl_yieldcpu", "1", CVAR_ARCHIVE, "Attempt to yield between frames. This can resolve issues with certain drivers and background software, but can mean less consistant frame times. Will reduce power consumption/heat generation so should be set on laptops or similar (over-hot/battery powered) devices."); cvar_t cl_nopext = CVARF("cl_nopext", "0", CVAR_ARCHIVE); cvar_t cl_pext_mask = CVAR("cl_pext_mask", "0xffffffff"); @@ -146,11 +146,11 @@ cvar_t password = CVARAF("password", "", "pq_password", CVAR_USERINFO | CVAR_NOU cvar_t spectator = CVARF("spectator", "", CVAR_USERINFO); cvar_t name = CVARFC("name", "Player", CVAR_ARCHIVE | CVAR_USERINFO, Name_Callback); cvar_t team = CVARF("team", "", CVAR_ARCHIVE | CVAR_USERINFO); -cvar_t skin = CVARAF("skin", "", "_cl_playerskin", CVAR_ARCHIVE | CVAR_USERINFO); -cvar_t model = CVARAF("model", "", "_cl_playermodel", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t skin = CVARAF("skin", "", "_cl_playerskin"/*dp*/, CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t model = CVARAF("model", "", "_cl_playermodel"/*dp*/, CVAR_ARCHIVE | CVAR_USERINFO); cvar_t topcolor = CVARF("topcolor", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t bottomcolor = CVARF("bottomcolor", "", CVAR_ARCHIVE | CVAR_USERINFO); -cvar_t rate = CVARFD("rate", "30000"/*"6480"*/, CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while playing. Too high a value may result in 'buffer bloat'."); +cvar_t rate = CVARAFD("rate", "30000"/*"6480"*/, "_cl_rate"/*dp*/, CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while playing. Too high a value may result in 'buffer bloat'."); static cvar_t drate = CVARFD("drate", "3000000", CVAR_ARCHIVE | CVAR_USERINFO, "A rough measure of the bandwidth to try to use while downloading (in bytes per second)."); // :) static cvar_t noaim = CVARF("noaim", "", CVAR_ARCHIVE | CVAR_USERINFO); cvar_t msg = CVARFD("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, "Filter console prints/messages. Only functions on QuakeWorld servers. 0=pickup messages. 1=death messages. 2=critical messages. 3=chat."); diff --git a/engine/client/snd_al.c b/engine/client/snd_al.c index 2d93c6db8..2b325145a 100644 --- a/engine/client/snd_al.c +++ b/engine/client/snd_al.c @@ -811,7 +811,7 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, chanupdat //openal doesn't support loopstart (entire sample loops or not at all), so if we're meant to skip the first half then we need to stream it. stream = sfx->decoder.decodedata || sfx->loopstart > 0; - if (schanged & CUR_SOUNDCHANGE || stream) + if ((schanged&CUR_SOUNDCHANGE) || stream) { int sndnum = sfx-known_sfx; int buf; diff --git a/engine/common/pr_bgcmd.c b/engine/common/pr_bgcmd.c index 9362f9bca..acf1e36ae 100644 --- a/engine/common/pr_bgcmd.c +++ b/engine/common/pr_bgcmd.c @@ -7858,6 +7858,7 @@ qc_extension_t QSG_Extensions[] = { #ifdef Q3SERVER {"FTE_QUAKE3_SERVER", NULL, 0,{NULL}, "This engine is able to act as a quake3 server"}, #endif + {"FTE_SOLID_BSPTRIGGER", NOBI "Allows for mappers to use shaped triggers instead of being limited to axially aligned triggers."}, {"FTE_SOLID_LADDER", NOBI "Allows a simple trigger to remove effects of gravity (solid 20). obsolete. will prolly be removed at some point as it is not networked properly. Use FTE_ENT_SKIN_CONTENTS"}, {"FTE_SPLITSCREEN", NOBI "Client supports splitscreen, controlled via cl_splitscreen. Servers require allow_splitscreen 1 if splitscreen is to be used over the internet. Mods that use csqc will need to be aware for this to work properly. per-client networking may be problematic."}, diff --git a/engine/common/translate.c b/engine/common/translate.c index 9e56d2d73..73fbadab3 100644 --- a/engine/common/translate.c +++ b/engine/common/translate.c @@ -599,6 +599,10 @@ void TL_Reformat(char *out, size_t outsize, size_t numargs, const char **arg) { if (!*fmt) break; + else if (*fmt == '{' && fmt[1] == '{') + *out++ = '{', fmt+=2, outsize--; + else if (*fmt == '}' && fmt[1] == '}') + *out++ = '}', fmt+=2, outsize--; else if (*fmt == '{') { unsigned int index = strtoul(fmt+1, (char**)&fmt, 10)+1; diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 4bfdaac2b..2e34947dd 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -3192,6 +3192,12 @@ static void Mod_Batches_Build(model_t *mod, builddata_t *bd) else mesh = surf->mesh; + if (mesh->numindexes <= 0 || mesh->numvertexes < 1) + { + mesh->numindexes = 0; + mesh->numvertexes = 0; + } + numverts += mesh->numvertexes; numindicies += mesh->numindexes; // surf->lightmaptexturenum = -1; @@ -4255,6 +4261,9 @@ static qboolean Mod_LoadFaces (model_t *loadmodel, bspx_header_t *bspx, qbyte *m if (!out->texinfo->texture) continue; + if (out->numedges < 3) + Con_Printf(CON_WARNING"%s: Face %i has only %i edge(s) - \"%s\".\n", loadmodel->name, surfnum, out->numedges, out->texinfo->texture->name); + // set the drawing flags flag if (!Q_strncmp(out->texinfo->texture->name,"sky",3)) // sky diff --git a/engine/gl/gl_videgl.c b/engine/gl/gl_videgl.c index 872805954..88bbae836 100644 --- a/engine/gl/gl_videgl.c +++ b/engine/gl/gl_videgl.c @@ -19,6 +19,7 @@ extern cvar_t vid_vsync; EGLContext eglctx = EGL_NO_CONTEXT; EGLDisplay egldpy = EGL_NO_DISPLAY; EGLSurface eglsurf = EGL_NO_SURFACE; +static const char *eglexts; static dllhandle_t *egllibrary; static dllhandle_t *eslibrary; @@ -28,6 +29,7 @@ static EGLint (EGLAPIENTRY *qeglGetError)(void); static EGLDisplay (EGLAPIENTRY *qeglGetPlatformDisplay)(EGLenum platform, void *native_display, const EGLAttrib *attrib_list); static EGLDisplay (EGLAPIENTRY *qeglGetDisplay)(EGLNativeDisplayType display_id); static EGLBoolean (EGLAPIENTRY *qeglInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor); +static const char * (EGLAPIENTRY *qeglQueryString)(EGLDisplay dpy, EGLint name); static EGLBoolean (EGLAPIENTRY *qeglTerminate)(EGLDisplay dpy); static EGLBoolean (EGLAPIENTRY *qeglGetConfigs)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); @@ -55,6 +57,7 @@ static dllfunction_t qeglfuncs[] = {(void*)&qeglGetDisplay, "eglGetDisplay"}, {(void*)&qeglInitialize, "eglInitialize"}, + {(void*)&qeglQueryString, "eglQueryString"}, {(void*)&qeglTerminate, "eglTerminate"}, {(void*)&qeglGetConfigs, "eglGetConfigs"}, @@ -126,6 +129,28 @@ static const char *EGL_GetErrorString(int error) } } +static qboolean EGL_CheckExtension(const char *extname) +{ + const char *x = eglexts, *n; + size_t l; + if (!x) + return false; + l = strlen(extname); + for(;;) + { + n = strchr(x, ' '); + if (!n) + { + if (!strcmp(x, extname)) + return true; + return false; + } + else if (n-x==l && !strncmp(x, extname, l)) + return true; + x = n+1; + } +} + void EGL_UnloadLibrary(void) { if (egllibrary) @@ -216,6 +241,7 @@ void EGL_Shutdown(void) eglctx = EGL_NO_CONTEXT; egldpy = EGL_NO_DISPLAY; eglsurf = EGL_NO_SURFACE; + eglexts = NULL; } /*static void EGL_ShowConfig(EGLDisplay egldpy, EGLConfig cfg) @@ -309,11 +335,11 @@ qboolean EGL_InitDisplay (rendererstate_t *info, int eglplat, void *ndpy, EGLNat // EGL_BUFFER_SIZE, info->bpp, // EGL_SAMPLES, info->multisample, // EGL_STENCIL_SIZE, 8, - EGL_ALPHA_MASK_SIZE, 0, +// EGL_ALPHA_MASK_SIZE, 0, EGL_DEPTH_SIZE, info->depthbits?info->depthbits:16, - EGL_RED_SIZE, 1, - EGL_GREEN_SIZE, 1, - EGL_BLUE_SIZE, 1, + EGL_RED_SIZE, 4, + EGL_GREEN_SIZE, 4, + EGL_BLUE_SIZE, 4, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; @@ -351,6 +377,8 @@ qboolean EGL_InitDisplay (rendererstate_t *info, int eglplat, void *ndpy, EGLNat return false; } + eglexts = qeglQueryString(egldpy, EGL_EXTENSIONS); + /* if (!qeglGetConfigs(egldpy, NULL, 0, &numconfigs) || !numconfigs) { @@ -392,13 +420,25 @@ qboolean EGL_InitWindow (rendererstate_t *info, int eglplat, void *nwindow, EGLN } else if (qeglCreatePlatformWindowSurface) { - EGLAttrib wndattrib[] = - { -// EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR, + EGLAttrib wndattrib[3*2]; + size_t i = 0; - EGL_NONE,EGL_NONE - }; - eglsurf = qeglCreatePlatformWindowSurface(egldpy, cfg, nwindow, info->srgb?wndattrib:NULL); + if (info->srgb) + { + wndattrib[i++] = EGL_GL_COLORSPACE_KHR; + wndattrib[i++] = EGL_GL_COLORSPACE_SRGB_KHR; + } + if (EGL_CheckExtension("EGL_EXT_present_opaque")) + { //try to avoid nasty surprises. + #ifndef EGL_PRESENT_OPAQUE_EXT + #define EGL_PRESENT_OPAQUE_EXT 0x31DF + #endif + wndattrib[i++] = EGL_PRESENT_OPAQUE_EXT; + wndattrib[i++] = EGL_TRUE; + } + wndattrib[i++] = EGL_NONE; + wndattrib[i++] = EGL_NONE; + eglsurf = qeglCreatePlatformWindowSurface(egldpy, cfg, nwindow, wndattrib); } else { diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index bbbb8f417..ff649de00 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -10936,7 +10936,7 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs {"loadfromfile", PF_Fixme, 0, 0, 0, 69, D("void(string s)", "Reads a set of entities from the named file. This file should have the same format as a .ent file or a saved game. Entities will be spawned as required. If you need to see the entities that were created, you should use parseentitydata instead.")}, {"mod", PF_Fixme, 0, 0, 0, 70, "float(float val, float m)"}, {"cvar_string", PF_Fixme, 0, 0, 0, 71, D("string(string name)", "Returns the value of a cvar, as a string.")}, - {"crash", PF_Fixme, 0, 0, 0, 72, D("void()", "Demonstrates that no program is bug free.")}, + {"crash", PF_Fixme, 0, 0, 0, 72, D("FTEDEP(\"Call 'error' instead\") void()", "Demonstrates that no program is bug free.")}, {"stackdump", PF_Fixme, 0, 0, 0, 73, D("void()", "Prints out the QC's stack, for console-based error reports.")}, {"search_begin", PF_Fixme, 0, 0, 0, 74, "searchhandle(string pattern, enumflags:float{" "SB_CASEINSENSITIVE=1<<0," diff --git a/imgtool.c b/imgtool.c index c45b4eef3..d3518223e 100644 --- a/imgtool.c +++ b/imgtool.c @@ -1473,8 +1473,9 @@ static void ImgTool_PrintInfo(const char *inname, struct pendingtextureinfo *in) printf("%-20s(%s): \"%s\"%s %i*%i, %i mips\n", inname, Image_FormatName(in->encoding), mip->name, mip->offsets[0]?"":" (stripped)", mip->width, mip->height, in->mipcount); else*/ printf("%-20s(%s): %s, %i*%i*%i, %i mips\n", inname, Image_FormatName(in->encoding), imagetypename[in->type], in->mip[0].width, in->mip[0].height, in->mip[0].depth, in->mipcount); - for (m = 0; m < in->mipcount; m++) - printf("\t%u: %i*%i*%i, %u\n", (unsigned)m, in->mip[m].width, in->mip[m].height, in->mip[m].depth, (unsigned)in->mip[m].datasize); + if (verbose) + for (m = 0; m < in->mipcount; m++) + printf("\t%u: %i*%i*%i, %u\n", (unsigned)m, in->mip[m].width, in->mip[m].height, in->mip[m].depth, (unsigned)in->mip[m].datasize); } } static void ImgTool_Enumerate(struct opts_s *args, const char *inname, void(*callback)(const char *name, struct pendingtextureinfo *mips)) @@ -1617,7 +1618,7 @@ static void ImgTool_Enumerate(struct opts_s *args, const char *inname, void(*cal { char syn[MAX_QPATH]; sprintf(syn, "unnamed%u", (unsigned)i); - printf("\t%16.16s: \n", syn); + printf("%-20s------ %d\n", syn, texlump->dataofs[i]); continue; }