From 11e41f1e7d2ae254e333b70138ac4f6d2ff1fa4c Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 28 Mar 2020 01:46:25 +0000 Subject: [PATCH] Fix some Q2 issues. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5659 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- CMakeLists.txt | 1 + engine/client/cl_parse.c | 17 ++++++++++++----- engine/client/client.h | 1 + engine/client/image.c | 2 +- engine/client/m_download.c | 10 ++++++++-- engine/common/common.c | 2 +- engine/common/gl_q2bsp.c | 13 ++++++++----- engine/gl/gl_model.c | 2 +- 8 files changed, 33 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a0f5ed51..26a7a4ec7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -480,6 +480,7 @@ SET(FTE_COMMON_FILES engine/common/config_nocompat.h engine/common/config_wastes.h engine/common/config_freecs.h + engine/common/config_fteqw_noweb.h #useless headers that I'll never search for engine/client/api_menu.h diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 7238a8ca9..1579144da 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -1393,6 +1393,11 @@ static int CL_LoadModels(int stage, qboolean dontactuallyload) if (cl.worldmodel && cl.worldmodel->loadstate == MLS_LOADING) return -1; +#ifdef Q2CLIENT + if (cl.worldmodel && cl.worldmodel->checksum != cl.q2mapchecksum) + Host_EndGame("Local map version differs from server: %i != '%i'\n", cl.worldmodel->checksum, cl.q2mapchecksum); +#endif + SCR_SetLoadingFile("csprogs world"); #ifdef CSQC_DAT @@ -4517,18 +4522,20 @@ static void CLQ2_ParseConfigString (void) } else if (i == Q2CS_MAPCHECKSUM) { - int serverchecksum = atoi(s); + int serverchecksum = (int)strtol(s, NULL, 10); int mapchecksum = 0; - if (cl.worldmodel) { if (cl.worldmodel->loadstate == MLS_LOADING) COM_WorkerPartialSync(cl.worldmodel, &cl.worldmodel->loadstate, MLS_LOADING); mapchecksum = cl.worldmodel->checksum; + + // the Q2 client normally exits here, however for our purposes we might as well ignore it + if (mapchecksum != serverchecksum) + Con_Printf(CON_WARNING "WARNING: Client checksum does not match server checksum (%i != %i)", mapchecksum, serverchecksum); } - // the Q2 client normally exits here, however for our purposes we might as well ignore it - if (mapchecksum != serverchecksum) - Con_Printf(CON_WARNING "WARNING: Client checksum does not match server checksum (%i != %i)", mapchecksum, serverchecksum); + + cl.q2mapchecksum = serverchecksum; } } #endif diff --git a/engine/client/client.h b/engine/client/client.h index 5b7ae0f14..e98cd9280 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -941,6 +941,7 @@ typedef struct char q2airaccel[16]; char q2statusbar[1024]; char q2layout[MAX_SPLITS][1024]; + int q2mapchecksum; int parse_entities; float lerpfrac; float q2svnetrate; //number of frames we expect to receive per second (required to calculate the server time correctly). diff --git a/engine/client/image.c b/engine/client/image.c index eb4865605..022ab3f61 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -33,7 +33,7 @@ static void QDECL R_Image_BuggyCvar (struct cvar_s *var, char *oldvalue) if (!*var->string) var->ival = var->value = true; } -cvar_t r_keepimages = CVARCD("r_keepimages", "", R_Image_BuggyCvar, "Retain unused images in memory for slightly faster map loading. FIXME: a setting of 0 may be crashy! (empty is treated as 1 for now)"); +cvar_t r_keepimages = CVARCD("r_keepimages", "", R_Image_BuggyCvar, "Retain unused images in memory for slightly faster map loading. FIXME: a setting of 0 may be crashy! (empty is treated as 1 for now).\n0: Redundant images will be purged after each map change.\n1: Images will be retained until vid_reload (potentially consuming a lot of ram)."); cvar_t r_ignoremapprefixes = CVARCD("r_ignoremapprefixes", "", R_Image_BuggyCvar, "Ignores when textures were loaded from map-specific paths. FIXME: empty is currently interpretted as 1 because the alternative is too memory hungary with r_keepimages 1."); char *r_defaultimageextensions = diff --git a/engine/client/m_download.c b/engine/client/m_download.c index 04fbfd05c..57983622f 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -209,7 +209,9 @@ static int downloadablessequence; //bumped any time any package is purged static void PM_WriteInstalledPackages(void); static void PM_PreparePackageList(void); +#ifdef WEBCLIENT static qboolean PM_SignatureOkay(package_t *p); +#endif static void PM_FreePackage(package_t *p) { @@ -1601,10 +1603,10 @@ static qboolean PM_MarkPackage(package_t *package, unsigned int markflag) package->flags &= ~DPF_PURGE; return false; } -#endif - +#else if (!PM_SignatureOkay(package)) return false; +#endif //any file-conflicts prevent the package from being installable. //this is mostly for pak1.pak @@ -3661,8 +3663,10 @@ static void MD_Draw (int x, int y, struct menucustom_s *c, struct emenu_s *m) if (!PM_CheckPackageFeatures(p)) Draw_FunStringWidth(0, y, "!", x+8, true, true); +#ifdef WEBCLIENT if (!PM_SignatureOkay(p)) Draw_FunStringWidth(0, y, "^b!", x+8, true, true); +#endif // if (!(p->flags & (DPF_ENABLED|DPF_MARKED|DPF_PRESENT)) // continue; @@ -3912,6 +3916,7 @@ static int MD_AddItemsToDownloadMenu(emenu_t *m, int y, const char *pathprefix) } } } +#ifdef WEBCLIENT if (!PM_SignatureOkay(p)) { if (!p->signature) @@ -3923,6 +3928,7 @@ static int MD_AddItemsToDownloadMenu(emenu_t *m, int y, const char *pathprefix) else head = va(CON_ERROR"Unable to verify signature"CON_DEFAULT"\n%s", head?head:""); //clientside problem. } +#endif if (head && desc) desc = va("%s\n%s", head, desc); diff --git a/engine/common/common.c b/engine/common/common.c index 8691ffba2..b23c7edbb 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -4950,7 +4950,7 @@ static void COM_Version_f (void) #endif //print out which libraries are disabled - Con_Printf("^3Compression:^7\n"); + Con_Printf("^3Compression:^7"); #ifdef AVAIL_ZLIB Con_Printf(" zlib^h(" #ifdef ZLIB_STATIC diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 8706fadc9..7cb0fd4e4 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -1323,9 +1323,11 @@ static texture_t *Mod_LoadWall(model_t *loadmodel, char *mapname, char *texname, wal->width = 64; wal->height = 64; } - - wal->width = LittleLong(wal->width); - wal->height = LittleLong(wal->height); + else + { + wal->width = LittleLong(wal->width); + wal->height = LittleLong(wal->height); + } { int i; @@ -1339,8 +1341,8 @@ static texture_t *Mod_LoadWall(model_t *loadmodel, char *mapname, char *texname, tex = ZG_Malloc(&loadmodel->memgroup, sizeof(texture_t)); - tex->vwidth = wal->width; - tex->vheight = wal->height; + tex->vwidth = tex->srcwidth = wal->width; + tex->vheight = tex->srcheight = wal->height; if (!tex->vwidth || !tex->vheight || wal == &replacementwal) { @@ -1377,6 +1379,7 @@ static texture_t *Mod_LoadWall(model_t *loadmodel, char *mapname, char *texname, (wal->width>>3)*(wal->height>>3); tex->srcdata = out = BZ_Malloc(size); + tex->srcfmt = TF_MIP4_8PAL24_T255; tex->palette = host_basepal; memcpy(out, (qbyte *)wal + wal->offsets[0], (wal->width>>0)*(wal->height>>0)); out += (wal->width>>0)*(wal->height>>0); diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index dcf9f017e..8c70107ea 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -5151,7 +5151,7 @@ void ModBrush_LoadGLStuff(void *ctx, void *data, size_t a, size_t b) // maps |= SHADER_HASNORMALMAP; if (gl_specular.ival) maps |= SHADER_HASGLOSS; - R_BuildLegacyTexnums(mod->textures[a]->shader, mod->textures[a]->name, loadname, maps, IF_WORLDTEX, TF_MIP4_8PAL24_T255, mod->textures[a]->srcwidth, mod->textures[a]->srcheight, mod->textures[a]->srcdata, mod->textures[a]->palette); + R_BuildLegacyTexnums(mod->textures[a]->shader, mod->textures[a]->name, loadname, maps, IF_WORLDTEX, mod->textures[a]->srcfmt, mod->textures[a]->srcwidth, mod->textures[a]->srcheight, mod->textures[a]->srcdata, mod->textures[a]->palette); BZ_Free(mod->textures[a]->srcdata); mod->textures[a]->srcdata = NULL; }