コード例 #1
0
 public Level(string name, Size3D size) : this()
 {
     Name          = name;
     CollisionMap  = new Cube(Size = size);
     LegacyMinimap = new Flat(LegacyMinimapSize);
     ExitPoint     = new Point3D16(0, 0, 1);
     Buttons       = new Buttons(this);
 }
コード例 #2
0
 public Bumper(Bumpers parent, BinaryReader reader) : this(parent)
 {
     Enabled  = reader.ReadBoolean();
     Position = new Point3D16(reader);
     North    = new BumperSide(reader);
     East     = new BumperSide(reader);
     South    = new BumperSide(reader);
     West     = new BumperSide(reader);
 }
コード例 #3
0
ファイル: Prism.cs プロジェクト: bundie1990/EDGE
 public Prism(BinaryReader reader)
 {
     Position = new Point3D16(reader);
     Energy   = reader.ReadByte();
     if (Energy != 1)
     {
         Warning.WriteLine(string.Format(Localization.DeprecatedAttribute, "Prism", "@Energy"));
     }
 }
コード例 #4
0
ファイル: MinimapWindow.xaml.cs プロジェクト: bundie1990/EDGE
        private void SetColor(IList <byte> array, Point3D16 point, ToggleButton box)
        {
            if (box.IsChecked != true || !level.Size.IsBlockInArea(point.X, point.Y, 0))
            {
                return;
            }
            var color = ((SolidColorBrush)box.Foreground).Color;
            var pos   = (point.Y * level.Size.Width + point.X) << 2;

            array[pos++] = color.B;
            array[pos++] = color.G;
            array[pos++] = color.R;
            array[pos]   = 255;
        }
コード例 #5
0
ファイル: CameraTrigger.cs プロジェクト: bundie1990/EDGE
 public CameraTrigger(BinaryReader reader)
 {
     Position = new Point3D16(reader);
     Zoom     = reader.ReadInt16();
     Radius   = new Point2D8(reader);
     if (Zoom != -1)
     {
         return;
     }
     Reset        = reader.ReadBoolean();
     StartDelay   = reader.ReadUInt16();
     Duration     = reader.ReadUInt16();
     Value        = reader.ReadInt16();
     SingleUse    = reader.ReadBoolean();
     ValueIsAngle = reader.ReadBoolean();
 }
コード例 #6
0
ファイル: OtherCube.cs プロジェクト: bundie1990/EDGE
        public OtherCube(Level parent, BinaryReader reader)
        {
            PositionTrigger = new Point3D16(reader);
            MovingBlockSync = new IDReference <MovingPlatform>(parent.MovingPlatforms, reader.ReadInt16());
            if (MovingBlockSync.Index == -2)
            {
                DarkCubeRadius          = new Point2D8(reader);
                DarkCubeMovingBlockSync = new IDReference <MovingPlatform>(parent.MovingPlatforms, reader.ReadInt16());
            }
            var count = reader.ReadUInt16();

            PositionCube = new Point3D16(reader);
            for (var i = 0; i < count; i++)
            {
                KeyEvents.Add(new KeyEvent(reader));
            }
        }
コード例 #7
0
ファイル: Button.cs プロジェクト: bundie1990/EDGE
 public Button(Buttons parent, BinaryReader reader) : this(parent)
 {
     Visible         = (NullableBoolean)reader.ReadByte();
     DisableCount    = reader.ReadByte();
     Mode            = (ButtonMode)reader.ReadByte();
     ParentID        = reader.ReadInt16();
     SequenceInOrder = reader.ReadBoolean();
     reader.ReadByte();  // Siblings count is useless at this point
     if (IsMoving = reader.ReadBoolean())
     {
         MovingPlatformID = new IDReference <MovingPlatform>(parent.Parent.MovingPlatforms, reader.ReadInt16());
     }
     else
     {
         Position = new Point3D16(reader);
     }
     var count = reader.ReadUInt16();
     for (var i = 0; i < count; i++)
     {
         Events.Add(reader.ReadUInt16());
     }
     CheckChild();
 }
コード例 #8
0
 public bool this[Point3D16 point]
 {
     get { return(this[point.X, point.Y, point.Z]); }
     set { this[point.X, point.Y, point.Z] = value; }
 }
