From 97f207e2306c4c066f8ffcdf3dc621697e275823 Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Wed, 12 Jun 2024 23:52:48 +0300 Subject: [PATCH] maps: cleanup maptype cvar code --- src/client/refresh/files/maps.c | 5 ++--- src/client/refresh/files/models.c | 1 + src/client/refresh/gl1/gl1_main.c | 2 +- src/client/refresh/gl1/gl1_model.c | 4 ++-- src/client/refresh/gl1/header/local.h | 5 ----- src/client/refresh/gl3/gl3_model.c | 4 ++-- src/client/refresh/gl4/gl4_model.c | 4 ++-- src/client/refresh/ref_shared.h | 6 ++---- src/client/refresh/soft/sw_model.c | 4 ++-- src/client/refresh/vk/vk_model.c | 4 ++-- src/common/frame.c | 2 ++ 11 files changed, 18 insertions(+), 23 deletions(-) diff --git a/src/client/refresh/files/maps.c b/src/client/refresh/files/maps.c index 1251b684..884b8118 100644 --- a/src/client/refresh/files/maps.c +++ b/src/client/refresh/files/maps.c @@ -562,7 +562,7 @@ Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header, const char *lumpname, } const bspx_header_t * -Mod_LoadBSPX(int filesize, const byte *mod_base, maptype_t maptype) +Mod_LoadBSPX(int filesize, const byte *mod_base) { const bspx_header_t *xheader; const dheader_t *header; @@ -1016,8 +1016,7 @@ calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *t } int -Mod_CalcNonModelLumpHunkSize(const byte *mod_base, const dheader_t *header, - maptype_t maptype) +Mod_CalcNonModelLumpHunkSize(const byte *mod_base, const dheader_t *header) { int hunkSize = 0; diff --git a/src/client/refresh/files/models.c b/src/client/refresh/files/models.c index 32225314..0c77eda2 100644 --- a/src/client/refresh/files/models.c +++ b/src/client/refresh/files/models.c @@ -2257,6 +2257,7 @@ Mod_LoadModel_Flex(const char *mod_name, const void *buffer, int modfilelen, __func__, blockname, version); return NULL; } + /* 516 mesh node size */ if (size != (num_mesh_nodes * 516)) { diff --git a/src/client/refresh/gl1/gl1_main.c b/src/client/refresh/gl1/gl1_main.c index 82c9a14d..6c405ce6 100644 --- a/src/client/refresh/gl1/gl1_main.c +++ b/src/client/refresh/gl1/gl1_main.c @@ -417,7 +417,7 @@ R_DrawEntitiesOnList(void) R_EnableMultitexture(false); } -void +static void R_DrawParticles2(int num_particles, const particle_t particles[], const unsigned *colortable) { diff --git a/src/client/refresh/gl1/gl1_model.c b/src/client/refresh/gl1/gl1_model.c index b040e65c..2656fb69 100644 --- a/src/client/refresh/gl1/gl1_model.c +++ b/src/client/refresh/gl1/gl1_model.c @@ -311,10 +311,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) header = (dheader_t *)mod_base; /* check for BSPX extensions */ - bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr); + bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base); // calculate the needed hunksize from the lumps - hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr); + hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header); hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS], sizeof(dmodel_t), sizeof(model_t), 0); diff --git a/src/client/refresh/gl1/header/local.h b/src/client/refresh/gl1/header/local.h index e4bce6aa..0fc9879a 100644 --- a/src/client/refresh/gl1/header/local.h +++ b/src/client/refresh/gl1/header/local.h @@ -314,11 +314,6 @@ void glCheckError_(const char *file, const char *function, int line); #define glEnd() glEnd(); glCheckError_(__FILE__, __func__, __LINE__) #endif -/* GL extension emulation functions */ -void R_DrawParticles2(int n, - const particle_t particles[], - const unsigned *colortable); - /* * GL config stuff */ diff --git a/src/client/refresh/gl3/gl3_model.c b/src/client/refresh/gl3/gl3_model.c index 8fe1d7b3..20089aa8 100644 --- a/src/client/refresh/gl3/gl3_model.c +++ b/src/client/refresh/gl3/gl3_model.c @@ -312,10 +312,10 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen) header = (dheader_t *)mod_base; /* check for BSPX extensions */ - bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr); + bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base); // calculate the needed hunksize from the lumps - hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr); + hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header); hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS], sizeof(dmodel_t), sizeof(gl3model_t), 0); diff --git a/src/client/refresh/gl4/gl4_model.c b/src/client/refresh/gl4/gl4_model.c index baefec1d..c80f1243 100644 --- a/src/client/refresh/gl4/gl4_model.c +++ b/src/client/refresh/gl4/gl4_model.c @@ -312,10 +312,10 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen) header = (dheader_t *)mod_base; /* check for BSPX extensions */ - bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr); + bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base); // calculate the needed hunksize from the lumps - hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr); + hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header); hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS], sizeof(dmodel_t), sizeof(gl4model_t), 0); diff --git a/src/client/refresh/ref_shared.h b/src/client/refresh/ref_shared.h index eff8cb08..29bca151 100644 --- a/src/client/refresh/ref_shared.h +++ b/src/client/refresh/ref_shared.h @@ -368,11 +368,9 @@ extern void Mod_LoadSurfedges(const char *name, int **surfedges, int *numsurfedg extern mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node); extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header, const char *lumpname, int *plumpsize, const byte *mod_base); -extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base, - maptype_t maptype); +extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base); extern int Mod_LoadBSPXDecoupledLM(const dlminfo_t* lminfos, int surfnum, msurface_t *out); -extern int Mod_CalcNonModelLumpHunkSize(const byte *mod_base, const dheader_t *header, - maptype_t maptype); +extern int Mod_CalcNonModelLumpHunkSize(const byte *mod_base, const dheader_t *header); /* Surface logic */ #define DLIGHT_CUTOFF 64 diff --git a/src/client/refresh/soft/sw_model.c b/src/client/refresh/soft/sw_model.c index 91506a49..f3f9d1c2 100644 --- a/src/client/refresh/soft/sw_model.c +++ b/src/client/refresh/soft/sw_model.c @@ -319,10 +319,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) header = (dheader_t *)mod_base; /* check for BSPX extensions */ - bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr); + bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base); // calculate the needed hunksize from the lumps - hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr); + hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header); hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS], sizeof(dmodel_t), sizeof(model_t), 0); diff --git a/src/client/refresh/vk/vk_model.c b/src/client/refresh/vk/vk_model.c index 307bac46..af8e729c 100644 --- a/src/client/refresh/vk/vk_model.c +++ b/src/client/refresh/vk/vk_model.c @@ -286,10 +286,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen) header = (dheader_t *)mod_base; /* check for BSPX extensions */ - bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr); + bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base); // calculate the needed hunksize from the lumps - hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr); + hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header); hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS], sizeof(dmodel_t), sizeof(model_t), 0); diff --git a/src/common/frame.c b/src/common/frame.c index f08db6c7..0bf06f59 100644 --- a/src/common/frame.c +++ b/src/common/frame.c @@ -332,6 +332,8 @@ Qcommon_Init(int argc, char **argv) the settings of the config files */ Cbuf_AddEarlyCommands(false); Cbuf_Execute(); + /* Set default maptype */ + Cvar_Get("maptype", "0", CVAR_ARCHIVE); // remember the initial game name that might have been set on commandline {