@@ -293,33 +293,28 @@ void drawTextMain(const char *text, int32_t x, int32_t y,
293
293
}
294
294
295
295
float NewPosX = intToFloat (x);
296
- uint32_t TextLength = 0 ;
296
+ float TextLengthScaled = 0 . f ; // Failsafe; 0.f value won't be used
297
297
298
298
// Check if aligning the text to the right
299
299
if (alignRight)
300
300
{
301
- #ifdef TTYD_JP
302
- const char *AlignBase = ttyd::win_main::str_999_jpn_winMain;
303
- #else
304
- const char *AlignBase = ttyd::win_main::str_999_winMain;
305
- #endif
306
- uint32_t BaseLength = ttyd::fontmgr::FontGetMessageWidth (AlignBase);
307
- TextLength = ttyd::fontmgr::FontGetMessageWidth (text);
301
+ uint32_t TextLength = ttyd::fontmgr::FontGetMessageWidth (text);
302
+ TextLengthScaled = intToFloat (static_cast <int32_t >(TextLength)) * scale;
308
303
309
- NewPosX += intToFloat (BaseLength - TextLength) * scale ;
304
+ NewPosX -= TextLengthScaled ;
310
305
}
311
306
312
307
// Check if there's a width limit
313
308
float ScaleX = scale;
314
309
if (!std::signbit (width)) // Check if positive, works for checking against +0.0 and -0.0
315
310
{
316
- // Prevent calling FontGetMessageWidth again if unnecessary
317
- if (TextLength == 0 )
311
+ // If not aligning the text to the right, then TextLengthScaled needs to be calculated
312
+ if (!alignRight )
318
313
{
319
- TextLength = ttyd::fontmgr::FontGetMessageWidth (text);
314
+ uint32_t TextLength = ttyd::fontmgr::FontGetMessageWidth (text);
315
+ TextLengthScaled = intToFloat (static_cast <int32_t >(TextLength)) * scale;
320
316
}
321
317
322
- float TextLengthScaled = intToFloat (static_cast <int32_t >(TextLength)) * scale;
323
318
if (TextLengthScaled > width)
324
319
{
325
320
ScaleX = (width / TextLengthScaled) * scale;
@@ -1163,7 +1158,7 @@ void drawMarioStats()
1163
1158
// Draw the text
1164
1159
PosX = TextPosX;
1165
1160
PosY = TextPosY;
1166
- ValuesPosX = TextPosX + 120 ;
1161
+ ValuesPosX = TextPosX + 148 ;
1167
1162
ExitLoop = false ;
1168
1163
1169
1164
for (uint32_t j = 0 ; j < TotalColumns; j++)
@@ -2767,13 +2762,7 @@ void drawBattlesStatusesList()
2767
2762
Color = 0xFFFFFFFF ;
2768
2763
}
2769
2764
2770
- int32_t TextPosXIncrement = 291 ;
2771
-
2772
- #ifdef TTYD_JP
2773
- TextPosXIncrement -= 3 ;
2774
- #endif
2775
-
2776
- drawTextAlignRight (TextToDraw, TextPosX + TextPosXIncrement, TextPosY, Color, TextScale);
2765
+ drawTextAlignRight (TextToDraw, TextPosX + 319 , TextPosY, Color, TextScale);
2777
2766
TextPosY -= 30 ;
2778
2767
}
2779
2768
}
@@ -3887,7 +3876,7 @@ void drawCheatsModifyMarioCoordinates()
3887
3876
" %.6f" ,
3888
3877
Coordinate);
3889
3878
3890
- // Make sure the text wont go offscreen
3879
+ // Make sure the text won't go offscreen
3891
3880
int32_t CoordinateMaxStringLength = 34 ;
3892
3881
3893
3882
#ifdef TTYD_JP
@@ -4789,7 +4778,7 @@ void drawWarpIndexEntranceList()
4789
4778
drawTextMultipleLines (tempDisplayBuffer, PosX + 170 , PosY, mapAndBeroDetails.MapColor , Scale);
4790
4779
4791
4780
// Draw the current page
4792
- int32_t PageNumberPosX = 223 ;
4781
+ int32_t PageNumberPosX = 233 ;
4793
4782
uint32_t tempCurrentPage = MenuVar.CurrentPage ;
4794
4783
drawPageNumber (PageNumberPosX, PosY, tempCurrentPage);
4795
4784
@@ -5232,13 +5221,17 @@ void Mod::drawSequenceInPauseMenu(ttyd::dispdrv::CameraId cameraId, void *winWor
5232
5221
" %" PRIu32,
5233
5222
getSequencePosition ());
5234
5223
5235
- #ifndef TTYD_JP
5224
+ int32_t PosXIncrement = 255 ;
5225
+
5226
+ #ifdef TTYD_JP
5227
+ PosXIncrement += 4 ;
5228
+ #else
5236
5229
Scale = 0 .9f ;
5237
5230
#endif
5238
5231
5239
5232
drawTextAlignRight (
5240
5233
tempDisplaybuffer,
5241
- WindowPosX + 214 ,
5234
+ WindowPosX + PosXIncrement ,
5242
5235
WindowPosY + PosYIncrement,
5243
5236
Color,
5244
5237
Scale);
0 commit comments