mirror of
https://github.com/demostf/demo.js
synced 2026-06-04 09:04:13 +02:00
add encoder for packet message
This commit is contained in:
parent
d54f639633
commit
5241059fd2
8 changed files with 180 additions and 22 deletions
|
|
@ -192,7 +192,7 @@ export function ParsePacketEntities(stream: BitStream, state: ParserState, skip:
|
|||
|
||||
export function EncodePacketEntities(packet: PacketEntitiesPacket, stream: BitStream, state: ParserState) {
|
||||
stream.writeBits(packet.maxEntries, 11);
|
||||
const isDelta = packet.removedEntities.length > 0;
|
||||
const isDelta = packet.delta > 0;
|
||||
stream.writeBoolean(isDelta);
|
||||
if (isDelta) {
|
||||
stream.writeInt32(packet.delta);
|
||||
|
|
|
|||
|
|
@ -76,5 +76,7 @@ export function EncodeTempEntities(packet: TempEntitiesPacket, stream: BitStream
|
|||
|
||||
writeVarInt(entityDataLength, stream);
|
||||
|
||||
stream.writeBitStream(entityStream, entityDataLength);
|
||||
if (entityDataLength > 0) {
|
||||
stream.writeBitStream(entityStream, entityDataLength);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue