Let AI fix wrapping for save game hints
This commit is contained in:
parent
c151cc73bb
commit
a6ccb7f6ae
1 changed files with 25 additions and 5 deletions
|
|
@ -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 != "") {
|
||||
|
|
|
|||
Loading…
Reference in a new issue