dont open dexnav from start menu if map has no encounters
This commit is contained in:
parent
4775e0372a
commit
7431044da1
3 changed files with 18 additions and 2 deletions
|
@ -42,5 +42,6 @@ u16 GetCurrentMapWildMonHeaderId(void);
|
|||
u8 ChooseWildMonIndex_Land(void);
|
||||
u8 ChooseWildMonIndex_WaterRock(void);
|
||||
u8 ChooseHiddenMonIndex(void);
|
||||
bool32 MapHasNoEncounterData(void);
|
||||
|
||||
#endif // GUARD_WILD_ENCOUNTER_H
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "window.h"
|
||||
#include "union_room.h"
|
||||
#include "dexnav.h"
|
||||
#include "wild_encounter.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "constants/songs.h"
|
||||
|
@ -171,8 +172,8 @@ static const struct MenuAction sStartMenuItems[] =
|
|||
[MENU_ACTION_PLAYER_LINK] = {gText_MenuPlayer, {.u8_void = StartMenuLinkModePlayerNameCallback}},
|
||||
[MENU_ACTION_REST_FRONTIER] = {gText_MenuRest, {.u8_void = StartMenuSaveCallback}},
|
||||
[MENU_ACTION_RETIRE_FRONTIER] = {gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}},
|
||||
[MENU_ACTION_PYRAMID_BAG] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}
|
||||
[MENU_ACTION_DEXNAV] = {gText_MenuDexNav, {.u8_void = StartMenuDexNavCallback}}
|
||||
[MENU_ACTION_PYRAMID_BAG] = {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}},
|
||||
[MENU_ACTION_DEXNAV] = {gText_MenuDexNav, {.u8_void = StartMenuDexNavCallback}},
|
||||
};
|
||||
|
||||
static const struct BgTemplate sBgTemplates_LinkBattleSave[] =
|
||||
|
@ -589,6 +590,10 @@ static bool8 HandleStartMenuInput(void)
|
|||
if (GetNationalPokedexCount(FLAG_GET_SEEN) == 0)
|
||||
return FALSE;
|
||||
}
|
||||
if (sCurrentStartMenuActions[sStartMenuCursorPos] == MENU_ACTION_DEXNAV
|
||||
&& MapHasNoEncounterData())
|
||||
return FALSE;
|
||||
|
||||
gMenuCallback = sStartMenuItems[sCurrentStartMenuActions[sStartMenuCursorPos]].func.u8_void;
|
||||
|
||||
if (gMenuCallback != StartMenuSaveCallback
|
||||
|
|
|
@ -963,3 +963,13 @@ u8 ChooseHiddenMonIndex(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool32 MapHasNoEncounterData(void)
|
||||
{
|
||||
u16 headerId = GetCurrentMapWildMonHeaderId();
|
||||
const struct WildPokemonInfo *landMonsInfo = gWildMonHeaders[headerId].landMonsInfo;
|
||||
const struct WildPokemonInfo *waterMonsInfo = gWildMonHeaders[headerId].waterMonsInfo;
|
||||
const struct WildPokemonInfo *hiddenMonsInfo = gWildMonHeaders[headerId].hiddenMonsInfo;
|
||||
|
||||
return (landMonsInfo == NULL && waterMonsInfo == NULL && hiddenMonsInfo == NULL);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue