mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 21:33:53 +01:00
Rename and document more contest setup functions
Also properly label the link contest flags variable, and label the contest window ID's.
This commit is contained in:
parent
f82bdb332a
commit
3a2ea40188
@ -3460,7 +3460,7 @@ EventScript_GotoTrainerScript:: @ 82742F6
|
||||
gUnknown_0827E8CE:: @ 827E8CE
|
||||
.string "Missed turn$"
|
||||
|
||||
gUnknown_0827E8DA:: @ 827E8DA
|
||||
gText_LinkStandby4:: @ 827E8DA
|
||||
.string "Link standby!$"
|
||||
|
||||
gUnknown_0827E8E8:: @ 827E8E8
|
||||
|
@ -14,6 +14,10 @@
|
||||
// Prints the ContestResourcesField1C::unk_D value as a bitstring for each contestant.
|
||||
#define CONTEST_DEBUG_MODE_PRINT_UNK_D 3
|
||||
|
||||
#define LINK_CONTEST_FLAG_IS_LINK (1 << 0)
|
||||
#define LINK_CONTEST_FLAG_IS_WIRELESS (1 << 1)
|
||||
#define LINK_CONTEST_FLAG_HAS_RS_PLAYER (1 << 2)
|
||||
|
||||
enum
|
||||
{
|
||||
CONTEST_CATEGORY_COOL,
|
||||
@ -250,7 +254,7 @@ struct ContestPokemon
|
||||
|
||||
struct Shared1A004
|
||||
{
|
||||
u16 unk18004[16][16]; // Saved palette data before a move happens?
|
||||
u16 cachedWindowPalettes[16][16]; // Saved palette data before a move happens?
|
||||
u16 unk18204[PLTT_BUFFER_SIZE]; // Saved copy of gPlttBufferUnfaded
|
||||
u16 unk18604[PLTT_BUFFER_SIZE]; // Saved copy of gPlttBufferFaded
|
||||
u8 savedJunk[0x800];
|
||||
@ -297,7 +301,7 @@ struct Contest
|
||||
u16 unk19220[5][4]; // move history?
|
||||
u8 unk19248[5][4]; // excitement history
|
||||
u8 applauseMeterSpriteId; // sprite ID
|
||||
/*0x1925D*/ u8 unk1925D;
|
||||
/*0x1925D*/ u8 contestSetupState;
|
||||
/*0x1925E*/ u8 unk1925E;
|
||||
};
|
||||
|
||||
@ -428,7 +432,7 @@ struct ContestResources
|
||||
struct ContestStruct_field_18 *field_18;
|
||||
struct ContestResourcesField1C * field_1c;
|
||||
struct ContestResourcesField20 * field_20;
|
||||
u8 * ContestantInfoTilemaps[CONTESTANT_COUNT];
|
||||
u8 * contestBgTilemaps[CONTESTANT_COUNT];
|
||||
void * field_34;
|
||||
void * field_38;
|
||||
void * field_3c;
|
||||
@ -440,7 +444,7 @@ struct ContestResources
|
||||
#define eContestAI (*gContestResources->aiData)
|
||||
#define eContestResources10 (*gContestResources->field_10)
|
||||
#define eContestResources14 (*gContestResources->field_14)
|
||||
#define eUnknownHeap18000 (gHeap + 0x18000)
|
||||
#define eUnzippedContestAudienceGfx (gHeap + 0x18000)
|
||||
#define eUnknownHeap19000 (gHeap + 0x19000)
|
||||
#define eContestDebugMode (gHeap[0x1a000])
|
||||
#define eUnknownHeap1A004 (*(struct Shared1A004 *)(gHeap + 0x1a004))
|
||||
@ -454,7 +458,7 @@ extern u8 gContestFinalStandings[4];
|
||||
extern u8 gContestMonPartyIndex;
|
||||
extern u8 gContestPlayerMonIndex;
|
||||
extern u8 gContestantTurnOrder[4];
|
||||
extern u8 gIsLinkContest;
|
||||
extern u8 gLinkContestFlags;
|
||||
extern u8 gUnknown_02039F2B;
|
||||
extern u16 gSpecialVar_ContestCategory;
|
||||
extern u16 gSpecialVar_ContestRank;
|
||||
@ -471,7 +475,7 @@ extern u32 gContestRngValue;
|
||||
// contest.c
|
||||
void ResetLinkContestBoolean(void);
|
||||
void LoadContestBgAfterMoveAnim(void);
|
||||
void CB2_ContestMain(void);
|
||||
void CB2_StartContest(void);
|
||||
void sub_80DA8C8(u8 partyIndex);
|
||||
void sub_80DAB8C(u8 contestType, u8 rank);
|
||||
void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame);
|
||||
|
@ -235,7 +235,7 @@ void LinkVSync(void);
|
||||
void Timer3Intr(void);
|
||||
void SerialCB(void);
|
||||
bool32 InUnionRoom(void);
|
||||
void sub_800E0E8(void);
|
||||
void LoadWirelessStatusIndicatorSprite(void);
|
||||
bool8 IsLinkTaskFinished(void);
|
||||
void CreateWirelessStatusIndicatorSprite(u8, u8);
|
||||
void sub_800ADF8(void);
|
||||
|
@ -981,7 +981,7 @@ static void CB2_HandleStartBattle(void)
|
||||
gBattleCommunication[MULTIUSE_STATE] = 1;
|
||||
}
|
||||
if (gWirelessCommType)
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
break;
|
||||
case 1:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
@ -1176,7 +1176,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
|
||||
gBattleCommunication[MULTIUSE_STATE] = 1;
|
||||
}
|
||||
if (gWirelessCommType)
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
// fall through
|
||||
case 1:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
@ -1576,7 +1576,7 @@ static void CB2_HandleStartMultiBattle(void)
|
||||
gBattleCommunication[MULTIUSE_STATE] = 1;
|
||||
}
|
||||
if (gWirelessCommType)
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
break;
|
||||
case 1:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
|
@ -996,7 +996,7 @@ static void sub_807FAC8(void)
|
||||
}
|
||||
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
SetVBlankCallback(VBlankCB0_BerryBlender);
|
||||
@ -1202,7 +1202,7 @@ static void sub_8080018(void)
|
||||
}
|
||||
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
sBerryBlenderData->mainState++;
|
||||
|
@ -511,7 +511,7 @@ int sub_802104C(void)
|
||||
CopyBgTilemapBufferToVram(3);
|
||||
break;
|
||||
case 8:
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
sub_8022730(var0);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, -gSpriteCoordOffsetY);
|
||||
|
253
src/contest.c
253
src/contest.c
@ -45,9 +45,26 @@
|
||||
#include "constants/rgb.h"
|
||||
#include "contest_ai.h"
|
||||
|
||||
#define CONTESTANT_WINDOW_START 5
|
||||
#define APPLAUSE_METER_GFX_TAG 0xABE2
|
||||
|
||||
// An index into a palette where the text color for each contestant is stored.
|
||||
// Contestant 0 will use palette color 10, contestant 1 will use color 11, etc.
|
||||
#define CONTESTANT_TEXT_COLOR_START 10
|
||||
|
||||
#define CONTEST_WINDOW_UNK_0 0
|
||||
#define CONTEST_WINDOW_UNK_1 1
|
||||
#define CONTEST_WINDOW_UNK_2 2
|
||||
#define CONTEST_WINDOW_UNK_3 3
|
||||
#define CONTEST_WINDOW_UNK_4 4
|
||||
#define CONTEST_WINDOW_CONTESTANT1 5
|
||||
#define CONTEST_WINDOW_CONTESTANT2 6
|
||||
#define CONTEST_WINDOW_CONTESTANT3 7
|
||||
#define CONTEST_WINDOW_CONTESTANT4 8
|
||||
#define CONTEST_WINDOW_UNK_9 9
|
||||
#define CONTEST_WINDOW_UNK_10 10
|
||||
|
||||
#define CONTESTANT_WINDOW_START CONTEST_WINDOW_CONTESTANT1
|
||||
|
||||
// This file's functions.
|
||||
static void sub_80D782C(void);
|
||||
static void sub_80D7C7C(u8 taskId);
|
||||
@ -55,11 +72,11 @@ static void sub_80D7CB4(u8 taskId);
|
||||
static void sub_80D7DAC(u8 taskId);
|
||||
static void sub_80D7DC8(u8 taskId);
|
||||
static void sub_80D7DE8(u8 taskId);
|
||||
static bool8 sub_80D7E44(u8 *);
|
||||
static bool8 SetupContestGraphics(u8 *stateVar);
|
||||
static void sub_80D80C8(u8 taskId);
|
||||
static void sub_80D8108(u8 taskId);
|
||||
static void vblank_cb_battle(void);
|
||||
static void sub_80D823C(void);
|
||||
static void CB2_ContestMain(void);
|
||||
static void sub_80D833C(u8 taskId);
|
||||
static void sub_80D8424(u8 taskId);
|
||||
static void sub_80D8610(u8 taskId);
|
||||
@ -97,10 +114,10 @@ static void sub_80DA7EC(u8);
|
||||
static void sub_80DA830(u8);
|
||||
static void sub_80DA874(void);
|
||||
static bool8 sub_80DA8A4(void);
|
||||
static void sub_80DAF04(u8);
|
||||
static void sub_80DAF1C(u8 a0, u8 a1);
|
||||
static void sub_80DAF88(u8);
|
||||
static void sub_80DAFA0(u8, u8);
|
||||
static void PrintContestantTrainerName(u8);
|
||||
static void PrintContestantTrainerNameWithColor(u8 a0, u8 a1);
|
||||
static void PrintContestantMonName(u8);
|
||||
static void PrintContestantMonNameWithColor(u8, u8);
|
||||
static u8 sub_80DB0C4(void);
|
||||
static u8 sub_80DB120(void);
|
||||
static u8 sub_80DB174(u16, u32, u32, u32);
|
||||
@ -110,7 +127,7 @@ static void sub_80DB89C(void);
|
||||
static u16 GetChosenMove(u8);
|
||||
static void sub_80DB918(void);
|
||||
static void sub_80DBF68(void);
|
||||
static void sub_80DBF90(void);
|
||||
static void FillContestantWindowBgs(void);
|
||||
static void sub_80DC2BC(void);
|
||||
static void sub_80DC490(bool8);
|
||||
static void sub_80DC4F0(void);
|
||||
@ -118,7 +135,7 @@ static void CreateApplauseMeterSprite(void);
|
||||
static void sub_80DC5E8(void);
|
||||
static void sub_80DC7EC(void);
|
||||
static void ContestDebugDoPrint(void);
|
||||
static void sub_80DD04C(void);
|
||||
static void DrawContestantWindows(void);
|
||||
static void ApplyNextTurnOrder(void);
|
||||
static void StartMoveApplauseMeterOnscreen(void);
|
||||
static void TryMoveApplauseMeterOffscreen(void);
|
||||
@ -204,7 +221,7 @@ EWRAM_DATA u8 gContestFinalStandings[4] = {0};
|
||||
EWRAM_DATA u8 gContestMonPartyIndex = 0;
|
||||
EWRAM_DATA u8 gContestPlayerMonIndex = 0;
|
||||
EWRAM_DATA u8 gContestantTurnOrder[4] = {0};
|
||||
EWRAM_DATA u8 gIsLinkContest = 0;
|
||||
EWRAM_DATA u8 gLinkContestFlags = 0;
|
||||
// Bit 0: Is a link contest
|
||||
// Bit 1: Link contest uses wireless adapter
|
||||
EWRAM_DATA u8 gUnknown_02039F2B = 0;
|
||||
@ -221,7 +238,7 @@ EWRAM_DATA u8 gUnknown_02039F5D = 0;
|
||||
// IWRAM common vars.
|
||||
u32 gContestRngValue;
|
||||
|
||||
extern const u8 *const gUnknown_0827E8DA[];
|
||||
extern const u8 gText_LinkStandby4[];
|
||||
extern const u8 gText_0827D55A[];
|
||||
extern const u8 gText_0827E793[];
|
||||
extern const u8 gText_0827E32E[];
|
||||
@ -577,7 +594,7 @@ const u16 gUnknown_08587C30[] = INCBIN_U16("graphics/unknown/unknown_587C30.gbap
|
||||
|
||||
#include "data/contest_text_tables.h"
|
||||
|
||||
static const struct BgTemplate sContestantInfoBgTemplates[] =
|
||||
static const struct BgTemplate sContestBgTemplates[] =
|
||||
{
|
||||
{
|
||||
.bg = 0,
|
||||
@ -619,7 +636,7 @@ static const struct BgTemplate sContestantInfoBgTemplates[] =
|
||||
|
||||
static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
{
|
||||
{
|
||||
[CONTEST_WINDOW_UNK_0] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 18,
|
||||
.tilemapTop = 0,
|
||||
@ -628,7 +645,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x200
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_UNK_1] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 18,
|
||||
.tilemapTop = 5,
|
||||
@ -637,7 +654,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x218
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_UNK_2] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 18,
|
||||
.tilemapTop = 10,
|
||||
@ -646,7 +663,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x230
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_UNK_3] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 18,
|
||||
.tilemapTop = 15,
|
||||
@ -655,7 +672,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x248
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_UNK_4] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 15,
|
||||
@ -664,7 +681,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x260
|
||||
},
|
||||
[CONTESTANT_WINDOW_START] = {
|
||||
[CONTEST_WINDOW_CONTESTANT1] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 0x1F,
|
||||
@ -673,7 +690,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x2A4
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_CONTESTANT2] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 0x21,
|
||||
@ -682,7 +699,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x2B6
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_CONTESTANT3] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 0x23,
|
||||
@ -691,7 +708,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x2C8
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_CONTESTANT4] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 0x25,
|
||||
@ -700,7 +717,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x2DA
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_UNK_9] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 16,
|
||||
.tilemapTop = 0x1F,
|
||||
@ -709,7 +726,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
|
||||
.paletteNum = 0xF,
|
||||
.baseBlock = 0x2EC
|
||||
},
|
||||
{
|
||||
[CONTEST_WINDOW_UNK_10] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 11,
|
||||
.tilemapTop = 0x23,
|
||||
@ -861,7 +878,7 @@ static void TaskDummy1(u8 taskId)
|
||||
|
||||
void ResetLinkContestBoolean(void)
|
||||
{
|
||||
gIsLinkContest = 0;
|
||||
gLinkContestFlags = 0;
|
||||
}
|
||||
|
||||
static void SetupContestGpuRegs(void)
|
||||
@ -904,7 +921,7 @@ void LoadContestBgAfterMoveAnim(void)
|
||||
{
|
||||
u32 contestantWindowId = CONTESTANT_WINDOW_START + i;
|
||||
|
||||
LoadPalette(eUnknownHeap1A004.unk18004[contestantWindowId], 16 * (CONTESTANT_WINDOW_START + gContestantTurnOrder[i]), sizeof((eUnknownHeap1A004.unk18004[contestantWindowId])));
|
||||
LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId], 16 * (CONTESTANT_WINDOW_START + gContestantTurnOrder[i]), sizeof((eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId])));
|
||||
}
|
||||
}
|
||||
|
||||
@ -913,11 +930,11 @@ static void InitContestInfoBgs(void)
|
||||
s32 i;
|
||||
|
||||
ResetBgsAndClearDma3BusyFlags(0);
|
||||
InitBgsFromTemplates(0, sContestantInfoBgTemplates, ARRAY_COUNT(sContestantInfoBgTemplates));
|
||||
InitBgsFromTemplates(0, sContestBgTemplates, ARRAY_COUNT(sContestBgTemplates));
|
||||
SetBgAttribute(3, BG_ATTR_WRAPAROUND, 1);
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
{
|
||||
SetBgTilemapBuffer(i, gContestResources->ContestantInfoTilemaps[i]);
|
||||
SetBgTilemapBuffer(i, gContestResources->contestBgTilemaps[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -925,7 +942,7 @@ static void InitContestWindows(void)
|
||||
{
|
||||
InitWindows(sContestWindowTemplates);
|
||||
DeactivateAllTextPrinters();
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
gTextFlags.canABSpeedUpPrint = FALSE;
|
||||
}
|
||||
@ -970,7 +987,7 @@ static void InitContestResources(void)
|
||||
*gContestResources->field_10 = (struct UnknownContestStruct5){};
|
||||
memset(gContestResources->field_14, 0, CONTESTANT_COUNT * sizeof(struct UnknownContestStruct4));
|
||||
|
||||
if (!(gIsLinkContest & 1))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
|
||||
SortContestants(FALSE);
|
||||
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
@ -996,15 +1013,15 @@ static void AllocContestResources(void)
|
||||
gContestResources->field_18 = AllocZeroed(sizeof(struct ContestStruct_field_18));
|
||||
gContestResources->field_1c = AllocZeroed(sizeof(struct ContestResourcesField1C) * CONTESTANT_COUNT);
|
||||
gContestResources->field_20 = AllocZeroed(sizeof(struct ContestResourcesField20));
|
||||
gContestResources->ContestantInfoTilemaps[0] = AllocZeroed(0x1000);
|
||||
gContestResources->ContestantInfoTilemaps[1] = AllocZeroed(0x1000);
|
||||
gContestResources->ContestantInfoTilemaps[2] = AllocZeroed(0x1000);
|
||||
gContestResources->ContestantInfoTilemaps[3] = AllocZeroed(0x1000);
|
||||
gContestResources->contestBgTilemaps[0] = AllocZeroed(0x1000);
|
||||
gContestResources->contestBgTilemaps[1] = AllocZeroed(0x1000);
|
||||
gContestResources->contestBgTilemaps[2] = AllocZeroed(0x1000);
|
||||
gContestResources->contestBgTilemaps[3] = AllocZeroed(0x1000);
|
||||
gContestResources->field_34 = AllocZeroed(0x800);
|
||||
gContestResources->field_38 = AllocZeroed(0x800);
|
||||
gContestResources->field_3c = AllocZeroed(0x2000);
|
||||
gUnknown_0202305C = gContestResources->field_3c;
|
||||
gUnknown_02023060 = gContestResources->ContestantInfoTilemaps[1];
|
||||
gUnknown_02023060 = gContestResources->contestBgTilemaps[1];
|
||||
}
|
||||
|
||||
static void FreeContestResources(void)
|
||||
@ -1018,10 +1035,10 @@ static void FreeContestResources(void)
|
||||
FREE_AND_SET_NULL(gContestResources->field_18);
|
||||
FREE_AND_SET_NULL(gContestResources->field_1c);
|
||||
FREE_AND_SET_NULL(gContestResources->field_20);
|
||||
FREE_AND_SET_NULL(gContestResources->ContestantInfoTilemaps[0]);
|
||||
FREE_AND_SET_NULL(gContestResources->ContestantInfoTilemaps[1]);
|
||||
FREE_AND_SET_NULL(gContestResources->ContestantInfoTilemaps[2]);
|
||||
FREE_AND_SET_NULL(gContestResources->ContestantInfoTilemaps[3]);
|
||||
FREE_AND_SET_NULL(gContestResources->contestBgTilemaps[0]);
|
||||
FREE_AND_SET_NULL(gContestResources->contestBgTilemaps[1]);
|
||||
FREE_AND_SET_NULL(gContestResources->contestBgTilemaps[2]);
|
||||
FREE_AND_SET_NULL(gContestResources->contestBgTilemaps[3]);
|
||||
FREE_AND_SET_NULL(gContestResources->field_34);
|
||||
FREE_AND_SET_NULL(gContestResources->field_38);
|
||||
FREE_AND_SET_NULL(gContestResources->field_3c);
|
||||
@ -1030,7 +1047,7 @@ static void FreeContestResources(void)
|
||||
gUnknown_02023060 = NULL;
|
||||
}
|
||||
|
||||
void CB2_ContestMain(void)
|
||||
void CB2_StartContest(void)
|
||||
{
|
||||
switch (gMain.state)
|
||||
{
|
||||
@ -1060,9 +1077,9 @@ void CB2_ContestMain(void)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 2:
|
||||
if (sub_80D7E44(&eContest.unk1925D))
|
||||
if (SetupContestGraphics(&eContest.contestSetupState))
|
||||
{
|
||||
eContest.unk1925D = 0;
|
||||
eContest.contestSetupState = 0;
|
||||
gMain.state++;
|
||||
}
|
||||
break;
|
||||
@ -1074,10 +1091,10 @@ void CB2_ContestMain(void)
|
||||
gPaletteFade.bufferTransferDisabled = FALSE;
|
||||
SetVBlankCallback(vblank_cb_battle);
|
||||
eContest.mainTaskId = CreateTask(sub_80D7C7C, 10);
|
||||
SetMainCallback2(sub_80D823C);
|
||||
if (gIsLinkContest & 2)
|
||||
SetMainCallback2(CB2_ContestMain);
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(8, 8);
|
||||
}
|
||||
break;
|
||||
@ -1095,9 +1112,9 @@ static void sub_80D7C7C(u8 taskId)
|
||||
|
||||
static void sub_80D7CB4(u8 taskId)
|
||||
{
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
if (gIsLinkContest & 2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
{
|
||||
switch (gTasks[taskId].data[0])
|
||||
{
|
||||
@ -1123,7 +1140,7 @@ static void sub_80D7CB4(u8 taskId)
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
gPaletteFade.bufferTransferDisabled = FALSE;
|
||||
if (!(gIsLinkContest & 2))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS))
|
||||
sub_80DBF68();
|
||||
CreateTask(sub_80D7DAC, 0);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
@ -1159,12 +1176,12 @@ static void sub_80D7DE8(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static u8 sub_80D7E44(u8 *a)
|
||||
static bool8 SetupContestGraphics(u8 *stateVar)
|
||||
{
|
||||
u16 sp0[16];
|
||||
u16 sp20[16];
|
||||
u16 tempPalette1[16];
|
||||
u16 tempPalette2[16];
|
||||
|
||||
switch (*a)
|
||||
switch (*stateVar)
|
||||
{
|
||||
case 0:
|
||||
gPaletteFade.bufferTransferDisabled = TRUE;
|
||||
@ -1177,7 +1194,7 @@ static u8 sub_80D7E44(u8 *a)
|
||||
break;
|
||||
case 2:
|
||||
LZDecompressVram(gContestAudienceGfx, (void *)(BG_SCREEN_ADDR(4)));
|
||||
DmaCopyLarge32(3, (void *)(BG_SCREEN_ADDR(4)), eUnknownHeap18000, 0x2000, 0x1000);
|
||||
DmaCopyLarge32(3, (void *)(BG_SCREEN_ADDR(4)), eUnzippedContestAudienceGfx, 0x2000, 0x1000);
|
||||
break;
|
||||
case 3:
|
||||
CopyToBgTilemapBuffer(3, gOldContestGfx, 0, 0);
|
||||
@ -1187,20 +1204,20 @@ static u8 sub_80D7E44(u8 *a)
|
||||
CopyToBgTilemapBuffer(2, gUnknown_08C17170, 0, 0);
|
||||
CopyBgTilemapBufferToVram(2);
|
||||
// This is a bug, and copies random junk. savedJunk is never read.
|
||||
DmaCopy32Defvars(3, gContestResources->ContestantInfoTilemaps[2], eUnknownHeap1A004.savedJunk, 0x800);
|
||||
DmaCopy32Defvars(3, gContestResources->contestBgTilemaps[2], eUnknownHeap1A004.savedJunk, sizeof(eUnknownHeap1A004.savedJunk));
|
||||
break;
|
||||
case 5:
|
||||
LoadCompressedPalette(gOldContestPalette, 0, 0x200);
|
||||
CpuCopy32(gPlttBufferUnfaded + 128, sp0, 16 * sizeof(u16));
|
||||
CpuCopy32(gPlttBufferUnfaded + (CONTESTANT_WINDOW_START + gContestPlayerMonIndex) * 16, sp20, 16 * sizeof(u16));
|
||||
CpuCopy32(sp20, gPlttBufferUnfaded + 128, 16 * sizeof(u16));
|
||||
CpuCopy32(sp0, gPlttBufferUnfaded + (CONTESTANT_WINDOW_START + gContestPlayerMonIndex) * 16, 16 * sizeof(u16));
|
||||
DmaCopy32Defvars(3, gPlttBufferUnfaded, eUnknownHeap1A004.unk18004, sizeof(eUnknownHeap1A004.unk18004));
|
||||
CpuCopy32(gPlttBufferUnfaded + 128, tempPalette1, 16 * sizeof(u16));
|
||||
CpuCopy32(gPlttBufferUnfaded + (CONTESTANT_WINDOW_START + gContestPlayerMonIndex) * 16, tempPalette2, 16 * sizeof(u16));
|
||||
CpuCopy32(tempPalette2, gPlttBufferUnfaded + 128, 16 * sizeof(u16));
|
||||
CpuCopy32(tempPalette1, gPlttBufferUnfaded + (CONTESTANT_WINDOW_START + gContestPlayerMonIndex) * 16, 16 * sizeof(u16));
|
||||
DmaCopy32Defvars(3, gPlttBufferUnfaded, eUnknownHeap1A004.cachedWindowPalettes, sizeof(eUnknownHeap1A004.cachedWindowPalettes));
|
||||
sub_80D782C();
|
||||
break;
|
||||
case 6:
|
||||
sub_80DD04C();
|
||||
sub_80DBF90();
|
||||
DrawContestantWindows();
|
||||
FillContestantWindowBgs();
|
||||
sub_80DB2BC();
|
||||
eContest.unk19216 = sub_80DB120();
|
||||
sub_80DC2BC();
|
||||
@ -1226,11 +1243,11 @@ static u8 sub_80D7E44(u8 *a)
|
||||
ShowBg(1);
|
||||
break;
|
||||
default:
|
||||
*a = 0;
|
||||
*stateVar = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
(*a)++;
|
||||
(*stateVar)++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1289,7 +1306,7 @@ static void sub_80D8108(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80D823C(void)
|
||||
static void CB2_ContestMain(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@ -1486,7 +1503,7 @@ static void sub_80D883C(s8 a0)
|
||||
|
||||
static void sub_80D8894(u8 taskId)
|
||||
{
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
u16 move = GetChosenMove(gContestPlayerMonIndex);
|
||||
u8 taskId2;
|
||||
@ -1561,7 +1578,7 @@ static void sub_80D8A88(u8 taskId)
|
||||
{
|
||||
eContest.unk19214 = 0;
|
||||
eContest.unk1921C = gRngValue;
|
||||
if ((gIsLinkContest & 1) && sub_80DA8A4())
|
||||
if ((gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) && sub_80DA8A4())
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@ -1590,7 +1607,7 @@ static void sub_80D8B38(u8 taskId)
|
||||
;
|
||||
eContest.unk19215 = i;
|
||||
r6 = eContest.unk19215;
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
u8 taskId2;
|
||||
|
||||
@ -2318,7 +2335,7 @@ static void sub_80DA198(u8 taskId)
|
||||
switch (gTasks[taskId].data[0])
|
||||
{
|
||||
case 0:
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
u8 taskId2;
|
||||
|
||||
@ -2504,7 +2521,7 @@ static void sub_80DA5E8(u8 taskId)
|
||||
gUnknown_02039F10[i] = eContestantStatus[i].pointTotal;
|
||||
sub_80DBD18();
|
||||
sub_80DB89C();
|
||||
if (!(gIsLinkContest & 1))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
|
||||
BravoTrainerPokemonProfile_BeforeInterview1(eContestantStatus[gContestPlayerMonIndex].prevMove);
|
||||
else
|
||||
{
|
||||
@ -2549,7 +2566,7 @@ static void sub_80DA740(u8 taskId)
|
||||
if (gTasks[taskId].data[0]++ >= 50)
|
||||
{
|
||||
gTasks[taskId].data[0] = 0;
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
gTasks[taskId].func = sub_80DA7A0;
|
||||
}
|
||||
@ -2599,7 +2616,7 @@ static void sub_80DA874(void)
|
||||
|
||||
static void sub_80DA884(void)
|
||||
{
|
||||
if (!(gIsLinkContest & 1))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
|
||||
gContestPlayerMonIndex = 3;
|
||||
}
|
||||
|
||||
@ -2621,7 +2638,7 @@ void sub_80DA8C8(u8 partyIndex)
|
||||
s16 tough;
|
||||
|
||||
StringCopy(name, gSaveBlock2Ptr->playerName);
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
sub_80DF9D4(name);
|
||||
}
|
||||
@ -2635,7 +2652,7 @@ void sub_80DA8C8(u8 partyIndex)
|
||||
gContestMons[gContestPlayerMonIndex].species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES);
|
||||
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, name);
|
||||
StringGetEnd10(name);
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
sub_80DF9E0(name, GetMonData(&gPlayerParty[partyIndex], MON_DATA_LANGUAGE));
|
||||
}
|
||||
@ -2697,7 +2714,7 @@ void sub_80DAB8C(u8 contestType, u8 rank)
|
||||
|
||||
sub_80DA884();
|
||||
|
||||
if (FlagGet(FLAG_SYS_GAME_CLEAR) && !(gIsLinkContest & 1))
|
||||
if (FlagGet(FLAG_SYS_GAME_CLEAR) && !(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
|
||||
r7 = TRUE;
|
||||
|
||||
// Find all suitable opponents
|
||||
@ -2833,55 +2850,55 @@ u8 sub_80DAE0C(struct Pokemon *pkmn)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static void sub_80DAEA4(void)
|
||||
static void DrawContestantWindowText(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
{
|
||||
FillWindowPixelBuffer(gContestantTurnOrder[i], PIXEL_FILL(0));
|
||||
sub_80DAF04(i);
|
||||
sub_80DAF88(i);
|
||||
PrintContestantTrainerName(i);
|
||||
PrintContestantMonName(i);
|
||||
}
|
||||
}
|
||||
|
||||
static u8 *sub_80DAED4(const u8 *src, u8 color)
|
||||
static u8 *Contest_CopyStringWithColor(const u8 *string, u8 color)
|
||||
{
|
||||
u8 * ptr = StringCopy(gDisplayedStringBattle, gText_ColorTransparent);
|
||||
ptr[-1] = color;
|
||||
ptr = StringCopy(ptr, src);
|
||||
ptr[-1] = color; // Overwrites the "{COLOR TRANSPARENT}" part of the string.
|
||||
ptr = StringCopy(ptr, string);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static void sub_80DAF04(u8 a0)
|
||||
static void PrintContestantTrainerName(u8 contestant)
|
||||
{
|
||||
sub_80DAF1C(a0, a0 + 10);
|
||||
PrintContestantTrainerNameWithColor(contestant, contestant + CONTESTANT_TEXT_COLOR_START);
|
||||
}
|
||||
|
||||
static void sub_80DAF1C(u8 a0, u8 a1)
|
||||
static void PrintContestantTrainerNameWithColor(u8 contestant, u8 color)
|
||||
{
|
||||
u8 buffer[32];
|
||||
s32 offset;
|
||||
|
||||
StringCopy(buffer, gText_Slash);
|
||||
StringAppend(buffer, gContestMons[a0].trainerName);
|
||||
sub_80DAED4(buffer, a1);
|
||||
StringAppend(buffer, gContestMons[contestant].trainerName);
|
||||
Contest_CopyStringWithColor(buffer, color);
|
||||
offset = GetStringRightAlignXOffset(7, gDisplayedStringBattle, 0x60);
|
||||
if (offset > 55)
|
||||
offset = 55;
|
||||
Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[a0], gDisplayedStringBattle, offset, 1, 7);
|
||||
Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, offset, 1, 7);
|
||||
}
|
||||
|
||||
static void sub_80DAF88(u8 a0)
|
||||
static void PrintContestantMonName(u8 contestant)
|
||||
{
|
||||
sub_80DAFA0(a0, a0 + 10);
|
||||
PrintContestantMonNameWithColor(contestant, contestant + CONTESTANT_TEXT_COLOR_START);
|
||||
}
|
||||
|
||||
static void sub_80DAFA0(u8 a0, u8 a1)
|
||||
static void PrintContestantMonNameWithColor(u8 contestant, u8 color)
|
||||
{
|
||||
sub_80DAED4(gContestMons[a0].nickname, a1);
|
||||
Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[a0], gDisplayedStringBattle, 5, 1, 7);
|
||||
Contest_CopyStringWithColor(gContestMons[contestant].nickname, color);
|
||||
Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, 5, 1, 7);
|
||||
}
|
||||
|
||||
static u16 sub_80DAFE0(u8 who, u8 contestCategory)
|
||||
@ -2993,8 +3010,9 @@ bool8 IsSpeciesNotUnown(u16 species)
|
||||
|
||||
static void sub_80DB2BC(void)
|
||||
{
|
||||
CpuCopy16(gContestResources->ContestantInfoTilemaps[0], gContestResources->ContestantInfoTilemaps[0] + 0x500, 0x280);
|
||||
CpuCopy16(gContestResources->ContestantInfoTilemaps[2], gContestResources->ContestantInfoTilemaps[2] + 0x500, 0x280);
|
||||
|
||||
CpuCopy16(gContestResources->contestBgTilemaps[0], gContestResources->contestBgTilemaps[0] + 0x500, 0x280);
|
||||
CpuCopy16(gContestResources->contestBgTilemaps[2], gContestResources->contestBgTilemaps[2] + 0x500, 0x280);
|
||||
}
|
||||
|
||||
static u16 sub_80DB2EC(u16 a0, u8 a1)
|
||||
@ -3454,7 +3472,7 @@ static void DetermineFinalStandings(void)
|
||||
|
||||
void sub_80DBED4(void)
|
||||
{
|
||||
if ((gIsLinkContest & 1))
|
||||
if ((gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
|
||||
{
|
||||
gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] =
|
||||
((gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1) > 9999) ? 9999 :
|
||||
@ -3487,14 +3505,14 @@ static void sub_80DBF68(void)
|
||||
gBattle_BG0_Y = 0;
|
||||
gBattle_BG2_Y = 0;
|
||||
sub_80DB89C();
|
||||
Contest_StartTextPrinter((u8*) &gUnknown_0827E8DA, 0);
|
||||
Contest_StartTextPrinter(gText_LinkStandby4, 0);
|
||||
}
|
||||
|
||||
static void sub_80DBF90(void)
|
||||
static void FillContestantWindowBgs(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < 4; i++)
|
||||
for(i = 0; i < CONTESTANT_COUNT; i++)
|
||||
{
|
||||
ContestBG_FillBoxWithTile(0, 0, 0x16, 2 + i * 5, 8, 2, 0x11);
|
||||
}
|
||||
@ -4021,7 +4039,7 @@ static void ContestDebugTogglePointTotal(void)
|
||||
|
||||
if(eContestDebugMode == CONTEST_DEBUG_MODE_OFF)
|
||||
{
|
||||
sub_80DAEA4();
|
||||
DrawContestantWindowText();
|
||||
sub_80DB2BC();
|
||||
}
|
||||
else
|
||||
@ -4198,15 +4216,16 @@ void SortContestants(bool8 useRanking)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80DD04C(void)
|
||||
static void DrawContestantWindows(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
{
|
||||
LoadPalette(&gHeap[0x1A004] + (i + CONTESTANT_WINDOW_START) * 32, (gContestantTurnOrder[i] + CONTESTANT_WINDOW_START) * 16, 32);
|
||||
s32 windowId = i + CONTESTANT_WINDOW_START;
|
||||
LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[windowId], (gContestantTurnOrder[i] + CONTESTANT_WINDOW_START) * 16, sizeof(eUnknownHeap1A004.cachedWindowPalettes[0]));
|
||||
}
|
||||
sub_80DAEA4();
|
||||
DrawContestantWindowText();
|
||||
}
|
||||
|
||||
static void sub_80DD080(u8 contestant)
|
||||
@ -4694,7 +4713,7 @@ static void sub_80DDE30(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
RequestDma3Copy(eUnknownHeap18000, (void *)(BG_SCREEN_ADDR(4)), 0x1000, 1);
|
||||
RequestDma3Copy(eUnzippedContestAudienceGfx, (void *)(BG_SCREEN_ADDR(4)), 0x1000, 1);
|
||||
gTasks[taskId].data[12]++;
|
||||
}
|
||||
|
||||
@ -4858,7 +4877,7 @@ static void sub_80DE224(void)
|
||||
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
|
||||
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
|
||||
|
||||
CpuFill32(0, gContestResources->ContestantInfoTilemaps[1], 0x1000);
|
||||
CpuFill32(0, gContestResources->contestBgTilemaps[1], 0x1000);
|
||||
|
||||
CopyToBgTilemapBuffer(1, gUnknown_08C17980, 0, 0);
|
||||
Contest_SetBgCopyFlags(1);
|
||||
@ -4876,7 +4895,7 @@ static void sub_80DE350(void)
|
||||
u16 bg1Cnt;
|
||||
|
||||
RequestDma3Fill(0,(void *)(BG_CHAR_ADDR(2)), 0x2000, 0x1);
|
||||
CpuFill32(0, gContestResources->ContestantInfoTilemaps[1], 0x1000);
|
||||
CpuFill32(0, gContestResources->contestBgTilemaps[1], 0x1000);
|
||||
Contest_SetBgCopyFlags(1);
|
||||
bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
|
||||
((vBgCnt *) &bg1Cnt)->priority = 1;
|
||||
@ -4924,18 +4943,18 @@ static void sub_80DE4A8(u8 taskId)
|
||||
switch (gTasks[taskId].data[0])
|
||||
{
|
||||
case 0:
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
eContest.prevTurnOrder[i] = gContestantTurnOrder[i];
|
||||
sub_80DBF90();
|
||||
FillContestantWindowBgs();
|
||||
sub_80DC864();
|
||||
sub_80DB69C();
|
||||
sub_80DD04C();
|
||||
DrawContestantWindows();
|
||||
sub_80DE008(TRUE);
|
||||
sub_80DC44C();
|
||||
gTasks[taskId].data[0] = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
u8 taskId2;
|
||||
|
||||
@ -5242,7 +5261,7 @@ static void Contest_StartTextPrinter(const u8 *currChar, bool32 b)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
speed = 4;
|
||||
else
|
||||
speed = GetPlayerTextSpeedDelay();
|
||||
@ -5253,15 +5272,15 @@ static void Contest_StartTextPrinter(const u8 *currChar, bool32 b)
|
||||
Contest_SetBgCopyFlags(0);
|
||||
}
|
||||
|
||||
static void ContestBG_FillBoxWithIncrementingTile(u8 a, u16 b, u8 c, u8 d, u8 e, u8 f, u8 g, s16 h)
|
||||
static void ContestBG_FillBoxWithIncrementingTile(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot, s16 tileNumData)
|
||||
{
|
||||
WriteSequenceToBgTilemapBuffer(a, b, c, d, e, f, g, h);
|
||||
Contest_SetBgCopyFlags(a);
|
||||
WriteSequenceToBgTilemapBuffer(bg, firstTileNum, x, y, width, height, paletteSlot, tileNumData);
|
||||
Contest_SetBgCopyFlags(bg);
|
||||
}
|
||||
|
||||
static void ContestBG_FillBoxWithTile(u8 a, u16 b, u8 c, u8 d, u8 e, u8 f, u8 g)
|
||||
static void ContestBG_FillBoxWithTile(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 width, u8 height, u8 paletteSlot)
|
||||
{
|
||||
ContestBG_FillBoxWithIncrementingTile(a, b, c, d, e, f, g, 0);
|
||||
ContestBG_FillBoxWithIncrementingTile(bg, firstTileNum, x, y, width, height, paletteSlot, 0);
|
||||
}
|
||||
|
||||
static bool32 Contest_RunTextPrinters(void)
|
||||
@ -5324,7 +5343,7 @@ bool8 sub_80DEDA8(u8 a)
|
||||
gSaveBlock1Ptr->contestWinners[r4].trainerId = gContestMons[i].otId;
|
||||
StringCopy(gSaveBlock1Ptr->contestWinners[r4].monName, gContestMons[i].nickname);
|
||||
StringCopy(gSaveBlock1Ptr->contestWinners[r4].trainerName, gContestMons[i].trainerName);
|
||||
if(gIsLinkContest & 1)
|
||||
if(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
gSaveBlock1Ptr->contestWinners[r4].contestRank = 4;
|
||||
else
|
||||
gSaveBlock1Ptr->contestWinners[r4].contestRank = gSpecialVar_ContestRank;
|
||||
@ -5677,7 +5696,7 @@ void ContestDebugToggleBitfields(bool8 showUnkD)
|
||||
|
||||
if (eContestDebugMode == CONTEST_DEBUG_MODE_OFF)
|
||||
{
|
||||
sub_80DAEA4();
|
||||
DrawContestantWindowText();
|
||||
sub_80DB2BC();
|
||||
}
|
||||
else
|
||||
|
@ -309,7 +309,7 @@ void sub_80F5B00(void)
|
||||
gBattle_WIN1V = 0x80A0;
|
||||
CreateTask(sub_80F68B4, 20);
|
||||
sub_80F7880();
|
||||
if (gIsLinkContest & 0x2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
gPaletteFade.bufferTransferDisabled = 1;
|
||||
else
|
||||
PlayBGM(MUS_CON_K);
|
||||
@ -351,7 +351,7 @@ static void sub_80F5CE4(u8 taskId)
|
||||
{
|
||||
u16 var;
|
||||
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
switch (gTasks[taskId].data[0])
|
||||
{
|
||||
@ -381,7 +381,7 @@ static void sub_80F5CE4(u8 taskId)
|
||||
break;
|
||||
case 1:
|
||||
gTasks[taskId].data[0]++;
|
||||
if (!(gIsLinkContest & 0x2))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS))
|
||||
gTasks[taskId].data[0] = 100;
|
||||
break;
|
||||
case 2:
|
||||
@ -406,7 +406,7 @@ static void sub_80F5CE4(u8 taskId)
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
gTasks[taskId].data[0] = 0;
|
||||
if (gIsLinkContest & 0x1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
sub_80F707C(gText_CommunicationStandby);
|
||||
gTasks[taskId].func = sub_80F5ED8;
|
||||
@ -742,7 +742,7 @@ static void sub_80F66B4(u8 taskId)
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (!(gIsLinkContest & 0x1))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@ -758,7 +758,7 @@ static void sub_80F66B4(u8 taskId)
|
||||
|
||||
static void sub_80F671C(u8 taskId)
|
||||
{
|
||||
if (gIsLinkContest & 0x1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
if (!gTasks[taskId].data[10])
|
||||
{
|
||||
@ -777,7 +777,7 @@ static void sub_80F677C(u8 taskId)
|
||||
{
|
||||
if (!gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
if (gIsLinkContest & 0x2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
DestroyWirelessStatusIndicatorSprite();
|
||||
|
||||
sub_80F7144();
|
||||
@ -787,7 +787,7 @@ static void sub_80F677C(u8 taskId)
|
||||
|
||||
static void sub_80F67C4(u8 taskId)
|
||||
{
|
||||
if (!(gIsLinkContest & 0x1))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK))
|
||||
BravoTrainerPokemonProfile_BeforeInterview2(gContestFinalStandings[gContestPlayerMonIndex]);
|
||||
|
||||
BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0);
|
||||
@ -907,9 +907,9 @@ static void sub_80F6AE8(void)
|
||||
u16 sheet;
|
||||
u8 spriteId;
|
||||
|
||||
if (gIsLinkContest & 0x2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(8, 8);
|
||||
gSprites[gWirelessStatusIndicatorSpriteId].subpriority = 1;
|
||||
sheet = LoadSpriteSheet(&gUnknown_0858D8E0);
|
||||
@ -1392,7 +1392,7 @@ static void sub_80F71C8(void)
|
||||
|
||||
x = 5;
|
||||
y = 1;
|
||||
if (gIsLinkContest & 0x1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
CopyToBgTilemapBufferRect(2, gUnknown_08DC6498, 5, 1, 5, 2);
|
||||
x = 10;
|
||||
@ -2830,7 +2830,7 @@ void sub_80F8390(void)
|
||||
|
||||
void sub_80F83D0(void)
|
||||
{
|
||||
SetMainCallback2(CB2_ContestMain);
|
||||
SetMainCallback2(CB2_StartContest);
|
||||
}
|
||||
|
||||
static void sub_80F83E0(u8 taskId)
|
||||
@ -2886,7 +2886,7 @@ void sub_80F84C4(u8 taskId)
|
||||
|
||||
static void sub_80F8508(u8 taskId)
|
||||
{
|
||||
if (gIsLinkContest & 0x4)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER)
|
||||
{
|
||||
sub_80DA8C8(gContestMonPartyIndex);
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_80FC6BC, sub_80F8568);
|
||||
|
@ -72,22 +72,22 @@ static void sub_80FC5DC(u8 taskId)
|
||||
|
||||
gContestPlayerMonIndex = GetMultiplayerId();
|
||||
gNumLinkContestPlayers = GetLinkPlayerCount();
|
||||
gIsLinkContest = 1;
|
||||
gLinkContestFlags = LINK_CONTEST_FLAG_IS_LINK;
|
||||
if (gWirelessCommType == 1)
|
||||
gIsLinkContest = 3;
|
||||
gLinkContestFlags = LINK_CONTEST_FLAG_IS_LINK | LINK_CONTEST_FLAG_IS_WIRELESS;
|
||||
|
||||
for (i = 0; i < gNumLinkContestPlayers && (u32)(gLinkPlayers[i].version & 0xFF) - 1 > VERSION_RUBY - 1; i++)
|
||||
;
|
||||
|
||||
if (i < gNumLinkContestPlayers)
|
||||
gIsLinkContest |= 0x4;
|
||||
gLinkContestFlags |= LINK_CONTEST_FLAG_HAS_RS_PLAYER;
|
||||
|
||||
SwitchTaskToFollowupFunc(taskId);
|
||||
}
|
||||
|
||||
bool32 sub_80FC670(s16 *arg0)
|
||||
{
|
||||
if (gIsLinkContest & 0x4)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER)
|
||||
return TRUE;
|
||||
|
||||
switch (*arg0)
|
||||
|
@ -445,7 +445,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
|
||||
case 6:
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
BlendPalettes(-1,0x10, 0);
|
||||
|
@ -2254,7 +2254,7 @@ void DestroyWirelessStatusIndicatorSprite(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800E0E8(void)
|
||||
void LoadWirelessStatusIndicatorSprite(void)
|
||||
{
|
||||
if (GetSpriteTileStartByTag(sWirelessStatusIndicatorSpriteSheet.tag) == 0xFFFF)
|
||||
{
|
||||
|
@ -1874,7 +1874,7 @@ static bool32 map_loading_iteration_3(u8 *state)
|
||||
case 11:
|
||||
if (gWirelessCommType != 0)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
(*state)++;
|
||||
@ -2046,7 +2046,7 @@ static bool32 map_loading_iteration_2_link(u8 *state)
|
||||
case 11:
|
||||
if (gWirelessCommType != 0)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
(*state)++;
|
||||
|
@ -154,7 +154,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
|
||||
|
||||
if (gWirelessCommType != 0 && gReceivedRemoteLinkPlayers != 0)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ void sub_80F8AFC(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
{
|
||||
@ -256,7 +256,7 @@ void sub_80F8B94(void)
|
||||
struct Sprite *sprite;
|
||||
|
||||
gReservedSpritePaletteCount = 12;
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
{
|
||||
@ -339,9 +339,9 @@ void ShowContestEntryMonPic(void)
|
||||
gMultiuseSpriteTemplate.paletteTag = palette->tag;
|
||||
spriteId = CreateSprite(&gMultiuseSpriteTemplate, (left + 1) * 8 + 32, (top * 8) + 40, 0);
|
||||
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
if (!(gIsLinkContest & 4))
|
||||
if (!(gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER))
|
||||
DoMonFrontSpriteAnimation(&gSprites[spriteId], species, FALSE, 0);
|
||||
}
|
||||
else
|
||||
@ -403,7 +403,7 @@ static void sub_80F8EE8(u8 taskId)
|
||||
|
||||
void ScriptGetMultiplayerId(void)
|
||||
{
|
||||
if ((gIsLinkContest & 1) && gNumLinkContestPlayers == 4 && !(gIsLinkContest & 2))
|
||||
if ((gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) && gNumLinkContestPlayers == 4 && !(gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS))
|
||||
gSpecialVar_Result = GetMultiplayerId();
|
||||
else
|
||||
gSpecialVar_Result = 4;
|
||||
@ -414,7 +414,7 @@ void ScriptRandom(void)
|
||||
u16 random;
|
||||
u16 *scriptPtr;
|
||||
|
||||
if (gIsLinkContest & 1)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
|
||||
{
|
||||
gContestRngValue = 1103515245 * gContestRngValue + 24691;
|
||||
random = gContestRngValue >> 16;
|
||||
@ -436,7 +436,7 @@ u16 sub_80F903C(void)
|
||||
|
||||
u8 sub_80F905C(void)
|
||||
{
|
||||
if (gIsLinkContest & 2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
{
|
||||
CreateTask(sub_80F9088, 5);
|
||||
return 1;
|
||||
@ -473,11 +473,11 @@ static void sub_80F9088(u8 taskId)
|
||||
|
||||
void sub_80F90DC(void)
|
||||
{
|
||||
if (gIsLinkContest & 2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
{
|
||||
if (gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(8, 8);
|
||||
}
|
||||
}
|
||||
@ -485,7 +485,7 @@ void sub_80F90DC(void)
|
||||
|
||||
void sub_80F910C(void)
|
||||
{
|
||||
if (gIsLinkContest & 2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
{
|
||||
if (gReceivedRemoteLinkPlayers)
|
||||
DestroyWirelessStatusIndicatorSprite();
|
||||
@ -494,7 +494,7 @@ void sub_80F910C(void)
|
||||
|
||||
u8 sub_80F9134(void)
|
||||
{
|
||||
if (gIsLinkContest & 4)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
@ -502,12 +502,12 @@ u8 sub_80F9134(void)
|
||||
|
||||
void sub_80F9154(void)
|
||||
{
|
||||
gIsLinkContest = 0;
|
||||
gLinkContestFlags = 0;
|
||||
}
|
||||
|
||||
u8 sub_80F9160(void)
|
||||
{
|
||||
if (gIsLinkContest & 2)
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -1626,7 +1626,7 @@ static void sub_80773D0(void)
|
||||
if (sub_8010500())
|
||||
{
|
||||
gMain.state++;
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
}
|
||||
@ -1820,7 +1820,7 @@ static void sub_8077B74(void)
|
||||
case 5:
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
gMain.state++;
|
||||
@ -4246,7 +4246,7 @@ void sub_807AE50(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
}
|
||||
SetMainCallback2(sub_807EA2C);
|
||||
|
@ -381,7 +381,7 @@ static void sub_80C2760(u8 taskId)
|
||||
case 7:
|
||||
if (gWirelessCommType == 1 && gReceivedRemoteLinkPlayers == TRUE)
|
||||
{
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(230, 150);
|
||||
}
|
||||
BlendPalettes(0xFFFFFFFF, 16, sData->var_52C);
|
||||
|
@ -1406,7 +1406,7 @@ void sub_8012780(u8 taskId)
|
||||
switch (sub_80170B8(&data->textState, sub_801064C(ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName)))
|
||||
{
|
||||
case 0:
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
data->field_19 = 5;
|
||||
sub_8010688(5, ReadAsU16(data->field_0->arr[data->field_13].unk.field_0.unk_00.playerTrainerId), data->field_0->arr[data->field_13].unk.playerName);
|
||||
@ -2132,7 +2132,7 @@ u32 sub_8013B8C(struct UnkStruct_Group *arg0, s32 id)
|
||||
void sub_8013BD8(struct UnkStruct_Group *data, s32 id)
|
||||
{
|
||||
data->field_F = id;
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
RedrawListMenu(data->listTaskId);
|
||||
sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]);
|
||||
@ -2784,7 +2784,7 @@ void sub_8014A40(u8 taskId)
|
||||
switch (mevent_message_print_and_prompt_yes_no(&data->textState, &data->field_14, 0, gStringVar4))
|
||||
{
|
||||
case 0:
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
data->field_0->arr[data->field_13].field_1B = 0;
|
||||
RedrawListMenu(data->listTaskId);
|
||||
@ -2987,7 +2987,7 @@ void sub_8014F48(u8 taskId)
|
||||
if (data->field_0->arr[id].field_1A_0 == 1 && !data->field_0->arr[id].unk.field_0.unk_0a_7)
|
||||
{
|
||||
data->field_F = id;
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
RedrawListMenu(data->listTaskId);
|
||||
sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]);
|
||||
@ -3150,7 +3150,7 @@ void sub_80152F4(u8 taskId)
|
||||
{
|
||||
data->field_F = 0;
|
||||
data->field_14 = 0;
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
sub_8011FC8(data->field_0->arr[0].unk.playerName, ReadAsU16(data->field_0->arr[0].unk.field_0.unk_00.playerTrainerId));
|
||||
PlaySE(SE_PN_ON);
|
||||
|
@ -281,7 +281,7 @@ static void c2_081284E0(void)
|
||||
SetMainCallback2(sub_801DF38);
|
||||
gUnknown_02022C84->unkE = CreateTask(sub_801DF54, 8);
|
||||
gUnknown_02022C84->unkF = CreateTask(sub_801F2B4, 7);
|
||||
sub_800E0E8();
|
||||
LoadWirelessStatusIndicatorSprite();
|
||||
CreateWirelessStatusIndicatorSprite(232, 150);
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user