From a6ccb7f6aeb7d8b1ddad2ff8fcca18469399c0a5 Mon Sep 17 00:00:00 2001 From: dazedanon Date: Sat, 14 Feb 2026 11:19:36 -0600 Subject: [PATCH] Let AI fix wrapping for save game hints --- www/js/plugins/JsScript130Set.js | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/www/js/plugins/JsScript130Set.js b/www/js/plugins/JsScript130Set.js index 68e3f71..c4ffd18 100644 --- a/www/js/plugins/JsScript130Set.js +++ b/www/js/plugins/JsScript130Set.js @@ -187,12 +187,32 @@ Game_Interpreter.prototype.DrawSaveDetail = function (DrawPlayTimer , DrawSaveTi let _HintStr = DrawHintTxt; let _hntRow1 = _HintStr; let _hntRow2 = ""; - if (_HintStr.length >= 17) { - _hntRow1 = _HintStr.substring(0, 16); - _hntRow2 = _HintStr.substring(16); + let _hintFontSize = 21; + // Word-aware wrapping for English text; original char-count split for Japanese + let _isLatin = /[a-zA-Z]/.test(_HintStr); + if (_isLatin) { + // Measure approximate max chars per line at font size for the save detail area + let _maxChars = 34; + if (_HintStr.length > _maxChars) { + // Scale down font if text is very long to fit in 2 lines + if (_HintStr.length > _maxChars * 2) { + _hintFontSize = 17; + _maxChars = 44; + } + // Find last space at or before _maxChars for clean word wrap + let _splitPos = _HintStr.lastIndexOf(' ', _maxChars); + if (_splitPos <= 0) _splitPos = _maxChars; + _hntRow1 = _HintStr.substring(0, _splitPos); + _hntRow2 = _HintStr.substring(_splitPos).replace(/^\s+/, ''); + } + } else { + if (_HintStr.length >= 17) { + _hntRow1 = _HintStr.substring(0, 16); + _hntRow2 = _HintStr.substring(16); + } } - this.SpriteStr(PNo_SHTxt, _hntRow1, 21, 599 + Save_ZureX, 479 + Save_ZureY); - this.SpriteStr(PNo_SHTxt + 1, _hntRow2, 21, 599 + Save_ZureX, 505 + Save_ZureY); + this.SpriteStr(PNo_SHTxt, _hntRow1, _hintFontSize, 599 + Save_ZureX, 479 + Save_ZureY); + this.SpriteStr(PNo_SHTxt + 1, _hntRow2, _hintFontSize, 599 + Save_ZureX, 505 + Save_ZureY); this.SpriteStr(PNo_SSTxt, DrawRateTxt, 21, 822 + Save_ZureX, 556 + Save_ZureY); this.SpriteStr(PNo_SCard, DrawHasCards, 21, 822 + Save_ZureX, 584 + Save_ZureY); if (DrawTenki != "") {