diff --git a/mage/Data/OAM.cs b/mage/Data/OAM.cs index ab6be87..51580f9 100644 --- a/mage/Data/OAM.cs +++ b/mage/Data/OAM.cs @@ -1,10 +1,12 @@ -using System; +using NCalc; +using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; +using System.Text.RegularExpressions; using System.Windows.Forms; namespace mage @@ -19,12 +21,6 @@ public class OAM public static int FrameOriginX => XPosRange / 2; public static int FrameOriginY => YPosRange / 2; - public static JsonSerializerOptions SerializerOptions { get; } = new() - { - IncludeFields = true, - WriteIndented = true, - }; - public struct Frame { public int duration; @@ -176,7 +172,7 @@ public Rectangle Bounds private ByteStream romStream; [JsonConstructor] - public OAM() {} + public OAM() { } public OAM(int offset) { @@ -379,7 +375,7 @@ public Bitmap DrawReal(byte[] gfx, Palette pal, int row, int frameNum) Rectangle dstRect = new Rectangle(0, 0, spriteImg.Width, spriteImg.Height); // The center/"origin" of the bitmap - Point originPos = new Point(XPosRange / 2, YPosRange/2); + Point originPos = new Point(XPosRange / 2, YPosRange / 2); // draw for each part BitmapData spriteData = spriteImg.LockBits(dstRect, ImageLockMode.WriteOnly, spriteImg.PixelFormat); @@ -405,53 +401,6 @@ public Bitmap DrawReal(byte[] gfx, Palette pal, int row, int frameNum) } #endregion - public string Serialize() => JsonSerializer.Serialize(this, SerializerOptions); - - public string ToASM(string animationName = "oam") - { - StringBuilder sb = new StringBuilder(); - - sb.AppendLine(".align"); - sb.AppendLine($"OAM_{animationName}_Animation:"); - for (int i = 0; i < NumFrames; i++) - { - Frame frame = Frames[i]; - sb.AppendLine($"\t.dw @OAM_{animationName}_Frame{Hex.ToPrefixedPaddedString(i)}, {Hex.ToPrefixedPaddedString(frame.duration)}"); - } - sb.AppendLine("\t.dw 0,0"); - - sb.AppendLine(); - - for (int i = 0; i < NumFrames; i++) - { - Frame frame = Frames[i]; - sb.AppendLine($"@OAM_{animationName}_Frame{Hex.ToPrefixedPaddedString(i)}:"); - sb.AppendLine($"\t.dh {Hex.ToPrefixedPaddedString(frame.numParts)}"); - - foreach (Part p in frame.parts) - { - ushort[] attributes = p.GetAttributes(); - sb.AppendLine($"\t.dh {Hex.ToPrefixedPaddedString(attributes[0])},{Hex.ToPrefixedPaddedString(attributes[1])},{Hex.ToPrefixedPaddedString(attributes[2])}"); - } - sb.AppendLine(); - } - return sb.ToString(); - } - - public static OAM? Deserialize(string json) - { - try - { - OAM? result = JsonSerializer.Deserialize(json, SerializerOptions); - return result; - } - catch (Exception e) - { - MessageBox.Show("File did not contain OAM Data or it was corrupted.", "Invalid OAM", MessageBoxButtons.OK, MessageBoxIcon.Error); - return null; - } - } - public static bool IsOAM(int offset) { for (int i = 0; i < 0xFFFF; i += 8) diff --git a/mage/Dialogs/TransparencyDialog.Designer.cs b/mage/Dialogs/TransparencyDialog.Designer.cs new file mode 100644 index 0000000..c309afb --- /dev/null +++ b/mage/Dialogs/TransparencyDialog.Designer.cs @@ -0,0 +1,384 @@ +namespace mage.Dialogs +{ + partial class TransparencyDialog + { + /// + /// 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(TransparencyDialog)); + lbl_bg0Position = new System.Windows.Forms.Label(); + lbl_colorIntensities = new System.Windows.Forms.Label(); + btn_overBG1_overSprite = new System.Windows.Forms.Button(); + btn_overBG2_overSprite = new System.Windows.Forms.Button(); + btn_overBG2_underSprite = new System.Windows.Forms.Button(); + btn_overBG3_underSprite = new System.Windows.Forms.Button(); + button0 = new System.Windows.Forms.Button(); + lbl_eva = new System.Windows.Forms.Label(); + lbl_layersbeneath = new System.Windows.Forms.Label(); + button1 = new System.Windows.Forms.Button(); + button2 = new System.Windows.Forms.Button(); + button3 = new System.Windows.Forms.Button(); + button4 = new System.Windows.Forms.Button(); + button5 = new System.Windows.Forms.Button(); + button6 = new System.Windows.Forms.Button(); + button7 = new System.Windows.Forms.Button(); + button8 = new System.Windows.Forms.Button(); + button9 = new System.Windows.Forms.Button(); + button10 = new System.Windows.Forms.Button(); + btn_apply = new System.Windows.Forms.Button(); + textBox_Value_Dialog = new mage.Theming.CustomControls.FlatTextBox(); + SuspendLayout(); + // + // lbl_bg0Position + // + lbl_bg0Position.AutoSize = true; + lbl_bg0Position.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline); + lbl_bg0Position.Location = new System.Drawing.Point(12, 24); + lbl_bg0Position.Name = "lbl_bg0Position"; + lbl_bg0Position.Size = new System.Drawing.Size(124, 15); + lbl_bg0Position.TabIndex = 0; + lbl_bg0Position.Text = "BG0 Position (Z-Axis)"; + lbl_bg0Position.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // lbl_colorIntensities + // + lbl_colorIntensities.AutoSize = true; + lbl_colorIntensities.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline); + lbl_colorIntensities.Location = new System.Drawing.Point(137, 166); + lbl_colorIntensities.Name = "lbl_colorIntensities"; + lbl_colorIntensities.Size = new System.Drawing.Size(88, 15); + lbl_colorIntensities.TabIndex = 1; + lbl_colorIntensities.Text = "Color Intensity"; + lbl_colorIntensities.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // btn_overBG1_overSprite + // + btn_overBG1_overSprite.Location = new System.Drawing.Point(12, 47); + btn_overBG1_overSprite.Name = "btn_overBG1_overSprite"; + btn_overBG1_overSprite.Size = new System.Drawing.Size(352, 23); + btn_overBG1_overSprite.TabIndex = 3; + btn_overBG1_overSprite.Tag = "0"; + btn_overBG1_overSprite.Text = "Over BG1, Over Sprites None"; + btn_overBG1_overSprite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + btn_overBG1_overSprite.UseVisualStyleBackColor = false; + btn_overBG1_overSprite.Click += buttonPositionClicked; + // + // btn_overBG2_overSprite + // + btn_overBG2_overSprite.Location = new System.Drawing.Point(12, 76); + btn_overBG2_overSprite.Name = "btn_overBG2_overSprite"; + btn_overBG2_overSprite.Size = new System.Drawing.Size(352, 23); + btn_overBG2_overSprite.TabIndex = 4; + btn_overBG2_overSprite.Tag = "1"; + btn_overBG2_overSprite.Text = "Over BG2 Over Sprites"; + btn_overBG2_overSprite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + btn_overBG2_overSprite.UseVisualStyleBackColor = true; + btn_overBG2_overSprite.Click += buttonPositionClicked; + // + // btn_overBG2_underSprite + // + btn_overBG2_underSprite.Location = new System.Drawing.Point(12, 105); + btn_overBG2_underSprite.Name = "btn_overBG2_underSprite"; + btn_overBG2_underSprite.Size = new System.Drawing.Size(352, 23); + btn_overBG2_underSprite.TabIndex = 5; + btn_overBG2_underSprite.Tag = "2"; + btn_overBG2_underSprite.Text = "Over BG2 Under Sprites"; + btn_overBG2_underSprite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + btn_overBG2_underSprite.UseVisualStyleBackColor = true; + btn_overBG2_underSprite.Click += buttonPositionClicked; + // + // btn_overBG3_underSprite + // + btn_overBG3_underSprite.Location = new System.Drawing.Point(12, 134); + btn_overBG3_underSprite.Name = "btn_overBG3_underSprite"; + btn_overBG3_underSprite.Size = new System.Drawing.Size(352, 23); + btn_overBG3_underSprite.TabIndex = 2; + btn_overBG3_underSprite.Tag = "3"; + btn_overBG3_underSprite.Text = "Over BG3 Under Sprites"; + btn_overBG3_underSprite.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + btn_overBG3_underSprite.UseVisualStyleBackColor = true; + btn_overBG3_underSprite.Click += buttonPositionClicked; + // + // button0 + // + button0.Font = new System.Drawing.Font("Noto Mono", 9F); + button0.Location = new System.Drawing.Point(12, 213); + button0.Name = "button0"; + button0.Size = new System.Drawing.Size(352, 23); + button0.TabIndex = 6; + button0.Tag = "0"; + button0.Text = "EVA = 16 EVB = 0"; + button0.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button0.UseVisualStyleBackColor = true; + button0.Click += buttonTransparencyClicked; + // + // lbl_eva + // + lbl_eva.AutoSize = true; + lbl_eva.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline); + lbl_eva.Location = new System.Drawing.Point(12, 195); + lbl_eva.Name = "lbl_eva"; + lbl_eva.Size = new System.Drawing.Size(31, 15); + lbl_eva.TabIndex = 13; + lbl_eva.Text = "BG0"; + // + // lbl_layersbeneath + // + lbl_layersbeneath.AutoSize = true; + lbl_layersbeneath.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline); + lbl_layersbeneath.Location = new System.Drawing.Point(245, 195); + lbl_layersbeneath.Name = "lbl_layersbeneath"; + lbl_layersbeneath.Size = new System.Drawing.Size(119, 15); + lbl_layersbeneath.TabIndex = 14; + lbl_layersbeneath.Text = "Layers Beneath BG0"; + // + // button1 + // + button1.Font = new System.Drawing.Font("Noto Mono", 9F); + button1.Location = new System.Drawing.Point(12, 242); + button1.Name = "button1"; + button1.Size = new System.Drawing.Size(352, 23); + button1.TabIndex = 15; + button1.Tag = "1"; + button1.Text = "EVA = 16 EVB = 7"; + button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button1.UseVisualStyleBackColor = true; + button1.Click += buttonTransparencyClicked; + // + // button2 + // + button2.Font = new System.Drawing.Font("Noto Mono", 9F); + button2.Location = new System.Drawing.Point(12, 271); + button2.Name = "button2"; + button2.Size = new System.Drawing.Size(352, 23); + button2.TabIndex = 16; + button2.Tag = "2"; + button2.Text = "EVA = 16 EVB = 10"; + button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button2.UseVisualStyleBackColor = true; + button2.Click += buttonTransparencyClicked; + // + // button3 + // + button3.Font = new System.Drawing.Font("Noto Mono", 9F); + button3.Location = new System.Drawing.Point(12, 300); + button3.Name = "button3"; + button3.Size = new System.Drawing.Size(352, 23); + button3.TabIndex = 17; + button3.Tag = "3"; + button3.Text = "EVA = 16 EVB = 13"; + button3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button3.UseVisualStyleBackColor = true; + button3.Click += buttonTransparencyClicked; + // + // button4 + // + button4.Font = new System.Drawing.Font("Noto Mono", 9F); + button4.Location = new System.Drawing.Point(12, 329); + button4.Name = "button4"; + button4.Size = new System.Drawing.Size(352, 23); + button4.TabIndex = 18; + button4.Tag = "4"; + button4.Text = "EVA = 16 EVB = 16\r\n"; + button4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button4.UseVisualStyleBackColor = true; + button4.Click += buttonTransparencyClicked; + // + // button5 + // + button5.Font = new System.Drawing.Font("Noto Mono", 9F); + button5.Location = new System.Drawing.Point(12, 358); + button5.Name = "button5"; + button5.Size = new System.Drawing.Size(352, 23); + button5.TabIndex = 19; + button5.Tag = "5"; + button5.Text = "EVA = 0 EVB = 16"; + button5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button5.UseVisualStyleBackColor = true; + button5.Click += buttonTransparencyClicked; + // + // button6 + // + button6.Font = new System.Drawing.Font("Noto Mono", 9F); + button6.Location = new System.Drawing.Point(12, 387); + button6.Name = "button6"; + button6.Size = new System.Drawing.Size(352, 23); + button6.TabIndex = 20; + button6.Tag = "6"; + button6.Text = "EVA = 3 EVB = 13"; + button6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button6.UseVisualStyleBackColor = true; + button6.Click += buttonTransparencyClicked; + // + // button7 + // + button7.Font = new System.Drawing.Font("Noto Mono", 9F); + button7.Location = new System.Drawing.Point(12, 416); + button7.Name = "button7"; + button7.Size = new System.Drawing.Size(352, 23); + button7.TabIndex = 21; + button7.Tag = "7"; + button7.Text = "EVA = 6 EVB = 10"; + button7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button7.UseVisualStyleBackColor = true; + button7.Click += buttonTransparencyClicked; + // + // button8 + // + button8.Font = new System.Drawing.Font("Noto Mono", 9F); + button8.Location = new System.Drawing.Point(12, 445); + button8.Name = "button8"; + button8.Size = new System.Drawing.Size(352, 23); + button8.TabIndex = 22; + button8.Tag = "8"; + button8.Text = "EVA = 9 EVB = 7"; + button8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button8.UseVisualStyleBackColor = true; + button8.Click += buttonTransparencyClicked; + // + // button9 + // + button9.Font = new System.Drawing.Font("Noto Mono", 9F); + button9.Location = new System.Drawing.Point(12, 474); + button9.Name = "button9"; + button9.Size = new System.Drawing.Size(352, 23); + button9.TabIndex = 23; + button9.Tag = "9"; + button9.Text = "EVA = 11 EVB = 5"; + button9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button9.UseVisualStyleBackColor = true; + button9.Click += buttonTransparencyClicked; + // + // button10 + // + button10.Font = new System.Drawing.Font("Noto Mono", 9F); + button10.Location = new System.Drawing.Point(12, 503); + button10.Name = "button10"; + button10.Size = new System.Drawing.Size(352, 23); + button10.TabIndex = 24; + button10.Tag = "10"; + button10.Text = "EVA = 13 EVB = 3"; + button10.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + button10.UseVisualStyleBackColor = true; + button10.Click += buttonTransparencyClicked; + // + // btn_apply + // + btn_apply.ImageAlign = System.Drawing.ContentAlignment.TopCenter; + btn_apply.Location = new System.Drawing.Point(276, 12); + btn_apply.Margin = new System.Windows.Forms.Padding(3, 0, 3, 3); + btn_apply.Name = "btn_apply"; + btn_apply.Size = new System.Drawing.Size(88, 23); + btn_apply.TabIndex = 25; + btn_apply.Tag = "0"; + btn_apply.Text = "Apply"; + btn_apply.TextAlign = System.Drawing.ContentAlignment.TopCenter; + btn_apply.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage; + btn_apply.UseVisualStyleBackColor = true; + btn_apply.Click += returnCombined; + // + // textBox_Value_Dialog + // + textBox_Value_Dialog.BorderColor = System.Drawing.Color.FromArgb(188, 188, 188); + textBox_Value_Dialog.DisplayBorder = true; + textBox_Value_Dialog.HexSanitized = true; + textBox_Value_Dialog.HexSanitizedMaxValue = 255; + textBox_Value_Dialog.Location = new System.Drawing.Point(234, 12); + textBox_Value_Dialog.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + textBox_Value_Dialog.MaxLength = 2; + textBox_Value_Dialog.Multiline = false; + textBox_Value_Dialog.Name = "textBox_Value_Dialog"; + textBox_Value_Dialog.OnTextChanged = null; + textBox_Value_Dialog.Padding = new System.Windows.Forms.Padding(4, 3, 1, 2); + textBox_Value_Dialog.PlaceholderText = ""; + textBox_Value_Dialog.ReadOnly = false; + textBox_Value_Dialog.ScrollBars = System.Windows.Forms.ScrollBars.None; + textBox_Value_Dialog.SelectionStart = 0; + textBox_Value_Dialog.Size = new System.Drawing.Size(35, 23); + textBox_Value_Dialog.TabIndex = 26; + textBox_Value_Dialog.TextAlign = System.Windows.Forms.HorizontalAlignment.Left; + textBox_Value_Dialog.ValueBox = false; + textBox_Value_Dialog.WordWrap = true; + textBox_Value_Dialog.TextChanged += textChanged; + // + // TransparencyDialog + // + AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + ClientSize = new System.Drawing.Size(376, 534); + Controls.Add(btn_apply); + Controls.Add(button10); + Controls.Add(button9); + Controls.Add(button8); + Controls.Add(button7); + Controls.Add(button6); + Controls.Add(button5); + Controls.Add(button4); + Controls.Add(button3); + Controls.Add(button2); + Controls.Add(button1); + Controls.Add(lbl_layersbeneath); + Controls.Add(lbl_eva); + Controls.Add(button0); + Controls.Add(btn_overBG2_underSprite); + Controls.Add(btn_overBG2_overSprite); + Controls.Add(btn_overBG1_overSprite); + Controls.Add(btn_overBG3_underSprite); + Controls.Add(lbl_colorIntensities); + Controls.Add(lbl_bg0Position); + Controls.Add(textBox_Value_Dialog); + FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); + Name = "TransparencyDialog"; + Text = "Transparency"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private System.Windows.Forms.Label lbl_bg0Position; + private System.Windows.Forms.Label lbl_colorIntensities; + private System.Windows.Forms.Button btn_overBG3_underSprite; + private System.Windows.Forms.Button btn_overBG1_overSprite; + private System.Windows.Forms.Button btn_overBG2_overSprite; + private System.Windows.Forms.Button btn_overBG2_underSprite; + private System.Windows.Forms.Button button0; + private System.Windows.Forms.Label lbl_eva; + private System.Windows.Forms.Label lbl_layersbeneath; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button4; + private System.Windows.Forms.Button button5; + private System.Windows.Forms.Button button6; + private System.Windows.Forms.Button button7; + private System.Windows.Forms.Button button8; + private System.Windows.Forms.Button button9; + private System.Windows.Forms.Button button10; + private System.Windows.Forms.Button btn_apply; + private Theming.CustomControls.FlatTextBox textBox_Value_Dialog; + } +} \ No newline at end of file diff --git a/mage/Dialogs/TransparencyDialog.cs b/mage/Dialogs/TransparencyDialog.cs new file mode 100644 index 0000000..cb76786 --- /dev/null +++ b/mage/Dialogs/TransparencyDialog.cs @@ -0,0 +1,164 @@ +using mage.Controls; +using mage.Theming; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static Microsoft.WindowsAPICodePack.Shell.PropertySystem.SystemProperties.System; +using static System.Net.Mime.MediaTypeNames; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using WinButton = System.Windows.Forms.Button; + +namespace mage.Dialogs +{ + public partial class TransparencyDialog : Form + { + //Button Arrays for easier management + private WinButton[] positionButtons; + private WinButton[] transparencyButtons; + //textBox_Value_Dialog.Text += textChanged; + + public byte Value = 0; //Hex.ToByte(FormHeader.textBox_transparency.Text); + private byte PositionValue; + private byte TransparencyValue; + public TransparencyDialog(byte initialValue) + { + InitializeComponent(); + // Store incoming value + this.Value = initialValue; + + // Split into components + separateValues(); + + + // After InitializeComponent, but before showing the form + this.Load += TransparencyDialog_Load; + + DialogResult = DialogResult.Cancel; + } + + private void TransparencyDialog_Load(object sender, EventArgs e) + { + positionButtons = new[] { btn_overBG1_overSprite, btn_overBG2_overSprite, btn_overBG2_underSprite, btn_overBG3_underSprite }; + transparencyButtons = new[] + { + button0, button1, button2, button3, button4, + button5, button6, button7, button8, button9, button10 + }; + + UpdateUI(); + + //Theming + ThemeSwitcher.ChangeTheme(Controls, this); + ThemeSwitcher.InjectPaintOverrides(Controls); + } + + private void textChanged(object sender, EventArgs e) + { + string ErrorText = string.Empty; + //Validate values or throw error textBox_Value_Dialog + try + { + byte newValue = Hex.ToByte(textBox_Value_Dialog.Text); + if (newValue < 0 || newValue > 0xFF) throw new ArgumentOutOfRangeException(nameof(newValue), "Tile number must be between 0 and 0xFF."); + Value = newValue;//update Value + separateValues(); + UpdateUI(); + } + catch (Exception exc) + { + ErrorText = exc.Message; + } + } + private void UpdateUI() + { + combineValues(); + textBox_Value_Dialog.Text = Hex.ToString(Value); + foreach (var b in positionButtons) + b.BackColor = ThemeSwitcher.ProjectTheme.BackgroundColor; + + foreach (var b in transparencyButtons) + b.BackColor = ThemeSwitcher.ProjectTheme.BackgroundColor; + + positionButtons[PositionValue].BackColor = ThemeSwitcher.ProjectTheme.AccentColor; + positionButtons[PositionValue].ForeColor = ThemeSwitcher.ProjectTheme.TextColorHighlight; + + int buttonIndex = GetButtonIndexForGroup(TransparencyValue); + transparencyButtons[buttonIndex].BackColor = ThemeSwitcher.ProjectTheme.AccentColor; + transparencyButtons[buttonIndex].ForeColor = ThemeSwitcher.ProjectTheme.TextColorHighlight; + } + + private byte combineValues() + { + Value = (byte)(PositionValue + 4 * TransparencyValue); + return Value; + } + + + private void separateValues() + { + PositionValue = (byte)(Value % 4); + TransparencyValue = (byte)(Value / 4); + } + + private void returnValue(byte value) + { + DialogResult = DialogResult.OK; + Value = value; + Close(); + } + + private void buttonPositionClicked(object sender, EventArgs e) + { + WinButton b = sender as WinButton; + int val = Convert.ToInt32(b.Tag.ToString(), 10); + PositionValue = ((byte)val); + UpdateUI(); + } + private void buttonTransparencyClicked(object sender, EventArgs e) + { + WinButton b = sender as WinButton; + int buttonIndex = Convert.ToInt32(b.Tag.ToString(), 10); + TransparencyValue = AlphaGroupForButton[buttonIndex]; // group index (0..13) + UpdateUI(); + } + + private void returnCombined(object sender, EventArgs e) + { + Value = combineValues(); + returnValue(Value); + } + private int GetButtonIndexForGroup(byte group) + { + for (int i = 0; i < AlphaGroupForButton.Length; i++) + if (AlphaGroupForButton[i] == group) + return i; + + // Fallback: if group is a duplicate (1,12,13), map to 0 (16,0) + return 0; + } + + + // Which BLDALPHA group each transparency button represents + // index = button.Tag (0..10), value = group index (0..13) + private static readonly byte[] AlphaGroupForButton = + { + 12, // button0 → group 13 (0x00–0x03, EVA=16, EVB=0) + 2, // button1 → group 2 (0x08–0x0B, 16,7) + 3, // button2 → group 3 (0x0C–0x0F, 16,10) + 4, // button3 → group 4 (0x10–0x13, 16,13) + 5, // button4 → group 5 (0x14–0x17, 16,16) + 6, // button5 → group 6 (0x18–0x1B, 0,16) + 7, // button6 → group 7 (0x1C–0x1F, 3,13) + 8, // button7 → group 8 (0x20–0x23, 6,10) + 9, // button8 → group 9 (0x24–0x27, 9,7) + 10, // button9 → group 10 (0x28–0x2B, 11,5) + 11 // button10 → group 11 (0x2C–0x2F, 13,3) + }; + } +} diff --git a/mage/Dialogs/TransparencyDialog.resx b/mage/Dialogs/TransparencyDialog.resx new file mode 100644 index 0000000..c3147e2 --- /dev/null +++ b/mage/Dialogs/TransparencyDialog.resx @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAIAEBAAAAAAGABoAwAAJgAAACAgAAAAABgAqAwAAI4DAAAoAAAAEAAAACAAAAABABgAAAAAAAAD + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUCgwUCgwUCgwUCgwAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAUCgwUCgwACjoACCwABhwUCgwUCgwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUCgw + YHhAACjoUCgwACjosMiQsMiQYHhAUCgwUCgwAAAAAAAAAAAAAAAAAAAAAAAAUCgwsMiQABhwsMiQACjo + ACjosMiQ+Pj4sMiQsMiQACCwUCgwUCgwAAAAAAAAAAAAYHhAABhwcPgAcPgAcPgAYHhAACjoACCwsMiQ + sMiQACCwACCwICBAICBAAAAAAAAAABhwYHhAcPgA+Pj4cPgAcPgAUCgwACjoABhwACjoICBAICBAAMD4 + ICBAAAAAAAAAABhwcPgA+Pj4+Pj4cPgAcPgAUCgwACjoICBAICBAAMD4AMD4AJDoICBAAAAAAAAAUCgw + cPgA+Pj4+Pj4cPgAcPgAYHhAICBAAMD4AMD4AJDoAJDoICBAAAAAAAAAAAAAUCgwYHhAcPgAYHhAcPgA + ICBAICBAMPj4AJDoAJDoAJDoICBAAAAAAAAAAAAAAAAAUCgwABhwYHhAICBAICBAAMD4MPj4AJDoAJDo + ACAwACAwICBAAAAAAAAAAAAAAAAAAAAAICBAICBAAMD4AMD4MPj4MPj4ACAwACAwACAwGGC4ICBAAAAA + AAAAAAAAAAAAICBAAMD4MPj4MPj4MPj4MPj4GGC4ACAwGGC4AJDoGGC4GGC4ICBAAAAAAAAAICBAAMD4 + MPj4MPj4MPj4AJDoGGC4GGC4AMD4MPj4AMD4GGC4GGC4GGC4ICBA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgIEAgIEAgIEAg + IEAw+Pgw+Pgw+Pgw+Pgw+Pgw+PgDru4Dru4AkOgAkOgYYLgYYLggIEAgIEAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgIEAgIEAgIEAgIEAgIEAgIEAgIEAg + IEAgIEAgIEAgIEAgIEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAgIEAgIEAgIEAgIEAgIEAgIEAgIEAgIEAgIEAgIEAgIEAgIEAAAAAAAAAAAAAA + AAD/AP///wD///AAP//wAD//wAAD/8AAA//AAAAPwAAAD8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA + AA/AAAAPwAAAP8AAAD/AAAA/wAAAP/AAAD/wAAA/wAAAD8AAAA8AAAADAAAAA8AAAADAAAAA//AAA//w + AAP//wAP//8ADw== + + + \ No newline at end of file diff --git a/mage/Editors/FormHeader.Designer.cs b/mage/Editors/FormHeader.Designer.cs index 4b976e9..43f272e 100644 --- a/mage/Editors/FormHeader.Designer.cs +++ b/mage/Editors/FormHeader.Designer.cs @@ -29,17 +29,17 @@ protected override void Dispose(bool disposing) private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormHeader)); - textBox_tileset = new Theming.CustomControls.FlatTextBox(); + textBox_tileset = new mage.Theming.CustomControls.FlatTextBox(); label_tileset = new System.Windows.Forms.Label(); - textBox_BG0pointer = new Theming.CustomControls.FlatTextBox(); - textBox_BG1pointer = new Theming.CustomControls.FlatTextBox(); - textBox_BG2pointer = new Theming.CustomControls.FlatTextBox(); - textBox_BG3pointer = new Theming.CustomControls.FlatTextBox(); - textBox_CLPpointer = new Theming.CustomControls.FlatTextBox(); - textBox_BG0prop = new Theming.CustomControls.FlatTextBox(); - textBox_BG1prop = new Theming.CustomControls.FlatTextBox(); - textBox_BG2prop = new Theming.CustomControls.FlatTextBox(); - textBox_BG3prop = new Theming.CustomControls.FlatTextBox(); + textBox_BG0pointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_BG1pointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_BG2pointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_BG3pointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_CLPpointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_BG0prop = new mage.Theming.CustomControls.FlatTextBox(); + textBox_BG1prop = new mage.Theming.CustomControls.FlatTextBox(); + textBox_BG2prop = new mage.Theming.CustomControls.FlatTextBox(); + textBox_BG3prop = new mage.Theming.CustomControls.FlatTextBox(); label_BG0 = new System.Windows.Forms.Label(); label_BG1 = new System.Windows.Forms.Label(); label_BG2 = new System.Windows.Forms.Label(); @@ -47,8 +47,8 @@ private void InitializeComponent() label_CLP = new System.Windows.Forms.Label(); label_BGpointer = new System.Windows.Forms.Label(); label_prop = new System.Windows.Forms.Label(); - textBox_BG3scroll = new Theming.CustomControls.FlatTextBox(); - textBox_transparency = new Theming.CustomControls.FlatTextBox(); + textBox_BG3scroll = new mage.Theming.CustomControls.FlatTextBox(); + textBox_transparency = new mage.Theming.CustomControls.FlatTextBox(); label_BG3scroll = new System.Windows.Forms.Label(); label_transparency = new System.Windows.Forms.Label(); groupBox_BGdata = new System.Windows.Forms.GroupBox(); @@ -58,10 +58,10 @@ private void InitializeComponent() btn_bg1_prop = new System.Windows.Forms.Button(); btn_bg2_prop = new System.Windows.Forms.Button(); btn_bg3_presets = new System.Windows.Forms.Button(); - textBox_effectYpos = new Theming.CustomControls.FlatTextBox(); + textBox_effectYpos = new mage.Theming.CustomControls.FlatTextBox(); label1 = new System.Windows.Forms.Label(); label_effect = new System.Windows.Forms.Label(); - textBox_effect = new Theming.CustomControls.FlatTextBox(); + textBox_effect = new mage.Theming.CustomControls.FlatTextBox(); groupBox_spritesetData = new System.Windows.Forms.GroupBox(); label_second = new System.Windows.Forms.Label(); label_first = new System.Windows.Forms.Label(); @@ -69,32 +69,33 @@ private void InitializeComponent() label_event = new System.Windows.Forms.Label(); label_spriteset = new System.Windows.Forms.Label(); label_spritesetPointer = new System.Windows.Forms.Label(); - textBox_defaultPointer = new Theming.CustomControls.FlatTextBox(); - textBox_defaultSpriteset = new Theming.CustomControls.FlatTextBox(); - textBox_secondEvent = new Theming.CustomControls.FlatTextBox(); - textBox_secondPointer = new Theming.CustomControls.FlatTextBox(); - textBox_secondSpriteset = new Theming.CustomControls.FlatTextBox(); - textBox_firstEvent = new Theming.CustomControls.FlatTextBox(); - textBox_firstPointer = new Theming.CustomControls.FlatTextBox(); - textBox_firstSpriteset = new Theming.CustomControls.FlatTextBox(); + textBox_defaultPointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_defaultSpriteset = new mage.Theming.CustomControls.FlatTextBox(); + textBox_secondEvent = new mage.Theming.CustomControls.FlatTextBox(); + textBox_secondPointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_secondSpriteset = new mage.Theming.CustomControls.FlatTextBox(); + textBox_firstEvent = new mage.Theming.CustomControls.FlatTextBox(); + textBox_firstPointer = new mage.Theming.CustomControls.FlatTextBox(); + textBox_firstSpriteset = new mage.Theming.CustomControls.FlatTextBox(); groupBox_misc = new System.Windows.Forms.GroupBox(); btn_open_map = new System.Windows.Forms.Button(); label_music = new System.Windows.Forms.Label(); - textBox_music = new Theming.CustomControls.FlatTextBox(); + textBox_music = new mage.Theming.CustomControls.FlatTextBox(); label_mapY = new System.Windows.Forms.Label(); label_mapX = new System.Windows.Forms.Label(); - textBox_mapX = new Theming.CustomControls.FlatTextBox(); - textBox_mapY = new Theming.CustomControls.FlatTextBox(); + textBox_mapX = new mage.Theming.CustomControls.FlatTextBox(); + textBox_mapY = new mage.Theming.CustomControls.FlatTextBox(); button_apply = new System.Windows.Forms.Button(); label_room = new System.Windows.Forms.Label(); label_area = new System.Windows.Forms.Label(); - comboBox_room = new Theming.CustomControls.FlatComboBox(); - comboBox_area = new Theming.CustomControls.FlatComboBox(); + comboBox_room = new mage.Theming.CustomControls.FlatComboBox(); + comboBox_area = new mage.Theming.CustomControls.FlatComboBox(); statusStrip = new System.Windows.Forms.StatusStrip(); statusLabel_changes = new System.Windows.Forms.ToolStripStatusLabel(); lbl_spring = new System.Windows.Forms.ToolStripStatusLabel(); lbl_offset = new System.Windows.Forms.ToolStripStatusLabel(); button_close = new System.Windows.Forms.Button(); + btn_transparency_preset = new System.Windows.Forms.Button(); groupBox_BGdata.SuspendLayout(); groupBox_spritesetData.SuspendLayout(); groupBox_misc.SuspendLayout(); @@ -129,7 +130,7 @@ private void InitializeComponent() label_tileset.Location = new System.Drawing.Point(7, 44); label_tileset.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_tileset.Name = "label_tileset"; - label_tileset.Size = new System.Drawing.Size(43, 15); + label_tileset.Size = new System.Drawing.Size(48, 17); label_tileset.TabIndex = 0; label_tileset.Text = "Tileset:"; // @@ -337,7 +338,7 @@ private void InitializeComponent() label_BG0.Location = new System.Drawing.Point(178, 44); label_BG0.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_BG0.Name = "label_BG0"; - label_BG0.Size = new System.Drawing.Size(34, 15); + label_BG0.Size = new System.Drawing.Size(38, 17); label_BG0.TabIndex = 0; label_BG0.Text = "BG 0:"; // @@ -347,7 +348,7 @@ private void InitializeComponent() label_BG1.Location = new System.Drawing.Point(178, 74); label_BG1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_BG1.Name = "label_BG1"; - label_BG1.Size = new System.Drawing.Size(34, 15); + label_BG1.Size = new System.Drawing.Size(38, 17); label_BG1.TabIndex = 0; label_BG1.Text = "BG 1:"; // @@ -357,7 +358,7 @@ private void InitializeComponent() label_BG2.Location = new System.Drawing.Point(178, 104); label_BG2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_BG2.Name = "label_BG2"; - label_BG2.Size = new System.Drawing.Size(34, 15); + label_BG2.Size = new System.Drawing.Size(38, 17); label_BG2.TabIndex = 0; label_BG2.Text = "BG 2:"; // @@ -367,7 +368,7 @@ private void InitializeComponent() label_BG3.Location = new System.Drawing.Point(178, 134); label_BG3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_BG3.Name = "label_BG3"; - label_BG3.Size = new System.Drawing.Size(34, 15); + label_BG3.Size = new System.Drawing.Size(38, 17); label_BG3.TabIndex = 0; label_BG3.Text = "BG 3:"; // @@ -377,14 +378,14 @@ private void InitializeComponent() label_CLP.Location = new System.Drawing.Point(178, 164); label_CLP.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_CLP.Name = "label_CLP"; - label_CLP.Size = new System.Drawing.Size(31, 15); + label_CLP.Size = new System.Drawing.Size(33, 17); label_CLP.TabIndex = 0; label_CLP.Text = "Clip:"; // // label_BGpointer // label_BGpointer.AutoSize = true; - label_BGpointer.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); + label_BGpointer.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline); label_BGpointer.Location = new System.Drawing.Point(225, 18); label_BGpointer.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_BGpointer.Name = "label_BGpointer"; @@ -395,7 +396,7 @@ private void InitializeComponent() // label_prop // label_prop.AutoSize = true; - label_prop.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); + label_prop.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline); label_prop.Location = new System.Drawing.Point(287, 19); label_prop.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_prop.Name = "label_prop"; @@ -453,7 +454,7 @@ private void InitializeComponent() label_BG3scroll.Location = new System.Drawing.Point(7, 104); label_BG3scroll.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_BG3scroll.Name = "label_BG3scroll"; - label_BG3scroll.Size = new System.Drawing.Size(62, 15); + label_BG3scroll.Size = new System.Drawing.Size(69, 17); label_BG3scroll.TabIndex = 0; label_BG3scroll.Text = "BG3 scroll:"; // @@ -463,12 +464,13 @@ private void InitializeComponent() label_transparency.Location = new System.Drawing.Point(7, 74); label_transparency.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_transparency.Name = "label_transparency"; - label_transparency.Size = new System.Drawing.Size(79, 15); + label_transparency.Size = new System.Drawing.Size(88, 17); label_transparency.TabIndex = 0; label_transparency.Text = "Transparency:"; // // groupBox_BGdata // + groupBox_BGdata.Controls.Add(btn_transparency_preset); groupBox_BGdata.Controls.Add(btn_tileset_preset); groupBox_BGdata.Controls.Add(btn_bg3_prop); groupBox_BGdata.Controls.Add(btn_bg0_prop); @@ -598,7 +600,7 @@ private void InitializeComponent() label1.Location = new System.Drawing.Point(7, 164); label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label1.Name = "label1"; - label1.Size = new System.Drawing.Size(72, 15); + label1.Size = new System.Drawing.Size(80, 17); label1.TabIndex = 0; label1.Text = "Effect Y pos:"; // @@ -608,7 +610,7 @@ private void InitializeComponent() label_effect.Location = new System.Drawing.Point(7, 134); label_effect.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_effect.Name = "label_effect"; - label_effect.Size = new System.Drawing.Size(40, 15); + label_effect.Size = new System.Drawing.Size(43, 17); label_effect.TabIndex = 0; label_effect.Text = "Effect:"; // @@ -665,7 +667,7 @@ private void InitializeComponent() label_second.Location = new System.Drawing.Point(7, 104); label_second.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_second.Name = "label_second"; - label_second.Size = new System.Drawing.Size(49, 15); + label_second.Size = new System.Drawing.Size(54, 17); label_second.TabIndex = 0; label_second.Text = "Second:"; // @@ -675,7 +677,7 @@ private void InitializeComponent() label_first.Location = new System.Drawing.Point(7, 74); label_first.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_first.Name = "label_first"; - label_first.Size = new System.Drawing.Size(32, 15); + label_first.Size = new System.Drawing.Size(35, 17); label_first.TabIndex = 0; label_first.Text = "First:"; // @@ -685,14 +687,14 @@ private void InitializeComponent() label_default.Location = new System.Drawing.Point(7, 44); label_default.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_default.Name = "label_default"; - label_default.Size = new System.Drawing.Size(48, 15); + label_default.Size = new System.Drawing.Size(52, 17); label_default.TabIndex = 0; label_default.Text = "Default:"; // // label_event // label_event.AutoSize = true; - label_event.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); + label_event.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline); label_event.Location = new System.Drawing.Point(192, 18); label_event.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_event.Name = "label_event"; @@ -703,7 +705,7 @@ private void InitializeComponent() // label_spriteset // label_spriteset.AutoSize = true; - label_spriteset.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); + label_spriteset.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline); label_spriteset.Location = new System.Drawing.Point(152, 18); label_spriteset.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_spriteset.Name = "label_spriteset"; @@ -714,7 +716,7 @@ private void InitializeComponent() // label_spritesetPointer // label_spritesetPointer.AutoSize = true; - label_spritesetPointer.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point); + label_spritesetPointer.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline); label_spritesetPointer.Location = new System.Drawing.Point(69, 18); label_spritesetPointer.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_spritesetPointer.Name = "label_spritesetPointer"; @@ -933,7 +935,7 @@ private void InitializeComponent() label_music.Location = new System.Drawing.Point(7, 138); label_music.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_music.Name = "label_music"; - label_music.Size = new System.Drawing.Size(42, 15); + label_music.Size = new System.Drawing.Size(45, 17); label_music.TabIndex = 0; label_music.Text = "Music:"; // @@ -965,7 +967,7 @@ private void InitializeComponent() label_mapY.Location = new System.Drawing.Point(7, 67); label_mapY.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_mapY.Name = "label_mapY"; - label_mapY.Size = new System.Drawing.Size(44, 15); + label_mapY.Size = new System.Drawing.Size(49, 17); label_mapY.TabIndex = 0; label_mapY.Text = "Map Y:"; // @@ -975,7 +977,7 @@ private void InitializeComponent() label_mapX.Location = new System.Drawing.Point(7, 30); label_mapX.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_mapX.Name = "label_mapX"; - label_mapX.Size = new System.Drawing.Size(44, 15); + label_mapX.Size = new System.Drawing.Size(50, 17); label_mapX.TabIndex = 0; label_mapX.Text = "Map X:"; // @@ -1041,7 +1043,7 @@ private void InitializeComponent() label_room.Location = new System.Drawing.Point(20, 421); label_room.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_room.Name = "label_room"; - label_room.Size = new System.Drawing.Size(42, 15); + label_room.Size = new System.Drawing.Size(46, 17); label_room.TabIndex = 0; label_room.Text = "Room:"; // @@ -1051,7 +1053,7 @@ private void InitializeComponent() label_area.Location = new System.Drawing.Point(20, 392); label_area.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_area.Name = "label_area"; - label_area.Size = new System.Drawing.Size(34, 15); + label_area.Size = new System.Drawing.Size(38, 17); label_area.TabIndex = 0; label_area.Text = "Area:"; // @@ -1062,7 +1064,7 @@ private void InitializeComponent() comboBox_room.Location = new System.Drawing.Point(70, 418); comboBox_room.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); comboBox_room.Name = "comboBox_room"; - comboBox_room.Size = new System.Drawing.Size(182, 23); + comboBox_room.Size = new System.Drawing.Size(182, 25); comboBox_room.TabIndex = 4; comboBox_room.SelectedIndexChanged += comboBox_room_SelectedIndexChanged; // @@ -1073,7 +1075,7 @@ private void InitializeComponent() comboBox_area.Location = new System.Drawing.Point(70, 389); comboBox_area.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); comboBox_area.Name = "comboBox_area"; - comboBox_area.Size = new System.Drawing.Size(182, 23); + comboBox_area.Size = new System.Drawing.Size(182, 25); comboBox_area.TabIndex = 3; comboBox_area.SelectedIndexChanged += comboBox_area_SelectedIndexChanged; // @@ -1090,19 +1092,19 @@ private void InitializeComponent() // statusLabel_changes.BorderStyle = System.Windows.Forms.Border3DStyle.Etched; statusLabel_changes.Name = "statusLabel_changes"; - statusLabel_changes.Size = new System.Drawing.Size(12, 17); + statusLabel_changes.Size = new System.Drawing.Size(13, 17); statusLabel_changes.Text = "-"; // // lbl_spring // lbl_spring.Name = "lbl_spring"; - lbl_spring.Size = new System.Drawing.Size(311, 17); + lbl_spring.Size = new System.Drawing.Size(306, 17); lbl_spring.Spring = true; // // lbl_offset // lbl_offset.Name = "lbl_offset"; - lbl_offset.Size = new System.Drawing.Size(42, 17); + lbl_offset.Size = new System.Drawing.Size(46, 17); lbl_offset.Text = "Offset:"; // // button_close @@ -1116,6 +1118,16 @@ private void InitializeComponent() button_close.UseVisualStyleBackColor = true; button_close.Click += button_close_Click; // + // btn_transparency_preset + // + btn_transparency_preset.Image = Properties.Resources.toolbar_patches; + btn_transparency_preset.Location = new System.Drawing.Point(144, 70); + btn_transparency_preset.Name = "btn_transparency_preset"; + btn_transparency_preset.Size = new System.Drawing.Size(23, 23); + btn_transparency_preset.TabIndex = 20; + btn_transparency_preset.UseVisualStyleBackColor = true; + btn_transparency_preset.Click += btn_transparency_preset_Click; + // // FormHeader // AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -1216,5 +1228,6 @@ private void InitializeComponent() private System.Windows.Forms.Button btn_bg0_prop; private System.Windows.Forms.Button btn_bg1_prop; private System.Windows.Forms.Button btn_tileset_preset; + private System.Windows.Forms.Button btn_transparency_preset; } } \ No newline at end of file diff --git a/mage/Editors/FormHeader.cs b/mage/Editors/FormHeader.cs index 6294f80..ea039e3 100644 --- a/mage/Editors/FormHeader.cs +++ b/mage/Editors/FormHeader.cs @@ -5,6 +5,7 @@ using System.Drawing; using System.Windows.Forms; + namespace mage { public partial class FormHeader : Form @@ -295,6 +296,20 @@ private void btn_tileset_preset_Click(object sender, EventArgs e) if (d.ShowDialog() != DialogResult.OK) return; textBox_tileset.Text = Hex.ToString(d.SelectedTileset); } + + private void btn_transparency_preset_Click(object sender, EventArgs e) + { + byte oldTransparency; + try { oldTransparency = Hex.ToByte(textBox_transparency.Text); } + catch { oldTransparency = 0; } + + TransparencyDialog d = new TransparencyDialog(oldTransparency); + if (d.ShowDialog() != DialogResult.OK) return; + textBox_transparency.Text = Hex.ToString(d.Value); + } + #endregion + + } } diff --git a/mage/Editors/FormOam.Designer.cs b/mage/Editors/FormOam.Designer.cs index 4e1be91..eb1a09e 100644 --- a/mage/Editors/FormOam.Designer.cs +++ b/mage/Editors/FormOam.Designer.cs @@ -105,6 +105,7 @@ private void InitializeComponent() label_spring = new System.Windows.Forms.ToolStripStatusLabel(); button_import = new System.Windows.Forms.ToolStripDropDownButton(); button_importOam = new System.Windows.Forms.ToolStripMenuItem(); + button_importAssembly = new System.Windows.Forms.ToolStripMenuItem(); button_export = new System.Windows.Forms.ToolStripDropDownButton(); button_exportAnimation = new System.Windows.Forms.ToolStripMenuItem(); button_exportAssembly = new System.Windows.Forms.ToolStripMenuItem(); @@ -194,7 +195,7 @@ private void InitializeComponent() checkBox_compressed.Location = new System.Drawing.Point(150, 24); checkBox_compressed.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); checkBox_compressed.Name = "checkBox_compressed"; - checkBox_compressed.Size = new System.Drawing.Size(92, 19); + checkBox_compressed.Size = new System.Drawing.Size(101, 21); checkBox_compressed.TabIndex = 1; checkBox_compressed.Text = "Compressed"; checkBox_compressed.UseVisualStyleBackColor = true; @@ -217,7 +218,7 @@ private void InitializeComponent() label_paletteOffset.Location = new System.Drawing.Point(8, 54); label_paletteOffset.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_paletteOffset.Name = "label_paletteOffset"; - label_paletteOffset.Size = new System.Drawing.Size(46, 15); + label_paletteOffset.Size = new System.Drawing.Size(50, 17); label_paletteOffset.TabIndex = 0; label_paletteOffset.Text = "Palette:"; // @@ -248,7 +249,7 @@ private void InitializeComponent() label_imageOffset.Location = new System.Drawing.Point(8, 25); label_imageOffset.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_imageOffset.Name = "label_imageOffset"; - label_imageOffset.Size = new System.Drawing.Size(56, 15); + label_imageOffset.Size = new System.Drawing.Size(62, 17); label_imageOffset.TabIndex = 0; label_imageOffset.Text = "Graphics:"; // @@ -258,7 +259,7 @@ private void InitializeComponent() label_OAMOffset.Location = new System.Drawing.Point(8, 85); label_OAMOffset.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); label_OAMOffset.Name = "label_OAMOffset"; - label_OAMOffset.Size = new System.Drawing.Size(38, 15); + label_OAMOffset.Size = new System.Drawing.Size(41, 17); label_OAMOffset.TabIndex = 0; label_OAMOffset.Text = "OAM:"; // @@ -324,10 +325,10 @@ private void InitializeComponent() panel_gfx.AutoScroll = true; panel_gfx.Controls.Add(gfxView_gfx); panel_gfx.Dock = System.Windows.Forms.DockStyle.Fill; - panel_gfx.Location = new System.Drawing.Point(4, 44); + panel_gfx.Location = new System.Drawing.Point(4, 46); panel_gfx.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); panel_gfx.Name = "panel_gfx"; - panel_gfx.Size = new System.Drawing.Size(529, 229); + panel_gfx.Size = new System.Drawing.Size(529, 227); panel_gfx.TabIndex = 0; // // gfxView_gfx @@ -345,6 +346,7 @@ private void InitializeComponent() gfxView_gfx.TabStop = false; gfxView_gfx.Tag = "unthemed"; gfxView_gfx.Text = "tileDisplay1"; + gfxView_gfx.TileGridOrigin = new System.Drawing.Point(0, 0); gfxView_gfx.TileImage = null; gfxView_gfx.TileSize = 8; gfxView_gfx.Zoom = 0; @@ -378,7 +380,7 @@ private void InitializeComponent() // toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { button_viewPalette, button_viewVram, button_loadCommonGraphics, toolStripSeparator1, button_gfxZoomIn, button_gfxZoomOut, label_gfxZoom }); - toolStrip1.Location = new System.Drawing.Point(4, 19); + toolStrip1.Location = new System.Drawing.Point(4, 21); toolStrip1.Name = "toolStrip1"; toolStrip1.Size = new System.Drawing.Size(529, 25); toolStrip1.TabIndex = 0; @@ -442,7 +444,7 @@ private void InitializeComponent() // label_gfxZoom // label_gfxZoom.Name = "label_gfxZoom"; - label_gfxZoom.Size = new System.Drawing.Size(35, 22); + label_gfxZoom.Size = new System.Drawing.Size(40, 22); label_gfxZoom.Text = "100%"; // // groupBox_oam @@ -554,7 +556,7 @@ private void InitializeComponent() label_frameDuration.AutoSize = true; label_frameDuration.Location = new System.Drawing.Point(9, 85); label_frameDuration.Name = "label_frameDuration"; - label_frameDuration.Size = new System.Drawing.Size(56, 15); + label_frameDuration.Size = new System.Drawing.Size(61, 17); label_frameDuration.TabIndex = 5; label_frameDuration.Text = "Duration:"; // @@ -564,7 +566,7 @@ private void InitializeComponent() comboBox_Frame.FormattingEnabled = true; comboBox_Frame.Location = new System.Drawing.Point(72, 22); comboBox_Frame.Name = "comboBox_Frame"; - comboBox_Frame.Size = new System.Drawing.Size(70, 23); + comboBox_Frame.Size = new System.Drawing.Size(70, 25); comboBox_Frame.TabIndex = 0; comboBox_Frame.SelectedIndexChanged += comboBox_Frame_SelectedIndexChanged; // @@ -573,7 +575,7 @@ private void InitializeComponent() label_OAMFrame.AutoSize = true; label_OAMFrame.Location = new System.Drawing.Point(8, 25); label_OAMFrame.Name = "label_OAMFrame"; - label_OAMFrame.Size = new System.Drawing.Size(43, 15); + label_OAMFrame.Size = new System.Drawing.Size(47, 17); label_OAMFrame.TabIndex = 3; label_OAMFrame.Text = "Frame:"; // @@ -586,7 +588,7 @@ private void InitializeComponent() groupBox_part.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); groupBox_part.Name = "groupBox_part"; groupBox_part.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - groupBox_part.Size = new System.Drawing.Size(250, 508); + groupBox_part.Size = new System.Drawing.Size(250, 445); groupBox_part.TabIndex = 2; groupBox_part.TabStop = false; groupBox_part.Text = "Part Details"; @@ -607,9 +609,9 @@ private void InitializeComponent() panel_partEditing.Controls.Add(label_y); panel_partEditing.Controls.Add(label_x); panel_partEditing.Dock = System.Windows.Forms.DockStyle.Fill; - panel_partEditing.Location = new System.Drawing.Point(4, 48); + panel_partEditing.Location = new System.Drawing.Point(4, 50); panel_partEditing.Name = "panel_partEditing"; - panel_partEditing.Size = new System.Drawing.Size(242, 457); + panel_partEditing.Size = new System.Drawing.Size(242, 392); panel_partEditing.TabIndex = 11; // // label_error @@ -617,7 +619,7 @@ private void InitializeComponent() label_error.AutoSize = true; label_error.Location = new System.Drawing.Point(4, 11); label_error.Name = "label_error"; - label_error.Size = new System.Drawing.Size(183, 15); + label_error.Size = new System.Drawing.Size(203, 17); label_error.TabIndex = 18; label_error.Text = "One of the values below is invalid"; label_error.Visible = false; @@ -629,7 +631,7 @@ private void InitializeComponent() comboBox_size.Items.AddRange(new object[] { "1x1 Tiles", "2x2 Tiles", "4x4 Tiles", "8x8 Tiles", "2x1 Tiles", "4x1 Tiles", "4x2 Tiles", "8x4 Tiles", "1x2 Tiles", "1x4 Tiles", "2x4 Tiles", "4x8 Tiles" }); comboBox_size.Location = new System.Drawing.Point(68, 151); comboBox_size.Name = "comboBox_size"; - comboBox_size.Size = new System.Drawing.Size(70, 23); + comboBox_size.Size = new System.Drawing.Size(70, 25); comboBox_size.TabIndex = 17; comboBox_size.SelectedIndexChanged += controlElements_changeMade; // @@ -640,7 +642,7 @@ private void InitializeComponent() comboBox_palette.Items.AddRange(new object[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" }); comboBox_palette.Location = new System.Drawing.Point(68, 64); comboBox_palette.Name = "comboBox_palette"; - comboBox_palette.Size = new System.Drawing.Size(70, 23); + comboBox_palette.Size = new System.Drawing.Size(70, 25); comboBox_palette.TabIndex = 16; comboBox_palette.SelectedIndexChanged += controlElements_changeMade; // @@ -649,7 +651,7 @@ private void InitializeComponent() label_size.AutoSize = true; label_size.Location = new System.Drawing.Point(4, 154); label_size.Name = "label_size"; - label_size.Size = new System.Drawing.Size(30, 15); + label_size.Size = new System.Drawing.Size(34, 17); label_size.TabIndex = 15; label_size.Text = "Size:"; // @@ -679,7 +681,7 @@ private void InitializeComponent() label_palette.AutoSize = true; label_palette.Location = new System.Drawing.Point(4, 67); label_palette.Name = "label_palette"; - label_palette.Size = new System.Drawing.Size(46, 15); + label_palette.Size = new System.Drawing.Size(50, 17); label_palette.TabIndex = 10; label_palette.Text = "Palette:"; // @@ -688,7 +690,7 @@ private void InitializeComponent() label_tile.AutoSize = true; label_tile.Location = new System.Drawing.Point(4, 39); label_tile.Name = "label_tile"; - label_tile.Size = new System.Drawing.Size(28, 15); + label_tile.Size = new System.Drawing.Size(31, 17); label_tile.TabIndex = 9; label_tile.Text = "Tile:"; // @@ -697,7 +699,7 @@ private void InitializeComponent() checkBox_yFlip.AutoSize = true; checkBox_yFlip.Location = new System.Drawing.Point(146, 123); checkBox_yFlip.Name = "checkBox_yFlip"; - checkBox_yFlip.Size = new System.Drawing.Size(72, 19); + checkBox_yFlip.Size = new System.Drawing.Size(77, 21); checkBox_yFlip.TabIndex = 5; checkBox_yFlip.Text = "Flip on Y"; checkBox_yFlip.UseVisualStyleBackColor = true; @@ -708,7 +710,7 @@ private void InitializeComponent() checkBox_xFlip.AutoSize = true; checkBox_xFlip.Location = new System.Drawing.Point(146, 94); checkBox_xFlip.Name = "checkBox_xFlip"; - checkBox_xFlip.Size = new System.Drawing.Size(72, 19); + checkBox_xFlip.Size = new System.Drawing.Size(78, 21); checkBox_xFlip.TabIndex = 3; checkBox_xFlip.Text = "Flip on X"; checkBox_xFlip.UseVisualStyleBackColor = true; @@ -761,7 +763,7 @@ private void InitializeComponent() label_y.AutoSize = true; label_y.Location = new System.Drawing.Point(4, 124); label_y.Name = "label_y"; - label_y.Size = new System.Drawing.Size(17, 15); + label_y.Size = new System.Drawing.Size(18, 17); label_y.TabIndex = 1; label_y.Text = "Y:"; // @@ -770,7 +772,7 @@ private void InitializeComponent() label_x.AutoSize = true; label_x.Location = new System.Drawing.Point(4, 95); label_x.Name = "label_x"; - label_x.Size = new System.Drawing.Size(17, 15); + label_x.Size = new System.Drawing.Size(19, 17); label_x.TabIndex = 0; label_x.Text = "X:"; // @@ -781,7 +783,7 @@ private void InitializeComponent() panel_partControl.Controls.Add(button_removePart); panel_partControl.Controls.Add(button_addPart); panel_partControl.Dock = System.Windows.Forms.DockStyle.Top; - panel_partControl.Location = new System.Drawing.Point(4, 19); + panel_partControl.Location = new System.Drawing.Point(4, 21); panel_partControl.Name = "panel_partControl"; panel_partControl.Size = new System.Drawing.Size(242, 29); panel_partControl.TabIndex = 12; @@ -792,7 +794,7 @@ private void InitializeComponent() comboBox_part.FormattingEnabled = true; comboBox_part.Location = new System.Drawing.Point(68, 3); comboBox_part.Name = "comboBox_part"; - comboBox_part.Size = new System.Drawing.Size(70, 23); + comboBox_part.Size = new System.Drawing.Size(70, 25); comboBox_part.TabIndex = 0; comboBox_part.SelectedIndexChanged += comboBox_part_SelectedIndexChanged; // @@ -801,7 +803,7 @@ private void InitializeComponent() label_part.AutoSize = true; label_part.Location = new System.Drawing.Point(4, 6); label_part.Name = "label_part"; - label_part.Size = new System.Drawing.Size(31, 15); + label_part.Size = new System.Drawing.Size(34, 17); label_part.TabIndex = 10; label_part.Text = "Part:"; // @@ -834,7 +836,7 @@ private void InitializeComponent() groupBox_oamDisplay.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); groupBox_oamDisplay.Name = "groupBox_oamDisplay"; groupBox_oamDisplay.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3); - groupBox_oamDisplay.Size = new System.Drawing.Size(828, 422); + groupBox_oamDisplay.Size = new System.Drawing.Size(828, 359); groupBox_oamDisplay.TabIndex = 4; groupBox_oamDisplay.TabStop = false; groupBox_oamDisplay.Text = "OAM Frame"; @@ -844,10 +846,10 @@ private void InitializeComponent() panel_oam.AutoScroll = true; panel_oam.Controls.Add(oamView_oam); panel_oam.Dock = System.Windows.Forms.DockStyle.Fill; - panel_oam.Location = new System.Drawing.Point(4, 44); + panel_oam.Location = new System.Drawing.Point(4, 46); panel_oam.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); panel_oam.Name = "panel_oam"; - panel_oam.Size = new System.Drawing.Size(820, 375); + panel_oam.Size = new System.Drawing.Size(820, 310); panel_oam.TabIndex = 0; // // oamView_oam @@ -865,6 +867,7 @@ private void InitializeComponent() oamView_oam.TabStop = false; oamView_oam.Tag = "unthemed"; oamView_oam.Text = "tileDisplay1"; + oamView_oam.TileGridOrigin = new System.Drawing.Point(0, 0); oamView_oam.TileImage = null; oamView_oam.TileSize = 16; oamView_oam.Zoom = 0; @@ -877,7 +880,7 @@ private void InitializeComponent() // toolStrip2.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { button_viewOrigin, button_viewOutline, toolStripSeparator2, button_oamZoomIn, button_oamZoomOut, label_oamZoom }); - toolStrip2.Location = new System.Drawing.Point(4, 19); + toolStrip2.Location = new System.Drawing.Point(4, 21); toolStrip2.Name = "toolStrip2"; toolStrip2.Size = new System.Drawing.Size(820, 25); toolStrip2.TabIndex = 0; @@ -931,7 +934,7 @@ private void InitializeComponent() // label_oamZoom // label_oamZoom.Name = "label_oamZoom"; - label_oamZoom.Size = new System.Drawing.Size(35, 22); + label_oamZoom.Size = new System.Drawing.Size(40, 22); label_oamZoom.Text = "100%"; // // splitContainer_views @@ -952,7 +955,7 @@ private void InitializeComponent() // splitContainer_views.Panel2.Controls.Add(groupBox_oamDisplay); splitContainer_views.Panel2.Padding = new System.Windows.Forms.Padding(3, 3, 3, 6); - splitContainer_views.Size = new System.Drawing.Size(834, 741); + splitContainer_views.Size = new System.Drawing.Size(834, 678); splitContainer_views.SplitterDistance = 307; splitContainer_views.SplitterWidth = 3; splitContainer_views.TabIndex = 6; @@ -992,9 +995,12 @@ private void InitializeComponent() paletteView.TabIndex = 0; paletteView.TabStop = false; paletteView.Text = "tileDisplay1"; + paletteView.TileGridOrigin = new System.Drawing.Point(0, 0); paletteView.TileImage = null; - paletteView.TileSize = 16; + paletteView.TileSize = 17; paletteView.Zoom = 0; + paletteView.TileMouseDown += paletteView_TileMouseDown; + paletteView.TileMouseMove += paletteView_TileMouseMove; // // splitContainer_controls // @@ -1014,48 +1020,55 @@ private void InitializeComponent() // splitContainer_controls.Panel2 // splitContainer_controls.Panel2.Controls.Add(splitContainer_views); - splitContainer_controls.Size = new System.Drawing.Size(1097, 741); + splitContainer_controls.Size = new System.Drawing.Size(1097, 678); splitContainer_controls.SplitterDistance = 259; splitContainer_controls.TabIndex = 7; // // statusStrip1 // statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { label_Status, label_spring, button_import, button_export, button_save }); - statusStrip1.Location = new System.Drawing.Point(0, 741); + statusStrip1.Location = new System.Drawing.Point(0, 678); statusStrip1.Name = "statusStrip1"; - statusStrip1.Size = new System.Drawing.Size(1097, 22); + statusStrip1.Size = new System.Drawing.Size(1097, 23); statusStrip1.TabIndex = 8; statusStrip1.Text = "statusStrip1"; // // label_Status // label_Status.Name = "label_Status"; - label_Status.Size = new System.Drawing.Size(12, 17); + label_Status.Size = new System.Drawing.Size(13, 18); label_Status.Text = "-"; // // label_spring // label_spring.Name = "label_spring"; - label_spring.Size = new System.Drawing.Size(902, 17); + label_spring.Size = new System.Drawing.Size(889, 18); label_spring.Spring = true; // // button_import // button_import.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - button_import.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { button_importOam }); + button_import.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { button_importOam, button_importAssembly }); button_import.Image = (System.Drawing.Image)resources.GetObject("button_import.Image"); button_import.ImageTransparentColor = System.Drawing.Color.Magenta; button_import.Name = "button_import"; - button_import.Size = new System.Drawing.Size(56, 20); + button_import.Size = new System.Drawing.Size(60, 21); button_import.Text = "Import"; // // button_importOam // button_importOam.Name = "button_importOam"; - button_importOam.Size = new System.Drawing.Size(111, 22); + button_importOam.Size = new System.Drawing.Size(140, 22); button_importOam.Text = "OAM..."; button_importOam.Click += button_importOam_Click; // + // button_importAssembly + // + button_importAssembly.Name = "button_importAssembly"; + button_importAssembly.Size = new System.Drawing.Size(140, 22); + button_importAssembly.Text = "Assembly..."; + button_importAssembly.Click += button_importAssembly_Click; + // // button_export // button_export.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; @@ -1063,27 +1076,27 @@ private void InitializeComponent() button_export.Image = (System.Drawing.Image)resources.GetObject("button_export.Image"); button_export.ImageTransparentColor = System.Drawing.Color.Magenta; button_export.Name = "button_export"; - button_export.Size = new System.Drawing.Size(54, 20); + button_export.Size = new System.Drawing.Size(59, 21); button_export.Text = "Export"; // // button_exportAnimation // button_exportAnimation.Name = "button_exportAnimation"; - button_exportAnimation.Size = new System.Drawing.Size(139, 22); + button_exportAnimation.Size = new System.Drawing.Size(143, 22); button_exportAnimation.Text = "Animation..."; button_exportAnimation.Click += button_exportAnimation_Click; // // button_exportAssembly // button_exportAssembly.Name = "button_exportAssembly"; - button_exportAssembly.Size = new System.Drawing.Size(139, 22); + button_exportAssembly.Size = new System.Drawing.Size(143, 22); button_exportAssembly.Text = "Assembly..."; button_exportAssembly.Click += button_exportAssembly_Click; // // button_exportOam // button_exportOam.Name = "button_exportOam"; - button_exportOam.Size = new System.Drawing.Size(139, 22); + button_exportOam.Size = new System.Drawing.Size(143, 22); button_exportOam.Text = "OAM..."; button_exportOam.Click += button_exportOam_Click; // @@ -1094,7 +1107,7 @@ private void InitializeComponent() button_save.ImageTransparentColor = System.Drawing.Color.Magenta; button_save.Name = "button_save"; button_save.ShowDropDownArrow = false; - button_save.Size = new System.Drawing.Size(58, 20); + button_save.Size = new System.Drawing.Size(61, 21); button_save.Text = "Apply"; button_save.Click += button_save_Click; // @@ -1102,14 +1115,14 @@ private void InitializeComponent() // contextMenu_oam.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { button_toFront, button_layerUp, button_layerDown, button_toBack, toolStripSeparator3, button_removePartCtx }); contextMenu_oam.Name = "contextMenu_oam"; - contextMenu_oam.Size = new System.Drawing.Size(164, 120); + contextMenu_oam.Size = new System.Drawing.Size(176, 120); contextMenu_oam.Opening += contextMenu_oam_Opening; // // button_toFront // button_toFront.Image = (System.Drawing.Image)resources.GetObject("button_toFront.Image"); button_toFront.Name = "button_toFront"; - button_toFront.Size = new System.Drawing.Size(163, 22); + button_toFront.Size = new System.Drawing.Size(175, 22); button_toFront.Text = "Bring to Front"; button_toFront.Click += button_toFront_Click; // @@ -1117,7 +1130,7 @@ private void InitializeComponent() // button_layerUp.Image = (System.Drawing.Image)resources.GetObject("button_layerUp.Image"); button_layerUp.Name = "button_layerUp"; - button_layerUp.Size = new System.Drawing.Size(163, 22); + button_layerUp.Size = new System.Drawing.Size(175, 22); button_layerUp.Text = "Move forwards"; button_layerUp.Click += button_layerUp_Click; // @@ -1125,7 +1138,7 @@ private void InitializeComponent() // button_layerDown.Image = (System.Drawing.Image)resources.GetObject("button_layerDown.Image"); button_layerDown.Name = "button_layerDown"; - button_layerDown.Size = new System.Drawing.Size(163, 22); + button_layerDown.Size = new System.Drawing.Size(175, 22); button_layerDown.Text = "Move backwards"; button_layerDown.Click += button_layerDown_Click; // @@ -1133,20 +1146,20 @@ private void InitializeComponent() // button_toBack.Image = (System.Drawing.Image)resources.GetObject("button_toBack.Image"); button_toBack.Name = "button_toBack"; - button_toBack.Size = new System.Drawing.Size(163, 22); + button_toBack.Size = new System.Drawing.Size(175, 22); button_toBack.Text = "Send to Back"; button_toBack.Click += button_toBack_Click; // // toolStripSeparator3 // toolStripSeparator3.Name = "toolStripSeparator3"; - toolStripSeparator3.Size = new System.Drawing.Size(160, 6); + toolStripSeparator3.Size = new System.Drawing.Size(172, 6); // // button_removePartCtx // button_removePartCtx.Image = Properties.Resources.delete; button_removePartCtx.Name = "button_removePartCtx"; - button_removePartCtx.Size = new System.Drawing.Size(163, 22); + button_removePartCtx.Size = new System.Drawing.Size(175, 22); button_removePartCtx.Text = "Delete"; button_removePartCtx.Click += button_removePart_Click; // @@ -1154,26 +1167,26 @@ private void InitializeComponent() // contextMenu_oamNoSelection.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { button_addPartHere }); contextMenu_oamNoSelection.Name = "contextMenu_oamNoSelection"; - contextMenu_oamNoSelection.Size = new System.Drawing.Size(146, 26); + contextMenu_oamNoSelection.Size = new System.Drawing.Size(155, 26); // // button_addPartHere // button_addPartHere.Image = Properties.Resources.toolbar_add; button_addPartHere.Name = "button_addPartHere"; - button_addPartHere.Size = new System.Drawing.Size(145, 22); + button_addPartHere.Size = new System.Drawing.Size(154, 22); button_addPartHere.Text = "Add new Part"; button_addPartHere.Click += button_addPartHere_Click; // // FormOam // AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - ClientSize = new System.Drawing.Size(1097, 763); + ClientSize = new System.Drawing.Size(1097, 701); Controls.Add(splitContainer_controls); Controls.Add(statusStrip1); Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon"); KeyPreview = true; Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - MinimumSize = new System.Drawing.Size(822, 802); + MinimumSize = new System.Drawing.Size(822, 670); Name = "FormOam"; Text = "OAM Editor"; FormClosing += FormOam_FormClosing; @@ -1308,5 +1321,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem button_importOam; private System.Windows.Forms.ToolStripMenuItem button_exportAssembly; private System.Windows.Forms.ToolStripButton button_loadCommonGraphics; + private System.Windows.Forms.ToolStripMenuItem button_importAssembly; } } \ No newline at end of file diff --git a/mage/Editors/FormOam.cs b/mage/Editors/FormOam.cs index 9fb18ff..585dd31 100644 --- a/mage/Editors/FormOam.cs +++ b/mage/Editors/FormOam.cs @@ -1,22 +1,23 @@ -using mage.Properties; +using mage.Bookmarks; +using mage.Controls; +using mage.Properties; using mage.Theming; +using mage.Utility; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Drawing.Drawing2D; using System.Drawing.Imaging; +using System.Drawing.Text; using System.IO; using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; using System.Text; -using System.Windows.Forms; -using mage.Controls; -using mage.Utility; -using System.Drawing.Drawing2D; -using System.Drawing.Text; using System.Text.Json; -using System.Runtime.InteropServices; -using mage.Bookmarks; +using System.Windows.Forms; namespace mage; @@ -52,6 +53,8 @@ public partial class FormOam : Form Drawable hoveredDrawable; Drawable gfxSelection; Drawable gfxCursor; + private Drawable PaletteCursor; + private Drawable PaletteSelection; // Data for saving int originalOamOffset; @@ -155,6 +158,7 @@ private bool LoadCommonGraphics get => loadCommonGraphics; set { + bool old = loadCommonGraphics == value; loadCommonGraphics = value; Program.Config.OamEditorLoadCommonGraphics = value; button_loadCommonGraphics.Checked = value; @@ -164,6 +168,10 @@ private bool LoadCommonGraphics DrawNewGFX(); LoadPalette(0); } + + if (old) return; + SelectedPaletteRow = Math.Clamp(SelectedPaletteRow + (value == true ? 8 : -8), 0, 15); + } } private bool loadCommonGraphics = true; @@ -190,6 +198,18 @@ private int SelectedPaletteRow set { selectedPaletteRow = value; + if (value == -1) + { + PaletteSelection.Visible = false; + return; + } + + PaletteSelection.Visible = true; + PaletteSelection.Rectangle = new Rectangle(0, value * 17, 16 * 16 + 17, 17); + if (!loading) + { + DrawImage(); + } } } private int selectedPaletteRow = 8; @@ -231,8 +251,6 @@ public FormOam(FormMain main, int gfxOffset, int palOffset, int oamOffset, bool loading = true; - LoadCommonGraphics = true; // We don't want to draw/reload graphics during initalization so this must come after `loading = true` - textBox_imageOffset.Text = Hex.ToString(gfxOffset); textBox_palOffset.Text = Hex.ToString(palOffset); textBox_oamOffset.Text = Hex.ToString(oamOffset); @@ -254,6 +272,15 @@ public FormOam(FormMain main, int gfxOffset, int palOffset, int oamOffset, bool gfxView_gfx.AddDrawable(gfxSelection); gfxView_gfx.AddDrawable(gfxCursor); + //Palette Drawables + PaletteCursor = new Drawable(Rectangle.Empty, CursorPen, 1) { Visible = true }; + PaletteSelection = new Drawable(Rectangle.Empty, SelectionPenWhite, 1) { Visible = true }; + PaletteSelection.DrawPens.Add(SelectionPenBlack); + paletteView.AddDrawable(PaletteCursor); + paletteView.AddDrawable(PaletteSelection); + + LoadCommonGraphics = true; // We don't want to draw/reload graphics during initalization so this must come after `loading = true` + Status = new Status(label_Status, button_save); loading = false; @@ -488,9 +515,10 @@ private void DrawNewGFX() private void DrawImage() { - if (!ViewVram) gfxImage = gfxObject.Draw4bpp(palette, 0, true); - else if (ViewVram && !LoadCommonGraphics) gfxImage = gfxObject.Draw4bpp(palette, 0, true); // A weird edge-case where this condition would render a blank Vram Viewer - else gfxImage = vram.VramGFX.Draw15bpp(vram.palette, selectedPaletteRow, true); + if (!ViewVram && LoadCommonGraphics) gfxImage = gfxObject.Draw4bpp(vram.palette, SelectedPaletteRow, true); + else if (!ViewVram && !LoadCommonGraphics) gfxImage = gfxObject.Draw4bpp(vram.palette, SelectedPaletteRow, true); + else if (ViewVram && !LoadCommonGraphics) gfxImage = gfxObject.Draw4bpp(vram.palette, SelectedPaletteRow, true); // A weird edge-case where this condition would render a blank Vram Viewer + else gfxImage = vram.VramGFX.Draw15bpp(vram.palette, SelectedPaletteRow, true); gfxView_gfx.TileImage = gfxImage; } @@ -621,6 +649,8 @@ private void button_editPal_Click(object sender, EventArgs e) + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } + + #endregion #region OAM @@ -1303,7 +1333,7 @@ private void button_exportOam_Click(object sender, EventArgs e) return; } - File.WriteAllText(saveOAM.FileName, oam.Serialize()); + File.WriteAllText(saveOAM.FileName, OamSerializer.Serialize(oam)); } private void button_exportAssembly_Click(object sender, EventArgs e) @@ -1318,7 +1348,7 @@ private void button_exportAssembly_Click(object sender, EventArgs e) } string animationName = Path.GetFileName(saveASM.FileName); animationName = Path.GetFileNameWithoutExtension(animationName); - File.WriteAllText(saveASM.FileName, oam.ToASM(animationName)); + File.WriteAllText(saveASM.FileName, OamSerializer.ToASM(oam, animationName)); } void button_importOam_Click(object sender, EventArgs e) @@ -1333,12 +1363,49 @@ void button_importOam_Click(object sender, EventArgs e) } string json = File.ReadAllText(openOAM.FileName); - OAM? imported = OAM.Deserialize(json); + OAM? imported = OamSerializer.Deserialize(json); + if (imported == null) return; + + oam = imported; + Save(); + SetOAM(); + } + + private void button_importAssembly_Click(object sender, EventArgs e) + { + OpenFileDialog openASM = new OpenFileDialog(); + openASM.Filter = "Assembly files (*.asm)|*.asm"; + if (openASM.ShowDialog() != DialogResult.OK) return; + if (oam == null) + { + MessageBox.Show("No OAM loaded. Please load the OAM that you want to replace.", "OAM Required", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + + string assembly = File.ReadAllText(openASM.FileName); + OAM? imported = OamSerializer.FromASM(assembly); if (imported == null) return; oam = imported; Save(); SetOAM(); + } + #endregion + + private void paletteView_TileMouseMove(object sender, mage.Controls.TileDisplay.TileDisplayArgs e) + { + if (PaletteCursor.Y == e.TilePixelPosition.Y) return; + PaletteCursor.Visible = true; + PaletteCursor.Rectangle = new Rectangle(0, Math.Min(e.TilePixelPosition.Y, 17 * 15), 16 * 16 + 17, 17); + + } + + private void paletteView_TileMouseDown(object sender, mage.Controls.TileDisplay.TileDisplayArgs e) + { + PaletteCursor.Visible = false; + SelectedPaletteRow = e.TilePixelPosition.Y / 17; + + } } diff --git a/mage/Editors/FormOam.resx b/mage/Editors/FormOam.resx index a245d25..3d3ddef 100644 --- a/mage/Editors/FormOam.resx +++ b/mage/Editors/FormOam.resx @@ -127,37 +127,37 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFpSURBVDhPxZJrS8JwFMb9Zn2GkZREdKGwIGnqUNiMQEIK - ohARl92Mksa8REYRFmVgL7qRJAld/ABBb3rhOzdPO+efcyUE2oseeBgc9vzOw9lsfxbnVqeWstVaQKmC - tGs4+QLi9hP4tyrg23wEYaMM3tUSuOP3wMduwRW9Bil2WcMcAUKZgh7Jv0Gn7gkXdALg5m7sXLwAAkjJ - V+hGY/NnDCDuPNMgWGwZxeecplErpZZRI6GTL4BxMBQGE+XvgHgpTM9Go0HBrLGrCRgKHjMAXhv1WwNd - 19saDM4eMQB+qp/CjU1j2GpN0+idgZkDBhDWH2hg3YhBkO2mMfhRmTCNckj7DMDLdzTAYKIsm5UpnBLo - iVsp+L5mAuy+DANMR29oYG1ANS0N6vV6W4NeIcUArsgVDToV51UZgPMo6uRykf6s8YVzGA2dwvBc3rjy - IR3KEchBv7gHff6sUTttbFaB86AVlQD/LJvtE6Ttd0n4eM6yAAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFmSURBVDhPxZJbSwJRFIX9Z/2GQSkJ6UJhQZKXQcExBAkp + iEJENLsZJsl4iYwiLMrAHrqRJAla8wOCXnrwTccde588Tg09aA8tWBzYzPr24pwxGP4qwSHPreaVpi+t + gLSvgJR6AW+yDp7dGrh3nkHcroJrowKO+CPYo/dgi9yCFL1uYo4AwVxJDRffoF8PhUoqAXDzILauXAEB + pNQrDKKppQs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mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj - CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN - AAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACNSURBVDhPY/j27dt/SjADiHByciILoxjw4f1HkjDJBjy/ + dfL/iW5TME2WASe6Tf4fqpUCG0KWARAXmBB2waSzr/4vuPQawwB0jNWArH0v/ksvfATGhAzBMABZMzGG + oBig07ASQzM2Q0Ds1hMvMQ1A14SOQRpBGMYHuZYkA7BhkKspMgCEqWcAJZiBUgAABzX8nOIkzeMAAAAA + SUVORK5CYII= iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACRSURBVDhPY/j27dt/SjDYACcnJ7IwigEf3n8kCZNswPNb - J/+f6DYF0yA+yQac6Db5f6hWCmwIiE+mC0wIu2DS2Vf/F1x6DefjwlgNyNr34r/0wkdgTMgQDAOQNRNj - CIoBOg0rMTTDMLIhIHbriZeYBmDTiIxBGkEYxge5liQDsGGQqykyAISpZwAlmIEywMAAAAc1/Jwvt6sN - AAAAAElFTkSuQmCC + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACNSURBVDhPY/j27dt/SjADiHByciILoxjw4f1HkjDJBjy/ + dfL/iW5TME2WASe6Tf4fqpUCG0KWARAXmBB2waSzr/4vuPQawwB0jNWArH0v/ksvfATGhAzBMABZMzGG + oBig07ASQzM2Q0Ds1hMvMQ1A14SOQRpBGMYHuZYkA7BhkKspMgCEqWcAJZiBUgAABzX8nOIkzeMAAAAA + SUVORK5CYII= @@ -216,53 +216,53 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U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QwDTINh0MO - aDQa1JsCsG37D/A/PAWoqorVywFWLgZYPrdpLgJgZUXfmyRZllF8/MT+PcHikRUHsKbb7TZvmpXVbDah - aRrq9ToUReFhSZKwV/ORu/UwX+jGAdGf9YqPs7dvlF6/cPwc8FMLdwS7VQ/ZGw/bVy5ms+/UmgJYK7s4 - eQlw+BTw6+Z/T925drFVcbBRHmBm06TWFAAr6eCBoFAjEB1YDLB0aiNf9ZGlp4oOLAZYKH7wkuZyXYgO - LAaISnRgiWEm0YElhplEB5YYZhIbmIQfuVdr5nioaPQAAAAASUVORK5CYII= + dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFXSURBVDhPjZLLSsNAAEXzrW4EcSG40IULXbgRH7TW + an27EKEUtbS+EReltCFJKZSG2prQJpMx+gdtE67MYCRjG5jFWQRyz8xcruL7PiilIITAcRz0+31YloVe + r4dOpwPTNNFqtQBAmYbieR7CMJxKEAScZrOZLHBdl/88Ho8FRqMRhwkMw0gWsCvHBVGQMRwOuUDTtGSB + bdt/gv/hSFCv17F6NcDK5QDLF7YgU1hZ8fdOo1qtIvf4if17isUjSxSwptvtNm+aldVoNKDrOlRVRa1W + 4+FKpYK9sod0kWA+2xUF8Y/1gofzt2+cvn7h+Nnnp2bvKHZLBKlbgu1rF7Op92TBWt7FyYuPwyefXzfz + e+rOjYutgoON/AAzm2aygJV08ECRLVPIDkwQLJ3ZyJQ8pIoEsgMTBAu5D17SXLoL2YEJgjiyA5sIRsgO + bCIYITuwiWCE7MB+ALlXa+bvsOERAAAAAElFTkSuQmCC diff --git a/mage/Theming/CustomControls/FlatTextBox.cs b/mage/Theming/CustomControls/FlatTextBox.cs index 937ec70..271d835 100644 --- a/mage/Theming/CustomControls/FlatTextBox.cs +++ b/mage/Theming/CustomControls/FlatTextBox.cs @@ -6,6 +6,7 @@ using System.DirectoryServices.ActiveDirectory; using System.Drawing; using System.Drawing.Drawing2D; +using System.Linq; using System.Runtime.Versioning; using System.Windows.Forms; @@ -91,6 +92,36 @@ public bool ValueBox if (valueBox) textBox.ContextMenuStrip = new ContextMenuStrip(); } } + + private bool hexSanitized = false; + [Browsable(true)] + [EditorBrowsable(EditorBrowsableState.Always)] + [Category("Behavior")] + [Description("Enables hex/decimal sanitization for this text box.")] + public bool HexSanitized + { + get => hexSanitized; + set + { + hexSanitized = value; + if (value) + { + textBox.KeyPress += textBoxKeyPress_HexSanitized; + textBox.TextChanged += textBoxTextChanged_HexSanitized; + } + else + { + textBox.KeyPress -= textBoxKeyPress_HexSanitized; + textBox.TextChanged -= textBoxTextChanged_HexSanitized; + } + } + } + [Browsable(true)] + [EditorBrowsable(EditorBrowsableState.Always)] + [Category("Behavior")] + [Description("Maximum allowed numeric value for sanitized input.")] + public int HexSanitizedMaxValue { get; set; } = -1; + #endregion #region events @@ -109,6 +140,92 @@ private void textBoxTextChanged(object sender, EventArgs e) { OnTextChanged?.Invoke(this, e); } + + + private void textBoxKeyPress_HexSanitized(object sender, KeyPressEventArgs e) + { //sanitize input to only allow hex characters, and convert lowercase to uppercase on the fly + char c = e.KeyChar; + + if (char.IsControl(c)) + return; + + if (char.IsDigit(c)) + return; + + if (c >= 'A' && c <= 'F') + return; + + if (c >= 'a' && c <= 'f') + { + e.KeyChar = char.ToUpper(c); + return; + } + + e.Handled = true; + } + + private bool _sanitizing = false; + + private void textBoxTextChanged_HexSanitized(object sender, EventArgs e) + { + if (_sanitizing) + return; + + _sanitizing = true; + + string raw = textBox.Text.ToUpper(); + + // Filter invalid characters + string filtered = new string(raw.Where(c => + char.IsDigit(c) || + (c >= 'A' && c <= 'F') + ).ToArray()); + + // If filtering changed the text, update it + if (filtered != raw) + { + int pos = textBox.SelectionStart; + textBox.Text = filtered; + textBox.SelectionStart = Math.Min(pos, textBox.Text.Length); + raw = filtered; + } + + if (raw.Length > 0) + { + bool containsHexLetters = raw.Any(c => c >= 'A' && c <= 'F'); + int value; + + if (Hex.radix == 10 && !containsHexLetters) + { + if (int.TryParse(raw, out value)) + { + if (HexSanitizedMaxValue >= 0 && value > HexSanitizedMaxValue) + { + value = HexSanitizedMaxValue; + textBox.Text = value.ToString("X"); + textBox.SelectionStart = textBox.Text.Length; + } + } + } + else + { + if (int.TryParse(raw, System.Globalization.NumberStyles.HexNumber, null, out value)) + { + if (value > HexSanitizedMaxValue) + { + value = HexSanitizedMaxValue; + textBox.Text = value.ToString("X"); + textBox.SelectionStart = textBox.Text.Length; + } + } + } + } + + _sanitizing = false; + + // Fire the public TextChanged event + OnTextChanged?.Invoke(this, e); + } #endregion public FlatTextBox() diff --git a/mage/Utility/Hex.cs b/mage/Utility/Hex.cs index 0d75246..a5025fc 100644 --- a/mage/Utility/Hex.cs +++ b/mage/Utility/Hex.cs @@ -1,4 +1,5 @@ -using System; +using NCalc; +using System; namespace mage { @@ -52,5 +53,11 @@ public static int ToInt(string text) { return Convert.ToInt32(text, radix); } + + public static int ToIntNcalc(string expression) + { + Expression ex = new Expression(expression); + return Convert.ToInt32(ex.Evaluate()); + } } } diff --git a/mage/Utility/OamSerializer.cs b/mage/Utility/OamSerializer.cs new file mode 100644 index 0000000..4732af4 --- /dev/null +++ b/mage/Utility/OamSerializer.cs @@ -0,0 +1,187 @@ +using NCalc; +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using System.Windows.Forms; +using static mage.OAM; + +namespace mage.Utility; + +public static class OamSerializer +{ + private static JsonSerializerOptions SerializerOptions { get; } = new() + { + IncludeFields = true, + WriteIndented = true, + }; + + public static string Serialize(OAM oam) => JsonSerializer.Serialize(oam, SerializerOptions); + + public static OAM? Deserialize(string json) + { + try + { + OAM? result = JsonSerializer.Deserialize(json, SerializerOptions); + return result; + } + catch (Exception e) + { + MessageBox.Show("File did not contain OAM Data or it was corrupted.", "Invalid OAM", MessageBoxButtons.OK, MessageBoxIcon.Error); + return null; + } + } + + public static string ToASM(OAM oam, string animationName = "oam") + { + StringBuilder sb = new StringBuilder(); + + sb.AppendLine(".align"); + sb.AppendLine($"OAM_{animationName}_Animation:"); + for (int i = 0; i < oam.NumFrames; i++) + { + Frame frame = oam.Frames[i]; + sb.AppendLine($"\t.dw @OAM_{animationName}_Frame{Hex.ToPrefixedPaddedString(i)}, {Hex.ToPrefixedPaddedString(frame.duration)}"); + } + sb.AppendLine("\t.dw 0,0"); + + sb.AppendLine(); + + for (int i = 0; i < oam.NumFrames; i++) + { + Frame frame = oam.Frames[i]; + sb.AppendLine($"@OAM_{animationName}_Frame{Hex.ToPrefixedPaddedString(i)}:"); + sb.AppendLine($"\t.dh {Hex.ToPrefixedPaddedString(frame.numParts)}"); + + foreach (Part p in frame.parts) + { + ushort[] attributes = p.GetAttributes(); + sb.AppendLine($"\t.dh {Hex.ToPrefixedPaddedString(attributes[0])},{Hex.ToPrefixedPaddedString(attributes[1])},{Hex.ToPrefixedPaddedString(attributes[2])}"); + } + sb.AppendLine(); + } + return sb.ToString(); + } + + + public static OAM? FromASM(string asmText) + { + var lines = new List(); + foreach (var raw in asmText.Split('\n')) + { + string cleaned = CleanLine(raw); + if (!string.IsNullOrWhiteSpace(cleaned)) + lines.Add(cleaned); + } + + // Parse frame table + var frameEntries = new List<(string label, int duration)>(); + + var frameRe = new Regex(@"\.dw\s+(@?[A-Za-z_]\w+)\s*,\s*(0x[0-9A-Fa-f]+|\d+)"); + + foreach (var line in lines) + { + var m = frameRe.Match(line); + if (m.Success) + { + string label = m.Groups[1].Value; + + int duration = Hex.ToIntNcalc(m.Groups[2].Value); + frameEntries.Add((label, duration)); + } + } + + var frames = new List(); + + foreach (var (label, duration) in frameEntries) + { + int idx = lines.FindIndex(l => l.StartsWith(label + ":")); + if (idx == -1) + continue; + + int numParts = Hex.ToIntNcalc(lines[idx + 1].Replace(".dh", "").Trim()); + + var parts = new List(); + for (int i = 0; i < numParts; i++) + { + var (y, x, t) = ParseDhTriplet(lines[idx + 2 + i]); + parts.Add(DecodeOam(y, x, t)); + } + + frames.Add(new Frame + { + duration = duration, + numParts = numParts, + parts = parts + }); + } + + return new OAM + { + NumFrames = frames.Count, + Frames = frames + }; + + + } + + private static Part DecodeOam(int y, int x, int tile) + { + int yPos = y & 0xFF; + if (yPos >= 128) + yPos -= 256; + + int shape = (y >> 14) & 0x3; + + int xPos = x & 0x1FF; + if (xPos >= 256) + xPos -= 512; + + int hflip = (x >> 12) & 1; + int size = (x >> 14) & 0x3; + + int tileNum = tile & 0x3FF; + int palRow = (tile >> 12) & 0xF; + + return new Part + { + xPos = xPos, + yPos = yPos, + shape = shape, + size = size, + flip = hflip, + tileNum = tileNum, + palRow = palRow + }; + } + + private static string CleanLine(string line) + { + int commentIndex = line.IndexOf(';'); + if (commentIndex >= 0) + line = line[..commentIndex]; + + line = line.Replace("halfword", "dh") + .Replace("word", "dw") + .Trim(); + + return line; + } + + private static (int, int, int) ParseDhTriplet(string line) + { + line = line.Replace(".dh", "").Trim(); + var parts = line.Split(','); + + if (parts.Length != 3) + throw new Exception($"Invalid .dh triplet: {line}"); + + int a = Hex.ToIntNcalc(parts[0].Trim()); + int b = Hex.ToIntNcalc(parts[1].Trim()); + int c = Hex.ToIntNcalc(parts[2].Trim()); + + return (a, b, c); + } + +} diff --git a/mage/mage.csproj b/mage/mage.csproj index 58ec0ea..da08ab5 100644 --- a/mage/mage.csproj +++ b/mage/mage.csproj @@ -1,4 +1,4 @@ - + net10.0-windows 1.14.1 @@ -42,6 +42,9 @@ + + Form + UserControl