From 3cad812d113fee9034e7e2f331856c77b66e678c Mon Sep 17 00:00:00 2001 From: PhoenixBound Date: Tue, 3 Apr 2018 23:28:38 -0500 Subject: [PATCH 1/2] A few ScriptTool/Gui changes - Gui Window: EB and M12JP windows are read-only - Updated some control code documentation - Added a little clarification to some control code widths - Added some Saturn font width support to the tool. --- ScriptTool/ScriptTool/Compiler.cs | 33 ++++++++++++++---- ScriptTool/ScriptTool/ScriptTool.csproj | 3 ++ ScriptTool/ScriptTool/m12-codelist.json | 12 +++---- ScriptTool/ScriptTool/m2-widths-saturn.bin | Bin 0 -> 192 bytes ScriptTool/ScriptToolGui/MainForm.Designer.cs | 2 ++ ScriptTool/ScriptToolGui/MainForm.cs | 6 ++-- m2-widths-saturn.bin | Bin 0 -> 192 bytes 7 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 ScriptTool/ScriptTool/m2-widths-saturn.bin create mode 100644 m2-widths-saturn.bin 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 0000000000000000000000000000000000000000..c838d6dc24086baceafa4936afee80552d31452a GIT binary patch literal 192 zcmbV@i46lm2m?>b@)+}^|7yct3DL-auq}@%U>c}|i|Dc+H+8!^$w($vmwVInx{Jf( oVCS340At2&h5?_BZM}-XCfDsE;bd1=(yib@)+}^|7yct3DL-auq}@%U>c}|i|Dc+H+8!^$w($vmwVInx{Jf( oVCS340At2&h5?_BZM}-XCfDsE;bd1=(yi Date: Tue, 3 Apr 2018 23:53:57 -0500 Subject: [PATCH 2/2] Typo --- ScriptTool/ScriptTool/Compiler.cs | 2 +- ScriptTool/ScriptTool/m12-codelist.json | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ScriptTool/ScriptTool/Compiler.cs b/ScriptTool/ScriptTool/Compiler.cs index 2743593..1e80e51 100644 --- a/ScriptTool/ScriptTool/Compiler.cs +++ b/ScriptTool/ScriptTool/Compiler.cs @@ -399,7 +399,7 @@ namespace ScriptTool break; case 0x1A: - // Name (60/75) or item (80/??) or number (36/72). + // Name (60/96) or item (80/??) or number (36/72). sb.Append("[NAME]"); currentWidth += 80; break; diff --git a/ScriptTool/ScriptTool/m12-codelist.json b/ScriptTool/ScriptTool/m12-codelist.json index a2d7ba3..06679a9 100644 --- a/ScriptTool/ScriptTool/m12-codelist.json +++ b/ScriptTool/ScriptTool/m12-codelist.json @@ -57,17 +57,17 @@ }, { "Identifier": 0xE, - "Description": "Paula's name (1C 02 02)", + "Description": "Paula's name (1C 02 02 or 1C 01 1E)", "Length": 2 }, { "Identifier": 0xF, - "Description": "Jeff's name (1C 02 03)", + "Description": "Jeff's name (1C 02 03 or 1C 01 34)", "Length": 2 }, { "Identifier": 0x10, - "Description": "Poo's name (1C 02 04)", + "Description": "Poo's name (1C 02 04 or 1C 01 4A)", "Length": 2 }, { @@ -87,7 +87,7 @@ }, { "Identifier": 0x15, - "Description": "King's name (1C 02 07)", + "Description": "King's name (1C 02 07 or 1C 01 03)", "Length": 2 }, { @@ -112,7 +112,7 @@ }, { "Identifier": 0x1C, - "Description": "If flag {0:X} is set, jump to offset {1:X} and return (06)", + "Description": "If flag {0:X} is set, jump to offset {1:X} and don't return (06)", "Length": 8, "HasReferences": true, "ReferenceOffset": 4