From e515e52abb8f477df32b1bb050ffee5ba149954b Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 26 Sep 2022 12:22:27 -0400 Subject: [PATCH] Add DISPLAY_TILE_* constants --- include/gba/defines.h | 3 +++ src/berry_blender.c | 4 ++-- src/contest_util.c | 18 +++++++++--------- src/credits.c | 2 +- src/dodrio_berry_picking.c | 14 +++++++------- src/field_screen_effect.c | 2 +- src/frontier_pass.c | 12 ++++++------ src/link.c | 6 +++--- src/mail.c | 4 ++-- src/main_menu.c | 2 +- src/mystery_event_menu.c | 2 +- src/mystery_gift_menu.c | 4 ++-- src/mystery_gift_view.c | 36 ++++++++++++++++++------------------ src/naming_screen.c | 2 +- src/party_menu.c | 4 ++-- src/trade.c | 6 +++--- src/union_room.c | 4 ++-- src/union_room_battle.c | 2 +- 18 files changed, 65 insertions(+), 62 deletions(-) diff --git a/include/gba/defines.h b/include/gba/defines.h index c52d7ef4f..6d96e9a9e 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -67,6 +67,9 @@ #define DISPLAY_WIDTH 240 #define DISPLAY_HEIGHT 160 +#define DISPLAY_TILE_WIDTH (DISPLAY_WIDTH / 8) +#define DISPLAY_TILE_HEIGHT (DISPLAY_HEIGHT / 8) + #define TILE_SIZE_4BPP 32 #define TILE_SIZE_8BPP 64 diff --git a/src/berry_blender.c b/src/berry_blender.c index d099a14ba..140d1042e 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1008,7 +1008,7 @@ static bool8 LoadBerryBlenderGfx(void) static void DrawBlenderBg(void) { - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); ShowBg(0); ShowBg(1); @@ -1029,7 +1029,7 @@ static void InitBerryBlenderWindows(void) for (i = 0; i < 5; i++) FillWindowPixelBuffer(i, PIXEL_FILL(0)); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); Menu_LoadStdPalAt(0xE0); } } diff --git a/src/contest_util.c b/src/contest_util.c index d44b47373..9a3825176 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -1167,24 +1167,24 @@ static void TryCreateWirelessSprites(void) static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId) { u16 windowId; - int origWidth; + int tileWidth; int strWidth; u8 *spriteTilePtrs[4]; u8 *dst; struct WindowTemplate windowTemplate; memset(&windowTemplate, 0, sizeof(windowTemplate)); - windowTemplate.width = 30; + windowTemplate.width = DISPLAY_TILE_WIDTH; windowTemplate.height = 2; windowId = AddWindow(&windowTemplate); FillWindowPixelBuffer(windowId, PIXEL_FILL(1)); - origWidth = GetStringWidth(FONT_NORMAL, text, 0); - strWidth = (origWidth + 9) / 8; - if (strWidth > 30) - strWidth = 30; + strWidth = GetStringWidth(FONT_NORMAL, text, 0); + tileWidth = (strWidth + 9) / 8; + if (tileWidth > DISPLAY_TILE_WIDTH) + tileWidth = DISPLAY_TILE_WIDTH; - AddTextPrinterParameterized3(windowId, FONT_NORMAL, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text); + AddTextPrinterParameterized3(windowId, FONT_NORMAL, (tileWidth * 8 - strWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text); { s32 i; struct Sprite *sprite; @@ -1207,7 +1207,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId) CpuCopy32(src + 128, dst + 0x200, 0x20); CpuCopy32(src + 64, dst + 0x300, 0x20); - for (i = 0; i < strWidth; i++) + for (i = 0; i < tileWidth; i++) { dst = &spriteTilePtrs[(i + 1) / 8][((i + 1) % 8) * 32]; CpuCopy32(src + 192, dst, 0x20); @@ -1225,7 +1225,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId) } RemoveWindow(windowId); - return (DISPLAY_WIDTH - (strWidth + 2) * 8) / 2; + return (DISPLAY_WIDTH - (tileWidth + 2) * 8) / 2; } static void CreateResultsTextWindowSprites(void) diff --git a/src/credits.c b/src/credits.c index c31859599..4156e45ba 100644 --- a/src/credits.c +++ b/src/credits.c @@ -183,7 +183,7 @@ static const struct WindowTemplate sWindowTemplates[] = .bg = 0, .tilemapLeft = 0, .tilemapTop = 9, - .width = 30, + .width = DISPLAY_TILE_WIDTH, .height = 12, .paletteNum = 8, .baseBlock = 1 diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index a3710e04f..268b930ae 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -4675,7 +4675,7 @@ static void ShowNames(void) ClearWindowTilemap(sGfx->windowIds[i]); RemoveWindow(sGfx->windowIds[i]); } - FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(BG_INTERFACE); sGfx->finished = TRUE; } @@ -4859,7 +4859,7 @@ static void ShowResults(void) sGfx->state++; } - FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, 30, 15); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT - 5); RemoveWindow(sGfx->windowIds[1]); sGfx->windowIds[1] = AddWindow(&sWindowTemplate_Prize); ClearWindowTilemap(sGfx->windowIds[1]); @@ -4917,7 +4917,7 @@ static void ShowResults(void) ClearWindowTilemap(sGfx->windowIds[1]); RemoveWindow(sGfx->windowIds[0]); RemoveWindow(sGfx->windowIds[1]); - FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(BG_INTERFACE); sGfx->finished = TRUE; break; @@ -5012,7 +5012,7 @@ static void Msg_WantToPlayAgain(void) ClearWindowTilemap(sGfx->windowIds[WIN_YES_NO]); RemoveWindow(sGfx->windowIds[WIN_PLAY_AGAIN]); RemoveWindow(sGfx->windowIds[WIN_YES_NO]); - FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(BG_INTERFACE); sGfx->finished = TRUE; break; @@ -5044,7 +5044,7 @@ static void Msg_SavingDontTurnOff(void) sGfx->state++; break; default: - FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(BG_INTERFACE); sGfx->finished = TRUE; break; @@ -5083,7 +5083,7 @@ static void EraseMessage(void) { ClearWindowTilemap(sGfx->windowIds[0]); RemoveWindow(sGfx->windowIds[0]); - FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(BG_INTERFACE); sGfx->finished = TRUE; } @@ -5121,7 +5121,7 @@ static void Msg_SomeoneDroppedOut(void) sGfx->playAgainState = PLAY_AGAIN_DROPPED; ClearWindowTilemap(sGfx->windowIds[0]); RemoveWindow(sGfx->windowIds[0]); - FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(BG_INTERFACE); sGfx->finished = TRUE; break; diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index 948d812e8..57f8cc52e 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -1136,7 +1136,7 @@ static void Task_OrbEffect(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7)); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ); - SetBgTilemapPalette(0, 0, 0, 0x1E, 0x14, 0xF); + SetBgTilemapPalette(0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF); ScheduleBgCopyTilemapToVram(0); SetOrbFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], tCenterX, tCenterY, 1); CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480); diff --git a/src/frontier_pass.c b/src/frontier_pass.c index b14358741..d25cb34cf 100644 --- a/src/frontier_pass.c +++ b/src/frontier_pass.c @@ -760,9 +760,9 @@ static bool32 InitFrontierPass(void) case 7: if (FreeTempTileDataBuffersIfPossible()) return FALSE; - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); @@ -1396,9 +1396,9 @@ static bool32 InitFrontierMap(void) SetBgTilemapBuffer(0, sMapData->tilemapBuff0); SetBgTilemapBuffer(1, sMapData->tilemapBuff1); SetBgTilemapBuffer(2, sMapData->tilemapBuff2); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); diff --git a/src/link.c b/src/link.c index b01be9d89..06907005f 100644 --- a/src/link.c +++ b/src/link.c @@ -198,7 +198,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 0, - .width = 30, + .width = DISPLAY_TILE_WIDTH, .height = 5, .paletteNum = 15, .baseBlock = 0x002 @@ -206,7 +206,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 6, - .width = 30, + .width = DISPLAY_TILE_WIDTH, .height = 7, .paletteNum = 15, .baseBlock = 0x098 @@ -214,7 +214,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 13, - .width = 30, + .width = DISPLAY_TILE_WIDTH, .height = 7, .paletteNum = 15, .baseBlock = 0x16A diff --git a/src/mail.c b/src/mail.c index f1e4fbedf..63553f172 100644 --- a/src/mail.c +++ b/src/mail.c @@ -556,8 +556,8 @@ static bool8 MailReadBuildGraphics(void) } break; case 10: - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(2, 1, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(2, 1, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyToBgTilemapBuffer(1, sMailGraphics[sMailRead->mailType].tileMap, 0, 0); break; case 11: diff --git a/src/main_menu.c b/src/main_menu.c index b8abffda5..5b18e440a 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1121,7 +1121,7 @@ static void Task_DisplayMainMenuInvalidActionError(u8 taskId) switch (gTasks[taskId].tCurrItem) { case 0: - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); switch (gTasks[taskId].tMenuType) { case 0: diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c index b6610a640..0af051ab7 100644 --- a/src/mystery_event_menu.c +++ b/src/mystery_event_menu.c @@ -90,7 +90,7 @@ void CB2_InitMysteryEventMenu(void) for (i = 0; i < 2; i++) FillWindowPixelBuffer(i, PIXEL_FILL(0)); - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); LoadUserWindowBorderGfx(0, 1u, 0xD0u); Menu_LoadStdPalAt(0xE0); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON); diff --git a/src/mystery_gift_menu.c b/src/mystery_gift_menu.c index 9e4796bb2..a6fb542b8 100644 --- a/src/mystery_gift_menu.c +++ b/src/mystery_gift_menu.c @@ -102,7 +102,7 @@ static const struct WindowTemplate sMainWindows[] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 0, - .width = 30, + .width = DISPLAY_TILE_WIDTH, .height = 2, .paletteNum = 12, .baseBlock = 0x0013 @@ -118,7 +118,7 @@ static const struct WindowTemplate sMainWindows[] = { .bg = 0, .tilemapLeft = 0, .tilemapTop = 15, - .width = 30, + .width = DISPLAY_TILE_WIDTH, .height = 5, .paletteNum = 13, .baseBlock = 0x004f diff --git a/src/mystery_gift_view.c b/src/mystery_gift_view.c index b059b183c..728605a90 100644 --- a/src/mystery_gift_view.c +++ b/src/mystery_gift_view.c @@ -226,9 +226,9 @@ s32 WonderCard_Enter(void) return 0; break; case 2: - FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); @@ -244,7 +244,7 @@ s32 WonderCard_Enter(void) gPaletteFade.bufferTransferDisabled = TRUE; LoadPalette(sWonderCardData->gfx->pal, 0x10, 0x20); LZ77UnCompWram(sWonderCardData->gfx->map, sWonderCardData->bgTilemapBuffer); - CopyRectToBgTilemapBufferRect(2, sWonderCardData->bgTilemapBuffer, 0, 0, 30, 20, 0, 0, 30, 20, 1, 0x008, 0); + CopyRectToBgTilemapBufferRect(2, sWonderCardData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 1, 0x008, 0); CopyBgTilemapBufferToVram(2); break; case 4: @@ -291,9 +291,9 @@ s32 WonderCard_Exit(bool32 useCancel) return 0; break; case 2: - FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); @@ -595,7 +595,7 @@ static const struct WindowTemplate sNews_WindowTemplates[] = { .tilemapLeft = 1, .tilemapTop = 3, .width = 28, - .height = 20, + .height = DISPLAY_TILE_HEIGHT, .paletteNum = 2, .baseBlock = 0x07C } @@ -688,10 +688,10 @@ s32 WonderNews_Enter(void) SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); break; case 2: - FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); @@ -707,8 +707,8 @@ s32 WonderNews_Enter(void) gPaletteFade.bufferTransferDisabled = TRUE; LoadPalette(sWonderNewsData->gfx->pal, 0x10, 0x20); LZ77UnCompWram(sWonderNewsData->gfx->map, sWonderNewsData->bgTilemapBuffer); - CopyRectToBgTilemapBufferRect(1, sWonderNewsData->bgTilemapBuffer, 0, 0, 30, 3, 0, 0, 30, 3, 1, 8, 0); - CopyRectToBgTilemapBufferRect(3, sWonderNewsData->bgTilemapBuffer, 0, 3, 30, 23, 0, 3, 30, 23, 1, 8, 0); + CopyRectToBgTilemapBufferRect(1, sWonderNewsData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, 3, 0, 0, DISPLAY_TILE_WIDTH, 3, 1, 8, 0); + CopyRectToBgTilemapBufferRect(3, sWonderNewsData->bgTilemapBuffer, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 1, 8, 0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(3); break; @@ -760,10 +760,10 @@ s32 WonderNews_Exit(bool32 useCancel) ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); break; case 2: - FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20); - FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 24); - FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 24); + FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); + FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT + 4); + FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT + 4); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); diff --git a/src/naming_screen.c b/src/naming_screen.c index a05e501c2..82cb359bd 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -267,7 +267,7 @@ static const struct WindowTemplate sWindowTemplates[WIN_COUNT + 1] = .bg = 0, .tilemapLeft = 0, .tilemapTop = 0, - .width = 30, + .width = DISPLAY_TILE_WIDTH, .height = 2, .paletteNum = 11, .baseBlock = 0x074 diff --git a/src/party_menu.c b/src/party_menu.c index 8c9b09f52..7330075cc 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -2866,7 +2866,7 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW { if (x + width < 0) return FALSE; - if (x > 31) + if (x >= 32) return FALSE; if (x < 0) @@ -2879,7 +2879,7 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW { *leftMove = 0; *newX = x; - if (x + width > 31) + if (x + width >= 32) *newWidth = 32 - x; else *newWidth = width; diff --git a/src/trade.c b/src/trade.c index ba18e8d32..9c8fb2e8e 100644 --- a/src/trade.c +++ b/src/trade.c @@ -351,7 +351,7 @@ static void InitTradeMenu(void) FillWindowPixelBuffer(i, PIXEL_FILL(0)); } - FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 15); + FillBgTilemapBufferRect(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 15); LoadUserWindowBorderGfx_(0, 20, 0xC0); LoadUserWindowBorderGfx(2, 1, 0xE0); LoadMonIconPalettes(); @@ -2064,13 +2064,13 @@ static void RedrawTradeMenuParty(u8 whichParty) static void Task_DrawSelectionSummary(u8 taskId) { - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); } static void Task_DrawSelectionTrade(u8 taskId) { - FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20); + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT); CopyBgTilemapBufferToVram(0); } diff --git a/src/union_room.c b/src/union_room.c index b47ddb41c..229ea3164 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3680,8 +3680,8 @@ static s32 ListMenuHandler_AllItemsAvailable(u8 *state, u8 *windowId, u8 *listMe if (winTemplateCopy.width > maxWidth) winTemplateCopy.width = maxWidth; - if (winTemplateCopy.tilemapLeft + winTemplateCopy.width > 29) - winTemplateCopy.tilemapLeft = max(29 - winTemplateCopy.width, 0); + if (winTemplateCopy.tilemapLeft + winTemplateCopy.width >= DISPLAY_TILE_WIDTH) + winTemplateCopy.tilemapLeft = max(DISPLAY_TILE_WIDTH - 1 - winTemplateCopy.width, 0); *windowId = AddWindow(&winTemplateCopy); DrawStdWindowFrame(*windowId, FALSE); diff --git a/src/union_room_battle.c b/src/union_room_battle.c index 1ec8be77b..2e1e5621d 100644 --- a/src/union_room_battle.c +++ b/src/union_room_battle.c @@ -129,7 +129,7 @@ void CB2_UnionRoomBattle(void) ClearWindowTilemap(0); FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(0, PIXEL_FILL(1)); - FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF); + FillBgTilemapBufferRect(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF); LoadUserWindowBorderGfx(0, 1, 0xD0); LoadUserWindowBorderGfx_(0, 1, 0xD0); Menu_LoadStdPal();