Esempio n. 1
0
        public void LoadDynamic(BinaryReaderBE reader)
        {
            Type  = (PlatformType)reader.ReadInt16();
            flags = (PlatformFlags)reader.ReadUInt32();
            Speed = reader.ReadInt16();
            Delay = reader.ReadInt16();

            short minimumFloorHeight   = reader.ReadInt16();
            short maximumFloorHeight   = reader.ReadInt16();
            short minimumCeilingHeight = reader.ReadInt16();
            short maximumCeilingHeight = reader.ReadInt16();

            PolygonIndex = reader.ReadInt16();

            reader.BaseStream.Seek(8 + 64 + 2, SeekOrigin.Current); // stuff we don't care about
            Tag = reader.ReadInt16();
            reader.BaseStream.Seek(22 * 2, SeekOrigin.Current);

            if (ComesFromCeiling && ComesFromFloor)
            {
                MaximumHeight = maximumCeilingHeight;
                MinimumHeight = minimumFloorHeight;
            }
            else if (ComesFromCeiling)
            {
                MaximumHeight = maximumCeilingHeight;
                MinimumHeight = minimumCeilingHeight;
            }
            else if (ComesFromFloor)
            {
                MaximumHeight = maximumFloorHeight;
                MinimumHeight = minimumFloorHeight;
            }
        }
Esempio n. 2
0
 // does not copy polygon index
 public void CopyFrom(Platform other)
 {
     Type          = other.Type;
     MaximumHeight = other.MaximumHeight;
     MinimumHeight = other.MinimumHeight;
     Speed         = other.Speed;
     Delay         = other.Delay;
     flags         = other.flags;
     Tag           = other.Tag;
 }
Esempio n. 3
0
        public static bool SetDefaultTarget()
        {
            bool isDefault = false;

            PlatformFlags currentPlatform = Application.Platform;

            foreach (ICppCompilerService service in CompilerServices.Services)
            {
                foreach (TargetPlatform platform in service.Platforms)
                {
                    string name = platform.Name.ToLowerInvariant();
                    if ((currentPlatform & PlatformFlags.Windows).ToString().ToLowerInvariant() == name ||
                        (currentPlatform & PlatformFlags.Linux).ToString().ToLowerInvariant() == name)
                    {
                        foreach (TargetArchitecture architecture in service.Architectures)
                        {
                            switch (architecture)
                            {
                            case TargetArchitecture.x86:
                                if ((currentPlatform & PlatformFlags.x86) == PlatformFlags.x86)
                                {
                                    targets = new BuildTarget[] { new BuildTarget(platform, architecture, BuildMode.Default) };
                                }
                                break;

                            case TargetArchitecture.x64:
                                if ((currentPlatform & PlatformFlags.x64) == PlatformFlags.x64)
                                {
                                    targets = new BuildTarget[] { new BuildTarget(platform, architecture, BuildMode.Default) };
                                }
                                break;
                            }

                            isDefault = targets.Length != 0;
                            if (isDefault)
                            {
                                break;
                            }
                        }
                    }

                    if (isDefault)
                    {
                        break;
                    }
                }

                if (isDefault)
                {
                    break;
                }
            }

            return(isDefault);
        }
Esempio n. 4
0
 void SetFlag(PlatformFlags flag, bool value)
 {
     if (value)
     {
         flags |= flag;
     }
     else
     {
         flags &= ~flag;
     }
 }
Esempio n. 5
0
 public void Load(BinaryReaderBE reader)
 {
     Type          = (PlatformType)reader.ReadInt16();
     Speed         = reader.ReadInt16();
     Delay         = reader.ReadInt16();
     MaximumHeight = reader.ReadInt16();
     MinimumHeight = reader.ReadInt16();
     flags         = (PlatformFlags)reader.ReadUInt32();
     PolygonIndex  = reader.ReadInt16();
     Tag           = reader.ReadInt16();
     reader.BaseStream.Seek(7 * 2, SeekOrigin.Current); // unused
 }
Esempio n. 6
0
 bool GetFlag(PlatformFlags flag)
 {
     return((flags & flag) == flag);
 }
Esempio n. 7
0
        public void SetTypeWithDefaults(PlatformType type)
        {
            const short baseSpeed = World.One / 60;
            const short baseDelay = 30;

            Type          = type;
            MaximumHeight = -1;
            MinimumHeight = -1;

            const PlatformFlags doorFlags =
                PlatformFlags.DeactivatesAtInitialLevel |
                PlatformFlags.ExtendsFloorToCeiling |
                PlatformFlags.IsPlayerControllable |
                PlatformFlags.IsMonsterControllable |
                PlatformFlags.ReversesDirectionWhenObstructed |
                PlatformFlags.InitiallyExtended |
                PlatformFlags.ComesFromCeiling |
                PlatformFlags.IsDoor;

            const PlatformFlags platformFlags =
                PlatformFlags.InitiallyActive |
                PlatformFlags.InitiallyExtended |
                PlatformFlags.ComesFromFloor |
                PlatformFlags.ReversesDirectionWhenObstructed;

            switch (type)
            {
            case PlatformType.SphtDoor:
                Speed = 2 * baseSpeed;
                Delay = 4 * baseDelay;
                flags = doorFlags;
                break;

            case PlatformType.SphtSplitDoor:
            case PlatformType.LockedSphtDoor:
                Speed = baseSpeed;
                Delay = 4 * baseDelay;
                flags = doorFlags | PlatformFlags.ComesFromFloor;
                break;

            case PlatformType.SphtPlatform:
            case PlatformType.NoisySphtPlatform:
                Speed = baseSpeed;
                Delay = 2 * baseDelay;
                flags = PlatformFlags.InitiallyActive |
                        PlatformFlags.InitiallyExtended |
                        PlatformFlags.ComesFromFloor |
                        PlatformFlags.ReversesDirectionWhenObstructed;
                break;

            case PlatformType.HeavySphtDoor:
                Speed = baseSpeed;
                Delay = 4 * baseDelay;
                flags = doorFlags;
                break;

            case PlatformType.PfhorDoor:
                Speed = 2 * baseSpeed;
                Delay = 4 * baseDelay;
                flags = doorFlags;
                break;

            case PlatformType.HeavySphtPlatform:
                Speed = baseSpeed;
                Delay = 4 * baseDelay;
                flags = platformFlags;
                break;

            case PlatformType.PfhorPlatform:
                Speed = baseSpeed;
                Delay = 2 * baseDelay;
                flags = platformFlags;
                break;
            }
        }
Esempio n. 8
0
 public static bool Has(this PlatformFlags flags, PlatformFlags flag)
 {
     return((flags & flag) != 0);
 }
Esempio n. 9
0
 public GameData(Project.GameProject project, PlatformFlags platform)
 {
     sections      = new List <Section>();
     this.project  = project;
     this.platform = platform;
 }
        public RegistrationData As(PlatformFlags flags)
        {
            Platforms = flags;

            return(this);
        }