mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
cmodels: Add quake2 map type for remove all ReRelease flags
This commit is contained in:
parent
119e1f6993
commit
85dcc852b7
9 changed files with 97 additions and 16 deletions
|
@ -316,10 +316,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
|||
header = (dheader_t *)mod_base;
|
||||
|
||||
/* check for BSPX extensions */
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2);
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr);
|
||||
|
||||
// calculate the needed hunksize from the lumps
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2);
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(model_t), 0);
|
||||
|
|
|
@ -317,10 +317,10 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int filelen)
|
|||
header = (dheader_t *)mod_base;
|
||||
|
||||
/* check for BSPX extensions */
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2);
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr);
|
||||
|
||||
// calculate the needed hunksize from the lumps
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2);
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(gl3model_t), 0);
|
||||
|
|
|
@ -317,10 +317,10 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int filelen)
|
|||
header = (dheader_t *)mod_base;
|
||||
|
||||
/* check for BSPX extensions */
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2);
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr);
|
||||
|
||||
// calculate the needed hunksize from the lumps
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2);
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(gl4model_t), 0);
|
||||
|
|
|
@ -324,10 +324,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
|||
header = (dheader_t *)mod_base;
|
||||
|
||||
/* check for BSPX extensions */
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2);
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr);
|
||||
|
||||
// calculate the needed hunksize from the lumps
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2);
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(model_t), 0);
|
||||
|
|
|
@ -291,10 +291,10 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int filelen)
|
|||
header = (dheader_t *)mod_base;
|
||||
|
||||
/* check for BSPX extensions */
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2);
|
||||
bspx_header = Mod_LoadBSPX(modfilelen, (byte*)mod_base, map_quake2rr);
|
||||
|
||||
// calculate the needed hunksize from the lumps
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2);
|
||||
hunkSize = Mod_CalcNonModelLumpHunkSize(mod_base, header, map_quake2rr);
|
||||
|
||||
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_MODELS],
|
||||
sizeof(dmodel_t), sizeof(model_t), 0);
|
||||
|
|
|
@ -202,6 +202,7 @@ Mod_LoadContextConvertFlags(int flags, maptype_t maptype)
|
|||
|
||||
switch (maptype)
|
||||
{
|
||||
case map_quake2: convert = quake2_contents_flags; break;
|
||||
case map_heretic2: convert = heretic2_contents_flags; break;
|
||||
case map_daikatana: convert = daikatana_contents_flags; break;
|
||||
case map_kingpin: convert = kingpin_contents_flags; break;
|
||||
|
@ -1045,6 +1046,7 @@ Mod_MaptypeName(maptype_t maptype)
|
|||
|
||||
switch(maptype)
|
||||
{
|
||||
case map_quake2rr: maptypename = "Quake2 ReRelease"; break;
|
||||
case map_quake2: maptypename = "Quake2"; break;
|
||||
case map_heretic2: maptypename = "Heretic 2"; break;
|
||||
case map_daikatana: maptypename = "Daikatana"; break;
|
||||
|
@ -1088,13 +1090,13 @@ Mod_LoadGetRules(const dheader_t *header, const rule_t **rules)
|
|||
else if (header->version == BSPVERSION)
|
||||
{
|
||||
*rules = idbsplumps;
|
||||
return map_quake2;
|
||||
return map_quake2rr;
|
||||
}
|
||||
}
|
||||
else if (header->ident == QBSPHEADER && header->version == BSPVERSION)
|
||||
{
|
||||
*rules = qbsplumps;
|
||||
return map_quake2;
|
||||
return map_quake2rr;
|
||||
}
|
||||
else if (header->ident == RBSPHEADER && header->version == BSPSINVERSION)
|
||||
{
|
||||
|
@ -1103,7 +1105,7 @@ Mod_LoadGetRules(const dheader_t *header, const rule_t **rules)
|
|||
}
|
||||
|
||||
*rules = NULL;
|
||||
return map_quake2;
|
||||
return map_quake2rr;
|
||||
}
|
||||
|
||||
byte *
|
||||
|
@ -1126,7 +1128,7 @@ Mod_Load2QBSP(const char *name, byte *inbuf, size_t filesize, size_t *out_len,
|
|||
result_size = sizeof(dheader_t);
|
||||
|
||||
detected_maptype = Mod_LoadGetRules(&header, &rules);
|
||||
if (detected_maptype != map_quake2)
|
||||
if (detected_maptype != map_quake2rr)
|
||||
{
|
||||
/* Use detected maptype only if for sure know */
|
||||
*maptype = detected_maptype;
|
||||
|
|
|
@ -132,6 +132,7 @@ static cbrush_t *box_brush;
|
|||
static cleaf_t *box_leaf;
|
||||
static cplane_t *box_planes;
|
||||
static cvar_t *map_noareas;
|
||||
static cvar_t *r_maptype;
|
||||
static int box_headnode;
|
||||
static int checkcount;
|
||||
static int floodvalid;
|
||||
|
@ -1744,7 +1745,7 @@ CM_LoadCachedMap(const char *name, model_t *mod)
|
|||
{
|
||||
int filelen, hunkSize = 0;
|
||||
byte *cmod_base, *filebuf;
|
||||
maptype_t maptype = map_quake2;
|
||||
maptype_t maptype;
|
||||
dheader_t *header;
|
||||
size_t length;
|
||||
|
||||
|
@ -1758,6 +1759,8 @@ CM_LoadCachedMap(const char *name, model_t *mod)
|
|||
|
||||
mod->checksum = LittleLong(Com_BlockChecksum(filebuf, filelen));
|
||||
|
||||
/* Can't detect will use provided */
|
||||
maptype = r_maptype->value;
|
||||
cmod_base = Mod_Load2QBSP(name, (byte *)filebuf, filelen, &length, &maptype);
|
||||
header = (dheader_t *)cmod_base;
|
||||
|
||||
|
@ -1848,6 +1851,7 @@ CM_LoadMap(const char *name, qboolean clientload, unsigned *checksum)
|
|||
int i, sec_start;
|
||||
|
||||
map_noareas = Cvar_Get("map_noareas", "0", 0);
|
||||
r_maptype = Cvar_Get("maptype", "0", CVAR_ARCHIVE);
|
||||
|
||||
if (!name[0])
|
||||
{
|
||||
|
|
|
@ -41,12 +41,13 @@
|
|||
|
||||
typedef enum
|
||||
{
|
||||
map_quake2 = 0,
|
||||
map_quake2rr = 0,
|
||||
map_heretic2 = 1,
|
||||
map_daikatana = 2,
|
||||
map_kingpin = 3,
|
||||
map_anachronox = 4,
|
||||
map_sin = 5,
|
||||
map_quake2 = 6,
|
||||
} maptype_t;
|
||||
|
||||
extern int Mod_CalcLumpHunkSize(const lump_t *l, int inSize, int outSize, int extra);
|
||||
|
|
|
@ -24,6 +24,80 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Based on https://github.com/TrenchBroom/
|
||||
*/
|
||||
static const int quake2_flags[32] = {
|
||||
SURF_LIGHT, /* 0: value will hold the light strength */
|
||||
SURF_SLICK, /* 1: effects game physics */
|
||||
SURF_SKY, /* 2: don't draw, but add to skybox */
|
||||
SURF_WARP, /* 3: The surface warps (like water textures do) */
|
||||
SURF_TRANS33, /* 4: The surface is 33% transparent */
|
||||
SURF_TRANS66, /* 5: The surface is 66% transparent */
|
||||
SURF_FLOWING, /* 6: The texture wraps in a downward 'flowing' pattern
|
||||
* (warp must also be set) */
|
||||
SURF_NODRAW, /* 7: Used for non-fixed-size brush triggers and clip brushes */
|
||||
0, /* 8: Unused */
|
||||
0, /* 9: Unused */
|
||||
0, /* 10: Unused */
|
||||
0, /* 11: Unused */
|
||||
0, /* 12: Unused */
|
||||
0, /* 13: Unused */
|
||||
0, /* 14: Unused */
|
||||
0, /* 15: Unused */
|
||||
0, /* 16: Unused */
|
||||
0, /* 17: Unused */
|
||||
0, /* 18: Unused */
|
||||
0, /* 19: Unused */
|
||||
0, /* 20: Unused */
|
||||
0, /* 21: Unused */
|
||||
0, /* 22: Unused */
|
||||
0, /* 23: Unused */
|
||||
0, /* 24: Unused */
|
||||
0, /* 25: Unused */
|
||||
0, /* 26: Unused */
|
||||
0, /* 27: Unused */
|
||||
0, /* 28: Unused */
|
||||
0, /* 29: Unused */
|
||||
0, /* 30: Unused */
|
||||
0, /* 31: Unused */
|
||||
};
|
||||
|
||||
static const int quake2_contents_flags[32] = {
|
||||
CONTENTS_SOLID, /* 0: Default for all brushes */
|
||||
CONTENTS_WINDOW, /* 1: translucent, but not watery */
|
||||
CONTENTS_AUX, /* 2: Unused by the engine */
|
||||
CONTENTS_LAVA, /* 3: The brush is lava */
|
||||
CONTENTS_SLIME, /* 4: The brush is slime */
|
||||
CONTENTS_WATER, /* 5: The brush is water */
|
||||
CONTENTS_MIST, /* 6: The brush is non-solid */
|
||||
0, /* 7: Unused */
|
||||
0, /* 8: Unused */
|
||||
0, /* 9: Unused */
|
||||
0, /* 10: Unused */
|
||||
0, /* 11: Unused */
|
||||
0, /* 12: Unused */
|
||||
0, /* 13: Unused */
|
||||
0, /* 14: Unused */
|
||||
CONTENTS_AREAPORTAL, /* 15: Area portal */
|
||||
CONTENTS_PLAYERCLIP, /* 16: Player cannot pass through the brush (other things can) */
|
||||
CONTENTS_MONSTERCLIP, /* 17: Monster cannot pass through the brush (player and other things can) */
|
||||
CONTENTS_CURRENT_0, /* 18: Brush has a current in direction of 0 degrees */
|
||||
CONTENTS_CURRENT_90, /* 19: Brush has a current in direction of 90 degrees */
|
||||
CONTENTS_CURRENT_180, /* 20: Brush has a current in direction of 180 degrees */
|
||||
CONTENTS_CURRENT_270, /* 21: Brush has a current in direction of 270 degrees */
|
||||
CONTENTS_CURRENT_UP, /* 22: Brush has a current in the up direction */
|
||||
CONTENTS_CURRENT_DOWN, /* 23: Brush has a current in the down direction */
|
||||
CONTENTS_ORIGIN, /* 24: Special brush used for specifying origin of rotation for rotating brushes*/
|
||||
CONTENTS_MONSTER, /* 25: Purpose unknown / monster */
|
||||
CONTENTS_DEADMONSTER, /* 26: Purpose unknown / deadmonster */
|
||||
CONTENTS_DETAIL, /* 27: Detail brush */
|
||||
CONTENTS_TRANSLUCENT, /* 28: Use for opaque water that does not block vis */
|
||||
CONTENTS_LADDER, /* 29: Brushes with this flag allow a player to move up and down a vertical surface */
|
||||
0, /* 30: Doesn't block camera */
|
||||
0, /* 31: Unused */
|
||||
};
|
||||
|
||||
/*
|
||||
* Based on https://github.com/TrenchBroom/
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue