t2-demo-parser 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DataBlockParsers.d.ts.map +1 -1
- package/dist/DataBlockParsers.js +89 -48
- package/dist/DataBlockParsers.js.map +1 -1
- package/dist/DataBlockParsers.test.js +128 -0
- package/dist/DataBlockParsers.test.js.map +1 -1
- package/dist/dataBlockDataTypes.d.ts +54 -29
- package/dist/dataBlockDataTypes.d.ts.map +1 -1
- package/dist/dataBlockDataTypes.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataBlockParsers.d.ts","sourceRoot":"","sources":["../src/DataBlockParsers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataBlockParsers.d.ts","sourceRoot":"","sources":["../src/DataBlockParsers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAqxExD,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CA0OtE"}
|
package/dist/DataBlockParsers.js
CHANGED
|
@@ -242,18 +242,23 @@ function shapeBaseImageDataUnpack(bs) {
|
|
|
242
242
|
if (!hasName)
|
|
243
243
|
continue;
|
|
244
244
|
const name = bs.readString();
|
|
245
|
-
// 11 transition values
|
|
246
|
-
|
|
245
|
+
// 11 transition values, each readInt(5), in the ENGINE's packing
|
|
246
|
+
// order (binary-verified; the old names here were rotated by two
|
|
247
|
+
// slots and consumers had to carry a remap table): NotLoaded,
|
|
248
|
+
// Loaded, NoAmmo, Ammo, NoTarget, Target, NotWet, Wet, TriggerUp,
|
|
249
|
+
// TriggerDown, Timeout. Values are 1-based state indices (0 = no
|
|
250
|
+
// transition).
|
|
251
|
+
const transitionOnNotLoaded = bs.readInt(5);
|
|
252
|
+
const transitionOnLoaded = bs.readInt(5);
|
|
247
253
|
const transitionOnNoAmmo = bs.readInt(5);
|
|
248
|
-
const
|
|
254
|
+
const transitionOnAmmo = bs.readInt(5);
|
|
249
255
|
const transitionOnNoTarget = bs.readInt(5);
|
|
250
|
-
const
|
|
256
|
+
const transitionOnTarget = bs.readInt(5);
|
|
251
257
|
const transitionOnNotWet = bs.readInt(5);
|
|
258
|
+
const transitionOnWet = bs.readInt(5);
|
|
252
259
|
const transitionOnTriggerUp = bs.readInt(5);
|
|
253
260
|
const transitionOnTriggerDown = bs.readInt(5);
|
|
254
261
|
const transitionOnTimeout = bs.readInt(5);
|
|
255
|
-
const transitionGeneric0In = bs.readInt(5);
|
|
256
|
-
const transitionGeneric0Out = bs.readInt(5);
|
|
257
262
|
// timeoutValue — flag(!=default) then F32
|
|
258
263
|
const timeoutValue = bs.readFlag() ? bs.readF32() : undefined;
|
|
259
264
|
// waitForTimeout — flag
|
|
@@ -292,6 +297,8 @@ function shapeBaseImageDataUnpack(bs) {
|
|
|
292
297
|
const sound = readDataBlockRef(bs);
|
|
293
298
|
const state = {
|
|
294
299
|
name,
|
|
300
|
+
transitionOnNotLoaded,
|
|
301
|
+
transitionOnLoaded,
|
|
295
302
|
transitionOnAmmo,
|
|
296
303
|
transitionOnNoAmmo,
|
|
297
304
|
transitionOnTarget,
|
|
@@ -301,8 +308,6 @@ function shapeBaseImageDataUnpack(bs) {
|
|
|
301
308
|
transitionOnTriggerUp,
|
|
302
309
|
transitionOnTriggerDown,
|
|
303
310
|
transitionOnTimeout,
|
|
304
|
-
transitionGeneric0In,
|
|
305
|
-
transitionGeneric0Out,
|
|
306
311
|
timeoutValue,
|
|
307
312
|
waitForTimeout,
|
|
308
313
|
fire,
|
|
@@ -950,39 +955,52 @@ function shockLanceProjectileDataUnpack(bs) {
|
|
|
950
955
|
// ELFProjectileData (extends ProjectileData)
|
|
951
956
|
// ============================================================
|
|
952
957
|
function elfProjectileDataUnpack(bs) {
|
|
958
|
+
// Verified against decompiled binary: initPersistFields FUN_0064a860,
|
|
959
|
+
// unpackData FUN_0064ae00. 6×F32 into offsets 0x138 (beamRange) then
|
|
960
|
+
// 0x154..0x164 (the beam/lightning fields), 3 readString (textures),
|
|
961
|
+
// then flag + ranged id (emitter). Field names were previously
|
|
962
|
+
// fabricated; the bit layout was already correct.
|
|
953
963
|
const result = projectileDataUnpack(bs);
|
|
954
|
-
// 6×F32
|
|
964
|
+
// 6×F32 (offsets 0x138, 0x154, 0x158, 0x15c, 0x160, 0x164)
|
|
955
965
|
result.beamRange = bs.readF32();
|
|
956
|
-
result.
|
|
957
|
-
result.
|
|
958
|
-
result.
|
|
959
|
-
result.
|
|
960
|
-
result.
|
|
961
|
-
// 3 readString
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
966
|
+
result.mainBeamWidth = bs.readF32();
|
|
967
|
+
result.mainBeamSpeed = bs.readF32();
|
|
968
|
+
result.mainBeamRepeat = bs.readF32();
|
|
969
|
+
result.lightningWidth = bs.readF32();
|
|
970
|
+
result.lightningDist = bs.readF32();
|
|
971
|
+
// 3 readString (textures[0..2] at 0x140)
|
|
972
|
+
const textures = [];
|
|
973
|
+
for (let i = 0; i < 3; i++)
|
|
974
|
+
textures.push(bs.readString());
|
|
975
|
+
result.textures = textures;
|
|
976
|
+
// 1 readDataBlockRef (emitter at 0x150)
|
|
977
|
+
result.emitter = readDataBlockRef(bs);
|
|
967
978
|
return result;
|
|
968
979
|
}
|
|
969
980
|
// ============================================================
|
|
970
981
|
// RepairProjectileData (extends ProjectileData)
|
|
971
982
|
// ============================================================
|
|
972
983
|
function repairProjectileDataUnpack(bs) {
|
|
984
|
+
// Verified against decompiled binary: initPersistFields FUN_00644910,
|
|
985
|
+
// unpackData FUN_00644c40 — 8×32-bit reads in struct-offset order
|
|
986
|
+
// 0x138, 0x13c, 0x140, 0x148, 0x144, 0x14c, 0x150, 0x154, then 2
|
|
987
|
+
// readString (textures at 0x158). numSegments (0x140) is registered
|
|
988
|
+
// as an S32 (persist type 1) — the old decode read its raw bits as a
|
|
989
|
+
// float. Field names were previously fabricated.
|
|
973
990
|
const result = projectileDataUnpack(bs);
|
|
974
|
-
// 8×F32
|
|
975
991
|
result.beamRange = bs.readF32();
|
|
976
|
-
result.
|
|
977
|
-
result.
|
|
978
|
-
result.
|
|
979
|
-
result.
|
|
980
|
-
result.
|
|
981
|
-
result.
|
|
982
|
-
result.
|
|
983
|
-
// 2 readString
|
|
984
|
-
|
|
985
|
-
|
|
992
|
+
result.beamWidth = bs.readF32();
|
|
993
|
+
result.numSegments = bs.readS32();
|
|
994
|
+
result.beamSpeed = bs.readF32();
|
|
995
|
+
result.texRepeat = bs.readF32();
|
|
996
|
+
result.blurFreq = bs.readF32();
|
|
997
|
+
result.blurLifetime = bs.readF32();
|
|
998
|
+
result.cutoffAngle = bs.readF32();
|
|
999
|
+
// 2 readString (textures[0..1]; retail: redbump2 / redflare)
|
|
1000
|
+
const textures = [];
|
|
1001
|
+
for (let i = 0; i < 2; i++)
|
|
1002
|
+
textures.push(bs.readString());
|
|
1003
|
+
result.textures = textures;
|
|
986
1004
|
return result;
|
|
987
1005
|
}
|
|
988
1006
|
// ============================================================
|
|
@@ -1044,19 +1062,25 @@ function tracerProjectileDataUnpack(bs) {
|
|
|
1044
1062
|
// EnergyProjectileData (extends GrenadeProjectileData)
|
|
1045
1063
|
// ============================================================
|
|
1046
1064
|
function energyProjectileDataUnpack(bs) {
|
|
1047
|
-
// Verified against decompiled binary FUN_00694d80 — parent is FUN_00633cf0
|
|
1065
|
+
// Verified against decompiled binary FUN_00694d80 — parent is FUN_00633cf0
|
|
1066
|
+
// (GrenadeProjectileData). 7×F32 into offsets 0x168..0x180, then 2
|
|
1067
|
+
// readString into 0x158/0x15c; names from initPersistFields FUN_00694b40.
|
|
1048
1068
|
const result = grenadeProjectileDataUnpack(bs);
|
|
1049
|
-
// 7×F32
|
|
1050
|
-
|
|
1051
|
-
result.
|
|
1052
|
-
result.
|
|
1053
|
-
result.
|
|
1054
|
-
result.
|
|
1055
|
-
result.
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1069
|
+
// 7×F32 (offsets 0x168, 0x16c, 0x170, 0x174, then blurColor rgb at
|
|
1070
|
+
// 0x178/0x17c/0x180 — alpha is not transmitted)
|
|
1071
|
+
result.crossViewAng = bs.readF32();
|
|
1072
|
+
result.crossSize = bs.readF32();
|
|
1073
|
+
result.blurLifetime = bs.readF32();
|
|
1074
|
+
result.blurWidth = bs.readF32();
|
|
1075
|
+
result.blurColor = {
|
|
1076
|
+
r: bs.readF32(),
|
|
1077
|
+
g: bs.readF32(),
|
|
1078
|
+
b: bs.readF32(),
|
|
1079
|
+
a: 1,
|
|
1080
|
+
};
|
|
1081
|
+
// 2 readString (offsets 0x158, 0x15c)
|
|
1082
|
+
result.texture0 = bs.readString();
|
|
1083
|
+
result.texture1 = bs.readString();
|
|
1060
1084
|
return result;
|
|
1061
1085
|
}
|
|
1062
1086
|
// ============================================================
|
|
@@ -1836,11 +1860,13 @@ function runningLightDataUnpack(bs) {
|
|
|
1836
1860
|
result.length = bs.readF32(); // 0x78
|
|
1837
1861
|
result.nodeName = bs.readString(); // 0x5c
|
|
1838
1862
|
result.direction = {
|
|
1863
|
+
// 0x60-0x68
|
|
1839
1864
|
x: bs.readF32(),
|
|
1840
1865
|
y: bs.readF32(),
|
|
1841
1866
|
z: bs.readF32(),
|
|
1842
1867
|
};
|
|
1843
1868
|
result.offset = {
|
|
1869
|
+
// 0x6c-0x74
|
|
1844
1870
|
x: bs.readF32(),
|
|
1845
1871
|
y: bs.readF32(),
|
|
1846
1872
|
z: bs.readF32(),
|
|
@@ -1865,7 +1891,10 @@ export function registerDataBlockParsers(registry) {
|
|
|
1865
1891
|
unpackData: shapeBaseImageDataUnpack,
|
|
1866
1892
|
});
|
|
1867
1893
|
// Player/Vehicle types
|
|
1868
|
-
registry.catalogDataBlock({
|
|
1894
|
+
registry.catalogDataBlock({
|
|
1895
|
+
name: "PlayerData",
|
|
1896
|
+
unpackData: playerDataUnpack,
|
|
1897
|
+
});
|
|
1869
1898
|
registry.catalogDataBlock({
|
|
1870
1899
|
name: "VehicleData",
|
|
1871
1900
|
unpackData: vehicleDataUnpack,
|
|
@@ -1887,7 +1916,10 @@ export function registerDataBlockParsers(registry) {
|
|
|
1887
1916
|
name: "StaticShapeData",
|
|
1888
1917
|
unpackData: staticShapeDataUnpack,
|
|
1889
1918
|
});
|
|
1890
|
-
registry.catalogDataBlock({
|
|
1919
|
+
registry.catalogDataBlock({
|
|
1920
|
+
name: "TurretData",
|
|
1921
|
+
unpackData: turretDataUnpack,
|
|
1922
|
+
});
|
|
1891
1923
|
registry.catalogDataBlock({
|
|
1892
1924
|
name: "TurretImageData",
|
|
1893
1925
|
unpackData: turretImageDataUnpack,
|
|
@@ -1956,8 +1988,14 @@ export function registerDataBlockParsers(registry) {
|
|
|
1956
1988
|
name: "ExplosionData",
|
|
1957
1989
|
unpackData: explosionDataUnpack,
|
|
1958
1990
|
});
|
|
1959
|
-
registry.catalogDataBlock({
|
|
1960
|
-
|
|
1991
|
+
registry.catalogDataBlock({
|
|
1992
|
+
name: "DebrisData",
|
|
1993
|
+
unpackData: debrisDataUnpack,
|
|
1994
|
+
});
|
|
1995
|
+
registry.catalogDataBlock({
|
|
1996
|
+
name: "SplashData",
|
|
1997
|
+
unpackData: splashDataUnpack,
|
|
1998
|
+
});
|
|
1961
1999
|
registry.catalogDataBlock({
|
|
1962
2000
|
name: "ShockwaveData",
|
|
1963
2001
|
unpackData: shockwaveDataUnpack,
|
|
@@ -1993,7 +2031,10 @@ export function registerDataBlockParsers(registry) {
|
|
|
1993
2031
|
name: "CameraData",
|
|
1994
2032
|
unpackData: cameraDataUnpack,
|
|
1995
2033
|
});
|
|
1996
|
-
registry.catalogDataBlock({
|
|
2034
|
+
registry.catalogDataBlock({
|
|
2035
|
+
name: "SensorData",
|
|
2036
|
+
unpackData: sensorDataUnpack,
|
|
2037
|
+
});
|
|
1997
2038
|
registry.catalogDataBlock({
|
|
1998
2039
|
name: "TriggerData",
|
|
1999
2040
|
unpackData: triggerDataUnpack,
|