コード例 #9
0
 public bool IsCubeInArea(Point3D16 point)
 {
     return(IsCubeInArea(point.X, point.Y, point.Z));
 }
コード例 #10
0
        private Level(BinaryReader reader) : this()
        {
            ID = reader.ReadInt32();
            var nameLength = reader.ReadInt32();

            Name      = Encoding.UTF8.GetString(reader.ReadBytes(nameLength));
            SPlusTime = reader.ReadUInt16();
            STime     = reader.ReadUInt16();
            ATime     = reader.ReadUInt16();
            BTime     = reader.ReadUInt16();
            CTime     = reader.ReadUInt16();
            CheckTime();
            var prismsCount = reader.ReadInt16();

            Size = new Size3D(reader);
            #region Boring verifying
            var temp = reader.ReadUInt16();
            if (Temp1 != temp)
            {
                Warning.WriteLine(string.Format(Localization.LevelInvalidArgument, temp, Temp1, "unknown_ushort_1"));
            }
            temp = reader.ReadUInt16();
            if (Temp2 != temp)
            {
                Warning.WriteLine(string.Format(Localization.LevelInvalidArgument, temp, Temp2, "unknown_ushort_2"));
            }
            ushort width = reader.ReadUInt16(), length = reader.ReadUInt16();
            var    legacyMinimapValid = true;
            if (LegacyMinimapSize.Width != width)
            {
                Warning.WriteLine(string.Format(Localization.LevelInvalidArgument, width, LegacyMinimapSize.Width,
                                                "unknown_ushort_3"));
                legacyMinimapValid = false;
            }
            if (LegacyMinimapSize.Length != length)
            {
                Warning.WriteLine(string.Format(Localization.LevelInvalidArgument, width, LegacyMinimapSize.Length,
                                                "unknown_ushort_4"));
                legacyMinimapValid = false;
            }
            if (!legacyMinimapValid)
            {
                Warning.WriteLine(Localization.LevelLegacyMinimapMalformed);
            }
            var tempByte = reader.ReadByte();
            if (tempByte != 10)
            {
                Warning.WriteLine(string.Format(Localization.LevelInvalidArgument, temp, 10, "unknown_byte_1"));
            }
            temp = reader.ReadUInt16();
            if (Size.Length - 1 != temp)
            {
                Warning.WriteLine(string.Format
                                      (Localization.LevelInvalidArgument, temp, Size.Length - 1, "unknown_ushort_5"));
            }
            temp = reader.ReadUInt16();
            if (0 != temp)
            {
                Warning.WriteLine(string.Format(Localization.LevelInvalidArgument, temp, 0, "unknown_ushort_6"));
            }
            #endregion
            if (legacyMinimapValid)
            {
                LegacyMinimap = new Flat(reader, LegacyMinimapSize);
            }
            else
            {
                LegacyMinimap = new Flat(LegacyMinimapSize);
                reader.ReadBytes((width * length + 7) / 8);
            }
            CollisionMap = new Cube(reader, Size);
            SpawnPoint   = new Point3D16(reader);
            Zoom         = reader.ReadInt16();
            if (Zoom < 0)
            {
                Value        = reader.ReadInt16();
                ValueIsAngle = reader.ReadBoolean();
            }
            ExitPoint = new Point3D16(reader);
            var count = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                MovingPlatforms.Add(new MovingPlatform(MovingPlatforms, reader));
            }
            count = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                Bumpers.Add(new Bumper(Bumpers, reader));
            }
            count = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                FallingPlatforms.Add(new FallingPlatform(this, reader));
            }
            count = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                Checkpoints.Add(new Checkpoint(reader));
            }
            count = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                CameraTriggers.Add(new CameraTrigger(reader));
            }
            count = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                Prisms.Add(new Prism(reader));
            }
            if (count != prismsCount)
            {
                Warning.WriteLine(string.Format
                                      (Localization.LevelInvalidArgument, prismsCount, count, "prisms_count"));
            }
            if ((count = reader.ReadUInt16()) > 0)
            {
                Warning.WriteLine(string.Format(Localization.DeprecatedElement, "Fan"));
            }
            for (var i = 0; i < count; i++)
            {
                Fans.Add(new Fan(reader));
            }
            Buttons = new Buttons(this, reader);
            count   = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                OtherCubes.Add(new OtherCube(this, reader));
            }
            count = reader.ReadUInt16();
            for (var i = 0; i < count; i++)
            {
                Resizers.Add(new Resizer(this, reader));
            }
            if ((count = reader.ReadUInt16()) > 0)
            {
                Warning.WriteLine(string.Format(Localization.DeprecatedElement, "MiniBlock"));
            }
            for (var i = 0; i < count; i++)
            {
                MiniBlocks.Add(new MiniBlock(reader));
            }
            ModelTheme = Theme = reader.ReadByte();
            MusicJava  = reader.ReadByte();
            Music      = reader.ReadByte();
            foreach (var button in Buttons)
            {
                if (button.IsMoving)
                {
                    button.MovingPlatformID.Name.DoNothing();
                }
                foreach (var e in button.Events)
                {
                    Buttons.BlockEvents[e].ID.Name.DoNothing();
                }
            }
            foreach (var cube in OtherCubes)
            {
                cube.MovingBlockSync.Name.DoNothing();
                cube.DarkCubeMovingBlockSync?.Name.DoNothing();
            }
        }
