summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/union_room_battle.c392
-rw-r--r--src/wireless_communication_status_screen.c412
2 files changed, 412 insertions, 392 deletions
diff --git a/src/union_room_battle.c b/src/union_room_battle.c
index e73f9bd24..dcc13b1cb 100644
--- a/src/union_room_battle.c
+++ b/src/union_room_battle.c
@@ -25,119 +25,13 @@
#include "union_room.h"
#include "union_room_battle.h"
-struct UnkStruct_3000DAC
-{
- /*0x00*/ u32 unk00[4];
- /*0x10*/ u32 unk10[4];
- /*0x20*/ u32 unk20[16];
- /*0x60*/ u8 taskId;
- /*0x61*/ u8 unk61;
- /*0x62*/ u8 filler_62[10];
-};
-
struct UnionRoomBattleWork
{
s16 textState;
};
-static struct UnkStruct_3000DAC * gUnknown_03000DAC;
-
EWRAM_DATA struct UnionRoomBattleWork * sWork = NULL;
-void sub_801A43C(void);
-void sub_801A6C0(u8 taskId);
-static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode);
-bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId);
-
-const u16 gWirelessInfoScreenPal[] = INCBIN_U16("graphics/interface/wireless_info_screen.gbapal");
-const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz");
-const u32 gWirelessInfoScreenTilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz");
-
-static const struct BgTemplate sBgTemplates[] = {
- {
- .bg = 0,
- .charBaseIndex = 2,
- .mapBaseIndex = 0x1F,
- .priority = 0
- }, {
- .bg = 1,
- .charBaseIndex = 0,
- .mapBaseIndex = 0x08,
- .priority = 1
- }
-};
-
-const struct WindowTemplate sWindowTemplates[] = {
- {
- .bg = 0x00,
- .tilemapLeft = 0x03,
- .tilemapTop = 0x00,
- .width = 0x18,
- .height = 0x03,
- .paletteNum = 0x0f,
- .baseBlock = 0x0001
- }, {
- .bg = 0x00,
- .tilemapLeft = 0x03,
- .tilemapTop = 0x04,
- .width = 0x15,
- .height = 0x0f,
- .paletteNum = 0x0f,
- .baseBlock = 0x0049
- }, {
- .bg = 0x00,
- .tilemapLeft = 0x18,
- .tilemapTop = 0x04,
- .width = 0x03,
- .height = 0x0f,
- .paletteNum = 0x0f,
- .baseBlock = 0x0184
- },
- { 0xFF }
-};
-
-const u8 *const gUnknown_082F0D5C[] = {
- gText_WirelessCommStatus,
- gText_PeopleTrading,
- gText_PeopleBattling,
- gText_PeopleInUnionRoom,
- gText_PeopleCommunicating
-};
-
-const u8 gUnknown_082F0D70[][3] = {
- {0x01, 0x01, 0x02},
- {0x02, 0x01, 0x02},
- {0x03, 0x01, 0x04},
- {0x04, 0x00, 0x02},
- {0x06, 0x03, 0x02},
- {0x07, 0x03, 0x02},
- {0x09, 0x03, 0x00},
- {0x0a, 0x03, 0x00},
- {0x0b, 0x03, 0x00},
- {0x0c, 0xff, 0x00},
- {0x0d, 0x00, 0x00},
- {0x10, 0x03, 0x00},
- {0x0f, 0x03, 0x00},
- {0x40, 0x02, 0x01},
- {0x41, 0x02, 0x02},
- {0x44, 0x02, 0x02},
- {0x45, 0x02, 0x00},
- {0x48, 0x02, 0x02},
- {0x54, 0x02, 0x01},
- {0x53, 0x02, 0x02},
- {0x51, 0x02, 0x01},
- {0x52, 0x02, 0x01},
- {0x15, 0x03, 0x02},
- {0x16, 0x03, 0x02},
- {0x17, 0x03, 0x00},
- {0x18, 0x03, 0x00},
- {0x19, 0x03, 0x00},
- {0x1a, 0x03, 0x00},
- {0x1b, 0x03, 0x00},
- {0x1c, 0x01, 0x02},
- {0x0e, 0x01, 0x02}
-};
-
const struct BgTemplate gUnknown_082F0DD0[] = {
{
.bg = 0,
@@ -161,292 +55,6 @@ const struct WindowTemplate gUnknown_082F0DD4[] = {
const u8 gUnknown_082F0DE4[] = { 1, 2, 3 };
-void sub_801A3F4(void)
-{
- if (!IsDma3ManagerBusyWithBgCopy())
- {
- RunTasks();
- RunTextPrinters();
- AnimateSprites();
- BuildOamBuffer();
- UpdatePaletteFade();
- }
-}
-
-void sub_801A418(void)
-{
- LoadOam();
- ProcessSpriteCopyRequests();
- TransferPlttBuffer();
-}
-
-void sub_801A42C(void)
-{
- SetMainCallback2(sub_801A43C);
-}
-
-void sub_801A43C(void)
-{
- SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
- gUnknown_03000DAC = AllocZeroed(sizeof(struct UnkStruct_3000DAC));
- SetVBlankCallback(NULL);
- ResetBgsAndClearDma3BusyFlags(0);
- InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
- SetBgTilemapBuffer(1, Alloc(0x800));
- SetBgTilemapBuffer(0, Alloc(0x800));
- DecompressAndLoadBgGfxUsingHeap(1, gWirelessInfoScreenGfx, 0, 0, 0);
- CopyToBgTilemapBuffer(1, gWirelessInfoScreenTilemap, 0, 0);
- InitWindows(sWindowTemplates);
- DeactivateAllTextPrinters();
- ResetPaletteFade();
- ResetSpriteData();
- ResetTasks();
- ScanlineEffect_Stop();
- m4aSoundVSyncOn();
- SetVBlankCallback(sub_801A418);
- gUnknown_03000DAC->taskId = CreateTask(sub_801A6C0, 0);
- gUnknown_03000DAC->unk61 = CreateTask_ListenToWireless();
- gUnknown_03000DAC->unk10[3] = 1;
- ChangeBgX(0, 0, 0);
- ChangeBgY(0, 0, 0);
- ChangeBgX(1, 0, 0);
- ChangeBgY(1, 0, 0);
- LoadPalette(gWirelessInfoScreenPal, 0x00, 0x20);
- Menu_LoadStdPalAt(0xF0);
- DynamicPlaceholderTextUtil_Reset();
- FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x0F);
- CopyBgTilemapBufferToVram(1);
- SetMainCallback2(sub_801A3F4);
- RunTasks();
- RunTextPrinters();
- AnimateSprites();
- BuildOamBuffer();
- UpdatePaletteFade();
-}
-
-void sub_801A584(void)
-{
- s32 i;
- FreeAllWindowBuffers();
- for (i = 0; i < 2; i++)
- {
- Free(GetBgTilemapBuffer(i));
- }
- Free(gUnknown_03000DAC);
- SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
-}
-
-void sub_801A5BC(s16 * a0, s16 * a1)
-{
- if (++(*a0) > 5)
- {
- if (++(*a1) == 14)
- {
- *a1 = 0;
- }
- *a0 = 0;
- }
- LoadPalette(gWirelessInfoScreenPal + 16 * (*a1 + 2), 0, 0x10);
-}
-
-void sub_801A600(void)
-{
- s32 i;
- FillWindowPixelBuffer(0, 0);
- FillWindowPixelBuffer(1, 0);
- FillWindowPixelBuffer(2, 0);
- sub_801A8B0(0, 1, gUnknown_082F0D5C[0], GetStringCenterAlignXOffset(1, gUnknown_082F0D5C[0], 0xC0), 6, 3);
- for (i = 0; i < 3; i++)
- {
- sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 1);
- }
- sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 2);
- PutWindowTilemap(0);
- CopyWindowToVram(0, 2);
- PutWindowTilemap(1);
- CopyWindowToVram(1, 2);
-}
-
-void sub_801A6C0(u8 taskId)
-{
- s32 i;
- switch (gTasks[taskId].data[0])
- {
- case 0:
- sub_801A600();
- gTasks[taskId].data[0]++;
- break;
- case 1:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
- ShowBg(1);
- CopyBgTilemapBufferToVram(0);
- ShowBg(0);
- gTasks[taskId].data[0]++;
- break;
- case 2:
- if (!gPaletteFade.active)
- {
- gTasks[taskId].data[0]++;
- }
- break;
- case 3:
- if (sub_801AA30(gUnknown_03000DAC->unk00, gUnknown_03000DAC->unk10, gUnknown_03000DAC->unk20, gUnknown_03000DAC->unk61))
- {
- FillWindowPixelBuffer(2, 0);
- for (i = 0; i < 4; i++)
- {
- ConvertIntToDecimalStringN(gStringVar4, gUnknown_03000DAC->unk00[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
- if (i != 3)
- {
- sub_801A8B0(2, 1, gStringVar4, 12, 30 * i + 8, 1);
- }
- else
- {
- sub_801A8B0(2, 1, gStringVar4, 12, 98, 2);
- }
- }
- PutWindowTilemap(2);
- CopyWindowToVram(2, 3);
- }
- if (({gMain.newKeys & A_BUTTON;}) || ({gMain.newKeys & B_BUTTON;}))
- {
- PlaySE(SE_SELECT);
- gTasks[gUnknown_03000DAC->unk61].data[15] = 0xFF;
- gTasks[taskId].data[0]++;
- }
- sub_801A5BC(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
- break;
- case 4:
- BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
- gTasks[taskId].data[0]++;
- break;
- case 5:
- if (!gPaletteFade.active)
- {
- SetMainCallback2(sub_801A584);
- DestroyTask(taskId);
- }
- break;
- }
-}
-
-static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode)
-{
- u8 color[3];
-
- switch (mode)
- {
- case 0:
- color[0] = 0;
- color[1] = 2;
- color[2] = 3;
- break;
- case 1:
- color[0] = 0;
- color[1] = 1;
- color[2] = 3;
- break;
- case 2:
- color[0] = 0;
- color[1] = 4;
- color[2] = 5;
- break;
- case 3:
- color[0] = 0;
- color[1] = 7;
- color[2] = 6;
- break;
- case 4:
- color[0] = 0;
- color[1] = 1;
- color[2] = 2;
- break;
- }
-
- AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, -1, str);
-}
-
-u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
-{
- s32 i, j, r2;
- u32 result = a0->gname_uname.gname.activity;
-
- for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++)
- {
- if (result != gUnknown_082F0D70[i][0])
- {
- continue;
- }
- if (a0->groupScheduledAnim != 1)
- {
- continue;
- }
- if (gUnknown_082F0D70[i][2] == 0)
- {
- r2 = 0;
- for (j = 0; j < 4; j++)
- {
- if (a0->gname_uname.gname.child_sprite_gender[j] != 0)
- {
- r2++;
- }
- }
- r2++;
- a1[gUnknown_082F0D70[i][1]] += r2;
- }
- else
- {
- a1[gUnknown_082F0D70[i][1]] += gUnknown_082F0D70[i][2];
- }
- }
- return result;
-}
-
-bool32 sub_801AA08(u32 * a0, u32 * a1)
-{
- s32 i;
- for (i = 0; i < 4; i++)
- {
- if (a0[i] != a1[i])
- {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId)
-{
- bool32 r8 = FALSE;
- u32 sp0[4] = {0, 0, 0, 0};
- struct UnkStruct_x20 ** data = (void *)gTasks[taskId].data;
- s32 i;
-
- for (i = 0; i < 16; i++)
- {
- u32 r1 = sub_801A960(&(*data)[i], sp0);
- if (r1 != a2[i])
- {
- a2[i] = r1;
- r8 = TRUE;
- }
- }
- if (sub_801AA08(sp0, a1) == 0)
- {
- if (r8 != TRUE)
- {
- return FALSE;
- }
- }
- else
- {
- memcpy(a0, sp0, sizeof(sp0));
- memcpy(a1, sp0, sizeof(sp0));
- a0[3] = a0[0] + a0[1] + a0[2] + a0[3];
- }
- return TRUE;
-}
-
void sub_801AAD4(void)
{
s32 i;
diff --git a/src/wireless_communication_status_screen.c b/src/wireless_communication_status_screen.c
new file mode 100644
index 000000000..4931e96da
--- /dev/null
+++ b/src/wireless_communication_status_screen.c
@@ -0,0 +1,412 @@
+#include "global.h"
+#include "task.h"
+#include "bg.h"
+#include "palette.h"
+#include "gpu_regs.h"
+#include "malloc.h"
+#include "scanline_effect.h"
+#include "m4a.h"
+#include "dynamic_placeholder_text_util.h"
+#include "overworld.h"
+#include "strings.h"
+#include "string_util.h"
+#include "international_string_util.h"
+#include "sound.h"
+#include "menu.h"
+#include "librfu.h"
+#include "link_rfu.h"
+#include "union_room.h"
+#include "constants/songs.h"
+#include "constants/union_room.h"
+
+struct UnkStruct_3000DAC
+{
+ /*0x00*/ u32 unk00[4];
+ /*0x10*/ u32 unk10[4];
+ /*0x20*/ u32 unk20[16];
+ /*0x60*/ u8 taskId;
+ /*0x61*/ u8 unk61;
+ /*0x62*/ u8 filler_62[10];
+};
+
+static struct UnkStruct_3000DAC * gUnknown_03000DAC;
+
+void sub_801A43C(void);
+void sub_801A6C0(u8 taskId);
+static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode);
+bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId);
+
+const u16 gWirelessInfoScreenPal[] = INCBIN_U16("graphics/interface/wireless_info_screen.gbapal");
+const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz");
+const u32 gWirelessInfoScreenTilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz");
+
+static const struct BgTemplate sBgTemplates[] = {
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 0x1F,
+ .priority = 0
+ }, {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 0x08,
+ .priority = 1
+ }
+};
+
+const struct WindowTemplate sWindowTemplates[] = {
+ {
+ .bg = 0x00,
+ .tilemapLeft = 0x03,
+ .tilemapTop = 0x00,
+ .width = 0x18,
+ .height = 0x03,
+ .paletteNum = 0x0f,
+ .baseBlock = 0x0001
+ }, {
+ .bg = 0x00,
+ .tilemapLeft = 0x03,
+ .tilemapTop = 0x04,
+ .width = 0x15,
+ .height = 0x0f,
+ .paletteNum = 0x0f,
+ .baseBlock = 0x0049
+ }, {
+ .bg = 0x00,
+ .tilemapLeft = 0x18,
+ .tilemapTop = 0x04,
+ .width = 0x03,
+ .height = 0x0f,
+ .paletteNum = 0x0f,
+ .baseBlock = 0x0184
+ },
+ { 0xFF }
+};
+
+const u8 *const gUnknown_082F0D5C[] = {
+ gText_WirelessCommStatus,
+ gText_PeopleTrading,
+ gText_PeopleBattling,
+ gText_PeopleInUnionRoom,
+ gText_PeopleCommunicating
+};
+
+const u8 gUnknown_082F0D70[][3] = {
+ {0x01, 0x01, 0x02},
+ {0x02, 0x01, 0x02},
+ {0x03, 0x01, 0x04},
+ {0x04, 0x00, 0x02},
+ {0x06, 0x03, 0x02},
+ {0x07, 0x03, 0x02},
+ {0x09, 0x03, 0x00},
+ {0x0a, 0x03, 0x00},
+ {0x0b, 0x03, 0x00},
+ {0x0c, 0xff, 0x00},
+ {0x0d, 0x00, 0x00},
+ {0x10, 0x03, 0x00},
+ {0x0f, 0x03, 0x00},
+ {0x40, 0x02, 0x01},
+ {0x41, 0x02, 0x02},
+ {0x44, 0x02, 0x02},
+ {0x45, 0x02, 0x00},
+ {0x48, 0x02, 0x02},
+ {0x54, 0x02, 0x01},
+ {0x53, 0x02, 0x02},
+ {0x51, 0x02, 0x01},
+ {0x52, 0x02, 0x01},
+ {0x15, 0x03, 0x02},
+ {0x16, 0x03, 0x02},
+ {0x17, 0x03, 0x00},
+ {0x18, 0x03, 0x00},
+ {0x19, 0x03, 0x00},
+ {0x1a, 0x03, 0x00},
+ {0x1b, 0x03, 0x00},
+ {0x1c, 0x01, 0x02},
+ {0x0e, 0x01, 0x02}
+};
+
+void sub_801A3F4(void)
+{
+ if (!IsDma3ManagerBusyWithBgCopy())
+ {
+ RunTasks();
+ RunTextPrinters();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+ }
+}
+
+void sub_801A418(void)
+{
+ LoadOam();
+ ProcessSpriteCopyRequests();
+ TransferPlttBuffer();
+}
+
+void sub_801A42C(void)
+{
+ SetMainCallback2(sub_801A43C);
+}
+
+void sub_801A43C(void)
+{
+ SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
+ gUnknown_03000DAC = AllocZeroed(sizeof(struct UnkStruct_3000DAC));
+ SetVBlankCallback(NULL);
+ ResetBgsAndClearDma3BusyFlags(0);
+ InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
+ SetBgTilemapBuffer(1, Alloc(0x800));
+ SetBgTilemapBuffer(0, Alloc(0x800));
+ DecompressAndLoadBgGfxUsingHeap(1, gWirelessInfoScreenGfx, 0, 0, 0);
+ CopyToBgTilemapBuffer(1, gWirelessInfoScreenTilemap, 0, 0);
+ InitWindows(sWindowTemplates);
+ DeactivateAllTextPrinters();
+ ResetPaletteFade();
+ ResetSpriteData();
+ ResetTasks();
+ ScanlineEffect_Stop();
+ m4aSoundVSyncOn();
+ SetVBlankCallback(sub_801A418);
+ gUnknown_03000DAC->taskId = CreateTask(sub_801A6C0, 0);
+ gUnknown_03000DAC->unk61 = CreateTask_ListenToWireless();
+ gUnknown_03000DAC->unk10[3] = 1;
+ ChangeBgX(0, 0, 0);
+ ChangeBgY(0, 0, 0);
+ ChangeBgX(1, 0, 0);
+ ChangeBgY(1, 0, 0);
+ LoadPalette(gWirelessInfoScreenPal, 0x00, 0x20);
+ Menu_LoadStdPalAt(0xF0);
+ DynamicPlaceholderTextUtil_Reset();
+ FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x0F);
+ CopyBgTilemapBufferToVram(1);
+ SetMainCallback2(sub_801A3F4);
+ RunTasks();
+ RunTextPrinters();
+ AnimateSprites();
+ BuildOamBuffer();
+ UpdatePaletteFade();
+}
+
+void sub_801A584(void)
+{
+ s32 i;
+ FreeAllWindowBuffers();
+ for (i = 0; i < 2; i++)
+ {
+ Free(GetBgTilemapBuffer(i));
+ }
+ Free(gUnknown_03000DAC);
+ SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
+}
+
+void sub_801A5BC(s16 * a0, s16 * a1)
+{
+ if (++(*a0) > 5)
+ {
+ if (++(*a1) == 14)
+ {
+ *a1 = 0;
+ }
+ *a0 = 0;
+ }
+ LoadPalette(gWirelessInfoScreenPal + 16 * (*a1 + 2), 0, 0x10);
+}
+
+void sub_801A600(void)
+{
+ s32 i;
+ FillWindowPixelBuffer(0, 0);
+ FillWindowPixelBuffer(1, 0);
+ FillWindowPixelBuffer(2, 0);
+ sub_801A8B0(0, 1, gUnknown_082F0D5C[0], GetStringCenterAlignXOffset(1, gUnknown_082F0D5C[0], 0xC0), 6, 3);
+ for (i = 0; i < 3; i++)
+ {
+ sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 1);
+ }
+ sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 2);
+ PutWindowTilemap(0);
+ CopyWindowToVram(0, 2);
+ PutWindowTilemap(1);
+ CopyWindowToVram(1, 2);
+}
+
+void sub_801A6C0(u8 taskId)
+{
+ s32 i;
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ sub_801A600();
+ gTasks[taskId].data[0]++;
+ break;
+ case 1:
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
+ ShowBg(1);
+ CopyBgTilemapBufferToVram(0);
+ ShowBg(0);
+ gTasks[taskId].data[0]++;
+ break;
+ case 2:
+ if (!gPaletteFade.active)
+ {
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 3:
+ if (sub_801AA30(gUnknown_03000DAC->unk00, gUnknown_03000DAC->unk10, gUnknown_03000DAC->unk20, gUnknown_03000DAC->unk61))
+ {
+ FillWindowPixelBuffer(2, 0);
+ for (i = 0; i < 4; i++)
+ {
+ ConvertIntToDecimalStringN(gStringVar4, gUnknown_03000DAC->unk00[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
+ if (i != 3)
+ {
+ sub_801A8B0(2, 1, gStringVar4, 12, 30 * i + 8, 1);
+ }
+ else
+ {
+ sub_801A8B0(2, 1, gStringVar4, 12, 98, 2);
+ }
+ }
+ PutWindowTilemap(2);
+ CopyWindowToVram(2, 3);
+ }
+ if (({gMain.newKeys & A_BUTTON;}) || ({gMain.newKeys & B_BUTTON;}))
+ {
+ PlaySE(SE_SELECT);
+ gTasks[gUnknown_03000DAC->unk61].data[15] = 0xFF;
+ gTasks[taskId].data[0]++;
+ }
+ sub_801A5BC(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
+ break;
+ case 4:
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
+ gTasks[taskId].data[0]++;
+ break;
+ case 5:
+ if (!gPaletteFade.active)
+ {
+ SetMainCallback2(sub_801A584);
+ DestroyTask(taskId);
+ }
+ break;
+ }
+}
+
+static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode)
+{
+ u8 color[3];
+
+ switch (mode)
+ {
+ case 0:
+ color[0] = 0;
+ color[1] = 2;
+ color[2] = 3;
+ break;
+ case 1:
+ color[0] = 0;
+ color[1] = 1;
+ color[2] = 3;
+ break;
+ case 2:
+ color[0] = 0;
+ color[1] = 4;
+ color[2] = 5;
+ break;
+ case 3:
+ color[0] = 0;
+ color[1] = 7;
+ color[2] = 6;
+ break;
+ case 4:
+ color[0] = 0;
+ color[1] = 1;
+ color[2] = 2;
+ break;
+ }
+
+ AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, -1, str);
+}
+
+u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
+{
+ s32 i, j, r2;
+ u32 result = a0->gname_uname.gname.activity;
+
+ for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++)
+ {
+ if (result != gUnknown_082F0D70[i][0])
+ {
+ continue;
+ }
+ if (a0->groupScheduledAnim != 1)
+ {
+ continue;
+ }
+ if (gUnknown_082F0D70[i][2] == 0)
+ {
+ r2 = 0;
+ for (j = 0; j < 4; j++)
+ {
+ if (a0->gname_uname.gname.child_sprite_gender[j] != 0)
+ {
+ r2++;
+ }
+ }
+ r2++;
+ a1[gUnknown_082F0D70[i][1]] += r2;
+ }
+ else
+ {
+ a1[gUnknown_082F0D70[i][1]] += gUnknown_082F0D70[i][2];
+ }
+ }
+ return result;
+}
+
+bool32 sub_801AA08(u32 * a0, u32 * a1)
+{
+ s32 i;
+ for (i = 0; i < 4; i++)
+ {
+ if (a0[i] != a1[i])
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId)
+{
+ bool32 r8 = FALSE;
+ u32 sp0[4] = {0, 0, 0, 0};
+ struct UnkStruct_x20 ** data = (void *)gTasks[taskId].data;
+ s32 i;
+
+ for (i = 0; i < 16; i++)
+ {
+ u32 r1 = sub_801A960(&(*data)[i], sp0);
+ if (r1 != a2[i])
+ {
+ a2[i] = r1;
+ r8 = TRUE;
+ }
+ }
+ if (sub_801AA08(sp0, a1) == 0)
+ {
+ if (r8 != TRUE)
+ {
+ return FALSE;
+ }
+ }
+ else
+ {
+ memcpy(a0, sp0, sizeof(sp0));
+ memcpy(a1, sp0, sizeof(sp0));
+ a0[3] = a0[0] + a0[1] + a0[2] + a0[3];
+ }
+ return TRUE;
+}