diff --git a/graphics/text_window/signpost.png b/graphics/text_window/signpost.png index 89e667df92..45ab7c6764 100644 Binary files a/graphics/text_window/signpost.png and b/graphics/text_window/signpost.png differ diff --git a/src/menu.c b/src/menu.c index ecb8dd20d6..6cb9c05492 100644 --- a/src/menu.c +++ b/src/menu.c @@ -17,6 +17,7 @@ #include "sound.h" #include "string_util.h" #include "strings.h" +#include "script.h" #include "task.h" #include "text_window.h" #include "window.h" @@ -48,6 +49,7 @@ 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 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); @@ -216,13 +218,133 @@ void LoadMessageBoxAndBorderGfx(void) 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)); + 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) +{ + // Top left + 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); + + // Bottom left + 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); + + // Top + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 4, + tilemapLeft, + tilemapTop - 1, + 26, + 1, + DLG_WINDOW_PALETTE_NUM); + + // Top right + 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); + + // Bottom right + 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); + + // Bottom + 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 (IsMsgSignPost() ? 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) diff --git a/src/text_window.c b/src/text_window.c index 6423867205..6c02797fe3 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -100,7 +100,7 @@ void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset) void LoadSignBoxGfx(u8 windowId, u16 destOffset, u8 palOffset) { LoadBgTiles(GetWindowAttribute(windowId, WINDOW_BG), gSignpostWindow_Gfx, 0x1C0, destOffset); - LoadPalette(GetOverworldTextboxPalettePtr(), palOffset, PLTT_SIZE_4BPP); + LoadPalette(GetTextWindowPalette(1), palOffset, PLTT_SIZE_4BPP); } void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset)