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 | 39 | Quake 2 / Anachronox / Kingpin / Heretic 2 |
| IBSP | 41 | Daikatana / SIN | | IBSP | 41 | Daikatana / SIN |
| RBSP | 1 | SIN |
| QBSP | 39 | Quake 2 ReRelease | | QBSP | 39 | Quake 2 ReRelease |
| BSPX | 39 | Quake 2 ReRelease (Extension to IBSP) | | 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, int numleafs, mnode_t **nodes, int *numnodes, const byte *mod_base,
const lump_t *l, int ident) const lump_t *l, int ident)
{ {
if (ident == IDBSPHEADER) if ((ident == IDBSPHEADER) ||
(ident == RBSPHEADER))
{ {
Mod_LoadNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes, Mod_LoadNodes(name, planes, numplanes, leafs, numleafs, nodes, numnodes,
mod_base, l); mod_base, l);
@ -571,7 +572,8 @@ void
Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges, Mod_LoadQBSPEdges(const char *name, medge_t **edges, int *numedges,
const byte *mod_base, const lump_t *l, int ident) 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); 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; xofs = 0;
numlumps = HEADER_LUMPS; numlumps = HEADER_LUMPS;
if (maptype == map_daikatana) if ((header->version == BSPDKMVERSION) &&
(maptype == map_daikatana))
{ {
numlumps = 21; numlumps = 21;
} }
@ -865,7 +868,8 @@ void
Mod_LoadQBSPMarksurfaces(const char *name, msurface_t ***marksurfaces, unsigned int *nummarksurfaces, 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) 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, Mod_LoadMarksurfaces(name, marksurfaces, nummarksurfaces,
surfaces, numsurfaces, mod_base, l); 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, msurface_t **marksurfaces, unsigned int nummarksurfaces,
const byte *mod_base, const lump_t *l, int ident, maptype_t maptype) 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) && if ((maptype == map_daikatana) &&
(l->filelen % sizeof(ddkleaf_t) == 0)) (l->filelen % sizeof(ddkleaf_t) == 0))
@ -1357,7 +1362,8 @@ calcTexinfoFacesLeafsSize(const byte *mod_base, const dheader_t *header)
{ {
int hunkSize = 0; int hunkSize = 0;
if (header->ident == IDBSPHEADER) if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{ {
hunkSize += calcTexinfoAndFacesSize(mod_base, hunkSize += calcTexinfoAndFacesSize(mod_base,
&header->lumps[LUMP_FACES], &header->lumps[LUMP_TEXINFO]); &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); 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)", Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER); __func__, mod->name, i, IDBSPHEADER);
@ -461,7 +463,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version); 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)", Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION); __func__, mod->name, i, BSPVERSION);
@ -489,7 +493,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0; int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_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 += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0); 1, 1, 0);
if (header->ident == IDBSPHEADER) if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{ {
if ((maptype == map_daikatana) && if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0)) (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_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
r_notexture, maptype); 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); 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: case IDBSPHEADER:
/* fall through */ /* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER: case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen); Mod_LoadBrushModel(mod, buf, modfilelen);
break; break;

View file

@ -454,7 +454,9 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident); 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)", Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER); __func__, mod->name, i, IDBSPHEADER);
@ -462,7 +464,9 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version); 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)", Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION); __func__, mod->name, i, BSPVERSION);
@ -490,7 +494,8 @@ Mod_LoadBrushModel(gl3model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0; int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_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 += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0); 1, 1, 0);
if (header->ident == IDBSPHEADER) if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{ {
if ((maptype == map_daikatana) && if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0)) (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_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL3_FindImage, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL3_FindImage,
gl3_notexture, maptype); 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); 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: case IDBSPHEADER:
/* fall through */ /* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER: case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen); Mod_LoadBrushModel(mod, buf, modfilelen);
break; break;

View file

@ -454,7 +454,9 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident); 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)", Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER); __func__, mod->name, i, IDBSPHEADER);
@ -462,7 +464,9 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version); 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)", Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION); __func__, mod->name, i, BSPVERSION);
@ -490,7 +494,8 @@ Mod_LoadBrushModel(gl4model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0; int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_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 += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0); 1, 1, 0);
if (header->ident == IDBSPHEADER) if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{ {
if ((maptype == map_daikatana) && if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0)) (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_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL4_FindImage, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)GL4_FindImage,
gl4_notexture, maptype); 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); 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: case IDBSPHEADER:
/* fall through */ /* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER: case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen); Mod_LoadBrushModel(mod, buf, modfilelen);
break; break;

View file

@ -438,7 +438,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident); 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)", Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER); __func__, mod->name, i, IDBSPHEADER);
@ -446,7 +448,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version); 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)", Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION); __func__, mod->name, i, BSPVERSION);
@ -474,7 +478,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0; int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_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 += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0); 1, 1, 0);
if (header->ident == IDBSPHEADER) if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{ {
if ((maptype == map_daikatana) && if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0)) (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_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)R_FindImage,
r_notexture_mip, maptype); 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); 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: case IDBSPHEADER:
/* fall through */ /* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER: case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen); Mod_LoadBrushModel(mod, buf, modfilelen);
break; break;

View file

@ -428,7 +428,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->ident); 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)", Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, mod->name, i, IDBSPHEADER); __func__, mod->name, i, IDBSPHEADER);
@ -436,7 +438,9 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
i = LittleLong(header->version); 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)", Com_Error(ERR_DROP, "%s: %s has wrong version number (%i should be %i)",
__func__, mod->name, i, BSPVERSION); __func__, mod->name, i, BSPVERSION);
@ -464,7 +468,8 @@ Mod_LoadBrushModel(model_t *mod, const void *buffer, int modfilelen)
int hunkSize = 0; int hunkSize = 0;
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VERTEXES],
sizeof(dvertex_t), sizeof(mvertex_t), EXTRA_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], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_EDGES],
sizeof(dedge_t), sizeof(medge_t), EXTRA_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 += calcTexinfoFacesLeafsSize(mod_base, header);
hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY], hunkSize += Mod_CalcLumpHunkSize(&header->lumps[LUMP_VISIBILITY],
1, 1, 0); 1, 1, 0);
if (header->ident == IDBSPHEADER) if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{ {
if ((maptype == map_daikatana) && if ((maptype == map_daikatana) &&
(header->lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0)) (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_LoadTexinfo(mod->name, &mod->texinfo, &mod->numtexinfo,
mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)Vk_FindImage, mod_base, &header->lumps[LUMP_TEXINFO], (findimage_t)Vk_FindImage,
r_notexture, maptype); 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); 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: case IDBSPHEADER:
/* fall through */ /* fall through */
case RBSPHEADER:
/* fall through */
case QBSPHEADER: case QBSPHEADER:
Mod_LoadBrushModel(mod, buf, modfilelen); Mod_LoadBrushModel(mod, buf, modfilelen);
break; break;

View file

@ -202,6 +202,7 @@ Mod_MaptypeName(maptype_t maptype)
case map_daikatana: maptypename = "Daikatana"; break; case map_daikatana: maptypename = "Daikatana"; break;
case map_kingpin: maptypename = "Kingpin"; break; case map_kingpin: maptypename = "Kingpin"; break;
case map_anachronox: maptypename = "Anachronox"; break; case map_anachronox: maptypename = "Anachronox"; break;
case map_sin: maptypename = "SiN"; break;
default: maptypename = "Unknown"; break; default: maptypename = "Unknown"; break;
} }
@ -215,7 +216,8 @@ Mod_LoadValidateLumps(const char *name, const dheader_t *header)
qboolean error = false; qboolean error = false;
maptype_t maptype; maptype_t maptype;
if (header->ident == IDBSPHEADER) if ((header->ident == IDBSPHEADER) ||
(header->ident == RBSPHEADER))
{ {
rules = idbsplumps; rules = idbsplumps;
if (header->version == BSPDKMVERSION) 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]); ((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)", Com_Error(ERR_DROP, "%s: %s has wrong ident (%i should be %i)",
__func__, name, header.ident, IDBSPHEADER); __func__, name, header.ident, IDBSPHEADER);
@ -2036,6 +2038,14 @@ CM_LoadCachedMap(const char *name, model_t *mod)
__func__, name, header.version, BSPVERSION); __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); maptype = Mod_LoadValidateLumps(name, &header);
cmod_base = (byte *)buf; cmod_base = (byte *)buf;
@ -2046,7 +2056,8 @@ CM_LoadCachedMap(const char *name, model_t *mod)
hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_TEXINFO], hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_TEXINFO],
sizeof(texinfo_t), sizeof(mapsurface_t), EXTRA_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) && if ((maptype == map_daikatana) &&
(header.lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0)) (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], hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHES],
sizeof(dbrush_t), sizeof(cbrush_t), EXTRA_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], hunkSize += Mod_CalcLumpHunkSize(&header.lumps[LUMP_BRUSHSIDES],
sizeof(dbrushside_t), sizeof(cbrushside_t), EXTRA_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_LoadSurfaces(mod->name, &mod->map_surfaces, &mod->numtexinfo,
cmod_base, &header.lumps[LUMP_TEXINFO], maptype); cmod_base, &header.lumps[LUMP_TEXINFO], maptype);
if (header.ident == IDBSPHEADER)
if ((header.ident == IDBSPHEADER) ||
(header.ident == RBSPHEADER))
{ {
if ((maptype == map_daikatana) && if ((maptype == map_daikatana) &&
(header.lumps[LUMP_LEAFS].filelen % sizeof(ddkleaf_t) == 0)) (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_LoadBrushes(mod->name, &mod->map_brushes, &mod->numbrushes,
cmod_base, &header.lumps[LUMP_BRUSHES]); 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, CMod_LoadBrushSides(mod->name, &mod->map_brushsides, &mod->numbrushsides,
mod->map_planes, mod->numplanes, mod->map_surfaces, mod->numtexinfo, 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_LoadSubmodels(mod->name, mod->map_cmodels, &mod->numcmodels,
cmod_base, &header.lumps[LUMP_MODELS]); 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, CMod_LoadNodes(mod->name, &mod->map_nodes, &mod->numnodes,
mod->map_planes, cmod_base, &header.lumps[LUMP_NODES]); mod->map_planes, cmod_base, &header.lumps[LUMP_NODES]);

View file

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

View file

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