@@ -2074,6 +2074,9 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
2074
2074
}
2075
2075
}
2076
2076
2077
+ // Adjust the current value if necessary
2078
+ adjustMenuItemBounds (0 , currentMenu);
2079
+
2077
2080
// Draw the window
2078
2081
uint32_t color = 0x151515E0 ;
2079
2082
int32_t PosX = -189 ;
@@ -2086,6 +2089,10 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
2086
2089
{
2087
2090
height = 208 ;
2088
2091
}
2092
+ else if (currentMenu == CHEATS_CHANGE_SEQUENCE)
2093
+ {
2094
+ height = 235 ;
2095
+ }
2089
2096
else
2090
2097
{
2091
2098
height = 173 ;
@@ -2102,11 +2109,10 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
2102
2109
const char *HelpText = " Press D-Pad Up/Down to adjust the value\n Press D-Pad Left/Right to change digits\n Press Y to set the value to max\n Press Z to set the value to min\n Press A to confirm\n Press B to cancel" ;
2103
2110
drawText (HelpText, x, y, alpha, color, scale);
2104
2111
2105
- adjustMenuItemBounds (0 , currentMenu); // Adjust the current value if necessary
2106
-
2107
2112
int32_t tempMenuSecondaryValue = MenuSecondaryValue;
2108
2113
y -= 100 ;
2109
2114
2115
+ char *tempDisplayBuffer = DisplayBuffer;
2110
2116
if (changingItem)
2111
2117
{
2112
2118
int32_t IconPosX = x + 10 ;
@@ -2146,6 +2152,35 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
2146
2152
2147
2153
drawText (ItemName, IconPosX, y, alpha, color, scale);
2148
2154
}
2155
+ else if (currentMenu == CHEATS_CHANGE_SEQUENCE)
2156
+ {
2157
+ // Draw the Stage and Event for the current Sequence value
2158
+ const char *StageAndEventNames[2 ];
2159
+
2160
+ #ifdef TTYD_JP
2161
+ char StageNameBuffer[8 ];
2162
+ clearMemory (StageNameBuffer, sizeof (StageNameBuffer));
2163
+
2164
+ getSequenceStageAndEvent (StageAndEventNames, StageNameBuffer,
2165
+ static_cast <uint32_t >(tempMenuSecondaryValue));
2166
+ #else
2167
+ getSequenceStageAndEvent (StageAndEventNames,
2168
+ static_cast <uint32_t >(tempMenuSecondaryValue));
2169
+ #endif
2170
+
2171
+ sprintf (tempDisplayBuffer,
2172
+ " %s\n %s" ,
2173
+ StageAndEventNames[0 ], // Stage name
2174
+ StageAndEventNames[1 ]); // Event name
2175
+
2176
+ int32_t NamesPosY = y - 35 ;
2177
+ drawText (tempDisplayBuffer, x + 80 , NamesPosY, alpha, color, scale);
2178
+
2179
+ const char *String = " Stage\n Event" ;
2180
+ drawText (String, x, NamesPosY, alpha, color, scale);
2181
+
2182
+ y -= 60 ;
2183
+ }
2149
2184
2150
2185
// Check if the number is negative
2151
2186
bool NumberIsNegative = false ;
@@ -2204,7 +2239,6 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
2204
2239
color = 0xFFFFFFFF ;
2205
2240
}
2206
2241
2207
- char *tempDisplayBuffer = DisplayBuffer;
2208
2242
sprintf (tempDisplayBuffer,
2209
2243
" %" PRIu8,
2210
2244
AdjustableValue[i]);
@@ -2533,95 +2567,83 @@ void drawBoolOnOrOff(bool tempBool, const char *currentLine, int32_t posY)
2533
2567
drawText (StringValue, PosX, posY, Alpha, Color, Scale);
2534
2568
}
2535
2569
2536
- void drawCheatsChangeSequence ()
2570
+ #ifdef TTYD_JP
2571
+ bool getSequenceStageAndEvent (const char **returnArray, char *stageNameBuffer, uint32_t sequencePosition)
2572
+ #else
2573
+ bool getSequenceStageAndEvent (const char **returnArray, uint32_t sequencePosition)
2574
+ #endif
2537
2575
{
2538
- uint32_t Color = 0xFFFFFFFF ;
2539
- uint8_t Alpha = 0xFF ;
2540
- int32_t PosX = -232 ;
2541
- int32_t PosY = 120 ;
2542
- float Scale = 0.6 ;
2543
-
2544
- uint32_t SequencePosition = getSequencePosition ();
2545
-
2546
- // Draw the text for showing what the current Sequence value is
2547
- char *tempDisplayBuffer = DisplayBuffer;
2548
- sprintf (tempDisplayBuffer,
2549
- " Current Value: %" PRIu32,
2550
- SequencePosition);
2551
-
2552
- drawText (tempDisplayBuffer, PosX, PosY, Alpha, Color, Scale);
2553
-
2554
- // Draw the name for the current Sequence value
2555
2576
const char *StageName = nullptr ;
2556
2577
const char *EventName = nullptr ;
2557
- bool FoundName = false ;
2558
2578
2559
2579
#ifdef TTYD_JP
2560
2580
// Make sure the Sequence value is valid
2561
- if (SequencePosition <= 405 )
2581
+ if (sequencePosition <= 406 )
2562
2582
{
2563
- if ((SequencePosition >= 0 ) && (SequencePosition <= 22 ))
2583
+ if ((sequencePosition >= 0 ) && (sequencePosition <= 22 ))
2564
2584
{
2565
2585
StageName = " Opening" ;
2566
2586
}
2567
- else if ((SequencePosition >= 403 ) && (SequencePosition <= 405 ))
2587
+ else if ((sequencePosition >= 403 ) && (sequencePosition <= 406 ))
2568
2588
{
2569
2589
StageName = " Ending" ;
2570
2590
}
2571
2591
else
2572
2592
{
2573
2593
int32_t StageNumber;
2574
- if ((SequencePosition >= 23 ) && (SequencePosition <= 70 ))
2594
+ if ((sequencePosition >= 23 ) && (sequencePosition <= 70 ))
2575
2595
{
2576
2596
StageNumber = 1 ;
2577
2597
}
2578
- else if ((SequencePosition >= 71 ) && (SequencePosition <= 126 ))
2598
+ else if ((sequencePosition >= 71 ) && (sequencePosition <= 126 ))
2579
2599
{
2580
2600
StageNumber = 2 ;
2581
2601
}
2582
- else if ((SequencePosition >= 127 ) && (SequencePosition <= 177 ))
2602
+ else if ((sequencePosition >= 127 ) && (sequencePosition <= 177 ))
2583
2603
{
2584
2604
StageNumber = 3 ;
2585
2605
}
2586
- else if ((SequencePosition >= 178 ) && (SequencePosition <= 229 ))
2606
+ else if ((sequencePosition >= 178 ) && (sequencePosition <= 229 ))
2587
2607
{
2588
2608
StageNumber = 4 ;
2589
2609
}
2590
- else if ((SequencePosition >= 230 ) && (SequencePosition <= 281 ))
2610
+ else if ((sequencePosition >= 230 ) && (sequencePosition <= 281 ))
2591
2611
{
2592
2612
StageNumber = 5 ;
2593
2613
}
2594
- else if ((SequencePosition >= 282 ) && (SequencePosition <= 351 ))
2614
+ else if ((sequencePosition >= 282 ) && (sequencePosition <= 351 ))
2595
2615
{
2596
2616
StageNumber = 6 ;
2597
2617
}
2598
- else if ((SequencePosition >= 352 ) && (SequencePosition <= 381 ))
2618
+ else if ((sequencePosition >= 352 ) && (sequencePosition <= 381 ))
2599
2619
{
2600
2620
StageNumber = 7 ;
2601
2621
}
2602
- else // if ((SequencePosition >= 382) && (SequencePosition <= 402))
2622
+ else // if ((sequencePosition >= 382) && (sequencePosition <= 402))
2603
2623
{
2604
2624
StageNumber = 8 ;
2605
2625
}
2606
2626
2607
- char tempString[8 ];
2608
- clearMemory (tempString, sizeof (tempString));
2609
-
2610
- sprintf (tempString,
2627
+ sprintf (stageNameBuffer,
2611
2628
" Stage %" PRId32,
2612
2629
StageNumber);
2613
2630
2614
- StageName = tempString ;
2631
+ StageName = stageNameBuffer ;
2615
2632
}
2616
2633
2617
- EventName = CheatsEventNames[SequencePosition];
2618
- FoundName = true ;
2634
+ EventName = CheatsEventNames[sequencePosition];
2635
+ }
2636
+ else
2637
+ {
2638
+ // Current value exceeds the max
2639
+ return false ;
2619
2640
}
2620
2641
#else
2621
- uint16_t tempSequencePosition = static_cast <uint16_t >(SequencePosition);
2622
- int NumberOfStages = ttyd::event::eventStgNum ();
2642
+ uint16_t tempSequencePosition = static_cast <uint16_t >(sequencePosition);
2643
+ int32_t NumberOfStages = ttyd::event::eventStgNum ();
2644
+ bool FoundName = false ;
2623
2645
2624
- for (int i = 0 ; i < NumberOfStages; ++i)
2646
+ for (int32_t i = 0 ; i < NumberOfStages; ++i)
2625
2647
{
2626
2648
ttyd::event::EventStageDescription *StageDesc = ttyd::event::eventStgDtPtr (i);
2627
2649
for (uint32_t j = 0 ; j < StageDesc->eventCount ; ++j)
@@ -2641,20 +2663,61 @@ void drawCheatsChangeSequence()
2641
2663
break ;
2642
2664
}
2643
2665
}
2666
+
2667
+ if (!FoundName)
2668
+ {
2669
+ return false ;
2670
+ }
2644
2671
#endif
2645
2672
2646
- if (FoundName)
2673
+ returnArray[0 ] = StageName;
2674
+ returnArray[1 ] = EventName;
2675
+ return true ;
2676
+ }
2677
+
2678
+ void drawCheatsChangeSequence ()
2679
+ {
2680
+ uint32_t Color = 0xFFFFFFFF ;
2681
+ uint8_t Alpha = 0xFF ;
2682
+ int32_t PosX = -232 ;
2683
+ int32_t PosY = 120 ;
2684
+ float Scale = 0.6 ;
2685
+
2686
+ uint32_t SequencePosition = getSequencePosition ();
2687
+
2688
+ // Draw the text for showing what the current Sequence value is
2689
+ char *tempDisplayBuffer = DisplayBuffer;
2690
+ sprintf (tempDisplayBuffer,
2691
+ " Current Value: %" PRIu32,
2692
+ SequencePosition);
2693
+
2694
+ drawText (tempDisplayBuffer, PosX, PosY, Alpha, Color, Scale);
2695
+
2696
+ // Draw the Stage and Event names for the current Sequence value
2697
+ const char *StageAndEventNames[2 ];
2698
+
2699
+ #ifdef TTYD_JP
2700
+ char StageNameBuffer[8 ];
2701
+ clearMemory (StageNameBuffer, sizeof (StageNameBuffer));
2702
+
2703
+ if (!getSequenceStageAndEvent (StageAndEventNames, StageNameBuffer, SequencePosition))
2704
+ #else
2705
+ if (!getSequenceStageAndEvent (StageAndEventNames, SequencePosition))
2706
+ #endif
2647
2707
{
2648
- PosY -= 40 ;
2649
- sprintf (tempDisplayBuffer,
2650
- " %s\n %s" ,
2651
- StageName,
2652
- EventName);
2653
- drawText (tempDisplayBuffer, PosX + 80 , PosY, Alpha, Color, Scale);
2654
-
2655
- const char *String = " Stage\n Event" ;
2656
- drawText (String, PosX, PosY, Alpha, Color, Scale);
2708
+ return ;
2657
2709
}
2710
+
2711
+ sprintf (tempDisplayBuffer,
2712
+ " %s\n %s" ,
2713
+ StageAndEventNames[0 ], // Stage name
2714
+ StageAndEventNames[1 ]); // Event name
2715
+
2716
+ PosY -= 40 ;
2717
+ drawText (tempDisplayBuffer, PosX + 80 , PosY, Alpha, Color, Scale);
2718
+
2719
+ const char *String = " Stage\n Event" ;
2720
+ drawText (String, PosX, PosY, Alpha, Color, Scale);
2658
2721
}
2659
2722
2660
2723
void drawCheatsBool (int32_t posY)
0 commit comments