From 39e1f24511441b27e43ed36566f7f4760857ba50 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 13 Oct 2018 12:19:58 +0000 Subject: [PATCH] Added trace_networkentity global to csqc. Try to fix some misc bugs. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5319 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/Makefile | 2 +- engine/client/cl_screen.c | 2 +- engine/client/pr_csqc.c | 5 +++++ engine/common/fs.c | 32 +++++++++++++++++--------------- engine/gl/gl_shader.c | 8 +++++++- engine/gl/gl_vidlinuxglx.c | 2 ++ engine/server/pr_cmds.c | 1 + engine/server/sv_user.c | 32 ++++++++++++++++---------------- engine/server/world.c | 8 ++++---- 9 files changed, 54 insertions(+), 38 deletions(-) diff --git a/engine/Makefile b/engine/Makefile index 667a0a07c..d4956a4f0 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -2205,7 +2205,7 @@ libs-$(ARCH)/libspeexdsp.a: libs-$(ARCH)/libfreetype.a: test -f freetype-$(FREETYPEVER).tar.gz || wget https://download.savannah.gnu.org/releases/freetype/freetype-$(FREETYPEVER).tar.gz - -test -f libs-$(ARCH)/libfreetype.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../freetype-$(FREETYPEVER).tar.gz && cd freetype-$(FREETYPEVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure $(CONFIGARGS) --with-harfbuzz=no && $(TOOLOVERRIDES) $(MAKE) && cp objs/.libs/libfreetype.a ../ && cp -r include/ ../) + -test -f libs-$(ARCH)/libfreetype.a || (mkdir -p libs-$(ARCH) && cd libs-$(ARCH) && tar -xvzf ../freetype-$(FREETYPEVER).tar.gz && cd freetype-$(FREETYPEVER) && CFLAGS="$(CFLAGS) -Os" $(TOOLOVERRIDES) ./configure $(CONFIGARGS) --with-bzip2=no --with-harfbuzz=no && $(TOOLOVERRIDES) $(MAKE) && cp objs/.libs/libfreetype.a ../ && cp -r include/ ../) libs-$(ARCH)/libBulletDynamics.a: test -f bullet3-$(BULLETVER).tar.gz || wget https://github.com/bulletphysics/bullet3/archive/$(BULLETVER).tar.gz -O bullet3-$(BULLETVER).tar.gz diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 8c9945b8b..7662472f6 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -2259,7 +2259,7 @@ void SCR_SetUpToDrawConsole (void) Key_Dest_Add(kdm_console); } } - if (!con_stayhidden.ival && !startuppending && Key_Dest_Has(kdm_console) && !scr_drawloading && !scr_disabled_for_loading && cls.state < ca_connected) + if (Key_Dest_Has(kdm_console) || (!con_stayhidden.ival && !startuppending && !scr_drawloading && !scr_disabled_for_loading && cls.state < ca_connected)) scr_con_current = scr_conlines = vid.height * fullscreenpercent; else scr_conlines = 0; diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 784f55fa8..9c9cf8beb 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -184,6 +184,7 @@ extern sfx_t *cl_sfx_r_exp3; globalint(trace_surface_id, "trace_surface_id"); /*int written by traceline*/ \ globalint(trace_bone_id, "trace_bone_id"); /*int written by traceline*/ \ globalint(trace_triangle_id, "trace_triangle_id"); /*int written by traceline*/ \ + globalfloat(trace_networkentity, "trace_networkentity"); /*float written by traceline*/ \ legacycsqcglobals \ \ globalfloat(clientcommandframe, "clientcommandframe"); /*float the next frame that will be sent*/ \ @@ -415,6 +416,7 @@ static void CSQC_FindGlobals(qboolean nofuncs) ensureint(trace_surface_id); ensureint(trace_bone_id); ensureint(trace_triangle_id); + ensurefloat(trace_networkentity); ensureentity(trace_ent); @@ -2600,6 +2602,7 @@ static void cs_settracevars(pubprogfuncs_t *prinst, trace_t *tr) *csqcg.trace_ent = EDICT_TO_PROG(csqcprogs, (void*)tr->ent); else *csqcg.trace_ent = EDICT_TO_PROG(csqcprogs, (void*)csqc_world.edicts); + *csqcg.trace_networkentity = tr->entnum; #ifndef NOLEGACY *csqcg.trace_endcontentsf = tr->contents; @@ -7326,6 +7329,8 @@ qboolean CSQC_Init (qboolean anycsqc, const char *csprogsname, unsigned int chec csdatenabled = false; csprogsname = "csprogs.dat"; } + if (!*csprogsname) + csprogsname = "csprogs.dat"; if (csprogs_promiscuous != anycsqc || csprogs_checksum != checksum || csprogs_checksize != progssize || strcmp(csprogs_checkname,csprogsname)) CSQC_Shutdown(); csprogs_promiscuous = anycsqc; diff --git a/engine/common/fs.c b/engine/common/fs.c index 5cc22b430..78438f638 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -1741,11 +1741,12 @@ qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, char *out else snprintf(out, outlen, "%s%s", com_gamepath, fname); break; - case FS_BASEGAMEONLY: + + case FS_BASEGAMEONLY: // fte/ last = NULL; - for (i = 0; i < sizeof(fs_manifest->gamepath)/sizeof(fs_manifest->gamepath[0]); i++) + for (i = 0; i < countof(fs_manifest->gamepath); i++) { - if (fs_manifest->gamepath[i].base && fs_manifest->gamepath[i].path) + if (fs_manifest && fs_manifest->gamepath[i].base && fs_manifest->gamepath[i].path) { if (!strcmp(fs_manifest->gamepath[i].path, "*")) continue; @@ -1762,16 +1763,15 @@ qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, char *out else snprintf(out, outlen, "%s%s/%s", com_gamepath, last, fname); break; - case FS_PUBGAMEONLY: + case FS_PUBGAMEONLY: // $gamedir/ or qw/ but not fte/ last = NULL; - for (i = 0; i < sizeof(fs_manifest->gamepath)/sizeof(fs_manifest->gamepath[0]); i++) + for (i = 0; i < countof(fs_manifest->gamepath); i++) { - if (fs_manifest->gamepath[i].path) + if (fs_manifest && fs_manifest->gamepath[i].path) { if (*fs_manifest->gamepath[i].path == '*') continue; last = fs_manifest->gamepath[i].path; - break; } } if (!last) @@ -1781,16 +1781,15 @@ qboolean FS_NativePath(const char *fname, enum fs_relative relativeto, char *out else snprintf(out, outlen, "%s%s/%s", com_gamepath, last, fname); break; - case FS_PUBBASEGAMEONLY: + case FS_PUBBASEGAMEONLY: // qw/ (fixme: should be the last non-private basedir) last = NULL; - for (i = 0; i < sizeof(fs_manifest->gamepath)/sizeof(fs_manifest->gamepath[0]); i++) + for (i = 0; i < countof(fs_manifest->gamepath); i++) { if (fs_manifest && fs_manifest->gamepath[i].base && fs_manifest->gamepath[i].path) { if (*fs_manifest->gamepath[i].path == '*') continue; last = fs_manifest->gamepath[i].path; - break; } } if (!last) @@ -3610,9 +3609,9 @@ int FS_PureOkay(void) continue; else //if (!sp) { - if (!CL_CheckDLFile(va("package/%s", pname))) - if (CL_CheckOrEnqueDownloadFile(va("package/%s", pname), va("%s.%i", pname, crc), DLLF_NONGAME)) - return -1; +// if (!CL_CheckDLFile(va("package/%s", pname))) +// if (CL_CheckOrEnqueDownloadFile(pname, va("%s.%i", pname, crc), DLLF_NONGAME)) +// return -1; Con_Printf(CON_ERROR"Pure package %s:%08x missing.\n", pname, crc); ret = false; } @@ -3915,12 +3914,14 @@ static void FS_ReloadPackFilesFlags(unsigned int reloadflags) if (handle) { sp = FS_AddPathHandle(&oldpaths, pname, local, handle, "", SPF_COPYPROTECTED|SPF_UNTRUSTED|SPF_TEMPORARY|keptflags, (unsigned int)-1); + if (!sp) + continue; //some kind of error... if (sp->handle->GeneratePureCRC) { sp->crc_check = sp->handle->GeneratePureCRC(sp->handle, fs_pureseed, 0); sp->crc_reply = sp->handle->GeneratePureCRC(sp->handle, fs_pureseed, 1); } - if (sp->crc_check == crc || !*crctok) + if ((*crctok && sp->crc_check == crc) || !*crctok) { if (fs_puremode) { @@ -3932,6 +3933,7 @@ static void FS_ReloadPackFilesFlags(unsigned int reloadflags) lastpure = sp; } } + //else crc mismatched... continue; } vfs = FS_OpenVFS(local, "rb", FS_ROOT); @@ -3956,7 +3958,7 @@ static void FS_ReloadPackFilesFlags(unsigned int reloadflags) sp->crc_reply = sp->handle->GeneratePureCRC(sp->handle, fs_pureseed, 1); } - if (!*crctok) + if ((*crctok && sp->crc_check == crc) || !*crctok) { if (fs_puremode) { diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 119f5e44a..0d2884250 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -340,7 +340,13 @@ static qboolean Shader_EvaluateCondition(shader_t *shader, char **ptr) else if (!Q_stricmp(token, "d3d11")) lhs = (qrenderer == QR_DIRECT3D11); else if (!Q_stricmp(token, "gles")) - lhs = ((qrenderer == QR_OPENGL) && sh_config.minver == 100); + { +#ifdef GLQUAKE + lhs = ((qrenderer == QR_OPENGL) && gl_config.gles); +#else + lhs = false; +#endif + } else if (!Q_stricmp(token, "nofixed")) lhs = sh_config.progs_required; else if (!Q_stricmp(token, "glsl")) diff --git a/engine/gl/gl_vidlinuxglx.c b/engine/gl/gl_vidlinuxglx.c index f912df4ce..e3cc280fc 100644 --- a/engine/gl/gl_vidlinuxglx.c +++ b/engine/gl/gl_vidlinuxglx.c @@ -736,6 +736,8 @@ static qboolean XRandR_Init(void) ) xrandr.canmodechange12 = true; } + + //FIXME: query monitor sizes and calculate dpi for vid.dpy_[x|y] return true; } } diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index ed4a94d48..e640c526b 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -11849,6 +11849,7 @@ void PR_DumpPlatform_f(void) {"trace_surface_id", "int", QW|NQ|CS, D("1-based. 0 if not known.")}, {"trace_bone_id", "int", QW|NQ|CS, D("1-based. 0 if not known. typically needs MOVE_HITMODEL.")}, {"trace_triangle_id", "int", QW|NQ|CS, D("1-based. 0 if not known.")}, + {"trace_networkentity", "int", CS, D("Repots which ssqc entnum was hit when a csqc traceline impacts an ssqc-based brush entity.")}, {"global_gravitydir", "vector", QW|NQ|CS, D("The direction gravity should act in if not otherwise specified per entity."), 0,"'0 0 -1'"}, {"serverid", "int", QW|NQ|CS, D("The unique id of this server within the server cluster.")}, diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 43f554107..25797e6d7 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -1009,6 +1009,22 @@ void SV_SendClientPrespawnInfo(client_t *client) while (client->netchan.message.cursize < maxsize) { if (client->prespawn_idx == 0) + { + FS_GetPackNames(buffer, sizeof(buffer), 2, true); /*retain extensions, or we'd have to assume pk3*/ + ClientReliableWrite_Begin(client, svc_stufftext, 1+11+strlen(buffer)+1+1); + ClientReliableWrite_SZ(client, "//paknames ", 11); + ClientReliableWrite_SZ(client, buffer, strlen(buffer)); + ClientReliableWrite_String(client, "\n"); + } + else if (client->prespawn_idx == 1) + { + FS_GetPackHashes(buffer, sizeof(buffer), false); + ClientReliableWrite_Begin(client, svc_stufftext, 1+7+strlen(buffer)+1+1); + ClientReliableWrite_SZ(client, "//paks ", 7); + ClientReliableWrite_SZ(client, buffer, strlen(buffer)); + ClientReliableWrite_String(client, "\n"); + } + else if (client->prespawn_idx == 2) { if (!ISNQCLIENT(client) || (client->fteprotocolextensions2 & PEXT2_PREDINFO)) { //nq does not normally get serverinfo sent to it. @@ -1023,22 +1039,6 @@ void SV_SendClientPrespawnInfo(client_t *client) ClientReliableWrite_String (client, va("//fullserverinfo \"%s\"\n", buffer) ); } } - else if (client->prespawn_idx == 1) - { - FS_GetPackNames(buffer, sizeof(buffer), 2, true); /*retain extensions, or we'd have to assume pk3*/ - ClientReliableWrite_Begin(client, svc_stufftext, 1+11+strlen(buffer)+1+1); - ClientReliableWrite_SZ(client, "//paknames ", 11); - ClientReliableWrite_SZ(client, buffer, strlen(buffer)); - ClientReliableWrite_String(client, "\n"); - } - else if (client->prespawn_idx == 2) - { - FS_GetPackHashes(buffer, sizeof(buffer), false); - ClientReliableWrite_Begin(client, svc_stufftext, 1+7+strlen(buffer)+1+1); - ClientReliableWrite_SZ(client, "//paks ", 7); - ClientReliableWrite_SZ(client, buffer, strlen(buffer)); - ClientReliableWrite_String(client, "\n"); - } else if (client->prespawn_idx == 3) { if (ISNQCLIENT(client) && (client->fteprotocolextensions2 & PEXT2_PREDINFO)) diff --git a/engine/server/world.c b/engine/server/world.c index c417d30b1..c82a8e4d7 100644 --- a/engine/server/world.c +++ b/engine/server/world.c @@ -2331,8 +2331,8 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip) trace.ent = clip->trace.ent; //something else hit earlier, that one gets the trace entity, but not the fraction. yeah, combining traces like this was always going to be weird. else { - trace.ent = NULL; - clip->trace.entnum = touch->number; + trace.ent = w->edicts; //misreport world + clip->trace.entnum = touch->number; //with an ssqc ent number } clip->trace = trace; } @@ -2344,8 +2344,8 @@ static void World_ClipToNetwork (world_t *w, moveclip_t *clip) if (!clip->trace.ent || trace.fraction == clip->trace.fraction) //xonotic requires that second test (DP has no check at all, which would end up reporting mismatched fraction/ent results, so yuck). { clip->trace.contents = trace.contents; - clip->trace.ent = NULL; - clip->trace.entnum = touch->number; + clip->trace.ent = w->edicts; //misreport world + clip->trace.entnum = touch->number; //with an ssqc ent number } } }