Skip to content

Commit e15d138

Browse files
committed
Memory - Added text for confirming watch positions
Also made small edits to enableOrDisableMenu, setAddByIconValue, and memoryChangeWatchPositionButtonControls.
1 parent 8595e01 commit e15d138

File tree

4 files changed

+39
-47
lines changed

4 files changed

+39
-47
lines changed

ttyd-tools/rel/include/global.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ enum ADJUSTABLE_MENU_VALUES
164164
ADDING_BY_ID = 0x1008,
165165
};
166166

167+
enum ADD_BY_ICON_MENU_VALUES
168+
{
169+
ADDING_BY_ICON = 0x1108,
170+
};
171+
167172
enum CHEATS_SPAWN_ITEM_MENU_VALUE
168173
{
169174
SPAWN_ITEM_MENU_VALUE = 0x7000,

ttyd-tools/rel/source/draw.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,13 +1489,13 @@ void drawMemoryTypeList()
14891489
void drawMemoryChangeWatchPosition()
14901490
{
14911491
// Check for button inputs
1492-
memoryChangeWatchPositionButtonControls();
1492+
memoryChangeWatchPositionButtonControls();
14931493

14941494
uint32_t tempMenuSelectedOption = MenuSelectedOption;
14951495

14961496
// Draw the current watch
1497-
int32_t PosX = MemoryWatch[tempMenuSelectedOption].PosX;
1498-
int32_t PosY = MemoryWatch[tempMenuSelectedOption].PosY;
1497+
int32_t PosX = MemoryWatchPosition.PosX;
1498+
int32_t PosY = MemoryWatchPosition.PosY;
14991499
uint32_t TextColor = 0xFFFFFFFF;
15001500
uint8_t Alpha = 0xFF;
15011501
float Scale = 0.75;
@@ -1512,10 +1512,10 @@ void drawMemoryChangeWatchPosition()
15121512
int32_t Curve = 20;
15131513
uint32_t WindowColor = 0x151515F6;
15141514
int32_t TextPosX = -135;
1515-
int32_t TextPosY = 100;
1515+
int32_t TextPosY = 140;
15161516
Scale = 0.6;
15171517

1518-
const char *HelpText = "Press/Hold the D-Pad directions\nto move the watch\n\nHold Y to hide this window\n\nPress B to cancel";
1518+
const char *HelpText = "Press/Hold the D-Pad directions\nto move the watch\n\nHold Y to hide this window\n\nPress A to confirm\n\nPress B to cancel";
15191519
int32_t Width = static_cast<int32_t>(getMessageWidth(HelpText, Scale));
15201520

15211521
drawTextWithWindow(HelpText, TextPosX, TextPosY, Alpha, TextColor,
@@ -2066,8 +2066,6 @@ void drawAdjustableValue(bool changingItem, uint32_t currentMenu)
20662066
uint32_t ReturnCode = adjustableValueButtonControls(currentMenu);
20672067
switch (ReturnCode)
20682068
{
2069-
case A: // Confirmed a value, so close the menu; Don't close if currently adding multiple items/badges
2070-
case B: // Canceled, so close the menu
20712069
case NO_NUMBERS_TO_DISPLAY: // There are no numbers to display, so close the menu
20722070
{
20732071
return;
@@ -2288,8 +2286,6 @@ void drawMemoryWatchAdjustableValue(uint32_t currentMenu)
22882286
uint32_t ReturnCode = adjustWatchValueControls(tempMenuSelectedOption);
22892287
switch (ReturnCode)
22902288
{
2291-
case A: // Confirmed a value, so close the menu
2292-
case B: // Canceled, so close the menu
22932289
case NO_NUMBERS_TO_DISPLAY: // There are no numbers to display, so close the menu
22942290
{
22952291
return;

ttyd-tools/rel/source/menu.cpp

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,14 +3732,17 @@ void drawMenu()
37323732
void enableOrDisableMenu()
37333733
{
37343734
// Check for user input
3735-
const uint16_t OpenMenuCombo = PAD_L | PAD_START;
3735+
uint16_t OpenMenuCombo = PAD_L | PAD_START;
3736+
bool tempMenuIsDisplayed = MenuIsDisplayed;
3737+
37363738
if (checkButtonCombo(OpenMenuCombo) && !PreventClosingMenu && !ChangingCheatButtonCombo)
37373739
{
3738-
MenuIsDisplayed = !MenuIsDisplayed;
3739-
if (MenuIsDisplayed)
3740+
resetMenuToRoot();
3741+
tempMenuIsDisplayed = !tempMenuIsDisplayed;
3742+
MenuIsDisplayed = tempMenuIsDisplayed;
3743+
3744+
if (tempMenuIsDisplayed)
37403745
{
3741-
resetMenuToRoot();
3742-
37433746
// Raise the System Level if not in a battle
37443747
raiseSystemLevel();
37453748

@@ -3748,19 +3751,6 @@ void enableOrDisableMenu()
37483751
}
37493752
else
37503753
{
3751-
if (HideMenu)
3752-
{
3753-
// Restore the memory watch default position if currently modifying it
3754-
if (CurrentMenu == MEMORY_MODIFY)
3755-
{
3756-
uint32_t tempMenuSelectedOption = MenuSelectedOption;
3757-
MemoryWatch[tempMenuSelectedOption].PosX = MemoryWatchPosition.PosX;
3758-
MemoryWatch[tempMenuSelectedOption].PosY = MemoryWatchPosition.PosY;
3759-
}
3760-
}
3761-
3762-
resetMenuToRoot();
3763-
37643754
// Lower the System Level if not in a battle
37653755
lowerSystemLevel();
37663756

@@ -3770,7 +3760,7 @@ void enableOrDisableMenu()
37703760
}
37713761

37723762
// Check if the menu should be displayed or not
3773-
if (MenuIsDisplayed)
3763+
if (tempMenuIsDisplayed)
37743764
{
37753765
// Check for button inputs for the menu
37763766
// Don't check any buttons if the frame counter is not 0

ttyd-tools/rel/source/menufunctions.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ uint32_t addByIconButtonControls(uint32_t currentMenu)
13201320
setAddByIconValue(tempAddress);
13211321

13221322
FrameCounter = 1;
1323-
return Button;
1323+
return ADDING_BY_ICON;
13241324
}
13251325
else
13261326
{
@@ -1469,26 +1469,26 @@ uint32_t memoryChangeWatchPositionButtonControls()
14691469
{
14701470
case DPADLEFT:
14711471
{
1472-
int32_t PosX = MemoryWatch[tempMenuSelectedOption].PosX;
1473-
MemoryWatch[tempMenuSelectedOption].PosX = PosX - 5;
1472+
int32_t PosX = MemoryWatchPosition.PosX;
1473+
MemoryWatchPosition.PosX = PosX - 5;
14741474
break;
14751475
}
14761476
case DPADRIGHT:
14771477
{
1478-
int32_t PosX = MemoryWatch[tempMenuSelectedOption].PosX;
1479-
MemoryWatch[tempMenuSelectedOption].PosX = PosX + 5;
1478+
int32_t PosX = MemoryWatchPosition.PosX;
1479+
MemoryWatchPosition.PosX = PosX + 5;
14801480
break;
14811481
}
14821482
case DPADUP:
14831483
{
1484-
int32_t PosY = MemoryWatch[tempMenuSelectedOption].PosY;
1485-
MemoryWatch[tempMenuSelectedOption].PosY = PosY + 5;
1484+
int32_t PosY = MemoryWatchPosition.PosY;
1485+
MemoryWatchPosition.PosY = PosY + 5;
14861486
break;
14871487
}
14881488
case DPADDOWN:
14891489
{
1490-
int32_t PosY = MemoryWatch[tempMenuSelectedOption].PosY;
1491-
MemoryWatch[tempMenuSelectedOption].PosY = PosY - 5;
1490+
int32_t PosY = MemoryWatchPosition.PosY;
1491+
MemoryWatchPosition.PosY = PosY - 5;
14921492
break;
14931493
}
14941494
default:
@@ -1528,38 +1528,41 @@ uint32_t memoryChangeWatchPositionButtonControls()
15281528
{
15291529
case DPADLEFT:
15301530
{
1531-
int32_t PosX = MemoryWatch[tempMenuSelectedOption].PosX;
1532-
MemoryWatch[tempMenuSelectedOption].PosX = PosX - 1;
1531+
int32_t PosX = MemoryWatchPosition.PosX;
1532+
MemoryWatchPosition.PosX = PosX - 1;
15331533

15341534
FrameCounter = 1;
15351535
return Button;
15361536
}
15371537
case DPADRIGHT:
15381538
{
1539-
int32_t PosX = MemoryWatch[tempMenuSelectedOption].PosX;
1540-
MemoryWatch[tempMenuSelectedOption].PosX = PosX + 1;
1539+
int32_t PosX = MemoryWatchPosition.PosX;
1540+
MemoryWatchPosition.PosX = PosX + 1;
15411541

15421542
FrameCounter = 1;
15431543
return Button;
15441544
}
15451545
case DPADUP:
15461546
{
1547-
int32_t PosY = MemoryWatch[tempMenuSelectedOption].PosY;
1548-
MemoryWatch[tempMenuSelectedOption].PosY = PosY + 1;
1547+
int32_t PosY = MemoryWatchPosition.PosY;
1548+
MemoryWatchPosition.PosY = PosY + 1;
15491549

15501550
FrameCounter = 1;
15511551
return Button;
15521552
}
15531553
case DPADDOWN:
15541554
{
1555-
int32_t PosY = MemoryWatch[tempMenuSelectedOption].PosY;
1556-
MemoryWatch[tempMenuSelectedOption].PosY = PosY - 1;
1555+
int32_t PosY = MemoryWatchPosition.PosY;
1556+
MemoryWatchPosition.PosY = PosY - 1;
15571557

15581558
FrameCounter = 1;
15591559
return Button;
15601560
}
15611561
case A:
15621562
{
1563+
MemoryWatch[tempMenuSelectedOption].PosX = MemoryWatchPosition.PosX;
1564+
MemoryWatch[tempMenuSelectedOption].PosY = MemoryWatchPosition.PosY;
1565+
15631566
SelectedOption = 0;
15641567
HideMenu = false;
15651568

@@ -1568,8 +1571,6 @@ uint32_t memoryChangeWatchPositionButtonControls()
15681571
}
15691572
case B:
15701573
{
1571-
MemoryWatch[tempMenuSelectedOption].PosX = MemoryWatchPosition.PosX;
1572-
MemoryWatch[tempMenuSelectedOption].PosY = MemoryWatchPosition.PosY;
15731574
SelectedOption = 0;
15741575
HideMenu = false;
15751576

0 commit comments

Comments
 (0)