Challenges menu can be opened in scripts

This commit is contained in:
resetes12
2024-01-06 16:21:15 +01:00
parent c94edeb04f
commit 1d7865b3f7
6 changed files with 56 additions and 14 deletions

View File

@@ -43,27 +43,44 @@ Debug_CheatStart::
end
Debug_Script_1::
special SavePlayerParty
msgbox Debug_Script_1_Text, MSGBOX_YESNO
switch VAR_RESULT
case NO, Debug_Script_1_Closemessage
case MULTI_B_PRESSED, Debug_Script_1_Closemessage
msgbox Debug_Script_1_Text2, MSGBOX_DEFAULT
closemessage
callnative Task_ChooseChallenge_NoNewGame
end
Debug_Script_1_Closemessage::
closemessage
end
Debug_Script_1_Text:
.string "WARNING! ENTERING THE CHALLENGES\n"
.string "MENU COULD MESS YOUR SAVE DATA.\p"
.string "SOME OPTIONS MAY NOT WORK UNLESS A\n"
.string "NEW GAME IS STARTED. PLEASE BACKUP\p"
.string "YOUR DATA BEFORE PRESSING YES.$"
Debug_Script_1_Text2:
.string "ALL OPTIONS YOU CHOSE AT THE START\n"
.string "OF THE GAME WILL RESET AND YOU\l"
.string "WILL HAVE TO ENABLE THEM AGAIN.$"
Debug_Script_2::
setflag FLAG_LIMIT_TO_50
end
Debug_Script_3::
calculatemonstats
end
Debug_Script_4::
special LoadPlayerParty
end
Debug_Script_5::
clearflag FLAG_LIMIT_TO_50
end
Debug_Script_6::
deleteparty
end
Debug_Script_7::

View File

@@ -158,6 +158,7 @@ void CB2_LoadMap(void);
void CB2_ReturnToFieldContestHall(void);
void CB2_ReturnToFieldCableClub(void);
void CB2_ReturnToField(void);
void CB2_ReturnToField_SaveChallengesData(void);
void CB2_ReturnToFieldFromMultiplayer(void);
void CB2_ReturnToFieldWithOpenMenu(void);
void CB2_ReturnToFieldContinueScript(void);

View File

@@ -64,6 +64,7 @@
#define TX_RANDOM_T_STATIC 6
void CB2_InitTxRandomizerChallengesMenu(void);
void Task_ChooseChallenge_NoNewGame(u8 taskId);
void SaveData_TxRandomizerAndChallenges(void);
bool8 IsRandomizerActivated(void);

View File

@@ -419,14 +419,14 @@ static const u8 sDebugText_Sound[] = _("Sound…{CLEAR_TO 110}{RIGHT_
static const u8 sDebugText_AccessPC[] = _("Access PC…{CLEAR_TO 110}{RIGHT_ARROW}");
static const u8 sDebugText_Cancel[] = _("Cancel");
// Script menu
static const u8 sDebugText_Util_Script_1[] = _("Script 1");
static const u8 sDebugText_Util_Script_2[] = _("Script 2");
static const u8 sDebugText_Util_Script_3[] = _("Script 3");
static const u8 sDebugText_Util_Script_4[] = _("Script 4");
static const u8 sDebugText_Util_Script_5[] = _("Script 5");
static const u8 sDebugText_Util_Script_6[] = _("Script 6");
static const u8 sDebugText_Util_Script_7[] = _("Script 7");
static const u8 sDebugText_Util_Script_8[] = _("Script 8");
static const u8 sDebugText_Util_Script_1[] = _("Open Challenges Menu");
static const u8 sDebugText_Util_Script_2[] = _("Script 2 (Empty)");
static const u8 sDebugText_Util_Script_3[] = _("Script 3 (Empty)");
static const u8 sDebugText_Util_Script_4[] = _("Script 4 (Empty)");
static const u8 sDebugText_Util_Script_5[] = _("Script 5 (Empty)");
static const u8 sDebugText_Util_Script_6[] = _("Script 6 (Empty)");
static const u8 sDebugText_Util_Script_7[] = _("Script 7 (Empty)");
static const u8 sDebugText_Util_Script_8[] = _("Script 8 (Empty)");
// Util Menu
static const u8 sDebugText_Util_HealParty[] = _("Heal Party");
static const u8 sDebugText_Util_Fly[] = _("Fly to map…{CLEAR_TO 110}{RIGHT_ARROW}");

View File

@@ -1851,6 +1851,21 @@ void CB2_ReturnToField(void)
}
}
void CB2_ReturnToField_SaveChallengesData(void)
{
if (IsOverworldLinkActive() == TRUE)
{
SetMainCallback2(CB2_ReturnToFieldLink);
SaveData_TxRandomizerAndChallenges();
}
else
{
FieldClearVBlankHBlankCallbacks();
SetMainCallback2(CB2_ReturnToFieldLocal);
SaveData_TxRandomizerAndChallenges();
}
}
static void CB2_ReturnToFieldLocal(void)
{
if (ReturnToFieldLocal(&gMain.state))

View File

@@ -10,6 +10,7 @@
#include "bg.h"
#include "gpu_regs.h"
#include "window.h"
#include "overworld.h"
#include "text.h"
#include "text_window.h"
#include "international_string_util.h"
@@ -1307,6 +1308,13 @@ void CB2_InitTxRandomizerChallengesMenu(void)
}
}
void Task_ChooseChallenge_NoNewGame(u8 taskId)
{
gMain.savedCallback = CB2_ReturnToField_SaveChallengesData;
SetMainCallback2(CB2_InitTxRandomizerChallengesMenu);
DestroyTask(taskId);
}
static void Task_OptionMenuFadeIn(u8 taskId)
{
if (!gPaletteFade.active)