From 0e9a8d837320a8e6bc274e122dc08a7b4bfbcc71 Mon Sep 17 00:00:00 2001 From: William Fowler Date: Thu, 2 Jan 2025 04:34:43 -0700 Subject: [PATCH] Validator: More robust detection of missing @ terminators. Small adjustments to satisfy new validator requirements. --- data/text/battle.asm | 2 +- data/text/common_1.asm | 2 +- data/text/common_3.asm | 2 +- tools/PokeGen2TextValidator.cs | 42 +++++++++++++++++----------------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/data/text/battle.asm b/data/text/battle.asm index cd9a60c79b..189e827e67 100644 --- a/data/text/battle.asm +++ b/data/text/battle.asm @@ -955,7 +955,7 @@ ProtectedByText: MirrorMoveFailedText: text "De SPIEGELAANVAL" ; "The MIRROR MOVE" - next "mislukte!" ; "failed!" + line "mislukte!" ; "failed!" prompt StoleText: diff --git a/data/text/common_1.asm b/data/text/common_1.asm index 65d3bfc6ab..58d935250a 100644 --- a/data/text/common_1.asm +++ b/data/text/common_1.asm @@ -139,7 +139,7 @@ _FourZerosInvalidText:: _EnterPasscodeText:: text "Voer de CIJFERCODE" ; "Enter the CARD" - next "in van KAARTMAP." ; "FOLDER PASSCODE." + line "in van KAARTMAP." ; "FOLDER PASSCODE." done _IncorrectPasscodeText:: diff --git a/data/text/common_3.asm b/data/text/common_3.asm index 2b718f6a11..d8fd7ed4da 100644 --- a/data/text/common_3.asm +++ b/data/text/common_3.asm @@ -953,7 +953,7 @@ _LearnedMoveText:: _MoveAskForgetText:: text "Welke aanval wordt" ; "Which move should" - next "vergeten?" ; "be forgotten?" + line "vergeten?" ; "be forgotten?" done _StopLearningMoveText:: diff --git a/tools/PokeGen2TextValidator.cs b/tools/PokeGen2TextValidator.cs index fd77de1687..b593e672b2 100644 --- a/tools/PokeGen2TextValidator.cs +++ b/tools/PokeGen2TextValidator.cs @@ -977,7 +977,7 @@ internal class Validator public const int MaxLandmarkLineLength = 11; public const int MaxLandmarkLength = 17; - public const string PrintableChars = "“”·… ′″ABCDEFGHIJKLMNOPQRSTUVWXYZ():;[]abcdefghijklmnopqrstuvwxyzàèùßçÄÖÜäöüëïâôûêîÏË←ÈÉ'-+?!.&é→▷▶▼♂¥×/,♀0123456789┌─┐│└─┘"; + public const string PrintableChars = "“”·… ′″ABCDEFGHIJKLMNOPQRSTUVWXYZ():;[]abcdefghijklmnopqrstuvwxyzàèùßçÄÖÜäöüëïâôûêîÏË←ÈÉ'-+?!.&é→▷▶▼♂¥×/,♀0123456789┌─┐│└─┘◀⁂№"; private Block _block; private StringBuilder output; @@ -1009,24 +1009,19 @@ private void ValidateLines() for (int i = 0; i < lines.Count; ++i) { string line = lines[i]; + string nextLine = null; if (lines.Count > i + 1) { - string nextLine = lines[i + 1]; - if (CheckTextboxLineNeedsTerminator(line, nextLine) && !lines[i].EndsWith("@\"")) - { - output.Append(GetTerminatorErrorMessage(line)); - } - if (!CheckTextboxNextLineValid(line, nextLine)) - { - output.Append(GetInvalidNextLineErrorMessage(line, nextLine)); - } + nextLine = lines[i + 1]; } - else + + if (CheckTextboxLineNeedsTerminator(line, nextLine) && !lines[i].EndsWith("@\"")) { - if (!CheckTextboxNextLineValid(line, null)) - { - output.Append(GetInvalidLastLineErrorMessage(line)); - } + output.Append(GetTerminatorErrorMessage(line)); + } + if (!CheckTextboxNextLineValid(line, nextLine)) + { + output.Append(GetInvalidNextLineErrorMessage(line, nextLine)); } } } @@ -1282,11 +1277,16 @@ private static bool CheckTextboxLineNeedsTerminator(string line, string nextLine if (line.StartsWith("text ") || line.StartsWith("line ") || line.StartsWith("para ") - || line.StartsWith("cont ") - || line.StartsWith("next ")) + || line.StartsWith("cont ")) + { + if (nextLine != null && (nextLine.StartsWith("sound_") || nextLine.StartsWith("text_"))) + { + return true; + } + } + if (line.StartsWith("db ") || line.StartsWith("next ")) { - if (nextLine.StartsWith("sound_") - || nextLine.StartsWith("text_")) + if (line.Contains("\"") && !line.Contains("@\"") && (nextLine == null || !nextLine.StartsWith("next "))) { return true; } @@ -1656,8 +1656,8 @@ private void CopyLines(Block sourceBlock, Block targetBlock) } } - - // TrainerDataValidator.cs + + // TrainerDataValidator.cs internal class TrainerDataValidator {