+ mod_base = (unsigned char*)buffer;
+
+ index = mod_base;
+ index += 8;
+ i = SB_ReadInt (&index);
+ if (i != MCBSPVERSION)
+ Host_Error("Mod_Q1BSP_Load: %s has wrong version number(%i should be %i)", mod->name, i, MCBSPVERSION);
+
+ // read hull info
+ hullinfo.numhulls = LittleLong(*(int*)index); index += 4;
+ hullinfo.filehulls = hullinfo.numhulls;
+ VectorClear (hullinfo.hullsizes[0][0]);
+ VectorClear (hullinfo.hullsizes[0][1]);
+ for (i = 1; i < hullinfo.numhulls; i++)
+ {
+ hullinfo.hullsizes[i][0][0] = SB_ReadFloat (&index);
+ hullinfo.hullsizes[i][0][1] = SB_ReadFloat (&index);
+ hullinfo.hullsizes[i][0][2] = SB_ReadFloat (&index);
+ hullinfo.hullsizes[i][1][0] = SB_ReadFloat (&index);
+ hullinfo.hullsizes[i][1][1] = SB_ReadFloat (&index);
+ hullinfo.hullsizes[i][1][2] = SB_ReadFloat (&index);
+ }
+
+ // read lumps
+ _header.version = 0;
+ for (i = 0; i < HEADER_LUMPS; i++)
+ {
+ _header.lumps[i].fileofs = SB_ReadInt (&index);
+ _header.lumps[i].filelen = SB_ReadInt (&index);
+ }
+
+ header = &_header;
+ }
+ else
+ {
+ header = (dheader_t *)buffer;
+
+ i = LittleLong(header->version);
+ if (i != BSPVERSION && i != 30)
+ Host_Error("Mod_Q1BSP_Load: %s has wrong version number(%i should be %i(Quake) or 30(HalfLife)", mod->name, i, BSPVERSION);
+ mod->brush.ishlbsp = i == 30;
+ mod->brush.ismcbsp = false;
+
+ // fill in hull info
+ VectorClear (hullinfo.hullsizes[0][0]);
+ VectorClear (hullinfo.hullsizes[0][1]);
+ if (mod->brush.ishlbsp)
+ {
+ hullinfo.numhulls = 4;
+ hullinfo.filehulls = 4;
+ VectorSet (hullinfo.hullsizes[1][0], -16, -16, -36);
+ VectorSet (hullinfo.hullsizes[1][1], 16, 16, 36);
+ VectorSet (hullinfo.hullsizes[2][0], -32, -32, -32);
+ VectorSet (hullinfo.hullsizes[2][1], 32, 32, 32);
+ VectorSet (hullinfo.hullsizes[3][0], -16, -16, -18);
+ VectorSet (hullinfo.hullsizes[3][1], 16, 16, 18);
+ }
+ else
+ {
+ hullinfo.numhulls = 3;
+ hullinfo.filehulls = 4;
+ VectorSet (hullinfo.hullsizes[1][0], -16, -16, -24);
+ VectorSet (hullinfo.hullsizes[1][1], 16, 16, 32);
+ VectorSet (hullinfo.hullsizes[2][0], -32, -32, -24);
+ VectorSet (hullinfo.hullsizes[2][1], 32, 32, 64);
+ }
+
+ // read lumps
+ mod_base = (unsigned char*)buffer;
+ for (i = 0; i < HEADER_LUMPS; i++)
+ {
+ header->lumps[i].fileofs = LittleLong(header->lumps[i].fileofs);
+ header->lumps[i].filelen = LittleLong(header->lumps[i].filelen);
+ }
+ }