Exemplo n.º 1
0
        private void YOffset_ValueChanged(object sender, EventArgs e)
        {
            if (OwnChange)
            {
                return;
            }
            var value = (byte)YOffset.Value;

            Content.Content.Get().Changes.BlockingResMod(new ResAction(() =>
            {
                ActiveObj.OBJ.SubIndex = (short)((ActiveObj.OBJ.SubIndex & 0x00FF) | (value << 8));
            }, ActiveObj.OBJ));

            ObjectView.ShowObject(ActiveObj.OBJ.GUID);
            //DGRPEdit.ShowObject(ActiveObj.OBJ.GUID);
        }
Exemplo n.º 2
0
        public void UpdateOBJD(GameObject tobj)
        {
            ActiveObj = tobj;
            if (ActiveObj == null || OBJDNumberEntry == null)
            {
                return;
            }
            OwnChange = true;

            bool isPhysical = (ActiveObj.OBJ.MasterID == 0 || ActiveObj.OBJ.SubIndex > -1);  //NOT a multitile master. eg. has collision bounds.
            bool isMaster   = (ActiveObj.OBJ.MasterID == 0 || ActiveObj.OBJ.SubIndex == -1); //is single tile or multitile master

            CatalogBox.Enabled   = isMaster;
            MotiveBox.Enabled    = isMaster;
            ThumbnailBox.Enabled = isMaster;
            PhysicalBox.Enabled  = isPhysical;

            ObjectView.ShowObject(ActiveObj.OBJ.GUID);
            NameEntry.Text  = ActiveObj.OBJ.ChunkLabel;
            GUIDButton.Text = ActiveObj.OBJ.GUID.ToString("X8");

            foreach (var entry in OBJDNumberEntry)
            {
                var ui = entry.Key;
                ui.Value = ActiveObj.OBJ.GetPropertyByName <decimal>(entry.Value);
            }

            foreach (var entry in OBJDFlagEntries)
            {
                var ui = entry.Key;
                ui.Checked = (ActiveObj.OBJ.GetPropertyByName <ushort>(entry.Value.Property) & (1 << entry.Value.Flag)) > 0;
            }

            var ctss = ActiveObj.Resource.Get <CTSS>(ActiveObj.OBJ.CatalogStringsID);

            CatalogNameLabel.Text = (ctss == null) ? "<NO CTSS>" : ctss.GetString(0);
            CTSSIDLabel.Text      = "(CTSS #" + ActiveObj.OBJ.CatalogStringsID + ")";

            //set up multitile box

            MultiGroupCombo.Items.Clear();
            MultiGroupCombo.Items.Add(new NameValueCombo("Single-Tile", 0, true));
            MultiGroupCombo.SelectedIndex = 0;
            var i = 1;

            foreach (var obj in ActiveObj.Resource.List <OBJD>())
            {
                if (obj.MasterID != 0 && obj.SubIndex == -1)
                {
                    MultiGroupCombo.Items.Add(new NameValueCombo(obj.ChunkLabel, obj.MasterID, true));
                    if (obj.MasterID == ActiveObj.OBJ.MasterID)
                    {
                        MultiGroupCombo.SelectedIndex = i;
                    }
                    i++;
                }
            }

            TypeCombo.Items.Clear();
            foreach (var num in Enum.GetValues(typeof(OBJDType)))
            {
                TypeCombo.Items.Add(new NameValueCombo(num.ToString(), Convert.ToInt16(num), true));
            }

            MultitileList.Items.Clear();
            MultitileList.Items.AddRange(
                ActiveObj.Resource.List <OBJD>()
                .Where(x => x.MasterID == ActiveObj.OBJ.MasterID)
                .OrderBy(x => x.SubIndex)
                .ToArray());

            //set up collision
            FootprintNorth.Value = ActiveObj.OBJ.FootprintMask & 15;
            FootprintEast.Value  = (ActiveObj.OBJ.FootprintMask >> 4) & 15;
            FootprintSouth.Value = (ActiveObj.OBJ.FootprintMask >> 8) & 15;
            FootprintWest.Value  = (ActiveObj.OBJ.FootprintMask >> 12) & 15;

            var isMultitileMaster = ActiveObj.OBJ.MasterID > 0 && ActiveObj.OBJ.SubIndex == -1;

            if (isMaster)
            {
                XOffset.Value = 0;
                YOffset.Value = 0;
            }
            else
            {
                XOffset.Value = (sbyte)ActiveObj.OBJ.SubIndex;
                YOffset.Value = (sbyte)(ActiveObj.OBJ.SubIndex >> 8);
            }

            XOffset.Enabled     = !isMaster;
            YOffset.Enabled     = !isMaster;
            LevelOffset.Enabled = !isMaster;

            foreach (var combo in OBJDComboEntry)
            {
                var targetValue = ActiveObj.OBJ.GetPropertyByName <ushort>(combo.Value);
                foreach (NameValueCombo item in combo.Key.Items)
                {
                    if (item.Value == targetValue)
                    {
                        combo.Key.SelectedItem = item;
                    }
                }
            }

            var thumb = ActiveObj.Resource.Get <BMP>(ActiveObj.OBJ.CatalogStringsID);

            ThumbSave.Enabled = false;
            if (thumb != null)
            {
                var mem = new MemoryStream(thumb.data);
                ThumbnailPic.Image = Image.FromStream(mem);
                ThumbSave.Enabled  = true;
            }

            OwnChange = false;
        }
