Fixup extended bsp when loading the file.

It turns out the tools need the node conversions too, so doing it in
bspfile seems to be best as it is used by everything that reads a bsp file.
This commit is contained in:
Bill Currie 2012-12-30 11:42:31 +09:00
parent 167977dfd9
commit 9d6954efb7
2 changed files with 9 additions and 9 deletions

View File

@ -600,13 +600,10 @@ Mod_LoadNodes (bsp_t *bsp)
for (j = 0; j < 2; j++) {
p = in->children[j];
// this check is for extended bsp 29 files
if (p >= 0 && p < count) {
if (p >= 0) {
out->children[j] = loadmodel->nodes + p;
} else {
if (p >= count)
p = 65535 - p; //NOTE 65535 is intentional, -1 is leaf
else
p = ~p;
p = ~p;
if (p < loadmodel->numleafs) {
out->children[j] = (mnode_t *) (loadmodel->leafs + p);
} else {

View File

@ -384,11 +384,14 @@ swap_from_bsp29 (bsp_t *bsp2, const bsp29_t *bsp29,
const dnode29_t *node29 = &bsp29->nodes[i];
node2->planenum = LittleLong (node29->planenum);
for (j=0 ; j<3 ; j++) {
node2->mins[j] = LittleShort (node29->mins[j]);
node2->maxs[j] = LittleShort (node29->maxs[j]);
node2->mins[j] = (int16_t) LittleShort (node29->mins[j]);
node2->maxs[j] = (int16_t) LittleShort (node29->maxs[j]);
}
for (j = 0; j < 2; j++) {
node2->children[j] = LittleShort (node29->children[j]);
if (node2->children[j] >= bsp2->numnodes)
node2->children[j] = (int16_t) node2->children[j];
}
node2->children[0] = (uint16_t) LittleShort (node29->children[0]);
node2->children[1] = (uint16_t) LittleShort (node29->children[1]);
node2->firstface = LittleShort (node29->firstface);
node2->numfaces = LittleShort (node29->numfaces);
}