@@ -2742,6 +2742,26 @@ void drawNotInBattleErrorMessage()
2742
2742
drawErrorWindow (CurrentLine, TextPosX, TextPosY, WindowWidth);
2743
2743
}
2744
2744
2745
+ void drawMarioCoordinatesErrorMessage ()
2746
+ {
2747
+ if (!checkErrorMessageReqs ())
2748
+ {
2749
+ return ;
2750
+ }
2751
+
2752
+ const char *CurrentLine = " This value must be modified as a hex value." ;
2753
+ int32_t TextPosX = -181 ;
2754
+ int32_t TextPosY = -17 ;
2755
+ int32_t WindowWidth = 392 ;
2756
+
2757
+ #ifdef TTYD_JP
2758
+ TextPosX += 1 ;
2759
+ WindowWidth -= 7 ;
2760
+ #endif
2761
+
2762
+ drawErrorWindow (CurrentLine, TextPosX, TextPosY, WindowWidth);
2763
+ }
2764
+
2745
2765
void drawResolveFadesMessage ()
2746
2766
{
2747
2767
int32_t tempFunctionReturnCode = MenuVar.FunctionReturnCode ;
@@ -3243,7 +3263,8 @@ void drawAdjustableValueHex(uint32_t currentMenu)
3243
3263
}
3244
3264
3245
3265
// Adjust the current value if necessary
3246
- if (currentMenu != MEMORY_WATCH_CHANGE_ADDRESS)
3266
+ if ((currentMenu != CHEATS_MODIFY_COORDINATES) &&
3267
+ (currentMenu != MEMORY_WATCH_CHANGE_ADDRESS))
3247
3268
{
3248
3269
adjustMenuItemBounds (0 , currentMenu);
3249
3270
}
@@ -3282,6 +3303,11 @@ void drawAdjustableValueHex(uint32_t currentMenu)
3282
3303
3283
3304
switch (currentMenu)
3284
3305
{
3306
+ case CHEATS_MODIFY_COORDINATES:
3307
+ {
3308
+ AmountOfNumbers = 8 ;
3309
+ break ;
3310
+ }
3285
3311
case MEMORY_WATCH_CHANGE_ADDRESS:
3286
3312
{
3287
3313
AmountOfNumbers = 8 ;
@@ -3390,6 +3416,103 @@ void drawAdjustableValueHex(uint32_t currentMenu)
3390
3416
}
3391
3417
}
3392
3418
3419
+ void drawAdjustableValueDouble (uint32_t currentMenu, const char *value)
3420
+ {
3421
+ // Check for button inputs
3422
+ uint32_t ReturnCode;
3423
+ if (currentMenu == CHEATS_MODIFY_COORDINATES)
3424
+ {
3425
+ ReturnCode = adjustableValueButtonControls (currentMenu);
3426
+ }
3427
+ else
3428
+ {
3429
+ // Nothing else currently uses this yet
3430
+ return ;
3431
+ }
3432
+
3433
+ switch (ReturnCode)
3434
+ {
3435
+ case NO_NUMBERS_TO_DISPLAY: // There are no numbers to display, so close the menu
3436
+ {
3437
+ return ;
3438
+ }
3439
+ default :
3440
+ {
3441
+ break ;
3442
+ }
3443
+ }
3444
+
3445
+ // Draw the window
3446
+ uint32_t Color = 0x151515E0 ;
3447
+ int32_t PosX = -189 ;
3448
+ int32_t PosY = 72 ;
3449
+ int32_t Width = 377 ;
3450
+ int32_t Curve = 10 ;
3451
+ int32_t Height = 138 ;
3452
+
3453
+ #ifdef TTYD_JP
3454
+ PosX += 4 ;
3455
+ Width -= 6 ;
3456
+ #endif
3457
+
3458
+ drawWindow (Color, PosX, PosY, Width, Height, Curve);
3459
+
3460
+ // Draw the help text
3461
+ uint8_t Alpha = 0xFF ;
3462
+ float Scale = 0 .6f ;
3463
+ PosX += 15 ;
3464
+ PosY -= 13 ;
3465
+ Color = 0xFFFFFFFF ;
3466
+ const char *HelpText = " Press D-Pad Up/Down to adjust the value\n Press D-Pad Left/Right to change digits\n Press A to confirm\n Press B to cancel" ;
3467
+ drawTextAndInit (HelpText, PosX, PosY, Alpha, Color, false , Scale);
3468
+
3469
+ PosX += 166 ;
3470
+ PosY -= 90 ;
3471
+
3472
+ #ifdef TTYD_JP
3473
+ Scale = 1 .f ;
3474
+ PosX -= 1 ;
3475
+ PosY += 3 ;
3476
+ #else
3477
+ Scale = 0 .9f ;
3478
+ #endif
3479
+
3480
+ uint32_t StringLength = strlen (value);
3481
+
3482
+ // Calculate the X offset
3483
+ int32_t tempPosX = 0 ;
3484
+ for (uint32_t i = 0 ; i < (StringLength - 1 ); i++)
3485
+ {
3486
+ tempPosX += 17 ;
3487
+ }
3488
+ PosX -= (tempPosX / 2 );
3489
+
3490
+ // Draw each digit of the number
3491
+ uint32_t tempSecondaryMenuOption = MenuVar.SecondaryMenuOption ;
3492
+
3493
+ char *tempDisplayBuffer = DisplayBuffer;
3494
+ for (uint32_t i = 0 ; i < StringLength; i++)
3495
+ {
3496
+ bool CurrentOptionCheck = tempSecondaryMenuOption == i;
3497
+ Color = getSelectedTextColor (CurrentOptionCheck);
3498
+
3499
+ char CurrentChar = value[i];
3500
+ sprintf (tempDisplayBuffer,
3501
+ " %c" ,
3502
+ CurrentChar);
3503
+
3504
+ // If drawing the decimal point, move it further right
3505
+ tempPosX = PosX;
3506
+ if (CurrentChar == ' .' )
3507
+ {
3508
+ tempPosX += 5 ;
3509
+ }
3510
+
3511
+ drawText (tempDisplayBuffer, tempPosX, PosY, Color, Scale);
3512
+ PosX += 17 ;
3513
+ }
3514
+ }
3515
+
3393
3516
void drawAddByIconMain (uint32_t currentMenu)
3394
3517
{
3395
3518
// Check for button inputs
@@ -3613,6 +3736,68 @@ void drawCheatsChangeSequence()
3613
3736
drawText (String, PosX, PosY, Color, Scale);
3614
3737
}
3615
3738
3739
+ void drawCheatsModifyMarioCoordinates ()
3740
+ {
3741
+ uint32_t Color;
3742
+ // uint8_t Alpha = 0xFF;
3743
+ int32_t PosX = -232 ;
3744
+ int32_t PosY = 80 ;
3745
+ float Scale = 0 .6f ;
3746
+
3747
+ // Draw the value for the bool
3748
+ const char *YesNoText;
3749
+ getYesNoTextAndColor (ChangeMarioCoordinates.ModifyAsHex , &YesNoText, &Color);
3750
+ drawText (YesNoText, PosX + 130 , PosY + 40 , Color, Scale);
3751
+
3752
+ // Draw each of the coordinates, both as a float and as hex
3753
+ Color = 0xFFFFFFFF ;
3754
+ char CoordinateLetter = ' X' ;
3755
+ char *tempDisplayBuffer = DisplayBuffer;
3756
+ ttyd::mario::Player *player = ttyd::mario::marioGetPtr ();
3757
+
3758
+ for (uint32_t i = 0 ; i < 3 ; i++)
3759
+ {
3760
+ float Coordinate = player->playerPosition [i];
3761
+
3762
+ // Get the coordinate in text form first
3763
+ const char *CoordinateText;
3764
+ char CoordinateStringBuffer[128 ];
3765
+
3766
+ int32_t StringLength = sprintf (
3767
+ CoordinateStringBuffer,
3768
+ " %.6f" ,
3769
+ Coordinate);
3770
+
3771
+ // Make sure the text wont go offscreen
3772
+ int32_t CoordinateMaxStringLength = 34 ;
3773
+
3774
+ #ifdef TTYD_JP
3775
+ CoordinateMaxStringLength += 4 ;
3776
+ #endif
3777
+
3778
+ if ((StringLength <= 0 ) || (StringLength > CoordinateMaxStringLength))
3779
+ {
3780
+ CoordinateText = " Too Big" ;
3781
+ }
3782
+ else
3783
+ {
3784
+ CoordinateText = CoordinateStringBuffer;
3785
+ }
3786
+
3787
+ // Get the actual text to draw
3788
+ uint32_t *CoordinateHex = reinterpret_cast <uint32_t *>(&Coordinate);
3789
+ sprintf (tempDisplayBuffer,
3790
+ " %c = %s, 0x%08" PRIX32,
3791
+ CoordinateLetter,
3792
+ CoordinateText,
3793
+ *CoordinateHex);
3794
+
3795
+ drawText (tempDisplayBuffer, PosX, PosY, Color, Scale);
3796
+ CoordinateLetter++;
3797
+ PosY -= 20 ;
3798
+ }
3799
+ }
3800
+
3616
3801
void drawCheatsBool (int32_t posY)
3617
3802
{
3618
3803
uint32_t tempMenuSelectedOption = MenuVar.MenuSelectedOption ;
0 commit comments