コード例 #11
0
 public Waypoint(BinaryReader reader)
 {
     Position   = new Point3D16(reader);
     TravelTime = reader.ReadUInt16();
     PauseTime  = reader.ReadUInt16();
 }
コード例 #12
0
ファイル: OtherCube.cs プロジェクト: bundie1990/EDGE
        private static void AddHelper(Level level, OtherCubeMode mode, Point3D16 position, Point3D16 moveDirection,
                                      XContainer container)
        {
            if (mode == OtherCubeMode.AutoHide)
            {
                return;
            }
            var child = container.ElementCaseInsensitive("Button");

            if (child == null)
            {
                level.Buttons.Add(new Button(level.Buttons)
                {
                    Position = position,
                    Visible  = NullableBoolean.False,
                    Events   = new List <ushort> {
                        (ushort)level.Buttons.BlockEvents.Count
                    }
                });
            }
            else
            {
                var button = new Button(level.Buttons, child)
                {
                    Position = child.GetAttributeValueWithDefault("Position", position),
                    Visible  = child.GetAttributeValueWithDefault("Visible", NullableBoolean.False)
                };
                button.Events.Add((ushort)level.Buttons.BlockEvents.Count);
            }
            level.Buttons.BlockEvents.Add(new BlockEvent(level)
            {
                ID = new IDReference((short)level.MovingPlatforms.Count), Type = BlockEventType.AffectMovingPlatform
            });
            child = container.ElementCaseInsensitive("MovingPlatform");
            MovingPlatform platform;

            if (child == null)
            {
                platform = new MovingPlatform(level.MovingPlatforms)
                {
                    AutoStart = false, LoopStartIndex = 0
                }
            }
            ;
            else
            {
                platform = new MovingPlatform(level.MovingPlatforms, child)
                {
                    AutoStart      = child.GetAttributeValueWithDefault <bool>("AutoStart"),
                    LoopStartIndex = child.GetAttributeValueWithDefault <byte>("LoopStartIndex")
                };
            }
            if (platform.Waypoints.Count == 0)
            {
                platform.Waypoints.Add(new Waypoint {
                    Position = position
                });
                platform.Waypoints.Add(new Waypoint
                {
                    Position   = position + moveDirection,
                    TravelTime = (ushort)(mode == OtherCubeMode.Hole ? 1 : 32000)
                });
            }
            level.MovingPlatforms.Add(platform);
        }
コード例 #13
0
 public Resizer(Level parent, BinaryReader reader) : this(parent)
 {
     Position  = new Point3D16(reader);
     Visible   = reader.ReadBoolean();
     Direction = (ResizeDirection)reader.ReadByte();
 }
コード例 #14
0
ファイル: Checkpoint.cs プロジェクト: bundie1990/EDGE
 public Checkpoint(BinaryReader reader)
 {
     Position = new Point3D16(reader);
     RespawnZ = reader.ReadInt16();
     Radius   = new Point2D8(reader);
 }
コード例 #15
0
ファイル: FallingPlatform.cs プロジェクト: bundie1990/EDGE
 public FallingPlatform(Level parent, BinaryReader reader) : this(parent)
 {
     Position  = new Point3D16(reader);
     FloatTime = reader.ReadUInt16();
 }