Exemplo n.º 1
0
        internal void KeyValue(Edict.Native *pentKeyvalue, KeyValueData.Native *pkvd)
        {
            try
            {
                if (FirstKeyValueCall)
                {
                    FirstKeyValueCall = false;

                    var pEdictList = EngineFuncs.pfnPEntityOfEntOffset(0);

                    Log.Message($"Initializing entity dictionary with 0x{(uint)pEdictList:X} as edict list address");

                    EntityDictionary.Initialize(pEdictList, Globals.MaxEntities);

                    Log.Message("Finished initializing entity dictionary");
                }

                Entities.KeyValue(EntityDictionary.EdictFromNative(pentKeyvalue), new KeyValueData(pkvd));
            }
            catch (Exception e)
            {
                Log.Exception(e);
                throw;
            }
        }
Exemplo n.º 2
0
        private unsafe int EntityIndex(Edict.Native *pEdict)
        {
            var baseAddress = NativeEdict(0);

            var index = pEdict - baseAddress;

            return((int)index);
        }
Exemplo n.º 3
0
 internal void ClientPutInServer(Edict.Native *pEntity)
 {
     try
     {
         GameClients.PutInServer(EntityDictionary.EdictFromNative(pEntity));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 4
0
 internal void ClientDisconnect(Edict.Native *pEntity)
 {
     try
     {
         GameClients.Disconnect(EntityDictionary.EdictFromNative(pEntity));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 5
0
 internal void SetAbsBox(Edict.Native *pent)
 {
     try
     {
         Entities.SetAbsBox(EntityDictionary.EdictFromNative(pent));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 6
0
 internal int Restore(Edict.Native *pent, SaveRestoreData.Native *pSaveData, int globalEntity)
 {
     try
     {
         return(Persistence.Restore(EntityDictionary.EdictFromNative(pent), new SaveRestoreData(pSaveData), globalEntity != 0) ? 0 : -1);
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 7
0
 internal void Save(Edict.Native *pent, SaveRestoreData.Native *pSaveData)
 {
     try
     {
         Persistence.Save(EntityDictionary.EdictFromNative(pent), new SaveRestoreData(pSaveData));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 8
0
 internal void ClientCommand(Edict.Native *pEntity)
 {
     try
     {
         GameClients.Command(EntityDictionary.EdictFromNative(pEntity), new Command(ServerAPIUtils.ArgsAsList(EngineFuncs)));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 9
0
 internal void PlayerCustomization(Edict.Native *pEntity, Customization.Native *pCustom)
 {
     try
     {
         GameClients.Customization(EntityDictionary.EdictFromNative(pEntity), new Customization(pCustom));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 10
0
 internal void CvarValue(Edict.Native *pEnt, string value)
 {
     try
     {
         ServerInterface.CvarValue(EntityDictionary.EdictFromNative(pEnt), value);
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 11
0
 internal int ShouldCollide(Edict.Native *pentTouched, Edict.Native *pentOther)
 {
     try
     {
         return(ServerEntities.ShouldCollide(EntityDictionary.EdictFromNative(pentTouched), EntityDictionary.EdictFromNative(pentOther)) ? 1 : 0);
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 12
0
 internal void CvarValue2(Edict.Native *pEnt, int requestID, string cvarName, string value)
 {
     try
     {
         ServerInterface.CvarValue2(EntityDictionary.EdictFromNative(pEnt), requestID, cvarName, value);
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 13
0
 internal void OnFreeEntPrivateData(Edict.Native *pEnt)
 {
     try
     {
         ServerEntities.OnFreeEntPrivateData(EntityDictionary.EdictFromNative(pEnt));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 14
0
 internal void SetupVisibility(Edict.Native *pViewEntity, Edict.Native *pClient, out IntPtr pvs, out IntPtr pas)
 {
     try
     {
         Networking.SetupVisibility(pViewEntity != null ? EntityDictionary.EdictFromNative(pViewEntity) : null, EntityDictionary.EdictFromNative(pClient), out pvs, out pas);
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 15
0
 internal void UpdateClientData(Edict.Native *ent, QBoolean sendweapons, ClientData.Native *cd)
 {
     try
     {
         Networking.UpdateClientData(EntityDictionary.EdictFromNative(ent), sendweapons != QBoolean.False, new ClientData(cd));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 16
0
#pragma warning disable RCS1163 // Unused parameter.
        internal void SpectatorThink(Edict.Native *pEntity)
#pragma warning restore RCS1163 // Unused parameter.
        {
            try
            {
            }
            catch (Exception e)
            {
                Log.Exception(e);
                throw;
            }
        }
Exemplo n.º 17
0
 internal void Blocked(Edict.Native *pentBlocked, Edict.Native *pentOther)
 {
     try
     {
         Entities.Blocked(EntityDictionary.EdictFromNative(pentBlocked), EntityDictionary.EdictFromNative(pentOther));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 18
0
 internal void PlayerPostThink(Edict.Native *pEntity)
 {
     try
     {
         GameClients.PostThink(EntityDictionary.EdictFromNative(pEntity));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// Called by ServerActivate to initialize the managed list of edicts
        /// </summary>
        /// <param name="pEdictList"></param>
        /// <param name="maxEntities"></param>
        public unsafe void Initialize(Edict.Native *pEdictList, int maxEntities)
        {
            HighestInUse = -1;

            List = new List <Edict>(maxEntities);

            //Create all managed edicts
            for (int i = 0; i < maxEntities; ++i)
            {
                List.Add(new Edict(&pEdictList[i]));
            }
        }
Exemplo n.º 20
0
 internal int Spawn(Edict.Native *pent)
 {
     try
     {
         return(Entities.Spawn(EntityDictionary.EdictFromNative(pent)));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 21
0
        public unsafe Edict EdictFromNative(Edict.Native *address)
        {
            if (address == null)
            {
                return(null);
            }

            var baseAddress = NativeEdict(0);

            var index = address - baseAddress;

            return(List[(int)index]);
        }
Exemplo n.º 22
0
 internal void ClientUserInfoChanged(Edict.Native *pEntity, IntPtr infoBuffer)
 {
     try
     {
         var edict = EntityDictionary.EdictFromNative(pEntity);
         GameClients.UserInfoChanged(edict, new ClientInfoBuffer(EngineFuncs, infoBuffer, EntityDictionary.EntityIndex(edict)));
     }
     catch (Exception e)
     {
         Log.Exception(e);
         throw;
     }
 }
Exemplo n.º 23
0
        internal QBoolean ClientConnect(Edict.Native *pEntity, string name, string address, byte *szRejectReason)
        {
            try
            {
                var result = GameClients.Connect(EntityDictionary.EdictFromNative(pEntity), name, address, out var rejectReason);

                InterfaceUtils.CopyStringToUnmanagedBuffer(rejectReason ?? string.Empty, szRejectReason, Interfaces.DLLFunctions.ClientConnectRejectReasonLength);

                return(result ? QBoolean.True : QBoolean.False);
            }
            catch (Exception e)
            {
                Log.Exception(e);
                throw;
            }
        }
Exemplo n.º 24
0
#pragma warning disable RCS1163 // Unused parameter.
        internal void ServerActivate(Edict.Native *pEdictList, int edictCount, int clientMax)
#pragma warning restore RCS1163 // Unused parameter.
        {
            try
            {
                //This is done in KeyValue because we need the list earlier than this gets called
                //EntityDictionary.Initialize(pEdictList, Program.Wrapper.Globals.MaxEntities);

                ServerInterface.Activate();
            }
            catch (Exception e)
            {
                Log.Exception(e);
                throw;
            }
        }
Exemplo n.º 25
0
 internal QBoolean AddToFullPack(EntityState.Native *state, int e, Edict.Native *ent, Edict.Native *host, HostFlags hostflags, QBoolean player, IntPtr pSet)
 {
     try
     {
         return(Networking.AddToFullPack(
                    new EntityState(state),
                    e,
                    EntityDictionary.EdictFromNative(ent),
                    EntityDictionary.EdictFromNative(host),
                    hostflags,
                    player != QBoolean.False, pSet
                    )
             ? QBoolean.True : QBoolean.False);
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
         throw;
     }
 }
Exemplo n.º 26
0
 internal void CreateBaseline(int player, int eindex, EntityState.Native *baseline, Edict.Native *entity, int playermodelindex, in Vector player_mins, in Vector player_maxs)
Exemplo n.º 27
0
 //This is cheating a bit: normally you should use the engine functions for physics strings,
 //But they internally do exactly the same thing as the info buffers so we can just use that instead
 //It's also a bit more efficient
 internal ClientPhysicsInfoBuffer(EngineFuncs engineFuncs, Edict.Native *pClient, int clientIndex)
     : base(engineFuncs ?? throw new ArgumentNullException(nameof(engineFuncs)), engineFuncs.pfnGetPhysicsInfoString(pClient), clientIndex)
 {
 }