1
0
Fork 0
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:
Robin Appelman 2017-02-21 20:56:33 +01:00
commit f66ab3ffaf
3 changed files with 13 additions and 3 deletions

View file

@ -23,7 +23,9 @@ 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) {
saveInstanceBaseLine(instanceBaseLine, match); if (instanceBaseLine) {
saveInstanceBaseLine(instanceBaseLine, match);
}
} }
} }
} }

View file

@ -33,7 +33,11 @@ export function parseStringTable(stream: BitStream, table: StringTable, entries:
const restOfString = stream.readASCIIString(); const restOfString = stream.readASCIIString();
value = history[index].text.substr(0, bytesToCopy) + restOfString; 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;
}
} 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,

View file

@ -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');
});
}); });