From 84f8c299ce9e9924c0e54435403e259e1dace3ed Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 Feb 2015 12:08:52 +0100 Subject: [PATCH] - fixed: cached GL nodes should use ZGL3 format for maximum precision. --- src/p_glnodes.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/p_glnodes.cpp b/src/p_glnodes.cpp index 15b97b9e61..1b34e8bbc2 100644 --- a/src/p_glnodes.cpp +++ b/src/p_glnodes.cpp @@ -1116,10 +1116,10 @@ static void CreateCachedNodes(MapData *map) WriteLong(ZNodes, numnodes); for(int i=0;i> FRACBITS); - WriteWord(ZNodes, nodes[i].y >> FRACBITS); - WriteWord(ZNodes, nodes[i].dx >> FRACBITS); - WriteWord(ZNodes, nodes[i].dy >> FRACBITS); + WriteLong(ZNodes, nodes[i].x); + WriteLong(ZNodes, nodes[i].y); + WriteLong(ZNodes, nodes[i].dx); + WriteLong(ZNodes, nodes[i].dy); for (int j = 0; j < 2; ++j) { for (int k = 0; k < 4; ++k) @@ -1168,7 +1168,7 @@ static void CreateCachedNodes(MapData *map) DWORD ndx[2] = {LittleLong(DWORD(lines[i].v1 - vertexes)), LittleLong(DWORD(lines[i].v2 - vertexes)) }; memcpy(compressed+8+16+8*i, ndx, 8); } - memcpy(compressed + offset - 4, "ZGL2", 4); + memcpy(compressed + offset - 4, "ZGL3", 4); FString path = CreateCacheName(map, true); FILE *f = fopen(path, "wb"); @@ -1218,7 +1218,7 @@ static bool CheckCachedNodes(MapData *map) if (fread(verts, 8, numlin, f) != numlin) goto errorout; if (fread(magic, 1, 4, f) != 4) goto errorout; - if (memcmp(magic, "ZGL2", 4)) goto errorout; + if (memcmp(magic, "ZGL2", 4) && memcmp(magic, "ZGL3", 4)) goto errorout; try @@ -1226,7 +1226,7 @@ static bool CheckCachedNodes(MapData *map) long pos = ftell(f); FileReader fr(f); fr.Seek(pos, SEEK_SET); - P_LoadZNodes (fr, MAKE_ID('Z','G','L','2')); + P_LoadZNodes (fr, MAKE_ID(magic[0],magic[1],magic[2],magic[3])); } catch (CRecoverableError &error) {