diff --git a/ScriptTool/ScriptTool/Compiler.cs b/ScriptTool/ScriptTool/Compiler.cs index c0b966a..2743593 100644 --- a/ScriptTool/ScriptTool/Compiler.cs +++ b/ScriptTool/ScriptTool/Compiler.cs @@ -11,6 +11,8 @@ namespace ScriptTool { private static int[] virtualWidths; private static int[] renderWidths; + private static int[] virtualWidthsSaturn; + private static int[] renderWidthsSaturn; public IEnumerable ControlCodes { get; set; } public Dictionary AddressMap { get; set; } @@ -19,13 +21,18 @@ namespace ScriptTool static Compiler() { byte[] widths = File.ReadAllBytes("m2-widths-main.bin"); + byte[] saturnWidths = File.ReadAllBytes("m2-widths-saturn.bin"); virtualWidths = new int[widths.Length / 2]; renderWidths = new int[widths.Length / 2]; + virtualWidthsSaturn = new int[saturnWidths.Length / 2]; + renderWidthsSaturn = new int[saturnWidths.Length / 2]; for (int i = 0; i < widths.Length; i += 2) { virtualWidths[i / 2] = widths[i]; renderWidths[i / 2] = widths[i + 1]; + virtualWidthsSaturn[i / 2] = saturnWidths[i]; + renderWidthsSaturn[i / 2] = saturnWidths[i + 1]; } } @@ -312,6 +319,7 @@ namespace ScriptTool var sb = new StringBuilder(); widths = new List(); int currentWidth = 0; + bool useSaturnWidths = false; var strings = new List(); @@ -382,15 +390,20 @@ namespace ScriptTool case 0x11: case 0x12: case 0x15: - case 0x1A: case 0x2D: case 0x9F: case 0xAD: - // Name/item code + // Name code sb.Append("[NAME]"); currentWidth += 60; break; + case 0x1A: + // Name (60/75) or item (80/??) or number (36/72). + sb.Append("[NAME]"); + currentWidth += 80; + break; + case 0x0: case 0x1: case 0x2: @@ -403,12 +416,12 @@ namespace ScriptTool break; case 0x20: - sb.Append("[SMAAASH]"); + sb.Append("[SMAAAASH!!]"); currentWidth += 72; break; case 0x21: - sb.Append("[YOU WIN]"); + sb.Append("[YOU WON!]"); currentWidth += 72; break; @@ -432,11 +445,18 @@ namespace ScriptTool currentWidth += 18; break; - case 0x1E: case 0x1F: sb.Append("_"); currentWidth += 10; break; + + case 0x7B: + useSaturnWidths = true; + break; + + case 0x7C: + useSaturnWidths = false; + break; } } } @@ -458,7 +478,8 @@ namespace ScriptTool if (!(str[i] == '\r') && !(str[i] == '\n')) { sb.Append(str[i]); - currentWidth += virtualWidths[GetByte(str[i], charLookup) - 0x50]; + int v = GetByte(str[i], charLookup) - 0x50; + currentWidth += useSaturnWidths ? virtualWidthsSaturn[v] : virtualWidths[v]; } i++; } diff --git a/ScriptTool/ScriptTool/ScriptTool.csproj b/ScriptTool/ScriptTool/ScriptTool.csproj index 4f58cb7..79cc5d2 100644 --- a/ScriptTool/ScriptTool/ScriptTool.csproj +++ b/ScriptTool/ScriptTool/ScriptTool.csproj @@ -90,6 +90,9 @@ Always + + Always + diff --git a/ScriptTool/ScriptTool/m12-codelist.json b/ScriptTool/ScriptTool/m12-codelist.json index 8ec1a1c..a2d7ba3 100644 --- a/ScriptTool/ScriptTool/m12-codelist.json +++ b/ScriptTool/ScriptTool/m12-codelist.json @@ -102,7 +102,7 @@ }, { "Identifier": 0x1A, - "Description": "Display string {0:X}? (Appears after 90 FF)", + "Description": "Display string in string slot as kind {0:X} (Appears after 90 FF)", "Length": 4 }, { @@ -144,7 +144,7 @@ }, { "Identifier": 0x22, - "Description": "Unknown", + "Description": "Wait with prompt, even in battle (14, sometimes used in place of 03)", "Length": 2 }, { @@ -463,7 +463,7 @@ }, { "Identifier": 0x90, - "Description": "Load character/item name {0:X} into memory (?)", + "Description": "Store {0:X} to string slot (for 1A FF printing). If 00, store argumentary memory to string slot.", "Length": 3 }, { @@ -596,12 +596,12 @@ }, { "Identifier": 0xA9, - "Description": "Unknown (1F EA, values don't match)", + "Description": "Apply 'cutscene' visual/sound FX associated with sprite {0:X}? (1F EA, values don't match)", "Length": 4 }, { "Identifier": 0xAA, - "Description": "Unknown (1F E7, values don't match)", + "Description": "Apply 'cutscene' visual/sound FX associated with A0 FF-generate sprite {0:X}? (1F E7, values don't match)", "Length": 4 }, { @@ -753,7 +753,7 @@ }, { "Identifier": 0xC8, - "Description": "Number selector with {0:X} digits (1F 52)", + "Description": "Number selector with {0:X} digits and {1:X} style (1F 52)", "Length": 4 }, { diff --git a/ScriptTool/ScriptTool/m2-widths-saturn.bin b/ScriptTool/ScriptTool/m2-widths-saturn.bin new file mode 100644 index 0000000..c838d6d Binary files /dev/null and b/ScriptTool/ScriptTool/m2-widths-saturn.bin differ diff --git a/ScriptTool/ScriptToolGui/MainForm.Designer.cs b/ScriptTool/ScriptToolGui/MainForm.Designer.cs index 1b2ae7b..232e313 100644 --- a/ScriptTool/ScriptToolGui/MainForm.Designer.cs +++ b/ScriptTool/ScriptToolGui/MainForm.Designer.cs @@ -303,6 +303,7 @@ this.ebString.Location = new System.Drawing.Point(3, 4); this.ebString.Multiline = true; this.ebString.Name = "ebString"; + this.ebString.ReadOnly = true; this.ebString.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.ebString.Size = new System.Drawing.Size(786, 128); this.ebString.TabIndex = 9; @@ -315,6 +316,7 @@ this.m12String.Location = new System.Drawing.Point(3, 138); this.m12String.Multiline = true; this.m12String.Name = "m12String"; + this.m12String.ReadOnly = true; this.m12String.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.m12String.Size = new System.Drawing.Size(786, 128); this.m12String.TabIndex = 10; diff --git a/ScriptTool/ScriptToolGui/MainForm.cs b/ScriptTool/ScriptToolGui/MainForm.cs index da346d9..dde2160 100644 --- a/ScriptTool/ScriptToolGui/MainForm.cs +++ b/ScriptTool/ScriptToolGui/MainForm.cs @@ -365,7 +365,7 @@ namespace ScriptToolGui } else { - m12String.BackColor = Color.White; + m12String.BackColor = SystemColors.Control; } } @@ -459,12 +459,12 @@ namespace ScriptToolGui } else { - m12String.BackColor = Color.White; + m12String.BackColor = SystemColors.Control; } } else { - m12String.BackColor = Color.White; + m12String.BackColor = SystemColors.Control; } previousNavigationState = new ReferenceNavigationEntry(game, label); diff --git a/m2-widths-saturn.bin b/m2-widths-saturn.bin new file mode 100644 index 0000000..c838d6d Binary files /dev/null and b/m2-widths-saturn.bin differ