Skip to content

Commit 1f326d6

Browse files
committed
Cheats - Change Sequence update
Displayed the Stage and Event names while manually changing the Sequence position. Also added in the Event name for Sequence position 406, and changed the name for one of the Cortez actors.
1 parent 8fe3734 commit 1f326d6

File tree

3 files changed

+125
-54
lines changed

3 files changed

+125
-54
lines changed

ttyd-tools/rel/include/draw.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ void drawAddById(uint32_t currentMenu);
8383
void drawVersionNumber(int32_t posX, int32_t posY);
8484
void drawPageNumber(int32_t posX, int32_t posY, uint32_t currentPage);
8585
void drawBoolOnOrOff(bool tempBool, const char *currentLine, int32_t posY);
86+
87+
#ifdef TTYD_JP
88+
bool getSequenceStageAndEvent(const char **returnArray, char *stageNameBuffer, uint32_t sequencePosition);
89+
#else
90+
bool getSequenceStageAndEvent(const char **returnArray, uint32_t sequencePosition);
91+
#endif
92+
8693
void drawCheatsChangeSequence();
8794
void drawCheatsBool(int32_t posY);
8895
void drawButtonCombo(uint16_t buttonCombo, int32_t posY, const char *description);

ttyd-tools/rel/source/draw.cpp

Lines changed: 116 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,6 +2074,9 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
20742074
}
20752075
}
20762076

2077+
// Adjust the current value if necessary
2078+
adjustMenuItemBounds(0, currentMenu);
2079+
20772080
// Draw the window
20782081
uint32_t color = 0x151515E0;
20792082
int32_t PosX = -189;
@@ -2086,6 +2089,10 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
20862089
{
20872090
height = 208;
20882091
}
2092+
else if (currentMenu == CHEATS_CHANGE_SEQUENCE)
2093+
{
2094+
height = 235;
2095+
}
20892096
else
20902097
{
20912098
height = 173;
@@ -2102,11 +2109,10 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
21022109
const char *HelpText = "Press D-Pad Up/Down to adjust the value\nPress D-Pad Left/Right to change digits\nPress Y to set the value to max\nPress Z to set the value to min\nPress A to confirm\nPress B to cancel";
21032110
drawText(HelpText, x, y, alpha, color, scale);
21042111

2105-
adjustMenuItemBounds(0, currentMenu); // Adjust the current value if necessary
2106-
21072112
int32_t tempMenuSecondaryValue = MenuSecondaryValue;
21082113
y -= 100;
21092114

2115+
char *tempDisplayBuffer = DisplayBuffer;
21102116
if (changingItem)
21112117
{
21122118
int32_t IconPosX = x + 10;
@@ -2146,6 +2152,35 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
21462152

21472153
drawText(ItemName, IconPosX, y, alpha, color, scale);
21482154
}
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\nEvent";
2180+
drawText(String, x, NamesPosY, alpha, color, scale);
2181+
2182+
y -= 60;
2183+
}
21492184

21502185
// Check if the number is negative
21512186
bool NumberIsNegative = false;
@@ -2204,7 +2239,6 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
22042239
color = 0xFFFFFFFF;
22052240
}
22062241

