diff --git a/Source/p_extnodes.c b/Source/p_extnodes.c index 8e98f20c..4e5dd755 100644 --- a/Source/p_extnodes.c +++ b/Source/p_extnodes.c @@ -152,10 +152,15 @@ void P_LoadSegs_DeePBSP (int lump) int side, linedef; line_t *ldef; + int vn1, vn2; + + // [MB] 2020-04-22: Fix endianess for DeePBSDP V4 nodes + vn1 = LONG(ml->v1); + vn2 = LONG(ml->v2); // [FG] extended nodes - li->v1 = &vertexes[ml->v1]; - li->v2 = &vertexes[ml->v2]; + li->v1 = &vertexes[vn1]; + li->v2 = &vertexes[vn2]; li->angle = (SHORT(ml->angle))<<16; li->offset = (SHORT(ml->offset))<<16; @@ -189,8 +194,9 @@ void P_LoadSubsectors_DeePBSP (int lump) for (i=0; ichildren[j] = (unsigned int)(mn->children[j]); + // [MB] 2020-04-22: Fix endianess for DeePBSDP V4 nodes + no->children[j] = LONG(mn->children[j]); for (k=0 ; k<4 ; k++) no->bbox[j][k] = SHORT(mn->bbox[j][k])<numsegs; - currSeg += mseg->numsegs; + subsectors[i].numlines = LONG(mseg->numsegs); + currSeg += LONG(mseg->numsegs); } data += numsubsectors * sizeof(mapsubsector_zdbsp_t); // 3. Load segs - numSegs = *((unsigned int*)data); + numSegs = LONG(*((unsigned int*)data)); data += sizeof(numSegs); // The number of stored segs should match the number of segs used by subsectors @@ -396,9 +405,12 @@ void P_LoadNodes_ZDBSP (int lump, boolean compressed) unsigned char side; seg_t *li = segs + i; mapseg_zdbsp_t *ml = (mapseg_zdbsp_t *) data + i; + unsigned int v1, v2; - li->v1 = &vertexes[ml->v1]; - li->v2 = &vertexes[ml->v2]; + v1 = LONG(ml->v1); + v2 = LONG(ml->v2); + li->v1 = &vertexes[v1]; + li->v2 = &vertexes[v2]; linedef = (unsigned short)SHORT(ml->linedef); ldef = &lines[linedef]; @@ -430,7 +442,7 @@ void P_LoadNodes_ZDBSP (int lump, boolean compressed) // 4. Load nodes - numNodes = *((unsigned int*)data); + numNodes = LONG(*((unsigned int*)data)); data += sizeof(numNodes); numnodes = numNodes; @@ -449,7 +461,7 @@ void P_LoadNodes_ZDBSP (int lump, boolean compressed) for (j = 0; j < 2; j++) { - no->children[j] = (unsigned int)(mn->children[j]); + no->children[j] = LONG(mn->children[j]); for (k = 0; k < 4; k++) no->bbox[j][k] = SHORT(mn->bbox[j][k])<