Working version of interactable signpost msgbox
This commit is contained in:
parent
389f4e4180
commit
614b7f862e
2 changed files with 15 additions and 13 deletions
|
@ -82,6 +82,7 @@ static void UpdateLetsGoEvolutionTracker(void);
|
||||||
static bool8 UpdatePoisonStepCounter(void);
|
static bool8 UpdatePoisonStepCounter(void);
|
||||||
#endif // OW_POISON_DAMAGE
|
#endif // OW_POISON_DAMAGE
|
||||||
static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection);
|
static bool8 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u16 metatileBehavior, u8 playerDirection);
|
||||||
|
static void SetMsgSignPostAndVarFacing(u32 playerDirection);
|
||||||
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection);
|
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection);
|
||||||
static u8 GetFacingSignpostType(u16 metatileBehvaior, u8 direction);
|
static u8 GetFacingSignpostType(u16 metatileBehvaior, u8 direction);
|
||||||
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position);
|
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position);
|
||||||
|
@ -379,6 +380,9 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
|
||||||
if (bgEvent->bgUnion.script == NULL)
|
if (bgEvent->bgUnion.script == NULL)
|
||||||
return EventScript_TestSignpostMsg;
|
return EventScript_TestSignpostMsg;
|
||||||
|
|
||||||
|
if (GetFacingSignpostType(metatileBehavior, direction) != SIGNPOST_NA)
|
||||||
|
SetMsgSignPostAndVarFacing(direction);
|
||||||
|
|
||||||
switch (bgEvent->kind)
|
switch (bgEvent->kind)
|
||||||
{
|
{
|
||||||
case BG_EVENT_PLAYER_FACING_ANY:
|
case BG_EVENT_PLAYER_FACING_ANY:
|
||||||
|
@ -1133,18 +1137,26 @@ static u8 GetFacingSignpostType(u16 metatileBehavior, u8 playerDirection)
|
||||||
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE)
|
if (MetatileBehavior_IsPlayerFacingPokeMartSign(metatileBehavior, playerDirection) == TRUE)
|
||||||
return SIGNPOST_POKEMART;*/
|
return SIGNPOST_POKEMART;*/
|
||||||
|
|
||||||
|
DebugPrintf("behavior is %d",metatileBehavior);
|
||||||
|
|
||||||
if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE)
|
||||||
return SIGNPOST_SCRIPTED;
|
return SIGNPOST_SCRIPTED;
|
||||||
|
|
||||||
return SIGNPOST_NA;
|
return SIGNPOST_NA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetMsgSignPostAndVarFacing(u32 playerDirection)
|
||||||
|
{
|
||||||
|
DebugPrintf("test");
|
||||||
|
MsgSetSignPost();
|
||||||
|
gSpecialVar_Facing = playerDirection;
|
||||||
|
}
|
||||||
|
|
||||||
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection)
|
static void SetUpWalkIntoSignScript(const u8 *script, u8 playerDirection)
|
||||||
{
|
{
|
||||||
gSpecialVar_Facing = playerDirection;
|
|
||||||
ScriptContext_SetupScript(script);
|
ScriptContext_SetupScript(script);
|
||||||
SetWalkingIntoSignVars();
|
SetWalkingIntoSignVars();
|
||||||
MsgSetSignPost();
|
SetMsgSignPostAndVarFacing(playerDirection);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position)
|
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position)
|
||||||
|
|
12
src/menu.c
12
src/menu.c
|
@ -225,7 +225,6 @@ void LoadSignPostWindowFrameGfx(void)
|
||||||
|
|
||||||
static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
|
static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
|
||||||
{
|
{
|
||||||
// Top left
|
|
||||||
FillBgTilemapBufferRect(bg,
|
FillBgTilemapBufferRect(bg,
|
||||||
DLG_WINDOW_BASE_TILE_NUM + 0,
|
DLG_WINDOW_BASE_TILE_NUM + 0,
|
||||||
tilemapLeft - 2,
|
tilemapLeft - 2,
|
||||||
|
@ -254,8 +253,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
|
||||||
1,
|
1,
|
||||||
4,
|
4,
|
||||||
DLG_WINDOW_PALETTE_NUM);
|
DLG_WINDOW_PALETTE_NUM);
|
||||||
|
|
||||||
// Bottom left
|
|
||||||
FillBgTilemapBufferRect(bg,
|
FillBgTilemapBufferRect(bg,
|
||||||
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
|
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
|
||||||
tilemapLeft - 2,
|
tilemapLeft - 2,
|
||||||
|
@ -270,8 +267,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
DLG_WINDOW_PALETTE_NUM);
|
DLG_WINDOW_PALETTE_NUM);
|
||||||
|
|
||||||
// Top
|
|
||||||
FillBgTilemapBufferRect(bg,
|
FillBgTilemapBufferRect(bg,
|
||||||
DLG_WINDOW_BASE_TILE_NUM + 4,
|
DLG_WINDOW_BASE_TILE_NUM + 4,
|
||||||
tilemapLeft,
|
tilemapLeft,
|
||||||
|
@ -279,8 +274,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
|
||||||
26,
|
26,
|
||||||
1,
|
1,
|
||||||
DLG_WINDOW_PALETTE_NUM);
|
DLG_WINDOW_PALETTE_NUM);
|
||||||
|
|
||||||
// Top right
|
|
||||||
FillBgTilemapBufferRect(bg,
|
FillBgTilemapBufferRect(bg,
|
||||||
BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
|
BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
|
||||||
tilemapLeft + 27,
|
tilemapLeft + 27,
|
||||||
|
@ -309,8 +302,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
|
||||||
1,
|
1,
|
||||||
4,
|
4,
|
||||||
DLG_WINDOW_PALETTE_NUM);
|
DLG_WINDOW_PALETTE_NUM);
|
||||||
|
|
||||||
// Bottom right
|
|
||||||
FillBgTilemapBufferRect(bg,
|
FillBgTilemapBufferRect(bg,
|
||||||
BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)),
|
BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)),
|
||||||
tilemapLeft + 27,
|
tilemapLeft + 27,
|
||||||
|
@ -325,8 +316,6 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
DLG_WINDOW_PALETTE_NUM);
|
DLG_WINDOW_PALETTE_NUM);
|
||||||
|
|
||||||
// Bottom
|
|
||||||
FillBgTilemapBufferRect(bg,
|
FillBgTilemapBufferRect(bg,
|
||||||
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4),
|
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4),
|
||||||
tilemapLeft,
|
tilemapLeft,
|
||||||
|
@ -338,6 +327,7 @@ static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 wi
|
||||||
|
|
||||||
static inline void *GetWindowFunc_DialogueFrame(void)
|
static inline void *GetWindowFunc_DialogueFrame(void)
|
||||||
{
|
{
|
||||||
|
DebugPrintf("test %d",IsMsgSignPost());
|
||||||
return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame);
|
return (IsMsgSignPost() ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue