Beispiel #1
0
        private Event?Process(CSVCMsg_PacketEntities message)
        {
            log.Debug("svc_PacketEntities is_delta: "
                      + message.is_delta
                      + " baseline: " + message.baseline
                      + " update_baseline: " + message.update_baseline
                      + " delta: " + message.delta_from);

            using (var stream = Bitstream.CreateWith(message.entity_data)) {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                client.Baseline = message.baseline;
                return(Event.BASELINE);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        private Events?Handle(CSVCMsg_PacketEntities message)
        {
            using (var stream = Bitstream.CreateWith(message.entity_data))
            {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                var ack = new CCLCMsg_BaselineAck
                {
                    baseline_nr   = state.Baseline,
                    baseline_tick = (int)state.ServerTick
                };
                var ackMsg = DotaGameConnection.ConvertProtoToMessage(
                    (uint)CLC_Messages.clc_BaselineAck,
                    ack);
                connection.SendReliably(ackMsg);
                return(null);
            }
            return(null);
        }
Beispiel #3
0
        private Event?Process(CSVCMsg_PacketEntities message)
        {
            log.Debug("svc_PacketEntities is_delta: "
                      + message.is_delta
                      + " baseline: " + message.baseline
                      + " update_baseline: " + message.update_baseline
                      + " delta: " + message.delta_from);

            using (var stream = Bitstream.CreateWith(message.entity_data)) {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                var ack = new CCLCMsg_BaselineAck();
                ack.baseline_nr   = client.Baseline;
                ack.baseline_tick = (int)client.ServerTick;
                var ackMsg = Connection.ConvertProtoToMessage <CCLCMsg_BaselineAck>(
                    (uint)CLC_Messages.clc_BaselineAck,
                    ack);
                connection.SendReliably(ackMsg);
                return(null);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        public bool TryApplyMessage(ProtoBuf.IExtensible message, DemoParser parser)
        {
            CSVCMsg_PacketEntities packetEntities = message as CSVCMsg_PacketEntities;

            if (packetEntities == null)
            {
                return(false);
            }

            // TODO check
            // In official C++ source code, loop is from last to first entities in packetEntities -> impact ?
            using (IBitStream reader = BitStreamUtil.Create(packetEntities.entity_data)) {
                int currentEntity = -1;

                for (int i = 0; i < packetEntities.updated_entries; i++)
                {
                    currentEntity += 1 + (int)reader.ReadUBitInt();

                    if (!reader.ReadBit())
                    {
                        Entity entity;

                        if (reader.ReadBit())
                        {
                            // EnterPVS = add entity
                            entity = EnterPVS(reader, currentEntity, parser);
                        }
                        else
                        {
                            // DeltaEnt = update entity
                            entity = parser.entities[currentEntity];
                        }

                        entity.ApplyUpdate(reader);

                        UpdateModel(entity, parser);

                        Debug.WriteLine("Entity #" + entity.ID + ": " + entity.ServerClass.Name);
                    }
                    else
                    {
                        // LeavePVS
                        if (reader.ReadBit())
                        {
                            parser.entities.Remove(currentEntity);
                        }
                    }
                }
            }

            return(true);
        }
Beispiel #5
0
        private Events?Handle(CSVCMsg_PacketEntities message)
        {
            using (var stream = Bitstream.CreateWith(message.entity_data))
            {
                entityUpdater.Update(
                    stream,
                    (uint)message.baseline,
                    message.update_baseline,
                    (uint)message.updated_entries,
                    message.is_delta);
            }

            if (message.update_baseline)
            {
                state.Baseline = message.baseline;
                return(Events.BASELINE);
            }
            return(null);
        }