Begin new contest documentation

This commit is contained in:
GriffinR 2020-07-11 20:25:56 -04:00
parent 617e411aca
commit 52a4428ba6
18 changed files with 685 additions and 735 deletions

View File

@ -48,7 +48,7 @@ gContestAIChecks:: @ 82DE350
@ Unreferenced AI routine to encourage moves that improve condition on the first @ Unreferenced AI routine to encourage moves that improve condition on the first
@ turn. Additionally, it checks the appeal order of the user and the effect @ turn. Additionally, it checks the appeal order of the user and the effect
@ type, but the code is buggy and doesn't affect the score. @ type, but the code is buggy and doesnt affect the score.
if_turn_not_eq 0, ContestUnreferenced_80 if_turn_not_eq 0, ContestUnreferenced_80
if_effect_not_eq CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, ContestUnreferenced_80 if_effect_not_eq CONTEST_EFFECT_IMPROVE_CONDITION_PREVENT_NERVOUSNESS, ContestUnreferenced_80
score +10 score +10
@ -63,7 +63,7 @@ ContestUnreferenced_0D:
ContestUnreferenced_end: ContestUnreferenced_end:
end end
@ Unreferenced AI routine that doesn't make much sense. @ Unreferenced AI routine that doesnt make much sense.
if_turn_eq 0, ContestUnreferenced_0F_1 if_turn_eq 0, ContestUnreferenced_0F_1
if_turn_eq 1, ContestUnreferenced_0F_2 if_turn_eq 1, ContestUnreferenced_0F_2
if_turn_eq 2, ContestUnreferenced_0F_3 if_turn_eq 2, ContestUnreferenced_0F_3
@ -122,25 +122,26 @@ ContestUnreferenced_score2:
end end
AI_CheckBoring: AI_CheckBoring:
if_effect_eq CONTEST_EFFECT_REPETITION_NOT_BORING, AI_end_081DC27F if_effect_eq CONTEST_EFFECT_REPETITION_NOT_BORING, AI_CheckBoring_NotBoring
if_move_used_count_eq 1, AI_score1_081DC27F if_move_used_count_eq 1, AI_CheckBoring_FirstRepeat
if_move_used_count_eq 2, AI_score2_081DC27F if_move_used_count_eq 2, AI_CheckBoring_SecondRepeat
if_move_used_count_eq 3, AI_score3_081DC27F if_move_used_count_eq 3, AI_CheckBoring_ThirdRepeat
if_move_used_count_eq 4, AI_score4_081DC27F if_move_used_count_eq 4, AI_CheckBoring_FourthRepeat
@ No repeats
end end
AI_score1_081DC27F: AI_CheckBoring_FirstRepeat:
score -5 score -5
end end
AI_score2_081DC27F: AI_CheckBoring_SecondRepeat:
score -15 score -15
end end
AI_score3_081DC27F: AI_CheckBoring_ThirdRepeat:
score -20 score -20
end end
AI_score4_081DC27F: AI_CheckBoring_FourthRepeat:
score -25 score -25
end end
AI_end_081DC27F: AI_CheckBoring_NotBoring:
end end
AI_CheckExcitement: AI_CheckExcitement:

View File

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 873 B

View File

@ -1,7 +1,6 @@
#ifndef GUARD_CONSTANTS_CONTEST_H #ifndef GUARD_CONSTANTS_CONTEST_H
#define GUARD_CONSTANTS_CONTEST_H #define GUARD_CONSTANTS_CONTEST_H
#define CONTESTANT_COUNT 4
#define APPLAUSE_METER_SIZE 5 #define APPLAUSE_METER_SIZE 5
#define CONTEST_TURN_COUNT 5 #define CONTEST_TURN_COUNT 5
@ -22,13 +21,6 @@
#define CONTEST_TYPE_NPC_MASTER (CONTEST_RANK_MASTER + 1) #define CONTEST_TYPE_NPC_MASTER (CONTEST_RANK_MASTER + 1)
#define CONTEST_TYPE_LINK (CONTEST_RANK_LINK + 1) #define CONTEST_TYPE_LINK (CONTEST_RANK_LINK + 1)
#define CONTEST_CATEGORY_COOL 0
#define CONTEST_CATEGORY_BEAUTY 1
#define CONTEST_CATEGORY_CUTE 2
#define CONTEST_CATEGORY_SMART 3
#define CONTEST_CATEGORY_TOUGH 4
#define CONTEST_CATEGORIES_COUNT 5
#define CONTEST_WINNER_ARTIST 0 // Winner shown by the artist, painting not necessarily saved #define CONTEST_WINNER_ARTIST 0 // Winner shown by the artist, painting not necessarily saved
#define CONTEST_WINNER_HALL_1 1 #define CONTEST_WINNER_HALL_1 1
#define CONTEST_WINNER_HALL_2 2 #define CONTEST_WINNER_HALL_2 2

View File

@ -62,6 +62,14 @@
#define MAX_MON_MOVES 4 #define MAX_MON_MOVES 4
#define NUM_STATS 6 #define NUM_STATS 6
#define CONTESTANT_COUNT 4
#define CONTEST_CATEGORY_COOL 0
#define CONTEST_CATEGORY_BEAUTY 1
#define CONTEST_CATEGORY_CUTE 2
#define CONTEST_CATEGORY_SMART 3
#define CONTEST_CATEGORY_TOUGH 4
#define CONTEST_CATEGORIES_COUNT 5
// party sizes // party sizes
#define PARTY_SIZE 6 #define PARTY_SIZE 6
#define MULTI_PARTY_SIZE PARTY_SIZE / 2 #define MULTI_PARTY_SIZE PARTY_SIZE / 2

View File

