public TexturePanel()
        {
            InitializeComponent();
            CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip);

            _editor = Editor.Instance;
            _editor.EditorEventRaised += EditorEventRaised;

            butDeleteTexture.Enabled                 =
                butBrowseTexture.Enabled             =
                    butAnimationRanges.Enabled       =
                        butBumpMaps.Enabled          =
                            butTextureSounds.Enabled = false;

            panelTextureMap.SelectedTextureChanged += delegate
            { _editor.SelectedTexture = panelTextureMap.SelectedTexture; };

            // Populate selection tile size
            for (int i = 5; i <= 8; i++)
            {
                cmbTileSize.Items.Add((float)(Math.Pow(2, i)));
            }

            cmbBlending.SelectedIndex = 0;
            if (cmbTileSize.Items.Contains(_editor.Configuration.TextureMap_TileSelectionSize))
            {
                cmbTileSize.SelectedItem = _editor.Configuration.TextureMap_TileSelectionSize;
            }
        }
Exemple #2
0
        private void EditorEventRaised(IEditorEvent obj)
        {
            if (obj is Editor.LevelChangedEvent)
            {
                _lastTexturePalette = null;
                lightPalette.LoadPalette(((Editor.LevelChangedEvent)obj).Current.Settings.Palette);
            }

            if (obj is Editor.ResetPaletteEvent)
            {
                if (!butSampleFromTextures.Checked)
                {
                    lightPalette.LoadPalette(LevelSettings.LoadPalette());
                    _editor.Level.Settings.Palette = lightPalette.Palette;
                }
            }

            if (obj is Editor.SelectedLevelTextureChangedSetEvent)
            {
                var o = (Editor.SelectedLevelTextureChangedSetEvent)obj;
                _lastTexturePalette = new List <ColorC>(o.Texture.Image.Palette);
                UpdateControls();
            }

            if (obj is Editor.ConfigurationChangedEvent)
            {
                var o = (Editor.ConfigurationChangedEvent)obj;
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }
                UpdateControls();
            }
        }
Exemple #3
0
        public TriggerList()
        {
            InitializeComponent();
            CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip);

            _editor = Editor.Instance;
            _editor.EditorEventRaised += EditorEventRaised;
        }
        public ImportedGeometryBrowser()
        {
            InitializeComponent();
            CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip);

            _editor = Editor.Instance;
            _editor.EditorEventRaised += EditorEventRaised;
        }
Exemple #5
0
        public Lighting()
        {
            InitializeComponent();
            CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip);
            cbLightQuality.SelectedIndex = 0; // Reset index to default

            _editor = Editor.Instance;
            _editor.EditorEventRaised += EditorEventRaised;
        }
Exemple #6
0
        public SectorOptions()
        {
            InitializeComponent();
            CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip);

            _editor = Editor.Instance;
            _editor.EditorEventRaised += EditorEventRaised;

            panel2DGrid.Room = _editor.SelectedRoom;
        }
        public RoomOptions()
        {
            InitializeComponent();
            CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip);

            _editor = Editor.Instance;
            _editor.EditorEventRaised += EditorEventRaised;

            // A hack to edit textbox size
            tbRoomTags.AutoSize = false;
            tbRoomTags.Height   = 23;
        }
Exemple #8
0
        public Palette()
        {
            InitializeComponent();

            CommandHandler.AssignCommandsToControls(Editor.Instance, this, toolTip);
            _editor = Editor.Instance;
            _editor.EditorEventRaised += EditorEventRaised;

            // Reset palette to default and prepare controls
            lightPalette.LoadPalette(LevelSettings.LoadPalette());
            UpdateControls(false);
        }
        private void EditorEventRaised(IEditorEvent obj)
        {
            // Update available items combo box
            if (obj is Editor.LoadedImportedGeometriesChangedEvent)
            {
                var allGeometry = _editor.Level.Settings.ImportedGeometries.Where(geo => geo.LoadException == null && geo.DirectXModel != null);

                comboItems.Items.Clear();
                foreach (var geo in allGeometry)
                {
                    comboItems.Items.Add(geo);
                }

                if (comboItems.Items.Count > 0)
                {
                    comboItems.SelectedIndex = 0;
                    if (comboItems.SelectedItem is ImportedGeometry)
                    {
                        var currentObject = (ImportedGeometry)panelItem.CurrentObject;
                        if (allGeometry.Contains(currentObject))
                        {
                            panelItem.CurrentObject = currentObject;
                        }
                    }
                }
            }

            if (obj is Editor.ChosenImportedGeometryChangedEvent)
            {
                var e = (Editor.ChosenImportedGeometryChangedEvent)obj;
                if (e.Current != null)
                {
                    comboItems.SelectedItem = panelItem.CurrentObject = e.Current;
                    MakeActive();
                }
            }

            // Update tooltip texts
            if (obj is Editor.ConfigurationChangedEvent)
            {
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }
            }
        }
        private void EditorEventRaised(IEditorEvent obj)
        {
            // Disable version-specific controls
            if (obj is Editor.InitEvent ||
                obj is Editor.GameVersionChangedEvent ||
                obj is Editor.LevelChangedEvent)
            {
                UpdateUI();
            }

            // Update texture map
            if (obj is Editor.SelectedTexturesChangedEvent)
            {
                var e = (Editor.SelectedTexturesChangedEvent)obj;

                LevelTexture toSelect = e.Current.Texture as LevelTexture;
                if (toSelect != null)
                {
                    comboCurrentTexture.SelectedItem = toSelect;
                }
                panelTextureMap.SelectedTexture = e.Current;

                UpdateTextureControls(e.Current);
            }

            // Center texture on texture map
            if (obj is Editor.SelectTextureAndCenterViewEvent)
            {
                var newTexture = ((Editor.SelectTextureAndCenterViewEvent)obj).Texture;
                comboCurrentTexture.SelectedItem = newTexture.Texture as LevelTexture;
                panelTextureMap.ShowTexture(((Editor.SelectTextureAndCenterViewEvent)obj).Texture);

                if (newTexture.Texture is LevelTexture)
                {
                    UpdateTextureControls(newTexture);
                    panelTextureMap.ShowTexture(newTexture);
                    MakeActive();
                }
            }

            // Reset texture map
            if (obj is Editor.LevelChangedEvent)
            {
                comboCurrentTexture.Items.Clear();
                comboCurrentTexture.Items.AddRange(_editor.Level.Settings.Textures.ToArray());
                comboCurrentTexture.SelectedItem = _editor.Level.Settings.Textures.FirstOrDefault();
            }

            if (obj is Editor.LoadedTexturesChangedEvent)
            {
                // Populate current texture combo box
                LevelTexture current = comboCurrentTexture.SelectedItem as LevelTexture;
                comboCurrentTexture.Items.Clear();
                comboCurrentTexture.Items.AddRange(_editor.Level.Settings.Textures.ToArray());
                if (_editor.Level.Settings.Textures.Contains(current))
                {
                    comboCurrentTexture.SelectedItem = current;
                }
                else
                {
                    panelTextureMap.ResetVisibleTexture(null);
                }
                if (((Editor.LoadedTexturesChangedEvent)obj).NewToSelect != null)
                {
                    comboCurrentTexture.SelectedItem = ((Editor.LoadedTexturesChangedEvent)obj).NewToSelect;
                }
                panelTextureMap.Invalidate();
            }

            // Update tooltip texts
            if (obj is Editor.ConfigurationChangedEvent)
            {
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }

                if (cmbTileSize.Items.Contains(_editor.Configuration.TextureMap_TileSelectionSize))
                {
                    cmbTileSize.SelectedItem = _editor.Configuration.TextureMap_TileSelectionSize;
                }
            }
        }
        private void EditorEventRaised(IEditorEvent obj)
        {
            // Disable version-specific controls
            if (obj is Editor.InitEvent ||
                obj is Editor.GameVersionChangedEvent ||
                obj is Editor.LevelChangedEvent)
            {
                bool isNGorT5M = _editor.Level.Settings.GameVersion >= TRVersion.Game.TRNG;
                bool isTR4or5  = _editor.Level.Settings.GameVersion >= TRVersion.Game.TR4;
                bool isTR345   = _editor.Level.Settings.GameVersion >= TRVersion.Game.TR3;
                bool isTR1     = _editor.Level.Settings.GameVersion == TRVersion.Game.TR1;

                cbFlagCold.Enabled             = isNGorT5M;
                cbFlagDamage.Enabled           = isNGorT5M;
                cbNoLensflare.Enabled          = isTR4or5;
                comboReverberation.Enabled     = isTR345;
                comboLightEffect.Enabled       = !isTR1;
                numLightEffectStrength.Enabled = !isTR1;

                RepopulateRoomTypes();
            }

            // Update the room list
            if (obj is Editor.InitEvent || obj is Editor.RoomListChangedEvent)
            {
                // Adjust the amount of entries in the combo list
                while (comboRoom.Items.Count > _editor.Level.Rooms.GetLength(0))
                {
                    comboRoom.Items.RemoveAt(comboRoom.Items.Count - 1);
                }
                while (comboRoom.Items.Count < _editor.Level.Rooms.GetLength(0))
                {
                    comboRoom.Items.Add("");
                }

                // Update the room list
                for (int i = 0; i < _editor.Level.Rooms.GetLength(0); i++)
                {
                    if (_editor.Level.Rooms[i] != null)
                    {
                        comboRoom.Items[i] = i + ": " + _editor.Level.Rooms[i].Name;
                    }
                    else
                    {
                        comboRoom.Items[i] = i + ": --- Empty room ---";
                    }
                }
            }

            // Update taglist
            if (obj is Editor.LevelChangedEvent || obj is Editor.SelectedRoomChangedEvent)
            {
                tbRoomTags.AutocompleteWords.Clear();
                foreach (var room in (_editor.Level.Rooms))
                {
                    if (room != null && room.ExistsInLevel)
                    {
                        tbRoomTags.AutocompleteWords.AddRange(room.Tags.Except(tbRoomTags.AutocompleteWords));
                    }
                }
            }

            // Update the room property controls
            if (obj is Editor.InitEvent || obj is Editor.SelectedRoomChangedEvent || obj is Editor.LevelChangedEvent ||
                _editor.IsSelectedRoomEvent(obj as Editor.RoomPropertiesChangedEvent))
            {
                Room room = _editor.SelectedRoom;
                if (obj is Editor.InitEvent || obj is Editor.SelectedRoomChangedEvent)
                {
                    comboRoom.SelectedIndex = _editor.Level.Rooms.ReferenceIndexOf(room);
                }

                // Update the state of other controls
                ReadRoomType();
                panelRoomAmbientLight.BackColor  = (room.AmbientLight * new Vector3(0.5f, 0.5f, 0.5f)).ToWinFormsColor();
                comboReverberation.SelectedIndex = (int)room.Reverberation;
                comboPortalShade.SelectedIndex   = (int)room.LightInterpolationMode;
                comboLightEffect.SelectedIndex   = (int)room.LightEffect;
                numLightEffectStrength.Value     = room.LightEffectStrength;
                cbFlagCold.Checked      = room.FlagCold;
                cbFlagDamage.Checked    = room.FlagDamage;
                cbFlagOutside.Checked   = room.FlagOutside;
                cbHorizon.Checked       = room.FlagHorizon;
                cbNoLensflare.Checked   = room.FlagNoLensflare;
                cbNoPathfinding.Checked = room.FlagExcludeFromPathFinding;
                butHidden.Checked       = room.Hidden;

                if (!tbRoomTags.ReadOnly) // Only update tags field if we're not in the process of editing
                {
                    if (room.Tags.Count > 0)
                    {
                        tbRoomTags.Text = string.Join(" ", room.Tags);
                    }
                    else
                    {
                        tbRoomTags.Text = "";
                    }
                }

                if (room.AlternateBaseRoom != null)
                {
                    butLocked.Enabled = false;
                    butLocked.Checked = room.AlternateBaseRoom.Locked;
                }
                else
                {
                    butLocked.Enabled = true;
                    butLocked.Checked = room.Locked;
                }

                comboFlipMap.SelectedIndex = room.Alternated ? room.AlternateGroup + 1 : 0;
            }

            // Update tooltip texts
            if (obj is Editor.ConfigurationChangedEvent)
            {
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }
            }
        }
