Worked with ShinyDragonHunter to get signpost working

This commit is contained in:
pkmnsnfrn 2024-07-24 20:58:18 -07:00
parent a0c5e5511c
commit 389f4e4180
3 changed files with 125 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 193 B

View file

@ -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)

View file

@ -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)