mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
fix parsing pov stringtables
This commit is contained in:
parent
2519a349d5
commit
f66ab3ffaf
3 changed files with 13 additions and 3 deletions
|
|
@ -23,10 +23,12 @@ export function handleStringTable(packet: StringTablePacket, match: Match) {
|
||||||
}
|
}
|
||||||
if (table.name === 'instancebaseline') {
|
if (table.name === 'instancebaseline') {
|
||||||
for (const instanceBaseLine of table.entries) {
|
for (const instanceBaseLine of table.entries) {
|
||||||
|
if (instanceBaseLine) {
|
||||||
saveInstanceBaseLine(instanceBaseLine, match);
|
saveInstanceBaseLine(instanceBaseLine, match);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveInstanceBaseLine(entry: StringTableEntry, match: Match) {
|
function saveInstanceBaseLine(entry: StringTableEntry, match: Match) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,11 @@ export function parseStringTable(stream: BitStream, table: StringTable, entries:
|
||||||
|
|
||||||
const restOfString = stream.readASCIIString();
|
const restOfString = stream.readASCIIString();
|
||||||
|
|
||||||
|
if (!history[index].text) {
|
||||||
|
value = restOfString; // best guess, happens in some pov demos but only for unimported tables it seems
|
||||||
|
} else {
|
||||||
value = history[index].text.substr(0, bytesToCopy) + restOfString;
|
value = history[index].text.substr(0, bytesToCopy) + restOfString;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
value = stream.readASCIIString();
|
value = stream.readASCIIString();
|
||||||
}
|
}
|
||||||
|
|
@ -55,11 +59,11 @@ export function parseStringTable(stream: BitStream, table: StringTable, entries:
|
||||||
if (userData) {
|
if (userData) {
|
||||||
existingEntry.extraData = userData;
|
existingEntry.extraData = userData;
|
||||||
}
|
}
|
||||||
history.push(existingEntry);
|
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
existingEntry.text = value;
|
existingEntry.text = value;
|
||||||
}
|
}
|
||||||
|
history.push(existingEntry);
|
||||||
} else {
|
} else {
|
||||||
table.entries[entryIndex] = {
|
table.entries[entryIndex] = {
|
||||||
text: value,
|
text: value,
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,8 @@ suite('Parse basic demo info', () => {
|
||||||
test('Parse demo with new celt voice codec', () => {
|
test('Parse demo with new celt voice codec', () => {
|
||||||
testDemo('celt');
|
testDemo('celt');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Parse pov demo', () => {
|
||||||
|
testDemo('pov');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue