Add OW_AUTO_SIGNPOST and associated metatile behaviors (#5044)
This commit is contained in:
commit
8ba96fdac4
@ -724,6 +724,11 @@ EventScript_BackupMrBrineyLocation::
|
||||
.include "data/scripts/rival_graphics.inc"
|
||||
.include "data/scripts/set_gym_trainers.inc"
|
||||
|
||||
EventScript_CancelMessageBox::
|
||||
special UseBlankMessageToCancelPokemonPic
|
||||
release
|
||||
end
|
||||
|
||||
Common_EventScript_ShowBagIsFull::
|
||||
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
|
||||
release
|
||||
|
||||
@ -554,3 +554,4 @@ gSpecials::
|
||||
def_special Script_GetChosenMonDefensiveEVs
|
||||
def_special Script_GetChosenMonOffensiveIVs
|
||||
def_special Script_GetChosenMonDefensiveIVs
|
||||
def_special UseBlankMessageToCancelPokemonPic
|
||||
|
||||
BIN
graphics/text_window/signpost.bin
Normal file
BIN
graphics/text_window/signpost.bin
Normal file
Binary file not shown.
BIN
graphics/text_window/signpost.png
Normal file
BIN
graphics/text_window/signpost.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 193 B |
@ -3,6 +3,7 @@
|
||||
|
||||
// Movement config
|
||||
#define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors.
|
||||
#define OW_AUTO_SIGNPOST FALSE // When enabled, if the tile that the player is facing has MB_SIGNPOST, MB_POKEMART_SIGN, or MB_POKEMON_CENTER_SIGN, the player will automatically read the signpost, as seen in FRLG.
|
||||
|
||||
// Other settings
|
||||
#define OW_POISON_DAMAGE GEN_LATEST // In Gen4, Pokémon no longer faint from Poison in the overworld. In Gen5+, they no longer take damage at all.
|
||||
|
||||
@ -30,9 +30,9 @@
|
||||
#define MB_UNUSED_SOOTOPOLIS_DEEP_WATER_2 0x1A
|
||||
#define MB_STAIRS_OUTSIDE_ABANDONED_SHIP 0x1B
|
||||
#define MB_SHOAL_CAVE_ENTRANCE 0x1C
|
||||
#define MB_UNUSED_1D 0x1D
|
||||
#define MB_UNUSED_1E 0x1E
|
||||
#define MB_UNUSED_1F 0x1F
|
||||
#define MB_SIGNPOST 0x1D
|
||||
#define MB_POKEMON_CENTER_SIGN 0x1E
|
||||
#define MB_POKEMART_SIGN 0x1F
|
||||
#define MB_ICE 0x20
|
||||
#define MB_SAND 0x21
|
||||
#define MB_SEAWEED 0x22
|
||||
|
||||
@ -649,4 +649,8 @@ extern const u8 EventScript_VsSeekerChargingDone[];
|
||||
extern const u8 Common_Movement_FollowerSafeStart[];
|
||||
extern const u8 Common_Movement_FollowerSafeEnd[];
|
||||
|
||||
extern const u8 EventScript_CancelMessageBox[];
|
||||
extern const u8 Common_EventScript_ShowPokemonCenterSign[];
|
||||
extern const u8 Common_EventScript_ShowPokemartSign[];
|
||||
|
||||
#endif // GUARD_EVENT_SCRIPTS_H
|
||||
|
||||
@ -34,5 +34,9 @@ u8 TrySetDiveWarp(void);
|
||||
const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction);
|
||||
const u8 *GetCoordEventScriptAtMapPosition(struct MapPosition *position);
|
||||
void ClearPoisonStepCounter(void);
|
||||
void CancelSignPostMessageBox(struct FieldInput *input);
|
||||
|
||||
#define NOT_SIGNPOST 0
|
||||
#define WALK_AWAY_SIGNPOST_FRAMES 6
|
||||
|
||||
#endif // GUARD_FIELDCONTROLAVATAR_H
|
||||
|
||||
@ -19,4 +19,6 @@ u8 GetFieldMessageBoxMode(void);
|
||||
void StopFieldMessage(void);
|
||||
void InitFieldMessageBox(void);
|
||||
|
||||
extern u8 gWalkAwayFromSignpostTimer;
|
||||
|
||||
#endif // GUARD_FIELD_MESSAGE_BOX_H
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define GUARD_GRAPHICS_H
|
||||
|
||||
// overworld
|
||||
extern const u32 gSignpostWindow_Gfx[];
|
||||
extern const u32 gMessageBox_Gfx[];
|
||||
extern const u16 gMessageBox_Pal[];
|
||||
|
||||
|
||||
@ -5,6 +5,12 @@
|
||||
#include "text.h"
|
||||
#include "window.h"
|
||||
|
||||
#define DLG_WINDOW_PALETTE_NUM 15
|
||||
#define DLG_WINDOW_BASE_TILE_NUM 0x200
|
||||
#define STD_WINDOW_PALETTE_NUM 14
|
||||
#define STD_WINDOW_PALETTE_SIZE PLTT_SIZEOF(10)
|
||||
#define STD_WINDOW_BASE_TILE_NUM 0x214
|
||||
|
||||
#define MENU_NOTHING_CHOSEN -2
|
||||
#define MENU_B_PRESSED -1
|
||||
|
||||
|
||||
@ -148,5 +148,8 @@ bool8 MetatileBehavior_IsQuestionnaire(u8);
|
||||
bool8 MetatileBehavior_IsLongGrass_Duplicate(u8);
|
||||
bool8 MetatileBehavior_IsLongGrassSouthEdge(u8);
|
||||
bool8 MetatileBehavior_IsTrainerHillTimer(u8);
|
||||
bool32 MetatileBehavior_IsSignpost(u32);
|
||||
bool32 MetatileBehavior_IsPokemonCenterSign(u32);
|
||||
bool32 MetatileBehavior_IsPokeMartSign(u32);
|
||||
|
||||
#endif // GUARD_METATILE_BEHAVIOR_H
|
||||
|
||||
@ -63,4 +63,7 @@ void InitRamScript_NoObjectEvent(u8 *script, u16 scriptSize);
|
||||
// srccmd.h
|
||||
void SetMovingNpcId(u16 npcId);
|
||||
|
||||
extern u8 gMsgIsSignPost;
|
||||
extern u8 gMsgBoxIsCancelable;
|
||||
|
||||
#endif // GUARD_SCRIPT_H
|
||||
|
||||
@ -14,6 +14,7 @@ extern const u16 gTextWindowFrame1_Pal[];
|
||||
|
||||
const struct TilesPal *GetWindowFrameTilesPal(u8 id);
|
||||
void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset);
|
||||
void LoadSignBoxGfx(u8 windowId, u16 destOffset, u8 palOffset);
|
||||
void LoadWindowGfx(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset);
|
||||
void LoadUserWindowBorderGfx(u8 windowId, u16 destOffset, u8 palOffset);
|
||||
void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset);
|
||||
@ -23,5 +24,6 @@ void DrawTextBorderInner(u8 windowId, u16 tileNum, u8 palNum);
|
||||
void rbox_fill_rectangle(u8 windowId);
|
||||
const u16 *GetTextWindowPalette(u8 id);
|
||||
const u16 *GetOverworldTextboxPalettePtr(void);
|
||||
void LoadSignPostWindowFrameGfx(void);
|
||||
|
||||
#endif // GUARD_TEXT_WINDOW_H
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include "event_scripts.h"
|
||||
#include "fieldmap.h"
|
||||
#include "field_control_avatar.h"
|
||||
#include "field_message_box.h"
|
||||
#include "field_player_avatar.h"
|
||||
#include "field_poison.h"
|
||||
#include "field_screen_effect.h"
|
||||
@ -34,6 +35,7 @@
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/field_poison.h"
|
||||
#include "constants/map_types.h"
|
||||
#include "constants/metatile_behaviors.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/trainer_hill.h"
|
||||
|
||||
@ -73,6 +75,11 @@ static void UpdateFollowerStepCounter(void);
|
||||
#if OW_POISON_DAMAGE < GEN_5
|
||||
static bool8 UpdatePoisonStepCounter(void);
|
||||
#endif // OW_POISON_DAMAGE
|
||||
static bool32 TrySetUpWalkIntoSignpostScript(struct MapPosition * position, u32 metatileBehavior, u32 playerDirection);
|
||||
static void SetMsgSignPostAndVarFacing(u32 playerDirection);
|
||||
static void SetUpWalkIntoSignScript(const u8 *script, u32 playerDirection);
|
||||
static u32 GetFacingSignpostType(u16 metatileBehvaior, u32 direction);
|
||||
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition * position);
|
||||
|
||||
void FieldClearPlayerInput(struct FieldInput *input)
|
||||
{
|
||||
@ -154,6 +161,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
gSpecialVar_LastTalked = 0;
|
||||
gSelectedObjectEvent = 0;
|
||||
|
||||
gMsgIsSignPost = FALSE;
|
||||
playerDirection = GetPlayerFacingDirection();
|
||||
GetPlayerPosition(&position);
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
||||
@ -173,6 +181,17 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
if (TryStartStepBasedScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((input->checkStandardWildEncounter) && ((input->dpadDirection == 0) || input->dpadDirection == playerDirection))
|
||||
{
|
||||
GetInFrontOfPlayerPosition(&position);
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
||||
if (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
return TRUE;
|
||||
GetPlayerPosition(&position);
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
||||
}
|
||||
|
||||
if (input->checkStandardWildEncounter && CheckStandardWildEncounter(metatileBehavior) == TRUE)
|
||||
return TRUE;
|
||||
if (input->heldDirection && input->dpadDirection == playerDirection)
|
||||
@ -183,6 +202,10 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
|
||||
GetInFrontOfPlayerPosition(&position);
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(position.x, position.y);
|
||||
|
||||
if (input->heldDirection && (input->dpadDirection == playerDirection) && (TrySetUpWalkIntoSignpostScript(&position, metatileBehavior, playerDirection) == TRUE))
|
||||
return TRUE;
|
||||
|
||||
if (input->pressedAButton && TryStartInteractionScript(&position, metatileBehavior, playerDirection) == TRUE)
|
||||
return TRUE;
|
||||
|
||||
@ -344,6 +367,9 @@ static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *position
|
||||
if (bgEvent->bgUnion.script == NULL)
|
||||
return EventScript_TestSignpostMsg;
|
||||
|
||||
if (GetFacingSignpostType(metatileBehavior, direction) != NOT_SIGNPOST)
|
||||
SetMsgSignPostAndVarFacing(direction);
|
||||
|
||||
switch (bgEvent->kind)
|
||||
{
|
||||
case BG_EVENT_PLAYER_FACING_ANY:
|
||||
@ -1053,3 +1079,113 @@ int SetCableClubWarp(void)
|
||||
SetupWarp(&gMapHeader, GetWarpEventAtMapPosition(&gMapHeader, &position), &position);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool32 TrySetUpWalkIntoSignpostScript(struct MapPosition *position, u32 metatileBehavior, u32 playerDirection)
|
||||
{
|
||||
const u8 *script;
|
||||
|
||||
if ((JOY_HELD(DPAD_LEFT | DPAD_RIGHT)) || (playerDirection != DIR_NORTH))
|
||||
return FALSE;
|
||||
|
||||
switch (GetFacingSignpostType(metatileBehavior, playerDirection))
|
||||
{
|
||||
case MB_POKEMON_CENTER_SIGN:
|
||||
SetUpWalkIntoSignScript(Common_EventScript_ShowPokemonCenterSign, playerDirection);
|
||||
return TRUE;
|
||||
case MB_POKEMART_SIGN:
|
||||
SetUpWalkIntoSignScript(Common_EventScript_ShowPokemartSign, playerDirection);
|
||||
return TRUE;
|
||||
case MB_SIGNPOST:
|
||||
script = GetSignpostScriptAtMapPosition(position);
|
||||
if (script == NULL)
|
||||
return FALSE;
|
||||
SetUpWalkIntoSignScript(script, playerDirection);
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static u32 GetFacingSignpostType(u16 metatileBehavior, u32 playerDirection)
|
||||
{
|
||||
if (MetatileBehavior_IsPokemonCenterSign(metatileBehavior) == TRUE)
|
||||
return MB_POKEMON_CENTER_SIGN;
|
||||
if (MetatileBehavior_IsPokeMartSign(metatileBehavior) == TRUE)
|
||||
return MB_POKEMART_SIGN;
|
||||
if (MetatileBehavior_IsSignpost(metatileBehavior) == TRUE)
|
||||
return MB_SIGNPOST;
|
||||
|
||||
return NOT_SIGNPOST;
|
||||
}
|
||||
|
||||
static void SetMsgSignPostAndVarFacing(u32 playerDirection)
|
||||
{
|
||||
gWalkAwayFromSignpostTimer = WALK_AWAY_SIGNPOST_FRAMES;
|
||||
gMsgBoxIsCancelable = TRUE;
|
||||
gMsgIsSignPost = TRUE;
|
||||
gSpecialVar_Facing = playerDirection;
|
||||
}
|
||||
|
||||
static void SetUpWalkIntoSignScript(const u8 *script, u32 playerDirection)
|
||||
{
|
||||
ScriptContext_SetupScript(script);
|
||||
SetMsgSignPostAndVarFacing(playerDirection);
|
||||
}
|
||||
|
||||
static const u8 *GetSignpostScriptAtMapPosition(struct MapPosition *position)
|
||||
{
|
||||
const struct BgEvent *event = GetBackgroundEventAtPosition(&gMapHeader, position->x - 7, position->y - 7, position->elevation);
|
||||
if (event == NULL)
|
||||
return NULL;
|
||||
if (event->bgUnion.script != NULL)
|
||||
return event->bgUnion.script;
|
||||
return EventScript_TestSignpostMsg;
|
||||
}
|
||||
|
||||
static void Task_OpenStartMenu(u8 taskId)
|
||||
{
|
||||
if (ArePlayerFieldControlsLocked())
|
||||
return;
|
||||
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
ShowStartMenu();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
bool32 IsDpadPushedToTurnOrMovePlayer(struct FieldInput *input)
|
||||
{
|
||||
return (input->dpadDirection != 0 && GetPlayerFacingDirection() != input->dpadDirection);
|
||||
}
|
||||
|
||||
void CancelSignPostMessageBox(struct FieldInput *input)
|
||||
{
|
||||
if (!ScriptContext_IsEnabled())
|
||||
return;
|
||||
|
||||
if (gWalkAwayFromSignpostTimer)
|
||||
{
|
||||
gWalkAwayFromSignpostTimer--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gMsgBoxIsCancelable)
|
||||
return;
|
||||
|
||||
if (IsDpadPushedToTurnOrMovePlayer(input))
|
||||
{
|
||||
ScriptContext_SetupScript(EventScript_CancelMessageBox);
|
||||
LockPlayerFieldControls();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!input->pressedStartButton)
|
||||
return;
|
||||
|
||||
ScriptContext_SetupScript(EventScript_CancelMessageBox);
|
||||
LockPlayerFieldControls();
|
||||
|
||||
if (FuncIsActiveTask(Task_OpenStartMenu))
|
||||
return;
|
||||
|
||||
CreateTask(Task_OpenStartMenu, 8);
|
||||
}
|
||||
|
||||
@ -5,8 +5,11 @@
|
||||
#include "text.h"
|
||||
#include "match_call.h"
|
||||
#include "field_message_box.h"
|
||||
#include "text_window.h"
|
||||
#include "script.h"
|
||||
|
||||
static EWRAM_DATA u8 sFieldMessageBoxMode = 0;
|
||||
EWRAM_DATA u8 gWalkAwayFromSignpostTimer = 0;
|
||||
|
||||
static void ExpandStringAndStartDrawFieldMessage(const u8 *, bool32);
|
||||
static void StartDrawFieldMessage(void);
|
||||
@ -29,7 +32,12 @@ static void Task_DrawFieldMessage(u8 taskId)
|
||||
switch (task->tState)
|
||||
{
|
||||
case 0:
|
||||
LoadMessageBoxAndBorderGfx();
|
||||
if (gMsgIsSignPost)
|
||||
LoadSignPostWindowFrameGfx();
|
||||
else
|
||||
LoadMessageBoxAndBorderGfx();
|
||||
task->tState++;
|
||||
break;
|
||||
task->tState++;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
@ -4276,3 +4276,10 @@ void PreparePartyForSkyBattle(void)
|
||||
VarSet(B_VAR_SKY_BATTLE,participatingPokemonSlot);
|
||||
CompactPartySlots();
|
||||
}
|
||||
|
||||
void UseBlankMessageToCancelPokemonPic(void)
|
||||
{
|
||||
u8 t = EOS;
|
||||
AddTextPrinterParameterized(0, FONT_NORMAL, &t, 0, 1, 0, NULL);
|
||||
ScriptMenu_HidePokemonPic();
|
||||
}
|
||||
|
||||
@ -2026,6 +2026,7 @@ const u16 gTradeMenuMonBox_Tilemap[] = INCBIN_U16("graphics/trade/menu_mon_box.b
|
||||
|
||||
const u16 gMessageBox_Pal[] = INCBIN_U16("graphics/text_window/message_box.gbapal");
|
||||
const u8 gMessageBox_Gfx[] = INCBIN_U8("graphics/text_window/message_box.4bpp");
|
||||
const u8 gSignpostWindow_Gfx[] = INCBIN_U8("graphics/text_window/signpost.4bpp");
|
||||
|
||||
const u32 gWallpaperIcon_Cross[] = INCBIN_U32("graphics/pokemon_storage/wallpapers/icons/cross.4bpp.lz");
|
||||
const u32 gWallpaperIcon_Bolt[] = INCBIN_U32("graphics/pokemon_storage/wallpapers/icons/bolt.4bpp.lz");
|
||||
|
||||
125
src/menu.c
125
src/menu.c
@ -17,18 +17,13 @@
|
||||
#include "sound.h"
|
||||
#include "string_util.h"
|
||||
#include "strings.h"
|
||||
#include "script.h"
|
||||
#include "task.h"
|
||||
#include "text_window.h"
|
||||
#include "window.h"
|
||||
#include "config/overworld.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
#define DLG_WINDOW_PALETTE_NUM 15
|
||||
#define DLG_WINDOW_BASE_TILE_NUM 0x200
|
||||
#define STD_WINDOW_PALETTE_NUM 14
|
||||
#define STD_WINDOW_PALETTE_SIZE PLTT_SIZEOF(10)
|
||||
#define STD_WINDOW_BASE_TILE_NUM 0x214
|
||||
|
||||
struct MenuInfoIcon
|
||||
{
|
||||
u8 width;
|
||||
@ -54,6 +49,8 @@ struct Menu
|
||||
|
||||
static u16 AddWindowParameterized(u8, u8, u8, u8, u8, u8, u16);
|
||||
static void WindowFunc_DrawStandardFrame(u8, u8, u8, u8, u8, u8);
|
||||
static void WindowFunc_DrawSignFrame(u8, u8, u8, u8, u8, u8);
|
||||
static inline void *GetWindowFunc_DialogueFrame(void);
|
||||
static void WindowFunc_DrawDialogueFrame(u8, u8, u8, u8, u8, u8);
|
||||
static void WindowFunc_ClearStdWindowAndFrame(u8, u8, u8, u8, u8, u8);
|
||||
static void WindowFunc_ClearDialogWindowAndFrame(u8, u8, u8, u8, u8, u8);
|
||||
@ -220,9 +217,123 @@ void LoadMessageBoxAndBorderGfx(void)
|
||||
LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM));
|
||||
}
|
||||
|
||||
void LoadSignPostWindowFrameGfx(void)
|
||||
{
|
||||
Menu_LoadStdPal();
|
||||
LoadSignBoxGfx(0, DLG_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM));
|
||||
LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM));
|
||||
}
|
||||
|
||||
static void WindowFunc_DrawSignFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
|
||||
{
|
||||
FillBgTilemapBufferRect(bg,
|
||||
DLG_WINDOW_BASE_TILE_NUM + 0,
|
||||
tilemapLeft - 2,
|
||||
tilemapTop - 1,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
DLG_WINDOW_BASE_TILE_NUM + 1,
|
||||
tilemapLeft - 1,
|
||||
tilemapTop - 1,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
DLG_WINDOW_BASE_TILE_NUM + 2,
|
||||
tilemapLeft - 2,
|
||||
tilemapTop,
|
||||
1,
|
||||
4,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
DLG_WINDOW_BASE_TILE_NUM + 3,
|
||||
tilemapLeft - 1,
|
||||
tilemapTop,
|
||||
1,
|
||||
4,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
|
||||
tilemapLeft - 2,
|
||||
tilemapTop + 4,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1),
|
||||
tilemapLeft - 1,
|
||||
tilemapTop + 4,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
DLG_WINDOW_BASE_TILE_NUM + 4,
|
||||
tilemapLeft,
|
||||
tilemapTop - 1,
|
||||
26,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0),
|
||||
tilemapLeft + 27,
|
||||
tilemapTop - 1,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1),
|
||||
tilemapLeft + 26,
|
||||
tilemapTop - 1,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 2),
|
||||
tilemapLeft + 27,
|
||||
tilemapTop,
|
||||
1,
|
||||
4,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 3),
|
||||
tilemapLeft + 26,
|
||||
tilemapTop,
|
||||
1,
|
||||
4,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 0)),
|
||||
tilemapLeft + 27,
|
||||
tilemapTop + 4,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_V_FLIP(BG_TILE_H_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1)),
|
||||
tilemapLeft + 26,
|
||||
tilemapTop + 4,
|
||||
1,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
FillBgTilemapBufferRect(bg,
|
||||
BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4),
|
||||
tilemapLeft,
|
||||
tilemapTop + 4,
|
||||
26,
|
||||
1,
|
||||
DLG_WINDOW_PALETTE_NUM);
|
||||
}
|
||||
|
||||
static inline void *GetWindowFunc_DialogueFrame(void)
|
||||
{
|
||||
return (gMsgIsSignPost ? WindowFunc_DrawSignFrame : WindowFunc_DrawDialogueFrame);
|
||||
}
|
||||
|
||||
void DrawDialogueFrame(u8 windowId, bool8 copyToVram)
|
||||
{
|
||||
CallWindowFunction(windowId, WindowFunc_DrawDialogueFrame);
|
||||
CallWindowFunction(windowId, GetWindowFunc_DialogueFrame());
|
||||
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
|
||||
PutWindowTilemap(windowId);
|
||||
if (copyToVram == TRUE)
|
||||
|
||||
@ -125,6 +125,9 @@ static const u8 sTileBitAttributes[NUM_METATILE_BEHAVIORS] =
|
||||
[MB_ISOLATED_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED,
|
||||
[MB_VERTICAL_RAIL] = TILE_FLAG_UNUSED,
|
||||
[MB_HORIZONTAL_RAIL] = TILE_FLAG_UNUSED,
|
||||
[MB_SIGNPOST] = TILE_FLAG_UNUSED,
|
||||
[MB_POKEMON_CENTER_SIGN] = TILE_FLAG_UNUSED,
|
||||
[MB_POKEMART_SIGN] = TILE_FLAG_UNUSED,
|
||||
};
|
||||
|
||||
bool8 MetatileBehavior_IsATile(u8 metatileBehavior)
|
||||
@ -1400,3 +1403,18 @@ bool8 MetatileBehavior_IsTrainerHillTimer(u8 metatileBehavior)
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 MetatileBehavior_IsSignpost(u32 metatileBehavior)
|
||||
{
|
||||
return (metatileBehavior == MB_SIGNPOST);
|
||||
}
|
||||
|
||||
bool32 MetatileBehavior_IsPokemonCenterSign(u32 metatileBehavior)
|
||||
{
|
||||
return (metatileBehavior == MB_POKEMON_CENTER_SIGN);
|
||||
}
|
||||
|
||||
bool32 MetatileBehavior_IsPokeMartSign(u32 metatileBehavior)
|
||||
{
|
||||
return (metatileBehavior == MB_POKEMART_SIGN);
|
||||
}
|
||||
|
||||
@ -1503,6 +1503,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys)
|
||||
UpdatePlayerAvatarTransitionState();
|
||||
FieldClearPlayerInput(&inputStruct);
|
||||
FieldGetPlayerInput(&inputStruct, newKeys, heldKeys);
|
||||
CancelSignPostMessageBox(&inputStruct);
|
||||
if (!ArePlayerFieldControlsLocked())
|
||||
{
|
||||
if (ProcessPlayerFieldInput(&inputStruct) == 1)
|
||||
|
||||
@ -1291,6 +1291,7 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx)
|
||||
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]);
|
||||
ScriptMovement_UnfreezeObjectEvents();
|
||||
UnfreezeObjectEvents();
|
||||
gMsgBoxIsCancelable = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1309,6 +1310,7 @@ bool8 ScrCmd_release(struct ScriptContext *ctx)
|
||||
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[playerObjectId]);
|
||||
ScriptMovement_UnfreezeObjectEvents();
|
||||
UnfreezeObjectEvents();
|
||||
gMsgBoxIsCancelable = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "util.h"
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/map_scripts.h"
|
||||
#include "field_message_box.h"
|
||||
|
||||
#define RAM_SCRIPT_MAGIC 51
|
||||
|
||||
@ -26,6 +27,8 @@ static u8 sGlobalScriptContextStatus;
|
||||
static struct ScriptContext sGlobalScriptContext;
|
||||
static struct ScriptContext sImmediateScriptContext;
|
||||
static bool8 sLockFieldControls;
|
||||
EWRAM_DATA u8 gMsgIsSignPost = FALSE;
|
||||
EWRAM_DATA u8 gMsgBoxIsCancelable = FALSE;
|
||||
|
||||
extern ScrCmdFunc gScriptCmdTable[];
|
||||
extern ScrCmdFunc gScriptCmdTableEnd[];
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "palette.h"
|
||||
#include "bg.h"
|
||||
#include "graphics.h"
|
||||
#include "menu.h"
|
||||
|
||||
const u8 gTextWindowFrame1_Gfx[] = INCBIN_U8("graphics/text_window/1.4bpp");
|
||||
static const u8 sTextWindowFrame2_Gfx[] = INCBIN_U8("graphics/text_window/2.4bpp");
|
||||
@ -96,6 +97,12 @@ void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset)
|
||||
LoadPalette(GetOverworldTextboxPalettePtr(), palOffset, PLTT_SIZE_4BPP);
|
||||
}
|
||||
|
||||
void LoadSignBoxGfx(u8 windowId, u16 destOffset, u8 palOffset)
|
||||
{
|
||||
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gSignpostWindow_Gfx, 0x1C0, destOffset);
|
||||
LoadPalette(GetTextWindowPalette(1), palOffset, PLTT_SIZE_4BPP);
|
||||
}
|
||||
|
||||
void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset)
|
||||
{
|
||||
LoadUserWindowBorderGfx(windowId, destOffset, palOffset);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user