diff --git a/libs/xassets/xclipmap.cpp b/libs/xassets/xclipmap.cpp index 78c7003..a5376e1 100644 --- a/libs/xassets/xclipmap.cpp +++ b/libs/xassets/xclipmap.cpp @@ -70,7 +70,7 @@ void XClipMap::ParseData(QDataStream *aStream) qint32 planePtr, staticModelPtr, materialsPtr, brushSidesPtr, brushEdgesPtr, nodesPtr, leafsPtr, leafsBrushNodesPtr, - leafBrushesPtr, leafSurfacesPtr, vertPtr1, vertPtr2, vertPtr3, + leafBrushesPtr, leafSurfacesPtr, vertPtr, triIndicesPtr, triEdgeWalkablePtr, bordersPtr, partitionsPtr, aabbTreesPtr, cModelsPtr; *aStream @@ -96,9 +96,7 @@ void XClipMap::ParseData(QDataStream *aStream) >> mNumLeafSurfaces >> leafSurfacesPtr >> mVertCount - >> vertPtr1 - >> vertPtr2 - >> vertPtr3 + >> vertPtr >> mTriCount >> triIndicesPtr >> triEdgeWalkablePtr @@ -114,15 +112,17 @@ void XClipMap::ParseData(QDataStream *aStream) aStream->skipRawData(2); - qint32 brushesPtr, visibilityPtr, mapEntsPtr, boxBrushPtr; + qint32 brushesPtr, visibilityPtr, mapEntsPtr; *aStream >> brushesPtr >> mNumClusters >> mClusterBytes >> visibilityPtr >> mVised - >> mapEntsPtr - >> boxBrushPtr; + >> mapEntsPtr; + + mMapEnts.ParsePtr(aStream, false); + mBoxBrush.ParsePtr(aStream, false); mBoxModel.ParseData(aStream); @@ -236,24 +236,117 @@ void XClipMap::ParseData(QDataStream *aStream) } } - // mLeafsurfaces() - // mVerts() - // mTriIndices() - // mTriEdgeIsWalkable() - // mBorders() - // mPartitions() - // mAabbTrees() - // mCodels() - // mBrushes() - // mVisibility() - // mMapEnts() - // mBoxBrush() - // mBoxModel() - // mDynEntCount(0) - // mDynEntDefList() - // mDynEntPoseList() - // mDynEntClientList() - // mDynEntCollList() + if (leafSurfacesPtr) + { + for (int i = 0; i < mNumLeafBrushes; i++) + { + quint32 newBrush; + *aStream >> newBrush; + mLeafSurfaces.append(newBrush); + } + } + + if (vertPtr) + { + for (int i = 0; i < mVertCount; i++) + { + QVector3D newVert; + *aStream + >> newVert[0] + >> newVert[1] + >> newVert[2]; + mVerts.append(newVert); + } + } + + if (triIndicesPtr) + { + for (int i = 0; i < mTriCount; i++) + { + quint32 newTri; + *aStream >> newTri; + mTriIndices.append(newTri); + } + } + + if (triEdgeWalkablePtr) + { + aStream->readRawData(mTriEdgeIsWalkable.data(), ((3 * mTriCount + 31) >> 3) & 0xFFFFFFFC); + } + + if (bordersPtr) + { + for (int i = 0; i < mBorderCount; i++) + { + XCollisionBorder newBorder; + newBorder.ParseData(aStream); + mBorders.append(newBorder); + } + } + + if (partitionsPtr) + { + for (int i = 0; i < mPartitionCount; i++) + { + XCollisionPartition newPartition; + newPartition.ParseData(aStream); + mPartitions.append(newPartition); + } + } + + if (aabbTreesPtr) + { + for (int i = 0; i < mAabbTreeCount; i++) + { + XCollisionAabbTree newTree; + newTree.ParseData(aStream); + mAabbTrees.append(newTree); + } + } + + if (cModelsPtr) + { + for (int i = 0; i < mNumSubModels; i++) + { + XCModel newCModel; + newCModel.ParseData(aStream); + mCModels.append(newCModel); + } + } + + if (brushesPtr) + { + for (int i = 0; i < mNumBrushes; i++) + { + XCBrush newCBrush; + newCBrush.ParseData(aStream); + mBrushes.append(newCBrush); + } + } + + if (visibilityPtr) + { + aStream->readRawData(mVisibility.data(), mClusterBytes * mNumClusters); + } + + if (mapEntsPtr) + { + mMapEnts.ParseData(aStream); + } + + mBoxBrush.ParseData(aStream); + + mDynEntDefList[0].ParseData(aStream); + mDynEntDefList[0].ParseData(aStream); + + mDynEntPoseList[0].ParseData(aStream); + mDynEntPoseList[0].ParseData(aStream); + + mDynEntClientList[0].ParseData(aStream); + mDynEntClientList[0].ParseData(aStream); + + mDynEntCollList[0].ParseData(aStream); + mDynEntCollList[0].ParseData(aStream); } }