Working version of interactable signpost msgbox

This commit is contained in:
pkmnsnfrn 2024-07-24 22:21:00 -07:00
parent 389f4e4180
commit 614b7f862e
2 changed files with 15 additions and 13 deletions

View file

@ -82,6 +82,7 @@ static void UpdateLetsGoEvolutionTracker(void);
static bool8 UpdatePoisonStepCounter(void);
#endif // OW_POISON_DAMAGE
static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection);
static void SetMsgSignPostAndVarFacing(u32 playerDirection);
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection);
static u8 GetFacingSignpostType(u16 metatileBehvaior, u8 direction);
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position);
@ -379,6 +380,9 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
if (bgEvent->bgUnion.script == NULL)
return EventScript_TestSignpostMsg;
if (GetFacingSignpostType(metatileBehavior, direction) != SIGNPOST_NA)
SetMsgSignPostAndVarFacing(direction);
switch (bgEvent->kind)
{
case BG_EVENT_PLAYER_FACING_ANY:
@ -1133,18 +1137,26 @@ static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection)
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE)
return SIGNPOST_POKEMART;*/
DebugPrintf("behavior is %d",metatileBehavior);
if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE)
return SIGNPOST_SCRIPTED;
return SIGNPOST_NA;
}
static void SetMsgSignPostAndVarFacing(u32 playerDirection)
{
DebugPrintf("test");
MsgSetSignPost();
gSpecialVar_Facing = playerDirection;
}
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection)
{
gSpecialVar_Facing = playerDirection;
ScriptContext_SetupScript(script);
SetWalkingIntoSignVars();
MsgSetSignPost();
SetMsgSignPostAndVarFacing(playerDirection);
}
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position)

View file

@ -225,7 +225,6 @@ void LoadSignPostWindowFrameGfx(void)
static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
// Top left
FillBgTilemapBufferRect(bg,
DLG_WINDOW_BASE_TILE_NUM + 0,
tilemapLeft - 2,
@ -254,8 +253,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
1,
4,
DLG_WINDOW_PALETTE_NUM);
// Bottom left
FillBgTilemapBufferRect(bg,
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
tilemapLeft - 2,
@ -270,8 +267,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
1,
1,
DLG_WINDOW_PALETTE_NUM);
// Top
FillBgTilemapBufferRect(bg,
DLG_WINDOW_BASE_TILE_NUM + 4,
tilemapLeft,
@ -279,8 +274,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
26,
1,
DLG_WINDOW_PALETTE_NUM);
// Top right
FillBgTilemapBufferRect(bg,
BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
tilemapLeft + 27,
@ -309,8 +302,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
1,
4,
DLG_WINDOW_PALETTE_NUM);
// Bottom right
FillBgTilemapBufferRect(bg,
BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)),
tilemapLeft + 27,
@ -325,8 +316,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
1,
1,
DLG_WINDOW_PALETTE_NUM);
// Bottom
FillBgTilemapBufferRect(bg,
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4),
tilemapLeft,
@ -338,6 +327,7 @@ 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);
}