Skip to content

Commit 6bbcdc7

Browse files
JasonDeacutisWaffle1434
authored andcommitted
MVAR: labeled unknown data
1 parent 717bf13 commit 6bbcdc7

File tree

2 files changed

+56
-47
lines changed

2 files changed

+56
-47
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ReachVariantTool
2-
2+
test
33
A tool for editing Halo: Reach game variants, tested on files obtained from Halo: The Master Chief Collection's PC release.
44

55
You can download the program [from NexusMods](https://www.nexusmods.com/halothemasterchiefcollection/mods/192/).

html/src/raw/map_variant_mvar.js

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ function _sub4DC8E0(bitcount, mapBounds, out) {
149149
}
150150
}
151151

152-
class LFOUnk30 { // sizeof >= 0x1C
152+
class ObjectData { // sizeof >= 0x1C
153153
sub6078F0(stream) {
154154
let sw = stream.readBits(2);
155-
this.unk10 = sw;
155+
this.shape = sw;
156156
let xmm3 = 0.0977517142892;
157157
let xmm0 = 0;
158158
let xmm4 = 0.0488758571446;
@@ -162,15 +162,15 @@ class LFOUnk30 { // sizeof >= 0x1C
162162
case 1: {
163163
let a = stream.readBits(0xB);
164164
if (!a) {
165-
this.unk00 = 0;
165+
this.shapeWidth = 0;
166166
} else {
167167
if (a == 0x7FF) {
168-
this.unk00 = 200; // float
168+
this.shapeWidth = 200; // float
169169
} else {
170170
--a;
171171
a *= 0.0977517142892;
172172
a += 0.0488758571446;
173-
this.unk00 = a;
173+
this.shapeWidth = a;
174174
}
175175
}
176176
}; return;
@@ -184,17 +184,17 @@ class LFOUnk30 { // sizeof >= 0x1C
184184
} else {
185185
xmm1 = (eax - 1) * xmm3 + xmm4;
186186
}
187-
this.unk00 = xmm1;
187+
this.shapeWidth = xmm1;
188188
eax = stream.readBits(0xB);
189189
if (eax == 0) {
190190
xmm1 = xmm0;
191-
this.unk04 = xmm1;
191+
this.shapeLength = xmm1;
192192
} else if (eax == 0x7FF) {
193193
xmm1 = xmm2;
194-
this.unk04 = xmm1;
194+
this.shapeLength = xmm1;
195195
} else {
196196
xmm1 = (eax - 1) * xmm3 + xmm4;
197-
this.unk04 = xmm1;
197+
this.shapeLength = xmm1;
198198
}
199199
}; break;
200200
//
@@ -207,7 +207,7 @@ class LFOUnk30 { // sizeof >= 0x1C
207207
} else {
208208
xmm1 = (eax - 1) * xmm3 + xmm4;
209209
}
210-
this.unk00 = xmm1;
210+
this.shapeWidth = xmm1;
211211
}; break;
212212
//
213213
default:
@@ -221,7 +221,7 @@ class LFOUnk30 { // sizeof >= 0x1C
221221
} else {
222222
xmm1 = (eax - 1) * xmm3 + xmm4;
223223
}
224-
this.unk08 = xmm1;
224+
this.shapeTop = xmm1;
225225
eax = stream.readBits(0xB);
226226
if (!eax) {
227227
xmm1 = xmm0;
@@ -230,23 +230,32 @@ class LFOUnk30 { // sizeof >= 0x1C
230230
} else {
231231
xmm1 = (eax - 1) * xmm3 + xmm4;
232232
}
233-
this.unk0C = xmm1;
233+
this.shapeBottom = xmm1;
234234
}
235235
constructor(stream) {
236-
this.unk00 = 0; // float (shape dimension 0? width or length; radius for cylinder)
237-
this.unk04 = 0; // float (shape dimension 1? width or length)
238-
this.unk08 = 0; // float (shape dimension 2? top or bottom; top for cylinder)
239-
this.unk0C = 0; // float (shape dimension 3? top or bottom; bottom for cylinder)
240-
this.unk10 = 0; // byte (shape type)
236+
this.shapeWidth = 0; // float (shape dimension 0? box width; radius for cylinder)
237+
this.shapeLength = 0; // float (shape dimension 1? box length)
238+
this.shapeTop = 0; // float (shape dimension 2? top)
239+
this.shapeBottom = 0; // float (shape dimension 3? bottom)
240+
this.shape = 0; // byte (shape type; 2:cylinder, 3:box)
241241
this.spawnSequence = 0; // 11 // byte; UI clamps this to [-100, 100]
242242
this.respawnTime = 0; // 12 // byte
243-
this.unk13 = 0; // byte
244-
this.forgeLabelIndex = -1; // 14 // word
245-
this.unk16 = 0; // byte // flags? maybe?
246-
this.unk17 = 0; // byte
247-
this.unk18 = 0; // qword
248-
this.team = -1; // 1A // byte
249-
this.unk17 = 8; // byte
243+
this.cachedType = 0; // byte; cached object type; not always reliable?
244+
this.forgeLabelIndex = -1; // 14 // word; gametype label index
245+
this.flags = 0; // byte // flags: physics, game specifc, symmetry, hide
246+
/*public enum Flags : byte {
247+
PhysicsNormal = 0b00000000,
248+
PhysicsFixed = 0b01000000,
249+
PhysicsPhased = 0b11000000,
250+
GameSpecific = 0b00100000,
251+
Asymmetric = 0b00001000,
252+
Symmetric = 0b00000100,
253+
HideAtStart = 0b00000010
254+
}*/
255+
this.team = 0; // byte { 0:Red, 1:Blue, 2:Green, 3:Orange, 4:Purple, 5:Yellow, 6:Brown, 7:Pink, 8:Neutral, TeamColor = -1 or 255 }
256+
//this.otherInfoA = 0; // byte; spareClips, teleporterChannel, locationNameIndex
257+
//this.otherInfoB = 0; // byte; teleporterPassability
258+
this.color = -1; // 1A // byte { 0:Red, 1:Blue, 2:Green, 3:Orange, 4:Purple, 5:Yellow, 6:Brown, 7:Pink, 8:Neutral, TeamColor = -1 or 255 }
250259
if (!stream)
251260
return;
252261
this.sub6078F0(stream); // read shape
@@ -257,30 +266,30 @@ class LFOUnk30 { // sizeof >= 0x1C
257266
this.spawnSequence = eax & 0xFF;
258267
//
259268
this.respawnTime = stream.readBits(8);
260-
this.unk13 = stream.readBits(5); // teleporter channel? 's got the right number of bits
269+
this.cachedType = stream.readBits(5);
261270
if (stream.readBits(1)) { // absence bit
262271
this.forgeLabelIndex = -1; // word
263272
} else {
264273
this.forgeLabelIndex = stream.readBits(8); // word
265274
}
266-
this.unk16 = stream.readBits(8); // byte
267-
this.unk17 = stream.readBits(4) - 1; // object color?
275+
this.flags = stream.readBits(8); // byte
276+
this.team = stream.readBits(4) - 1;
268277
if (!stream.readBits(1)) {
269-
this.team = stream.readBits(3); // byte
278+
this.color = stream.readBits(3); // byte
270279
} else {
271-
this.team = -1; // byte
280+
this.color = -1; // byte
272281
}
273282
//
274-
if (this.unk13 == 1) {
275-
this.unk18 = stream.readBits(8); // byte
283+
if (this.cachedType == 1) {// weapon
284+
this.spareClips = stream.readBits(8); // byte
276285
return;
277-
} else if (this.unk13 <= 0xB) {
286+
} else if (this.cachedType <= 0xB) {
278287
return;
279-
} else if (this.unk13 <= 0xE) {
280-
this.unk18 = stream.readBits(5); // byte
281-
this.unk19 = stream.readBits(5); // byte
282-
} else if (this.unk13 == 0x13) {
283-
this.unk18 = stream.readBits(8) - 1; // byte
288+
} else if (this.cachedType <= 0xE) {// teleporter
289+
this.teleporterChannel = stream.readBits(5); // byte
290+
this.teleporterPassability = stream.readBits(5); // byte
291+
} else if (this.cachedType == 0x13) {
292+
this.locationNameIndex = stream.readBits(8) - 1; // byte
284293
}
285294
}
286295
}
@@ -580,11 +589,11 @@ class LoadedForgeObject {
580589
//
581590
this.objectSubcat = 0xFFFF; // 02
582591
//
583-
this.unk04 = -1; // dword
592+
this.unk04 = -1; // dword, unused/padding?
584593
this.position = new MVVector(); // 08, 0C, 10
585594
this.rotation = new MVVector(); // 14, 18, 1C // possibly local-forward unit vector
586595
this.axisAngleAxis = new MVVector(); // 20, 24, 28 // most likely local-up unit vector
587-
this.unk2C = -1; // word
596+
this.unk2C = -1; // word, spawnRelativeToMapIndex?
588597
//
589598
// objectSubtype
590599
// Index of an object within a subcategory.
@@ -594,10 +603,10 @@ class LoadedForgeObject {
594603
//
595604
this.objectType = 0; // 2E
596605
//
597-
this.unk2F = 0; // padding?
598-
this.unk30 = null; // struct; all remaining fields are its members
606+
this.pad1 = 0; // padding
607+
this.objectData = null; // struct; all remaining fields are its members
599608
/*//
600-
this.unk30 = 0; // int64?
609+
this.objectData = 0; // int64?
601610
this.unk38 = 0; // int64?
602611
this.unk40 = 0;
603612
this.unk41 = 0; // padding?
@@ -638,15 +647,15 @@ class LoadedForgeObject {
638647
}
639648
let a = stream.readBits(14, false); // TODO: processing
640649
this.loadAxisAngleAngle(a);
641-
this.unk2C = stream.readBits(10, false) - 1;
642-
this.unk30 = new LFOUnk30(stream);
650+
this.unk2C = stream.readBits(10, false) - 1;// spawnRelativeToMapIndex?
651+
this.objectData = new ObjectData(stream);
643652
}
644653
get forgeLabel() {
645654
if (!this.owner)
646655
return void 0;
647-
if (!this.unk30)
656+
if (!this.objectData)
648657
return null;
649-
let index = this.unk30.forgeLabelIndex;
658+
let index = this.objectData.forgeLabelIndex;
650659
if (index < 0)
651660
return null;
652661
let entry = this.owner.forgeLabels.strings[index];

0 commit comments

Comments
 (0)