@ -226,7 +226,9 @@ struct ContestPokemon
/*0x29*/ u8 smart; // smart /*0x29*/ u8 smart; // smart
/*0x2A*/ u8 tough; // tough /*0x2A*/ u8 tough; // tough
/*0x2B*/ u8 sheen; // sheen /*0x2B*/ u8 sheen; // sheen
/*0x2C*/ u8 unk2C[12]; u8 highestRank;
bool8 gameCleared;
/*0x2C*/ u8 unk2C[10];
/*0x38*/ u32 personality; // personality /*0x38*/ u32 personality; // personality
/*0x3C*/ u32 otId; // otId /*0x3C*/ u32 otId; // otId
}; };
@ -252,85 +254,85 @@ struct ContestStruct_field_18
struct Contest struct Contest
{ {
/*0x0*/ u8 playerMoveChoice; u8 playerMoveChoice;
/*0x1*/ u8 turnNumber; u8 turnNumber;
/*0x2*/ u8 unused2[CONTESTANT_COUNT]; u8 unused2[CONTESTANT_COUNT];
/*0x6*/ u16 unk1920A_0:1; // Task active flags? bool16 unk1920A_0:1; // Task active flags?
u16 unk1920A_1:1; bool16 unk1920A_1:1;
u16 unk1920A_2:1; bool16 unk1920A_2:1;
u16 unk1920A_3:1; bool16 unk1920A_3:1;
u16 unk1920A_4:1; bool16 unk1920A_4:1;
u16 isShowingApplauseMeter:1; bool16 isShowingApplauseMeter:1;
u16 applauseMeterIsMoving:1; bool16 applauseMeterIsMoving:1;
u16 unk1920A_7:1; bool16 unk1920A_7:1;
/*0x7*/ u16 unk1920B_0:1; bool16 unk1920B_0:1;
u16 unk1920B_1:1; bool16 sliderHeartsAnimating:1; // When the slider heart is appearing/disappearing
u16 unk1920B_2:1; bool16 unk1920B_2:1;
/*0x8*/ u8 mainTaskId; u8 mainTaskId;
/*0x9*/ u8 unk1920D[4]; u8 unk1920D[4];
/*0xD*/ u8 unk19211; u8 unk19211;
/*0xE*/ u8 unk19212; u8 unk19212;
/*0xF*/ u8 filler19213; u8 filler19213;
/*0x10*/ u8 unk19214; u8 unk19214;
/*0x11*/ u8 unk19215; u8 unk19215;
/*0x12*/ u8 unk19216; // sprite ID u8 unk19216; // sprite ID
/*0x13*/ s8 applauseLevel; s8 applauseLevel;
/*0x19218*/ u8 prevTurnOrder[CONTESTANT_COUNT]; u8 prevTurnOrder[CONTESTANT_COUNT];
/*0x1921C*/ u32 unk1921C; // saved RNG value? u32 unk1921C; // saved RNG value?
u16 moveHistory[CONTEST_TURN_COUNT][CONTESTANT_COUNT]; u16 moveHistory[CONTEST_TURN_COUNT][CONTESTANT_COUNT];
u8 excitementHistory[CONTEST_TURN_COUNT][CONTESTANT_COUNT]; u8 excitementHistory[CONTEST_TURN_COUNT][CONTESTANT_COUNT];
u8 applauseMeterSpriteId; u8 applauseMeterSpriteId;
/*0x1925D*/ u8 contestSetupState; u8 contestSetupState;
/*0x1925E*/ u8 unk1925E; u8 unk1925E;
}; };
struct ContestantStatus struct ContestantStatus
{ {
/*0x00*/ s16 appeal1; // move appeal? s16 appeal1; // move appeal?
/*0x02*/ s16 appeal2; // final appeal after end of turn, maybe? s16 appeal2; // final appeal after end of turn, maybe?
/*0x04*/ s16 pointTotal; s16 pointTotal;
/*0x06*/ u16 currMove; u16 currMove;
/*0x08*/ u16 prevMove; u16 prevMove;
/*0x0A*/ u8 moveCategory; u8 moveCategory;
/*0x0B*/ u8 ranking:2; u8 ranking:2;
u8 unkB_2:2; u8 unkB_2:2;
u8 moveRepeatCount:3; u8 moveRepeatCount:3;
u8 noMoreTurns:1; // used a one-time move? bool8 noMoreTurns:1; // used a one-time move?
/*0x0C*/ u8 nervous:1; bool8 nervous:1;
u8 numTurnsSkipped:2; u8 numTurnsSkipped:2;
/*0x0D*/ s8 condition; s8 condition;
/*0x0E*/ u8 jam; u8 jam;
/*0x0F*/ u8 jamReduction; u8 jamReduction;
// Flags set by move effect // Flags set by move effect
/*0x10*/ u8 resistant:1; bool8 resistant:1;
u8 immune:1; bool8 immune:1;
u8 moreEasilyStartled:1; bool8 moreEasilyStartled:1;
u8 usedRepeatableMove:1; bool8 usedRepeatableMove:1;
u8 conditionMod:2; // 1: just raised condition; 2: appeal greatly improved by condition u8 conditionMod:2; // 1: just raised condition; 2: appeal greatly improved by condition
u8 turnOrderMod:2; // 1: defined; 2: random u8 turnOrderMod:2; // 1: defined; 2: random
/*0x11*/ u8 turnOrderModAction:2; // 1: made first; 2: made last; 3: made random u8 turnOrderModAction:2; // 1: made first; 2: made last; 3: made random
u8 turnSkipped:1; bool8 turnSkipped:1;
u8 exploded:1; bool8 exploded:1;
u8 overrideCategoryExcitementMod:1; bool8 overrideCategoryExcitementMod:1;
u8 appealTripleCondition:1; bool8 appealTripleCondition:1;
/*0x12*/ u8 jamSafetyCount; u8 jamSafetyCount;
/*0x13*/ u8 effectStringId; // status action? u8 effectStringId; // status action?
/*0x14*/ u8 effectStringId2; u8 effectStringId2;
/*0x15*/ u8 disappointedRepeat:1; bool8 repeatedMove:1;
u8 unk15_1:1; bool8 unused:1;
u8 unk15_2:1; bool8 repeatedPrevMove:1; // never read
u8 unk15_3:1; bool8 unk15_3:1;
u8 hasJudgesAttention:1; bool8 hasJudgesAttention:1;
u8 judgesAttentionWasRemoved:1; bool8 judgesAttentionWasRemoved:1;
u8 unk15_6:1; bool8 unk15_6:1;
/*0x16*/ u8 unk16; u8 unk16;
/*0x17*/ u8 unk17; u8 unk17;
/*0x18*/ u8 unk18; u8 unk18;
/*0x19*/ u8 nextTurnOrder; // turn position u8 nextTurnOrder; // turn position
/*0x1A*/ u8 attentionLevel; // How much the Pokemon "stood out" u8 attentionLevel; // How much the Pokemon "stood out"
/*0x1B*/ u8 unk1B; u8 unk1B;
}; };
struct UnknownContestStruct7 struct UnknownContestStruct7
@ -348,9 +350,9 @@ struct ContestAIInfo
/*0x00*/ u8 aiState; /*0x00*/ u8 aiState;
/*0x02*/ u16 nextMove; /*0x02*/ u16 nextMove;
/*0x04*/ u8 nextMoveIndex; /*0x04*/ u8 nextMoveIndex;
/*0x05*/ u8 unk5[4]; /*0x05*/ u8 moveScores[MAX_MON_MOVES];
/*0x09*/ u8 aiAction; /*0x09*/ u8 aiAction;
/*0x0A*/ u8 fillerA[0x6]; // TODO: don't know what's here /*0x0A*/ u8 filler[6];
/*0x10*/ u8 currentAICheck; /*0x10*/ u8 currentAICheck;
/*0x14*/ u32 aiChecks; /*0x14*/ u32 aiChecks;
/*0x18*/ s16 scriptResult; /*0x18*/ s16 scriptResult;
@ -370,9 +372,9 @@ struct UnknownContestStruct5
struct UnknownContestStruct4 struct UnknownContestStruct4
{ {
u8 unk0; // sprite ID u8 sliderHeartSpriteId;
u8 unk1; // sprite ID u8 nextTurnSpriteId;
u8 unk2_0:1; u8 sliderUpdating:1;
u8 unk2_1:1; u8 unk2_1:1;
u8 unk2_2:1; u8 unk2_2:1;
}; };
@ -454,7 +456,7 @@ extern u32 gContestRngValue;
void ResetLinkContestBoolean(void); void ResetLinkContestBoolean(void);
void LoadContestBgAfterMoveAnim(void); void LoadContestBgAfterMoveAnim(void);
void CB2_StartContest(void); void CB2_StartContest(void);
void sub_80DA8C8(u8 partyIndex); void CreateContestMonFromParty(u8 partyIndex);
void sub_80DAB8C(u8 contestType, u8 rank); void sub_80DAB8C(u8 contestType, u8 rank);
void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame); void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame);
u8 GetContestEntryEligibility(struct Pokemon *pkmn); u8 GetContestEntryEligibility(struct Pokemon *pkmn);
@ -474,18 +476,6 @@ void ResetContestLinkResults(void);
bool8 sub_80DEDA8(u8 a); bool8 sub_80DEDA8(u8 a);
u8 sub_80DEFA8(u8 a, u8 b); u8 sub_80DEFA8(u8 a, u8 b);
void ClearContestWinnerPicsInContestHall(void); void ClearContestWinnerPicsInContestHall(void);
void sub_80DFA08(struct ContestPokemon *mon, s32 language); void StripPlayerAndMonNamesForLinkContest(struct ContestPokemon *mon, s32 language);
// contest link
void sub_81D9DE4(u8 taskId);
void sub_80FCF40(u8);
void sub_80FCFD0(u8);
void sub_80F8714(u8);
bool32 sub_80FC670(s16 *);
bool32 sub_80FC4F4(void *, u16);
bool8 sub_80FC55C(void);
bool8 sub_80FC530(u8);
u8 sub_80F86E0(u8 *);
void sub_80FC9F8(u8 taskId);
#endif //GUARD_CONTEST_H #endif //GUARD_CONTEST_H

View File

@ -9,5 +9,16 @@ void sub_80FC6BC(u8);
void sub_80FC804(u8); void sub_80FC804(u8);
void sub_80FCE48(u8); void sub_80FCE48(u8);
void sub_80FC894(u8); void sub_80FC894(u8);
void Task_LinkContest_CommunicateMonIdxs(u8 taskId);
void sub_81D9DE4(u8 taskId);
void sub_80FCF40(u8);
void sub_80FCFD0(u8);
void sub_80F8714(u8);
bool32 sub_80FC670(s16 *);
bool32 LinkContest_SendBlock(void *, u16);
bool8 LinkContest_GetBlockReceivedFromAllPlayers(void);
bool8 LinkContest_GetBlockReceived(u8);
u8 sub_80F86E0(u8 *);
void Task_LinkContest_CommunicateMoveSelections(u8 taskId);
#endif //GUARD_CONTEST_LINK_H #endif //GUARD_CONTEST_LINK_H

View File

@ -7,6 +7,5 @@ void StartContest(void);
void BufferContestantMonSpecies(void); void BufferContestantMonSpecies(void);
void ShowContestResults(void); void ShowContestResults(void);
void ContestLinkTransfer(u8); void ContestLinkTransfer(u8);
void sub_80FC998(u8 taskId);
#endif // GUARD_CONTEST_UTIL_H #endif // GUARD_CONTEST_UTIL_H

View File

@ -474,7 +474,7 @@ struct SaveBlock2
/*0x20C*/ struct BerryPickingResults berryPick; /*0x20C*/ struct BerryPickingResults berryPick;
/*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][2][3]; // From record mixing. /*0x21C*/ struct RankingHall1P hallRecords1P[HALL_FACILITIES_COUNT][2][3]; // From record mixing.
/*0x57C*/ struct RankingHall2P hallRecords2P[2][3]; // From record mixing. /*0x57C*/ struct RankingHall2P hallRecords2P[2][3]; // From record mixing.
/*0x624*/ u16 contestLinkResults[5][4]; // 4 positions for 5 categories. /*0x624*/ u16 contestLinkResults[CONTEST_CATEGORIES_COUNT][CONTESTANT_COUNT];
/*0x64C*/ struct BattleFrontier frontier; /*0x64C*/ struct BattleFrontier frontier;
}; // sizeof=0xF2C }; // sizeof=0xF2C
@ -483,7 +483,7 @@ extern struct SaveBlock2 *gSaveBlock2Ptr;
struct SecretBaseParty struct SecretBaseParty
{ {
u32 personality[PARTY_SIZE]; u32 personality[PARTY_SIZE];
u16 moves[PARTY_SIZE * 4]; u16 moves[PARTY_SIZE * MAX_MON_MOVES];
u16 species[PARTY_SIZE]; u16 species[PARTY_SIZE];
u16 heldItems[PARTY_SIZE]; u16 heldItems[PARTY_SIZE];
u8 levels[PARTY_SIZE]; u8 levels[PARTY_SIZE];

View File

@ -4786,10 +4786,10 @@ extern const u32 gOldContestGfx[];
extern const u32 gOldContestPalette[]; extern const u32 gOldContestPalette[];
extern const u32 gUnknown_08C17170[]; extern const u32 gUnknown_08C17170[];
extern const u32 gUnknown_08C17980[]; extern const u32 gUnknown_08C17980[];
extern const u32 gTiles_8C19450[]; extern const u32 gContestSliderHeart_Gfx[];
extern const u32 gContestNextTurnGfx[]; extern const u32 gContestNextTurnGfx[];
extern const u16 gContestPal[]; extern const u16 gContestPal[];
extern const u32 gUnknown_08C19168[]; extern const u32 gContestFaces_Gfx[];
extern const u32 gContestApplauseGfx[]; extern const u32 gContestApplauseGfx[];
extern const u32 gContestJudgeGfx[]; extern const u32 gContestJudgeGfx[];
extern const u32 gContestJudgeSymbolsGfx[]; extern const u32 gContestJudgeSymbolsGfx[];

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@
#include "random.h" #include "random.h"
#include "contest_ai.h" #include "contest_ai.h"
#include "contest_effect.h" #include "contest_effect.h"
#include "constants/moves.h"
extern const u8 *gAIScriptPtr; extern const u8 *gAIScriptPtr;
extern const u8 *gContestAIChecks[]; extern const u8 *gContestAIChecks[];
@ -288,7 +289,7 @@ static const ContestAICmdFunc sContestAICmdTable[] =
}; };
static void ContestAI_DoAIProcessing(void); static void ContestAI_DoAIProcessing(void);
static bool8 sub_81563B0(u8); static bool8 GetContestantIdByTurn(u8);
static void AIStackPushVar(const u8 *); static void AIStackPushVar(const u8 *);
static u8 AIStackPop(void); static u8 AIStackPop(void);
@ -297,8 +298,8 @@ void ContestAI_ResetAI(u8 contestantAI)
int i; int i;
memset(&eContestAI, 0, sizeof(struct ContestAIInfo)); memset(&eContestAI, 0, sizeof(struct ContestAIInfo));
for (i = 0; i < 4; i++) for (i = 0; i < MAX_MON_MOVES; i++)
eContestAI.unk5[i] = 100; eContestAI.moveScores[i] = 100;
eContestAI.contestantId = contestantAI; eContestAI.contestantId = contestantAI;
eContestAI.stackSize = 0; eContestAI.stackSize = 0;
@ -321,16 +322,18 @@ u8 ContestAI_GetActionToUse(void)
while (1) while (1)
{ {
u8 rval = Random() & 3; // Randomly choose a move index. If it's the move
u8 r2 = eContestAI.unk5[rval]; // with the highest (or tied highest) score, return
u8 moveIdx = Random() & (MAX_MON_MOVES - 1); // % 4 doesn't match
u8 score = eContestAI.moveScores[moveIdx];
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < MAX_MON_MOVES; i++)
{ {
if (r2 < eContestAI.unk5[i]) if (score < eContestAI.moveScores[i])
break; break;
} }
if (i == 4) if (i == MAX_MON_MOVES)
return rval; return moveIdx;
} }
} }
@ -345,26 +348,26 @@ static void ContestAI_DoAIProcessing(void)
case CONTESTAI_SETTING_UP: case CONTESTAI_SETTING_UP:
gAIScriptPtr = gContestAIChecks[eContestAI.currentAICheck]; gAIScriptPtr = gContestAIChecks[eContestAI.currentAICheck];
if (gContestMons[eContestAI.contestantId].moves[eContestAI.nextMoveIndex] == 0) if (gContestMons[eContestAI.contestantId].moves[eContestAI.nextMoveIndex] == MOVE_NONE)
eContestAI.nextMove = 0; // don't process a move that doesn't exist. eContestAI.nextMove = MOVE_NONE; // don't process a move that doesn't exist.
else else
eContestAI.nextMove = gContestMons[eContestAI.contestantId].moves[eContestAI.nextMoveIndex]; eContestAI.nextMove = gContestMons[eContestAI.contestantId].moves[eContestAI.nextMoveIndex];
eContestAI.aiState++; eContestAI.aiState++;
break; break;
case CONTESTAI_PROCESSING: case CONTESTAI_PROCESSING:
if (eContestAI.nextMove != 0) if (eContestAI.nextMove != MOVE_NONE)
{ {
sContestAICmdTable[*gAIScriptPtr](); // run the command. sContestAICmdTable[*gAIScriptPtr](); // run the command.
} }
else else
{ {
eContestAI.unk5[eContestAI.nextMoveIndex] = 0; // don't consider a move that doesn't exist. eContestAI.moveScores[eContestAI.nextMoveIndex] = 0; // don't consider a move that doesn't exist.
eContestAI.aiAction |= 1; eContestAI.aiAction |= 1;
} }
if (eContestAI.aiAction & 1) if (eContestAI.aiAction & 1)
{ {
eContestAI.nextMoveIndex++; eContestAI.nextMoveIndex++;
if (eContestAI.nextMoveIndex < 4) if (eContestAI.nextMoveIndex < MAX_MON_MOVES)
eContestAI.aiState = 0; eContestAI.aiState = 0;
else else
// aiState = CONTESTAI_FINISHED // aiState = CONTESTAI_FINISHED
@ -376,12 +379,12 @@ static void ContestAI_DoAIProcessing(void)
} }
} }
static u8 sub_81563B0(u8 var) static u8 GetContestantIdByTurn(u8 turn)
{ {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
if (eContestResources8.turnOrder[i] == var) if (eContestResources8.turnOrder[i] == turn)
break; break;
return i; return i;
@ -389,14 +392,14 @@ static u8 sub_81563B0(u8 var)
static void ContestAICmd_score(void) static void ContestAICmd_score(void)
{ {
s16 score = eContestAI.unk5[eContestAI.nextMoveIndex] + (s8)gAIScriptPtr[1]; s16 score = eContestAI.moveScores[eContestAI.nextMoveIndex] + (s8)gAIScriptPtr[1];
if (score > 255) if (score > 255)
score = 255; score = 255;
else if (score < 0) else if (score < 0)
score = 0; score = 0;
eContestAI.unk5[eContestAI.nextMoveIndex] = score; eContestAI.moveScores[eContestAI.nextMoveIndex] = score;
gAIScriptPtr += 2; gAIScriptPtr += 2;
} }
@ -1146,9 +1149,9 @@ static void ContestAICmd_if_would_not_finish_combo(void)
static void ContestAICmd_get_condition(void) static void ContestAICmd_get_condition(void)
{ {
int var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
eContestAI.scriptResult = eContestantStatus[var].condition / 10; eContestAI.scriptResult = eContestantStatus[contestant].condition / 10;
gAIScriptPtr += 2; gAIScriptPtr += 2;
} }
@ -1194,11 +1197,11 @@ static void ContestAICmd_if_condition_not_eq(void)
static void ContestAICmd_get_used_combo_starter(void) static void ContestAICmd_get_used_combo_starter(void)
{ {
u16 result = 0; u16 result = FALSE;
u8 var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
if (sub_80DE1E8(var)) if (sub_80DE1E8(contestant))
result = gContestMoves[eContestantStatus[var].prevMove].comboStarterId ? 1 : 0; result = gContestMoves[eContestantStatus[contestant].prevMove].comboStarterId ? TRUE : FALSE;
eContestAI.scriptResult = result; eContestAI.scriptResult = result;
gAIScriptPtr += 2; gAIScriptPtr += 2;
@ -1246,7 +1249,7 @@ static void ContestAICmd_if_used_combo_starter_not_eq(void)
static void ContestAICmd_check_can_participate(void) static void ContestAICmd_check_can_participate(void)
{ {
if (Contest_IsMonsTurnDisabled(sub_81563B0(gAIScriptPtr[1]))) if (Contest_IsMonsTurnDisabled(GetContestantIdByTurn(gAIScriptPtr[1])))
eContestAI.scriptResult = FALSE; eContestAI.scriptResult = FALSE;
else else
eContestAI.scriptResult = TRUE; eContestAI.scriptResult = TRUE;
@ -1276,9 +1279,9 @@ static void ContestAICmd_if_cannot_participate(void)
static void ContestAICmd_get_val_812A188(void) static void ContestAICmd_get_val_812A188(void)
{ {
u8 var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
eContestAI.scriptResult = eContestantStatus[var].unk15_3; eContestAI.scriptResult = eContestantStatus[contestant].unk15_3;
gAIScriptPtr += 2; gAIScriptPtr += 2;
} }
@ -1304,9 +1307,9 @@ static void ContestAICmd_contest_58(void)
static void ContestAICmd_unk_59(void) static void ContestAICmd_unk_59(void)
{ {
u8 var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
eContestAI.scriptResult = eContestantStatus[var].pointTotal - eContestantStatus[eContestAI.contestantId].pointTotal; eContestAI.scriptResult = eContestantStatus[contestant].pointTotal - eContestantStatus[eContestAI.contestantId].pointTotal;
gAIScriptPtr += 2; gAIScriptPtr += 2;
} }
@ -1352,9 +1355,9 @@ static void ContestAICmd_unk_5D(void)
static void ContestAICmd_unk_5E(void) static void ContestAICmd_unk_5E(void)
{ {
u8 var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
eContestAI.scriptResult = gContestMonConditions[var] - gContestMonConditions[eContestAI.contestantId]; eContestAI.scriptResult = gContestMonConditions[contestant] - gContestMonConditions[eContestAI.contestantId];
gAIScriptPtr += 2; gAIScriptPtr += 2;
} }
@ -1400,9 +1403,9 @@ static void ContestAICmd_unk_62(void)
static void ContestAICmd_unk_63(void) static void ContestAICmd_unk_63(void)
{ {
u8 var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
u8 var2 = gAIScriptPtr[2]; u8 turn = gAIScriptPtr[2];
u16 move = eContest.moveHistory[var2][var]; u16 move = eContest.moveHistory[turn][contestant];
eContestAI.scriptResult = gContestMoves[move].effect; eContestAI.scriptResult = gContestMoves[move].effect;
gAIScriptPtr += 3; gAIScriptPtr += 3;
@ -1450,9 +1453,9 @@ static void ContestAICmd_unk_67(void)
static void ContestAICmd_unk_68(void) static void ContestAICmd_unk_68(void)
{ {
u8 var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
u8 var2 = gAIScriptPtr[2]; u8 turn = gAIScriptPtr[2];
s8 result = eContest.excitementHistory[var2][var]; s8 result = eContest.excitementHistory[turn][contestant];
eContestAI.scriptResult = result; eContestAI.scriptResult = result;
gAIScriptPtr += 3; gAIScriptPtr += 3;
@ -1500,9 +1503,9 @@ static void ContestAICmd_unk_6C(void)
static void ContestAICmd_unk_6D(void) static void ContestAICmd_unk_6D(void)
{ {
u8 var = sub_81563B0(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
u8 var2 = gAIScriptPtr[2]; u8 turn = gAIScriptPtr[2];
u16 move = eContest.moveHistory[var2][var]; u16 move = eContest.moveHistory[turn][contestant];
eContestAI.scriptResult = gContestEffects[gContestMoves[move].effect].effectType; eContestAI.scriptResult = gContestEffects[gContestMoves[move].effect].effectType;
gAIScriptPtr += 3; gAIScriptPtr += 3;

View File

@ -97,7 +97,7 @@ static void ContestEffect_GreatAppealButNoMoreMoves(void)
static void ContestEffect_RepetitionNotBoring(void) static void ContestEffect_RepetitionNotBoring(void)
{ {
eContestantStatus[eContestResources8.contestant].usedRepeatableMove = TRUE; eContestantStatus[eContestResources8.contestant].usedRepeatableMove = TRUE;
eContestantStatus[eContestResources8.contestant].disappointedRepeat = FALSE; eContestantStatus[eContestResources8.contestant].repeatedMove = FALSE;
eContestantStatus[eContestResources8.contestant].moveRepeatCount = 0; eContestantStatus[eContestResources8.contestant].moveRepeatCount = 0;
} }
@ -138,7 +138,7 @@ static void ContestEffect_StartleFrontMon(void)
if (eContestResources8.turnOrder[a] != 0) { if (eContestResources8.turnOrder[a] != 0) {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[a] - 1 == eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[a] - 1 == eContestResources8.turnOrder[i])
break; break;
@ -156,15 +156,15 @@ static void ContestEffect_StartleFrontMon(void)
static void ContestEffect_StartlePrevMons(void) static void ContestEffect_StartlePrevMons(void)
{ {
u8 idx = 0; u8 idx = 0;
u8 a = eContestResources8.contestant; u8 contestant = eContestResources8.contestant;
if (eContestResources8.turnOrder[a] != 0) if (eContestResources8.turnOrder[contestant] != 0)
{ {
int i, j; int i, j;
for (i = 0, j = 0; i < 4; i++) for (i = 0, j = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[a] > eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[contestant] > eContestResources8.turnOrder[i])
eContestResources8.jamQueue[j++] = i; eContestResources8.jamQueue[j++] = i;
} }
@ -390,11 +390,11 @@ static void ContestEffect_MakeFollowingMonsNervous(void)
u8 contestantIds[5]; u8 contestantIds[5];
int i; int i;
int numAfter; int numAfter;
s16 oddsMod[4]; s16 oddsMod[CONTESTANT_COUNT];
s16 odds[4]; s16 odds[CONTESTANT_COUNT];
memset(contestantIds, 0xFF, ARRAY_COUNT(contestantIds)); memset(contestantIds, 0xFF, ARRAY_COUNT(contestantIds));
for (i = 0, numAfter = 0; i < 4; i++) for (i = 0, numAfter = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] < eContestResources8.turnOrder[i] && if (eContestResources8.turnOrder[eContestResources8.contestant] < eContestResources8.turnOrder[i] &&
!eContestantStatus[i].nervous && !Contest_IsMonsTurnDisabled(i)) !eContestantStatus[i].nervous && !Contest_IsMonsTurnDisabled(i))
@ -418,10 +418,10 @@ static void ContestEffect_MakeFollowingMonsNervous(void)
} }
else else
{ {
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
odds[i] = 0; odds[i] = 0;
} }
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestantStatus[i].hasJudgesAttention && sub_80DE1E8(i)) if (eContestantStatus[i].hasJudgesAttention && sub_80DE1E8(i))
oddsMod[i] = gComboStarterLookupTable[gContestMoves[eContestantStatus[i].prevMove].comboStarterId] * 10; oddsMod[i] = gComboStarterLookupTable[gContestMoves[eContestantStatus[i].prevMove].comboStarterId] * 10;
@ -471,7 +471,7 @@ static void ContestEffect_WorsenConditionOfPrevMons(void)
u8 numHit = 0; u8 numHit = 0;
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i] && if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i] &&
eContestantStatus[i].condition > 0 && eContestantStatus[i].condition > 0 &&
@ -495,7 +495,7 @@ static void ContestEffect_BadlyStartlesMonsInGoodCondition(void)
u8 numHit = 0; u8 numHit = 0;
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i])
{ {
@ -542,7 +542,7 @@ static void ContestEffect_AppealAsGoodAsPrevOnes(void)
int i; int i;
int appealSum; int appealSum;
for (i = 0, appealSum = 0; i < 4; i++) for (i = 0, appealSum = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i])
appealSum += eContestantStatus[i].appeal2; appealSum += eContestantStatus[i].appeal2;
@ -570,7 +570,7 @@ static void ContestEffect_AppealAsGoodAsPrevOne(void)
if (eContestResources8.turnOrder[eContestResources8.contestant] != 0) if (eContestResources8.turnOrder[eContestResources8.contestant] != 0)
{ {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] - 1 == eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[eContestResources8.contestant] - 1 == eContestResources8.turnOrder[i])
appeal = eContestantStatus[i].appeal2; appeal = eContestantStatus[i].appeal2;
@ -647,7 +647,7 @@ static void ContestEffect_BetterIfSameType(void)
while (1) while (1)
{ {
for (j = 0; j < 4; j++) for (j = 0; j < CONTESTANT_COUNT; j++)
{ {
if (eContestResources8.turnOrder[j] == i) if (eContestResources8.turnOrder[j] == i)
break; break;
@ -679,7 +679,7 @@ static void ContestEffect_BetterIfDiffType(void)
u16 move = eContestantStatus[eContestResources8.contestant].currMove; u16 move = eContestantStatus[eContestResources8.contestant].currMove;
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] - 1 == eContestResources8.turnOrder[i] && if (eContestResources8.turnOrder[eContestResources8.contestant] - 1 == eContestResources8.turnOrder[i] &&
gContestMoves[move].contestCategory != gContestMoves[eContestantStatus[i].currMove].contestCategory) gContestMoves[move].contestCategory != gContestMoves[eContestantStatus[i].currMove].contestCategory)
@ -699,7 +699,7 @@ static void ContestEffect_AffectedByPrevAppeal(void)
{ {
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] - 1 == eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[eContestResources8.contestant] - 1 == eContestResources8.turnOrder[i])
{ {
@ -748,18 +748,18 @@ static void ContestEffect_NextAppealEarlier(void)
{ {
s8 i; s8 i;
s8 j; s8 j;
u8 turnOrder[4]; u8 turnOrder[CONTESTANT_COUNT];
if (eContest.turnNumber != 4) if (eContest.turnNumber != 4)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
turnOrder[i] = eContestantStatus[i].nextTurnOrder; turnOrder[i] = eContestantStatus[i].nextTurnOrder;
turnOrder[eContestResources8.contestant] = 0xFF; turnOrder[eContestResources8.contestant] = 0xFF;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
for (j = 0; j < 4; j++) for (j = 0; j < CONTESTANT_COUNT; j++)
{ {
if (j != eContestResources8.contestant && if (j != eContestResources8.contestant &&
i == turnOrder[j] && i == turnOrder[j] &&
@ -769,14 +769,14 @@ static void ContestEffect_NextAppealEarlier(void)
break; break;
} }
} }
if (j == 4) if (j == CONTESTANT_COUNT)
break; break;
} }
turnOrder[eContestResources8.contestant] = 0; turnOrder[eContestResources8.contestant] = 0;
eContestantStatus[eContestResources8.contestant].turnOrderMod = 1; eContestantStatus[eContestResources8.contestant].turnOrderMod = 1;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
eContestantStatus[i].nextTurnOrder = turnOrder[i]; eContestantStatus[i].nextTurnOrder = turnOrder[i];
} }
@ -790,18 +790,18 @@ static void ContestEffect_NextAppealLater(void)
{ {
s8 i; s8 i;
s8 j; s8 j;
u8 turnOrder[4]; u8 turnOrder[CONTESTANT_COUNT];
if (eContest.turnNumber != 4) if (eContest.turnNumber != 4)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
turnOrder[i] = eContestantStatus[i].nextTurnOrder; turnOrder[i] = eContestantStatus[i].nextTurnOrder;
turnOrder[eContestResources8.contestant] = 0xFF; turnOrder[eContestResources8.contestant] = 0xFF;
for (i = 3; i > -1; i--) for (i = CONTESTANT_COUNT - 1; i > -1; i--)
{ {
for (j = 0; j < 4; j++) for (j = 0; j < CONTESTANT_COUNT; j++)
{ {
if (j != eContestResources8.contestant && if (j != eContestResources8.contestant &&
i == turnOrder[j] && i == turnOrder[j] &&
@ -811,14 +811,14 @@ static void ContestEffect_NextAppealLater(void)
break; break;
} }
} }
if (j == 4) if (j == CONTESTANT_COUNT)
break; break;
} }
turnOrder[eContestResources8.contestant] = 3; turnOrder[eContestResources8.contestant] = CONTESTANT_COUNT - 1;
eContestantStatus[eContestResources8.contestant].turnOrderMod = 1; eContestantStatus[eContestResources8.contestant].turnOrderMod = 1;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
eContestantStatus[i].nextTurnOrder = turnOrder[i]; eContestantStatus[i].nextTurnOrder = turnOrder[i];
} }
@ -838,22 +838,22 @@ static void ContestEffect_ScrambleNextTurnOrder(void)
{ {
s8 i; s8 i;
s8 j; s8 j;
u8 turnOrder[4]; u8 turnOrder[CONTESTANT_COUNT];
u8 unselectedContestants[4]; u8 unselectedContestants[CONTESTANT_COUNT];
if (eContest.turnNumber != 4) if (eContest.turnNumber != 4)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
turnOrder[i] = eContestantStatus[i].nextTurnOrder; turnOrder[i] = eContestantStatus[i].nextTurnOrder;
unselectedContestants[i] = i; unselectedContestants[i] = i;
} }
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
u8 rval = Random() % (4 - i); u8 rval = Random() % (CONTESTANT_COUNT - i);
for (j = 0; j < 4; j++) for (j = 0; j < CONTESTANT_COUNT; j++)
{ {
if (unselectedContestants[j] != 0xFF) if (unselectedContestants[j] != 0xFF)
{ {
@ -869,7 +869,7 @@ static void ContestEffect_ScrambleNextTurnOrder(void)
} }
} }
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
eContestantStatus[i].nextTurnOrder = turnOrder[i]; eContestantStatus[i].nextTurnOrder = turnOrder[i];
eContestantStatus[i].turnOrderMod = 2; eContestantStatus[i].turnOrderMod = 2;
@ -894,7 +894,7 @@ static void ContestEffect_BadlyStartleMonsWithGoodAppeals(void)
int i; int i;
u8 numJammed = 0; u8 numJammed = 0;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i])
{ {
@ -965,7 +965,7 @@ static void JamByMoveCategory(u8 category)
int i; int i;
int numJammed = 0; int numJammed = 0;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i]) if (eContestResources8.turnOrder[eContestResources8.contestant] > eContestResources8.turnOrder[i])
{ {
@ -1010,7 +1010,7 @@ static bool8 CanUnnerveContestant(u8 i)
static bool8 WasAtLeastOneOpponentJammed(void) static bool8 WasAtLeastOneOpponentJammed(void)
{ {
s16 jamBuffer[4] = {0}; s16 jamBuffer[CONTESTANT_COUNT] = {0};
int i; int i;
for (i = 0; eContestResources8.jamQueue[i] != 0xFF; i++) for (i = 0; eContestResources8.jamQueue[i] != 0xFF; i++)
@ -1044,7 +1044,7 @@ static bool8 WasAtLeastOneOpponentJammed(void)
} }
} }
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
{ {
if (jamBuffer[i] != 0) if (jamBuffer[i] != 0)
return TRUE; return TRUE;

View File

@ -12,7 +12,11 @@
static void sub_80FC5C0(u8); static void sub_80FC5C0(u8);
static void sub_80FC5DC(u8); static void sub_80FC5DC(u8);
bool32 sub_80FC4F4(void *src, u16 size) #define tState data[0]
#define tCategory data[9]
#define tTimer data[11]
bool32 LinkContest_SendBlock(void *src, u16 size)
{ {
memcpy(gDecompressionBuffer, src, size); memcpy(gDecompressionBuffer, src, size);
if (SendBlock(bitmask_all_link_players_but_self(), gDecompressionBuffer, size)) if (SendBlock(bitmask_all_link_players_but_self(), gDecompressionBuffer, size))
@ -21,21 +25,21 @@ bool32 sub_80FC4F4(void *src, u16 size)
return FALSE; return FALSE;
} }
bool8 sub_80FC530(u8 arg0) bool8 LinkContest_GetBlockReceived(u8 flag)
{ {
u8 mask = (1 << arg0); u8 mask = (1 << flag);
if (!(GetBlockReceivedStatus() & mask)) if (!(GetBlockReceivedStatus() & mask))
{ {
return FALSE; return FALSE;
} }
else else
{ {
ResetBlockReceivedFlag(arg0); ResetBlockReceivedFlag(flag);
return TRUE; return TRUE;
} }
} }
bool8 sub_80FC55C(void) bool8 LinkContest_GetBlockReceivedFromAllPlayers(void)
{ {
if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags()) if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags())
{ {
@ -52,10 +56,10 @@ void sub_80FC580(u8 taskId)
{ {
u8 i; u8 i;
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
gBlockRecvBuffer[i][0] = 0xFF; gBlockRecvBuffer[i][0] = 0xFF;
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
gTasks[taskId].func = sub_80FC5C0; gTasks[taskId].func = sub_80FC5C0;
} }
@ -77,6 +81,7 @@ static void sub_80FC5DC(u8 taskId)
if (gWirelessCommType == 1) if (gWirelessCommType == 1)
gLinkContestFlags = LINK_CONTEST_FLAG_IS_LINK | LINK_CONTEST_FLAG_IS_WIRELESS; gLinkContestFlags = LINK_CONTEST_FLAG_IS_LINK | LINK_CONTEST_FLAG_IS_WIRELESS;
// Get number of players using Emerald/FRLG
for (i = 0; i < gNumLinkContestPlayers && (u32)(gLinkPlayers[i].version & 0xFF) - 1 > VERSION_RUBY - 1; i++) for (i = 0; i < gNumLinkContestPlayers && (u32)(gLinkPlayers[i].version & 0xFF) - 1 > VERSION_RUBY - 1; i++)
; ;
@ -86,22 +91,22 @@ static void sub_80FC5DC(u8 taskId)
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
} }
bool32 sub_80FC670(s16 *arg0) bool32 sub_80FC670(s16 *state)
{ {
if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER) if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER)
return TRUE; return TRUE;
switch (*arg0) switch (*state)
{ {
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
sub_800ADF8(); sub_800ADF8();
(*arg0)++; (*state)++;
} }
return FALSE; return FALSE;
case 1: case 1:
(*arg0)++; (*state)++;
return FALSE; return FALSE;
default: default:
if (IsLinkTaskFinished() != TRUE) if (IsLinkTaskFinished() != TRUE)
@ -118,7 +123,7 @@ void sub_80FC6BC(u8 taskId)
if (!sub_80FC670(&gTasks[taskId].data[12])) if (!sub_80FC670(&gTasks[taskId].data[12]))
return; return;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (GetMultiplayerId() == 0) if (GetMultiplayerId() == 0)
@ -126,37 +131,37 @@ void sub_80FC6BC(u8 taskId)
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon)); memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon));
gTasks[taskId].data[0] = 10; gTasks[taskId].tState = 10;
} }
} }
else else
{ {
memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon)); memcpy(gBlockSendBuffer, &gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon));
gTasks[taskId].data[0] = 1; gTasks[taskId].tState = 1;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
{ {
memcpy(&gContestMons[i], gBlockRecvBuffer[i], sizeof(struct ContestPokemon)); memcpy(&gContestMons[i], gBlockRecvBuffer[i], sizeof(struct ContestPokemon));
sub_80DFA08(&gContestMons[i], gLinkPlayers[i].language); StripPlayerAndMonNamesForLinkContest(&gContestMons[i], gLinkPlayers[i].language);
} }
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 10: case 10:
if (++gTasks[taskId].data[11] > 300) if (++gTasks[taskId].tTimer > 300)
{ {
sub_800A4D8(2); sub_800A4D8(2);
gTasks[taskId].data[0] = 1; gTasks[taskId].tState = 1;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
gTasks[taskId].data[11] = 0; gTasks[taskId].tTimer = 0;
gTasks[taskId].data[12] = 0; gTasks[taskId].data[12] = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
@ -165,29 +170,29 @@ void sub_80FC6BC(u8 taskId)
void sub_80FC804(u8 taskId) void sub_80FC804(u8 taskId)
{ {
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (GetMultiplayerId() == 0) if (GetMultiplayerId() == 0)
{ {
if (IsLinkTaskFinished() && sub_80FC4F4(&gRngValue, sizeof(gRngValue)) == TRUE) if (IsLinkTaskFinished() && LinkContest_SendBlock(&gRngValue, sizeof(gRngValue)) == TRUE)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
else else
{ {
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC530(0)) if (LinkContest_GetBlockReceived(0))
{ {
memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue)); memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue));
memcpy(&gContestRngValue, gBlockRecvBuffer[0], sizeof(gContestRngValue)); memcpy(&gContestRngValue, gBlockRecvBuffer[0], sizeof(gContestRngValue));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
} }
@ -200,91 +205,93 @@ void sub_80FC894(u8 taskId)
if (!sub_80FC670(&gTasks[taskId].data[12])) if (!sub_80FC670(&gTasks[taskId].data[12]))
return; return;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
gBlockSendBuffer[0] = gTasks[taskId].data[9]; gBlockSendBuffer[0] = gTasks[taskId].tCategory;
if (GetMultiplayerId() == 0) if (GetMultiplayerId() == 0)
{ {
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
gTasks[taskId].data[0] = 10; gTasks[taskId].tState = 10;
} }
else else
{ {
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
gTasks[taskId].data[i + 1] = gBlockRecvBuffer[i][0]; gTasks[taskId].data[i + 1] = gBlockRecvBuffer[i][0];
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 10: case 10:
if (++gTasks[taskId].data[11] > 10) if (++gTasks[taskId].tTimer > 10)
{ {
sub_800A4D8(2); sub_800A4D8(2);
gTasks[taskId].data[0] = 1; gTasks[taskId].tState = 1;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
gTasks[taskId].data[11] = 0; gTasks[taskId].tTimer = 0;
gTasks[taskId].data[12] = 0; gTasks[taskId].data[12] = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
} }
} }
void sub_80FC998(u8 taskId) void Task_LinkContest_CommunicateMonIdxs(u8 taskId)
{ {
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(&gContestPlayerMonIndex, sizeof(gContestPlayerMonIndex)) == TRUE) if (LinkContest_SendBlock(&gContestPlayerMonIndex, sizeof(gContestPlayerMonIndex)) == TRUE)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
} }
} }
void sub_80FC9F8(u8 taskId) void Task_LinkContest_CommunicateMoveSelections(u8 taskId)
{ {
int i; int i;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(&eContestantStatus[gContestPlayerMonIndex].currMove, sizeof(eContestantStatus[gContestPlayerMonIndex].currMove)) == TRUE) // Send player's move selection
gTasks[taskId].data[0]++; if (LinkContest_SendBlock(&eContestantStatus[gContestPlayerMonIndex].currMove, sizeof(eContestantStatus[gContestPlayerMonIndex].currMove)) == TRUE)
gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
// Receive partners' move selections
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
eContestantStatus[i].currMove = gBlockRecvBuffer[i][0]; eContestantStatus[i].currMove = gBlockRecvBuffer[i][0];
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
} }
@ -292,20 +299,20 @@ void sub_80FC9F8(u8 taskId)
void sub_80FCACC(u8 taskId) void sub_80FCACC(u8 taskId)
{ {
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestMonTotalPoints, sizeof(gContestMonTotalPoints)) == 1) if (LinkContest_SendBlock(gContestMonTotalPoints, sizeof(gContestMonTotalPoints)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestMonTotalPoints, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonTotalPoints)); memcpy(gContestMonTotalPoints, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonTotalPoints));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 2: case 2:
@ -315,53 +322,53 @@ void sub_80FCACC(u8 taskId)
if (gTasks[taskId].data[1]++ > 10) if (gTasks[taskId].data[1]++ > 10)
{ {
gTasks[taskId].data[1] = 0; gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 3: case 3:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gUnknown_02039F10, sizeof(gUnknown_02039F10)) == 1) if (LinkContest_SendBlock(gUnknown_02039F10, sizeof(gUnknown_02039F10)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 4: case 4:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gUnknown_02039F10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F10)); memcpy(gUnknown_02039F10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gUnknown_02039F10));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 6: case 6:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestMonRound2Points, sizeof(gContestMonRound2Points)) == 1) if (LinkContest_SendBlock(gContestMonRound2Points, sizeof(gContestMonRound2Points)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 7: case 7:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestMonRound2Points, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonRound2Points)); memcpy(gContestMonRound2Points, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonRound2Points));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 9: case 9:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestFinalStandings, sizeof(gContestFinalStandings)) == 1) if (LinkContest_SendBlock(gContestFinalStandings, sizeof(gContestFinalStandings)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 10: case 10:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestFinalStandings, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestFinalStandings)); memcpy(gContestFinalStandings, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestFinalStandings));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
} }
@ -369,20 +376,20 @@ void sub_80FCACC(u8 taskId)
void sub_80FCC88(u8 taskId) void sub_80FCC88(u8 taskId)
{ {
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(eContestantStatus, 4 * sizeof(struct ContestantStatus)) == 1) if (LinkContest_SendBlock(eContestantStatus, 4 * sizeof(struct ContestantStatus)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(eContestantStatus, gBlockRecvBuffer[gUnknown_02039F2B], 4 * sizeof(struct ContestantStatus)); memcpy(eContestantStatus, gBlockRecvBuffer[gUnknown_02039F2B], 4 * sizeof(struct ContestantStatus));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 2: case 2:
@ -392,53 +399,53 @@ void sub_80FCC88(u8 taskId)
if (gTasks[taskId].data[1]++ > 10) if (gTasks[taskId].data[1]++ > 10)
{ {
gTasks[taskId].data[1] = 0; gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 3: case 3:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestResources->field_8, sizeof(struct UnknownContestStruct7)) == 1) if (LinkContest_SendBlock(gContestResources->field_8, sizeof(struct UnknownContestStruct7)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 4: case 4:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestResources->field_8, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct7)); memcpy(gContestResources->field_8, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct7));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 6: case 6:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestResources->field_10, sizeof(struct UnknownContestStruct5)) == 1) if (LinkContest_SendBlock(gContestResources->field_10, sizeof(struct UnknownContestStruct5)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 7: case 7:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestResources->field_10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct5)); memcpy(gContestResources->field_10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct5));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 9: case 9:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestantTurnOrder, sizeof(gContestantTurnOrder)) == 1) if (LinkContest_SendBlock(gContestantTurnOrder, sizeof(gContestantTurnOrder)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 10: case 10:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestantTurnOrder, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestantTurnOrder)); memcpy(gContestantTurnOrder, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestantTurnOrder));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
} }
@ -451,39 +458,39 @@ void sub_80FCE48(u8 taskId)
if (!sub_80FC670(&gTasks[taskId].data[12])) if (!sub_80FC670(&gTasks[taskId].data[12]))
return; return;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
gBlockSendBuffer[0] = 0x6E; gBlockSendBuffer[0] = 0x6E;
if (GetMultiplayerId() == 0) if (GetMultiplayerId() == 0)
{ {
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
gTasks[taskId].data[0] = 10; gTasks[taskId].tState = 10;
} }
else else
{ {
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
for (i = 0; i < 4; i++) for (i = 0; i < CONTESTANT_COUNT; i++)
gTasks[taskId].data[i + 5] = gBlockRecvBuffer[i][0]; gTasks[taskId].data[i + 5] = gBlockRecvBuffer[i][0];
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 10: case 10:
if (++gTasks[taskId].data[11] > 10) if (++gTasks[taskId].tTimer > 10)
{ {
sub_800A4D8(2); sub_800A4D8(2);
gTasks[taskId].data[0] = 1; gTasks[taskId].tState = 1;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
gTasks[taskId].data[11] = 0; gTasks[taskId].tTimer = 0;
gTasks[taskId].data[12] = 0; gTasks[taskId].data[12] = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
@ -495,24 +502,24 @@ void sub_80FCF40(u8 taskId)
if (!sub_80FC670(&gTasks[taskId].data[12])) if (!sub_80FC670(&gTasks[taskId].data[12]))
return; return;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestMonConditions, sizeof(gContestMonConditions)) == 1) if (LinkContest_SendBlock(gContestMonConditions, sizeof(gContestMonConditions)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestMonConditions, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonConditions)); memcpy(gContestMonConditions, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonConditions));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
gTasks[taskId].data[12] = 0; gTasks[taskId].data[12] = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;
@ -524,24 +531,24 @@ void sub_80FCFD0(u8 taskId)
if (!sub_80FC670(&gTasks[taskId].data[12])) if (!sub_80FC670(&gTasks[taskId].data[12]))
return; return;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].tState)
{ {
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(gContestantTurnOrder, sizeof(gContestantTurnOrder)) == 1) if (LinkContest_SendBlock(gContestantTurnOrder, sizeof(gContestantTurnOrder)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
memcpy(gContestantTurnOrder, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestantTurnOrder)); memcpy(gContestantTurnOrder, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestantTurnOrder));
gTasks[taskId].data[0]++; gTasks[taskId].tState++;
} }
break; break;
default: default:
gTasks[taskId].data[0] = 0; gTasks[taskId].tState = 0;
gTasks[taskId].data[12] = 0; gTasks[taskId].data[12] = 0;
SwitchTaskToFollowupFunc(taskId); SwitchTaskToFollowupFunc(taskId);
break; break;

