diff --git a/SilicaTilesEditor.sln b/SilicaTilesEditor.sln
new file mode 100644
index 0000000..e7498e5
--- /dev/null
+++ b/SilicaTilesEditor.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31515.178
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SilicaTilesEditor", "SilicaTilesEditor\SilicaTilesEditor.csproj", "{286BE9D8-B723-43A5-A9BA-6769D4FD36DB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {286BE9D8-B723-43A5-A9BA-6769D4FD36DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {286BE9D8-B723-43A5-A9BA-6769D4FD36DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {286BE9D8-B723-43A5-A9BA-6769D4FD36DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {286BE9D8-B723-43A5-A9BA-6769D4FD36DB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1801A7AD-3C83-4942-8E58-8656C9BDDB06}
+ EndGlobalSection
+EndGlobal
diff --git a/SilicaTilesEditor/App.config b/SilicaTilesEditor/App.config
new file mode 100644
index 0000000..5754728
--- /dev/null
+++ b/SilicaTilesEditor/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SilicaTilesEditor/MainForm.Designer.cs b/SilicaTilesEditor/MainForm.Designer.cs
new file mode 100644
index 0000000..e73d6ef
--- /dev/null
+++ b/SilicaTilesEditor/MainForm.Designer.cs
@@ -0,0 +1,310 @@
+
+namespace SilicaTilesEditor
+{
+ partial class MainForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
+ this.toolMenu = new System.Windows.Forms.ToolStrip();
+ this.fileMenu = new System.Windows.Forms.ToolStripDropDownButton();
+ this.newItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.loadItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.layerMenu = new System.Windows.Forms.ToolStripDropDownButton();
+ this.overlayLayerOption = new System.Windows.Forms.ToolStripMenuItem();
+ this.tilesetMenu = new System.Windows.Forms.ToolStripDropDownButton();
+ this.tileset0 = new System.Windows.Forms.ToolStripMenuItem();
+ this.tileset1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.tileset2 = new System.Windows.Forms.ToolStripMenuItem();
+ this.tileset3 = new System.Windows.Forms.ToolStripMenuItem();
+ this.tileset4 = new System.Windows.Forms.ToolStripMenuItem();
+ this.tileset5 = new System.Windows.Forms.ToolStripMenuItem();
+ this.tileset6 = new System.Windows.Forms.ToolStripMenuItem();
+ this.tileset7 = new System.Windows.Forms.ToolStripMenuItem();
+ this.lookingAt = new System.Windows.Forms.Label();
+ this.layout = new System.Windows.Forms.TableLayoutPanel();
+ this.selTileId = new System.Windows.Forms.Label();
+ this.tileSelector = new SilicaTilesEditor.TileSelectorControl();
+ this.tileList = new SilicaTilesEditor.TileMapEditorControl();
+ this.toolMenu.SuspendLayout();
+ this.layout.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // toolMenu
+ //
+ this.toolMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileMenu,
+ this.layerMenu,
+ this.tilesetMenu});
+ this.toolMenu.Location = new System.Drawing.Point(0, 0);
+ this.toolMenu.Name = "toolMenu";
+ this.toolMenu.Size = new System.Drawing.Size(1107, 25);
+ this.toolMenu.TabIndex = 0;
+ this.toolMenu.Text = "MainMenu";
+ //
+ // fileMenu
+ //
+ this.fileMenu.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.fileMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.newItem,
+ this.loadItem,
+ this.saveItem});
+ this.fileMenu.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.fileMenu.Name = "fileMenu";
+ this.fileMenu.Size = new System.Drawing.Size(38, 22);
+ this.fileMenu.Text = "File";
+ //
+ // newItem
+ //
+ this.newItem.Name = "newItem";
+ this.newItem.Size = new System.Drawing.Size(121, 22);
+ this.newItem.Text = "New File";
+ this.newItem.Click += new System.EventHandler(this.newItem_Click);
+ //
+ // loadItem
+ //
+ this.loadItem.Name = "loadItem";
+ this.loadItem.Size = new System.Drawing.Size(121, 22);
+ this.loadItem.Text = "Load File";
+ this.loadItem.Click += new System.EventHandler(this.loadItem_Click);
+ //
+ // saveItem
+ //
+ this.saveItem.Name = "saveItem";
+ this.saveItem.Size = new System.Drawing.Size(121, 22);
+ this.saveItem.Text = "Save File";
+ //
+ // layerMenu
+ //
+ this.layerMenu.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.layerMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.overlayLayerOption});
+ this.layerMenu.Image = ((System.Drawing.Image)(resources.GetObject("layerMenu.Image")));
+ this.layerMenu.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.layerMenu.Name = "layerMenu";
+ this.layerMenu.Size = new System.Drawing.Size(48, 22);
+ this.layerMenu.Text = "Layer";
+ //
+ // overlayLayerOption
+ //
+ this.overlayLayerOption.Checked = true;
+ this.overlayLayerOption.CheckOnClick = true;
+ this.overlayLayerOption.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.overlayLayerOption.Name = "overlayLayerOption";
+ this.overlayLayerOption.Size = new System.Drawing.Size(145, 22);
+ this.overlayLayerOption.Text = "Overlay Layer";
+ this.overlayLayerOption.ToolTipText = "Enables the overlay layer";
+ this.overlayLayerOption.Click += new System.EventHandler(this.overlayLayerOption_Click);
+ //
+ // tilesetMenu
+ //
+ this.tilesetMenu.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.tilesetMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.tileset0,
+ this.tileset1,
+ this.tileset2,
+ this.tileset3,
+ this.tileset4,
+ this.tileset5,
+ this.tileset6,
+ this.tileset7});
+ this.tilesetMenu.Image = ((System.Drawing.Image)(resources.GetObject("tilesetMenu.Image")));
+ this.tilesetMenu.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.tilesetMenu.Name = "tilesetMenu";
+ this.tilesetMenu.Size = new System.Drawing.Size(53, 22);
+ this.tilesetMenu.Text = "Tileset";
+ //
+ // tileset0
+ //
+ this.tileset0.Checked = true;
+ this.tileset0.CheckOnClick = true;
+ this.tileset0.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.tileset0.Name = "tileset0";
+ this.tileset0.Size = new System.Drawing.Size(146, 22);
+ this.tileset0.Text = "NORM Tileset";
+ this.tileset0.Click += new System.EventHandler(this.tileset0_Click);
+ //
+ // tileset1
+ //
+ this.tileset1.CheckOnClick = true;
+ this.tileset1.Name = "tileset1";
+ this.tileset1.Size = new System.Drawing.Size(146, 22);
+ this.tileset1.Text = "SNOW Tileset";
+ this.tileset1.Click += new System.EventHandler(this.tileset1_Click);
+ //
+ // tileset2
+ //
+ this.tileset2.CheckOnClick = true;
+ this.tileset2.Name = "tileset2";
+ this.tileset2.Size = new System.Drawing.Size(146, 22);
+ this.tileset2.Text = "SAND Tileset";
+ this.tileset2.Click += new System.EventHandler(this.tileset2_Click);
+ //
+ // tileset3
+ //
+ this.tileset3.CheckOnClick = true;
+ this.tileset3.Name = "tileset3";
+ this.tileset3.Size = new System.Drawing.Size(146, 22);
+ this.tileset3.Text = "PIRT Tileset";
+ this.tileset3.Click += new System.EventHandler(this.tileset3_Click);
+ //
+ // tileset4
+ //
+ this.tileset4.CheckOnClick = true;
+ this.tileset4.Name = "tileset4";
+ this.tileset4.Size = new System.Drawing.Size(146, 22);
+ this.tileset4.Text = "FLWR Tileset";
+ this.tileset4.Click += new System.EventHandler(this.tileset4_Click);
+ //
+ // tileset5
+ //
+ this.tileset5.CheckOnClick = true;
+ this.tileset5.Name = "tileset5";
+ this.tileset5.Size = new System.Drawing.Size(146, 22);
+ this.tileset5.Text = "JNGL Tileset";
+ this.tileset5.Click += new System.EventHandler(this.tileset5_Click);
+ //
+ // tileset6
+ //
+ this.tileset6.CheckOnClick = true;
+ this.tileset6.Name = "tileset6";
+ this.tileset6.Size = new System.Drawing.Size(146, 22);
+ this.tileset6.Text = "CLWD Tileset";
+ this.tileset6.Click += new System.EventHandler(this.tileset6_Click);
+ //
+ // tileset7
+ //
+ this.tileset7.CheckOnClick = true;
+ this.tileset7.Name = "tileset7";
+ this.tileset7.Size = new System.Drawing.Size(146, 22);
+ this.tileset7.Text = "VOLC Tileset";
+ this.tileset7.Click += new System.EventHandler(this.tileset7_Click);
+ //
+ // lookingAt
+ //
+ this.lookingAt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.lookingAt.AutoSize = true;
+ this.lookingAt.Location = new System.Drawing.Point(126, 515);
+ this.lookingAt.Name = "lookingAt";
+ this.lookingAt.Size = new System.Drawing.Size(78, 13);
+ this.lookingAt.TabIndex = 2;
+ this.lookingAt.Text = "Looking at: 0,0";
+ //
+ // layout
+ //
+ this.layout.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.layout.ColumnCount = 2;
+ this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 249F));
+ this.layout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.layout.Controls.Add(this.tileSelector, 0, 0);
+ this.layout.Controls.Add(this.tileList, 1, 0);
+ this.layout.Location = new System.Drawing.Point(0, 22);
+ this.layout.Margin = new System.Windows.Forms.Padding(0);
+ this.layout.Name = "layout";
+ this.layout.RowCount = 1;
+ this.layout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 487F));
+ this.layout.Size = new System.Drawing.Size(1107, 487);
+ this.layout.TabIndex = 4;
+ //
+ // selTileId
+ //
+ this.selTileId.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.selTileId.AutoSize = true;
+ this.selTileId.Location = new System.Drawing.Point(12, 515);
+ this.selTileId.Name = "selTileId";
+ this.selTileId.Size = new System.Drawing.Size(89, 13);
+ this.selTileId.TabIndex = 5;
+ this.selTileId.Text = "Seleted Tile ID: 1";
+ //
+ // tileSelector
+ //
+ this.tileSelector.AutoScroll = true;
+ this.tileSelector.AutoScrollMinSize = new System.Drawing.Size(0, 1440);
+ this.tileSelector.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tileSelector.Location = new System.Drawing.Point(3, 3);
+ this.tileSelector.Name = "tileSelector";
+ this.tileSelector.Size = new System.Drawing.Size(243, 481);
+ this.tileSelector.TabIndex = 3;
+ //
+ // tileList
+ //
+ this.tileList.BackColor = System.Drawing.Color.Blue;
+ this.tileList.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tileList.Location = new System.Drawing.Point(252, 3);
+ this.tileList.Name = "tileList";
+ this.tileList.Size = new System.Drawing.Size(852, 481);
+ this.tileList.TabIndex = 1;
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1107, 537);
+ this.Controls.Add(this.selTileId);
+ this.Controls.Add(this.layout);
+ this.Controls.Add(this.lookingAt);
+ this.Controls.Add(this.toolMenu);
+ this.Name = "MainForm";
+ this.Text = "Horse Isle Tile Editor";
+ this.Load += new System.EventHandler(this.MainForm_Load);
+ this.toolMenu.ResumeLayout(false);
+ this.toolMenu.PerformLayout();
+ this.layout.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ToolStrip toolMenu;
+ private System.Windows.Forms.ToolStripDropDownButton fileMenu;
+ private System.Windows.Forms.ToolStripMenuItem newItem;
+ private System.Windows.Forms.ToolStripMenuItem loadItem;
+ private System.Windows.Forms.ToolStripMenuItem saveItem;
+ private System.Windows.Forms.ToolStripDropDownButton layerMenu;
+ private System.Windows.Forms.ToolStripMenuItem overlayLayerOption;
+ private System.Windows.Forms.ToolStripDropDownButton tilesetMenu;
+ private System.Windows.Forms.ToolStripMenuItem tileset0;
+ private System.Windows.Forms.ToolStripMenuItem tileset1;
+ private System.Windows.Forms.ToolStripMenuItem tileset2;
+ private System.Windows.Forms.ToolStripMenuItem tileset3;
+ private System.Windows.Forms.ToolStripMenuItem tileset4;
+ private System.Windows.Forms.ToolStripMenuItem tileset5;
+ private System.Windows.Forms.ToolStripMenuItem tileset6;
+ private System.Windows.Forms.ToolStripMenuItem tileset7;
+ public System.Windows.Forms.Label lookingAt;
+ private System.Windows.Forms.TableLayoutPanel layout;
+ public TileMapEditorControl tileList;
+ public System.Windows.Forms.Label selTileId;
+ public TileSelectorControl tileSelector;
+ }
+}
+
diff --git a/SilicaTilesEditor/MainForm.cs b/SilicaTilesEditor/MainForm.cs
new file mode 100644
index 0000000..7bf0f96
--- /dev/null
+++ b/SilicaTilesEditor/MainForm.cs
@@ -0,0 +1,158 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace SilicaTilesEditor
+{
+ public partial class MainForm : Form
+ {
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+
+ private void newItem_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void loadItem_Click(object sender, EventArgs e)
+ {
+ OpenFileDialog loadFileDg = new OpenFileDialog();
+ loadFileDg.Filter = "Map Data Files|*.MAP";
+ loadFileDg.Title = "Select Map File";
+ if(loadFileDg.ShowDialog() == DialogResult.OK)
+ {
+ Map.OpenMap(loadFileDg.FileName);
+ tileList.UpdateScroll();
+ tileList.Invalidate();
+
+ }
+ }
+ private void MainForm_Load(object sender, EventArgs e)
+ {
+ Tileset.ReadTerrain();
+ Tileset.ReadOverlay();
+ Tileset.ReadExtOverlay();
+ layout.ColumnStyles[0].Width = (32*7) + SystemInformation.VerticalScrollBarWidth;
+ tileset0.Checked = true;
+ tileList.ExtOverlay = 0;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ }
+
+ private void overlayLayerOption_Click(object sender, EventArgs e)
+ {
+ tileList.DisplayOverlay = overlayLayerOption.Checked;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+ }
+
+ private void UncheckAll()
+ {
+ tileset0.Checked = false;
+ tileset1.Checked = false;
+ tileset2.Checked = false;
+ tileset3.Checked = false;
+ tileset4.Checked = false;
+ tileset5.Checked = false;
+ tileset6.Checked = false;
+ tileset7.Checked = false;
+ }
+ private void tileset0_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset0.Checked = true;
+ tileList.ExtOverlay = 0;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ private void tileset1_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset1.Checked = true;
+ tileList.ExtOverlay = 1;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ private void tileset2_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset2.Checked = true;
+ tileList.ExtOverlay = 2;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ private void tileset3_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset3.Checked = true;
+ tileList.ExtOverlay = 3;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ private void tileset4_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset4.Checked = true;
+ tileList.ExtOverlay = 4;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ private void tileset5_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset5.Checked = true;
+ tileList.ExtOverlay = 5;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ private void tileset6_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset6.Checked = true;
+ tileList.ExtOverlay = 6;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ private void tileset7_Click(object sender, EventArgs e)
+ {
+ UncheckAll();
+ tileset7.Checked = true;
+ tileList.ExtOverlay = 7;
+ tileSelector.CalculateScroll();
+ tileSelector.Invalidate();
+ tileList.Invalidate();
+
+ }
+
+ }
+}
diff --git a/SilicaTilesEditor/MainForm.resx b/SilicaTilesEditor/MainForm.resx
new file mode 100644
index 0000000..f8de5d1
--- /dev/null
+++ b/SilicaTilesEditor/MainForm.resx
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+
+
+
+ 25
+
+
\ No newline at end of file
diff --git a/SilicaTilesEditor/Map.cs b/SilicaTilesEditor/Map.cs
new file mode 100644
index 0000000..c8a8cd6
--- /dev/null
+++ b/SilicaTilesEditor/Map.cs
@@ -0,0 +1,79 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace SilicaTilesEditor
+{
+ public static class Map
+ {
+ public static string LoadedMap = "";
+ public static bool MapLoaded = false;
+
+ public static int Width;
+ public static int Height;
+
+ public static byte[] MapData;
+ public static byte[] oMapData;
+ public static void SetTileId(int x, int y, bool overlay, int tileId)
+ {
+ int pos = ((x * Height) + y);
+
+ if (!MapLoaded)
+ return;
+ if ((pos <= 0 || pos >= oMapData.Length) && overlay)
+ return;
+ else if ((pos <= 0 || pos >= MapData.Length) && !overlay)
+ return;
+ else if (overlay)
+ oMapData[pos] = (byte)tileId;
+ else if (!overlay)
+ MapData[pos] = (byte)tileId;
+ else // Not sure how you could even get here.
+ return;
+ }
+ public static int GetTileId(int x, int y, bool overlay)
+ {
+ int pos = ((x * Height) + y);
+
+ if ((pos <= 0 || pos >= oMapData.Length) && overlay)
+ return 1;
+ else if ((pos <= 0 || pos >= MapData.Length) && !overlay)
+ return 1;
+ else if (overlay)
+ return oMapData[pos];
+ else if (!overlay)
+ return MapData[pos];
+ else // Not sure how you could even get here.
+ return 1;
+ }
+
+ public static void OpenMap(string MapFile)
+ {
+ byte[] worldMap = File.ReadAllBytes(MapFile);
+
+ Width = BitConverter.ToInt32(worldMap, 0);
+ Height = BitConverter.ToInt32(worldMap, 4);
+
+ MapData = new byte[Width * Height];
+ oMapData = new byte[Width * Height];
+ int ii = 8;
+
+ for (int i = 0; i < MapData.Length; i++)
+ {
+ oMapData[i] = worldMap[ii];
+ MapData[i] = worldMap[ii + 1];
+ ii += 2;
+ }
+
+ worldMap = null;
+
+ LoadedMap = MapFile;
+ MapLoaded = true;
+ }
+ }
+}
diff --git a/SilicaTilesEditor/Program.cs b/SilicaTilesEditor/Program.cs
new file mode 100644
index 0000000..b4b4a71
--- /dev/null
+++ b/SilicaTilesEditor/Program.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace SilicaTilesEditor
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ ///
+ public static MainForm form;
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ form = new MainForm();
+ Application.Run(form);
+ }
+ }
+}
diff --git a/SilicaTilesEditor/Properties/AssemblyInfo.cs b/SilicaTilesEditor/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..7683037
--- /dev/null
+++ b/SilicaTilesEditor/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SilicaTilesEditor")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SilicaTilesEditor")]
+[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("286be9d8-b723-43a5-a9ba-6769d4fd36db")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/SilicaTilesEditor/Properties/Resources.Designer.cs b/SilicaTilesEditor/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..71ab8f2
--- /dev/null
+++ b/SilicaTilesEditor/Properties/Resources.Designer.cs
@@ -0,0 +1,163 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace SilicaTilesEditor.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SilicaTilesEditor.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap OverlayTileset {
+ get {
+ object obj = ResourceManager.GetObject("OverlayTileset", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap TerrainTileset {
+ get {
+ object obj = ResourceManager.GetObject("TerrainTileset", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset0 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset0", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset1 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset1", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset2 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset2", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset3 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset3", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset4 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset4", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset5 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset5", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset6 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset6", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Tileset7 {
+ get {
+ object obj = ResourceManager.GetObject("Tileset7", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/SilicaTilesEditor/Properties/Resources.resx b/SilicaTilesEditor/Properties/Resources.resx
new file mode 100644
index 0000000..833aebf
--- /dev/null
+++ b/SilicaTilesEditor/Properties/Resources.resx
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\images\195_OVERLAY.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\392_TERRAIN.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\405_EXTOVERLAY-NORM.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\403_EXTOVERLAY-SNOW.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\402_EXTOVERLAY-SAND.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\404_EXTOVERLAY-PIRT.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\431_EXTOVERLAY-FLWR.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\450_EXTOVERLAY-JNGL.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\474_EXTOVERLAY-CLWD.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\images\473_EXTOVERLAY-VOLC.png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/SilicaTilesEditor/Properties/Settings.Designer.cs b/SilicaTilesEditor/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..1d84dfb
--- /dev/null
+++ b/SilicaTilesEditor/Properties/Settings.Designer.cs
@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+
+namespace SilicaTilesEditor.Properties
+{
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/SilicaTilesEditor/Properties/Settings.settings b/SilicaTilesEditor/Properties/Settings.settings
new file mode 100644
index 0000000..abf36c5
--- /dev/null
+++ b/SilicaTilesEditor/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/SilicaTilesEditor/SilicaTilesEditor.csproj b/SilicaTilesEditor/SilicaTilesEditor.csproj
new file mode 100644
index 0000000..26f101b
--- /dev/null
+++ b/SilicaTilesEditor/SilicaTilesEditor.csproj
@@ -0,0 +1,126 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {286BE9D8-B723-43A5-A9BA-6769D4FD36DB}
+ Exe
+ SilicaTilesEditor
+ SilicaTilesEditor
+ v4.7.2
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ MainForm.cs
+
+
+
+
+
+ Component
+
+
+ Component
+
+
+
+ MainForm.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SilicaTilesEditor/TileMapEditorControl.cs b/SilicaTilesEditor/TileMapEditorControl.cs
new file mode 100644
index 0000000..1809e13
--- /dev/null
+++ b/SilicaTilesEditor/TileMapEditorControl.cs
@@ -0,0 +1,155 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace SilicaTilesEditor
+{
+ public class TileMapEditorControl : Panel
+ {
+ public bool DisplayOverlay = true;
+ public int ExtOverlay = 0;
+ public int SelTileX = 0;
+ public int SelTileY = 0;
+ private int selectedTileX = 0;
+ private int selectedTileY = 0;
+ public TileMapEditorControl()
+ {
+ this.DoubleBuffered = true;
+ this.VerticalScroll.SmallChange = 32;
+ this.HorizontalScroll.SmallChange = 32;
+ }
+ protected override void OnMouseMove(MouseEventArgs e)
+ {
+ int oldSelTileX = SelTileX;
+ int oldSelTileY = SelTileY;
+
+ int tinyOffsetX = (this.HorizontalScroll.Value % 32);
+ int tinyOffsetY = (this.VerticalScroll.Value % 32);
+
+
+ SelTileX = Convert.ToInt32(Math.Floor((float)(e.X + tinyOffsetX) / 32.0));
+ SelTileY = Convert.ToInt32(Math.Floor((float)(e.Y + tinyOffsetY) / 32.0));
+
+ selectedTileX = Convert.ToInt32(Math.Floor((float)HorizontalScroll.Value / 32.0)) + SelTileX;
+ selectedTileY = Convert.ToInt32(Math.Floor((float)VerticalScroll.Value / 32.0)) + SelTileY;
+ if (!(oldSelTileX == SelTileX && oldSelTileY == SelTileY))
+ {
+
+ if (e.Button == MouseButtons.Left)
+ OnMouseDown(e);
+
+ this.Invalidate();
+ if(Map.MapLoaded)
+ Program.form.lookingAt.Text = "Looking at: " + selectedTileX + "," + selectedTileY + "(" + Map.GetTileId(selectedTileX, selectedTileY, false) + ":" + Map.GetTileId(selectedTileX, selectedTileY, true) + ")";
+ }
+
+ }
+
+ public void UpdateScroll()
+ {
+ this.AutoScroll = true;
+ this.AutoScrollMinSize = new Size(Map.Width * 32, Map.Height * 32);
+ }
+ protected override void OnSizeChanged(EventArgs e)
+ {
+ this.Invalidate();
+ }
+ protected override void OnScroll(ScrollEventArgs se)
+ {
+ this.Invalidate();
+ }
+ protected override void OnMouseDown(MouseEventArgs e)
+ {
+ Map.SetTileId(selectedTileX, selectedTileY, DisplayOverlay, Program.form.tileSelector.SelectedTileid);
+ this.Invalidate();
+ }
+ protected override void OnPaint(PaintEventArgs e)
+ {
+
+
+ Graphics g = e.Graphics;
+ g.Clear(Color.Blue);
+ int offsetX = (this.HorizontalScroll.Value / 32);
+ int offsetY = (this.VerticalScroll.Value / 32);
+
+ int tinyOffsetX = (this.HorizontalScroll.Value % 32);
+ int tinyOffsetY = (this.VerticalScroll.Value % 32);
+
+ int tlistHeight = (this.Size.Height / 32)+ 1;
+ int tlistWidth = (this.Size.Width / 32) + 1;
+ int rH = this.Size.Height;
+ int rW = this.Size.Width;
+ int relX;
+ int relY = 0;
+ if (Map.MapLoaded)
+ {
+
+ for (int y = offsetY; y < (tlistHeight + offsetY)+1; y++)
+ {
+ relX = -1;
+ for (int x = offsetX; x < (tlistWidth + offsetX)+1; x++)
+ {
+ relX++;
+ int tileId = Map.GetTileId(x, y, false) - 1;
+ Bitmap Tile = Tileset.TerrainList[tileId];
+ if (Tile == null)
+ continue;
+ g.DrawImageUnscaled(Tile, (relX * 32) - tinyOffsetX, (relY * 32) - tinyOffsetY);
+
+ }
+ relY++;
+ }
+
+ if (DisplayOverlay)
+ {
+
+ relX = 0;
+ relY = 0;
+
+ for (int y = offsetY; y < (tlistHeight + offsetY) + 1; y++)
+ {
+ relX = -1;
+ for (int x = offsetX; x < (tlistWidth + offsetX) + 1; x++)
+ {
+ relX++;
+ int tileId = Map.GetTileId(x, y, true) - 1;
+ Bitmap Tile = null;
+ if (tileId >= Tileset.OverlayList.Length)
+ {
+ tileId -= Tileset.OverlayList.Length;
+ Tile = Tileset.GetTileset(ExtOverlay)[tileId];
+ }
+ else
+ {
+ Tile = Tileset.OverlayList[tileId];
+ }
+ if (Tile == null)
+ continue;
+ g.DrawImageUnscaled(Tile, (relX * 32) - tinyOffsetX, (relY * 32) - tinyOffsetY);
+
+ }
+ relY++;
+ }
+ }
+ }
+
+ Pen p = new Pen(Color.Black);
+ Pen wp = new Pen(Color.Aqua,3);
+ for (int x = 0; x <= rW; x += 32)
+ g.DrawLine(p, (x - tinyOffsetX), 0, (x - tinyOffsetX), rH);
+
+ for (int y = 0; y <= rH; y += 32)
+ g.DrawLine(p, 0, (y - tinyOffsetY), rW, (y - tinyOffsetY));
+
+ // Highlight selected tile
+ int exactX = (SelTileX*32) - tinyOffsetX;
+ int exactY = (SelTileY*32) - tinyOffsetY;
+ if(!DisplayOverlay)
+ g.DrawRectangle(wp, exactX, exactY, 32, 32);
+ else
+ g.DrawRectangle(wp, exactX, exactY, 32, 48);
+
+ g.Flush();
+ }
+ }
+}
diff --git a/SilicaTilesEditor/TileSelectorControl.cs b/SilicaTilesEditor/TileSelectorControl.cs
new file mode 100644
index 0000000..e2d99bd
--- /dev/null
+++ b/SilicaTilesEditor/TileSelectorControl.cs
@@ -0,0 +1,199 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace SilicaTilesEditor
+{
+ public class TileSelectorControl : Panel
+ {
+ public TileSelectorControl()
+ {
+ this.DoubleBuffered = true;
+ }
+ int SelTileX = 0;
+ int SelTileY = 0;
+ public int SelectedTileid = 1;
+ protected override void OnMouseClick(MouseEventArgs e)
+ {
+ int rW = (this.Size.Width - SystemInformation.VerticalScrollBarWidth);
+
+ int maxX = (rW / 32)+1;
+
+
+ int oldSelTileX = SelTileX;
+ int oldSelTileY = SelTileY;
+
+ int tinyOffsetY = (this.VerticalScroll.Value % 32);
+ if (Program.form.tileList.DisplayOverlay)
+ tinyOffsetY = (this.VerticalScroll.Value % 48);
+
+ SelTileX = Convert.ToInt32(Math.Floor((float)e.X / 32.0));
+ if (!Program.form.tileList.DisplayOverlay)
+ SelTileY = Convert.ToInt32(Math.Floor((float)VerticalScroll.Value / 32.0)) + Convert.ToInt32(Math.Floor((float)(e.Y + tinyOffsetY) / 32.0));
+ else
+ SelTileY = Convert.ToInt32(Math.Floor((float)VerticalScroll.Value / 48.0)) + Convert.ToInt32(Math.Floor((float)(e.Y + tinyOffsetY) / 48.0));
+
+ SelectedTileid = ((SelTileY * maxX) + SelTileX) + 1;
+
+ if(SelectedTileid > 0xFF)
+ {
+ SelectedTileid = 0xFF;
+ SelTileX = (SelectedTileid % maxX) -1;
+ SelTileY = SelectedTileid / maxX;
+ }
+
+ if (!(oldSelTileX == SelTileX && oldSelTileY == SelTileY))
+ {
+ Program.form.selTileId.Text = "Seleted Tile ID: " + SelectedTileid;
+ this.Invalidate();
+ }
+ }
+
+ protected override void OnSizeChanged(EventArgs e)
+ {
+ this.Invalidate();
+ }
+ protected override void OnScroll(ScrollEventArgs se)
+ {
+ this.Invalidate();
+ }
+ public void CalculateScroll()
+ {
+ int rW = (this.Size.Width - SystemInformation.VerticalScrollBarWidth);
+
+ int x = 0;
+ int y = 0;
+ int maxX = rW / 32;
+
+ Bitmap[] tileset = Tileset.TerrainList;
+ if (Program.form.tileList.DisplayOverlay)
+ tileset = Tileset.JoinedTileset;
+
+ int addFinal = tileset.Length % maxX;
+
+ int tilewidth = 32;
+ int tileheight = 32;
+ if (Program.form.tileList.DisplayOverlay)
+ tileheight = 48;
+
+
+ for (int i = 0; i < tileset.Length; i++)
+ {
+ Bitmap tile = tileset[i];
+
+ if (tile != null)
+ {
+ tilewidth = tile.Width;
+ tileheight = tile.Height;
+ }
+ x += tilewidth;
+
+ if (x > (maxX * tilewidth))
+ {
+ x = 0;
+ y += tileheight;
+ }
+
+ }
+ if (addFinal != 0)
+ y += tileheight;
+
+ AutoScroll = false;
+ AutoScrollMinSize = new Size(0, y);
+ AutoScroll = true;
+
+
+ if (Program.form.tileList.DisplayOverlay)
+ VerticalScroll.SmallChange = 32;
+ else
+ VerticalScroll.SmallChange = 48;
+
+ }
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ Graphics g = e.Graphics;
+ if (!Program.form.tileList.DisplayOverlay)
+ g.Clear(Color.Blue);
+ else
+ g.Clear(Color.Magenta);
+
+
+ int rH = this.Size.Height;
+ int rW = (this.Size.Width - SystemInformation.VerticalScrollBarWidth);
+
+ int offsetY = (this.VerticalScroll.Value / 32);
+ int tinyOffsetY = (this.VerticalScroll.Value % 32);
+ if (Program.form.tileList.DisplayOverlay)
+ {
+ offsetY = (this.VerticalScroll.Value / 48);
+ tinyOffsetY = (this.VerticalScroll.Value % 48);
+ }
+ int x = 0;
+ int y = 0;
+ int maxX = rW / 32;
+ int window = (offsetY * (maxX + 1));
+
+ Bitmap[] tileset = Tileset.TerrainList;
+ if (Program.form.tileList.DisplayOverlay)
+ tileset = Tileset.JoinedTileset;
+
+ for (int i = window; i < tileset.Length; i++)
+ {
+
+ int tilewidth = 32;
+ int tileheight = 32;
+ if (Program.form.tileList.DisplayOverlay)
+ tileheight = 48;
+
+ Bitmap tile = tileset[i];
+
+ if(tile != null)
+ {
+ g.DrawImageUnscaled(tile, x, y - tinyOffsetY);
+ tilewidth = tile.Width;
+ tileheight = tile.Height;
+ }
+ x += tilewidth;
+
+ if(x > (maxX*tilewidth))
+ {
+ x = 0;
+ y+=tileheight;
+ }
+
+ }
+
+
+
+ Pen p = new Pen(Color.Black);
+ Pen wp = new Pen(Color.Aqua, 3);
+ for (x = 0; x <= rW; x += 32)
+ g.DrawLine(p, x, 0, x, rH);
+
+ if (!Program.form.tileList.DisplayOverlay)
+ {
+ for (y = 0; y <= rH; y += 32)
+ g.DrawLine(p, 0, (y - tinyOffsetY), rW, (y - tinyOffsetY));
+ }
+ else
+ {
+ for (y = 0; y <= rH; y += 48)
+ g.DrawLine(p, 0, (y - tinyOffsetY), rW, (y - tinyOffsetY));
+
+ }
+
+ // Highlight selected tile
+ int exactX = (SelTileX * 32);
+ int exactY = 0;
+ if (!Program.form.tileList.DisplayOverlay)
+ exactY = (SelTileY * 32) - VerticalScroll.Value;
+ else
+ exactY = (SelTileY * 48) - VerticalScroll.Value;
+
+ if (!Program.form.tileList.DisplayOverlay)
+ g.DrawRectangle(wp, exactX, exactY, 32, 32);
+ else
+ g.DrawRectangle(wp, exactX, exactY, 32, 48);
+ }
+ }
+}
diff --git a/SilicaTilesEditor/Tileset.cs b/SilicaTilesEditor/Tileset.cs
new file mode 100644
index 0000000..5f382a7
--- /dev/null
+++ b/SilicaTilesEditor/Tileset.cs
@@ -0,0 +1,144 @@
+using SilicaTilesEditor.Properties;
+using System;
+using System.Drawing;
+
+namespace SilicaTilesEditor
+{
+ class Tileset
+ {
+ public static Bitmap[] TerrainList = new Bitmap[((Resources.TerrainTileset.Height / 32) * (Resources.TerrainTileset.Width / 32)) + 1];
+ public static Bitmap[] OverlayList = new Bitmap[193];
+ public static Bitmap[] ExtOverlays = new Bitmap[8] { Resources.Tileset0, Resources.Tileset1, Resources.Tileset2, Resources.Tileset3, Resources.Tileset4, Resources.Tileset5, Resources.Tileset6, Resources.Tileset7 };
+
+ public static Bitmap[] ExtNorm = new Bitmap[((Resources.Tileset0.Height / 48) * (Resources.Tileset0.Width / 32)) + 1];
+ public static Bitmap[] ExtSnow = new Bitmap[((Resources.Tileset1.Height / 48) * (Resources.Tileset1.Width / 32)) + 1];
+ public static Bitmap[] ExtSand = new Bitmap[((Resources.Tileset2.Height / 48) * (Resources.Tileset2.Width / 32)) + 1];
+ public static Bitmap[] ExtPirt = new Bitmap[((Resources.Tileset3.Height / 48) * (Resources.Tileset3.Width / 32)) + 1];
+ public static Bitmap[] ExtFlwr = new Bitmap[((Resources.Tileset4.Height / 48) * (Resources.Tileset4.Width / 32)) + 1];
+ public static Bitmap[] ExtJngl = new Bitmap[((Resources.Tileset5.Height / 48) * (Resources.Tileset5.Width / 32)) + 1];
+ public static Bitmap[] ExtClwd = new Bitmap[((Resources.Tileset6.Height / 48) * (Resources.Tileset6.Width / 32)) + 1];
+ public static Bitmap[] ExtVolc = new Bitmap[((Resources.Tileset7.Height / 48) * (Resources.Tileset7.Width / 32)) + 1];
+
+ public static Bitmap[] JoinedTileset
+ {
+ get
+ {
+ Bitmap[] ExtOverlaySet = GetTileset(Program.form.tileList.ExtOverlay);
+ int sz = OverlayList.Length + ExtOverlaySet.Length;
+ if (sz > 0xFF)
+ sz = 0xFF;
+ Bitmap[] arr = new Bitmap[sz];
+ int i = 0;
+ for(i = 0; i < OverlayList.Length; i++)
+ {
+ arr[i] = OverlayList[i];
+ }
+ for (int ii = 0; ii < ExtOverlaySet.Length; ii++)
+ {
+ arr[i] = ExtOverlaySet[ii];
+ i++;
+ if (i >= 0xFF)
+ break;
+ }
+ return arr;
+ }
+ }
+
+ public static Boolean ReadAllTerrain = false;
+ public static Boolean ReadAllOverlay = false;
+ public static void CopyRegionIntoImage(Bitmap srcBitmap, Rectangle srcRegion, Bitmap destBitmap, Rectangle destRegion)
+ {
+ using (Graphics grD = Graphics.FromImage(destBitmap))
+ {
+ grD.DrawImage(srcBitmap, destRegion, srcRegion, GraphicsUnit.Pixel);
+ }
+ }
+
+ public static Bitmap[] GetTileset(int numb)
+ {
+ switch(numb)
+ {
+ case 0:
+ return ExtNorm;
+ case 1:
+ return ExtSnow;
+ case 2:
+ return ExtSand;
+ case 3:
+ return ExtPirt;
+ case 4:
+ return ExtFlwr;
+ case 5:
+ return ExtJngl;
+ case 6:
+ return ExtClwd;
+ case 7:
+ return ExtVolc;
+ default:
+ return ExtNorm;
+ }
+ }
+
+ public static void ReadTerrain()
+ {
+ Console.WriteLine("Reading Terrain.png...");
+ int i = 0;
+
+ for (int y = 0; y < (Resources.TerrainTileset.Height/32); y++)
+ {
+ for (int x = 0; x < (Resources.TerrainTileset.Width / 32); x++)
+ {
+ i++;
+ TerrainList[i] = new Bitmap(32, 32);
+ int posx = x * 32;
+ int posy = y * 32;
+ CopyRegionIntoImage(Resources.TerrainTileset, new Rectangle(posx, posy, 32, 32), TerrainList[i], new Rectangle(0, 0, 32, 32));
+ }
+ }
+ ReadAllTerrain = true;
+ }
+
+ public static void ReadExtOverlay()
+ {
+ for(int picid = 0; picid <= 7; picid++)
+ {
+ Bitmap[] TilesetList = GetTileset(picid);
+ Bitmap Tileset = ExtOverlays[picid];
+
+ Console.WriteLine("Reading Overlay"+ picid.ToString()+".png...");
+ int i = 0;
+
+ for (int y = 0; y < (Tileset.Height / 48); y++)
+ {
+ for (int x = 0; x < (Tileset.Width / 32); x++)
+ {
+ i++;
+ TilesetList[i] = new Bitmap(32, 48);
+ int posx = x * 32;
+ int posy = y * 48;
+ CopyRegionIntoImage(Tileset, new Rectangle(posx, posy, 32, 48), TilesetList[i], new Rectangle(0, 0, 32, 48));
+ }
+ }
+ Console.WriteLine("Total Tiles Read: " + i.ToString());
+ }
+ }
+ public static void ReadOverlay()
+ {
+ Console.WriteLine("Reading Overlay.png...");
+ int i = 0;
+ int OVERLAY_SIZE = 24;
+
+ for (int y = 0; y < OVERLAY_SIZE; y++)
+ {
+ for (int x = 0; x < (Resources.OverlayTileset.Width / 32); x++)
+ {
+ i++;
+ OverlayList[i] = new Bitmap(32, 48);
+ int posx = x * 32;
+ int posy = y * 48;
+ CopyRegionIntoImage(Resources.OverlayTileset, new Rectangle(posx, posy, 32, 48), OverlayList[i], new Rectangle(0, 0, 32, 48));
+ }
+ }
+ }
+ }
+}
diff --git a/SilicaTilesEditor/images/195_OVERLAY.png.png b/SilicaTilesEditor/images/195_OVERLAY.png.png
new file mode 100644
index 0000000..a7489ba
Binary files /dev/null and b/SilicaTilesEditor/images/195_OVERLAY.png.png differ
diff --git a/SilicaTilesEditor/images/392_TERRAIN.png.png b/SilicaTilesEditor/images/392_TERRAIN.png.png
new file mode 100644
index 0000000..9f5b6ef
Binary files /dev/null and b/SilicaTilesEditor/images/392_TERRAIN.png.png differ
diff --git a/SilicaTilesEditor/images/402_EXTOVERLAY-SAND.png.png b/SilicaTilesEditor/images/402_EXTOVERLAY-SAND.png.png
new file mode 100644
index 0000000..b7d509c
Binary files /dev/null and b/SilicaTilesEditor/images/402_EXTOVERLAY-SAND.png.png differ
diff --git a/SilicaTilesEditor/images/403_EXTOVERLAY-SNOW.png.png b/SilicaTilesEditor/images/403_EXTOVERLAY-SNOW.png.png
new file mode 100644
index 0000000..72b09a9
Binary files /dev/null and b/SilicaTilesEditor/images/403_EXTOVERLAY-SNOW.png.png differ
diff --git a/SilicaTilesEditor/images/404_EXTOVERLAY-PIRT.png.png b/SilicaTilesEditor/images/404_EXTOVERLAY-PIRT.png.png
new file mode 100644
index 0000000..0217b97
Binary files /dev/null and b/SilicaTilesEditor/images/404_EXTOVERLAY-PIRT.png.png differ
diff --git a/SilicaTilesEditor/images/405_EXTOVERLAY-NORM.png.png b/SilicaTilesEditor/images/405_EXTOVERLAY-NORM.png.png
new file mode 100644
index 0000000..7b308e1
Binary files /dev/null and b/SilicaTilesEditor/images/405_EXTOVERLAY-NORM.png.png differ
diff --git a/SilicaTilesEditor/images/431_EXTOVERLAY-FLWR.png.png b/SilicaTilesEditor/images/431_EXTOVERLAY-FLWR.png.png
new file mode 100644
index 0000000..228365b
Binary files /dev/null and b/SilicaTilesEditor/images/431_EXTOVERLAY-FLWR.png.png differ
diff --git a/SilicaTilesEditor/images/450_EXTOVERLAY-JNGL.png.png b/SilicaTilesEditor/images/450_EXTOVERLAY-JNGL.png.png
new file mode 100644
index 0000000..77f2997
Binary files /dev/null and b/SilicaTilesEditor/images/450_EXTOVERLAY-JNGL.png.png differ
diff --git a/SilicaTilesEditor/images/473_EXTOVERLAY-VOLC.png.png b/SilicaTilesEditor/images/473_EXTOVERLAY-VOLC.png.png
new file mode 100644
index 0000000..b2822a8
Binary files /dev/null and b/SilicaTilesEditor/images/473_EXTOVERLAY-VOLC.png.png differ
diff --git a/SilicaTilesEditor/images/474_EXTOVERLAY-CLWD.png.png b/SilicaTilesEditor/images/474_EXTOVERLAY-CLWD.png.png
new file mode 100644
index 0000000..00a8ebc
Binary files /dev/null and b/SilicaTilesEditor/images/474_EXTOVERLAY-CLWD.png.png differ