maps: cleanup maptype cvar code

This commit is contained in:
Denis Pauk 2024-06-12 23:52:48 +03:00
parent 1775874418
commit 97f207e230
11 changed files with 18 additions and 23 deletions

View file

@ -562,7 +562,7 @@ Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header, const char *lumpname,
} }
const bspx_header_t * 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 bspx_header_t *xheader;
const dheader_t *header; const dheader_t *header;
@ -1016,8 +1016,7 @@ calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *t
} }
int int
Mod_CalcNonModelLumpHunkSize(const byte *mod_base, const dheader_t *header, Mod_CalcNonModelLumpHunkSize(const byte *mod_base, const dheader_t *header)
maptype_t maptype)
{ {
int hunkSize = 0; int hunkSize = 0;

View file

@ -2257,6 +2257,7 @@ Mod_LoadModel_Flex(const char *mod_name, const void *buffer, int modfilelen,
__func__, blockname, version); __func__, blockname, version);
return NULL; return NULL;
} }
/* 516 mesh node size */ /* 516 mesh node size */
if (size != (num_mesh_nodes * 516)) if (size != (num_mesh_nodes * 516))
{ {

View file

@ -417,7 +417,7 @@ R_DrawEntitiesOnList(void)
R_EnableMultitexture(false); R_EnableMultitexture(false);
} }
void static void
R_DrawParticles2(int num_particles, const particle_t particles[], R_DrawParticles2(int num_particles, const particle_t particles[],
const unsigned *colortable) const unsigned *colortable)
{ {

View file

@ -311,10 +311,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
header = (dheader_t *)mod_base; header = (dheader_t *)mod_base;
/* check for BSPX extensions */ /* 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 // 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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
sizeof(dmodel_t), sizeof(model_t), 0); sizeof(dmodel_t), sizeof(model_t), 0);

View file

@ -314,11 +314,6 @@ void glCheckError_(const char *file, const char *function, int line);
#define glEnd() glEnd(); glCheckError_(__FILE__, __func__, __LINE__) #define glEnd() glEnd(); glCheckError_(__FILE__, __func__, __LINE__)
#endif #endif
/* GL extension emulation functions */
void R_DrawParticles2(int n,
const particle_t particles[],
const unsigned *colortable);
/* /*
* GL config stuff * GL config stuff
*/ */

View file

@ -312,10 +312,10 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
header = (dheader_t *)mod_base; header = (dheader_t *)mod_base;
/* check for BSPX extensions */ /* 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 // 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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
sizeof(dmodel_t), sizeof(gl3model_t), 0); sizeof(dmodel_t), sizeof(gl3model_t), 0);

View file

@ -312,10 +312,10 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
header = (dheader_t *)mod_base; header = (dheader_t *)mod_base;
/* check for BSPX extensions */ /* 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 // 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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
sizeof(dmodel_t), sizeof(gl4model_t), 0); sizeof(dmodel_t), sizeof(gl4model_t), 0);

View file

@ -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 mleaf_t *Mod_PointInLeaf(const vec3_t p, mnode_t *node);
extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header, extern const void *Mod_LoadBSPXFindLump(const bspx_header_t *bspx_header,
const char *lumpname, int *plumpsize, const byte *mod_base); const char *lumpname, int *plumpsize, const byte *mod_base);
extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base, extern const bspx_header_t *Mod_LoadBSPX(int filesize, const byte *mod_base);
maptype_t maptype);
extern int Mod_LoadBSPXDecoupledLM(const dlminfo_t* lminfos, int surfnum, msurface_t *out); 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, extern int Mod_CalcNonModelLumpHunkSize(const byte *mod_base, const dheader_t *header);
maptype_t maptype);
/* Surface logic */ /* Surface logic */
#define DLIGHT_CUTOFF 64 #define DLIGHT_CUTOFF 64

View file

@ -319,10 +319,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
header = (dheader_t *)mod_base; header = (dheader_t *)mod_base;
/* check for BSPX extensions */ /* 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 // 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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
sizeof(dmodel_t), sizeof(model_t), 0); sizeof(dmodel_t), sizeof(model_t), 0);

View file

@ -286,10 +286,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
header = (dheader_t *)mod_base; header = (dheader_t *)mod_base;
/* check for BSPX extensions */ /* 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 // 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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
sizeof(dmodel_t), sizeof(model_t), 0); sizeof(dmodel_t), sizeof(model_t), 0);

View file

@ -332,6 +332,8 @@ Qcommon_Init(int argc, char **argv)
the settings of the config files */ the settings of the config files */
Cbuf_AddEarlyCommands(false); Cbuf_AddEarlyCommands(false);
Cbuf_Execute(); Cbuf_Execute();
/* Set default maptype */
Cvar_Get("maptype", "0", CVAR_ARCHIVE);
// remember the initial game name that might have been set on commandline // remember the initial game name that might have been set on commandline
{ {