View File

@ -1,5 +1,6 @@
#include "global.h" #include "global.h"
#include "contest.h" #include "contest.h"
#include "contest_link.h"
#include "event_data.h" #include "event_data.h"
#include "link.h" #include "link.h"
#include "random.h" #include "random.h"
@ -17,33 +18,35 @@ static void sub_81DA2E8(u8);
static void sub_81DA3B8(u8); static void sub_81DA3B8(u8);
static void sub_81DA488(u8); static void sub_81DA488(u8);
#define tCategory data[9]
void sub_81D9DE4(u8 taskId) void sub_81D9DE4(u8 taskId)
{ {
int gameCleared; int gameCleared;
switch (gTasks[taskId].data[9]) switch (gTasks[taskId].tCategory)
{ {
case 0: case CONTEST_CATEGORY_COOL:
gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON); gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_COOL_RIBBON);
break; break;
case 1: case CONTEST_CATEGORY_BEAUTY:
gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON); gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_BEAUTY_RIBBON);
break; break;
case 2: case CONTEST_CATEGORY_CUTE:
gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON); gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_CUTE_RIBBON);
break; break;
case 3: case CONTEST_CATEGORY_SMART:
gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON); gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SMART_RIBBON);
break; break;
case 4: case CONTEST_CATEGORY_TOUGH:
default: default:
gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON); gHighestRibbonRank = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_TOUGH_RIBBON);
break; break;
} }
gContestMons[gContestPlayerMonIndex].unk2C[0] = gHighestRibbonRank; gContestMons[gContestPlayerMonIndex].highestRank = gHighestRibbonRank;
gameCleared = FlagGet(FLAG_SYS_GAME_CLEAR) > 0; gameCleared = FlagGet(FLAG_SYS_GAME_CLEAR) > 0;
gContestMons[gContestPlayerMonIndex].unk2C[1] = gameCleared; gContestMons[gContestPlayerMonIndex].gameCleared = gameCleared;
SetTaskFuncWithFollowupFunc(taskId, sub_81DA160, sub_81D9F14); SetTaskFuncWithFollowupFunc(taskId, sub_81DA160, sub_81D9F14);
} }
@ -94,13 +97,13 @@ static void sub_81D9F68(u8 taskId)
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
data2[i] = gTasks[taskId].data[i + 5]; data2[i] = gTasks[taskId].data[i + 5];
if (gNumLinkContestPlayers != 4 && GetMultiplayerId() == 0) if (gNumLinkContestPlayers != CONTESTANT_COUNT && GetMultiplayerId() == 0)
{ {
rank = gContestMons[0].unk2C[0]; rank = gContestMons[0].highestRank;
for (i = 1; i < gNumLinkContestPlayers; i++) for (i = 1; i < gNumLinkContestPlayers; i++)
{ {
if (rank < gContestMons[i].unk2C[0]) if (rank < gContestMons[i].highestRank)
rank = gContestMons[i].unk2C[0]; rank = gContestMons[i].highestRank;
} }
if (rank) if (rank)
@ -109,7 +112,7 @@ static void sub_81D9F68(u8 taskId)
gameCleared = 1; gameCleared = 1;
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
{ {
if (!gContestMons[i].unk2C[1]) if (!gContestMons[i].gameCleared)
{ {
gameCleared = 0; gameCleared = 0;
break; break;
@ -120,7 +123,7 @@ static void sub_81D9F68(u8 taskId)
} }
gUnknown_02039F2B = sub_80F86E0(data2); gUnknown_02039F2B = sub_80F86E0(data2);
if (gNumLinkContestPlayers < 4) if (gNumLinkContestPlayers < CONTESTANT_COUNT)
SetTaskFuncWithFollowupFunc(taskId, sub_81DA488, sub_81DA10C); SetTaskFuncWithFollowupFunc(taskId, sub_81DA488, sub_81DA10C);
else else
gTasks[taskId].func = sub_81DA10C; gTasks[taskId].func = sub_81DA10C;
@ -155,17 +158,17 @@ static void sub_81DA160(u8 taskId)
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
if (sub_80FC4F4(&gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon)) == 1) if (LinkContest_SendBlock(&gContestMons[gContestPlayerMonIndex], sizeof(struct ContestPokemon)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
{ {
memcpy(&gContestMons[i], gBlockRecvBuffer[i], sizeof(struct ContestPokemon)); memcpy(&gContestMons[i], gBlockRecvBuffer[i], sizeof(struct ContestPokemon));
sub_80DFA08(&gContestMons[i], gLinkPlayers[i].language); StripPlayerAndMonNamesForLinkContest(&gContestMons[i], gLinkPlayers[i].language);
} }
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
@ -192,7 +195,7 @@ static void sub_81DA244(u8 taskId)
if (!IsLinkTaskFinished()) if (!IsLinkTaskFinished())
return; return;
if (sub_80FC4F4(&gRngValue, sizeof(gRngValue)) == 1) if (LinkContest_SendBlock(&gRngValue, sizeof(gRngValue)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
else else
@ -201,7 +204,7 @@ static void sub_81DA244(u8 taskId)
} }
break; break;
case 1: case 1:
if (sub_80FC530(0)) if (LinkContest_GetBlockReceived(0))
{ {
memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue)); memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue));
memcpy(&gContestRngValue, gBlockRecvBuffer[0], sizeof(gContestRngValue)); memcpy(&gContestRngValue, gBlockRecvBuffer[0], sizeof(gContestRngValue));
@ -231,12 +234,12 @@ static void sub_81DA2E8(u8 taskId)
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
var0 = 0x6E; var0 = 0x6E;
if (sub_80FC4F4(&var0, sizeof(var0)) == 1) if (LinkContest_SendBlock(&var0, sizeof(var0)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
{ {
@ -253,8 +256,8 @@ static void sub_81DA2E8(u8 taskId)
static void sub_81DA3B8(u8 taskId) static void sub_81DA3B8(u8 taskId)
{ {
int i; int i;
u16 data[4]; u16 data[CONTESTANT_COUNT];
u16 var0; u16 category;
if (!sub_80FC670(&gTasks[taskId].data[12])) if (!sub_80FC670(&gTasks[taskId].data[12]))
return; return;
@ -269,13 +272,13 @@ static void sub_81DA3B8(u8 taskId)
case 0: case 0:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
var0 = gTasks[taskId].data[9]; category = gTasks[taskId].tCategory;
if (sub_80FC4F4(&var0, sizeof(var0)) == 1) if (LinkContest_SendBlock(&category, sizeof(category)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
break; break;
case 1: case 1:
if (sub_80FC55C()) if (LinkContest_GetBlockReceivedFromAllPlayers())
{ {
for (i = 0; i < gNumLinkContestPlayers; i++) for (i = 0; i < gNumLinkContestPlayers; i++)
{ {
@ -309,7 +312,7 @@ static void sub_81DA488(u8 taskId)
if (!IsLinkTaskFinished()) if (!IsLinkTaskFinished())
return; return;
if (sub_80FC4F4(&gContestMons[gNumLinkContestPlayers], (4 - gNumLinkContestPlayers) * sizeof(struct ContestPokemon)) == 1) if (LinkContest_SendBlock(&gContestMons[gNumLinkContestPlayers], (CONTESTANT_COUNT - gNumLinkContestPlayers) * sizeof(struct ContestPokemon)) == 1)
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
else else
@ -318,11 +321,11 @@ static void sub_81DA488(u8 taskId)
} }
break; break;
case 1: case 1:
if (sub_80FC530(0)) if (LinkContest_GetBlockReceived(0))
{ {
memcpy(&gContestMons[gNumLinkContestPlayers], gBlockRecvBuffer[0], (4 - gNumLinkContestPlayers) * sizeof(struct ContestPokemon)); memcpy(&gContestMons[gNumLinkContestPlayers], gBlockRecvBuffer[0], (CONTESTANT_COUNT - gNumLinkContestPlayers) * sizeof(struct ContestPokemon));
for (i = gNumLinkContestPlayers; i < 4; i++) for (i = gNumLinkContestPlayers; i < CONTESTANT_COUNT; i++)
sub_80DFA08(&gContestMons[i], gLinkPlayers[0].language); StripPlayerAndMonNamesForLinkContest(&gContestMons[i], gLinkPlayers[0].language);
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }

View File

@ -653,7 +653,7 @@ static void Task_WaitForLinkPartnersBeforeResults(u8 taskId)
static void sub_80F5F14(u8 taskId) static void sub_80F5F14(u8 taskId)
{ {
SetTaskFuncWithFollowupFunc(taskId, sub_80FC998, sub_80F5F30); SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateMonIdxs, sub_80F5F30);
} }
static void sub_80F5F30(u8 taskId) static void sub_80F5F30(u8 taskId)
@ -2405,25 +2405,25 @@ void GetContestPlayerId(void)
gSpecialVar_0x8004 = gContestPlayerMonIndex; gSpecialVar_0x8004 = gContestPlayerMonIndex;
} }
void ContestLinkTransfer(u8 taskId) void ContestLinkTransfer(u8 category)
{ {
u8 newTaskId; u8 newTaskId;
ScriptContext2_Enable(); ScriptContext2_Enable();
newTaskId = CreateTask(sub_80FC580, 0); newTaskId = CreateTask(sub_80FC580, 0);
SetTaskFuncWithFollowupFunc(newTaskId, sub_80FC580, sub_80F8508); SetTaskFuncWithFollowupFunc(newTaskId, sub_80FC580, sub_80F8508);
gTasks[newTaskId].data[9] = taskId; gTasks[newTaskId].data[9] = category;
} }
static void sub_80F8508(u8 taskId) static void sub_80F8508(u8 taskId)
{ {
if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER) if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER)
{ {
sub_80DA8C8(gContestMonPartyIndex); CreateContestMonFromParty(gContestMonPartyIndex);
SetTaskFuncWithFollowupFunc(taskId, sub_80FC6BC, sub_80F8568); SetTaskFuncWithFollowupFunc(taskId, sub_80FC6BC, sub_80F8568);
} }
else else
{ {
sub_80DA8C8(gContestMonPartyIndex); CreateContestMonFromParty(gContestMonPartyIndex);
gTasks[taskId].func = sub_81D9DE4; gTasks[taskId].func = sub_81D9DE4;
} }
} }

View File

@ -203,7 +203,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 3, .smart = 3,
.tough = 4, .tough = 4,
.sheen = 50, .sheen = 50,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -232,7 +231,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 1, .smart = 1,
.tough = 2, .tough = 2,
.sheen = 60, .sheen = 60,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -261,7 +259,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 12, .smart = 12,
.tough = 4, .tough = 4,
.sheen = 70, .sheen = 70,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -290,7 +287,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 2, .smart = 2,
.tough = 7, .tough = 7,
.sheen = 80, .sheen = 80,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -319,7 +315,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 5, .smart = 5,
.tough = 4, .tough = 4,
.sheen = 90, .sheen = 90,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -348,7 +343,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 7, .smart = 7,
.tough = 8, .tough = 8,
.sheen = 100, .sheen = 100,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -377,7 +371,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 2, .smart = 2,
.tough = 2, .tough = 2,
.sheen = 50, .sheen = 50,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -406,7 +399,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 10, .tough = 10,
.sheen = 60, .sheen = 60,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -435,7 +427,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 5, .smart = 5,
.tough = 18, .tough = 18,
.sheen = 70, .sheen = 70,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -464,7 +455,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 2, .smart = 2,
.tough = 7, .tough = 7,
.sheen = 80, .sheen = 80,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -493,7 +483,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 8, .smart = 8,
.tough = 1, .tough = 1,
.sheen = 90, .sheen = 90,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -522,7 +511,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 2, .tough = 2,
.sheen = 100, .sheen = 100,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -551,7 +539,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 2, .smart = 2,
.tough = 10, .tough = 10,
.sheen = 50, .sheen = 50,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -580,7 +567,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 5, .tough = 5,
.sheen = 60, .sheen = 60,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -609,7 +595,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 1, .smart = 1,
.tough = 1, .tough = 1,
.sheen = 70, .sheen = 70,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -638,7 +623,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 4, .tough = 4,
.sheen = 50, .sheen = 50,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -667,7 +651,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 4, .tough = 4,
.sheen = 60, .sheen = 60,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -696,7 +679,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 2, .smart = 2,
.tough = 3, .tough = 3,
.sheen = 70, .sheen = 70,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -725,7 +707,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 5, .smart = 5,
.tough = 10, .tough = 10,
.sheen = 80, .sheen = 80,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -754,7 +735,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 3, .smart = 3,
.tough = 10, .tough = 10,
.sheen = 90, .sheen = 90,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -783,7 +763,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 1, .smart = 1,
.tough = 5, .tough = 5,
.sheen = 100, .sheen = 100,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -812,7 +791,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 6, .smart = 6,
.tough = 2, .tough = 2,
.sheen = 90, .sheen = 90,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -841,7 +819,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 5, .smart = 5,
.tough = 3, .tough = 3,
.sheen = 80, .sheen = 80,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -870,7 +847,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 8, .smart = 8,
.tough = 10, .tough = 10,
.sheen = 70, .sheen = 70,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -899,7 +875,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 20, .tough = 20,
.sheen = 100, .sheen = 100,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -928,7 +903,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 85, .smart = 85,
.tough = 35, .tough = 35,
.sheen = 110, .sheen = 110,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -957,7 +931,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 25, .tough = 25,
.sheen = 120, .sheen = 120,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -986,7 +959,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 65, .smart = 65,
.tough = 25, .tough = 25,
.sheen = 130, .sheen = 130,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1015,7 +987,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 100, .tough = 100,
.sheen = 140, .sheen = 140,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1044,7 +1015,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 35, .smart = 35,
.tough = 35, .tough = 35,
.sheen = 150, .sheen = 150,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1073,7 +1043,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 40, .smart = 40,
.tough = 40, .tough = 40,
.sheen = 100, .sheen = 100,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1102,7 +1071,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 10, .smart = 10,
.tough = 25, .tough = 25,
.sheen = 110, .sheen = 110,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1131,7 +1099,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 30, .smart = 30,
.tough = 25, .tough = 25,
.sheen = 120, .sheen = 120,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1160,7 +1127,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 40, .smart = 40,
.tough = 30, .tough = 30,
.sheen = 130, .sheen = 130,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1189,7 +1155,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 75, .smart = 75,
.tough = 35, .tough = 35,
.sheen = 140, .sheen = 140,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1218,7 +1183,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 30, .smart = 30,
.tough = 25, .tough = 25,
.sheen = 150, .sheen = 150,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1247,7 +1211,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 25, .smart = 25,
.tough = 15, .tough = 15,
.sheen = 100, .sheen = 100,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1276,7 +1239,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 60, .smart = 60,
.tough = 20, .tough = 20,
.sheen = 110, .sheen = 110,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1305,7 +1267,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 15, .smart = 15,
.tough = 75, .tough = 75,
.sheen = 120, .sheen = 120,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1334,7 +1295,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 30, .smart = 30,
.tough = 20, .tough = 20,
.sheen = 100, .sheen = 100,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1363,7 +1323,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 20, .smart = 20,
.tough = 20, .tough = 20,
.sheen = 110, .sheen = 110,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1392,7 +1351,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 20, .smart = 20,
.tough = 20, .tough = 20,
.sheen = 120, .sheen = 120,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1421,7 +1379,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 30, .smart = 30,
.tough = 45, .tough = 45,
.sheen = 130, .sheen = 130,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1450,7 +1407,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 20, .smart = 20,
.tough = 45, .tough = 45,
.sheen = 140, .sheen = 140,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1479,7 +1435,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 20, .smart = 20,
.tough = 20, .tough = 20,
.sheen = 150, .sheen = 150,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1508,7 +1463,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 25, .smart = 25,
.tough = 25, .tough = 25,
.sheen = 140, .sheen = 140,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1537,7 +1491,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 20, .smart = 20,
.tough = 20, .tough = 20,
.sheen = 130, .sheen = 130,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1566,7 +1519,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 45, .smart = 45,
.tough = 20, .tough = 20,
.sheen = 120, .sheen = 120,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1595,7 +1547,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 100, .smart = 100,
.tough = 90, .tough = 90,
.sheen = 200, .sheen = 200,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1624,7 +1575,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 35, .smart = 35,
.tough = 70, .tough = 70,
.sheen = 210, .sheen = 210,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1653,7 +1603,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 70, .smart = 70,
.tough = 70, .tough = 70,
.sheen = 220, .sheen = 220,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1682,7 +1631,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 75, .smart = 75,
.tough = 40, .tough = 40,
.sheen = 230, .sheen = 230,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1711,7 +1659,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 70, .smart = 70,
.tough = 70, .tough = 70,
.sheen = 240, .sheen = 240,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1740,7 +1687,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 80, .smart = 80,
.tough = 100, .tough = 100,
.sheen = 250, .sheen = 250,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1769,7 +1715,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 70, .smart = 70,
.tough = 90, .tough = 90,
.sheen = 200, .sheen = 200,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1798,7 +1743,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 50, .smart = 50,
.tough = 65, .tough = 65,
.sheen = 210, .sheen = 210,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1827,7 +1771,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 60, .smart = 60,
.tough = 50, .tough = 50,
.sheen = 220, .sheen = 220,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1856,7 +1799,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 45, .smart = 45,
.tough = 70, .tough = 70,
.sheen = 230, .sheen = 230,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1885,7 +1827,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 40, .smart = 40,
.tough = 100, .tough = 100,
.sheen = 240, .sheen = 240,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1914,7 +1855,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 50, .smart = 50,
.tough = 30, .tough = 30,
.sheen = 250, .sheen = 250,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1943,7 +1883,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 50, .smart = 50,
.tough = 160, .tough = 160,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -1972,7 +1911,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 70, .smart = 70,
.tough = 50, .tough = 50,
.sheen = 210, .sheen = 210,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2001,7 +1939,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 35, .smart = 35,
.tough = 35, .tough = 35,
.sheen = 220, .sheen = 220,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2030,7 +1967,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 100, .smart = 100,
.tough = 80, .tough = 80,
.sheen = 200, .sheen = 200,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2059,7 +1995,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 35, .smart = 35,
.tough = 100, .tough = 100,
.sheen = 210, .sheen = 210,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2088,7 +2023,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 50, .smart = 50,
.tough = 100, .tough = 100,
.sheen = 220, .sheen = 220,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2117,7 +2051,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 40, .smart = 40,
.tough = 95, .tough = 95,
.sheen = 230, .sheen = 230,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2146,7 +2079,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 50, .smart = 50,
.tough = 100, .tough = 100,
.sheen = 240, .sheen = 240,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2175,7 +2107,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 80, .smart = 80,
.tough = 80, .tough = 80,
.sheen = 250, .sheen = 250,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2204,7 +2135,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 40, .smart = 40,
.tough = 110, .tough = 110,
.sheen = 240, .sheen = 240,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2233,7 +2163,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 25, .smart = 25,
.tough = 80, .tough = 80,
.sheen = 230, .sheen = 230,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2262,7 +2191,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 35, .smart = 35,
.tough = 40, .tough = 40,
.sheen = 220, .sheen = 220,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2291,7 +2219,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 40, .smart = 40,
.tough = 160, .tough = 160,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2320,7 +2247,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 150, .smart = 150,
.tough = 160, .tough = 160,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2349,7 +2275,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 185, .smart = 185,
.tough = 60, .tough = 60,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2378,7 +2303,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 110, .smart = 110,
.tough = 150, .tough = 150,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2407,7 +2331,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 30, .smart = 30,
.tough = 90, .tough = 90,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2436,7 +2359,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 230, .smart = 230,
.tough = 80, .tough = 80,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2465,7 +2387,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 130, .smart = 130,
.tough = 40, .tough = 40,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2494,7 +2415,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 150, .smart = 150,
.tough = 160, .tough = 160,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2523,7 +2443,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 130, .smart = 130,
.tough = 170, .tough = 170,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2552,7 +2471,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 75, .smart = 75,
.tough = 100, .tough = 100,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2581,7 +2499,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 40, .smart = 40,
.tough = 190, .tough = 190,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2610,7 +2527,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 240, .smart = 240,
.tough = 140, .tough = 140,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2639,7 +2555,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 35, .smart = 35,
.tough = 50, .tough = 50,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2668,7 +2583,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 115, .smart = 115,
.tough = 120, .tough = 120,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2697,7 +2611,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 220, .smart = 220,
.tough = 210, .tough = 210,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2726,7 +2639,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 80, .smart = 80,
.tough = 180, .tough = 180,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2755,7 +2667,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 130, .smart = 130,
.tough = 130, .tough = 130,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2784,7 +2695,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 120, .smart = 120,
.tough = 150, .tough = 150,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2813,7 +2723,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 170, .smart = 170,
.tough = 80, .tough = 80,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2842,7 +2751,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 150, .smart = 150,
.tough = 120, .tough = 120,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2871,7 +2779,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 120, .smart = 120,
.tough = 80, .tough = 80,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2900,7 +2807,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 80, .smart = 80,
.tough = 150, .tough = 150,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2929,7 +2835,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 110, .smart = 110,
.tough = 170, .tough = 170,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
}, },
@ -2958,7 +2863,6 @@ const struct ContestPokemon gContestOpponents[] =
.smart = 80, .smart = 80,
.tough = 190, .tough = 190,
.sheen = 255, .sheen = 255,
.unk2C = {0},
.personality = 0, .personality = 0,
.otId = 0xFFFF .otId = 0xFFFF
} }

View File

@ -461,12 +461,12 @@ const u32 gContestMiscGfx[] = INCBIN_U32("graphics/contest/misc.4bpp.lz");
const u32 gContestAudienceGfx[] = INCBIN_U32("graphics/contest/audience.4bpp.lz"); const u32 gContestAudienceGfx[] = INCBIN_U32("graphics/contest/audience.4bpp.lz");
const u32 gUnknown_08C19168[] = INCBIN_U32("graphics/contest/faces.4bpp.lz"); const u32 gContestFaces_Gfx[] = INCBIN_U32("graphics/contest/faces.4bpp.lz");
const u32 gContestJudgeSymbolsGfx[] = INCBIN_U32("graphics/contest/judge_symbols.4bpp.lz"); const u32 gContestJudgeSymbolsGfx[] = INCBIN_U32("graphics/contest/judge_symbols.4bpp.lz");
const u32 gContest3Pal[] = INCBIN_U32("graphics/contest/judge_symbols.gbapal.lz"); const u32 gContest3Pal[] = INCBIN_U32("graphics/contest/judge_symbols.gbapal.lz");
const u8 gTiles_8C19450[] = INCBIN_U8("graphics/contest/heart.4bpp"); const u8 gContestSliderHeart_Gfx[] = INCBIN_U8("graphics/contest/slider_heart.4bpp");
const u32 gUnknownGfx_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.4bpp.lz"); const u32 gUnknownGfx_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.4bpp.lz");
const u32 gUnknownPal_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.gbapal.lz"); const u32 gUnknownPal_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.gbapal.lz");

View File

@ -4499,8 +4499,8 @@ void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord)
for (j = 0; j < MAX_MON_MOVES; j++) for (j = 0; j < MAX_MON_MOVES; j++)
{ {
SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, &gBattleResources->secretBase->party.moves[i * 4 + j]); SetMonData(&gEnemyParty[i], MON_DATA_MOVE1 + j, &gBattleResources->secretBase->party.moves[i * MAX_MON_MOVES + j]);
SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[gBattleResources->secretBase->party.moves[i * 4 + j]].pp); SetMonData(&gEnemyParty[i], MON_DATA_PP1 + j, &gBattleMoves[gBattleResources->secretBase->party.moves[i * MAX_MON_MOVES + j]].pp);
} }
} }
} }