Exemple #1
0
 private void Reset()
 {
     this.m_Name          = "";
     this.m_HostName      = "";
     this.m_Username      = this.m_Password = "";
     this.m_Bpp           = 0x10;
     this.m_Port          = 0xd3d;
     this.m_CacheFilename = "";
     this.m_Flags         = HostFlags.DefaultFlags;
 }
Exemple #2
0
        public override HostFlags GetHostFlags()
        {
            CheckDisposed();

            if (hostFlags == HostFlags.Invalid)
            {
                hostFlags = base.GetHostFlags();
            }

            return(hostFlags);
        }
Exemple #3
0
        ///////////////////////////////////////////////////////////////////////

        public static bool HasFlags(
            HostFlags flags,
            HostFlags hasFlags,
            bool all
            )
        {
            if (all)
            {
                return((flags & hasFlags) == hasFlags);
            }
            else
            {
                return((flags & hasFlags) != HostFlags.None);
            }
        }
Exemple #4
0
        public override HostFlags GetHostFlags()
        {
            CheckDisposed();

            if (hostFlags == HostFlags.Invalid)
            {
                //
                // NOTE: We support no colors (i.e. monochrome) and
                //       unlimited text output.
                //
                hostFlags = HostFlags.Monochrome | HostFlags.Text |
                            HostFlags.UnlimitedSize | base.GetHostFlags();
            }

            return(hostFlags);
        }
