Document contest appeal

This commit is contained in:
GriffinR 2020-08-13 19:10:23 -04:00
parent 3779422489
commit c42c1ab8c1
13 changed files with 1203 additions and 1017 deletions

View File

@ -123,15 +123,15 @@ struct Shared1A004
u8 savedJunk[0x800];
};
struct ContestStruct_field_18
struct ContestMoveAnimData
{
u16 species;
u16 unk2;
u8 unk4_0:1;
u8 unk5;
u32 unk8;
u32 unkC;
u32 unk10;
u16 targetSpecies;
bool8 hasTargetAnim:1;
u8 contestant;
u32 personality;
u32 otId;
u32 targetPersonality;
};
struct Contest
@ -143,29 +143,29 @@ struct Contest
bool16 unk1920A_1:1;
bool16 unk1920A_2:1;
bool16 unk1920A_3:1;
bool16 unk1920A_4:1;
bool16 waitForJudgeSpeechBubble:1;
bool16 isShowingApplauseMeter:1;
bool16 applauseMeterIsMoving:1;
bool16 unk1920A_7:1;
bool16 unk1920B_0:1;
bool16 animatingAudience:1;
bool16 waitForAudienceBlend:1;
bool16 sliderHeartsAnimating:1; // When the slider heart is appearing/disappearing
bool16 unk1920B_2:1;
bool16 waitForLink:1;
u8 mainTaskId;
u8 unk1920D[4];
u8 unk19211;
u8 judgeAttentionTaskId;
u8 unk19212;
u8 filler19213;
u8 turnNumber;
u8 currentContestant;
u8 unk19216; // sprite ID
u8 judgeSpeechBubbleSpriteId;
s8 applauseLevel;
u8 prevTurnOrder[CONTESTANT_COUNT];
u32 unk1921C; // saved RNG value?
u32 unusedRng;
u16 moveHistory[CONTEST_NUM_APPEALS][CONTESTANT_COUNT];
u8 excitementHistory[CONTEST_NUM_APPEALS][CONTESTANT_COUNT];
u8 applauseMeterSpriteId;
u8 contestSetupState;
u8 unk1925E;
u8 moveAnimTurnCount;
};
struct ContestantStatus
@ -177,7 +177,7 @@ struct ContestantStatus
u16 prevMove;
u8 moveCategory;
u8 ranking:2;
u8 unkB_2:2;
u8 unused1:2;
u8 moveRepeatCount:3;
bool8 noMoreTurns:1; // used a one-time move?
bool8 nervous:1;
@ -203,18 +203,18 @@ struct ContestantStatus
u8 effectStringId; // status action?
u8 effectStringId2;
bool8 repeatedMove:1;
bool8 unused:1;
bool8 unused2:1;
bool8 repeatedPrevMove:1; // never read
bool8 unk15_3:1;
bool8 hasJudgesAttention:1;
bool8 judgesAttentionWasRemoved:1;
bool8 unk15_6:1;
u8 unk16;
bool8 usedComboMove:1;
bool8 completedCombo;
u8 unk17;
u8 unk18;
u8 nextTurnOrder; // turn position
u8 attentionLevel; // How much the Pokemon "stood out"
u8 unk1B;
u8 contestantAnimTarget;
};
struct UnknownContestStruct7
@ -246,7 +246,7 @@ struct ContestAIInfo
struct UnknownContestStruct5
{
s8 bits_0; // current move excitement?
s8 moveExcitement;
u8 excitementFrozen:1;
u8 excitementFreezer:3;
s8 unk2;
@ -256,17 +256,17 @@ struct UnknownContestStruct4
{
u8 sliderHeartSpriteId;
u8 nextTurnSpriteId;
u8 sliderUpdating:1;
u8 unk2_1:1;
u8 unk2_2:1;
bool8 sliderUpdating:1;
bool8 boxBlinking:1;
bool8 updatingAppealHearts:1;
};
struct UnknownContestStruct6
struct ContestFinalStandings
{
s32 unk0;
s32 unk4;
s32 unk8;
s32 unkC;
s32 totalPoints;
s32 round1Points;
s32 random;
s32 contestant;
};
struct ContestResourcesField1C
@ -292,12 +292,12 @@ struct ContestResources
struct ContestAIInfo *aiData;
struct UnknownContestStruct5 *field_10;
struct UnknownContestStruct4 *field_14;
struct ContestStruct_field_18 *field_18;
struct ContestMoveAnimData *moveAnim;
struct ContestResourcesField1C * field_1c;
struct ContestResourcesField20 * field_20;
u8 * contestBgTilemaps[CONTESTANT_COUNT];
void * field_34;
void * field_38;
void * boxBlinkTiles1;
void * boxBlinkTiles2;
void * field_3c;
};
@ -307,8 +307,8 @@ struct ContestResources
#define eContestAI (*gContestResources->aiData)
#define eContestResources10 (*gContestResources->field_10)
#define eContestResources14 (*gContestResources->field_14)
#define eUnzippedContestAudienceGfx (gHeap + 0x18000)
#define eUnknownHeap19000 (gHeap + 0x19000)
#define eUnzippedContestAudience_Gfx (gHeap + 0x18000)
#define eContestAudienceFrame2_Gfx (gHeap + 0x19000)
#define eContestDebugMode (gHeap[0x1a000])
#define eUnknownHeap1A004 (*(struct Shared1A004 *)(gHeap + 0x1a004))
@ -352,7 +352,7 @@ void SetContestantEffectStringID2(u8 a, u8 b);
void SetStartledString(u8 contestant, u8 jam);
void MakeContestantNervous(u8 p);
s8 Contest_GetMoveExcitement(u16 move);
bool8 sub_80DE1E8(u8 a);
bool8 IsContestantAllowedToCombo(u8 contestant);
void Contest_PrintTextToBg0WindowAt(u32 windowId, u8 *currChar, s32 x, s32 y, s32 fontId);
void ResetContestLinkResults(void);
bool8 sub_80DEDA8(u8 a);

