mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 00:54:14 +02:00
parse updated voice init
This commit is contained in:
parent
15704c89fc
commit
2e56bb8881
4 changed files with 31 additions and 6 deletions
|
|
@ -96,6 +96,12 @@ export interface UnknownUserMessagePacket {
|
||||||
type: number;
|
type: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface VoiceInitPacket {
|
||||||
|
packetType: 'voiceInit';
|
||||||
|
codec: string;
|
||||||
|
quality: number;
|
||||||
|
}
|
||||||
|
|
||||||
export type UserMessagePacket = SayText2Packet | TextMessagePacket | UnknownUserMessagePacket;
|
export type UserMessagePacket = SayText2Packet | TextMessagePacket | UnknownUserMessagePacket;
|
||||||
|
|
||||||
export type Packet = BSPDecalPacket |
|
export type Packet = BSPDecalPacket |
|
||||||
|
|
@ -109,4 +115,5 @@ export type Packet = BSPDecalPacket |
|
||||||
ParseSoundsPacket |
|
ParseSoundsPacket |
|
||||||
SetConVarPacket |
|
SetConVarPacket |
|
||||||
TempEntitiesPacket |
|
TempEntitiesPacket |
|
||||||
UserMessagePacket;
|
UserMessagePacket |
|
||||||
|
VoiceInitPacket;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import * as clone from 'clone';
|
|
||||||
import {SendPropDefinition} from "./SendPropDefinition";
|
import {SendPropDefinition} from "./SendPropDefinition";
|
||||||
import {Vector} from "./Vector";
|
import {Vector} from "./Vector";
|
||||||
|
|
||||||
|
|
@ -13,7 +12,7 @@ export class SendProp {
|
||||||
|
|
||||||
clone():SendProp {
|
clone():SendProp {
|
||||||
const prop = new SendProp(this.definition);
|
const prop = new SendProp(this.definition);
|
||||||
prop.value = clone(this.value, false);
|
prop.value = this.value;
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,9 @@ import {ParseSounds} from '../Packet/ParseSounds';
|
||||||
import {SetConVar} from '../Packet/SetConVar';
|
import {SetConVar} from '../Packet/SetConVar';
|
||||||
import {UpdateStringTable} from '../Packet/UpdateStringTable';
|
import {UpdateStringTable} from '../Packet/UpdateStringTable';
|
||||||
import {UserMessage} from '../Packet/UserMessage';
|
import {UserMessage} from '../Packet/UserMessage';
|
||||||
import {PacketParserMap} from '../Packet/Parser'
|
import {PacketParserMap} from '../Packet/Parser';
|
||||||
import {TempEntities} from '../Packet/TempEntities'
|
import {TempEntities} from '../Packet/TempEntities';
|
||||||
|
import {VoiceInit} from '../Packet/VoiceInit';
|
||||||
|
|
||||||
import {GameEventDefinitionMap} from "../../Data/GameEvent";
|
import {GameEventDefinitionMap} from "../../Data/GameEvent";
|
||||||
|
|
||||||
|
|
@ -63,7 +64,7 @@ export class Packet extends Parser {
|
||||||
11: ParserGenerator.make('setPause', 'paused{b}'),
|
11: ParserGenerator.make('setPause', 'paused{b}'),
|
||||||
12: CreateStringTable,
|
12: CreateStringTable,
|
||||||
13: UpdateStringTable,
|
13: UpdateStringTable,
|
||||||
14: ParserGenerator.make('voiceInit', 'codec{s}quality{8}'),
|
14: VoiceInit,
|
||||||
15: ParserGenerator.make('voiceData', 'client{8}proximity{8}length{16}_{$length}'),
|
15: ParserGenerator.make('voiceData', 'client{8}proximity{8}length{16}_{$length}'),
|
||||||
17: ParseSounds,
|
17: ParseSounds,
|
||||||
18: ParserGenerator.make('setView', 'index{11}'),
|
18: ParserGenerator.make('setView', 'index{11}'),
|
||||||
|
|
|
||||||
18
src/Parser/Packet/VoiceInit.ts
Normal file
18
src/Parser/Packet/VoiceInit.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
import {VoiceInitPacket} from "../../Data/Packet";
|
||||||
|
import {BitStream} from 'bit-buffer';
|
||||||
|
|
||||||
|
export function VoiceInit(stream: BitStream): VoiceInitPacket {
|
||||||
|
//ParserGenerator.make('voiceInit', 'codec{s}quality{8}'),
|
||||||
|
const codec = stream.readASCIIString();
|
||||||
|
const quality = stream.readUint8();
|
||||||
|
if (codec === 'vaudio_celt') {
|
||||||
|
// no clue, from 2017-2-14 update
|
||||||
|
stream.readUint8();
|
||||||
|
stream.readUint8();
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
packetType: 'voiceInit',
|
||||||
|
codec: codec,
|
||||||
|
quality: quality
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue