const char *data = NULL;
char keyname[64];
char entfilename[MAX_QPATH];
- strlcpy(message, "^1**ERROR**^7", sizeof(message));
+ char desc[64];
+ desc[0] = 0;
+ strlcpy(message, "^1ERROR: open failed^7", sizeof(message));
p = 0;
f = FS_OpenVirtualFile(t->filenames[i], true);
if(f)
{
+ strlcpy(message, "^1ERROR: not a known map format^7", sizeof(message));
memset(buf, 0, 1024);
FS_Read(f, buf, 1024);
if (!memcmp(buf, "IBSP", 4))
q3dheader_t *header = (q3dheader_t *)buf;
lumpofs = LittleLong(header->lumps[Q3LUMP_ENTITIES].fileofs);
lumplen = LittleLong(header->lumps[Q3LUMP_ENTITIES].filelen);
+ dpsnprintf(desc, sizeof(desc), "Q3BSP%i", p);
}
else if (p == Q2BSPVERSION)
{
q2dheader_t *header = (q2dheader_t *)buf;
lumpofs = LittleLong(header->lumps[Q2LUMP_ENTITIES].fileofs);
lumplen = LittleLong(header->lumps[Q2LUMP_ENTITIES].filelen);
+ dpsnprintf(desc, sizeof(desc), "Q2BSP%i", p);
}
+ else
+ dpsnprintf(desc, sizeof(desc), "IBSP%i", p);
}
- else if((p = BuffLittleLong(buf)) == BSPVERSION || p == 30 || !memcmp(buf, "BSP2", 4))
+ else if (BuffLittleLong(buf) == BSPVERSION)
{
lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES);
lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4);
+ dpsnprintf(desc, sizeof(desc), "BSP29");
+ }
+ else if (BuffLittleLong(buf) == 30)
+ {
+ lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES);
+ lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4);
+ dpsnprintf(desc, sizeof(desc), "BSPHL");
+ }
+ else if (!memcmp(buf, "BSP2", 4))
+ {
+ lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES);
+ lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4);
+ dpsnprintf(desc, sizeof(desc), "BSP2");
+ }
+ else if (!memcmp(buf, "2PSB", 4))
+ {
+ lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES);
+ lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4);
+ dpsnprintf(desc, sizeof(desc), "BSP2RMQe");
}
else
- p = 0;
+ {
+ dpsnprintf(desc, sizeof(desc), "unknown%i", BuffLittleLong(buf));
+ }
strlcpy(entfilename, t->filenames[i], sizeof(entfilename));
memcpy(entfilename + strlen(entfilename) - 4, ".ent", 5);
entities = (char *)FS_LoadFile(entfilename, tempmempool, true, NULL);
if(f)
FS_Close(f);
*(t->filenames[i]+len[i]+5) = 0;
- switch(p)
- {
- case Q3BSPVERSION: strlcpy((char *)buf, "Q3", sizeof(buf));break;
- case Q2BSPVERSION: strlcpy((char *)buf, "Q2", sizeof(buf));break;
- case BSPVERSION: strlcpy((char *)buf, "Q1", sizeof(buf));break;
- case 30: strlcpy((char *)buf, "HL", sizeof(buf));break;
- default: strlcpy((char *)buf, "??", sizeof(buf));break;
- }
- Con_Printf("%16s (%s) %s\n", t->filenames[i]+5, buf, message);
+ Con_Printf("%16s (%-8s) %s\n", t->filenames[i]+5, desc, message);
}
Con_Print("\n");
for(p=o;p<min;p++)
{
int i, j, count, p, child[2];
mnode_t *out;
- size_t structsize = loadmodel->brush.isbsp2 ? 44 : 24;
+ size_t structsize = loadmodel->brush.isbsp2rmqe ? 32 : (loadmodel->brush.isbsp2 ? 44 : 24);
if (sb->cursize % structsize)
Host_Error("Mod_Q1BSP_LoadNodes: funny lump size in %s",loadmodel->name);
p = MSG_ReadLittleLong(sb);
out->plane = loadmodel->brush.data_planes + p;
- if (loadmodel->brush.isbsp2)
+ if (loadmodel->brush.isbsp2rmqe)
+ {
+ child[0] = MSG_ReadLittleLong(sb);
+ child[1] = MSG_ReadLittleLong(sb);
+ out->mins[0] = MSG_ReadLittleShort(sb);
+ out->mins[1] = MSG_ReadLittleShort(sb);
+ out->mins[2] = MSG_ReadLittleShort(sb);
+ out->maxs[0] = MSG_ReadLittleShort(sb);
+ out->maxs[1] = MSG_ReadLittleShort(sb);
+ out->maxs[2] = MSG_ReadLittleShort(sb);
+ out->firstsurface = MSG_ReadLittleLong(sb);
+ out->numsurfaces = MSG_ReadLittleLong(sb);
+ }
+ else if (loadmodel->brush.isbsp2)
{
child[0] = MSG_ReadLittleLong(sb);
child[1] = MSG_ReadLittleLong(sb);
{
mleaf_t *out;
int i, j, count, p, firstmarksurface, nummarksurfaces;
- size_t structsize = loadmodel->brush.isbsp2 ? 44 : 28;
+ size_t structsize = loadmodel->brush.isbsp2rmqe ? 32 : (loadmodel->brush.isbsp2 ? 44 : 28);
if (sb->cursize % structsize)
Host_Error("Mod_Q1BSP_LoadLeafs: funny lump size in %s",loadmodel->name);
Mod_Q1BSP_DecompressVis(loadmodel->brushq1.data_compressedpvs + p, loadmodel->brushq1.data_compressedpvs + loadmodel->brushq1.num_compressedpvs, loadmodel->brush.data_pvsclusters + out->clusterindex * loadmodel->brush.num_pvsclusterbytes, loadmodel->brush.data_pvsclusters + (out->clusterindex + 1) * loadmodel->brush.num_pvsclusterbytes);
}
- if (loadmodel->brush.isbsp2)
+ if (loadmodel->brush.isbsp2rmqe)
+ {
+ out->mins[0] = MSG_ReadLittleShort(sb);
+ out->mins[1] = MSG_ReadLittleShort(sb);
+ out->mins[2] = MSG_ReadLittleShort(sb);
+ out->maxs[0] = MSG_ReadLittleShort(sb);
+ out->maxs[1] = MSG_ReadLittleShort(sb);
+ out->maxs[2] = MSG_ReadLittleShort(sb);
+
+ firstmarksurface = MSG_ReadLittleLong(sb);
+ nummarksurfaces = MSG_ReadLittleLong(sb);
+ }
+ else if (loadmodel->brush.isbsp2)
{
out->mins[0] = MSG_ReadLittleFloat(sb);
out->mins[1] = MSG_ReadLittleFloat(sb);
mod->brush.ishlbsp = true;
mod->modeldatatypestring = "HLBSP";
break;
+ case ('2' + 'P' * 256 + 'S' * 65536 + 'B' * 16777216):
+ mod->brush.isbsp2 = true;
+ mod->brush.isbsp2rmqe = true; // like bsp2 except leaf/node bounds are 16bit (unexpanded)
+ mod->modeldatatypestring = "Q1BSP2rmqe";
+ break;
case ('B' + 'S' * 256 + 'P' * 65536 + '2' * 16777216):
mod->brush.isbsp2 = true;
mod->modeldatatypestring = "Q1BSP2";
break;
default:
mod->modeldatatypestring = "Unknown BSP";
- Host_Error("Mod_Q1BSP_Load: %s has wrong version number %i: supported versions are 29 (Quake), 30 (Half-Life), \"BSP2\"", mod->name, i);
+ Host_Error("Mod_Q1BSP_Load: %s has wrong version number %i: supported versions are 29 (Quake), 30 (Half-Life), \"BSP2\" or \"2PSB\" (rmqe)", mod->name, i);
return;
}