summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/union_room_chat_display.c287
-rw-r--r--src/union_room_chat_objects.c316
2 files changed, 504 insertions, 99 deletions
diff --git a/src/union_room_chat_display.c b/src/union_room_chat_display.c
index 0e1e7c3b6..c60c94eb0 100644
--- a/src/union_room_chat_display.c
+++ b/src/union_room_chat_display.c
@@ -11,46 +11,46 @@
#include "union_room_chat_display.h"
#include "union_room_chat_objects.h"
-struct UnionRoomChat2_Unk0
+struct UnionRoomChat2Subtask
{
- bool32 (*unk0)(u8 *);
- u8 unk4;
- u8 unk5;
+ bool32 (*callback)(u8 *);
+ u8 active;
+ u8 state;
};
struct UnionRoomChat2
{
- struct UnionRoomChat2_Unk0 unk0[3];
+ struct UnionRoomChat2Subtask subtasks[3];
u16 unk18;
u16 unk1A;
u16 unk1C;
- u16 unk1E;
- s16 unk20;
- u8 unk22[0x106];
- u8 unk128[BG_SCREEN_SIZE];
- u8 unk928[BG_SCREEN_SIZE];
- u8 unk1128[BG_SCREEN_SIZE];
- u8 unk1928[BG_SCREEN_SIZE];
+ u16 messageWindowId;
+ s16 bg1hofs;
+ u8 expandedPlaceholdersBuffer[0x106];
+ u8 bg0Buffer[BG_SCREEN_SIZE];
+ u8 bg1Buffer[BG_SCREEN_SIZE];
+ u8 bg3Buffer[BG_SCREEN_SIZE];
+ u8 bg2Buffer[BG_SCREEN_SIZE];
u8 unk2128[0x20];
u8 unk2148[0x20];
};
struct Unk845AABC
{
- u16 unk0;
- bool32 (*unk4)(u8 *);
+ u16 idx;
+ bool32 (*callback)(u8 *);
};
struct Unk845AB64
{
- const u8 *unk0;
- u8 unk4;
- u8 unk5;
- u8 unk6;
- u8 unk7;
- u8 unk8;
- u8 unk9;
- u8 unkA;
+ const u8 *text;
+ bool8 boxType;
+ u8 x;
+ u8 y;
+ u8 letterSpacing;
+ u8 lineSpacing;
+ bool8 expandPlaceholders;
+ bool8 widerBox;
};
EWRAM_DATA struct UnionRoomChat2 * gUnknown_203B0E4 = NULL;
@@ -208,17 +208,106 @@ const struct Unk845AABC gUnknown_845AABC[] = {
};
const struct Unk845AB64 gUnknown_845AB64[] = {
- {gText_QuitChatting, 1, 0, 0, 1, 2, 0, 0},
- {gText_RegisterTextWhere, 1, 0, 0, 1, 2, 0, 0},
- {gText_RegisterTextHere, 1, 0, 0, 1, 2, 0, 0},
- {gText_InputText, 1, 0, 0, 1, 2, 0, 0},
- {gText_ExitingTheChat, 2, 0, 0, 1, 2, 0, 0},
- {gText_LeaderHasLeftEndingChat, 2, 0, 0, 0, 2, 1, 0},
- {gText_RegisteredTextChanged_OKtoSave, 2, 0, 0, 1, 2, 0, 1},
- {gText_RegisteredTextChanged_AlreadySavedFile, 2, 0, 0, 1, 2, 0, 1},
- {gText_RegisteredTextChanged_SavingDontTurnOff, 2, 0, 0, 1, 2, 0, 1},
- {gText_RegisteredTextChanged_SavedTheGame, 2, 0, 0, 1, 2, 1, 1},
- {gText_IfLeaderLeavesChatWillEnd, 2, 0, 0, 1, 2, 0, 1}
+ {
+ .text = gText_QuitChatting,
+ .boxType = 1,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = FALSE
+ }, {
+ .text = gText_RegisterTextWhere,
+ .boxType = 1,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = FALSE
+ }, {
+ .text = gText_RegisterTextHere,
+ .boxType = 1,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = FALSE
+ }, {
+ .text = gText_InputText,
+ .boxType = 1,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = FALSE
+ }, {
+ .text = gText_ExitingTheChat,
+ .boxType = 2,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = FALSE
+ }, {
+ .text = gText_LeaderHasLeftEndingChat,
+ .boxType = 2,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 0,
+ .lineSpacing = 2,
+ .expandPlaceholders = TRUE,
+ .widerBox = FALSE
+ }, {
+ .text = gText_RegisteredTextChanged_OKtoSave,
+ .boxType = 2,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = TRUE
+ }, {
+ .text = gText_RegisteredTextChanged_AlreadySavedFile,
+ .boxType = 2,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = TRUE
+ }, {
+ .text = gText_RegisteredTextChanged_SavingDontTurnOff,
+ .boxType = 2,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = TRUE
+ }, {
+ .text = gText_RegisteredTextChanged_SavedTheGame,
+ .boxType = 2,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = TRUE,
+ .widerBox = TRUE
+ }, {
+ .text = gText_IfLeaderLeavesChatWillEnd,
+ .boxType = 2,
+ .x = 0,
+ .y = 0,
+ .letterSpacing = 1,
+ .lineSpacing = 2,
+ .expandPlaceholders = FALSE,
+ .widerBox = TRUE
+ }
};
const u8 gText_Ellipsis[] = _("…");
@@ -270,7 +359,7 @@ void sub_8129B88(void)
void sub_8129BB8(struct UnionRoomChat2 *arg0)
{
arg0->unk18 = 0xFF;
- arg0->unk1E = 0xFF;
+ arg0->messageWindowId = 0xFF;
arg0->unk1A = 0;
}
@@ -283,9 +372,9 @@ void sub_8129BC4(void)
for (i = 0; i < 3; i++)
{
- gUnknown_203B0E4->unk0[i].unk0 = sub_812A420;
- gUnknown_203B0E4->unk0[i].unk4 = 0;
- gUnknown_203B0E4->unk0[i].unk5 = 0;
+ gUnknown_203B0E4->subtasks[i].callback = sub_812A420;
+ gUnknown_203B0E4->subtasks[i].active = FALSE;
+ gUnknown_203B0E4->subtasks[i].state = 0;
}
}
@@ -298,8 +387,8 @@ void sub_8129BFC(void)
for (i = 0; i < 3; i++)
{
- if (gUnknown_203B0E4->unk0[i].unk4)
- gUnknown_203B0E4->unk0[i].unk4 = gUnknown_203B0E4->unk0[i].unk0(&gUnknown_203B0E4->unk0[i].unk5);
+ if (gUnknown_203B0E4->subtasks[i].active)
+ gUnknown_203B0E4->subtasks[i].active = gUnknown_203B0E4->subtasks[i].callback(&gUnknown_203B0E4->subtasks[i].state);
}
}
@@ -307,14 +396,14 @@ void sub_8129C34(u16 arg0, u8 arg1)
{
int i;
- gUnknown_203B0E4->unk0[arg1].unk0 = sub_812A420;
+ gUnknown_203B0E4->subtasks[arg1].callback = sub_812A420;
for (i = 0; i < NELEMS(gUnknown_845AABC); i++)
{
- if (gUnknown_845AABC[i].unk0 == arg0)
+ if (gUnknown_845AABC[i].idx == arg0)
{
- gUnknown_203B0E4->unk0[arg1].unk0 = gUnknown_845AABC[i].unk4;
- gUnknown_203B0E4->unk0[arg1].unk4 = 1;
- gUnknown_203B0E4->unk0[arg1].unk5 = 0;
+ gUnknown_203B0E4->subtasks[arg1].callback = gUnknown_845AABC[i].callback;
+ gUnknown_203B0E4->subtasks[arg1].active = TRUE;
+ gUnknown_203B0E4->subtasks[arg1].state = 0;
break;
}
}
@@ -322,7 +411,7 @@ void sub_8129C34(u16 arg0, u8 arg1)
bool8 sub_8129C8C(u8 arg0)
{
- return gUnknown_203B0E4->unk0[arg0].unk4;
+ return gUnknown_203B0E4->subtasks[arg0].active;
}
bool32 sub_8129CA0(u8 *state)
@@ -445,7 +534,7 @@ bool32 sub_8129E28(u8 *state)
case 0:
sub_812A578(0, 0);
sub_812A424(23, 11, 1);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
break;
case 1:
return IsDma3ManagerBusyWithBgCopy();
@@ -524,7 +613,7 @@ bool32 sub_8129F24(u8 *state)
if (!IsDma3ManagerBusyWithBgCopy())
{
sub_812A578(1, 16);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
}
else
{
@@ -565,7 +654,7 @@ bool32 sub_8129FCC(u8 *state)
if (!IsDma3ManagerBusyWithBgCopy())
{
sub_812A6F4();
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
}
else
{
@@ -688,7 +777,7 @@ bool32 sub_812A1B8(u8 *state)
{
case 0:
sub_812A578(3, 16);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -704,7 +793,7 @@ bool32 sub_812A1FC(u8 *state)
{
case 0:
sub_812A578(4, 0);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -725,7 +814,7 @@ bool32 sub_812A240(u8 *state)
str = sub_8129814();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, str);
sub_812A578(5, 0);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -742,7 +831,7 @@ bool32 sub_812A294(u8 *state)
case 0:
sub_812A578(6, 0);
sub_812A424(23, 10, 1);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -759,7 +848,7 @@ bool32 sub_812A2E4(u8 *state)
case 0:
sub_812A578(7, 0);
sub_812A424(23, 10, 1);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -775,7 +864,7 @@ bool32 sub_812A334(u8 *state)
{
case 0:
sub_812A578(8, 0);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -793,7 +882,7 @@ bool32 sub_812A378(u8 *state)
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gSaveBlock2Ptr->playerName);
sub_812A578(9, 0);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -810,7 +899,7 @@ bool32 sub_812A3D0(u8 *state)
case 0:
sub_812A578(10, 0);
sub_812A424(23, 10, 1);
- CopyWindowToVram(gUnknown_203B0E4->unk1E, 3);
+ CopyWindowToVram(gUnknown_203B0E4->messageWindowId, 3);
(*state)++;
break;
case 1:
@@ -882,43 +971,43 @@ void sub_812A578(int arg0, u16 arg1)
template.height = 4;
template.paletteNum = 14;
template.baseBlock = 0x06A;
- if (gUnknown_845AB64[arg0].unkA)
+ if (gUnknown_845AB64[arg0].widerBox)
{
template.tilemapLeft -= 7;
template.width += 7;
}
- gUnknown_203B0E4->unk1E = AddWindow(&template);
- windowId = gUnknown_203B0E4->unk1E;
- if (gUnknown_203B0E4->unk1E == 0xFF)
+ gUnknown_203B0E4->messageWindowId = AddWindow(&template);
+ windowId = gUnknown_203B0E4->messageWindowId;
+ if (gUnknown_203B0E4->messageWindowId == 0xFF)
return;
- if (gUnknown_845AB64[arg0].unk9)
+ if (gUnknown_845AB64[arg0].expandPlaceholders)
{
- DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_203B0E4->unk22, gUnknown_845AB64[arg0].unk0);
- str = gUnknown_203B0E4->unk22;
+ DynamicPlaceholderTextUtil_ExpandPlaceholders(gUnknown_203B0E4->expandedPlaceholdersBuffer, gUnknown_845AB64[arg0].text);
+ str = gUnknown_203B0E4->expandedPlaceholdersBuffer;
}
else
{
- str = gUnknown_845AB64[arg0].unk0;
+ str = gUnknown_845AB64[arg0].text;
}
ChangeBgY(0, arg1 * 256, 0);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
PutWindowTilemap(windowId);
- if (gUnknown_845AB64[arg0].unk4 == 1)
+ if (gUnknown_845AB64[arg0].boxType == 1)
{
DrawTextBorderInner(windowId, 0xA, 2);
AddTextPrinterParameterized5(
windowId,
2,
str,
- gUnknown_845AB64[arg0].unk5 + 8,
- gUnknown_845AB64[arg0].unk6 + 8,
+ gUnknown_845AB64[arg0].x + 8,
+ gUnknown_845AB64[arg0].y + 8,
TEXT_SPEED_FF,
NULL,
- gUnknown_845AB64[arg0].unk7,
- gUnknown_845AB64[arg0].unk8);
+ gUnknown_845AB64[arg0].letterSpacing,
+ gUnknown_845AB64[arg0].lineSpacing);
}
else
{
@@ -927,23 +1016,23 @@ void sub_812A578(int arg0, u16 arg1)
windowId,
2,
str,
- gUnknown_845AB64[arg0].unk5,
- gUnknown_845AB64[arg0].unk6,
+ gUnknown_845AB64[arg0].x,
+ gUnknown_845AB64[arg0].y,
TEXT_SPEED_FF,
NULL,
- gUnknown_845AB64[arg0].unk7,
- gUnknown_845AB64[arg0].unk8);
+ gUnknown_845AB64[arg0].letterSpacing,
+ gUnknown_845AB64[arg0].lineSpacing);
}
- gUnknown_203B0E4->unk1E = windowId;
+ gUnknown_203B0E4->messageWindowId = windowId;
}
void sub_812A6F4(void)
{
- if (gUnknown_203B0E4->unk1E != 0xFF)
+ if (gUnknown_203B0E4->messageWindowId != 0xFF)
{
- ClearStdWindowAndFrameToTransparent(gUnknown_203B0E4->unk1E, FALSE);
- ClearWindowTilemap(gUnknown_203B0E4->unk1E);
+ ClearStdWindowAndFrameToTransparent(gUnknown_203B0E4->messageWindowId, FALSE);
+ ClearWindowTilemap(gUnknown_203B0E4->messageWindowId);
}
ChangeBgY(0, 0, 0);
@@ -951,10 +1040,10 @@ void sub_812A6F4(void)
void sub_812A728(void)
{
- if (gUnknown_203B0E4->unk1E != 0xFF)
+ if (gUnknown_203B0E4->messageWindowId != 0xFF)
{
- RemoveWindow(gUnknown_203B0E4->unk1E);
- gUnknown_203B0E4->unk1E = 0xFF;
+ RemoveWindow(gUnknown_203B0E4->messageWindowId);
+ gUnknown_203B0E4->messageWindowId = 0xFF;
}
}
@@ -1045,39 +1134,39 @@ void sub_812A804(void)
bool32 sub_812A980(void)
{
- if (gUnknown_203B0E4->unk20 < 56)
+ if (gUnknown_203B0E4->bg1hofs < 56)
{
- gUnknown_203B0E4->unk20 += 12;
- if (gUnknown_203B0E4->unk20 >= 56)
- gUnknown_203B0E4->unk20 = 56;
+ gUnknown_203B0E4->bg1hofs += 12;
+ if (gUnknown_203B0E4->bg1hofs >= 56)
+ gUnknown_203B0E4->bg1hofs = 56;
- if (gUnknown_203B0E4->unk20 < 56)
+ if (gUnknown_203B0E4->bg1hofs < 56)
{
- sub_812ADA0(gUnknown_203B0E4->unk20);
+ sub_812ADA0(gUnknown_203B0E4->bg1hofs);
return TRUE;
}
}
- sub_812ADF8(gUnknown_203B0E4->unk20);
+ sub_812ADF8(gUnknown_203B0E4->bg1hofs);
return FALSE;
}
bool32 sub_812A9C8(void)
{
- if (gUnknown_203B0E4->unk20 > 0)
+ if (gUnknown_203B0E4->bg1hofs > 0)
{
- gUnknown_203B0E4->unk20 -= 12;
- if (gUnknown_203B0E4->unk20 <= 0)
- gUnknown_203B0E4->unk20 = 0;
+ gUnknown_203B0E4->bg1hofs -= 12;
+ if (gUnknown_203B0E4->bg1hofs <= 0)
+ gUnknown_203B0E4->bg1hofs = 0;
- if (gUnknown_203B0E4->unk20 > 0)
+ if (gUnknown_203B0E4->bg1hofs > 0)
{
- sub_812ADA0(gUnknown_203B0E4->unk20);
+ sub_812ADA0(gUnknown_203B0E4->bg1hofs);
return TRUE;
}
}
- sub_812ADF8(gUnknown_203B0E4->unk20);
+ sub_812ADF8(gUnknown_203B0E4->bg1hofs);
return FALSE;
}
@@ -1133,10 +1222,10 @@ void sub_812AAD4(void)
void sub_812AB8C(void)
{
- SetBgTilemapBuffer(0, gUnknown_203B0E4->unk128);
- SetBgTilemapBuffer(1, gUnknown_203B0E4->unk928);
- SetBgTilemapBuffer(3, gUnknown_203B0E4->unk1128);
- SetBgTilemapBuffer(2, gUnknown_203B0E4->unk1928);
+ SetBgTilemapBuffer(0, gUnknown_203B0E4->bg0Buffer);
+ SetBgTilemapBuffer(1, gUnknown_203B0E4->bg1Buffer);
+ SetBgTilemapBuffer(3, gUnknown_203B0E4->bg3Buffer);
+ SetBgTilemapBuffer(2, gUnknown_203B0E4->bg2Buffer);
}
void sub_812ABD8(void)
@@ -1208,7 +1297,7 @@ void sub_812AD50(void)
params.dmaDest = &REG_BG1HOFS;
params.initState = 1;
params.unused9 = 0;
- gUnknown_203B0E4->unk20 = 0;
+ gUnknown_203B0E4->bg1hofs = 0;
CpuFastFill(0, gScanlineEffectRegBuffers, sizeof(gScanlineEffectRegBuffers));
ScanlineEffect_SetParams(params);
}
diff --git a/src/union_room_chat_objects.c b/src/union_room_chat_objects.c
new file mode 100644
index 000000000..805e95d33
--- /dev/null
+++ b/src/union_room_chat_objects.c
@@ -0,0 +1,316 @@
+#include "global.h"
+#include "gflib.h"
+#include "decompress.h"
+#include "graphics.h"
+#include "union_room_chat.h"
+
+struct UnionRoomChat3
+{
+ struct Sprite *unk0;
+ struct Sprite *unk4;
+ struct Sprite *unk8;
+ struct Sprite *unkC;
+ struct Sprite *unk10;
+ u16 unk14;
+};
+
+EWRAM_DATA struct UnionRoomChat3 *gUnknown_203B0E8 = NULL;
+
+void sub_812B09C(struct Sprite * sprite);
+void sub_812B0D4(struct Sprite * sprite);
+
+const u16 gUnknown_845AC14[] = INCBIN_U16("graphics/union_room_chat/unk_845AC14.gbapal");
+const u32 gUnknown_845AC34[] = INCBIN_U32("graphics/union_room_chat/unk_845AC34.4bpp.lz");
+const u32 gUnknown_845AEB8[] = INCBIN_U32("graphics/union_room_chat/unk_845AEB8.4bpp.lz");
+const u32 gUnknown_845AED8[] = INCBIN_U32("graphics/union_room_chat/unk_845AED8.4bpp.lz");
+const u32 gUnknown_845AF04[] = INCBIN_U32("graphics/union_room_chat/unk_845AF04.4bpp.lz");
+
+const struct CompressedSpriteSheet gUnknown_845AF58[] = {
+ {gUnknown_845AC34, 0x1000, 0},
+ {gUnknown_845AED8, 0x0040, 1},
+ {gUnknown_845AEB8, 0x0040, 2},
+ {gUnknown_845AF04, 0x0080, 3},
+ {gUnknown_8EA1A50, 0x0400, 4}
+};
+
+const struct SpritePalette gUnknown_845AF80 = {
+ gUnknown_845AC14, 0
+};
+
+const struct OamData gOamData_845AF88 = {
+ .shape = SPRITE_SHAPE(64x32),
+ .size = SPRITE_SIZE(64x32),
+ .priority = 1
+};
+
+const union AnimCmd gAnimCmd_845AF90[] = {
+ ANIMCMD_FRAME(0x00, 30),
+ ANIMCMD_END
+};
+
+const union AnimCmd gAnimCmd_845AF98[] = {
+ ANIMCMD_FRAME(0x20, 30),
+ ANIMCMD_END
+};
+
+const union AnimCmd gAnimCmd_845AFA0[] = {
+ ANIMCMD_FRAME(0x40, 30),
+ ANIMCMD_END
+};
+
+const union AnimCmd gAnimCmd_845AFA8[] = {
+ ANIMCMD_FRAME(0x60, 30),
+ ANIMCMD_END
+};
+
+const union AnimCmd *const gSpriteAnimTable_845AFB0[] = {
+ gAnimCmd_845AF90,
+ gAnimCmd_845AF98,
+ gAnimCmd_845AFA0,
+ gAnimCmd_845AFA8
+};
+
+const struct SpriteTemplate gUnknown_845AFC0 = {
+ .tileTag = 0,
+ .paletteTag = 0,
+ .oam = &gOamData_845AF88,
+ .anims = gSpriteAnimTable_845AFB0,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+const struct OamData gOamData_845AFD8 = {
+ .shape = SPRITE_SHAPE(8x16),
+ .size = SPRITE_SIZE(8x16),
+ .priority = 2
+};
+
+const struct SpriteTemplate gUnknown_845AFE0 = {
+ .tileTag = 2,
+ .paletteTag = 0,
+ .oam = &gOamData_845AFD8,
+ .anims = gDummySpriteAnimTable,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_812B09C
+};
+
+const struct SpriteTemplate gUnknown_845AFF8 = {
+ .tileTag = 1,
+ .paletteTag = 0,
+ .oam = &gOamData_845AFD8,
+ .anims = gDummySpriteAnimTable,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_812B0D4
+};
+
+const struct OamData gOamData_845B010 = {
+ .shape = SPRITE_SHAPE(16x16),
+ .size = SPRITE_SIZE(16x16),
+ .priority = 2
+};
+
+const struct OamData gOamData_845B018 = {
+ .shape = SPRITE_SHAPE(32x16),
+ .size = SPRITE_SIZE(32x16),
+ .priority = 2
+};
+
+const union AnimCmd gAnimCmd_845B020[] = {
+ ANIMCMD_FRAME(0x00, 2),
+ ANIMCMD_END
+};
+
+const union AnimCmd gAnimCmd_845B028[] = {
+ ANIMCMD_FRAME(0x08, 2),
+ ANIMCMD_END
+};
+
+const union AnimCmd gAnimCmd_845B030[] = {
+ ANIMCMD_FRAME(0x10, 2),
+ ANIMCMD_END
+};
+
+const union AnimCmd gAnimCmd_845B038[] = {
+ ANIMCMD_FRAME(0x18, 2),
+ ANIMCMD_END
+};
+
+const union AnimCmd *const gSpriteAnimTable_845B040[] = {
+ gAnimCmd_845B020,
+ gAnimCmd_845B028,
+ gAnimCmd_845B030,
+ gAnimCmd_845B038
+};
+
+const struct SpriteTemplate gUnknown_845B050 = {
+ .tileTag = 3,
+ .paletteTag = 0,
+ .oam = &gOamData_845B010,
+ .anims = gDummySpriteAnimTable,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+const struct SpriteTemplate gUnknown_845B068 = {
+ .tileTag = 4,
+ .paletteTag = 0,
+ .oam = &gOamData_845B018,
+ .anims = gSpriteAnimTable_845B040,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+bool32 sub_812AE70(void)
+{
+ u32 i;
+ for (i = 0; i < 5; i++)
+ LoadCompressedSpriteSheet(&gUnknown_845AF58[i]);
+
+ LoadSpritePalette(&gUnknown_845AF80);
+ gUnknown_203B0E8 = Alloc(0x18);
+ if (!gUnknown_203B0E8)
+ return FALSE;
+
+ return TRUE;
+}
+
+void sub_812AEB0(void)
+{
+ if (gUnknown_203B0E8)
+ Free(gUnknown_203B0E8);
+}
+
+void sub_812AEC8(void)
+{
+ u8 spriteId = CreateSprite(&gUnknown_845AFC0, 10, 24, 0);
+ gUnknown_203B0E8->unk0 = &gSprites[spriteId];
+}
+
+void sub_812AEFC(bool32 invisible)
+{
+ gUnknown_203B0E8->unk0->invisible = invisible;
+}
+
+void sub_812AF1C(void)
+{
+ u8 x, y;
+ u8 page = GetCurrentKeyboardPage();
+ sub_8129700(&x, &y);
+ if (page != UNION_ROOM_KB_PAGE_COUNT)
+ {
+ StartSpriteAnim(gUnknown_203B0E8->unk0, 0);
+ gUnknown_203B0E8->unk0->pos1.x = x * 8 + 10;
+ gUnknown_203B0E8->unk0->pos1.y = y * 12 + 24;
+ }
+ else
+ {
+ StartSpriteAnim(gUnknown_203B0E8->unk0, 2);
+ gUnknown_203B0E8->unk0->pos1.x = 24;
+ gUnknown_203B0E8->unk0->pos1.y = y * 12 + 24;
+ }
+}
+
+void sub_812AF8C(int arg0)
+{
+ const u16 *palette = &gUnknown_845AC14[arg0 * 2 + 1];
+ u8 index = IndexOfSpritePaletteTag(0);
+ LoadPalette(palette, index * 16 + 0x101, 4);
+}
+
+void sub_812AFC0(void)
+{
+ if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT)
+ StartSpriteAnim(gUnknown_203B0E8->unk0, 1);
+ else
+ StartSpriteAnim(gUnknown_203B0E8->unk0, 3);
+
+ gUnknown_203B0E8->unk14 = 0;
+}
+
+bool32 sub_812AFFC(void)
+{
+ if (gUnknown_203B0E8->unk14 > 3)
+ return FALSE;
+
+ if (++gUnknown_203B0E8->unk14 > 3)
+ {
+ if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT)
+ StartSpriteAnim(gUnknown_203B0E8->unk0, 0);
+ else
+ StartSpriteAnim(gUnknown_203B0E8->unk0, 2);
+
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void sub_812B048(void)
+{
+ u8 spriteId = CreateSprite(&gUnknown_845AFE0, 76, 152, 2);
+ gUnknown_203B0E8->unk8 = &gSprites[spriteId];
+ spriteId = CreateSprite(&gUnknown_845AFF8, 64, 152, 1);
+ gUnknown_203B0E8->unk4 = &gSprites[spriteId];
+}
+
+void sub_812B09C(struct Sprite *sprite)
+{
+ int var0 = sub_81297DC();
+ if (var0 == 15)
+ {
+ sprite->invisible = TRUE;
+ }
+ else
+ {
+ sprite->invisible = FALSE;
+ sprite->pos1.x = var0 * 8 + 76;
+ }
+}
+
+void sub_812B0D4(struct Sprite *sprite)
+{
+ if (++sprite->data[0] > 4)
+ {
+ sprite->data[0] = 0;
+ if (++sprite->pos2.x > 4)
+ sprite->pos2.x = 0;
+ }
+}
+
+void sub_812B100(void)
+{
+ u8 spriteId = CreateSprite(&gUnknown_845B050, 8, 152, 3);
+ gUnknown_203B0E8->unkC = &gSprites[spriteId];
+ spriteId = CreateSprite(&gUnknown_845B068, 32, 152, 4);
+ gUnknown_203B0E8->unk10 = &gSprites[spriteId];
+ gUnknown_203B0E8->unk10->invisible = 1;
+}
+
+void sub_812B160(void)
+{
+ if (GetCurrentKeyboardPage() == UNION_ROOM_KB_PAGE_COUNT)
+ {
+ if (sub_8129720() != 0)
+ {
+ gUnknown_203B0E8->unk10->invisible = 0;
+ StartSpriteAnim(gUnknown_203B0E8->unk10, 3);
+ }
+ else
+ {
+ gUnknown_203B0E8->unk10->invisible = 1;
+ }
+ }
+ else
+ {
+ int anim = sub_81297E8();
+ if (anim == 3)
+ {
+ gUnknown_203B0E8->unk10->invisible = 1;
+ }
+ else
+ {
+ gUnknown_203B0E8->unk10->invisible = 0;
+ StartSpriteAnim(gUnknown_203B0E8->unk10, anim);
+ }
+ }
+}