Exemple #12
0
        private void EditorEventRaised(IEditorEvent obj)
        {
            // Disable version-specific controls
            if (obj is Editor.InitEvent ||
                obj is Editor.GameVersionChangedEvent ||
                obj is Editor.LevelChangedEvent)
            {
                butAddFogBulb.Enabled = _editor.Level.Settings.GameVersion > TRVersion.Game.TR3;
            }

            // Update light UI
            if (obj is Editor.ObjectChangedEvent ||
                obj is Editor.SelectedObjectChangedEvent)
            {
                var light = _editor.SelectedObject as LightInstance;

                // Get light type
                bool HasInOutRange         = false;
                bool HasInOutAngle         = false;
                bool HasDirection          = false;
                bool CanCastShadows        = false;
                bool CanIlluminateGeometry = false;
                cbLightQuality.Enabled = false;
                if (light != null)
                {
                    switch (light.Type)
                    {
                    case LightType.Point:
                        HasInOutRange         = true;
                        CanCastShadows        = true;
                        CanIlluminateGeometry = true;
                        break;

                    case LightType.Shadow:
                        HasInOutRange         = true;
                        CanCastShadows        = true;
                        CanIlluminateGeometry = true;
                        break;

                    case LightType.Effect:
                        HasInOutRange = true;
                        break;

                    case LightType.FogBulb:
                        HasInOutRange = true;
                        break;

                    case LightType.Spot:
                        HasInOutRange         = true;
                        HasInOutAngle         = true;
                        HasDirection          = true;
                        CanCastShadows        = true;
                        CanIlluminateGeometry = true;
                        break;

                    case LightType.Sun:
                        HasDirection          = true;
                        CanCastShadows        = true;
                        CanIlluminateGeometry = true;
                        break;
                    }
                }

                // Update enable state
                // We set it before the values to make sure that irrelevant values are
                // not recognized as being changed to 0 in the "ValueChanged" functions.
                panelLightColor.Enabled = light != null;
                cbLightEnabled.Enabled  = light != null;
                cbLightIsObstructedByRoomGeometry.Enabled = CanCastShadows;
                cbLightIsDynamicallyUsed.Enabled          = CanIlluminateGeometry;
                cbLightIsStaticallyUsed.Enabled           = CanIlluminateGeometry;
                cbLightIsUsedForImportedGeometry.Enabled  = CanIlluminateGeometry;
                numIntensity.Enabled  = light != null;
                numInnerRange.Enabled = HasInOutRange;
                numOuterRange.Enabled = HasInOutRange;
                numInnerAngle.Enabled = HasInOutAngle;
                numOuterAngle.Enabled = HasInOutAngle;
                numDirectionY.Enabled = HasDirection;
                numDirectionX.Enabled = HasDirection;

                // Update value state
                panelLightColor.BackColor = light != null ? new Vector4(light.Color * 0.5f, 1.0f).ToWinFormsColor() : BackColor;
                numIntensity.Value        = (decimal)(light?.Intensity ?? 0);
                numInnerRange.Value       = HasInOutRange ? (decimal)light.InnerRange : 0;
                numOuterRange.Value       = HasInOutRange ? (decimal)light.OuterRange : 0;
                numInnerAngle.Value       = HasInOutAngle ? (decimal)light.InnerAngle : 0;
                numOuterAngle.Value       = HasInOutAngle ? (decimal)light.OuterAngle : 0;
                numDirectionY.Value       = HasDirection ? (decimal)light.RotationY : 0;
                numDirectionX.Value       = HasDirection ? (decimal)light.RotationX : 0;
                cbLightEnabled.Checked    = light?.Enabled ?? false;
                cbLightIsObstructedByRoomGeometry.Checked = light?.IsObstructedByRoomGeometry ?? false;
                cbLightIsDynamicallyUsed.Checked          = light?.IsDynamicallyUsed ?? false;
                cbLightIsStaticallyUsed.Checked           = light?.IsStaticallyUsed ?? false;
                cbLightIsUsedForImportedGeometry.Checked  = light?.IsUsedForImportedGeometry ?? false;
                cbLightQuality.Enabled       = light != null;
                cbLightQuality.SelectedIndex = (int)(light?.Quality ?? 0);
            }

            // Update tooltip texts
            if (obj is Editor.ConfigurationChangedEvent)
            {
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }
            }
        }
