maps: add little bit knowledge about SIN

Without real implementation for now
This commit is contained in:
Denis Pauk 2024-04-06 18:09:46 +03:00
parent a7d3bb7573
commit 51419ffc63
11 changed files with 114 additions and 39 deletions

View file

@ -67,6 +67,7 @@ Maps support:
| ------ | ------- | ------------------------------------------ |
| IBSP | 39 | Quake 2 / Anachronox / Kingpin / Heretic 2 |
| IBSP | 41 | Daikatana / SIN |
| RBSP | 1 | SIN |
| QBSP | 39 | Quake 2 ReRelease |
| BSPX | 39 | Quake 2 ReRelease (Extension to IBSP) |

View file

@ -247,7 +247,8 @@ Mod_LoadQBSPNodes(const char *name, cplane_t *planes, int numplanes, mleaf_t *le
int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
const lump_t *l, int ident)
{
if (ident == IDBSPHEADER)
if ((ident == IDBSPHEADER) ||
(ident == RBSPHEADER))
{
Mod_LoadNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes,
mod_base, l);
@ -571,7 +572,8 @@ void
Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges,
const byte *mod_base, const lump_t *l, int ident)
{
if (ident == IDBSPHEADER)
if ((ident == IDBSPHEADER) ||
(ident == RBSPHEADER))
{
Mod_LoadEdges(name, edges, numedges, mod_base, l);
}
@ -693,7 +695,8 @@ Mod_LoadBSPX(int filesize, const byte *mod_base, maptype_t maptype)
xofs = 0;
numlumps = HEADER_LUMPS;
if (maptype == map_daikatana)
if ((header->version == BSPDKMVERSION) &&
(maptype == map_daikatana))
{
numlumps = 21;
}
@ -865,7 +868,8 @@ void
Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int *nummarksurfaces,
msurface_t *surfaces, int numsurfaces, const byte *mod_base, const lump_t *l, int ident)
{
if (ident == IDBSPHEADER)
if ((ident == IDBSPHEADER) ||
(ident == RBSPHEADER))
{
Mod_LoadMarksurfaces(name, marksurfaces, nummarksurfaces,
surfaces, numsurfaces, mod_base, l);
@ -1032,7 +1036,8 @@ Mod_LoadQBSPLeafs(const char *name, mleaf_t **leafs, int *numleafs,
msurface_t **marksurfaces, unsigned int nummarksurfaces,
const byte *mod_base, const lump_t *l, int ident, maptype_t maptype)
{
if (ident == IDBSPHEADER)
if ((ident == IDBSPHEADER) ||
(ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(l->filelen % sizeof(ddkleaf_t) == 0))
@ -1357,7 +1362,8 @@ calcTexinfoFacesLeafsSize(const byte *mod_base, const dheader_t *header)
{
int hunkSize = 0;
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
hunkSize += calcTexinfoAndFacesSize(mod_base,
&header->lumps[LUMP_FACES], &header->lumps[LUMP_TEXINFO]);

View file

@ -453,7 +453,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident);
if (i != IDBSPHEADER && i != QBSPHEADER)
if ((i != IDBSPHEADER) &&
(i != RBSPHEADER) &&
(i != QBSPHEADER))
{
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
@ -461,7 +463,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version);
if (i != BSPVERSION && i != BSPDKMVERSION)
if ((i != BSPVERSION) &&
(i != BSPSINVERSION) &&
(i != BSPDKMVERSION))
{
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
@ -489,7 +493,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_LUMP_VERTEXES);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_LUMP_EDGES);
@ -508,7 +513,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
@ -567,7 +573,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
r_notexture, maptype);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
}
@ -708,6 +715,8 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
case IDBSPHEADER:
/* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen);
break;

View file

@ -454,7 +454,9 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident);
if (i != IDBSPHEADER && i != QBSPHEADER)
if ((i != IDBSPHEADER) &&
(i != RBSPHEADER) &&
(i != QBSPHEADER))
{
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
@ -462,7 +464,9 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version);
if (i != BSPVERSION && i != BSPDKMVERSION)
if ((i != BSPVERSION) &&
(i != BSPSINVERSION) &&
(i != BSPDKMVERSION))
{
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
@ -490,7 +494,8 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_LUMP_VERTEXES);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_LUMP_EDGES);
@ -509,7 +514,8 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
@ -568,7 +574,8 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL3_FindImage,
gl3_notexture, maptype);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
}
@ -709,6 +716,8 @@ Mod_ForName(const char *name, gl3model_t *parent_model, qboolean crash)
case IDBSPHEADER:
/* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen);
break;

View file

@ -454,7 +454,9 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident);
if (i != IDBSPHEADER && i != QBSPHEADER)
if ((i != IDBSPHEADER) &&
(i != RBSPHEADER) &&
(i != QBSPHEADER))
{
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
@ -462,7 +464,9 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version);
if (i != BSPVERSION && i != BSPDKMVERSION)
if ((i != BSPVERSION) &&
(i != BSPSINVERSION) &&
(i != BSPDKMVERSION))
{
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
@ -490,7 +494,8 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_LUMP_VERTEXES);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_LUMP_EDGES);
@ -509,7 +514,8 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
@ -568,7 +574,8 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL4_FindImage,
gl4_notexture, maptype);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
}
@ -709,6 +716,8 @@ Mod_ForName(const char *name, gl4model_t *parent_model, qboolean crash)
case IDBSPHEADER:
/* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen);
break;

View file

@ -438,7 +438,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident);
if (i != IDBSPHEADER && i != QBSPHEADER)
if ((i != IDBSPHEADER) &&
(i != RBSPHEADER) &&
(i != QBSPHEADER))
{
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
@ -446,7 +448,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version);
if (i != BSPVERSION && i != BSPDKMVERSION)
if ((i != BSPVERSION) &&
(i != BSPSINVERSION) &&
(i != BSPDKMVERSION))
{
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
@ -474,7 +478,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_LUMP_VERTEXES);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_LUMP_EDGES);
@ -495,7 +500,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
@ -556,7 +562,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
r_notexture_mip, maptype);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
}
@ -699,6 +706,8 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
case IDBSPHEADER:
/* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen);
break;

View file

@ -428,7 +428,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident);
if (i != IDBSPHEADER && i != QBSPHEADER)
if ((i != IDBSPHEADER) &&
(i != RBSPHEADER) &&
(i != QBSPHEADER))
{
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER);
@ -436,7 +438,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version);
if (i != BSPVERSION && i != BSPDKMVERSION)
if ((i != BSPVERSION) &&
(i != BSPSINVERSION) &&
(i != BSPDKMVERSION))
{
Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION);
@ -464,7 +468,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_LUMP_VERTEXES);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_LUMP_EDGES);
@ -483,7 +488,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
hunkSize += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
@ -542,7 +548,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
Mod_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)Vk_FindImage,
r_notexture, maptype);
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
Mod_LoadFaces(mod, mod_base, &header->lumps[LUMP_FACES], bspx_header);
}
@ -692,6 +699,8 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
case IDBSPHEADER:
/* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen);
break;

View file

@ -202,6 +202,7 @@ Mod_MaptypeName(maptype_t maptype)
case map_daikatana: maptypename = "Daikatana"; break;
case map_kingpin: maptypename = "Kingpin"; break;
case map_anachronox: maptypename = "Anachronox"; break;
case map_sin: maptypename = "SiN"; break;
default: maptypename = "Unknown"; break;
}
@ -215,7 +216,8 @@ Mod_LoadValidateLumps(const char *name, const dheader_t *header)
qboolean error = false;
maptype_t maptype;
if (header->ident == IDBSPHEADER)
if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{
rules = idbsplumps;
if (header->version == BSPDKMVERSION)

View file

@ -2013,7 +2013,9 @@ CM_LoadCachedMap(const char *name, model_t *mod)
((int *)&header)[i] = LittleLong(((int *)&header)[i]);
}
if (header.ident != IDBSPHEADER && header.ident != QBSPHEADER)
if ((header.ident != IDBSPHEADER) &&
(header.ident != RBSPHEADER) &&
(header.ident != QBSPHEADER))
{
Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, name, header.ident, IDBSPHEADER);
@ -2036,6 +2038,14 @@ CM_LoadCachedMap(const char *name, model_t *mod)
__func__, name, header.version, BSPVERSION);
}
if ((header.ident == RBSPHEADER) &&
(header.version != BSPSINVERSION))
{
Com_Error(ERR_DROP,
"%s: %s has wrong version number (%i should be %i)",
__func__, name, header.version, BSPSINVERSION);
}
maptype = Mod_LoadValidateLumps(name, &header);
cmod_base = (byte *)buf;
@ -2046,7 +2056,8 @@ CM_LoadCachedMap(const char *name, model_t *mod)
hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_TEXINFO],
sizeof(texinfo_t), sizeof(mapsurface_t), EXTRA_LUMP_TEXINFO);
if (header.ident == IDBSPHEADER)
if ((header.ident == IDBSPHEADER) ||
(header.ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(header.lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
@ -2076,7 +2087,8 @@ CM_LoadCachedMap(const char *name, model_t *mod)
hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHES],
sizeof(dbrush_t), sizeof(cbrush_t), EXTRA_LUMP_BRUSHES);
if (header.ident == IDBSPHEADER)
if ((header.ident == IDBSPHEADER) ||
(header.ident == RBSPHEADER))
{
hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHSIDES],
sizeof(dbrushside_t), sizeof(cbrushside_t), EXTRA_LUMP_BRUSHSIDES);
@ -2106,7 +2118,9 @@ CM_LoadCachedMap(const char *name, model_t *mod)
CMod_LoadSurfaces(mod->name, &mod->map_surfaces, &mod->numtexinfo,
cmod_base, &header.lumps[LUMP_TEXINFO], maptype);
if (header.ident == IDBSPHEADER)
if ((header.ident == IDBSPHEADER) ||
(header.ident == RBSPHEADER))
{
if ((maptype == map_daikatana) &&
(header.lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0))
@ -2135,7 +2149,8 @@ CM_LoadCachedMap(const char *name, model_t *mod)
CMod_LoadBrushes(mod->name, &mod->map_brushes, &mod->numbrushes,
cmod_base, &header.lumps[LUMP_BRUSHES]);
if (header.ident == IDBSPHEADER)
if ((header.ident == IDBSPHEADER) ||
(header.ident == RBSPHEADER))
{
CMod_LoadBrushSides(mod->name, &mod->map_brushsides, &mod->numbrushsides,
mod->map_planes, mod->numplanes, mod->map_surfaces, mod->numtexinfo,
@ -2151,7 +2166,8 @@ CM_LoadCachedMap(const char *name, model_t *mod)
CMod_LoadSubmodels(mod->name, mod->map_cmodels, &mod->numcmodels,
cmod_base, &header.lumps[LUMP_MODELS]);
if (header.ident == IDBSPHEADER)
if ((header.ident == IDBSPHEADER) ||
(header.ident == RBSPHEADER))
{
CMod_LoadNodes(mod->name, &mod->map_nodes, &mod->numnodes,
mod->map_planes, cmod_base, &header.lumps[LUMP_NODES]);

View file

@ -46,6 +46,7 @@ typedef enum
map_daikatana = 2,
map_kingpin = 3,
map_anachronox = 4,
map_sin = 5,
} maptype_t;
extern int Mod_LoadSurfConvertFlags(int flags, maptype_t maptype);

View file

@ -588,7 +588,7 @@ typedef struct {
int value;
} dkmtex_t;
/* .SWL Daikana texture file format */
/* .SWL SiN texture file format */
#define SIN_PALETTE_SIZE 256 * 4
@ -965,5 +965,9 @@ typedef struct
int unknow; /* some unused additional field */
} ddkleaf_t;
/* SiN structures */
#define RBSPHEADER (('P' << 24) + ('S' << 16) + ('B' << 8) + 'R') /* little-endian "RBSP" */
#define BSPSINVERSION 1
#endif