public GraphicsEditor() { InitializeComponent(); CompositeTable = ProjectController.GraphicsManager.BuildPatternTable(0); CmbPalettes.DisplayMember = "Name"; foreach (var p in ProjectController.PaletteManager.Palettes) { CmbPalettes.Items.Add(p); } CmbGraphics1.DisplayMember = CmbGraphics2.DisplayMember = CmbGraphics3.DisplayMember = CmbGraphics4.DisplayMember = "Name"; foreach (var g in ProjectController.GraphicsManager.GraphicsInfo) { CmbGraphics1.Items.Add(g); CmbGraphics2.Items.Add(g); CmbGraphics3.Items.Add(g); CmbGraphics4.Items.Add(g); } CmbGraphics1.SelectedIndex = 0; CmbGraphics2.SelectedIndex = 1; CmbGraphics3.SelectedIndex = 2; CmbGraphics4.SelectedIndex = 3; CmbPalettes.SelectedIndex = 0; PtvTileSelector.CurrentTable= CompositeTable; SelectionMode = SelectionMode.Quarter; PslView.SelectedIndexChanged += new EventHandler(PslView_SelectedIndexChanged); PslView.SelectedOffsetChanged += new EventHandler(PslView_SelectedOffsetChanged); PtvTileSelector.SelectionChanged += new EventHandler(PtvTileSelector_SelectionChanged); PtvTileSelector.UpdateSelection(); }
public bool LoadSpecialGraphics(string fileName) { if (!File.Exists(fileName)) return false; int dataPointer = 0; FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); byte[] data = new byte[fs.Length]; fs.Read(data, 0, (int) fs.Length); fs.Close(); SpecialBanks.Clear(); for (int i = 0; i < 4; i++) { GraphicsBank nextBank = new GraphicsBank(); for (int j = 0; j < 64; j++) { byte[] nextTileChunk = new byte[16]; for (int k = 0; k < 16; k++) nextTileChunk[k] = data[dataPointer++]; nextBank[j] = new Tile(nextTileChunk); } SpecialBanks.Add(nextBank); } SpecialTable = new PatternTable(); for (int j = 0; j < 4; j++) { SpecialTable.SetGraphicsbank(j, SpecialBanks[j]); } return true; }
public void LoadDefaultSpecialGraphics() { int dataPointer = 0; byte[] data = Resource.special_graphics; SpecialBanks.Clear(); for (int i = 0; i < 4; i++) { GraphicsBank nextBank = new GraphicsBank(); for (int j = 0; j < 64; j++) { byte[] nextTileChunk = new byte[16]; for (int k = 0; k < 16; k++) { nextTileChunk[k] = data[dataPointer++]; } nextBank[j] = new Tile(nextTileChunk); } SpecialBanks.Add(nextBank); } SpecialTable = new PatternTable(); for (int j = 0; j < 4; j++) { SpecialTable.SetGraphicsbank(j, SpecialBanks[j]); } }
public PatternTable BuildPatternTable(int index) { PatternTable returnTable = new PatternTable(); for (int j = 0; j < 4; j++) { returnTable.SetGraphicsbank(j, GraphicsBanks[j]); } return returnTable; }
public PatternTable BuildPatternTable(int index) { PatternTable returnTable = new PatternTable(); for (int j = 0; j < 4; j++) { returnTable.SetGraphicsbank(j, GraphicsBanks[j]); } return(returnTable); }
public Map16Editor() { InitializeComponent(); CmbGraphics1.DisplayMember = CmbGraphics2.DisplayMember = CmbPalettes.DisplayMember = CmbDefinitions.DisplayMember = "Name"; foreach (var g in ProjectController.GraphicsManager.GraphicsInfo) { CmbGraphics1.Items.Add(g); CmbGraphics2.Items.Add(g); } foreach (var p in ProjectController.PaletteManager.Palettes) { CmbPalettes.Items.Add(p); } foreach (var l in ProjectController.LevelManager.LevelTypes) { CmbDefinitions.Items.Add(l); } CurrentTable = ProjectController.GraphicsManager.BuildPatternTable(0); PtvTable.CurrentTable = CurrentTable; BlsBlocks.CurrentTable = CurrentTable; BlsBlocks.BlockLayout = ProjectController.LayoutManager.BlockLayouts[0]; BlvCurrent.CurrentTable = CurrentTable; BlsBlocks.SpecialTable = ProjectController.SpecialManager.SpecialTable; BlsBlocks.SpecialPalette = ProjectController.SpecialManager.SpecialPalette; CmbGraphics1.SelectedIndex = 8; CmbGraphics2.SelectedIndex = 0x64; CmbPalettes.SelectedIndex = 0; CmbDefinitions.SelectedIndex = 0; BlsBlocks.SelectionChanged += new EventHandler<TEventArgs<MouseButtons>>(BlsBlocks_SelectionChanged); BlsBlocks.SelectedIndex = 0; solidityMap[0] = BlockProperty.Background; solidityMap[1] = BlockProperty.Foreground; solidityMap[2] = BlockProperty.Water; solidityMap[3] = BlockProperty.Water | BlockProperty.Foreground; solidityMap[4] = BlockProperty.SolidTop; solidityMap[5] = BlockProperty.SolidBottom; solidityMap[6] = BlockProperty.SolidAll; solidityMap[7] = BlockProperty.CoinBlock; for (int i = 0; i < 16; i++) { SpecialTypes.Add(((BlockProperty)(0xF0 | i)).ToString()); } }
public LayoutEditor() { InitializeComponent(); CmbLayouts.DisplayMember = CmbGraphics1.DisplayMember = CmbGraphics2.DisplayMember = CmbPalettes.DisplayMember = CmbDefinitions.DisplayMember = "Name"; foreach (var g in ProjectController.GraphicsManager.GraphicsInfo) { CmbGraphics1.Items.Add(g); CmbGraphics2.Items.Add(g); } foreach (var p in ProjectController.PaletteManager.Palettes) { CmbPalettes.Items.Add(p); } foreach (var l in ProjectController.LevelManager.LevelTypes) { CmbDefinitions.Items.Add(l); } foreach (var l in ProjectController.LayoutManager.BlockLayouts) { if (!l.IsDefault) CmbLayouts.Items.Add(l); } if (CmbLayouts.SelectedIndex != -1) { CmbLayouts.SelectedIndex = 0; } CurrentTable = ProjectController.GraphicsManager.BuildPatternTable(0); BlsFrom.CurrentTable = CurrentTable; BlsTo.CurrentTable = CurrentTable; BlsFrom.BlockLayout = ProjectController.LayoutManager.BlockLayouts[0]; CmbGraphics1.SelectedIndex = 8; CmbGraphics2.SelectedIndex = 0x64; CmbPalettes.SelectedIndex = 0; CmbDefinitions.SelectedIndex = 0; BlsFrom.SpecialPalette = BlsTo.SpecialPalette = ProjectController.SpecialManager.SpecialPalette; BlsFrom.SpecialTable = BlsTo.SpecialTable = ProjectController.SpecialManager.SpecialTable; ProjectController.LayoutManager.LayoutAdded += new EventHandler<TEventArgs<BlockLayout>>(LayoutManager_LayoutAdded); ProjectController.LayoutManager.LayoutRemoved += new EventHandler<TEventArgs<BlockLayout>>(LayoutManager_LayoutRemoved); }
public void LoadDefaultSpecialGraphics() { int dataPointer = 0; byte[] data = Resource.special_graphics; SpecialBanks.Clear(); for (int i = 0; i < 4; i++) { GraphicsBank nextBank = new GraphicsBank(); for (int j = 0; j < 64; j++) { byte[] nextTileChunk = new byte[16]; for (int k = 0; k < 16; k++) nextTileChunk[k] = data[dataPointer++]; nextBank[j] = new Tile(nextTileChunk); } SpecialBanks.Add(nextBank); } SpecialTable = new PatternTable(); for (int j = 0; j < 4; j++) { SpecialTable.SetGraphicsbank(j, SpecialBanks[j]); } }
public bool LoadSpecialGraphics(string fileName) { if (!File.Exists(fileName)) { return(false); } int dataPointer = 0; FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); byte[] data = new byte[fs.Length]; fs.Read(data, 0, (int)fs.Length); fs.Close(); SpecialBanks.Clear(); for (int i = 0; i < 4; i++) { GraphicsBank nextBank = new GraphicsBank(); for (int j = 0; j < 64; j++) { byte[] nextTileChunk = new byte[16]; for (int k = 0; k < 16; k++) { nextTileChunk[k] = data[dataPointer++]; } nextBank[j] = new Tile(nextTileChunk); } SpecialBanks.Add(nextBank); } SpecialTable = new PatternTable(); for (int j = 0; j < 4; j++) { SpecialTable.SetGraphicsbank(j, SpecialBanks[j]); } return(true); }
public void SwitchObjects(PatternTable table, BlockDefinition definition, PaletteInfo palette) { BlsSelector.HaltRendering = true; BlsSelector.CurrentTable = table; BlsSelector.CurrentDefiniton = definition; BlsSelector.HaltRendering = false; BlsSelector.CurrentPalette = palette; }
public WorldEditor() { InitializeComponent(); UndoBuffer = new List<IUndoableAction>(); RedoBuffer = new List<IUndoableAction>(); CmbMusic.DisplayMember = CmbLayouts.DisplayMember = CmbPalettes.DisplayMember = CmbGraphics.DisplayMember = "Name"; foreach (var g in ProjectController.GraphicsManager.GraphicsInfo) { CmbGraphics.Items.Add(g); } CmbGraphics.Items.RemoveAt(254); foreach (var p in ProjectController.PaletteManager.Palettes) { CmbPalettes.Items.Add(p); } for (int i = 1; i < 5; i++) { CmbLength.Items.Add(i); } foreach (var l in ProjectController.LayoutManager.BlockLayouts) { CmbLayouts.Items.Add(l); } foreach (var m in ProjectController.MusicManager.MusicList) { CmbMusic.Items.Add(m); } CmbLayouts.SelectedIndex = 0; CurrentTable = new PatternTable(); WldView.DelayDrawing = true; WldView.CurrentTable = CurrentTable; BlsSelector.CurrentTable = CurrentTable; BlsSelector.BlockLayout = ProjectController.LayoutManager.BlockLayouts[0]; BlsSelector.SpecialTable = WldView.SpecialTable = ProjectController.SpecialManager.SpecialTable; BlsSelector.SpecialPalette = WldView.SpecialPalette = ProjectController.SpecialManager.SpecialPalette; BlsSelector.SelectionChanged += new EventHandler<TEventArgs<MouseButtons>>(BlsSelector_SelectionChanged); BlvRight.CurrentTable = BlvLeft.CurrentTable = CurrentTable; ProjectController.PaletteManager.PaletteAdded += new EventHandler<TEventArgs<PaletteInfo>>(PaletteManager_PaletteAdded); ProjectController.PaletteManager.PaletteRemoved += new EventHandler<TEventArgs<PaletteInfo>>(PaletteManager_PaletteRemoved); ProjectController.PaletteManager.PalettesSaved += new EventHandler(PaletteManager_PalettesSaved); ProjectController.BlockManager.DefinitionsSaved += new EventHandler(BlockManager_DefinitionsSaved); ProjectController.LayoutManager.LayoutAdded += new EventHandler<TEventArgs<BlockLayout>>(LayoutManager_LayoutAdded); ProjectController.GraphicsManager.GraphicsUpdated += new EventHandler(GraphicsManager_GraphicsUpdated); ProjectController.LayoutManager.LayoutRemoved += new EventHandler<TEventArgs<BlockLayout>>(LayoutManager_LayoutRemoved); WldView.Zoom = 1; ReubenController.GraphicsReloaded += new EventHandler(ReubenController_GraphicsReloaded); ReubenController.WorldReloaded += new EventHandler<TEventArgs<World>>(ReubenController_WorldReloaded); LoadSpriteSelector(); BlsSelector.CurrentDefiniton = WldView.CurrentDefiniton = ProjectController.BlockManager.GetDefiniton(0); }
public LevelEditor() { InitializeComponent(); LvlView.DelayDrawing = true; UndoBuffer = new List<IUndoableAction>(); RedoBuffer = new List<IUndoableAction>(); CmbMusic.DisplayMember = CmbLayouts.DisplayMember = CmbTypes.DisplayMember = CmbPalettes.DisplayMember = CmbGraphics.DisplayMember = "Name"; foreach (var g in ProjectController.GraphicsManager.GraphicsInfo) { CmbGraphics.Items.Add(g); } CmbGraphics.Items.RemoveAt(254); foreach (var p in ProjectController.PaletteManager.Palettes) { CmbPalettes.Items.Add(p); } foreach (var t in ProjectController.LevelManager.LevelTypes) { if (t.InGameID != 0) CmbTypes.Items.Add(t); } for (int i = 1; i < 16; i++) { CmbLength.Items.Add(i); } foreach (var m in ProjectController.MusicManager.MusicList) { CmbMusic.Items.Add(m); } foreach (var l in ProjectController.LayoutManager.BlockLayouts) { CmbLayouts.Items.Add(l); } CurrentTable = new PatternTable(); LvlView.CurrentTable = BlsSelector.CurrentTable = CurrentTable; BlsSelector.BlockLayout = ProjectController.LayoutManager.BlockLayouts[0]; BlsSelector.SpecialTable = LvlView.SpecialTable = ProjectController.SpecialManager.SpecialTable; BlsSelector.SpecialPalette = LvlView.SpecialPalette = ProjectController.SpecialManager.SpecialPalette; BlsSelector.SelectionChanged += new EventHandler<TEventArgs<MouseButtons>>(BlsSelector_SelectionChanged); // BlvRight.CurrentTable = BlvLeft.CurrentTable = CurrentTable; ProjectController.PaletteManager.PaletteAdded += new EventHandler<TEventArgs<PaletteInfo>>(PaletteManager_PaletteAdded); ProjectController.PaletteManager.PaletteRemoved += new EventHandler<TEventArgs<PaletteInfo>>(PaletteManager_PaletteRemoved); ProjectController.PaletteManager.PalettesSaved += new EventHandler(PaletteManager_PalettesSaved); ProjectController.BlockManager.DefinitionsSaved += new EventHandler(BlockManager_DefinitionsSaved); ProjectController.LayoutManager.LayoutAdded += new EventHandler<TEventArgs<BlockLayout>>(LayoutManager_LayoutAdded); ProjectController.GraphicsManager.GraphicsUpdated += new EventHandler(GraphicsManager_GraphicsUpdated); ProjectController.LayoutManager.LayoutRemoved += new EventHandler<TEventArgs<BlockLayout>>(LayoutManager_LayoutRemoved); PnlVerticalGuide.Guide1Changed += new EventHandler(PnlVerticalGuide_Guide1Changed); PnlVerticalGuide.Guide2Changed += new EventHandler(PnlVerticalGuide_Guide2Changed); PnlHorizontalGuide.Guide1Changed += new EventHandler(PnlHorizontalGuide_Guide1Changed); PnlHorizontalGuide.Guide2Changed += new EventHandler(PnlHorizontalGuide_Guide2Changed); ReubenController.GraphicsReloaded += new EventHandler(ReubenController_GraphicsReloaded); ReubenController.LevelReloaded += new EventHandler<TEventArgs<Level>>(ReubenController_LevelReloaded); LoadSpriteSelector(); LvlView.HorizontalGuide1 = PnlHorizontalGuide.Guide1; LvlView.HorizontalGuide2 = PnlHorizontalGuide.Guide2; LvlView.VerticalGuide1 = PnlVerticalGuide.Guide1; LvlView.VerticalGuide2 = PnlVerticalGuide.Guide2; LvlView.DelayDrawing = false; LvlView.FullUpdate(); }