diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fcd787c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/ClassicMap/bin +/ClassicMap/obj diff --git a/ClassicMap.sln b/ClassicMap.sln new file mode 100644 index 0000000..0d0e711 --- /dev/null +++ b/ClassicMap.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C# Express 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassicMap", "ClassicMap\ClassicMap.csproj", "{B4591C7A-5431-452F-92FB-91098E7CE7FC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B4591C7A-5431-452F-92FB-91098E7CE7FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4591C7A-5431-452F-92FB-91098E7CE7FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4591C7A-5431-452F-92FB-91098E7CE7FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4591C7A-5431-452F-92FB-91098E7CE7FC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ClassicMap.suo b/ClassicMap.suo new file mode 100644 index 0000000..b88cc70 Binary files /dev/null and b/ClassicMap.suo differ diff --git a/ClassicMap/ClassicMap.csproj b/ClassicMap/ClassicMap.csproj new file mode 100644 index 0000000..b3c6680 --- /dev/null +++ b/ClassicMap/ClassicMap.csproj @@ -0,0 +1,109 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {B4591C7A-5431-452F-92FB-91098E7CE7FC} + WinExe + Properties + ClassicMap + ClassicMap + v2.0 + 512 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\GBHL\GBHL\bin\Debug\GBHL.dll + + + + + + + + + + + + Form + + + Form1.cs + + + + + + + + Form1.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/ClassicMap/ClassicMap.csproj.user b/ClassicMap/ClassicMap.csproj.user new file mode 100644 index 0000000..7ff3943 --- /dev/null +++ b/ClassicMap/ClassicMap.csproj.user @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ClassicMap/FastPixel.cs b/ClassicMap/FastPixel.cs new file mode 100644 index 0000000..8ab0530 --- /dev/null +++ b/ClassicMap/FastPixel.cs @@ -0,0 +1,172 @@ +using System; +using System.Drawing.Imaging; +using System.Drawing; + +namespace ClassicMap +{ + public class FastPixel + { + public byte[] rgbValues = new byte[4]; + private BitmapData bmpData; + private IntPtr bmpPtr; + private bool locked = false; + + private bool _isAlpha = false; + private Bitmap _bitmap; + private int _width; + private int _height; + public int Width + { + get { return this._width; } + } + public int Height + { + get { return this._height; } + } + public bool IsAlphaBitmap + { + get { return this._isAlpha; } + } + public Bitmap Bitmap + { + get { return this._bitmap; } + } + + public FastPixel(Bitmap bitmap) + { + if ((bitmap.PixelFormat == (bitmap.PixelFormat | PixelFormat.Indexed))) + { + throw new Exception("Cannot lock an Indexed image."); + } + this._bitmap = bitmap; + this._isAlpha = (this.Bitmap.PixelFormat == (this.Bitmap.PixelFormat | PixelFormat.Alpha)); + this._width = bitmap.Width; + this._height = bitmap.Height; + } + + public void Lock() + { + if (this.locked) + { + throw new Exception("Bitmap already locked."); + } + + Rectangle rect = new Rectangle(0, 0, this.Width, this.Height); + this.bmpData = this.Bitmap.LockBits(rect, ImageLockMode.ReadWrite, this.Bitmap.PixelFormat); + this.bmpPtr = this.bmpData.Scan0; + + if (this.IsAlphaBitmap) + { + int bytes = (this.Width * this.Height) * 4; + // ERROR: Not supported in C#: ReDimStatement + + System.Runtime.InteropServices.Marshal.Copy(this.bmpPtr, rgbValues, 0, this.rgbValues.Length); + } + else + { + int bytes = (this.Width * this.Height) * 3; + // ERROR: Not supported in C#: ReDimStatement + + System.Runtime.InteropServices.Marshal.Copy(this.bmpPtr, rgbValues, 0, this.rgbValues.Length); + } + + this.locked = true; + } + public void Unlock(bool setPixels) + { + if (!this.locked) + { + throw new Exception("Bitmap not locked."); + } + // Copy the RGB values back to the bitmap + if (setPixels) System.Runtime.InteropServices.Marshal.Copy(this.rgbValues, 0, this.bmpPtr, this.rgbValues.Length); + // Unlock the bits. + this.Bitmap.UnlockBits(bmpData); + this.locked = false; + } + + public void Clear(Color colour) + { + if (!this.locked) + { + throw new Exception("Bitmap not locked."); + } + + if (this.IsAlphaBitmap) + { + for (int index = 0; index <= this.rgbValues.Length - 1; index += 4) + { + this.rgbValues[index] = colour.B; + this.rgbValues[index + 1] = colour.G; + this.rgbValues[index + 2] = colour.R; + this.rgbValues[index + 3] = colour.A; + } + } + else + { + for (int index = 0; index <= this.rgbValues.Length - 1; index += 3) + { + this.rgbValues[index] = colour.B; + this.rgbValues[index + 1] = colour.G; + this.rgbValues[index + 2] = colour.R; + } + } + } + public void SetPixel(Point location, Color colour) + { + this.SetPixel(location.X, location.Y, colour); + } + public void SetPixel(int x, int y, Color colour) + { + if (!this.locked) + { + throw new Exception("Bitmap not locked."); + } + + if (this.IsAlphaBitmap) + { + int index = ((y * this.Width + x) * 4); + this.rgbValues[index] = colour.B; + this.rgbValues[index + 1] = colour.G; + this.rgbValues[index + 2] = colour.R; + this.rgbValues[index + 3] = colour.A; + } + else + { + int index = ((y * this.Width + x) * 3); + this.rgbValues[index] = colour.B; + this.rgbValues[index + 1] = colour.G; + this.rgbValues[index + 2] = colour.R; + } + } + public Color GetPixel(Point location) + { + return this.GetPixel(location.X, location.Y); + } + public Color GetPixel(int x, int y) + { + if (!this.locked) + { + throw new Exception("Bitmap not locked."); + } + + if (this.IsAlphaBitmap) + { + int index = ((y * this.Width + x) * 4); + int b = this.rgbValues[index]; + int g = this.rgbValues[index + 1]; + int r = this.rgbValues[index + 2]; + int a = this.rgbValues[index + 3]; + return Color.FromArgb(a, r, g, b); + } + else + { + int index = ((y * this.Width + x) * 3); + int b = this.rgbValues[index]; + int g = this.rgbValues[index + 1]; + int r = this.rgbValues[index + 2]; + return Color.FromArgb(r, g, b); + } + } + } +} \ No newline at end of file diff --git a/ClassicMap/Form1.Designer.cs b/ClassicMap/Form1.Designer.cs new file mode 100644 index 0000000..57856c4 --- /dev/null +++ b/ClassicMap/Form1.Designer.cs @@ -0,0 +1,1440 @@ +namespace ClassicMap +{ + partial class Form1 + { + /// + /// 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(Form1)); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openROMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); + this.saveROMToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.spriteImagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.pTownMap = new System.Windows.Forms.PictureBox(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lblName = new System.Windows.Forms.Label(); + this.nMap = new System.Windows.Forms.NumericUpDown(); + this.label2 = new System.Windows.Forms.Label(); + this.nTownMap = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.lblMapHeader = new System.Windows.Forms.Label(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.panel2 = new System.Windows.Forms.Panel(); + this.pMap = new System.Windows.Forms.PictureBox(); + this.panel5 = new System.Windows.Forms.Panel(); + this.pTile = new System.Windows.Forms.PictureBox(); + this.panel4 = new System.Windows.Forms.Panel(); + this.pTileset = new System.Windows.Forms.PictureBox(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.panel1 = new System.Windows.Forms.Panel(); + this.pEventMap = new System.Windows.Forms.PictureBox(); + this.panel3 = new System.Windows.Forms.Panel(); + this.pnlPerson = new System.Windows.Forms.Panel(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.lblPersonItem = new System.Windows.Forms.Label(); + this.nPersonItem = new System.Windows.Forms.NumericUpDown(); + this.lblPersonPokemonSet = new System.Windows.Forms.Label(); + this.nPersonPokemonSet = new System.Windows.Forms.NumericUpDown(); + this.lblPersonTrainer = new System.Windows.Forms.Label(); + this.nPersonTrainer = new System.Windows.Forms.NumericUpDown(); + this.label8 = new System.Windows.Forms.Label(); + this.nPersonText = new System.Windows.Forms.NumericUpDown(); + this.label7 = new System.Windows.Forms.Label(); + this.nPersonMovement2 = new System.Windows.Forms.NumericUpDown(); + this.nSelectedPerson = new System.Windows.Forms.NumericUpDown(); + this.label6 = new System.Windows.Forms.Label(); + this.nPersonMovement1 = new System.Windows.Forms.NumericUpDown(); + this.label5 = new System.Windows.Forms.Label(); + this.nPersonPicture = new System.Windows.Forms.NumericUpDown(); + this.label4 = new System.Windows.Forms.Label(); + this.pnlSign = new System.Windows.Forms.Panel(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.nSelectedSign = new System.Windows.Forms.NumericUpDown(); + this.label10 = new System.Windows.Forms.Label(); + this.nSignText = new System.Windows.Forms.NumericUpDown(); + this.label11 = new System.Windows.Forms.Label(); + this.pnlWarpTo = new System.Windows.Forms.Panel(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.button2 = new System.Windows.Forms.Button(); + this.nSelectedWarpTo = new System.Windows.Forms.NumericUpDown(); + this.label12 = new System.Windows.Forms.Label(); + this.nWarpToEvent = new System.Windows.Forms.NumericUpDown(); + this.label13 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.pnlWarp = new System.Windows.Forms.Panel(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.button1 = new System.Windows.Forms.Button(); + this.nSelectedWarp = new System.Windows.Forms.NumericUpDown(); + this.label14 = new System.Windows.Forms.Label(); + this.nWarpMap = new System.Windows.Forms.NumericUpDown(); + this.label15 = new System.Windows.Forms.Label(); + this.nWarpDest = new System.Windows.Forms.NumericUpDown(); + this.label16 = new System.Windows.Forms.Label(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.panel6 = new System.Windows.Forms.Panel(); + this.grpWater = new System.Windows.Forms.GroupBox(); + this.cboWaterPokemon = new System.Windows.Forms.ComboBox(); + this.label21 = new System.Windows.Forms.Label(); + this.nWaterLevel = new System.Windows.Forms.NumericUpDown(); + this.lblWaterEncounter = new System.Windows.Forms.Label(); + this.tbWater = new System.Windows.Forms.TrackBar(); + this.label23 = new System.Windows.Forms.Label(); + this.lstWater = new System.Windows.Forms.ListBox(); + this.pnlWater = new System.Windows.Forms.Panel(); + this.button4 = new System.Windows.Forms.Button(); + this.label17 = new System.Windows.Forms.Label(); + this.grpGrass = new System.Windows.Forms.GroupBox(); + this.cboGrassPokemon = new System.Windows.Forms.ComboBox(); + this.label20 = new System.Windows.Forms.Label(); + this.nGrassLevel = new System.Windows.Forms.NumericUpDown(); + this.lblGrassEncounter = new System.Windows.Forms.Label(); + this.tbGrass = new System.Windows.Forms.TrackBar(); + this.label18 = new System.Windows.Forms.Label(); + this.lstGrass = new System.Windows.Forms.ListBox(); + this.pnlGrass = new System.Windows.Forms.Panel(); + this.button3 = new System.Windows.Forms.Button(); + this.label9 = new System.Windows.Forms.Label(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.lblPosition = new System.Windows.Forms.ToolStripStatusLabel(); + this.lblWildPokemon = new System.Windows.Forms.ToolStripStatusLabel(); + this.romWatcher = new System.IO.FileSystemWatcher(); + this.menuStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pTownMap)).BeginInit(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nMap)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nTownMap)).BeginInit(); + this.groupBox2.SuspendLayout(); + this.tabControl1.SuspendLayout(); + this.tabPage2.SuspendLayout(); + this.panel2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pMap)).BeginInit(); + this.panel5.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pTile)).BeginInit(); + this.panel4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pTileset)).BeginInit(); + this.tabPage1.SuspendLayout(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pEventMap)).BeginInit(); + this.panel3.SuspendLayout(); + this.pnlPerson.SuspendLayout(); + this.groupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonItem)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonPokemonSet)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonTrainer)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonText)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonMovement2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedPerson)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonMovement1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonPicture)).BeginInit(); + this.pnlSign.SuspendLayout(); + this.groupBox5.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedSign)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nSignText)).BeginInit(); + this.pnlWarpTo.SuspendLayout(); + this.groupBox6.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedWarpTo)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nWarpToEvent)).BeginInit(); + this.pnlWarp.SuspendLayout(); + this.groupBox4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedWarp)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nWarpMap)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.nWarpDest)).BeginInit(); + this.tabPage3.SuspendLayout(); + this.panel6.SuspendLayout(); + this.grpWater.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nWaterLevel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbWater)).BeginInit(); + this.pnlWater.SuspendLayout(); + this.grpGrass.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nGrassLevel)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbGrass)).BeginInit(); + this.pnlGrass.SuspendLayout(); + this.statusStrip1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.romWatcher)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.BackColor = System.Drawing.SystemColors.Control; + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.viewToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; + this.menuStrip1.Size = new System.Drawing.Size(592, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openROMToolStripMenuItem, + this.toolStripMenuItem1, + this.saveROMToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // openROMToolStripMenuItem + // + this.openROMToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openROMToolStripMenuItem.Image"))); + this.openROMToolStripMenuItem.Name = "openROMToolStripMenuItem"; + this.openROMToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); + this.openROMToolStripMenuItem.Size = new System.Drawing.Size(189, 22); + this.openROMToolStripMenuItem.Text = "Open ROM..."; + this.openROMToolStripMenuItem.Click += new System.EventHandler(this.openROMToolStripMenuItem_Click); + // + // toolStripMenuItem1 + // + this.toolStripMenuItem1.Name = "toolStripMenuItem1"; + this.toolStripMenuItem1.Size = new System.Drawing.Size(186, 6); + // + // saveROMToolStripMenuItem + // + this.saveROMToolStripMenuItem.Enabled = false; + this.saveROMToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveROMToolStripMenuItem.Image"))); + this.saveROMToolStripMenuItem.Name = "saveROMToolStripMenuItem"; + this.saveROMToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); + this.saveROMToolStripMenuItem.Size = new System.Drawing.Size(189, 22); + this.saveROMToolStripMenuItem.Text = "Save ROM"; + this.saveROMToolStripMenuItem.Click += new System.EventHandler(this.saveROMToolStripMenuItem_Click); + // + // viewToolStripMenuItem + // + this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.spriteImagesToolStripMenuItem}); + this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; + this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); + this.viewToolStripMenuItem.Text = "&View"; + // + // spriteImagesToolStripMenuItem + // + this.spriteImagesToolStripMenuItem.Checked = true; + this.spriteImagesToolStripMenuItem.CheckOnClick = true; + this.spriteImagesToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; + this.spriteImagesToolStripMenuItem.Name = "spriteImagesToolStripMenuItem"; + this.spriteImagesToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.spriteImagesToolStripMenuItem.Text = "Sprite Images"; + this.spriteImagesToolStripMenuItem.Click += new System.EventHandler(this.spriteImagesToolStripMenuItem_Click); + // + // pTownMap + // + this.pTownMap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.pTownMap.Location = new System.Drawing.Point(6, 19); + this.pTownMap.Name = "pTownMap"; + this.pTownMap.Size = new System.Drawing.Size(162, 146); + this.pTownMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pTownMap.TabIndex = 1; + this.pTownMap.TabStop = false; + this.pTownMap.Paint += new System.Windows.Forms.PaintEventHandler(this.pTownMap_Paint); + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.lblName); + this.groupBox1.Controls.Add(this.nMap); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.nTownMap); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.pTownMap); + this.groupBox1.Enabled = false; + this.groupBox1.Location = new System.Drawing.Point(12, 27); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(174, 254); + this.groupBox1.TabIndex = 2; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Selected Map"; + // + // lblName + // + this.lblName.AutoSize = true; + this.lblName.Location = new System.Drawing.Point(6, 222); + this.lblName.Name = "lblName"; + this.lblName.Size = new System.Drawing.Size(35, 13); + this.lblName.TabIndex = 6; + this.lblName.Text = "label3"; + // + // nMap + // + this.nMap.Location = new System.Drawing.Point(95, 197); + this.nMap.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nMap.Name = "nMap"; + this.nMap.Size = new System.Drawing.Size(73, 20); + this.nMap.TabIndex = 5; + this.nMap.ValueChanged += new System.EventHandler(this.nMap_ValueChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 199); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(76, 13); + this.label2.TabIndex = 4; + this.label2.Text = "Selected Map:"; + // + // nTownMap + // + this.nTownMap.Location = new System.Drawing.Point(95, 171); + this.nTownMap.Maximum = new decimal(new int[] { + 47, + 0, + 0, + 0}); + this.nTownMap.Minimum = new decimal(new int[] { + 1, + 0, + 0, + -2147483648}); + this.nTownMap.Name = "nTownMap"; + this.nTownMap.Size = new System.Drawing.Size(73, 20); + this.nTownMap.TabIndex = 3; + this.nTownMap.ValueChanged += new System.EventHandler(this.nTownMap_ValueChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 173); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(83, 13); + this.label1.TabIndex = 2; + this.label1.Text = "Selection Index:"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.lblMapHeader); + this.groupBox2.Enabled = false; + this.groupBox2.Location = new System.Drawing.Point(12, 287); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(174, 134); + this.groupBox2.TabIndex = 3; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Map Information"; + // + // lblMapHeader + // + this.lblMapHeader.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblMapHeader.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblMapHeader.Location = new System.Drawing.Point(3, 16); + this.lblMapHeader.Name = "lblMapHeader"; + this.lblMapHeader.Size = new System.Drawing.Size(168, 115); + this.lblMapHeader.TabIndex = 0; + // + // tabControl1 + // + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Enabled = false; + this.tabControl1.Location = new System.Drawing.Point(192, 27); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(388, 401); + this.tabControl1.TabIndex = 4; + this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged); + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.panel2); + this.tabPage2.Controls.Add(this.panel5); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(380, 375); + this.tabPage2.TabIndex = 2; + this.tabPage2.Text = "Map"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // panel2 + // + this.panel2.AutoScroll = true; + this.panel2.BackColor = System.Drawing.SystemColors.Control; + this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel2.Controls.Add(this.pMap); + this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel2.Location = new System.Drawing.Point(3, 3); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(315, 369); + this.panel2.TabIndex = 0; + // + // pMap + // + this.pMap.Location = new System.Drawing.Point(0, 0); + this.pMap.Name = "pMap"; + this.pMap.Size = new System.Drawing.Size(64, 64); + this.pMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pMap.TabIndex = 0; + this.pMap.TabStop = false; + this.pMap.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pMap_MouseMove); + this.pMap.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pMap_MouseDown); + this.pMap.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pMap_MouseUp); + // + // panel5 + // + this.panel5.BackColor = System.Drawing.SystemColors.Control; + this.panel5.Controls.Add(this.pTile); + this.panel5.Controls.Add(this.panel4); + this.panel5.Dock = System.Windows.Forms.DockStyle.Right; + this.panel5.Location = new System.Drawing.Point(318, 3); + this.panel5.Name = "panel5"; + this.panel5.Size = new System.Drawing.Size(59, 369); + this.panel5.TabIndex = 1; + // + // pTile + // + this.pTile.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.pTile.Location = new System.Drawing.Point(13, 323); + this.pTile.Name = "pTile"; + this.pTile.Size = new System.Drawing.Size(36, 36); + this.pTile.TabIndex = 6; + this.pTile.TabStop = false; + // + // panel4 + // + this.panel4.AutoScroll = true; + this.panel4.Controls.Add(this.pTileset); + this.panel4.Location = new System.Drawing.Point(0, 2); + this.panel4.Name = "panel4"; + this.panel4.Size = new System.Drawing.Size(57, 306); + this.panel4.TabIndex = 5; + // + // pTileset + // + this.pTileset.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.pTileset.Location = new System.Drawing.Point(4, 0); + this.pTileset.Margin = new System.Windows.Forms.Padding(0); + this.pTileset.Name = "pTileset"; + this.pTileset.Size = new System.Drawing.Size(36, 8196); + this.pTileset.TabIndex = 0; + this.pTileset.TabStop = false; + this.pTileset.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pTileset_MouseDown); + this.pTileset.Paint += new System.Windows.Forms.PaintEventHandler(this.pTileset_Paint); + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.panel1); + this.tabPage1.Controls.Add(this.panel3); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(380, 375); + this.tabPage1.TabIndex = 3; + this.tabPage1.Text = "Events"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // panel1 + // + this.panel1.AutoScroll = true; + this.panel1.BackColor = System.Drawing.SystemColors.Control; + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel1.Controls.Add(this.pEventMap); + this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel1.Location = new System.Drawing.Point(3, 3); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(232, 369); + this.panel1.TabIndex = 0; + // + // pEventMap + // + this.pEventMap.Location = new System.Drawing.Point(0, 0); + this.pEventMap.Name = "pEventMap"; + this.pEventMap.Size = new System.Drawing.Size(64, 64); + this.pEventMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pEventMap.TabIndex = 0; + this.pEventMap.TabStop = false; + this.pEventMap.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pEventMap_MouseMove); + this.pEventMap.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pEventMap_MouseDown); + this.pEventMap.Paint += new System.Windows.Forms.PaintEventHandler(this.pEventMap_Paint); + this.pEventMap.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pEventMap_MouseUp); + // + // panel3 + // + this.panel3.BackColor = System.Drawing.SystemColors.Control; + this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.panel3.Controls.Add(this.pnlPerson); + this.panel3.Controls.Add(this.pnlSign); + this.panel3.Controls.Add(this.pnlWarpTo); + this.panel3.Controls.Add(this.label3); + this.panel3.Controls.Add(this.pnlWarp); + this.panel3.Dock = System.Windows.Forms.DockStyle.Right; + this.panel3.Location = new System.Drawing.Point(235, 3); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(142, 369); + this.panel3.TabIndex = 1; + // + // pnlPerson + // + this.pnlPerson.Controls.Add(this.groupBox3); + this.pnlPerson.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlPerson.Location = new System.Drawing.Point(0, 0); + this.pnlPerson.Name = "pnlPerson"; + this.pnlPerson.Size = new System.Drawing.Size(138, 365); + this.pnlPerson.TabIndex = 2; + this.pnlPerson.Visible = false; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.lblPersonItem); + this.groupBox3.Controls.Add(this.nPersonItem); + this.groupBox3.Controls.Add(this.lblPersonPokemonSet); + this.groupBox3.Controls.Add(this.nPersonPokemonSet); + this.groupBox3.Controls.Add(this.lblPersonTrainer); + this.groupBox3.Controls.Add(this.nPersonTrainer); + this.groupBox3.Controls.Add(this.label8); + this.groupBox3.Controls.Add(this.nPersonText); + this.groupBox3.Controls.Add(this.label7); + this.groupBox3.Controls.Add(this.nPersonMovement2); + this.groupBox3.Controls.Add(this.nSelectedPerson); + this.groupBox3.Controls.Add(this.label6); + this.groupBox3.Controls.Add(this.nPersonMovement1); + this.groupBox3.Controls.Add(this.label5); + this.groupBox3.Controls.Add(this.nPersonPicture); + this.groupBox3.Controls.Add(this.label4); + this.groupBox3.Location = new System.Drawing.Point(7, 3); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(128, 224); + this.groupBox3.TabIndex = 0; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Selected Person"; + // + // lblPersonItem + // + this.lblPersonItem.AutoSize = true; + this.lblPersonItem.Enabled = false; + this.lblPersonItem.Location = new System.Drawing.Point(6, 199); + this.lblPersonItem.Name = "lblPersonItem"; + this.lblPersonItem.Size = new System.Drawing.Size(30, 13); + this.lblPersonItem.TabIndex = 14; + this.lblPersonItem.Text = "Item:"; + // + // nPersonItem + // + this.nPersonItem.Enabled = false; + this.nPersonItem.Location = new System.Drawing.Point(81, 197); + this.nPersonItem.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nPersonItem.Name = "nPersonItem"; + this.nPersonItem.Size = new System.Drawing.Size(43, 20); + this.nPersonItem.TabIndex = 15; + this.nPersonItem.ValueChanged += new System.EventHandler(this.nPersonItem_ValueChanged); + // + // lblPersonPokemonSet + // + this.lblPersonPokemonSet.AutoSize = true; + this.lblPersonPokemonSet.Enabled = false; + this.lblPersonPokemonSet.Location = new System.Drawing.Point(6, 174); + this.lblPersonPokemonSet.Name = "lblPersonPokemonSet"; + this.lblPersonPokemonSet.Size = new System.Drawing.Size(74, 13); + this.lblPersonPokemonSet.TabIndex = 12; + this.lblPersonPokemonSet.Text = "Pokemon Set:"; + // + // nPersonPokemonSet + // + this.nPersonPokemonSet.Enabled = false; + this.nPersonPokemonSet.Location = new System.Drawing.Point(81, 171); + this.nPersonPokemonSet.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nPersonPokemonSet.Name = "nPersonPokemonSet"; + this.nPersonPokemonSet.Size = new System.Drawing.Size(43, 20); + this.nPersonPokemonSet.TabIndex = 13; + this.nPersonPokemonSet.ValueChanged += new System.EventHandler(this.nPersonPokemonSet_ValueChanged); + // + // lblPersonTrainer + // + this.lblPersonTrainer.AutoSize = true; + this.lblPersonTrainer.Enabled = false; + this.lblPersonTrainer.Location = new System.Drawing.Point(6, 147); + this.lblPersonTrainer.Name = "lblPersonTrainer"; + this.lblPersonTrainer.Size = new System.Drawing.Size(57, 13); + this.lblPersonTrainer.TabIndex = 10; + this.lblPersonTrainer.Text = "Trainer ID:"; + // + // nPersonTrainer + // + this.nPersonTrainer.Enabled = false; + this.nPersonTrainer.Location = new System.Drawing.Point(81, 145); + this.nPersonTrainer.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nPersonTrainer.Name = "nPersonTrainer"; + this.nPersonTrainer.Size = new System.Drawing.Size(43, 20); + this.nPersonTrainer.TabIndex = 11; + this.nPersonTrainer.ValueChanged += new System.EventHandler(this.nPersonTrainer_ValueChanged); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(6, 121); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(31, 13); + this.label8.TabIndex = 8; + this.label8.Text = "Text:"; + // + // nPersonText + // + this.nPersonText.Location = new System.Drawing.Point(81, 119); + this.nPersonText.Maximum = new decimal(new int[] { + 63, + 0, + 0, + 0}); + this.nPersonText.Name = "nPersonText"; + this.nPersonText.Size = new System.Drawing.Size(43, 20); + this.nPersonText.TabIndex = 9; + this.nPersonText.ValueChanged += new System.EventHandler(this.nPersonText_ValueChanged); + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(6, 95); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(69, 13); + this.label7.TabIndex = 6; + this.label7.Text = "Movement 2:"; + // + // nPersonMovement2 + // + this.nPersonMovement2.Location = new System.Drawing.Point(81, 93); + this.nPersonMovement2.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nPersonMovement2.Name = "nPersonMovement2"; + this.nPersonMovement2.Size = new System.Drawing.Size(43, 20); + this.nPersonMovement2.TabIndex = 7; + this.nPersonMovement2.ValueChanged += new System.EventHandler(this.nPersonMovement2_ValueChanged); + // + // nSelectedPerson + // + this.nSelectedPerson.Location = new System.Drawing.Point(81, 15); + this.nSelectedPerson.Maximum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nSelectedPerson.Name = "nSelectedPerson"; + this.nSelectedPerson.Size = new System.Drawing.Size(43, 20); + this.nSelectedPerson.TabIndex = 1; + this.nSelectedPerson.ValueChanged += new System.EventHandler(this.nSelectedPerson_ValueChanged); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(6, 69); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(69, 13); + this.label6.TabIndex = 4; + this.label6.Text = "Movement 1:"; + // + // nPersonMovement1 + // + this.nPersonMovement1.Location = new System.Drawing.Point(81, 67); + this.nPersonMovement1.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nPersonMovement1.Name = "nPersonMovement1"; + this.nPersonMovement1.Size = new System.Drawing.Size(43, 20); + this.nPersonMovement1.TabIndex = 5; + this.nPersonMovement1.ValueChanged += new System.EventHandler(this.nPersonMovement1_ValueChanged); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(6, 43); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(43, 13); + this.label5.TabIndex = 2; + this.label5.Text = "Picture:"; + // + // nPersonPicture + // + this.nPersonPicture.Location = new System.Drawing.Point(81, 41); + this.nPersonPicture.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nPersonPicture.Name = "nPersonPicture"; + this.nPersonPicture.Size = new System.Drawing.Size(43, 20); + this.nPersonPicture.TabIndex = 3; + this.nPersonPicture.ValueChanged += new System.EventHandler(this.nPersonPicture_ValueChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(6, 17); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(52, 13); + this.label4.TabIndex = 0; + this.label4.Text = "Selected:"; + // + // pnlSign + // + this.pnlSign.Controls.Add(this.groupBox5); + this.pnlSign.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlSign.Location = new System.Drawing.Point(0, 0); + this.pnlSign.Name = "pnlSign"; + this.pnlSign.Size = new System.Drawing.Size(138, 365); + this.pnlSign.TabIndex = 4; + this.pnlSign.Visible = false; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.nSelectedSign); + this.groupBox5.Controls.Add(this.label10); + this.groupBox5.Controls.Add(this.nSignText); + this.groupBox5.Controls.Add(this.label11); + this.groupBox5.Location = new System.Drawing.Point(7, 3); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(128, 66); + this.groupBox5.TabIndex = 0; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "Selected Sign"; + // + // nSelectedSign + // + this.nSelectedSign.Location = new System.Drawing.Point(81, 15); + this.nSelectedSign.Maximum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nSelectedSign.Name = "nSelectedSign"; + this.nSelectedSign.Size = new System.Drawing.Size(43, 20); + this.nSelectedSign.TabIndex = 1; + this.nSelectedSign.ValueChanged += new System.EventHandler(this.nSelectedSign_ValueChanged); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(6, 43); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(31, 13); + this.label10.TabIndex = 2; + this.label10.Text = "Text:"; + // + // nSignText + // + this.nSignText.Location = new System.Drawing.Point(81, 41); + this.nSignText.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nSignText.Name = "nSignText"; + this.nSignText.Size = new System.Drawing.Size(43, 20); + this.nSignText.TabIndex = 3; + this.nSignText.ValueChanged += new System.EventHandler(this.nSignText_ValueChanged); + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(6, 17); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(52, 13); + this.label11.TabIndex = 0; + this.label11.Text = "Selected:"; + // + // pnlWarpTo + // + this.pnlWarpTo.Controls.Add(this.groupBox6); + this.pnlWarpTo.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlWarpTo.Location = new System.Drawing.Point(0, 0); + this.pnlWarpTo.Name = "pnlWarpTo"; + this.pnlWarpTo.Size = new System.Drawing.Size(138, 365); + this.pnlWarpTo.TabIndex = 5; + this.pnlWarpTo.Visible = false; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.button2); + this.groupBox6.Controls.Add(this.nSelectedWarpTo); + this.groupBox6.Controls.Add(this.label12); + this.groupBox6.Controls.Add(this.nWarpToEvent); + this.groupBox6.Controls.Add(this.label13); + this.groupBox6.Location = new System.Drawing.Point(7, 3); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(128, 98); + this.groupBox6.TabIndex = 0; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Selected Warp"; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(61, 67); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(63, 23); + this.button2.TabIndex = 4; + this.button2.Text = "Calculate"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // nSelectedWarpTo + // + this.nSelectedWarpTo.Location = new System.Drawing.Point(81, 15); + this.nSelectedWarpTo.Maximum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nSelectedWarpTo.Name = "nSelectedWarpTo"; + this.nSelectedWarpTo.Size = new System.Drawing.Size(43, 20); + this.nSelectedWarpTo.TabIndex = 1; + this.nSelectedWarpTo.ValueChanged += new System.EventHandler(this.nSelectedWarpTo_ValueChanged); + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(6, 43); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(58, 13); + this.label12.TabIndex = 2; + this.label12.Text = "Event Off.:"; + // + // nWarpToEvent + // + this.nWarpToEvent.Hexadecimal = true; + this.nWarpToEvent.Location = new System.Drawing.Point(70, 41); + this.nWarpToEvent.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.nWarpToEvent.Name = "nWarpToEvent"; + this.nWarpToEvent.Size = new System.Drawing.Size(54, 20); + this.nWarpToEvent.TabIndex = 3; + this.nWarpToEvent.ValueChanged += new System.EventHandler(this.nWarpToEvent_ValueChanged); + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(6, 17); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(52, 13); + this.label13.TabIndex = 0; + this.label13.Text = "Selected:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(4, 2); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(97, 13); + this.label3.TabIndex = 1; + this.label3.Text = "No event selected."; + // + // pnlWarp + // + this.pnlWarp.Controls.Add(this.groupBox4); + this.pnlWarp.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlWarp.Location = new System.Drawing.Point(0, 0); + this.pnlWarp.Name = "pnlWarp"; + this.pnlWarp.Size = new System.Drawing.Size(138, 365); + this.pnlWarp.TabIndex = 3; + this.pnlWarp.Visible = false; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.button1); + this.groupBox4.Controls.Add(this.nSelectedWarp); + this.groupBox4.Controls.Add(this.label14); + this.groupBox4.Controls.Add(this.nWarpMap); + this.groupBox4.Controls.Add(this.label15); + this.groupBox4.Controls.Add(this.nWarpDest); + this.groupBox4.Controls.Add(this.label16); + this.groupBox4.Location = new System.Drawing.Point(7, 3); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(128, 121); + this.groupBox4.TabIndex = 0; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Selected Warp"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(6, 93); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(116, 23); + this.button1.TabIndex = 13; + this.button1.Text = "Follow Warp"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // nSelectedWarp + // + this.nSelectedWarp.Location = new System.Drawing.Point(81, 15); + this.nSelectedWarp.Maximum = new decimal(new int[] { + 0, + 0, + 0, + 0}); + this.nSelectedWarp.Name = "nSelectedWarp"; + this.nSelectedWarp.Size = new System.Drawing.Size(43, 20); + this.nSelectedWarp.TabIndex = 1; + this.nSelectedWarp.ValueChanged += new System.EventHandler(this.nSelectedWarp_ValueChanged); + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(6, 69); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(59, 13); + this.label14.TabIndex = 4; + this.label14.Text = "Dest. Map:"; + // + // nWarpMap + // + this.nWarpMap.Location = new System.Drawing.Point(81, 67); + this.nWarpMap.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nWarpMap.Name = "nWarpMap"; + this.nWarpMap.Size = new System.Drawing.Size(43, 20); + this.nWarpMap.TabIndex = 5; + this.nWarpMap.ValueChanged += new System.EventHandler(this.nWarpMap_ValueChanged); + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(6, 43); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(62, 13); + this.label15.TabIndex = 2; + this.label15.Text = "Dest. Point:"; + // + // nWarpDest + // + this.nWarpDest.Location = new System.Drawing.Point(81, 41); + this.nWarpDest.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nWarpDest.Name = "nWarpDest"; + this.nWarpDest.Size = new System.Drawing.Size(43, 20); + this.nWarpDest.TabIndex = 3; + this.nWarpDest.ValueChanged += new System.EventHandler(this.nWarpDest_ValueChanged); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(6, 17); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(52, 13); + this.label16.TabIndex = 0; + this.label16.Text = "Selected:"; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.panel6); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Size = new System.Drawing.Size(380, 375); + this.tabPage3.TabIndex = 4; + this.tabPage3.Text = "Wild Pokemon"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // panel6 + // + this.panel6.BackColor = System.Drawing.SystemColors.Control; + this.panel6.Controls.Add(this.grpWater); + this.panel6.Controls.Add(this.pnlWater); + this.panel6.Controls.Add(this.grpGrass); + this.panel6.Controls.Add(this.pnlGrass); + this.panel6.Dock = System.Windows.Forms.DockStyle.Fill; + this.panel6.Location = new System.Drawing.Point(0, 0); + this.panel6.Name = "panel6"; + this.panel6.Size = new System.Drawing.Size(380, 375); + this.panel6.TabIndex = 0; + // + // grpWater + // + this.grpWater.Controls.Add(this.cboWaterPokemon); + this.grpWater.Controls.Add(this.label21); + this.grpWater.Controls.Add(this.nWaterLevel); + this.grpWater.Controls.Add(this.lblWaterEncounter); + this.grpWater.Controls.Add(this.tbWater); + this.grpWater.Controls.Add(this.label23); + this.grpWater.Controls.Add(this.lstWater); + this.grpWater.Location = new System.Drawing.Point(3, 190); + this.grpWater.Name = "grpWater"; + this.grpWater.Size = new System.Drawing.Size(202, 182); + this.grpWater.TabIndex = 3; + this.grpWater.TabStop = false; + this.grpWater.Text = "Water Pokemon"; + this.grpWater.Visible = false; + // + // cboWaterPokemon + // + this.cboWaterPokemon.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboWaterPokemon.FormattingEnabled = true; + this.cboWaterPokemon.Location = new System.Drawing.Point(67, 154); + this.cboWaterPokemon.Name = "cboWaterPokemon"; + this.cboWaterPokemon.Size = new System.Drawing.Size(129, 21); + this.cboWaterPokemon.TabIndex = 6; + this.cboWaterPokemon.SelectedIndexChanged += new System.EventHandler(this.cboWaterPokemon_SelectedIndexChanged); + // + // label21 + // + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(6, 157); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(55, 13); + this.label21.TabIndex = 5; + this.label21.Text = "Pokemon:"; + // + // nWaterLevel + // + this.nWaterLevel.Location = new System.Drawing.Point(67, 128); + this.nWaterLevel.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nWaterLevel.Name = "nWaterLevel"; + this.nWaterLevel.Size = new System.Drawing.Size(130, 20); + this.nWaterLevel.TabIndex = 4; + this.nWaterLevel.ValueChanged += new System.EventHandler(this.nWaterLevel_ValueChanged); + // + // lblWaterEncounter + // + this.lblWaterEncounter.AutoSize = true; + this.lblWaterEncounter.Location = new System.Drawing.Point(6, 19); + this.lblWaterEncounter.Name = "lblWaterEncounter"; + this.lblWaterEncounter.Size = new System.Drawing.Size(144, 13); + this.lblWaterEncounter.TabIndex = 3; + this.lblWaterEncounter.Text = "Encounter Frequency: 0/255"; + // + // tbWater + // + this.tbWater.AutoSize = false; + this.tbWater.Location = new System.Drawing.Point(6, 35); + this.tbWater.Maximum = 255; + this.tbWater.Name = "tbWater"; + this.tbWater.Size = new System.Drawing.Size(190, 25); + this.tbWater.TabIndex = 2; + this.tbWater.Scroll += new System.EventHandler(this.tbWater_Scroll); + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(6, 130); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(36, 13); + this.label23.TabIndex = 1; + this.label23.Text = "Level:"; + // + // lstWater + // + this.lstWater.FormattingEnabled = true; + this.lstWater.Location = new System.Drawing.Point(6, 66); + this.lstWater.Name = "lstWater"; + this.lstWater.Size = new System.Drawing.Size(191, 56); + this.lstWater.TabIndex = 0; + this.lstWater.SelectedIndexChanged += new System.EventHandler(this.lstWater_SelectedIndexChanged); + // + // pnlWater + // + this.pnlWater.Controls.Add(this.button4); + this.pnlWater.Controls.Add(this.label17); + this.pnlWater.Location = new System.Drawing.Point(0, 190); + this.pnlWater.Name = "pnlWater"; + this.pnlWater.Size = new System.Drawing.Size(202, 94); + this.pnlWater.TabIndex = 1; + this.pnlWater.Visible = false; + // + // button4 + // + this.button4.Location = new System.Drawing.Point(17, 52); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(182, 23); + this.button4.TabIndex = 2; + this.button4.Text = "Add Water Pokemon"; + this.button4.UseVisualStyleBackColor = true; + // + // label17 + // + this.label17.Location = new System.Drawing.Point(14, 12); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(185, 37); + this.label17.TabIndex = 1; + this.label17.Text = "There are no water Pokemon. Click the button to add some."; + // + // grpGrass + // + this.grpGrass.Controls.Add(this.cboGrassPokemon); + this.grpGrass.Controls.Add(this.label20); + this.grpGrass.Controls.Add(this.nGrassLevel); + this.grpGrass.Controls.Add(this.lblGrassEncounter); + this.grpGrass.Controls.Add(this.tbGrass); + this.grpGrass.Controls.Add(this.label18); + this.grpGrass.Controls.Add(this.lstGrass); + this.grpGrass.Location = new System.Drawing.Point(3, 2); + this.grpGrass.Name = "grpGrass"; + this.grpGrass.Size = new System.Drawing.Size(202, 182); + this.grpGrass.TabIndex = 2; + this.grpGrass.TabStop = false; + this.grpGrass.Text = "Grass Pokemon"; + this.grpGrass.Visible = false; + // + // cboGrassPokemon + // + this.cboGrassPokemon.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboGrassPokemon.FormattingEnabled = true; + this.cboGrassPokemon.Location = new System.Drawing.Point(67, 154); + this.cboGrassPokemon.Name = "cboGrassPokemon"; + this.cboGrassPokemon.Size = new System.Drawing.Size(129, 21); + this.cboGrassPokemon.TabIndex = 6; + this.cboGrassPokemon.SelectedIndexChanged += new System.EventHandler(this.cboGrassPokemon_SelectedIndexChanged); + // + // label20 + // + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(6, 157); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(55, 13); + this.label20.TabIndex = 5; + this.label20.Text = "Pokemon:"; + // + // nGrassLevel + // + this.nGrassLevel.Location = new System.Drawing.Point(67, 128); + this.nGrassLevel.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.nGrassLevel.Name = "nGrassLevel"; + this.nGrassLevel.Size = new System.Drawing.Size(129, 20); + this.nGrassLevel.TabIndex = 4; + this.nGrassLevel.ValueChanged += new System.EventHandler(this.nGrassLevel_ValueChanged); + // + // lblGrassEncounter + // + this.lblGrassEncounter.AutoSize = true; + this.lblGrassEncounter.Location = new System.Drawing.Point(6, 19); + this.lblGrassEncounter.Name = "lblGrassEncounter"; + this.lblGrassEncounter.Size = new System.Drawing.Size(144, 13); + this.lblGrassEncounter.TabIndex = 3; + this.lblGrassEncounter.Text = "Encounter Frequency: 0/255"; + // + // tbGrass + // + this.tbGrass.AutoSize = false; + this.tbGrass.Location = new System.Drawing.Point(6, 35); + this.tbGrass.Maximum = 255; + this.tbGrass.Name = "tbGrass"; + this.tbGrass.Size = new System.Drawing.Size(190, 25); + this.tbGrass.TabIndex = 2; + this.tbGrass.Scroll += new System.EventHandler(this.tbGrass_Scroll); + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Location = new System.Drawing.Point(6, 130); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(36, 13); + this.label18.TabIndex = 1; + this.label18.Text = "Level:"; + // + // lstGrass + // + this.lstGrass.FormattingEnabled = true; + this.lstGrass.Location = new System.Drawing.Point(6, 66); + this.lstGrass.Name = "lstGrass"; + this.lstGrass.Size = new System.Drawing.Size(190, 56); + this.lstGrass.TabIndex = 0; + this.lstGrass.SelectedIndexChanged += new System.EventHandler(this.lstGrass_SelectedIndexChanged); + // + // pnlGrass + // + this.pnlGrass.Controls.Add(this.button3); + this.pnlGrass.Controls.Add(this.label9); + this.pnlGrass.Location = new System.Drawing.Point(0, 0); + this.pnlGrass.Name = "pnlGrass"; + this.pnlGrass.Size = new System.Drawing.Size(202, 94); + this.pnlGrass.TabIndex = 0; + this.pnlGrass.Visible = false; + // + // button3 + // + this.button3.Location = new System.Drawing.Point(17, 52); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(182, 23); + this.button3.TabIndex = 2; + this.button3.Text = "Add Grass Pokemon"; + this.button3.UseVisualStyleBackColor = true; + // + // label9 + // + this.label9.Location = new System.Drawing.Point(14, 12); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(185, 37); + this.label9.TabIndex = 1; + this.label9.Text = "There are no grass Pokemon. Click the button to add some."; + // + // statusStrip1 + // + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.lblPosition, + this.lblWildPokemon}); + this.statusStrip1.Location = new System.Drawing.Point(0, 431); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(592, 22); + this.statusStrip1.TabIndex = 5; + this.statusStrip1.Text = "statusStrip1"; + // + // lblPosition + // + this.lblPosition.AutoSize = false; + this.lblPosition.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; + this.lblPosition.Name = "lblPosition"; + this.lblPosition.Size = new System.Drawing.Size(72, 17); + this.lblPosition.Text = "X: 0 Y: 0"; + this.lblPosition.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // lblWildPokemon + // + this.lblWildPokemon.Name = "lblWildPokemon"; + this.lblWildPokemon.Size = new System.Drawing.Size(105, 17); + this.lblWildPokemon.Text = "Wild Pokemon: None"; + // + // romWatcher + // + this.romWatcher.EnableRaisingEvents = true; + this.romWatcher.NotifyFilter = System.IO.NotifyFilters.Attributes; + this.romWatcher.SynchronizingObject = this; + this.romWatcher.Changed += new System.IO.FileSystemEventHandler(this.romWatcher_Changed); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; + this.ClientSize = new System.Drawing.Size(592, 453); + this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.tabControl1); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "ClassicMap"; + this.Load += new System.EventHandler(this.Form1_Load); + this.Resize += new System.EventHandler(this.Form1_Resize); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pTownMap)).EndInit(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nMap)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nTownMap)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.tabControl1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pMap)).EndInit(); + this.panel5.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pTile)).EndInit(); + this.panel4.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pTileset)).EndInit(); + this.tabPage1.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pEventMap)).EndInit(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.pnlPerson.ResumeLayout(false); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonItem)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonPokemonSet)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonTrainer)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonText)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonMovement2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedPerson)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonMovement1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nPersonPicture)).EndInit(); + this.pnlSign.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedSign)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nSignText)).EndInit(); + this.pnlWarpTo.ResumeLayout(false); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedWarpTo)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nWarpToEvent)).EndInit(); + this.pnlWarp.ResumeLayout(false); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nSelectedWarp)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nWarpMap)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.nWarpDest)).EndInit(); + this.tabPage3.ResumeLayout(false); + this.panel6.ResumeLayout(false); + this.grpWater.ResumeLayout(false); + this.grpWater.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nWaterLevel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbWater)).EndInit(); + this.pnlWater.ResumeLayout(false); + this.grpGrass.ResumeLayout(false); + this.grpGrass.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.nGrassLevel)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.tbGrass)).EndInit(); + this.pnlGrass.ResumeLayout(false); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.romWatcher)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openROMToolStripMenuItem; + private System.Windows.Forms.PictureBox pTownMap; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.NumericUpDown nTownMap; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown nMap; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label lblName; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label lblMapHeader; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panel5; + private System.Windows.Forms.PictureBox pTile; + private System.Windows.Forms.Panel panel4; + private System.Windows.Forms.PictureBox pMap; + private System.Windows.Forms.PictureBox pTileset; + private System.Windows.Forms.ToolStripStatusLabel lblPosition; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.PictureBox pEventMap; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Panel pnlPerson; + private System.Windows.Forms.GroupBox groupBox3; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.NumericUpDown nSelectedPerson; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.NumericUpDown nPersonPicture; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.NumericUpDown nPersonMovement1; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.NumericUpDown nPersonMovement2; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.NumericUpDown nPersonText; + private System.Windows.Forms.Label lblPersonTrainer; + private System.Windows.Forms.NumericUpDown nPersonTrainer; + private System.Windows.Forms.Label lblPersonPokemonSet; + private System.Windows.Forms.NumericUpDown nPersonPokemonSet; + private System.Windows.Forms.Label lblPersonItem; + private System.Windows.Forms.NumericUpDown nPersonItem; + private System.Windows.Forms.Panel pnlWarp; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.NumericUpDown nSelectedWarp; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.NumericUpDown nWarpMap; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.NumericUpDown nWarpDest; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Panel pnlSign; + private System.Windows.Forms.GroupBox groupBox5; + private System.Windows.Forms.NumericUpDown nSelectedSign; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.NumericUpDown nSignText; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Panel pnlWarpTo; + private System.Windows.Forms.GroupBox groupBox6; + private System.Windows.Forms.NumericUpDown nSelectedWarpTo; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.NumericUpDown nWarpToEvent; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; + private System.Windows.Forms.ToolStripMenuItem saveROMToolStripMenuItem; + private System.IO.FileSystemWatcher romWatcher; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.Panel panel6; + private System.Windows.Forms.ToolStripStatusLabel lblWildPokemon; + private System.Windows.Forms.Panel pnlGrass; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.GroupBox grpGrass; + private System.Windows.Forms.Panel pnlWater; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label lblGrassEncounter; + private System.Windows.Forms.TrackBar tbGrass; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.ListBox lstGrass; + private System.Windows.Forms.GroupBox grpWater; + private System.Windows.Forms.ComboBox cboWaterPokemon; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.NumericUpDown nWaterLevel; + private System.Windows.Forms.Label lblWaterEncounter; + private System.Windows.Forms.TrackBar tbWater; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.ListBox lstWater; + private System.Windows.Forms.ComboBox cboGrassPokemon; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.NumericUpDown nGrassLevel; + private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem spriteImagesToolStripMenuItem; + } +} + diff --git a/ClassicMap/Form1.cs b/ClassicMap/Form1.cs new file mode 100644 index 0000000..7bc3463 --- /dev/null +++ b/ClassicMap/Form1.cs @@ -0,0 +1,924 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using GBHL; +using System.Text; +using System.IO; +using System.Windows.Forms; +using System.Drawing.Imaging; + +namespace ClassicMap +{ + public partial class Form1 : Form + { + private string romLocation = ""; + private GBFile gb = null; + private TownMapLoader townMapLoader; + private TilesetLoader tilesetLoader; + private MapLoader mapLoader; + private WildPokemonLoader wildPokemonLoader; + private SpriteLoader spriteLoader; + private Bitmap townMapMarker; + private Bitmap townMap; + private Bitmap[] cachedTilesets; + private int selectedTile = 0; + private Point lastClick; + private ImageAttributes eventTransparency; + private ImageAttributes eventTTransparency; + private Rectangle eventRectangle = new Rectangle(0, 0, 16, 16); + private int selectedPerson = -1, selectedSign = -1, selectedWarp = -1, selectedWarpTo = -1; + private bool triggerPokemonEvents; //Ugh... Didn't want to have to resort to this. Probably don't, but oh well. + + public static Color[] Palette = new Color[] { Color.White, Color.FromArgb(208, 208, 208), Color.FromArgb(168, 168, 168), Color.Black }; + + + //Open File Dialogs + private OpenFileDialog openROM; + + public Form1() + { + InitializeComponent(); + //Initialize the Open File Dialogs + openROM = new OpenFileDialog(); + openROM.Title = "Select a Pokemon Red/Blue ROM"; + openROM.Filter = "All Supported Types|*.bin;*.gb"; + + ColorMatrix cm = new ColorMatrix(); + cm.Matrix33 = (float).7; + eventTransparency = new ImageAttributes(); + eventTransparency.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); + ColorMatrix cm2 = new ColorMatrix(); + cm2.Matrix33 = (float).6; + eventTTransparency = new ImageAttributes(); + eventTTransparency.SetColorMatrix(cm2, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); + } + + private void openROMToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openROM.ShowDialog() != DialogResult.OK) + return; + FileInfo f = new FileInfo(openROM.FileName); + bool enable = true; + if (f.IsReadOnly) + { + MessageBox.Show("Warning! ROM is read-only. You will not be able to save.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + enable = false; + } + try + { + BinaryReader br = new BinaryReader(File.OpenRead(openROM.FileName)); + byte[] buffer = br.ReadBytes((int)br.BaseStream.Length); + br.Close(); + gb = new GBFile(buffer); + if (enable) + saveROMToolStripMenuItem.Enabled = true; + } + catch (IOException ex) + { + MessageBox.Show("Error reading ROM.\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + DoInitialLoading(); + } + + public void DoInitialLoading() + { + romLocation = openROM.FileName; + EnableFileWatcher(); + BleControls(true); + lastClick = new Point(-1, -1); + triggerPokemonEvents = true; + + townMapLoader = new TownMapLoader(gb); + tilesetLoader = new TilesetLoader(gb); + mapLoader = new MapLoader(gb); + wildPokemonLoader = new WildPokemonLoader(gb); + spriteLoader = new SpriteLoader(gb); + + cachedTilesets = new Bitmap[256]; + wildPokemonLoader.LoadPokemonNames(); + foreach (string name in wildPokemonLoader.PokemonNames) + { + if (name == null) + continue; + cboGrassPokemon.Items.Add(name); + cboWaterPokemon.Items.Add(name); + } + + townMap = townMapLoader.LoadMap(); + townMapMarker = townMapLoader.LoadMarker(); + nTownMap_ValueChanged(null, null); + LoadMap((int)nMap.Value); + } + + private void EnableFileWatcher() + { + string[] parts = romLocation.Split('\\'); + string f = ""; + for (int i = 0; i < parts.Length - 1; i++) + f += parts[i] + "\\"; + romWatcher.Path = f; + romWatcher.EnableRaisingEvents = true; + } + + private void BleControls(bool b) + { + groupBox1.Enabled = b; + groupBox2.Enabled = b; + tabControl1.Enabled = b; + } + + private void pTownMap_Paint(object sender, PaintEventArgs e) + { + + } + + private void nTownMap_ValueChanged(object sender, EventArgs e) + { + if (nTownMap.Value == 47) + nTownMap.Value = 0; + if (nTownMap.Value == -1) + nTownMap.Value = 46; + Bitmap b = new Bitmap(townMap); + if (sender == nMap) + { + pTownMap.Image = b; + return; + } + Graphics g = Graphics.FromImage(b); + int x = 0, y = 0; + byte map = gb.ReadByte(0x70F11 + (int)nTownMap.Value); + nMap.Value = map; + int namePointer = 0; + if (map <= 0x25) + { + gb.BufferLocation = 0x71313 + map * 3; + byte location = gb.ReadByte(); + x = (location & 0xF) * 8 + 12; + y = (location >> 4) * 8 + 4; + namePointer = gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + } + else + { + gb.BufferLocation = 0x71382; + while (true) + { + if (gb.ReadByte() > map) + { + byte location = gb.ReadByte(); + x = (location & 0xF) * 8 + 12; + y = (location >> 4) * 8 + 4; + namePointer = gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + break; + } + else + gb.BufferLocation += 3; + } + } + g.DrawImage(townMapMarker, x, y); + pTownMap.Image = b; + + //Read the name + gb.BufferLocation = 0x70000 + namePointer; + byte by; + string text = ""; + while ((by = gb.ReadByte()) != 0x50) + { + text = text + TextTable.GetString(by); + } + lblName.Text = "Map Name: " + text; + } + + private void nMap_ValueChanged(object sender, EventArgs e) + { + nTownMap_ValueChanged(nMap, null); + if (!LoadMap((int)nMap.Value)) + { + groupBox2.Enabled = false; + tabControl1.Enabled = false; + pMap.Image = pTileset.Image = pTile.Image = null; + lblMapHeader.Text = ""; + this.BeginInvoke(new MethodInvoker(ShowMapError)); + } + } + + private void ShowMapError() + { + MessageBox.Show("Error loading map or tileset. Probably a map that isn't actually a map.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + public bool LoadMap(int map) + { + try + { + if (nMap.Value != map) + nMap.Value = map; + lastClick = new Point(-1, -1); + mapLoader.LoadMapHeader(map); + mapLoader.LoadLevelData(); + wildPokemonLoader.LoadWildPokemon(map); + + lblMapHeader.Text = "Header Location: 0x" + mapLoader.mapHeader.Location.ToString("X") + + "\nTileset: " + mapLoader.mapHeader.Tileset + + "\nWidth: " + mapLoader.mapHeader.Width + + "\nHeight: " + mapLoader.mapHeader.Height + + "\nLevel Data: 0x" + mapLoader.mapHeader.LevelData.ToString("X") + + "\nEvent Data: 0x" + mapLoader.mapHeader.EventData.ToString("X"); + lblWildPokemon.Text = "Wild Pokemon: " + (wildPokemonLoader.rarityGrass > 0 ? "Grass" + (wildPokemonLoader.rarityWater > 0 ? "/Water" : "") : (wildPokemonLoader.rarityWater > 0 ? "Water" : "None")); + + tbGrass.Value = wildPokemonLoader.rarityGrass; + lblGrassEncounter.Text = "Encounter Frequency: " + tbGrass.Value + "/255"; + if (wildPokemonLoader.rarityGrass > 0) + { + grpGrass.Visible = true; + pnlGrass.Visible = false; + lstGrass.Items.Clear(); + foreach (Pokemon p in wildPokemonLoader.grassPokemon) + { + lstGrass.Items.Add(wildPokemonLoader.PokemonNames[wildPokemonLoader.PokemonIndicies[p.id - 1]].Substring(4) + " - " + p.level.ToString()); + } + if (lstGrass.SelectedIndex == 0) + lstGrass_SelectedIndexChanged(null, null); + else + lstGrass.SelectedIndex = 0; + } + else + { + pnlGrass.Visible = true; + grpGrass.Visible = false; + } + + tbWater.Value = wildPokemonLoader.rarityWater; + lblWaterEncounter.Text = "Encounter Frequency: " + tbWater.Value + "/255"; + if (wildPokemonLoader.rarityWater > 0) + { + grpWater.Visible = true; + pnlWater.Visible = false; + lstWater.Items.Clear(); + foreach (Pokemon p in wildPokemonLoader.waterPokemon) + { + lstWater.Items.Add(wildPokemonLoader.PokemonNames[wildPokemonLoader.PokemonIndicies[p.id - 1]].Substring(4) + " - " + p.level.ToString()); + } + if (lstWater.SelectedIndex == 0) + lstWater_SelectedIndexChanged(null, null); + else + lstWater.SelectedIndex = 0; + } + else + { + pnlWater.Visible = true; + grpWater.Visible = false; + } + + if (cachedTilesets[mapLoader.mapHeader.Tileset] == null) + { + cachedTilesets[mapLoader.mapHeader.Tileset] = tilesetLoader.LoadTileset(mapLoader.mapHeader.Tileset); + } + pTileset.Image = cachedTilesets[mapLoader.mapHeader.Tileset]; + UpdateSelectedTile(); + DrawMap(); + + ResetSelects(); + pnlPerson.Visible = false; + pnlWarp.Visible = false; + pnlSign.Visible = false; + pnlWarpTo.Visible = false; + nSelectedPerson.Maximum = mapLoader.people.Count - 1; + nSelectedWarp.Maximum = mapLoader.warps.Count - 1; + nSelectedSign.Maximum = mapLoader.signs.Count - 1; + nSelectedWarpTo.Maximum = mapLoader.warpTo.Count - 1; + + pEventMap.Image = pMap.Image; + if (tabControl1.SelectedIndex == 0) + pEventMap.Invalidate(); + + BleControls(true); + return true; + } + catch (Exception) + { + return false; + } + } + + private void Form1_Load(object sender, EventArgs e) + { + panel4.VerticalScroll.SmallChange = 32; + panel4.VerticalScroll.LargeChange = 128; + } + + private void UpdateSelectedTile() + { + Bitmap b = new Bitmap(32, 32); + for (int y = 0; y < 32; y++) + for (int x = 0; x < 32; x++) + b.SetPixel(x, y, cachedTilesets[mapLoader.mapHeader.Tileset].GetPixel(x, selectedTile * 32 + y)); + pTile.Image = b; + pTileset.Invalidate(); + } + + private void pTileset_MouseDown(object sender, MouseEventArgs e) + { + selectedTile = e.Y / 32; + UpdateSelectedTile(); + pTileset.Invalidate(); + } + + private void pTileset_Paint(object sender, PaintEventArgs e) + { + if (pTileset.Image != null) + e.Graphics.DrawRectangle(Pens.Red, 0, selectedTile * 32, 31, 31); + } + + private void DrawMap() + { + Bitmap b = new Bitmap(mapLoader.mapHeader.Width * 32, mapLoader.mapHeader.Height * 32); + FastPixel fp = new FastPixel(b); + fp.rgbValues = new byte[b.Width * b.Height * 4]; + fp.Lock(); + FastPixel source = new FastPixel(cachedTilesets[mapLoader.mapHeader.Tileset]); + source.rgbValues = new byte[source.Width * source.Height * 4]; + source.Lock(); + for (int ytile = 0; ytile < mapLoader.mapHeader.Height; ytile++) + { + for (int xtile = 0; xtile < mapLoader.mapHeader.Width; xtile++) + { + for (int y = 0; y < 32; y++) + { + for (int x = 0; x < 32; x++) + { + fp.SetPixel(xtile * 32 + x, ytile * 32 + y, source.GetPixel(x, mapLoader.LevelData[xtile, ytile] * 32 + y)); + } + } + } + } + source.Unlock(false); + fp.Unlock(true); + pMap.Image = b; + } + + private void DrawEvents(Graphics g) + { + foreach (WarpTo w in mapLoader.warpTo) + { + eventRectangle.X = w.x * 16; + eventRectangle.Y = w.y * 16; + g.DrawImage(ClassicMap.Properties.Resources.trigger, eventRectangle, 0, 0, 16, 16, GraphicsUnit.Pixel, eventTTransparency); + } + + foreach (Warp w in mapLoader.warps) + { + eventRectangle.X = w.x * 16; + eventRectangle.Y = w.y * 16; + g.DrawImage(ClassicMap.Properties.Resources.warp, eventRectangle, 0, 0, 16, 16, GraphicsUnit.Pixel, eventTransparency); + } + + foreach (Sign s in mapLoader.signs) + { + eventRectangle.X = s.x * 16; + eventRectangle.Y = s.y * 16; + g.DrawImage(ClassicMap.Properties.Resources.sign, eventRectangle, 0, 0, 16, 16, GraphicsUnit.Pixel, eventTransparency); + } + + foreach (Person p in mapLoader.people) + { + eventRectangle.X = p.x * 16 - 64; + eventRectangle.Y = p.y * 16 - 64; + if (!spriteImagesToolStripMenuItem.Checked) + g.DrawImage(ClassicMap.Properties.Resources.person, eventRectangle, 0, 0, 16, 16, GraphicsUnit.Pixel, eventTransparency); + else + g.DrawImage(spriteLoader.LoadSprite(p.sprite), p.x * 16 - 64, p.y * 16 - 64); + } + + if (selectedPerson != -1 && selectedPerson < mapLoader.people.Count) + g.DrawRectangle(Pens.Red, mapLoader.people[selectedPerson].x * 16 - 64, mapLoader.people[selectedPerson].y * 16 - 64, 16, 16); + else if (selectedWarp != -1 && selectedWarp < mapLoader.warps.Count) + g.DrawRectangle(Pens.Red, mapLoader.warps[selectedWarp].x * 16, mapLoader.warps[selectedWarp].y * 16, 16, 16); + else if (selectedSign != -1 && selectedSign < mapLoader.signs.Count) + g.DrawRectangle(Pens.Red, mapLoader.signs[selectedSign].x * 16, mapLoader.signs[selectedSign].y * 16, 16, 16); + else if (selectedWarpTo != -1 && selectedWarpTo < mapLoader.warpTo.Count) + g.DrawRectangle(Pens.Red, mapLoader.warpTo[selectedWarpTo].x * 16, mapLoader.warpTo[selectedWarpTo].y * 16, 16, 16); + } + + private void Form1_Resize(object sender, EventArgs e) + { + tabControl1.Width = this.Width - 212; + tabControl1.Height = this.Height - 79; + panel4.Height = tabControl1.Height - 95; + pTile.Top = panel4.Top + panel4.Height + 15; + groupBox2.Height = this.Height - 346; + } + + private void pMap_MouseDown(object sender, MouseEventArgs e) + { + panel2.Focus(); + if (e.Button == MouseButtons.Left) + { + if (e.X < 0 || e.Y < 0 || e.X / 32 >= mapLoader.mapHeader.Width || e.Y / 32 >= mapLoader.mapHeader.Height) + return; + mapLoader.LevelData[e.X / 32, e.Y / 32] = (byte)selectedTile; + Graphics g = Graphics.FromImage(pMap.Image); + g.DrawImage(pTile.Image, e.X / 32 * 32, e.Y / 32 * 32); + pMap.Invalidate(new Rectangle(e.X / 32 * 32, e.Y / 32 * 32, 32, 32)); + } + else if (e.Button == MouseButtons.Right) + { + selectedTile = mapLoader.LevelData[e.X / 32, e.Y / 32]; + panel4.VerticalScroll.Value = selectedTile * 32 + (selectedTile > 0 ? 2 : 0); + panel4.VerticalScroll.Value = selectedTile * 32 + (selectedTile > 0 ? 2 : 0); + UpdateSelectedTile(); + pTileset.Invalidate(); + } + } + + private void pMap_MouseMove(object sender, MouseEventArgs e) + { + SetPositionLabel(e.X, e.Y); + if (e.Button == MouseButtons.Left) + { + int x = e.X / 32 * 32; + int y = e.Y / 32 * 32; + if (x == lastClick.X && y == lastClick.Y) + return; + lastClick = new Point(x, y); + if (x < 0 || x / 32 >= mapLoader.mapHeader.Width || y < 0 || y / 32 >= mapLoader.mapHeader.Height) + return; + mapLoader.LevelData[x / 32, y / 32] = (byte)selectedTile; + Graphics g = Graphics.FromImage(pMap.Image); + g.DrawImage(pTile.Image, x, y); + pMap.Invalidate(new Rectangle(e.X / 32 * 32, e.Y / 32 * 32, 32, 32)); + } + } + + private void SetPositionLabel(int x, int y) + { + lblPosition.Text = "X: " + (x / 32).ToString() + " Y: " + (y / 32).ToString(); + } + + private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) + { + lastClick = new Point(-1, -1); + if (tabControl1.SelectedIndex == 1) + pEventMap.Image = pMap.Image; + } + + private void pEventMap_MouseMove(object sender, MouseEventArgs e) + { + SetPositionLabel(e.X * 2, e.Y * 2); + if (e.Button != MouseButtons.Left) + return; + if (e.X / 16 == lastClick.X && e.Y / 16 == lastClick.Y) + return; + lastClick = new Point(e.X / 16, e.Y / 16); + //Okay. So here we do Event x = mapLoader.eventGroup[selectedX]; + //However, when I wrote this the events were structures, not classes. + //Because of this, variable could not be directly modified. This was changed later on. + if (selectedPerson != -1) + { + Person p = mapLoader.people[selectedPerson]; + p.x = (byte)(4 + e.X / 16); + p.y = (byte)(4 + e.Y / 16); + mapLoader.people[selectedPerson] = p; + pEventMap.Invalidate(); + } + else if (selectedWarp != -1) + { + Warp w = mapLoader.warps[selectedWarp]; + w.x = (byte)(e.X / 16); + w.y = (byte)(e.Y / 16); + mapLoader.warps[selectedWarp] = w; + pEventMap.Invalidate(); + } + else if (selectedSign != -1) + { + Sign s = mapLoader.signs[selectedSign]; + s.x = (byte)(e.X / 16); + s.y = (byte)(e.Y / 16); + mapLoader.signs[selectedSign] = s; + pEventMap.Invalidate(); + } + else if (selectedWarpTo != -1) + { + WarpTo w = mapLoader.warpTo[selectedWarpTo]; + w.x = (byte)(e.X / 16); + w.y = (byte)(e.Y / 16); + mapLoader.warpTo[selectedWarpTo] = w; + pEventMap.Invalidate(); + } + } + + private void pEventMap_Paint(object sender, PaintEventArgs e) + { + DrawEvents(e.Graphics); + } + + private void ResetSelects() + { + selectedPerson = -1; + selectedSign = -1; + selectedWarp = -1; + selectedWarpTo = -1; + } + + private void pEventMap_MouseDown(object sender, MouseEventArgs e) + { + if (e.Button != MouseButtons.Left && e.Button != MouseButtons.Right) + return; + + panel1.Focus(); + ResetSelects(); + + if ((selectedPerson = GetPersonIndex(e.X, e.Y)) != -1) + { + SelectPerson(); + } + else if ((selectedWarp = GetWarpIndex(e.X, e.Y)) != -1) + { + SelectWarp(); + } + else if ((selectedSign = GetSignIndex(e.X, e.Y)) != -1) + { + SelectSign(); + } + else if ((selectedWarpTo = GetWarpToIndex(e.X, e.Y)) != -1) + { + SelectWarpTo(); + } + else + { + pnlPerson.Visible = false; + } + + pEventMap.Invalidate(); + } + + private void SelectPerson() + { + pnlPerson.Visible = true; + pnlWarp.Visible = false; + pnlSign.Visible = false; + pnlWarpTo.Visible = false; + nSelectedPerson.Value = selectedPerson; + nPersonPicture.Value = mapLoader.people[selectedPerson].sprite; + nPersonMovement1.Value = mapLoader.people[selectedPerson].movement; + nPersonMovement2.Value = mapLoader.people[selectedPerson].movement2; + nPersonPicture.Value = mapLoader.people[selectedPerson].sprite; + nPersonText.Value = (mapLoader.people[selectedPerson].text & 0x3F); + if ((mapLoader.people[selectedPerson].originalText & 0x40) != 0) + { + lblPersonItem.Enabled = false; + nPersonItem.Enabled = false; + lblPersonTrainer.Enabled = true; + nPersonTrainer.Enabled = true; + lblPersonPokemonSet.Enabled = true; + nPersonPokemonSet.Enabled = true; + nPersonTrainer.Value = mapLoader.people[selectedPerson].trainer; + nPersonPokemonSet.Value = mapLoader.people[selectedPerson].pokemonSet; + } + else if ((mapLoader.people[selectedPerson].originalText & 0x80) != 0) + { + lblPersonItem.Enabled = true; + nPersonItem.Enabled = true; + lblPersonTrainer.Enabled = false; + nPersonTrainer.Enabled = false; + lblPersonPokemonSet.Enabled = false; + nPersonPokemonSet.Enabled = false; + nPersonItem.Value = mapLoader.people[selectedPerson].item; + } + else + { + lblPersonItem.Enabled = false; + nPersonItem.Enabled = false; + lblPersonTrainer.Enabled = false; + nPersonTrainer.Enabled = false; + lblPersonPokemonSet.Enabled = false; + nPersonPokemonSet.Enabled = false; + } + } + + public void SelectWarp() + { + pnlWarp.Visible = true; + pnlPerson.Visible = false; + pnlSign.Visible = false; + pnlWarpTo.Visible = false; + nSelectedWarp.Value = selectedWarp; + nWarpDest.Value = mapLoader.warps[selectedWarp].destPoint; + nWarpMap.Value = mapLoader.warps[selectedWarp].map; + } + + public void SelectSign() + { + pnlSign.Visible = false; + pnlPerson.Visible = false; + pnlSign.Visible = true; + pnlWarpTo.Visible = false; + nSelectedSign.Value = selectedSign; + nSignText.Value = mapLoader.signs[selectedSign].text; + } + + public void SelectWarpTo() + { + pnlWarp.Visible = false; + pnlPerson.Visible = false; + pnlSign.Visible = false; + pnlWarpTo.Visible = true; + nSelectedWarpTo.Value = selectedWarpTo; + nWarpToEvent.Value = mapLoader.warpTo[selectedWarpTo].address; + } + + private int GetPersonIndex(int x, int y) + { + for (int i = mapLoader.people.Count - 1; i > -1; i--) + { + if (mapLoader.people[i].x - 4 == x / 16 && mapLoader.people[i].y - 4 == y / 16) + return i; + } + + return -1; + } + + private int GetWarpIndex(int x, int y) + { + for (int i = mapLoader.warps.Count - 1; i > -1; i--) + { + if (mapLoader.warps[i].x == x / 16 && mapLoader.warps[i].y == y / 16) + return i; + } + + return -1; + } + + private int GetSignIndex(int x, int y) + { + for (int i = mapLoader.signs.Count - 1; i > -1; i--) + { + if (mapLoader.signs[i].x == x / 16 && mapLoader.signs[i].y == y / 16) + return i; + } + + return -1; + } + + private int GetWarpToIndex(int x, int y) + { + for (int i = mapLoader.warpTo.Count - 1; i > -1; i--) + { + if (mapLoader.warpTo[i].x == x / 16 && mapLoader.warpTo[i].y == y / 16) + return i; + } + + return -1; + } + + private void button1_Click(object sender, EventArgs e) + { + int warp = (int)nWarpDest.Value; + if (!LoadMap((int)nWarpMap.Value)) + { + ShowMapError(); + return; + } + + if (warp < mapLoader.warpTo.Count) + { + selectedWarpTo = warp; + SelectWarpTo(); + } + else + MessageBox.Show("Destination point out of range.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + private void button2_Click(object sender, EventArgs e) + { + //Okay, this had me stumped for a few minutes. + //On the Pokemon Red notes, a basic formula was provided with very little detail. + //It turns out the x/y had to be their even numbers (block they were on). + //That wasn't specified so it threw me off. + //However, this works, as the original address was calculated successfully with all tests. + int address = 0xC6EF; + address += mapLoader.mapHeader.Width; + address += (mapLoader.mapHeader.Width + 6) * ((mapLoader.warpTo[selectedWarpTo].y / 2) * 2 / 2); + address += mapLoader.warpTo[selectedWarpTo].x / 2 * 2 / 2; + nWarpToEvent.Value = address; + } + + private void pEventMap_MouseUp(object sender, MouseEventArgs e) + { + lastClick = new Point(-1, -1); + } + + private void pMap_MouseUp(object sender, MouseEventArgs e) + { + lastClick = new Point(-1, -1); + } + + private void nWarpToEvent_ValueChanged(object sender, EventArgs e) + { + mapLoader.warpTo[selectedWarpTo].address = (int)nWarpToEvent.Value; + } + + private void nWarpDest_ValueChanged(object sender, EventArgs e) + { + mapLoader.warps[selectedWarp].destPoint = (byte)nWarpDest.Value; + } + + private void nWarpMap_ValueChanged(object sender, EventArgs e) + { + mapLoader.warps[selectedWarp].map = (byte)nWarpMap.Value; + } + + private void nPersonPicture_ValueChanged(object sender, EventArgs e) + { + mapLoader.people[selectedPerson].sprite = (byte)nPersonPicture.Value; + pEventMap.Invalidate(); + } + + private void nPersonMovement1_ValueChanged(object sender, EventArgs e) + { + mapLoader.people[selectedPerson].movement = (byte)nPersonMovement1.Value; + } + + private void nPersonMovement2_ValueChanged(object sender, EventArgs e) + { + mapLoader.people[selectedPerson].movement2 = (byte)nPersonMovement2.Value; + } + + private void nPersonText_ValueChanged(object sender, EventArgs e) + { + mapLoader.people[selectedPerson].text = (byte)nPersonText.Value; + } + + private void nPersonTrainer_ValueChanged(object sender, EventArgs e) + { + mapLoader.people[selectedPerson].trainer = (byte)nPersonTrainer.Value; + } + + private void nPersonPokemonSet_ValueChanged(object sender, EventArgs e) + { + mapLoader.people[selectedPerson].pokemonSet = (byte)nPersonPokemonSet.Value; + } + + private void nPersonItem_ValueChanged(object sender, EventArgs e) + { + mapLoader.people[selectedPerson].item = (byte)nPersonItem.Value; + } + + private void nSelectedPerson_ValueChanged(object sender, EventArgs e) + { + if (nSelectedPerson.Maximum == -1) + return; + selectedPerson = (int)nSelectedPerson.Value; + SelectPerson(); + pEventMap.Invalidate(); + } + + private void nSelectedSign_ValueChanged(object sender, EventArgs e) + { + if (nSelectedSign.Maximum == -1) + return; + selectedSign = (int)nSelectedSign.Value; + SelectSign(); + pEventMap.Invalidate(); + } + + private void nSignText_ValueChanged(object sender, EventArgs e) + { + mapLoader.signs[selectedSign].text = (byte)nSignText.Value; + } + + private void nSelectedWarpTo_ValueChanged(object sender, EventArgs e) + { + if (nSelectedWarpTo.Maximum == -1) + return; + selectedWarpTo = (int)nSelectedWarpTo.Value; + SelectWarpTo(); + pEventMap.Invalidate(); + } + + private void nSelectedWarp_ValueChanged(object sender, EventArgs e) + { + if (nSelectedWarp.Maximum == -1) + return; + selectedWarp = (int)nSelectedWarp.Value; + SelectWarp(); + pEventMap.Invalidate(); + } + + private void saveROMToolStripMenuItem_Click(object sender, EventArgs e) + { + if (romLocation == "") + return; + MapSaver mapSaver = new MapSaver(gb, mapLoader, wildPokemonLoader); + mapSaver.Save((int)nMap.Value); + BinaryWriter bw = new BinaryWriter(File.Open(romLocation, FileMode.Open)); + bw.Write(gb.Buffer); + bw.Close(); + } + + private void romWatcher_Changed(object sender, FileSystemEventArgs e) + { + if (e.FullPath != romLocation) + return; + FileInfo f = new FileInfo(romLocation); + if (!f.IsReadOnly) + saveROMToolStripMenuItem.Enabled = true; + else + { + MessageBox.Show("Warning! ROM has been changed to read-only. You cannot save until it is writable.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + saveROMToolStripMenuItem.Enabled = false; + } + } + + private void lstGrass_SelectedIndexChanged(object sender, EventArgs e) + { + if (!triggerPokemonEvents) + return; + if (lstGrass.SelectedIndex == -1 && grpGrass.Visible) + lstGrass.SelectedIndex = 0; + nGrassLevel.Value = wildPokemonLoader.grassPokemon[lstGrass.SelectedIndex].level; + cboGrassPokemon.SelectedIndex = wildPokemonLoader.PokemonIndicies[wildPokemonLoader.grassPokemon[lstGrass.SelectedIndex].id - 1]; + } + + private void lstWater_SelectedIndexChanged(object sender, EventArgs e) + { + if (!triggerPokemonEvents) + return; + if (lstWater.SelectedIndex == -1 && grpWater.Visible) + lstWater.SelectedIndex = 0; + nWaterLevel.Value = wildPokemonLoader.waterPokemon[lstWater.SelectedIndex].level; + cboWaterPokemon.SelectedIndex = wildPokemonLoader.PokemonIndicies[wildPokemonLoader.waterPokemon[lstWater.SelectedIndex].id - 1]; + } + + private void cboGrassPokemon_SelectedIndexChanged(object sender, EventArgs e) + { + string s = cboGrassPokemon.SelectedItem.ToString().Substring(4) + " - " + (int)nGrassLevel.Value; + if ((string)lstGrass.Text == s) + return; + triggerPokemonEvents = false; + int id = int.Parse(cboGrassPokemon.SelectedItem.ToString().Substring(0, 2), System.Globalization.NumberStyles.HexNumber); + wildPokemonLoader.grassPokemon[lstGrass.SelectedIndex].id = (byte)(id + 1); + lstGrass.Items[lstGrass.SelectedIndex] = s; + triggerPokemonEvents = true; + } + + private void nGrassLevel_ValueChanged(object sender, EventArgs e) + { + if (cboGrassPokemon.SelectedItem == null) + return; + string s = cboGrassPokemon.SelectedItem.ToString().Substring(4) + " - " + (int)nGrassLevel.Value; + if ((string)lstGrass.Text == s) + return; + triggerPokemonEvents = false; + wildPokemonLoader.grassPokemon[lstGrass.SelectedIndex].level = (byte)nGrassLevel.Value; + lstGrass.Items[lstGrass.SelectedIndex] = s; + triggerPokemonEvents = true; + } + + private void tbGrass_Scroll(object sender, EventArgs e) + { + lblGrassEncounter.Text = "Encounter Frequency: " + tbGrass.Value + "/255"; + wildPokemonLoader.rarityGrass = (byte)tbGrass.Value; + } + + private void tbWater_Scroll(object sender, EventArgs e) + { + lblWaterEncounter.Text = "Encounter Frequency: " + tbWater.Value + "/255"; + wildPokemonLoader.rarityWater = (byte)tbWater.Value; + } + + private void cboWaterPokemon_SelectedIndexChanged(object sender, EventArgs e) + { + string s = cboWaterPokemon.SelectedItem.ToString().Substring(4) + " - " + (int)nWaterLevel.Value; + if ((string)lstWater.Text == s) + return; + triggerPokemonEvents = false; + int id = int.Parse(cboWaterPokemon.SelectedItem.ToString().Substring(0, 2), System.Globalization.NumberStyles.HexNumber); + wildPokemonLoader.waterPokemon[lstWater.SelectedIndex].id = (byte)(id + 1); + lstWater.Items[lstWater.SelectedIndex] = s; + triggerPokemonEvents = true; + } + + private void nWaterLevel_ValueChanged(object sender, EventArgs e) + { + if (cboWaterPokemon.SelectedItem == null) + return; + string s = cboWaterPokemon.SelectedItem.ToString().Substring(4) + " - " + (int)nWaterLevel.Value; + if ((string)lstWater.Text == s) + return; + triggerPokemonEvents = false; + wildPokemonLoader.waterPokemon[lstWater.SelectedIndex].level = (byte)nWaterLevel.Value; + lstWater.Items[lstWater.SelectedIndex] = s; + triggerPokemonEvents = true; + } + + private void spriteImagesToolStripMenuItem_Click(object sender, EventArgs e) + { + if (tabControl1.SelectedIndex == 1 && tabControl1.Enabled) + pEventMap.Invalidate(); + } + } +} diff --git a/ClassicMap/Form1.resx b/ClassicMap/Form1.resx new file mode 100644 index 0000000..9ee3dad --- /dev/null +++ b/ClassicMap/Form1.resx @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALBQAA + CwUByY3ISQAAAjRJREFUOE+Fk19IU3EUx9eDcxiMkdmKohWkPjbBCBlMwx6EWkmDiLKndPSSmQ/ZluFa + s8CwhwqjDMpBj5ZzlQRpshFFZdof0sVihkrSIotade+2++13fte7bneLLnw453d+5/vl/O793SUAdNpn + aas+zmrrDIUFOnOJSfd+NjHB1ieT58SBnGYyyEfRkQIrw7v+dAnaXu5AVe8GsPU1bW9esbqJiWpIfGZ6 + DyouWsikXr3/XwNqZqIHHVEn2ifrsexYUTzHYKS70MGABofSSEdpDNfAE92Jih4+hVXZ0yliSZIA6UYW + tVljhx4NIza0vKrDtuBGMvCqDcDFqeuQFMQ+BCdaqBGWzmKUdpmxb9QG19gWOIc3YU2nCcajBtofpwkg + JXsh/bjCyfBcXgciB2DxF+Pgs1o0MXHDYxuckUpUD5RzMcMkG3y5gAzj4aUV2vcAj0+P1T4Tdoc3Y1e4 + EvZb5bAeNyB0Vn5n3CD9sQvfYm2I9CxHZoHMznNDgswDo/th9hqZuAxlJ4yY/zSI5MKQymDGh9hQLaZu + 25FOdGfJsJygWmB4L1a5jQj1V0P4eRfTTw79MUi9c+PR5ZX4PO5CavYUw480izJyTvX0nB9v79VB+B5S + jurgRxDftPJCKub+Bx6IbI+I3tkK4etN3s//I0o+3N+Op1fXQnx9mCPw2LwY5Zpcb0Y0aEdi0v+3wYu+ + UsQH7RDGXIs0sSjzSx2fuzDVX5UdX5kg3zXO+Zzaq67cxN/E55FzvSfetAAAAABJRU5ErkJggg== + + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALDgAA + Cw4BQL7hQQAAAU1JREFUOE/Vkz9Lw1AUxfWLVOlmpn4DB0uHruKkoUWbpAUdmknwG7gICgr+QZc2SBBB + 0L1Fiy0JLRabOMT8TxQU50zHvGBdTIjUyQeHt5z7e+e+y50GMPWnQwDzCwdsKARBkCriI35SFz3+BQDH + SqnF5AHiI5BEgCzLSNKvAGlt/IMEE7ewuHSDza02jk+GaAgKmoKKRlPF6ZkS6hHCuQJRVJOnsLYqo1y+ + B8d1wfMS6nwPtVoHlcot1jeksLAHmr4Dw8jxY2SYAVaWW/C8D7juO/RnF7pmwDJ02KaBh8EIFLWPYvEq + GUDTLTjOG6i53Ui6puPFM+G7BDBEJrONfF6MB7BhglKpDct6/QbYphUCLDiWhr7URza7g0LhIh5QrY7C + P+hE0ccJfN+BZxsw9CdIXQkzswRwGQuIlono6PA6UbncXuT5sUzjxZjk/gS/KNRyAFcG5wAAAABJRU5E + rkJggg== + + + + 126, 17 + + + 236, 17 + + \ No newline at end of file diff --git a/ClassicMap/MapEvents.cs b/ClassicMap/MapEvents.cs new file mode 100644 index 0000000..3e3af67 --- /dev/null +++ b/ClassicMap/MapEvents.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ClassicMap +{ + public class Person + { + public byte sprite; + public byte y; + public byte x; + public byte movement; + public byte movement2; + public byte text; + public byte originalText; + public byte trainer; + public byte pokemonSet; + public byte item; + } + + public class Warp + { + public byte y; + public byte x; + public byte destPoint; + public byte map; + } + + public class Sign + { + public byte y; + public byte x; + public byte text; + } + + public class WarpTo + { + public int address; + public byte y; + public byte x; + } +} diff --git a/ClassicMap/MapLoader.cs b/ClassicMap/MapLoader.cs new file mode 100644 index 0000000..453bd63 --- /dev/null +++ b/ClassicMap/MapLoader.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GBHL; + +namespace ClassicMap +{ + public struct MapHeader + { + public int Location; + public byte Tileset; + public byte Width; + public byte Height; + public int LevelData; + public int EventData; + } + + public class MapLoader + { + private GBFile gb; + public MapHeader mapHeader; + public byte[,] LevelData; + public byte borderTile; + public List warps; + public List signs; + public List people; + public List warpTo; + + public MapLoader(GBFile g) + { + gb = g; + } + + public void LoadMapHeader(int map) + { + mapHeader = new MapHeader(); + + gb.BufferLocation = 0xC23D + map; + byte bank = gb.ReadByte(); + + gb.BufferLocation = 0x01AE + map * 2; + mapHeader.Location = bank * 0x4000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + + gb.BufferLocation = mapHeader.Location; + mapHeader.Tileset = gb.ReadByte(); + mapHeader.Height = gb.ReadByte(); + mapHeader.Width = gb.ReadByte(); + mapHeader.LevelData = bank * 0x4000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + gb.ReadWord(); + gb.ReadWord(); + LoadConnections(); + mapHeader.EventData = bank * 0x4000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + LoadEvents(); + } + + public void LoadLevelData() + { + gb.BufferLocation = mapHeader.LevelData; + LevelData = new byte[mapHeader.Width, mapHeader.Height]; + for (int y = 0; y < mapHeader.Height; y++) + { + for (int x = 0; x < mapHeader.Width; x++) + { + LevelData[x, y] = gb.ReadByte(); + } + } + } + + public void LoadConnections() + { + byte connection = gb.ReadByte(); + if ((connection & (1 << 3)) != 0) + gb.BufferLocation += 11; + if ((connection & (1 << 2)) != 0) + gb.BufferLocation += 11; + if ((connection & (1 << 1)) != 0) + gb.BufferLocation += 11; + if ((connection & (1 << 0)) != 0) + gb.BufferLocation += 11; + } + + public void LoadEvents() + { + gb.BufferLocation = mapHeader.EventData; + borderTile = gb.ReadByte(); + + warps = new List(); + byte warpCount = gb.ReadByte(); + for (int i = 0; i < warpCount; i++) + { + Warp w = new Warp(); + w.y = gb.ReadByte(); + w.x = gb.ReadByte(); + w.destPoint = gb.ReadByte(); + w.map = gb.ReadByte(); + warps.Add(w); + } + + signs = new List(); + byte signCount = gb.ReadByte(); + for (int i = 0; i < signCount; i++) + { + Sign s = new Sign(); + s.y = gb.ReadByte(); + s.x = gb.ReadByte(); + s.text = gb.ReadByte(); + signs.Add(s); + } + + people = new List(); + byte personCount = gb.ReadByte(); + for (int i = 0; i < personCount; i++) + { + Person p = new Person(); + p.sprite = gb.ReadByte(); + p.y = gb.ReadByte(); + p.x = gb.ReadByte(); + p.movement = gb.ReadByte(); + p.movement2 = gb.ReadByte(); + p.text = gb.ReadByte(); + p.originalText = p.text; + if ((p.text & 0x40) != 0) + { + p.trainer = gb.ReadByte(); + p.pokemonSet = gb.ReadByte(); + } + else if ((p.text & 0x80) != 0) + { + p.item = gb.ReadByte(); + } + people.Add(p); + } + + warpTo = new List(); + for (int i = 0; i < warpCount; i++) + { + WarpTo w = new WarpTo(); + w.address = gb.ReadByte() + gb.ReadByte() * 0x100; + w.y = gb.ReadByte(); + w.x = gb.ReadByte(); + warpTo.Add(w); + } + } + } +} diff --git a/ClassicMap/MapSaver.cs b/ClassicMap/MapSaver.cs new file mode 100644 index 0000000..74f6aa3 --- /dev/null +++ b/ClassicMap/MapSaver.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GBHL; + +namespace ClassicMap +{ + public class MapSaver + { + private GBFile gb; + private MapLoader mapLoader; + private WildPokemonLoader wildPokemonLoader; + public MapSaver(GBFile g, MapLoader ml, WildPokemonLoader wpl) + { + gb = g; + mapLoader = ml; + wildPokemonLoader = wpl; + } + + public void Save(int map) + { + //Save the map header + gb.BufferLocation = 0xC23D + map; + gb.WriteByte((byte)(mapLoader.mapHeader.Location / 0x4000)); + + gb.BufferLocation = 0x01AE + map * 2; + gb.WriteByte((byte)mapLoader.mapHeader.Location); + gb.WriteByte((byte)((((mapLoader.mapHeader.Location % 0x4000) >> 8) & 0xFF) + 0x40)); + + gb.BufferLocation = mapLoader.mapHeader.Location; + gb.WriteByte(mapLoader.mapHeader.Tileset); + gb.WriteByte(mapLoader.mapHeader.Height); + gb.WriteByte(mapLoader.mapHeader.Width); + + gb.WriteByte((byte)mapLoader.mapHeader.LevelData); + gb.WriteByte((byte)((((mapLoader.mapHeader.LevelData % 0x4000) >> 8) & 0xFF) + 0x40)); + + gb.BufferLocation += 4; + //Skip connections for now + byte connection = gb.ReadByte(); + if ((connection & (1 << 3)) != 0) + gb.BufferLocation += 11; + if ((connection & (1 << 2)) != 0) + gb.BufferLocation += 11; + if ((connection & (1 << 1)) != 0) + gb.BufferLocation += 11; + if ((connection & (1 << 0)) != 0) + gb.BufferLocation += 11; + + gb.WriteByte((byte)mapLoader.mapHeader.EventData); + gb.WriteByte((byte)((((mapLoader.mapHeader.EventData % 0x4000) >> 8) & 0xFF) + 0x40)); + + //Save the level data + gb.BufferLocation = mapLoader.mapHeader.LevelData; + for (int y = 0; y < mapLoader.mapHeader.Height; y++) + { + for (int x = 0; x < mapLoader.mapHeader.Width; x++) + { + gb.WriteByte(mapLoader.LevelData[x, y]); + } + } + + //Save the event data. Oh boy... + gb.BufferLocation = mapLoader.mapHeader.EventData; + gb.WriteByte(mapLoader.borderTile); + + gb.WriteByte((byte)mapLoader.warps.Count); + foreach (Warp w in mapLoader.warps) + { + gb.WriteByte(w.y); + gb.WriteByte(w.x); + gb.WriteByte(w.destPoint); + gb.WriteByte(w.map); + } + gb.WriteByte((byte)mapLoader.signs.Count); + foreach (Sign s in mapLoader.signs) + { + gb.WriteByte(s.y); + gb.WriteByte(s.x); + gb.WriteByte(s.text); + } + gb.WriteByte((byte)mapLoader.people.Count); + foreach (Person p in mapLoader.people) + { + gb.WriteByte(p.sprite); + //These are already formatted. + gb.WriteByte(p.y); + gb.WriteByte(p.x); + gb.WriteByte(p.movement); + gb.WriteByte(p.movement2); + gb.WriteByte((byte)((p.text & 0x3F) | (p.originalText & 0xC0))); + if ((p.originalText & 0x40) != 0) + { + gb.WriteByte(p.trainer); + gb.WriteByte(p.pokemonSet); + } + else if ((p.originalText & 0x80) != 0) + { + gb.WriteByte(p.item); + } + } + foreach (WarpTo w in mapLoader.warpTo) + { + gb.WriteByte((byte)w.address); + gb.WriteByte((byte)(w.address >> 8)); + gb.WriteByte(w.y); + gb.WriteByte(w.x); + } + + //End of header stuff! Now to save wild Pokemon... Yaaaay... + //Also, for some very, very weird reason, the foreach loop doesn't work here. + //There are only 10 pokemon per array, yet some data wasn't saving properly. + gb.BufferLocation = wildPokemonLoader.wildPokemonLocation; + gb.WriteByte(wildPokemonLoader.rarityGrass); + if (wildPokemonLoader.rarityGrass > 0) + { + for(int i = 0; i < 10; i++) + { + Pokemon p = wildPokemonLoader.grassPokemon[i]; + gb.WriteByte(p.level); + gb.WriteByte(p.id); + } + } + gb.WriteByte(wildPokemonLoader.rarityWater); + if (wildPokemonLoader.rarityWater > 0) + { + for (int i = 0; i < 10; i++) + { + Pokemon p = wildPokemonLoader.waterPokemon[i]; + gb.WriteByte(p.level); + gb.WriteByte(p.id); + } + } + + //Huh... That was a lot easier than I had expected. + } + } +} diff --git a/ClassicMap/Program.cs b/ClassicMap/Program.cs new file mode 100644 index 0000000..ee2e49f --- /dev/null +++ b/ClassicMap/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace ClassicMap +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/ClassicMap/Properties/AssemblyInfo.cs b/ClassicMap/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..781792c --- /dev/null +++ b/ClassicMap/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("ClassicMap")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Charlie")] +[assembly: AssemblyProduct("ClassicMap")] +[assembly: AssemblyCopyright("Copyright © Charlie 2010")] +[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("9209ff14-e984-40ac-a923-469a72483165")] + +// 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/ClassicMap/Properties/Resources.Designer.cs b/ClassicMap/Properties/Resources.Designer.cs new file mode 100644 index 0000000..2f08371 --- /dev/null +++ b/ClassicMap/Properties/Resources.Designer.cs @@ -0,0 +1,91 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3603 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ClassicMap.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", "2.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("ClassicMap.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; + } + } + + internal static System.Drawing.Bitmap person { + get { + object obj = ResourceManager.GetObject("person", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap sign { + get { + object obj = ResourceManager.GetObject("sign", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap trigger { + get { + object obj = ResourceManager.GetObject("trigger", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + internal static System.Drawing.Bitmap warp { + get { + object obj = ResourceManager.GetObject("warp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ClassicMap/Properties/Resources.resx b/ClassicMap/Properties/Resources.resx new file mode 100644 index 0000000..782ed65 --- /dev/null +++ b/ClassicMap/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\person.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\sign.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\trigger.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\warp.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ClassicMap/Properties/Settings.Designer.cs b/ClassicMap/Properties/Settings.Designer.cs new file mode 100644 index 0000000..4115d3e --- /dev/null +++ b/ClassicMap/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3603 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ClassicMap.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.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/ClassicMap/Properties/Settings.settings b/ClassicMap/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/ClassicMap/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ClassicMap/Resources/person.bmp b/ClassicMap/Resources/person.bmp new file mode 100644 index 0000000..36d4181 Binary files /dev/null and b/ClassicMap/Resources/person.bmp differ diff --git a/ClassicMap/Resources/sign.bmp b/ClassicMap/Resources/sign.bmp new file mode 100644 index 0000000..75c4d9a Binary files /dev/null and b/ClassicMap/Resources/sign.bmp differ diff --git a/ClassicMap/Resources/trigger.bmp b/ClassicMap/Resources/trigger.bmp new file mode 100644 index 0000000..c5b6bfd Binary files /dev/null and b/ClassicMap/Resources/trigger.bmp differ diff --git a/ClassicMap/Resources/warp.bmp b/ClassicMap/Resources/warp.bmp new file mode 100644 index 0000000..f2c538a Binary files /dev/null and b/ClassicMap/Resources/warp.bmp differ diff --git a/ClassicMap/SpriteLoader.cs b/ClassicMap/SpriteLoader.cs new file mode 100644 index 0000000..02782ab --- /dev/null +++ b/ClassicMap/SpriteLoader.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GBHL; +using System.Drawing; + +namespace ClassicMap +{ + public class SpriteLoader + { + private GBFile gb; + + public SpriteLoader(GBFile g) + { + gb = g; + } + + public int CalculateTDA(int sprite) + { + return 0x17B27 + (sprite - 1) * 4; + } + + public Bitmap LoadSprite(int sprite) + { + gb.BufferLocation = CalculateTDA(sprite); + int loc = gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + int count = gb.ReadByte(); + byte bank = gb.ReadByte(); + if (bank * 0x4000 + loc + 256 >= 0x100000) + { + return new Bitmap(16, 16); + } + + gb.BufferLocation = bank * 0x4000 + loc; + + if (gb.BufferLocation < 0) + return new Bitmap(16, 16); + + byte[, ,] tileData = new byte[32, 8, 8]; + gb.ReadTiles(16, 2, gb.BufferLocation, ref tileData); + + Bitmap b = new Bitmap(16, 16); + FastPixel fp = new FastPixel(b); + fp.rgbValues = new byte[1024]; + fp.Lock(); + for (int y = 0; y < 2; y++) + { + for (int x = 0; x < 2; x++) + { + for (int xx = 0; xx < 8; xx++) + { + for (int yy = 0; yy < 8; yy++) + { + fp.SetPixel(x * 8 + xx, y * 8 + yy, Form1.Palette[tileData[x + y * 2, xx, yy]]); + } + } + } + } + fp.Unlock(true); + + b.MakeTransparent(Form1.Palette[0]); + return b; + } + } +} diff --git a/ClassicMap/TextTable.cs b/ClassicMap/TextTable.cs new file mode 100644 index 0000000..d484129 --- /dev/null +++ b/ClassicMap/TextTable.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ClassicMap +{ + public class TextTable + { + public static string[] TextTableChars = new string[] { + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "", + " ", "*", "A1", "A2", "POKe", "+", " ", "#", "$", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", + "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", " ", " ", ":", " ", " ", " ", + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", + "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "�", " ", "'l", "'s", "'t", "'v", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", + "'", "PK", "MN", "-", "'r", "'m", "?", "!", ".", " ", " ", " ", " ", " ", " ", " ", + " ", " ", " ", " ", ",", " ", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", + }; + + public static string GetString(byte[] bytes) + { + string s = ""; + foreach (byte b in bytes) + s += TextTableChars[b]; + return s; + } + + public static string GetString(byte b) + { + return TextTableChars[b]; + } + } +} diff --git a/ClassicMap/TilesetLoader.cs b/ClassicMap/TilesetLoader.cs new file mode 100644 index 0000000..dcda5bd --- /dev/null +++ b/ClassicMap/TilesetLoader.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Drawing; +using GBHL; + +namespace ClassicMap +{ + public class TilesetLoader + { + private GBFile gb; + private byte bank; + private int formationAddress; + private int graphicsAddress; + private byte[, ,] formation; + private byte[, ,] graphics; + + public TilesetLoader(GBFile g) + { + gb = g; + } + + public void LoadTilesetHeader(int tileset) + { + gb.BufferLocation = 0xC7BE + tileset * 12; + bank = gb.ReadByte(); + formationAddress = bank * 0x4000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + graphicsAddress = bank * 0x4000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + } + + public void LoadFormation() + { + formation = new byte[256, 4, 4]; + gb.BufferLocation = formationAddress; + for (int i = 0; i < 256; i++) + { + for (int y = 0; y < 4; y++) + { + for (int x = 0; x < 4; x++) + { + formation[i, x, y] = gb.ReadByte(); + } + } + } + } + + public void LoadGraphics() + { + graphics = new byte[256, 8, 8]; + gb.ReadTiles(16, 6, graphicsAddress, ref graphics); + } + + public Bitmap LoadTileset(int tileset) + { + LoadTilesetHeader(tileset); + LoadFormation(); + LoadGraphics(); + + Bitmap b = new Bitmap(32, 8192); + FastPixel fp = new FastPixel(b); + fp.rgbValues = new byte[32 * 8192 * 4]; + fp.Lock(); + for (int i = 0; i < 256; i++) + { + for (int ytile = 0; ytile < 4; ytile++) + { + for (int xtile = 0; xtile < 4; xtile++) + { + for (int y = 0; y < 8; y++) + { + for (int x = 0; x < 8; x++) + { + fp.SetPixel(xtile * 8 + x, i * 32 + ytile * 8 + y, Form1.Palette[graphics[formation[i, xtile, ytile], x, y]]); + } + } + } + } + } + + fp.Unlock(true); + return b; + } + } +} diff --git a/ClassicMap/TownMapLoader.cs b/ClassicMap/TownMapLoader.cs new file mode 100644 index 0000000..1f507d6 --- /dev/null +++ b/ClassicMap/TownMapLoader.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GBHL; +using System.Drawing; + +namespace ClassicMap +{ + //Well, here we load the town map and stuff. + //There are 2 very weak compressions which we take care of and then create the map. + public class TownMapLoader + { + private GBFile gb; + public byte[] data; + public byte[,,] tileData; + private int tileLocation = 0x125A8; + private int markerLocation = 0x70F40; + + public TownMapLoader(GBFile g) + { + gb = g; + data = new byte[360]; + } + + public Bitmap LoadMap() + { + Bitmap b = new Bitmap(160, 144); + FastPixel fp = new FastPixel(b); + fp.rgbValues = new byte[160 * 144 * 4]; + fp.Lock(); + LoadData(); + LoadTileData(); + for (int i = 0; i < 360; i++) + { + for (int y = 0; y < 8; y++) + { + for (int x = 0; x < 8; x++) + { + fp.SetPixel((i % 20) * 8 + x, (i / 20) * 8 + y, Form1.Palette[tileData[data[i], x, y]]); + } + } + } + fp.Unlock(true); + return b; + } + + public Bitmap LoadMarker() + { + byte[] decompressed = new byte[0x40]; + gb.BufferLocation = markerLocation; + int index = 0; + for (int i = 0; i < 0x10; i++) + { + byte by = gb.ReadByte(); + decompressed[index++] = by; + decompressed[index++] = by; + by = gb.ReadByte(); + decompressed[index++] = by; + decompressed[index++] = by; + } + + byte[, ,] markerData = new byte[4, 8, 8]; + gb.ReadTiles(2, 2, decompressed, ref markerData); + + Bitmap b = new Bitmap(16, 16); + FastPixel fp = new FastPixel(b); + fp.rgbValues = new byte[1024]; + fp.Lock(); + LoadData(); + LoadTileData(); + for (int i = 0; i < 4; i++) + { + for (int y = 0; y < 8; y++) + { + for (int x = 0; x < 8; x++) + { + fp.SetPixel((i % 2) * 8 + x, (i / 2) * 8 + y, Form1.Palette[markerData[i, x, y]]); + } + } + } + fp.Unlock(true); + b.MakeTransparent(Form1.Palette[0]); + return b; + } + + public void LoadData() + { + gb.BufferLocation = 0x71100; + int index = 0; + while (true) + { + byte b = gb.ReadByte(); + if (b == 0) + break; + int count = (b & 0xF); + for (int i = 0; i < count; i++) + { + data[index++] = (byte)((b >> 4)); //Initially did + 60, however we're not using tiles like that + } + } + } + + public void LoadTileData() + { + tileData = new byte[32, 8, 8]; + gb.ReadTiles(16, 2, tileLocation, ref tileData); + } + } +} diff --git a/ClassicMap/WildPokemonLoader.cs b/ClassicMap/WildPokemonLoader.cs new file mode 100644 index 0000000..333a62a --- /dev/null +++ b/ClassicMap/WildPokemonLoader.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Text; +using GBHL; + +namespace ClassicMap +{ + public class Pokemon + { + public byte level; + public byte id; + } + + public class WildPokemonLoader + { + GBFile gb; + public byte rarityGrass; + public byte rarityWater; + public Pokemon[] grassPokemon; + public Pokemon[] waterPokemon; + public string[] PokemonNames; + public byte[] PokemonIndicies; + public int wildPokemonLocation; + + public WildPokemonLoader(GBFile g) + { + gb = g; + } + + public void LoadWildPokemon(int map) + { + gb.BufferLocation = 0xCEEB + map * 2; + gb.BufferLocation = 0xC000 + gb.ReadByte() + ((gb.ReadByte() - 0x40) * 0x100); + wildPokemonLocation = gb.BufferLocation; + rarityGrass = gb.ReadByte(); + rarityWater = 0; + grassPokemon = new Pokemon[10]; + waterPokemon = new Pokemon[10]; + if (rarityGrass != 0) + { + for (int i = 0; i < 10; i++) + { + Pokemon p = new Pokemon(); + p.level = gb.ReadByte(); + p.id = gb.ReadByte(); + grassPokemon[i] = p; + } + } + + rarityWater = gb.ReadByte(); + if (rarityWater == 0) + return; + for (int i = 0; i < 10; i++) + { + Pokemon p = new Pokemon(); + p.level = gb.ReadByte(); + p.id = gb.ReadByte(); + waterPokemon[i] = p; + } + } + + public void LoadPokemonNames() + { + gb.BufferLocation = 0x41024; + byte[] indicies = gb.ReadBytes(256); + PokemonIndicies = indicies; + string[] names = new string[256]; + for (int i = 0; i < 191; i++) + { + gb.BufferLocation = 0x1C21E + (i * 10); + byte[] nameBytes = gb.ReadBytes(10); + string s = ""; + for (int k = 0; k < 10; k++) + if (nameBytes[k] != 0x50) + s += TextTable.GetString(nameBytes[k]); + string ss = i.ToString("X"); + if (ss.Length == 1) + ss = "0" + ss; + names[indicies[i]] = ss + " - " + s; + } + PokemonNames = names; + } + } +} diff --git a/ClassicMap/app.config b/ClassicMap/app.config new file mode 100644 index 0000000..df20690 --- /dev/null +++ b/ClassicMap/app.config @@ -0,0 +1,3 @@ + + +