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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -874,14 +874,14 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
if (IsContest()) if (IsContest())
{ {
position = 0; position = 0;
targetSpecies = gContestResources->field_18->unk2; targetSpecies = gContestResources->moveAnim->targetSpecies;
personalityValue = gContestResources->field_18->unk8; personalityValue = gContestResources->moveAnim->personality;
otId = gContestResources->field_18->unkC; otId = gContestResources->moveAnim->otId;
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies], HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[0], gMonSpritesGfxPtr->sprites[0],
targetSpecies, targetSpecies,
gContestResources->field_18->unk10); gContestResources->moveAnim->targetPersonality);
} }
else 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; u16 result = FALSE;
u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]); u8 contestant = GetContestantIdByTurn(gAIScriptPtr[1]);
if (sub_80DE1E8(contestant)) if (IsContestantAllowedToCombo(contestant))
result = gContestMoves[eContestantStatus[contestant].prevMove].comboStarterId ? TRUE : FALSE; result = gContestMoves[eContestantStatus[contestant].prevMove].comboStarterId ? TRUE : FALSE;
eContestAI.scriptResult = result; eContestAI.scriptResult = result;

View File

@ -423,7 +423,7 @@ static void ContestEffect_MakeFollowingMonsNervous(void)
} }
for (i = 0; i < CONTESTANT_COUNT; i++) 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; oddsMod[i] = gComboStarterLookupTable[gContestMoves[eContestantStatus[i].prevMove].comboStarterId] * 10;
else else
oddsMod[i] = 0; oddsMod[i] = 0;

View File

@ -122,8 +122,8 @@ static void CB2_ShowContestResults(void);
static void VBlankCB_ShowContestResults(void); static void VBlankCB_ShowContestResults(void);
static void Task_SlideContestResultsBg(u8); static void Task_SlideContestResultsBg(u8);
static void Task_WaitForLinkPartnersBeforeResults(u8); static void Task_WaitForLinkPartnersBeforeResults(u8);
static void sub_80F5F14(u8); static void Task_CommunicateMonIdxsForResults(u8);
static void sub_80F5F30(u8); static void Task_WaitForLinkPartnerMonIdxs(u8);
static void Task_AnnouncePreliminaryResults(u8); static void Task_AnnouncePreliminaryResults(u8);
static void Task_FlashStarsAndHearts(u8); static void Task_FlashStarsAndHearts(u8);
static void Task_ShowPreliminaryResults(u8); static void Task_ShowPreliminaryResults(u8);
@ -657,17 +657,17 @@ static void Task_WaitForLinkPartnersBeforeResults(u8 taskId)
{ {
if (gReceivedRemoteLinkPlayers) if (gReceivedRemoteLinkPlayers)
{ {
CreateTask(sub_80F5F14, 0); CreateTask(Task_CommunicateMonIdxsForResults, 0);
gTasks[taskId].func = TaskDummy; 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()) if (IsLinkTaskFinished())
{ {