From 5793a1a5e7865cd2a70706501c6ed801705b7fe3 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 2 Feb 2023 00:09:53 -0500 Subject: [PATCH] Correct some union room chat documentation --- ..._palette2.pal => chat_messages_window.pal} | 0 .../{window_1.pal => input_text.pal} | 0 .../{border.bin => keyboard.bin} | Bin .../{border.png => keyboard.png} | Bin graphics/union_room_chat/r_button.png | Bin 188 -> 177 bytes .../{unk_palette1.pal => unused.pal} | 0 graphics/union_room_chat/window_2.pal | 19 --- include/graphics.h | 8 +- src/graphics.c | 8 +- src/union_room_chat.c | 158 ++++++++++-------- 10 files changed, 94 insertions(+), 99 deletions(-) rename graphics/union_room_chat/{unk_palette2.pal => chat_messages_window.pal} (100%) rename graphics/union_room_chat/{window_1.pal => input_text.pal} (100%) rename graphics/union_room_chat/{border.bin => keyboard.bin} (100%) rename graphics/union_room_chat/{border.png => keyboard.png} (100%) rename graphics/union_room_chat/{unk_palette1.pal => unused.pal} (100%) delete mode 100644 graphics/union_room_chat/window_2.pal diff --git a/graphics/union_room_chat/unk_palette2.pal b/graphics/union_room_chat/chat_messages_window.pal similarity index 100% rename from graphics/union_room_chat/unk_palette2.pal rename to graphics/union_room_chat/chat_messages_window.pal diff --git a/graphics/union_room_chat/window_1.pal b/graphics/union_room_chat/input_text.pal similarity index 100% rename from graphics/union_room_chat/window_1.pal rename to graphics/union_room_chat/input_text.pal diff --git a/graphics/union_room_chat/border.bin b/graphics/union_room_chat/keyboard.bin similarity index 100% rename from graphics/union_room_chat/border.bin rename to graphics/union_room_chat/keyboard.bin diff --git a/graphics/union_room_chat/border.png b/graphics/union_room_chat/keyboard.png similarity index 100% rename from graphics/union_room_chat/border.png rename to graphics/union_room_chat/keyboard.png diff --git a/graphics/union_room_chat/r_button.png b/graphics/union_room_chat/r_button.png index 168a293f35474ee97ea6a9ed3754d59a6b5c978f..06079ca2113a79e665b763c48c086075818cf5ad 100644 GIT binary patch delta 123 zcmdnPxRFt@Gr-TCmrII^fq{Y7)59eQNDF{43p0>>d-qY$L`C~R8&4O<5RRF(y$3lN z3^HM^k*qXReihuNE+> WXz3gaE13i`mBG{1&t;ucLK6TA3MyOx delta 134 zcmdnUxQ9`(Gr-TCmrII^fq{Y7)59eQNOJ(O0t+*cyn9dO@kB-Y7#}JO0sl69D z84Nj`?=JYwFK+GVEj}S8=vOIQ4NIrtqD+a@$+LvGe)50hm~p60=bFvN>Eh;p7(^%h kZJiPzv9Ce4QhK)Cgm*f}KJN&=3pAR+)78&qol`;+056*@5dZ)H diff --git a/graphics/union_room_chat/unk_palette1.pal b/graphics/union_room_chat/unused.pal similarity index 100% rename from graphics/union_room_chat/unk_palette1.pal rename to graphics/union_room_chat/unused.pal diff --git a/graphics/union_room_chat/window_2.pal b/graphics/union_room_chat/window_2.pal deleted file mode 100644 index a8c95a3c0..000000000 --- a/graphics/union_room_chat/window_2.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -156 197 98 -41 131 222 -0 82 172 -197 255 106 -172 230 49 -246 246 213 -255 49 49 -255 148 148 -131 164 213 -238 238 90 -65 65 65 -115 115 115 -172 172 172 -230 230 255 -0 0 0 -255 255 255 diff --git a/include/graphics.h b/include/graphics.h index 45dd9175d..135eaa95e 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4992,10 +4992,10 @@ extern const u32 gUsePokeblockCondition_Gfx[]; extern const u16 gUnionRoomChat_Background_Pal[]; extern const u32 gUnionRoomChat_Background_Gfx[]; extern const u32 gUnionRoomChat_Background_Tilemap[]; -extern const u16 gUnionRoomChat_Window_Pal1[]; -extern const u16 gUnionRoomChat_Window_Pal2[]; -extern const u32 gUnionRoomChat_Border_Gfx[]; -extern const u32 gUnionRoomChat_Border_Tilemap[]; +extern const u16 gUnionRoomChat_InputText_Pal[]; +extern const u16 gUnionRoomChat_Keyboard_Pal[]; +extern const u32 gUnionRoomChat_Keyboard_Gfx[]; +extern const u32 gUnionRoomChat_Keyboard_Tilemap[]; extern const u32 gUnionRoomChat_RButtonLabels[]; // Use Pokeblock diff --git a/src/graphics.c b/src/graphics.c index e0045ba6b..f288b98bf 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1427,10 +1427,10 @@ const u32 gNamingScreenKeyboardSymbols_Tilemap[] = INCBIN_U32("graphics/naming_s const u16 gUnionRoomChat_Background_Pal[] = INCBIN_U16("graphics/union_room_chat/background.gbapal"); const u32 gUnionRoomChat_Background_Gfx[] = INCBIN_U32("graphics/union_room_chat/background.4bpp.lz"); const u32 gUnionRoomChat_Background_Tilemap[] = INCBIN_U32("graphics/union_room_chat/background.bin.lz"); -const u16 gUnionRoomChat_Window_Pal1[] = INCBIN_U16("graphics/union_room_chat/window_1.gbapal"); -const u16 gUnionRoomChat_Window_Pal2[] = INCBIN_U16("graphics/union_room_chat/window_2.gbapal"); -const u32 gUnionRoomChat_Border_Gfx[] = INCBIN_U32("graphics/union_room_chat/border.4bpp.lz"); -const u32 gUnionRoomChat_Border_Tilemap[] = INCBIN_U32("graphics/union_room_chat/border.bin.lz"); +const u16 gUnionRoomChat_InputText_Pal[] = INCBIN_U16("graphics/union_room_chat/input_text.gbapal"); +const u16 gUnionRoomChat_Keyboard_Pal[] = INCBIN_U16("graphics/union_room_chat/keyboard.gbapal"); +const u32 gUnionRoomChat_Keyboard_Gfx[] = INCBIN_U32("graphics/union_room_chat/keyboard.4bpp.lz"); +const u32 gUnionRoomChat_Keyboard_Tilemap[] = INCBIN_U32("graphics/union_room_chat/keyboard.bin.lz"); const u32 gUnionRoomChat_RButtonLabels[] = INCBIN_U32("graphics/union_room_chat/r_button_labels.4bpp.lz"); const u16 gTilesetPalettes_General[][16] = diff --git a/src/union_room_chat.c b/src/union_room_chat.c index af4ec2721..253e02568 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -116,6 +116,13 @@ enum { // Shared by all above #define PALTAG_INTERFACE 0 +enum { + WIN_CHAT_HISTORY, + WIN_TEXT_ENTRY, + WIN_KEYBOARD, + WIN_SWAP_MENU, +}; + struct UnionRoomChat { u32 filler1; @@ -166,8 +173,7 @@ struct UnionRoomChatDisplay u8 bg1Buffer[BG_SCREEN_SIZE]; u8 bg3Buffer[BG_SCREEN_SIZE]; u8 bg2Buffer[BG_SCREEN_SIZE]; - u8 unk2128[0x20]; - u8 unk2148[0x20]; + u8 textEntryTiles[TILE_SIZE_4BPP * 2]; }; struct UnionRoomChatSprites @@ -247,11 +253,11 @@ static void FreeSprites(void); static void ResetGpuBgState(void); static void SetBgTilemapBuffers(void); static void ClearBg0(void); -static void LoadChatWindowBorderGfx(void); +static void LoadKeyboardWindowGfx(void); static void LoadChatWindowGfx(void); static void LoadChatUnkPalette(void); static void LoadChatMessagesWindow(void); -static void LoadKeyboardWindow(void); +static void DrawKeyboardWindow(void); static void LoadKeyboardSwapWindow(void); static void LoadTextEntryWindow(void); static void CreateKeyboardCursorSprite(void); @@ -520,8 +526,8 @@ static const u8 *const sUnionRoomKeyboardText[UNION_ROOM_KB_PAGE_COUNT - 1][UNIO } }; -static const u16 sUnk_Palette1[] = INCBIN_U16("graphics/union_room_chat/unk_palette1.gbapal"); -static const u16 sUnk_Palette2[] = INCBIN_U16("graphics/union_room_chat/unk_palette2.gbapal"); +static const u16 sUnusedPalette[] = INCBIN_U16("graphics/union_room_chat/unused.gbapal"); // Loaded but never apparently used +static const u16 sChatMessagesWindow_Pal[] = INCBIN_U16("graphics/union_room_chat/chat_messages_window.gbapal"); static const struct BgTemplate sBgTemplates[] = { { @@ -560,7 +566,7 @@ static const struct BgTemplate sBgTemplates[] = { }; static const struct WindowTemplate sWinTemplates[] = { - { + [WIN_CHAT_HISTORY] = { .bg = 3, .tilemapLeft = 8, .tilemapTop = 1, @@ -568,7 +574,8 @@ static const struct WindowTemplate sWinTemplates[] = { .height = 19, .paletteNum = 15, .baseBlock = 0x0001, - }, { + }, + [WIN_TEXT_ENTRY] = { .bg = 1, .tilemapLeft = 9, .tilemapTop = 18, @@ -576,7 +583,8 @@ static const struct WindowTemplate sWinTemplates[] = { .height = 2, .paletteNum = 12, .baseBlock = 0x007a, - }, { + }, + [WIN_KEYBOARD] = { .bg = 1, .tilemapLeft = 0, .tilemapTop = 2, @@ -584,7 +592,8 @@ static const struct WindowTemplate sWinTemplates[] = { .height = 15, .paletteNum = 7, .baseBlock = 0x0020, - }, { + }, + [WIN_SWAP_MENU] = { .bg = 0, .tilemapLeft = 1, .tilemapTop = 2, @@ -749,15 +758,15 @@ static const u32 sTextEntryArrowTiles[] = INCBIN_U32("graphics/union_room_chat/t static const u32 sRButtonGfxTiles[] = INCBIN_U32("graphics/union_room_chat/r_button.4bpp.lz"); static const struct CompressedSpriteSheet sSpriteSheets[] = { - {sKeyboardCursorTiles, 0x1000, 0}, - {sTextEntryArrowTiles, 0x0040, 1}, - {sTextEntryCursorTiles, 0x0040, 2}, - {sRButtonGfxTiles, 0x0080, 3}, - {gUnionRoomChat_RButtonLabels, 0x0400, 4} + {.data = sKeyboardCursorTiles, .size = 0x1000, .tag = GFXTAG_KEYBOARD_CURSOR}, + {.data = sTextEntryArrowTiles, .size = 0x0040, .tag = GFXTAG_TEXT_ENTRY_ARROW}, + {.data = sTextEntryCursorTiles, .size = 0x0040, .tag = GFXTAG_TEXT_ENTRY_CURSOR}, + {.data = sRButtonGfxTiles, .size = 0x0080, .tag = GFXTAG_RBUTTON_ICON}, + {.data = gUnionRoomChat_RButtonLabels, .size = 0x0400, .tag = GFXTAG_RBUTTON_LABELS} }; static const struct SpritePalette sSpritePalette = { - sUnionRoomChatInterfacePal, 0 + .data = sUnionRoomChatInterfacePal, .tag = PALTAG_INTERFACE }; static const struct OamData sOam_KeyboardCursor = { @@ -960,7 +969,7 @@ static void CB2_LoadInterface(void) sChat->handleInputTask = CreateTask(Task_HandlePlayerInput, 8); sChat->receiveMessagesTask = CreateTask(Task_ReceiveChatMessage, 7); LoadWirelessStatusIndicatorSpriteGfx(); - CreateWirelessStatusIndicatorSprite(232, 150); + CreateWirelessStatusIndicatorSprite(DISPLAY_WIDTH - 8, DISPLAY_HEIGHT - 10); } break; } @@ -1749,7 +1758,7 @@ static void RegisterTextAtRow(void) static void ResetMessageEntryBuffer(void) { sChat->messageEntryBuffer[0] = EOS; - sChat->lastBufferCursorPos = 15; + sChat->lastBufferCursorPos = MAX_MESSAGE_LENGTH; sChat->bufferCursorPos = 0; } @@ -2053,10 +2062,10 @@ static void Task_ReceiveChatMessage(u8 taskId) tState = 3; // fall through case 3: - for (; tI < 5 && ((tBlockReceivedStatus >> tI) & 1) == 0; tI++) + for (; tI < MAX_RFU_PLAYERS && ((tBlockReceivedStatus >> tI) & 1) == 0; tI++) ; - if (tI == 5) + if (tI == MAX_RFU_PLAYERS) { tState = 1; return; @@ -2244,7 +2253,7 @@ static bool32 Display_LoadGfx(u8 *state) ClearBg0(); break; case 2: - LoadChatWindowBorderGfx(); + LoadKeyboardWindowGfx(); break; case 3: LoadChatWindowGfx(); @@ -2254,7 +2263,7 @@ static bool32 Display_LoadGfx(u8 *state) break; case 5: LoadChatMessagesWindow(); - LoadKeyboardWindow(); + DrawKeyboardWindow(); LoadKeyboardSwapWindow(); LoadTextEntryWindow(); break; @@ -2280,7 +2289,7 @@ static bool32 Display_ShowKeyboardSwapMenu(u8 *state) { case 0: ShowKeyboardSwapMenu(); - CopyWindowToVram(3, COPYWIN_FULL); + CopyWindowToVram(WIN_SWAP_MENU, COPYWIN_FULL); break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -2296,7 +2305,7 @@ static bool32 Display_HideKeyboardSwapMenu(u8 *state) { case 0: HideKeyboardSwapMenu(); - CopyWindowToVram(3, COPYWIN_FULL); + CopyWindowToVram(WIN_SWAP_MENU, COPYWIN_FULL); break; case 1: return IsDma3ManagerBusyWithBgCopy(); @@ -2316,7 +2325,7 @@ static bool32 Display_SwitchPages(u8 *state) return TRUE; PrintCurrentKeyboardPage(); - CopyWindowToVram(2, COPYWIN_GFX); + CopyWindowToVram(WIN_KEYBOARD, COPYWIN_GFX); break; case 1: if (IsDma3ManagerBusyWithBgCopy()) @@ -2393,7 +2402,7 @@ static bool32 Display_UpdateMessageBuffer(u8 *state) FillTextEntryWindow(x, width, 0); str = GetMessageEntryBuffer(); DrawTextEntryMessage(0, str, 3, 1, 2); - CopyWindowToVram(1, COPYWIN_GFX); + CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_GFX); break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) @@ -2422,7 +2431,7 @@ static bool32 Display_AskRegisterText(u8 *state) length = StringLength_Multibyte(str); FillTextEntryWindow(x, length, PIXEL_FILL(6)); DrawTextEntryMessage(x, str, 0, 4, 5); - CopyWindowToVram(1, COPYWIN_GFX); + CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_GFX); break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) @@ -2463,7 +2472,7 @@ static bool32 Display_CancelRegister(u8 *state) length = StringLength_Multibyte(str); FillTextEntryWindow(x, length, PIXEL_FILL(0)); DrawTextEntryMessage(x, str, 3, 1, 2); - CopyWindowToVram(1, COPYWIN_GFX); + CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_GFX); break; case 1: if (!IsDma3ManagerBusyWithBgCopy()) @@ -2501,7 +2510,7 @@ static bool32 Display_ReturnToKeyboard(u8 *state) { case 0: PrintCurrentKeyboardPage(); - CopyWindowToVram(2, COPYWIN_GFX); + CopyWindowToVram(WIN_KEYBOARD, COPYWIN_GFX); (*state)++; break; case 1: @@ -2527,7 +2536,7 @@ static bool32 Display_ScrollChat(u8 *state) str = GetLastReceivedMessage(); colorIdx = GetReceivedPlayerIndex(); PrintChatMessage(row, str, colorIdx); - CopyWindowToVram(0, COPYWIN_GFX); + CopyWindowToVram(WIN_CHAT_HISTORY, COPYWIN_GFX); break; case 1: if (IsDma3ManagerBusyWithBgCopy()) @@ -2546,8 +2555,8 @@ static bool32 Display_ScrollChat(u8 *state) } // fall through case 2: - ScrollWindow(0, 0, 5, PIXEL_FILL(1)); - CopyWindowToVram(0, COPYWIN_GFX); + ScrollWindow(WIN_CHAT_HISTORY, 0, 5, PIXEL_FILL(1)); + CopyWindowToVram(WIN_CHAT_HISTORY, COPYWIN_GFX); sDisplay->scrollCount++; (*state)++; // fall through @@ -2864,7 +2873,7 @@ static void DestroyStdMessageWindow(void) static void FillTextEntryWindow(u16 x, u16 width, u8 fillValue) { - FillWindowPixelRect(1, fillValue, x * 8, 1, width * 8, 14); + FillWindowPixelRect(WIN_TEXT_ENTRY, fillValue, x * 8, 1, width * 8, 14); } static void DrawTextEntryMessage(u16 x, u8 *str, u8 bgColor, u8 fgColor, u8 shadowColor) @@ -2881,7 +2890,7 @@ static void DrawTextEntryMessage(u16 x, u8 *str, u8 bgColor, u8 fgColor, u8 shad strBuffer[1] = EXT_CTRL_CODE_MIN_LETTER_SPACING; strBuffer[2] = 8; StringCopy(&strBuffer[3], str); - AddTextPrinterParameterized3(1, FONT_SHORT, x * 8, 1, color, TEXT_SKIP_DRAW, strBuffer); + AddTextPrinterParameterized3(WIN_TEXT_ENTRY, FONT_SHORT, x * 8, 1, color, TEXT_SKIP_DRAW, strBuffer); } static void PrintCurrentKeyboardPage(void) @@ -2894,7 +2903,7 @@ static void PrintCurrentKeyboardPage(void) u8 str[45]; u8 *str2; - FillWindowPixelBuffer(2, PIXEL_FILL(15)); + FillWindowPixelBuffer(WIN_KEYBOARD, PIXEL_FILL(15)); page = GetCurrentKeyboardPage(); color[0] = TEXT_COLOR_TRANSPARENT; color[1] = TEXT_DYNAMIC_COLOR_5; @@ -2916,7 +2925,7 @@ static void PrintCurrentKeyboardPage(void) return; StringCopy(&str[3], sUnionRoomKeyboardText[page][i]); - AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str); + AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str); } } else @@ -2927,7 +2936,7 @@ static void PrintCurrentKeyboardPage(void) str2 = GetRegisteredTextByRow(i); if (GetStringWidth(FONT_SMALL, str2, 0) <= 40) { - AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str2); + AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str2); } else { @@ -2938,8 +2947,8 @@ static void PrintCurrentKeyboardPage(void) StringCopyN_Multibyte(str, str2, length); } while (GetStringWidth(FONT_SMALL, str, 0) > 35); - AddTextPrinterParameterized3(2, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str); - AddTextPrinterParameterized3(2, FONT_SMALL, left + 35, top, color, TEXT_SKIP_DRAW, sText_Ellipsis); + AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left, top, color, TEXT_SKIP_DRAW, str); + AddTextPrinterParameterized3(WIN_KEYBOARD, FONT_SMALL, left + 35, top, color, TEXT_SKIP_DRAW, sText_Ellipsis); } } } @@ -2989,17 +2998,17 @@ static bool32 SlideKeyboardPageIn(void) static void ShowKeyboardSwapMenu(void) { - FillWindowPixelBuffer(3, PIXEL_FILL(1)); - DrawTextBorderOuter(3, 1, 13); - PrintMenuActionTextsAtPos(3, FONT_SHORT, 8, 1, 14, ARRAY_COUNT(sKeyboardPageTitleTexts), sKeyboardPageTitleTexts); - InitMenuNormal(3, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage()); - PutWindowTilemap(3); + FillWindowPixelBuffer(WIN_SWAP_MENU, PIXEL_FILL(1)); + DrawTextBorderOuter(WIN_SWAP_MENU, 1, 13); + PrintMenuActionTextsAtPos(WIN_SWAP_MENU, FONT_SHORT, 8, 1, 14, ARRAY_COUNT(sKeyboardPageTitleTexts), sKeyboardPageTitleTexts); + InitMenuNormal(WIN_SWAP_MENU, FONT_SHORT, 0, 1, 14, 5, GetCurrentKeyboardPage()); + PutWindowTilemap(WIN_SWAP_MENU); } static void HideKeyboardSwapMenu(void) { - ClearStdWindowAndFrameToTransparent(3, FALSE); - ClearWindowTilemap(3); + ClearStdWindowAndFrameToTransparent(WIN_SWAP_MENU, FALSE); + ClearWindowTilemap(WIN_SWAP_MENU); } static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx) @@ -3009,8 +3018,8 @@ static void PrintChatMessage(u16 row, u8 *str, u8 colorIdx) color[0] = TEXT_COLOR_WHITE; color[1] = colorIdx * 2 + 2; color[2] = colorIdx * 2 + 3; - FillWindowPixelRect(0, PIXEL_FILL(1), 0, row * 15, 168, 15); - AddTextPrinterParameterized3(0, FONT_SHORT, 0, row * 15 + 1, color, TEXT_SKIP_DRAW, str); + FillWindowPixelRect(WIN_CHAT_HISTORY, PIXEL_FILL(1), 0, row * 15, 168, 15); + AddTextPrinterParameterized3(WIN_CHAT_HISTORY, FONT_SHORT, 0, row * 15 + 1, color, TEXT_SKIP_DRAW, str); } static void ResetGpuBgState(void) @@ -3053,12 +3062,12 @@ static void ClearBg0(void) CopyBgTilemapBufferToVram(0); } -static void LoadChatWindowBorderGfx(void) +static void LoadKeyboardWindowGfx(void) { - LoadPalette(gUnionRoomChat_Window_Pal2, BG_PLTT_ID(7), PLTT_SIZE_4BPP); - LoadPalette(gUnionRoomChat_Window_Pal1, BG_PLTT_ID(12), PLTT_SIZE_4BPP); - DecompressAndCopyTileDataToVram(1, gUnionRoomChat_Border_Gfx, 0, 0, 0); - CopyToBgTilemapBuffer(1, gUnionRoomChat_Border_Tilemap, 0, 0); + LoadPalette(gUnionRoomChat_Keyboard_Pal, BG_PLTT_ID(7), PLTT_SIZE_4BPP); + LoadPalette(gUnionRoomChat_InputText_Pal, BG_PLTT_ID(12), PLTT_SIZE_4BPP); + DecompressAndCopyTileDataToVram(1, gUnionRoomChat_Keyboard_Gfx, 0, 0, 0); + CopyToBgTilemapBuffer(1, gUnionRoomChat_Keyboard_Tilemap, 0, 0); CopyBgTilemapBufferToVram(1); } @@ -3070,8 +3079,12 @@ static void LoadChatWindowGfx(void) ptr = DecompressAndCopyTileDataToVram(2, gUnionRoomChat_Background_Gfx, 0, 0, 0); if (ptr) { - CpuFastCopy(&ptr[0x220], sDisplay->unk2128, sizeof(sDisplay->unk2128)); - CpuFastCopy(&ptr[0x420], sDisplay->unk2148, sizeof(sDisplay->unk2148)); + // The below is nonsense. Tiles 0x11 and 0x21 of the background tileset are + // the second half of "OK" and the "T" in "START" in the instructions header. + // They're later blitted onto the text entry window, then immediately cleared. + // The window has a different palette as well, so the tiles would appear mostly black anyway. + CpuFastCopy(&ptr[0x11 * TILE_SIZE_4BPP], &sDisplay->textEntryTiles[TILE_SIZE_4BPP * 0], TILE_SIZE_4BPP); + CpuFastCopy(&ptr[0x21 * TILE_SIZE_4BPP], &sDisplay->textEntryTiles[TILE_SIZE_4BPP * 1], TILE_SIZE_4BPP); } CopyToBgTilemapBuffer(2, gUnionRoomChat_Background_Tilemap, 0, 0); @@ -3080,23 +3093,23 @@ static void LoadChatWindowGfx(void) static void LoadChatUnkPalette(void) { - LoadPalette(sUnk_Palette1, BG_PLTT_ID(8), sizeof(sUnk_Palette1)); - RequestDma3Fill(0, (void *)BG_CHAR_ADDR(1) + 0x20, 0x20, 1); + LoadPalette(sUnusedPalette, BG_PLTT_ID(8), sizeof(sUnusedPalette)); + RequestDma3Fill(0, (void *)BG_CHAR_ADDR(1) + TILE_SIZE_4BPP, TILE_SIZE_4BPP, 1); } static void LoadChatMessagesWindow(void) { - LoadPalette(sUnk_Palette2, BG_PLTT_ID(15), sizeof(sUnk_Palette2)); - PutWindowTilemap(0); - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - CopyWindowToVram(0, COPYWIN_FULL); + LoadPalette(sChatMessagesWindow_Pal, BG_PLTT_ID(15), sizeof(sChatMessagesWindow_Pal)); + PutWindowTilemap(WIN_CHAT_HISTORY); + FillWindowPixelBuffer(WIN_CHAT_HISTORY, PIXEL_FILL(1)); + CopyWindowToVram(WIN_CHAT_HISTORY, COPYWIN_FULL); } -static void LoadKeyboardWindow(void) +static void DrawKeyboardWindow(void) { - PutWindowTilemap(2); + PutWindowTilemap(WIN_KEYBOARD); PrintCurrentKeyboardPage(); - CopyWindowToVram(2, COPYWIN_FULL); + CopyWindowToVram(WIN_KEYBOARD, COPYWIN_FULL); } static void LoadTextEntryWindow(void) @@ -3106,20 +3119,21 @@ static void LoadTextEntryWindow(void) unused[0] = 0; unused[1] = 0xFF; + // Pointless, cleared below. The tiles are nonsense anyway, see LoadChatWindowGfx. for (i = 0; i < MAX_MESSAGE_LENGTH; i++) - BlitBitmapToWindow(1, sDisplay->unk2128, i * 8, 0, 8, 16); + BlitBitmapToWindow(WIN_TEXT_ENTRY, sDisplay->textEntryTiles, i * 8, 0, 8, 16); - FillWindowPixelBuffer(1, PIXEL_FILL(0)); - PutWindowTilemap(1); - CopyWindowToVram(1, COPYWIN_FULL); + FillWindowPixelBuffer(WIN_TEXT_ENTRY, PIXEL_FILL(0)); + PutWindowTilemap(WIN_TEXT_ENTRY); + CopyWindowToVram(WIN_TEXT_ENTRY, COPYWIN_FULL); } static void LoadKeyboardSwapWindow(void) { - FillWindowPixelBuffer(3, PIXEL_FILL(1)); - LoadUserWindowBorderGfx(3, 1, BG_PLTT_ID(13)); - LoadUserWindowBorderGfx_(3, 0xA, BG_PLTT_ID(2)); - LoadPalette(gStandardMenuPalette, BG_PLTT_ID(14), PLTT_SIZE_4BPP); + FillWindowPixelBuffer(WIN_SWAP_MENU, PIXEL_FILL(1)); + LoadUserWindowBorderGfx(WIN_SWAP_MENU, 1, BG_PLTT_ID(13)); + LoadUserWindowBorderGfx_(WIN_SWAP_MENU, 0xA, BG_PLTT_ID(2)); + LoadPalette(gStandardMenuPalette, BG_PLTT_ID(14), PLTT_SIZE_4BPP); } static void InitScanlineEffect(void)