Clean up reader.string

This commit is contained in:
mmorrison 2019-02-04 19:58:28 -06:00
parent 6189d2fa62
commit fc5975bf0c
12 changed files with 58 additions and 61 deletions

View file

@ -16,10 +16,10 @@ class Doom3 extends Core {
if(header !== 0xffff) return;
const header2 = reader.string();
if(header2 !== 'infoResponse') return;
const challengePart1 = reader.string({length:4});
const challengePart1 = reader.string(4);
if (challengePart1 !== "PiNG") return;
// some doom3 implementations only return the first 4 bytes of the challenge
const challengePart2 = reader.string({length:4});
const challengePart2 = reader.string(4);
if (challengePart2 !== 'PoNg') reader.skip(-4);
return reader.rest();
});