added Debug to StartMenu via DEBUG_MENU option

This commit is contained in:
TheXaman 2021-07-02 11:49:32 +02:00
parent a663742eba
commit af355fcb12
3 changed files with 69 additions and 8 deletions

View File

@ -5,4 +5,6 @@
void Debug_ShowMainMenu(void);
#endif
#define DEBUG_MENU FALSE
#endif // GUARD_DEBUG_H

View File

@ -132,7 +132,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
else if (heldKeys & DPAD_RIGHT)
input->dpadDirection = DIR_EAST;
#if DEBUGGING && !DEBUG_MENU
//DEBUG
if (heldKeys & R_BUTTON)
{
@ -158,7 +158,7 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
input->pressedStartButton = FALSE;
}
}
//
#endif
}
@ -219,7 +219,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE)
return TRUE;
#if DEBUGGING
#if DEBUGGING && !DEBUG_MENU
if (input->input_field_1_2)
{
PlaySE(SE_WIN_OPEN);

View File

@ -3,6 +3,7 @@
#include "battle_pyramid.h"
#include "battle_pyramid_bag.h"
#include "bg.h"
#include "debug.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "event_object_lock.h"
@ -61,7 +62,8 @@ enum
MENU_ACTION_PLAYER_LINK,
MENU_ACTION_REST_FRONTIER,
MENU_ACTION_RETIRE_FRONTIER,
MENU_ACTION_PYRAMID_BAG
MENU_ACTION_PYRAMID_BAG,
MENU_ACTION_DEBUG,
};
// Save status
@ -102,6 +104,7 @@ static bool8 StartMenuSafariZoneRetireCallback(void);
static bool8 StartMenuLinkModePlayerNameCallback(void);
static bool8 StartMenuBattlePyramidRetireCallback(void);
static bool8 StartMenuBattlePyramidBagCallback(void);
static bool8 StartMenuDebugCallback(void);
// Menu callbacks
static bool8 SaveStartCallback(void);
@ -153,6 +156,8 @@ static const u8* const sPyramindFloorNames[] =
static const struct WindowTemplate sPyramidFloorWindowTemplate_2 = {0, 1, 1, 0xA, 4, 0xF, 8};
static const struct WindowTemplate sPyramidFloorWindowTemplate_1 = {0, 1, 1, 0xC, 4, 0xF, 8};
static const u8 gText_MenuDebug[] = _("DEBUG");
static const struct MenuAction sStartMenuItems[] =
{
{gText_MenuPokedex, {.u8_void = StartMenuPokedexCallback}},
@ -167,7 +172,8 @@ static const struct MenuAction sStartMenuItems[] =
{gText_MenuPlayer, {.u8_void = StartMenuLinkModePlayerNameCallback}},
{gText_MenuRest, {.u8_void = StartMenuSaveCallback}},
{gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}},
{gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}
{gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}},
{gText_MenuDebug, {.u8_void = StartMenuDebugCallback}},
};
static const struct BgTemplate sUnknown_085105A8[] =
@ -195,6 +201,7 @@ static const struct WindowTemplate sSaveInfoWindowTemplate = {0, 1, 1, 0xE, 0xA,
static void BuildStartMenuActions(void);
static void AddStartMenuAction(u8 action);
static void BuildNormalStartMenu(void);
static void BuildDebugStartMenu(void);
static void BuildSafariZoneStartMenu(void);
static void BuildLinkModeStartMenu(void);
static void BuildUnionRoomStartMenu(void);
@ -223,6 +230,7 @@ static void CB2_SaveAfterLinkBattle(void);
static void ShowSaveInfoWindow(void);
static void RemoveSaveInfoWindow(void);
static void HideStartMenuWindow(void);
static void HideStartMenuDebug(void);
void SetDexPokemonPokenavFlags(void) // unused
{
@ -259,10 +267,17 @@ static void BuildStartMenuActions(void)
{
BuildMultiPartnerRoomStartMenu();
}
#if DEBUGGING && DEBUG_MENU
else
{
BuildDebugStartMenu();
}
#else
else
{
BuildNormalStartMenu();
}
{
BuildNormalStartMenu();
}
#endif
}
static void AddStartMenuAction(u8 action)
@ -294,6 +309,30 @@ static void BuildNormalStartMenu(void)
AddStartMenuAction(MENU_ACTION_EXIT);
}
static void BuildDebugStartMenu(void)
{
if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE)
{
AddStartMenuAction(MENU_ACTION_POKEDEX);
}
if (FlagGet(FLAG_SYS_POKEMON_GET) == TRUE)
{
AddStartMenuAction(MENU_ACTION_POKEMON);
}
AddStartMenuAction(MENU_ACTION_BAG);
if (FlagGet(FLAG_SYS_POKENAV_GET) == TRUE)
{
AddStartMenuAction(MENU_ACTION_POKENAV);
}
AddStartMenuAction(MENU_ACTION_PLAYER);
AddStartMenuAction(MENU_ACTION_SAVE);
AddStartMenuAction(MENU_ACTION_OPTION);
AddStartMenuAction(MENU_ACTION_DEBUG);
}
static void BuildSafariZoneStartMenu(void)
{
AddStartMenuAction(MENU_ACTION_RETIRE_SAFARI);
@ -575,6 +614,7 @@ static bool8 HandleStartMenuInput(void)
if (gMenuCallback != StartMenuSaveCallback
&& gMenuCallback != StartMenuExitCallback
&& gMenuCallback != StartMenuDebugCallback
&& gMenuCallback != StartMenuSafariZoneRetireCallback
&& gMenuCallback != StartMenuBattlePyramidRetireCallback)
{
@ -710,6 +750,18 @@ static bool8 StartMenuExitCallback(void)
return TRUE;
}
static bool8 StartMenuDebugCallback(void)
{
RemoveExtraStartMenuWindows();
HideStartMenuDebug(); // Hide start menu without enabling movement
#if DEBUGGING
Debug_ShowMainMenu();
#endif
return TRUE;
}
static bool8 StartMenuSafariZoneRetireCallback(void)
{
RemoveExtraStartMenuWindows();
@ -719,6 +771,13 @@ static bool8 StartMenuSafariZoneRetireCallback(void)
return TRUE;
}
static void HideStartMenuDebug(void)
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE);
RemoveStartMenuWindow();
}
static bool8 StartMenuLinkModePlayerNameCallback(void)
{
if (!gPaletteFade.active)