Got pokemart and pokecenter changes working

This commit is contained in:
pkmnsnfrn 2024-07-25 19:33:07 -07:00
parent 614b7f862e
commit fd69ef339c
6 changed files with 33 additions and 13 deletions

View file

@ -32,11 +32,13 @@
#define MB_SHOAL_CAVE_ENTRANCE 0x1C
#if OW_AUTO_SIGNPOST == TRUE
#define MB_SIGNPOST 0x1D
#define MB_SIGNPOST_POKECENTER 0x1E
#define MB_SIGNPOST_POKEMART 0x1F
#else
#define MB_UNUSED_1D 0x1D
#endif
#define MB_UNUSED_1E 0x1E
#define MB_UNUSED_1F 0x1F
#endif
#define MB_ICE 0x20
#define MB_SAND 0x21
#define MB_SEAWEED 0x22

View file

@ -648,4 +648,7 @@ extern const u8 VSSeeker_Text_TrainersNotReady[];
extern const u8 EventScript_VsSeekerChargingDone[];
extern const u8 EventScript_CancelMessageBox[];
extern const u8 Common_EventScript_ShowPokemonCenterSign[];
extern const u8 Common_EventScript_ShowPokemartSign[];
#endif // GUARD_EVENT_SCRIPTS_H

View file

@ -149,5 +149,7 @@ bool8 MetatileBehavior_IsLongGrass_Duplicate(u8);
bool8 MetatileBehavior_IsLongGrassSouthEdge(u8);
bool8 MetatileBehavior_IsTrainerHillTimer(u8);
bool8 MetatileBehavior_IsSignpost(u8 mb);
bool8 MetatileBehavior_IsPokemonCenterSign(u8 mb);
bool8 MetatileBehavior_IsPokeMartSign(u8 mb);
#endif // GUARD_METATILE_BEHAVIOR_H

View file

@ -1112,13 +1112,12 @@ static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 me
switch (GetFacingSignpostType(metatileBehavior, playerDirection))
{
/* leaving this commented out for examples of custom signpost types
case SIGNPOST_POKECENTER:
SetUpWalkIntoSignScript(EventScript_PokecenterSign, playerDirection);
SetUpWalkIntoSignScript(Common_EventScript_ShowPokemonCenterSign, playerDirection);
return TRUE;
case SIGNPOST_POKEMART:
SetUpWalkIntoSignScript(EventScript_PokemartSign, playerDirection);
return TRUE;*/
SetUpWalkIntoSignScript(Common_EventScript_ShowPokemartSign, playerDirection);
return TRUE;
case SIGNPOST_SCRIPTED:
script = GetSignpostScriptAtMapPosition(position);
if (script == NULL)
@ -1132,12 +1131,10 @@ static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u16 me
static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection)
{
/*if (MetatileBehavior_IsPlayerFacingPokemonCenterSign(metatileBehavior, playerDirection) == TRUE)
if (MetatileBehavior_IsPokemonCenterSign(metatileBehavior) == TRUE)
return SIGNPOST_POKECENTER;
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE)
return SIGNPOST_POKEMART;*/
DebugPrintf("behavior is %d",metatileBehavior);
if (MetatileBehavior_IsPokeMartSign(metatileBehavior) == TRUE)
return SIGNPOST_POKEMART;
if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE)
return SIGNPOST_SCRIPTED;
@ -1147,7 +1144,7 @@ static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection)
static void SetMsgSignPostAndVarFacing(u32 playerDirection)
{
DebugPrintf("test");
SetWalkingIntoSignVars();
MsgSetSignPost();
gSpecialVar_Facing = playerDirection;
}
@ -1155,7 +1152,6 @@ static void SetMsgSignPostAndVarFacing(u32 playerDirection)
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection)
{
ScriptContext_SetupScript(script);
SetWalkingIntoSignVars();
SetMsgSignPostAndVarFacing(playerDirection);
}

View file

@ -327,7 +327,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
static inline void *GetWindowFunc_DialogueFrame(void)
{
DebugPrintf("test %d",IsMsgSignPost());
return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame);
}

View file

@ -1413,3 +1413,21 @@ bool8 MetatileBehavior_IsSignpost(u8 mb)
#endif
}
bool8 MetatileBehavior_IsPokemonCenterSign(u8 mb)
{
#if OW_AUTO_SIGNPOST == TRUE
return (mb == MB_SIGNPOST_POKECENTER);
#else
return FALSE;
#endif
}
bool8 MetatileBehavior_IsPokeMartSign(u8 mb)
{
#if OW_AUTO_SIGNPOST == TRUE
return (mb == MB_SIGNPOST_POKEMART);
#else
return FALSE;
#endif
}