2207-
char *tempDisplayBuffer = DisplayBuffer;
22082242
sprintf(tempDisplayBuffer,
22092243
"%" PRIu8,
22102244
AdjustableValue[i]);
@@ -2533,95 +2567,83 @@ void drawBoolOnOrOff(bool tempBool, const char *currentLine, int32_t posY)
25332567
drawText(StringValue, PosX, posY, Alpha, Color, Scale);
25342568
}
25352569

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
25372575
{
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
25552576
const char *StageName = nullptr;
25562577
const char *EventName = nullptr;
2557-
bool FoundName = false;
25582578

25592579
#ifdef TTYD_JP
25602580
// Make sure the Sequence value is valid
2561-
if (SequencePosition <= 405)
2581+
if (sequencePosition <= 406)
25622582
{
2563-
if ((SequencePosition >= 0) && (SequencePosition <= 22))
2583+
if ((sequencePosition >= 0) && (sequencePosition <= 22))
25642584
{
25652585
StageName = "Opening";
25662586
}
2567-
else if ((SequencePosition >= 403) && (SequencePosition <= 405))
2587+
else if ((sequencePosition >= 403) && (sequencePosition <= 406))
25682588
{
25692589
StageName = "Ending";
25702590
}
25712591
else
25722592
{
25732593
int32_t StageNumber;
2574-
if ((SequencePosition >= 23) && (SequencePosition <= 70))
2594+
if ((sequencePosition >= 23) && (sequencePosition <= 70))
25752595
{
25762596
StageNumber = 1;
25772597
}
2578-
else if ((SequencePosition >= 71) && (SequencePosition <= 126))
2598+
else if ((sequencePosition >= 71) && (sequencePosition <= 126))
25792599
{
25802600
StageNumber = 2;
25812601
}
2582-
else if ((SequencePosition >= 127) && (SequencePosition <= 177))
2602+
else if ((sequencePosition >= 127) && (sequencePosition <= 177))
25832603
{
25842604
StageNumber = 3;
25852605
}
2586-
else if ((SequencePosition >= 178) && (SequencePosition <= 229))
2606+
else if ((sequencePosition >= 178) && (sequencePosition <= 229))
25872607
{
25882608
StageNumber = 4;
25892609
}
2590-
else if ((SequencePosition >= 230) && (SequencePosition <= 281))
2610+
else if ((sequencePosition >= 230) && (sequencePosition <= 281))
25912611
{
25922612
StageNumber = 5;
25932613
}
2594-
else if ((SequencePosition >= 282) && (SequencePosition <= 351))
2614+
else if ((sequencePosition >= 282) && (sequencePosition <= 351))
25952615
{
25962616
StageNumber = 6;
25972617
}
2598-
else if ((SequencePosition >= 352) && (SequencePosition <= 381))
2618+
else if ((sequencePosition >= 352) && (sequencePosition <= 381))
25992619
{
26002620
StageNumber = 7;
26012621
}
2602-
else // if ((SequencePosition >= 382) && (SequencePosition <= 402))
2622+
else // if ((sequencePosition >= 382) && (sequencePosition <= 402))
26032623
{
26042624
StageNumber = 8;
26052625
}
26062626

2607-
char tempString[8];
2608-
clearMemory(tempString, sizeof(tempString));
2609-
2610-
sprintf(tempString,
2627+
sprintf(stageNameBuffer,
26112628
"Stage %" PRId32,
26122629
StageNumber);
26132630

2614-
StageName = tempString;
2631+
StageName = stageNameBuffer;
26152632
}
26162633

2617-
EventName = CheatsEventNames[SequencePosition];
2618-
FoundName = true;
2634+
EventName = CheatsEventNames[sequencePosition];
2635+
}
2636+
else
2637+
{
2638+
// Current value exceeds the max
2639+
return false;
26192640
}
26202641
#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;
26232645

2624-
for (int i = 0; i < NumberOfStages; ++i)
2646+
for (int32_t i = 0; i < NumberOfStages; ++i)
26252647
{
26262648
ttyd::event::EventStageDescription *StageDesc = ttyd::event::eventStgDtPtr(i);
26272649
for (uint32_t j = 0; j < StageDesc->eventCount; ++j)
@@ -2641,20 +2663,61 @@ void drawCheatsChangeSequence()
26412663
break;
26422664
}
26432665
}
2666+
2667+
if (!FoundName)
2668+
{
2669+
return false;
2670+
}
26442671
#endif
26452672

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
26472707
{
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\nEvent";
2656-
drawText(String, PosX, PosY, Alpha, Color, Scale);
2708+
return;
26572709
}
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\nEvent";
2720+
drawText(String, PosX, PosY, Alpha, Color, Scale);
26582721
}
26592722

26602723
void drawCheatsBool(int32_t posY)

ttyd-tools/rel/source/global.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ const char *CheatsEventNames[]
505505
"Epilogue",
506506
"End Credits",
507507
"Return to Rogueport",
508+
"Rogueport",
508509
};
509510
#endif
510511

@@ -871,7 +872,7 @@ const char *BattlesActorsLines[] =
871872
"Bullet Bill",
872873
"Bulky Bob_omb",
873874
"Cortez",
874-
"Cortez - ???",
875+
"Cortez - Bone Pile?",
875876
"Hook",
876877
"Rapier",
877878
"Sword",

0 commit comments

Comments
 (0)