Merge pull request #1855 from GriffinRichards/doc-chat

Add/correct some union room chat documentation
This commit is contained in:
GriffinR
2023-02-27 13:25:05 -05:00
committed by GitHub
10 changed files with 43 additions and 58 deletions

View File

@@ -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] =

66
src/union_room_chat.c Executable file → Normal file
View File

@@ -173,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
@@ -254,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);
@@ -527,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[] = {
{
@@ -759,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 = {
@@ -970,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;
}
@@ -1759,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;
}
@@ -2063,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;
@@ -2254,7 +2253,7 @@ static bool32 Display_LoadGfx(u8 *state)
ClearBg0();
break;
case 2:
LoadChatWindowBorderGfx();
LoadKeyboardWindowGfx();
break;
case 3:
LoadChatWindowGfx();
@@ -2264,7 +2263,7 @@ static bool32 Display_LoadGfx(u8 *state)
break;
case 5:
LoadChatMessagesWindow();
LoadKeyboardWindow();
DrawKeyboardWindow();
LoadKeyboardSwapWindow();
LoadTextEntryWindow();
break;
@@ -3063,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);
}
@@ -3080,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);
@@ -3090,19 +3093,19 @@ 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));
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(WIN_KEYBOARD);
PrintCurrentKeyboardPage();
@@ -3116,8 +3119,9 @@ 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(WIN_TEXT_ENTRY, sDisplay->unk2128, i * 8, 0, 8, 16);
BlitBitmapToWindow(WIN_TEXT_ENTRY, sDisplay->textEntryTiles, i * 8, 0, 8, 16);
FillWindowPixelBuffer(WIN_TEXT_ENTRY, PIXEL_FILL(0));
PutWindowTilemap(WIN_TEXT_ENTRY);
@@ -3129,7 +3133,7 @@ static void LoadKeyboardSwapWindow(void)
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);
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(14), PLTT_SIZE_4BPP);
}
static void InitScanlineEffect(void)