From 2608c8528edcc76c3d493615f5555a4c94975ff4 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Tue, 14 Jun 2016 14:56:00 -0500 Subject: [PATCH 1/4] Improved MOGP parsing * Added missing portalCount. * Modified batch counts to live together in single struct. * Added batchOffsets helper. Some logic requires manipulating batches based on their location relative to batchCounts. Having offsets precomputed makes these manipulations simpler. --- src/lib/wmo/group.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/lib/wmo/group.js b/src/lib/wmo/group.js index 077c8c0..3f2352c 100644 --- a/src/lib/wmo/group.js +++ b/src/lib/wmo/group.js @@ -13,13 +13,24 @@ const MOGP = Chunk({ minBoundingBox: Vec3Float, maxBoundingBox: Vec3Float, portalOffset: r.uint16le, - aBatchCount: r.uint16le, - interiorBatchCount: r.uint16le, - exteriorBatchCount: r.uint16le, + portalCount: r.uint16le, + batchCounts: new r.Struct({ + a: r.uint16le, + b: r.uint16le, + c: r.int32le + }), fogOffsets: new r.Array(r.uint8, 4), unknown: new r.Reserved(r.uint32le), groupID: r.uint32le, unknowns: new r.Reserved(r.uint32le, 3) + + batchOffsets: function() { + return { + a: 0, + b: this.batchCounts.a, + c: this.batchCounts.a + this.batchCounts.b + }; + }, }); const MOPY = Chunk({ From 73173900f5163165ff663758789bad8ffd0328ee Mon Sep 17 00:00:00 2001 From: fallenoak Date: Tue, 14 Jun 2016 15:01:04 -0500 Subject: [PATCH 2/4] Renamed baseColor to ambientColor for clarity --- src/lib/wmo/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/wmo/index.js b/src/lib/wmo/index.js index 8754d96..0854acf 100644 --- a/src/lib/wmo/index.js +++ b/src/lib/wmo/index.js @@ -15,7 +15,7 @@ const MOHD = Chunk({ modelCount: r.uint32le, doodadCount: r.uint32le, doodadSetCount: r.uint32le, - baseColor: new r.Struct({ + ambientColor: new r.Struct({ r: r.uint8, g: r.uint8, b: r.uint8, From 7b6dabb32758748d2d627f0dbf1d70b58ac008dd Mon Sep 17 00:00:00 2001 From: fallenoak Date: Tue, 14 Jun 2016 15:22:36 -0500 Subject: [PATCH 3/4] Renamed indoor to interior --- src/lib/wmo/group.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/wmo/group.js b/src/lib/wmo/group.js index 3f2352c..89d1a40 100644 --- a/src/lib/wmo/group.js +++ b/src/lib/wmo/group.js @@ -110,7 +110,7 @@ export default Chunked({ return this.flags & 0x4; }), - indoor: function() { + interior: function() { return (this.flags & 0x2000) !== 0 && (this.flags & 0x8) === 0; } }); From e4a7c3e3f50a178cb85fc5a555938f3de1bbfb81 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Tue, 14 Jun 2016 15:37:30 -0500 Subject: [PATCH 4/4] Fixed syntax error and corrected length --- src/lib/wmo/group.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/wmo/group.js b/src/lib/wmo/group.js index 89d1a40..750013c 100644 --- a/src/lib/wmo/group.js +++ b/src/lib/wmo/group.js @@ -22,7 +22,7 @@ const MOGP = Chunk({ fogOffsets: new r.Array(r.uint8, 4), unknown: new r.Reserved(r.uint32le), groupID: r.uint32le, - unknowns: new r.Reserved(r.uint32le, 3) + unknowns: new r.Reserved(r.uint32le, 2), batchOffsets: function() { return {