Exemple #5
0
        public bool AddToFullPack(EntityState state, int e, Edict ent, Edict host, HostFlags hostFlags, bool isPlayer, IntPtr pSet)
        {
            //Never add entities that aren't in use
            if (ent.Free)
            {
                return(false);
            }

            var entity     = ent.Entity();
            var hostEntity = host.Entity();

            // don't send if flagged for NODRAW and it's not the host getting the message
            if ((entity.Effects & EntityEffects.NoDraw) != 0 &&
                (entity != hostEntity))
            {
                return(false);
            }

            // Ignore ents without valid / visible models
            if (entity.ModelIndex == 0 || string.IsNullOrEmpty(entity.ModelName))
            {
                return(false);
            }

            // Don't send spectators to other players
            if ((entity.Flags & EntFlags.Spectator) != 0 && (entity != hostEntity))
            {
                return(false);
            }

            // Ignore if not the host and not touching a PVS/PAS leaf
            // If pSet is NULL, then the test will always succeed and the entity will be added to the update
            if (entity != hostEntity)
            {
                if (!EngineServer.CheckVisibility(ent, pSet))
                {
                    return(false);
                }
            }

            // Don't send entity to local client if the client says it's predicting the entity itself.
            if ((entity.Flags & EntFlags.SkipLocalHost) != 0)
            {
                if ((hostFlags & HostFlags.SkipLocalEnts) != 0 && (entity.Owner == hostEntity))
                {
                    return(false);
                }
            }

            if (hostEntity.GroupInfo != 0)
            {
                Trace.PushGroupTrace(hostEntity.GroupInfo, GroupOp.And);

                try
                {
                    Trace.GetGroupTrace(out var currentMask, out var currentOp);

                    // Should always be set, of course
                    if (entity.GroupInfo != 0)
                    {
                        if (currentOp == GroupOp.And)
                        {
                            if ((entity.GroupInfo & hostEntity.GroupInfo) == 0)
                            {
                                return(false);
                            }
                        }
                        else if (currentOp == GroupOp.NAnd)
                        {
                            if ((entity.GroupInfo & hostEntity.GroupInfo) != 0)
                            {
                                return(false);
                            }
                        }
                    }
                }
                finally
                {
                    //There is a bug in the SDK that can cause the last group trace to remain if it failed the tests above
                    Trace.PopGroupTrace();
                }
            }

            //This is done by the wrapper since there's no memset in managed code
            //memset(state, 0, sizeof( * state) );

            // Assign index so we can track this entity from frame to frame and
            //  delta from it.
            state.Number     = e;
            state.EntityType = EntityType.Normal;

            // Flag custom entities.
            if ((entity.Flags & EntFlags.CustomEntity) != 0)
            {
                state.EntityType = EntityType.Beam;
            }

            //
            // Copy state data
            //

            // Round animtime to nearest millisecond
            state.AnimTime = (float)((int)(1000.0 * entity.AnimationTime) / 1000.0);

            state.Origin = entity.Origin;
            state.Angles = entity.Angles;
            state.Mins   = entity.Mins;
            state.Maxs   = entity.Maxs;

            state.EndPos   = entity.EndPosition;
            state.StartPos = entity.StartPosition;

            state.ImpactTime = entity.ImpactTime;
            state.StartTime  = entity.StartTime;

            state.ModelIndex = entity.ModelIndex;

            state.Frame = entity.Frame;

            state.Skin    = (short)entity.Skin;
            state.Effects = entity.Effects;

            // This non-player entity is being moved by the game .dll and not the physics simulation system
            //  make sure that we interpolate it's position on the client if it moves
            if (!isPlayer &&
                entity.AnimationTime != 0 &&
                entity.Velocity[0] == 0 &&
                entity.Velocity[1] == 0 &&
                entity.Velocity[2] == 0)
            {
                state.EFlags |= EntityStateFlags.SLerp;
            }

            state.Scale    = entity.Scale;
            state.Solid    = entity.Solid;
            state.ColorMap = entity.ColorMap;

            state.MoveType  = entity.MoveType;
            state.Sequence  = entity.Sequence;
            state.FrameRate = entity.FrameRate;
            state.Body      = entity.Body;

            for (var i = 0; i < 4; ++i)
            {
                state.SetController(i, entity.GetController(i));
            }

            for (var i = 0; i < 2; ++i)
            {
                state.SetBlending(i, entity.GetBlending(i));
            }

            state.RenderMode   = entity.RenderMode;
            state.RenderAmount = (int)entity.RenderAmount;
            state.RenderEffect = entity.RenderEffect;

            state.RenderColor = new Color24
            {
                r = (byte)entity.RenderColor.x,
                g = (byte)entity.RenderColor.y,
                b = (byte)entity.RenderColor.z
            };

            state.AimEnt = 0;
            if (entity.AimEntity != null)
            {
                state.AimEnt = entity.AimEntity.EntIndex();
            }

            state.Owner = 0;
            if (entity.Owner != null)
            {
                var owner = entity.Owner.EntIndex();

                // Only care if owned by a player
                if (owner >= 1 && owner <= Globals.MaxClients)
                {
                    state.Owner = owner;
                }
            }

            // HACK:  Somewhat...
            // Class is overridden for non-players to signify a breakable glass object ( sort of a class? )
            if (!isPlayer)
            {
                state.PlayerClass = entity.PlayerClass;
            }

            // Special stuff for players only
            if (isPlayer)
            {
                state.BaseVelocity = entity.BaseVelocity;

                state.WeaponModel  = EngineModel.IndexOf(entity.WeaponModelName);
                state.GaitSequence = entity.GaitSequence;
                state.Spectator    = (entity.Flags & EntFlags.Spectator) != 0;
                state.Friction     = entity.Friction;

                state.Gravity = entity.Gravity;
                //		state.Team			= entity.Team;
                //
                state.UseHull = (entity.Flags & EntFlags.Ducking) != 0 ? 1 : 0;
                state.Health  = (int)entity.Health;
            }

            return(true);
        }
Exemple #6
0
 public static bool IsHostFlagSet(HostFlags Flag)
 {
     return((flags & Flag) == Flag);
 }
Exemple #7
0
 // Методы из класса Options
 internal static bool IsHostFlagSet(HostFlags Flag)
 {
     return((flags & Flag) == Flag);
 }
 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;
     }
 }
Exemple #9
0
 public void Host(ApplicationDescription applicationDescription, Address deviceAddress, HostFlags flags)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
 public void Host(ApplicationDescription applicationDescription, Address[] deviceAddress, object playerContext, HostFlags flags)
 {
     throw new NotImplementedException();
 }