Improve line breaks/scrolls (#5641)
This commit is contained in:
parent
ee2535be96
commit
57e771c8b8
1 changed files with 14 additions and 4 deletions
|
@ -3340,6 +3340,7 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
u8 fontId = FONT_NORMAL;
|
||||
s16 letterSpacing = 0;
|
||||
u32 lineNum = 1;
|
||||
u32 displayedLineNums = 1;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)
|
||||
multiplayerId = gRecordedBattleMultiplayerId;
|
||||
|
@ -3753,8 +3754,12 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
|
||||
if (dstWidth + toCpyWidth > BATTLE_MSG_MAX_WIDTH)
|
||||
{
|
||||
dst[lastValidSkip] = lineNum == 1 ? CHAR_NEWLINE : CHAR_PROMPT_SCROLL;
|
||||
dst[lastValidSkip] = displayedLineNums == 1 ? CHAR_NEWLINE : CHAR_PROMPT_SCROLL;
|
||||
dstWidth = GetStringLineWidth(fontId, dst, letterSpacing, lineNum, dstSize);
|
||||
if (displayedLineNums == 1)
|
||||
displayedLineNums++;
|
||||
else
|
||||
displayedLineNums = 1;
|
||||
lineNum++;
|
||||
}
|
||||
while (*toCpy != EOS)
|
||||
|
@ -3780,15 +3785,20 @@ u32 BattleStringExpandPlaceholders(const u8 *src, u8 *dst, u32 dstSize)
|
|||
dst[dstID] = *src;
|
||||
if (dstWidth + toCpyWidth > BATTLE_MSG_MAX_WIDTH)
|
||||
{
|
||||
dst[lastValidSkip] = lineNum == 1 ? CHAR_NEWLINE : CHAR_PROMPT_SCROLL;
|
||||
dst[lastValidSkip] = displayedLineNums == 1 ? CHAR_NEWLINE : CHAR_PROMPT_SCROLL;
|
||||
if (displayedLineNums == 1)
|
||||
displayedLineNums++;
|
||||
else
|
||||
displayedLineNums = 1;
|
||||
lineNum++;
|
||||
dstWidth = 0;
|
||||
}
|
||||
switch (*src)
|
||||
{
|
||||
case CHAR_NEWLINE:
|
||||
case CHAR_PROMPT_SCROLL:
|
||||
case CHAR_PROMPT_CLEAR:
|
||||
case CHAR_PROMPT_SCROLL:
|
||||
displayedLineNums = 1;
|
||||
case CHAR_NEWLINE:
|
||||
lineNum++;
|
||||
dstWidth = 0;
|
||||
//fallthrough
|
||||
|
|
Loading…
Reference in a new issue