Exemple #13
0
        private void EditorEventRaised(IEditorEvent obj)
        {
            // Update level-specific UI
            if (obj is Editor.InitEvent ||
                obj is Editor.LevelChangedEvent ||
                obj is Editor.GameVersionChangedEvent)
            {
                if (_editor.Level.Settings.GameVersion == TRVersion.Game.TR5Main)
                {
                    DockText = "Legacy triggers";
                }
                else
                {
                    DockText = "Triggers";
                }
            }

            // Update the trigger control
            if (obj is Editor.SelectedSectorsChangedEvent ||
                obj is Editor.SelectedRoomChangedEvent ||
                obj is Editor.RoomSectorPropertiesChangedEvent)
            {
                lstTriggers.Items.Clear();

                if (_editor.Level != null && _editor.SelectedSectors.Valid)
                {
                    // Search for unique triggers inside the selected area
                    var triggers = new List <TriggerInstance>();
                    var area     = _editor.SelectedSectors.Area;
                    for (int x = area.X0; x <= area.X1; x++)
                    {
                        for (int z = area.Y0; z <= area.Y1; z++)
                        {
                            foreach (var trigger in _editor.SelectedRoom.GetBlockTry(x, z)?.Triggers ?? new List <TriggerInstance>())
                            {
                                if (!triggers.Contains(trigger))
                                {
                                    triggers.Add(trigger);
                                }
                            }
                        }
                    }

                    // Add triggers to listbox
                    foreach (TriggerInstance trigger in triggers)
                    {
                        lstTriggers.Items.Add(new DarkListItem(trigger.ToShortString())
                        {
                            Tag = trigger
                        });
                    }
                }
            }

            // Update any modified trigger from area
            if (obj is Editor.ObjectChangedEvent)
            {
                var changedObject = ((Editor.ObjectChangedEvent)obj).Object;

                if (changedObject.Room == _editor.SelectedRoom &&
                    changedObject is TriggerInstance)
                {
                    var item = lstTriggers.Items.FirstOrDefault(l => l.Tag == changedObject);
                    if (item != null)
                    {
                        item.Text = changedObject.ToShortString();
                    }
                }
            }

            // Update the trigger control selection
            if (obj is Editor.SelectedSectorsChangedEvent ||
                obj is Editor.SelectedRoomChangedEvent ||
                obj is Editor.SelectedObjectChangedEvent)
            {
                if (_editor.SelectedObject is TriggerInstance)
                {
                    var trigger = _editor.SelectedObject as TriggerInstance;
                    var entry   = lstTriggers.Items.FirstOrDefault(t => t.Tag == trigger);
                    if (entry != null)
                    {
                        lstTriggers.SelectItem(lstTriggers.Items.IndexOf(entry));
                    }
                }
            }

            // Update tooltip texts
            if (obj is Editor.ConfigurationChangedEvent)
            {
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }
            }
        }
