|
本帖最后由 744865306 于 2022-5-3 19:08 编辑
教程包括:开始菜单翻页程序和开始菜单查看,取放电脑精灵
欢迎转载此教程
首先,打开修改gText_MenuExit的文本为:下一页,并定义文本:- const u8 gText_MenuPC[]=_("电脑");
- const u8 gText_MenuPage[]=_("上一页");
复制代码 接着打开在底下添加:- extern const u8 gText_MenuPC[];
- extern const u8 gText_MenuPage[];
复制代码 打开找到MENU_ACTION的enum,更改:- enum
- {
- MENU_ACTION_POKEDEX,
- MENU_ACTION_POKEMON,
- MENU_ACTION_BAG,
- MENU_ACTION_POKENAV,
- MENU_ACTION_PLAYER,
- MENU_ACTION_SAVE,
- MENU_ACTION_OPTION,
- MENU_ACTION_PAGE,
- MENU_ACTION_PC,
- MENU_ACTION_EXIT,
- MENU_ACTION_RETIRE_SAFARI,
- MENU_ACTION_PLAYER_LINK,
- MENU_ACTION_REST_FRONTIER,
- MENU_ACTION_RETIRE_FRONTIER,
- MENU_ACTION_PYRAMID_BAG
- };
复制代码 定义新函数:- static bool8 StartMenuExitCallback(void);
- static bool8 StartMenuChangePage(void);
- static void BuildSecondStartMenu(void);
复制代码 定义新内存用于判断页数:- EWRAM_DATA static u8 sStartMenuPage = 0;
复制代码 搜索:- static const struct MenuAction sStartMenuItems[] =
复制代码 修改内容为:- static const struct MenuAction sStartMenuItems[] =
- {
- {gText_MenuPokedex, {.u8_void = StartMenuPokedexCallback}},
- {gText_MenuPokemon, {.u8_void = StartMenuPokemonCallback}},
- {gText_MenuBag, {.u8_void = StartMenuBagCallback}},
- {gText_MenuPokenav, {.u8_void = StartMenuPokeNavCallback}},
- {gText_MenuPlayer, {.u8_void = StartMenuPlayerNameCallback}},
- {gText_MenuSave, {.u8_void = StartMenuSaveCallback}},
- {gText_MenuOption, {.u8_void = StartMenuOptionCallback}},
- {gText_MenuExit, {.u8_void = StartMenuExitCallback}},
- {gText_MenuPC, {.u8_void = StartMenuPCCallback}},
- {gText_MenuPage, {.u8_void = StartMenuChangePage}},
- {gText_MenuRetire, {.u8_void = StartMenuSafariZoneRetireCallback}},
- {gText_MenuPlayer, {.u8_void = StartMenuLinkModePlayerNameCallback}},
- {gText_MenuRest, {.u8_void = StartMenuSaveCallback}},
- {gText_MenuRetire, {.u8_void = StartMenuBattlePyramidRetireCallback}},
- {gText_MenuBag, {.u8_void = StartMenuBattlePyramidBagCallback}}
- };
复制代码 修改BuildStartMenuActions函数:- static void BuildStartMenuActions(void)
- {
- sNumStartMenuActions = 0;
- if (StartMenuPage==0) {
- if (IsUpdateLinkStateCBActive() == TRUE)
- {
- BuildLinkModeStartMenu();
- }
- else if (InUnionRoom() == TRUE)
- {
- BuildUnionRoomStartMenu();
- }
- else if (GetSafariZoneFlag() == TRUE)
- {
- BuildSafariZoneStartMenu();
- }
- else if (InBattlePike())
- {
- BuildBattlePikeStartMenu();
- }
- else if (InBattlePyramid())
- {
- BuildBattlePyramidStartMenu();
- }
- else if (InMultiPartnerRoom())
- {
- BuildMultiPartnerRoomStartMenu();
- }
- else
- {
- BuildNormalStartMenu();
- }
- }
- if (StartMenuPage==1) {
- BuildSecondStartMenu();
- }
- }
复制代码 搜索:- if (gMenuCallback != StartMenuSaveCallback
- && gMenuCallback != StartMenuExitCallback
- && gMenuCallback != StartMenuSafariZoneRetireCallback
- && gMenuCallback != StartMenuBattlePyramidRetireCallback)
复制代码 更改为:- if (gMenuCallback != StartMenuSaveCallback
- && gMenuCallback != StartMenuExitCallback
- && gMenuCallback != StartMenuSafariZoneRetireCallback
- && gMenuCallback != StartMenuBattlePyramidRetireCallback
- && gMenuCallback != StartMenuChangePage)
复制代码 添加新函数:- /*设置第二页内容*/
- static void BuildSecondStartMenu(void) {
- AddStartMenuAction(MENU_ACTION_PC);
- AddStartMenuAction(MENU_ACTION_EXIT);
- }
- static bool8 StartMenuPCCallback(void)
- {
- u8 taskId;
- if (!gPaletteFade.active)
- {
- PlayRainStoppingSoundEffect();
- RemoveExtraStartMenuWindows();
- EnterPokeStorage(2);
- return TRUE;
- }
- return FALSE;
- }
- /*切换到第一页*/
- static bool8 StartMenuChangePage(void) {
- sStartMenuPage=0;
- RemoveExtraStartMenuWindows();
- HideStartMenu();
- ShowStartMenu();
- }
复制代码 最后,更改StartMenuExitCallback函数为:- static bool8 StartMenuExitCallback(void)
- {
- sStartMenuPage=1;
- RemoveExtraStartMenuWindows();
- HideStartMenu(); // Hide start menu
- ShowStartMenu();
- return TRUE;
- }
复制代码 教程结束,欢迎各位大佬进行优化 |
评分
-
查看全部评分
|