commit
2be6d41d41
|
@ -11,6 +11,8 @@ namespace ScriptTool
|
||||||
{
|
{
|
||||||
private static int[] virtualWidths;
|
private static int[] virtualWidths;
|
||||||
private static int[] renderWidths;
|
private static int[] renderWidths;
|
||||||
|
private static int[] virtualWidthsSaturn;
|
||||||
|
private static int[] renderWidthsSaturn;
|
||||||
|
|
||||||
public IEnumerable<IControlCode> ControlCodes { get; set; }
|
public IEnumerable<IControlCode> ControlCodes { get; set; }
|
||||||
public Dictionary<string, int> AddressMap { get; set; }
|
public Dictionary<string, int> AddressMap { get; set; }
|
||||||
|
@ -19,13 +21,18 @@ namespace ScriptTool
|
||||||
static Compiler()
|
static Compiler()
|
||||||
{
|
{
|
||||||
byte[] widths = File.ReadAllBytes("m2-widths-main.bin");
|
byte[] widths = File.ReadAllBytes("m2-widths-main.bin");
|
||||||
|
byte[] saturnWidths = File.ReadAllBytes("m2-widths-saturn.bin");
|
||||||
virtualWidths = new int[widths.Length / 2];
|
virtualWidths = new int[widths.Length / 2];
|
||||||
renderWidths = 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)
|
for (int i = 0; i < widths.Length; i += 2)
|
||||||
{
|
{
|
||||||
virtualWidths[i / 2] = widths[i];
|
virtualWidths[i / 2] = widths[i];
|
||||||
renderWidths[i / 2] = widths[i + 1];
|
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();
|
var sb = new StringBuilder();
|
||||||
widths = new List<int>();
|
widths = new List<int>();
|
||||||
int currentWidth = 0;
|
int currentWidth = 0;
|
||||||
|
bool useSaturnWidths = false;
|
||||||
|
|
||||||
var strings = new List<string>();
|
var strings = new List<string>();
|
||||||
|
|
||||||
|
@ -382,15 +390,20 @@ namespace ScriptTool
|
||||||
case 0x11:
|
case 0x11:
|
||||||
case 0x12:
|
case 0x12:
|
||||||
case 0x15:
|
case 0x15:
|
||||||
case 0x1A:
|
|
||||||
case 0x2D:
|
case 0x2D:
|
||||||
case 0x9F:
|
case 0x9F:
|
||||||
case 0xAD:
|
case 0xAD:
|
||||||
// Name/item code
|
// Name code
|
||||||
sb.Append("[NAME]");
|
sb.Append("[NAME]");
|
||||||
currentWidth += 60;
|
currentWidth += 60;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x1A:
|
||||||
|
// Name (60/96) or item (80/??) or number (36/72).
|
||||||
|
sb.Append("[NAME]");
|
||||||
|
currentWidth += 80;
|
||||||
|
break;
|
||||||
|
|
||||||
case 0x0:
|
case 0x0:
|
||||||
case 0x1:
|
case 0x1:
|
||||||
case 0x2:
|
case 0x2:
|
||||||
|
@ -403,12 +416,12 @@ namespace ScriptTool
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x20:
|
case 0x20:
|
||||||
sb.Append("[SMAAASH]");
|
sb.Append("[SMAAAASH!!]");
|
||||||
currentWidth += 72;
|
currentWidth += 72;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x21:
|
case 0x21:
|
||||||
sb.Append("[YOU WIN]");
|
sb.Append("[YOU WON!]");
|
||||||
currentWidth += 72;
|
currentWidth += 72;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -432,11 +445,18 @@ namespace ScriptTool
|
||||||
currentWidth += 18;
|
currentWidth += 18;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1E:
|
|
||||||
case 0x1F:
|
case 0x1F:
|
||||||
sb.Append("_");
|
sb.Append("_");
|
||||||
currentWidth += 10;
|
currentWidth += 10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x7B:
|
||||||
|
useSaturnWidths = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x7C:
|
||||||
|
useSaturnWidths = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -458,7 +478,8 @@ namespace ScriptTool
|
||||||
if (!(str[i] == '\r') && !(str[i] == '\n'))
|
if (!(str[i] == '\r') && !(str[i] == '\n'))
|
||||||
{
|
{
|
||||||
sb.Append(str[i]);
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,9 @@
|
||||||
<None Include="m2-widths-main.bin">
|
<None Include="m2-widths-main.bin">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="m2-widths-saturn.bin">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -57,17 +57,17 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0xE,
|
"Identifier": 0xE,
|
||||||
"Description": "Paula's name (1C 02 02)",
|
"Description": "Paula's name (1C 02 02 or 1C 01 1E)",
|
||||||
"Length": 2
|
"Length": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0xF,
|
"Identifier": 0xF,
|
||||||
"Description": "Jeff's name (1C 02 03)",
|
"Description": "Jeff's name (1C 02 03 or 1C 01 34)",
|
||||||
"Length": 2
|
"Length": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0x10,
|
"Identifier": 0x10,
|
||||||
"Description": "Poo's name (1C 02 04)",
|
"Description": "Poo's name (1C 02 04 or 1C 01 4A)",
|
||||||
"Length": 2
|
"Length": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0x15,
|
"Identifier": 0x15,
|
||||||
"Description": "King's name (1C 02 07)",
|
"Description": "King's name (1C 02 07 or 1C 01 03)",
|
||||||
"Length": 2
|
"Length": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0x1A,
|
"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
|
"Length": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0x1C,
|
"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,
|
"Length": 8,
|
||||||
"HasReferences": true,
|
"HasReferences": true,
|
||||||
"ReferenceOffset": 4
|
"ReferenceOffset": 4
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0x22,
|
"Identifier": 0x22,
|
||||||
"Description": "Unknown",
|
"Description": "Wait with prompt, even in battle (14, sometimes used in place of 03)",
|
||||||
"Length": 2
|
"Length": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0x90,
|
"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
|
"Length": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -596,12 +596,12 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0xA9,
|
"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
|
"Length": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0xAA,
|
"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
|
"Length": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -753,7 +753,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Identifier": 0xC8,
|
"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
|
"Length": 4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
|
@ -303,6 +303,7 @@
|
||||||
this.ebString.Location = new System.Drawing.Point(3, 4);
|
this.ebString.Location = new System.Drawing.Point(3, 4);
|
||||||
this.ebString.Multiline = true;
|
this.ebString.Multiline = true;
|
||||||
this.ebString.Name = "ebString";
|
this.ebString.Name = "ebString";
|
||||||
|
this.ebString.ReadOnly = true;
|
||||||
this.ebString.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.ebString.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.ebString.Size = new System.Drawing.Size(786, 128);
|
this.ebString.Size = new System.Drawing.Size(786, 128);
|
||||||
this.ebString.TabIndex = 9;
|
this.ebString.TabIndex = 9;
|
||||||
|
@ -315,6 +316,7 @@
|
||||||
this.m12String.Location = new System.Drawing.Point(3, 138);
|
this.m12String.Location = new System.Drawing.Point(3, 138);
|
||||||
this.m12String.Multiline = true;
|
this.m12String.Multiline = true;
|
||||||
this.m12String.Name = "m12String";
|
this.m12String.Name = "m12String";
|
||||||
|
this.m12String.ReadOnly = true;
|
||||||
this.m12String.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
this.m12String.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.m12String.Size = new System.Drawing.Size(786, 128);
|
this.m12String.Size = new System.Drawing.Size(786, 128);
|
||||||
this.m12String.TabIndex = 10;
|
this.m12String.TabIndex = 10;
|
||||||
|
|
|
@ -365,7 +365,7 @@ namespace ScriptToolGui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m12String.BackColor = Color.White;
|
m12String.BackColor = SystemColors.Control;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,12 +459,12 @@ namespace ScriptToolGui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m12String.BackColor = Color.White;
|
m12String.BackColor = SystemColors.Control;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m12String.BackColor = Color.White;
|
m12String.BackColor = SystemColors.Control;
|
||||||
}
|
}
|
||||||
|
|
||||||
previousNavigationState = new ReferenceNavigationEntry(game, label);
|
previousNavigationState = new ReferenceNavigationEntry(game, label);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue