summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSlawter666 <38655737+Slawter666@users.noreply.github.com>2019-01-05 19:54:26 +0000
committerSlawter666 <38655737+Slawter666@users.noreply.github.com>2019-01-05 19:54:26 +0000
commitf8c2fcb9b22a1b9cf43e293fdcb6df2b9d0dd164 (patch)
tree81b80d287c4fb3320a8143b9cfbb06e9fc4b34d5 /src
parentee5a239534d7c4bd64ce7ced4146204579f5d598 (diff)
parentcbf7d6cee59e7aa2cdef6b9e89fa62fbeb4a07c5 (diff)
Merge branch 'master' of https://github.com/pret/pokeemerald into secret-base
Diffstat (limited to 'src')
-rw-r--r--src/battle_anim_80A5C6C.c20
-rw-r--r--src/battle_controller_link_opponent.c4
-rw-r--r--src/battle_controller_link_partner.c2
-rw-r--r--src/battle_controller_opponent.c4
-rw-r--r--src/battle_controller_player.c8
-rw-r--r--src/battle_controller_player_partner.c4
-rw-r--r--src/battle_controller_recorded_opponent.c2
-rw-r--r--src/battle_controller_recorded_player.c6
-rw-r--r--src/battle_controller_safari.c2
-rw-r--r--src/battle_controller_wally.c4
-rw-r--r--src/battle_dome.c11
-rw-r--r--src/battle_main.c18
-rw-r--r--src/battle_setup.c2
-rw-r--r--src/battle_tower.c4
-rw-r--r--src/contest.c28
-rw-r--r--src/contest_link_80F57C4.c1443
-rw-r--r--src/contest_link_80FC4F4.c548
-rw-r--r--src/contest_link_81D9DE4.c331
-rw-r--r--src/contest_painting.c3
-rw-r--r--src/data/pokemon_graphics/back_pic_coordinates.h880
-rw-r--r--src/data/pokemon_graphics/front_pic_coordinates.h880
-rw-r--r--src/data/trainer_graphics/back_pic_tables.h16
-rw-r--r--src/data/trainer_graphics/front_pic_tables.h186
-rw-r--r--src/decoration.c10
-rw-r--r--src/event_data.c32
-rw-r--r--src/field_control_avatar.c4
-rwxr-xr-xsrc/field_message_box.c8
-rw-r--r--src/field_specials.c20
-rw-r--r--src/link.c2
-rw-r--r--src/link_rfu.c2
-rw-r--r--src/match_call.c2806
-rw-r--r--src/menu.c468
-rw-r--r--src/menu_helpers.c2
-rw-r--r--src/new_game.c4
-rw-r--r--src/overworld.c4
-rwxr-xr-xsrc/party_menu.c10
-rwxr-xr-xsrc/pokedex_area_screen.c2
-rw-r--r--src/pokenav_match_call.c1275
-rw-r--r--src/reshow_battle_screen.c4
-rw-r--r--src/roulette.c4929
-rwxr-xr-xsrc/roulette_util.c2
-rw-r--r--src/rtc.c2
-rw-r--r--src/script_menu.c26
-rwxr-xr-xsrc/script_pokemon_util_80F87D8.c14
-rw-r--r--src/secret_base.c2
-rw-r--r--src/strings.c2
-rw-r--r--src/trade.c98
-rw-r--r--src/tv.c16
48 files changed, 11674 insertions, 2476 deletions
diff --git a/src/battle_anim_80A5C6C.c b/src/battle_anim_80A5C6C.c
index 0800e67a0..3efc86bf8 100644
--- a/src/battle_anim_80A5C6C.c
+++ b/src/battle_anim_80A5C6C.c
@@ -72,10 +72,10 @@ static const struct UCoords8 sBattlerCoords[][4] =
// One entry for each of the four Castform forms.
const struct MonCoords gCastformFrontSpriteCoords[] =
{
- { 0x44, 17 }, // NORMAL
- { 0x66, 9 }, // SUN
- { 0x46, 9 }, // RAIN
- { 0x86, 8 }, // HAIL
+ { .size = 0x44, .y_offset = 17 }, // NORMAL
+ { .size = 0x66, .y_offset = 9 }, // SUN
+ { .size = 0x46, .y_offset = 9 }, // RAIN
+ { .size = 0x86, .y_offset = 8 }, // HAIL
};
static const u8 sCastformElevations[] =
@@ -2216,17 +2216,17 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
switch (attr)
{
case BATTLER_COORD_ATTR_HEIGHT:
- return (coords->coords & 0xf) * 8;
+ return (coords->size & 0xf) * 8;
case BATTLER_COORD_ATTR_WIDTH:
- return (coords->coords >> 4) * 8;
+ return (coords->size >> 4) * 8;
case BATTLER_COORD_ATTR_LEFT:
- return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - ((coords->coords >> 4) * 4);
+ return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - ((coords->size >> 4) * 4);
case BATTLER_COORD_ATTR_RIGHT:
- return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + ((coords->coords >> 4) * 4);
+ return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + ((coords->size >> 4) * 4);
case BATTLER_COORD_ATTR_TOP:
- return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - ((coords->coords & 0xf) * 4);
+ return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - ((coords->size & 0xf) * 4);
case BATTLER_COORD_ATTR_BOTTOM:
- return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + ((coords->coords & 0xf) * 4);
+ return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + ((coords->size & 0xf) * 4);
case BATTLER_COORD_ATTR_RAW_BOTTOM:
ret = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 31;
return ret - coords->y_offset;
diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c
index 33f557388..a7b08a974 100644
--- a/src/battle_controller_link_opponent.c
+++ b/src/battle_controller_link_opponent.c
@@ -1301,7 +1301,7 @@ static void LinkOpponentHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
- (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
+ (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40,
GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240;
@@ -1324,7 +1324,7 @@ static void LinkOpponentHandleTrainerSlide(void)
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
- gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
+ gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;
diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c
index 78c2c409d..5c9a92744 100644
--- a/src/battle_controller_link_partner.c
+++ b/src/battle_controller_link_partner.c
@@ -1143,7 +1143,7 @@ static void LinkPartnerHandleDrawTrainerPic(void)
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
- gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, GetBattlerSpriteSubpriority(gActiveBattler));
+ gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c
index 4e600ea71..d8a0127d0 100644
--- a/src/battle_controller_opponent.c
+++ b/src/battle_controller_opponent.c
@@ -1292,7 +1292,7 @@ static void OpponentHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
- (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
+ (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40,
GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240;
@@ -1362,7 +1362,7 @@ static void OpponentHandleTrainerSlide(void)
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
- gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40, 0x1E);
+ gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 176, (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, 0x1E);
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 96;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos1.x += 32;
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index 12ffca381..a6a6ac0f3 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -2291,18 +2291,18 @@ static void PlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
{
xPos = 90;
- yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80;
}
else
{
- yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
}
else
{
xPos = 80;
- yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
// Use front pic table for any tag battles unless your partner is Steven.
@@ -2365,7 +2365,7 @@ static void PlayerHandleTrainerSlide(void)
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
- gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 80, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, 30);
+ gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, 80, (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80, 30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96;
diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c
index ddb241b30..3cfc94977 100644
--- a/src/battle_controller_player_partner.c
+++ b/src/battle_controller_player_partner.c
@@ -1308,13 +1308,13 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
{
trainerPicId = TRAINER_BACK_PIC_STEVEN;
xPos = 90;
- yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
else
{
trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId);
xPos = 32;
- yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80;
}
// Use back pic only if the partner is Steven
diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c
index b1b271bac..03c3c88b2 100644
--- a/src/battle_controller_recorded_opponent.c
+++ b/src/battle_controller_recorded_opponent.c
@@ -1248,7 +1248,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
xPos,
- (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 40,
+ (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40,
GetBattlerSpriteSubpriority(gActiveBattler));
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240;
diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c
index 301c1f009..9055fc16b 100644
--- a/src/battle_controller_recorded_player.c
+++ b/src/battle_controller_recorded_player.c
@@ -1217,18 +1217,18 @@ static void RecordedPlayerHandleDrawTrainerPic(void)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
{
xPos = 90;
- yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80;
}
else
{
- yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
}
else
{
xPos = 80;
- yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
+ yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
}
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER)
diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c
index 3f1542edb..54ba04ab4 100644
--- a/src/battle_controller_safari.c
+++ b/src/battle_controller_safari.c
@@ -359,7 +359,7 @@ static void SafariHandleDrawTrainerPic(void)
gBattlerSpriteIds[gActiveBattler] = CreateSprite(
&gMultiuseSpriteTemplate,
80,
- (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
+ (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].size) * 4 + 80,
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c
index ac3604054..9a9773316 100644
--- a/src/battle_controller_wally.c
+++ b/src/battle_controller_wally.c
@@ -1036,7 +1036,7 @@ static void WallyHandleDrawTrainerPic(void)
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
- 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
+ 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size),
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
@@ -1051,7 +1051,7 @@ static void WallyHandleTrainerSlide(void)
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(gActiveBattler));
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate,
80,
- 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords),
+ 80 + 4 * (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size),
30);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -96;
diff --git a/src/battle_dome.c b/src/battle_dome.c
index 00ae84d09..efc69313e 100644
--- a/src/battle_dome.c
+++ b/src/battle_dome.c
@@ -5847,17 +5847,22 @@ static void sub_8194220(u8 taskId)
gTasks[i].data[0] = 0;
}
ScanlineEffect_Clear();
- for (i = 0; i < 91; i++)
+
+ i = 0;
+ while (i < 91)
{
gScanlineEffectRegBuffers[0][i] = 0x1F0A;
gScanlineEffectRegBuffers[1][i] = 0x1F0A;
+ i++;
}
- for (i = 91; i < 160; i++)
+
+ while (i < 160)
{
- asm(""::"r"(i));
gScanlineEffectRegBuffers[0][i] = 0x1F09;
gScanlineEffectRegBuffers[1][i] = 0x1F09;
+ i++;
}
+
ScanlineEffect_SetParams(gUnknown_0860CF44);
DestroyTask(taskId);
break;
diff --git a/src/battle_main.c b/src/battle_main.c
index df1828d18..4e2a87beb 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -656,16 +656,19 @@ static void CB2_InitBattleInternal(void)
gBattle_WIN0V = 0x5051;
ScanlineEffect_Clear();
- for (i = 0; i < 80; i++)
+ i = 0;
+ while (i < 80)
{
gScanlineEffectRegBuffers[0][i] = 0xF0;
gScanlineEffectRegBuffers[1][i] = 0xF0;
+ i++;
}
- for (i = 80; i < 160; i++)
+
+ while (i < 160)
{
- asm(""::"r"(i));
gScanlineEffectRegBuffers[0][i] = 0xFF10;
gScanlineEffectRegBuffers[1][i] = 0xFF10;
+ i++;
}
ScanlineEffect_SetParams(sIntroScanlineParams16Bit);
@@ -2222,16 +2225,19 @@ void sub_8038D64(void)
gBattle_WIN0V = 0x5051;
ScanlineEffect_Clear();
- for (i = 0; i < 80; i++)
+ i = 0;
+ while (i < 80)
{
gScanlineEffectRegBuffers[0][i] = 0xF0;
gScanlineEffectRegBuffers[1][i] = 0xF0;
+ i++;
}
- for (i = 80; i < 160; i++)
+
+ while (i < 160)
{
- asm(""::"r"(i)); // Needed to stop the compiler from optimizing out the loop counter.
gScanlineEffectRegBuffers[0][i] = 0xFF10;
gScanlineEffectRegBuffers[1][i] = 0xFF10;
+ i++;
}
ResetPaletteFade();
diff --git a/src/battle_setup.c b/src/battle_setup.c
index 21386016f..195af0c28 100644
--- a/src/battle_setup.c
+++ b/src/battle_setup.c
@@ -1557,7 +1557,7 @@ static bool32 sub_80B1D94(s32 rematchTableId)
if (rematchTableId >= REMATCH_ELITE_FOUR_ENTRIES)
return TRUE;
else if (rematchTableId == REMATCH_WALLY_ENTRY)
- return (FlagGet(FLAG_0x07E) == FALSE);
+ return (FlagGet(FLAG_DEFEATED_WALLY_VICTORY_ROAD) == FALSE);
else
return FALSE;
}
diff --git a/src/battle_tower.c b/src/battle_tower.c
index 9e546b0c8..deb5acb2e 100644
--- a/src/battle_tower.c
+++ b/src/battle_tower.c
@@ -3158,10 +3158,10 @@ void sub_81653CC(void)
{
if (gSaveBlock2Ptr->frontier.field_CA8 == 1)
sub_80F01B8();
- if (FlagGet(FLAG_0x077) == TRUE)
+ if (FlagGet(FLAG_CANCEL_BATTLE_ROOM_CHALLENGE) == TRUE)
{
sub_80F01B8();
- FlagClear(FLAG_0x077);
+ FlagClear(FLAG_CANCEL_BATTLE_ROOM_CHALLENGE);
}
}
diff --git a/src/contest.c b/src/contest.c
index 949be7941..7decf88fc 100644
--- a/src/contest.c
+++ b/src/contest.c
@@ -176,7 +176,7 @@ EWRAM_DATA s16 gUnknown_02039F08[4] = {0};
EWRAM_DATA s16 gUnknown_02039F10[4] = {0};
EWRAM_DATA s16 gUnknown_02039F18[4] = {0};
EWRAM_DATA u8 gContestFinalStandings[4] = {0};
-EWRAM_DATA u8 gUnknown_02039F24 = 0;
+EWRAM_DATA u8 gContestMonPartyIndex = 0;
EWRAM_DATA u8 gContestPlayerMonIndex = 0;
EWRAM_DATA u8 gUnknown_02039F26[4] = {0};
EWRAM_DATA u8 gIsLinkContest = 0;
@@ -185,8 +185,8 @@ EWRAM_DATA u8 gIsLinkContest = 0;
EWRAM_DATA u8 gUnknown_02039F2B = 0;
EWRAM_DATA u16 gSpecialVar_ContestCategory = 0;
EWRAM_DATA u16 gSpecialVar_ContestRank = 0;
-EWRAM_DATA u8 gUnknown_02039F30 = 0;
-EWRAM_DATA u8 gUnknown_02039F31 = 0;
+EWRAM_DATA u8 gNumLinkContestPlayers = 0;
+EWRAM_DATA u8 gHighestRibbonRank = 0;
EWRAM_DATA struct ContestResources * gContestResources = NULL;
EWRAM_DATA u8 sContestBgCopyFlags = 0;
EWRAM_DATA struct ContestWinner gUnknown_02039F3C = {0};
@@ -932,9 +932,9 @@ void sub_80D8A88(u8 taskId)
{
s32 i;
- for (i = 0; i + gUnknown_02039F30 < 4; i++)
+ for (i = 0; i + gNumLinkContestPlayers < 4; i++)
{
- gContestResources->field_4[gUnknown_02039F30 + i].currMove = sub_80DB8B8(gUnknown_02039F30 + i);
+ gContestResources->field_4[gNumLinkContestPlayers + i].currMove = sub_80DB8B8(gNumLinkContestPlayers + i);
}
}
gTasks[taskId].data[0] = 0;
@@ -2110,7 +2110,7 @@ void sub_80DAB8C(u8 contestType, u8 rank)
opponentsCount--;
}
- sub_80DA8C8(gUnknown_02039F24);
+ sub_80DA8C8(gContestMonPartyIndex);
}
#ifdef NONMATCHING
@@ -2121,7 +2121,7 @@ void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame)
u8 opponents[100];
const u8 * r6;
- if (gUnknown_02039F30 == 4)
+ if (gNumLinkContestPlayers == 4)
return;
r6 = gUnknown_085898A4;
@@ -2151,14 +2151,14 @@ void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame)
opponents[opponentsCount++] = i;
}
opponents[opponentsCount] = 0xFF;
- for (i = 0; i < 4 - gUnknown_02039F30; i++)
+ for (i = 0; i < 4 - gNumLinkContestPlayers; i++)
{
u16 rnd = sub_80F903C() % opponentsCount;
s32 j;
- gContestMons[gUnknown_02039F30 + i] = gContestOpponents[opponents[rnd]];
- sub_80DF9D4(gContestMons[gUnknown_02039F30 + i].trainerName);
- sub_80DF9E0(gContestMons[gUnknown_02039F30 + i].nickname, GAME_LANGUAGE);
+ gContestMons[gNumLinkContestPlayers + i] = gContestOpponents[opponents[rnd]];
+ sub_80DF9D4(gContestMons[gNumLinkContestPlayers + i].trainerName);
+ sub_80DF9E0(gContestMons[gNumLinkContestPlayers + i].nickname, GAME_LANGUAGE);
for (j = rnd; opponents[j] != 0xFF; j++)
opponents[j] = opponents[j + 1];
opponentsCount--;
@@ -2178,7 +2178,7 @@ NAKED void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame)
"\tlsls r1, 24\n"
"\tlsrs r2, r1, 24\n"
"\tmovs r7, 0\n"
- "\tldr r0, =gUnknown_02039F30\n"
+ "\tldr r0, =gNumLinkContestPlayers\n"
"\tldrb r1, [r0]\n"
"\tmov r9, r0\n"
"\tcmp r1, 0x4\n"
@@ -2471,12 +2471,12 @@ u16 sub_80DAFE0(u8 who, u8 contestCategory)
return statMain + (statSub1 + statSub2 + gContestMons[who].sheen) / 2;
}
-void sub_80DB09C(u8 a0)
+void sub_80DB09C(u8 contestCategory)
{
s32 i;
for (i = 0; i < 4; i++)
- gContestMonConditions[i] = sub_80DAFE0(i, a0);
+ gContestMonConditions[i] = sub_80DAFE0(i, contestCategory);
}
u8 sub_80DB0C4(void)
diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c
new file mode 100644
index 000000000..721a4f870
--- /dev/null
+++ b/src/contest_link_80F57C4.c
@@ -0,0 +1,1443 @@
+#include "global.h"
+#include "battle.h"
+#include "bg.h"
+#include "contest.h"
+#include "contest_link_80F57C4.h"
+#include "contest_painting.h"
+#include "decompress.h"
+#include "dma3.h"
+#include "event_data.h"
+#include "field_specials.h"
+#include "gpu_regs.h"
+#include "graphics.h"
+#include "international_string_util.h"
+#include "link.h"
+#include "link_rfu.h"
+#include "load_save.h"
+#include "main.h"
+#include "overworld.h"
+#include "palette.h"
+#include "pokedex.h"
+#include "pokemon.h"
+#include "pokemon_icon.h"
+#include "random.h"
+#include "save.h"
+#include "scanline_effect.h"
+#include "sound.h"
+#include "string_util.h"
+#include "strings.h"
+#include "task.h"
+#include "text.h"
+#include "tv.h"
+#include "util.h"
+#include "window.h"
+#include "constants/game_stat.h"
+#include "constants/rgb.h"
+#include "constants/songs.h"
+#include "constants/vars.h"
+
+struct ContestLinkUnk0
+{
+ u8 unk0;
+ u8 unk1;
+ u8 taskId;
+ u8 unk3;
+ u8 unk4;
+ u8 unk5;
+ u8 unk6;
+ u8 filler7[0x1];
+ u8 spriteId;
+ u8 unk9;
+ u8 unkA;
+ u8 fillerB[0x9];
+ u8 unk14;
+ u8 filler15[0x3];
+};
+
+struct ContestLinkUnk4
+{
+ u8 filler0[0x50];
+};
+
+struct ContestLink80F57C4
+{
+ struct ContestLinkUnk0 *unk0;
+ struct ContestLinkUnk4 *unk4;
+ u8 filler8[0x4];
+ u8 *unkC[4];
+};
+
+extern const struct CompressedSpriteSheet gMonFrontPicTable[];
+
+extern struct ContestLink80F57C4 *gUnknown_0203A034;
+
+extern const struct BgTemplate gUnknown_0858D888[4];
+extern const struct WindowTemplate gUnknown_0858D898[];
+extern const struct CompressedSpriteSheet gUnknown_0858D878[];
+extern const struct CompressedSpritePalette gUnknown_0858D880[];
+extern const struct SpriteSheet gUnknown_0858D8E0;
+extern const struct SpriteTemplate gSpriteTemplate_858D8C8;
+extern const u8 gUnknown_0858D8E8[];
+extern const u8 gUnknown_0858D6D0[];
+extern const struct SpriteTemplate gSpriteTemplate_858D7F8;
+extern const struct SpriteSheet gUnknown_0858D810[];
+extern const struct SpritePalette gUnknown_0858D850;
+
+static void sub_80F6A9C(void);
+static void sub_80F71C8(void);
+u8 sub_80F7310(u8, u8);
+s8 sub_80F7364(u8, u8);
+void sub_80F7ED0(int, u8 *, int);
+void sub_80F7DF4(void);
+static void sub_80F6A64(u8, u8);
+static void sub_80F6DC0(void);
+static void sub_80F6AE8(void);
+static void sub_80F5CE4(u8);
+static void sub_80F5C00(void);
+static void sub_80F68B4(u8);
+void sub_80F7880(void);
+static void sub_80F5C24(void);
+static void sub_80F707C(const u8 *);
+static void sub_80F5ED8(u8);
+static void sub_80F5F14(u8);
+static void sub_80F5F30(u8);
+static void sub_80F5F74(u8);
+static void sub_80F7144(void);
+static void sub_80F68F0(u8);
+s16 sub_80F6B78(const u8 *, u8);
+static void sub_80F6E9C(s16, u16, u16, u16);
+static void sub_80F6058(u8);
+void sub_80F7A80(u8, u8);
+static void sub_80F6EF4(u16);
+static void sub_80F60F0(u8);
+static void sub_80F616C(u8);
+static void sub_80F6204(u8);
+void sub_80F73DC(u8);
+void sub_80F74BC(u8);
+void sub_80F77E0(u8, u8);
+static void sub_80F6404(u8);
+void sub_80F75A8(struct Sprite *);
+void sub_80F7670(u8);
+void sub_80F7620(struct Sprite *);
+static void sub_80F66B4(u8);
+static void sub_80F671C(u8);
+static void sub_80F677C(u8);
+static void sub_80F67C4(u8);
+static void sub_80F6820(u8);
+void sub_80F7E64(void);
+static void sub_80F6F68(struct Sprite *);
+static void sub_80F7014(struct Sprite *);
+static void sub_80F6FDC(struct Sprite *);
+
+void sub_80F57C4(void)
+{
+ int i;
+
+ SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP);
+ ResetBgsAndClearDma3BusyFlags(0);
+ InitBgsFromTemplates(0, gUnknown_0858D888, ARRAY_COUNT(gUnknown_0858D888));
+ for (i = 0; i < 4; i++)
+ SetBgTilemapBuffer(i, gUnknown_0203A034->unkC[i]);
+
+ InitWindows(gUnknown_0858D898);
+ DeactivateAllTextPrinters();
+ SetGpuReg(REG_OFFSET_MOSAIC, 0);
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+ SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
+ SetGpuReg(REG_OFFSET_WIN0H, 0);
+ SetGpuReg(REG_OFFSET_WIN0V, 0);
+ SetGpuReg(REG_OFFSET_WIN1H, 0);
+ SetGpuReg(REG_OFFSET_WIN1V, 0);
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ SetGpuReg(REG_OFFSET_BLDY, 0);
+ SetGpuReg(REG_OFFSET_BG0HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG0VOFS, 0);
+ SetGpuReg(REG_OFFSET_BG1HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG1VOFS, 0);
+ SetGpuReg(REG_OFFSET_BG2HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG2VOFS, 0);
+ SetGpuReg(REG_OFFSET_BG3HOFS, 0);
+ SetGpuReg(REG_OFFSET_BG3VOFS, 0);
+ SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON);
+ gBattle_BG0_X = 0;
+ gBattle_BG0_Y = 0;
+ gBattle_BG1_X = 0;
+ gBattle_BG1_Y = 0;
+ gBattle_BG2_X = 0;
+ gBattle_BG2_Y = 0;
+ gBattle_BG3_X = 0;
+ gBattle_BG3_Y = 0;
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ gBattle_WIN1H = 0;
+ gBattle_WIN1V = 0;
+}
+
+void sub_80F591C(void)
+{
+ int i, j;
+ s8 var0;
+ s8 var1;
+ int var2;
+ u16 tile1, tile2;
+
+ LZDecompressVram(gUnknown_08C19588, (void *)BG_CHAR_ADDR(0));
+ CopyToBgTilemapBuffer(3, gUnknown_08C1A12C, 0, 0);
+ CopyToBgTilemapBuffer(2, gUnknown_08C1A000, 0, 0);
+ CopyToBgTilemapBuffer(0, gUnknown_08C19EEC, 0, 0);
+ sub_80F71C8();
+ LoadCompressedPalette(gUnknown_08C1A2B4, 0, 0x200);
+ LoadPalette(gUnknown_0858D6B0, 0xF0, 0x20);
+
+ for (i = 0; i < 4; i++)
+ {
+ var0 = sub_80F7310(i, 1);
+ var1 = sub_80F7364(i, 1);
+ for (j = 0; j < 10; j++)
+ {
+ tile1 = 0x60B2;
+ if (j < var0)
+ tile1 += 2;
+
+ var2 = var1;
+ if (var1 < 0)
+ var2 = -var2;
+
+ if (j < var2)
+ {
+ tile2 = 0x60A4;
+ if (var1 < 0)
+ tile2 += 2;
+ }
+ else
+ {
+ tile2 = 0x60A2;
+ }
+
+ FillBgTilemapBufferRect_Palette0(1, tile1, j + 19, i * 3 + 5, 1, 1);
+ FillBgTilemapBufferRect_Palette0(1, tile2, j + 19, i * 3 + 6, 1, 1);
+ }
+ }
+
+ CopyBgTilemapBufferToVram(0);
+ CopyBgTilemapBufferToVram(1);
+ CopyBgTilemapBufferToVram(2);
+ CopyBgTilemapBufferToVram(3);
+ ShowBg(0);
+ ShowBg(1);
+ ShowBg(2);
+ ShowBg(3);
+}
+
+static void sub_80F5A74(u8 monIndex)
+{
+ struct ContestPokemon *mon = &gContestMons[monIndex];
+ u8 *str = gDisplayedStringBattle;
+ if (monIndex == gContestPlayerMonIndex)
+ str = StringCopy(gDisplayedStringBattle, gText_ColorDarkGrey);
+
+ StringCopy(str, mon->nickname);
+ sub_80F7ED0(monIndex, gDisplayedStringBattle, 0);
+ StringCopy(str, gText_Slash);
+ StringAppend(str, mon->trainerName);
+ sub_80F7ED0(monIndex, gDisplayedStringBattle, 50);
+}
+
+void sub_80F5AE0(void)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ sub_80F5A74(i);
+
+ CopyBgTilemapBufferToVram(1);
+}
+
+void sub_80F5B00(void)
+{
+ gPaletteFade.bufferTransferDisabled = 1;
+ SetVBlankCallback(NULL);
+ sub_80F7DF4();
+ sub_80F57C4();
+ ScanlineEffect_Clear();
+ ResetPaletteFade();
+ ResetSpriteData();
+ ResetTasks();
+ FreeAllSpritePalettes();
+ sub_80F591C();
+ sub_80F6A9C();
+ sub_80F6A64(0, 1);
+ sub_80F5AE0();
+ memset(gUnknown_0203A034->unk0, 0, sizeof(*gUnknown_0203A034->unk0));
+ memset(gUnknown_0203A034->unk4, 0, sizeof(*gUnknown_0203A034->unk4));
+ sub_80F6DC0();
+ sub_80F6AE8();
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
+ gPaletteFade.bufferTransferDisabled = 0;
+ gUnknown_0203A034->unk0->taskId = CreateTask(sub_80F5CE4, 5);
+ SetMainCallback2(sub_80F5C00);
+ gBattle_WIN1H = 0x00F0;
+ gBattle_WIN1V = 0x80A0;
+ CreateTask(sub_80F68B4, 20);
+ sub_80F7880();
+ if (gIsLinkContest & 0x2)
+ gPaletteFade.bufferTransferDisabled = 1;
+ else
+ PlayBGM(MUS_CON_K);
+
+ SetVBlankCallback(sub_80F5C24);
+}
+
+static void sub_80F5C00(void)
+{
+ AnimateSprites();
+ BuildOamBuffer();
+ RunTasks();
+ UpdatePaletteFade();
+ CopyBgTilemapBufferToVram(1);
+ CopyBgTilemapBufferToVram(2);
+}
+
+static void sub_80F5C24(void)
+{
+ SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X);
+ SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y);
+ SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
+ SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
+ SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X);
+ SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y);
+ SetGpuReg(REG_OFFSET_BG3HOFS, gBattle_BG3_X);
+ SetGpuReg(REG_OFFSET_BG3VOFS, gBattle_BG3_Y);
+ SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H);
+ SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V);
+ SetGpuReg(REG_OFFSET_WIN1H, gBattle_WIN1H);
+ SetGpuReg(REG_OFFSET_WIN1V, gBattle_WIN1V);
+ LoadOam();
+ ProcessSpriteCopyRequests();
+ TransferPlttBuffer();
+ ScanlineEffect_InitHBlankDmaTransfer();
+}
+
+static void sub_80F5CE4(u8 taskId)
+{
+ u16 var;
+
+ if (gIsLinkContest & 1)
+ {
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ sub_80DBED4();
+ if (gContestFinalStandings[gContestPlayerMonIndex] == 0)
+ {
+ IncrementGameStat(GAME_STAT_WON_LINK_CONTEST);
+ gSpecialVar_0x8005 = 8;
+ InterviewBefore();
+ if (gSpecialVar_Result != 1)
+ InterviewAfter();
+ }
+
+ sub_813BADC(2);
+ sub_80DEDA8(gSpecialVar_ContestRank);
+ sub_80DEDA8(0xFE);
+ gUnknown_02039F5C = 1;
+ gUnknown_02039F5D = sub_80DEFA8(0xFE, 0);
+ var = VarGet(VAR_0x4086);
+ VarSet(VAR_0x4086, 0);
+ SetContinueGameWarpStatusToDynamicWarp();
+ TrySavingData(SAVE_LINK);
+ ClearContinueGameWarpStatus2();
+ VarSet(VAR_0x4086, var);
+ gTasks[taskId].data[0]++;
+ break;
+ case 1:
+ gTasks[taskId].data[0]++;
+ if (!(gIsLinkContest & 0x2))
+ gTasks[taskId].data[0] = 100;
+ break;
+ case 2:
+ if (IsLinkTaskFinished())
+ {
+ sub_800ADF8();
+ gTasks[taskId].data[0]++;
+ }
+ return;
+ case 3:
+ if (IsLinkTaskFinished() == TRUE)
+ {
+ PlayBGM(MUS_CON_K);
+ gPaletteFade.bufferTransferDisabled = 0;
+ gTasks[taskId].data[0]++;
+ break;
+ }
+ return;
+ }
+ }
+
+ if (!gPaletteFade.active)
+ {
+ gTasks[taskId].data[0] = 0;
+ if (gIsLinkContest & 0x1)
+ {
+ sub_80F707C(gText_CommunicationStandby);
+ gTasks[taskId].func = sub_80F5ED8;
+ }
+ else
+ {
+ IncrementGameStat(GAME_STAT_ENTERED_CONTEST);
+ if (gContestFinalStandings[gContestPlayerMonIndex] == 0)
+ IncrementGameStat(GAME_STAT_WON_CONTEST);
+
+ sub_80DEDA8(gSpecialVar_ContestRank);
+ sub_80DEDA8(0xFE);
+ gUnknown_02039F5C = 1;
+ gUnknown_02039F5D = sub_80DEFA8(0xFE, 0);
+ sub_813BADC(2);
+ gTasks[taskId].func = sub_80F5F74;
+ }
+ }
+}
+
+static void sub_80F5ED8(u8 taskId)
+{
+ if (gReceivedRemoteLinkPlayers)
+ {
+ CreateTask(sub_80F5F14, 0);
+ gTasks[taskId].func = TaskDummy;
+ }
+}
+
+static void sub_80F5F14(u8 taskId)
+{
+ SetTaskFuncWithFollowupFunc(taskId, sub_80FC998, sub_80F5F30);
+}
+
+static void sub_80F5F30(u8 taskId)
+{
+ if (IsLinkTaskFinished())
+ {
+ DestroyTask(taskId);
+ gTasks[gUnknown_0203A034->unk0->taskId].func = sub_80F5F74;
+ sub_80F7144();
+ }
+}
+
+static void sub_80F5F74(u8 taskId)
+{
+ s16 var0;
+
+ if (gTasks[taskId].data[0] == 0)
+ {
+ CreateTask(sub_80F68F0, 20);
+ var0 = sub_80F6B78(gText_AnnouncingResults, gUnknown_0203A034->unk0->unk0);
+ sub_80F6E9C(var0, 144, 120, 1088);
+ gTasks[taskId].data[0]++;
+ }
+ else if (gTasks[taskId].data[0] == 1)
+ {
+ if (gUnknown_0203A034->unk0->unk4 == 0)
+ {
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].data[0]++;
+ }
+ }
+ else if (gTasks[taskId].data[0] == 2)
+ {
+ if (++gTasks[taskId].data[1] == 21)
+ {
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].data[0]++;
+ }
+ }
+ else if (gTasks[taskId].data[0] == 3)
+ {
+ var0 = sub_80F6B78(gText_PreliminaryResults, gUnknown_0203A034->unk0->unk0);
+ sub_80F6E9C(var0, 144, -1, 1088);
+ gTasks[taskId].data[0]++;
+ }
+ else if (gTasks[taskId].data[0] == 4)
+ {
+ if (gUnknown_0203A034->unk0->unk4 == 2)
+ {
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].func = sub_80F6058;
+ }
+ }
+}
+
+static void sub_80F6058(u8 taskId)
+{
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (!gUnknown_0203A034->unk0->unkA)
+ {
+ sub_80F7A80(0, gTasks[taskId].data[2]++);
+ if (!gUnknown_0203A034->unk0->unk14)
+ gTasks[taskId].data[0] = 2;
+ else
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (!gUnknown_0203A034->unk0->unk14)
+ gTasks[taskId].data[0] = 0;
+ break;
+ case 2:
+ sub_80F6EF4(1088);
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[2] = 0;
+ gTasks[taskId].func = sub_80F60F0;
+ break;
+ }
+}
+
+static void sub_80F60F0(u8 taskId)
+{
+ s16 var0;
+
+ if (gUnknown_0203A034->unk0->unk4 == 0)
+ {
+ if (++gTasks[taskId].data[1] == 21)
+ {
+ gTasks[taskId].data[1] = 0;
+ var0 = sub_80F6B78(gText_Round2Results, gUnknown_0203A034->unk0->unk0);
+ sub_80F6E9C(var0, 144, -1, 1088);
+ }
+ }
+ else if (gUnknown_0203A034->unk0->unk4 == 2)
+ {
+ gTasks[taskId].func = sub_80F616C;
+ }
+}
+
+static void sub_80F616C(u8 taskId)
+{
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (!gUnknown_0203A034->unk0->unkA)
+ {
+ sub_80F7A80(1, gTasks[taskId].data[2]++);
+ if (!gUnknown_0203A034->unk0->unk14)
+ gTasks[taskId].data[0] = 2;
+ else
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (!gUnknown_0203A034->unk0->unk14)
+ gTasks[taskId].data[0] = 0;
+ break;
+ case 2:
+ sub_80F6EF4(1088);
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].func = sub_80F6204;
+ break;
+ }
+}
+
+static void sub_80F6204(u8 taskId)
+{
+ int i;
+ u8 newTaskId;
+ u8 buffer[100];
+ s16 var0;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (!gUnknown_0203A034->unk0->unk4)
+ gTasks[taskId].data[0]++;
+ break;
+ case 1:
+ if (++gTasks[taskId].data[1] == 31)
+ {
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 2:
+ for (i = 0; i < 4; i++)
+ {
+ newTaskId = CreateTask(sub_80F73DC, 10);
+ gTasks[newTaskId].data[0] = gContestFinalStandings[i];
+ gTasks[newTaskId].data[1] = i;
+ }
+ gTasks[taskId].data[0]++;
+ break;
+ case 3:
+ if (gUnknown_0203A034->unk0->unk5 == 4)
+ {
+ if (++gTasks[taskId].data[1] == 31)
+ {
+ gTasks[taskId].data[1] = 0;
+ CreateTask(sub_80F74BC, 10);
+ gTasks[taskId].data[0]++;
+ for (i = 0; i < 4 && gContestFinalStandings[i] != 0; i++)
+ ;
+
+ sub_80F77E0(i, 14);
+ }
+ }
+ break;
+ case 4:
+ if (++gTasks[taskId].data[1] == 21)
+ {
+ gTasks[taskId].data[1] = 0;
+ for (i = 0; i < 4 && gContestFinalStandings[i] != 0; i++)
+ ;
+
+ StringCopy(gStringVar1, gContestMons[i].trainerName);
+ sub_81DB5AC(gStringVar1);
+ StringCopy(gStringVar2, gContestMons[i].nickname);
+ StringExpandPlaceholders(buffer, gText_Var1sVar2Won);
+ var0 = sub_80F6B78(buffer, gUnknown_0203A034->unk0->unk0);
+ sub_80F6E9C(var0, 144, -1, 1088);
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 5:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].func = sub_80F6404;
+ break;
+ }
+}
+
+static void sub_80F6404(u8 taskId)
+{
+ int i;
+ u8 spriteId;
+ u16 species;
+ u32 otId;
+ u32 personality;
+ const struct CompressedSpritePalette *pokePal;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ gBattle_WIN0H = 0x00F0;
+ gBattle_WIN0V = 0x5050;
+ for (i = 0; i < 4 && gContestFinalStandings[i] != 0; i++)
+ ;
+
+ species = gContestMons[i].species;
+ personality = gContestMons[i].personality;
+ otId = gContestMons[i].otId;
+ if (i == gContestPlayerMonIndex)
+ {
+ HandleLoadSpecialPokePic_2(
+ &gMonFrontPicTable[species],
+ gMonSpritesGfxPtr->sprites[1],
+ species,
+ personality);
+ }
+ else
+ {
+ HandleLoadSpecialPokePic_DontHandleDeoxys(
+ &gMonFrontPicTable[species],
+ gMonSpritesGfxPtr->sprites[1],
+ species,
+ personality);
+ }
+
+ pokePal = GetMonSpritePalStructFromOtIdPersonality(species, otId, personality);
+ LoadCompressedSpritePalette(pokePal);
+ SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_OPPONENT_LEFT);
+ gMultiuseSpriteTemplate.paletteTag = pokePal->tag;
+ spriteId = CreateSprite(&gMultiuseSpriteTemplate, 272, 80, 10);
+ gSprites[spriteId].data[1] = species;
+ gSprites[spriteId].oam.priority = 0;
+ gSprites[spriteId].callback = sub_80F75A8;
+ gUnknown_0203A034->unk0->spriteId = spriteId;
+ LoadCompressedSpriteSheet(gUnknown_0858D878);
+ LoadCompressedSpritePalette(gUnknown_0858D880);
+ CreateTask(sub_80F7670, 10);
+ gTasks[taskId].data[0]++;
+ break;
+ case 1:
+ if (++gTasks[taskId].data[3] == 1)
+ {
+ u8 counter;
+ gTasks[taskId].data[3] = 0;
+ gTasks[taskId].data[2] += 2;
+ if (gTasks[taskId].data[2] > 32)
+ gTasks[taskId].data[2] = 32;
+
+ counter = gTasks[taskId].data[2];
+ gBattle_WIN0V = ((80 - counter) << 8) | (80 + counter);
+ if (counter == 32)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 2:
+ if (gUnknown_0203A034->unk0->unk6 == 1)
+ gTasks[taskId].data[0]++;
+ break;
+ case 3:
+ if (++gTasks[taskId].data[1] == 121)
+ {
+ gTasks[taskId].data[1] = 0;
+ gSprites[gUnknown_0203A034->unk0->spriteId].callback = sub_80F7620;
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 4:
+ if (gUnknown_0203A034->unk0->unk6 == 2)
+ {
+ u8 top = (gBattle_WIN0V >> 8);
+ top += 2;
+ if (top > 80)
+ top = 80;
+
+ gBattle_WIN0V = (top << 8) | (160 - top);;
+ if (top == 80)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 5:
+ if (gUnknown_0203A034->unk0->unk6 == 2)
+ {
+ gUnknown_0203A034->unk0->unk9 = 1;
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].func = sub_80F66B4;
+ }
+ break;
+ }
+}
+
+static void sub_80F66B4(u8 taskId)
+{
+ int i;
+ u16 nationalDexNum;
+
+ if (gMain.newKeys & A_BUTTON)
+ {
+ if (!(gIsLinkContest & 0x1))
+ {
+ for (i = 0; i < 4; i++)
+ {
+ nationalDexNum = SpeciesToNationalPokedexNum(gContestMons[i].species);
+ GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN);
+ }
+ }
+
+ gTasks[taskId].data[10] = 0;
+ gTasks[taskId].func = sub_80F671C;
+ }
+}
+
+static void sub_80F671C(u8 taskId)
+{
+ if (gIsLinkContest & 0x1)
+ {
+ if (!gTasks[taskId].data[10])
+ {
+ sub_80F707C(gText_CommunicationStandby);
+ sub_800AC34();
+ gTasks[taskId].func = sub_80F677C;
+ }
+ }
+ else
+ {
+ gTasks[taskId].func = sub_80F67C4;
+ }
+}
+
+static void sub_80F677C(u8 taskId)
+{
+ if (!gReceivedRemoteLinkPlayers)
+ {
+ if (gIsLinkContest & 0x2)
+ sub_800E084();
+
+ sub_80F7144();
+ gTasks[taskId].func = sub_80F67C4;
+ }
+}
+
+static void sub_80F67C4(u8 taskId)
+{
+ if (!(gIsLinkContest & 0x1))
+ BravoTrainerPokemonProfile_BeforeInterview2(gContestFinalStandings[gContestPlayerMonIndex]);
+
+ BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0);
+ gTasks[taskId].func = sub_80F6820;
+}
+
+static void sub_80F6820(u8 taskId)
+{
+ if (!gPaletteFade.active)
+ {
+ if (gTasks[taskId].data[1] == 0)
+ {
+ DestroyTask(gUnknown_0203A034->unk0->unk3);
+ BlendPalettes(0x0000FFFF, 16, RGB_BLACK);
+ gTasks[taskId].data[1]++;
+ }
+ else if (gTasks[taskId].data[1] == 1)
+ {
+ BlendPalettes(0xFFFF0000, 16, RGB_BLACK);
+ gTasks[taskId].data[1]++;
+ }
+ else
+ {
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDY, 0);
+ DestroyTask(taskId);
+ FreeAllWindowBuffers();
+ SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
+ sub_80F7E64();
+ }
+ }
+}
+
+static void sub_80F68B4(u8 taskId)
+{
+ gBattle_BG3_X += 2;
+ gBattle_BG3_Y += 1;
+ if (gBattle_BG3_X > 255)
+ gBattle_BG3_X -= 255;
+ if (gBattle_BG3_Y > 255)
+ gBattle_BG3_Y -= 255;
+}
+
+static void sub_80F68F0(u8 taskId)
+{
+ if (++gTasks[taskId].data[0] == 2)
+ {
+ gTasks[taskId].data[0] = 0;
+ if (gTasks[taskId].data[2] == 0)
+ gTasks[taskId].data[1]++;
+ else
+ gTasks[taskId].data[1]--;
+
+ if (gTasks[taskId].data[1] == 16)
+ gTasks[taskId].data[2] = 1;
+ else if (gTasks[taskId].data[1] == 0)
+ gTasks[taskId].data[2] = 0;
+
+ BlendPalette(0x6B, 1, gTasks[taskId].data[1], RGB(30, 22, 11));
+ BlendPalette(0x68, 1, gTasks[taskId].data[1], RGB_WHITE);
+ BlendPalette(0x6E, 1, gTasks[taskId].data[1], RGB(30, 29, 29));
+ }
+
+ if (gTasks[taskId].data[1] == 0)
+ gUnknown_0203A034->unk0->unkA = 0;
+ else
+ gUnknown_0203A034->unk0->unkA = 1;
+}
+
+void sub_80F69B8(u16 species, u8 monIndex, u8 arg2, u8 arg3, u32 personality)
+{
+ u8 frameNum;
+ const u8 *iconPtr;
+ u16 var0;
+ u16 var1;
+
+ u8 *contestPlayerMonIndex = &gContestPlayerMonIndex; // fake match
+ frameNum = (monIndex == *contestPlayerMonIndex) ? 1 : 0;
+
+ iconPtr = GetMonIconPtr(species, personality, frameNum);
+ iconPtr += arg2 * 0x200 + 0x80;
+ if (arg3)
+ {
+ RequestDma3Copy(iconPtr, (void *)BG_CHAR_ADDR(1) + monIndex * 0x200, 0x180, 1);
+ var0 = ((monIndex + 10) << 12);
+ var1 = (monIndex * 0x10 + 0x200);
+ WriteSequenceToBgTilemapBuffer(1, var1 | var0, 3, monIndex * 3 + 4, 4, 3, 17, 1);
+ }
+ else
+ {
+ RequestDma3Copy(iconPtr, (void *)BG_CHAR_ADDR(1) + monIndex * 0x200, 0x180, 1);
+ }
+}
+
+static void sub_80F6A64(u8 arg0, u8 arg1)
+{
+ int i;
+
+ for (i = 0; i < 4; i++)
+ sub_80F69B8(gContestMons[i].species, i, arg0, arg1, gContestMons[i].personality);
+}
+
+static void sub_80F6A9C(void)
+{
+ int i;
+ register u16 species asm("r0");
+
+ for (i = 0; i < 4; i++)
+ {
+ species = GetIconSpecies(gContestMons[i].species, 0);
+ LoadPalette(gMonIconPalettes[gMonIconPaletteIndices[species]], i * 0x10 + 0xA0, 0x20);
+ }
+}
+
+static void sub_80F6AE8(void)
+{
+ u16 sheet;
+ u8 spriteId;
+
+ if (gIsLinkContest & 0x2)
+ {
+ sub_800E0E8();
+ CreateWirelessStatusIndicatorSprite(8, 8);
+ gSprites[gWirelessStatusIndicatorSpriteId].subpriority = 1;
+ sheet = LoadSpriteSheet(&gUnknown_0858D8E0);
+ RequestDma3Fill(0xFFFFFFFF, (void *)BG_CHAR_ADDR(4) + sheet * 0x20, 0x80, 1);
+ spriteId = CreateSprite(&gSpriteTemplate_858D8C8, 8, 8, 0);
+ gSprites[spriteId].oam.objMode = ST_OAM_OBJ_WINDOW;
+ }
+}
+
+// s16 sub_80F6B78(const u8 *text, u8 spriteId)
+// {
+// int i;
+// int origWidth, strWidth;
+// const u8 *r8;
+// u8 sp10[0x10];
+// struct WindowTemplate windowTemplate;
+// int spC;
+// u8 *windowTileData;
+// u8 windowId;
+
+// memset(windowTemplate, 0, sizeof(*windowTemplate));
+// windowTemplate.width = 30;
+// windowTemplate.height = 2;
+// windowId = AddWindow(&windowTemplate);
+// FillWindowPixelBuffer(windowId, 0x11);
+// origWidth = GetStringWidth(1, text, 0) + 9;
+// strWidth = origWidth;
+// if (strWidth < 0)
+// strWidth += 7;
+
+// strWidth >>= 3;
+// if (strWidth > 30)
+// strWidth = 30;
+
+// AddTextPrinterParameterized3(windowId, 1, (strWidth * 8 - origWidth) / 2, 1, gUnknown_0858D8E8, -1, text);
+// windowTileData = (u8 *)GetWindowAttribute(windowId, WINDOW_TILE_DATA);
+// r8 = gUnknown_0858D6D0;
+// // ....
+// }
+
+NAKED
+s16 sub_80F6B78(const u8 *text, u8 spriteId)
+{
+ asm_unified("\n\
+ push {r4-r7,lr}\n\
+ mov r7, r10\n\
+ mov r6, r9\n\
+ mov r5, r8\n\
+ push {r5-r7}\n\
+ sub sp, 0x44\n\
+ adds r5, r0, 0\n\
+ lsls r1, 24\n\
+ lsrs r7, r1, 24\n\
+ add r4, sp, 0x20\n\
+ adds r0, r4, 0\n\
+ movs r1, 0\n\
+ movs r2, 0x8\n\
+ bl memset\n\
+ movs r0, 0x1E\n\
+ strb r0, [r4, 0x3]\n\
+ movs r0, 0x2\n\
+ strb r0, [r4, 0x4]\n\
+ adds r0, r4, 0\n\
+ bl AddWindow\n\
+ lsls r6, r0, 24\n\
+ lsrs r4, r6, 24\n\
+ adds r0, r4, 0\n\
+ movs r1, 0x11\n\
+ bl FillWindowPixelBuffer\n\
+ movs r0, 0x1\n\
+ adds r1, r5, 0\n\
+ movs r2, 0\n\
+ bl GetStringWidth\n\
+ adds r2, r0, 0\n\
+ adds r2, 0x9\n\
+ cmp r2, 0\n\
+ bge _080F6BC4\n\
+ adds r2, 0x7\n\
+_080F6BC4:\n\
+ asrs r2, 3\n\
+ mov r10, r2\n\
+ cmp r2, 0x1E\n\
+ ble _080F6BD0\n\
+ movs r1, 0x1E\n\
+ mov r10, r1\n\
+_080F6BD0:\n\
+ mov r1, r10\n\
+ lsls r2, r1, 3\n\
+ subs r2, r0\n\
+ lsrs r0, r2, 31\n\
+ adds r2, r0\n\
+ asrs r2, 1\n\
+ lsls r2, 24\n\
+ lsrs r2, 24\n\
+ ldr r0, =gUnknown_0858D8E8\n\
+ str r0, [sp]\n\
+ movs r0, 0x1\n\
+ negs r0, r0\n\
+ str r0, [sp, 0x4]\n\
+ str r5, [sp, 0x8]\n\
+ adds r0, r4, 0\n\
+ movs r1, 0x1\n\
+ movs r3, 0x1\n\
+ bl AddTextPrinterParameterized3\n\
+ adds r0, r4, 0\n\
+ movs r1, 0x7\n\
+ bl GetWindowAttribute\n\
+ mov r9, r0\n\
+ ldr r2, =gUnknown_0858D6D0\n\
+ mov r8, r2\n\
+ lsls r1, r7, 4\n\
+ adds r1, r7\n\
+ lsls r1, 2\n\
+ ldr r3, =gSprites\n\
+ adds r1, r3\n\
+ ldrh r0, [r1, 0x4]\n\
+ lsls r0, 22\n\
+ lsrs r0, 17\n\
+ ldr r2, =0x06010000\n\
+ adds r0, r2\n\
+ str r0, [sp, 0xC]\n\
+ str r6, [sp, 0x38]\n\
+ mov r7, sp\n\
+ adds r7, 0x1C\n\
+ str r7, [sp, 0x2C]\n\
+ mov r0, r10\n\
+ adds r0, 0x2\n\
+ str r0, [sp, 0x30]\n\
+ movs r5, 0\n\
+ add r7, sp, 0x10\n\
+ mov r12, r7\n\
+ adds r6, r1, 0\n\
+ adds r6, 0x2E\n\
+ movs r4, 0x2\n\
+_080F6C34:\n\
+ adds r0, r6, r5\n\
+ movs r7, 0\n\
+ ldrsh r1, [r0, r7]\n\
+ lsls r0, r1, 4\n\
+ adds r0, r1\n\
+ lsls r0, 2\n\
+ adds r0, r3\n\
+ ldrh r0, [r0, 0x4]\n\
+ lsls r0, 22\n\
+ lsrs r0, 17\n\
+ adds r0, r2\n\
+ mov r1, r12\n\
+ adds r1, 0x4\n\
+ mov r12, r1\n\
+ subs r1, 0x4\n\
+ stm r1!, {r0}\n\
+ adds r5, 0x2\n\
+ subs r4, 0x1\n\
+ cmp r4, 0\n\
+ bge _080F6C34\n\
+ mov r7, r8\n\
+ adds r7, 0x80\n\
+ mov r2, r8\n\
+ adds r2, 0x40\n\
+ str r2, [sp, 0x28]\n\
+ mov r0, r8\n\
+ adds r0, 0x20\n\
+ str r0, [sp, 0x3C]\n\
+ mov r1, r8\n\
+ adds r1, 0xA0\n\
+ str r1, [sp, 0x40]\n\
+ adds r2, 0x20\n\
+ str r2, [sp, 0x34]\n\
+ add r5, sp, 0xC\n\
+ movs r6, 0\n\
+ movs r4, 0x3\n\
+_080F6C7C:\n\
+ str r6, [sp, 0x1C]\n\
+ ldm r5!, {r1}\n\
+ ldr r0, [sp, 0x2C]\n\
+ ldr r2, =0x05000100\n\
+ bl CpuSet\n\
+ subs r4, 0x1\n\
+ cmp r4, 0\n\
+ bge _080F6C7C\n\
+ ldr r5, [sp, 0xC]\n\
+ ldr r6, =0x04000008\n\
+ mov r0, r8\n\
+ adds r1, r5, 0\n\
+ adds r2, r6, 0\n\
+ bl CpuSet\n\
+ movs r0, 0x80\n\
+ lsls r0, 1\n\
+ adds r1, r5, r0\n\
+ adds r0, r7, 0\n\
+ adds r2, r6, 0\n\
+ bl CpuSet\n\
+ movs r2, 0x80\n\
+ lsls r2, 2\n\
+ adds r1, r5, r2\n\
+ adds r0, r7, 0\n\
+ adds r2, r6, 0\n\
+ bl CpuSet\n\
+ movs r7, 0xC0\n\
+ lsls r7, 2\n\
+ adds r1, r5, r7\n\
+ ldr r0, [sp, 0x28]\n\
+ adds r2, r6, 0\n\
+ bl CpuSet\n\
+ movs r4, 0\n\
+ cmp r4, r10\n\
+ bge _080F6D32\n\
+ adds r7, r6, 0\n\
+_080F6CCE:\n\
+ adds r6, r4, 0x1\n\
+ adds r0, r6, 0\n\
+ cmp r6, 0\n\
+ bge _080F6CDA\n\
+ adds r0, r4, 0\n\
+ adds r0, 0x8\n\
+_080F6CDA:\n\
+ asrs r0, 3\n\
+ lsls r1, r0, 2\n\
+ add r1, sp\n\
+ adds r1, 0xC\n\
+ lsls r0, 3\n\
+ subs r0, r6, r0\n\
+ lsls r0, 5\n\
+ ldr r1, [r1]\n\
+ adds r5, r1, r0\n\
+ mov r0, r8\n\
+ adds r0, 0xC0\n\
+ adds r1, r5, 0\n\
+ adds r2, r7, 0\n\
+ bl CpuSet\n\
+ movs r0, 0x80\n\
+ lsls r0, 1\n\
+ adds r1, r5, r0\n\
+ mov r0, r9\n\
+ adds r2, r7, 0\n\
+ bl CpuSet\n\
+ movs r0, 0xF0\n\
+ lsls r0, 2\n\
+ add r0, r9\n\
+ movs r2, 0x80\n\
+ lsls r2, 2\n\
+ adds r1, r5, r2\n\
+ adds r2, r7, 0\n\
+ bl CpuSet\n\
+ movs r0, 0xC0\n\
+ lsls r0, 2\n\
+ adds r1, r5, r0\n\
+ mov r0, r8\n\
+ adds r0, 0xE0\n\
+ adds r2, r7, 0\n\
+ bl CpuSet\n\
+ movs r1, 0x20\n\
+ add r9, r1\n\
+ adds r4, r6, 0\n\
+ cmp r4, r10\n\
+ blt _080F6CCE\n\
+_080F6D32:\n\
+ adds r2, r4, 0x1\n\
+ adds r0, r2, 0\n\
+ cmp r2, 0\n\
+ bge _080F6D3E\n\
+ adds r0, r4, 0\n\
+ adds r0, 0x8\n\
+_080F6D3E:\n\
+ asrs r0, 3\n\
+ lsls r1, r0, 2\n\
+ add r1, sp\n\
+ adds r1, 0xC\n\
+ lsls r0, 3\n\
+ subs r0, r2, r0\n\
+ lsls r0, 5\n\
+ ldr r1, [r1]\n\
+ adds r5, r1, r0\n\
+ ldr r4, =0x04000008\n\
+ ldr r0, [sp, 0x3C]\n\
+ adds r1, r5, 0\n\
+ adds r2, r4, 0\n\
+ bl CpuSet\n\
+ movs r2, 0x80\n\
+ lsls r2, 1\n\
+ adds r1, r5, r2\n\
+ ldr r0, [sp, 0x40]\n\
+ adds r2, r4, 0\n\
+ bl CpuSet\n\
+ movs r7, 0x80\n\
+ lsls r7, 2\n\
+ adds r1, r5, r7\n\
+ ldr r0, [sp, 0x40]\n\
+ adds r2, r4, 0\n\
+ bl CpuSet\n\
+ movs r0, 0xC0\n\
+ lsls r0, 2\n\
+ adds r1, r5, r0\n\
+ ldr r0, [sp, 0x34]\n\
+ adds r2, r4, 0\n\
+ bl CpuSet\n\
+ ldr r1, [sp, 0x38]\n\
+ lsrs r0, r1, 24\n\
+ bl RemoveWindow\n\
+ ldr r2, [sp, 0x30]\n\
+ lsls r1, r2, 3\n\
+ movs r0, 0xF0\n\
+ subs r0, r1\n\
+ asrs r0, 1\n\
+ add sp, 0x44\n\
+ pop {r3-r5}\n\
+ mov r8, r3\n\
+ mov r9, r4\n\
+ mov r10, r5\n\
+ pop {r4-r7}\n\
+ pop {r1}\n\
+ bx r1\n\
+ .pool");
+}
+
+static void sub_80F6DC0(void)
+{
+ int i;
+ struct SpriteTemplate template;
+ u8 spriteIds[8];
+
+ template = gSpriteTemplate_858D7F8;
+ for (i = 0; i < 8; i++)
+ LoadSpriteSheet(&gUnknown_0858D810[i]);
+
+ LoadSpritePalette(&gUnknown_0858D850);
+ for (i = 0; i < 8; i++)
+ {
+ spriteIds[i] = CreateSprite(&template, 272, 144, 10);
+ template.tileTag++;
+ }
+
+ gSprites[spriteIds[0]].data[0] = spriteIds[1];
+ gSprites[spriteIds[0]].data[1] = spriteIds[2];
+ gSprites[spriteIds[0]].data[2] = spriteIds[3];
+
+ gSprites[spriteIds[4]].data[0] = spriteIds[5];
+ gSprites[spriteIds[4]].data[1] = spriteIds[6];
+ gSprites[spriteIds[4]].data[2] = spriteIds[7];
+
+ gUnknown_0203A034->unk0->unk0 = spriteIds[0];
+ gUnknown_0203A034->unk0->unk4 = 0;
+ gUnknown_0203A034->unk0->unk1 = spriteIds[4];
+ sub_80F7144();
+}
+
+static void sub_80F6E9C(s16 arg0, u16 y, u16 arg2, u16 arg3)
+{
+ struct Sprite *sprite = &gSprites[gUnknown_0203A034->unk0->unk0];
+ sprite->pos1.x = 272;
+ sprite->pos1.y = y;
+ sprite->pos2.x = 0;
+ sprite->pos2.y = 0;
+ sprite->data[4] = arg0 + 32;
+ sprite->data[5] = arg2;
+ sprite->data[6] = arg3;
+ sprite->data[7] = 0;
+ sprite->callback = sub_80F6F68;
+ gUnknown_0203A034->unk0->unk4 = 1;
+}
+
+static void sub_80F6EF4(u16 arg0)
+{
+ struct Sprite *sprite = &gSprites[gUnknown_0203A034->unk0->unk0];
+ sprite->pos1.x += sprite->pos2.x;
+ sprite->pos1.y += sprite->pos2.y;
+ sprite->pos2.y = 0;
+ sprite->pos2.x = 0;
+ sprite->data[6] = arg0;
+ sprite->data[7] = 0;
+ sprite->callback = sub_80F7014;
+ gUnknown_0203A034->unk0->unk4 = 3;
+}
+
+static void sub_80F6F40(struct Sprite *sprite)
+{
+ sprite->pos1.x = 272;
+ sprite->pos1.y = 144;
+ sprite->pos2.y = 0;
+ sprite->pos2.x = 0;
+ sprite->callback = SpriteCallbackDummy;
+ gUnknown_0203A034->unk0->unk4 = 0;
+}
+
+static void sub_80F6F68(struct Sprite *sprite)
+{
+ int i;
+ s16 var0;
+
+ var0 = (u16)sprite->data[7] + (u16)sprite->data[6];
+ sprite->pos1.x -= var0 >> 8;
+ sprite->data[7] = (sprite->data[6] + sprite->data[7]) & 0xFF;
+ if (sprite->pos1.x < sprite->data[4])
+ sprite->pos1.x = sprite->data[4];
+
+ for (i = 0; i < 3; i++)
+ {
+ struct Sprite *sprite2 = &gSprites[sprite->data[i]];
+ sprite2->pos1.x = sprite->pos1.x + sprite->pos2.x + (i + 1) * 64;
+ }
+
+ if (sprite->pos1.x == sprite->data[4])
+ sprite->callback = sub_80F6FDC;
+}
+
+static void sub_80F6FDC(struct Sprite *sprite)
+{
+ gUnknown_0203A034->unk0->unk4 = 2;
+ if ((u16)sprite->data[5] != 0xFFFF)
+ {
+ if (--sprite->data[5] == -1)
+ sub_80F6EF4(sprite->data[6]);
+ }
+}
+
+static void sub_80F7014(struct Sprite *sprite)
+{
+ int i;
+ s16 var0;
+
+ var0 = (u16)sprite->data[7] + (u16)sprite->data[6];
+ sprite->pos1.x -= var0 >> 8;
+ sprite->data[7] = (sprite->data[6] + sprite->data[7]) & 0xFF;
+ for (i = 0; i < 3; i++)
+ {
+ struct Sprite *sprite2 = &gSprites[sprite->data[i]];
+ sprite2->pos1.x = sprite->pos1.x + sprite->pos2.x + (i + 1) * 64;
+ }
+
+ if (sprite->pos1.x + sprite->pos2.x < -224)
+ sub_80F6F40(sprite);
+}
+
+static void sub_80F707C(const u8 *text)
+{
+ int i;
+ u16 x;
+ struct Sprite *sprite;
+
+ x = sub_80F6B78(text, gUnknown_0203A034->unk0->unk1);
+ sprite = &gSprites[gUnknown_0203A034->unk0->unk1];
+ sprite->pos1.x = x + 32;
+ sprite->pos1.y = 80;
+ sprite->invisible = 0;
+ for (i = 0; i < 3; i++)
+ {
+ gSprites[sprite->data[i]].pos1.x = sprite->pos1.x + sprite->pos2.x + (i + 1) * 64;
+ gSprites[sprite->data[i]].pos1.y = sprite->pos1.y;
+ gSprites[sprite->data[i]].invisible = 0;
+ }
+
+ gBattle_WIN0H = 0x00F0;
+ gBattle_WIN0V = ((sprite->pos1.y - 16) << 8) | (sprite->pos1.y + 16);
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR
+ | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR);
+}
+
+static void sub_80F7144(void)
+{
+ int i;
+ struct Sprite *sprite;
+
+ sprite = &gSprites[gUnknown_0203A034->unk0->unk1];
+ sprite->invisible = 1;
+ for (i = 0; i < 3; i++)
+ gSprites[sprite->data[i]].invisible = 1;
+
+ gBattle_WIN0H = 0;
+ gBattle_WIN0V = 0;
+ SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H);
+ SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V);
+ SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
+ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
+}
+
+static void sub_80F71C8(void)
+{
+ u8 palette;
+ int x, y;
+
+ x = 5;
+ y = 1;
+ if (gIsLinkContest & 0x1)
+ {
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC6498, 5, 1, 5, 2);
+ x = 10;
+ }
+ else if (gSpecialVar_ContestRank == 0)
+ {
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC63F8, 5, 1, 10, 2);
+ x = 15;
+ }
+ else if (gSpecialVar_ContestRank == 1)
+ {
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC6420, 5, 1, 10, 2);
+ x = 15;
+ }
+ else if (gSpecialVar_ContestRank == 2)
+ {
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC6448, 5, 1, 10, 2);
+ x = 15;
+ }
+ else
+ {
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC6470, 5, 1, 10, 2);
+ x = 15;
+ }
+
+ if (gSpecialVar_ContestCategory == 0)
+ {
+ palette = 0;
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC64AC, x, y, 5, 2);
+ }
+ else if (gSpecialVar_ContestCategory == 1)
+ {
+ palette = 1;
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC64C0, x, y, 5, 2);
+ }
+ else if (gSpecialVar_ContestCategory == 2)
+ {
+ palette = 2;
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC64D4, x, y, 5, 2);
+ }
+ else if (gSpecialVar_ContestCategory == 3)
+ {
+ palette = 3;
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC64E8, x, y, 5, 2);
+ }
+ else
+ {
+ palette = 4;
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC64FC, x, y, 5, 2);
+ }
+
+ x += 5;
+ CopyToBgTilemapBufferRect(2, gUnknown_08DC6510, x, y, 6, 2);
+ CopyToBgTilemapBufferRect_ChangePalette(2, gUnknown_0203A034->unkC[2], 0, 0, 32, 4, palette);
+}
+
+// fakematching?
+u8 sub_80F7310(u8 monIndex, u8 arg1)
+{
+ u32 var0;
+ u32 var1;
+
+ var0 = gContestMonConditions[monIndex] << 16;
+ var1 = var0 / 0x3F;
+ if (var1 & 0xFFFF)
+ var1 += 0x10000;
+
+ var1 >>= 16;
+ if (var1 == 0 && var0)
+ var1 = 1;
+
+ if (arg1 && var1 > 10)
+ var1 = 10;
+
+ return var1;
+}
diff --git a/src/contest_link_80FC4F4.c b/src/contest_link_80FC4F4.c
new file mode 100644
index 000000000..f582626f8
--- /dev/null
+++ b/src/contest_link_80FC4F4.c
@@ -0,0 +1,548 @@
+#include "global.h"
+#include "contest.h"
+#include "decompress.h"
+#include "event_data.h"
+#include "link.h"
+#include "pokemon.h"
+#include "random.h"
+#include "task.h"
+#include "constants/flags.h"
+
+static void sub_80FC5C0(u8);
+static void sub_80FC5DC(u8);
+
+bool32 sub_80FC4F4(void *src, u16 size)
+{
+ memcpy(gDecompressionBuffer, src, size);
+ if (SendBlock(bitmask_all_link_players_but_self(), gDecompressionBuffer, size))
+ return TRUE;
+ else
+ return FALSE;
+}
+
+bool8 sub_80FC530(u8 arg0)
+{
+ u8 mask = (1 << arg0);
+ if (!(GetBlockReceivedStatus() & mask))
+ {
+ return FALSE;
+ }
+ else
+ {
+ ResetBlockReceivedFlag(arg0);
+ return TRUE;
+ }
+}
+
+bool8 sub_80FC55C(void)
+{
+ if (GetBlockReceivedStatus() == sub_800A9D8())
+ {
+ ResetBlockReceivedFlags();
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
+void sub_80FC580(u8 taskId)
+{
+ u8 i;
+
+ for (i = 0; i < 4; i++)
+ gBlockRecvBuffer[i][0] = 0xFF;
+
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].func = sub_80FC5C0;
+}
+
+static void sub_80FC5C0(u8 taskId)
+{
+ gTasks[taskId].func = sub_80FC5DC;
+}
+
+static void sub_80FC5DC(u8 taskId)
+{
+ int i;
+
+ if (!gReceivedRemoteLinkPlayers)
+ return;
+
+ gContestPlayerMonIndex = GetMultiplayerId();
+ gNumLinkContestPlayers = GetLinkPlayerCount();
+ gIsLinkContest = 1;
+ if (gWirelessCommType == 1)
+ gIsLinkContest = 3;
+
+ for (i = 0; i < gNumLinkContestPlayers && (u32)(gLinkPlayers[i].version & 0xFF) - 1 > VERSION_RUBY - 1; i++)
+ ;
+
+ if (i < gNumLinkContestPlayers)
+ gIsLinkContest |= 0x4;
+
+ SwitchTaskToFollowupFunc(taskId);
+}
+
+bool32 sub_80FC670(s16 *arg0)
+{
+ if (gIsLinkContest & 0x4)
+ return TRUE;
+
+ switch (*arg0)
+ {
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ sub_800ADF8();
+ (*arg0)++;
+ }
+ return FALSE;
+ case 1:
+ (*arg0)++;
+ return FALSE;
+ default:
+ if (IsLinkTaskFinished() != TRUE)
+ return FALSE;
+ else
+ return TRUE;
+ }
+}
+
+void sub_80FC6BC(u8 taskId)
+{
+ int i;
+
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (GetMultiplayerId() == 0)
+ {
+ if (IsLinkTaskFinished())
+ {
+ memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon));
+ gTasks[taskId].data[0] = 10;
+ }
+ }
+ else
+ {
+ memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon));
+ gTasks[taskId].data[0] = 1;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ {
+ memcpy(&gContestMons[i], gBlockRecvBuffer[i], sizeof(struct ContestPokemon));
+ sub_80DFA08(&gContestMons[i], gLinkPlayers[i].language);
+ }
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 10:
+ if (++gTasks[taskId].data[11] > 300)
+ {
+ sub_800A4D8(2);
+ gTasks[taskId].data[0] = 1;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[11] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FC804(u8 taskId)
+{
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (GetMultiplayerId() == 0)
+ {
+ if (IsLinkTaskFinished() && sub_80FC4F4(&gRngValue, sizeof(gRngValue)) == TRUE)
+ gTasks[taskId].data[0]++;
+ }
+ else
+ {
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC530(0))
+ {
+ memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue));
+ memcpy(&gContestRngValue, gBlockRecvBuffer[0], sizeof(gContestRngValue));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FC894(u8 taskId)
+{
+ int i;
+
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ gBlockSendBuffer[0] = gTasks[taskId].data[9];
+ if (GetMultiplayerId() == 0)
+ {
+ if (IsLinkTaskFinished())
+ gTasks[taskId].data[0] = 10;
+ }
+ else
+ {
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ gTasks[taskId].data[i + 1] = gBlockRecvBuffer[i][0];
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 10:
+ if (++gTasks[taskId].data[11] > 10)
+ {
+ sub_800A4D8(2);
+ gTasks[taskId].data[0] = 1;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[11] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FC998(u8 taskId)
+{
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(&gContestPlayerMonIndex, sizeof(gContestPlayerMonIndex)) == TRUE)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ gTasks[taskId].data[0]++;
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FC9F8(u8 taskId)
+{
+ int i;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(&gContestResources->field_4[gContestPlayerMonIndex].currMove, sizeof(gContestResources->field_4[gContestPlayerMonIndex].currMove)) == TRUE)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ gContestResources->field_4[i].currMove = gBlockRecvBuffer[i][0];
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FCACC(u8 taskId)
+{
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gUnknown_02039F08, sizeof(gUnknown_02039F08)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ memcpy(gUnknown_02039F08, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F08));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 2:
+ case 5:
+ case 8:
+ case 11:
+ if (gTasks[taskId].data[1]++ > 10)
+ {
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 3:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gUnknown_02039F10, sizeof(gUnknown_02039F10)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 4:
+ if (sub_80FC55C())
+ {
+ memcpy(gUnknown_02039F10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F10));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 6:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gUnknown_02039F18, sizeof(gUnknown_02039F18)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 7:
+ if (sub_80FC55C())
+ {
+ memcpy(gUnknown_02039F18, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F18));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 9:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gContestFinalStandings, sizeof(gContestFinalStandings)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 10:
+ if (sub_80FC55C())
+ {
+ memcpy(gContestFinalStandings, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestFinalStandings));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FCC88(u8 taskId)
+{
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gContestResources->field_4, 4 * sizeof(struct ContestantStatus)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ memcpy(gContestResources->field_4, gBlockRecvBuffer[gUnknown_02039F2B], 4 * sizeof(struct ContestantStatus));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 2:
+ case 5:
+ case 8:
+ case 11:
+ if (gTasks[taskId].data[1]++ > 10)
+ {
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 3:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gContestResources->field_8, sizeof(struct UnknownContestStruct7)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 4:
+ if (sub_80FC55C())
+ {
+ memcpy(gContestResources->field_8, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct7));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 6:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gContestResources->field_10, sizeof(struct UnknownContestStruct5)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 7:
+ if (sub_80FC55C())
+ {
+ memcpy(gContestResources->field_10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct5));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 9:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gUnknown_02039F26, sizeof(gUnknown_02039F26)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 10:
+ if (sub_80FC55C())
+ {
+ memcpy(gUnknown_02039F26, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F26));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FCE48(u8 taskId)
+{
+ int i;
+
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ gBlockSendBuffer[0] = 0x6E;
+ if (GetMultiplayerId() == 0)
+ {
+ if (IsLinkTaskFinished())
+ gTasks[taskId].data[0] = 10;
+ }
+ else
+ {
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ for (i = 0; i < 4; i++)
+ gTasks[taskId].data[i + 5] = gBlockRecvBuffer[i][0];
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 10:
+ if (++gTasks[taskId].data[11] > 10)
+ {
+ sub_800A4D8(2);
+ gTasks[taskId].data[0] = 1;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[11] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FCF40(u8 taskId)
+{
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gContestMonConditions, sizeof(gContestMonConditions)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ memcpy(gContestMonConditions, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonConditions));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
+
+void sub_80FCFD0(u8 taskId)
+{
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(gUnknown_02039F26, sizeof(gUnknown_02039F26)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ memcpy(gUnknown_02039F26, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F26));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ }
+}
diff --git a/src/contest_link_81D9DE4.c b/src/contest_link_81D9DE4.c
new file mode 100644
index 000000000..4b56c9c38
--- /dev/null
+++ b/src/contest_link_81D9DE4.c
@@ -0,0 +1,331 @@
+#include "global.h"
+#include "contest.h"
+#include "event_data.h"
+#include "link.h"
+#include "random.h"
+#include "task.h"
+
+static void sub_81D9F14(u8);
+static void sub_81D9F30(u8);
+static void sub_81D9F4C(u8);
+static void sub_81D9F68(u8);
+static void sub_81DA10C(u8);
+static void sub_81DA138(u8);
+static void sub_81DA160(u8);
+static void sub_81DA244(u8);
+static void sub_81DA2E8(u8);
+static void sub_81DA3B8(u8);
+static void sub_81DA488(u8);
+
+void sub_81D9DE4(u8 taskId)
+{
+ int gameCleared;
+
+ switch (gTasks[taskId].data[9])
+ {
+ case 0:
+ gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON);
+ break;
+ case 1:
+ gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON);
+ break;
+ case 2:
+ gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON);
+ break;
+ case 3:
+ gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON);
+ break;
+ case 4:
+ default:
+ gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON);
+ break;
+ }
+
+ gContestMons[gContestPlayerMonIndex].unk2C[0] = gHighestRibbonRank;
+ gameCleared = FlagGet(FLAG_SYS_GAME_CLEAR) > 0;
+ gContestMons[gContestPlayerMonIndex].unk2C[1] = gameCleared;
+ SetTaskFuncWithFollowupFunc(taskId, sub_81DA160, sub_81D9F14);
+}
+
+static void sub_81D9F14(u8 taskId)
+{
+ SetTaskFuncWithFollowupFunc(taskId, sub_81DA244, sub_81D9F30);
+}
+
+static void sub_81D9F30(u8 taskId)
+{
+ SetTaskFuncWithFollowupFunc(taskId, sub_81DA2E8, sub_81D9F4C);
+}
+
+static void sub_81D9F4C(u8 taskId)
+{
+ SetTaskFuncWithFollowupFunc(taskId, sub_81DA3B8, sub_81D9F68);
+}
+
+static void sub_81D9F68(u8 taskId)
+{
+ u8 i;
+ u8 rank;
+ int gameCleared;
+ u8 data1[4];
+ u8 data2[4];
+
+ memset(data1, 0, sizeof(data1));
+ memset(data2, 0, sizeof(data2));
+
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ data1[i] = gTasks[taskId].data[i + 1];
+
+ i = 0;
+ if (i < gNumLinkContestPlayers)
+ {
+ while (++i < gNumLinkContestPlayers)
+ {
+ if (data1[0] != data1[i])
+ break;
+ }
+ }
+
+ if (i == gNumLinkContestPlayers)
+ gSpecialVar_0x8004 = 0;
+ else
+ gSpecialVar_0x8004 = 1;
+
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ data2[i] = gTasks[taskId].data[i + 5];
+
+ if (gNumLinkContestPlayers != 4 && GetMultiplayerId() == 0)
+ {
+ rank = gContestMons[0].unk2C[0];
+ for (i = 1; i < gNumLinkContestPlayers; i++)
+ {
+ if (rank < gContestMons[i].unk2C[0])
+ rank = gContestMons[i].unk2C[0];
+ }
+
+ if (rank)
+ rank--;
+
+ gameCleared = 1;
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ {
+ if (!gContestMons[i].unk2C[1])
+ {
+ gameCleared = 0;
+ break;
+ }
+ }
+
+ sub_80DACBC(data1[0], rank, gameCleared);
+ }
+
+ gUnknown_02039F2B = sub_80F86E0(data2);
+ if (gNumLinkContestPlayers < 4)
+ SetTaskFuncWithFollowupFunc(taskId, sub_81DA488, sub_81DA10C);
+ else
+ gTasks[taskId].func = sub_81DA10C;
+}
+
+static void sub_81DA10C(u8 taskId)
+{
+ sub_80DB09C(gSpecialVar_ContestCategory);
+ SetTaskFuncWithFollowupFunc(taskId, sub_80FCF40, sub_81DA138);
+}
+
+static void sub_81DA138(u8 taskId)
+{
+ sub_80DCE58(0);
+ SetTaskFuncWithFollowupFunc(taskId, sub_80FCFD0, sub_80F8714);
+}
+
+static void sub_81DA160(u8 taskId)
+{
+ int i;
+
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ if (sub_80FC4F4(&gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ {
+ memcpy(&gContestMons[i], gBlockRecvBuffer[i], sizeof(struct ContestPokemon));
+ sub_80DFA08(&gContestMons[i], gLinkPlayers[i].language);
+ }
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ }
+}
+
+static void sub_81DA244(u8 taskId)
+{
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ case 0:
+ if (GetMultiplayerId() == 0)
+ {
+ if (!IsLinkTaskFinished())
+ return;
+
+ if (sub_80FC4F4(&gRngValue, sizeof(gRngValue)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ else
+ {
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC530(0))
+ {
+ memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue));
+ memcpy(&gContestRngValue, gBlockRecvBuffer[0], sizeof(gContestRngValue));
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ }
+}
+
+static void sub_81DA2E8(u8 taskId)
+{
+ int i;
+ u16 data[4];
+ u16 var0;
+
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ var0 = 0x6E;
+ if (sub_80FC4F4(&var0, sizeof(var0)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ {
+ data[i] = gBlockRecvBuffer[i][0];
+ gTasks[taskId].data[i + 5] = data[i];
+ }
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ }
+}
+
+static void sub_81DA3B8(u8 taskId)
+{
+ int i;
+ u16 data[4];
+ u16 var0;
+
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ case 0:
+ if (IsLinkTaskFinished())
+ {
+ var0 = gTasks[taskId].data[9];
+ if (sub_80FC4F4(&var0, sizeof(var0)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC55C())
+ {
+ for (i = 0; i < gNumLinkContestPlayers; i++)
+ {
+ data[i] = gBlockRecvBuffer[i][0];
+ gTasks[taskId].data[i + 1] = data[i];
+ }
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ }
+}
+
+static void sub_81DA488(u8 taskId)
+{
+ int i;
+
+ if (!sub_80FC670(&gTasks[taskId].data[12]))
+ return;
+
+ switch (gTasks[taskId].data[0])
+ {
+ default:
+ gTasks[taskId].data[0] = 0;
+ gTasks[taskId].data[12] = 0;
+ SwitchTaskToFollowupFunc(taskId);
+ break;
+ case 0:
+ if (GetMultiplayerId() == 0)
+ {
+ if (!IsLinkTaskFinished())
+ return;
+
+ if (sub_80FC4F4(&gContestMons[gNumLinkContestPlayers], (4 - gNumLinkContestPlayers) * sizeof(struct ContestPokemon)) == 1)
+ gTasks[taskId].data[0]++;
+ }
+ else
+ {
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ case 1:
+ if (sub_80FC530(0))
+ {
+ memcpy(&gContestMons[gNumLinkContestPlayers], gBlockRecvBuffer[0], (4 - gNumLinkContestPlayers) * sizeof(struct ContestPokemon));
+ for (i = gNumLinkContestPlayers; i < 4; i++)
+ sub_80DFA08(&gContestMons[i], gLinkPlayers[0].language);
+
+ gTasks[taskId].data[0]++;
+ }
+ break;
+ }
+}
diff --git a/src/contest_painting.c b/src/contest_painting.c
index 9de3d733d..0ed169a77 100644
--- a/src/contest_painting.c
+++ b/src/contest_painting.c
@@ -20,9 +20,6 @@
#include "window.h"
#include "constants/rgb.h"
-extern u8 gUnknown_02039F5C;
-extern u8 gUnknown_02039F5D;
-
extern u16 (*gUnknown_03006190)[][32];
extern struct ContestWinner *gUnknown_030061C0;
extern u16 *gContestPaintingMonPalette;
diff --git a/src/data/pokemon_graphics/back_pic_coordinates.h b/src/data/pokemon_graphics/back_pic_coordinates.h
index cdb28f8c3..0de0bfb52 100644
--- a/src/data/pokemon_graphics/back_pic_coordinates.h
+++ b/src/data/pokemon_graphics/back_pic_coordinates.h
@@ -4,2202 +4,2202 @@ const struct MonCoords gMonBackPicCoords[] =
{
[SPECIES_NONE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_BULBASAUR] =
{
- .coords = 0x64,
+ .size = 0x64,
.y_offset = 0x10,
},
[SPECIES_IVYSAUR] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_VENUSAUR] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_CHARMANDER] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0e,
},
[SPECIES_CHARMELEON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_CHARIZARD] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_SQUIRTLE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0e,
},
[SPECIES_WARTORTLE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_BLASTOISE] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_CATERPIE] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_METAPOD] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_BUTTERFREE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_WEEDLE] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_KAKUNA] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0a,
},
[SPECIES_BEEDRILL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_PIDGEY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_PIDGEOTTO] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0c,
},
[SPECIES_PIDGEOT] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x02,
},
[SPECIES_RATTATA] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_RATICATE] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0d,
},
[SPECIES_SPEAROW] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_FEAROW] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_EKANS] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_ARBOK] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_PIKACHU] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_RAICHU] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_SANDSHREW] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_SANDSLASH] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_NIDORAN_F] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_NIDORINA] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_NIDOQUEEN] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_NIDORAN_M] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x08,
},
[SPECIES_NIDORINO] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_NIDOKING] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_CLEFAIRY] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_CLEFABLE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_VULPIX] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_NINETALES] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_JIGGLYPUFF] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_WIGGLYTUFF] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_ZUBAT] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_GOLBAT] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_ODDISH] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_GLOOM] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_VILEPLUME] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_PARAS] =
{
- .coords = 0x63,
+ .size = 0x63,
.y_offset = 0x14,
},
[SPECIES_PARASECT] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_VENONAT] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_VENOMOTH] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_DIGLETT] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x10,
},
[SPECIES_DUGTRIO] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_MEOWTH] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_PERSIAN] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_PSYDUCK] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_GOLDUCK] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_MANKEY] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_PRIMEAPE] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_GROWLITHE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_ARCANINE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_POLIWAG] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x10,
},
[SPECIES_POLIWHIRL] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_POLIWRATH] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_ABRA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_KADABRA] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_ALAKAZAM] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x05,
},
[SPECIES_MACHOP] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_MACHOKE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_MACHAMP] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x04,
},
[SPECIES_BELLSPROUT] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_WEEPINBELL] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_VICTREEBEL] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_TENTACOOL] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_TENTACRUEL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_GEODUDE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_GRAVELER] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0c,
},
[SPECIES_GOLEM] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x10,
},
[SPECIES_PONYTA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_RAPIDASH] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_SLOWPOKE] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0e,
},
[SPECIES_SLOWBRO] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_MAGNEMITE] =
{
- .coords = 0x43,
+ .size = 0x43,
.y_offset = 0x14,
},
[SPECIES_MAGNETON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_FARFETCHD] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_DODUO] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_DODRIO] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_SEEL] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_DEWGONG] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_GRIMER] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0c,
},
[SPECIES_MUK] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_SHELLDER] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_CLOYSTER] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_GASTLY] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0e,
},
[SPECIES_HAUNTER] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_GENGAR] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_ONIX] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_DROWZEE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_HYPNO] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_KRABBY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_KINGLER] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_VOLTORB] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_ELECTRODE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_EXEGGCUTE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_EXEGGUTOR] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_CUBONE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_MAROWAK] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_HITMONLEE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_HITMONCHAN] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_LICKITUNG] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0e,
},
[SPECIES_KOFFING] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_WEEZING] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_RHYHORN] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0c,
},
[SPECIES_RHYDON] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_CHANSEY] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_TANGELA] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0e,
},
[SPECIES_KANGASKHAN] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_HORSEA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_SEADRA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_GOLDEEN] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_SEAKING] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_STARYU] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_STARMIE] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0e,
},
[SPECIES_MR_MIME] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_SCYTHER] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_JYNX] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_ELECTABUZZ] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_MAGMAR] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_PINSIR] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_TAUROS] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_MAGIKARP] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_GYARADOS] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_LAPRAS] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_DITTO] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x11,
},
[SPECIES_EEVEE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_VAPOREON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_JOLTEON] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_FLAREON] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x05,
},
[SPECIES_PORYGON] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_OMANYTE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_OMASTAR] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_KABUTO] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_KABUTOPS] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_AERODACTYL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_SNORLAX] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_ARTICUNO] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_ZAPDOS] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_MOLTRES] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_DRATINI] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_DRAGONAIR] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_DRAGONITE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_MEWTWO] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x01,
},
[SPECIES_MEW] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_CHIKORITA] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_BAYLEEF] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_MEGANIUM] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_CYNDAQUIL] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_QUILAVA] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_TYPHLOSION] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_TOTODILE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_CROCONAW] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_FERALIGATR] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_SENTRET] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x05,
},
[SPECIES_FURRET] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_HOOTHOOT] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_NOCTOWL] =
{
- .coords = 0x68,
+ .size = 0x68,
.y_offset = 0x03,
},
[SPECIES_LEDYBA] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_LEDIAN] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_SPINARAK] =
{
- .coords = 0x73,
+ .size = 0x73,
.y_offset = 0x15,
},
[SPECIES_ARIADOS] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_CROBAT] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_CHINCHOU] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_LANTURN] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_PICHU] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_CLEFFA] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0f,
},
[SPECIES_IGGLYBUFF] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_TOGEPI] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x10,
},
[SPECIES_TOGETIC] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_NATU] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x11,
},
[SPECIES_XATU] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_MAREEP] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_FLAAFFY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_AMPHAROS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_BELLOSSOM] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_MARILL] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0c,
},
[SPECIES_AZUMARILL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_SUDOWOODO] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_POLITOED] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_HOPPIP] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_SKIPLOOM] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_JUMPLUFF] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_AIPOM] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_SUNKERN] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_SUNFLORA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_YANMA] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_WOOPER] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0f,
},
[SPECIES_QUAGSIRE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_ESPEON] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_UMBREON] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_MURKROW] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_SLOWKING] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_MISDREAVUS] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_UNOWN] =
{
- .coords = 0x36,
+ .size = 0x36,
.y_offset = 0x08,
},
[SPECIES_WOBBUFFET] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0c,
},
[SPECIES_GIRAFARIG] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_PINECO] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0f,
},
[SPECIES_FORRETRESS] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x10,
},
[SPECIES_DUNSPARCE] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0f,
},
[SPECIES_GLIGAR] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_STEELIX] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SNUBBULL] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_GRANBULL] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_QWILFISH] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_SCIZOR] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_SHUCKLE] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_HERACROSS] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_SNEASEL] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_TEDDIURSA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_URSARING] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_SLUGMA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_MAGCARGO] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_SWINUB] =
{
- .coords = 0x63,
+ .size = 0x63,
.y_offset = 0x15,
},
[SPECIES_PILOSWINE] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0d,
},
[SPECIES_CORSOLA] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_REMORAID] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0d,
},
[SPECIES_OCTILLERY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_DELIBIRD] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_MANTINE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_SKARMORY] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_HOUNDOUR] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_HOUNDOOM] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_KINGDRA] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_PHANPY] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0e,
},
[SPECIES_DONPHAN] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_PORYGON2] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_STANTLER] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_SMEARGLE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_TYROGUE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_HITMONTOP] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_SMOOCHUM] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x09,
},
[SPECIES_ELEKID] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_MAGBY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_MILTANK] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_BLISSEY] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_RAIKOU] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_ENTEI] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_SUICUNE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_LARVITAR] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_PUPITAR] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x05,
},
[SPECIES_TYRANITAR] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_LUGIA] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_HO_OH] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_CELEBI] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_OLD_UNOWN_B] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_C] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_D] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_E] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_F] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_G] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_H] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_I] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_J] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_K] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_L] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_M] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_N] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_O] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_P] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_Q] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_R] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_S] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_T] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_U] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_V] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_W] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_X] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_Y] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_OLD_UNOWN_Z] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_TREECKO] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_GROVYLE] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_SCEPTILE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_TORCHIC] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x05,
},
[SPECIES_COMBUSKEN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_BLAZIKEN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_MUDKIP] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_MARSHTOMP] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_SWAMPERT] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_POOCHYENA] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_MIGHTYENA] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_ZIGZAGOON] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_LINOONE] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0f,
},
[SPECIES_WURMPLE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_SILCOON] =
{
- .coords = 0x83,
+ .size = 0x83,
.y_offset = 0x15,
},
[SPECIES_BEAUTIFLY] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CASCOON] =
{
- .coords = 0x73,
+ .size = 0x73,
.y_offset = 0x14,
},
[SPECIES_DUSTOX] =
{
- .coords = 0x83,
+ .size = 0x83,
.y_offset = 0x14,
},
[SPECIES_LOTAD] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0f,
},
[SPECIES_LOMBRE] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_LUDICOLO] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_SEEDOT] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_NUZLEAF] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_SHIFTRY] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_NINCADA] =
{
- .coords = 0x83,
+ .size = 0x83,
.y_offset = 0x14,
},
[SPECIES_NINJASK] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_SHEDINJA] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_TAILLOW] =
{
- .coords = 0x64,
+ .size = 0x64,
.y_offset = 0x11,
},
[SPECIES_SWELLOW] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_SHROOMISH] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_BRELOOM] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_SPINDA] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_WINGULL] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0e,
},
[SPECIES_PELIPPER] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_SURSKIT] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_MASQUERAIN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_WAILMER] =
{
- .coords = 0x83,
+ .size = 0x83,
.y_offset = 0x15,
},
[SPECIES_WAILORD] =
{
- .coords = 0x83,
+ .size = 0x83,
.y_offset = 0x16,
},
[SPECIES_SKITTY] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_DELCATTY] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_KECLEON] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_BALTOY] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_CLAYDOL] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_NOSEPASS] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0c,
},
[SPECIES_TORKOAL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_SABLEYE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_BARBOACH] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_WHISCASH] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_LUVDISC] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0a,
},
[SPECIES_CORPHISH] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_CRAWDAUNT] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_FEEBAS] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_MILOTIC] =
{
- .coords = 0x68,
+ .size = 0x68,
.y_offset = 0x02,
},
[SPECIES_CARVANHA] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_SHARPEDO] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_TRAPINCH] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0e,
},
[SPECIES_VIBRAVA] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x11,
},
[SPECIES_FLYGON] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_MAKUHITA] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_HARIYAMA] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_ELECTRIKE] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x10,
},
[SPECIES_MANECTRIC] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_NUMEL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_CAMERUPT] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x13,
},
[SPECIES_SPHEAL] =
{
- .coords = 0x64,
+ .size = 0x64,
.y_offset = 0x12,
},
[SPECIES_SEALEO] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_WALREIN] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_CACNEA] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0f,
},
[SPECIES_CACTURNE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_SNORUNT] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_GLALIE] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0c,
},
[SPECIES_LUNATONE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_SOLROCK] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_AZURILL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_SPOINK] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_GRUMPIG] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_PLUSLE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_MINUN] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_MAWILE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_MEDITITE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_MEDICHAM] =
{
- .coords = 0x68,
+ .size = 0x68,
.y_offset = 0x03,
},
[SPECIES_SWABLU] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_ALTARIA] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_WYNAUT] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_DUSKULL] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_DUSCLOPS] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_ROSELIA] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_SLAKOTH] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0f,
},
[SPECIES_VIGOROTH] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_SLAKING] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_GULPIN] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_SWALOT] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_TROPIUS] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_WHISMUR] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_LOUDRED] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_EXPLOUD] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_CLAMPERL] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_HUNTAIL] =
{
- .coords = 0x68,
+ .size = 0x68,
.y_offset = 0x02,
},
[SPECIES_GOREBYSS] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_ABSOL] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_SHUPPET] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_BANETTE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_SEVIPER] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_ZANGOOSE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_RELICANTH] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_ARON] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x11,
},
[SPECIES_LAIRON] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x11,
},
[SPECIES_AGGRON] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_CASTFORM] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0d,
},
[SPECIES_VOLBEAT] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_ILLUMISE] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_LILEEP] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_CRADILY] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_ANORITH] =
{
- .coords = 0x83,
+ .size = 0x83,
.y_offset = 0x17,
},
[SPECIES_ARMALDO] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_RALTS] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0d,
},
[SPECIES_KIRLIA] =
{
- .coords = 0x57,
+ .size = 0x57,
.y_offset = 0x06,
},
[SPECIES_GARDEVOIR] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_BAGON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_SHELGON] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_SALAMENCE] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_BELDUM] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_METANG] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x10,
},
[SPECIES_METAGROSS] =
{
- .coords = 0x83,
+ .size = 0x83,
.y_offset = 0x14,
},
[SPECIES_REGIROCK] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_REGICE] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0e,
},
[SPECIES_REGISTEEL] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0e,
},
[SPECIES_KYOGRE] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x13,
},
[SPECIES_GROUDON] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_RAYQUAZA] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_LATIAS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_LATIOS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_JIRACHI] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_DEOXYS] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_CHIMECHO] =
{
- .coords = 0x47,
+ .size = 0x47,
.y_offset = 0x07,
},
[SPECIES_EGG] =
{
- .coords = 0x36,
+ .size = 0x36,
.y_offset = 0x0a,
},
[SPECIES_UNOWN_B] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x09,
},
[SPECIES_UNOWN_C] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_UNOWN_D] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x08,
},
[SPECIES_UNOWN_E] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_UNOWN_F] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_UNOWN_G] =
{
- .coords = 0x57,
+ .size = 0x57,
.y_offset = 0x05,
},
[SPECIES_UNOWN_H] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_UNOWN_I] =
{
- .coords = 0x37,
+ .size = 0x37,
.y_offset = 0x07,
},
[SPECIES_UNOWN_J] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x09,
},
[SPECIES_UNOWN_K] =
{
- .coords = 0x57,
+ .size = 0x57,
.y_offset = 0x07,
},
[SPECIES_UNOWN_L] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0a,
},
[SPECIES_UNOWN_M] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_UNOWN_N] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_UNOWN_O] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_UNOWN_P] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0a,
},
[SPECIES_UNOWN_Q] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_UNOWN_R] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0c,
},
[SPECIES_UNOWN_S] =
{
- .coords = 0x57,
+ .size = 0x57,
.y_offset = 0x04,
},
[SPECIES_UNOWN_T] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0d,
},
[SPECIES_UNOWN_U] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_UNOWN_V] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_UNOWN_W] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0d,
},
[SPECIES_UNOWN_X] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_UNOWN_Y] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0a,
},
[SPECIES_UNOWN_Z] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0a,
},
[SPECIES_UNOWN_EMARK] =
{
- .coords = 0x37,
+ .size = 0x37,
.y_offset = 0x06,
},
[SPECIES_UNOWN_QMARK] =
{
- .coords = 0x47,
+ .size = 0x47,
.y_offset = 0x06,
},
};
diff --git a/src/data/pokemon_graphics/front_pic_coordinates.h b/src/data/pokemon_graphics/front_pic_coordinates.h
index a01f0360f..95ec7a132 100644
--- a/src/data/pokemon_graphics/front_pic_coordinates.h
+++ b/src/data/pokemon_graphics/front_pic_coordinates.h
@@ -4,2202 +4,2202 @@ const struct MonCoords gMonFrontPicCoords[] =
{
[SPECIES_NONE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_BULBASAUR] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0e,
},
[SPECIES_IVYSAUR] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_VENUSAUR] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_CHARMANDER] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_CHARMELEON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_CHARIZARD] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_SQUIRTLE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_WARTORTLE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_BLASTOISE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CATERPIE] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x10,
},
[SPECIES_METAPOD] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x14,
},
[SPECIES_BUTTERFREE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_WEEDLE] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x12,
},
[SPECIES_KAKUNA] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0e,
},
[SPECIES_BEEDRILL] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_PIDGEY] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_PIDGEOTTO] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x0b,
},
[SPECIES_PIDGEOT] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_RATTATA] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x10,
},
[SPECIES_RATICATE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_SPEAROW] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0f,
},
[SPECIES_FEAROW] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_EKANS] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_ARBOK] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_PIKACHU] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x09,
},
[SPECIES_RAICHU] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x04,
},
[SPECIES_SANDSHREW] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_SANDSLASH] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_NIDORAN_F] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0f,
},
[SPECIES_NIDORINA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_NIDOQUEEN] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_NIDORAN_M] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_NIDORINO] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_NIDOKING] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x02,
},
[SPECIES_CLEFAIRY] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x10,
},
[SPECIES_CLEFABLE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_VULPIX] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_NINETALES] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_JIGGLYPUFF] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x10,
},
[SPECIES_WIGGLYTUFF] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x08,
},
[SPECIES_ZUBAT] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_GOLBAT] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_ODDISH] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0f,
},
[SPECIES_GLOOM] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_VILEPLUME] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_PARAS] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_PARASECT] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_VENONAT] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_VENOMOTH] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_DIGLETT] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x12,
},
[SPECIES_DUGTRIO] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0d,
},
[SPECIES_MEOWTH] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_PERSIAN] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_PSYDUCK] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x09,
},
[SPECIES_GOLDUCK] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x02,
},
[SPECIES_MANKEY] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0e,
},
[SPECIES_PRIMEAPE] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_GROWLITHE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_ARCANINE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_POLIWAG] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x13,
},
[SPECIES_POLIWHIRL] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_POLIWRATH] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_ABRA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_KADABRA] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_ALAKAZAM] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_MACHOP] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_MACHOKE] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_MACHAMP] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_BELLSPROUT] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0f,
},
[SPECIES_WEEPINBELL] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_VICTREEBEL] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_TENTACOOL] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x09,
},
[SPECIES_TENTACRUEL] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_GEODUDE] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x12,
},
[SPECIES_GRAVELER] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_GOLEM] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_PONYTA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_RAPIDASH] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_SLOWPOKE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_SLOWBRO] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_MAGNEMITE] =
{
- .coords = 0x43,
+ .size = 0x43,
.y_offset = 0x15,
},
[SPECIES_MAGNETON] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_FARFETCHD] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_DODUO] =
{
- .coords = 0x57,
+ .size = 0x57,
.y_offset = 0x05,
},
[SPECIES_DODRIO] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SEEL] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_DEWGONG] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_GRIMER] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_MUK] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_SHELLDER] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x10,
},
[SPECIES_CLOYSTER] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_GASTLY] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_HAUNTER] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_GENGAR] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_ONIX] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x02,
},
[SPECIES_DROWZEE] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_HYPNO] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_KRABBY] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0d,
},
[SPECIES_KINGLER] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_VOLTORB] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x13,
},
[SPECIES_ELECTRODE] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_EXEGGCUTE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_EXEGGUTOR] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CUBONE] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_MAROWAK] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0b,
},
[SPECIES_HITMONLEE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_HITMONCHAN] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x04,
},
[SPECIES_LICKITUNG] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_KOFFING] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_WEEZING] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_RHYHORN] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_RHYDON] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_CHANSEY] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_TANGELA] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_KANGASKHAN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_HORSEA] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0f,
},
[SPECIES_SEADRA] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_GOLDEEN] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_SEAKING] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_STARYU] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_STARMIE] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_MR_MIME] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_SCYTHER] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_JYNX] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_ELECTABUZZ] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x02,
},
[SPECIES_MAGMAR] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_PINSIR] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_TAUROS] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_MAGIKARP] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_GYARADOS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x08,
},
[SPECIES_LAPRAS] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0d,
},
[SPECIES_DITTO] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x11,
},
[SPECIES_EEVEE] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x09,
},
[SPECIES_VAPOREON] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_JOLTEON] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_FLAREON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_PORYGON] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0d,
},
[SPECIES_OMANYTE] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0f,
},
[SPECIES_OMASTAR] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_KABUTO] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x11,
},
[SPECIES_KABUTOPS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_AERODACTYL] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_SNORLAX] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_ARTICUNO] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_ZAPDOS] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_MOLTRES] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_DRATINI] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0e,
},
[SPECIES_DRAGONAIR] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_DRAGONITE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_MEWTWO] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_MEW] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0d,
},
[SPECIES_CHIKORITA] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0d,
},
[SPECIES_BAYLEEF] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_MEGANIUM] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CYNDAQUIL] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_QUILAVA] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_TYPHLOSION] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_TOTODILE] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_CROCONAW] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_FERALIGATR] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SENTRET] =
{
- .coords = 0x47,
+ .size = 0x47,
.y_offset = 0x04,
},
[SPECIES_FURRET] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_HOOTHOOT] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0d,
},
[SPECIES_NOCTOWL] =
{
- .coords = 0x58,
+ .size = 0x58,
.y_offset = 0x03,
},
[SPECIES_LEDYBA] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0c,
},
[SPECIES_LEDIAN] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x04,
},
[SPECIES_SPINARAK] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x13,
},
[SPECIES_ARIADOS] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_CROBAT] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CHINCHOU] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x10,
},
[SPECIES_LANTURN] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x0b,
},
[SPECIES_PICHU] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0c,
},
[SPECIES_CLEFFA] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x14,
},
[SPECIES_IGGLYBUFF] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x12,
},
[SPECIES_TOGEPI] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x14,
},
[SPECIES_TOGETIC] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x09,
},
[SPECIES_NATU] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x14,
},
[SPECIES_XATU] =
{
- .coords = 0x47,
+ .size = 0x47,
.y_offset = 0x07,
},
[SPECIES_MAREEP] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x10,
},
[SPECIES_FLAAFFY] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_AMPHAROS] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_BELLOSSOM] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0e,
},
[SPECIES_MARILL] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0e,
},
[SPECIES_AZUMARILL] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_SUDOWOODO] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_POLITOED] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_HOPPIP] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_SKIPLOOM] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_JUMPLUFF] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_AIPOM] =
{
- .coords = 0x58,
+ .size = 0x58,
.y_offset = 0x03,
},
[SPECIES_SUNKERN] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x10,
},
[SPECIES_SUNFLORA] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x08,
},
[SPECIES_YANMA] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_WOOPER] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x10,
},
[SPECIES_QUAGSIRE] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x07,
},
[SPECIES_ESPEON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_UMBREON] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x08,
},
[SPECIES_MURKROW] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_SLOWKING] =
{
- .coords = 0x58,
+ .size = 0x58,
.y_offset = 0x01,
},
[SPECIES_MISDREAVUS] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_UNOWN] =
{
- .coords = 0x35,
+ .size = 0x35,
.y_offset = 0x0f,
},
[SPECIES_WOBBUFFET] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_GIRAFARIG] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_PINECO] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_FORRETRESS] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_DUNSPARCE] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x11,
},
[SPECIES_GLIGAR] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_STEELIX] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SNUBBULL] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0d,
},
[SPECIES_GRANBULL] =
{
- .coords = 0x57,
+ .size = 0x57,
.y_offset = 0x06,
},
[SPECIES_QWILFISH] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0a,
},
[SPECIES_SCIZOR] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SHUCKLE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_HERACROSS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_SNEASEL] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x05,
},
[SPECIES_TEDDIURSA] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0d,
},
[SPECIES_URSARING] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x01,
},
[SPECIES_SLUGMA] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0d,
},
[SPECIES_MAGCARGO] =
{
- .coords = 0x57,
+ .size = 0x57,
.y_offset = 0x0d,
},
[SPECIES_SWINUB] =
{
- .coords = 0x43,
+ .size = 0x43,
.y_offset = 0x14,
},
[SPECIES_PILOSWINE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_CORSOLA] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_REMORAID] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_OCTILLERY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_DELIBIRD] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x08,
},
[SPECIES_MANTINE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_SKARMORY] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_HOUNDOUR] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_HOUNDOOM] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_KINGDRA] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x04,
},
[SPECIES_PHANPY] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x10,
},
[SPECIES_DONPHAN] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_PORYGON2] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_STANTLER] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SMEARGLE] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_TYROGUE] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x09,
},
[SPECIES_HITMONTOP] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x05,
},
[SPECIES_SMOOCHUM] =
{
- .coords = 0x35,
+ .size = 0x35,
.y_offset = 0x0f,
},
[SPECIES_ELEKID] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_MAGBY] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0d,
},
[SPECIES_MILTANK] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_BLISSEY] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x06,
},
[SPECIES_RAIKOU] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_ENTEI] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SUICUNE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_LARVITAR] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x09,
},
[SPECIES_PUPITAR] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x09,
},
[SPECIES_TYRANITAR] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_LUGIA] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_HO_OH] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CELEBI] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_OLD_UNOWN_B] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_C] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_D] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_E] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_F] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_G] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_H] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_I] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_J] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_K] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_L] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_M] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_N] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_O] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_P] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_Q] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_R] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_S] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_T] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_U] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_V] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_W] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_X] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_Y] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_OLD_UNOWN_Z] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_TREECKO] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_GROVYLE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_SCEPTILE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_TORCHIC] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x08,
},
[SPECIES_COMBUSKEN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_BLAZIKEN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_MUDKIP] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0c,
},
[SPECIES_MARSHTOMP] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_SWAMPERT] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_POOCHYENA] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_MIGHTYENA] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_ZIGZAGOON] =
{
- .coords = 0x85,
+ .size = 0x85,
.y_offset = 0x0f,
},
[SPECIES_LINOONE] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_WURMPLE] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0e,
},
[SPECIES_SILCOON] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x11,
},
[SPECIES_BEAUTIFLY] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x09,
},
[SPECIES_CASCOON] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x10,
},
[SPECIES_DUSTOX] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0f,
},
[SPECIES_LOTAD] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0e,
},
[SPECIES_LOMBRE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_LUDICOLO] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SEEDOT] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x10,
},
[SPECIES_NUZLEAF] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x08,
},
[SPECIES_SHIFTRY] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_NINCADA] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x12,
},
[SPECIES_NINJASK] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_SHEDINJA] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_TAILLOW] =
{
- .coords = 0x64,
+ .size = 0x64,
.y_offset = 0x10,
},
[SPECIES_SWELLOW] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_SHROOMISH] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x10,
},
[SPECIES_BRELOOM] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_SPINDA] =
{
- .coords = 0x68,
+ .size = 0x68,
.y_offset = 0x08,
},
[SPECIES_WINGULL] =
{
- .coords = 0x84,
+ .size = 0x84,
.y_offset = 0x18,
},
[SPECIES_PELIPPER] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x04,
},
[SPECIES_SURSKIT] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0f,
},
[SPECIES_MASQUERAIN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_WAILMER] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0f,
},
[SPECIES_WAILORD] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x0a,
},
[SPECIES_SKITTY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0b,
},
[SPECIES_DELCATTY] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_KECLEON] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_BALTOY] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x10,
},
[SPECIES_CLAYDOL] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x06,
},
[SPECIES_NOSEPASS] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0c,
},
[SPECIES_TORKOAL] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_SABLEYE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_BARBOACH] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0b,
},
[SPECIES_WHISCASH] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x09,
},
[SPECIES_LUVDISC] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x18,
},
[SPECIES_CORPHISH] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0c,
},
[SPECIES_CRAWDAUNT] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_FEEBAS] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x0d,
},
[SPECIES_MILOTIC] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CARVANHA] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x06,
},
[SPECIES_SHARPEDO] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_TRAPINCH] =
{
- .coords = 0x54,
+ .size = 0x54,
.y_offset = 0x10,
},
[SPECIES_VIBRAVA] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0c,
},
[SPECIES_FLYGON] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_MAKUHITA] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_HARIYAMA] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_ELECTRIKE] =
{
- .coords = 0x64,
+ .size = 0x64,
.y_offset = 0x12,
},
[SPECIES_MANECTRIC] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x04,
},
[SPECIES_NUMEL] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0f,
},
[SPECIES_CAMERUPT] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x09,
},
[SPECIES_SPHEAL] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x10,
},
[SPECIES_SEALEO] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0a,
},
[SPECIES_WALREIN] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_CACNEA] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x10,
},
[SPECIES_CACTURNE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_SNORUNT] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_GLALIE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x0a,
},
[SPECIES_LUNATONE] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_SOLROCK] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_AZURILL] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_SPOINK] =
{
- .coords = 0x46,
+ .size = 0x46,
.y_offset = 0x09,
},
[SPECIES_GRUMPIG] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_PLUSLE] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0e,
},
[SPECIES_MINUN] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0c,
},
[SPECIES_MAWILE] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_MEDITITE] =
{
- .coords = 0x65,
+ .size = 0x65,
.y_offset = 0x0c,
},
[SPECIES_MEDICHAM] =
{
- .coords = 0x68,
+ .size = 0x68,
.y_offset = 0x01,
},
[SPECIES_SWABLU] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x11,
},
[SPECIES_ALTARIA] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_WYNAUT] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_DUSKULL] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0a,
},
[SPECIES_DUSCLOPS] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x05,
},
[SPECIES_ROSELIA] =
{
- .coords = 0x76,
+ .size = 0x76,
.y_offset = 0x08,
},
[SPECIES_SLAKOTH] =
{
- .coords = 0x74,
+ .size = 0x74,
.y_offset = 0x12,
},
[SPECIES_VIGOROTH] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_SLAKING] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x08,
},
[SPECIES_GULPIN] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x12,
},
[SPECIES_SWALOT] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_TROPIUS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_WHISMUR] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_LOUDRED] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_EXPLOUD] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_CLAMPERL] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0e,
},
[SPECIES_HUNTAIL] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x03,
},
[SPECIES_GOREBYSS] =
{
- .coords = 0x86,
+ .size = 0x86,
.y_offset = 0x0b,
},
[SPECIES_ABSOL] =
{
- .coords = 0x68,
+ .size = 0x68,
.y_offset = 0x00,
},
[SPECIES_SHUPPET] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0e,
},
[SPECIES_BANETTE] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0c,
},
[SPECIES_SEVIPER] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x08,
},
[SPECIES_ZANGOOSE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x05,
},
[SPECIES_RELICANTH] =
{
- .coords = 0x77,
+ .size = 0x77,
.y_offset = 0x0b,
},
[SPECIES_ARON] =
{
- .coords = 0x43,
+ .size = 0x43,
.y_offset = 0x14,
},
[SPECIES_LAIRON] =
{
- .coords = 0x75,
+ .size = 0x75,
.y_offset = 0x0d,
},
[SPECIES_AGGRON] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_CASTFORM] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x11,
},
[SPECIES_VOLBEAT] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_ILLUMISE] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x08,
},
[SPECIES_LILEEP] =
{
- .coords = 0x67,
+ .size = 0x67,
.y_offset = 0x07,
},
[SPECIES_CRADILY] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x00,
},
[SPECIES_ANORITH] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x08,
},
[SPECIES_ARMALDO] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_RALTS] =
{
- .coords = 0x35,
+ .size = 0x35,
.y_offset = 0x0f,
},
[SPECIES_KIRLIA] =
{
- .coords = 0x47,
+ .size = 0x47,
.y_offset = 0x06,
},
[SPECIES_GARDEVOIR] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x01,
},
[SPECIES_BAGON] =
{
- .coords = 0x56,
+ .size = 0x56,
.y_offset = 0x0b,
},
[SPECIES_SHELGON] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x09,
},
[SPECIES_SALAMENCE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_BELDUM] =
{
- .coords = 0x55,
+ .size = 0x55,
.y_offset = 0x0f,
},
[SPECIES_METANG] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x07,
},
[SPECIES_METAGROSS] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x06,
},
[SPECIES_REGIROCK] =
{
- .coords = 0x78,
+ .size = 0x78,
.y_offset = 0x04,
},
[SPECIES_REGICE] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_REGISTEEL] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x03,
},
[SPECIES_KYOGRE] =
{
- .coords = 0x87,
+ .size = 0x87,
.y_offset = 0x04,
},
[SPECIES_GROUDON] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_RAYQUAZA] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x00,
},
[SPECIES_LATIAS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_LATIOS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x02,
},
[SPECIES_JIRACHI] =
{
- .coords = 0x66,
+ .size = 0x66,
.y_offset = 0x0d,
},
[SPECIES_DEOXYS] =
{
- .coords = 0x88,
+ .size = 0x88,
.y_offset = 0x01,
},
[SPECIES_CHIMECHO] =
{
- .coords = 0x37,
+ .size = 0x37,
.y_offset = 0x06,
},
[SPECIES_EGG] =
{
- .coords = 0x33,
+ .size = 0x33,
.y_offset = 0x14,
},
[SPECIES_UNOWN_B] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x10,
},
[SPECIES_UNOWN_C] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x10,
},
[SPECIES_UNOWN_D] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x10,
},
[SPECIES_UNOWN_E] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x11,
},
[SPECIES_UNOWN_F] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x11,
},
[SPECIES_UNOWN_G] =
{
- .coords = 0x35,
+ .size = 0x35,
.y_offset = 0x0e,
},
[SPECIES_UNOWN_H] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x10,
},
[SPECIES_UNOWN_I] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x10,
},
[SPECIES_UNOWN_J] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x11,
},
[SPECIES_UNOWN_K] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x11,
},
[SPECIES_UNOWN_L] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x13,
},
[SPECIES_UNOWN_M] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x13,
},
[SPECIES_UNOWN_N] =
{
- .coords = 0x43,
+ .size = 0x43,
.y_offset = 0x14,
},
[SPECIES_UNOWN_O] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x10,
},
[SPECIES_UNOWN_P] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x13,
},
[SPECIES_UNOWN_Q] =
{
- .coords = 0x43,
+ .size = 0x43,
.y_offset = 0x15,
},
[SPECIES_UNOWN_R] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x13,
},
[SPECIES_UNOWN_S] =
{
- .coords = 0x45,
+ .size = 0x45,
.y_offset = 0x0c,
},
[SPECIES_UNOWN_T] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x12,
},
[SPECIES_UNOWN_U] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x12,
},
[SPECIES_UNOWN_V] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x12,
},
[SPECIES_UNOWN_W] =
{
- .coords = 0x44,
+ .size = 0x44,
.y_offset = 0x13,
},
[SPECIES_UNOWN_X] =
{
- .coords = 0x33,
+ .size = 0x33,
.y_offset = 0x15,
},
[SPECIES_UNOWN_Y] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x11,
},
[SPECIES_UNOWN_Z] =
{
- .coords = 0x34,
+ .size = 0x34,
.y_offset = 0x10,
},
[SPECIES_UNOWN_EMARK] =
{
- .coords = 0x35,
+ .size = 0x35,
.y_offset = 0x0f,
},
[SPECIES_UNOWN_QMARK] =
{
- .coords = 0x35,
+ .size = 0x35,
.y_offset = 0x0d,
},
};
diff --git a/src/data/trainer_graphics/back_pic_tables.h b/src/data/trainer_graphics/back_pic_tables.h
index 8d4e27694..920ecbb39 100644
--- a/src/data/trainer_graphics/back_pic_tables.h
+++ b/src/data/trainer_graphics/back_pic_tables.h
@@ -1,13 +1,13 @@
const struct MonCoords gTrainerBackPicCoords[] =
{
- {8, 4},
- {8, 4},
- {8, 5},
- {8, 5},
- {8, 4},
- {8, 4},
- {8, 4},
- {8, 4},
+ {.size = 8, .y_offset = 4},
+ {.size = 8, .y_offset = 4},
+ {.size = 8, .y_offset = 5},
+ {.size = 8, .y_offset = 5},
+ {.size = 8, .y_offset = 4},
+ {.size = 8, .y_offset = 4},
+ {.size = 8, .y_offset = 4},
+ {.size = 8, .y_offset = 4},
};
// this table goes functionally unused, since none of these pics are compressed
diff --git a/src/data/trainer_graphics/front_pic_tables.h b/src/data/trainer_graphics/front_pic_tables.h
index d8f8c2492..fc637fc6e 100644
--- a/src/data/trainer_graphics/front_pic_tables.h
+++ b/src/data/trainer_graphics/front_pic_tables.h
@@ -1,98 +1,98 @@
const struct MonCoords gTrainerFrontPicCoords[] =
{
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 2},
- {8, 2},
- {8, 1},
- {8, 1},
- {8, 2},
- {8, 1},
- {8, 2},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 2},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 2},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
- {8, 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 2},
+ {.size = 8, .y_offset = 2},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 2},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 2},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 2},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 2},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
+ {.size = 8, .y_offset = 1},
};
const struct CompressedSpriteSheet gTrainerFrontPicTable[] =
diff --git a/src/decoration.c b/src/decoration.c
index 438f2cbd1..c4c3d6171 100644
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -1629,7 +1629,7 @@ void sub_8128950(u8 taskId)
void sub_81289D0(u8 taskId)
{
DisplayYesNoMenu();
- sub_8121F68(taskId, &gUnknown_085A72C4);
+ DoYesNoFuncWithChoice(taskId, &gUnknown_085A72C4);
}
void sub_81289F0(u8 taskId)
@@ -1694,7 +1694,7 @@ void sub_8128AAC(u8 taskId)
void sub_8128B80(u8 taskId)
{
DisplayYesNoMenu();
- sub_8121F68(taskId, &gUnknown_085A72CC);
+ DoYesNoFuncWithChoice(taskId, &gUnknown_085A72CC);
}
void sub_8128BA0(u8 taskId)
@@ -2589,7 +2589,7 @@ void sub_812A0E8(u8 taskId)
void sub_812A1A0(u8 taskId)
{
DisplayYesNoMenu();
- sub_8121F68(taskId, &gUnknown_085A7348);
+ DoYesNoFuncWithChoice(taskId, &gUnknown_085A7348);
}
void sub_812A1C0(u8 taskId)
@@ -2602,7 +2602,7 @@ void sub_812A1C0(u8 taskId)
void sub_812A1F0(u8 taskId)
{
DisplayYesNoMenu();
- sub_8121F68(taskId, &gUnknown_085A7350);
+ DoYesNoFuncWithChoice(taskId, &gUnknown_085A7350);
}
void sub_812A210(u8 taskId)
@@ -2726,7 +2726,7 @@ void sub_812A3D4(u8 taskId)
void sub_812A458(u8 taskId)
{
DisplayYesNoMenu();
- sub_8121F68(taskId, &gUnknown_085A741C);
+ DoYesNoFuncWithChoice(taskId, &gUnknown_085A741C);
}
void sub_812A478(u8 taskId)
diff --git a/src/event_data.c b/src/event_data.c
index f6a1cde78..df289c538 100644
--- a/src/event_data.c
+++ b/src/event_data.c
@@ -45,7 +45,7 @@ void ClearTempFieldEventData(void)
FlagClear(FLAG_SYS_ENC_DOWN_ITEM);
FlagClear(FLAG_SYS_USE_STRENGTH);
FlagClear(FLAG_SYS_CTRL_OBJ_DELETE);
- FlagClear(FLAG_0x880);
+ FlagClear(FLAG_NURSE_UNION_ROOM_REMINDER);
}
// Probably had different flag splits at one point.
@@ -114,21 +114,21 @@ bool32 IsMysteryGiftEnabled(void)
void sub_809D4D8(void)
{
FlagClear(FLAG_MYSTERY_EVENT_DONE);
- FlagClear(FLAG_0x1E5);
- FlagClear(FLAG_0x1E6);
- FlagClear(FLAG_0x1E7);
- FlagClear(FLAG_0x1E8);
- FlagClear(FLAG_0x1E9);
- FlagClear(FLAG_0x1EA);
- FlagClear(FLAG_0x1EB);
- FlagClear(FLAG_0x1EC);
- FlagClear(FLAG_0x1ED);
- FlagClear(FLAG_0x1EE);
- FlagClear(FLAG_0x1EF);
- FlagClear(FLAG_0x1F0);
- FlagClear(FLAG_0x1F1);
- FlagClear(FLAG_0x1F2);
- FlagClear(FLAG_0x1F3);
+ FlagClear(FLAG_MYSTERY_EVENT_1);
+ FlagClear(FLAG_MYSTERY_EVENT_2);
+ FlagClear(FLAG_MYSTERY_EVENT_3);
+ FlagClear(FLAG_MYSTERY_EVENT_4);
+ FlagClear(FLAG_MYSTERY_EVENT_5);
+ FlagClear(FLAG_MYSTERY_EVENT_6);
+ FlagClear(FLAG_MYSTERY_EVENT_7);
+ FlagClear(FLAG_MYSTERY_EVENT_8);
+ FlagClear(FLAG_MYSTERY_EVENT_9);
+ FlagClear(FLAG_MYSTERY_EVENT_10);
+ FlagClear(FLAG_MYSTERY_EVENT_11);
+ FlagClear(FLAG_MYSTERY_EVENT_12);
+ FlagClear(FLAG_MYSTERY_EVENT_13);
+ FlagClear(FLAG_MYSTERY_EVENT_14);
+ FlagClear(FLAG_MYSTERY_EVENT_15);
}
void sub_809D570(void)
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index e6a859c84..4f6f5acdf 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -32,7 +32,7 @@
#include "constants/maps.h"
#include "constants/songs.h"
-extern bool32 sub_8196034(void);
+extern bool32 TryStartMatchCall(void);
static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0;
static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0;
@@ -600,7 +600,7 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
ScriptContext1_SetupScript(SSTidalCorridor_EventScript_23C050);
return TRUE;
}
- if (sub_8196034())
+ if (TryStartMatchCall())
return TRUE;
return FALSE;
}
diff --git a/src/field_message_box.c b/src/field_message_box.c
index 5e23b5f6b..299aafaf2 100755
--- a/src/field_message_box.c
+++ b/src/field_message_box.c
@@ -5,8 +5,8 @@
#include "task.h"
#include "text.h"
-extern bool32 sub_8196094(void);
-extern void sub_8196080(u8*);
+extern bool32 IsMatchCallTaskActive(void);
+extern void StartMatchCallFromScript(u8*);
static EWRAM_DATA u8 sFieldMessageBoxMode = 0;
@@ -68,7 +68,7 @@ bool8 ShowFieldMessage(u8 *str)
void sub_8098214(u8 taskId)
{
- if (!sub_8196094())
+ if (!IsMatchCallTaskActive())
{
sFieldMessageBoxMode = 0;
DestroyTask(taskId);
@@ -81,7 +81,7 @@ bool8 sub_8098238(u8 *str)
return FALSE;
StringExpandPlaceholders(gStringVar4, str);
CreateTask(sub_8098214, 0);
- sub_8196080(str);
+ StartMatchCallFromScript(str);
sFieldMessageBoxMode = 2;
return TRUE;
}
diff --git a/src/field_specials.c b/src/field_specials.c
index 5883e0245..0dc1bf18b 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -361,7 +361,7 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y)
bool32 is_tile_that_overrides_player_control(void)
{
- if (FlagGet(FLAG_0x088))
+ if (FlagGet(FLAG_ENABLE_FIRST_WALLY_POKENAV_CALL))
{
switch (gMapHeader.mapType)
{
@@ -388,7 +388,7 @@ bool32 is_tile_that_overrides_player_control(void)
bool32 sub_8138120(void)
{
- if (FlagGet(FLAG_0x08A))
+ if (FlagGet(FLAG_REGISTER_WINONA_POKENAV))
{
switch (gMapHeader.mapType)
{
@@ -415,7 +415,7 @@ bool32 sub_8138120(void)
bool32 sub_8138168(void)
{
- if (FlagGet(FLAG_0x072))
+ if (FlagGet(FLAG_SCOTT_CALL_NATIONAL_DEX))
{
switch (gMapHeader.mapType)
{
@@ -442,7 +442,7 @@ bool32 sub_8138168(void)
bool32 sub_81381B0(void)
{
- if (FlagGet(FLAG_0x080))
+ if (FlagGet(FLAG_ENABLE_ROXANNE_FIRST_CALL))
{
switch (gMapHeader.mapType)
{
@@ -469,7 +469,7 @@ bool32 sub_81381B0(void)
bool32 sub_81381F8(void)
{
- if (FlagGet(FLAG_0x075))
+ if (FlagGet(FLAG_DEFEATED_MAGMA_SPACE_CENTER))
{
switch (gMapHeader.mapType)
{
@@ -1201,7 +1201,7 @@ void EndLotteryCornerComputerEffect(void)
void SetTrickHouseEndRoomFlag(void)
{
u16 *specVar = &gSpecialVar_0x8004;
- u16 flag = FLAG_0x1F5;
+ u16 flag = FLAG_TRICK_HOUSE_END_ROOM;
*specVar = flag;
FlagSet(flag);
}
@@ -1209,7 +1209,7 @@ void SetTrickHouseEndRoomFlag(void)
void ResetTrickHouseEndRoomFlag(void)
{
u16 *specVar = &gSpecialVar_0x8004;
- u16 flag = FLAG_0x1F5;
+ u16 flag = FLAG_TRICK_HOUSE_END_ROOM;
*specVar = flag;
FlagClear(flag);
}
@@ -2111,7 +2111,7 @@ void sub_813A080(void)
u16 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
- if (battleMode == FRONTIER_MODE_MULTIS && !FlagGet(FLAG_0x152))
+ if (battleMode == FRONTIER_MODE_MULTIS && !FlagGet(FLAG_CHOSEN_MULTI_BATTLE_NPC_PARTNER))
{
gSpecialVar_0x8005 = 5;
gSpecialVar_0x8006 = 4;
@@ -3425,11 +3425,11 @@ void sub_813B2E4(void)
u16 randomValue = Random();
VarSet(VAR_0x4038, 0);
- if (FlagGet(FLAG_0x1BE) == TRUE)
+ if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE)
{
VarSet(VAR_0x4037, (randomValue & 7) + 1);
}
- else if (FlagGet(FLAG_0x1BF) == TRUE)
+ else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE)
{
VarSet(VAR_0x4037, (randomValue & 7) + 9);
}
diff --git a/src/link.c b/src/link.c
index 69373f773..bec9dddc6 100644
--- a/src/link.c
+++ b/src/link.c
@@ -317,7 +317,7 @@ static void InitLocalLinkPlayer(void)
gLocalLinkPlayer.version = gGameVersion + 0x4000;
gLocalLinkPlayer.lp_field_2 = 0x8000;
gLocalLinkPlayer.name[8] = IsNationalPokedexEnabled();
- if (FlagGet(FLAG_0x87F))
+ if (FlagGet(FLAG_IS_CHAMPION))
{
gLocalLinkPlayer.name[8] |= 0x10;
}
diff --git a/src/link_rfu.c b/src/link_rfu.c
index 0625e4af4..0f997591f 100644
--- a/src/link_rfu.c
+++ b/src/link_rfu.c
@@ -2140,7 +2140,7 @@ void sub_800DD94(struct UnkLinkRfuStruct_02022B14 *data, u8 r9, bool32 r2, s32 r
data->unk_00.unk_00_4 = 0;
data->unk_00.unk_00_5 = 0;
data->unk_00.unk_00_6 = 0;
- data->unk_00.unk_00_7 = FlagGet(FLAG_0x87F);
+ data->unk_00.unk_00_7 = FlagGet(FLAG_IS_CHAMPION);
data->unk_00.unk_01_0 = IsNationalPokedexEnabled();
data->unk_00.unk_01_1 = FlagGet(FLAG_SYS_GAME_CLEAR);
}
diff --git a/src/match_call.c b/src/match_call.c
index a15700070..e7e91969f 100644
--- a/src/match_call.c
+++ b/src/match_call.c
@@ -1,1275 +1,2017 @@
-
-// Includes
#include "global.h"
+#include "alloc.h"
+#include "battle.h"
#include "battle_setup.h"
+#include "bg.h"
+#include "data2.h"
#include "event_data.h"
+#include "event_object_movement.h"
+#include "field_player_avatar.h"
+#include "main.h"
+#include "menu.h"
+#include "new_game.h"
+#include "overworld.h"
+#include "palette.h"
+#include "pokedex.h"
+#include "pokemon.h"
+#include "random.h"
+#include "region_map.h"
+#include "rtc.h"
+#include "script.h"
+#include "script_movement.h"
+#include "sound.h"
#include "string_util.h"
-#include "battle.h"
-#include "gym_leader_rematch.h"
-
-extern void sub_8197080(u8 *dest);
-extern const u8 gTrainerClassNames[][13];
-
-// Static type declarations
-
-typedef struct MatchCallTextDataStruct {
- const u8 *text;
- u16 flag;
- u16 flag2;
-} match_call_text_data_t;
-
-struct MatchCallStructCommon {
- u8 type;
- u8 v1;
- u16 flag;
-};
-
-struct MatchCallStruct0 {
- u8 type;
- u8 v1;
- u16 flag;
- const u8 *desc;
- const u8 *name;
- const match_call_text_data_t *textData;
+#include "strings.h"
+#include "task.h"
+#include "wild_encounter.h"
+#include "window.h"
+#include "constants/abilities.h"
+#include "constants/battle_frontier.h"
+#include "constants/event_objects.h"
+#include "constants/maps.h"
+#include "constants/region_map_sections.h"
+#include "constants/songs.h"
+#include "constants/species.h"
+#include "constants/trainers.h"
+
+struct MatchCallState
+{
+ u32 minutes;
+ u16 trainerId;
+ u8 stepCounter;
+ u8 triggeredFromScript;
};
-struct MatchCallStruct1 {
- u8 type;
- u8 v1;
- u16 flag;
- u16 rematchTableIdx;
- const u8 *desc;
- const u8 *name;
- const match_call_text_data_t *textData;
+struct MatchCallTrainerTextInfo
+{
+ u16 trainerId;
+ u16 unused;
+ u16 battleTopicTextIds[3];
+ u16 generalTextId;
+ u8 battleFrontierRecordStreakTextIndex;
+ u16 sameRouteMatchCallTextId;
+ u16 differentRouteMatchCallTextId;
};
-struct MatchCallSubstruct2 {
- u16 flag;
- u8 v2;
+struct MatchCallText
+{
+ const u8 *text;
+ s8 stringVarFuncIds[3];
};
-struct MatchCallStruct2 {
- u8 type;
- u8 v1;
- u16 flag;
- u16 rematchTableIdx;
- const u8 *desc;
- const match_call_text_data_t *textData;
- const struct MatchCallSubstruct2 *v10;
+struct MultiTrainerMatchCallText
+{
+ u16 trainerId;
+ const u8 *text;
};
-struct MatchCallStruct3 {
- u8 type;
- u8 v1;
- u16 flag;
- const u8 *desc;
- const u8 *name;
+struct BattleFrontierStreakInfo
+{
+ u16 facilityId;
+ u16 streak;
};
-struct MatchCallStruct4 {
- u8 type;
- u8 gender;
- u16 flag;
- const u8 *desc;
- const u8 *name;
- const match_call_text_data_t *textData;
+EWRAM_DATA struct MatchCallState gMatchCallState = {0};
+EWRAM_DATA struct BattleFrontierStreakInfo gBattleFrontierStreakInfo = {0};
+
+bool32 SelectMatchCallMessage(int, u8 *);
+static u32 GetCurrentTotalMinutes(struct Time *);
+static u32 GetNumRegisteredNPCs(void);
+static u32 GetActiveMatchCallTrainerId(u32);
+static int GetTrainerMatchCallId(int);
+static u16 GetRematchTrainerLocation(int);
+static bool32 TrainerIsEligibleForRematch(int);
+static void StartMatchCall(void);
+static void ExecuteMatchCall(u8);
+static void DrawMatchCallTextBoxBorder(u32, u32, u32);
+static void sub_8196694(u8);
+static void InitMatchCallTextPrinter(int, const u8 *);
+static bool32 ExecuteMatchCallTextPrinter(int);
+static const struct MatchCallText *GetSameRouteMatchCallText(int, u8 *);
+static const struct MatchCallText *GetDifferentRouteMatchCallText(int, u8 *);
+static const struct MatchCallText *GetBattleMatchCallText(int, u8 *);
+static const struct MatchCallText *GetGeneralMatchCallText(int, u8 *);
+static bool32 sub_8196D74(int);
+static void BuildMatchCallString(int, const struct MatchCallText *, u8 *);
+static u16 GetFrontierStreakInfo(u16, u32 *);
+static void PopulateMatchCallStringVars(int, const s8 *);
+static void PopulateMatchCallStringVar(int, int, u8 *);
+static bool32 LoadMatchCallWindowGfx(u8);
+static bool32 MoveMatchCallWindowToVram(u8);
+static bool32 PrintMatchCallIntroEllipsis(u8);
+static bool32 sub_81962B0(u8);
+static bool32 sub_81962D8(u8);
+static bool32 sub_8196330(u8);
+static bool32 sub_8196390(u8);
+static bool32 sub_81963F0(u8);
+static void PopulateTrainerName(int, u8 *);
+static void PopulateMapName(int, u8 *);
+static void PopulateSpeciesFromTrainerLocation(int, u8 *);
+static void PopulateSpeciesFromTrainerParty(int, u8 *);
+static void PopulateBattleFrontierFacilityName(int, u8 *);
+static void PopulateBattleFrontierStreak(int, u8 *);
+
+extern void sub_81973A4(void);
+
+#define TEXT_ID(topic, id) (((topic) << 8) | ((id) & 0xFF))
+
+static const struct MatchCallTrainerTextInfo sMatchCallTrainers[] =
+{
+ {
+ .trainerId = TRAINER_ROSE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) },
+ .generalTextId = TEXT_ID(1, 3),
+ .battleFrontierRecordStreakTextIndex = 8,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 8),
+ },
+ {
+ .trainerId = TRAINER_ANDRES_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) },
+ .generalTextId = TEXT_ID(1, 62),
+ .battleFrontierRecordStreakTextIndex = 12,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 12),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 12),
+ },
+ {
+ .trainerId = TRAINER_DUSTY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) },
+ .generalTextId = TEXT_ID(1, 4),
+ .battleFrontierRecordStreakTextIndex = 12,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 12),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 12),
+ },
+ {
+ .trainerId = TRAINER_LOLA_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) },
+ .generalTextId = TEXT_ID(1, 5),
+ .battleFrontierRecordStreakTextIndex = 2,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 2),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 2),
+ },
+ {
+ .trainerId = TRAINER_RICKY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) },
+ .generalTextId = TEXT_ID(1, 6),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 1),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 1),
+ },
+ {
+ .trainerId = TRAINER_LILA_AND_ROY_1,
+ .unused = 4,
+ .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) },
+ .generalTextId = TEXT_ID(1, 61),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 1),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 1),
+ },
+ {
+ .trainerId = TRAINER_CRISTIN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 10), TEXT_ID(2, 10), TEXT_ID(3, 10) },
+ .generalTextId = TEXT_ID(1, 64),
+ .battleFrontierRecordStreakTextIndex = 10,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 10),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 10),
+ },
+ {
+ .trainerId = TRAINER_BROOKE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 8),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_WILTON_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 6), TEXT_ID(2, 6), TEXT_ID(3, 6) },
+ .generalTextId = TEXT_ID(1, 7),
+ .battleFrontierRecordStreakTextIndex = 6,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 6),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 6),
+ },
+ {
+ .trainerId = TRAINER_VALERIE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) },
+ .generalTextId = TEXT_ID(1, 9),
+ .battleFrontierRecordStreakTextIndex = 8,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 8),
+ },
+ {
+ .trainerId = TRAINER_CINDY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) },
+ .generalTextId = TEXT_ID(1, 10),
+ .battleFrontierRecordStreakTextIndex = 8,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 8),
+ },
+ {
+ .trainerId = TRAINER_THALIA_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 10), TEXT_ID(3, 10) },
+ .generalTextId = TEXT_ID(1, 14),
+ .battleFrontierRecordStreakTextIndex = 10,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 10),
+ },
+ {
+ .trainerId = TRAINER_JESSICA_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 10), TEXT_ID(2, 10), TEXT_ID(3, 10) },
+ .generalTextId = TEXT_ID(1, 11),
+ .battleFrontierRecordStreakTextIndex = 10,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 10),
+ },
+ {
+ .trainerId = TRAINER_WINSTON_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) },
+ .generalTextId = TEXT_ID(1, 12),
+ .battleFrontierRecordStreakTextIndex = 4,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 4),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 4),
+ },
+ {
+ .trainerId = TRAINER_STEVE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 7), TEXT_ID(2, 7), TEXT_ID(3, 7) },
+ .generalTextId = TEXT_ID(1, 13),
+ .battleFrontierRecordStreakTextIndex = 7,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 7),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 7),
+ },
+ {
+ .trainerId = TRAINER_TONY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) },
+ .generalTextId = TEXT_ID(1, 15),
+ .battleFrontierRecordStreakTextIndex = 5,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 5),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 5),
+ },
+ {
+ .trainerId = TRAINER_NOB_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) },
+ .generalTextId = TEXT_ID(1, 16),
+ .battleFrontierRecordStreakTextIndex = 3,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 3),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 3),
+ },
+ {
+ .trainerId = TRAINER_KOJI_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) },
+ .generalTextId = TEXT_ID(1, 59),
+ .battleFrontierRecordStreakTextIndex = 3,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 3),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 3),
+ },
+ {
+ .trainerId = TRAINER_FERNANDO_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 6), TEXT_ID(2, 6), TEXT_ID(3, 6) },
+ .generalTextId = TEXT_ID(1, 17),
+ .battleFrontierRecordStreakTextIndex = 6,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 6),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 6),
+ },
+ {
+ .trainerId = TRAINER_DALTON_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) },
+ .generalTextId = TEXT_ID(1, 18),
+ .battleFrontierRecordStreakTextIndex = 4,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 4),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 4),
+ },
+ {
+ .trainerId = TRAINER_BERNIE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 11), TEXT_ID(2, 11), TEXT_ID(3, 11) },
+ .generalTextId = TEXT_ID(1, 19),
+ .battleFrontierRecordStreakTextIndex = 11,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 11),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 11),
+ },
+ {
+ .trainerId = TRAINER_ETHAN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) },
+ .generalTextId = TEXT_ID(1, 20),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 1),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 1),
+ },
+ {
+ .trainerId = TRAINER_JOHN_AND_JAY_1,
+ .unused = 3,
+ .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) },
+ .generalTextId = TEXT_ID(1, 60),
+ .battleFrontierRecordStreakTextIndex = 12,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 12),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 12),
+ },
+ {
+ .trainerId = TRAINER_JEFFREY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 7), TEXT_ID(2, 7), TEXT_ID(3, 7) },
+ .generalTextId = TEXT_ID(1, 21),
+ .battleFrontierRecordStreakTextIndex = 7,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 7),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 7),
+ },
+ {
+ .trainerId = TRAINER_CAMERON_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) },
+ .generalTextId = TEXT_ID(1, 22),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 4),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 4),
+ },
+ {
+ .trainerId = TRAINER_JACKI_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) },
+ .generalTextId = TEXT_ID(1, 23),
+ .battleFrontierRecordStreakTextIndex = 8,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 8),
+ },
+ {
+ .trainerId = TRAINER_WALTER_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) },
+ .generalTextId = TEXT_ID(1, 24),
+ .battleFrontierRecordStreakTextIndex = 12,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 12),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 12),
+ },
+ {
+ .trainerId = TRAINER_KAREN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) },
+ .generalTextId = TEXT_ID(1, 26),
+ .battleFrontierRecordStreakTextIndex = 2,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 2),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 2),
+ },
+ {
+ .trainerId = TRAINER_JERRY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) },
+ .generalTextId = TEXT_ID(1, 25),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 1),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 1),
+ },
+ {
+ .trainerId = TRAINER_ANNA_AND_MEG_1,
+ .unused = 6,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 27),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_ISABEL_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 14), TEXT_ID(2, 14), TEXT_ID(3, 14) },
+ .generalTextId = TEXT_ID(1, 29),
+ .battleFrontierRecordStreakTextIndex = 14,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 14),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 14),
+ },
+ {
+ .trainerId = TRAINER_MIGUEL_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 11), TEXT_ID(2, 11), TEXT_ID(3, 11) },
+ .generalTextId = TEXT_ID(1, 28),
+ .battleFrontierRecordStreakTextIndex = 11,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 11),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 11),
+ },
+ {
+ .trainerId = TRAINER_TIMOTHY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 12), TEXT_ID(2, 12), TEXT_ID(3, 12) },
+ .generalTextId = TEXT_ID(1, 30),
+ .battleFrontierRecordStreakTextIndex = 12,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 12),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 12),
+ },
+ {
+ .trainerId = TRAINER_SHELBY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 13), TEXT_ID(2, 13), TEXT_ID(3, 13) },
+ .generalTextId = TEXT_ID(1, 31),
+ .battleFrontierRecordStreakTextIndex = 13,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 13),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 13),
+ },
+ {
+ .trainerId = TRAINER_CALVIN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) },
+ .generalTextId = TEXT_ID(1, 32),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 1),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 1),
+ },
+ {
+ .trainerId = TRAINER_ELLIOT_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) },
+ .generalTextId = TEXT_ID(1, 33),
+ .battleFrontierRecordStreakTextIndex = 3,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 3),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 3),
+ },
+ {
+ .trainerId = TRAINER_ISAIAH_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) },
+ .generalTextId = TEXT_ID(1, 38),
+ .battleFrontierRecordStreakTextIndex = 5,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 5),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 5),
+ },
+ {
+ .trainerId = TRAINER_MARIA_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 37),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_ABIGAIL_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 35),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_DYLAN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) },
+ .generalTextId = TEXT_ID(1, 36),
+ .battleFrontierRecordStreakTextIndex = 5,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 5),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 5),
+ },
+ {
+ .trainerId = TRAINER_KATELYN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 40),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_BENJAMIN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) },
+ .generalTextId = TEXT_ID(1, 34),
+ .battleFrontierRecordStreakTextIndex = 5,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 5),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 5),
+ },
+ {
+ .trainerId = TRAINER_PABLO_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) },
+ .generalTextId = TEXT_ID(1, 39),
+ .battleFrontierRecordStreakTextIndex = 5,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 5),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 5),
+ },
+ {
+ .trainerId = TRAINER_NICOLAS_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 4), TEXT_ID(2, 4), TEXT_ID(3, 4) },
+ .generalTextId = TEXT_ID(1, 41),
+ .battleFrontierRecordStreakTextIndex = 4,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 4),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 4),
+ },
+ {
+ .trainerId = TRAINER_ROBERT_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 6), TEXT_ID(2, 6), TEXT_ID(3, 6) },
+ .generalTextId = TEXT_ID(1, 42),
+ .battleFrontierRecordStreakTextIndex = 6,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 6),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 6),
+ },
+ {
+ .trainerId = TRAINER_LAO_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) },
+ .generalTextId = TEXT_ID(1, 43),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 1),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 1),
+ },
+ {
+ .trainerId = TRAINER_CYNDY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 44),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_MADELINE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) },
+ .generalTextId = TEXT_ID(1, 45),
+ .battleFrontierRecordStreakTextIndex = 8,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 8),
+ },
+ {
+ .trainerId = TRAINER_JENNY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 46),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_DIANA_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) },
+ .generalTextId = TEXT_ID(1, 47),
+ .battleFrontierRecordStreakTextIndex = 2,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 2),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 2),
+ },
+ {
+ .trainerId = TRAINER_AMY_AND_LIV_1,
+ .unused = 2,
+ .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) },
+ .generalTextId = TEXT_ID(1, 48),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 2),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 2),
+ },
+ {
+ .trainerId = TRAINER_ERNEST_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) },
+ .generalTextId = TEXT_ID(1, 49),
+ .battleFrontierRecordStreakTextIndex = 3,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 3),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 3),
+ },
+ {
+ .trainerId = TRAINER_CORY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) },
+ .generalTextId = TEXT_ID(1, 63),
+ .battleFrontierRecordStreakTextIndex = 3,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 3),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 3),
+ },
+ {
+ .trainerId = TRAINER_EDWIN_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 7), TEXT_ID(2, 7), TEXT_ID(3, 7) },
+ .generalTextId = TEXT_ID(1, 50),
+ .battleFrontierRecordStreakTextIndex = 7,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 7),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 7),
+ },
+ {
+ .trainerId = TRAINER_LYDIA_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) },
+ .generalTextId = TEXT_ID(1, 52),
+ .battleFrontierRecordStreakTextIndex = 8,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 8),
+ },
+ {
+ .trainerId = TRAINER_ISAAC_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) },
+ .generalTextId = TEXT_ID(1, 51),
+ .battleFrontierRecordStreakTextIndex = 5,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 5),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 5),
+ },
+ {
+ .trainerId = TRAINER_GABRIELLE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 8), TEXT_ID(2, 8), TEXT_ID(3, 8) },
+ .generalTextId = TEXT_ID(1, 2),
+ .battleFrontierRecordStreakTextIndex = 8,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 8),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 8),
+ },
+ {
+ .trainerId = TRAINER_CATHERINE_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 54),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
+ {
+ .trainerId = TRAINER_JACKSON_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 5), TEXT_ID(2, 5), TEXT_ID(3, 5) },
+ .generalTextId = TEXT_ID(1, 53),
+ .battleFrontierRecordStreakTextIndex = 5,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 5),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 5),
+ },
+ {
+ .trainerId = TRAINER_HALEY_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 2), TEXT_ID(2, 2), TEXT_ID(3, 2) },
+ .generalTextId = TEXT_ID(1, 55),
+ .battleFrontierRecordStreakTextIndex = 2,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 2),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 2),
+ },
+ {
+ .trainerId = TRAINER_JAMES_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 1), TEXT_ID(2, 1), TEXT_ID(3, 1) },
+ .generalTextId = TEXT_ID(1, 56),
+ .battleFrontierRecordStreakTextIndex = 1,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 1),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 1),
+ },
+ {
+ .trainerId = TRAINER_TRENT_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 3), TEXT_ID(2, 3), TEXT_ID(3, 3) },
+ .generalTextId = TEXT_ID(1, 57),
+ .battleFrontierRecordStreakTextIndex = 3,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 3),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 3),
+ },
+ {
+ .trainerId = TRAINER_SAWYER_1,
+ .unused = 0,
+ .battleTopicTextIds = { TEXT_ID(1, 15), TEXT_ID(2, 3), TEXT_ID(3, 3) },
+ .generalTextId = TEXT_ID(1, 1),
+ .battleFrontierRecordStreakTextIndex = 3,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 3),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 3),
+ },
+ {
+ .trainerId = TRAINER_KIRA_AND_DAN_1,
+ .unused = 1,
+ .battleTopicTextIds = { TEXT_ID(1, 9), TEXT_ID(2, 9), TEXT_ID(3, 9) },
+ .generalTextId = TEXT_ID(1, 58),
+ .battleFrontierRecordStreakTextIndex = 9,
+ .sameRouteMatchCallTextId = TEXT_ID(1, 9),
+ .differentRouteMatchCallTextId = TEXT_ID(2, 9),
+ },
};
-struct MatchCallStruct5 {
- u8 type;
- u8 v1;
- u16 flag;
- u16 v4;
- const u8 *desc;
- const u8 *name;
- const match_call_text_data_t *textData;
+static const struct MatchCallText sMatchCallWildBattleTexts[] =
+{
+ { .text = MatchCall_WildBattleText1, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText2, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText3, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText4, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText5, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText6, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText7, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText8, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText9, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText10, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText11, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText12, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText13, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText14, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_WildBattleText15, .stringVarFuncIds = { 0, 2, -1 } },
};
-#define MATCHCALLDEF(name, type_, ...) \
-static const struct MatchCallStruct##type_ name = { \
- .type = type_, \
- __VA_ARGS__ \
+ static const struct MatchCallText sMatchCallNegativeBattleTexts[] =
+ {
+ { .text = MatchCall_NegativeBattleText1, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText2, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText3, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText4, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText5, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText6, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText7, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText8, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText9, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText10, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText11, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText12, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText13, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_NegativeBattleText14, .stringVarFuncIds = { 0, -1, -1 } },
};
-typedef union {
- const struct MatchCallStructCommon *common;
- const struct MatchCallStruct0 *type0;
- const struct MatchCallStruct1 *type1;
- const struct MatchCallStruct2 *type2;
- const struct MatchCallStruct3 *type3;
- const struct MatchCallStruct4 *type4;
- const struct MatchCallStruct5 *type5;
-} match_call_t;
-
-struct UnkStruct_08625388 {
- u16 idx;
- u16 v2;
- u16 v4;
- const u8 *v8[4];
+static const struct MatchCallText sMatchCallPositiveBattleTexts[] =
+{
+ { .text = MatchCall_PositiveBattleText1, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText2, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText3, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText4, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText5, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText6, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText7, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText8, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText9, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText10, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText11, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText12, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText13, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PositiveBattleText14, .stringVarFuncIds = { 0, 3, -1 } },
};
-// Static RAM declarations
-
-// Static ROM declarations
-
-static bool32 MatchCallGetFlag_Type0(match_call_t);
-static bool32 MatchCallGetFlag_Type1(match_call_t);
-static bool32 MatchCallGetFlag_Type2(match_call_t);
-static bool32 MatchCallGetFlag_Type3(match_call_t);
-static bool32 MatchCallGetFlag_Type4(match_call_t);
-
-static u8 sub_81D1714(match_call_t);
-static u8 sub_81D1718(match_call_t);
-static u8 sub_81D171C(match_call_t);
-static u8 sub_81D1750(match_call_t);
-static u8 sub_81D1754(match_call_t);
-
-static bool32 MatchCall_IsRematchable_Type0(match_call_t);
-static bool32 MatchCall_IsRematchable_Type1(match_call_t);
-static bool32 MatchCall_IsRematchable_Type2(match_call_t);
-static bool32 MatchCall_IsRematchable_Type3(match_call_t);
-static bool32 MatchCall_IsRematchable_Type4(match_call_t);
-
-static bool32 sub_81D1840(match_call_t);
-static bool32 sub_81D1844(match_call_t);
-static bool32 sub_81D1848(match_call_t);
-static bool32 sub_81D184C(match_call_t);
-static bool32 sub_81D1850(match_call_t);
-
-static u32 MatchCall_GetRematchTableIdx_Type0(match_call_t);
-static u32 MatchCall_GetRematchTableIdx_Type1(match_call_t);
-static u32 MatchCall_GetRematchTableIdx_Type2(match_call_t);
-static u32 MatchCall_GetRematchTableIdx_Type3(match_call_t);
-static u32 MatchCall_GetRematchTableIdx_Type4(match_call_t);
-
-static void MatchCall_GetMessage_Type0(match_call_t, u8 *);
-static void MatchCall_GetMessage_Type1(match_call_t, u8 *);
-static void MatchCall_GetMessage_Type2(match_call_t, u8 *);
-static void MatchCall_GetMessage_Type3(match_call_t, u8 *);
-static void MatchCall_GetMessage_Type4(match_call_t, u8 *);
-
-static void MatchCall_GetNameAndDesc_Type0(match_call_t, const u8 **, const u8 **);
-static void MatchCall_GetNameAndDesc_Type1(match_call_t, const u8 **, const u8 **);
-static void MatchCall_GetNameAndDesc_Type2(match_call_t, const u8 **, const u8 **);
-static void MatchCall_GetNameAndDesc_Type3(match_call_t, const u8 **, const u8 **);
-static void MatchCall_GetNameAndDesc_Type4(match_call_t, const u8 **, const u8 **);
-
-static void sub_81D1920(const match_call_text_data_t *, u8 *);
-static void sub_81D199C(const match_call_text_data_t *, u16, u8 *);
-static void MatchCall_GetNameAndDescByRematchIdx(u32, const u8 **, const u8 **);
-
-extern const u8 gText_MrStone_Pokenav_2B60C0[];
-extern const u8 gText_MrStone_Pokenav_2B61E6[];
-extern const u8 gText_MrStone_Pokenav_2B6302[];
-extern const u8 gText_MrStone_Pokenav_2B63A0[];
-extern const u8 gText_MrStone_Pokenav_2B64A2[];
-extern const u8 gText_MrStone_Pokenav_2B6526[];
-extern const u8 gText_MrStone_Pokenav_2B65BB[];
-extern const u8 gText_MrStone_Pokenav_2B6664[];
-extern const u8 gText_MrStone_Pokenav_2B66B1[];
-extern const u8 gText_MrStone_Pokenav_2B6703[];
-extern const u8 gText_MrStone_Pokenav_2B67ED[];
-
-extern const u8 gMrStoneMatchCallDesc[];
-extern const u8 gMrStoneMatchCallName[];
-
-extern const u8 gText_Norman_Pokenav_2B5719[];
-extern const u8 gText_Norman_Pokenav_2B5795[];
-extern const u8 gText_Norman_Pokenav_2B584D[];
-extern const u8 gText_Norman_Pokenav_2B58E3[];
-extern const u8 gText_Norman_Pokenav_2B5979[];
-extern const u8 gText_Norman_Pokenav_2B5A07[];
-extern const u8 gText_Norman_Pokenav_2B5A69[];
-extern const u8 gText_Norman_Pokenav_2B5ACF[];
-extern const u8 gText_Norman_Pokenav_2B5B5E[];
-
-extern const u8 gNormanMatchCallDesc[];
-extern const u8 gNormanMatchCallName[];
-
-extern const u8 gProfBirchMatchCallDesc[];
-extern const u8 gProfBirchMatchCallName[];
-
-extern const u8 gText_Mom_Pokenav_2B227B[];
-extern const u8 gText_Mom_Pokenav_2B2310[];
-extern const u8 gText_Mom_Pokenav_2B23F3[];
-
-extern const u8 gMomMatchCallDesc[];
-extern const u8 gMomMatchCallName[];
-
-extern const u8 gText_Steven_Pokenav_2B5B95[];
-extern const u8 gText_Steven_Pokenav_2B5C53[];
-extern const u8 gText_Steven_Pokenav_2B5CC9[];
-extern const u8 gText_Steven_Pokenav_2B5DB4[];
-extern const u8 gText_Steven_Pokenav_2B5E26[];
-extern const u8 gText_Steven_Pokenav_2B5EA2[];
-extern const u8 gText_Steven_Pokenav_2B5ED9[];
-
-extern const u8 gStevenMatchCallDesc[];
-extern const u8 gStevenMatchCallName[];
-
-extern const u8 gText_May_Pokenav_2B3AB3[];
-extern const u8 gText_May_Pokenav_2B3B3F[];
-extern const u8 gText_May_Pokenav_2B3C13[];
-extern const u8 gText_May_Pokenav_2B3CF3[];
-extern const u8 gText_May_Pokenav_2B3D4B[];
-extern const u8 gText_May_Pokenav_2B3DD1[];
-extern const u8 gText_May_Pokenav_2B3E69[];
-extern const u8 gText_May_Pokenav_2B3ECD[];
-extern const u8 gText_May_Pokenav_2B3F2B[];
-extern const u8 gText_May_Pokenav_2B3FFB[];
-extern const u8 gText_May_Pokenav_2B402B[];
-extern const u8 gText_May_Pokenav_2B414B[];
-extern const u8 gText_May_Pokenav_2B4228[];
-extern const u8 gText_May_Pokenav_2B42E0[];
-extern const u8 gText_May_Pokenav_2B4350[];
-extern const u8 gMayBrendanMatchCallDesc[];
-extern const u8 gExpandedPlaceholder_May[];
-extern const u8 gText_Brendan_Pokenav_2B43EF[];
-extern const u8 gText_Brendan_Pokenav_2B4486[];
-extern const u8 gText_Brendan_Pokenav_2B4560[];
-extern const u8 gText_Brendan_Pokenav_2B463F[];
-extern const u8 gText_Brendan_Pokenav_2B46B7[];
-extern const u8 gText_Brendan_Pokenav_2B4761[];
-extern const u8 gText_Brendan_Pokenav_2B47F4[];
-extern const u8 gText_Brendan_Pokenav_2B4882[];
-extern const u8 gText_Brendan_Pokenav_2B4909[];
-extern const u8 gText_Brendan_Pokenav_2B49C4[];
-extern const u8 gText_Brendan_Pokenav_2B4A44[];
-extern const u8 gText_Brendan_Pokenav_2B4B28[];
-extern const u8 gText_Brendan_Pokenav_2B4C15[];
-extern const u8 gText_Brendan_Pokenav_2B4CD8[];
-extern const u8 gText_Brendan_Pokenav_2B4D46[];
-extern const u8 gExpandedPlaceholder_Brendan[];
-extern const u8 gText_Wally_Pokenav_2B4DE2[];
-extern const u8 gText_Wally_Pokenav_2B4E57[];
-extern const u8 gText_Wally_Pokenav_2B4EA5[];
-extern const u8 gText_Wally_Pokenav_2B4F41[];
-extern const u8 gText_Wally_Pokenav_2B4FF3[];
-extern const u8 gText_Wally_Pokenav_2B50B1[];
-extern const u8 gText_Wally_Pokenav_2B5100[];
-extern const u8 gWallyMatchCallDesc[];
-extern const u8 gText_Scott_Pokenav_2B5184[];
-extern const u8 gText_Scott_Pokenav_2B5275[];
-extern const u8 gText_Scott_Pokenav_2B5323[];
-extern const u8 gText_Scott_Pokenav_2B53DB[];
-extern const u8 gText_Scott_Pokenav_2B54A5[];
-extern const u8 gText_Scott_Pokenav_2B5541[];
-extern const u8 gText_Scott_Pokenav_2B56CA[];
-extern const u8 gScottMatchCallDesc[];
-extern const u8 gScottMatchCallName[];
-extern const u8 gText_Roxanne_Pokenav_2B2456[];
-extern const u8 gText_Roxanne_Pokenav_2B250E[];
-extern const u8 gText_Roxanne_Pokenav_2B25C1[];
-extern const u8 gText_Roxanne_Pokenav_2B2607[];
-extern const u8 gRoxanneMatchCallDesc[];
-extern const u8 gText_Brawly_Pokenav_2B2659[];
-extern const u8 gText_Brawly_Pokenav_2B275D[];
-extern const u8 gText_Brawly_Pokenav_2B286F[];
-extern const u8 gText_Brawly_Pokenav_2B28D1[];
-extern const u8 gBrawlyMatchCallDesc[];
-extern const u8 gText_Wattson_Pokenav_2B2912[];
-extern const u8 gText_Wattson_Pokenav_2B29CA[];
-extern const u8 gText_Wattson_Pokenav_2B2AB6[];
-extern const u8 gText_Wattson_Pokenav_2B2B01[];
-extern const u8 gWattsonMatchCallDesc[];
-extern const u8 gText_Flannery_Pokenav_2B2B4D[];
-extern const u8 gText_Flannery_Pokenav_2B2C0E[];
-extern const u8 gText_Flannery_Pokenav_2B2CF1[];
-extern const u8 gText_Flannery_Pokenav_2B2D54[];
-extern const u8 gFlanneryMatchCallDesc[];
-extern const u8 gText_Winona_Pokenav_2B2DA4[];
-extern const u8 gText_Winona_Pokenav_2B2E2B[];
-extern const u8 gText_Winona_Pokenav_2B2EC2[];
-extern const u8 gText_Winona_Pokenav_2B2F16[];
-extern const u8 gWinonaMatchCallDesc[];
-extern const u8 gText_TateLiza_Pokenav_2B2F97[];
-extern const u8 gText_TateLiza_Pokenav_2B306E[];
-extern const u8 gText_TateLiza_Pokenav_2B3158[];
-extern const u8 gText_TateLiza_Pokenav_2B31CD[];
-extern const u8 gTateLizaMatchCallDesc[];
-extern const u8 gText_Juan_Pokenav_2B3249[];
-extern const u8 gText_Juan_Pokenav_2B32EC[];
-extern const u8 gText_Juan_Pokenav_2B33AA[];
-extern const u8 gText_Juan_Pokenav_2B341E[];
-extern const u8 gJuanMatchCallDesc[];
-extern const u8 gText_Sidney_Pokenav_2B34CC[];
-extern const u8 gEliteFourMatchCallDesc[];
-extern const u8 gText_Phoebe_Pokenav_2B3561[];
-extern const u8 gText_Glacia_Pokenav_2B35E4[];
-extern const u8 gText_Drake_Pokenav_2B368B[];
-extern const u8 gText_Wallace_Pokenav_2B3790[];
-extern const u8 gChampionMatchCallDesc[];
-extern const u8 gMatchCallStevenStrategyText[];
-extern const u8 gMatchCall_StevenTrainersPokemonText[];
-extern const u8 gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle[];
-extern const u8 gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle[];
-extern const u8 gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle[];
-extern const u8 gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle[];
-extern const u8 gMatchCall_BrendanStrategyText[];
-extern const u8 gMatchCall_BrendanTrainersPokemonText[];
-extern const u8 gMatchCall_BrendanSelfIntroductionText_Line1[];
-extern const u8 gMatchCall_BrendanSelfIntroductionText_Line2[];
-extern const u8 gMatchCall_MayStrategyText[];
-extern const u8 gMatchCall_MayTrainersPokemonText[];
-extern const u8 gMatchCall_MaySelfIntroductionText_Line1[];
-extern const u8 gMatchCall_MaySelfIntroductionText_Line2[];
-// .rodata
-
-static const match_call_text_data_t sMrStoneTextScripts[] = {
- { gText_MrStone_Pokenav_2B60C0, 0xFFFF, FLAG_0x158 },
- { gText_MrStone_Pokenav_2B61E6, FLAG_0x158, 0xFFFF },
- { gText_MrStone_Pokenav_2B6302, FLAG_0x0BD, 0xFFFF },
- { gText_MrStone_Pokenav_2B63A0, FLAG_0x110, 0xFFFF },
- { gText_MrStone_Pokenav_2B64A2, FLAG_0x06A, 0xFFFF },
- { gText_MrStone_Pokenav_2B6526, FLAG_0x4F4, 0xFFFF },
- { gText_MrStone_Pokenav_2B65BB, FLAG_0x097, 0xFFFF },
- { gText_MrStone_Pokenav_2B6664, FLAG_0x06F, 0xFFFF },
- { gText_MrStone_Pokenav_2B66B1, FLAG_0x070, 0xFFFF },
- { gText_MrStone_Pokenav_2B6703, FLAG_0x4F7, 0xFFFF },
- { gText_MrStone_Pokenav_2B67ED, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText sMatchCallSameRouteBattleRequestTexts[] =
+{
+ { .text = MatchCall_SameRouteBattleRequestText1, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText2, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText3, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText4, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText5, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText6, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText7, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText8, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText9, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText10, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText11, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText12, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText13, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_SameRouteBattleRequestText14, .stringVarFuncIds = { 0, 1, -1 } },
};
-MATCHCALLDEF(sMrStoneMatchCallHeader, 0, 10, 0xffff, gMrStoneMatchCallDesc, gMrStoneMatchCallName, sMrStoneTextScripts);
-
-static const match_call_text_data_t sNormanTextScripts[] = {
- { gText_Norman_Pokenav_2B5719, FLAG_0x132, 0xFFFF },
- { gText_Norman_Pokenav_2B5795, FLAG_0x4F1, 0xFFFF },
- { gText_Norman_Pokenav_2B584D, FLAG_0x4F3, 0xFFFF },
- { gText_Norman_Pokenav_2B58E3, FLAG_0x4F4, 0xFFFF },
- { gText_Norman_Pokenav_2B5979, FLAG_0x0D4, 0xFFFF },
- { gText_Norman_Pokenav_2B5A07, 0xFFFE, 0xFFFF },
- { gText_Norman_Pokenav_2B5A69, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { gText_Norman_Pokenav_2B5ACF, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { gText_Norman_Pokenav_2B5B5E, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText sMatchCallDifferentRouteBattleRequestTexts[] =
+{
+ { .text = MatchCall_DifferentRouteBattleRequestText1, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText2, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText3, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText4, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText5, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText6, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText7, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText8, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText9, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText10, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText11, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText12, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText13, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_DifferentRouteBattleRequestText14, .stringVarFuncIds = { 0, 1, -1 } },
};
-MATCHCALLDEF(sNormanMatchCallHeader, 5, 7, FLAG_0x132, 0x45, gNormanMatchCallDesc, gNormanMatchCallName, sNormanTextScripts);
-
-MATCHCALLDEF(sProfBirchMatchCallHeader, 3, 0, FLAG_0x119, gProfBirchMatchCallDesc, gProfBirchMatchCallName)
-
-static const match_call_text_data_t sMomTextScripts[] = {
- { gText_Mom_Pokenav_2B227B, 0xffff, 0xffff },
- { gText_Mom_Pokenav_2B2310, FLAG_0x4F4, 0xffff },
- { gText_Mom_Pokenav_2B23F3, FLAG_SYS_GAME_CLEAR, 0xffff },
- { NULL, 0xffff, 0xffff }
+static const struct MatchCallText sMatchCallPersonalizedTexts[] =
+{
+ { .text = MatchCall_PersonalizedText1, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_PersonalizedText2, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText3, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText4, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText5, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText6, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText7, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText8, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText9, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText10, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText11, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText12, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText13, .stringVarFuncIds = { 0, 2, -1 } },
+ { .text = MatchCall_PersonalizedText14, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText15, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText16, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText17, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText18, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PersonalizedText19, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText20, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText21, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText22, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText23, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText24, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText25, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText26, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText27, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText28, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PersonalizedText29, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PersonalizedText30, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText31, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText32, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText33, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText34, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText35, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText36, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText37, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText38, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText39, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText40, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText41, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText42, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PersonalizedText43, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText44, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PersonalizedText45, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText46, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText47, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText48, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText49, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText50, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText51, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_PersonalizedText52, .stringVarFuncIds = { 0, 3, -1 } },
+ { .text = MatchCall_PersonalizedText53, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText54, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText55, .stringVarFuncIds = { 0, 1, -1 } },
+ { .text = MatchCall_PersonalizedText56, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText57, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText58, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText59, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText60, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText61, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText62, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText63, .stringVarFuncIds = { 0, -1, -1 } },
+ { .text = MatchCall_PersonalizedText64, .stringVarFuncIds = { 0, -1, -1 } },
};
-MATCHCALLDEF(sMomMatchCallHeader, 0, 0, FLAG_0x0D8, gMomMatchCallDesc, gMomMatchCallName, sMomTextScripts);
-
-static const match_call_text_data_t sStevenTextScripts[] = {
- { gText_Steven_Pokenav_2B5B95, 0xffff, 0xffff },
- { gText_Steven_Pokenav_2B5C53, FLAG_RUSTURF_TUNNEL_OPENED, 0xffff },
- { gText_Steven_Pokenav_2B5CC9, FLAG_0x0D4, 0xffff },
- { gText_Steven_Pokenav_2B5DB4, FLAG_0x070, 0xffff },
- { gText_Steven_Pokenav_2B5E26, FLAG_0x4F6, 0xffff },
- { gText_Steven_Pokenav_2B5EA2, FLAG_0x081, 0xffff },
- { gText_Steven_Pokenav_2B5ED9, FLAG_SYS_GAME_CLEAR, 0xffff },
- { NULL, 0xffff, 0xffff },
+static const struct MatchCallText sMatchCallBattleFrontierStreakTexts[] =
+{
+ { .text = MatchCall_BattleFrontierStreakText1, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText2, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText3, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText4, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText5, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText6, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText7, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText8, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText9, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText10, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText11, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText12, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText13, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierStreakText14, .stringVarFuncIds = { 0, 4, 5 } },
};
-MATCHCALLDEF(sStevenMatchCallHeader, 0, 0xd5, FLAG_0x131, gStevenMatchCallDesc, gStevenMatchCallName, sStevenTextScripts);
-
-static const match_call_text_data_t sMayTextScripts[] = {
- { gText_May_Pokenav_2B3AB3, 0xFFFF, 0xFFFF },
- { gText_May_Pokenav_2B3B3F, FLAG_0x4F1, 0xFFFF },
- { gText_May_Pokenav_2B3C13, FLAG_0x095, 0xFFFF },
- { gText_May_Pokenav_2B3CF3, FLAG_HIDE_MAUVILLE_CITY_WALLY, 0xFFFF },
- { gText_May_Pokenav_2B3D4B, FLAG_0x06A, 0xFFFF },
- { gText_May_Pokenav_2B3DD1, FLAG_0x4F3, 0xFFFF },
- { gText_May_Pokenav_2B3E69, FLAG_0x4F4, 0xFFFF },
- { gText_May_Pokenav_2B3ECD, FLAG_0x097, 0xFFFF },
- { gText_May_Pokenav_2B3F2B, FLAG_0x0D4, 0xFFFF },
- { gText_May_Pokenav_2B3FFB, FLAG_0x06F, 0xFFFF },
- { gText_May_Pokenav_2B402B, FLAG_0x061, 0xFFFF },
- { gText_May_Pokenav_2B414B, FLAG_0x070, 0xFFFF },
- { gText_May_Pokenav_2B4228, FLAG_0x081, 0xFFFF },
- { gText_May_Pokenav_2B42E0, FLAG_0x4F7, 0xFFFF },
- { gText_May_Pokenav_2B4350, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText sMatchCallBattleFrontierRecordStreakTexts[] =
+{
+ { .text = MatchCall_BattleFrontierRecordStreakText1, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText2, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText3, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText4, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText5, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText6, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText7, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText8, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText9, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText10, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText11, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText12, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText13, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleFrontierRecordStreakText14, .stringVarFuncIds = { 0, 4, 5 } },
};
-MATCHCALLDEF(sMayMatchCallHeader, 4, MALE, FLAG_0x0FD, gMayBrendanMatchCallDesc, gExpandedPlaceholder_May, sMayTextScripts);
-
-static const match_call_text_data_t sBrendanTextScripts[] = {
- { gText_Brendan_Pokenav_2B43EF, 0xFFFF, 0xFFFF },
- { gText_Brendan_Pokenav_2B4486, FLAG_0x4F1, 0xFFFF },
- { gText_Brendan_Pokenav_2B4560, FLAG_0x095, 0xFFFF },
- { gText_Brendan_Pokenav_2B463F, FLAG_HIDE_MAUVILLE_CITY_WALLY, 0xFFFF },
- { gText_Brendan_Pokenav_2B46B7, FLAG_0x06A, 0xFFFF },
- { gText_Brendan_Pokenav_2B4761, FLAG_0x4F3, 0xFFFF },
- { gText_Brendan_Pokenav_2B47F4, FLAG_0x4F4, 0xFFFF },
- { gText_Brendan_Pokenav_2B4882, FLAG_0x097, 0xFFFF },
- { gText_Brendan_Pokenav_2B4909, FLAG_0x0D4, 0xFFFF },
- { gText_Brendan_Pokenav_2B49C4, FLAG_0x06F, 0xFFFF },
- { gText_Brendan_Pokenav_2B4A44, FLAG_0x061, 0xFFFF },
- { gText_Brendan_Pokenav_2B4B28, FLAG_0x070, 0xFFFF },
- { gText_Brendan_Pokenav_2B4C15, FLAG_0x081, 0xFFFF },
- { gText_Brendan_Pokenav_2B4CD8, FLAG_0x4F7, 0xFFFF },
- { gText_Brendan_Pokenav_2B4D46, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText sMatchCallBattleDomeTexts[] =
+{
+ { .text = MatchCall_BattleDomeText1, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText2, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText3, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText4, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText5, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText6, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText7, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText8, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText9, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText10, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText11, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText12, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText13, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattleDomeText14, .stringVarFuncIds = { 0, 4, 5 } },
};
-MATCHCALLDEF(sBrendanMatchCallHeader, 4, FEMALE, FLAG_0x0FD, gMayBrendanMatchCallDesc, gExpandedPlaceholder_Brendan, sBrendanTextScripts);
-
-static const match_call_text_data_t sWallyTextScripts[] = {
- { gText_Wally_Pokenav_2B4DE2, 0xFFFF, 0xFFFF },
- { gText_Wally_Pokenav_2B4E57, FLAG_RUSTURF_TUNNEL_OPENED, 0xFFFF },
- { gText_Wally_Pokenav_2B4EA5, FLAG_0x4F3, 0xFFFF },
- { gText_Wally_Pokenav_2B4F41, FLAG_0x097, 0xFFFF },
- { gText_Wally_Pokenav_2B4FF3, FLAG_0x06F, 0xFFFF },
- { gText_Wally_Pokenav_2B50B1, FLAG_0x081, 0xFFFF },
- { gText_Wally_Pokenav_2B5100, FLAG_0x07E, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText sMatchCallBattlePikeTexts[] =
+{
+ { .text = MatchCall_BattlePikeText1, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText2, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText3, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText4, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText5, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText6, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText7, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText8, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText9, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText10, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText11, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText12, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText13, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePikeText14, .stringVarFuncIds = { 0, 4, 5 } },
};
-const struct MatchCallSubstruct2 sWallyAdditionalData[] = {
- { FLAG_HIDE_MAUVILLE_CITY_WALLY, 0x05 },
- { FLAG_0x06F, 0xD5 },
- { FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY, 0x46 },
- { 0xFFFF, 0xD5 }
+static const struct MatchCallText sMatchCallBattlePyramidTexts[] =
+{
+ { .text = MatchCall_BattlePyramidText1, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText2, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText3, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText4, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText5, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText6, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText7, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText8, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText9, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText10, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText11, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText12, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText13, .stringVarFuncIds = { 0, 4, 5 } },
+ { .text = MatchCall_BattlePyramidText14, .stringVarFuncIds = { 0, 4, 5 } },
};
-MATCHCALLDEF(sWallyMatchCallHeader, 2, 0, FLAG_0x0D6, REMATCH_WALLY_3, gWallyMatchCallDesc, sWallyTextScripts, sWallyAdditionalData);
-
-static const match_call_text_data_t sScottTextScripts[] = {
- { gText_Scott_Pokenav_2B5184, 0xFFFF, 0xFFFF },
- { gText_Scott_Pokenav_2B5275, FLAG_0x08B, 0xFFFF },
- { gText_Scott_Pokenav_2B5323, FLAG_0x097, 0xFFFF },
- { gText_Scott_Pokenav_2B53DB, FLAG_0x0D4, 0xFFFF },
- { gText_Scott_Pokenav_2B54A5, FLAG_0x070, 0xFFFF },
- { gText_Scott_Pokenav_2B5541, FLAG_0x4F7, 0xFFFF },
- { gText_Scott_Pokenav_2B56CA, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText *const sMatchCallBattleTopics[] =
+{
+ sMatchCallWildBattleTexts,
+ sMatchCallNegativeBattleTexts,
+ sMatchCallPositiveBattleTexts,
};
-
-MATCHCALLDEF(sScottMatchCallHeader, 0, 0xD5, FLAG_0x0D7, gScottMatchCallDesc, gScottMatchCallName, sScottTextScripts);
-
-static const match_call_text_data_t sRoxanneTextScripts[] = {
- { gText_Roxanne_Pokenav_2B2456, 0xFFFE, 0xFFFF },
- { gText_Roxanne_Pokenav_2B250E, 0xFFFF, 0xFFFF },
- { gText_Roxanne_Pokenav_2B25C1, 0xFFFF, 0xFFFF },
- { gText_Roxanne_Pokenav_2B2607, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText *const sMatchCallBattleRequestTopics[] =
+{
+ sMatchCallSameRouteBattleRequestTexts,
+ sMatchCallDifferentRouteBattleRequestTexts,
};
-MATCHCALLDEF(sRoxanneMatchCallHeader, 5, 10, FLAG_0x1D3, 0x41, gRoxanneMatchCallDesc, NULL, sRoxanneTextScripts);
-
-static const match_call_text_data_t sBrawlyTextScripts[] = {
- { gText_Brawly_Pokenav_2B2659, 0xFFFE, 0xFFFF },
- { gText_Brawly_Pokenav_2B275D, 0xFFFF, 0xFFFF },
- { gText_Brawly_Pokenav_2B286F, 0xFFFF, 0xFFFF },
- { gText_Brawly_Pokenav_2B28D1, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
+static const struct MatchCallText *const sMatchCallGeneralTopics[] =
+{
+ sMatchCallPersonalizedTexts,
+ sMatchCallBattleFrontierStreakTexts,
+ sMatchCallBattleFrontierRecordStreakTexts,
+ sMatchCallBattleDomeTexts,
+ sMatchCallBattlePikeTexts,
+ sMatchCallBattlePyramidTexts,
};
-MATCHCALLDEF(sBrawlyMatchCallHeader, 5, 2, FLAG_0x1D4, 0x42, gBrawlyMatchCallDesc, NULL, sBrawlyTextScripts);
-
-static const match_call_text_data_t sWattsonTextScripts[] = {
- { gText_Wattson_Pokenav_2B2912, 0xFFFE, 0xFFFF },
- { gText_Wattson_Pokenav_2B29CA, 0xFFFF, 0xFFFF },
- { gText_Wattson_Pokenav_2B2AB6, 0xFFFF, 0xFFFF },
- { gText_Wattson_Pokenav_2B2B01, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+extern const u8 gUnknown_082A5C9C[];
+extern const u8 gUnknown_082A5D2C[];
+extern const u8 gUnknown_082A633D[];
-MATCHCALLDEF(sWattsonMatchCallHeader, 5, 9, FLAG_0x1D5, 0x43, gWattsonMatchCallDesc, NULL, sWattsonTextScripts);
+void InitMatchCallCounters(void)
+{
+ RtcCalcLocalTime();
+ gMatchCallState.minutes = GetCurrentTotalMinutes(&gLocalTime) + 10;
+ gMatchCallState.stepCounter = 0;
+}
-static const match_call_text_data_t sFlanneryTextScripts[] = {
- { gText_Flannery_Pokenav_2B2B4D, 0xFFFE, 0xFFFF },
- { gText_Flannery_Pokenav_2B2C0E, 0xFFFF, 0xFFFF },
- { gText_Flannery_Pokenav_2B2CF1, 0xFFFF, 0xFFFF },
- { gText_Flannery_Pokenav_2B2D54, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+static u32 GetCurrentTotalMinutes(struct Time *time)
+{
+ return time->days * 1440 + time->hours * 60 + time->minutes;
+}
-MATCHCALLDEF(sFlanneryMatchCallHeader, 5, 3, FLAG_0x1D6, 0x44, gFlanneryMatchCallDesc, NULL, sFlanneryTextScripts);
+static bool32 UpdateMatchCallMinutesCounter(void)
+{
+ int curMinutes;
+ RtcCalcLocalTime();
+ curMinutes = GetCurrentTotalMinutes(&gLocalTime);
+ if (gMatchCallState.minutes > curMinutes || curMinutes - gMatchCallState.minutes > 9)
+ {
+ gMatchCallState.minutes = curMinutes;
+ return TRUE;
+ }
-static const match_call_text_data_t sWinonaTextScripts[] = {
- { gText_Winona_Pokenav_2B2DA4, 0xFFFE, 0xFFFF },
- { gText_Winona_Pokenav_2B2E2B, 0xFFFF, 0xFFFF },
- { gText_Winona_Pokenav_2B2EC2, 0xFFFF, 0xFFFF },
- { gText_Winona_Pokenav_2B2F16, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+ return FALSE;
+}
-MATCHCALLDEF(sWinonaMatchCallHeader, 5, 11, FLAG_0x1D7, 0x46, gWinonaMatchCallDesc, NULL, sWinonaTextScripts);
+static bool32 CheckMatchCallChance(void)
+{
+ int callChance = 1;
+ if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG) && GetMonAbility(&gPlayerParty[0]) == ABILITY_LIGHTNING_ROD)
+ callChance = 2;
+
+ if (Random() % 10 < callChance * 3)
+ return TRUE;
+ else
+ return FALSE;
+}
-static const match_call_text_data_t sTateLizaTextScripts[] = {
- { gText_TateLiza_Pokenav_2B2F97, 0xFFFE, 0xFFFF },
- { gText_TateLiza_Pokenav_2B306E, 0xFFFF, 0xFFFF },
- { gText_TateLiza_Pokenav_2B3158, 0xFFFF, 0xFFFF },
- { gText_TateLiza_Pokenav_2B31CD, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+static bool32 MapAllowsMatchCall(void)
+{
+ if (!Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) || gMapHeader.regionMapSectionId == MAPSEC_SAFARI_ZONE)
+ return FALSE;
+
+ if (gMapHeader.regionMapSectionId == MAPSEC_SOOTOPOLIS_CITY
+ && FlagGet(FLAG_HIDE_SOOTOPOLIS_CITY_RAYQUAZA) == TRUE
+ && FlagGet(FLAG_UNUSED_0x0DC) == FALSE)
+ return FALSE;
-MATCHCALLDEF(sTateLizaMatchCallHeader, 5, 13, FLAG_0x1D8, 0x47, gTateLizaMatchCallDesc, NULL, sTateLizaTextScripts);
+ if (gMapHeader.regionMapSectionId == MAPSEC_MT_CHIMNEY
+ && FlagGet(FLAG_MET_ARCHIE_METEOR_FALLS) == TRUE
+ && FlagGet(FLAG_DEFEATED_EVIL_TEAM_MT_CHIMNEY) == FALSE)
+ return FALSE;
-static const match_call_text_data_t sJuanTextScripts[] = {
- { gText_Juan_Pokenav_2B3249, 0xFFFE, 0xFFFF },
- { gText_Juan_Pokenav_2B32EC, 0xFFFF, 0xFFFF },
- { gText_Juan_Pokenav_2B33AA, 0xFFFF, 0xFFFF },
- { gText_Juan_Pokenav_2B341E, FLAG_SYS_GAME_CLEAR, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+ return TRUE;
+}
-MATCHCALLDEF(sJuanMatchCallHeader, 5, 14, FLAG_0x1D9, 0x48, gJuanMatchCallDesc, NULL, sJuanTextScripts);
+static bool32 UpdateMatchCallStepCounter(void)
+{
+ if (++gMatchCallState.stepCounter >= 10)
+ {
+ gMatchCallState.stepCounter = 0;
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
-static const match_call_text_data_t sSidneyTextScripts[] = {
- { gText_Sidney_Pokenav_2B34CC, 0xFFFF, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+static bool32 SelectMatchCallTrainer(void)
+{
+ u32 matchCallId;
+ u32 numRegistered = GetNumRegisteredNPCs();
+ if (!numRegistered)
+ return FALSE;
-MATCHCALLDEF(sSidneyMatchCallHeader, 5, 15, FLAG_0x1A5, 0x49, gEliteFourMatchCallDesc, NULL, sSidneyTextScripts);
+ gMatchCallState.trainerId = GetActiveMatchCallTrainerId(Random() % numRegistered);
+ gMatchCallState.triggeredFromScript = 0;
+ if (gMatchCallState.trainerId == REMATCH_TABLE_ENTRIES)
+ return FALSE;
-static const match_call_text_data_t sPhoebeTextScripts[] = {
- { gText_Phoebe_Pokenav_2B3561, 0xFFFF, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+ matchCallId = GetTrainerMatchCallId(gMatchCallState.trainerId);
+ if (GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId && !TrainerIsEligibleForRematch(matchCallId))
+ return FALSE;
-MATCHCALLDEF(sPhoebeMatchCallHeader, 5, 15, FLAG_0x1A6, 0x4A, gEliteFourMatchCallDesc, NULL, sPhoebeTextScripts);
+ return TRUE;
+}
-static const match_call_text_data_t sGlaciaTextScripts[] = {
- { gText_Glacia_Pokenav_2B35E4, 0xFFFF, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+static u32 GetNumRegisteredNPCs(void)
+{
+ u32 i, count;
+ for (i = 0, count = 0; i < 64; i++)
+ {
+ if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i))
+ count++;
+ }
-MATCHCALLDEF(sGlaciaMatchCallHeader, 5, 15, FLAG_0x1A7, 0x4B, gEliteFourMatchCallDesc, NULL, sGlaciaTextScripts);
+ return count;
+}
-static const match_call_text_data_t sDrakeTextScripts[] = {
- { gText_Drake_Pokenav_2B368B, 0xFFFF, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+static u32 GetActiveMatchCallTrainerId(u32 activeMatchCallId)
+{
+ u32 i;
+ for (i = 0; i < 64; i++)
+ {
+ if (FlagGet(FLAG_MATCH_CALL_REGISTERED + i))
+ {
+ if (!activeMatchCallId)
+ return gRematchTable[i].trainerIds[0];
-MATCHCALLDEF(sDrakeMatchCallHeader, 5, 15, FLAG_0x1A8, 0x4C, gEliteFourMatchCallDesc, NULL, sDrakeTextScripts);
+ activeMatchCallId--;
+ }
+ }
-static const match_call_text_data_t sWallaceTextScripts[] = {
- { gText_Wallace_Pokenav_2B3790, 0xFFFF, 0xFFFF },
- { NULL, 0xFFFF, 0xFFFF }
-};
+ return REMATCH_TABLE_ENTRIES;
+}
-MATCHCALLDEF(sWallaceMatchCallHeader, 5, 15, FLAG_0x1A9, 0x4D, gChampionMatchCallDesc, NULL, sWallaceTextScripts);
-
-static const match_call_t sMatchCallHeaders[] = {
- {.type0 = &sMrStoneMatchCallHeader},
- {.type3 = &sProfBirchMatchCallHeader},
- {.type4 = &sBrendanMatchCallHeader},
- {.type4 = &sMayMatchCallHeader},
- {.type2 = &sWallyMatchCallHeader},
- {.type5 = &sNormanMatchCallHeader},
- {.type0 = &sMomMatchCallHeader},
- {.type0 = &sStevenMatchCallHeader},
- {.type0 = &sScottMatchCallHeader},
- {.type5 = &sRoxanneMatchCallHeader},
- {.type5 = &sBrawlyMatchCallHeader},
- {.type5 = &sWattsonMatchCallHeader},
- {.type5 = &sFlanneryMatchCallHeader},
- {.type5 = &sWinonaMatchCallHeader},
- {.type5 = &sTateLizaMatchCallHeader},
- {.type5 = &sJuanMatchCallHeader},
- {.type5 = &sSidneyMatchCallHeader},
- {.type5 = &sPhoebeMatchCallHeader},
- {.type5 = &sGlaciaMatchCallHeader},
- {.type5 = &sDrakeMatchCallHeader},
- {.type5 = &sWallaceMatchCallHeader}
-};
+bool32 TryStartMatchCall(void)
+{
+ if (FlagGet(FLAG_HAS_MATCH_CALL) && UpdateMatchCallStepCounter() && UpdateMatchCallMinutesCounter()
+ && CheckMatchCallChance() && MapAllowsMatchCall() && SelectMatchCallTrainer())
+ {
+ StartMatchCall();
+ return TRUE;
+ }
-static bool32 (*const sMatchCallGetFlagFuncs[])(match_call_t) = {
- MatchCallGetFlag_Type0,
- MatchCallGetFlag_Type1,
- MatchCallGetFlag_Type2,
- MatchCallGetFlag_Type3,
- MatchCallGetFlag_Type4
-};
+ return FALSE;
+}
-static u8 (*const gUnknown_08625310[])(match_call_t) = {
- sub_81D1714,
- sub_81D1718,
- sub_81D171C,
- sub_81D1750,
- sub_81D1754
-};
+void StartMatchCallFromScript(void)
+{
+ gMatchCallState.triggeredFromScript = 1;
+ StartMatchCall();
+}
-static bool32 (*const sMatchCall_IsRematchableFunctions[])(match_call_t) = {
- MatchCall_IsRematchable_Type0,
- MatchCall_IsRematchable_Type1,
- MatchCall_IsRematchable_Type2,
- MatchCall_IsRematchable_Type3,
- MatchCall_IsRematchable_Type4
-};
+bool8 IsMatchCallTaskActive(void)
+{
+ return FuncIsActiveTask(ExecuteMatchCall);
+}
-static bool32 (*const gUnknown_08625338[])(match_call_t) = {
- sub_81D1840,
- sub_81D1844,
- sub_81D1848,
- sub_81D184C,
- sub_81D1850
-};
+static void StartMatchCall(void)
+{
+ if (!gMatchCallState.triggeredFromScript)
+ {
+ ScriptContext2_Enable();
+ FreezeEventObjects();
+ sub_808B864();
+ sub_808BCF4();
+ }
-static u32 (*const sMatchCall_GetRematchTableIdxFunctions[])(match_call_t) = {
- MatchCall_GetRematchTableIdx_Type0,
- MatchCall_GetRematchTableIdx_Type1,
- MatchCall_GetRematchTableIdx_Type2,
- MatchCall_GetRematchTableIdx_Type3,
- MatchCall_GetRematchTableIdx_Type4
-};
+ PlaySE(SE_TOREEYE);
+ CreateTask(ExecuteMatchCall, 1);
+}
-static void (*const sMatchCall_GetMessageFunctions[])(match_call_t, u8 *) = {
- MatchCall_GetMessage_Type0,
- MatchCall_GetMessage_Type1,
- MatchCall_GetMessage_Type2,
- MatchCall_GetMessage_Type3,
- MatchCall_GetMessage_Type4
-};
+static const u16 sUnknown_0860EA4C[] = INCBIN_U16("graphics/unknown/unknown_60EA4C.gbapal");
+static const u8 sUnknown_0860EA6C[] = INCBIN_U8("graphics/interface/menu_border.4bpp");
+static const u16 sPokeNavIconPalette[] = INCBIN_U16("graphics/pokenav/icon.gbapal");
+static const u32 sPokeNavIconGfx[] = INCBIN_U32("graphics/pokenav/icon.4bpp.lz");
-static void (*const sMatchCall_GetNameAndDescFunctions[])(match_call_t, const u8 **, const u8 **) = {
- MatchCall_GetNameAndDesc_Type0,
- MatchCall_GetNameAndDesc_Type1,
- MatchCall_GetNameAndDesc_Type2,
- MatchCall_GetNameAndDesc_Type3,
- MatchCall_GetNameAndDesc_Type4
-};
+static const u8 sText_PokenavCallEllipsis[] = _("………………\p");
-static const struct UnkStruct_08625388 sMatchCallCheckPageOverrides[] = {
- { 7, 0x4B, 0xffff, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle } }, // STEVEN
- { 7, 0x4B, FLAG_0x4F6, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle } }, // STEVEN
- { 2, 0x3c, 0xffff, { gMatchCall_BrendanStrategyText, gMatchCall_BrendanTrainersPokemonText, gMatchCall_BrendanSelfIntroductionText_Line1, gMatchCall_BrendanSelfIntroductionText_Line2 } }, // Brendan
- { 3, 0x3f, 0xffff, { gMatchCall_MayStrategyText, gMatchCall_MayTrainersPokemonText, gMatchCall_MaySelfIntroductionText_Line1, gMatchCall_MaySelfIntroductionText_Line2 } } // May
+static bool32 (*const sMatchCallTaskFuncs[])(u8) =
+{
+ LoadMatchCallWindowGfx,
+ MoveMatchCallWindowToVram,
+ PrintMatchCallIntroEllipsis,
+ sub_81962B0,
+ sub_81962D8,
+ sub_8196330,
+ sub_8196390,
+ sub_81963F0,
};
-// .text
-
-static u32 MatchCallGetFunctionIndex(match_call_t matchCall)
+static void ExecuteMatchCall(u8 taskId)
{
- switch (matchCall.common->type)
+ s16 *taskData = gTasks[taskId].data;
+ if (sMatchCallTaskFuncs[taskData[0]](taskId))
{
- case 0:
- default:
- return 0;
- case 1:
- case 5:
- return 1;
- case 2:
- return 2;
- case 4:
- return 3;
- case 3:
- return 4;
+ taskData[0]++;
+ taskData[1] = 0;
+ if ((u16)taskData[0] > 7)
+ DestroyTask(taskId);
}
}
-u32 GetTrainerIdxByRematchIdx(u32 rematchIdx)
+static const struct WindowTemplate sMatchCallTextWindow =
{
- return gRematchTable[rematchIdx].trainerIds[0];
-}
+ .bg = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 15,
+ .width = 28,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0x200
+};
-s32 GetRematchIdxByTrainerIdx(s32 trainerIdx)
+static bool32 LoadMatchCallWindowGfx(u8 taskId)
{
- s32 rematchIdx;
-
- for (rematchIdx = 0; rematchIdx < REMATCH_TABLE_ENTRIES; rematchIdx++)
+ s16 *taskData = gTasks[taskId].data;
+ taskData[2] = AddWindow(&sMatchCallTextWindow);
+ if (taskData[2] == 0xFF)
{
- if (gRematchTable[rematchIdx].trainerIds[0] == trainerIdx)
- return rematchIdx;
+ DestroyTask(taskId);
+ return FALSE;
}
- return -1;
-}
-bool32 MatchCallFlagGetByIndex(u32 idx)
-{
- match_call_t matchCall;
- u32 i;
+ if (LoadBgTiles(0, sUnknown_0860EA6C, sizeof(sUnknown_0860EA6C), 0x270) == 0xFFFF)
+ {
+ RemoveWindow(taskData[2]);
+ DestroyTask(taskId);
+ return FALSE;
+ }
- if (idx > 20)
+ if (!decompress_and_copy_tile_data_to_vram(0, sPokeNavIconGfx, 0, 0x279, 0))
+ {
+ RemoveWindow(taskData[2]);
+ DestroyTask(taskId);
return FALSE;
- matchCall = sMatchCallHeaders[idx];
- i = MatchCallGetFunctionIndex(matchCall);
- return sMatchCallGetFlagFuncs[i](matchCall);
+ }
+
+ FillWindowPixelBuffer(taskData[2], 0x88);
+ LoadPalette(sUnknown_0860EA4C, 0xE0, 0x20);
+ LoadPalette(sPokeNavIconPalette, 0xF0, 0x20);
+ ChangeBgY(0, -0x2000, 0);
+ return TRUE;
}
-static bool32 MatchCallGetFlag_Type0(match_call_t matchCall)
+static bool32 MoveMatchCallWindowToVram(u8 taskId)
{
- if (matchCall.type0->flag == 0xffff)
- return TRUE;
- return FlagGet(matchCall.type0->flag);
+ s16 *taskData = gTasks[taskId].data;
+ if (free_temp_tile_data_buffers_if_possible())
+ return FALSE;
+
+ PutWindowTilemap(taskData[2]);
+ DrawMatchCallTextBoxBorder(taskData[2], 0x270, 14);
+ WriteSequenceToBgTilemapBuffer(0, 0xF279, 1, 15, 4, 4, 17, 1);
+ taskData[5] = CreateTask(sub_8196694, 10);
+ CopyWindowToVram(taskData[2], 2);
+ CopyBgTilemapBufferToVram(0);
+ return TRUE;
}
-static bool32 MatchCallGetFlag_Type1(match_call_t matchCall)
+static bool32 PrintMatchCallIntroEllipsis(u8 taskId)
{
- if (matchCall.type1->flag == 0xffff)
+ s16 *taskData = gTasks[taskId].data;
+ if (!IsDma3ManagerBusyWithBgCopy())
+ {
+ InitMatchCallTextPrinter(taskData[2], sText_PokenavCallEllipsis);
return TRUE;
- return FlagGet(matchCall.type1->flag);
+ }
+
+ return FALSE;
}
-static bool32 MatchCallGetFlag_Type2(match_call_t matchCall)
+static bool32 sub_81962B0(u8 taskId)
{
- if (matchCall.type2->flag == 0xffff)
+ if (ChangeBgY(0, 0x600, 1) >= 0)
+ {
+ ChangeBgY(0, 0, 0);
return TRUE;
- return FlagGet(matchCall.type2->flag);
+ }
+
+ return FALSE;
}
-static bool32 MatchCallGetFlag_Type3(match_call_t matchCall)
+static bool32 sub_81962D8(u8 taskId)
{
- if (matchCall.type4->gender != gSaveBlock2Ptr->playerGender)
- return FALSE;
- if (matchCall.type4->flag == 0xffff)
+ s16 *taskData = gTasks[taskId].data;
+ if (!ExecuteMatchCallTextPrinter(taskData[2]))
+ {
+ FillWindowPixelBuffer(taskData[2], 0x88);
+ if (!gMatchCallState.triggeredFromScript)
+ SelectMatchCallMessage(gMatchCallState.trainerId, gStringVar4);
+
+ InitMatchCallTextPrinter(taskData[2], gStringVar4);
return TRUE;
- return FlagGet(matchCall.type4->flag);
-}
+ }
-static bool32 MatchCallGetFlag_Type4(match_call_t matchCall)
-{
- return FlagGet(matchCall.type3->flag);
+ return FALSE;
}
-u8 sub_81D16DC(u32 idx)
+static bool32 sub_8196330(u8 taskId)
{
- match_call_t matchCall;
- u32 i;
+ s16 *taskData = gTasks[taskId].data;
+ if (!ExecuteMatchCallTextPrinter(taskData[2]) && !IsSEPlaying() && gMain.newKeys & (A_BUTTON | B_BUTTON))
+ {
+ FillWindowPixelBuffer(taskData[2], 0x88);
+ CopyWindowToVram(taskData[2], 2);
+ PlaySE(SE_TOREOFF);
+ return TRUE;
+ }
- if (idx > 20)
- return 0;
- matchCall = sMatchCallHeaders[idx];
- i = MatchCallGetFunctionIndex(matchCall);
- return gUnknown_08625310[i](matchCall);
+ return FALSE;
}
-static u8 sub_81D1714(match_call_t matchCall)
+static bool32 sub_8196390(u8 taskId)
{
- return matchCall.type0->v1;
-}
+ s16 *taskData = gTasks[taskId].data;
+ if (ChangeBgY(0, 0x600, 2) <= -0x2000)
+ {
+ FillBgTilemapBufferRect_Palette0(0, 0, 0, 14, 30, 6);
+ DestroyTask(taskData[5]);
+ RemoveWindow(taskData[2]);
+ CopyBgTilemapBufferToVram(0);
+ return TRUE;
+ }
-static u8 sub_81D1718(match_call_t matchCall)
-{
- return matchCall.type1->v1;
+ return FALSE;
}
-static u8 sub_81D171C(match_call_t matchCall)
+static bool32 sub_81963F0(u8 taskId)
{
- s32 i;
-
- for (i = 0; matchCall.type2->v10[i].flag != 0xffff; i++)
+ u8 playerObjectId;
+ if (!IsDma3ManagerBusyWithBgCopy() && !IsSEPlaying())
{
- if (!FlagGet(matchCall.type2->v10[i].flag))
- break;
+ ChangeBgY(0, 0, 0);
+ if (!gMatchCallState.triggeredFromScript)
+ {
+ sub_81973A4();
+ playerObjectId = GetEventObjectIdByLocalIdAndMap(EVENT_OBJ_ID_PLAYER, 0, 0);
+ EventObjectClearHeldMovementIfFinished(&gEventObjects[playerObjectId]);
+ sub_80D338C();
+ UnfreezeEventObjects();
+ ScriptContext2_Disable();
+ }
+
+ return TRUE;
}
- return matchCall.type2->v10[i].v2;
+
+ return FALSE;
}
-static u8 sub_81D1750(match_call_t matchCall)
+static void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId)
{
- return 0xd5;
+ int bg, x, y, width, height;
+ int tileNum;
+
+ bg = GetWindowAttribute(windowId, WINDOW_BG);
+ x = GetWindowAttribute(windowId, WINDOW_TILEMAP_LEFT);
+ y = GetWindowAttribute(windowId, WINDOW_TILEMAP_TOP);
+ width = GetWindowAttribute(windowId, WINDOW_WIDTH);
+ height = GetWindowAttribute(windowId, WINDOW_HEIGHT);
+ tileNum = tileOffset + GetBgAttribute(bg, BG_ATTR_BASETILE);
+
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 0), x - 1, y - 1, 1, 1);
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 1), x, y - 1, width, 1);
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 2), x + width, y - 1, 1, 1);
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 3), x - 1, y, 1, height);
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 4), x + width, y, 1, height);
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 5), x - 1, y + height, 1, 1);
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 6), x, y + height, width, 1);
+ FillBgTilemapBufferRect_Palette0(bg, ((paletteId << 12) & 0xF000) | (tileNum + 7), x + width, y + height, 1, 1);
}
-static u8 sub_81D1754(match_call_t matchCall)
+static void InitMatchCallTextPrinter(int windowId, const u8 *str)
{
- return 0xd5;
+ struct TextPrinterTemplate printerTemplate;
+ printerTemplate.currentChar = str;
+ printerTemplate.windowId = windowId;
+ printerTemplate.fontId = 1;
+ printerTemplate.x = 32;
+ printerTemplate.y = 1;
+ printerTemplate.currentX = 32;
+ printerTemplate.currentY = 1;
+ printerTemplate.letterSpacing = 0;
+ printerTemplate.lineSpacing = 0;
+ printerTemplate.unk = 0;
+ printerTemplate.fgColor = 10;
+ printerTemplate.bgColor = 8;
+ printerTemplate.shadowColor = 14;
+ gTextFlags.useAlternateDownArrow = 0;
+
+ AddTextPrinter(&printerTemplate, GetPlayerTextSpeedDelay(), NULL);
}
-bool32 MatchCall_IsRematchable(u32 idx)
+static bool32 ExecuteMatchCallTextPrinter(int windowId)
{
- match_call_t matchCall;
- u32 i;
+ if (gMain.heldKeys & A_BUTTON)
+ gTextFlags.canABSpeedUpPrint = 1;
+ else
+ gTextFlags.canABSpeedUpPrint = 0;
- if (idx > 20)
- return 0;
- matchCall = sMatchCallHeaders[idx];
- i = MatchCallGetFunctionIndex(matchCall);
- return sMatchCall_IsRematchableFunctions[i](matchCall);
+ RunTextPrinters();
+ return IsTextPrinterActive(windowId);
}
-static bool32 MatchCall_IsRematchable_Type0(match_call_t matchCall)
+static void sub_8196694(u8 taskId)
{
- return FALSE;
-}
+ s16 *taskData = gTasks[taskId].data;
+ if (++taskData[0] > 8)
+ {
+ taskData[0] = 0;
+ if (++taskData[1] > 7)
+ taskData[1] = 0;
-static bool32 MatchCall_IsRematchable_Type1(match_call_t matchCall)
-{
- if (matchCall.type1->rematchTableIdx >= REMATCH_ELITE_FOUR_ENTRIES)
- return FALSE;
- return gSaveBlock1Ptr->trainerRematches[matchCall.type1->rematchTableIdx] ? TRUE : FALSE;
+ taskData[2] = (taskData[1] * 16) + 0x279;
+ WriteSequenceToBgTilemapBuffer(0, taskData[2] | ~0xFFF, 1, 15, 4, 4, 17, 1);
+ CopyBgTilemapBufferToVram(0);
+ }
}
-static bool32 MatchCall_IsRematchable_Type2(match_call_t matchCall)
+static bool32 TrainerIsEligibleForRematch(int matchCallId)
{
- return gSaveBlock1Ptr->trainerRematches[matchCall.type2->rematchTableIdx] ? TRUE : FALSE;
+ return gSaveBlock1Ptr->trainerRematches[matchCallId] > 0;
}
-static bool32 MatchCall_IsRematchable_Type3(match_call_t matchCall)
+static u16 GetRematchTrainerLocation(int matchCallId)
{
- return FALSE;
+ const struct MapHeader *mapHeader = Overworld_GetMapHeaderByGroupAndId(gRematchTable[matchCallId].mapGroup, gRematchTable[matchCallId].mapNum);
+ return mapHeader->regionMapSectionId;
}
-static bool32 MatchCall_IsRematchable_Type4(match_call_t matchCall)
+static u32 GetNumRematchTrainersFought(void)
{
- return FALSE;
+ u32 i, count;
+ for (i = 0, count = 0; i < 64; i++)
+ {
+ if (HasTrainerBeenFought(gRematchTable[i].trainerIds[0]))
+ count++;
+ }
+
+ return count;
}
-bool32 sub_81D17E8(u32 idx)
+static u32 sub_8196774(int arg0)
{
- match_call_t matchCall;
- u32 i;
+ u32 i, count;
- if (idx > 20)
- return FALSE;
- matchCall = sMatchCallHeaders[idx];
- i = MatchCallGetFunctionIndex(matchCall);
- if (gUnknown_08625338[i](matchCall))
- return TRUE;
- for (i = 0; i < 4; i++)
+ for (i = 0, count = 0; i < REMATCH_TABLE_ENTRIES; i++)
{
- if (sMatchCallCheckPageOverrides[i].idx == idx)
- return TRUE;
+ if (HasTrainerBeenFought(gRematchTable[i].trainerIds[0]))
+ {
+ if (count == arg0)
+ return i;
+
+ count++;
+ }
}
- return FALSE;
+
+ return REMATCH_TABLE_ENTRIES;
}
-static bool32 sub_81D1840(match_call_t matchCall)
+bool32 SelectMatchCallMessage(int trainerId, u8 *str)
{
- return FALSE;
+ u32 matchCallId;
+ const struct MatchCallText *matchCallText;
+ bool32 retVal = FALSE;
+
+ matchCallId = GetTrainerMatchCallId(trainerId);
+ gBattleFrontierStreakInfo.facilityId = 0;
+ if (TrainerIsEligibleForRematch(matchCallId)
+ && GetRematchTrainerLocation(matchCallId) == gMapHeader.regionMapSectionId)
+ {
+ matchCallText = GetSameRouteMatchCallText(matchCallId, str);
+ }
+ else if (sub_8196D74(matchCallId))
+ {
+ matchCallText = GetDifferentRouteMatchCallText(matchCallId, str);
+ retVal = TRUE;
+ UpdateRematchIfDefeated(matchCallId);
+ }
+ else if (Random() % 3)
+ {
+ matchCallText = GetBattleMatchCallText(matchCallId, str);
+ }
+ else
+ {
+ matchCallText = GetGeneralMatchCallText(matchCallId, str);
+ }
+
+ BuildMatchCallString(matchCallId, matchCallText, str);
+ return retVal;
}
-static bool32 sub_81D1844(match_call_t matchCall)
+static int GetTrainerMatchCallId(int trainerId)
{
- return TRUE;
+ int i = 0;
+ while (1)
+ {
+ if (sMatchCallTrainers[i].trainerId == trainerId)
+ return i;
+ else
+ i++;
+ }
}
-static bool32 sub_81D1848(match_call_t matchCall)
+static const struct MatchCallText *GetSameRouteMatchCallText(int matchCallId, u8 *str)
{
- return TRUE;
+ u16 textId = sMatchCallTrainers[matchCallId].sameRouteMatchCallTextId;
+ int mask = 0xFF;
+ u32 topic = (textId >> 8) - 1;
+ u32 id = (textId & mask) - 1;
+ return &sMatchCallBattleRequestTopics[topic][id];
}
-static bool32 sub_81D184C(match_call_t matchCall)
+static const struct MatchCallText *GetDifferentRouteMatchCallText(int matchCallId, u8 *str)
{
- return FALSE;
+ u16 textId = sMatchCallTrainers[matchCallId].differentRouteMatchCallTextId;
+ int mask = 0xFF;
+ u32 topic = (textId >> 8) - 1;
+ u32 id = (textId & mask) - 1;
+ return &sMatchCallBattleRequestTopics[topic][id];
}
-static bool32 sub_81D1850(match_call_t matchCall)
+static const struct MatchCallText *GetBattleMatchCallText(int matchCallId, u8 *str)
{
- return FALSE;
+ int mask;
+ u32 textId, topic, id;
+
+ topic = Random() % 3;
+ textId = sMatchCallTrainers[matchCallId].battleTopicTextIds[topic];
+ if (!textId)
+ SpriteCallbackDummy(NULL); // leftover debugging ???
+
+ mask = 0xFF;
+ topic = (textId >> 8) - 1;
+ id = (textId & mask) - 1;
+ return &sMatchCallBattleTopics[topic][id];
}
-u32 MatchCall_GetRematchTableIdx(u32 idx)
+static const struct MatchCallText *GetGeneralMatchCallText(int matchCallId, u8 *str)
{
- match_call_t matchCall;
- u32 i;
+ int i;
+ int count;
+ u32 topic, id;
+ u16 rand;
+ u16 var3;
+
+ rand = Random();
+ if (!(rand & 1))
+ {
+ for (count = 0, i = 0; i < NUM_FRONTIER_FACILITIES; i++)
+ {
+ if (GetFrontierStreakInfo(i, &topic) > 1)
+ count++;
+ }
- if (idx > 20)
- return REMATCH_TABLE_ENTRIES;
- matchCall = sMatchCallHeaders[idx];
- i = MatchCallGetFunctionIndex(matchCall);
- return sMatchCall_GetRematchTableIdxFunctions[i](matchCall);
+ if (count)
+ {
+ count = Random() % count;
+ for (i = 0; i < NUM_FRONTIER_FACILITIES; i++)
+ {
+ gBattleFrontierStreakInfo.streak = GetFrontierStreakInfo(i, &topic);
+ if (gBattleFrontierStreakInfo.streak < 2)
+ continue;
+
+ if (!count)
+ break;
+
+ count--;
+ }
+
+ gBattleFrontierStreakInfo.facilityId = i;
+ id = sMatchCallTrainers[matchCallId].battleFrontierRecordStreakTextIndex - 1;
+ return &sMatchCallGeneralTopics[topic][id];
+ }
+ }
+
+ topic = (sMatchCallTrainers[matchCallId].generalTextId >> 8) - 1;
+ id = (sMatchCallTrainers[matchCallId].generalTextId & 0xFF) - 1;
+ return &sMatchCallGeneralTopics[topic][id];
}
-static u32 MatchCall_GetRematchTableIdx_Type0(match_call_t matchCall)
+static void BuildMatchCallString(int matchCallId, const struct MatchCallText *matchCallText, u8 *str)
{
- return REMATCH_TABLE_ENTRIES;
+ PopulateMatchCallStringVars(matchCallId, matchCallText->stringVarFuncIds);
+ StringExpandPlaceholders(str, matchCallText->text);
}
-static u32 MatchCall_GetRematchTableIdx_Type1(match_call_t matchCall)
+static u8 *const sMatchCallTextStringVars[] = { gStringVar1, gStringVar2, gStringVar3 };
+
+static void PopulateMatchCallStringVars(int matchCallId, const s8 *stringVarFuncIds)
{
- return matchCall.type1->rematchTableIdx;
+ int i;
+ for (i = 0; i < 3; i++)
+ {
+ if (stringVarFuncIds[i] >= 0)
+ PopulateMatchCallStringVar(matchCallId, stringVarFuncIds[i], sMatchCallTextStringVars[i]);
+ }
}
-static u32 MatchCall_GetRematchTableIdx_Type2(match_call_t matchCall)
+static void (*const sPopulateMatchCallStringVarFuncs[])(int, u8 *) =
{
- return matchCall.type2->rematchTableIdx;
-}
+ PopulateTrainerName,
+ PopulateMapName,
+ PopulateSpeciesFromTrainerLocation,
+ PopulateSpeciesFromTrainerParty,
+ PopulateBattleFrontierFacilityName,
+ PopulateBattleFrontierStreak,
+};
-static u32 MatchCall_GetRematchTableIdx_Type3(match_call_t matchCall)
+static void PopulateMatchCallStringVar(int matchCallId, int funcId, u8 *destStr)
{
- return REMATCH_TABLE_ENTRIES;
+ sPopulateMatchCallStringVarFuncs[funcId](matchCallId, destStr);
}
-static u32 MatchCall_GetRematchTableIdx_Type4(match_call_t matchCall)
+static const struct MultiTrainerMatchCallText sMultiTrainerMatchCallTexts[] =
{
- return REMATCH_TABLE_ENTRIES;
-}
+ { .trainerId = TRAINER_KIRA_AND_DAN_1, .text = gText_Kira },
+ { .trainerId = TRAINER_AMY_AND_LIV_1, .text = gText_Amy },
+ { .trainerId = TRAINER_JOHN_AND_JAY_1, .text = gText_John },
+ { .trainerId = TRAINER_LILA_AND_ROY_1, .text = gText_Roy },
+ { .trainerId = TRAINER_GABBY_AND_TY_1, .text = gText_Gabby },
+ { .trainerId = TRAINER_ANNA_AND_MEG_1, .text = gText_Anna },
+};
-void MatchCall_GetMessage(u32 idx, u8 *dest)
+static void PopulateTrainerName(int matchCallId, u8 *destStr)
{
- match_call_t matchCall;
u32 i;
+ u16 trainerId = sMatchCallTrainers[matchCallId].trainerId;
+ for (i = 0; i < 6; i++)
+ {
+ if (sMultiTrainerMatchCallTexts[i].trainerId == trainerId)
+ {
+ StringCopy(destStr, sMultiTrainerMatchCallTexts[i].text);
+ return;
+ }
+ }
- if (idx > 20)
- return;
- matchCall = sMatchCallHeaders[idx];
- i = MatchCallGetFunctionIndex(matchCall);
- sMatchCall_GetMessageFunctions[i](matchCall, dest);
+ StringCopy(destStr, gTrainers[trainerId].trainerName);
}
-static void MatchCall_GetMessage_Type0(match_call_t matchCall, u8 *dest)
+static void PopulateMapName(int matchCallId, u8 *destStr)
{
- sub_81D1920(matchCall.type0->textData, dest);
+ GetMapName(destStr, GetRematchTrainerLocation(matchCallId), 0);
}
-static void MatchCall_GetMessage_Type1(match_call_t matchCall, u8 *dest)
+static u8 GetLandEncounterSlot(void)
{
- if (matchCall.common->type != 5)
- sub_81D1920(matchCall.type5->textData, dest);
+ int rand = Random() % 100;
+ if (rand < 20)
+ return 0;
+ else if (rand >= 20 && rand < 40)
+ return 1;
+ else if (rand >= 40 && rand < 50)
+ return 2;
+ else if (rand >= 50 && rand < 60)
+ return 3;
+ else if (rand >= 60 && rand < 70)
+ return 4;
+ else if (rand >= 70 && rand < 80)
+ return 5;
+ else if (rand >= 80 && rand < 85)
+ return 6;
+ else if (rand >= 85 && rand < 90)
+ return 7;
+ else if (rand >= 90 && rand < 94)
+ return 8;
+ else if (rand >= 94 && rand < 98)
+ return 9;
+ else if (rand >= 98 && rand < 99)
+ return 10;
else
- sub_81D199C(matchCall.type1->textData, matchCall.type1->rematchTableIdx, dest);
+ return 11;
}
-static void MatchCall_GetMessage_Type2(match_call_t matchCall, u8 *dest)
+static u8 GetWaterEncounterSlot(void)
{
- sub_81D1920(matchCall.type2->textData, dest);
-}
-
-static void MatchCall_GetMessage_Type3(match_call_t matchCall, u8 *dest)
-{
- sub_81D1920(matchCall.type4->textData, dest);
+ int rand = Random() % 100;
+ if (rand < 60)
+ return 0;
+ else if (rand >= 60 && rand < 90)
+ return 1;
+ else if (rand >= 90 && rand < 95)
+ return 2;
+ else if (rand >= 95 && rand < 99)
+ return 3;
+ else
+ return 4;
}
-static void MatchCall_GetMessage_Type4(match_call_t matchCall, u8 *dest)
+static void PopulateSpeciesFromTrainerLocation(int matchCallId, u8 *destStr)
{
- sub_8197080(dest);
-}
+ u16 species[2];
+ int numSpecies;
+ u8 slot;
+ int i = 0;
-void sub_81D1920(const match_call_text_data_t *sub0, u8 *dest)
-{
- u32 i;
- for (i = 0; sub0[i].text != NULL; i++)
- ;
- if (i)
- i--;
- while (i)
+ if (gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED)) // ??? This check is nonsense.
{
- if (sub0[i].flag != 0xffff && FlagGet(sub0[i].flag) == TRUE)
- break;
- i--;
- }
- if (sub0[i].flag2 != 0xffff)
- FlagSet(sub0[i].flag2);
- StringExpandPlaceholders(dest, sub0[i].text);
-}
+ while (gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED))
+ {
+ if (gWildMonHeaders[i].mapGroup == gRematchTable[matchCallId].mapGroup
+ && gWildMonHeaders[i].mapNum == gRematchTable[matchCallId].mapNum)
+ break;
-#ifdef NONMATCHING
-// There's some weird upmerge going on that I cannot replicate at this time.
-static void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
-{
- u32 i;
- for (i = 0; sub0[i].text != NULL; i++)
- {
- if (sub0[i].flag == 0xfffe)
- break;
- if (sub0[i].flag == 0xffff && !FlagGet(sub0[i].flag))
- break;
- }
- if (sub0[i].flag != 0xfffe)
- {
- if (i)
- i--;
- if (sub0[i].flag2 != 0xffff)
- FlagSet(sub0[i].flag2);
- StringExpandPlaceholders(dest, sub0[i].text);
- }
- else
- {
- if (!FlagGet(FLAG_SYS_GAME_CLEAR))
- ;
- else if (gSaveBlock1Ptr->trainerRematches[idx])
- i += 2;
- else if (CountBattledRematchTeams(idx) >= 2)
- i += 3;
- else
i++;
- StringExpandPlaceholders(dest, sub0[i].text);
+ }
+
+ if (gWildMonHeaders[i].mapGroup != MAP_GROUP(UNDEFINED))
+ {
+ numSpecies = 0;
+ if (gWildMonHeaders[i].landMonsInfo)
+ {
+ slot = GetLandEncounterSlot();
+ species[numSpecies] = gWildMonHeaders[i].landMonsInfo->wildPokemon[slot].species;
+ numSpecies++;
+ }
+
+ if (gWildMonHeaders[i].waterMonsInfo)
+ {
+ slot = GetWaterEncounterSlot();
+ species[numSpecies] = gWildMonHeaders[i].waterMonsInfo->wildPokemon[slot].species;
+ numSpecies++;
+ }
+
+ if (numSpecies)
+ {
+ StringCopy(destStr, gSpeciesNames[species[Random() % numSpecies]]);
+ return;
+ }
+ }
}
+
+ destStr[0] = EOS;
}
-#else
-static NAKED void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
-{
- asm_unified("\tpush {r4-r7,lr}\n"
- "\tmov r7, r10\n"
- "\tmov r6, r9\n"
- "\tmov r5, r8\n"
- "\tpush {r5-r7}\n"
- "\tadds r6, r0, 0\n"
- "\tmov r10, r2\n"
- "\tlsls r1, 16\n"
- "\tlsrs r7, r1, 16\n"
- "\tmovs r5, 0\n"
- "\tldr r0, [r6]\n"
- "\tcmp r0, 0\n"
- "\tbeq _081D19E6\n"
- "\tldrh r0, [r6, 0x4]\n"
- "\tldr r1, =0x0000fffe\n"
- "\tcmp r0, r1\n"
- "\tbeq _081D1A24\n"
- "\tldr r0, =0x0000ffff\n"
- "\tmov r9, r0\n"
- "\tmov r8, r1\n"
- "\tadds r4, r6, 0\n"
- "_081D19C6:\n"
- "\tldrh r0, [r4, 0x4]\n"
- "\tcmp r0, r9\n"
- "\tbeq _081D19D6\n"
- "\tbl FlagGet\n"
- "\tlsls r0, 24\n"
- "\tcmp r0, 0\n"
- "\tbeq _081D19E6\n"
- "_081D19D6:\n"
- "\tadds r4, 0x8\n"
- "\tadds r5, 0x1\n"
- "\tldr r0, [r4]\n"
- "\tcmp r0, 0\n"
- "\tbeq _081D19E6\n"
- "\tldrh r0, [r4, 0x4]\n"
- "\tcmp r0, r8\n"
- "\tbne _081D19C6\n"
- "_081D19E6:\n"
- "\tlsls r0, r5, 3\n"
- "\tadds r0, r6\n"
- "\tldrh r1, [r0, 0x4]\n"
- "\tldr r0, =0x0000fffe\n"
- "\tcmp r1, r0\n"
- "\tbeq _081D1A24\n"
- "\tcmp r5, 0\n"
- "\tbeq _081D19F8\n"
- "\tsubs r5, 0x1\n"
- "_081D19F8:\n"
- "\tlsls r0, r5, 3\n"
- "\tadds r4, r0, r6\n"
- "\tldrh r1, [r4, 0x6]\n"
- "\tldr r0, =0x0000ffff\n"
- "\tcmp r1, r0\n"
- "\tbeq _081D1A0A\n"
- "\tadds r0, r1, 0\n"
- "\tbl FlagSet\n"
- "_081D1A0A:\n"
- "\tldr r1, [r4]\n"
- "\tmov r0, r10\n"
- "\tbl StringExpandPlaceholders\n"
- "\tb _081D1A5C\n"
- "\t.pool\n"
- "_081D1A1C:\n"
- "\tadds r5, 0x2\n"
- "\tb _081D1A50\n"
- "_081D1A20:\n"
- "\tadds r5, 0x3\n"
- "\tb _081D1A50\n"
- "_081D1A24:\n"
- "\tldr r0, =0x00000864\n"
- "\tbl FlagGet\n"
- "\tlsls r0, 24\n"
- "\tcmp r0, 0\n"
- "\tbeq _081D1A50\n"
- "\tldr r0, =gSaveBlock1Ptr\n"
- "\tldr r0, [r0]\n"
- "\tldr r1, =0x000009ca\n"
- "\tadds r0, r1\n"
- "\tadds r0, r7\n"
- "\tldrb r0, [r0]\n"
- "\tcmp r0, 0\n"
- "\tbne _081D1A1C\n"
- "\tadds r0, r7, 0\n"
- "\tbl CountBattledRematchTeams\n"
- "\tlsls r0, 16\n"
- "\tlsrs r0, 16\n"
- "\tcmp r0, 0x1\n"
- "\tbhi _081D1A20\n"
- "\tadds r5, 0x1\n"
- "_081D1A50:\n"
- "\tlsls r0, r5, 3\n"
- "\tadds r0, r6\n"
- "\tldr r1, [r0]\n"
- "\tmov r0, r10\n"
- "\tbl StringExpandPlaceholders\n"
- "_081D1A5C:\n"
- "\tpop {r3-r5}\n"
- "\tmov r8, r3\n"
- "\tmov r9, r4\n"
- "\tmov r10, r5\n"
- "\tpop {r4-r7}\n"
- "\tpop {r0}\n"
- "\tbx r0\n"
- "\t.pool");
-}
-#endif
-void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name)
+static void PopulateSpeciesFromTrainerParty(int matchCallId, u8 *destStr)
{
- match_call_t matchCall;
- u32 i;
+ u16 trainerId;
+ union TrainerMonPtr party;
+ u8 monId;
+ const u8 *speciesName;
- if (idx > 20)
- return;
- matchCall = sMatchCallHeaders[idx];
- i = MatchCallGetFunctionIndex(matchCall);
- sMatchCall_GetNameAndDescFunctions[i](matchCall, desc, name);
+ trainerId = GetLastBeatenRematchTrainerId(sMatchCallTrainers[matchCallId].trainerId);
+ party = gTrainers[trainerId].party;
+ monId = Random() % gTrainers[trainerId].partySize;
+
+ switch (gTrainers[trainerId].partyFlags)
+ {
+ case 0:
+ default:
+ speciesName = gSpeciesNames[party.NoItemDefaultMoves[monId].species];
+ break;
+ case F_TRAINER_PARTY_CUSTOM_MOVESET:
+ speciesName = gSpeciesNames[party.NoItemCustomMoves[monId].species];
+ break;
+ case F_TRAINER_PARTY_HELD_ITEM:
+ speciesName = gSpeciesNames[party.ItemDefaultMoves[monId].species];
+ break;
+ case F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM:
+ speciesName = gSpeciesNames[party.ItemCustomMoves[monId].species];
+ break;
+ }
+
+ StringCopy(destStr, speciesName);
}
-static void MatchCall_GetNameAndDesc_Type0(match_call_t matchCall, const u8 **desc, const u8 **name)
+static const u8 *const sBattleFrontierFacilityNames[] =
{
- *desc = matchCall.type0->desc;
- *name = matchCall.type0->name;
-}
+ gText_BattleTower2,
+ gText_BattleDome,
+ gText_BattlePalace,
+ gText_BattleArena,
+ gText_BattlePike,
+ gText_BattleFactory,
+ gText_BattlePyramid,
+};
-static void MatchCall_GetNameAndDesc_Type1(match_call_t matchCall, const u8 **desc, const u8 **name)
+static void PopulateBattleFrontierFacilityName(int matchCallId, u8 *destStr)
{
- match_call_t _matchCall = matchCall;
- if (_matchCall.type1->name == NULL)
- MatchCall_GetNameAndDescByRematchIdx(_matchCall.type1->rematchTableIdx, desc, name);
- else
- *name = _matchCall.type1->name;
- *desc = _matchCall.type1->desc;
+ StringCopy(destStr, sBattleFrontierFacilityNames[gBattleFrontierStreakInfo.facilityId]);
}
-static void MatchCall_GetNameAndDesc_Type2(match_call_t matchCall, const u8 **desc, const u8 **name)
+static void PopulateBattleFrontierStreak(int matchCallId, u8 *destStr)
{
- MatchCall_GetNameAndDescByRematchIdx(matchCall.type2->rematchTableIdx, desc, name);
- *desc = matchCall.type2->desc;
+ int i = 0;
+ int streak = gBattleFrontierStreakInfo.streak;
+ while (streak != 0)
+ {
+ streak /= 10;
+ i++;
+ }
+
+ ConvertIntToDecimalStringN(destStr, gBattleFrontierStreakInfo.streak, 0, i);
}
-static void MatchCall_GetNameAndDesc_Type3(match_call_t matchCall, const u8 **desc, const u8 **name)
+static const u16 sBadgeFlags[] =
{
- *desc = matchCall.type4->desc;
- *name = matchCall.type4->name;
-}
+ FLAG_BADGE01_GET,
+ FLAG_BADGE02_GET,
+ FLAG_BADGE03_GET,
+ FLAG_BADGE04_GET,
+ FLAG_BADGE05_GET,
+ FLAG_BADGE06_GET,
+ FLAG_BADGE07_GET,
+ FLAG_BADGE08_GET,
+};
-static void MatchCall_GetNameAndDesc_Type4(match_call_t matchCall, const u8 **desc, const u8 **name)
+static int GetNumOwnedBadges(void)
{
- *desc = matchCall.type3->desc;
- *name = matchCall.type3->name;
+ u32 i;
+
+ for (i = 0; i < 8; i++)
+ {
+ if (!FlagGet(sBadgeFlags[i]))
+ break;
+ }
+
+ return i;
}
-static void MatchCall_GetNameAndDescByRematchIdx(u32 idx, const u8 **desc, const u8 **name)
+static bool32 sub_8196D74(int matchCallId)
{
- const struct Trainer *trainer = gTrainers + GetTrainerIdxByRematchIdx(idx);
- *desc = gTrainerClassNames[trainer->trainerClass];
- *name = trainer->trainerName;
+ int dayCount;
+ int otId;
+ u16 easyChatWord;
+ int numRematchTrainersFought;
+ int var0, var1, var2;
+
+ if (GetNumOwnedBadges() < 5)
+ return FALSE;
+
+ dayCount = RtcGetLocalDayCount();
+ otId = GetTrainerId(gSaveBlock2Ptr->playerTrainerId) & 0xFFFF;
+
+ easyChatWord = gSaveBlock1Ptr->easyChatPairs[0].unk2;
+ numRematchTrainersFought = GetNumRematchTrainersFought();
+ var0 = (numRematchTrainersFought * 13) / 10;
+ var1 = ((dayCount ^ easyChatWord) + (easyChatWord ^ GetGameStat(GAME_STAT_TRAINER_BATTLES))) ^ otId;
+ var2 = var1 % var0;
+ if (var2 < numRematchTrainersFought)
+ {
+ if (sub_8196774(var2) == matchCallId)
+ return TRUE;
+ }
+
+ return FALSE;
}
-#ifdef NONMATCHING
-const u8 *sub_81D1B40(u32 idx, u32 offset)
+static u16 GetFrontierStreakInfo(u16 facilityId, u32 *topicTextId)
{
- u32 i;
+ int i;
+ int j;
+ u16 streak = 0;
- for (i = 0; i < 4; i++)
+ switch (facilityId)
{
- if (sMatchCallCheckPageOverrides[i].idx == idx)
+ case FRONTIER_FACILITY_DOME:
+ for (i = 0; i < 2; i++)
{
- for (; i + 1 < 4 && sMatchCallCheckPageOverrides[i + 1].idx == idx; i++)
+ for (j = 0; j < 2; j++)
{
- if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].v4))
- break;
+ if (streak < gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j])
+ streak = gSaveBlock2Ptr->frontier.domeRecordWinStreaks[i][j];
}
- return sMatchCallCheckPageOverrides[i].v8[offset];
}
+ *topicTextId = 3;
+ break;
+ case FRONTIER_FACILITY_FACTORY:
+ for (i = 0; i < 2; i++)
+ {
+ // BUG: should be looking at battle factory records.
+ if (streak < gSaveBlock2Ptr->frontier.pikeRecordStreaks[i])
+ streak = gSaveBlock2Ptr->frontier.pikeRecordStreaks[i];
+ }
+ *topicTextId = 4;
+ break;
+ case FRONTIER_FACILITY_TOWER:
+ for (i = 0; i < 4; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ if (streak < gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j])
+ streak = gSaveBlock2Ptr->frontier.towerRecordWinStreaks[i][j];
+ }
+ }
+ *topicTextId = 2;
+ break;
+ case FRONTIER_FACILITY_PALACE:
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ if (streak < gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j])
+ streak = gSaveBlock2Ptr->frontier.palaceRecordWinStreaks[i][j];
+ }
+ }
+ *topicTextId = 2;
+ break;
+ case FRONTIER_FACILITY_PIKE:
+ for (i = 0; i < 2; i++)
+ {
+ for (j = 0; j < 2; j++)
+ {
+ // BUG: should be looking at battle pike records.
+ if (streak < gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j])
+ streak = gSaveBlock2Ptr->frontier.factoryRecordWinStreaks[i][j];
+ }
+ }
+ *topicTextId = 2;
+ break;
+ case FRONTIER_FACILITY_ARENA:
+ for (i = 0; i < 2; i++)
+ {
+ if (streak < gSaveBlock2Ptr->frontier.arenaRecordStreaks[i])
+ streak = gSaveBlock2Ptr->frontier.arenaRecordStreaks[i];
+ }
+ *topicTextId = 2;
+ break;
+ case FRONTIER_FACILITY_PYRAMID:
+ for (i = 0; i < 2; i++)
+ {
+ if (streak < gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i])
+ streak = gSaveBlock2Ptr->frontier.pyramidRecordStreaks[i];
+ }
+ *topicTextId = 5;
+ break;
}
- return NULL;
+
+ return streak;
}
-#else
-NAKED const u8 *sub_81D1B40(u32 idx, u32 offset)
-{
- asm_unified("\tpush {r4-r7,lr}\n"
- "\tmov r7, r9\n"
- "\tmov r6, r8\n"
- "\tpush {r6,r7}\n"
- "\tadds r6, r0, 0\n"
- "\tmovs r5, 0\n"
- "\tldr r2, =sMatchCallCheckPageOverrides\n"
- "\tmovs r0, 0x8\n"
- "\tadds r0, r2\n"
- "\tmov r9, r0\n"
- "_081D1B54:\n"
- "\tlsls r0, r5, 1\n"
- "\tadds r0, r5\n"
- "\tlsls r0, 3\n"
- "\tadds r0, r2\n"
- "\tldrh r0, [r0]\n"
- "\tcmp r0, r6\n"
- "\tbne _081D1BBC\n"
- "\tadds r4, r5, 0x1\n"
- "\tlsls r1, 2\n"
- "\tmov r8, r1\n"
- "\tcmp r4, 0x3\n"
- "\tbhi _081D1BA8\n"
- "\tlsls r0, r4, 1\n"
- "\tadds r0, r4\n"
- "\tlsls r0, 3\n"
- "\tadds r0, r2\n"
- "\tldrh r0, [r0]\n"
- "\tcmp r0, r6\n"
- "\tbne _081D1BA8\n"
- "\tldr r7, =sMatchCallCheckPageOverrides\n"
- "_081D1B7C:\n"
- "\tlsls r0, r4, 1\n"
- "\tadds r0, r4\n"
- "\tlsls r0, 3\n"
- "\tadds r1, r7, 0x4\n"
- "\tadds r0, r1\n"
- "\tldrh r0, [r0]\n"
- "\tbl FlagGet\n"
- "\tlsls r0, 24\n"
- "\tcmp r0, 0\n"
- "\tbeq _081D1BA8\n"
- "\tadds r5, r4, 0\n"
- "\tadds r4, r5, 0x1\n"
- "\tcmp r4, 0x3\n"
- "\tbhi _081D1BA8\n"
- "\tlsls r0, r4, 1\n"
- "\tadds r0, r4\n"
- "\tlsls r0, 3\n"
- "\tadds r0, r7\n"
- "\tldrh r0, [r0]\n"
- "\tcmp r0, r6\n"
- "\tbeq _081D1B7C\n"
- "_081D1BA8:\n"
- "\tlsls r0, r5, 1\n"
- "\tadds r0, r5\n"
- "\tlsls r0, 3\n"
- "\tadd r0, r8\n"
- "\tadd r0, r9\n"
- "\tldr r0, [r0]\n"
- "\tb _081D1BC4\n"
- "\t.pool\n"
- "_081D1BBC:\n"
- "\tadds r5, 0x1\n"
- "\tcmp r5, 0x3\n"
- "\tbls _081D1B54\n"
- "\tmovs r0, 0\n"
- "_081D1BC4:\n"
- "\tpop {r3,r4}\n"
- "\tmov r8, r3\n"
- "\tmov r9, r4\n"
- "\tpop {r4-r7}\n"
- "\tpop {r1}\n"
- "\tbx r1");
+
+static u8 GetPokedexRatingLevel(u16 numSeen)
+{
+ if (numSeen < 10)
+ return 0;
+ if (numSeen < 20)
+ return 1;
+ if (numSeen < 30)
+ return 2;
+ if (numSeen < 40)
+ return 3;
+ if (numSeen < 50)
+ return 4;
+ if (numSeen < 60)
+ return 5;
+ if (numSeen < 70)
+ return 6;
+ if (numSeen < 80)
+ return 7;
+ if (numSeen < 90)
+ return 8;
+ if (numSeen < 100)
+ return 9;
+ if (numSeen < 110)
+ return 10;
+ if (numSeen < 120)
+ return 11;
+ if (numSeen < 130)
+ return 12;
+ if (numSeen < 140)
+ return 13;
+ if (numSeen < 150)
+ return 14;
+ if (numSeen < 160)
+ return 15;
+ if (numSeen < 170)
+ return 16;
+ if (numSeen < 180)
+ return 17;
+ if (numSeen < 190)
+ return 18;
+ if (numSeen < 200)
+ return 19;
+
+ if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT))
+ numSeen--;
+ if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT))
+ numSeen--;
+
+ if (numSeen < 200)
+ return 19;
+ else
+ return 20;
}
-#endif
-s32 sub_81D1BD0(u32 idx)
+static const u8 *const sBirchDexRatingTexts[] =
{
- u32 i;
+ gBirchDexRatingText_LessThan10,
+ gBirchDexRatingText_LessThan20,
+ gBirchDexRatingText_LessThan30,
+ gBirchDexRatingText_LessThan40,
+ gBirchDexRatingText_LessThan50,
+ gBirchDexRatingText_LessThan60,
+ gBirchDexRatingText_LessThan70,
+ gBirchDexRatingText_LessThan80,
+ gBirchDexRatingText_LessThan90,
+ gBirchDexRatingText_LessThan100,
+ gBirchDexRatingText_LessThan110,
+ gBirchDexRatingText_LessThan120,
+ gBirchDexRatingText_LessThan130,
+ gBirchDexRatingText_LessThan140,
+ gBirchDexRatingText_LessThan150,
+ gBirchDexRatingText_LessThan160,
+ gBirchDexRatingText_LessThan170,
+ gBirchDexRatingText_LessThan180,
+ gBirchDexRatingText_LessThan190,
+ gBirchDexRatingText_LessThan200,
+ gBirchDexRatingText_DexCompleted,
+};
+
+void sub_8197080(u8 *destStr)
+{
+ int numSeen, numCaught;
+ u8 *str;
+ u8 dexRatingLevel;
- for (i = 0; i < 4; i++)
+ u8 *buffer = Alloc(0x3E8);
+ if (!buffer)
{
- if (sMatchCallCheckPageOverrides[i].idx == idx)
- return sMatchCallCheckPageOverrides[i].v2;
+ destStr[0] = EOS;
+ return;
}
- return -1;
-}
-
-bool32 sub_81D1BF8(u32 idx)
-{
- s32 i;
- for (i = 0; i < 21; i++)
+ numSeen = GetHoennPokedexCount(FLAG_GET_SEEN);
+ numCaught = GetHoennPokedexCount(FLAG_GET_CAUGHT);
+ ConvertIntToDecimalStringN(gStringVar1, numSeen, 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, numCaught, 0, 3);
+ dexRatingLevel = GetPokedexRatingLevel(numCaught);
+ str = StringCopy(buffer, gUnknown_082A5C9C);
+ str[0] = CHAR_PROMPT_CLEAR;
+ str++;
+ str = StringCopy(str, gUnknown_082A5D2C);
+ str[0] = CHAR_PROMPT_CLEAR;
+ str++;
+ StringCopy(str, sBirchDexRatingTexts[dexRatingLevel]);
+ str = StringExpandPlaceholders(destStr, buffer);
+
+ if (IsNationalPokedexEnabled())
{
- u32 r0 = MatchCall_GetRematchTableIdx(i);
- if (r0 != REMATCH_TABLE_ENTRIES && r0 == idx)
- return TRUE;
+ str[0] = CHAR_PROMPT_CLEAR;
+ str++;
+ numSeen = GetNationalPokedexCount(FLAG_GET_SEEN);
+ numCaught = GetNationalPokedexCount(FLAG_GET_CAUGHT);
+ ConvertIntToDecimalStringN(gStringVar1, numSeen, 0, 3);
+ ConvertIntToDecimalStringN(gStringVar2, numCaught, 0, 3);
+ StringExpandPlaceholders(str, gUnknown_082A633D);
}
- return FALSE;
+
+ Free(buffer);
}
-void SetMatchCallRegisteredFlag(void)
+void sub_8197184(u8 windowId, u32 destOffset, u32 paletteId)
{
- s32 r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004);
- if (r0 >= 0)
- FlagSet(FLAG_MATCH_CALL_REGISTERED + r0);
+ u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
+ LoadBgTiles(bg, sUnknown_0860EA6C, 0x100, destOffset);
+ LoadPalette(sUnknown_0860EA4C, paletteId << 4, 0x20);
}
+
+void sub_81971C4(u32 windowId, u32 tileOffset, u32 paletteId)
+{
+ DrawMatchCallTextBoxBorder(windowId, tileOffset, paletteId);
+} \ No newline at end of file
diff --git a/src/menu.c b/src/menu.c
index f1b35b42e..ae589dff4 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,24 +1,24 @@
#include "global.h"
-#include "bg.h"
-#include "window.h"
-#include "palette.h"
-#include "menu.h"
-#include "constants/songs.h"
-#include "main.h"
-#include "sound.h"
-#include "menu_helpers.h"
#include "alloc.h"
-#include "task.h"
+#include "bg.h"
#include "dma3.h"
-#include "string_util.h"
-#include "pokemon_icon.h"
-#include "constants/flags.h"
#include "event_data.h"
+#include "graphics.h"
+#include "main.h"
+#include "menu.h"
+#include "menu_helpers.h"
+#include "palette.h"
#include "pokedex.h"
+#include "pokemon_icon.h"
#include "region_map.h"
-#include "text_window.h"
+#include "sound.h"
+#include "string_util.h"
#include "strings.h"
-#include "graphics.h"
+#include "task.h"
+#include "text_window.h"
+#include "window.h"
+#include "constants/flags.h"
+#include "constants/songs.h"
#define DLG_WINDOW_PALETTE_NUM 15
#define DLG_WINDOW_BASE_TILE_NUM 0x200
@@ -50,11 +50,11 @@ struct Menu
static EWRAM_DATA u8 sStartMenuWindowId = 0;
static EWRAM_DATA u8 sMapNamePopupWindowId = 0;
-static EWRAM_DATA struct Menu gUnknown_0203CD90 = {0};
-static EWRAM_DATA u16 gUnknown_0203CD9C = 0;
-static EWRAM_DATA u8 gUnknown_0203CD9E = 0;
-static EWRAM_DATA u8 gUnknown_0203CD9F = 0;
-static EWRAM_DATA u8 gUnknown_0203CDA0 = 0;
+static EWRAM_DATA struct Menu sMenu = {0};
+static EWRAM_DATA u16 sTileNum = 0;
+static EWRAM_DATA u8 sPaletteNum = 0;
+static EWRAM_DATA u8 sYesNoWindowId = 0;
+static EWRAM_DATA u8 sWindowId = 0;
static EWRAM_DATA u16 sFiller = 0; // needed to align
static EWRAM_DATA bool8 gUnknown_0203CDA4[4] = {FALSE};
static EWRAM_DATA u16 gUnknown_0203CDA8 = 0;
@@ -549,10 +549,10 @@ void sub_8197AE8(bool8 copyToVram)
CopyBgTilemapBufferToVram(0);
}
-void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a3, u8 a4)
+void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum)
{
- gUnknown_0203CD9C = a3;
- gUnknown_0203CD9E = a4;
+ sTileNum = tileNum;
+ sPaletteNum = paletteNum;
CallWindowFunction(windowId, sub_8197BB4);
FillWindowPixelBuffer(windowId, 0x11);
PutWindowTilemap(windowId);
@@ -560,10 +560,10 @@ void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a3, u8 a4)
CopyWindowToVram(windowId, 3);
}
-void sub_8197B64(u8 windowId, bool8 copyToVram, u16 a3)
+void sub_8197B64(u8 windowId, bool8 copyToVram, u16 tileNum)
{
- gUnknown_0203CD9C = a3;
- gUnknown_0203CD9E = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM);
+ sTileNum = tileNum;
+ sPaletteNum = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM);
CallWindowFunction(windowId, sub_8197BB4);
FillWindowPixelBuffer(windowId, 0x11);
PutWindowTilemap(windowId);
@@ -574,96 +574,96 @@ void sub_8197B64(u8 windowId, bool8 copyToVram, u16 a3)
void sub_8197BB4(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 1,
+ sTileNum + 1,
tilemapLeft - 2,
tilemapTop - 1,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 3,
+ sTileNum + 3,
tilemapLeft - 1,
tilemapTop - 1,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 4,
+ sTileNum + 4,
tilemapLeft,
tilemapTop - 1,
width - 1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 5,
+ sTileNum + 5,
tilemapLeft + width - 1,
tilemapTop - 1,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 6,
+ sTileNum + 6,
tilemapLeft + width,
tilemapTop - 1,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 7,
+ sTileNum + 7,
tilemapLeft - 2,
tilemapTop,
1,
5,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 9,
+ sTileNum + 9,
tilemapLeft - 1,
tilemapTop,
width + 1,
5,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 10,
+ sTileNum + 10,
tilemapLeft + width,
tilemapTop,
1,
5,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- BG_TILE_V_FLIP(gUnknown_0203CD9C + 1),
+ BG_TILE_V_FLIP(sTileNum + 1),
tilemapLeft - 2,
tilemapTop + height,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- BG_TILE_V_FLIP(gUnknown_0203CD9C + 3),
+ BG_TILE_V_FLIP(sTileNum + 3),
tilemapLeft - 1,
tilemapTop + height,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- BG_TILE_V_FLIP(gUnknown_0203CD9C + 4),
+ BG_TILE_V_FLIP(sTileNum + 4),
tilemapLeft,
tilemapTop + height,
width - 1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- BG_TILE_V_FLIP(gUnknown_0203CD9C + 5),
+ BG_TILE_V_FLIP(sTileNum + 5),
tilemapLeft + width - 1,
tilemapTop + height,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- BG_TILE_V_FLIP(gUnknown_0203CD9C + 6),
+ BG_TILE_V_FLIP(sTileNum + 6),
tilemapLeft + width,
tilemapTop + height,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
}
void sub_8197DF8(u8 windowId, bool8 copyToVram)
@@ -682,8 +682,8 @@ void sub_8197E30(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 p
void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 paletteNum)
{
- gUnknown_0203CD9C = baseTileNum;
- gUnknown_0203CD9E = paletteNum;
+ sTileNum = baseTileNum;
+ sPaletteNum = paletteNum;
CallWindowFunction(windowId, DrawWindowBorder);
FillWindowPixelBuffer(windowId, 0x11);
PutWindowTilemap(windowId);
@@ -693,8 +693,8 @@ void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 baseTileNum, u8 pal
void sub_8197EC8(u8 windowId, bool8 copyToVram, u16 baseTileNum)
{
- gUnknown_0203CD9C = baseTileNum;
- gUnknown_0203CD9E = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM);
+ sTileNum = baseTileNum;
+ sPaletteNum = GetWindowAttribute(windowId, WINDOW_PALETTE_NUM);
CallWindowFunction(windowId, DrawWindowBorder);
FillWindowPixelBuffer(windowId, 0x11);
PutWindowTilemap(windowId);
@@ -705,61 +705,61 @@ void sub_8197EC8(u8 windowId, bool8 copyToVram, u16 baseTileNum)
void DrawWindowBorder(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum)
{
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 0,
+ sTileNum + 0,
tilemapLeft - 1,
tilemapTop - 1,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 1,
+ sTileNum + 1,
tilemapLeft,
tilemapTop - 1,
width,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 2,
+ sTileNum + 2,
tilemapLeft + width,
tilemapTop - 1,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 3,
+ sTileNum + 3,
tilemapLeft - 1,
tilemapTop,
1,
height,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 5,
+ sTileNum + 5,
tilemapLeft + width,
tilemapTop,
1,
height,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 6,
+ sTileNum + 6,
tilemapLeft - 1,
tilemapTop + height,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 7,
+ sTileNum + 7,
tilemapLeft,
tilemapTop + height,
width,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
FillBgTilemapBufferRect(bg,
- gUnknown_0203CD9C + 8,
+ sTileNum + 8,
tilemapLeft + width,
tilemapTop + height,
1,
1,
- gUnknown_0203CD9E);
+ sPaletteNum);
}
void sub_8198070(u8 windowId, bool8 copyToVram)
@@ -793,7 +793,7 @@ u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile)
window.paletteNum = palette;
window.baseBlock = baseTile;
- gUnknown_0203CDA0 = AddWindow(&window);
+ sWindowId = AddWindow(&window);
if (palette > 15)
palette = 15 * 16;
@@ -801,27 +801,27 @@ u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile)
palette *= 16;
LoadPalette(gUnknown_0860F0B0, palette, sizeof(gUnknown_0860F0B0));
- return gUnknown_0203CDA0;
+ return sWindowId;
}
void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram)
{
u16 width = 0;
- if (gUnknown_0203CDA0 != 0xFF)
+ if (sWindowId != 0xFF)
{
- PutWindowTilemap(gUnknown_0203CDA0);
- FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF);
+ PutWindowTilemap(sWindowId);
+ FillWindowPixelBuffer(sWindowId, 0xFF);
width = GetStringWidth(0, string, 0);
- AddTextPrinterParameterized3(gUnknown_0203CDA0,
+ AddTextPrinterParameterized3(sWindowId,
0,
- 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a2 - width,
+ 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a2 - width,
1,
gUnknown_0860F0D0,
0,
string);
if (copyToVram)
- CopyWindowToVram(gUnknown_0203CDA0, 3);
+ CopyWindowToVram(sWindowId, 3);
}
}
@@ -830,7 +830,7 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo
u8 color[3];
u16 width = 0;
- if (gUnknown_0203CDA0 != 0xFF)
+ if (sWindowId != 0xFF)
{
if (a3 != 0)
{
@@ -844,49 +844,49 @@ void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyTo
color[1] = 1;
color[2] = 2;
}
- PutWindowTilemap(gUnknown_0203CDA0);
- FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF);
+ PutWindowTilemap(sWindowId);
+ FillWindowPixelBuffer(sWindowId, 0xFF);
if (string2 != NULL)
{
width = GetStringWidth(0, string2, 0);
- AddTextPrinterParameterized3(gUnknown_0203CDA0,
+ AddTextPrinterParameterized3(sWindowId,
0,
- 0xEC - (GetWindowAttribute(gUnknown_0203CDA0, WINDOW_TILEMAP_LEFT) * 8) - a4 - width,
+ 0xEC - (GetWindowAttribute(sWindowId, WINDOW_TILEMAP_LEFT) * 8) - a4 - width,
1,
color,
0,
string2);
}
- AddTextPrinterParameterized4(gUnknown_0203CDA0, 1, 4, 1, 0, 0, color, 0, string);
+ AddTextPrinterParameterized4(sWindowId, 1, 4, 1, 0, 0, color, 0, string);
if (copyToVram)
- CopyWindowToVram(gUnknown_0203CDA0, 3);
+ CopyWindowToVram(sWindowId, 3);
}
}
void sub_81982D8(void)
{
- if (gUnknown_0203CDA0 != 0xFF)
- CopyWindowToVram(gUnknown_0203CDA0, 3);
+ if (sWindowId != 0xFF)
+ CopyWindowToVram(sWindowId, 3);
}
void sub_81982F0(void)
{
- if (gUnknown_0203CDA0 != 0xFF)
+ if (sWindowId != 0xFF)
{
- FillWindowPixelBuffer(gUnknown_0203CDA0, 0xFF);
- CopyWindowToVram(gUnknown_0203CDA0, 3);
+ FillWindowPixelBuffer(sWindowId, 0xFF);
+ CopyWindowToVram(sWindowId, 3);
}
}
void sub_8198314(void)
{
- if (gUnknown_0203CDA0 != 0xFF)
+ if (sWindowId != 0xFF)
{
- FillWindowPixelBuffer(gUnknown_0203CDA0, 0);
- ClearWindowTilemap(gUnknown_0203CDA0);
- CopyWindowToVram(gUnknown_0203CDA0, 3);
- RemoveWindow(gUnknown_0203CDA0);
- gUnknown_0203CDA0 = 0xFF;
+ FillWindowPixelBuffer(sWindowId, 0);
+ ClearWindowTilemap(sWindowId);
+ CopyWindowToVram(sWindowId, 3);
+ RemoveWindow(sWindowId);
+ sWindowId = 0xFF;
}
}
@@ -894,24 +894,24 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC
{
s32 pos;
- gUnknown_0203CD90.left = left;
- gUnknown_0203CD90.top = top;
- gUnknown_0203CD90.minCursorPos = 0;
- gUnknown_0203CD90.maxCursorPos = numChoices - 1;
- gUnknown_0203CD90.windowId = windowId;
- gUnknown_0203CD90.fontId = fontId;
- gUnknown_0203CD90.optionHeight = cursorHeight;
- gUnknown_0203CD90.APressMuted = a7;
+ sMenu.left = left;
+ sMenu.top = top;
+ sMenu.minCursorPos = 0;
+ sMenu.maxCursorPos = numChoices - 1;
+ sMenu.windowId = windowId;
+ sMenu.fontId = fontId;
+ sMenu.optionHeight = cursorHeight;
+ sMenu.APressMuted = a7;
pos = initialCursorPos;
- if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos)
- gUnknown_0203CD90.cursorPos = 0;
+ if (pos < 0 || pos > sMenu.maxCursorPos)
+ sMenu.cursorPos = 0;
else
- gUnknown_0203CD90.cursorPos = pos;
+ sMenu.cursorPos = pos;
Menu_MoveCursor(0);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos)
@@ -929,56 +929,56 @@ void RedrawMenuCursor(u8 oldPos, u8 newPos)
{
u8 width, height;
- width = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0);
- height = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1);
- FillWindowPixelRect(gUnknown_0203CD90.windowId, 0x11, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * oldPos + gUnknown_0203CD90.top, width, height);
- AddTextPrinterParameterized(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * newPos + gUnknown_0203CD90.top, 0, 0);
+ width = GetMenuCursorDimensionByFont(sMenu.fontId, 0);
+ height = GetMenuCursorDimensionByFont(sMenu.fontId, 1);
+ FillWindowPixelRect(sMenu.windowId, 0x11, sMenu.left, sMenu.optionHeight * oldPos + sMenu.top, width, height);
+ AddTextPrinterParameterized(sMenu.windowId, sMenu.fontId, gText_SelectorArrow3, sMenu.left, sMenu.optionHeight * newPos + sMenu.top, 0, 0);
}
u8 Menu_MoveCursor(s8 cursorDelta)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
- int newPos = gUnknown_0203CD90.cursorPos + cursorDelta;
+ u8 oldPos = sMenu.cursorPos;
+ int newPos = sMenu.cursorPos + cursorDelta;
- if (newPos < gUnknown_0203CD90.minCursorPos)
- gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.maxCursorPos;
- else if (newPos > gUnknown_0203CD90.maxCursorPos)
- gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.minCursorPos;
+ if (newPos < sMenu.minCursorPos)
+ sMenu.cursorPos = sMenu.maxCursorPos;
+ else if (newPos > sMenu.maxCursorPos)
+ sMenu.cursorPos = sMenu.minCursorPos;
else
- gUnknown_0203CD90.cursorPos += cursorDelta;
+ sMenu.cursorPos += cursorDelta;
- RedrawMenuCursor(oldPos, gUnknown_0203CD90.cursorPos);
- return gUnknown_0203CD90.cursorPos;
+ RedrawMenuCursor(oldPos, sMenu.cursorPos);
+ return sMenu.cursorPos;
}
u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
- int newPos = gUnknown_0203CD90.cursorPos + cursorDelta;
+ u8 oldPos = sMenu.cursorPos;
+ int newPos = sMenu.cursorPos + cursorDelta;
- if (newPos < gUnknown_0203CD90.minCursorPos)
- gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.minCursorPos;
- else if (newPos > gUnknown_0203CD90.maxCursorPos)
- gUnknown_0203CD90.cursorPos = gUnknown_0203CD90.maxCursorPos;
+ if (newPos < sMenu.minCursorPos)
+ sMenu.cursorPos = sMenu.minCursorPos;
+ else if (newPos > sMenu.maxCursorPos)
+ sMenu.cursorPos = sMenu.maxCursorPos;
else
- gUnknown_0203CD90.cursorPos += cursorDelta;
+ sMenu.cursorPos += cursorDelta;
- RedrawMenuCursor(oldPos, gUnknown_0203CD90.cursorPos);
- return gUnknown_0203CD90.cursorPos;
+ RedrawMenuCursor(oldPos, sMenu.cursorPos);
+ return sMenu.cursorPos;
}
u8 Menu_GetCursorPos(void)
{
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
s8 Menu_ProcessInput(void)
{
if (gMain.newKeys & A_BUTTON)
{
- if (!gUnknown_0203CD90.APressMuted)
+ if (!sMenu.APressMuted)
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1002,13 +1002,13 @@ s8 Menu_ProcessInput(void)
s8 Menu_ProcessInputNoWrap(void)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
+ u8 oldPos = sMenu.cursorPos;
if (gMain.newKeys & A_BUTTON)
{
- if (!gUnknown_0203CD90.APressMuted)
+ if (!sMenu.APressMuted)
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1034,9 +1034,9 @@ s8 ProcessMenuInput_other(void)
{
if (gMain.newKeys & A_BUTTON)
{
- if (!gUnknown_0203CD90.APressMuted)
+ if (!sMenu.APressMuted)
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1060,13 +1060,13 @@ s8 ProcessMenuInput_other(void)
s8 Menu_ProcessInputNoWrapAround_other(void)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
+ u8 oldPos = sMenu.cursorPos;
if (gMain.newKeys & A_BUTTON)
{
- if (!gUnknown_0203CD90.APressMuted)
+ if (!sMenu.APressMuted)
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1174,11 +1174,11 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top
{
struct TextPrinterTemplate printer;
- gUnknown_0203CD9F = AddWindow(window);
- SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum);
+ sYesNoWindowId = AddWindow(window);
+ SetWindowBorderStyle(sYesNoWindowId, TRUE, baseTileNum, paletteNum);
printer.currentChar = gText_YesNo;
- printer.windowId = gUnknown_0203CD9F;
+ printer.windowId = sYesNoWindowId;
printer.fontId = fontId;
printer.x = GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH) + left;
printer.y = top;
@@ -1193,7 +1193,7 @@ void sub_8198AF8(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top
AddTextPrinter(&printer, 0xFF, NULL);
- sub_81983AC(gUnknown_0203CD9F, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos);
+ sub_81983AC(sYesNoWindowId, fontId, left, top, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_HEIGHT), 2, initialCursorPos);
}
void sub_8198C34(const struct WindowTemplate *window, u8 fontId, u16 baseTileNum, u8 paletteNum)
@@ -1211,8 +1211,8 @@ s8 Menu_ProcessInputNoWrapClearOnChoose(void)
void sub_8198C78(void)
{
- sub_8198070(gUnknown_0203CD9F, TRUE);
- RemoveWindow(gUnknown_0203CD9F);
+ sub_8198070(sYesNoWindowId, TRUE);
+ RemoveWindow(sYesNoWindowId);
}
void sub_8198C94(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7, const struct MenuAction *strs)
@@ -1274,26 +1274,26 @@ u8 sub_8198F58(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 cursorHeight,
{
s32 pos;
- gUnknown_0203CD90.left = left;
- gUnknown_0203CD90.top = top;
- gUnknown_0203CD90.minCursorPos = 0;
- gUnknown_0203CD90.maxCursorPos = numChoices - 1;
- gUnknown_0203CD90.windowId = windowId;
- gUnknown_0203CD90.fontId = fontId;
- gUnknown_0203CD90.optionWidth = a4;
- gUnknown_0203CD90.optionHeight = cursorHeight;
- gUnknown_0203CD90.horizontalCount = a6;
- gUnknown_0203CD90.verticalCount = a7;
+ sMenu.left = left;
+ sMenu.top = top;
+ sMenu.minCursorPos = 0;
+ sMenu.maxCursorPos = numChoices - 1;
+ sMenu.windowId = windowId;
+ sMenu.fontId = fontId;
+ sMenu.optionWidth = a4;
+ sMenu.optionHeight = cursorHeight;
+ sMenu.horizontalCount = a6;
+ sMenu.verticalCount = a7;
pos = a9;
- if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos)
- gUnknown_0203CD90.cursorPos = 0;
+ if (pos < 0 || pos > sMenu.maxCursorPos)
+ sMenu.cursorPos = 0;
else
- gUnknown_0203CD90.cursorPos = pos;
+ sMenu.cursorPos = pos;
sub_8199134(0, 0);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
u8 sub_8198FD4(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7)
@@ -1305,20 +1305,20 @@ u8 sub_8198FD4(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8
void sub_8199060(u8 oldCursorPos, u8 newCursorPos)
{
- u8 cursorWidth = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0);
- u8 cursorHeight = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1);
- u8 xPos = (oldCursorPos % gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionWidth + gUnknown_0203CD90.left;
- u8 yPos = (oldCursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionHeight + gUnknown_0203CD90.top;
- FillWindowPixelRect(gUnknown_0203CD90.windowId,
+ u8 cursorWidth = GetMenuCursorDimensionByFont(sMenu.fontId, 0);
+ u8 cursorHeight = GetMenuCursorDimensionByFont(sMenu.fontId, 1);
+ u8 xPos = (oldCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left;
+ u8 yPos = (oldCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top;
+ FillWindowPixelRect(sMenu.windowId,
0x11,
xPos,
yPos,
cursorWidth,
cursorHeight);
- xPos = (newCursorPos % gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionWidth + gUnknown_0203CD90.left;
- yPos = (newCursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionHeight + gUnknown_0203CD90.top;
- AddTextPrinterParameterized(gUnknown_0203CD90.windowId,
- gUnknown_0203CD90.fontId,
+ xPos = (newCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left;
+ yPos = (newCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top;
+ AddTextPrinterParameterized(sMenu.windowId,
+ sMenu.fontId,
gText_SelectorArrow3,
xPos,
yPos,
@@ -1328,83 +1328,83 @@ void sub_8199060(u8 oldCursorPos, u8 newCursorPos)
u8 sub_8199134(s8 deltaX, s8 deltaY)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
+ u8 oldPos = sMenu.cursorPos;
if (deltaX != 0)
{
- if ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX < 0)
+ if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < 0)
{
- gUnknown_0203CD90.cursorPos += gUnknown_0203CD90.horizontalCount - 1;
+ sMenu.cursorPos += sMenu.horizontalCount - 1;
}
- else if ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX >= gUnknown_0203CD90.horizontalCount)
+ else if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= sMenu.horizontalCount)
{
- gUnknown_0203CD90.cursorPos = (gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.horizontalCount;
+ sMenu.cursorPos = (sMenu.cursorPos / sMenu.horizontalCount) * sMenu.horizontalCount;
}
else
{
- gUnknown_0203CD90.cursorPos += deltaX;
+ sMenu.cursorPos += deltaX;
}
}
if (deltaY != 0)
{
- if ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY < 0)
+ if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < 0)
{
- gUnknown_0203CD90.cursorPos += gUnknown_0203CD90.horizontalCount * (gUnknown_0203CD90.verticalCount - 1);
+ sMenu.cursorPos += sMenu.horizontalCount * (sMenu.verticalCount - 1);
}
- else if ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY >= gUnknown_0203CD90.verticalCount)
+ else if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= sMenu.verticalCount)
{
- gUnknown_0203CD90.cursorPos -= gUnknown_0203CD90.horizontalCount * (gUnknown_0203CD90.verticalCount - 1);
+ sMenu.cursorPos -= sMenu.horizontalCount * (sMenu.verticalCount - 1);
}
else
{
- gUnknown_0203CD90.cursorPos += (gUnknown_0203CD90.horizontalCount * deltaY);
+ sMenu.cursorPos += (sMenu.horizontalCount * deltaY);
}
}
- if (gUnknown_0203CD90.cursorPos > gUnknown_0203CD90.maxCursorPos)
+ if (sMenu.cursorPos > sMenu.maxCursorPos)
{
- gUnknown_0203CD90.cursorPos = oldPos;
- return gUnknown_0203CD90.cursorPos;
+ sMenu.cursorPos = oldPos;
+ return sMenu.cursorPos;
}
else
{
- sub_8199060(oldPos, gUnknown_0203CD90.cursorPos);
- return gUnknown_0203CD90.cursorPos;
+ sub_8199060(oldPos, sMenu.cursorPos);
+ return sMenu.cursorPos;
}
}
u8 sub_81991F8(s8 deltaX, s8 deltaY)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
+ u8 oldPos = sMenu.cursorPos;
if (deltaX != 0)
{
- if (((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX >= 0) &&
- ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX < gUnknown_0203CD90.horizontalCount))
+ if (((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= 0) &&
+ ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < sMenu.horizontalCount))
{
- gUnknown_0203CD90.cursorPos += deltaX;
+ sMenu.cursorPos += deltaX;
}
}
if (deltaY != 0)
{
- if (((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY >= 0) &&
- ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY < gUnknown_0203CD90.verticalCount))
+ if (((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= 0) &&
+ ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < sMenu.verticalCount))
{
- gUnknown_0203CD90.cursorPos += (gUnknown_0203CD90.horizontalCount * deltaY);
+ sMenu.cursorPos += (sMenu.horizontalCount * deltaY);
}
}
- if (gUnknown_0203CD90.cursorPos > gUnknown_0203CD90.maxCursorPos)
+ if (sMenu.cursorPos > sMenu.maxCursorPos)
{
- gUnknown_0203CD90.cursorPos = oldPos;
- return gUnknown_0203CD90.cursorPos;
+ sMenu.cursorPos = oldPos;
+ return sMenu.cursorPos;
}
else
{
- sub_8199060(oldPos, gUnknown_0203CD90.cursorPos);
- return gUnknown_0203CD90.cursorPos;
+ sub_8199060(oldPos, sMenu.cursorPos);
+ return sMenu.cursorPos;
}
}
@@ -1413,7 +1413,7 @@ s8 sub_8199284(void)
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1449,12 +1449,12 @@ s8 sub_8199284(void)
s8 Menu_ProcessInputGridLayout(void)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
+ u8 oldPos = sMenu.cursorPos;
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1493,7 +1493,7 @@ s8 sub_81993D8(void)
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1529,12 +1529,12 @@ s8 sub_81993D8(void)
s8 sub_8199484(void)
{
- u8 oldPos = gUnknown_0203CD90.cursorPos;
+ u8 oldPos = sMenu.cursorPos;
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
{
@@ -1572,21 +1572,21 @@ u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, boo
{
s32 pos;
- gUnknown_0203CD90.left = 0;
- gUnknown_0203CD90.top = 1;
- gUnknown_0203CD90.minCursorPos = 0;
- gUnknown_0203CD90.maxCursorPos = itemCount - 1;
- gUnknown_0203CD90.windowId = windowId;
- gUnknown_0203CD90.fontId = 1;
- gUnknown_0203CD90.optionHeight = 16;
- gUnknown_0203CD90.APressMuted = APressMuted;
+ sMenu.left = 0;
+ sMenu.top = 1;
+ sMenu.minCursorPos = 0;
+ sMenu.maxCursorPos = itemCount - 1;
+ sMenu.windowId = windowId;
+ sMenu.fontId = 1;
+ sMenu.optionHeight = 16;
+ sMenu.APressMuted = APressMuted;
pos = initialCursorPos;
- if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos)
- gUnknown_0203CD90.cursorPos = 0;
+ if (pos < 0 || pos > sMenu.maxCursorPos)
+ sMenu.cursorPos = 0;
else
- gUnknown_0203CD90.cursorPos = pos;
+ sMenu.cursorPos = pos;
return Menu_MoveCursor(0);
}
@@ -1639,11 +1639,11 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
{
struct TextPrinterTemplate printer;
- gUnknown_0203CD9F = AddWindow(window);
- SetWindowBorderStyle(gUnknown_0203CD9F, TRUE, baseTileNum, paletteNum);
+ sYesNoWindowId = AddWindow(window);
+ SetWindowBorderStyle(sYesNoWindowId, TRUE, baseTileNum, paletteNum);
printer.currentChar = gText_YesNo;
- printer.windowId = gUnknown_0203CD9F;
+ printer.windowId = sYesNoWindowId;
printer.fontId = 1;
printer.x = 8;
printer.y = 1;
@@ -1657,7 +1657,7 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa
printer.lineSpacing = 0;
AddTextPrinter(&printer, 0xFF, NULL);
- InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_0203CD9F, 2, initialCursorPos);
+ InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos);
}
void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs)
@@ -1709,26 +1709,26 @@ u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount
{
s32 pos;
- gUnknown_0203CD90.left = 0;
- gUnknown_0203CD90.top = 1;
- gUnknown_0203CD90.minCursorPos = 0;
- gUnknown_0203CD90.maxCursorPos = (horizontalCount * verticalCount) - 1;
- gUnknown_0203CD90.windowId = windowId;
- gUnknown_0203CD90.fontId = 1;
- gUnknown_0203CD90.optionWidth = optionWidth;
- gUnknown_0203CD90.optionHeight = 16;
- gUnknown_0203CD90.horizontalCount = horizontalCount;
- gUnknown_0203CD90.verticalCount = verticalCount;
+ sMenu.left = 0;
+ sMenu.top = 1;
+ sMenu.minCursorPos = 0;
+ sMenu.maxCursorPos = (horizontalCount * verticalCount) - 1;
+ sMenu.windowId = windowId;
+ sMenu.fontId = 1;
+ sMenu.optionWidth = optionWidth;
+ sMenu.optionHeight = 16;
+ sMenu.horizontalCount = horizontalCount;
+ sMenu.verticalCount = verticalCount;
pos = initialCursorPos;
- if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos)
- gUnknown_0203CD90.cursorPos = 0;
+ if (pos < 0 || pos > sMenu.maxCursorPos)
+ sMenu.cursorPos = 0;
else
- gUnknown_0203CD90.cursorPos = pos;
+ sMenu.cursorPos = pos;
sub_8199134(0, 0);
- return gUnknown_0203CD90.cursorPos;
+ return sMenu.cursorPos;
}
void clear_scheduled_bg_copies_to_vram(void)
diff --git a/src/menu_helpers.c b/src/menu_helpers.c
index 0adc6228e..e6547b300 100644
--- a/src/menu_helpers.c
+++ b/src/menu_helpers.c
@@ -152,7 +152,7 @@ static void Task_ContinueTaskAfterMessagePrints(u8 taskId)
gUnknown_0300117C(taskId);
}
-void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data)
+void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data)
{
gUnknown_0203A138 = *data;
gTasks[taskId].func = Task_CallYesOrNoCallback;
diff --git a/src/new_game.c b/src/new_game.c
index 8ecd48bc7..1b3fa2b00 100644
--- a/src/new_game.c
+++ b/src/new_game.c
@@ -46,7 +46,7 @@ extern void NewGameInitPCItems(void);
extern void ClearDecorationInventories(void);
extern void ResetFanClub(void);
extern void copy_strings_to_sav1(void);
-extern void sub_8195E10(void);
+extern void InitMatchCallCounters(void);
extern void sub_801AFD8(void);
extern void sub_800E5AC(void);
extern void sub_81D54BC(void);
@@ -209,7 +209,7 @@ void NewGameInitData(void)
SetLilycoveLady();
ResetAllApprenticeData();
ClearRankingHallRecords();
- sub_8195E10();
+ InitMatchCallCounters();
sub_801AFD8();
sub_800E5AC();
sub_81D54BC();
diff --git a/src/overworld.c b/src/overworld.c
index ef424cff8..9df69e360 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -127,7 +127,7 @@ extern void ExecuteTruckSequence(void);
extern void sub_80A0A38(void);
extern void WriteFlashScanlineEffectBuffer(u8);
extern void sub_81AA2F8(void);
-extern void sub_8195E10(void);
+extern void InitMatchCallCounters(void);
extern void sub_80EDB44(void);
extern void sub_81D64C0(void);
extern void InitFieldMessageBox(void);
@@ -1777,7 +1777,7 @@ void CB2_ContinueSavedGame(void)
PlayTimeCounter_Start();
ScriptContext1_Init();
ScriptContext2_Disable();
- sub_8195E10();
+ InitMatchCallCounters();
if (UseContinueGameWarp() == TRUE)
{
ClearContinueGameWarpStatus();
diff --git a/src/party_menu.c b/src/party_menu.c
index 00432e6db..241df1c91 100755
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -2799,7 +2799,7 @@ static void sub_81B1CD0(struct Pokemon *mon, u16 item, u8 c)
{
GetMonNickname(mon, gStringVar1);
CopyItemName(item, gStringVar2);
- StringExpandPlaceholders(gStringVar4, gText_RecievedItemFromPkmn);
+ StringExpandPlaceholders(gStringVar4, gText_ReceivedItemFromPkmn);
sub_81B1B5C(gStringVar4, c);
schedule_bg_copy_tilemap_to_vram(2);
}
@@ -7257,10 +7257,10 @@ static void sub_81B9424(u8 taskId)
static void sub_81B9470(void)
{
- gUnknown_02039F24 = GetCursorSelectionMonId();
- if (gUnknown_02039F24 >= PARTY_SIZE)
- gUnknown_02039F24 = 0xFF;
- gSpecialVar_0x8004 = gUnknown_02039F24;
+ gContestMonPartyIndex = GetCursorSelectionMonId();
+ if (gContestMonPartyIndex >= PARTY_SIZE)
+ gContestMonPartyIndex = 0xFF;
+ gSpecialVar_0x8004 = gContestMonPartyIndex;
gFieldCallback2 = hm_add_c3_without_phase_2;
SetMainCallback2(CB2_ReturnToField);
}
diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c
index a268b5382..eeea3c210 100755
--- a/src/pokedex_area_screen.c
+++ b/src/pokedex_area_screen.c
@@ -96,7 +96,7 @@ static const u16 sLandmarkData[][2] = {
{MAPSEC_ALTERING_CAVE_2, FLAG_LANDMARK_ALTERING_CAVE},
{MAPSEC_MIRAGE_TOWER, FLAG_LANDMARK_MIRAGE_TOWER},
{MAPSEC_DESERT_UNDERPASS, FLAG_LANDMARK_DESERT_UNDERPASS},
- {MAPSEC_ARTISAN_CAVE, FLAG_0x8DF},
+ {MAPSEC_ARTISAN_CAVE, FLAG_LANDMARK_ARTISAN_CAVE},
{MAPSEC_NONE}
};
diff --git a/src/pokenav_match_call.c b/src/pokenav_match_call.c
new file mode 100644
index 000000000..53f9f0548
--- /dev/null
+++ b/src/pokenav_match_call.c
@@ -0,0 +1,1275 @@
+
+// Includes
+#include "global.h"
+#include "battle_setup.h"
+#include "event_data.h"
+#include "string_util.h"
+#include "battle.h"
+#include "gym_leader_rematch.h"
+
+extern void sub_8197080(u8 *dest);
+extern const u8 gTrainerClassNames[][13];
+
+// Static type declarations
+
+typedef struct MatchCallTextDataStruct {
+ const u8 *text;
+ u16 flag;
+ u16 flag2;
+} match_call_text_data_t;
+
+struct MatchCallStructCommon {
+ u8 type;
+ u8 v1;
+ u16 flag;
+};
+
+struct MatchCallStruct0 {
+ u8 type;
+ u8 v1;
+ u16 flag;
+ const u8 *desc;
+ const u8 *name;
+ const match_call_text_data_t *textData;
+};
+
+struct MatchCallStruct1 {
+ u8 type;
+ u8 v1;
+ u16 flag;
+ u16 rematchTableIdx;
+ const u8 *desc;
+ const u8 *name;
+ const match_call_text_data_t *textData;
+};
+
+struct MatchCallSubstruct2 {
+ u16 flag;
+ u8 v2;
+};
+
+struct MatchCallStruct2 {
+ u8 type;
+ u8 v1;
+ u16 flag;
+ u16 rematchTableIdx;
+ const u8 *desc;
+ const match_call_text_data_t *textData;
+ const struct MatchCallSubstruct2 *v10;
+};
+
+struct MatchCallStruct3 {
+ u8 type;
+ u8 v1;
+ u16 flag;
+ const u8 *desc;
+ const u8 *name;
+};
+
+struct MatchCallStruct4 {
+ u8 type;
+ u8 gender;
+ u16 flag;
+ const u8 *desc;
+ const u8 *name;
+ const match_call_text_data_t *textData;
+};
+
+struct MatchCallStruct5 {
+ u8 type;
+ u8 v1;
+ u16 flag;
+ u16 v4;
+ const u8 *desc;
+ const u8 *name;
+ const match_call_text_data_t *textData;
+};
+
+#define MATCHCALLDEF(name, type_, ...) \
+static const struct MatchCallStruct##type_ name = { \
+ .type = type_, \
+ __VA_ARGS__ \
+};
+
+typedef union {
+ const struct MatchCallStructCommon *common;
+ const struct MatchCallStruct0 *type0;
+ const struct MatchCallStruct1 *type1;
+ const struct MatchCallStruct2 *type2;
+ const struct MatchCallStruct3 *type3;
+ const struct MatchCallStruct4 *type4;
+ const struct MatchCallStruct5 *type5;
+} match_call_t;
+
+struct UnkStruct_08625388 {
+ u16 idx;
+ u16 v2;
+ u16 v4;
+ const u8 *v8[4];
+};
+
+// Static RAM declarations
+
+// Static ROM declarations
+
+static bool32 MatchCallGetFlag_Type0(match_call_t);
+static bool32 MatchCallGetFlag_Type1(match_call_t);
+static bool32 MatchCallGetFlag_Type2(match_call_t);
+static bool32 MatchCallGetFlag_Type3(match_call_t);
+static bool32 MatchCallGetFlag_Type4(match_call_t);
+
+static u8 sub_81D1714(match_call_t);
+static u8 sub_81D1718(match_call_t);
+static u8 sub_81D171C(match_call_t);
+static u8 sub_81D1750(match_call_t);
+static u8 sub_81D1754(match_call_t);
+
+static bool32 MatchCall_IsRematchable_Type0(match_call_t);
+static bool32 MatchCall_IsRematchable_Type1(match_call_t);
+static bool32 MatchCall_IsRematchable_Type2(match_call_t);
+static bool32 MatchCall_IsRematchable_Type3(match_call_t);
+static bool32 MatchCall_IsRematchable_Type4(match_call_t);
+
+static bool32 sub_81D1840(match_call_t);
+static bool32 sub_81D1844(match_call_t);
+static bool32 sub_81D1848(match_call_t);
+static bool32 sub_81D184C(match_call_t);
+static bool32 sub_81D1850(match_call_t);
+
+static u32 MatchCall_GetRematchTableIdx_Type0(match_call_t);
+static u32 MatchCall_GetRematchTableIdx_Type1(match_call_t);
+static u32 MatchCall_GetRematchTableIdx_Type2(match_call_t);
+static u32 MatchCall_GetRematchTableIdx_Type3(match_call_t);
+static u32 MatchCall_GetRematchTableIdx_Type4(match_call_t);
+
+static void MatchCall_GetMessage_Type0(match_call_t, u8 *);
+static void MatchCall_GetMessage_Type1(match_call_t, u8 *);
+static void MatchCall_GetMessage_Type2(match_call_t, u8 *);
+static void MatchCall_GetMessage_Type3(match_call_t, u8 *);
+static void MatchCall_GetMessage_Type4(match_call_t, u8 *);
+
+static void MatchCall_GetNameAndDesc_Type0(match_call_t, const u8 **, const u8 **);
+static void MatchCall_GetNameAndDesc_Type1(match_call_t, const u8 **, const u8 **);
+static void MatchCall_GetNameAndDesc_Type2(match_call_t, const u8 **, const u8 **);
+static void MatchCall_GetNameAndDesc_Type3(match_call_t, const u8 **, const u8 **);
+static void MatchCall_GetNameAndDesc_Type4(match_call_t, const u8 **, const u8 **);
+
+static void sub_81D1920(const match_call_text_data_t *, u8 *);
+static void sub_81D199C(const match_call_text_data_t *, u16, u8 *);
+static void MatchCall_GetNameAndDescByRematchIdx(u32, const u8 **, const u8 **);
+
+extern const u8 gText_MrStone_Pokenav_2B60C0[];
+extern const u8 gText_MrStone_Pokenav_2B61E6[];
+extern const u8 gText_MrStone_Pokenav_2B6302[];
+extern const u8 gText_MrStone_Pokenav_2B63A0[];
+extern const u8 gText_MrStone_Pokenav_2B64A2[];
+extern const u8 gText_MrStone_Pokenav_2B6526[];
+extern const u8 gText_MrStone_Pokenav_2B65BB[];
+extern const u8 gText_MrStone_Pokenav_2B6664[];
+extern const u8 gText_MrStone_Pokenav_2B66B1[];
+extern const u8 gText_MrStone_Pokenav_2B6703[];
+extern const u8 gText_MrStone_Pokenav_2B67ED[];
+
+extern const u8 gMrStoneMatchCallDesc[];
+extern const u8 gMrStoneMatchCallName[];
+
+extern const u8 gText_Norman_Pokenav_2B5719[];
+extern const u8 gText_Norman_Pokenav_2B5795[];
+extern const u8 gText_Norman_Pokenav_2B584D[];
+extern const u8 gText_Norman_Pokenav_2B58E3[];
+extern const u8 gText_Norman_Pokenav_2B5979[];
+extern const u8 gText_Norman_Pokenav_2B5A07[];
+extern const u8 gText_Norman_Pokenav_2B5A69[];
+extern const u8 gText_Norman_Pokenav_2B5ACF[];
+extern const u8 gText_Norman_Pokenav_2B5B5E[];
+
+extern const u8 gNormanMatchCallDesc[];
+extern const u8 gNormanMatchCallName[];
+
+extern const u8 gProfBirchMatchCallDesc[];
+extern const u8 gProfBirchMatchCallName[];
+
+extern const u8 gText_Mom_Pokenav_2B227B[];
+extern const u8 gText_Mom_Pokenav_2B2310[];
+extern const u8 gText_Mom_Pokenav_2B23F3[];
+
+extern const u8 gMomMatchCallDesc[];
+extern const u8 gMomMatchCallName[];
+
+extern const u8 gText_Steven_Pokenav_2B5B95[];
+extern const u8 gText_Steven_Pokenav_2B5C53[];
+extern const u8 gText_Steven_Pokenav_2B5CC9[];
+extern const u8 gText_Steven_Pokenav_2B5DB4[];
+extern const u8 gText_Steven_Pokenav_2B5E26[];
+extern const u8 gText_Steven_Pokenav_2B5EA2[];
+extern const u8 gText_Steven_Pokenav_2B5ED9[];
+
+extern const u8 gStevenMatchCallDesc[];
+extern const u8 gStevenMatchCallName[];
+
+extern const u8 gText_May_Pokenav_2B3AB3[];
+extern const u8 gText_May_Pokenav_2B3B3F[];
+extern const u8 gText_May_Pokenav_2B3C13[];
+extern const u8 gText_May_Pokenav_2B3CF3[];
+extern const u8 gText_May_Pokenav_2B3D4B[];
+extern const u8 gText_May_Pokenav_2B3DD1[];
+extern const u8 gText_May_Pokenav_2B3E69[];
+extern const u8 gText_May_Pokenav_2B3ECD[];
+extern const u8 gText_May_Pokenav_2B3F2B[];
+extern const u8 gText_May_Pokenav_2B3FFB[];
+extern const u8 gText_May_Pokenav_2B402B[];
+extern const u8 gText_May_Pokenav_2B414B[];
+extern const u8 gText_May_Pokenav_2B4228[];
+extern const u8 gText_May_Pokenav_2B42E0[];
+extern const u8 gText_May_Pokenav_2B4350[];
+extern const u8 gMayBrendanMatchCallDesc[];
+extern const u8 gExpandedPlaceholder_May[];
+extern const u8 gText_Brendan_Pokenav_2B43EF[];
+extern const u8 gText_Brendan_Pokenav_2B4486[];
+extern const u8 gText_Brendan_Pokenav_2B4560[];
+extern const u8 gText_Brendan_Pokenav_2B463F[];
+extern const u8 gText_Brendan_Pokenav_2B46B7[];
+extern const u8 gText_Brendan_Pokenav_2B4761[];
+extern const u8 gText_Brendan_Pokenav_2B47F4[];
+extern const u8 gText_Brendan_Pokenav_2B4882[];
+extern const u8 gText_Brendan_Pokenav_2B4909[];
+extern const u8 gText_Brendan_Pokenav_2B49C4[];
+extern const u8 gText_Brendan_Pokenav_2B4A44[];
+extern const u8 gText_Brendan_Pokenav_2B4B28[];
+extern const u8 gText_Brendan_Pokenav_2B4C15[];
+extern const u8 gText_Brendan_Pokenav_2B4CD8[];
+extern const u8 gText_Brendan_Pokenav_2B4D46[];
+extern const u8 gExpandedPlaceholder_Brendan[];
+extern const u8 gText_Wally_Pokenav_2B4DE2[];
+extern const u8 gText_Wally_Pokenav_2B4E57[];
+extern const u8 gText_Wally_Pokenav_2B4EA5[];
+extern const u8 gText_Wally_Pokenav_2B4F41[];
+extern const u8 gText_Wally_Pokenav_2B4FF3[];
+extern const u8 gText_Wally_Pokenav_2B50B1[];
+extern const u8 gText_Wally_Pokenav_2B5100[];
+extern const u8 gWallyMatchCallDesc[];
+extern const u8 gText_Scott_Pokenav_2B5184[];
+extern const u8 gText_Scott_Pokenav_2B5275[];
+extern const u8 gText_Scott_Pokenav_2B5323[];
+extern const u8 gText_Scott_Pokenav_2B53DB[];
+extern const u8 gText_Scott_Pokenav_2B54A5[];
+extern const u8 gText_Scott_Pokenav_2B5541[];
+extern const u8 gText_Scott_Pokenav_2B56CA[];
+extern const u8 gScottMatchCallDesc[];
+extern const u8 gScottMatchCallName[];
+extern const u8 gText_Roxanne_Pokenav_2B2456[];
+extern const u8 gText_Roxanne_Pokenav_2B250E[];
+extern const u8 gText_Roxanne_Pokenav_2B25C1[];
+extern const u8 gText_Roxanne_Pokenav_2B2607[];
+extern const u8 gRoxanneMatchCallDesc[];
+extern const u8 gText_Brawly_Pokenav_2B2659[];
+extern const u8 gText_Brawly_Pokenav_2B275D[];
+extern const u8 gText_Brawly_Pokenav_2B286F[];
+extern const u8 gText_Brawly_Pokenav_2B28D1[];
+extern const u8 gBrawlyMatchCallDesc[];
+extern const u8 gText_Wattson_Pokenav_2B2912[];
+extern const u8 gText_Wattson_Pokenav_2B29CA[];
+extern const u8 gText_Wattson_Pokenav_2B2AB6[];
+extern const u8 gText_Wattson_Pokenav_2B2B01[];
+extern const u8 gWattsonMatchCallDesc[];
+extern const u8 gText_Flannery_Pokenav_2B2B4D[];
+extern const u8 gText_Flannery_Pokenav_2B2C0E[];
+extern const u8 gText_Flannery_Pokenav_2B2CF1[];
+extern const u8 gText_Flannery_Pokenav_2B2D54[];
+extern const u8 gFlanneryMatchCallDesc[];
+extern const u8 gText_Winona_Pokenav_2B2DA4[];
+extern const u8 gText_Winona_Pokenav_2B2E2B[];
+extern const u8 gText_Winona_Pokenav_2B2EC2[];
+extern const u8 gText_Winona_Pokenav_2B2F16[];
+extern const u8 gWinonaMatchCallDesc[];
+extern const u8 gText_TateLiza_Pokenav_2B2F97[];
+extern const u8 gText_TateLiza_Pokenav_2B306E[];
+extern const u8 gText_TateLiza_Pokenav_2B3158[];
+extern const u8 gText_TateLiza_Pokenav_2B31CD[];
+extern const u8 gTateLizaMatchCallDesc[];
+extern const u8 gText_Juan_Pokenav_2B3249[];
+extern const u8 gText_Juan_Pokenav_2B32EC[];
+extern const u8 gText_Juan_Pokenav_2B33AA[];
+extern const u8 gText_Juan_Pokenav_2B341E[];
+extern const u8 gJuanMatchCallDesc[];
+extern const u8 gText_Sidney_Pokenav_2B34CC[];
+extern const u8 gEliteFourMatchCallDesc[];
+extern const u8 gText_Phoebe_Pokenav_2B3561[];
+extern const u8 gText_Glacia_Pokenav_2B35E4[];
+extern const u8 gText_Drake_Pokenav_2B368B[];
+extern const u8 gText_Wallace_Pokenav_2B3790[];
+extern const u8 gChampionMatchCallDesc[];
+extern const u8 gMatchCallStevenStrategyText[];
+extern const u8 gMatchCall_StevenTrainersPokemonText[];
+extern const u8 gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle[];
+extern const u8 gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle[];
+extern const u8 gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle[];
+extern const u8 gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle[];
+extern const u8 gMatchCall_BrendanStrategyText[];
+extern const u8 gMatchCall_BrendanTrainersPokemonText[];
+extern const u8 gMatchCall_BrendanSelfIntroductionText_Line1[];
+extern const u8 gMatchCall_BrendanSelfIntroductionText_Line2[];
+extern const u8 gMatchCall_MayStrategyText[];
+extern const u8 gMatchCall_MayTrainersPokemonText[];
+extern const u8 gMatchCall_MaySelfIntroductionText_Line1[];
+extern const u8 gMatchCall_MaySelfIntroductionText_Line2[];
+// .rodata
+
+static const match_call_text_data_t sMrStoneTextScripts[] = {
+ { gText_MrStone_Pokenav_2B60C0, 0xFFFF, FLAG_ENABLE_MR_STONE_POKENAV },
+ { gText_MrStone_Pokenav_2B61E6, FLAG_ENABLE_MR_STONE_POKENAV, 0xFFFF },
+ { gText_MrStone_Pokenav_2B6302, FLAG_DELIVERED_STEVEN_LETTER, 0xFFFF },
+ { gText_MrStone_Pokenav_2B63A0, FLAG_RECEIVED_EXP_SHARE, 0xFFFF },
+ { gText_MrStone_Pokenav_2B64A2, FLAG_RECEIVED_HM04, 0xFFFF },
+ { gText_MrStone_Pokenav_2B6526, FLAG_DEFEATED_PETALBURG_GYM, 0xFFFF },
+ { gText_MrStone_Pokenav_2B65BB, FLAG_RECEIVED_CASTFORM, 0xFFFF },
+ { gText_MrStone_Pokenav_2B6664, FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, 0xFFFF },
+ { gText_MrStone_Pokenav_2B66B1, FLAG_TEAM_AQUA_ESCAPED_IN_SUBMARINE, 0xFFFF },
+ { gText_MrStone_Pokenav_2B6703, FLAG_DEFEATED_SOOTOPOLIS_GYM, 0xFFFF },
+ { gText_MrStone_Pokenav_2B67ED, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sMrStoneMatchCallHeader, 0, 10, 0xffff, gMrStoneMatchCallDesc, gMrStoneMatchCallName, sMrStoneTextScripts);
+
+static const match_call_text_data_t sNormanTextScripts[] = {
+ { gText_Norman_Pokenav_2B5719, FLAG_ENABLE_NORMAN_MATCH_CALL, 0xFFFF },
+ { gText_Norman_Pokenav_2B5795, FLAG_DEFEATED_DEWFORD_GYM, 0xFFFF },
+ { gText_Norman_Pokenav_2B584D, FLAG_DEFEATED_LAVARIDGE_GYM, 0xFFFF },
+ { gText_Norman_Pokenav_2B58E3, FLAG_DEFEATED_PETALBURG_GYM, 0xFFFF },
+ { gText_Norman_Pokenav_2B5979, FLAG_RECEIVED_RED_OR_BLUE_ORB, 0xFFFF },
+ { gText_Norman_Pokenav_2B5A07, 0xFFFE, 0xFFFF },
+ { gText_Norman_Pokenav_2B5A69, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { gText_Norman_Pokenav_2B5ACF, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { gText_Norman_Pokenav_2B5B5E, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sNormanMatchCallHeader, 5, 7, FLAG_ENABLE_NORMAN_MATCH_CALL, 0x45, gNormanMatchCallDesc, gNormanMatchCallName, sNormanTextScripts);
+
+MATCHCALLDEF(sProfBirchMatchCallHeader, 3, 0, FLAG_ENABLE_PROF_BIRCH_MATCH_CALL, gProfBirchMatchCallDesc, gProfBirchMatchCallName)
+
+static const match_call_text_data_t sMomTextScripts[] = {
+ { gText_Mom_Pokenav_2B227B, 0xffff, 0xffff },
+ { gText_Mom_Pokenav_2B2310, FLAG_DEFEATED_PETALBURG_GYM, 0xffff },
+ { gText_Mom_Pokenav_2B23F3, FLAG_SYS_GAME_CLEAR, 0xffff },
+ { NULL, 0xffff, 0xffff }
+};
+
+MATCHCALLDEF(sMomMatchCallHeader, 0, 0, FLAG_ENABLE_MOM_MATCH_CALL, gMomMatchCallDesc, gMomMatchCallName, sMomTextScripts);
+
+static const match_call_text_data_t sStevenTextScripts[] = {
+ { gText_Steven_Pokenav_2B5B95, 0xffff, 0xffff },
+ { gText_Steven_Pokenav_2B5C53, FLAG_RUSTURF_TUNNEL_OPENED, 0xffff },
+ { gText_Steven_Pokenav_2B5CC9, FLAG_RECEIVED_RED_OR_BLUE_ORB, 0xffff },
+ { gText_Steven_Pokenav_2B5DB4, FLAG_TEAM_AQUA_ESCAPED_IN_SUBMARINE, 0xffff },
+ { gText_Steven_Pokenav_2B5E26, FLAG_DEFEATED_MOSSDEEP_GYM, 0xffff },
+ { gText_Steven_Pokenav_2B5EA2, FLAG_KYOGRE_ESCAPED_SEAFLOOR_CAVERN, 0xffff },
+ { gText_Steven_Pokenav_2B5ED9, FLAG_SYS_GAME_CLEAR, 0xffff },
+ { NULL, 0xffff, 0xffff },
+};
+
+MATCHCALLDEF(sStevenMatchCallHeader, 0, 0xd5, FLAG_REGISTERED_STEVEN_POKENAV, gStevenMatchCallDesc, gStevenMatchCallName, sStevenTextScripts);
+
+static const match_call_text_data_t sMayTextScripts[] = {
+ { gText_May_Pokenav_2B3AB3, 0xFFFF, 0xFFFF },
+ { gText_May_Pokenav_2B3B3F, FLAG_DEFEATED_DEWFORD_GYM, 0xFFFF },
+ { gText_May_Pokenav_2B3C13, FLAG_DELIVERED_DEVON_GOODS, 0xFFFF },
+ { gText_May_Pokenav_2B3CF3, FLAG_HIDE_MAUVILLE_CITY_WALLY, 0xFFFF },
+ { gText_May_Pokenav_2B3D4B, FLAG_RECEIVED_HM04, 0xFFFF },
+ { gText_May_Pokenav_2B3DD1, FLAG_DEFEATED_LAVARIDGE_GYM, 0xFFFF },
+ { gText_May_Pokenav_2B3E69, FLAG_DEFEATED_PETALBURG_GYM, 0xFFFF },
+ { gText_May_Pokenav_2B3ECD, FLAG_RECEIVED_CASTFORM, 0xFFFF },
+ { gText_May_Pokenav_2B3F2B, FLAG_RECEIVED_RED_OR_BLUE_ORB, 0xFFFF },
+ { gText_May_Pokenav_2B3FFB, FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, 0xFFFF },
+ { gText_May_Pokenav_2B402B, FLAG_MET_TEAM_AQUA_HARBOR, 0xFFFF },
+ { gText_May_Pokenav_2B414B, FLAG_TEAM_AQUA_ESCAPED_IN_SUBMARINE, 0xFFFF },
+ { gText_May_Pokenav_2B4228, FLAG_KYOGRE_ESCAPED_SEAFLOOR_CAVERN, 0xFFFF },
+ { gText_May_Pokenav_2B42E0, FLAG_DEFEATED_SOOTOPOLIS_GYM, 0xFFFF },
+ { gText_May_Pokenav_2B4350, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sMayMatchCallHeader, 4, MALE, FLAG_ENABLE_RIVAL_MATCH_CALL, gMayBrendanMatchCallDesc, gExpandedPlaceholder_May, sMayTextScripts);
+
+static const match_call_text_data_t sBrendanTextScripts[] = {
+ { gText_Brendan_Pokenav_2B43EF, 0xFFFF, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4486, FLAG_DEFEATED_DEWFORD_GYM, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4560, FLAG_DELIVERED_DEVON_GOODS, 0xFFFF },
+ { gText_Brendan_Pokenav_2B463F, FLAG_HIDE_MAUVILLE_CITY_WALLY, 0xFFFF },
+ { gText_Brendan_Pokenav_2B46B7, FLAG_RECEIVED_HM04, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4761, FLAG_DEFEATED_LAVARIDGE_GYM, 0xFFFF },
+ { gText_Brendan_Pokenav_2B47F4, FLAG_DEFEATED_PETALBURG_GYM, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4882, FLAG_RECEIVED_CASTFORM, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4909, FLAG_RECEIVED_RED_OR_BLUE_ORB, 0xFFFF },
+ { gText_Brendan_Pokenav_2B49C4, FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4A44, FLAG_MET_TEAM_AQUA_HARBOR, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4B28, FLAG_TEAM_AQUA_ESCAPED_IN_SUBMARINE, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4C15, FLAG_KYOGRE_ESCAPED_SEAFLOOR_CAVERN, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4CD8, FLAG_DEFEATED_SOOTOPOLIS_GYM, 0xFFFF },
+ { gText_Brendan_Pokenav_2B4D46, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sBrendanMatchCallHeader, 4, FEMALE, FLAG_ENABLE_RIVAL_MATCH_CALL, gMayBrendanMatchCallDesc, gExpandedPlaceholder_Brendan, sBrendanTextScripts);
+
+static const match_call_text_data_t sWallyTextScripts[] = {
+ { gText_Wally_Pokenav_2B4DE2, 0xFFFF, 0xFFFF },
+ { gText_Wally_Pokenav_2B4E57, FLAG_RUSTURF_TUNNEL_OPENED, 0xFFFF },
+ { gText_Wally_Pokenav_2B4EA5, FLAG_DEFEATED_LAVARIDGE_GYM, 0xFFFF },
+ { gText_Wally_Pokenav_2B4F41, FLAG_RECEIVED_CASTFORM, 0xFFFF },
+ { gText_Wally_Pokenav_2B4FF3, FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, 0xFFFF },
+ { gText_Wally_Pokenav_2B50B1, FLAG_KYOGRE_ESCAPED_SEAFLOOR_CAVERN, 0xFFFF },
+ { gText_Wally_Pokenav_2B5100, FLAG_DEFEATED_WALLY_VICTORY_ROAD, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+const struct MatchCallSubstruct2 sWallyAdditionalData[] = {
+ { FLAG_HIDE_MAUVILLE_CITY_WALLY, 0x05 },
+ { FLAG_GROUDON_AWAKENED_MAGMA_HIDEOUT, 0xD5 },
+ { FLAG_HIDE_VICTORY_ROAD_ENTRANCE_WALLY, 0x46 },
+ { 0xFFFF, 0xD5 }
+};
+
+MATCHCALLDEF(sWallyMatchCallHeader, 2, 0, FLAG_ENABLE_WALLY_MATCH_CALL, REMATCH_WALLY_3, gWallyMatchCallDesc, sWallyTextScripts, sWallyAdditionalData);
+
+static const match_call_text_data_t sScottTextScripts[] = {
+ { gText_Scott_Pokenav_2B5184, 0xFFFF, 0xFFFF },
+ { gText_Scott_Pokenav_2B5275, FLAG_DEFEATED_EVIL_TEAM_MT_CHIMNEY, 0xFFFF },
+ { gText_Scott_Pokenav_2B5323, FLAG_RECEIVED_CASTFORM, 0xFFFF },
+ { gText_Scott_Pokenav_2B53DB, FLAG_RECEIVED_RED_OR_BLUE_ORB, 0xFFFF },
+ { gText_Scott_Pokenav_2B54A5, FLAG_TEAM_AQUA_ESCAPED_IN_SUBMARINE, 0xFFFF },
+ { gText_Scott_Pokenav_2B5541, FLAG_DEFEATED_SOOTOPOLIS_GYM, 0xFFFF },
+ { gText_Scott_Pokenav_2B56CA, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+
+MATCHCALLDEF(sScottMatchCallHeader, 0, 0xD5, FLAG_ENABLE_SCOTT_MATCH_CALL, gScottMatchCallDesc, gScottMatchCallName, sScottTextScripts);
+
+static const match_call_text_data_t sRoxanneTextScripts[] = {
+ { gText_Roxanne_Pokenav_2B2456, 0xFFFE, 0xFFFF },
+ { gText_Roxanne_Pokenav_2B250E, 0xFFFF, 0xFFFF },
+ { gText_Roxanne_Pokenav_2B25C1, 0xFFFF, 0xFFFF },
+ { gText_Roxanne_Pokenav_2B2607, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sRoxanneMatchCallHeader, 5, 10, FLAG_ENABLE_ROXANNE_MATCH_CALL, 0x41, gRoxanneMatchCallDesc, NULL, sRoxanneTextScripts);
+
+static const match_call_text_data_t sBrawlyTextScripts[] = {
+ { gText_Brawly_Pokenav_2B2659, 0xFFFE, 0xFFFF },
+ { gText_Brawly_Pokenav_2B275D, 0xFFFF, 0xFFFF },
+ { gText_Brawly_Pokenav_2B286F, 0xFFFF, 0xFFFF },
+ { gText_Brawly_Pokenav_2B28D1, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sBrawlyMatchCallHeader, 5, 2, FLAG_ENABLE_BRAWLY_MATCH_CALL, 0x42, gBrawlyMatchCallDesc, NULL, sBrawlyTextScripts);
+
+static const match_call_text_data_t sWattsonTextScripts[] = {
+ { gText_Wattson_Pokenav_2B2912, 0xFFFE, 0xFFFF },
+ { gText_Wattson_Pokenav_2B29CA, 0xFFFF, 0xFFFF },
+ { gText_Wattson_Pokenav_2B2AB6, 0xFFFF, 0xFFFF },
+ { gText_Wattson_Pokenav_2B2B01, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sWattsonMatchCallHeader, 5, 9, FLAG_ENABLE_WATTSON_MATCH_CALL, 0x43, gWattsonMatchCallDesc, NULL, sWattsonTextScripts);
+
+static const match_call_text_data_t sFlanneryTextScripts[] = {
+ { gText_Flannery_Pokenav_2B2B4D, 0xFFFE, 0xFFFF },
+ { gText_Flannery_Pokenav_2B2C0E, 0xFFFF, 0xFFFF },
+ { gText_Flannery_Pokenav_2B2CF1, 0xFFFF, 0xFFFF },
+ { gText_Flannery_Pokenav_2B2D54, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sFlanneryMatchCallHeader, 5, 3, FLAG_ENABLE_FLANNERY_MATCH_CALL, 0x44, gFlanneryMatchCallDesc, NULL, sFlanneryTextScripts);
+
+static const match_call_text_data_t sWinonaTextScripts[] = {
+ { gText_Winona_Pokenav_2B2DA4, 0xFFFE, 0xFFFF },
+ { gText_Winona_Pokenav_2B2E2B, 0xFFFF, 0xFFFF },
+ { gText_Winona_Pokenav_2B2EC2, 0xFFFF, 0xFFFF },
+ { gText_Winona_Pokenav_2B2F16, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sWinonaMatchCallHeader, 5, 11, FLAG_ENABLE_WINONA_MATCH_CALL, 0x46, gWinonaMatchCallDesc, NULL, sWinonaTextScripts);
+
+static const match_call_text_data_t sTateLizaTextScripts[] = {
+ { gText_TateLiza_Pokenav_2B2F97, 0xFFFE, 0xFFFF },
+ { gText_TateLiza_Pokenav_2B306E, 0xFFFF, 0xFFFF },
+ { gText_TateLiza_Pokenav_2B3158, 0xFFFF, 0xFFFF },
+ { gText_TateLiza_Pokenav_2B31CD, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sTateLizaMatchCallHeader, 5, 13, FLAG_ENABLE_TATE_AND_LIZA_MATCH_CALL, 0x47, gTateLizaMatchCallDesc, NULL, sTateLizaTextScripts);
+
+static const match_call_text_data_t sJuanTextScripts[] = {
+ { gText_Juan_Pokenav_2B3249, 0xFFFE, 0xFFFF },
+ { gText_Juan_Pokenav_2B32EC, 0xFFFF, 0xFFFF },
+ { gText_Juan_Pokenav_2B33AA, 0xFFFF, 0xFFFF },
+ { gText_Juan_Pokenav_2B341E, FLAG_SYS_GAME_CLEAR, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sJuanMatchCallHeader, 5, 14, FLAG_ENABLE_JUAN_MATCH_CALL, 0x48, gJuanMatchCallDesc, NULL, sJuanTextScripts);
+
+static const match_call_text_data_t sSidneyTextScripts[] = {
+ { gText_Sidney_Pokenav_2B34CC, 0xFFFF, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sSidneyMatchCallHeader, 5, 15, FLAG_REMATCH_JUAN, 0x49, gEliteFourMatchCallDesc, NULL, sSidneyTextScripts);
+
+static const match_call_text_data_t sPhoebeTextScripts[] = {
+ { gText_Phoebe_Pokenav_2B3561, 0xFFFF, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sPhoebeMatchCallHeader, 5, 15, FLAG_REMATCH_SIDNEY, 0x4A, gEliteFourMatchCallDesc, NULL, sPhoebeTextScripts);
+
+static const match_call_text_data_t sGlaciaTextScripts[] = {
+ { gText_Glacia_Pokenav_2B35E4, 0xFFFF, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sGlaciaMatchCallHeader, 5, 15, FLAG_REMATCH_PHOEBE, 0x4B, gEliteFourMatchCallDesc, NULL, sGlaciaTextScripts);
+
+static const match_call_text_data_t sDrakeTextScripts[] = {
+ { gText_Drake_Pokenav_2B368B, 0xFFFF, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sDrakeMatchCallHeader, 5, 15, FLAG_REMATCH_GLACIA, 0x4C, gEliteFourMatchCallDesc, NULL, sDrakeTextScripts);
+
+static const match_call_text_data_t sWallaceTextScripts[] = {
+ { gText_Wallace_Pokenav_2B3790, 0xFFFF, 0xFFFF },
+ { NULL, 0xFFFF, 0xFFFF }
+};
+
+MATCHCALLDEF(sWallaceMatchCallHeader, 5, 15, FLAG_REMATCH_DRAKE, 0x4D, gChampionMatchCallDesc, NULL, sWallaceTextScripts);
+
+static const match_call_t sMatchCallHeaders[] = {
+ {.type0 = &sMrStoneMatchCallHeader},
+ {.type3 = &sProfBirchMatchCallHeader},
+ {.type4 = &sBrendanMatchCallHeader},
+ {.type4 = &sMayMatchCallHeader},
+ {.type2 = &sWallyMatchCallHeader},
+ {.type5 = &sNormanMatchCallHeader},
+ {.type0 = &sMomMatchCallHeader},
+ {.type0 = &sStevenMatchCallHeader},
+ {.type0 = &sScottMatchCallHeader},
+ {.type5 = &sRoxanneMatchCallHeader},
+ {.type5 = &sBrawlyMatchCallHeader},
+ {.type5 = &sWattsonMatchCallHeader},
+ {.type5 = &sFlanneryMatchCallHeader},
+ {.type5 = &sWinonaMatchCallHeader},
+ {.type5 = &sTateLizaMatchCallHeader},
+ {.type5 = &sJuanMatchCallHeader},
+ {.type5 = &sSidneyMatchCallHeader},
+ {.type5 = &sPhoebeMatchCallHeader},
+ {.type5 = &sGlaciaMatchCallHeader},
+ {.type5 = &sDrakeMatchCallHeader},
+ {.type5 = &sWallaceMatchCallHeader}
+};
+
+static bool32 (*const sMatchCallGetFlagFuncs[])(match_call_t) = {
+ MatchCallGetFlag_Type0,
+ MatchCallGetFlag_Type1,
+ MatchCallGetFlag_Type2,
+ MatchCallGetFlag_Type3,
+ MatchCallGetFlag_Type4
+};
+
+static u8 (*const gUnknown_08625310[])(match_call_t) = {
+ sub_81D1714,
+ sub_81D1718,
+ sub_81D171C,
+ sub_81D1750,
+ sub_81D1754
+};
+
+static bool32 (*const sMatchCall_IsRematchableFunctions[])(match_call_t) = {
+ MatchCall_IsRematchable_Type0,
+ MatchCall_IsRematchable_Type1,
+ MatchCall_IsRematchable_Type2,
+ MatchCall_IsRematchable_Type3,
+ MatchCall_IsRematchable_Type4
+};
+
+static bool32 (*const gUnknown_08625338[])(match_call_t) = {
+ sub_81D1840,
+ sub_81D1844,
+ sub_81D1848,
+ sub_81D184C,
+ sub_81D1850
+};
+
+static u32 (*const sMatchCall_GetRematchTableIdxFunctions[])(match_call_t) = {
+ MatchCall_GetRematchTableIdx_Type0,
+ MatchCall_GetRematchTableIdx_Type1,
+ MatchCall_GetRematchTableIdx_Type2,
+ MatchCall_GetRematchTableIdx_Type3,
+ MatchCall_GetRematchTableIdx_Type4
+};
+
+static void (*const sMatchCall_GetMessageFunctions[])(match_call_t, u8 *) = {
+ MatchCall_GetMessage_Type0,
+ MatchCall_GetMessage_Type1,
+ MatchCall_GetMessage_Type2,
+ MatchCall_GetMessage_Type3,
+ MatchCall_GetMessage_Type4
+};
+
+static void (*const sMatchCall_GetNameAndDescFunctions[])(match_call_t, const u8 **, const u8 **) = {
+ MatchCall_GetNameAndDesc_Type0,
+ MatchCall_GetNameAndDesc_Type1,
+ MatchCall_GetNameAndDesc_Type2,
+ MatchCall_GetNameAndDesc_Type3,
+ MatchCall_GetNameAndDesc_Type4
+};
+
+static const struct UnkStruct_08625388 sMatchCallCheckPageOverrides[] = {
+ { 7, 0x4B, 0xffff, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_BeforeMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_BeforeMeteorFallsBattle } }, // STEVEN
+ { 7, 0x4B, FLAG_DEFEATED_MOSSDEEP_GYM, { gMatchCallStevenStrategyText, gMatchCall_StevenTrainersPokemonText, gMatchCall_StevenSelfIntroductionText_Line1_AfterMeteorFallsBattle, gMatchCall_StevenSelfIntroductionText_Line2_AfterMeteorFallsBattle } }, // STEVEN
+ { 2, 0x3c, 0xffff, { gMatchCall_BrendanStrategyText, gMatchCall_BrendanTrainersPokemonText, gMatchCall_BrendanSelfIntroductionText_Line1, gMatchCall_BrendanSelfIntroductionText_Line2 } }, // Brendan
+ { 3, 0x3f, 0xffff, { gMatchCall_MayStrategyText, gMatchCall_MayTrainersPokemonText, gMatchCall_MaySelfIntroductionText_Line1, gMatchCall_MaySelfIntroductionText_Line2 } } // May
+};
+
+// .text
+
+static u32 MatchCallGetFunctionIndex(match_call_t matchCall)
+{
+ switch (matchCall.common->type)
+ {
+ case 0:
+ default:
+ return 0;
+ case 1:
+ case 5:
+ return 1;
+ case 2:
+ return 2;
+ case 4:
+ return 3;
+ case 3:
+ return 4;
+ }
+}
+
+u32 GetTrainerIdxByRematchIdx(u32 rematchIdx)
+{
+ return gRematchTable[rematchIdx].trainerIds[0];
+}
+
+s32 GetRematchIdxByTrainerIdx(s32 trainerIdx)
+{
+ s32 rematchIdx;
+
+ for (rematchIdx = 0; rematchIdx < REMATCH_TABLE_ENTRIES; rematchIdx++)
+ {
+ if (gRematchTable[rematchIdx].trainerIds[0] == trainerIdx)
+ return rematchIdx;
+ }
+ return -1;
+}
+
+bool32 MatchCallFlagGetByIndex(u32 idx)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return FALSE;
+ matchCall = sMatchCallHeaders[idx];
+ i = MatchCallGetFunctionIndex(matchCall);
+ return sMatchCallGetFlagFuncs[i](matchCall);
+}
+
+static bool32 MatchCallGetFlag_Type0(match_call_t matchCall)
+{
+ if (matchCall.type0->flag == 0xffff)
+ return TRUE;
+ return FlagGet(matchCall.type0->flag);
+}
+
+static bool32 MatchCallGetFlag_Type1(match_call_t matchCall)
+{
+ if (matchCall.type1->flag == 0xffff)
+ return TRUE;
+ return FlagGet(matchCall.type1->flag);
+}
+
+static bool32 MatchCallGetFlag_Type2(match_call_t matchCall)
+{
+ if (matchCall.type2->flag == 0xffff)
+ return TRUE;
+ return FlagGet(matchCall.type2->flag);
+}
+
+static bool32 MatchCallGetFlag_Type3(match_call_t matchCall)
+{
+ if (matchCall.type4->gender != gSaveBlock2Ptr->playerGender)
+ return FALSE;
+ if (matchCall.type4->flag == 0xffff)
+ return TRUE;
+ return FlagGet(matchCall.type4->flag);
+}
+
+static bool32 MatchCallGetFlag_Type4(match_call_t matchCall)
+{
+ return FlagGet(matchCall.type3->flag);
+}
+
+u8 sub_81D16DC(u32 idx)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return 0;
+ matchCall = sMatchCallHeaders[idx];
+ i = MatchCallGetFunctionIndex(matchCall);
+ return gUnknown_08625310[i](matchCall);
+}
+
+static u8 sub_81D1714(match_call_t matchCall)
+{
+ return matchCall.type0->v1;
+}
+
+static u8 sub_81D1718(match_call_t matchCall)
+{
+ return matchCall.type1->v1;
+}
+
+static u8 sub_81D171C(match_call_t matchCall)
+{
+ s32 i;
+
+ for (i = 0; matchCall.type2->v10[i].flag != 0xffff; i++)
+ {
+ if (!FlagGet(matchCall.type2->v10[i].flag))
+ break;
+ }
+ return matchCall.type2->v10[i].v2;
+}
+
+static u8 sub_81D1750(match_call_t matchCall)
+{
+ return 0xd5;
+}
+
+static u8 sub_81D1754(match_call_t matchCall)
+{
+ return 0xd5;
+}
+
+bool32 MatchCall_IsRematchable(u32 idx)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return 0;
+ matchCall = sMatchCallHeaders[idx];
+ i = MatchCallGetFunctionIndex(matchCall);
+ return sMatchCall_IsRematchableFunctions[i](matchCall);
+}
+
+static bool32 MatchCall_IsRematchable_Type0(match_call_t matchCall)
+{
+ return FALSE;
+}
+
+static bool32 MatchCall_IsRematchable_Type1(match_call_t matchCall)
+{
+ if (matchCall.type1->rematchTableIdx >= REMATCH_ELITE_FOUR_ENTRIES)
+ return FALSE;
+ return gSaveBlock1Ptr->trainerRematches[matchCall.type1->rematchTableIdx] ? TRUE : FALSE;
+}
+
+static bool32 MatchCall_IsRematchable_Type2(match_call_t matchCall)
+{
+ return gSaveBlock1Ptr->trainerRematches[matchCall.type2->rematchTableIdx] ? TRUE : FALSE;
+}
+
+static bool32 MatchCall_IsRematchable_Type3(match_call_t matchCall)
+{
+ return FALSE;
+}
+
+static bool32 MatchCall_IsRematchable_Type4(match_call_t matchCall)
+{
+ return FALSE;
+}
+
+bool32 sub_81D17E8(u32 idx)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return FALSE;
+ matchCall = sMatchCallHeaders[idx];
+ i = MatchCallGetFunctionIndex(matchCall);
+ if (gUnknown_08625338[i](matchCall))
+ return TRUE;
+ for (i = 0; i < 4; i++)
+ {
+ if (sMatchCallCheckPageOverrides[i].idx == idx)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static bool32 sub_81D1840(match_call_t matchCall)
+{
+ return FALSE;
+}
+
+static bool32 sub_81D1844(match_call_t matchCall)
+{
+ return TRUE;
+}
+
+static bool32 sub_81D1848(match_call_t matchCall)
+{
+ return TRUE;
+}
+
+static bool32 sub_81D184C(match_call_t matchCall)
+{
+ return FALSE;
+}
+
+static bool32 sub_81D1850(match_call_t matchCall)
+{
+ return FALSE;
+}
+
+u32 MatchCall_GetRematchTableIdx(u32 idx)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return REMATCH_TABLE_ENTRIES;
+ matchCall = sMatchCallHeaders[idx];
+ i = MatchCallGetFunctionIndex(matchCall);
+ return sMatchCall_GetRematchTableIdxFunctions[i](matchCall);
+}
+
+static u32 MatchCall_GetRematchTableIdx_Type0(match_call_t matchCall)
+{
+ return REMATCH_TABLE_ENTRIES;
+}
+
+static u32 MatchCall_GetRematchTableIdx_Type1(match_call_t matchCall)
+{
+ return matchCall.type1->rematchTableIdx;
+}
+
+static u32 MatchCall_GetRematchTableIdx_Type2(match_call_t matchCall)
+{
+ return matchCall.type2->rematchTableIdx;
+}
+
+static u32 MatchCall_GetRematchTableIdx_Type3(match_call_t matchCall)
+{
+ return REMATCH_TABLE_ENTRIES;
+}
+
+static u32 MatchCall_GetRematchTableIdx_Type4(match_call_t matchCall)
+{
+ return REMATCH_TABLE_ENTRIES;
+}
+
+void MatchCall_GetMessage(u32 idx, u8 *dest)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return;
+ matchCall = sMatchCallHeaders[idx];
+ i = MatchCallGetFunctionIndex(matchCall);
+ sMatchCall_GetMessageFunctions[i](matchCall, dest);
+}
+
+static void MatchCall_GetMessage_Type0(match_call_t matchCall, u8 *dest)
+{
+ sub_81D1920(matchCall.type0->textData, dest);
+}
+
+static void MatchCall_GetMessage_Type1(match_call_t matchCall, u8 *dest)
+{
+ if (matchCall.common->type != 5)
+ sub_81D1920(matchCall.type5->textData, dest);
+ else
+ sub_81D199C(matchCall.type1->textData, matchCall.type1->rematchTableIdx, dest);
+}
+
+static void MatchCall_GetMessage_Type2(match_call_t matchCall, u8 *dest)
+{
+ sub_81D1920(matchCall.type2->textData, dest);
+}
+
+static void MatchCall_GetMessage_Type3(match_call_t matchCall, u8 *dest)
+{
+ sub_81D1920(matchCall.type4->textData, dest);
+}
+
+static void MatchCall_GetMessage_Type4(match_call_t matchCall, u8 *dest)
+{
+ sub_8197080(dest);
+}
+
+void sub_81D1920(const match_call_text_data_t *sub0, u8 *dest)
+{
+ u32 i;
+ for (i = 0; sub0[i].text != NULL; i++)
+ ;
+ if (i)
+ i--;
+ while (i)
+ {
+ if (sub0[i].flag != 0xffff && FlagGet(sub0[i].flag) == TRUE)
+ break;
+ i--;
+ }
+ if (sub0[i].flag2 != 0xffff)
+ FlagSet(sub0[i].flag2);
+ StringExpandPlaceholders(dest, sub0[i].text);
+}
+
+#ifdef NONMATCHING
+// There's some weird upmerge going on that I cannot replicate at this time.
+static void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
+{
+ u32 i;
+ for (i = 0; sub0[i].text != NULL; i++)
+ {
+ if (sub0[i].flag == 0xfffe)
+ break;
+ if (sub0[i].flag == 0xffff && !FlagGet(sub0[i].flag))
+ break;
+ }
+ if (sub0[i].flag != 0xfffe)
+ {
+ if (i)
+ i--;
+ if (sub0[i].flag2 != 0xffff)
+ FlagSet(sub0[i].flag2);
+ StringExpandPlaceholders(dest, sub0[i].text);
+ }
+ else
+ {
+ if (!FlagGet(FLAG_SYS_GAME_CLEAR))
+ ;
+ else if (gSaveBlock1Ptr->trainerRematches[idx])
+ i += 2;
+ else if (CountBattledRematchTeams(idx) >= 2)
+ i += 3;
+ else
+ i++;
+ StringExpandPlaceholders(dest, sub0[i].text);
+ }
+}
+#else
+static NAKED void sub_81D199C(const match_call_text_data_t *sub0, u16 idx, u8 *dest)
+{
+ asm_unified("\tpush {r4-r7,lr}\n"
+ "\tmov r7, r10\n"
+ "\tmov r6, r9\n"
+ "\tmov r5, r8\n"
+ "\tpush {r5-r7}\n"
+ "\tadds r6, r0, 0\n"
+ "\tmov r10, r2\n"
+ "\tlsls r1, 16\n"
+ "\tlsrs r7, r1, 16\n"
+ "\tmovs r5, 0\n"
+ "\tldr r0, [r6]\n"
+ "\tcmp r0, 0\n"
+ "\tbeq _081D19E6\n"
+ "\tldrh r0, [r6, 0x4]\n"
+ "\tldr r1, =0x0000fffe\n"
+ "\tcmp r0, r1\n"
+ "\tbeq _081D1A24\n"
+ "\tldr r0, =0x0000ffff\n"
+ "\tmov r9, r0\n"
+ "\tmov r8, r1\n"
+ "\tadds r4, r6, 0\n"
+ "_081D19C6:\n"
+ "\tldrh r0, [r4, 0x4]\n"
+ "\tcmp r0, r9\n"
+ "\tbeq _081D19D6\n"
+ "\tbl FlagGet\n"
+ "\tlsls r0, 24\n"
+ "\tcmp r0, 0\n"
+ "\tbeq _081D19E6\n"
+ "_081D19D6:\n"
+ "\tadds r4, 0x8\n"
+ "\tadds r5, 0x1\n"
+ "\tldr r0, [r4]\n"
+ "\tcmp r0, 0\n"
+ "\tbeq _081D19E6\n"
+ "\tldrh r0, [r4, 0x4]\n"
+ "\tcmp r0, r8\n"
+ "\tbne _081D19C6\n"
+ "_081D19E6:\n"
+ "\tlsls r0, r5, 3\n"
+ "\tadds r0, r6\n"
+ "\tldrh r1, [r0, 0x4]\n"
+ "\tldr r0, =0x0000fffe\n"
+ "\tcmp r1, r0\n"
+ "\tbeq _081D1A24\n"
+ "\tcmp r5, 0\n"
+ "\tbeq _081D19F8\n"
+ "\tsubs r5, 0x1\n"
+ "_081D19F8:\n"
+ "\tlsls r0, r5, 3\n"
+ "\tadds r4, r0, r6\n"
+ "\tldrh r1, [r4, 0x6]\n"
+ "\tldr r0, =0x0000ffff\n"
+ "\tcmp r1, r0\n"
+ "\tbeq _081D1A0A\n"
+ "\tadds r0, r1, 0\n"
+ "\tbl FlagSet\n"
+ "_081D1A0A:\n"
+ "\tldr r1, [r4]\n"
+ "\tmov r0, r10\n"
+ "\tbl StringExpandPlaceholders\n"
+ "\tb _081D1A5C\n"
+ "\t.pool\n"
+ "_081D1A1C:\n"
+ "\tadds r5, 0x2\n"
+ "\tb _081D1A50\n"
+ "_081D1A20:\n"
+ "\tadds r5, 0x3\n"
+ "\tb _081D1A50\n"
+ "_081D1A24:\n"
+ "\tldr r0, =0x00000864\n"
+ "\tbl FlagGet\n"
+ "\tlsls r0, 24\n"
+ "\tcmp r0, 0\n"
+ "\tbeq _081D1A50\n"
+ "\tldr r0, =gSaveBlock1Ptr\n"
+ "\tldr r0, [r0]\n"
+ "\tldr r1, =0x000009ca\n"
+ "\tadds r0, r1\n"
+ "\tadds r0, r7\n"
+ "\tldrb r0, [r0]\n"
+ "\tcmp r0, 0\n"
+ "\tbne _081D1A1C\n"
+ "\tadds r0, r7, 0\n"
+ "\tbl CountBattledRematchTeams\n"
+ "\tlsls r0, 16\n"
+ "\tlsrs r0, 16\n"
+ "\tcmp r0, 0x1\n"
+ "\tbhi _081D1A20\n"
+ "\tadds r5, 0x1\n"
+ "_081D1A50:\n"
+ "\tlsls r0, r5, 3\n"
+ "\tadds r0, r6\n"
+ "\tldr r1, [r0]\n"
+ "\tmov r0, r10\n"
+ "\tbl StringExpandPlaceholders\n"
+ "_081D1A5C:\n"
+ "\tpop {r3-r5}\n"
+ "\tmov r8, r3\n"
+ "\tmov r9, r4\n"
+ "\tmov r10, r5\n"
+ "\tpop {r4-r7}\n"
+ "\tpop {r0}\n"
+ "\tbx r0\n"
+ "\t.pool");
+}
+#endif
+
+void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return;
+ matchCall = sMatchCallHeaders[idx];
+ i = MatchCallGetFunctionIndex(matchCall);
+ sMatchCall_GetNameAndDescFunctions[i](matchCall, desc, name);
+}
+
+static void MatchCall_GetNameAndDesc_Type0(match_call_t matchCall, const u8 **desc, const u8 **name)
+{
+ *desc = matchCall.type0->desc;
+ *name = matchCall.type0->name;
+}
+
+static void MatchCall_GetNameAndDesc_Type1(match_call_t matchCall, const u8 **desc, const u8 **name)
+{
+ match_call_t _matchCall = matchCall;
+ if (_matchCall.type1->name == NULL)
+ MatchCall_GetNameAndDescByRematchIdx(_matchCall.type1->rematchTableIdx, desc, name);
+ else
+ *name = _matchCall.type1->name;
+ *desc = _matchCall.type1->desc;
+}
+
+static void MatchCall_GetNameAndDesc_Type2(match_call_t matchCall, const u8 **desc, const u8 **name)
+{
+ MatchCall_GetNameAndDescByRematchIdx(matchCall.type2->rematchTableIdx, desc, name);
+ *desc = matchCall.type2->desc;
+}
+
+static void MatchCall_GetNameAndDesc_Type3(match_call_t matchCall, const u8 **desc, const u8 **name)
+{
+ *desc = matchCall.type4->desc;
+ *name = matchCall.type4->name;
+}
+
+static void MatchCall_GetNameAndDesc_Type4(match_call_t matchCall, const u8 **desc, const u8 **name)
+{
+ *desc = matchCall.type3->desc;
+ *name = matchCall.type3->name;
+}
+
+static void MatchCall_GetNameAndDescByRematchIdx(u32 idx, const u8 **desc, const u8 **name)
+{
+ const struct Trainer *trainer = gTrainers + GetTrainerIdxByRematchIdx(idx);
+ *desc = gTrainerClassNames[trainer->trainerClass];
+ *name = trainer->trainerName;
+}
+
+#ifdef NONMATCHING
+const u8 *sub_81D1B40(u32 idx, u32 offset)
+{
+ u32 i;
+
+ for (i = 0; i < 4; i++)
+ {
+ if (sMatchCallCheckPageOverrides[i].idx == idx)
+ {
+ for (; i + 1 < 4 && sMatchCallCheckPageOverrides[i + 1].idx == idx; i++)
+ {
+ if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].v4))
+ break;
+ }
+ return sMatchCallCheckPageOverrides[i].v8[offset];
+ }
+ }
+ return NULL;
+}
+#else
+NAKED const u8 *sub_81D1B40(u32 idx, u32 offset)
+{
+ asm_unified("\tpush {r4-r7,lr}\n"
+ "\tmov r7, r9\n"
+ "\tmov r6, r8\n"
+ "\tpush {r6,r7}\n"
+ "\tadds r6, r0, 0\n"
+ "\tmovs r5, 0\n"
+ "\tldr r2, =sMatchCallCheckPageOverrides\n"
+ "\tmovs r0, 0x8\n"
+ "\tadds r0, r2\n"
+ "\tmov r9, r0\n"
+ "_081D1B54:\n"
+ "\tlsls r0, r5, 1\n"
+ "\tadds r0, r5\n"
+ "\tlsls r0, 3\n"
+ "\tadds r0, r2\n"
+ "\tldrh r0, [r0]\n"
+ "\tcmp r0, r6\n"
+ "\tbne _081D1BBC\n"
+ "\tadds r4, r5, 0x1\n"
+ "\tlsls r1, 2\n"
+ "\tmov r8, r1\n"
+ "\tcmp r4, 0x3\n"
+ "\tbhi _081D1BA8\n"
+ "\tlsls r0, r4, 1\n"
+ "\tadds r0, r4\n"
+ "\tlsls r0, 3\n"
+ "\tadds r0, r2\n"
+ "\tldrh r0, [r0]\n"
+ "\tcmp r0, r6\n"
+ "\tbne _081D1BA8\n"
+ "\tldr r7, =sMatchCallCheckPageOverrides\n"
+ "_081D1B7C:\n"
+ "\tlsls r0, r4, 1\n"
+ "\tadds r0, r4\n"
+ "\tlsls r0, 3\n"
+ "\tadds r1, r7, 0x4\n"
+ "\tadds r0, r1\n"
+ "\tldrh r0, [r0]\n"
+ "\tbl FlagGet\n"
+ "\tlsls r0, 24\n"
+ "\tcmp r0, 0\n"
+ "\tbeq _081D1BA8\n"
+ "\tadds r5, r4, 0\n"
+ "\tadds r4, r5, 0x1\n"
+ "\tcmp r4, 0x3\n"
+ "\tbhi _081D1BA8\n"
+ "\tlsls r0, r4, 1\n"
+ "\tadds r0, r4\n"
+ "\tlsls r0, 3\n"
+ "\tadds r0, r7\n"
+ "\tldrh r0, [r0]\n"
+ "\tcmp r0, r6\n"
+ "\tbeq _081D1B7C\n"
+ "_081D1BA8:\n"
+ "\tlsls r0, r5, 1\n"
+ "\tadds r0, r5\n"
+ "\tlsls r0, 3\n"
+ "\tadd r0, r8\n"
+ "\tadd r0, r9\n"
+ "\tldr r0, [r0]\n"
+ "\tb _081D1BC4\n"
+ "\t.pool\n"
+ "_081D1BBC:\n"
+ "\tadds r5, 0x1\n"
+ "\tcmp r5, 0x3\n"
+ "\tbls _081D1B54\n"
+ "\tmovs r0, 0\n"
+ "_081D1BC4:\n"
+ "\tpop {r3,r4}\n"
+ "\tmov r8, r3\n"
+ "\tmov r9, r4\n"
+ "\tpop {r4-r7}\n"
+ "\tpop {r1}\n"
+ "\tbx r1");
+}
+#endif
+
+s32 sub_81D1BD0(u32 idx)
+{
+ u32 i;
+
+ for (i = 0; i < 4; i++)
+ {
+ if (sMatchCallCheckPageOverrides[i].idx == idx)
+ return sMatchCallCheckPageOverrides[i].v2;
+ }
+ return -1;
+}
+
+bool32 sub_81D1BF8(u32 idx)
+{
+ s32 i;
+
+ for (i = 0; i < 21; i++)
+ {
+ u32 r0 = MatchCall_GetRematchTableIdx(i);
+ if (r0 != REMATCH_TABLE_ENTRIES && r0 == idx)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void SetMatchCallRegisteredFlag(void)
+{
+ s32 r0 = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004);
+ if (r0 >= 0)
+ FlagSet(FLAG_MATCH_CALL_REGISTERED + r0);
+}
diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c
index 1b17c372c..0926d4569 100644
--- a/src/reshow_battle_screen.c
+++ b/src/reshow_battle_screen.c
@@ -240,7 +240,7 @@ static void CreateBattlerSprite(u8 battler)
{
SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(B_POSITION_PLAYER_LEFT));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
- (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
+ (8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].size) * 4 + 80,
GetBattlerSpriteSubpriority(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
@@ -250,7 +250,7 @@ static void CreateBattlerSprite(u8 battler)
{
SetMultiuseSpriteTemplateToTrainerBack(TRAINER_BACK_PIC_WALLY, GetBattlerPosition(0));
gBattlerSpriteIds[battler] = CreateSprite(&gMultiuseSpriteTemplate, 0x50,
- (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].coords) * 4 + 80,
+ (8 - gTrainerBackPicCoords[TRAINER_BACK_PIC_WALLY].size) * 4 + 80,
GetBattlerSpriteSubpriority(0));
gSprites[gBattlerSpriteIds[battler]].oam.paletteNum = battler;
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCallbackDummy;
diff --git a/src/roulette.c b/src/roulette.c
new file mode 100644
index 000000000..a6a020f39
--- /dev/null
+++ b/src/roulette.c
@@ -0,0 +1,4929 @@
+#include "global.h"
+#include "alloc.h"
+#include "bg.h"
+#include "coins.h"
+#include "decompress.h"
+#include "event_data.h"
+#include "field_screen_effect.h"
+#include "gpu_regs.h"
+#include "graphics.h"
+#include "m4a.h"
+#include "main.h"
+#include "menu.h"
+#include "menu_helpers.h"
+#include "overworld.h"
+#include "palette.h"
+#include "random.h"
+#include "roulette.h"
+#include "roulette_util.h"
+#include "rtc.h"
+#include "scanline_effect.h"
+#include "script.h"
+#include "sound.h"
+#include "sprite.h"
+#include "string_util.h"
+#include "task.h"
+#include "trig.h"
+#include "tv.h"
+#include "window.h"
+#include "constants/rgb.h"
+#include "constants/species.h"
+#include "constants/songs.h"
+
+struct StructgUnknown_083F8DF4
+{
+ u8 var00;
+ u8 var01;
+ u8 var02;
+ u8 var03;
+ u8 var04;
+ u8 filler_05[3];
+ u16 var08;
+ u16 var0A;
+ u16 var0C;
+ u8 filler_0E[2];
+ u16 var10;
+ u16 var12;
+ u16 var14;
+ u8 filler_16[2];
+ u16 var18;
+ u16 var1A;
+ float var1C;
+};
+
+struct StructgUnknown_085B6154
+{
+ u8 var00;
+ u8 var01_0:4;
+ u8 var01_4:4;
+ u8 var02;
+ u8 var03;
+ u8 var04;
+ u8 var05;
+ u8 var06;
+ u32 var08;
+ u32 var0C;
+ u16 var10;
+};
+
+struct StructgUnknown_083F8D90
+{
+ u8 var00;
+ u8 var01;
+ u8 var02;
+ u32 var04;
+};
+
+EWRAM_DATA struct Roulette
+{
+ u8 var00;
+ u8 var01;
+ u8 var02;
+ u8 var03_0:5;
+ u8 var03_5:1;
+ u8 var03_6:1;
+ u8 var03_7:1;
+ u8 var04_0:2;
+ u8 var04_2:5;
+ u8 var04_7:1;
+ u32 var08;
+ u8 var0C[6];
+ u8 var12[4];
+ u8 var16[3];
+ u8 var19;
+ u8 var1A_0:4;
+ u8 var1A_4:4;
+ u8 var1B[6];
+ u8 var21;
+ u8 var22;
+ u8 var23;
+ s16 var24;
+ s16 var26;
+ s16 var28;
+ s16 var2A;
+ struct OamMatrix var2C;
+ u16 var34;
+ struct Sprite *var38;
+ u8 var3C[MAX_SPRITES]; // Sprite IDs
+ u8 var7C;
+ u8 var7D;
+ u8 var7E;
+ u8 var7F;
+ s16 var80;
+ s16 var82;
+ u16 var84;
+ u16 var86;
+ float var88;
+ float var8C;
+ float var90;
+ float var94;
+ float var98;
+ float var9C;
+ float varA0;
+ u8 varA4;
+ u8 varA5;
+ u8 v51[2];
+ u16 varA8;
+ u16 varAA;
+ TaskFunc varAC;
+ u8 v46[4];
+ TaskFunc varB4;
+ struct UnkStruct0 varB8;
+ u16 tilemapBuffers[7][0x400];
+ u16 *unk_397C;
+} *gUnknown_0203AB88 = NULL;
+EWRAM_DATA u8 gUnknown_0203AB8C = 0;
+
+static void sub_8140814(u8);
+static void sub_81408A8(u8);
+static void sub_8140968(u8);
+static void sub_8140994(u8);
+static void sub_8140BD0(u8);
+static void sub_8141040(u8);
+static void sub_81410FC(u8);
+static void sub_8141344(u8);
+static void sub_814155C(u8);
+static void sub_81415D4(u8);
+static void sub_81416D4(u8);
+static void sub_8141778(u8);
+static void sub_814189C(u8);
+static void sub_8141A18(u8);
+static void sub_8141AC0(u8);
+static void sub_8141B58(u8);
+static void dp01t_12_3_battle_menu(u8);
+static void sub_8141DE4(u8);
+static void sub_8141E7C(u8);
+static void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3);
+static void sub_8141FF4(u8);
+static void sub_8142070(void);
+static void sub_8142918(u8);
+static void sub_814297C(u8);
+static u8 sub_81420D0(u8, u8);
+static bool8 sub_81421E8(u8, u8);
+static void sub_8142284(u8);
+static void sub_81424FC(u8);
+static u8 sub_8142758(u8);
+static void sub_8142814(void);
+static void sub_8142C0C(u8);
+static void sub_8142CD0(void);
+static void sub_8142E70(u8, u8);
+static void sub_8142F7C(void);
+static void sub_8143038(u8, u8);
+static void sub_8143150(u8);
+static void sub_81431E4(void);
+static void sub_8143280(struct Sprite *);
+static void sub_8143314(void);
+static void sub_8143514(u16);
+static void sub_81436D0(u8);
+static void sub_814372C(u8);
+static void sub_814390C(struct Sprite *);
+static void sub_814391C(void);
+static void sub_814399C(struct Sprite *);
+static void sub_81439C8(void);
+static void sub_8143A40(void);
+static void sub_81446AC(struct Sprite *);
+static void sub_81446DC(struct Sprite *);
+static void sub_81448B8(struct Sprite *);
+static void sub_8144A24(struct Sprite *);
+static void sub_8144E60(struct Sprite *);
+static void sub_8145294(struct Sprite *);
+
+extern const u8 gUnknown_082A5B89[];
+extern const u8 gUnknown_082A5C13[];
+extern const u8 gUnknown_082A5BD7[];
+extern const u8 gUnknown_082A5BCB[];
+extern const u8 gUnknown_082A5BE0[];
+extern const u8 gUnknown_082A5BEF[];
+extern const u8 gUnknown_082A5C21[];
+extern const u8 gUnknown_082A5C61[];
+extern const u8 gUnknown_082A5C04[];
+extern const u8 gUnknown_082A5B12[];
+extern const u8 gUnknown_082A5B6B[];
+extern const u8 gUnknown_082A5B4E[];
+
+static const u16 gUnknown_085B5BFC[] = INCBIN_U16("graphics/roulette/85B5BFC.gbapal");
+static const u32 gUnknown_085B5DFC[] = INCBIN_U32("graphics/roulette/85B5DFC.bin.lz");
+static const u32 gUnknown_085B5FA0[] = INCBIN_U32("graphics/roulette/wheel_map.bin.lz");
+static const struct BgTemplate gUnknown_085B6140[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 4,
+ .screenSize = 1,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 6,
+ .screenSize = 1,
+ .paletteMode = 1,
+ .priority = 2,
+ .baseTile = 0
+ }
+};
+static const struct WindowTemplate gUnknown_085B614C[] =
+{
+ {
+ .bg = 0,
+ .tilemapLeft = 3,
+ .tilemapTop = 15,
+ .width = 24,
+ .height = 4,
+ .paletteNum = 15,
+ .baseBlock = 0xC5
+ },
+ // BUG: Array not terminated properly
+ //DUMMY_WIN_TEMPLATE
+};
+static const struct StructgUnknown_085B6154 gUnknown_085B6154[] =
+{
+ {
+ .var00 = 0xFF,
+ .var01_0 = 0,
+ .var01_4 = 0,
+ .var02 = 0,
+ .var03 = 7,
+ .var04 = 7,
+ .var05 = 0,
+ .var06 = 0,
+ .var08 = 0x0,
+ .var0C = 0x0,
+ .var10 = 0x0,
+ },
+ {
+ .var00 = 12,
+ .var01_0 = 4,
+ .var01_4 = 1,
+ .var02 = 0,
+ .var03 = 17,
+ .var04 = 7,
+ .var05 = 0,
+ .var06 = 0,
+ .var08 = 0x2,
+ .var0C = 0x10842,
+ .var10 = 0xE000,
+ },
+ {
+ .var00 = 13,
+ .var01_0 = 4,
+ .var01_4 = 2,
+ .var02 = 0,
+ .var03 = 20,
+ .var04 = 7,
+ .var05 = 0,
+ .var06 = 0,
+ .var08 = 0x4,
+ .var0C = 0x21084,
+ .var10 = 0xE000,
+ },
+ {
+ .var00 = 14,
+ .var01_0 = 4,
+ .var01_4 = 3,
+ .var02 = 0,
+ .var03 = 23,
+ .var04 = 7,
+ .var05 = 0,
+ .var06 = 0,
+ .var08 = 0x8,
+ .var0C = 0x42108,
+ .var10 = 0xE000,
+ },
+ {
+ .var00 = 15,
+ .var01_0 = 4,
+ .var01_4 = 4,
+ .var02 = 0,
+ .var03 = 26,
+ .var04 = 7,
+ .var05 = 0,
+ .var06 = 0,
+ .var08 = 0x10,
+ .var0C = 0x84210,
+ .var10 = 0xE000,
+ },
+ {
+ .var00 = 16,
+ .var01_0 = 3,
+ .var01_4 = 0,
+ .var02 = 1,
+ .var03 = 14,
+ .var04 = 10,
+ .var05 = 0,
+ .var06 = 12,
+ .var08 = 0x20,
+ .var0C = 0x3E0,
+ .var10 = 0x249,
+ },
+ {
+ .var00 = 0,
+ .var01_0 = 12,
+ .var01_4 = 1,
+ .var02 = 1,
+ .var03 = 17,
+ .var04 = 10,
+ .var05 = 3,
+ .var06 = 3,
+ .var08 = 0x40,
+ .var0C = 0x40,
+ .var10 = 0x2001,
+ },
+ {
+ .var00 = 9,
+ .var01_0 = 12,
+ .var01_4 = 2,
+ .var02 = 1,
+ .var03 = 20,
+ .var04 = 10,
+ .var05 = 3,
+ .var06 = 3,
+ .var08 = 0x80,
+ .var0C = 0x80,
+ .var10 = 0x2200,
+ },
+ {
+ .var00 = 6,
+ .var01_0 = 12,
+ .var01_4 = 3,
+ .var02 = 1,
+ .var03 = 23,
+ .var04 = 10,
+ .var05 = 3,
+ .var06 = 3,
+ .var08 = 0x100,
+ .var0C = 0x100,
+ .var10 = 0x2040,
+ },
+ {
+ .var00 = 3,
+ .var01_0 = 12,
+ .var01_4 = 4,
+ .var02 = 1,
+ .var03 = 26,
+ .var04 = 10,
+ .var05 = 3,
+ .var06 = 3,
+ .var08 = 0x200,
+ .var0C = 0x200,
+ .var10 = 0x2008,
+ },
+ {
+ .var00 = 17,
+ .var01_0 = 3,
+ .var01_4 = 0,
+ .var02 = 2,
+ .var03 = 14,
+ .var04 = 13,
+ .var05 = 3,
+ .var06 = 15,
+ .var08 = 0x400,
+ .var0C = 0x7C00,
+ .var10 = 0x492,
+ },
+ {
+ .var00 = 4,
+ .var01_0 = 12,
+ .var01_4 = 1,
+ .var02 = 2,
+ .var03 = 17,
+ .var04 = 13,
+ .var05 = 6,
+ .var06 = 6,
+ .var08 = 0x800,
+ .var0C = 0x800,
+ .var10 = 0x2010,
+ },
+ {
+ .var00 = 1,
+ .var01_0 = 12,
+ .var01_4 = 2,
+ .var02 = 2,
+ .var03 = 20,
+ .var04 = 13,
+ .var05 = 6,
+ .var06 = 6,
+ .var08 = 0x1000,
+ .var0C = 0x1000,
+ .var10 = 0x2002,
+ },
+ {
+ .var00 = 10,
+ .var01_0 = 12,
+ .var01_4 = 3,
+ .var02 = 2,
+ .var03 = 23,
+ .var04 = 13,
+ .var05 = 6,
+ .var06 = 6,
+ .var08 = 0x2000,
+ .var0C = 0x2000,
+ .var10 = 0x2400,
+ },
+ {
+ .var00 = 7,
+ .var01_0 = 12,
+ .var01_4 = 4,
+ .var02 = 2,
+ .var03 = 26,
+ .var04 = 13,
+ .var05 = 6,
+ .var06 = 6,
+ .var08 = 0x4000,
+ .var0C = 0x4000,
+ .var10 = 0x2080,
+ },
+ {
+ .var00 = 18,
+ .var01_0 = 3,
+ .var01_4 = 0,
+ .var02 = 3,
+ .var03 = 14,
+ .var04 = 16,
+ .var05 = 6,
+ .var06 = 18,
+ .var08 = 0x8000,
+ .var0C = 0xF8000,
+ .var10 = 0x924,
+ },
+ {
+ .var00 = 8,
+ .var01_0 = 12,
+ .var01_4 = 1,
+ .var02 = 3,
+ .var03 = 17,
+ .var04 = 16,
+ .var05 = 9,
+ .var06 = 9,
+ .var08 = 0x10000,
+ .var0C = 0x10000,
+ .var10 = 0x2100,
+ },
+ {
+ .var00 = 5,
+ .var01_0 = 12,
+ .var01_4 = 2,
+ .var02 = 3,
+ .var03 = 20,
+ .var04 = 16,
+ .var05 = 9,
+ .var06 = 9,
+ .var08 = 0x20000,
+ .var0C = 0x20000,
+ .var10 = 0x2020,
+ },
+ {
+ .var00 = 2,
+ .var01_0 = 12,
+ .var01_4 = 3,
+ .var02 = 3,
+ .var03 = 23,
+ .var04 = 16,
+ .var05 = 9,
+ .var06 = 9,
+ .var08 = 0x40000,
+ .var0C = 0x40000,
+ .var10 = 0x2004,
+ },
+ {
+ .var00 = 11,
+ .var01_0 = 12,
+ .var01_4 = 4,
+ .var02 = 3,
+ .var03 = 26,
+ .var04 = 16,
+ .var05 = 9,
+ .var06 = 9,
+ .var08 = 0x80000,
+ .var0C = 0x80000,
+ .var10 = 0x2800,
+ },
+};
+
+static const struct StructgUnknown_083F8D90 gUnknown_085B62E4[] =
+{
+ {
+ .var00 = 0,
+ .var01 = 1,
+ .var02 = 6,
+ .var04 = 0x40,
+ },
+ {
+ .var00 = 1,
+ .var01 = 3,
+ .var02 = 12,
+ .var04 = 0x1000,
+ },
+ {
+ .var00 = 2,
+ .var01 = 5,
+ .var02 = 18,
+ .var04 = 0x40000,
+ },
+ {
+ .var00 = 3,
+ .var01 = 7,
+ .var02 = 9,
+ .var04 = 0x200,
+ },
+ {
+ .var00 = 4,
+ .var01 = 9,
+ .var02 = 11,
+ .var04 = 0x800,
+ },
+ {
+ .var00 = 5,
+ .var01 = 11,
+ .var02 = 17,
+ .var04 = 0x20000,
+ },
+ {
+ .var00 = 6,
+ .var01 = 13,
+ .var02 = 8,
+ .var04 = 0x100,
+ },
+ {
+ .var00 = 7,
+ .var01 = 15,
+ .var02 = 14,
+ .var04 = 0x4000,
+ },
+ {
+ .var00 = 8,
+ .var01 = 17,
+ .var02 = 16,
+ .var04 = 0x10000,
+ },
+ {
+ .var00 = 9,
+ .var01 = 19,
+ .var02 = 7,
+ .var04 = 0x80,
+ },
+ {
+ .var00 = 10,
+ .var01 = 21,
+ .var02 = 13,
+ .var04 = 0x2000,
+ },
+ {
+ .var00 = 11,
+ .var01 = 23,
+ .var02 = 19,
+ .var04 = 0x80000,
+ },
+};
+static const u8 gUnknown_085B6344[] = {1, 3, 1, 6};
+static const struct StructgUnknown_083F8DF4 gUnknown_085B6348[] =
+{
+ {
+ .var00 = 1,
+ .var01 = 60,
+ .var02 = 30,
+ .var03 = 1,
+ .var04 = 1,
+ .var08 = 45,
+ .var0A = 30,
+ .var0C = 1,
+ .var10 = 75,
+ .var12 = 27,
+ .var14 = 24,
+ .var18 = 10,
+ .var1A = 360,
+ .var1C = -0.5f
+ },
+ {
+ .var00 = 3,
+ .var01 = 30,
+ .var02 = 15,
+ .var03 = 1,
+ .var04 = 0,
+ .var08 = 75,
+ .var0A = 60,
+ .var0C = 2,
+ .var10 = 0,
+ .var12 = 54,
+ .var14 = 48,
+ .var18 = 10,
+ .var1A = 270,
+ .var1C = -1.0f
+ }
+};
+
+static const struct UnkStruct1 gUnknown_085B6388[] =
+{
+ {
+ .var00 = 0x8000,
+ .var02 = 0x0005,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x000A,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x0015,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x0055,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x005A,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x0065,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x0075,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x007A,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x0085,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x0095,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x009A,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x8000,
+ .var02 = 0x00A5,
+ .var04 = 1,
+ .var05 = 1,
+ .var06 = 0xFF,
+ .var07_0 = 8,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x77D6,
+ .var02 = 0x0028,
+ .var04 = 2,
+ .var05 = 10,
+ .var06 = 0xFF,
+ .var07_0 = 14,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+};
+
+static const struct UnkStruct1 gUnknown_085B63F0[] =
+{
+ {
+ .var00 = 0x53FF,
+ .var02 = 0x0101,
+ .var04 = 5,
+ .var05 = 30,
+ .var06 = 0xFF,
+ .var07_0 = 14,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x7FFB,
+ .var02 = 0x0106,
+ .var04 = 5,
+ .var05 = 30,
+ .var06 = 0xFF,
+ .var07_0 = 14,
+ .var07_5 = 2,
+ .var07_7 = 0
+ },
+ {
+ .var00 = 0x7F7F,
+ .var02 = 0x010B,
+ .var04 = 5,
+ .var05 = 30,
+ .var06 = 0xFF,
+ .var07_0 = 14,
+ .var07_5 = 2,
+ .var07_7 = 0
+ }
+};
+
+static const struct YesNoFuncTable gUnknown_085B6408 =
+{
+ sub_8142918,
+ sub_814297C
+};
+
+static const struct YesNoFuncTable gUnknown_085B6410 =
+{
+ sub_8140968,
+ sub_8140994
+};
+
+static void sub_8140238(void)
+{
+ RunTasks();
+ AnimateSprites();
+ BuildOamBuffer();
+ if (gUnknown_0203AB88->varB8.var00)
+ task_tutorial_controls_fadein(&gUnknown_0203AB88->varB8);
+}
+
+static void sub_8140264(void)
+{
+ LoadOam();
+ ProcessSpriteCopyRequests();
+ TransferPlttBuffer();
+ sub_8142814();
+ SetGpuReg(REG_OFFSET_BG1HOFS, 0x200 - gUnknown_0203AB88->var26);
+ if (gUnknown_0203AB88->var01)
+ SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0203AB88->var34);
+ if (gUnknown_0203AB88->var2A != 0)
+ {
+ DmaCopy16(3, &gUnknown_0203AB88->tilemapBuffers[2][0xE0], (void *)BG_SCREEN_ADDR(4) + 0x1C0, 0x340);
+ gUnknown_0203AB88->var2A = 0;
+ }
+ switch (gUnknown_0203AB88->var28)
+ {
+ case 1:
+ SetBgAttribute(0, BG_ATTR_CHARBASEINDEX, 0);
+ ShowBg(0);
+ DmaCopy16(3, &gUnknown_0203AB88->tilemapBuffers[0][0xE0], (void *)BG_SCREEN_ADDR(31) + 0x1C0, 0x340);
+ gUnknown_0203AB88->var28 = 2;
+ break;
+ case 2:
+ DmaCopy16(3, &gUnknown_0203AB88->tilemapBuffers[0][0xE0], (void *)BG_SCREEN_ADDR(31) + 0x1C0, 0x340);
+ break;
+ case 0xFF:
+ SetBgAttribute(0, BG_ATTR_CHARBASEINDEX, 2);
+ ShowBg(0);
+ DmaFill16(3, 0, (void *)BG_SCREEN_ADDR(31) + 0x1C0, 0x340);
+ gUnknown_0203AB88->var28 = 0;
+ case 0:
+ break;
+ }
+}
+
+static void sub_8140388(void)
+{
+ u32 size = 0;
+
+ gUnknown_0203AB88 = AllocZeroed(sizeof(*gUnknown_0203AB88));
+ ResetBgsAndClearDma3BusyFlags(0);
+ InitBgsFromTemplates(1, gUnknown_085B6140, ARRAY_COUNT(gUnknown_085B6140));
+ SetBgTilemapBuffer(0, gUnknown_0203AB88->tilemapBuffers[0]);
+ SetBgTilemapBuffer(1, gUnknown_0203AB88->tilemapBuffers[2]);
+ SetBgTilemapBuffer(2, gUnknown_0203AB88->tilemapBuffers[6]);
+ InitWindows(gUnknown_085B614C);
+ sub_8197200();
+ gUnknown_0203AB8C = 0;
+ gUnknown_0203AB88->unk_397C = malloc_and_decompress(gUnknown_085B5DFC, &size);
+}
+
+static void sub_8140418(void)
+{
+ FREE_AND_SET_NULL(gUnknown_0203AB88->unk_397C);
+ FreeAllWindowBuffers();
+ UnsetBgTilemapBuffer(0);
+ UnsetBgTilemapBuffer(1);
+ UnsetBgTilemapBuffer(2);
+ ResetBgsAndClearDma3BusyFlags(0);
+ memset(gUnknown_0203AB88, 0, sizeof(*gUnknown_0203AB88));
+ FREE_AND_SET_NULL(gUnknown_0203AB88);
+}
+
+static void sub_8140470(void)
+{
+ u8 i;
+ u16 arr[3] = {RGB(24, 4, 10), RGB(10, 19, 6), RGB(24, 4, 10)}; // the third is never used ?
+
+ gUnknown_0203AB88->var04_0 = (gSpecialVar_0x8004 & 1);
+
+ if (gSpecialVar_0x8004 & 0x80)
+ gUnknown_0203AB88->var04_7 = 1;
+
+ gUnknown_0203AB88->var22 = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var03;
+ gUnknown_0203AB88->var23 = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var04;
+ gUnknown_0203AB88->var19 = gUnknown_085B6344[gUnknown_0203AB88->var04_0 + gUnknown_0203AB88->var04_7 * 2];
+ gUnknown_0203AB88->var1A_4 = 1;
+
+ if (gUnknown_0203AB88->var19 == 1)
+ gPlttBufferUnfaded[0] = gPlttBufferUnfaded[0x51] = gPlttBufferFaded[0] = gPlttBufferFaded[0x51] = arr[0];
+ else
+ gPlttBufferUnfaded[0] = gPlttBufferUnfaded[0x51] = gPlttBufferFaded[0] = gPlttBufferFaded[0x51] = arr[1];
+
+ sub_8151678(&gUnknown_0203AB88->varB8);
+
+ for (i = 0; i < 13; i++)
+ {
+ sub_815168C(&gUnknown_0203AB88->varB8, i, &gUnknown_085B6388[i]);
+ }
+
+ for (i = 0; i < PARTY_SIZE; i++)
+ {
+ switch (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2))
+ {
+ case SPECIES_SHROOMISH:
+ gUnknown_0203AB88->var02 |= 0x1;
+ break;
+ case SPECIES_TAILLOW:
+ gUnknown_0203AB88->var02 |= 0x2;
+ break;
+ }
+ }
+ RtcCalcLocalTime();
+}
+
+static void sub_81405CC(void)
+{
+ u8 taskId;
+
+ switch (gMain.state)
+ {
+ case 0:
+ SetVBlankCallback(NULL);
+ ScanlineEffect_Stop();
+ SetVBlankHBlankCallbacksToNull();
+ ResetVramOamAndBgCntRegs();
+ ResetAllBgsCoordinates();
+ break;
+ case 1:
+ sub_8140388();
+ DeactivateAllTextPrinters();
+ SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_NONE |
+ BLDCNT_TGT2_BG2 |
+ BLDCNT_TGT2_BD);
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(10, 6));
+ break;
+ case 2:
+ ResetPaletteFade();
+ ResetSpriteData();
+ ResetTasks();
+ reset_temp_tile_data_buffers();
+ break;
+ case 3:
+ LoadPalette(&gUnknown_085B5BFC, 0, 0x1C0);
+ decompress_and_copy_tile_data_to_vram(1, gRouletteMenuTiles, 0, 0, 0);
+ decompress_and_copy_tile_data_to_vram(2, gRouletteWheelTiles, 0, 0, 0);
+ break;
+ case 4:
+ if (free_temp_tile_data_buffers_if_possible())
+ return;
+
+ sub_8140470();
+ CopyToBgTilemapBuffer(2, gUnknown_085B5FA0, 0, 0);
+ break;
+ case 5:
+ sub_8142C0C(0);
+ sub_81439C8();
+ sub_814391C();
+ sub_8143314();
+ sub_8142CD0();
+ sub_8142F7C();
+ sub_81431E4();
+ break;
+ case 6:
+ AnimateSprites();
+ BuildOamBuffer();
+ sub_8143514(GetCoins());
+ sub_814372C(6);
+ sub_81436D0(0);
+ sub_81424FC(0);
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5B89, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ gSpriteCoordOffsetX = -60;
+ gSpriteCoordOffsetY = 0;
+ break;
+ case 7:
+ SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 |
+ DISPCNT_OBJ_1D_MAP |
+ DISPCNT_OBJ_ON);
+ CopyBgTilemapBufferToVram(1);
+ CopyBgTilemapBufferToVram(2);
+ ShowBg(0);
+ ShowBg(1);
+ ShowBg(2);
+ break;
+ case 8:
+ EnableInterrupts(INTR_FLAG_VBLANK);
+ SetVBlankCallback(sub_8140264);
+ BeginHardwarePaletteFade(0xFF, 0, 16, 0, 1);
+ taskId = gUnknown_0203AB88->varA4 = CreateTask(sub_81408A8, 0);
+ gTasks[taskId].data[6] = 6;
+ gTasks[taskId].data[13] = GetCoins();
+ sub_80EDE84(GetCoins());
+ gUnknown_0203AB88->varA5 = CreateTask(sub_8140814, 1);
+ SetMainCallback2(sub_8140238);
+ return;
+ }
+ gMain.state++;
+}
+
+static void sub_8140814(u8 unused)
+{
+ s16 sin;
+ s16 cos;
+
+ if (gUnknown_0203AB88->var21++ == gUnknown_0203AB88->var23)
+ {
+ gUnknown_0203AB88->var21 = 0;
+ if ((gUnknown_0203AB88->var24 -= gUnknown_0203AB88->var22) < 0)
+ gUnknown_0203AB88->var24 = 360 - gUnknown_0203AB88->var22;
+ }
+ sin = Sin2(gUnknown_0203AB88->var24);
+ cos = Cos2(gUnknown_0203AB88->var24);
+ sin = sin / 16;
+ gUnknown_0203AB88->var2C.a = gUnknown_0203AB88->var2C.d = cos / 16;
+ gUnknown_0203AB88->var2C.b = sin;
+ gUnknown_0203AB88->var2C.c = -sin;
+}
+
+static void sub_81408A8(u8 taskId)
+{
+ if (UpdatePaletteFade() == 0)
+ {
+ SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_NONE |
+ BLDCNT_TGT2_BG2 |
+ BLDCNT_TGT2_BD);
+ SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 8));
+ gTasks[taskId].data[6] = 0;
+ sub_8141FF4(taskId);
+ sub_8142070();
+ sub_8143A40();
+ sub_81424FC(0);
+ sub_814372C(6);
+ sub_8141F7C(taskId, sub_8140968, 0xFFFF, 0x3);
+ }
+}
+
+static void sub_8140914(u8 taskId)
+{
+ DisplayYesNoMenu();
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, 0);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C13, 0, 1, TEXT_SPEED_FF, 0);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ DoYesNoFuncWithChoice(taskId, &gUnknown_085B6410);
+}
+
+static void sub_8140968(u8 taskId)
+{
+ sub_819746C(0, TRUE);
+ gTasks[taskId].func = sub_8140BD0;
+}
+
+static void sub_8140994(u8 taskId)
+{
+ DestroyTask(gUnknown_0203AB88->varA5);
+ sub_8141DE4(taskId);
+}
+
+static void sub_81409B8(u8 r0)
+{
+ u8 temp0, temp1;
+ switch (r0)
+ {
+ case 0:
+ sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13);
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ temp0 = (r0 * 3 + 14);
+ sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13);
+ sub_8152058(&gUnknown_0203AB88->tilemapBuffers[0][0], &gUnknown_0203AB88->unk_397C[281], temp0, 7, 3, 13);
+ break;
+ case 0x5:
+ case 0xA:
+ case 0xF:
+ temp1 = ((r0 - 1) / 5 * 3 + 10);
+ sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13);
+ sub_8152058(&gUnknown_0203AB88->tilemapBuffers[0][0], &gUnknown_0203AB88->unk_397C[320], 14, temp1, 16, 3);
+ break;
+ default:
+ temp0 = ((r0 % 5) * 3 + 14);
+ temp1 = ((r0 - 1) / 5 * 3 + 7);
+ sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13);
+ sub_8152058(&gUnknown_0203AB88->tilemapBuffers[0][0], &gUnknown_0203AB88->unk_397C[272], temp0, temp1, 3, 3);
+ break;
+ }
+}
+
+static void sub_8140B64(u8 taskId)
+{
+ sub_81436D0(gTasks[taskId].data[4]);
+ sub_81409B8(gTasks[taskId].data[4]);
+}
+
+static void sub_8140B8C(u8 taskId)
+{
+ gUnknown_0203AB88->var28 = 1;
+ sub_81409B8(gTasks[taskId].data[4]);
+ gUnknown_0203AB88->var23 = 2;
+ gUnknown_0203AB88->var21 = 0;
+ gTasks[taskId].func = sub_8141040;
+}
+
+static void sub_8140BD0(u8 taskId)
+{
+ s16 i;
+
+ if (gUnknown_0203AB88->var08 & 0x20)
+ {
+ for (i = 11; i < 14; i++)
+ {
+ if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[i].var08) == 0)
+ break;
+ }
+ }
+ else
+ {
+ for (i = 6; i < 10; i++)
+ {
+ if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[i].var08) == 0)
+ break;
+ }
+ }
+ gTasks[taskId].data[4] = i;
+ sub_8141FF4(taskId);
+ sub_81424FC(gTasks[taskId].data[4]);
+ sub_81436D0(gTasks[taskId].data[4]);
+ sub_8142284(gTasks[taskId].data[4]);
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].func = sub_8140B8C;
+}
+
+static u8 sub_8140CA8(s16 *r0, u8 r1)
+{
+ s8 temp1 = 0;
+ s8 temp = 0;
+ s8 arr[4] = {-5, 5, -1, 1};
+ s8 t = *r0;
+
+ switch (r1)
+ {
+ case 0:
+ case 1:
+ temp1 = (*r0 % 5);
+ temp = temp1 + 15;
+ if (temp1 == 0)
+ temp1 = 5;
+ break;
+ case 2:
+ case 3:
+ temp1 = (*r0 / 5) * 5;
+ temp = temp1 + 4;
+ if (temp1 == 0)
+ temp1 = 1;
+ break;
+ }
+
+ *r0 += arr[r1];
+
+ if (*r0 < temp1)
+ *r0 = temp;
+
+ if (*r0 > temp)
+ *r0 = temp1;
+
+ if (*r0 != t)
+ return TRUE;
+
+ return FALSE;
+}
+
+static void sub_8140D6C(u8 r0)
+{
+ u8 z = 0;
+ bool8 var0 = FALSE;
+ if (!(gMain.newKeys & DPAD_UP) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 0)))
+ if (!(gMain.newKeys & DPAD_DOWN) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 1)))
+ if (!(gMain.newKeys & DPAD_LEFT) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 2)))
+ if (!(gMain.newKeys & DPAD_RIGHT) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 3)))
+ if (var0)
+ {
+ u8 i;
+ sub_81424FC(gTasks[r0].data[4]);
+ sub_8140B64(r0);
+ gTasks[r0].data[1] = z;
+ PlaySE(SE_SELECT);
+ sub_8151A9C(&gUnknown_0203AB88->varB8, 0xFFFF);
+ gUnknown_0203AB88->varB8.var04[13].var00_7 = gUnknown_0203AB88->varB8.var04[14].var00_7 = gUnknown_0203AB88->varB8.var04[15].var00_7 = 0;
+ sub_8142284(gTasks[r0].data[4]);
+ for (i = 0; i < 4; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 41]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[i + 41]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[i + 41]].anims)->type;
+ }
+ if ((u16)(gTasks[r0].data[4] - 1) < 4 && !(gUnknown_0203AB88->var08 & gUnknown_085B6154[gTasks[r0].data[4]].var08) )
+ {
+ z = gTasks[r0].data[4] - 1;
+ gSprites[gUnknown_0203AB88->var3C[z + 41]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[z + 41]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[z + 41]].anims + 1)->type;
+ }
+ }
+}
+
+static void sub_8140F6C(u8 r0)
+{
+ sub_80EECA4();
+ gUnknown_0203AB88->var28 = 0xFF;
+ if (gUnknown_0203AB88->var19 == 1)
+ gUnknown_0203AB88->var23 = 1;
+ else
+ gUnknown_0203AB88->var23 = 0;
+ gUnknown_0203AB88->var21 = 0;
+ gTasks[r0].data[1] = 32;
+ gTasks[r0].func = sub_81410FC;
+}
+
+static void sub_8140FC4(u8 taskId)
+{
+ gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0] = gTasks[taskId].data[4];
+ gTasks[taskId].data[2] = sub_8142758(gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]);
+ sub_81436D0(gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]);
+ if ((gTasks[taskId].data[13] -= gUnknown_0203AB88->var19) < 0)
+ gTasks[taskId].data[13] = 0;
+ sub_8143514(gTasks[taskId].data[13]);
+ gTasks[taskId].func = sub_8140F6C;
+}
+
+static void sub_8141040(u8 taskId)
+{
+ sub_8140D6C(taskId);
+
+ switch (gTasks[taskId].data[1])
+ {
+ case 0:
+ sub_81409B8(gTasks[taskId].data[4]);
+ gTasks[taskId].data[1]++;
+ break;
+ case 30:
+ sub_81409B8(0);
+ gTasks[taskId].data[1]++;
+ break;
+ case 59:
+ gTasks[taskId].data[1] = 0;
+ break;
+ default:
+ gTasks[taskId].data[1]++;
+ }
+
+ if (gMain.newKeys & A_BUTTON)
+ {
+ if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[gTasks[taskId].data[4]].var08))
+ PlaySE(SE_BOO);
+ else
+ {
+ m4aSongNumStart(SE_REGI);
+ gTasks[taskId].func = sub_8140FC4;
+ }
+ }
+}
+
+static void sub_81410FC(u8 taskId)
+{
+ if (gTasks[taskId].data[1]-- > 0)
+ {
+ if (gTasks[taskId].data[1] > 2)
+ gSpriteCoordOffsetX += 2;
+ if ((gUnknown_0203AB88->var26 += 4) == 104)
+ gSprites[gUnknown_0203AB88->var3C[25]].callback = &SpriteCallbackDummy;
+ }
+ else
+ {
+ sub_8142E70(1, -1);
+ sub_8143038(1, -1);
+ gTasks[taskId].func = sub_8141344;
+ gTasks[taskId].data[1] = 0;
+ }
+}
+
+static u8 sub_814118C(u16 r0, u16 r1)
+{
+ switch (gUnknown_0203AB88->var02)
+ {
+ case 1: // SHROOMISH
+ case 2: // TAILLOW
+ // one of the two is in party
+ if (gLocalTime.hours > 3 && gLocalTime.hours < 10)
+ {
+ if (r0 < 12 || (r1 & 1))
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ else if (!(r1 & 0x3))
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2;
+ }
+ else
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02;
+ }
+ break;
+ case 3:
+ // both are in party
+ if (gLocalTime.hours > 3 && gLocalTime.hours < 11)
+ {
+ if (r0 < 6 || (r1 & 1))
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ else if ((r1 & 1) && r0 > 6)
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 4;
+ }
+ else
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2;
+ }
+ break;
+ case 0:
+ default:
+ // neither is in party
+ if (gLocalTime.hours > 3 && gLocalTime.hours < 10)
+ {
+ if (!(r1 & 3))
+ {
+ return 1;
+ }
+ else
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2;
+ }
+ }
+ else if (!(r1 & 3))
+ {
+ if (r0 > 12)
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2;
+ }
+ else
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02;
+ }
+ }
+ else if (r1 & 0x8000)
+ {
+ if (r0 > 12)
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02;
+ }
+ else
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01;
+ }
+ }
+ else
+ {
+ return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01 * 2;
+ }
+ break;
+ }
+}
+
+// r7/r8 swap
+#ifdef NONMATCHING
+static void sub_8141344(u8 taskId)
+{
+ u8 randf;
+ s8 randfinal;
+ s8 r5;
+ u16 g = 0;
+ u16 rand;
+ u16 randmod;
+ u16 angles[4] = {0, 180, 90, 270}; // angles in 90 degree steps
+
+ rand = Random();
+ randmod = rand % 100;
+ gUnknown_0203AB88->var7C = gTasks[taskId].data[6];
+ gUnknown_0203AB88->var7D = gUnknown_0203AB88->var7E = gUnknown_0203AB88->var7F = g;
+ randf = sub_814118C(gTasks[taskId].data[8], rand);
+ randfinal = (rand % randf) - (randf / 2);
+
+ if (gLocalTime.hours < 13)
+ r5 = 0;
+ else
+ r5 = 1;
+
+ if (randmod < 80)
+ r5 *= 2;
+ else
+ r5 = (1 - r5) * 2;
+
+ gUnknown_0203AB88->var80 = g = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var1A + randfinal;
+
+ g = S16TOPOSFLOAT(g) / 5.0f;
+ gUnknown_0203AB88->var82 = g * 3;
+ gUnknown_0203AB88->var84 = g;
+ gUnknown_0203AB88->var86 = g;
+
+ gUnknown_0203AB88->var88 = S16TOPOSFLOAT(angles[(rand & 1) + r5]);
+ gUnknown_0203AB88->var8C = S16TOPOSFLOAT(gUnknown_085B6348[gUnknown_0203AB88->var04_0].var18);
+ gUnknown_0203AB88->var90 = ((gUnknown_0203AB88->var8C * 0.5f) - gUnknown_0203AB88->var8C) / S16TOPOSFLOAT(gUnknown_0203AB88->var82);
+ gUnknown_0203AB88->var94 = 68.0f;
+ gUnknown_0203AB88->var9C = 0.0f;
+ gUnknown_0203AB88->var98 = -(8.0f / S16TOPOSFLOAT(gUnknown_0203AB88->var82));
+ gUnknown_0203AB88->varA0 = 36.0f;
+ gTasks[taskId].func = sub_814155C;
+}
+#else
+static const u16 gUnknown_085B6422[4] = {0, 180, 90, 270};
+NAKED
+static void sub_8141344(u8 taskId)
+{
+ asm_unified(" push {r4-r7,lr}\n\
+ mov r7, r10\n\
+ mov r6, r9\n\
+ mov r5, r8\n\
+ push {r5-r7}\n\
+ sub sp, 0x8\n\
+ lsls r0, 24\n\
+ lsrs r0, 24\n\
+ mov r10, r0\n\
+ movs r4, 0\n\
+ ldr r1, =gUnknown_085B6422\n\
+ mov r0, sp\n\
+ movs r2, 0x8\n\
+ bl memcpy\n\
+ bl Random\n\
+ lsls r0, 16\n\
+ lsrs r7, r0, 16\n\
+ adds r0, r7, 0\n\
+ movs r1, 0x64\n\
+ bl __umodsi3\n\
+ lsls r0, 16\n\
+ lsrs r6, r0, 16\n\
+ ldr r3, =gUnknown_0203AB88\n\
+ ldr r0, [r3]\n\
+ ldr r2, =gTasks\n\
+ mov r5, r10\n\
+ lsls r1, r5, 2\n\
+ add r1, r10\n\
+ lsls r1, 3\n\
+ adds r1, r2\n\
+ ldrh r2, [r1, 0x14]\n\
+ adds r0, 0x7C\n\
+ strb r2, [r0]\n\
+ ldr r0, [r3]\n\
+ adds r2, r0, 0\n\
+ adds r2, 0x7F\n\
+ strb r4, [r2]\n\
+ subs r2, 0x1\n\
+ strb r4, [r2]\n\
+ adds r0, 0x7D\n\
+ strb r4, [r0]\n\
+ ldrh r0, [r1, 0x18]\n\
+ adds r1, r7, 0\n\
+ bl sub_814118C\n\
+ adds r4, r0, 0\n\
+ lsls r4, 24\n\
+ lsrs r1, r4, 24\n\
+ adds r0, r7, 0\n\
+ bl __modsi3\n\
+ lsrs r4, 25\n\
+ subs r0, r4\n\
+ lsls r0, 24\n\
+ lsrs r4, r0, 24\n\
+ ldr r0, =gLocalTime\n\
+ ldrb r0, [r0, 0x2]\n\
+ lsls r0, 24\n\
+ asrs r0, 24\n\
+ movs r5, 0x1\n\
+ cmp r0, 0xC\n\
+ bgt _081413C8\n\
+ movs r5, 0\n\
+_081413C8:\n\
+ cmp r6, 0x4F\n\
+ bhi _081413E0\n\
+ lsls r0, r5, 25\n\
+ b _081413EA\n\
+ .pool\n\
+_081413E0:\n\
+ lsls r1, r5, 24\n\
+ asrs r1, 24\n\
+ movs r0, 0x1\n\
+ subs r0, r1\n\
+ lsls r0, 25\n\
+_081413EA:\n\
+ lsrs r5, r0, 24\n\
+ ldr r0, _08141530 @ =gUnknown_0203AB88\n\
+ ldr r6, [r0]\n\
+ ldrb r0, [r6, 0x4]\n\
+ lsls r0, 30\n\
+ lsrs r0, 25\n\
+ ldr r1, _08141534 @ =gUnknown_085B6348\n\
+ adds r0, r1\n\
+ lsls r4, 24\n\
+ asrs r4, 24\n\
+ ldrh r0, [r0, 0x1A]\n\
+ adds r4, r0\n\
+ adds r0, r6, 0\n\
+ adds r0, 0x80\n\
+ strh r4, [r0]\n\
+ lsls r4, 16\n\
+ asrs r4, 16\n\
+ adds r0, r4, 0\n\
+ bl __floatsisf\n\
+ cmp r4, 0\n\
+ bge _0814141C\n\
+ ldr r1, _08141538 @ =0x47800000\n\
+ bl __addsf3\n\
+_0814141C:\n\
+ ldr r1, _0814153C @ =0x40A00000\n\
+ bl __divsf3\n\
+ bl __fixunssfsi\n\
+ lsls r0, 16\n\
+ lsrs r4, r0, 16\n\
+ lsls r0, r4, 1\n\
+ adds r0, r4\n\
+ movs r2, 0x82\n\
+ adds r2, r6\n\
+ mov r8, r2\n\
+ strh r0, [r2]\n\
+ adds r0, r6, 0\n\
+ adds r0, 0x84\n\
+ strh r4, [r0]\n\
+ adds r0, 0x2\n\
+ strh r4, [r0]\n\
+ movs r0, 0x88\n\
+ adds r0, r6\n\
+ mov r9, r0\n\
+ movs r0, 0x1\n\
+ ands r0, r7\n\
+ lsls r1, r5, 24\n\
+ asrs r1, 24\n\
+ adds r0, r1\n\
+ lsls r0, 1\n\
+ add r0, sp\n\
+ movs r1, 0\n\
+ ldrsh r4, [r0, r1]\n\
+ adds r0, r4, 0\n\
+ bl __floatsisf\n\
+ cmp r4, 0\n\
+ bge _08141468\n\
+ ldr r1, _08141538 @ =0x47800000\n\
+ bl __addsf3\n\
+_08141468:\n\
+ mov r2, r9\n\
+ str r0, [r2]\n\
+ adds r7, r6, 0\n\
+ adds r7, 0x8C\n\
+ ldrb r0, [r6, 0x4]\n\
+ lsls r0, 30\n\
+ lsrs r0, 25\n\
+ ldr r5, _08141534 @ =gUnknown_085B6348\n\
+ adds r0, r5\n\
+ movs r1, 0x18\n\
+ ldrsh r4, [r0, r1]\n\
+ adds r0, r4, 0\n\
+ bl __floatsisf\n\
+ adds r5, r0, 0\n\
+ cmp r4, 0\n\
+ bge _08141492\n\
+ ldr r1, _08141538 @ =0x47800000\n\
+ bl __addsf3\n\
+ adds r5, r0, 0\n\
+_08141492:\n\
+ str r5, [r7]\n\
+ adds r7, r6, 0\n\
+ adds r7, 0x90\n\
+ ldr r1, _08141540 @ =0x3F000000\n\
+ adds r0, r5, 0\n\
+ bl __mulsf3\n\
+ adds r1, r5, 0\n\
+ bl __subsf3\n\
+ adds r5, r0, 0\n\
+ mov r2, r8\n\
+ movs r0, 0\n\
+ ldrsh r4, [r2, r0]\n\
+ adds r0, r4, 0\n\
+ bl __floatsisf\n\
+ adds r2, r0, 0\n\
+ cmp r4, 0\n\
+ bge _081414C2\n\
+ ldr r1, _08141538 @ =0x47800000\n\
+ bl __addsf3\n\
+ adds r2, r0, 0\n\
+_081414C2:\n\
+ adds r0, r5, 0\n\
+ adds r1, r2, 0\n\
+ bl __divsf3\n\
+ str r0, [r7]\n\
+ adds r1, r6, 0\n\
+ adds r1, 0x94\n\
+ ldr r0, _08141544 @ =0x42880000\n\
+ str r0, [r1]\n\
+ adds r1, 0x8\n\
+ ldr r0, _08141548 @ =0x00000000\n\
+ str r0, [r1]\n\
+ adds r5, r6, 0\n\
+ adds r5, 0x98\n\
+ mov r1, r8\n\
+ movs r2, 0\n\
+ ldrsh r4, [r1, r2]\n\
+ adds r0, r4, 0\n\
+ bl __floatsisf\n\
+ adds r2, r0, 0\n\
+ cmp r4, 0\n\
+ bge _081414F8\n\
+ ldr r1, _08141538 @ =0x47800000\n\
+ bl __addsf3\n\
+ adds r2, r0, 0\n\
+_081414F8:\n\
+ ldr r0, _0814154C @ =0x41000000\n\
+ adds r1, r2, 0\n\
+ bl __divsf3\n\
+ bl __negsf2\n\
+ str r0, [r5]\n\
+ adds r1, r6, 0\n\
+ adds r1, 0xA0\n\
+ ldr r0, _08141550 @ =0x42100000\n\
+ str r0, [r1]\n\
+ ldr r1, _08141554 @ =gTasks\n\
+ mov r5, r10\n\
+ lsls r0, r5, 2\n\
+ add r0, r10\n\
+ lsls r0, 3\n\
+ adds r0, r1\n\
+ ldr r1, _08141558 @ =sub_814155C\n\
+ str r1, [r0]\n\
+ add sp, 0x8\n\
+ pop {r3-r5}\n\
+ mov r8, r3\n\
+ mov r9, r4\n\
+ mov r10, r5\n\
+ pop {r4-r7}\n\
+ pop {r0}\n\
+ bx r0\n\
+ .align 2, 0\n\
+_08141530:\n\
+ .4byte gUnknown_0203AB88\n\
+_08141534:\n\
+ .4byte gUnknown_085B6348\n\
+_08141538:\n\
+ .4byte 0x47800000\n\
+_0814153C:\n\
+ .4byte 0x40A00000\n\
+_08141540:\n\
+ .4byte 0x3F000000\n\
+_08141544:\n\
+ .4byte 0x42880000\n\
+_08141548:\n\
+ .4byte 0x00000000\n\
+_0814154C:\n\
+ .4byte 0x41000000\n\
+_08141550:\n\
+ .4byte 0x42100000\n\
+_08141554:\n\
+ .4byte gTasks\n\
+_08141558:\n\
+ .4byte sub_814155C");
+}
+#endif // NONMATCHING
+
+static void sub_814155C(u8 taskId)
+{
+ u8 index;
+ gUnknown_0203AB88->var03_7 = 1;
+ index = gUnknown_0203AB88->var3C[gUnknown_0203AB88->var7C];
+ gUnknown_0203AB88->var38 = &gSprites[index];
+ gUnknown_0203AB88->var38->callback = sub_81446AC;
+ gTasks[taskId].data[6]++;
+ gTasks[taskId].data[0x8]++;
+ sub_814372C(6 - gTasks[taskId].data[6]);
+ m4aSongNumStart(SE_TAMAKORO);
+ gTasks[taskId].func = sub_81415D4;
+}
+
+static void sub_81415D4(u8 taskId)
+{
+ if (gUnknown_0203AB88->var7D)
+ {
+ if (gUnknown_0203AB88->var03_5)
+ {
+ if (gUnknown_0203AB88->var03_6)
+ {
+ gUnknown_0203AB88->var03_6 = FALSE;
+ gUnknown_0203AB88->var03_5 = FALSE;
+ }
+ }
+ else
+ {
+ if (!gTasks[taskId].data[1])
+ {
+ bool8 temp = sub_81421E8(sub_81420D0(taskId, gUnknown_0203AB88->var7E), gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]);
+ gTasks[taskId].data[5] = temp;
+ if (temp == TRUE)
+ sub_8151A48(&gUnknown_0203AB88->varB8, 0x1000);
+ }
+ if (gTasks[taskId].data[1] <= 60)
+ {
+ if (gMain.newKeys & A_BUTTON)
+ gTasks[taskId].data[1] = 60;
+ gTasks[taskId].data[1]++;
+ }
+ else
+ {
+ sub_81424FC(gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]);
+ sub_8142E70(0, gTasks[taskId].data[12]);
+ sub_8143038(0, gTasks[taskId].data[6] - 1);
+ gTasks[taskId].data[1] = 32;
+ gTasks[taskId].func = sub_81416D4;
+ }
+ }
+ }
+}
+
+static void sub_81416D4(u8 taskId)
+{
+ if (gTasks[taskId].data[1]-- > 0)
+ {
+ if (gTasks[taskId].data[1] > 2)
+ gSpriteCoordOffsetX -= 2;
+ if ((gUnknown_0203AB88->var26 -= 4) == 104)
+ gSprites[gUnknown_0203AB88->var3C[25]].callback = sub_814390C;
+ }
+ else
+ {
+ sub_8143150(gTasks[taskId].data[12]);
+ if (gTasks[taskId].data[5] == 1)
+ gTasks[taskId].data[1] = 121;
+ else
+ gTasks[taskId].data[1] = 61;
+ gTasks[taskId].func = sub_8141778;
+ }
+}
+
+static void sub_8141778(u8 taskId)
+{
+ if (gTasks[taskId].data[1]-- > 1)
+ {
+ switch (gTasks[taskId].data[1] % 16)
+ {
+ case 8:
+ sub_8142E70(0, -1);
+ sub_8143038(0, -1);
+ break;
+ case 0:
+ sub_8142E70(0, gTasks[taskId].data[12]);
+ sub_8143038(0, gTasks[taskId].data[6] - 1);
+ break;
+ }
+ }
+ else
+ {
+ sub_8141F7C(taskId, sub_814189C, 30, 0);
+ }
+}
+
+static void sub_8141800(u8 taskId)
+{
+ switch (gTasks[taskId].data[0x5])
+ {
+ case 1:
+ case 2:
+ if (IsFanfareTaskInactive())
+ {
+ u32 wins = GetGameStat(GAME_STAT_CONSECUTIVE_ROULETTE_WINS);
+ if (wins < ++gTasks[taskId].data[11])
+ SetGameStat(GAME_STAT_CONSECUTIVE_ROULETTE_WINS, gTasks[taskId].data[11]);
+ sub_8141F7C(taskId, sub_8141A18, 0xFFFF, 3);
+ }
+ break;
+ case 0:
+ default:
+ if (!IsSEPlaying())
+ {
+ gTasks[taskId].data[11] = FALSE;
+ sub_8141F7C(taskId, sub_8141AC0, 0xFFFF, 3);
+ }
+ break;
+ }
+}
+
+static void sub_814189C(u8 taskId)
+{
+ switch (gTasks[taskId].data[5])
+ {
+ case 1:
+ case 2:
+ if (gTasks[taskId].data[2] == 12)
+ {
+ PlayFanfare(MUS_ME_B_BIG);
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BD7, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ }
+ else
+ {
+ PlayFanfare(MUS_ME_B_SMALL);
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BCB, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ }
+ break;
+ case 0:
+ default:
+ m4aSongNumStart(SE_HAZURE);
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BE0, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ break;
+ }
+ gTasks[taskId].data[1] = 0;
+ gTasks[taskId].func = sub_8141800;
+}
+
+static void sub_8141984(u8 taskId)
+{
+ s32 r0 = gTasks[taskId].data[7];
+ switch (r0)
+ {
+ case 0:
+ gTasks[taskId].data[13]++;
+ m4aSongNumStart(SE_PIN);
+ sub_8143514(gTasks[taskId].data[13]);
+ if (gTasks[taskId].data[13] >= 9999)
+ {
+ gTasks[taskId].data[1] = r0;
+ }
+ else
+ {
+ gTasks[taskId].data[1]--;
+ gTasks[taskId].data[7]++;
+ }
+ break;
+ case 3:
+ m4aSongNumStop(SE_PIN);
+ gTasks[taskId].data[7] = 0;
+ break;
+ default:
+ gTasks[taskId].data[7]++;
+ break;
+ }
+ if (gTasks[taskId].data[1] == 0)
+ sub_8141F7C(taskId, sub_8141AC0, 0xFFFF, 3);
+}
+
+static void sub_8141A18(u8 taskId)
+{
+ ConvertIntToDecimalStringN(gStringVar1, (gUnknown_0203AB88->var19 * gTasks[taskId].data[2]), STR_CONV_MODE_LEFT_ALIGN, 2);
+ StringExpandPlaceholders(gStringVar4, gUnknown_082A5BEF);
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ gTasks[taskId].data[1] = (gUnknown_0203AB88->var19 * gTasks[taskId].data[2]);
+ gTasks[taskId].data[7] = 0;
+ gTasks[taskId].func = sub_8141984;
+}
+
+static void sub_8141AC0(u8 taskId)
+{
+ sub_8151A9C(&gUnknown_0203AB88->varB8, 0xFFFF);
+ gUnknown_0203AB88->varB8.var04[13].var00_7 = gUnknown_0203AB88->varB8.var04[14].var00_7 = gUnknown_0203AB88->varB8.var04[15].var00_7 = 0;
+ gSprites[gUnknown_0203AB88->var3C[7 + gUnknown_085B6154[gTasks[taskId].data[12]].var00]].invisible = TRUE;
+ gTasks[taskId].func = sub_8141B58;
+}
+
+static void sub_8141B58(u8 taskId)
+{
+ u8 i = 0;
+ gTasks[taskId].data[4] = i;
+ gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0] = 0;
+ sub_81424FC(0);
+ gSprites[gUnknown_0203AB88->var3C[48]].invisible = TRUE;
+ for (i = 0; i < 4; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 41]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[i + 41]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[i + 41]].anims)->type;
+ }
+ if (gTasks[taskId].data[13] >= gUnknown_0203AB88->var19)
+ {
+ if (gTasks[taskId].data[6] == 6)
+ {
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C21, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ sub_8141F7C(taskId, dp01t_12_3_battle_menu, 0xFFFF, 3);
+ }
+ else if (gTasks[taskId].data[13] == 9999)
+ {
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C61, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ sub_8141F7C(taskId, sub_8140914, 0xFFFF, 0x3);
+ }
+ else
+ {
+ gTasks[taskId].func = sub_8140914;
+ }
+ }
+ else
+ {
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C04, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ sub_8141F7C(taskId, sub_8140994, 0x3C, 0x3);
+ }
+}
+
+static void dp01t_12_3_battle_menu(u8 taskId)
+{
+ u8 i = 0;
+
+ gTasks[taskId].data[6] = 0;
+ sub_8141FF4(taskId);
+ sub_8142070();
+ sub_8143A40();
+ sub_81424FC(0);
+ sub_814372C(6);
+
+ for (i = 0; i < 12; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 7]].invisible = FALSE;
+ }
+
+ if (gTasks[taskId].data[13] == 9999)
+ {
+ NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE);
+ AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C61, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(gUnknown_0203AB8C, 3);
+ sub_8141F7C(taskId, sub_8140914, 0xFFFF, 3);
+ }
+ else
+ {
+ gTasks[taskId].func = sub_8140914;
+ }
+}
+
+static void sub_8141DE4(u8 taskId)
+{
+ sub_8151A9C(&gUnknown_0203AB88->varB8, 0xFFFF);
+ sub_8151678(&gUnknown_0203AB88->varB8);
+ SetCoins(gTasks[taskId].data[13]);
+ if (GetCoins() < gUnknown_0203AB88->var19)
+ gSpecialVar_0x8004 = TRUE;
+ else
+ gSpecialVar_0x8004 = FALSE;
+ sub_80EDD78(GetCoins());
+ BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0);
+ gTasks[taskId].func = sub_8141E7C;
+}
+
+static void sub_8141E7C(u8 taskId) // end roulette ?
+{
+ if (UpdatePaletteFade() == 0)
+ {
+ SetVBlankCallback(NULL);
+ gSpriteCoordOffsetX = gSpriteCoordOffsetY = 0;
+ ResetVramOamAndBgCntRegs();
+ ResetAllBgsCoordinates();
+ SetGpuReg(REG_OFFSET_BLDCNT, 0);
+ SetGpuReg(REG_OFFSET_BLDALPHA, 0);
+ SetGpuReg(REG_OFFSET_BLDY, 0);
+ FreeAllSpritePalettes();
+ ResetPaletteFade();
+ ResetSpriteData();
+ sub_8140418();
+ gFieldCallback = sub_80AF168;
+ SetMainCallback2(CB2_ReturnToField);
+ DestroyTask(taskId);
+ }
+}
+
+static void sub_8141EF8(u8 taskId)
+{
+ if (gUnknown_0203AB88->varA8 == 0 || gMain.newKeys & gUnknown_0203AB88->varAA)
+ {
+ gTasks[taskId].func = gUnknown_0203AB88->varAC;
+ if (gUnknown_0203AB88->varAA > 0)
+ PlaySE(SE_SELECT);
+ gUnknown_0203AB88->varAC = NULL;
+ gUnknown_0203AB88->varAA = 0;
+ gUnknown_0203AB88->varA8 = 0;
+ }
+ if (gUnknown_0203AB88->varA8 != 0xFFFF)
+ gUnknown_0203AB88->varA8--;
+}
+
+static void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3)
+{
+ gUnknown_0203AB88->varB4 = gTasks[taskId].func;
+ if (r1 == NULL)
+ r1 = gUnknown_0203AB88->varB4;
+ gUnknown_0203AB88->varAC = r1;
+ gUnknown_0203AB88->varA8 = r2;
+ if (r2 == 0xFFFF && r3 == 0)
+ gUnknown_0203AB88->varAA = 0xFFFF;
+ else
+ gUnknown_0203AB88->varAA = r3;
+ gTasks[taskId].func = sub_8141EF8;
+}
+
+static void sub_8141FF4(u8 taskId)
+{
+ u8 i = 0;
+ gUnknown_0203AB88->var00 = i;
+ gUnknown_0203AB88->var03_7 = 0;
+ gUnknown_0203AB88->var03_5 = 0;
+ gUnknown_0203AB88->var03_6 = 0;
+ gUnknown_0203AB88->var03_0 = 0;
+ for (i = 0; i < 6; i++)
+ {
+ gUnknown_0203AB88->var1B[i] = 0;
+ }
+ gUnknown_0203AB88->var1A_0 = 0;
+ gTasks[taskId].data[1] = 0;
+}
+
+static void sub_8142070(void)
+{
+ u8 i;
+ gUnknown_0203AB88->var08 = 0;
+ for (i = 0; i < 6; i++)
+ {
+ gUnknown_0203AB88->var0C[i] = 0;
+ }
+ for (i = 0; i < 4; i++)
+ {
+ gUnknown_0203AB88->var12[i] = 0;
+ }
+ for (i = 0; i < 3; i++)
+ {
+ gUnknown_0203AB88->var16[i] = 0;
+ }
+ sub_8143038(1, -1);
+}
+
+static u8 sub_81420D0(u8 taskId, u8 r1)
+{
+ u8 i;
+ u8 z;
+ u32 t0[4] = {0x10842, 0x21084, 0x42108, 0x84210};
+ u32 t1[3] = {0x3E0, 0x7C00, 0xF8000};
+
+ if (r1 > 11)
+ return 0;
+
+ gUnknown_0203AB88->var0C[gTasks[taskId].data[6] - 1] = gUnknown_085B62E4[r1].var02;
+ gTasks[taskId].data[12] = gUnknown_085B62E4[r1].var02;
+ gUnknown_0203AB88->var08 |= gUnknown_085B62E4[r1].var04;
+ for (i = 0; i < 4; i++)
+ {
+ if (gUnknown_085B62E4[r1].var04 & t0[i])
+ gUnknown_0203AB88->var12[i]++;
+ if (gUnknown_0203AB88->var12[i] > 2)
+ gUnknown_0203AB88->var08 |= t0[i];
+ }
+ for (z = 0; z < 3; z++)
+ {
+ if (gUnknown_085B62E4[r1].var04 & t1[z])
+ gUnknown_0203AB88->var16[z]++;
+ if (gUnknown_0203AB88->var16[z] > 3)
+ gUnknown_0203AB88->var08 |= t1[z];
+ }
+ return gUnknown_085B62E4[r1].var02;
+}
+
+static bool8 sub_81421E8(u8 r0, u8 r1)
+{
+ u8 t = r0;
+ if (--r0 < 19)
+ {
+ switch (r1)
+ {
+ case 0:
+ return 3;
+ case 1 ... 4:
+ if (t == r1 + 5 || t == r1 + 10 || t == r1 + 15)
+ return TRUE;
+ break;
+ case 5:
+ case 10:
+ case 15:
+ if (t >= (r1 + 1) && t <= (r1 + 4))
+ return TRUE;
+ break;
+ default:
+ if (t == r1)
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static void sub_8142284(u8 r0)
+{
+
+ u16 var0 = 0;
+ u8 var2;
+ u16 var3;
+ u8 i;
+
+ switch (r0)
+ {
+ case 5:
+ case 10:
+ case 15:
+ for (i = (r0 + 1); i < (r0 + 5); i++)
+ {
+ if (!(gUnknown_0203AB88->var08 & gUnknown_085B6154[i].var08))
+ var0 |= gUnknown_085B6154[i].var10;
+ }
+ sub_8151A48(&gUnknown_0203AB88->varB8, var0 &= 0xDFFF);
+ break;
+ default:
+ {
+ struct UnkStruct1 var1[3];
+ memcpy(var1, gUnknown_085B63F0, sizeof(var1));
+ if (r0 > 0 && r0 < 5)
+ var2 = 3;
+ else
+ var2 = 1;
+ var3 = r0 / 5 - 1;
+ switch (r0 % 5)
+ {
+ case 1:
+ var3 = gSprites[gUnknown_0203AB88->var3C[7]].oam.paletteNum * 16;
+ break;
+ case 2:
+ var3 = gSprites[gUnknown_0203AB88->var3C[8]].oam.paletteNum * 16;
+ break;
+ case 3:
+ var3 = gSprites[gUnknown_0203AB88->var3C[9]].oam.paletteNum * 16;
+ break;
+ case 4:
+ var3 = gSprites[gUnknown_0203AB88->var3C[10]].oam.paletteNum * 16;
+ break;
+ }
+ if (var2 == 1)
+ {
+ if (!(gUnknown_0203AB88->var08 & gUnknown_085B6154[r0].var08))
+ {
+ var1[r0 / 5 - 1].var02 += var3;
+ sub_815168C(&gUnknown_0203AB88->varB8, 13, &var1[r0 / 5 - 1]);
+ }
+ else
+ {
+ break;
+ }
+ }
+ else
+ {
+ for (i = 0; i < 3; i++)
+ {
+ u8 var4 = i * 5 + r0 + 5;
+ if (!(gUnknown_0203AB88->var08 & gUnknown_085B6154[var4].var08))
+ {
+ var1[var4 / 5 - 1].var02 += var3;
+ sub_815168C(&gUnknown_0203AB88->varB8, i + 13, &var1[var4 / 5 - 1]);
+ if (var2 == 3)
+ var0 = gUnknown_085B6154[var4].var10;
+ var2--;
+ }
+ }
+ if (var2 != 2)
+ var0 = 0;
+ }
+ sub_8151A48(&gUnknown_0203AB88->varB8, var0 |= gUnknown_085B6154[r0].var10);
+ break;
+ }
+ }
+}
+
+static void sub_81424FC(u8 r0)
+{
+ vu8 i;
+ vu8 z;
+ vu16 var1;
+ vu16 var2;
+ vu8 var0;
+ u8 v[5];
+ u8 l;
+ gUnknown_0203AB88->var2A = 1;
+ sub_8142E70(0, 0);
+ sub_8152058(gUnknown_0203AB88->tilemapBuffers[2], gUnknown_0203AB88->unk_397C, 14, 7, 16, 13);
+ switch (r0)
+ {
+ case 0:
+ return;
+ case 1 ... 4:
+ l = 4;
+ for (i = 0; i < l; i++)
+ {
+ v[i] = i * 5 + r0;
+ }
+ break;
+ case 5:
+ case 10:
+ case 15:
+ l = 5;
+ for (i = 0; i < l; i++)
+ {
+ v[i] = i + r0;
+ }
+ break;
+ default:
+ l = 1;
+ v[0] = r0;
+ }
+ for (i = 0; i < l; i++)
+ {
+ var0 = gUnknown_085B6154[v[i]].var06;
+ var1 = gUnknown_085B6154[v[i]].var03;
+ for (z = 0; z < 3; z++)
+ {
+ var2 = (gUnknown_085B6154[v[i]].var04 + z) * 32;
+ gUnknown_0203AB88->tilemapBuffers[2][var1 + var2 + 0] = gUnknown_0203AB88->unk_397C[(var0 + z) * 3 + 208];
+ gUnknown_0203AB88->tilemapBuffers[2][var1 + var2 + 1] = gUnknown_0203AB88->unk_397C[(var0 + z) * 3 + 209];
+ gUnknown_0203AB88->tilemapBuffers[2][var1 + var2 + 2] = gUnknown_0203AB88->unk_397C[(var0 + z) * 3 + 210];
+ }
+ }
+}
+
+static u8 sub_8142758(u8 r0)
+{
+ u8 var0[5] = {0, 3, 4, 6, 12};
+
+ if (r0 > 19)
+ r0 = 0;
+ switch (gUnknown_085B6154[r0].var01_0)
+ {
+ case 3:
+ r0 = r0 / 5 - 1;
+ if (gUnknown_0203AB88->var16[r0] > 3)
+ return 0;
+ return var0[gUnknown_0203AB88->var16[r0] + 1];
+ case 4:
+ r0--;
+ if (gUnknown_0203AB88->var12[r0] > 2)
+ return 0;
+ return var0[gUnknown_0203AB88->var12[r0] + 2];
+ case 12:
+ if (gUnknown_0203AB88->var08 & gUnknown_085B6154[r0].var08)
+ return 0;
+ return var0[4];
+ }
+ return 0;
+}
+
+static void sub_8142814(void)
+{
+ s32 x1;
+ s32 x2;
+ SetGpuReg(REG_OFFSET_BG2PA, gUnknown_0203AB88->var2C.a);
+ SetGpuReg(REG_OFFSET_BG2PB, gUnknown_0203AB88->var2C.b);
+ SetGpuReg(REG_OFFSET_BG2PC, gUnknown_0203AB88->var2C.c);
+ SetGpuReg(REG_OFFSET_BG2PD, gUnknown_0203AB88->var2C.d);
+ x1 = 0x7400 - gUnknown_0203AB88->var2C.a * (gSpriteCoordOffsetX + 116)
+ - gUnknown_0203AB88->var2C.b * (gSpriteCoordOffsetY + 80);
+ x2 = 0x5400 - gUnknown_0203AB88->var2C.c * (gSpriteCoordOffsetX + 116)
+ - gUnknown_0203AB88->var2C.d * (gSpriteCoordOffsetY + 80);
+ SetGpuReg(REG_OFFSET_BG2X_L, x1);
+ SetGpuReg(REG_OFFSET_BG2X_H, (x1 & 0x0fff0000) >> 16);
+ SetGpuReg(REG_OFFSET_BG2Y_L, x2);
+ SetGpuReg(REG_OFFSET_BG2Y_H, (x2 & 0x0fff0000) >> 16);
+}
+
+static const u8 sFiller_085B644D[3] = {};
+static const u16 RouletteSpritePalette_01[] = INCBIN_U16("graphics/roulette/shadow.gbapal");
+static const u16 RouletteSpritePalette_02[] = INCBIN_U16("graphics/roulette/ball.gbapal");
+static const u16 RouletteSpritePalette_03[] = INCBIN_U16("graphics/roulette/ball_counter.gbapal");
+static const u16 RouletteSpritePalette_04[] = INCBIN_U16("graphics/roulette/cursor.gbapal");
+static const u16 RouletteSpritePalette_05[] = INCBIN_U16("graphics/roulette/credit.gbapal");
+static const u16 RouletteSpritePalette_06[] = INCBIN_U16("graphics/roulette/shroomish.gbapal");
+static const u16 RouletteSpritePalette_07[] = INCBIN_U16("graphics/roulette/tailow.gbapal");
+static const u16 RouletteSpritePalette_08[] = INCBIN_U16("graphics/roulette/poke_icons.gbapal");
+static const u16 RouletteSpritePalette_09[] = INCBIN_U16("graphics/roulette/wynaut.gbapal");
+static const u16 RouletteSpritePalette_10[] = INCBIN_U16("graphics/roulette/azurill.gbapal");
+static const u16 RouletteSpritePalette_11[] = INCBIN_U16("graphics/roulette/skitty.gbapal");
+static const u16 RouletteSpritePalette_12[] = INCBIN_U16("graphics/roulette/makuhita.gbapal");
+static const u16 RouletteSpritePalette_13[] = INCBIN_U16("graphics/roulette/85B65D0.gbapal");
+static const u16 RouletteSpritePalette_14[] = INCBIN_U16("graphics/roulette/85B65F0.gbapal");
+static const u16 RouletteSpritePalette_15[] = INCBIN_U16("graphics/roulette/85B6610.gbapal");
+static const u16 RouletteSpritePalette_16[] = INCBIN_U16("graphics/roulette/85B6630.gbapal");
+static const u32 gUnknown_085B6650[] = INCBIN_U32("graphics/roulette/ball.4bpp.lz");
+static const u32 RouletteBallCounterTiles[] = INCBIN_U32("graphics/roulette/ball_counter.4bpp.lz");
+static const u32 gUnknown_085B67FC[] = INCBIN_U32("graphics/roulette/roulette_tilt.4bpp.lz");
+static const u32 RoulettePokeIconsTiles[] = INCBIN_U32("graphics/roulette/poke_icons.4bpp.lz");
+static const u32 RoulettePokeIcons2Tiles[] = INCBIN_U32("graphics/roulette/poke_icons2.4bpp.lz");
+static const u32 gUnknown_085B7290[] = INCBIN_U32("graphics/roulette/shadow.4bpp.lz");
+static const u32 RouletteCursorTiles[] = INCBIN_U32("graphics/roulette/cursor.4bpp.lz");
+
+static const struct SpritePalette gUnknown_085B7384[] =
+{
+ { RouletteSpritePalette_01, 1 },
+ { RouletteSpritePalette_02, 2 },
+ { RouletteSpritePalette_03, 3 },
+ { RouletteSpritePalette_04, 4 },
+ { RouletteSpritePalette_05, 5 },
+ { RouletteSpritePalette_06, 6 },
+ { RouletteSpritePalette_07, 7 },
+ { RouletteSpritePalette_08, 8 },
+ { RouletteSpritePalette_09, 9 },
+ { RouletteSpritePalette_10, 10 },
+ { RouletteSpritePalette_11, 11 },
+ { RouletteSpritePalette_12, 12 },
+ {}
+};
+
+static const struct OamData gOamData_85B73EC =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_SQUARE,
+ .size = 2,
+ .priority = 1,
+};
+
+static const struct OamData gOamData_85B73F4 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_SQUARE,
+ .size = 1,
+ .priority = 1,
+};
+
+static const struct OamData gOamData_85B73FC =
+{
+ .y = 60,
+ .affineMode = ST_OAM_AFFINE_DOUBLE,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_V_RECTANGLE,
+ .size = 2,
+ .priority = 2,
+};
+
+static const union AnimCmd gSpriteAnim_85B7404[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B740C[] = {
+ gSpriteAnim_85B7404
+};
+
+static const union AffineAnimCmd gSpriteAffineAnim_85B7410[] = {
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7418[] = {
+ gSpriteAffineAnim_85B7410
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B741C = {
+ .data = RoulettePokeIcons2Tiles,
+ .size = 0xC00,
+ .tag = 0
+};
+
+static const union AnimCmd gSpriteAnim_85B7420[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_FRAME(32, 0),
+ ANIMCMD_FRAME(64, 0),
+ ANIMCMD_FRAME(72, 0),
+ ANIMCMD_FRAME(8, 0),
+ ANIMCMD_FRAME(40, 0),
+ ANIMCMD_FRAME(48, 0),
+ ANIMCMD_FRAME(80, 0),
+ ANIMCMD_FRAME(16, 0),
+ ANIMCMD_FRAME(24, 0),
+ ANIMCMD_FRAME(56, 0),
+ ANIMCMD_FRAME(88, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7458[] = {
+ &gSpriteAnim_85B7420[0]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B745C[] = {
+ &gSpriteAnim_85B7420[1]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7460[] = {
+ &gSpriteAnim_85B7420[2]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7464[] = {
+ &gSpriteAnim_85B7420[3]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7468[] = {
+ &gSpriteAnim_85B7420[4]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B746C[] = {
+ &gSpriteAnim_85B7420[5]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7470[] = {
+ &gSpriteAnim_85B7420[6]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7474[] = {
+ &gSpriteAnim_85B7420[7]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7478[] = {
+ &gSpriteAnim_85B7420[8]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B747C[] = {
+ &gSpriteAnim_85B7420[9]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7480[] = {
+ &gSpriteAnim_85B7420[10]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7484[] = {
+ &gSpriteAnim_85B7420[11]
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B7488 = {
+ .data = gRouletteHeadersTiles,
+ .size = 0x1600,
+ .tag = 4
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B7490 = {
+ .data = RoulettePokeIconsTiles,
+ .size = 0x400,
+ .tag = 5
+};
+
+static const union AnimCmd gSpriteAnim_85B7498[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_FRAME(16, 0),
+ ANIMCMD_FRAME(32, 0),
+ ANIMCMD_FRAME(48, 0),
+ ANIMCMD_FRAME(64, 0),
+ ANIMCMD_FRAME(80, 0),
+ ANIMCMD_FRAME(96, 0),
+ ANIMCMD_FRAME(112, 0),
+ ANIMCMD_FRAME(128, 0),
+ ANIMCMD_FRAME(144, 0),
+ ANIMCMD_FRAME(160, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B74C8[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_FRAME(4, 0),
+ ANIMCMD_FRAME(8, 0),
+ ANIMCMD_FRAME(12, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74DC[] = {
+ &gSpriteAnim_85B7498[0]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74E0[] = {
+ &gSpriteAnim_85B7498[2]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74E4[] = {
+ &gSpriteAnim_85B7498[4]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74E8[] = {
+ &gSpriteAnim_85B7498[6]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74EC[] = {
+ &gSpriteAnim_85B7498[8]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74F0[] = {
+ &gSpriteAnim_85B7498[9]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74F4[] = {
+ &gSpriteAnim_85B7498[10]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74F8[] = {
+ &gSpriteAnim_85B74C8[0]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B74FC[] = {
+ &gSpriteAnim_85B74C8[1]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7500[] = {
+ &gSpriteAnim_85B74C8[2]
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7504[] = {
+ &gSpriteAnim_85B74C8[3]
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B7508[] =
+{
+ {
+ .tileTag = 4,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73EC,
+ .anims = gSpriteAnimTable_85B74DC,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 4,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73EC,
+ .anims = gSpriteAnimTable_85B74E0,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 4,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73EC,
+ .anims = gSpriteAnimTable_85B74E4,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 4,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73EC,
+ .anims = gSpriteAnimTable_85B74E8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ }
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B7568[] =
+{
+ {
+ .tileTag = 4,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73EC,
+ .anims = gSpriteAnimTable_85B74EC,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 4,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73EC,
+ .anims = gSpriteAnimTable_85B74F0,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 4,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73EC,
+ .anims = gSpriteAnimTable_85B74F4,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ }
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B75B0[] =
+{
+ {
+ .tileTag = 5,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73F4,
+ .anims = gSpriteAnimTable_85B74F8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 5,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73F4,
+ .anims = gSpriteAnimTable_85B74FC,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 5,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73F4,
+ .anims = gSpriteAnimTable_85B7500,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ },
+ {
+ .tileTag = 5,
+ .paletteTag = 8,
+ .oam = &gOamData_85B73F4,
+ .anims = gSpriteAnimTable_85B7504,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+ }
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B7610[] =
+{
+ {
+ .tileTag = 0,
+ .paletteTag = 9,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7458,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 10,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B745C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 11,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7460,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 12,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7464,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 9,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7468,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 10,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B746C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 11,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7470,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 12,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7474,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 9,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7478,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 10,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B747C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 11,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7480,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ },
+ {
+ .tileTag = 0,
+ .paletteTag = 12,
+ .oam = &gOamData_85B73FC,
+ .anims = gSpriteAnimTable_85B7484,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8143280
+ }
+};
+
+static const struct OamData gOamData_85B7730 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_H_RECTANGLE,
+ .size = 3,
+ .priority = 1,
+};
+
+static const struct OamData gOamData_85B7738 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_V_RECTANGLE,
+ .size = 0,
+ .priority = 1,
+};
+
+static const struct OamData gOamData_85B7740 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_H_RECTANGLE,
+ .size = 2,
+ .priority = 1,
+};
+
+static const struct OamData gOamData_85B7748 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_H_RECTANGLE,
+ .size = 0,
+ .priority = 1,
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B7750[] =
+{
+ {
+ .data = gRouletteCreditTiles,
+ .size = 0x400,
+ .tag = 7
+ },
+ {
+ .data = gRouletteNumbersTiles,
+ .size = 0x280,
+ .tag = 8
+ },
+ {
+ .data = gRouletteMultiplierTiles,
+ .size = 0x500,
+ .tag = 9
+ },
+ {
+ .data = RouletteBallCounterTiles,
+ .size = 0x140,
+ .tag = 10
+ },
+ {
+ .data = RouletteCursorTiles,
+ .size = 0x200,
+ .tag = 11
+ },
+ {}
+};
+
+static const union AnimCmd gSpriteAnim_85B7780[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_FRAME(2, 0),
+ ANIMCMD_FRAME(4, 0),
+ ANIMCMD_FRAME(6, 0),
+ ANIMCMD_FRAME(8, 0),
+ ANIMCMD_FRAME(10, 0),
+ ANIMCMD_FRAME(12, 0),
+ ANIMCMD_FRAME(14, 0),
+ ANIMCMD_FRAME(16, 0),
+ ANIMCMD_FRAME(18, 0),
+ // BUG: Animation not terminated properly
+ //ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B77A8[] = {
+ gSpriteAnim_85B7780
+};
+
+static const union AnimCmd gSpriteAnim_85B77AC[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_FRAME(8, 0),
+ ANIMCMD_FRAME(16, 0),
+ ANIMCMD_FRAME(24, 0),
+ ANIMCMD_FRAME(32, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B77C4[] = {
+ gSpriteAnim_85B77AC
+};
+
+static const union AnimCmd gSpriteAnim_85B77C8[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_FRAME(2, 0),
+ ANIMCMD_FRAME(4, 0),
+ ANIMCMD_FRAME(6, 0),
+ ANIMCMD_FRAME(8, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B77E0[] = {
+ gSpriteAnim_85B77C8
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B77E4 =
+{
+ .tileTag = 7,
+ .paletteTag = 5,
+ .oam = &gOamData_85B7730,
+ .anims = gDummySpriteAnimTable,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+static const struct SpriteTemplate gUnknown_085B77FC =
+{
+ .tileTag = 8,
+ .paletteTag = 5,
+ .oam = &gOamData_85B7738,
+ .anims = gSpriteAnimTable_85B77A8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+static const struct SpriteTemplate gUnknown_085B7814 =
+{
+ .tileTag = 9,
+ .paletteTag = 5,
+ .oam = &gOamData_85B7740,
+ .anims = gSpriteAnimTable_85B77C4,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814390C
+};
+
+static const struct SpriteTemplate gUnknown_085B782C =
+{
+ .tileTag = 10,
+ .paletteTag = 3,
+ .oam = &gOamData_85B7748,
+ .anims = gSpriteAnimTable_85B77E0,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+static const struct SpriteTemplate gUnknown_085B7844 =
+{
+ .tileTag = 11,
+ .paletteTag = 5,
+ .oam = &gOamData_85B73EC,
+ .anims = gDummySpriteAnimTable,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+static const struct OamData gOamData_85B785C =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_SQUARE,
+ .size = 1,
+ .priority = 2,
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B7864 = {
+ .data = gUnknown_085B6650,
+ .size = 0x200,
+ .tag = 12
+};
+
+static const union AnimCmd gSpriteAnim_85B786C[] = {
+ ANIMCMD_FRAME(0, 5),
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_FRAME(8, 5),
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd gSpriteAnim_85B7880[] = {
+ ANIMCMD_FRAME(0, 10),
+ ANIMCMD_FRAME(4, 10),
+ ANIMCMD_FRAME(8, 10),
+ ANIMCMD_FRAME(4, 10),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd gSpriteAnim_85B7894[] = {
+ ANIMCMD_FRAME(0, 15),
+ ANIMCMD_FRAME(4, 15),
+ ANIMCMD_FRAME(8, 15),
+ ANIMCMD_FRAME(4, 15),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd gSpriteAnim_85B78A8[] = {
+ ANIMCMD_FRAME(4, 2),
+ ANIMCMD_FRAME(8, 5),
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_FRAME(12, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B78BC[] = {
+ ANIMCMD_FRAME(4, 2),
+ ANIMCMD_FRAME(0, 4),
+ ANIMCMD_FRAME(4, 4),
+ ANIMCMD_FRAME(8, 4),
+ ANIMCMD_FRAME(12, 4),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B78D4[] = {
+ ANIMCMD_FRAME(0, 2),
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_FRAME(8, 5),
+ ANIMCMD_FRAME(12, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B78E8[] = {
+ ANIMCMD_FRAME(12, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B78F0[] = {
+ ANIMCMD_FRAME(8, 2),
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_FRAME(0, 5),
+ ANIMCMD_FRAME(12, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7904[] = {
+ gSpriteAnim_85B786C,
+ gSpriteAnim_85B7880,
+ gSpriteAnim_85B7894,
+ gSpriteAnim_85B78A8,
+ gSpriteAnim_85B78F0,
+ gSpriteAnim_85B78BC,
+ gSpriteAnim_85B78D4,
+ gSpriteAnim_85B78D4,
+ gSpriteAnim_85B78E8
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B7928 =
+{
+ .tileTag = 12,
+ .paletteTag = 2,
+ .oam = &gOamData_85B785C,
+ .anims = gSpriteAnimTable_85B7904,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+static const struct OamData gOamData_85B7940 =
+{
+ .y = 81,
+ .affineMode = ST_OAM_AFFINE_DOUBLE,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_SQUARE,
+ .size = 3,
+ .priority = 2,
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B7948 = {
+ .data = gRouletteCenter_Gfx,
+ .size = 0x800,
+ .tag = 6
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B7950 =
+{
+ .tileTag = 6,
+ .paletteTag = 2,
+ .oam = &gOamData_85B7940,
+ .anims = gDummySpriteAnimTable,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_814399C
+};
+
+static const struct OamData gOamData_85B7968 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_SQUARE,
+ .size = 2,
+ .priority = 2,
+};
+
+static const struct OamData gOamData_85B7970 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_SQUARE,
+ .size = 2,
+ .priority = 2,
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B7978 = {
+ .data = gUnknown_085B67FC,
+ .size = 0xE00,
+ .tag = 13
+};
+
+static const union AnimCmd gSpriteAnim_85B7980[] = {
+ ANIMCMD_FRAME(0, 6),
+ ANIMCMD_FRAME(16, 6),
+ ANIMCMD_FRAME(32, 6),
+ ANIMCMD_FRAME(48, 6),
+ ANIMCMD_FRAME(32, 6),
+ ANIMCMD_FRAME(64, 6),
+ ANIMCMD_JUMP(2)
+};
+
+static const union AnimCmd gSpriteAnim_85B799C[] = {
+ ANIMCMD_FRAME(80, 10),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B79A4[] = {
+ ANIMCMD_FRAME(80, 10, .hFlip = TRUE),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B79AC[] = {
+ ANIMCMD_FRAME(80, 20),
+ ANIMCMD_FRAME(96, 20),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd gSpriteAnim_85B79B8[] = {
+ ANIMCMD_FRAME(80, 20, .hFlip = TRUE),
+ ANIMCMD_FRAME(96, 20, .hFlip = TRUE),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd gSpriteAnim_85B79C4[] = {
+ ANIMCMD_FRAME(80, 10),
+ ANIMCMD_FRAME(96, 10),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd gSpriteAnim_85B79D0[] = {
+ ANIMCMD_FRAME(80, 10, .hFlip = TRUE),
+ ANIMCMD_FRAME(96, 10, .hFlip = TRUE),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B79DC[] = {
+ gSpriteAnim_85B7980
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B79E0[] = {
+ gSpriteAnim_85B799C,
+ gSpriteAnim_85B79A4,
+ gSpriteAnim_85B79AC,
+ gSpriteAnim_85B79B8,
+ gSpriteAnim_85B79C4,
+ gSpriteAnim_85B79D0
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B79F8 =
+{
+ .tileTag = 13,
+ .paletteTag = 6,
+ .oam = &gOamData_85B7968,
+ .anims = gSpriteAnimTable_85B79DC,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B7A10 =
+{
+ .tileTag = 13,
+ .paletteTag = 7,
+ .oam = &gOamData_85B7970,
+ .anims = gSpriteAnimTable_85B79E0,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8145294
+};
+
+static const struct OamData gOamData_85B7A28 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_SQUARE,
+ .size = 1,
+ .priority = 2,
+};
+
+static const struct OamData gOamData_85B7A30 =
+{
+ .affineMode = ST_OAM_AFFINE_OFF,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_H_RECTANGLE,
+ .size = 2,
+ .priority = 2,
+};
+
+static const struct OamData gOamData_85B7A38 =
+{
+ .affineMode = ST_OAM_AFFINE_NORMAL,
+ .objMode = ST_OAM_OBJ_NORMAL,
+ .shape = ST_OAM_H_RECTANGLE,
+ .size = 2,
+ .priority = 2,
+};
+
+static const struct CompressedSpriteSheet gUnknown_085B7A40 = {
+ .data = gUnknown_085B7290,
+ .size = 0x180,
+ .tag = 14
+};
+
+static const union AffineAnimCmd gSpriteAffineAnim_85B7A48[] = {
+ AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0),
+ AFFINEANIMCMD_FRAME(2, 2, 0, 60),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd gSpriteAffineAnim_85B7A60[] = {
+ AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_FRAME(-2, 0x0, 0, 15),
+ AFFINEANIMCMD_FRAME(-1, -2, 0, 15),
+ AFFINEANIMCMD_FRAME(-1, -5, 0, 24),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7A88[] = {
+ gSpriteAffineAnim_85B7A48
+};
+
+static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7A8C[] = {
+ gSpriteAffineAnim_85B7A60
+};
+
+static const union AffineAnimCmd gSpriteAffineAnim_85B7A90[] = {
+ AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7AA0[] = {
+ gSpriteAffineAnim_85B7A90
+};
+
+static const union AnimCmd gSpriteAnim_85B7AA4[] = {
+ ANIMCMD_FRAME(0, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd gSpriteAnim_85B7AAC[] = {
+ ANIMCMD_FRAME(4, 0),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7AB4[] = {
+ gSpriteAnim_85B7AA4
+};
+
+static const union AnimCmd *const gSpriteAnimTable_85B7AB8[] = {
+ gSpriteAnim_85B7AAC
+};
+
+static const struct SpriteTemplate gSpriteTemplate_85B7ABC[] =
+{
+ {
+ .tileTag = 14,
+ .paletteTag = 1,
+ .oam = &gOamData_85B7A28,
+ .anims = gSpriteAnimTable_85B7AB4,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy
+ },
+ {
+ .tileTag = 14,
+ .paletteTag = 1,
+ .oam = &gOamData_85B7A30,
+ .anims = gSpriteAnimTable_85B7AB8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8144E60
+ }
+};
+
+static const struct SpriteTemplate gUnknown_085B7AEC =
+{
+ .tileTag = 14,
+ .paletteTag = 1,
+ .oam = &gOamData_85B7A38,
+ .anims = gSpriteAnimTable_85B7AB8,
+ .images = NULL,
+ .affineAnims = gSpriteAffineAnimTable_85B7A8C,
+ .callback = sub_8145294
+};
+
+static void sub_81428C4(u8 r0)
+{
+ DisplayYesNoMenu();
+ DoYesNoFuncWithChoice(r0, &gUnknown_085B6408);
+}
+
+static void sub_81428E4(u8 taskId)
+{
+ if (!gPaletteFade.active)
+ {
+ SetVBlankCallback(NULL);
+ SetMainCallback2(sub_81405CC);
+ DestroyTask(taskId);
+ }
+}
+
+static void sub_8142918(u8 taskId)
+{
+ sub_819746C(0, TRUE);
+ HideCoinsWindow();
+ FreeAllWindowBuffers();
+ BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
+ gPaletteFade.delayCounter = gPaletteFade.multipurpose2;
+ UpdatePaletteFade();
+ gTasks[taskId].func = sub_81428E4;
+}
+
+static void sub_814297C(u8 taskId)
+{
+ sub_819746C(0, FALSE);
+ HideCoinsWindow();
+ ScriptContext2_Disable();
+ DestroyTask(taskId);
+}
+
+static void sub_81429A0(u8 taskId)
+{
+ gTasks[taskId].data[0]++;
+ if (gMain.newKeys & (A_BUTTON | B_BUTTON))
+ {
+ gSpecialVar_0x8004 = 1;
+ HideCoinsWindow();
+ sub_819746C(0, TRUE);
+ ScriptContext2_Disable();
+ DestroyTask(taskId);
+ }
+}
+
+static void sub_81429F0(u8 taskId)
+{
+ if (gMain.newKeys & (A_BUTTON | B_BUTTON))
+ {
+ u32 temp = gUnknown_085B6344[(gSpecialVar_0x8004 & 1) + (gSpecialVar_0x8004 >> 7 << 1)];
+ ConvertIntToDecimalStringN(gStringVar1, temp, STR_CONV_MODE_LEADING_ZEROS, 1);
+ StringExpandPlaceholders(gStringVar4, gUnknown_082A5B12);
+ NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(0, 3);
+ gTasks[taskId].func = sub_81428C4;
+ }
+}
+
+static void Task_Roulette_0(u8 taskId)
+{
+ s32 temp;
+ PrintCoinsString(gTasks[taskId].data[13]);
+ temp = gUnknown_085B6344[(gSpecialVar_0x8004 & 1) + (gSpecialVar_0x8004 >> 7 << 1)];
+ ConvertIntToDecimalStringN(gStringVar1, temp, 2, 1);
+ if (gTasks[taskId].data[13] >= temp)
+ {
+ if ((gSpecialVar_0x8004 & 0x80) && (gSpecialVar_0x8004 & 1))
+ {
+ NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ AddTextPrinterParameterized(0, 1, gUnknown_082A5B6B, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(0, 3);
+ gTasks[taskId].func = sub_81429F0;
+ }
+ else
+ {
+ StringExpandPlaceholders(gStringVar4, gUnknown_082A5B12);
+ NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(0, 3);
+ gTasks[taskId].func = sub_81428C4;
+ }
+ }
+ else
+ {
+ StringExpandPlaceholders(gStringVar4, gUnknown_082A5B4E);
+ NewMenuHelpers_DrawStdWindowFrame(0, FALSE);
+ AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL);
+ CopyWindowToVram(0, 3);
+ gTasks[taskId].func = sub_81429A0;
+ gTasks[taskId].data[13] = 0;
+ gTasks[taskId].data[0] = 0;
+ }
+}
+
+void PlayRoulette(void)
+{
+ u8 taskId;
+
+ ScriptContext2_Enable();
+ ShowCoinsWindow(GetCoins(), 1, 1);
+ taskId = CreateTask(Task_Roulette_0, 0);
+ gTasks[taskId].data[13] = GetCoins();
+}
+
+static void sub_8142C0C(u8 r0)
+{
+ if (!r0)
+ {
+ FreeAllSpritePalettes();
+ LoadSpritePalettes(gUnknown_085B7384);
+ LoadCompressedSpriteSheet(&gUnknown_085B7864);
+ LoadCompressedSpriteSheet(&gUnknown_085B7978);
+ LoadCompressedSpriteSheet(&gUnknown_085B7A40);
+ }
+ else
+ {
+ FreeSpriteTilesByTag(14);
+ FreeSpriteTilesByTag(13);
+ FreeSpriteTilesByTag(12);
+ FreeAllSpritePalettes();
+ }
+}
+
+static u8 sub_8142C60(const struct SpriteTemplate *r0, u8 r1, u16 *r2)
+{
+ u16 temp;
+ u8 spriteId = CreateSprite(r0, 116, 80, r0->oam->y);
+ gSprites[spriteId].data[0] = *r2;
+ gSprites[spriteId].data[1] = r1;
+ gSprites[spriteId].coordOffsetEnabled = TRUE;
+ gSprites[spriteId].animPaused = TRUE;
+ gSprites[spriteId].affineAnimPaused = TRUE;
+ temp = *r2;
+ *r2 += 30;
+ if (*r2 >= 360)
+ *r2 = temp - 330;
+ return spriteId;
+}
+
+static void sub_8142CD0(void)
+{
+ u8 i, j;
+ u8 spriteId;
+ struct SpriteSheet s;
+ LZ77UnCompWram(gUnknown_085B7488.data, gDecompressionBuffer);
+ s.data = gDecompressionBuffer;
+ s.size = gUnknown_085B7488.size;
+ s.tag = gUnknown_085B7488.tag;
+ LoadSpriteSheet(&s);
+ LZ77UnCompWram(gUnknown_085B7490.data, gDecompressionBuffer);
+ s.data = gDecompressionBuffer;
+ s.size = gUnknown_085B7490.size;
+ s.tag = gUnknown_085B7490.tag;
+ LoadSpriteSheet(&s);
+ for (i = 0; i < 3; i++)
+ {
+ u8 o = i * 24;
+ for (j = 0; j < 4; j++)
+ {
+ spriteId = gUnknown_0203AB88->var3C[(i * 4) + 29 + j] = CreateSprite(&gSpriteTemplate_85B75B0[j], (j * 24) + 148, o + 92, 30);
+ gSprites[spriteId].animPaused = TRUE;
+ o += 24;
+ if (o >= 72)
+ o = 0;
+ }
+ }
+ for (i = 0; i < 4; i++)
+ {
+ spriteId = gUnknown_0203AB88->var3C[i + 41] = CreateSprite(&gSpriteTemplate_85B7508[i], (i * 24) + 148, 70, 30);
+ gSprites[spriteId].animPaused = TRUE;
+ }
+ for (i = 0; i < 3; i++)
+ {
+ spriteId = gUnknown_0203AB88->var3C[i + 45] = CreateSprite(&gSpriteTemplate_85B7568[i], 126, (i * 24) + 92, 30);
+ gSprites[spriteId].animPaused = TRUE;
+ }
+}
+
+static void unref_sub_8142E3C(void)
+{
+ u8 i;
+ for (i = 0; i < 12; i++)
+ {
+ DestroySprite(&gSprites[gUnknown_0203AB88->var3C[i + 29]]);
+ }
+}
+
+static void sub_8142E70(u8 r0, u8 r1)
+{
+ u8 i;
+ switch (r0)
+ {
+ case 1:
+ for (i = 0; i < 19; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = TRUE;
+ }
+ break;
+ case 0:
+ for (i = 0; i < 12; i++)
+ {
+ if (!(gUnknown_0203AB88->var08 & gUnknown_085B62E4[i].var04))
+ gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = FALSE;
+ else if (gUnknown_085B62E4[i].var02 != r1)
+ gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = TRUE;
+ else
+ gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = FALSE;
+ }
+ for (; i < 19; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = FALSE;
+ }
+ break;
+ }
+}
+
+static void sub_8142F7C(void)
+{
+ u8 i;
+ for (i = 0; i < 6; i++)
+ {
+ gUnknown_0203AB88->var3C[i + 49] = CreateSprite(&gSpriteTemplate_85B7928, 116, 20, 10);
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].data[0] = 1;
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].callback = sub_814390C;
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].oam.priority = 1;
+ StartSpriteAnim(&gSprites[gUnknown_0203AB88->var3C[i + 49]], 8);
+ }
+}
+
+static void sub_8143038(u8 r0, u8 r1)
+{
+ u8 i = 0;
+ if (r0)
+ {
+ for ( ; i < 6; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = TRUE;
+ }
+ }
+ else
+ {
+ for ( ; i < 6; i++)
+ {
+ if (!gUnknown_0203AB88->var0C[i] || i == r1)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = TRUE;
+ }
+ else
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = FALSE;
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].pos1.x = (gUnknown_085B6154[gUnknown_0203AB88->var0C[i]].var03 + 1) * 8 + 4;
+ gSprites[gUnknown_0203AB88->var3C[i + 49]].pos1.y = (gUnknown_085B6154[gUnknown_0203AB88->var0C[i]].var04 + 1) * 8 + 3;
+ }
+ }
+ }
+}
+
+static void sub_8143150(u8 r0)
+{
+ if (!r0)
+ {
+ gSprites[gUnknown_0203AB88->var3C[48]].invisible = TRUE;
+ }
+ else
+ {
+ gSprites[gUnknown_0203AB88->var3C[48]].invisible = FALSE;
+ gSprites[gUnknown_0203AB88->var3C[48]].pos1.x = (gUnknown_085B6154[r0].var03 + 2) * 8;
+ gSprites[gUnknown_0203AB88->var3C[48]].pos1.y = (gUnknown_085B6154[r0].var04 + 2) * 8;
+ }
+}
+
+static void sub_81431E4(void)
+{
+ u8 i, j;
+ u16 k;
+ struct SpriteSheet s;
+
+ LZ77UnCompWram(gUnknown_085B741C.data, gDecompressionBuffer);
+ s.data = gDecompressionBuffer;
+ s.size = gUnknown_085B741C.size;
+ s.tag = gUnknown_085B741C.tag;
+ LoadSpriteSheet(&s);
+
+ k = 15;
+ for (i = 0; i < 3; i++)
+ {
+ for (j = 0; j < 4; j++)
+ {
+ u8 spriteId;
+ spriteId = gUnknown_0203AB88->var3C[(i * 4) + 7 + j] = sub_8142C60(&gSpriteTemplate_85B7610[i * 4 + j], 40, &k);
+ gSprites[spriteId].animPaused = TRUE;
+ gSprites[spriteId].affineAnimPaused = TRUE;
+ }
+ }
+}
+
+static void sub_8143280(struct Sprite *sprite)
+{
+ s16 cos;
+ s16 sin;
+ u32 matrixNum;
+ s16 angle = gUnknown_0203AB88->var24 + sprite->data[0];
+ if (angle >= 360)
+ angle -= 360;
+ sin = Sin2(angle);
+ cos = Cos2(angle);
+ sprite->pos2.x = sin * sprite->data[1] >> 12;
+ sprite->pos2.y = -cos * sprite->data[1] >> 12;
+ matrixNum = sprite->oam.matrixNum;
+ sin /= 16;
+ gOamMatrices[matrixNum].d = cos /= 16;
+ gOamMatrices[matrixNum].a = cos;
+ gOamMatrices[matrixNum].b = sin;
+ gOamMatrices[matrixNum].c = -sin;
+}
+
+static void sub_8143314(void)
+{
+ u8 i;
+ for (i = 0; i < 5; i++)
+ {
+ struct SpriteSheet s;
+ LZ77UnCompWram(gUnknown_085B7750[i].data, gDecompressionBuffer);
+ s.data = gDecompressionBuffer;
+ s.size = gUnknown_085B7750[i].size;
+ s.tag = gUnknown_085B7750[i].tag;
+ LoadSpriteSheet(&s);
+ }
+ gUnknown_0203AB88->var3C[20] = CreateSprite(&gSpriteTemplate_85B77E4, 208, 16, 4);
+ gSprites[gUnknown_0203AB88->var3C[20]].animPaused = TRUE;
+ for (i = 0; i < 4; i++)
+ {
+ gUnknown_0203AB88->var3C[i + 21] = CreateSprite(&gUnknown_085B77FC, i * 8 + 196, 24, 0);
+ gSprites[gUnknown_0203AB88->var3C[i + 21]].invisible = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[i + 21]].animPaused = TRUE;
+ }
+ gUnknown_0203AB88->var3C[25] = CreateSprite(&gUnknown_085B7814, 120, 68, 4);
+ gSprites[gUnknown_0203AB88->var3C[25]].animPaused = TRUE;
+ for (i = 0; i < 3; i++)
+ {
+ gUnknown_0203AB88->var3C[i + 26] = CreateSprite(&gUnknown_085B782C, i * 16 + 192, 36, 4);
+ gSprites[gUnknown_0203AB88->var3C[i + 26]].invisible = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[i + 26]].animPaused = TRUE;
+ }
+ gUnknown_0203AB88->var3C[48] = CreateSprite(&gUnknown_085B7844, 152, 96, 9);
+ gSprites[gUnknown_0203AB88->var3C[48]].oam.priority = 1;
+ gSprites[gUnknown_0203AB88->var3C[48]].animPaused = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[48]].invisible = TRUE;
+}
+
+static void sub_8143514(u16 r0)
+{
+ u8 i;
+ u16 d = 1000;
+ bool8 v = FALSE;
+ for (i = 0; i < 4; i++)
+ {
+ u8 t = r0 / d;
+ gSprites[gUnknown_0203AB88->var3C[i + 21]].invisible = TRUE;
+ if (t > 0 || v || i == 3)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 21]].invisible = FALSE;
+ gSprites[gUnknown_0203AB88->var3C[i + 21]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[i + 21]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[i + 21]].anims + t)->type;
+ v = TRUE;
+ }
+ r0 = r0 % d;
+ d = d / 10;
+ }
+}
+
+static u8 sub_8143614(u8 r0)
+{
+ u8 t[5] = {0, 1, 2, 3, 4};
+
+ if (r0 >= 20)
+ r0 = 0;
+ switch (gUnknown_085B6154[r0].var01_0)
+ {
+ case 3:
+ r0 = r0 / 5 - 1;
+ if (gUnknown_0203AB88->var16[r0] > 3)
+ return 0;
+ return t[gUnknown_0203AB88->var16[r0] + 1];
+ case 4:
+ r0--;
+ if (gUnknown_0203AB88->var12[r0] > 2)
+ return 0;
+ return t[gUnknown_0203AB88->var12[r0] + 2];
+ case 12:
+ if (gUnknown_0203AB88->var08 & gUnknown_085B6154[r0].var08)
+ return 0;
+ return t[4];
+ }
+ return 0;
+}
+
+static void sub_81436D0(u8 r0)
+{
+ struct Sprite *s = &gSprites[gUnknown_0203AB88->var3C[25]];
+ s->animCmdIndex = sub_8143614(r0);
+ s->oam.tileNum = s->sheetTileStart + (*s->anims + s->animCmdIndex)->type;
+}
+
+static void sub_814372C(u8 r0)
+{
+ u8 i;
+ u8 t = 0;
+ if (gUnknown_0203AB88->var19 == 1)
+ t = 2;
+ switch (r0)
+ {
+ case 6:
+ for (i = 0; i < 3; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 26]].invisible = FALSE;
+ gSprites[gUnknown_0203AB88->var3C[i + 26]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[i + 26]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[i + 26]].anims)->type;
+ }
+ break;
+ case 5:
+ gSprites[gUnknown_0203AB88->var3C[28]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[28]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[28]].anims + t + 1)->type;
+ break;
+ case 4:
+ gSprites[gUnknown_0203AB88->var3C[28]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[28]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[28]].anims + t + 2)->type;
+ break;
+ case 3:
+ gSprites[gUnknown_0203AB88->var3C[27]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[27]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[27]].anims + t + 1)->type;
+ break;
+ case 2:
+ gSprites[gUnknown_0203AB88->var3C[27]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[27]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[27]].anims + t + 2)->type;
+ break;
+ case 1:
+ gSprites[gUnknown_0203AB88->var3C[26]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[26]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[26]].anims + t + 1)->type;
+ break;
+ case 0:
+ default:
+ for (i = 0; i < 3; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 26]].oam.tileNum =
+ gSprites[gUnknown_0203AB88->var3C[i + 26]].sheetTileStart
+ + (*gSprites[gUnknown_0203AB88->var3C[i + 26]].anims + t + 2)->type;
+ }
+ }
+}
+
+static void sub_814390C(struct Sprite *sprite)
+{
+ sprite->pos2.x = gUnknown_0203AB88->var26;
+}
+
+static void sub_814391C(void)
+{
+ u8 spriteId;
+ struct SpriteSheet s;
+ LZ77UnCompWram(gUnknown_085B7948.data, gDecompressionBuffer);
+ s.data = gDecompressionBuffer;
+ s.size = gUnknown_085B7948.size;
+ s.tag = gUnknown_085B7948.tag;
+ LoadSpriteSheet(&s);
+ spriteId = CreateSprite(&gSpriteTemplate_85B7950, 116, 80, 81);
+ gSprites[spriteId].data[0] = gUnknown_0203AB88->var24;
+ gSprites[spriteId].data[1] = 0;
+ gSprites[spriteId].animPaused = TRUE;
+ gSprites[spriteId].affineAnimPaused = TRUE;
+ gSprites[spriteId].coordOffsetEnabled = TRUE;
+}
+
+static void sub_814399C(struct Sprite *sprite)
+{
+ u32 t = sprite->oam.matrixNum;
+ struct OamMatrix *m = &gOamMatrices[0];
+ m[t].d = gUnknown_0203AB88->var2C.a;
+ m[t].a = gUnknown_0203AB88->var2C.a;
+ m[t].b = gUnknown_0203AB88->var2C.b;
+ m[t].c = gUnknown_0203AB88->var2C.c;
+}
+
+static void sub_81439C8(void)
+{
+ u8 i;
+ for (i = 0; i < 6; i++)
+ {
+ gUnknown_0203AB88->var3C[i] = CreateSprite(&gSpriteTemplate_85B7928, 116, 80, 57 - i);
+ if (gUnknown_0203AB88->var3C[i] != MAX_SPRITES)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i]].invisible = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[i]].coordOffsetEnabled = TRUE;
+ }
+ }
+}
+
+static void sub_8143A40(void)
+{
+ u8 t = gUnknown_0203AB88->var3C[0];
+ u8 i;
+ for (i = 0; i < 6; i++)
+ {
+ u8 j;
+ gSprites[t].invisible = TRUE;
+ gSprites[t].callback = &SpriteCallbackDummy;
+ StartSpriteAnim(&gSprites[t], 0);
+ for (j = 0; j < 8; j++)
+ {
+ gSprites[t].data[j] = 0;
+ }
+ t++;
+ }
+}
+
+static s16 sub_8143AC8(struct Sprite *sprite)
+{
+ if (gUnknown_0203AB88->var24 > sprite->data[3])
+ {
+ sprite->data[6] = 360 - gUnknown_0203AB88->var24 + sprite->data[3];
+ if (sprite->data[6] >= 360)
+ sprite->data[6] -= 360;
+ }
+ else
+ {
+ sprite->data[6] = sprite->data[3] - gUnknown_0203AB88->var24;
+ }
+
+ return sprite->data[6];
+}
+
+static u8 sub_8143B14(struct Sprite *sprite)
+{
+ gUnknown_0203AB88->var7E = sub_8143AC8(sprite) / 30.0f;
+ return gUnknown_0203AB88->var7E;
+}
+
+static s16 sub_8143B48(struct Sprite *sprite)
+{
+ s16 t = sub_8143AC8(sprite) % 30;
+ u16 z;
+ if (t == 14)
+ {
+ z = 0;
+ return sprite->data[2] = z;
+ }
+ else if (t > 13)
+ {
+ z = 43 - t;
+ return sprite->data[2] = z;
+ }
+ else
+ {
+ z = 14 - t;
+ return sprite->data[2] = z;
+ }
+}
+
+static void sub_8143B84(struct Sprite *sprite)
+{
+ s16 sin, cos;
+
+ gUnknown_0203AB88->var8C += gUnknown_0203AB88->var90;
+ gUnknown_0203AB88->var88 += gUnknown_0203AB88->var8C;
+
+ if (gUnknown_0203AB88->var88 >= 360)
+ gUnknown_0203AB88->var88 -= 360.0f;
+ else if (gUnknown_0203AB88->var88 < 0.0f)
+ gUnknown_0203AB88->var88 += 360.0f;
+
+ sprite->data[3] = gUnknown_0203AB88->var88;
+ gUnknown_0203AB88->var98 += gUnknown_0203AB88->var9C;
+ gUnknown_0203AB88->var94 += gUnknown_0203AB88->var98;
+ sprite->data[4] = gUnknown_0203AB88->var94;
+ sin = Sin2(sprite->data[3]);
+ cos = Cos2(sprite->data[3]);
+ sprite->pos2.x = sin * sprite->data[4] >> 12;
+ sprite->pos2.y = -cos * sprite->data[4] >> 12;
+ if (IsSEPlaying())
+ {
+ m4aMPlayPanpotControl(&gMPlayInfo_SE1, 0xFFFF, sprite->pos2.x);
+ m4aMPlayPanpotControl(&gMPlayInfo_SE2, 0xFFFF, sprite->pos2.x);
+ }
+}
+
+static void sub_8143C90(struct Sprite *sprite)
+{
+ s16 sin, cos;
+ sprite->data[3] = gUnknown_0203AB88->var24 + sprite->data[6];
+ if (sprite->data[3] >= 360)
+ sprite->data[3] -= 360;
+ sin = Sin2(sprite->data[3]);
+ cos = Cos2(sprite->data[3]);
+ sprite->pos2.x = sin * sprite->data[4] >> 12;
+ sprite->pos2.y = -cos * sprite->data[4] >> 12;
+ sprite->pos2.y += gSpriteCoordOffsetY;
+}
+
+static void sub_8143CFC(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ sprite->data[2]++;
+ if (sprite->data[4] < -132 || sprite->data[4] > 80)
+ sprite->invisible = TRUE;
+ else
+ sprite->invisible = FALSE;
+
+ if (sprite->data[2] >= 30)
+ {
+ if (!sprite->data[0])
+ {
+ if (gUnknown_0203AB88->var94 <= gUnknown_0203AB88->varA0 - 2.0f)
+ {
+ gUnknown_0203AB88->var7D = 0xFF;
+ gUnknown_0203AB88->var03_7 = 0;
+ StartSpriteAnim(sprite, sprite->animCmdIndex + 0x3);
+ sub_8143B14(sprite);
+ sprite->data[4] = 30;
+ sub_8143AC8(sprite);
+ sprite->data[6] = (sprite->data[6] / 30) * 30 + 15;
+ sprite->callback = sub_8143C90;
+ m4aSongNumStartOrChange(SE_HASHI);
+ gUnknown_0203AB88->var9C = gUnknown_0203AB88->var98 = 0.0f;
+ gUnknown_0203AB88->var8C = -1.0f;
+ }
+ }
+ else
+ {
+ if (gUnknown_0203AB88->var94 >= gUnknown_0203AB88->varA0 - 2.0f)
+ {
+ gUnknown_0203AB88->var7D = 0xFF;
+ gUnknown_0203AB88->var03_7 = 0;
+ StartSpriteAnim(sprite, sprite->animCmdIndex + 3);
+ sub_8143B14(sprite);
+ sprite->data[4] = 30;
+ sub_8143AC8(sprite);
+ sprite->data[6] = (sprite->data[6] / 30) * 30 + 15;
+ sprite->callback = sub_8143C90;
+ m4aSongNumStartOrChange(SE_HASHI);
+ gUnknown_0203AB88->var9C = gUnknown_0203AB88->var98 = 0.0f;
+ gUnknown_0203AB88->var8C = -1.0f;
+ }
+ }
+ }
+}
+
+static void sub_8143E14(struct Sprite *sprite)
+{
+ float f0, f1, f2;
+ sub_8143B84(sprite);
+
+ switch (sprite->data[3])
+ {
+ case 0:
+ if (sprite->data[0] != 1)
+ {
+ f0 = sprite->data[7];
+ f1 = (f0 * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01 + (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 - 1));
+ f2 = (f0 / gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0C);
+ }
+ else
+ {
+ return;
+ }
+ break;
+ case 180:
+ if (sprite->data[0] != 0)
+ {
+ f0 = sprite->data[7];
+ f1 = (f0 * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01 + (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 - 1));
+ f2 = -(f0 / gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0C);
+ }
+ else
+ {
+ return;
+ }
+ break;
+ default:
+ return;
+ }
+ gUnknown_0203AB88->varA0 = gUnknown_0203AB88->var94;
+ gUnknown_0203AB88->var98 = f2;
+ gUnknown_0203AB88->var9C = -((f2 * 2.0f) / f1 + (2.0f / (f1 * f1)));
+ gUnknown_0203AB88->var8C = 0.0f;
+ sprite->animPaused = FALSE;
+ sprite->animNum = 0;
+ sprite->animBeginning = TRUE;
+ sprite->animEnded = FALSE;
+ sprite->callback = sub_8143CFC;
+ sprite->data[2] = 0;
+}
+
+static void sub_8143FA4(struct Sprite *sprite)
+{
+ sprite->pos2.y = (s16)(sprite->data[2] * 0.05f * sprite->data[2]) - 45;
+ sprite->data[2]++;
+ if (sprite->data[2] > 29 && sprite->pos2.y >= 0)
+ {
+ gUnknown_0203AB88->var7D = 0xFF;
+ gUnknown_0203AB88->var03_7 = FALSE;
+ StartSpriteAnim(sprite, sprite->animCmdIndex + 3);
+ sub_8143B14(sprite);
+ sprite->data[4] = 30;
+ sub_8143AC8(sprite);
+ sprite->data[6] = (sprite->data[6] / 30) * 30 + 15;
+ sprite->callback = sub_8143C90;
+ m4aSongNumStartOrChange(SE_HASHI);
+ gUnknown_0203AB88->var03_6 = TRUE;
+ }
+}
+
+static void sub_8144050(struct Sprite *sprite)
+{
+ if (sprite->data[2]++ < 45)
+ {
+ sprite->pos2.y--;
+ if (sprite->data[2] == 45)
+ {
+ if (gSprites[gUnknown_0203AB88->var3C[55]].animCmdIndex == 1)
+ sprite->pos2.y++;
+ }
+ }
+ else
+ {
+ if (sprite->data[2] < sprite->data[7])
+ {
+ if (gSprites[gUnknown_0203AB88->var3C[55]].animDelayCounter == 0)
+ {
+ if (gSprites[gUnknown_0203AB88->var3C[55]].animCmdIndex == 1)
+ sprite->pos2.y++;
+ else
+ sprite->pos2.y--;
+ }
+ }
+ else
+ {
+ sprite->animPaused = FALSE;
+ sprite->animNum = 1;
+ sprite->animBeginning = TRUE;
+ sprite->animEnded = FALSE;
+ sprite->data[2] = 0;
+ sprite->callback = sub_8143FA4;
+ m4aSongNumStart(SE_NAGERU);
+ }
+ }
+}
+
+static void sub_8144128(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ switch (sprite->data[3])
+ {
+ case 90:
+ if (sprite->data[0] != 1)
+ {
+ sprite->callback = &sub_8144050;
+ sprite->data[2] = 0;
+ }
+ break;
+ case 270:
+ if (sprite->data[0] != 0)
+ {
+ sprite->callback = &sub_8144050;
+ sprite->data[2] = 0;
+ }
+ break;
+ }
+}
+
+static void sub_8144168(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ switch (gUnknown_0203AB88->var03_0)
+ {
+ default:
+ case 0:
+ sub_81446DC(sprite);
+ sprite->callback = sub_8143E14;
+ break;
+ case 1:
+ sub_81448B8(sprite);
+ sprite->callback = sub_8144128;
+ break;
+ }
+}
+
+static void prev_quest_read_x24_hm_usage(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ if (sprite->data[2]-- == 16)
+ gUnknown_0203AB88->var98 *= -1.0f;
+ if (sprite->data[2] == 0)
+ {
+ if (!sprite->data[0])
+ {
+ gUnknown_0203AB88->var7D = 0xFF;
+ gUnknown_0203AB88->var03_7 = 0;
+ StartSpriteAnim(sprite, sprite->animCmdIndex + 3);
+ sub_8143B14(sprite);
+ sprite->data[4] = 30;
+ sub_8143AC8(sprite);
+ sprite->data[6] = (sprite->data[6] / 30) * 30 + 15;
+ sprite->callback = sub_8143C90;
+ m4aSongNumStartOrChange(SE_HASHI);
+ }
+ else
+ {
+ sprite->animPaused = TRUE;
+ m4aSongNumStart(SE_KON);
+ sub_8144A24(sprite);
+ }
+ }
+}
+
+static void sub_8144264(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ sprite->data[2] = 0;
+ sub_8143B14(sprite);
+ if (!(gUnknown_085B62E4[gUnknown_0203AB88->var7E].var04 & gUnknown_0203AB88->var08))
+ {
+ gUnknown_0203AB88->var7D = 0xFF;
+ gUnknown_0203AB88->var03_7 = 0;
+ StartSpriteAnim(sprite, sprite->animCmdIndex + 3);
+ sub_8143B14(sprite);
+ sprite->data[4] = 30;
+ sub_8143AC8(sprite);
+ sprite->data[6] = (sprite->data[6] / 30) * 30 + 15;
+ sprite->callback = sub_8143C90;
+ m4aSongNumStartOrChange(SE_HASHI);
+ }
+ else
+ {
+ u8 t;
+ u32 z;
+ m4aSongNumStart(SE_KON);
+ z = Random() & 1;
+ if (z)
+ {
+ gUnknown_0203AB88->var8C = 0.0f;
+ gUnknown_0203AB88->var7F = t = (gUnknown_0203AB88->var7E + 1) % 12;
+ }
+ else
+ {
+ float temp;
+ gUnknown_0203AB88->var8C = (temp = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var1C) * 2.0f;
+ t = (gUnknown_0203AB88->var7E + 11) % 12;
+ gUnknown_0203AB88->var7F = gUnknown_0203AB88->var7E;
+ }
+ if (gUnknown_085B62E4[t].var04 & gUnknown_0203AB88->var08)
+ {
+ sprite->data[0] = 1;
+ sprite->data[2] = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02;
+ }
+ else
+ {
+ sprite->data[0] = gUnknown_085B62E4[t].var04 & gUnknown_0203AB88->var08;
+ if (gUnknown_0203AB88->var04_0)
+ {
+ sprite->data[2] = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01;
+ }
+ else
+ {
+ sprite->data[2] = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02;
+ if (z)
+ {
+ gUnknown_0203AB88->var8C = 0.5f;
+ }
+ else
+ {
+ gUnknown_0203AB88->var8C = -1.5f;
+ }
+ }
+ }
+ gUnknown_0203AB88->var98 = 0.085f;
+ sprite->callback = prev_quest_read_x24_hm_usage;
+ sprite->data[1] = 5;
+ }
+}
+
+static void sub_8144410(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ if (gUnknown_0203AB88->var8C > 0.5f)
+ return;
+
+ sub_8143B14(sprite);
+ if (!sub_8143B48(sprite))
+ {
+ gUnknown_0203AB88->var90 = 0.0f;
+ gUnknown_0203AB88->var8C -= (float)(gUnknown_085B6348[gUnknown_0203AB88->var04_0].var03)
+ / (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var04 + 1);
+ sprite->data[1] = 4;
+ sprite->callback = sub_8144264;
+ }
+ else
+ {
+ if (gUnknown_0203AB88->var90 != 0.0f)
+ {
+ if (gUnknown_0203AB88->var8C < 0.0f)
+ {
+ gUnknown_0203AB88->var90 = 0.0f;
+ gUnknown_0203AB88->var8C = 0.0f;
+ gUnknown_0203AB88->var98 /= 1.2;
+ }
+ }
+ }
+}
+
+static void sub_8144514(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ if (gUnknown_0203AB88->var94 > 40.f)
+ return;
+
+ gUnknown_0203AB88->var98 = -(4.0f / (float)gUnknown_0203AB88->var86);
+ gUnknown_0203AB88->var90 = -(gUnknown_0203AB88->var8C / (float)gUnknown_0203AB88->var86);
+ sprite->animNum = 2;
+ sprite->animBeginning = TRUE;
+ sprite->animEnded = FALSE;
+ sprite->data[1] = 3;
+ sprite->callback = sub_8144410;
+}
+
+static void sub_81445D8(struct Sprite *sprite)
+{
+ sub_8143B84(sprite);
+ if (gUnknown_0203AB88->var94 > 60.0f)
+ return;
+
+ m4aSongNumStartOrChange(SE_TAMAKORO_E);
+ gUnknown_0203AB88->var98 = -(20.0f / (float)gUnknown_0203AB88->var84);
+ gUnknown_0203AB88->var90 = ((1.0f - gUnknown_0203AB88->var8C) / (float)gUnknown_0203AB88->var84);
+ sprite->animNum = 1;
+ sprite->animBeginning = TRUE;
+ sprite->animEnded = FALSE;
+ sprite->data[1] = 2;
+ sprite->callback = sub_8144514;
+}
+
+static void sub_81446AC(struct Sprite *sprite)
+{
+ sprite->data[1] = 1;
+ sprite->data[2] = 0;
+ sub_8143B84(sprite);
+ sprite->invisible = FALSE;
+ sprite->callback = sub_81445D8;
+}
+
+static void sub_81446DC(struct Sprite *sprite)
+{
+ u16 t;
+ u8 i;
+ s16 s[2][2] = {
+ {116, 44},
+ {116, 112}
+ };
+ struct Roulette *p;
+
+ t = sprite->data[7] - 2;
+ p = gUnknown_0203AB88; // why???
+ gUnknown_0203AB88->var3C[55] = CreateSprite(&gSpriteTemplate_85B79F8, 36, -12, 50);
+ gUnknown_0203AB88->var3C[56] = CreateSprite(&gSpriteTemplate_85B7ABC[0], s[sprite->data[0]][0], s[sprite->data[0]][1], 59);
+ gUnknown_0203AB88->var3C[57] = CreateSprite(&gSpriteTemplate_85B7ABC[1], 36, 140, 51);
+ gSprites[gUnknown_0203AB88->var3C[57]].oam.objMode = 1;
+ for (i = 0; i < 3; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].coordOffsetEnabled = FALSE;
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].invisible = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].animPaused = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].affineAnimPaused = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].data[4] = gUnknown_0203AB88->var3C[55];
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].data[5] = gUnknown_0203AB88->var3C[56];
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].data[6] = gUnknown_0203AB88->var3C[57];
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].data[2] = t;
+ gSprites[gUnknown_0203AB88->var3C[i + 55]].data[3] = (sprite->data[7] * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01) +
+ (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 + 0xFFFF);
+ }
+ gSprites[gUnknown_0203AB88->var3C[56]].coordOffsetEnabled = TRUE;
+ gUnknown_0203AB88->var38 = sprite;
+}
+
+static void sub_81448B8(struct Sprite *sprite)
+{
+ u8 i = 0;
+ s16 t;
+ s16 s[2][2] = {
+ {256, 84},
+ {-16, 84}
+ };
+
+ t = sprite->data[7] - 2;
+ gUnknown_0203AB88->var3C[55] = CreateSprite(&gSpriteTemplate_85B7A10, s[sprite->data[0]][0], s[sprite->data[0]][1], 50);
+ StartSpriteAnim(&gSprites[gUnknown_0203AB88->var3C[55]], sprite->data[0]);
+ gUnknown_0203AB88->var3C[56] = CreateSprite(&gUnknown_085B7AEC, s[sprite->data[0]][0], s[sprite->data[0]][1], 51);
+ gSprites[gUnknown_0203AB88->var3C[56]].affineAnimPaused = TRUE;
+ gSprites[gUnknown_0203AB88->var3C[56]].animPaused = TRUE;
+ sprite->data[7] = (t * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01) + (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var10 + 45);
+ for (; i < 2; i++)
+ {
+ gSprites[gUnknown_0203AB88->var3C[55 + i]].data[4] = gUnknown_0203AB88->var3C[55];
+ gSprites[gUnknown_0203AB88->var3C[55 + i]].data[5] = gUnknown_0203AB88->var3C[56];
+ gSprites[gUnknown_0203AB88->var3C[55 + i]].data[6] = gUnknown_0203AB88->var3C[56];
+ gSprites[gUnknown_0203AB88->var3C[55 + i]].data[2] = t;
+ gSprites[gUnknown_0203AB88->var3C[55 + i]].data[3] = sprite->data[7] - 45;
+ }
+ gUnknown_0203AB88->var38 = sprite;
+}
+
+#ifdef NONMATCHING
+static void sub_8144A24(struct Sprite *sprite)
+{
+ u8 z;
+ u16 o;
+ u8 h = 0; // r10 (sp+0xc)
+ u8 j = 5; // r9 (r9)
+ u8 p = 0; // sp+0xc (sp+0x10)
+ u8 i;
+ u8 s[10] = {}; // sp+0 (sp+0)
+ u16 t = Random(); // sp+0x10 (r10)
+
+ gUnknown_0203AB88->var7D = 1;
+ gUnknown_0203AB88->var03_5 = TRUE;
+ gUnknown_0203AB88->var03_6 = FALSE;
+ gUnknown_0203AB88->var7E = 0xFF;
+ gUnknown_0203AB88->var88 = sprite->data[3];
+ gUnknown_0203AB88->var98 = 0.0f;
+ gUnknown_0203AB88->var8C = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var1C;
+ o = (gUnknown_0203AB88->var04_0 * 30 + 33) + (0x1 - gUnknown_0203AB88->var03_0) * 15;
+ for (i = 0; i < 4; i++)
+ {
+ if (o < sprite->data[3] && sprite->data[3] <= o + 90)
+ {
+ sprite->data[0] = i / 2;
+ gUnknown_0203AB88->var03_0 = i & 1;
+ break;
+ }
+ if (i == 3)
+ {
+ sprite->data[0] = 1;
+ gUnknown_0203AB88->var03_0 = 1;
+ break;
+ }
+ o += 90;
+ }
+ if (gUnknown_0203AB88->var03_0)
+ {
+ if (sprite->data[0])
+ {
+ PlayCry1(SPECIES_TAILLOW, -63);
+ }
+ else
+ {
+ PlayCry1(SPECIES_TAILLOW, 63);
+ }
+ }
+ else
+ {
+ PlayCry1(SPECIES_SHROOMISH, -63);
+ }
+ i = 2;
+ z = (gUnknown_0203AB88->var7F + 2) % 12;
+ if (gUnknown_0203AB88->var03_0 == 1 && gUnknown_0203AB88->var04_0 == 1)
+ j += 6;
+ else
+ j += i;
+ for (; i < j; i++)
+ {
+ if (!(gUnknown_0203AB88->var08 & gUnknown_085B62E4[z].var04))
+ {
+ s[h++] = i;
+ if (!p && (gUnknown_085B62E4[z].var04 & gUnknown_085B6154[gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]].var00))
+ {
+ p = i;
+ }
+ }
+ z = (z + 1) % 0xC;
+ }
+ if ((gUnknown_0203AB88->var03_0 + 1) & gUnknown_0203AB88->var02)
+ {
+ if (p && (t & 0xFF) < 0xc0)
+ {
+ sprite->data[7] = p;
+ }
+ else
+ {
+ sprite->data[7] = s[t % h];
+ }
+ }
+ else
+ {
+ sprite->data[7] = s[t % h];
+ }
+ sprite->callback = sub_8144168;
+}
+#else
+NAKED
+static void sub_8144A24(struct Sprite *sprite)
+{
+ asm_unified("push {r4-r7,lr}\n\
+ mov r7, r10\n\
+ mov r6, r9\n\
+ mov r5, r8\n\
+ push {r5-r7}\n\
+ sub sp, 0x14\n\
+ adds r7, r0, 0\n\
+ movs r0, 0\n\
+ mov r9, r0\n\
+ movs r1, 0x5\n\
+ mov r8, r1\n\
+ str r0, [sp, 0xC]\n\
+ mov r0, sp\n\
+ movs r1, 0\n\
+ movs r2, 0xA\n\
+ bl memset\n\
+ bl Random\n\
+ lsls r0, 16\n\
+ lsrs r0, 16\n\
+ str r0, [sp, 0x10]\n\
+ ldr r3, _08144B10 @ =gUnknown_0203AB88\n\
+ ldr r0, [r3]\n\
+ adds r0, 0x7D\n\
+ movs r5, 0x1\n\
+ strb r5, [r0]\n\
+ ldr r2, [r3]\n\
+ ldrb r0, [r2, 0x3]\n\
+ movs r1, 0x20\n\
+ orrs r0, r1\n\
+ strb r0, [r2, 0x3]\n\
+ ldr r2, [r3]\n\
+ ldrb r1, [r2, 0x3]\n\
+ movs r0, 0x41\n\
+ negs r0, r0\n\
+ ands r0, r1\n\
+ strb r0, [r2, 0x3]\n\
+ ldr r0, [r3]\n\
+ adds r0, 0x7E\n\
+ movs r1, 0xFF\n\
+ strb r1, [r0]\n\
+ ldr r6, [r3]\n\
+ adds r4, r6, 0\n\
+ adds r4, 0x88\n\
+ movs r1, 0x34\n\
+ ldrsh r0, [r7, r1]\n\
+ bl __floatsisf\n\
+ str r0, [r4]\n\
+ adds r1, r6, 0\n\
+ adds r1, 0x98\n\
+ ldr r0, _08144B14 @ =0x00000000\n\
+ str r0, [r1]\n\
+ adds r2, r6, 0\n\
+ adds r2, 0x8C\n\
+ ldr r1, _08144B18 @ =gUnknown_085B6348\n\
+ ldrb r0, [r6, 0x4]\n\
+ lsls r0, 30\n\
+ lsrs r0, 25\n\
+ adds r1, 0x1C\n\
+ adds r0, r1\n\
+ ldr r0, [r0]\n\
+ str r0, [r2]\n\
+ ldrb r0, [r6, 0x4]\n\
+ lsls r0, 30\n\
+ lsrs r0, 30\n\
+ lsls r1, r0, 4\n\
+ subs r1, r0\n\
+ lsls r1, 1\n\
+ adds r1, 0x21\n\
+ ldrb r0, [r6, 0x3]\n\
+ lsls r0, 27\n\
+ lsrs r0, 27\n\
+ subs r5, r0\n\
+ lsls r0, r5, 4\n\
+ subs r0, r5\n\
+ adds r1, r0\n\
+ lsls r1, 16\n\
+ lsrs r1, 16\n\
+ mov r5, r9\n\
+ movs r0, 0x34\n\
+ ldrsh r2, [r7, r0]\n\
+_08144ACA:\n\
+ cmp r1, r2\n\
+ bge _08144AD6\n\
+ adds r0, r1, 0\n\
+ adds r0, 0x5A\n\
+ cmp r2, r0\n\
+ ble _08144B38\n\
+_08144AD6:\n\
+ cmp r5, 0x3\n\
+ beq _08144B1C\n\
+ adds r0, r1, 0\n\
+ adds r0, 0x5A\n\
+ lsls r0, 16\n\
+ lsrs r1, r0, 16\n\
+ adds r0, r5, 0x1\n\
+ lsls r0, 24\n\
+ lsrs r5, r0, 24\n\
+ cmp r5, 0x3\n\
+ bls _08144ACA\n\
+_08144AEC:\n\
+ ldr r0, _08144B10 @ =gUnknown_0203AB88\n\
+ ldr r0, [r0]\n\
+ ldrb r1, [r0, 0x3]\n\
+ movs r0, 0x1F\n\
+ ands r0, r1\n\
+ cmp r0, 0\n\
+ beq _08144B64\n\
+ movs r1, 0x2E\n\
+ ldrsh r0, [r7, r1]\n\
+ cmp r0, 0\n\
+ beq _08144B58\n\
+ movs r0, 0x98\n\
+ lsls r0, 1\n\
+ movs r1, 0x3F\n\
+ negs r1, r1\n\
+ bl PlayCry1\n\
+ b _08144B70\n\
+ .align 2, 0\n\
+_08144B10:\n\
+ .4byte gUnknown_0203AB88\n\
+_08144B14:\n\
+ .4byte 0x00000000\n\
+_08144B18:\n\
+ .4byte gUnknown_085B6348\n\
+_08144B1C:\n\
+ movs r0, 0x1\n\
+ strh r0, [r7, 0x2E]\n\
+ ldr r0, =gUnknown_0203AB88\n\
+ ldr r2, [r0]\n\
+ ldrb r1, [r2, 0x3]\n\
+ movs r0, 0x20\n\
+ negs r0, r0\n\
+ ands r0, r1\n\
+ movs r1, 0x1\n\
+ orrs r0, r1\n\
+ strb r0, [r2, 0x3]\n\
+ b _08144AEC\n\
+ .pool\n\
+_08144B38:\n\
+ lsrs r0, r5, 1\n\
+ strh r0, [r7, 0x2E]\n\
+ ldr r0, =gUnknown_0203AB88\n\
+ ldr r3, [r0]\n\
+ movs r1, 0x1\n\
+ ands r1, r5\n\
+ ldrb r2, [r3, 0x3]\n\
+ movs r0, 0x20\n\
+ negs r0, r0\n\
+ ands r0, r2\n\
+ orrs r0, r1\n\
+ strb r0, [r3, 0x3]\n\
+ b _08144AEC\n\
+ .pool\n\
+_08144B58:\n\
+ movs r0, 0x98\n\
+ lsls r0, 1\n\
+ movs r1, 0x3F\n\
+ bl PlayCry1\n\
+ b _08144B70\n\
+_08144B64:\n\
+ movs r0, 0x99\n\
+ lsls r0, 1\n\
+ movs r1, 0x3F\n\
+ negs r1, r1\n\
+ bl PlayCry1\n\
+_08144B70:\n\
+ movs r0, 0x2\n\
+ mov r10, r0\n\
+ ldr r4, =gUnknown_0203AB88\n\
+ ldr r5, [r4]\n\
+ adds r0, r5, 0\n\
+ adds r0, 0x7F\n\
+ ldrb r0, [r0]\n\
+ adds r0, 0x2\n\
+ movs r1, 0xC\n\
+ bl __modsi3\n\
+ lsls r0, 24\n\
+ lsrs r6, r0, 24\n\
+ ldrb r1, [r5, 0x3]\n\
+ movs r0, 0x1F\n\
+ ands r0, r1\n\
+ cmp r0, 0x1\n\
+ bne _08144BA8\n\
+ ldrb r1, [r5, 0x4]\n\
+ movs r0, 0x3\n\
+ ands r0, r1\n\
+ cmp r0, 0x1\n\
+ bne _08144BA8\n\
+ mov r0, r8\n\
+ adds r0, 0x6\n\
+ b _08144BAC\n\
+ .pool\n\
+_08144BA8:\n\
+ mov r0, r8\n\
+ add r0, r10\n\
+_08144BAC:\n\
+ lsls r0, 24\n\
+ lsrs r0, 24\n\
+ mov r8, r0\n\
+ mov r5, r10\n\
+ cmp r5, r8\n\
+ bcs _08144C18\n\
+ ldr r1, =gUnknown_085B6154+0xC\n\
+ mov r10, r1\n\
+_08144BBC:\n\
+ ldr r3, [r4]\n\
+ lsls r0, r6, 3\n\
+ ldr r1, =gUnknown_085B62E4+0x4\n\
+ adds r0, r1\n\
+ ldr r1, [r3, 0x8]\n\
+ ldr r2, [r0]\n\
+ ands r1, r2\n\
+ cmp r1, 0\n\
+ bne _08144C02\n\
+ mov r0, r9\n\
+ adds r1, r0, 0x1\n\
+ lsls r1, 24\n\
+ lsrs r1, 24\n\
+ mov r9, r1\n\
+ add r0, sp\n\
+ strb r5, [r0]\n\
+ ldr r0, [sp, 0xC]\n\
+ cmp r0, 0\n\
+ bne _08144C02\n\
+ ldrb r1, [r3, 0x1A]\n\
+ lsls r1, 28\n\
+ lsrs r1, 28\n\
+ adds r0, r3, 0\n\
+ adds r0, 0x1B\n\
+ adds r0, r1\n\
+ ldrb r1, [r0]\n\
+ lsls r0, r1, 2\n\
+ adds r0, r1\n\
+ lsls r0, 2\n\
+ add r0, r10\n\
+ ldr r0, [r0]\n\
+ ands r2, r0\n\
+ cmp r2, 0\n\
+ beq _08144C02\n\
+ str r5, [sp, 0xC]\n\
+_08144C02:\n\
+ adds r0, r6, 0x1\n\
+ movs r1, 0xC\n\
+ bl __modsi3\n\
+ lsls r0, 24\n\
+ lsrs r6, r0, 24\n\
+ adds r0, r5, 0x1\n\
+ lsls r0, 24\n\
+ lsrs r5, r0, 24\n\
+ cmp r5, r8\n\
+ bcc _08144BBC\n\
+_08144C18:\n\
+ ldr r0, [r4]\n\
+ ldrb r1, [r0, 0x3]\n\
+ lsls r1, 27\n\
+ lsrs r1, 27\n\
+ adds r1, 0x1\n\
+ ldrb r0, [r0, 0x2]\n\
+ ands r1, r0\n\
+ cmp r1, 0\n\
+ beq _08144C48\n\
+ ldr r1, [sp, 0xC]\n\
+ cmp r1, 0\n\
+ beq _08144C48\n\
+ movs r0, 0xFF\n\
+ ldr r1, [sp, 0x10]\n\
+ ands r0, r1\n\
+ cmp r0, 0xBF\n\
+ bhi _08144C48\n\
+ mov r0, sp\n\
+ ldrh r0, [r0, 0xC]\n\
+ b _08144C54\n\
+ .pool\n\
+_08144C48:\n\
+ ldr r0, [sp, 0x10]\n\
+ mov r1, r9\n\
+ bl __modsi3\n\
+ add r0, sp\n\
+ ldrb r0, [r0]\n\
+_08144C54:\n\
+ strh r0, [r7, 0x3C]\n\
+ ldr r1, =sub_8144168\n\
+ str r1, [r7, 0x1C]\n\
+ add sp, 0x14\n\
+ pop {r3-r5}\n\
+ mov r8, r3\n\
+ mov r9, r4\n\
+ mov r10, r5\n\
+ pop {r4-r7}\n\
+ pop {r0}\n\
+ bx r0\n\
+ .pool");
+}
+#endif // NONMATCHING
+
+static const u16 gUnknown_085B7B1A[] = {
+ 0x907,
+ 0x808,
+ 0x709,
+ 0x60A,
+ 0x50B,
+ 0x40C,
+ 0x30D,
+ 0x20E,
+ 0x10F,
+ 0x010,
+};
+
+static void sub_8144C70(struct Sprite *sprite)
+{
+ if (sprite->data[1]++ >= sprite->data[3])
+ {
+ sprite->pos1.x -= 2;
+ if (sprite->pos1.x < -16)
+ {
+ if (!gUnknown_0203AB88->var03_6)
+ gUnknown_0203AB88->var03_6 = TRUE;
+ DestroySprite(sprite);
+ gUnknown_0203AB88->var01 = 0;
+ gUnknown_0203AB88->var34 = gUnknown_085B7B1A[0];
+ }
+ }
+}
+
+static void sub_8144CD0(struct Sprite *sprite)
+{
+ int p;
+ u16 t[][4] = {
+ {-1, 0, 1, 0},
+ {-2, 0, 2, 0},
+ {-3, 0, 3, 0},
+ };
+
+ if (sprite->data[1]++ < sprite->data[3])
+ {
+ if (sprite->data[1] & 1)
+ {
+ gSpriteCoordOffsetY = t[sprite->data[2] / 2][sprite->data[7]];
+ p = sprite->data[7] + 1;
+ sprite->data[7] = p - ((p / 4) * 4);
+ }
+ sprite->invisible ^= 1;
+ }
+ else
+ {
+ gSpriteCoordOffsetY = 0;
+ gSprites[gUnknown_0203AB88->var3C[55]].animPaused = FALSE;
+ DestroySprite(sprite);
+ }
+}
+
+static void sub_8144D94(struct Sprite *sprite)
+{
+ float t;
+ sprite->data[1]++;
+ t = sprite->data[1];
+ sprite->pos2.y = t * 0.039f * t;
+ gUnknown_0203AB88->var34 = gUnknown_085B7B1A[(gUnknown_0203AB88->var01 - 1) / 2];
+ if (gUnknown_0203AB88->var01 < 19)
+ gUnknown_0203AB88->var01++;
+ if (sprite->data[1] > 60)
+ {
+ sprite->data[1] = 0;
+ sprite->callback = sub_8144C70;
+ gSprites[sprite->data[6]].callback = sub_8144C70;
+ gSprites[sprite->data[6]].data[1] = -2;
+ gSprites[sprite->data[5]].invisible = FALSE;
+ gSprites[sprite->data[5]].callback = sub_8144CD0;
+ m4aSongNumStart(SE_W070);
+ }
+}
+
+static void sub_8144E60(struct Sprite *sprite)
+{
+ if (sprite->data[7] == 0)
+ {
+ if (gUnknown_0203AB88->var38->data[0] == 0)
+ {
+ if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08)
+ return;
+ }
+ else
+ {
+ if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08 + 180)
+ return;
+ }
+
+ sprite->invisible = FALSE;
+ sprite->data[7]++;
+ m4aSongNumStart(SE_RU_HYUU);
+ gUnknown_0203AB88->var01 = 1;
+ gUnknown_0203AB88->var34 = gUnknown_085B7B1A[0];
+ }
+ else
+ {
+ gUnknown_0203AB88->var34 = gUnknown_085B7B1A[(gUnknown_0203AB88->var01 - 1) / 2];
+ if (gUnknown_0203AB88->var01 < 19)
+ gUnknown_0203AB88->var01++;
+
+ if (gUnknown_0203AB88->var38->data[0] == 0)
+ {
+ if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A)
+ return;
+ }
+ else
+ {
+ if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A + 180)
+ return;
+ }
+
+ gSprites[sprite->data[4]].callback = sub_8144D94;
+ gSprites[sprite->data[4]].invisible = FALSE;
+ sprite->callback = &SpriteCallbackDummy;
+ sprite->data[7] = 0;
+ }
+}
+
+static void sub_8144F94(struct Sprite *sprite)
+{
+ sprite->invisible ^= 1;
+}
+
+static void sub_8144FB0(struct Sprite *sprite)
+{
+ if (sprite->pos1.y > -16)
+ {
+ sprite->pos1.y--;
+ }
+ else
+ {
+ sprite->callback = SpriteCallbackDummy;
+ sprite->invisible = TRUE;
+ sprite->animPaused = TRUE;
+ m4aSongNumStop(SE_BASABASA);
+ DestroySprite(sprite);
+ FreeOamMatrix(gSprites[gUnknown_0203AB88->var3C[56]].oam.matrixNum);
+ DestroySprite(&gSprites[gUnknown_0203AB88->var3C[56]]);
+ }
+}
+
+static void sub_8145030(struct Sprite *sprite)
+{
+ if (sprite->data[1] >= 0)
+ {
+ sprite->data[1]--;
+ sprite->pos1.y--;
+ if (sprite->data[1] == 0 && sprite->animCmdIndex == 1)
+ sprite->pos2.y++;
+ }
+ else
+ {
+ if (sprite->data[3] >= 0)
+ {
+ sprite->data[3]--;
+ if (sprite->animDelayCounter == 0)
+ {
+ if (sprite->animCmdIndex == 1)
+ sprite->pos2.y++;
+ else
+ sprite->pos2.y--;
+ }
+ }
+ else
+ {
+ m4aSongNumStart(SE_RU_HYUU);
+ StartSpriteAnim(sprite, gUnknown_0203AB88->var38->data[0] + 4);
+ sprite->callback = sub_8144FB0;
+ gSprites[sprite->data[6]].affineAnimPaused = FALSE;
+ }
+ }
+}
+
+static void sub_81450D8(struct Sprite *sprite)
+{
+ s8 t[2] = {-1, 1};
+ s8 z[][2] = {
+ {2, 0},
+ {2, 0},
+ {2, -1},
+ {2, -1},
+ {2, -1},
+ {2, -1},
+ {2, -2},
+ {2, -2},
+ };
+
+ if (sprite->data[1]-- > 7)
+ {
+ sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * 2;
+ if (IsSEPlaying())
+ {
+ s8 pan = -((116 - sprite->pos1.x) / 2);
+ m4aMPlayPanpotControl(&gMPlayInfo_SE1, 0xFFFF, pan);
+ m4aMPlayPanpotControl(&gMPlayInfo_SE2, 0xFFFF, pan);
+ }
+ }
+ else
+ {
+ if (sprite->data[1] >= 0)
+ {
+ sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * z[7 - sprite->data[1]][0];
+ sprite->pos1.y += z[7 - sprite->data[1]][1];
+ }
+ else
+ {
+ m4aSongNumStartOrChange(SE_BASABASA);
+ if (gUnknown_0203AB88->var38->data[0] == 0)
+ PlayCry1(SPECIES_TAILLOW, 63);
+ else
+ PlayCry1(SPECIES_TAILLOW, -63);
+ StartSpriteAnim(sprite, gUnknown_0203AB88->var38->data[0] + 2);
+ sprite->data[1] = 45;
+ sprite->callback = sub_8145030;
+ }
+ }
+}
+
+static void sub_8145218(struct Sprite *sprite)
+{
+ s8 t[2] = {-1, 1};
+
+ if (sprite->data[1]-- >= 0)
+ {
+ sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * 2;
+ gSprites[sprite->data[6]].invisible ^= 1;
+ }
+ else
+ {
+ sprite->callback = sub_8144F94;
+ }
+}
+
+static void sub_8145294(struct Sprite *sprite)
+{
+ if (gUnknown_0203AB88->var38->data[0] == 0)
+ {
+ if (gUnknown_0203AB88->var38->data[3] == gUnknown_085B6348[gUnknown_0203AB88->var04_0].var12 + 90)
+ {
+ gSprites[sprite->data[6]].data[1] = 52;
+ gSprites[sprite->data[4]].data[1] = 52;
+ }
+ else
+ {
+ return;
+ }
+ }
+ else
+ {
+ if (gUnknown_0203AB88->var38->data[3] == gUnknown_085B6348[gUnknown_0203AB88->var04_0].var14 + 270)
+ {
+ gSprites[sprite->data[6]].data[1] = 46;
+ gSprites[sprite->data[4]].data[1] = 46;
+ }
+ else
+ {
+ return;
+ }
+ }
+ gSprites[sprite->data[6]].callback = sub_8145218;
+ gSprites[sprite->data[4]].callback = sub_81450D8;
+ m4aSongNumStart(SE_RU_HYUU);
+}
diff --git a/src/roulette_util.c b/src/roulette_util.c
index c556a4af5..9531302d9 100755
--- a/src/roulette_util.c
+++ b/src/roulette_util.c
@@ -11,7 +11,7 @@ void sub_8151678(struct UnkStruct0 *r0)
memset(&r0->var04, 0, sizeof(r0->var04));
}
-u8 sub_815168C(struct UnkStruct0 *r0, u8 r1, struct UnkStruct1 *r2)
+u8 sub_815168C(struct UnkStruct0 *r0, u8 r1, const struct UnkStruct1 *r2)
{
if (!(r1 < 16) || (r0->var04[r1].var00_7))
return 0xFF;
diff --git a/src/rtc.c b/src/rtc.c
index 3f413d0e3..37a06fe7e 100644
--- a/src/rtc.c
+++ b/src/rtc.c
@@ -340,7 +340,7 @@ u32 RtcGetMinuteCount(void)
return (24 * 60) * RtcGetDayCount(&sRtc) + 60 * sRtc.hour + sRtc.minute;
}
-u16 RtcGetLocalDayCount(void)
+u32 RtcGetLocalDayCount(void)
{
return RtcGetDayCount(&sRtc);
}
diff --git a/src/script_menu.c b/src/script_menu.c
index 6f16b1a8a..d415d65a9 100644
--- a/src/script_menu.c
+++ b/src/script_menu.c
@@ -1416,7 +1416,7 @@ static void sub_80E2578(void)
{
gUnknown_03001124[temp] = 0;
temp++;
- if (FlagGet(FLAG_0x1D0) == TRUE)
+ if (FlagGet(FLAG_MET_SCOTT_ON_SS_TIDAL) == TRUE)
{
gUnknown_03001124[temp] = 1;
temp++;
@@ -1431,15 +1431,15 @@ static void sub_80E2578(void)
temp++;
}
- if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_0x1AE) == FALSE)
+ if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_EON_TICKET) == FALSE)
{
gUnknown_03001124[temp] = 2;
temp++;
- FlagSet(FLAG_0x1AE);
+ FlagSet(FLAG_HAS_EON_TICKET);
}
}
- if (CheckBagHasItem(ITEM_MYSTIC_TICKET, 1) == TRUE && FlagGet(FLAG_0x8E0) == TRUE)
+ if (CheckBagHasItem(ITEM_MYSTIC_TICKET, 1) == TRUE && FlagGet(FLAG_ENABLE_SHIP_NAVEL_ROCK) == TRUE)
{
if (gSpecialVar_0x8004 == 0)
{
@@ -1447,15 +1447,15 @@ static void sub_80E2578(void)
temp++;
}
- if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_0x1DB) == FALSE)
+ if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_MYSTIC_TICKET) == FALSE)
{
gUnknown_03001124[temp] = 3;
temp++;
- FlagSet(FLAG_0x1DB);
+ FlagSet(FLAG_HAS_MYSTIC_TICKET);
}
}
- if (CheckBagHasItem(ITEM_AURORA_TICKET, 1) == TRUE && FlagGet(FLAG_0x8D5) == TRUE)
+ if (CheckBagHasItem(ITEM_AURORA_TICKET, 1) == TRUE && FlagGet(FLAG_ENABLE_SHIP_BIRTH_ISLAND) == TRUE)
{
if (gSpecialVar_0x8004 == 0)
{
@@ -1463,15 +1463,15 @@ static void sub_80E2578(void)
temp++;
}
- if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_0x1AF) == FALSE)
+ if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_AURORA_TICKET) == FALSE)
{
gUnknown_03001124[temp] = 4;
temp++;
- FlagSet(FLAG_0x1AF);
+ FlagSet(FLAG_HAS_AURORA_TICKET);
}
}
- if (CheckBagHasItem(ITEM_OLD_SEA_MAP, 1) == TRUE && FlagGet(FLAG_0x8D6) == TRUE)
+ if (CheckBagHasItem(ITEM_OLD_SEA_MAP, 1) == TRUE && FlagGet(FLAG_ENABLE_SHIP_FARAWAY_ISLAND) == TRUE)
{
if (gSpecialVar_0x8004 == 0)
{
@@ -1479,18 +1479,18 @@ static void sub_80E2578(void)
temp++;
}
- if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_0x1B0) == FALSE)
+ if (gSpecialVar_0x8004 == 1 && FlagGet(FLAG_HAS_OLD_SEA_MAP) == FALSE)
{
gUnknown_03001124[temp] = 5;
temp++;
- FlagSet(FLAG_0x1B0);
+ FlagSet(FLAG_HAS_OLD_SEA_MAP);
}
}
gUnknown_03001124[temp] = 6;
temp++;
- if (gSpecialVar_0x8004 == 0 && FlagGet(FLAG_0x1D0) == TRUE)
+ if (gSpecialVar_0x8004 == 0 && FlagGet(FLAG_MET_SCOTT_ON_SS_TIDAL) == TRUE)
{
count = temp;
}
diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c
index 15e91ac98..f3eaa7161 100755
--- a/src/script_pokemon_util_80F87D8.c
+++ b/src/script_pokemon_util_80F87D8.c
@@ -228,7 +228,7 @@ void sub_80F8AFC(void)
if (gIsLinkContest & 1)
{
- for (i = 0; i < gUnknown_02039F30; i++)
+ for (i = 0; i < gNumLinkContestPlayers; i++)
{
int version = (u8)gLinkPlayers[i].version;
if (version == VERSION_RUBY || version == VERSION_SAPPHIRE)
@@ -257,7 +257,7 @@ void sub_80F8B94(void)
gReservedSpritePaletteCount = 12;
if (gIsLinkContest & 1)
{
- for (i = 0; i < gUnknown_02039F30; i++)
+ for (i = 0; i < gNumLinkContestPlayers; i++)
{
eventObjectId = GetEventObjectIdByLocalIdAndMap(gUnknown_0858D8EC[i], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
sprite = &gSprites[gEventObjects[eventObjectId].spriteId];
@@ -285,14 +285,14 @@ u8 GiveMonArtistRibbon(void)
{
u8 hasArtistRibbon;
- hasArtistRibbon = GetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_ARTIST_RIBBON);
+ hasArtistRibbon = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_ARTIST_RIBBON);
if (!hasArtistRibbon && gContestFinalStandings[gContestPlayerMonIndex] == 0 && gSpecialVar_ContestRank == 3
&& gUnknown_02039F08[gContestPlayerMonIndex] >= 800)
{
hasArtistRibbon = 1;
- SetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_ARTIST_RIBBON, &hasArtistRibbon);
- if (GetRibbonCount(&gPlayerParty[gUnknown_02039F24]) > 4)
- sub_80EE4DC(&gPlayerParty[gUnknown_02039F24], MON_DATA_ARTIST_RIBBON);
+ SetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_ARTIST_RIBBON, &hasArtistRibbon);
+ if (GetRibbonCount(&gPlayerParty[gContestMonPartyIndex]) > 4)
+ sub_80EE4DC(&gPlayerParty[gContestMonPartyIndex], MON_DATA_ARTIST_RIBBON);
return 1;
}
@@ -402,7 +402,7 @@ static void sub_80F8EE8(u8 taskId)
void ScriptGetMultiplayerId(void)
{
- if ((gIsLinkContest & 1) && gUnknown_02039F30 == 4 && !(gIsLinkContest & 2))
+ if ((gIsLinkContest & 1) && gNumLinkContestPlayers == 4 && !(gIsLinkContest & 2))
gSpecialVar_Result = GetMultiplayerId();
else
gSpecialVar_Result = 4;
diff --git a/src/secret_base.c b/src/secret_base.c
index d6e42505e..b99a7c7d5 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -1033,7 +1033,7 @@ void sub_80E9FFC(u8 taskId)
void sub_80EA06C(u8 taskId)
{
DisplayYesNoMenu();
- sub_8121F68(taskId, &gUnknown_0858D058);
+ DoYesNoFuncWithChoice(taskId, &gUnknown_0858D058);
}
void sub_80EA08C(u8 taskId)
diff --git a/src/strings.c b/src/strings.c
index bd8c766de..7b2b5ca4c 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -390,7 +390,7 @@ const u8 gText_RemoveMailBeforeItem[] = _("MAIL must be removed before\nholding
const u8 gText_PkmnWasGivenItem[] = _("{STR_VAR_1} was given the\n{STR_VAR_2} to hold.{PAUSE_UNTIL_PRESS}");
const u8 gText_SwitchPkmnItem[] = _("{STR_VAR_1} is already holding\none {STR_VAR_2}.\pWould you like to switch the\ntwo items?");
const u8 gText_PkmnNotHolding[] = _("{STR_VAR_1} isn't holding\nanything.{PAUSE_UNTIL_PRESS}");
-const u8 gText_RecievedItemFromPkmn[] = _("Received the {STR_VAR_2}\nfrom {STR_VAR_1}.{PAUSE_UNTIL_PRESS}");
+const u8 gText_ReceivedItemFromPkmn[] = _("Received the {STR_VAR_2}\nfrom {STR_VAR_1}.{PAUSE_UNTIL_PRESS}");
const u8 gText_MailTakenFromPkmn[] = _("MAIL was taken from the\nPOKéMON.{PAUSE_UNTIL_PRESS}");
const u8 gText_SwitchedPkmnItem[] = _("The {STR_VAR_2} was taken and\nreplaced with the {STR_VAR_1}.{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnHoldingItemCantHoldMail[] = _("This POKéMON is holding an\nitem. It cannot hold MAIL.{PAUSE_UNTIL_PRESS}");
diff --git a/src/trade.c b/src/trade.c
index ccdd43986..7af1e19c9 100644
--- a/src/trade.c
+++ b/src/trade.c
@@ -3491,13 +3491,12 @@ static u32 sub_807A5F4(struct Pokemon *monList, int a1, int monIdx)
}
}
-#ifdef NONMATCHING
s32 sub_807A728(void)
{
s32 val;
u16 version;
- if (gReceivedRemoteLinkPlayers)
+ if (gReceivedRemoteLinkPlayers != 0)
{
val = 0;
version = (gLinkPlayers[GetMultiplayerId() ^ 1].version & 0xFF);
@@ -3536,83 +3535,6 @@ s32 sub_807A728(void)
}
return 0;
}
-#else
-NAKED
-s32 sub_807A728(void)
-{
- asm_unified("push {r4-r7,lr}\n\
- ldr r0, =gReceivedRemoteLinkPlayers\n\
- ldrb r0, [r0]\n\
- cmp r0, 0\n\
- beq _0807A7B4\n\
- movs r4, 0\n\
- bl GetMultiplayerId\n\
- ldr r5, =gLinkPlayers\n\
- movs r7, 0x1\n\
- eors r0, r7\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- lsls r1, r0, 3\n\
- subs r1, r0\n\
- lsls r1, 2\n\
- adds r1, r5\n\
- ldrb r1, [r1]\n\
- subs r0, r1, 0x1\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- cmp r0, 0x2\n\
- bls _0807A7B4\n\
- subs r0, r1, 0x4\n\
- lsls r0, 16\n\
- lsrs r0, 16\n\
- cmp r0, 0x1\n\
- bhi _0807A762\n\
- movs r4, 0x2\n\
-_0807A762:\n\
- cmp r4, 0\n\
- ble _0807A7B4\n\
- bl GetMultiplayerId\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- lsls r1, r0, 3\n\
- subs r1, r0\n\
- lsls r1, 2\n\
- adds r1, r5\n\
- ldrb r1, [r1, 0x12]\n\
- movs r6, 0xF0\n\
- adds r0, r6, 0\n\
- ands r0, r1\n\
- cmp r0, 0\n\
- beq _0807A7B0\n\
- cmp r4, 0x2\n\
- bne _0807A7B4\n\
- bl GetMultiplayerId\n\
- eors r0, r7\n\
- lsls r0, 24\n\
- lsrs r0, 24\n\
- lsls r1, r0, 3\n\
- subs r1, r0\n\
- lsls r1, 2\n\
- adds r1, r5\n\
- ldrb r1, [r1, 0x12]\n\
- adds r0, r6, 0\n\
- ands r0, r1\n\
- cmp r0, 0\n\
- bne _0807A7B4\n\
- movs r0, 0x2\n\
- b _0807A7B6\n\
- .pool\n\
-_0807A7B0:\n\
- movs r0, 0x1\n\
- b _0807A7B6\n\
-_0807A7B4:\n\
- movs r0, 0\n\
-_0807A7B6:\n\
- pop {r4-r7}\n\
- pop {r1}\n\
- bx r1");
-}
-#endif // NONMATCHING
static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isObedientBitSet)
{
@@ -3675,7 +3597,7 @@ int sub_807A7E0(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuS
{
return 6;
}
-
+
if (!IsSpeciesInHoennDex(species1))
{
return 4;
@@ -3745,7 +3667,7 @@ int sub_807A918(struct Pokemon *mon, u16 monIdx)
version = gLinkPlayers[i].version & 0xFF;
if (version == VERSION_FIRE_RED ||
version == VERSION_LEAF_GREEN)
- {
+ {
versions = 0;
}
else
@@ -3761,7 +3683,7 @@ int sub_807A918(struct Pokemon *mon, u16 monIdx)
{
unk = 0;
}
-
+
if (versions && (player->name[8] / 16))
{
unk = 0;
@@ -3774,7 +3696,7 @@ int sub_807A918(struct Pokemon *mon, u16 monIdx)
{
return 2;
}
-
+
if (speciesArray[monIdx] == SPECIES_NONE)
{
return 3;
@@ -4487,7 +4409,7 @@ static void sub_807B62C(u8 a0)
BGCNT_16COLOR |
BGCNT_SCREENBASE(18) |
BGCNT_TXT256x512);
-
+
if (gUnknown_020322A0->unk_FA)
{
DmaCopy16Defvars(3, gUnknown_083369A0, (void *) BG_SCREEN_ADDR(5), 0x1000);
@@ -4553,7 +4475,7 @@ static void sub_807B62C(u8 a0)
gUnknown_020322A0->unk_EC = 0;
DmaCopyLarge16(3, gUnknown_08332F60, (void *) BG_CHAR_ADDR(1), 0x2840, 0x1000);
-
+
if (gUnknown_020322A0->unk_FA)
{
DmaCopy16Defvars(3, gUnknown_083357A0, (void *) BG_SCREEN_ADDR(18), 0x100);
@@ -4586,7 +4508,7 @@ static void sub_807B62C(u8 a0)
gUnknown_020322A0->unk_EC = 0;
DmaCopyLarge16(3, gUnknown_08332F60, (void *) BG_CHAR_ADDR(1), 0x2840, 0x1000);
-
+
if (gUnknown_020322A0->unk_FA)
{
DmaCopy16Defvars(3, gUnknown_083357A0, (void *) BG_SCREEN_ADDR(18), 0x100);
@@ -6227,7 +6149,7 @@ static void c3_0805465C(u8 taskId)
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE2(gUnknown_020322A0->unk_FB, gUnknown_020322A0->unk_FD));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE2(gUnknown_020322A0->unk_FC, gUnknown_020322A0->unk_FE));
-
+
data[0]++;
gUnknown_020322A0->unk_FB -= 5;
gUnknown_020322A0->unk_FD += 5;
@@ -6254,7 +6176,7 @@ static void sub_807F39C(u8 taskId)
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE2(gUnknown_020322A0->unk_FB, gUnknown_020322A0->unk_FD));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE2(gUnknown_020322A0->unk_FC, gUnknown_020322A0->unk_FE));
-
+
if (gUnknown_020322A0->unk_FB != 120)
{
data[0]++;
diff --git a/src/tv.c b/src/tv.c
index 27e2922f4..dfb4a3a64 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -1262,7 +1262,7 @@ static void InterviewAfter_ContestLiveUpdates(void)
show2->contestLiveUpdates.active = TRUE;
StringCopy(show2->contestLiveUpdates.playerName, gSaveBlock2Ptr->playerName);
show2->contestLiveUpdates.category = gSpecialVar_ContestCategory;
- show2->contestLiveUpdates.species = GetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_SPECIES, NULL);
+ show2->contestLiveUpdates.species = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES, NULL);
show2->contestLiveUpdates.winningSpecies = show->contestLiveUpdates.winningSpecies;
show2->contestLiveUpdates.appealFlags2 = show->contestLiveUpdates.appealFlags2;
show2->contestLiveUpdates.round1Rank = show->contestLiveUpdates.round1Rank;
@@ -1453,7 +1453,7 @@ void ContestLiveUpdates_BeforeInterview_5(u8 a0, u8 a1)
StringCopy(show->contestLiveUpdates.winningTrainerName, gContestMons[a1].trainerName);
StripExtCtrlCodes(show->contestLiveUpdates.winningTrainerName);
show->contestLiveUpdates.appealFlags2 = a0;
- if (a1 + 1 > gUnknown_02039F30)
+ if (a1 + 1 > gNumLinkContestPlayers)
{
show->contestLiveUpdates.winningTrainerLanguage = gLinkPlayers[0].language;
}
@@ -1516,7 +1516,7 @@ void BravoTrainerPokemonProfile_BeforeInterview1(u16 a0)
}
}
-void BravoTrainerPokemonProfile_BeforeInterview2(u8 a0)
+void BravoTrainerPokemonProfile_BeforeInterview2(u8 contestStandingPlace)
{
TVShow *show;
@@ -1524,13 +1524,13 @@ void BravoTrainerPokemonProfile_BeforeInterview2(u8 a0)
sCurTVShowSlot = FindEmptyTVSlotWithinFirstFiveShowsOfArray(gSaveBlock1Ptr->tvShows);
if (sCurTVShowSlot != -1)
{
- show->bravoTrainer.contestResult = a0;
+ show->bravoTrainer.contestResult = contestStandingPlace;
show->bravoTrainer.contestCategory = gSpecialVar_ContestCategory;
show->bravoTrainer.contestRank = gSpecialVar_ContestRank;
- show->bravoTrainer.species = GetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_SPECIES, NULL);
- GetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_NICKNAME, show->bravoTrainer.pokemonNickname);
+ show->bravoTrainer.species = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES, NULL);
+ GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_NICKNAME, show->bravoTrainer.pokemonNickname);
StripExtCtrlCodes(show->bravoTrainer.pokemonNickname);
- show->bravoTrainer.pokemonNameLanguage = GetMonData(&gPlayerParty[gUnknown_02039F24], MON_DATA_LANGUAGE);
+ show->bravoTrainer.pokemonNameLanguage = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_LANGUAGE);
}
}
@@ -3538,7 +3538,7 @@ u8 CheckForBigMovieOrEmergencyNewsOnTV(void)
return 0;
}
}
- if (FlagGet(FLAG_SYS_TV_LATI) == TRUE)
+ if (FlagGet(FLAG_SYS_TV_LATIAS_LATIOS) == TRUE)
{
return 1;
}