9 Add PC Access in PokeNav
tm6789 edited this page 2024-04-04 17:36:34 -07:00

By devolov

Goal: I wanted to be able to access the PC in the overworld through the PokeNav. If I can use my smartphone to do online banking, then I should be able to use my PokeNav to do the same in the game!
Accessing works in the Condition menu and it so it can only be accessible if you can also fly or teleport. If you want to allow it to work in caves and tunnels, change Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) to IsMapTypeOutdoors(gMapHeader.mapType).

Addition of the Option in the Conditions menu of the Pokenav:

Accessing PC in Pokenav

Using the PC after selecting:

PC in overworld

Message showing PC access cannot work:

Go Outside

1. Add this image to graphics/pokenav/options, and name it pc.png

Access PC Icon

2. Make all these code changes:

Add the png in the make file.

---------------------------- graphics_file_rules.mk ----------------------------
index 8f74216a7..6f86ea8d7 100644
@@ -649,9 +649,10 @@ $(PKNAVOPTIONSGFXDIR)/options.4bpp: $(PKNAVOPTIONSGFXDIR)/hoenn_map.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/condition.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/match_call.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/ribbons.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/switch_off.4bpp \
+                                    $(PKNAVOPTIONSGFXDIR)/pc.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/party.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/search.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/cool.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/beauty.4bpp \
                                     $(PKNAVOPTIONSGFXDIR)/cute.4bpp \

--------------------------- src/pokenav_main_menu.c ---------------------------
index c51ab10bae..777045dd41 100644
@@ -165,8 +165,12 @@ static const struct CompressedSpriteSheet sMenuLeftHeaderSpriteSheets[] =
 };
 
 static const struct CompressedSpriteSheetNoSize sPokenavSubMenuLeftHeaderSpriteSheets[] =
 {
+    [POKENAV_GFX_ACCESS_PC - POKENAV_GFX_SUBMENUS_START] = {
+        .data = gPokenavLeftHeaderParty_Gfx,
+        .tag = 1
+    },
     [POKENAV_GFX_PARTY_MENU - POKENAV_GFX_SUBMENUS_START] = {
         .data = gPokenavLeftHeaderParty_Gfx,
         .tag = 1
     },

Adds the text that tell you to access the PC and whether you can.

-------------------------------- src/strings.c --------------------------------
index 622d7613e..0754558a9 100644
@@ -944,10 +944,12 @@ const u8 gText_Box[] = _("BOX");
 const u8 gText_CheckMapOfHoenn[] = _("Check the map of the HOENN region.");
 const u8 gText_CheckPokemonInDetail[] = _("Check POKéMON in detail.");
 const u8 gText_CallRegisteredTrainer[] = _("Call a registered TRAINER.");
 const u8 gText_CheckObtainedRibbons[] = _("Check obtained RIBBONS.");
+const u8 gText_Pokenav_Access_PC[] = _("Access your PC.");
 const u8 gText_PutAwayPokenav[] = _("Put away the POKéNAV.");
 const u8 gText_NoRibbonWinners[] = _("There are no RIBBON winners.");
+const u8 gText_Pokenav_Cannot_Access_PC[] = _("Can't access PC. Go outside.");
 const u8 gText_NoTrainersRegistered[] = _("No TRAINERS are registered."); // Unused
 const u8 gText_CheckPartyPokemonInDetail[] = _("Check party POKéMON in detail.");
 const u8 gText_CheckAllPokemonInDetail[] = _("Check all POKéMON in detail.");
 const u8 gText_ReturnToPokenavMenu[] = _("Return to the POKéNAV menu.");
------------------------------ include/strings.h ------------------------------
index 49e9784474..87ec2c55c3 100644
@@ -2966,8 +2966,9 @@ extern const u8 gText_Cancel6[];
 // Pokenav Menu Handler
 extern const u8 gText_CheckMapOfHoenn[];
 extern const u8 gText_CheckPokemonInDetail[];
 extern const u8 gText_CallRegisteredTrainer[];
+extern const u8 gText_Pokenav_Access_PC[];
 extern const u8 gText_CheckObtainedRibbons[];
 extern const u8 gText_PutAwayPokenav[];
 extern const u8 gText_CheckPartyPokemonInDetail[];
 extern const u8 gText_CheckAllPokemonInDetail[];
@@ -2977,8 +2978,9 @@ extern const u8 gText_FindBeautifulPokemon[];
 extern const u8 gText_FindCutePokemon[];
 extern const u8 gText_FindSmartPokemon[];
 extern const u8 gText_FindToughPokemon[];
 extern const u8 gText_ReturnToConditionMenu[];
+extern const u8 gText_Pokenav_Cannot_Access_PC[];
 extern const u8 gText_NoRibbonWinners[];
 
 // Pokenav
 extern const u8 gText_NumberIndex[];

Since the 4bpp file made from the png gets concatenated to all the other options into one file, these edits need to be made in order to properly show the new icon. Also handles showing the text if accessing the PC is not allowed.

------------------------ src/pokenav_menu_handler_gfx.c ------------------------
index ec8d67cbe..a1aa8207c 100644
@@ -58,8 +58,9 @@ static u32 LoopedTask_OpenConditionMenu(s32);
 static u32 LoopedTask_ReturnToMainMenu(s32);
 static u32 LoopedTask_OpenConditionSearchMenu(s32);
 static u32 LoopedTask_ReturnToConditionMenu(s32);
 static u32 LoopedTask_SelectRibbonsNoWinners(s32);
+static u32 LoopedTask_CannotAccessPC(s32);
 static u32 LoopedTask_ReShowDescription(s32);
 static u32 LoopedTask_OpenPokenavFeature(s32);
 static void LoadPokenavOptionPalettes(void);
 static void FreeAndDestroyMainMenuSprites(void);
@@ -82,8 +83,9 @@ static void SpriteCB_BlinkingBlueLight(struct Sprite *);
 static void DestroyRematchBlueLightSprite(void);
 static void AddOptionDescriptionWindow(void);
 static void PrintCurrentOptionDescription(void);
 static void PrintNoRibbonWinners(void);
+static void PrintCannotAccessPC(void);
 static bool32 IsDma3ManagerBusyWithBgCopy_(void);
 static void CreateMovingBgDotsTask(void);
 static void DestroyMovingDotsBgTask(void);
 static void Task_MoveBgDots(u8);
@@ -145,16 +147,17 @@ static const LoopedTask sMenuHandlerLoopTaskFuncs[] =
     [POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH] = LoopedTask_OpenConditionSearchMenu,
     [POKENAV_MENU_FUNC_RETURN_TO_CONDITION]   = LoopedTask_ReturnToConditionMenu,
     [POKENAV_MENU_FUNC_NO_RIBBON_WINNERS]     = LoopedTask_SelectRibbonsNoWinners,
     [POKENAV_MENU_FUNC_RESHOW_DESCRIPTION]    = LoopedTask_ReShowDescription,
-    [POKENAV_MENU_FUNC_OPEN_FEATURE]          = LoopedTask_OpenPokenavFeature
+    [POKENAV_MENU_FUNC_OPEN_FEATURE]          = LoopedTask_OpenPokenavFeature,
+    [POKENAV_MENU_FUNC_CANNOT_ACCESS_PC]      = LoopedTask_CannotAccessPC
 };
 
 static const struct CompressedSpriteSheet sPokenavOptionsSpriteSheets[] =
 {
     {
         .data = gPokenavOptions_Gfx,
-        .size = 0x3400,
+        .size = 0x3800,
         .tag = GFXTAG_OPTIONS
     },
     {
         .data = sMatchCallBlueLightTiles,
@@ -179,16 +182,17 @@ static const u16 sOptionsLabelGfx_RegionMap[] = {0x000, PALTAG_OPTIONS_DEFAULT -
 static const u16 sOptionsLabelGfx_Condition[] = {0x020, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
 static const u16 sOptionsLabelGfx_MatchCall[] = {0x040, PALTAG_OPTIONS_RED - PALTAG_OPTIONS_START};
 static const u16 sOptionsLabelGfx_Ribbons[]   = {0x060, PALTAG_OPTIONS_PINK - PALTAG_OPTIONS_START};
 static const u16 sOptionsLabelGfx_SwitchOff[] = {0x080, PALTAG_OPTIONS_BEIGE - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Party[]     = {0x0A0, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Search[]    = {0x0C0, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Cool[]      = {0x0E0, PALTAG_OPTIONS_RED - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Beauty[]    = {0x100, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Cute[]      = {0x120, PALTAG_OPTIONS_PINK - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Smart[]     = {0x140, PALTAG_OPTIONS_DEFAULT - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Tough[]     = {0x160, PALTAG_OPTIONS_DEFAULT - PALTAG_OPTIONS_START};
-static const u16 sOptionsLabelGfx_Cancel[]    = {0x180, PALTAG_OPTIONS_BEIGE - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_AccessPC[]  = {0x0A0, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Party[]     = {0x0C0, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Search[]    = {0x0E0, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Cool[]      = {0x100, PALTAG_OPTIONS_RED - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Beauty[]    = {0x120, PALTAG_OPTIONS_BLUE - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Cute[]      = {0x140, PALTAG_OPTIONS_PINK - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Smart[]     = {0x160, PALTAG_OPTIONS_DEFAULT - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Tough[]     = {0x180, PALTAG_OPTIONS_DEFAULT - PALTAG_OPTIONS_START};
+static const u16 sOptionsLabelGfx_Cancel[]    = {0x1A0, PALTAG_OPTIONS_BEIGE - PALTAG_OPTIONS_START};
 
 struct
 {
     u16 yStart;
@@ -230,11 +234,12 @@ struct
         }
     },
     [POKENAV_MENU_TYPE_CONDITION] =
     {
-        .yStart = 56,
+        .yStart = 49,
         .deltaY = 20,
         .gfx = {
+            sOptionsLabelGfx_AccessPC,
             sOptionsLabelGfx_Party,
             sOptionsLabelGfx_Search,
             sOptionsLabelGfx_Cancel
         }
@@ -271,8 +276,9 @@ static const u8 *const sPageDescriptions[] =
     [POKENAV_MENUITEM_CONDITION]               = gText_CheckPokemonInDetail,
     [POKENAV_MENUITEM_MATCH_CALL]              = gText_CallRegisteredTrainer,
     [POKENAV_MENUITEM_RIBBONS]                 = gText_CheckObtainedRibbons,
     [POKENAV_MENUITEM_SWITCH_OFF]              = gText_PutAwayPokenav,
+    [POKENAV_MENUITEM_CONDITION_ACCESS_PC]     = gText_Pokenav_Access_PC,
     [POKENAV_MENUITEM_CONDITION_PARTY]         = gText_CheckPartyPokemonInDetail,
     [POKENAV_MENUITEM_CONDITION_SEARCH]        = gText_CheckAllPokemonInDetail,
     [POKENAV_MENUITEM_CONDITION_CANCEL]        = gText_ReturnToPokenavMenu,
     [POKENAV_MENUITEM_CONDITION_SEARCH_COOL]   = gText_FindCoolPokemon,
@@ -713,8 +719,24 @@ static u32 LoopedTask_ReturnToConditionMenu(s32 state)
        break;
    }
    return LT_FINISH;
}

+static u32 LoopedTask_CannotAccessPC(s32 state)
+{
+    switch (state)
+    {
+    case 0:
+        PlaySE(SE_FAILURE);
+        PrintCannotAccessPC();
+        return LT_INC_AND_PAUSE;
+    case 1:
+        if (IsDma3ManagerBusyWithBgCopy())
+            return LT_PAUSE;
+        break;
+    }
+    return LT_FINISH;
+}

// For redisplaying the Ribbons description to replace the No Ribbon Winners message
static u32 LoopedTask_ReShowDescription(s32 state)
{
    switch (state)
@@ -1238,8 +1260,17 @@ static void PrintNoRibbonWinners(void)
     FillWindowPixelBuffer(gfx->optionDescWindowId, PIXEL_FILL(6));
     AddTextPrinterParameterized3(gfx->optionDescWindowId, FONT_NORMAL, (192 - width) / 2, 1, sOptionDescTextColors2, 0, s);
 }
 
+static void PrintCannotAccessPC(void)
+{
+    struct Pokenav_MenuGfx * gfx = GetSubstructPtr(POKENAV_SUBSTRUCT_MENU_GFX);
+    const u8 * s = gText_Pokenav_Cannot_Access_PC;
+    u32 width = GetStringWidth(FONT_NORMAL, s, -1);
+    FillWindowPixelBuffer(gfx->optionDescWindowId, PIXEL_FILL(6));
+    AddTextPrinterParameterized3(gfx->optionDescWindowId, FONT_NORMAL, (192 - width) / 2, 1, sOptionDescTextColors2, 0, s);
+}
+
 static bool32 IsDma3ManagerBusyWithBgCopy_(void)
 {
     return IsDma3ManagerBusyWithBgCopy();
 }

This is where most of the logic exists. gSysPcFromPokenav is used to stop the start menu from reshowing when the PokeNav closes, to lock the player in place, and to avoid metatile goofiness where accessing the PC would normally change the tile you're facing into a turned on PC.

Add gSysPcFromPokenav into overworld.h so it can be in the scope of other functions.

----------------------------- include/overworld.h -----------------------------
index 1bd0bdd110..5d8176df63 100644
@@ -54,8 +54,9 @@ extern u16 gHeldKeyCodeToSend;
 extern void (*gFieldCallback)(void);
 extern bool8 (*gFieldCallback2)(void);
 extern u8 gLocalLinkPlayerId;
 extern u8 gFieldLinkPlayerCount;
+extern bool8 gSysPcFromPokenav;
 
 extern const struct UCoords32 gDirectionToVectors[];
 
 void DoWhiteOut(void);

-------------------------- src/pokenav_menu_handler.c --------------------------
index b81b4c892..d6b62d021 100644
@@ -2,9 +2,15 @@
 #include "pokenav.h"
 #include "event_data.h"
 #include "main.h"
 #include "sound.h"
+#include "task.h"
+#include "palette.h"
 #include "constants/songs.h"
+#include "script.h"
+#include "overworld.h"
+#include "event_scripts.h"
+
 
 struct Pokenav_Menu
 {
     u16 menuType;
@@ -30,15 +36,17 @@ static u32 HandleMainMenuInputTutorial(struct Pokenav_Menu *);
 static u32 HandleMainMenuInput(struct Pokenav_Menu *);
 static u32 (*GetMainMenuInputHandler(void))(struct Pokenav_Menu *);
 static void SetMenuInputHandler(struct Pokenav_Menu *);
 
+extern const u8 EventScript_PCMainMenu[];
+
 // Number of entries - 1 for that menu type
 static const u8 sLastCursorPositions[] =
 {
     [POKENAV_MENU_TYPE_DEFAULT]           = 2,
     [POKENAV_MENU_TYPE_UNLOCK_MC]         = 3,
     [POKENAV_MENU_TYPE_UNLOCK_MC_RIBBONS] = 4,
-    [POKENAV_MENU_TYPE_CONDITION]         = 2,
+    [POKENAV_MENU_TYPE_CONDITION]         = 3,
     [POKENAV_MENU_TYPE_CONDITION_SEARCH]  = 5
 };
 
 static const u8 sMenuItems[][MAX_POKENAV_MENUITEMS] =
@@ -65,12 +73,13 @@ static const u8 sMenuItems[][MAX_POKENAV_MENUITEMS] =
         [4 ... MAX_POKENAV_MENUITEMS - 1] = POKENAV_MENUITEM_SWITCH_OFF
     },
     [POKENAV_MENU_TYPE_CONDITION] =
     {
+        POKENAV_MENUITEM_CONDITION_ACCESS_PC,
         POKENAV_MENUITEM_CONDITION_PARTY,
         POKENAV_MENUITEM_CONDITION_SEARCH,
         POKENAV_MENUITEM_CONDITION_CANCEL,
-        [3 ... MAX_POKENAV_MENUITEMS - 1] = POKENAV_MENUITEM_SWITCH_OFF
+        [4 ... MAX_POKENAV_MENUITEMS - 1] = POKENAV_MENUITEM_SWITCH_OFF
     },
     [POKENAV_MENU_TYPE_CONDITION_SEARCH] =
     {
         POKENAV_MENUITEM_CONDITION_SEARCH_COOL,
@@ -145,9 +154,9 @@ bool32 PokenavCallback_Init_ConditionMenu(void)
         return FALSE;
 
     menu->menuType = POKENAV_MENU_TYPE_CONDITION;
     menu->cursorPos = 0;   //party
-    menu->currMenuItem = POKENAV_MENUITEM_CONDITION_PARTY;
+    menu->currMenuItem = POKENAV_MENUITEM_CONDITION_ACCESS_PC;
     menu->helpBarIndex = HELPBAR_NONE;
     SetMenuInputHandler(menu);
     return TRUE;
 }
@@ -337,8 +346,36 @@ static u32 HandleCantOpenRibbonsInput(struct Pokenav_Menu *menu)
 
     return POKENAV_MENU_FUNC_NONE;
 }
 
+
+static u32 HandleCantAccessPCInput(struct Pokenav_Menu *menu)
+{
+    if (UpdateMenuCursorPos(menu))
+    {
+        menu->callback = HandleConditionMenuInput;
+        return POKENAV_MENU_FUNC_MOVE_CURSOR;
+    }
+
+    if (JOY_NEW(A_BUTTON | B_BUTTON))
+    {
+        menu->callback = HandleConditionMenuInput;
+        return POKENAV_MENU_FUNC_RESHOW_DESCRIPTION;
+    }
+
+    return POKENAV_MENU_FUNC_NONE;
+}
+
+
+static void Task_WaitFadeAccessPC(u8 taskId)
+{
+    if (WaitForPokenavShutdownFade())
+    {
+        ScriptContext_SetupScript(EventScript_PCMainMenu);
+        DestroyTask(taskId);
+    }
+}
+
 static u32 HandleConditionMenuInput(struct Pokenav_Menu *menu)
 {
     if (UpdateMenuCursorPos(menu))
         return POKENAV_MENU_FUNC_MOVE_CURSOR;
@@ -352,8 +389,19 @@ static u32 HandleConditionMenuInput(struct Pokenav_Menu *menu)
             menu->cursorPos = 0;
             menu->currMenuItem = sMenuItems[POKENAV_MENU_TYPE_CONDITION_SEARCH][0];
             menu->callback = HandleConditionSearchMenuInput;
             return POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH;
+        case POKENAV_MENUITEM_CONDITION_ACCESS_PC:
+            if(Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType)){
+                gSysPcFromPokenav = TRUE;
+                // Reusing from debug menu to gracefully close PC when done.
+                CreateTask(Task_WaitFadeAccessPC, 0);
+                return POKENAV_MENU_FUNC_EXIT; 
+            }
+            else{
+                menu->callback = HandleCantAccessPCInput;
+                return POKENAV_MENU_FUNC_CANNOT_ACCESS_PC;
+            }
         case POKENAV_MENUITEM_CONDITION_PARTY:
             menu->helpBarIndex = 0;
             SetMenuIdAndCB(menu, POKENAV_CONDITION_GRAPH_PARTY);
             return POKENAV_MENU_FUNC_OPEN_FEATURE;
 -------------------------------- src/pokenav.c --------------------------------
index 03f48ee36..1988b103e 100644
@@ -6,8 +6,9 @@
 #include "field_weather.h"
 #include "palette.h"
 #include "pokemon_storage_system.h"
 #include "pokenav.h"
+#include "event_data.h"
 
 #define LOOPED_TASK_DECODE_STATE(action) (action - 5)
 
 #define LOOPED_TASK_ID(primary, secondary) (((secondary) << 16) |(primary))
@@ -204,8 +204,9 @@ const struct PokenavCallbacks PokenavMenuCallbacks[15] =
     },
 };
 
 EWRAM_DATA u8 gNextLoopedTaskId = 0;
+EWRAM_DATA bool8 gSysPcFromPokenav = 0;
 EWRAM_DATA struct PokenavResources *gPokenavResources = NULL;
 
 // code
 u32 CreateLoopedTask(LoopedTask loopedTask, u32 priority)
@@ -494,9 +495,13 @@ static void Task_Pokenav(u8 taskId)
             FreePokenavResources();
             if (calledFromScript)
                 SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
             else
-                SetMainCallback2(CB2_ReturnToFieldWithOpenMenu);
+                if (gSysPcFromPokenav)
+                    SetMainCallback2(CB2_ReturnToField);
+                else
+                    SetMainCallback2(CB2_ReturnToFieldWithOpenMenu);
+
         }
         break;
     }
 }
------------------------------ include/pokenav.h ------------------------------
index c6a8bb253e..90f7df55a6 100644
@@ -100,8 +100,9 @@ enum
enum
{
    POKENAV_GFX_MAIN_MENU,
    POKENAV_GFX_CONDITION_MENU,
    POKENAV_GFX_RIBBONS_MENU,
    POKENAV_GFX_MATCH_CALL_MENU,
    POKENAV_GFX_MAP_MENU_ZOOMED_OUT,
    POKENAV_GFX_MAP_MENU_ZOOMED_IN,
+   POKENAV_GFX_ACCESS_PC,
    POKENAV_GFX_PARTY_MENU,
    POKENAV_GFX_SEARCH_MENU,
    POKENAV_GFX_COOL_MENU,
    POKENAV_GFX_BEAUTY_MENU,
    POKENAV_GFX_CUTE_MENU,
    POKENAV_GFX_SMART_MENU,
    POKENAV_GFX_TOUGH_MENU,
    POKENAV_GFX_MENUS_END,
};
 
-#define POKENAV_GFX_SUBMENUS_START POKENAV_GFX_PARTY_MENU
+#define POKENAV_GFX_SUBMENUS_START POKENAV_GFX_ACCESS_PC
 
 #define POKENAV_MENU_IDS_START 100000
 enum
 {
@@ -151,8 +152,9 @@ enum
enum
{
    POKENAV_MENUITEM_MAP,
    POKENAV_MENUITEM_CONDITION,
    POKENAV_MENUITEM_MATCH_CALL,
    POKENAV_MENUITEM_RIBBONS,
    POKENAV_MENUITEM_SWITCH_OFF,
+   POKENAV_MENUITEM_CONDITION_ACCESS_PC,
    POKENAV_MENUITEM_CONDITION_PARTY,
    POKENAV_MENUITEM_CONDITION_SEARCH,
    POKENAV_MENUITEM_CONDITION_CANCEL,
    POKENAV_MENUITEM_CONDITION_SEARCH_COOL,
    POKENAV_MENUITEM_CONDITION_SEARCH_BEAUTY,
    POKENAV_MENUITEM_CONDITION_SEARCH_CUTE,
    POKENAV_MENUITEM_CONDITION_SEARCH_SMART,
    POKENAV_MENUITEM_CONDITION_SEARCH_TOUGH,
    POKENAV_MENUITEM_CONDITION_SEARCH_CANCEL,
};
@@ -245,8 +247,9 @@ enum RegionMapFuncIds
enum RegionMapFuncIds
{
    POKENAV_MENU_FUNC_NONE,
    POKENAV_MENU_FUNC_MOVE_CURSOR,
    POKENAV_MENU_FUNC_OPEN_CONDITION,
    POKENAV_MENU_FUNC_RETURN_TO_MAIN,
    POKENAV_MENU_FUNC_OPEN_CONDITION_SEARCH,
    POKENAV_MENU_FUNC_RETURN_TO_CONDITION,
    POKENAV_MENU_FUNC_NO_RIBBON_WINNERS,
    POKENAV_MENU_FUNC_RESHOW_DESCRIPTION,
    POKENAV_MENU_FUNC_OPEN_FEATURE,
+   POKENAV_MENU_FUNC_CANNOT_ACCESS_PC,
};

Not adding this part below in would cause the map tiles to change to a turned on and turned off PC.

----------------------------- src/field_specials.c -----------------------------
index 03aebb0ce..3a27720f7 100644
@@ -64,8 +64,9 @@
 #include "constants/battle_frontier.h"
 #include "constants/weather.h"
 #include "constants/metatile_labels.h"
 #include "palette.h"
+#include "event_data.h"
 
 EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE;
 EWRAM_DATA u8 gBikeCollisions = 0;
 static EWRAM_DATA u32 sBikeCyclingTimer = 0;
@@ -1021,8 +1022,10 @@ static void PCTurnOnEffect_0(struct Task *task)
 
 static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy)
 {
     u16 tileId = 0;
+    if(gSysPcFromPokenav)
+        return;
     if (isPcTurnedOn)
     {
         if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
             tileId = METATILE_Building_PC_Off;
@@ -1049,8 +1052,12 @@ void DoPCTurnOffEffect(void)
 }
 
 static void PCTurnOffEffect(void)
 {
     s8 dx = 0;
     s8 dy = 0;
     u16 tileId = 0;
     u8 playerDirection = GetPlayerFacingDirection();
+    if(gSysPcFromPokenav){
+        gSysPcFromPokenav = FALSE;
+        return;
+    }
    switch (playerDirection)
    {
    case DIR_NORTH:
        dx = 0;

This locks the character in place until you leave the PC and gSysPcFromPokenav is cleared.

-------------------------- src/field_screen_effect.c --------------------------
index 57f8cc52e..a36f61a25 100644
@@ -410,9 +410,9 @@ static void Task_ExitNonDoor(u8 taskId)
         LockPlayerFieldControls();
         gTasks[taskId].tState++;
         break;
     case 1:
-        if (WaitForWeatherFadeIn())
+        if (WaitForWeatherFadeIn()  && !gSysPcFromPokenav)
         {
             UnfreezeObjectEvents();
             UnlockPlayerFieldControls();
             DestroyTask(taskId);