1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 00:54:14 +02:00

cache entity baseline

This commit is contained in:
Robin Appelman 2017-02-14 22:53:27 +01:00
commit 255602d1e2
6 changed files with 33 additions and 43 deletions

View file

@ -27,7 +27,6 @@ export class Match {
stringTables: StringTable[];
serverClasses: ServerClass[];
sendTables: SendTable[];
instanceBaselines: SendProp[][][];
staticBaseLines: BitStream[];
eventDefinitions: GameEventDefinitionMap;
world: World;
@ -47,7 +46,6 @@ export class Match {
this.stringTables = [];
this.sendTables = [];
this.serverClasses = [];
this.instanceBaselines = [[], []];
this.staticBaseLines = [];
this.eventDefinitions = {};
this.players = [];

View file

@ -16,15 +16,13 @@ export class PacketEntity {
entityIndex: number;
props: SendProp[];
inPVS: boolean;
updatedProps: SendProp[];
constructor(serverClass: ServerClass, entityIndex: number, pvs: PVS) {
this.serverClass = serverClass;
this.entityIndex = entityIndex;
this.props = [];
this.inPVS = false;
this.updatedProps = [];
this.pvs = pvs;
this.serverClass = serverClass;
this.entityIndex = entityIndex;
this.props = [];
this.inPVS = false;
this.pvs = pvs;
}
getPropByDefinition(definition: SendPropDefinition) {
@ -44,5 +42,13 @@ export class PacketEntity {
}
throw new Error('Property not found in entity');
}
clone(): PacketEntity {
const result = new PacketEntity(this.serverClass, this.entityIndex, this.pvs);
for (const prop of this.props) {
result.props.push(prop.clone());
}
return result;
}
}

View file

@ -13,7 +13,7 @@ export class SendProp {
clone():SendProp {
const prop = new SendProp(this.definition);
prop.value = clone(this.value);
prop.value = clone(this.value, false);
return prop;
}
}