Exemple #14
0
        private void EditorEventRaised(IEditorEvent obj)
        {
            // Update available items combo box
            if (obj is Editor.LoadedWadsChangedEvent ||
                obj is Editor.GameVersionChangedEvent)
            {
                var allMoveables = _editor.Level.Settings.WadGetAllMoveables();
                var allStatics   = _editor.Level.Settings.WadGetAllStatics();

                comboItems.Items.Clear();
                foreach (var moveable in allMoveables.Values)
                {
                    comboItems.Items.Add(moveable);
                }
                foreach (var staticMesh in allStatics.Values)
                {
                    comboItems.Items.Add(staticMesh);
                }

                if (comboItems.Items.Count > 0)
                {
                    comboItems.SelectedIndex = 0;

                    // Update visible conflicting item, otherwise it's not updated in 3D control.
                    if (comboItems.SelectedItem is WadMoveable)
                    {
                        var currentObject = (WadMoveableId)panelItem.CurrentObject.Id;
                        if (allMoveables.ContainsKey(currentObject))
                        {
                            panelItem.CurrentObject = allMoveables[currentObject];
                        }
                    }
                    else if (comboItems.SelectedItem is WadStatic)
                    {
                        var currentObject = (WadStaticId)panelItem.CurrentObject.Id;
                        if (allStatics.ContainsKey(currentObject))
                        {
                            panelItem.CurrentObject = allStatics[currentObject];
                        }
                    }
                }
            }

            // Update selection of items combo box
            if (obj is Editor.ChosenItemChangedEvent)
            {
                var e = (Editor.ChosenItemChangedEvent)obj;
                if (!e.Current.HasValue)
                {
                    comboItems.SelectedItem = panelItem.CurrentObject = null;
                }
                else
                {
                    if (e.Current.Value.IsStatic)
                    {
                        comboItems.SelectedItem = panelItem.CurrentObject = _editor.Level.Settings.WadTryGetStatic(e.Current.Value.StaticId);
                    }
                    else
                    {
                        comboItems.SelectedItem = panelItem.CurrentObject = _editor.Level.Settings.WadTryGetMoveable(e.Current.Value.MoveableId);
                    }

                    MakeActive();
                }
            }

            if (obj is Editor.ChosenItemChangedEvent ||
                obj is Editor.GameVersionChangedEvent)
            {
                FindLaraSkin();
            }

            // Update tooltip texts
            if (obj is Editor.ConfigurationChangedEvent)
            {
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }
            }
        }
Exemple #15
0
        private void EditorEventRaised(IEditorEvent obj)
        {
            if (obj is Editor.SelectedRoomChangedEvent)
            {
                panel2DGrid.Room = ((Editor.SelectedRoomChangedEvent)obj).Current;
            }

            // Update tooltip texts
            if (obj is Editor.ConfigurationChangedEvent)
            {
                if (((Editor.ConfigurationChangedEvent)obj).UpdateKeyboardShortcuts)
                {
                    CommandHandler.AssignCommandsToControls(_editor, this, toolTip, true);
                }
            }

            // Update color scheme on buttons
            if (obj is Editor.ConfigurationChangedEvent || obj is Editor.InitEvent)
            {
                butFloor.BackColor          = _editor.Configuration.UI_ColorScheme.ColorFloor.ToWinFormsColor();
                butFloor.Image              = (butFloor.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_Floor_neg_16 : Properties.Resources.sectortype_Floor_1_16;
                butCeiling.BackColor        = _editor.Configuration.UI_ColorScheme.ColorFloor.ToWinFormsColor();
                butCeiling.Image            = (butCeiling.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_Roof_neg_16 : Properties.Resources.sectortype_Roof_16;
                butBox.BackColor            = _editor.Configuration.UI_ColorScheme.ColorBox.ToWinFormsColor();
                butBox.Image                = (butBox.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_Box_neg_16 : Properties.Resources.sectortype_Box_16;
                butNotWalkableBox.BackColor = _editor.Configuration.UI_ColorScheme.ColorNotWalkable.ToWinFormsColor();
                butNotWalkableBox.Image     = (butNotWalkableBox.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_NotWalkable_neg_16 : Properties.Resources.sectortype_NotWalkable_16;
                butMonkey.BackColor         = _editor.Configuration.UI_ColorScheme.ColorMonkey.ToWinFormsColor();
                butMonkey.Image             = (butMonkey.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_Monkey_neg_16 : Properties.Resources.sectortype_Monkey_16;
                butDeath.BackColor          = _editor.Configuration.UI_ColorScheme.ColorDeath.ToWinFormsColor();
                butDeath.Image              = (butDeath.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_Death_neg_16 : Properties.Resources.sectortype_Death_16;
                butPortal.BackColor         = _editor.Configuration.UI_ColorScheme.ColorPortal.ToWinFormsColor();
                butPortal.Image             = (butPortal.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_Portal_neg__16 : Properties.Resources.sectortype_Portal__16;
                butWall.BackColor           = _editor.Configuration.UI_ColorScheme.ColorWall.ToWinFormsColor();
                butWall.Image               = (butWall.BackColor.GetBrightness() > iconSwitchBrightnessThreshold) ? Properties.Resources.sectortype_Wall_neg_16 : Properties.Resources.sectortype_Wall_1_16;
            }

            // Disable version-specific controls
            if (obj is Editor.InitEvent ||
                obj is Editor.GameVersionChangedEvent ||
                obj is Editor.LevelChangedEvent)
            {
                bool isTR2   = _editor.Level.Settings.GameVersion >= TRVersion.Game.TR2;
                bool isTR345 = _editor.Level.Settings.GameVersion >= TRVersion.Game.TR3;

                butClimbNegativeX.Enabled       = isTR2;
                butClimbNegativeZ.Enabled       = isTR2;
                butClimbPositiveX.Enabled       = isTR2;
                butClimbPositiveZ.Enabled       = isTR2;
                butMonkey.Enabled               = isTR345;
                butFlagBeetle.Enabled           = isTR345;
                butFlagTriggerTriggerer.Enabled = isTR345;

                if (_editor.Level.Settings.GameVersion >= TRVersion.Game.TR4)
                {
                    butFlagTriggerTriggerer.Image = Properties.Resources.sectortype_TriggerTriggerer_16;
                    butFlagBeetle.Image           = Properties.Resources.sectortype_Beetle_16;
                }
                else
                {
                    butFlagTriggerTriggerer.Image = Properties.Resources.sectortype_MinecartLeft_16;
                    butFlagBeetle.Image           = Properties.Resources.sectortype_MinecartRight_16;
                }
            }
        }