Document union room chat

This commit is contained in:
PikalaxALT
2020-01-25 19:58:39 -05:00
parent 52c0e05abb
commit 0ebdbcfd5b
13 changed files with 1170 additions and 1078 deletions
+4 -4
View File
@@ -16383,7 +16383,7 @@ gLinkMiscMenu_Gfx:: @ 8EA1720
gLinkMiscMenu_Tilemap:: @ 8EA1958 gLinkMiscMenu_Tilemap:: @ 8EA1958
.incbin "graphics/interface/union_room_chat.bin.lz" .incbin "graphics/interface/union_room_chat.bin.lz"
gUnknown_8EA1A50:: @ 8EA1A50 gUnionRoomChatIcons:: @ 8EA1A50
.incbin "graphics/interface/union_room_chat_icons.4bpp.lz" .incbin "graphics/interface/union_room_chat_icons.4bpp.lz"
.align 2 .align 2
@@ -16508,13 +16508,13 @@ gTilesetPalettes_8EA9D88:: @ 8EA9D88
gTilesetTiles_8EA9F88:: @ 8EA9F88 gTilesetTiles_8EA9F88:: @ 8EA9F88
.incbin "data/tilesets/secondary/82D4E6C/tiles.4bpp.lz" .incbin "data/tilesets/secondary/82D4E6C/tiles.4bpp.lz"
gUnknown_8EAA9F0:: @ 8EAA9F0 gUnionRoomChatPanelBgPal_7:: @ 8EAA9F0
.incbin "graphics/interface/union_room_chat_panel.gbapal" .incbin "graphics/interface/union_room_chat_panel.gbapal"
gUnknown_8EAAA10:: @ 8EAAA10 gUnionRoomChatPanelBgTiles:: @ 8EAAA10
.incbin "graphics/interface/union_room_chat_panel.4bpp.lz" .incbin "graphics/interface/union_room_chat_panel.4bpp.lz"
gUnknown_8EAAA6C:: @ 8EAAA6C gUnionRoomChatPanelBgMap:: @ 8EAAA6C
.incbin "graphics/interface/union_room_chat_panel.bin.lz" .incbin "graphics/interface/union_room_chat_panel.bin.lz"
gCreditsMonBackdropPals:: @ 8EAAB18 gCreditsMonBackdropPals:: @ 8EAAB18
+1 -1
View File
@@ -775,7 +775,7 @@ struct SaveBlock1
/*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH + 1]; /*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH + 1];
/*0x3A54*/ struct FameCheckerSaveData fameChecker[NUM_FAMECHECKER_PERSONS]; /*0x3A54*/ struct FameCheckerSaveData fameChecker[NUM_FAMECHECKER_PERSONS];
/*0x3A94*/ u8 filler3A94[0x40]; /*0x3A94*/ u8 filler3A94[0x40];
/*0x3AD4*/ u8 unk3AD4[UNION_ROOM_KB_ROW_COUNT][21]; /*0x3AD4*/ u8 registeredTexts[UNION_ROOM_KB_ROW_COUNT][21];
/*0x3BA8*/ struct TrainerNameRecord trainerNameRecords[20]; /*0x3BA8*/ struct TrainerNameRecord trainerNameRecords[20];
/*0x3C98*/ struct DaycareMon route5DayCareMon; /*0x3C98*/ struct DaycareMon route5DayCareMon;
/*0x3D24*/ u8 filler3D24[0x10]; /*0x3D24*/ u8 filler3D24[0x10];
+4 -4
View File
@@ -4865,14 +4865,14 @@ extern const u32 gBagBgPalette[];
extern const u32 gBagBgPalette_FemaleOverride[]; extern const u32 gBagBgPalette_FemaleOverride[];
// union_room_chat_display // union_room_chat_display
extern const u16 gUnknown_8EAA9F0[]; extern const u16 gUnionRoomChatPanelBgPal_7[];
extern const u32 gUnknown_8EAAA10[]; extern const u32 gUnionRoomChatPanelBgTiles[];
extern const u32 gUnknown_8EAAA6C[]; extern const u32 gUnionRoomChatPanelBgMap[];
extern const u16 gLinkMiscMenu_Pal[]; extern const u16 gLinkMiscMenu_Pal[];
extern const u32 gLinkMiscMenu_Gfx[]; extern const u32 gLinkMiscMenu_Gfx[];
extern const u32 gLinkMiscMenu_Tilemap[]; extern const u32 gLinkMiscMenu_Tilemap[];
// union_room_chat_objects // union_room_chat_objects
extern const u32 gUnknown_8EA1A50[]; extern const u32 gUnionRoomChatIcons[];
#endif //GUARD_GRAPHICS_H #endif //GUARD_GRAPHICS_H
+2 -2
View File
@@ -216,7 +216,7 @@ struct UnkRfuStruct_2
/* 0x99d */ u8 unk_ce5; /* 0x99d */ u8 unk_ce5;
/* 0x99e */ u8 unk_ce6; /* 0x99e */ u8 unk_ce6;
/* 0x99f */ u8 unk_ce7; /* 0x99f */ u8 unk_ce7;
/* 0x9a0 */ u8 unk_ce8; /* 0x9a0 */ bool8 unk_ce8;
/* 0x9a1 */ u8 unk_ce9; /* 0x9a1 */ u8 unk_ce9;
/* 0x9a2 */ u8 unk_cea[RFU_CHILD_MAX]; /* 0x9a2 */ u8 unk_cea[RFU_CHILD_MAX];
/* 0x9a6 */ u8 unk_cee[RFU_CHILD_MAX]; /* 0x9a6 */ u8 unk_cee[RFU_CHILD_MAX];
@@ -325,7 +325,7 @@ void sub_80FC114(const u8 *name, struct GFtgtGname *structPtr, u8 a2);
bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name); bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name);
bool8 sub_80FCC3C(struct GFtgtGname *gname, u8 *uname, u8 idx); bool8 sub_80FCC3C(struct GFtgtGname *gname, u8 *uname, u8 idx);
bool8 sub_80FCCF4(struct GFtgtGname *gname, u8 *uname, u8 idx); bool8 sub_80FCCF4(struct GFtgtGname *gname, u8 *uname, u8 idx);
bool32 sub_80FBA1C(void); bool32 GetRfuUnkCE8(void);
void sub_80FA4A8(void); void sub_80FA4A8(void);
void sub_80FB9D0(void); void sub_80FB9D0(void);
void sub_80FB030(u32 a0); void sub_80FB030(u32 a0);
+14 -14
View File
@@ -11,20 +11,20 @@ enum
extern const u8 *const gUnionRoomKeyboardText[UNION_ROOM_KB_PAGE_COUNT][UNION_ROOM_KB_ROW_COUNT]; extern const u8 *const gUnionRoomKeyboardText[UNION_ROOM_KB_PAGE_COUNT][UNION_ROOM_KB_ROW_COUNT];
void sub_8128420(void); void EnterUnionRoomChat(void);
u8 *sub_81294B0(int arg0); u8 *UnionRoomChat_GetWorkRegisteredText(int arg0);
void sub_8129700(u8 *arg0, u8 *arg1); void UnionRoomChat_GetCursorColAndRow(u8 *colp, u8 *rowp);
u8 *sub_8129714(void); u8 *UnionRoomChat_GetMessageEntryBuffer(void);
int sub_8129720(void); int UnionRoomChat_LenMessageEntryBuffer(void);
void sub_8129730(u32 *a0, u32 *a1); void UnionRoomChat_GetBufferSelectionRegion(u32 *startp, u32 *diffp);
u8 *sub_8129758(void); u8 *UnionRoomChat_GetEndOfMessageEntryBuffer(void);
u16 sub_8129788(void); u16 UnionRoomChat_GetNumCharsInMessageEntryBuffer(void);
u8 *sub_81297C4(void); u8 *UnionRoomChat_GetLastReceivedMessage(void);
u16 sub_81297D0(void); u16 UnionRoomChat_GetReceivedPlayerIndex(void);
int sub_81297DC(void); int UnionRoomChat_GetMessageEntryCursorPosition(void);
int sub_81297E8(void); int UnionRoomChat_GetWhetherShouldShowCaseToggleIcon(void);
u8 *sub_8129814(void); u8 *UnionRoomChat_GetNameOfPlayerWhoDisbandedChat(void);
void copy_strings_to_sav1(void); void UnionRoomChat_InitializeRegisteredTexts(void);
u8 GetCurrentKeyboardPage(void); u8 GetCurrentKeyboardPage(void);
#endif // GUARD_UNION_ROOM_CHAT_H #endif // GUARD_UNION_ROOM_CHAT_H
+29 -7
View File
@@ -1,12 +1,34 @@
#ifndef GUARD_UNION_ROOM_CHAT_DISPLAY_H #ifndef GUARD_UNION_ROOM_CHAT_DISPLAY_H
#define GUARD_UNION_ROOM_CHAT_DISPLAY_H #define GUARD_UNION_ROOM_CHAT_DISPLAY_H
bool8 sub_8129B14(void); #define CHATDISPLAYROUTINE_LOADGFX 0
bool32 sub_8129B78(void); #define CHATDISPLAYROUTINE_MOVEKBCURSOR 1
void sub_8129B88(void); #define CHATDISPLAYROUTINE_CURSORBLINK 2
void sub_8129BFC(void); #define CHATDISPLAYROUTINE_SHOWKBSWAPMENU 3
void sub_8129C34(u16 a0, u8 a1); #define CHATDISPLAYROUTINE_HIDEKBSWAPMENU 4
u8 sub_8129C8C(u8 a0); #define CHATDISPLAYROUTINE_SWITCHPAGES 5
s8 sub_812A568(void); #define CHATDISPLAYROUTINE_SHOWQUITCHATTINGDIALOG 6
#define CHATDISPLAYROUTINE_DESTROYSTDMSGANDYESNO 7
#define CHATDISPLAYROUTINE_PRINTMSG 8
#define CHATDISPLAYROUTINE_PRINTREGISTERWHERE 9
#define CHATDISPLAYROUTINE_CANCELREGISTER 10
#define CHATDISPLAYROUTINE_RETURNTOKB 11
#define CHATDISPLAYROUTINE_SCROLLCHAT 12
#define CHATDISPLAYROUTINE_PRINTINPUTTEXT 13
#define CHATDISPLAYROUTINE_ASKSAVE 14
#define CHATDISPLAYROUTINE_ASKOVERWRITESAVE 15
#define CHATDISPLAYROUTINE_PRINTSAVING 16
#define CHATDISPLAYROUTINE_PRINTSAVEDTHEGAME 17
#define CHATDISPLAYROUTINE_PRINTEXITINGCHAT 18
#define CHATDISPLAYROUTINE_PRINTLEADERLEFT 19
#define CHATDISPLAYROUTINE_SHOWCONFIRMLEADERLEAVEDIALOG 20
bool8 UnionRoomChat_TryAllocGraphicsWork(void);
bool32 UnionRoomChat_RunDisplaySubtask0(void);
void UnionRoomChat_FreeGraphicsWork(void);
void UnionRoomChat_RunDisplaySubtasks(void);
void UnionRoomChat_StartDisplaySubtask(u16 a0, u8 a1);
u8 RunDisplaySubtask(u8 a0);
s8 UnionRoomChat_ProcessInput(void);
#endif //GUARD_UNION_ROOM_CHAT_DISPLAY_H #endif //GUARD_UNION_ROOM_CHAT_DISPLAY_H
+11 -11
View File
@@ -1,16 +1,16 @@
#ifndef GUARD_UNION_ROOM_CHAT_OBJECTS_H #ifndef GUARD_UNION_ROOM_CHAT_OBJECTS_H
#define GUARD_UNION_ROOM_CHAT_OBJECTS_H #define GUARD_UNION_ROOM_CHAT_OBJECTS_H
bool32 sub_812AE70(void); bool32 UnionRoomChat_TryAllocSpriteWork(void);
void sub_812AEB0(void); void UnionRoomChat_FreeSpriteWork(void);
void sub_812AEC8(void); void UnionRoomChat_CreateSelectorCursorObj(void);
void sub_812AEFC(bool32 invisible); void UnionRoomChat_ToggleSelectorCursorObjVisibility(bool32 invisible);
void sub_812AF1C(void); void UnionRoomChat_MoveSelectorCursorObj(void);
void sub_812AF8C(u32 idx); void UnionRoomChat_UpdateObjPalCycle(u32 idx);
void sub_812AFC0(void); void UnionRoomChat_SetSelectorCursorClosedImage(void);
bool32 sub_812AFFC(void); bool32 UnionRoomChat_AnimateSelectorCursorReopen(void);
void sub_812B048(void); void UnionRoomChat_SpawnTextEntryPointerSprites(void);
void sub_812B100(void); void CreatePageSwitchUISprites(void);
void sub_812B160(void); void UpdateVisibleUnionRoomChatIcon(void);
#endif //GUARD_UNION_ROOM_CHAT_OBJECTS_H #endif //GUARD_UNION_ROOM_CHAT_OBJECTS_H
+15 -14
View File
@@ -448,7 +448,7 @@ static void sub_80F8B34(u8 taskId)
gTasks[taskId].data[1] = 8; gTasks[taskId].data[1] = 8;
Rfu.unk_0c = 1; Rfu.unk_0c = 1;
CreateTask(sub_80FA834, 5); CreateTask(sub_80FA834, 5);
Rfu.unk_ce8 = 1; Rfu.unk_ce8 = TRUE;
DestroyTask(taskId); DestroyTask(taskId);
break; break;
} }
@@ -1337,7 +1337,7 @@ static void sub_80FA1C4(void)
static void sub_80FA224(void) static void sub_80FA224(void)
{ {
if (gSendCmd[0] == 0 && Rfu.unk_ce8 == 0) if (gSendCmd[0] == 0 && !Rfu.unk_ce8)
{ {
sub_80F9D04(0x5f00); sub_80F9D04(0x5f00);
Rfu.RfuFunc = sub_80FA1C4; Rfu.RfuFunc = sub_80FA1C4;
@@ -1620,7 +1620,7 @@ static void sub_80FA834(u8 taskId)
if (Rfu.unk_f1 == 1 || Rfu.unk_f1 == 2) if (Rfu.unk_f1 == 1 || Rfu.unk_f1 == 2)
{ {
Rfu.unk_ce8 = 0; Rfu.unk_ce8 = FALSE;
DestroyTask(taskId); DestroyTask(taskId);
} }
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].data[0])
@@ -1681,7 +1681,7 @@ static void sub_80FA834(u8 taskId)
case 6: case 6:
DestroyTask(taskId); DestroyTask(taskId);
gReceivedRemoteLinkPlayers = 1; gReceivedRemoteLinkPlayers = 1;
Rfu.unk_ce8 = 0; Rfu.unk_ce8 = FALSE;
sub_80FEA34(1, 0x258); sub_80FEA34(1, 0x258);
if (Rfu.unk_ce6) if (Rfu.unk_ce6)
{ {
@@ -1740,7 +1740,7 @@ static void sub_80FAA94(u8 taskId)
u8 r4 = Rfu.unk_cde[gUnknown_843EC38[Rfu.unk_ce9]]; u8 r4 = Rfu.unk_cde[gUnknown_843EC38[Rfu.unk_ce9]];
if (Rfu.unk_f1 == 1 || Rfu.unk_f1 == 2) if (Rfu.unk_f1 == 1 || Rfu.unk_f1 == 2)
{ {
Rfu.unk_ce8 = 0; Rfu.unk_ce8 = FALSE;
DestroyTask(taskId); DestroyTask(taskId);
} }
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].data[0])
@@ -1790,7 +1790,7 @@ static void sub_80FAA94(u8 taskId)
{ {
CpuFill16(0, gBlockRecvBuffer, sizeof(struct UnkRfuStruct_8010A14)); CpuFill16(0, gBlockRecvBuffer, sizeof(struct UnkRfuStruct_8010A14));
ResetBlockReceivedFlag(0); ResetBlockReceivedFlag(0);
Rfu.unk_ce8 = 0; Rfu.unk_ce8 = FALSE;
if (Rfu.unk_ce6) if (Rfu.unk_ce6)
{ {
for (i = 0; i < RFU_CHILD_MAX; i++) for (i = 0; i < RFU_CHILD_MAX; i++)
@@ -1799,7 +1799,7 @@ static void sub_80FAA94(u8 taskId)
{ {
Rfu.unk_ce5 = 1 << i; Rfu.unk_ce5 = 1 << i;
Rfu.unk_ce6 ^= (1 << i); Rfu.unk_ce6 ^= (1 << i);
Rfu.unk_ce8 = 1; Rfu.unk_ce8 = TRUE;
break; break;
} }
} }
@@ -1948,7 +1948,7 @@ void sub_80FB008(u8 a0, u32 a1, u32 a2)
rfu_REQ_configGameData(0, 2, (void *)&gHostRFUtgtGnameBuffer, gHostRFUtgtUnameBuffer); rfu_REQ_configGameData(0, 2, (void *)&gHostRFUtgtGnameBuffer, gHostRFUtgtUnameBuffer);
} }
void sub_80FB030(u32 a0) void sub_80FB030(u32 linkPlayerCount)
{ {
s32 i; s32 i;
u32 r5; u32 r5;
@@ -1964,9 +1964,10 @@ void sub_80FB030(u32 a0)
{ {
if ((r8 >> i) & 1) if ((r8 >> i) & 1)
{ {
r7 |= ((0x80 | ((gLinkPlayers[Rfu.unk_cde[i]].gender & 1) << 3) | (gLinkPlayers[Rfu.unk_cde[i]].trainerId & 7)) << (r5 << 3)); r7 |= ((
0x80 | ((gLinkPlayers[Rfu.unk_cde[i]].gender & 1) << 3) | (gLinkPlayers[Rfu.unk_cde[i]].trainerId & 7)) << (r5 << 3));
r5++; r5++;
if (r5 == a0 - 1) if (r5 == linkPlayerCount - 1)
break; break;
} }
} }
@@ -2214,11 +2215,11 @@ static void sub_80FB5EC(u8 a0, u8 unused1)
if (idx != 0) if (idx != 0)
{ {
r1 = 1 << sub_80F886C(idx); r1 = 1 << sub_80F886C(idx);
if (Rfu.unk_ce6 == 0 && Rfu.unk_ce8 == 0) if (Rfu.unk_ce6 == 0 && !Rfu.unk_ce8)
{ {
Rfu.unk_ce5 = r1; Rfu.unk_ce5 = r1;
Rfu.unk_ce6 |= (r1 ^ idx); Rfu.unk_ce6 |= (r1 ^ idx);
Rfu.unk_ce8 = 1; Rfu.unk_ce8 = TRUE;
} }
else else
{ {
@@ -2360,7 +2361,7 @@ bool32 sub_80FBA00(void)
return FALSE; return FALSE;
} }
bool32 sub_80FBA1C(void) bool32 GetRfuUnkCE8(void)
{ {
return Rfu.unk_ce8; return Rfu.unk_ce8;
} }
@@ -2534,7 +2535,7 @@ void sub_80FBD6C(u32 a0)
static void sub_80FBDB8(u8 taskId) static void sub_80FBDB8(u8 taskId)
{ {
if (gSendCmd[0] == 0 && Rfu.unk_ce8 == 0) if (gSendCmd[0] == 0 && !Rfu.unk_ce8)
{ {
sub_80F9D04(0xED00); sub_80F9D04(0xED00);
gSendCmd[1] = gTasks[taskId].data[0]; gSendCmd[1] = gTasks[taskId].data[0];
+1 -1
View File
@@ -143,7 +143,7 @@ void NewGameInitData(void)
sub_809C794(); sub_809C794();
InitEasyChatPhrases(); InitEasyChatPhrases();
ResetTrainerFanClub(); ResetTrainerFanClub();
copy_strings_to_sav1(); UnionRoomChat_InitializeRegisteredTexts();
ResetMiniGamesResults(); ResetMiniGamesResults();
sub_8143D24(); sub_8143D24();
SetAllRenewableItemFlags(); SetAllRenewableItemFlags();
+1 -1
View File
@@ -1852,7 +1852,7 @@ static void sub_81175BC(u8 taskId)
sub_80F8D14(); sub_80F8D14();
SetHostRFUtgtGname(69, 0, 1); SetHostRFUtgtGname(69, 0, 1);
} }
sub_8128420(); EnterUnionRoomChat();
break; break;
case 8: case 8:
case 72: case 72:
+589 -543
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+115 -113
View File
@@ -6,238 +6,238 @@
struct UnionRoomChat3 struct UnionRoomChat3
{ {
struct Sprite *unk0; struct Sprite *selectorCursorSprite;
struct Sprite *unk4; struct Sprite *characterSelectCursorSprite;
struct Sprite *unk8; struct Sprite *textEntryCursorSprite;
struct Sprite *unkC; struct Sprite *rButtonSprite;
struct Sprite *unk10; struct Sprite *chatIconsSprite;
u16 unk14; u16 cursorBlinkTimer;
}; };
static EWRAM_DATA struct UnionRoomChat3 *gUnknown_203B0E8 = NULL; static EWRAM_DATA struct UnionRoomChat3 *sWork = NULL;
static void sub_812B09C(struct Sprite * sprite); static void SpriteCB_TextEntryCursor(struct Sprite * sprite);
static void sub_812B0D4(struct Sprite * sprite); static void SpriteCB_CharacterSelectCursor(struct Sprite * sprite);
static const u16 gUnknown_845AC14[] = INCBIN_U16("graphics/union_room_chat/unk_845AC14.gbapal"); static const u16 sUnionRoomChatInterfacePal[] = INCBIN_U16("graphics/union_room_chat/unk_845AC14.gbapal");
static const u32 gUnknown_845AC34[] = INCBIN_U32("graphics/union_room_chat/unk_845AC34.4bpp.lz"); static const u32 sSelectorCursorGfxTiles[] = INCBIN_U32("graphics/union_room_chat/unk_845AC34.4bpp.lz");
static const u32 gUnknown_845AEB8[] = INCBIN_U32("graphics/union_room_chat/unk_845AEB8.4bpp.lz"); static const u32 sHorizontalBarGfxTiles[] = INCBIN_U32("graphics/union_room_chat/unk_845AEB8.4bpp.lz");
static const u32 gUnknown_845AED8[] = INCBIN_U32("graphics/union_room_chat/unk_845AED8.4bpp.lz"); static const u32 sMenuCursorGfxTiles[] = INCBIN_U32("graphics/union_room_chat/unk_845AED8.4bpp.lz");
static const u32 gUnknown_845AF04[] = INCBIN_U32("graphics/union_room_chat/unk_845AF04.4bpp.lz"); static const u32 sRButtonGfxTiles[] = INCBIN_U32("graphics/union_room_chat/unk_845AF04.4bpp.lz");
static const struct CompressedSpriteSheet gUnknown_845AF58[] = { static const struct CompressedSpriteSheet sSpriteSheets[] = {
{gUnknown_845AC34, 0x1000, 0}, {sSelectorCursorGfxTiles, 0x1000, 0},
{gUnknown_845AED8, 0x0040, 1}, {sMenuCursorGfxTiles, 0x0040, 1},
{gUnknown_845AEB8, 0x0040, 2}, {sHorizontalBarGfxTiles, 0x0040, 2},
{gUnknown_845AF04, 0x0080, 3}, {sRButtonGfxTiles, 0x0080, 3},
{gUnknown_8EA1A50, 0x0400, 4} {gUnionRoomChatIcons, 0x0400, 4}
}; };
static const struct SpritePalette gUnknown_845AF80 = { static const struct SpritePalette sSpritePalette = {
gUnknown_845AC14, 0 sUnionRoomChatInterfacePal, 0
}; };
static const struct OamData gOamData_845AF88 = { static const struct OamData sOamData_64x32_1 = {
.shape = SPRITE_SHAPE(64x32), .shape = SPRITE_SHAPE(64x32),
.size = SPRITE_SIZE(64x32), .size = SPRITE_SIZE(64x32),
.priority = 1 .priority = 1
}; };
static const union AnimCmd gAnimCmd_845AF90[] = { static const union AnimCmd sAnim_CursorSmallOpen[] = {
ANIMCMD_FRAME(0x00, 30), ANIMCMD_FRAME(0x00, 30),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gAnimCmd_845AF98[] = { static const union AnimCmd sAnim_CursorSmallClosed[] = {
ANIMCMD_FRAME(0x20, 30), ANIMCMD_FRAME(0x20, 30),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gAnimCmd_845AFA0[] = { static const union AnimCmd sAnim_CursorLargeOpen[] = {
ANIMCMD_FRAME(0x40, 30), ANIMCMD_FRAME(0x40, 30),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gAnimCmd_845AFA8[] = { static const union AnimCmd sAnim_CursorLargeClosed[] = {
ANIMCMD_FRAME(0x60, 30), ANIMCMD_FRAME(0x60, 30),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd *const gSpriteAnimTable_845AFB0[] = { static const union AnimCmd *const sSpriteAnims_SelectorCursor[] = {
gAnimCmd_845AF90, sAnim_CursorSmallOpen,
gAnimCmd_845AF98, sAnim_CursorSmallClosed,
gAnimCmd_845AFA0, sAnim_CursorLargeOpen,
gAnimCmd_845AFA8 sAnim_CursorLargeClosed
}; };
static const struct SpriteTemplate gUnknown_845AFC0 = { static const struct SpriteTemplate sSpriteTemplate_SelectorCursor = {
.tileTag = 0, .tileTag = 0,
.paletteTag = 0, .paletteTag = 0,
.oam = &gOamData_845AF88, .oam = &sOamData_64x32_1,
.anims = gSpriteAnimTable_845AFB0, .anims = sSpriteAnims_SelectorCursor,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
static const struct OamData gOamData_845AFD8 = { static const struct OamData sOamData_8x16_2 = {
.shape = SPRITE_SHAPE(8x16), .shape = SPRITE_SHAPE(8x16),
.size = SPRITE_SIZE(8x16), .size = SPRITE_SIZE(8x16),
.priority = 2 .priority = 2
}; };
static const struct SpriteTemplate gUnknown_845AFE0 = { static const struct SpriteTemplate sSpriteTemplate_TextEntryCursor = {
.tileTag = 2, .tileTag = 2,
.paletteTag = 0, .paletteTag = 0,
.oam = &gOamData_845AFD8, .oam = &sOamData_8x16_2,
.anims = gDummySpriteAnimTable, .anims = gDummySpriteAnimTable,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_812B09C .callback = SpriteCB_TextEntryCursor
}; };
static const struct SpriteTemplate gUnknown_845AFF8 = { static const struct SpriteTemplate sSpriteTemplate_CharacterSelectCursor = {
.tileTag = 1, .tileTag = 1,
.paletteTag = 0, .paletteTag = 0,
.oam = &gOamData_845AFD8, .oam = &sOamData_8x16_2,
.anims = gDummySpriteAnimTable, .anims = gDummySpriteAnimTable,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_812B0D4 .callback = SpriteCB_CharacterSelectCursor
}; };
static const struct OamData gOamData_845B010 = { static const struct OamData sOamData_16x16_2 = {
.shape = SPRITE_SHAPE(16x16), .shape = SPRITE_SHAPE(16x16),
.size = SPRITE_SIZE(16x16), .size = SPRITE_SIZE(16x16),
.priority = 2 .priority = 2
}; };
static const struct OamData gOamData_845B018 = { static const struct OamData sOamData_32x16_2 = {
.shape = SPRITE_SHAPE(32x16), .shape = SPRITE_SHAPE(32x16),
.size = SPRITE_SIZE(32x16), .size = SPRITE_SIZE(32x16),
.priority = 2 .priority = 2
}; };
static const union AnimCmd gAnimCmd_845B020[] = { static const union AnimCmd sAnim_UnionRoomChatIcons_ToggleCase[] = {
ANIMCMD_FRAME(0x00, 2), ANIMCMD_FRAME(0x00, 2),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gAnimCmd_845B028[] = { static const union AnimCmd sAnim_UnionRoomChatIcons_Dummy1[] = {
ANIMCMD_FRAME(0x08, 2), ANIMCMD_FRAME(0x08, 2),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gAnimCmd_845B030[] = { static const union AnimCmd sAnim_UnionRoomChatIcons_Dummy2[] = {
ANIMCMD_FRAME(0x10, 2), ANIMCMD_FRAME(0x10, 2),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gAnimCmd_845B038[] = { static const union AnimCmd sAnim_UnionRoomChatIcons_Register[] = {
ANIMCMD_FRAME(0x18, 2), ANIMCMD_FRAME(0x18, 2),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd *const gSpriteAnimTable_845B040[] = { static const union AnimCmd *const sSpriteAnimTable_UnionRoomChatIcons[] = {
gAnimCmd_845B020, sAnim_UnionRoomChatIcons_ToggleCase,
gAnimCmd_845B028, sAnim_UnionRoomChatIcons_Dummy1,
gAnimCmd_845B030, sAnim_UnionRoomChatIcons_Dummy2,
gAnimCmd_845B038 sAnim_UnionRoomChatIcons_Register
}; };
static const struct SpriteTemplate gUnknown_845B050 = { static const struct SpriteTemplate sSpriteTemplate_RButton = {
.tileTag = 3, .tileTag = 3,
.paletteTag = 0, .paletteTag = 0,
.oam = &gOamData_845B010, .oam = &sOamData_16x16_2,
.anims = gDummySpriteAnimTable, .anims = gDummySpriteAnimTable,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
static const struct SpriteTemplate gUnknown_845B068 = { static const struct SpriteTemplate sSpriteTemplate_UnionRoomChatIcons = {
.tileTag = 4, .tileTag = 4,
.paletteTag = 0, .paletteTag = 0,
.oam = &gOamData_845B018, .oam = &sOamData_32x16_2,
.anims = gSpriteAnimTable_845B040, .anims = sSpriteAnimTable_UnionRoomChatIcons,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
bool32 sub_812AE70(void) bool32 UnionRoomChat_TryAllocSpriteWork(void)
{ {
u32 i; u32 i;
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
LoadCompressedSpriteSheet(&gUnknown_845AF58[i]); LoadCompressedSpriteSheet(&sSpriteSheets[i]);
LoadSpritePalette(&gUnknown_845AF80); LoadSpritePalette(&sSpritePalette);
gUnknown_203B0E8 = Alloc(0x18); sWork = Alloc(0x18);
if (!gUnknown_203B0E8) if (!sWork)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
void sub_812AEB0(void) void UnionRoomChat_FreeSpriteWork(void)
{ {
if (gUnknown_203B0E8) if (sWork)
Free(gUnknown_203B0E8); Free(sWork);
} }
void sub_812AEC8(void) void UnionRoomChat_CreateSelectorCursorObj(void)
{ {
u8 spriteId = CreateSprite(&gUnknown_845AFC0, 10, 24, 0); u8 spriteId = CreateSprite(&sSpriteTemplate_SelectorCursor, 10, 24, 0);
gUnknown_203B0E8->unk0 = &gSprites[spriteId]; sWork->selectorCursorSprite = &gSprites[spriteId];
} }
void sub_812AEFC(bool32 invisible) void UnionRoomChat_ToggleSelectorCursorObjVisibility(bool32 invisible)
{ {
gUnknown_203B0E8->unk0->invisible = invisible; sWork->selectorCursorSprite->invisible = invisible;
} }
void sub_812AF1C(void) void UnionRoomChat_MoveSelectorCursorObj(void)
{ {
u8 x, y; u8 x, y;
u8 page = GetCurrentKeyboardPage(); u8 page = GetCurrentKeyboardPage();
sub_8129700(&x, &y); UnionRoomChat_GetCursorColAndRow(&x, &y);
if (page != UNION_ROOM_KB_PAGE_COUNT) if (page != UNION_ROOM_KB_PAGE_COUNT)
{ {
StartSpriteAnim(gUnknown_203B0E8->unk0, 0); StartSpriteAnim(sWork->selectorCursorSprite, 0);
gUnknown_203B0E8->unk0->pos1.x = x * 8 + 10; sWork->selectorCursorSprite->pos1.x = x * 8 + 10;
gUnknown_203B0E8->unk0->pos1.y = y * 12 + 24; sWork->selectorCursorSprite->pos1.y = y * 12 + 24;
} }
else else
{ {
StartSpriteAnim(gUnknown_203B0E8->unk0, 2); StartSpriteAnim(sWork->selectorCursorSprite, 2);
gUnknown_203B0E8->unk0->pos1.x = 24; sWork->selectorCursorSprite->pos1.x = 24;
gUnknown_203B0E8->unk0->pos1.y = y * 12 + 24; sWork->selectorCursorSprite->pos1.y = y * 12 + 24;
} }
} }
void sub_812AF8C(int arg0) void UnionRoomChat_UpdateObjPalCycle(int arg0)
{ {
const u16 *palette = &gUnknown_845AC14[arg0 * 2 + 1]; const u16 *palette = &sUnionRoomChatInterfacePal[arg0 * 2 + 1];
u8 index = IndexOfSpritePaletteTag(0); u8 index = IndexOfSpritePaletteTag(0);
LoadPalette(palette, index * 16 + 0x101, 4); LoadPalette(palette, index * 16 + 0x101, 4);
} }
void sub_812AFC0(void) void UnionRoomChat_SetSelectorCursorClosedImage(void)
{ {
if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT) if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT)
StartSpriteAnim(gUnknown_203B0E8->unk0, 1); StartSpriteAnim(sWork->selectorCursorSprite, 1);
else else
StartSpriteAnim(gUnknown_203B0E8->unk0, 3); StartSpriteAnim(sWork->selectorCursorSprite, 3);
gUnknown_203B0E8->unk14 = 0; sWork->cursorBlinkTimer = 0;
} }
bool32 sub_812AFFC(void) bool32 UnionRoomChat_AnimateSelectorCursorReopen(void)
{ {
if (gUnknown_203B0E8->unk14 > 3) if (sWork->cursorBlinkTimer > 3)
return FALSE; return FALSE;
if (++gUnknown_203B0E8->unk14 > 3) if (++sWork->cursorBlinkTimer > 3)
{ {
if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT) if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT)
StartSpriteAnim(gUnknown_203B0E8->unk0, 0); StartSpriteAnim(sWork->selectorCursorSprite, 0);
else else
StartSpriteAnim(gUnknown_203B0E8->unk0, 2); StartSpriteAnim(sWork->selectorCursorSprite, 2);
return FALSE; return FALSE;
} }
@@ -245,17 +245,17 @@ bool32 sub_812AFFC(void)
return TRUE; return TRUE;
} }
void sub_812B048(void) void UnionRoomChat_SpawnTextEntryPointerSprites(void)
{ {
u8 spriteId = CreateSprite(&gUnknown_845AFE0, 76, 152, 2); u8 spriteId = CreateSprite(&sSpriteTemplate_TextEntryCursor, 76, 152, 2);
gUnknown_203B0E8->unk8 = &gSprites[spriteId]; sWork->textEntryCursorSprite = &gSprites[spriteId];
spriteId = CreateSprite(&gUnknown_845AFF8, 64, 152, 1); spriteId = CreateSprite(&sSpriteTemplate_CharacterSelectCursor, 64, 152, 1);
gUnknown_203B0E8->unk4 = &gSprites[spriteId]; sWork->characterSelectCursorSprite = &gSprites[spriteId];
} }
static void sub_812B09C(struct Sprite *sprite) static void SpriteCB_TextEntryCursor(struct Sprite *sprite)
{ {
int var0 = sub_81297DC(); int var0 = UnionRoomChat_GetMessageEntryCursorPosition();
if (var0 == 15) if (var0 == 15)
{ {
sprite->invisible = TRUE; sprite->invisible = TRUE;
@@ -267,7 +267,7 @@ static void sub_812B09C(struct Sprite *sprite)
} }
} }
static void sub_812B0D4(struct Sprite *sprite) static void SpriteCB_CharacterSelectCursor(struct Sprite *sprite)
{ {
if (++sprite->data[0] > 4) if (++sprite->data[0] > 4)
{ {
@@ -277,40 +277,42 @@ static void sub_812B0D4(struct Sprite *sprite)
} }
} }
void sub_812B100(void) void CreatePageSwitchUISprites(void)
{ {
u8 spriteId = CreateSprite(&gUnknown_845B050, 8, 152, 3); u8 spriteId = CreateSprite(&sSpriteTemplate_RButton, 8, 152, 3);
gUnknown_203B0E8->unkC = &gSprites[spriteId]; sWork->rButtonSprite = &gSprites[spriteId];
spriteId = CreateSprite(&gUnknown_845B068, 32, 152, 4); spriteId = CreateSprite(&sSpriteTemplate_UnionRoomChatIcons, 32, 152, 4);
gUnknown_203B0E8->unk10 = &gSprites[spriteId]; sWork->chatIconsSprite = &gSprites[spriteId];
gUnknown_203B0E8->unk10->invisible = 1; sWork->chatIconsSprite->invisible = TRUE;
} }
void sub_812B160(void) void UpdateVisibleUnionRoomChatIcon(void)
{ {
if (GetCurrentKeyboardPage() == UNION_ROOM_KB_PAGE_COUNT) if (GetCurrentKeyboardPage() == UNION_ROOM_KB_PAGE_COUNT)
{ {
if (sub_8129720() != 0) if (UnionRoomChat_LenMessageEntryBuffer() != 0)
{ {
gUnknown_203B0E8->unk10->invisible = 0; // REGISTER
StartSpriteAnim(gUnknown_203B0E8->unk10, 3); sWork->chatIconsSprite->invisible = FALSE;
StartSpriteAnim(sWork->chatIconsSprite, 3);
} }
else else
{ {
gUnknown_203B0E8->unk10->invisible = 1; sWork->chatIconsSprite->invisible = TRUE;
} }
} }
else else
{ {
int anim = sub_81297E8(); int anim = UnionRoomChat_GetWhetherShouldShowCaseToggleIcon();
if (anim == 3) if (anim == 3)
{ {
gUnknown_203B0E8->unk10->invisible = 1; sWork->chatIconsSprite->invisible = TRUE;
} }
else else
{ {
gUnknown_203B0E8->unk10->invisible = 0; // A <--> a
StartSpriteAnim(gUnknown_203B0E8->unk10, anim); sWork->chatIconsSprite->invisible = FALSE;
StartSpriteAnim(sWork->chatIconsSprite, anim);
} }
} }
} }