Exemplo n.º 3
0
        public void UpdateOBJD(GameObject tobj)
        {
            ActiveObj = tobj;
            if (ActiveObj == null || OBJDNumberEntry == null)
            {
                return;
            }
            OwnChange = true;

            bool isPhysical = (ActiveObj.OBJ.MasterID == 0 || ActiveObj.OBJ.SubIndex > -1);  //NOT a multitile master. eg. has collision bounds.
            bool isMaster   = (ActiveObj.OBJ.MasterID == 0 || ActiveObj.OBJ.SubIndex == -1); //is single tile or multitile master

            CatalogBox.Enabled   = isMaster;
            MotiveBox.Enabled    = isMaster;
            ThumbnailBox.Enabled = isMaster;
            PhysicalBox.Enabled  = isPhysical;

            ObjectView.ShowObject(ActiveObj.OBJ.GUID);
            NameEntry.Text  = ActiveObj.OBJ.ChunkLabel;
            GUIDButton.Text = ActiveObj.OBJ.GUID.ToString("X8");

            foreach (var entry in OBJDNumberEntry)
            {
                var ui = entry.Key;
                ui.Value = ActiveObj.OBJ.GetPropertyByName <decimal>(entry.Value);
            }

            foreach (var entry in OBJDFlagEntries)
            {
                var ui = entry.Key;
                ui.Checked = (ActiveObj.OBJ.GetPropertyByName <ushort>(entry.Value.Property) & (1 << entry.Value.Flag)) > 0;
            }

            var ctss = ActiveObj.Resource.Get <CTSS>(ActiveObj.OBJ.CatalogStringsID);

            CatalogNameLabel.Text = (ctss == null) ? "<NO CTSS>" : ctss.GetString(0);
            CTSSIDLabel.Text      = "(CTSS #" + ActiveObj.OBJ.CatalogStringsID + ")";

            //set up multitile box
            UpdateMultitileGroup();

            TypeCombo.Items.Clear();
            foreach (var num in Enum.GetValues(typeof(OBJDType)))
            {
                TypeCombo.Items.Add(new NameValueCombo(num.ToString(), Convert.ToInt16(num), true));
            }

            foreach (var combo in OBJDComboEntry)
            {
                var targetValue = ActiveObj.OBJ.GetPropertyByName <ushort>(combo.Value);
                foreach (NameValueCombo item in combo.Key.Items)
                {
                    if (item.Value == targetValue)
                    {
                        combo.Key.SelectedItem = item;
                    }
                }
            }

            var thumb = ActiveObj.Resource.Get <BMP>(ActiveObj.OBJ.CatalogStringsID);

            ThumbSave.Enabled = false;
            if (thumb != null)
            {
                var mem = new MemoryStream(thumb.data);
                ThumbnailPic.Image = Image.FromStream(mem);
                ThumbSave.Enabled  = true;
            }

            OwnChange = false;
        }