View File

@ -1849,8 +1849,8 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
}
else
{
for (i = 0; i < 4; i++)
gAnimBattlerSpecies[i] = gContestResources->field_18->species;
for (i = 0; i < CONTESTANT_COUNT; i++)
gAnimBattlerSpecies[i] = gContestResources->moveAnim->species;
}
if (!isMoveAnim)
@ -2311,7 +2311,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
battlerSpriteId = gBattlerSpriteIds[battlerId];
gBattle_BG1_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20;
if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->species))
if (IsContest() && IsSpeciesNotUnown(gContestResources->moveAnim->species))
gBattle_BG1_X--;
gBattle_BG1_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20;
@ -2369,7 +2369,7 @@ static void sub_80A46A0(void)
struct BattleAnimBgData animBg;
u16 *ptr;
if (IsSpeciesNotUnown(gContestResources->field_18->species))
if (IsSpeciesNotUnown(gContestResources->moveAnim->species))
{
sub_80A6B30(&animBg);
ptr = animBg.bgTilemap;

View File

@ -849,7 +849,7 @@ void AnimTask_MetallicShine(u8 taskId)
if (IsContest())
{
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
}
else
{

View File

@ -2297,7 +2297,7 @@ void AnimTask_TransformMon(u8 taskId)
LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset);
if (IsContest())
{
if (IsSpeciesNotUnown(gContestResources->field_18->species) != IsSpeciesNotUnown(gContestResources->field_18->unk2))
if (IsSpeciesNotUnown(gContestResources->moveAnim->species) != IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies))
{
bgTilemap = (u16 *)animBg.bgTilemap;
for (i = 0; i < 8; i++)
@ -2319,7 +2319,7 @@ void AnimTask_TransformMon(u8 taskId)
}
}
if (IsSpeciesNotUnown(gContestResources->field_18->unk2))
if (IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies))
gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF6C0;
else
gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gUnknown_082FF694;
@ -3196,10 +3196,10 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
GetAnimBattlerSpriteId(ANIM_ATTACKER);
if (IsContest())
{
isBackPic = 1;
personality = gContestResources->field_18->unk10;
otId = gContestResources->field_18->unkC;
species = gContestResources->field_18->unk2;
isBackPic = TRUE;
personality = gContestResources->moveAnim->targetPersonality;
otId = gContestResources->moveAnim->otId;
species = gContestResources->moveAnim->targetSpecies;
xOffset = 20;
priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
}
@ -5031,9 +5031,9 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
case 1:
if (IsContest())
{
personality = gContestResources->field_18->unk8;
otId = gContestResources->field_18->unkC;
species = gContestResources->field_18->species;
personality = gContestResources->moveAnim->personality;
otId = gContestResources->moveAnim->otId;
species = gContestResources->moveAnim->species;
subpriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
isBackPic = 0;
x = -32;

View File

@ -141,10 +141,10 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType)
default:
if (IsContest())
{
if (gContestResources->field_18->unk4_0)
species = gContestResources->field_18->unk2;
if (gContestResources->moveAnim->hasTargetAnim)
species = gContestResources->moveAnim->targetSpecies;
else
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
}
else
{
@ -189,10 +189,10 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species)
{
if (IsContest())
{
if (gContestResources->field_18->unk4_0)
personality = gContestResources->field_18->unk10;
if (gContestResources->moveAnim->hasTargetAnim)
personality = gContestResources->moveAnim->targetPersonality;
else
personality = gContestResources->field_18->unk8;
personality = gContestResources->moveAnim->personality;
}
else
{
@ -306,10 +306,10 @@ u8 GetBattlerSpriteCoord2(u8 battlerId, u8 coordType)
{
if (IsContest())
{
if (gContestResources->field_18->unk4_0)
species = gContestResources->field_18->unk2;
if (gContestResources->moveAnim->hasTargetAnim)
species = gContestResources->moveAnim->targetSpecies;
else
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
}
else
{
@ -1851,7 +1851,7 @@ static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId)
{
if (IsContest())
{
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
return gMonBackPicCoords[species].y_offset;
}
else
@ -2103,15 +2103,15 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
if (IsContest())
{
if (gContestResources->field_18->unk4_0)
if (gContestResources->moveAnim->hasTargetAnim)
{
species = gContestResources->field_18->unk2;
personality = gContestResources->field_18->unk10;
species = gContestResources->moveAnim->targetSpecies;
personality = gContestResources->moveAnim->targetPersonality;
}
else
{
species = gContestResources->field_18->species;
personality = gContestResources->field_18->unk8;
species = gContestResources->moveAnim->species;
personality = gContestResources->moveAnim->personality;
}
if (species == SPECIES_UNOWN)
{

View File

@ -134,7 +134,7 @@ void SoundTask_PlayCryHighPitch(u8 taskId)
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
@ -180,7 +180,7 @@ void SoundTask_PlayDoubleCry(u8 taskId)
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
@ -284,7 +284,7 @@ void SoundTask_PlayCryWithEcho(u8 taskId)
pan = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
if (IsContest())
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
else
species = gAnimBattlerSpecies[gBattleAnimAttacker];

View File

@ -318,7 +318,7 @@ void AnimTask_DrawFallingWhiteLinesOnAttacker(u8 taskId)
if (IsContest())
{
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
}
else
{
@ -440,7 +440,7 @@ static void sub_8116F04(u8 taskId)
if (IsContest())
{
sAnimStatsChangeData->species = gContestResources->field_18->species;
sAnimStatsChangeData->species = gContestResources->moveAnim->species;
}
else
{
@ -810,7 +810,7 @@ void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5,
if (IsContest())
{
species = gContestResources->field_18->species;
species = gContestResources->moveAnim->species;
}
else
{

View File

@ -874,14 +874,14 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
if (IsContest())
{
position = 0;
targetSpecies = gContestResources->field_18->unk2;
personalityValue = gContestResources->field_18->unk8;
otId = gContestResources->field_18->unkC;
targetSpecies = gContestResources->moveAnim->targetSpecies;
personalityValue = gContestResources->moveAnim->personality;
otId = gContestResources->moveAnim->otId;
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[0],
targetSpecies,
gContestResources->field_18->unk10);
gContestResources->moveAnim->targetPersonality);
}
else
{

File diff suppressed because it is too large Load Diff

View File

@ -1200,7 +1200,7 @@ static void ContestAICmd_get_used_combo_starter(void)
u16 result = FALSE;
u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
if (sub_80DE1E8(contestant))
if (IsContestantAllowedToCombo(contestant))
result = gContestMoves[eContestantStatus[contestant].prevMove].comboStarterId ? TRUE : FALSE;
eContestAI.scriptResult = result;

View File

@ -423,7 +423,7 @@ static void ContestEffect_MakeFollowingMonsNervous(void)
}
for (i = 0; i < CONTESTANT_COUNT; i++)
{
if (eContestantStatus[i].hasJudgesAttention && sub_80DE1E8(i))
if (eContestantStatus[i].hasJudgesAttention && IsContestantAllowedToCombo(i))
oddsMod[i] = gComboStarterLookupTable[gContestMoves[eContestantStatus[i].prevMove].comboStarterId] * 10;
else
oddsMod[i] = 0;

View File

@ -122,8 +122,8 @@ static void CB2_ShowContestResults(void);
static void VBlankCB_ShowContestResults(void);
static void Task_SlideContestResultsBg(u8);
static void Task_WaitForLinkPartnersBeforeResults(u8);
static void sub_80F5F14(u8);
static void sub_80F5F30(u8);
static void Task_CommunicateMonIdxsForResults(u8);
static void Task_WaitForLinkPartnerMonIdxs(u8);
static void Task_AnnouncePreliminaryResults(u8);
static void Task_FlashStarsAndHearts(u8);
static void Task_ShowPreliminaryResults(u8);
@ -657,17 +657,17 @@ static void Task_WaitForLinkPartnersBeforeResults(u8 taskId)
{
if (gReceivedRemoteLinkPlayers)
{
CreateTask(sub_80F5F14, 0);
CreateTask(Task_CommunicateMonIdxsForResults, 0);
gTasks[taskId].func = TaskDummy;
}
}
static void sub_80F5F14(u8 taskId)
static void Task_CommunicateMonIdxsForResults(u8 taskId)
{
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateMonIdxs, sub_80F5F30);
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateMonIdxs, Task_WaitForLinkPartnerMonIdxs);
}
static void sub_80F5F30(u8 taskId)
static void Task_WaitForLinkPartnerMonIdxs(u8 taskId)
{
if (IsLinkTaskFinished())
{