diff --git a/data/contest.s b/data/contest.s index 7ed6e24bc..69a2f142d 100644 --- a/data/contest.s +++ b/data/contest.s @@ -156,23 +156,23 @@ gOamData_83CA49C:: @ 83CA49C .2byte 0x2C00 .align 2 -gSpriteTemplate_83CA4A4:: @ 83CA4A4 +sSpriteTemplate_Judge:: @ 83CA4A4 spr_template 20005, 20005, gOamData_83CA49C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy .align 2 -gUnknown_083CA4BC:: @ 83CA4BC +sSpriteSheet_Judge:: @ 83CA4BC obj_tiles gContestJudgeGfx, 2048, 0x4e25 .align 2 -gUnknown_083CA4C4:: @ 83CA4C4 +sSpriteSheet_JudgeSymbols:: @ 83CA4C4 obj_tiles gContestJudgeSymbolsGfx, 896, 0xabe0 .align 2 -gUnknown_083CA4CC:: @ 83CA4CC +sSpritePalette_JudgeSymbols:: @ 83CA4CC obj_pal gContest3Pal, 0xabe0 .align 2 -gUnknown_083CA4D4:: @ 83CA4D4 +sSpriteTemplate_JudgeSpeechBubble:: @ 83CA4D4 spr_template 0xABE0, 0xABE0, gOamData_837DF2C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy .include "data/text/contest_strings.inc" @@ -347,7 +347,7 @@ gSpriteTemplate_83CC584:: @ 83CC584 gUnknown_083CC59C:: @ 83CC59C .string "{HIGHLIGHT TRANSPARENT}{COLOR}$" -gUnknown_083CC5A2:: @ 83CC5A2 +gText_Slash:: @ 83CC5A2 .string "/$" .align 1 diff --git a/include/contest.h b/include/contest.h index a9ef50e0c..8281b76ce 100644 --- a/include/contest.h +++ b/include/contest.h @@ -295,13 +295,13 @@ void CB2_StartContest(void); void Contest_CreatePlayerMon(u8); void Contest_InitAllPokemon(u8, u8); u8 CanMonParticipateInContest(struct Pokemon *party); -u16 InitContestMonConditionI(u8, u8); -void InitContestMonConditions(u8); +u16 CalculateContestantRound1Points(u8, u8); +void CalculateRound1Points(u8); u8 IsSpeciesNotUnown(u16); -void sub_80AF668(void); +void CalculateFinalScores(void); void SortContestants(u8); bool8 Contest_SaveWinner(u8); -u8 sub_80B2C4C(u8, u8); +u8 GetContestWinnerSaveIdx(u8, u8); void Contest_ResetWinners(void); s8 Contest_GetMoveExcitement(u16); @@ -439,12 +439,12 @@ struct UnknownContestStruct8 u32 unk10; }; -struct UnknownContestStruct6 +struct ContestFinalStandings { - s32 unk0; - s32 unk4; - s32 unk8; - s32 unkC; + s32 totalPoints; + s32 round1Points; + s32 random; + s32 contestant; }; // TODO: Please move these to ewram.h once the defines are settled down and figured out completely. @@ -463,13 +463,13 @@ struct UnknownContestStruct6 extern u8 gContestPlayerMonIndex; extern u8 gIsLinkContest; extern u32 gContestRngValue; -extern u8 gUnknown_02038696[4]; +extern u8 gContestantTurnOrder[4]; extern s16 gContestMonRound1Points[4]; extern s16 gContestMonTotalPoints[4]; -extern s16 gUnknown_02038680[4]; -extern s16 gUnknown_02038688[4]; +extern s16 gContestMonAppealPointTotals[4]; +extern s16 gContestMonRound2Points[4]; extern u8 gContestFinalStandings[4]; -extern u8 gUnknown_02038696[4]; +extern u8 gContestantTurnOrder[4]; extern u8 gContestLinkLeaderIndex; extern u16 gSpecialVar_ContestRank; extern u16 gSpecialVar_ContestCategory; diff --git a/include/easy_chat.h b/include/easy_chat.h index 729bc0b62..468902e4c 100644 --- a/include/easy_chat.h +++ b/include/easy_chat.h @@ -18,7 +18,7 @@ struct Shared1000 u16 *unk4; u8 unk8; u8 unk9; - u8 unkA; // length of unkC array + u8 unkA; // length of contestant array u8 unkB; // reporter talked to (Gabby or Ty) u16 unkC[9]; void (*unk20)(void); diff --git a/include/text.h b/include/text.h index 920093a1d..1d79eeb46 100644 --- a/include/text.h +++ b/include/text.h @@ -75,7 +75,6 @@ #define CHAR_NEWLINE 0xFE #define EOS 0xFF // end of string -#define EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW 4 #define TEXT_COLOR_TRANSPARENT 0x00 #define TEXT_COLOR_DARK_GREY 0x01 #define TEXT_COLOR_RED 0x02 @@ -93,8 +92,28 @@ #define TEXT_COLOR_LIGHT_BLUE 0x0E #define TEXT_COLOR_WHITE2 0x0F -#define EXT_CTRL_CODE_CLEAR 17 - +#define EXT_CTRL_CODE_COLOR 0x01 +#define EXT_CTRL_CODE_HIGHLIGHT 0x02 +#define EXT_CTRL_CODE_SHADOW 0x03 +#define EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW 0x04 +#define EXT_CTRL_CODE_PALETTE 0x05 +#define EXT_CTRL_CODE_SIZE 0x06 +#define EXT_CTRL_CODE_RESET_SIZE 0x07 +#define EXT_CTRL_CODE_PAUSE 0x08 +#define EXT_CTRL_CODE_PAUSE_UNTIL_PRESS 0x09 +#define EXT_CTRL_CODE_WAIT_SE 0x0A +#define EXT_CTRL_CODE_PLAY_BGM 0x0B +#define EXT_CTRL_CODE_ESCAPE 0x0C +#define EXT_CTRL_CODE_SHIFT_TEXT 0x0D // nop +#define EXT_CTRL_CODE_SHIFT_DOWN 0x0E +#define EXT_CTRL_CODE_FILL_WINDOW 0x0F +#define EXT_CTRL_CODE_PLAY_SE 0x10 +#define EXT_CTRL_CODE_CLEAR 0x11 +#define EXT_CTRL_CODE_SKIP 0x12 +#define EXT_CTRL_CODE_CLEAR_TO 0x13 +#define EXT_CTRL_CODE_MIN_LETTER_SPACING 0x14 +#define EXT_CTRL_CODE_JPN 0x15 +#define EXT_CTRL_CODE_ENG 0x16 struct WindowTemplate { diff --git a/src/battle_bg.c b/src/battle_bg.c index c3c08aa0e..f9b1e192c 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -19,7 +19,7 @@ extern u16 gBattleTypeFlags; extern u8 gBattleOutcome; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern u8 BattleText_Win[]; extern u8 BattleText_Loss[]; @@ -247,9 +247,9 @@ void sub_800D6D4(void) void ApplyPlayerChosenFrameToBattleMenu(void) { TextWindow_SetBaseTileNum(0x12); - TextWindow_LoadStdFrameGraphicsOverridePal(&gUnknown_03004210, 1); + TextWindow_LoadStdFrameGraphicsOverridePal(&gWindowTemplate_Contest_MoveDescription, 1); TextWindow_SetBaseTileNum(0x22); - TextWindow_LoadStdFrameGraphicsOverridePal(&gUnknown_03004210, 1); + TextWindow_LoadStdFrameGraphicsOverridePal(&gWindowTemplate_Contest_MoveDescription, 1); gPlttBufferUnfaded[92] = 0x7fe0; gPlttBufferUnfaded[93] = 0x2529; gPlttBufferUnfaded[94] = 0x7fff; @@ -444,8 +444,8 @@ static void sub_800DAF8(u8 taskId, u8 windowId, u8 *dest) #define PRINT_MESSAGE(text, tileDataStartOffset, x) \ { \ - Text_InitWindow(&gUnknown_03004210, text, tileDataStartOffset, x, MESSAGE_Y); \ - Text_PrintWindow8002F44(&gUnknown_03004210); \ + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, text, tileDataStartOffset, x, MESSAGE_Y); \ + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); \ } #define PRINT_MESSAGE_LEFT(text, tileDataStartOffset) PRINT_MESSAGE(text, tileDataStartOffset, LEFT_MESSAGE_X) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 90af47511..adbad297d 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -48,7 +48,7 @@ extern u16 gIntroSlideFlags; extern u8 gUnknown_02024E68[]; extern struct SpriteTemplate gUnknown_02024E8C; extern u8 gAnimMoveTurn; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern u8 gUnknown_0300434C[]; extern u32 gBattleControllerExecFlags; extern MainCallback gPreBattleCallback1; @@ -427,7 +427,7 @@ void sub_8037BBC(void) void sub_8037C2C(void) { - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) LinkOpponentBufferExecCompleted(); } @@ -1405,7 +1405,7 @@ void LinkOpponentHandlePrintString(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; BufferStringBattle(*(u16 *)&gBattleBufferA[gActiveBattler][2]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gBattlerControllerFuncs[gActiveBattler] = sub_8037C2C; } diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 45b2afae9..39e1a4a0f 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -48,7 +48,7 @@ extern u16 gAnimMovePower; extern u8 gAnimFriendship; extern u16 gWeatherMoveAnim; extern u8 gAnimMoveTurn; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern MainCallback gPreBattleCallback1; extern void (*gBattlerControllerFuncs[])(void); extern u8 gHealthboxSpriteIds[]; @@ -368,7 +368,7 @@ void sub_811DF34(void) void sub_811DFA0(void) { - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) LinkPartnerBufferExecCompleted(); } @@ -1341,7 +1341,7 @@ void LinkPartnerHandlePrintString(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; BufferStringBattle(*(u16 *)&gBattleBufferA[gActiveBattler][2]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gBattlerControllerFuncs[gActiveBattler] = sub_811DFA0; } diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 882c34b7f..d148962cf 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -53,7 +53,7 @@ extern u32 gTransformedPersonalities[]; extern u8 gAnimMoveTurn; extern u8 gAnimScriptActive; extern void (*gAnimScriptCallback)(void); -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern u8 gDisplayedStringBattle[]; extern u8 gBattlerTarget; extern u8 gAbsentBattlerFlags; @@ -432,7 +432,7 @@ void sub_8033160(void) void sub_80331D0(void) { - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) OpponentBufferExecCompleted(); } @@ -1409,7 +1409,7 @@ void OpponentHandlePrintString(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; BufferStringBattle(*(u16 *)&gBattleBufferA[gActiveBattler][2]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gBattlerControllerFuncs[gActiveBattler] = sub_80331D0; } diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 967ff347b..7a1c7682e 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -36,7 +36,7 @@ struct MovePpInfo #define SUB_803037C_TILE_DATA_OFFSET 444 #endif -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern void (*gBattlerControllerFuncs[])(void); @@ -141,7 +141,7 @@ extern u8 gAbsentBattlerFlags; extern u8 gUnknown_03004344; extern u8 gBattlersCount; extern u16 gBattlerPartyIndexes[]; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern const u8 BattleText_SwitchWhich[]; extern u8 gUnknown_03004348; extern struct BattlePokemon gBattleMons[]; @@ -739,9 +739,9 @@ void sub_802C68C(void) else gUnknown_03004344 = gMoveSelectionCursor[gActiveBattler] + 1; sub_802E3B4(gUnknown_03004344, 27); - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 0x17, 0x37, 0x1C, 0x3A); - Text_InitWindow(&gUnknown_03004210, BattleText_SwitchWhich, 0x290, 0x17, 0x37); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 0x17, 0x37, 0x1C, 0x3A); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_SwitchWhich, 0x290, 0x17, 0x37); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); gBattlerControllerFuncs[gActiveBattler] = sub_802CA60; } } @@ -751,34 +751,34 @@ void sub_802C68C(void) const u8 *moveName; s32 i; - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 1, 0x37, 16, 0x3A); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 1, 0x37, 16, 0x3A); moveName = gMoveNames[GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1)]; - Text_InitWindowAndPrintText(&gUnknown_03004210, moveName, 0x100, 2, 0x37); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, moveName, 0x100, 2, 0x37); ConvertIntToDecimalStringN( gDisplayedStringBattle, GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1), 2, 3); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 0x110, 10, 0x37); - Text_InitWindowAndPrintText(&gUnknown_03004210, gString_TurnJP, 0x116, 1, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x110, 10, 0x37); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gString_TurnJP, 0x116, 1, 0x39); ConvertIntToDecimalStringN(gDisplayedStringBattle, gAnimMoveTurn, 2, 3); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 0x11C, 4, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x11C, 4, 0x39); for (i = 0; i < 64; i++) { if (gSprites[i].inUse) count++; } ConvertIntToDecimalStringN(gDisplayedStringBattle, count, 2, 2); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 0x122, 8, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x122, 8, 0x39); count = GetTaskCount(); ConvertIntToDecimalStringN(gDisplayedStringBattle, count, 2, 2); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 0x126, 11, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x126, 11, 0x39); for (i = 0, count = 0; i < 32; i++) { if (gOamMatrixAllocBitmap & (1 << i)) count++; } ConvertIntToDecimalStringN(gDisplayedStringBattle, count, 2, 2); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 0x12A, 14, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x12A, 14, 0x39); gBattlerControllerFuncs[gActiveBattler] = debug_sub_8030C24; } #endif @@ -885,9 +885,9 @@ void sub_802CA60(void) gBattlerControllerFuncs[gActiveBattler] = sub_802C68C; gMoveSelectionCursor[gActiveBattler] = gUnknown_03004344; sub_802E3B4(gMoveSelectionCursor[gActiveBattler], 0); - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 0x17, 0x37, 0x1C, 0x3A); - Text_InitWindow(&gUnknown_03004210, BattleText_PP, 0x290, 0x17, 0x37); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 0x17, 0x37, 0x1C, 0x3A); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_PP, 0x290, 0x17, 0x37); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); sub_802E220(); sub_802E2D4(); } @@ -898,9 +898,9 @@ void sub_802CA60(void) sub_802E3B4(gMoveSelectionCursor[gActiveBattler], 0); sub_802E12C(gMoveSelectionCursor[gActiveBattler], BattleText_Format); gBattlerControllerFuncs[gActiveBattler] = sub_802C68C; - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 0x17, 0x37, 0x1C, 0x3A); - Text_InitWindow(&gUnknown_03004210, BattleText_PP, 0x290, 0x17, 0x37); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 0x17, 0x37, 0x1C, 0x3A); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_PP, 0x290, 0x17, 0x37); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); sub_802E220(); sub_802E2D4(); } @@ -1045,10 +1045,10 @@ void debug_sub_8030C24(void) move = 1; SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1, &move); gBattleMons[gActiveBattler].moves[0] = move; - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 1, 0x37, 16, 0x38); - Text_InitWindowAndPrintText(&gUnknown_03004210, gMoveNames[move], 0x100, 2, 0x37); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 1, 0x37, 16, 0x38); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gMoveNames[move], 0x100, 2, 0x37); ConvertIntToDecimalStringN(gDisplayedStringBattle, move, 2, 3); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 272, 10, 0x37); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 272, 10, 0x37); } break; case L_BUTTON: @@ -1070,10 +1070,10 @@ void debug_sub_8030C24(void) move = 354; SetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1, &move); gBattleMons[gActiveBattler].moves[0] = move; - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 1, 0x37, 16, 0x38); - Text_InitWindowAndPrintText(&gUnknown_03004210, gMoveNames[move], 0x100, 2, 0x37); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 1, 0x37, 16, 0x38); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gMoveNames[move], 0x100, 2, 0x37); ConvertIntToDecimalStringN(gDisplayedStringBattle, move, 2, 3); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 272, 10, 0x37); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 272, 10, 0x37); } break; case DPAD_UP: @@ -1083,7 +1083,7 @@ void debug_sub_8030C24(void) else gAnimMoveTurn++; ConvertIntToDecimalStringN(gDisplayedStringBattle, gAnimMoveTurn, 2, 3); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 284, 4, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 284, 4, 0x39); break; } @@ -1098,12 +1098,12 @@ void debug_sub_8030C24(void) move = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MOVE1 + i); StringAppend(gDisplayedStringBattle, gMoveNames[move]); Text_InitWindow( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x100 + i * 16, (i & 1) ? 10 : 2, (i < 2) ? 0x37 : 0x39); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } gBattlerControllerFuncs[gActiveBattler] = sub_802C68C; } @@ -1128,11 +1128,11 @@ void debug_sub_803107C(void) count++; } ConvertIntToDecimalStringN(gDisplayedStringBattle, count, 2, 2); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 290, 8, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 290, 8, 0x39); count = GetTaskCount(); ConvertIntToDecimalStringN(gDisplayedStringBattle, count, 2, 2); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 294, 11, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 294, 11, 0x39); for (i = 0, count = 0; i < 32; i++) { @@ -1140,7 +1140,7 @@ void debug_sub_803107C(void) count++; } ConvertIntToDecimalStringN(gDisplayedStringBattle, count, 2, 2); - Text_InitWindowAndPrintText(&gUnknown_03004210, gDisplayedStringBattle, 298, 14, 0x39); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 298, 14, 0x39); gBattlerControllerFuncs[gActiveBattler] = debug_sub_8030C24; } @@ -1317,7 +1317,7 @@ void bx_t1_healthbar_update(void) void sub_802D90C(void) { - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) PlayerBufferExecCompleted(); } @@ -1507,7 +1507,7 @@ void sub_802DEAC(void) // Duplicate of sub_802D90C void sub_802DF18(void) { - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) PlayerBufferExecCompleted(); } @@ -1589,12 +1589,12 @@ void sub_802E12C(s32 a, const u8 *b) StringCopy(gDisplayedStringBattle, b); StringAppend(gDisplayedStringBattle, gMoveNames[r4->moves[a]]); Text_InitWindow( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x300 + a * 20, (a & 1) ? 11 : 1, (a < 2) ? 0x37 : 0x39); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } void sub_802E1B0(void) @@ -1603,7 +1603,7 @@ void sub_802E1B0(void) s32 i; gUnknown_03004348 = 0; - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 1, 0x37, 0x14, 0x3A); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 1, 0x37, 0x14, 0x3A); for (i = 0; i < 4; i++) { nullsub_7(i); @@ -1632,8 +1632,8 @@ void sub_802E220(void) str = ConvertIntToDecimalStringN(str, r4->pp[gMoveSelectionCursor[gActiveBattler]], 1, 2); *str++ = CHAR_SLASH; ConvertIntToDecimalStringN(str, r4->unkC[gMoveSelectionCursor[gActiveBattler]], 1, 2); - Text_InitWindow(&gUnknown_03004210, gDisplayedStringBattle, 0x2A2, 0x19, 0x37); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x2A2, 0x19, 0x37); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } } @@ -1644,8 +1644,8 @@ void sub_802E2D4(void) { if (gBattleBufferA[gActiveBattler][2] == 1) { - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 0x17, 0x37, 0x1C, 0x3A); - Text_InitWindow(&gUnknown_03004210, BattleText_ForgetMove, 0x290, 0x13, 0x37); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 0x17, 0x37, 0x1C, 0x3A); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_ForgetMove, 0x290, 0x13, 0x37); } else { @@ -1654,10 +1654,10 @@ void sub_802E2D4(void) str = StringCopy(str, BattleText_Format); StringCopy(str, gTypeNames[gBattleMoves[r4->moves[gMoveSelectionCursor[gActiveBattler]]].type]); - Text_FillWindowRect(&gUnknown_03004210, 0x1016, 0x17, 0x39, 0x1C, 0x3A); - Text_InitWindow(&gUnknown_03004210, gDisplayedStringBattle, 0x2C0, 0x17, 0x39); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 0x1016, 0x17, 0x39, 0x1C, 0x3A); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x2C0, 0x17, 0x39); } - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } const u8 gUnknown_081FAE89[][2] = @@ -1728,7 +1728,7 @@ void b_link_standby_message(void) { gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - Text_InitWindow8002EB0(&gUnknown_03004210, BattleText_LinkStandby, 0x90, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, BattleText_LinkStandby, 0x90, 2, 15); } } @@ -2594,7 +2594,7 @@ void PlayerHandlePrintString(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; BufferStringBattle(*(u16 *)&gBattleBufferA[gActiveBattler][2]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 0x90, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x90, 2, 15); gBattlerControllerFuncs[gActiveBattler] = sub_802DF18; } @@ -2612,13 +2612,13 @@ void PlayerHandlecmd18(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 160; - Text_FillWindowRect(&gUnknown_03004210, 10, 2, 15, 27, 18); - Text_FillWindowRect(&gUnknown_03004210, 10, 2, 35, 16, 38); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 10, 2, 15, 27, 18); + Text_FillWindowRect(&gWindowTemplate_Contest_MoveDescription, 10, 2, 35, 16, 38); gBattlerControllerFuncs[gActiveBattler] = sub_802C098; - Text_InitWindow(&gUnknown_03004210, BattleText_MenuOptions, 400, 18, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_MenuOptions, 400, 18, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); MenuCursor_Create814A5C0(0, 0xFFFF, 12, 11679, 0); for (r4 = 0; r4 < 4; r4++) @@ -2627,8 +2627,8 @@ void PlayerHandlecmd18(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); BattleStringExpandPlaceholdersToDisplayedString(BattleText_OtherMenu); - Text_InitWindow(&gUnknown_03004210, gDisplayedStringBattle, SUB_803037C_TILE_DATA_OFFSET, 2, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, SUB_803037C_TILE_DATA_OFFSET, 2, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } void PlayerHandlecmd19() @@ -2651,8 +2651,8 @@ void sub_80304A8(void) sub_802E3B4(gMoveSelectionCursor[gActiveBattler], 0); if (gBattleBufferA[gActiveBattler][2] != 1) { - Text_InitWindow(&gUnknown_03004210, BattleText_PP, 656, 23, 55); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_PP, 656, 23, 55); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } sub_802E220(); sub_802E2D4(); diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 138f873c9..56defc527 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -15,7 +15,7 @@ #include "util.h" #include "ewram.h" -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern u8 gDisplayedStringBattle[]; extern u8 gActionSelectionCursor[]; @@ -290,7 +290,7 @@ void sub_812B65C(void) void sub_812B694(void) { - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) SafariBufferExecCompleted(); } @@ -461,7 +461,7 @@ void SafariHandlePrintString(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; BufferStringBattle(*(u16 *)&gBattleBufferA[gActiveBattler][2]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gBattlerControllerFuncs[gActiveBattler] = sub_812B694; } @@ -479,13 +479,13 @@ void SafariHandlecmd18(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 160; - gUnknown_03004210.paletteNum = 0; - Text_FillWindowRectDefPalette(&gUnknown_03004210, 10, 2, 15, 27, 18); - Text_FillWindowRectDefPalette(&gUnknown_03004210, 10, 2, 35, 16, 36); + gWindowTemplate_Contest_MoveDescription.paletteNum = 0; + Text_FillWindowRectDefPalette(&gWindowTemplate_Contest_MoveDescription, 10, 2, 15, 27, 18); + Text_FillWindowRectDefPalette(&gWindowTemplate_Contest_MoveDescription, 10, 2, 35, 16, 36); gBattlerControllerFuncs[gActiveBattler] = bx_battle_menu_t6_2; - Text_InitWindow(&gUnknown_03004210, BattleText_MenuOptionsSafari, 400, 18, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_MenuOptionsSafari, 400, 18, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); MenuCursor_Create814A5C0(0, 0xFFFF, 12, 11679, 0); for (i = 0; i < 4; i++) @@ -494,8 +494,8 @@ void SafariHandlecmd18(void) sub_802E3E4(gActionSelectionCursor[gActiveBattler], 0); BattleStringExpandPlaceholdersToDisplayedString(BattleText_PlayerMenu); - Text_InitWindow(&gUnknown_03004210, gDisplayedStringBattle, SUB_812BB10_TILE_DATA_OFFSET, 2, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, SUB_812BB10_TILE_DATA_OFFSET, 2, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } void SafariHandlecmd19(void) diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 3e54668b0..26fc28a9e 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -53,7 +53,7 @@ extern u16 gIntroSlideFlags; extern u8 gUnknown_02024E68[]; extern struct SpriteTemplate gUnknown_02024E8C; extern u8 gAnimMoveTurn; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern u8 gUnknown_0300434C[]; extern const u8 BattleText_WallyMenu[]; extern const u8 BattleText_MenuOptions[]; @@ -324,7 +324,7 @@ void sub_813741C(void) void sub_8137454(void) { - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) WallyBufferExecCompleted(); } @@ -1239,7 +1239,7 @@ void WallyHandlePrintString(void) if (*ptr == 2) DestroyMenuCursor(); BufferStringBattle(*ptr); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 0x90, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 0x90, 2, 15); gBattlerControllerFuncs[gActiveBattler] = sub_8137454; } @@ -1257,23 +1257,23 @@ void WallyHandlecmd18(void) gBattle_BG0_X = 0; gBattle_BG0_Y = 160; - gUnknown_03004210.paletteNum = 0; - Text_FillWindowRectDefPalette(&gUnknown_03004210, 10, 2, 15, 27, 18); - Text_FillWindowRectDefPalette(&gUnknown_03004210, 10, 2, 35, 16, 36); + gWindowTemplate_Contest_MoveDescription.paletteNum = 0; + Text_FillWindowRectDefPalette(&gWindowTemplate_Contest_MoveDescription, 10, 2, 15, 27, 18); + Text_FillWindowRectDefPalette(&gWindowTemplate_Contest_MoveDescription, 10, 2, 35, 16, 36); gBattlerControllerFuncs[gActiveBattler] = sub_81372BC; - Text_InitWindow(&gUnknown_03004210, BattleText_MenuOptions, 400, 18, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_MenuOptions, 400, 18, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); MenuCursor_Create814A5C0(0, 0xFFFF, 12, 0x2D9F, 0); for (i = 0; i < 4; i++) nullsub_8(i); sub_802E3E4(0, 0); BattleStringExpandPlaceholdersToDisplayedString(BattleText_WallyMenu); #ifdef ENGLISH - Text_InitWindow(&gUnknown_03004210, gDisplayedStringBattle, 440, 2, 35); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 440, 2, 35); #else - Text_InitWindow(&gUnknown_03004210, gDisplayedStringBattle, 444, 2, 35); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 444, 2, 35); #endif - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } void WallyHandlecmd19(void) diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index 3c3464b9e..d6822ac6a 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -32,7 +32,7 @@ extern u8 gBattlerSpriteIds[]; extern u16 gIntroSlideFlags; extern u8 gDoingBattleAnim; extern u32 gTransformedPersonalities[]; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern void (*gBattlerControllerFuncs[])(void); extern u8 gHealthboxSpriteIds[]; extern u8 gUnknown_0300434C[]; diff --git a/src/battle_interface.c b/src/battle_interface.c index be9554bf2..4a79126cf 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -1538,7 +1538,7 @@ u8 sub_8044804(u8 a, const struct BattleInterfaceStruct2 *b, u8 c, u8 d) sp14 = 0; for (i = 0; i < 6; i++) //_080448A0 { - if (b[i].unk0 != 0xFFFF) + if (b[i].totalPoints != 0xFFFF) sp14++; } @@ -1599,19 +1599,19 @@ u8 sub_8044804(u8 a, const struct BattleInterfaceStruct2 *b, u8 c, u8 d) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) // && b[i] != 0xFFFF && b[i] { - if (b[i].unk0 == 0xFFFF) + if (b[i].totalPoints == 0xFFFF) { //_08044AE6 gSprites[sp[i]].oam.tileNum += 1; gSprites[sp[i]].data[7] = 1; // to _08044B52 } - else if (b[i].unk0 == 0) + else if (b[i].totalPoints == 0) { gSprites[sp[i]].oam.tileNum += 3; // to _08044B46 } - else if (b[i].unk4 != 0) + else if (b[i].round1Points != 0) { gSprites[sp[i]].oam.tileNum += 2; } @@ -1626,13 +1626,13 @@ u8 sub_8044804(u8 a, const struct BattleInterfaceStruct2 *b, u8 c, u8 d) gSprites[sp[i]].data[7] = 1; // to _08044B52 } - else if (b[i].unk0 == 0) + else if (b[i].totalPoints == 0) { //_08044B14 gSprites[sp[i]].oam.tileNum += 3; // to _08044B46 } - else if (b[i].unk4 != 0) + else if (b[i].round1Points != 0) { gSprites[sp[i]].oam.tileNum += 2; } @@ -1647,16 +1647,16 @@ u8 sub_8044804(u8 a, const struct BattleInterfaceStruct2 *b, u8 c, u8 d) { if (gBattleTypeFlags & BATTLE_TYPE_MULTI) { - if (b[i].unk0 == 0xFFFF) + if (b[i].totalPoints == 0xFFFF) { gSprites[sp[5 - i]].oam.tileNum += 1; gSprites[sp[5 - i]].data[7] = 1; } - else if (b[i].unk0 == 0) + else if (b[i].totalPoints == 0) { gSprites[sp[5 - i]].oam.tileNum += 3; } - else if (b[i].unk4 != 0) + else if (b[i].round1Points != 0) { gSprites[sp[5 - i]].oam.tileNum += 2; } @@ -1668,11 +1668,11 @@ u8 sub_8044804(u8 a, const struct BattleInterfaceStruct2 *b, u8 c, u8 d) gSprites[sp[5 - i]].oam.tileNum += 1; gSprites[sp[5 - i]].data[7] = 1; } - else if (b[i].unk0 == 0) + else if (b[i].totalPoints == 0) { gSprites[sp[5 - i]].oam.tileNum += 3; } - else if (b[i].unk4 != 0) + else if (b[i].round1Points != 0) { gSprites[sp[5 - i]].oam.tileNum += 2; } diff --git a/src/battle_main.c b/src/battle_main.c index 9ec46033d..ede90e65e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -204,7 +204,7 @@ s8 gBattleTerrain; void (*gBattleMainFunc)(void); u32 gUnknown_03004284; -struct Window gUnknown_03004210; +struct Window gWindowTemplate_Contest_MoveDescription; struct Window gUnknown_030041D0; struct Window gUnknown_03004250; @@ -250,7 +250,7 @@ void CB2_InitBattleInternal(void) gScanlineEffectRegBuffers[0][i] = 0xFF10; gScanlineEffectRegBuffers[1][i] = 0xFF10; } - //ScanlineEffect_SetParams(gUnknown_081F9674.unk0, gUnknown_081F9674.unk4, gUnknown_081F9674.unk8); + //ScanlineEffect_SetParams(gUnknown_081F9674.totalPoints, gUnknown_081F9674.round1Points, gUnknown_081F9674.random); ScanlineEffect_SetParams(gUnknown_081F9674); Text_LoadWindowTemplate(&gWindowTemplate_81E6C58); ResetPaletteFade(); @@ -270,7 +270,7 @@ void CB2_InitBattleInternal(void) gBattleTerrain = BattleSetup_GetTerrain(); #endif - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6C58); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6C58); Text_InitWindowWithTemplate(&gUnknown_030041D0, &gWindowTemplate_81E71D0); Text_InitWindowWithTemplate(&gUnknown_03004250, &gWindowTemplate_81E71EC); sub_800D6D4(); @@ -987,7 +987,7 @@ void BattleMainCB2(void) } #endif - Text_UpdateWindowInBattle(&gUnknown_03004210); + Text_UpdateWindowInBattle(&gWindowTemplate_Contest_MoveDescription); UpdatePaletteFade(); RunTasks(); } @@ -1309,7 +1309,7 @@ void c2_8011A1C(void) gBattle_BG3_X = 0; gBattle_BG3_Y = 0; - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6C58); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6C58); Text_InitWindowWithTemplate(&gUnknown_030041D0, &gWindowTemplate_81E71D0); Text_InitWindowWithTemplate(&gUnknown_03004250, &gWindowTemplate_81E71EC); sub_800D6D4(); @@ -2617,7 +2617,7 @@ void debug_sub_8012688(void) FreeAllSpritePalettes(); gReservedSpritePaletteCount = 4; gCurrentMove = 1; - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6C58); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6C58); DecompressPicFromTable_2( &gMonFrontPicTable[gCurrentMove], gMonFrontPicCoords[gCurrentMove].coords, @@ -2644,7 +2644,7 @@ void debug_sub_8012878(void) { AnimateSprites(); BuildOamBuffer(); - Text_UpdateWindowInBattle(&gUnknown_03004210); + Text_UpdateWindowInBattle(&gWindowTemplate_Contest_MoveDescription); UpdatePaletteFade(); RunTasks(); if (gMain.heldKeys == (SELECT_BUTTON | R_BUTTON)) @@ -2654,25 +2654,25 @@ void debug_sub_8012878(void) void debug_sub_80128B4(void) { debug_sub_8010A7C(0, 9); - Text_InitWindow(&gUnknown_03004210, gBattleTextBuff1, 144, 2, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gBattleTextBuff1, 144, 2, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); ConvertIntToDecimalStringN(gBattleTextBuff1, gCurrentMove, 2, 3); gBattleTextBuff1[3] = CHAR_SPACE; gBattleTextBuff1[4] = EOS; StringAppend(gBattleTextBuff1, gSpeciesNames[gCurrentMove]); - Text_InitWindow(&gUnknown_03004210, gBattleTextBuff1, 144, 2, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gBattleTextBuff1, 144, 2, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } void debug_sub_8012938(u8 taskId) { debug_sub_8010A7C(0, 7); - Text_InitWindow(&gUnknown_03004210, gBattleTextBuff1, 162, 2, 37); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gBattleTextBuff1, 162, 2, 37); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); StringCopy(gBattleTextBuff1, Str_821F7B8); ConvertIntToDecimalStringN(gBattleTextBuff1 + 4, gUnknown_Debug_2023B62[gCurrentMove - 1], 2, 3); - Text_InitWindow(&gUnknown_03004210, gBattleTextBuff1, 162, 2, 37); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gBattleTextBuff1, 162, 2, 37); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); gSprites[gTasks[taskId].data[1]].pos2.y = -gUnknown_Debug_2023B62[gCurrentMove - 1]; } @@ -2732,8 +2732,8 @@ void debug_sub_8012B70(u8 taskId, u8 b) { sub_802BBD4(24, 28, 29, 33, 0); gTasks[taskId].data[0] = 2; - Text_InitWindow(&gUnknown_03004210, Str_821F7DA, 656, 26, 29); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, Str_821F7DA, 656, 26, 29); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); gTasks[taskId].data[3] = 0; debug_sub_8012B2C(0); } @@ -2742,25 +2742,25 @@ void debug_sub_8012B70(u8 taskId, u8 b) void debug_sub_8012C08(u8 taskId, u8 b) { debug_sub_8010A7C(0, 9); - Text_InitWindow(&gUnknown_03004210, gBattleTextBuff1, 144, 2, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gBattleTextBuff1, 144, 2, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); debug_sub_8010A7C(0, 7); - Text_InitWindow(&gUnknown_03004210, gBattleTextBuff1, 162, 2, 37); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gBattleTextBuff1, 162, 2, 37); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); sub_802BBD4(24, 28, 29, 33, 0); if (b != 0) { gTasks[taskId].data[0] = 4; - Text_InitWindow(&gUnknown_03004210, gUnknown_Debug_821F7F3, 144, 2, 35); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, gUnknown_Debug_821F7F3, 144, 2, 35); } else { gTasks[taskId].data[0] = 3; - Text_InitWindow(&gUnknown_03004210, Str_821F7EA, 144, 2, 35); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, Str_821F7EA, 144, 2, 35); } - Text_PrintWindow8002F44(&gUnknown_03004210); - Text_InitWindow(&gUnknown_03004210, BattleText_YesNo, 656, 26, 29); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_YesNo, 656, 26, 29); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); gTasks[taskId].data[3] = 1; debug_sub_8012B2C(1); } @@ -2772,8 +2772,8 @@ void debug_sub_8012D10(u8 taskId) case 0: debug_sub_80128B4(); debug_sub_8012938(taskId); - Text_InitWindow(&gUnknown_03004210, Str_821F7BD, 400, 19, 35); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, Str_821F7BD, 400, 19, 35); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); gTasks[taskId].data[0]++; sub_802E3E4(gTasks[taskId].data[2], 0); break; diff --git a/src/battle_records.c b/src/battle_records.c index 307b977d5..aaa280720 100644 --- a/src/battle_records.c +++ b/src/battle_records.c @@ -29,7 +29,7 @@ const struct DebugStruct1 gUnknown_Debug_4245CC[] = { 7, DTR("ナンバー7", "NUMBER7") }, }; -const struct {u8 unk0; u8 unk1;} gUnknown_Debug_8424620[] = +const struct {u8 totalPoints; u8 unk1;} gUnknown_Debug_8424620[] = { { 1, 1 }, { 2, 1 }, @@ -231,7 +231,7 @@ void debug_sub_81257E0(void) InitLinkBattleRecords(); for (i = 0; i < 3; i++) { - u32 id = gUnknown_Debug_8424620[i].unk0 - 1; + u32 id = gUnknown_Debug_8424620[i].totalPoints - 1; UpdateLinkBattleRecords_( gSaveBlock1.linkBattleRecords, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c9c22ec6f..d1143d764 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -91,7 +91,7 @@ extern u8 gBattleTextBuff2[]; extern u8 gBattleTextBuff3[]; extern u8 gLeveledUpInBattle; extern void (*gBattleMainFunc)(void); -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern const u8 BattleText_YesNo[]; extern u8 gPlayerPartyCount; extern u16 gMoveToLearn; //move to learn @@ -8294,8 +8294,8 @@ void atk59_handlelearnnewmove(void) void sub_8023A80(void) { sub_802BBD4(0x18, 8, 0x1D, 0xD, 0); - Text_InitWindow(&gUnknown_03004210, BattleText_YesNo, 0x100, 0x19, 0x9); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_InitWindow(&gWindowTemplate_Contest_MoveDescription, BattleText_YesNo, 0x100, 0x19, 0x9); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); MenuCursor_Create814A5C0(0, 0xFFFF, 0xC, 0x2D9F, 0x20); } @@ -9304,7 +9304,7 @@ _08024AB8:\n\ bgt _08024AC4\n\ b _0802495A\n\ _08024AC4:\n\ - ldr r4, _08024AE4 @ =gUnknown_03004210\n\ + ldr r4, _08024AE4 @ =gWindowTemplate_Contest_MoveDescription\n\ ldr r1, _08024AE8 @ =gStringVar4\n\ adds r2, 0xFF\n\ movs r0, 0x1\n\ @@ -9319,7 +9319,7 @@ _08024AC4:\n\ adds r1, r2\n\ b _08024BEA\n\ .align 2, 0\n\ -_08024AE4: .4byte gUnknown_03004210\n\ +_08024AE4: .4byte gWindowTemplate_Contest_MoveDescription\n\ _08024AE8: .4byte gStringVar4\n\ _08024AEC: .4byte gSharedMem\n\ _08024AF0: .4byte 0x0001609c\n\ @@ -9424,7 +9424,7 @@ _08024BC0:\n\ mov r2, r8\n\ cmp r2, 0x5\n\ ble _08024B1C\n\ - ldr r4, _08024BF4 @ =gUnknown_03004210\n\ + ldr r4, _08024BF4 @ =gWindowTemplate_Contest_MoveDescription\n\ ldr r1, _08024BF8 @ =gStringVar4\n\ movs r2, 0x80\n\ lsls r2, 1\n\ @@ -9444,7 +9444,7 @@ _08024BEA:\n\ strb r0, [r1]\n\ b _08024C38\n\ .align 2, 0\n\ -_08024BF4: .4byte gUnknown_03004210\n\ +_08024BF4: .4byte gWindowTemplate_Contest_MoveDescription\n\ _08024BF8: .4byte gStringVar4\n\ _08024BFC: .4byte gSharedMem\n\ _08024C00: .4byte 0x0001609c\n\ diff --git a/src/contest.c b/src/contest.c index cea968738..a282226d5 100644 --- a/src/contest.c +++ b/src/contest.c @@ -48,7 +48,7 @@ extern u8 gBattlerAttacker; extern u8 gBattlerTarget; extern u8 gBattlerPositions[]; extern u8 gBattlerSpriteIds[]; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; u32 gContestRngValue; extern struct SpriteTemplate gUnknown_02024E8C; @@ -69,11 +69,11 @@ extern const struct SubspriteTable gSubspriteTables_83CA464[]; extern const struct CompressedSpriteSheet gUnknown_083CA46C; extern const struct SpritePalette gUnknown_083CA474; extern const struct SpriteTemplate gSpriteTemplate_83CA484; -extern const struct SpriteTemplate gSpriteTemplate_83CA4A4; -extern const struct CompressedSpriteSheet gUnknown_083CA4BC; -extern const struct CompressedSpriteSheet gUnknown_083CA4C4; -extern const struct CompressedSpritePalette gUnknown_083CA4CC; -extern const struct SpriteTemplate gUnknown_083CA4D4; +extern const struct SpriteTemplate sSpriteTemplate_Judge; +extern const struct CompressedSpriteSheet sSpriteSheet_Judge; +extern const struct CompressedSpriteSheet sSpriteSheet_JudgeSymbols; +extern const struct CompressedSpritePalette sSpritePalette_JudgeSymbols; +extern const struct SpriteTemplate sSpriteTemplate_JudgeSpeechBubble; extern const struct CompressedSpriteSheet gUnknown_083CC3AC; extern const struct CompressedSpritePalette gUnknown_083CC3B4[]; extern const struct SpriteTemplate gSpriteTemplate_83CC454[]; @@ -107,7 +107,7 @@ extern const u8 *const gUnknown_083CC330[]; extern const u8 gUnknownText_UnknownFormatting2[]; extern const u8 gUnknownText_UnknownFormatting3[]; extern const u8 gUnknown_083CC59C[]; -extern const u8 gUnknown_083CC5A2[]; +extern const u8 gText_Slash[]; extern const u16 gUnknown_083CC5A4[]; extern const struct ContestWinner gUnknown_083CC5D0[]; extern const u8 gUnknownText_MissedTurn[]; @@ -166,30 +166,30 @@ void sub_80ADFD8(u8); void sub_80AE010(void); void InsertStringDigit(u8 *, s32); bool8 sub_80AE074(void); -void sub_80AEB4C(void *); -void sub_80AE5BC(u8); -void sub_80AE5D4(u8, u8); -void sub_80AE6CC(u8); -void sub_80AE6E4(u8, u8); +void __copy_tilemap(void *); +void PrintContestantTrainerName(u8 contestant); +void PrintContestantTrainerNameWithColor(u8 contestant, u8 color); +void PrintContestantMonName(u8 contestant); +void PrintContestantMonNameWithColor(u8 contestant, u8 color); u8 CreateJudgeSprite(void); -u8 sub_80AE8B4(void); -u8 sub_80AE9FC(u16, u32, u32); -void sub_80AEB30(void); -void sub_80AEBEC(u16); +u8 CreateJudgeSpeechBubbleSprite(void); +u8 CreateContestantSprite(u16, u32, u32); +void SwapMoveDescAndContestTilemaps(void); +void PrintContestMoveDescription(u16); void sub_80AED58(void); -bool8 sub_80AEE54(u8, u8); -bool8 sub_80AF038(u8); -void sub_80AF120(void); -void sub_80AF138(void); +bool8 UpdateConditionStars(u8, u8); +bool8 DrawStatusSymbol(u8); +void DrawStatusSymbols(void); +void ContestClearGeneralTextWindow(void); u16 GetChosenMove(u8); void sub_80AF1B8(void); void sub_80AF2A0(u8); void sub_80AF2FC(void); void sub_80AF3C0(void); -s16 sub_80AF688(u8); +s16 GetContestantRound2Points(u8 a); void DetermineFinalStandings(void); -bool8 sub_80AF828(s32, s32, struct UnknownContestStruct6 *); -void sub_80AF860(void); +bool8 DidContestantPlaceHigher(s32 a, s32 b, struct ContestFinalStandings *c); +void ContestPrintLinkStandby(void); void sub_80AF94C(u8); void sub_80AFA5C(void); u16 sub_80AFB40(u8); @@ -269,12 +269,12 @@ EWRAM_DATA u8 gUnknown_0203856C = 0; EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; EWRAM_DATA s16 gContestMonRound1Points[4] = {0}; EWRAM_DATA s16 gContestMonTotalPoints[4] = {0}; -EWRAM_DATA s16 gUnknown_02038680[4] = {0}; -EWRAM_DATA s16 gUnknown_02038688[4] = {0}; +EWRAM_DATA s16 gContestMonAppealPointTotals[4] = {0}; +EWRAM_DATA s16 gContestMonRound2Points[4] = {0}; EWRAM_DATA u8 gContestFinalStandings[4] = {0}; // What "place" each participant came in. EWRAM_DATA u8 gContestMonPartyIndex = 0; EWRAM_DATA u8 gContestPlayerMonIndex = 0; -EWRAM_DATA u8 gUnknown_02038696[4] = {0}; +EWRAM_DATA u8 gContestantTurnOrder[4] = {0}; EWRAM_DATA u8 gIsLinkContest = 0; EWRAM_DATA u8 gContestLinkLeaderIndex = 0; EWRAM_DATA u16 gSpecialVar_ContestCategory = 0; @@ -336,14 +336,14 @@ void LoadContestBgAfterMoveAnim(void) { u32 var = 5 + i; - LoadPalette(shared18000.unk18004[var], 16 * (5 + gUnknown_02038696[i]), 16 * sizeof(u16)); + LoadPalette(shared18000.unk18004[var], 16 * (5 + gContestantTurnOrder[i]), 16 * sizeof(u16)); } } void SetUpContestWindow(void) { Text_LoadWindowTemplate(&gWindowTemplate_81E6FD8); - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6FD8); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6FD8); Text_InitWindowWithTemplate(&gMenuWindow, &gWindowTemplate_81E6FF4); } @@ -384,7 +384,7 @@ void ClearContestVars(void) for (i = 0; i < 4; i++) { sContestantStatus[i].nextTurnOrder = 0xFF; - sContest.unk19218[i] = gUnknown_02038696[i]; + sContest.unk19218[i] = gContestantTurnOrder[i]; } sub_80B159C(); } @@ -447,7 +447,7 @@ void sub_80AB604(u8 taskId) if (!gPaletteFade.active) { gPaletteFade.bufferTransferDisabled = FALSE; - sub_80AF860(); + ContestPrintLinkStandby(); CreateTask(sub_80AB678, 0); gTasks[taskId].func = nullsub_89; } @@ -518,8 +518,8 @@ u8 sub_80AB70C(u8 *a) case 6: sub_80B1118(); sub_80AFA5C(); - sub_80AEB30(); - sContest.unk19216 = sub_80AE8B4(); + SwapMoveDescAndContestTilemaps(); + sContest.unk19216 = CreateJudgeSpeechBubbleSprite(); sub_80AFE30(); sub_80B0034(); CreateApplauseMeterSprite(); @@ -635,7 +635,7 @@ void sub_80ABB70(u8 taskId) else StringCopy(gDisplayedStringBattle, gText_Contest_ButItCantParticipate); InsertStringDigit(gDisplayedStringBattle, sContest.turnNumber + 1); - sub_80AF138(); + ContestClearGeneralTextWindow(); StringExpandPlaceholders(gStringVar4, gDisplayedStringBattle); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); gTasks[taskId].func = sub_80ABC3C; @@ -673,7 +673,7 @@ void sub_80ABCDC(u8 taskId) gBattle_BG0_Y = 0xA0; gBattle_BG2_Y = 0xA0; Text_FillWindowRectDefPalette( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, 0, gUnknown_083CA340[0][0], gUnknown_083CA340[0][1], @@ -702,18 +702,18 @@ void sub_80ABCDC(u8 taskId) r5 = StringCopy(r5, gMoveNames[move]); Text_InitWindow8002E4C( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, sp8, 776 + i * 20, gUnknown_083CA340[i][0] * 8 + 4, gUnknown_083CA340[i][1] * 8, 1); - Text_PrintWindow8002F44(&gUnknown_03004210); + Text_PrintWindow8002F44(&gWindowTemplate_Contest_MoveDescription); } MenuCursor_Create814A5C0(0, 0xFFFF, 12, 0x2D9F, 72); sub_80AC0AC(sContest.playerMoveChoice); - sub_80AEBEC(gContestMons[gContestPlayerMonIndex].moves[sContest.playerMoveChoice]); + PrintContestMoveDescription(gContestMons[gContestPlayerMonIndex].moves[sContest.playerMoveChoice]); gTasks[taskId].func = sub_80ABEA0; } @@ -746,7 +746,7 @@ void sub_80ABEA0(u8 taskId) PlaySE(SE_SELECT); sub_80AFFE0(FALSE); Text_FillWindowRectDefPalette( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, 0, gUnknown_083CA340[0][0], gUnknown_083CA340[0][1], @@ -757,7 +757,7 @@ void sub_80ABEA0(u8 taskId) else StringCopy(gDisplayedStringBattle, gText_Contest_ButItCantParticipate); InsertStringDigit(gDisplayedStringBattle, sContest.turnNumber + 1); - sub_80AF138(); + ContestClearGeneralTextWindow(); StringExpandPlaceholders(gStringVar4, gDisplayedStringBattle); Text_InitWindowAndPrintText(&gMenuWindow, gStringVar4, 776, 1, 15); gBattle_BG0_Y = 0; @@ -775,7 +775,7 @@ void sub_80ABEA0(u8 taskId) sContest.playerMoveChoice--; sub_80AC0AC(sContest.playerMoveChoice); sub_80AED58(); - sub_80AEBEC(gContestMons[gContestPlayerMonIndex].moves[sContest.playerMoveChoice]); + PrintContestMoveDescription(gContestMons[gContestPlayerMonIndex].moves[sContest.playerMoveChoice]); if (numMoves > 1) PlaySE(SE_SELECT); break; @@ -787,7 +787,7 @@ void sub_80ABEA0(u8 taskId) sContest.playerMoveChoice++; sub_80AC0AC(sContest.playerMoveChoice); sub_80AED58(); - sub_80AEBEC(gContestMons[gContestPlayerMonIndex].moves[sContest.playerMoveChoice]); + PrintContestMoveDescription(gContestMons[gContestPlayerMonIndex].moves[sContest.playerMoveChoice]); if (numMoves > 1) PlaySE(SE_SELECT); break; @@ -817,27 +817,27 @@ void debug_sub_80B9EBC(u8 taskId) { case 0: Text_FillWindowRectDefPalette( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, 0, gUnknown_083CA340[0][0], gUnknown_083CA340[0][1], gUnknown_083CA340[0][2], gUnknown_083CA340[0][3]); Text_InitWindowAndPrintText( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, gMoveNames[gTasks[taskId].data[1]], 776, gUnknown_083CA340[0][0], gUnknown_083CA340[0][1]); ConvertIntToDecimalStringN(text, gTasks[taskId].data[1], 2, 3); Text_InitWindowAndPrintText( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, text, 796, gUnknown_083CA340[1][0], gUnknown_083CA340[1][1]); sub_80AED58(); - sub_80AEBEC(gTasks[taskId].data[1]); + PrintContestMoveDescription(gTasks[taskId].data[1]); gTasks[taskId].data[0]++; break; case 1: @@ -902,7 +902,7 @@ void debug_sub_80BA054(u8 taskId) gBattleMonForms[i] = 0; memset(&shared19348, 0, sizeof(shared19348)); sub_80B28F0(gContestPlayerMonIndex); - r6 = sub_80AE9FC( + r6 = CreateContestantSprite( gContestMons[gContestPlayerMonIndex].species, gContestMons[gContestPlayerMonIndex].otId, gContestMons[gContestPlayerMonIndex].personality); @@ -998,7 +998,7 @@ void sub_80AC0C8(u8 taskId) taskId2 = CreateTask(sub_80C8A38, 0); SetTaskFuncWithFollowupFunc(taskId2, sub_80C8A38, sub_80AC15C); gTasks[taskId].func = nullsub_89; - sub_80AF860(); + ContestPrintLinkStandby(); sub_80AFFE0(FALSE); } else @@ -1016,7 +1016,7 @@ void sub_80AC15C(u8 taskId) void sub_80AC188(u8 taskId) { - sub_80AF138(); + ContestClearGeneralTextWindow(); gBattle_BG0_Y = 0; gBattle_BG2_Y = 0; sub_80AFFE0(FALSE); @@ -1082,7 +1082,7 @@ void sub_80AC2CC(u8 taskId) sub_80B114C(sContest.unk19215); taskId2 = CreateTask(sub_80C8C80, 0); SetTaskFuncWithFollowupFunc(taskId2, sub_80C8C80, sub_80AD8DC); - sub_80AF860(); + ContestPrintLinkStandby(); gTasks[taskId].data[0] = 1; } else @@ -1103,7 +1103,7 @@ void sub_80AC2CC(u8 taskId) } else { - sub_80AF138(); + ContestClearGeneralTextWindow(); sub_80B0CDC(r7, 0); gTasks[taskId].data[10] = 0; gTasks[taskId].data[0] = 3; @@ -1114,7 +1114,7 @@ void sub_80AC2CC(u8 taskId) gBattleMonForms[i] = 0; memset(&shared19348, 0, sizeof(shared19348)); sub_80B28F0(sContest.unk19215); - spriteId = sub_80AE9FC( + spriteId = CreateContestantSprite( gContestMons[sContest.unk19215].species, gContestMons[sContest.unk19215].otId, gContestMons[sContest.unk19215].personality); @@ -1140,7 +1140,7 @@ void sub_80AC2CC(u8 taskId) } else { - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r7].nickname); if (sContestantStatus[r7].currMove < NUM_MOVES) StringCopy(gStringVar2, gMoveNames[sContestantStatus[r7].currMove]); @@ -1279,7 +1279,7 @@ void sub_80AC2CC(u8 taskId) gTasks[taskId].data[0] = 37; return; case 37: - if (sub_80AEE54(r7, 1)) + if (UpdateConditionStars(r7, 1)) { gTasks[taskId].data[10] = 0; gTasks[taskId].data[0] = 38; @@ -1297,7 +1297,7 @@ void sub_80AC2CC(u8 taskId) } return; case 50: - if (sub_80AF038(r7)) + if (DrawStatusSymbol(r7)) PlaySE(SE_CONTEST_ICON_CHANGE); gTasks[taskId].data[0] = 25; return; @@ -1315,7 +1315,7 @@ void sub_80AC2CC(u8 taskId) r4 = 0; for (r2 = 0; r2 < 4; r2++) { - if (r2 != r7 && gUnknown_02038696[r2] == i + if (r2 != r7 && gContestantTurnOrder[r2] == i && sContestantStatus[r2].effectStringId != CONTEST_STRING_NONE) { r4 = 1; @@ -1327,7 +1327,7 @@ void sub_80AC2CC(u8 taskId) } if (r4) { - gTasks[taskId].data[1] = gUnknown_02038696[r2]; + gTasks[taskId].data[1] = gContestantTurnOrder[r2]; sub_80B146C(r2, sContestantStatus[r2].effectStringId); sContestantStatus[r2].effectStringId = CONTEST_STRING_NONE; gTasks[taskId].data[0] = 27; @@ -1337,7 +1337,7 @@ void sub_80AC2CC(u8 taskId) gTasks[taskId].data[1] = 0; gTasks[taskId].data[10] = 0; gTasks[taskId].data[0] = 51; - sub_80AF120(); + DrawStatusSymbols(); } } return; @@ -1346,21 +1346,21 @@ void sub_80AC2CC(u8 taskId) gTasks[taskId].data[0] = 28; return; case 28: - for (i = 0; gTasks[taskId].data[1] != gUnknown_02038696[i]; i++) + for (i = 0; gTasks[taskId].data[1] != gContestantTurnOrder[i]; i++) ; sub_80AFBA0(sContestantStatus[i].appeal2 + sContestantStatus[i].jam, -sContestantStatus[i].jam, i); gTasks[taskId].data[0] = 29; return; case 29: - for (i = 0; gTasks[taskId].data[1] != gUnknown_02038696[i]; i++) + for (i = 0; gTasks[taskId].data[1] != gContestantTurnOrder[i]; i++) ; if (!shared19338[i].unk2_2) gTasks[taskId].data[0] = 39; return; case 39: - for (i = 0; gTasks[taskId].data[1] != gUnknown_02038696[i]; i++) + for (i = 0; gTasks[taskId].data[1] != gContestantTurnOrder[i]; i++) ; - if (sub_80AEE54(i, 1)) + if (UpdateConditionStars(i, 1)) { gTasks[taskId].data[10] = 0; gTasks[taskId].data[0] = 40; @@ -1380,10 +1380,10 @@ void sub_80AC2CC(u8 taskId) case 30: for (i = 0; i < 4; i++) { - if (gUnknown_02038696[i] == gTasks[taskId].data[1]) + if (gContestantTurnOrder[i] == gTasks[taskId].data[1]) break; } - if (sub_80AF038(i)) + if (DrawStatusSymbol(i)) PlaySE(SE_CONTEST_ICON_CHANGE); else PlaySE(SE_CONTEST_ICON_CLEAR); @@ -1402,7 +1402,7 @@ void sub_80AC2CC(u8 taskId) if (sContestantStatus[r7].numTurnsSkipped != 0 || sContestantStatus[r7].turnSkipped) { - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r7].nickname); StringExpandPlaceholders(gStringVar4, ContestString_CantAppealNextTurn); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); @@ -1423,7 +1423,7 @@ void sub_80AC2CC(u8 taskId) r4 = sContestantStatus[r7].unk16; if (sContestantStatus[r7].unk16 != 0) { - sub_80AF138(); + ContestClearGeneralTextWindow(); if (r4 == 1) Text_InitWindow8002EB0(&gMenuWindow, ContestString_WentOverWell, 776, 1, 15); else if (r4 == 2) @@ -1436,7 +1436,7 @@ void sub_80AC2CC(u8 taskId) } else { - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r7].nickname); StringExpandPlaceholders(gStringVar4, ContestString_JudgeExpectantly2); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); @@ -1479,7 +1479,7 @@ void sub_80AC2CC(u8 taskId) case 17: if (sContestantStatus[r7].disappointedRepeat) { - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r7].nickname); StringExpandPlaceholders(gStringVar4, ContestString_DissapointedRepeat); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); @@ -1509,7 +1509,7 @@ void sub_80AC2CC(u8 taskId) if (!shared19338[r7].unk2_2) { gTasks[taskId].data[10] = 0; - sub_80AF138(); + ContestClearGeneralTextWindow(); gTasks[taskId].data[0] = 41; } return; @@ -1535,7 +1535,7 @@ void sub_80AC2CC(u8 taskId) if (sContestantStatus[r7].disappointedRepeat) r4 = 0; } - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r7].nickname); sContest.applauseLevel += r4; if (sContest.applauseLevel < 0) @@ -1652,12 +1652,12 @@ void sub_80AC2CC(u8 taskId) case 43: if (!shared19338[r7].unk2_2) { - sub_80AF138(); + ContestClearGeneralTextWindow(); gTasks[taskId].data[0] = 55; } return; case 57: - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar3, gContestMons[shared19328.excitementFreezer].nickname); StringCopy(gStringVar1, gContestMons[r7].nickname); StringCopy(gStringVar2, gMoveNames[sContestantStatus[r7].currMove]); @@ -1668,7 +1668,7 @@ void sub_80AC2CC(u8 taskId) case 58: if (Text_UpdateWindowInContest(&gMenuWindow) != 0) { - sub_80AF138(); + ContestClearGeneralTextWindow(); StringExpandPlaceholders(gStringVar4, ContestString_Ignored2); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); gTasks[taskId].data[0] = 59; @@ -1677,7 +1677,7 @@ void sub_80AC2CC(u8 taskId) case 59: if (Text_UpdateWindowInContest(&gMenuWindow) != 0) { - sub_80AF138(); + ContestClearGeneralTextWindow(); gTasks[taskId].data[0] = 55; } return; @@ -1731,7 +1731,7 @@ void sub_80AC2CC(u8 taskId) gTasks[taskId].data[0] = 21; return; case 31: - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[r7].nickname); StringExpandPlaceholders(gStringVar4, gUnknown_083CB00D); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); @@ -1814,7 +1814,7 @@ void sub_80AD960(u8 taskId) } taskId2 = CreateTask(sub_80C8C80, 0); SetTaskFuncWithFollowupFunc(taskId2, sub_80C8C80, sub_80AD8DC); - sub_80AF860(); + ContestPrintLinkStandby(); gTasks[taskId].data[0] = 1; } else @@ -1902,7 +1902,7 @@ void sub_80ADB88(u8 taskId) { u8 r4 = sContestantStatus[gContestPlayerMonIndex].attentionLevel; - sub_80AF138(); + ContestClearGeneralTextWindow(); StringCopy(gStringVar1, gContestMons[gContestPlayerMonIndex].nickname); StringExpandPlaceholders(gStringVar4, gContestStandOutStrings[r4]); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); @@ -1978,9 +1978,9 @@ void sub_80ADDA4(u8 taskId) gBattle_BG0_Y = 0; gBattle_BG2_Y = 0; for (i = 0; i < 4; i++) - gUnknown_02038680[i] = sContestantStatus[i].unk4; - sub_80AF668(); - sub_80AF138(); + gContestMonAppealPointTotals[i] = sContestantStatus[i].unk4; + CalculateFinalScores(); + ContestClearGeneralTextWindow(); sub_80BE23C(sContestantStatus[gContestPlayerMonIndex].prevMove); gContestRngValue = gRngValue; StringExpandPlaceholders(gStringVar4, gUnknown_083CB02C); @@ -2036,7 +2036,7 @@ void sub_80ADF4C(u8 taskId) SetTaskFuncWithFollowupFunc(taskId2, sub_80C8AD0, sub_80ADF98); gTasks[taskId].func = nullsub_89; - sub_80AF860(); + ContestPrintLinkStandby(); sub_80AFFE0(FALSE); } @@ -2292,156 +2292,156 @@ void sub_80AE514(void) for (i = 0; i < 4; i++) { Text_FillWindowRectDefPalette( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, 0, - gUnknown_083CA308[gUnknown_02038696[i]][0], - gUnknown_083CA308[gUnknown_02038696[i]][1], - gUnknown_083CA310[gUnknown_02038696[i]][0] + 5, - gUnknown_083CA310[gUnknown_02038696[i]][1] + 1); - sub_80AE5BC(i); - sub_80AE6CC(i); + gUnknown_083CA308[gContestantTurnOrder[i]][0], + gUnknown_083CA308[gContestantTurnOrder[i]][1], + gUnknown_083CA310[gContestantTurnOrder[i]][0] + 5, + gUnknown_083CA310[gContestantTurnOrder[i]][1] + 1); + PrintContestantTrainerName(i); + PrintContestantMonName(i); } } -u8 *sub_80AE598(u8 *dest, const u8 *b, u8 c) +u8 *Contest_CopyStringWithColor(u8 *dest, const u8 *src, u8 color) { - dest = StringCopy(dest, gUnknown_083CC59C); - *dest++ = c; - dest = StringCopy(dest, b); + dest = StringCopy(dest, gUnknown_083CC59C); // {HIGHLIGHT TRANSPARENT}{COLOR}$ + *dest++ = color; + dest = StringCopy(dest, src); return dest; } -void sub_80AE5BC(u8 a) +void PrintContestantTrainerName(u8 contestant) { - sub_80AE5D4(a, a + 10); + PrintContestantTrainerNameWithColor(contestant, contestant + 10); } -void sub_80AE5D4(u8 p, u8 b) +void PrintContestantTrainerNameWithColor(u8 contestant, u8 color) { u8 *str = gDisplayedStringBattle; - str = sub_80AE598(str, gEmptyString_81E72B0, b); + str = Contest_CopyStringWithColor(str, gEmptyString_81E72B0, color); str[0] = EXT_CTRL_CODE_BEGIN; - str[1] = 6; + str[1] = EXT_CTRL_CODE_SIZE; str[2] = 4; str += 3; *str++ = CHAR_SLASH; - if ((gIsLinkContest & 1) && gLinkPlayers[p].language == LANGUAGE_JAPANESE) + if ((gIsLinkContest & 1) && gLinkPlayers[contestant].language == LANGUAGE_JAPANESE) { - StringCopy(str, gLinkPlayers[p].name); + StringCopy(str, gLinkPlayers[contestant].name); Text_InitWindow8004D04( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, - 592 + gUnknown_02038696[p] * 22, - 251 + gUnknown_083CA310[gUnknown_02038696[p]][0] * 8, - gUnknown_083CA310[gUnknown_02038696[p]][1] * 8, + 592 + gContestantTurnOrder[contestant] * 22, + 251 + gUnknown_083CA310[gContestantTurnOrder[contestant]][0] * 8, + gUnknown_083CA310[gContestantTurnOrder[contestant]][1] * 8, 1); } else { - StringCopy(str, gContestMons[p].trainerName); + StringCopy(str, gContestMons[contestant].trainerName); Text_InitWindowAndPrintText( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, - 592 + gUnknown_02038696[p] * 22, - gUnknown_083CA310[gUnknown_02038696[p]][0], - gUnknown_083CA310[gUnknown_02038696[p]][1]); + 592 + gContestantTurnOrder[contestant] * 22, + gUnknown_083CA310[gContestantTurnOrder[contestant]][0], + gUnknown_083CA310[gContestantTurnOrder[contestant]][1]); } } -void sub_80AE6CC(u8 a) +void PrintContestantMonName(u8 contestant) { - sub_80AE6E4(a, a + 10); + PrintContestantMonNameWithColor(contestant, contestant + 10); } -void sub_80AE6E4(u8 a, u8 b) +void PrintContestantMonNameWithColor(u8 contestant, u8 color) { u8 *str = gDisplayedStringBattle; str[0] = EXT_CTRL_CODE_BEGIN; - str[1] = 6; + str[1] = EXT_CTRL_CODE_SIZE; str[2] = 4; str += 3; - str = sub_80AE598(str, gContestMons[a].nickname, b); + str = Contest_CopyStringWithColor(str, gContestMons[contestant].nickname, color); *str = EOS; Text_InitWindow8004D04( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, - 512 + gUnknown_02038696[a] * 20, - 253 + gUnknown_083CA308[gUnknown_02038696[a]][0] * 8, - gUnknown_083CA308[gUnknown_02038696[a]][1] * 8, + 512 + gContestantTurnOrder[contestant] * 20, + 253 + gUnknown_083CA308[gContestantTurnOrder[contestant]][0] * 8, + gUnknown_083CA308[gContestantTurnOrder[contestant]][1] * 8, 1); } -u16 InitContestMonConditionI(u8 a, u8 b) +u16 CalculateContestantRound1Points(u8 who, u8 contestCategory) { - u8 r5; - u8 r4; - u8 r3; + u8 statMain; + u8 statSub1; + u8 statSub2; - switch (b) + switch (contestCategory) { case CONTEST_CATEGORY_COOL: - r5 = gContestMons[a].cool; - r4 = gContestMons[a].tough; - r3 = gContestMons[a].beauty; + statMain = gContestMons[who].cool; + statSub1 = gContestMons[who].tough; + statSub2 = gContestMons[who].beauty; break; case CONTEST_CATEGORY_BEAUTY: - r5 = gContestMons[a].beauty; - r4 = gContestMons[a].cool; - r3 = gContestMons[a].cute; + statMain = gContestMons[who].beauty; + statSub1 = gContestMons[who].cool; + statSub2 = gContestMons[who].cute; break; case CONTEST_CATEGORY_CUTE: - r5 = gContestMons[a].cute; - r4 = gContestMons[a].beauty; - r3 = gContestMons[a].smart; + statMain = gContestMons[who].cute; + statSub1 = gContestMons[who].beauty; + statSub2 = gContestMons[who].smart; break; case CONTEST_CATEGORY_SMART: - r5 = gContestMons[a].smart; - r4 = gContestMons[a].cute; - r3 = gContestMons[a].tough; + statMain = gContestMons[who].smart; + statSub1 = gContestMons[who].cute; + statSub2 = gContestMons[who].tough; break; case CONTEST_CATEGORY_TOUGH: default: - r5 = gContestMons[a].tough; - r4 = gContestMons[a].smart; - r3 = gContestMons[a].cool; + statMain = gContestMons[who].tough; + statSub1 = gContestMons[who].smart; + statSub2 = gContestMons[who].cool; break; } - return r5 + (r4 + r3 + gContestMons[a].sheen) / 2; + return statMain + (statSub1 + statSub2 + gContestMons[who].sheen) / 2; } -void InitContestMonConditions(u8 a) +void CalculateRound1Points(u8 contestCategory) { u8 i; for (i = 0; i < 4; i++) - gContestMonRound1Points[i] = InitContestMonConditionI(i, a); + gContestMonRound1Points[i] = CalculateContestantRound1Points(i, contestCategory); } u8 CreateJudgeSprite(void) { u8 spriteId; - LoadCompressedObjectPic(&gUnknown_083CA4BC); + LoadCompressedObjectPic(&sSpriteSheet_Judge); LoadCompressedPalette(gContest2Pal, 0x110, 32); - spriteId = CreateSprite(&gSpriteTemplate_83CA4A4, 112, 36, 30); + spriteId = CreateSprite(&sSpriteTemplate_Judge, 112, 36, 30); gSprites[spriteId].oam.paletteNum = 1; gSprites[spriteId].callback = SpriteCallbackDummy; return spriteId; } -u8 sub_80AE8B4(void) +u8 CreateJudgeSpeechBubbleSprite(void) { u8 spriteId; - LoadCompressedObjectPic(&gUnknown_083CA4C4); - LoadCompressedObjectPalette(&gUnknown_083CA4CC); - spriteId = CreateSprite(&gUnknown_083CA4D4, 96, 10, 29); + LoadCompressedObjectPic(&sSpriteSheet_JudgeSymbols); + LoadCompressedObjectPalette(&sSpritePalette_JudgeSymbols); + spriteId = CreateSprite(&sSpriteTemplate_JudgeSpeechBubble, 96, 10, 29); gSprites[spriteId].invisible = TRUE; gSprites[spriteId].data[0] = gSprites[spriteId].oam.tileNum; return spriteId; @@ -2472,7 +2472,7 @@ u8 unref_sub_80AE908(void) return spriteId; } -u8 sub_80AE9FC(u16 species, u32 otId, u32 personality) +u8 CreateContestantSprite(u16 species, u32 otId, u32 personality) { const u8 *lzPaletteData; u8 spriteId; @@ -2512,18 +2512,18 @@ bool8 IsSpeciesNotUnown(u16 species) return TRUE; } -void sub_80AEB30(void) +void SwapMoveDescAndContestTilemaps(void) { - sub_80AEB4C((void *)(VRAM + 0xC000)); - sub_80AEB4C((void *)(VRAM + 0xE000)); + __copy_tilemap((void *)(VRAM + 0xC000)); + __copy_tilemap((void *)(VRAM + 0xE000)); } -void sub_80AEB4C(void *a) +void __copy_tilemap(void *a) { DmaCopy16Defvars(3, a, (u8 *)a + 0x500, 0x280); } -u16 sub_80AEB68(u16 move, u8 b) +u16 GetMoveEffectSymbolTileOffset(u16 move, u8 b) { u16 var; @@ -2546,14 +2546,14 @@ u16 sub_80AEB68(u16 move, u8 b) return var; } -void sub_80AEBEC(u16 a) +void PrintContestMoveDescription(u16 a) { u8 category; u16 categoryTile; s32 i; u8 numHearts; - Text_FillWindowRectDefPalette(&gUnknown_03004210, 0, 11, 31, 16, 34); + Text_FillWindowRectDefPalette(&gWindowTemplate_Contest_MoveDescription, 0, 11, 31, 16, 34); category = gContestMoves[a].contestCategory; if (category == CONTEST_CATEGORY_COOL) @@ -2582,9 +2582,9 @@ void sub_80AEBEC(u16 a) numHearts = 8; for (i = 0; i < 8; i++) { - if (i < numHearts) + if (i < numHearts) // Empty hearts *(u16 *)(VRAM + 0xC7EA + i * 2) = 0x5012; - else + else // Filled-in hearts *(u16 *)(VRAM + 0xC7EA + i * 2) = 0x5035; } @@ -2596,29 +2596,29 @@ void sub_80AEBEC(u16 a) numHearts = 8; for (i = 0; i < 8; i++) { - if (i < numHearts) + if (i < numHearts) // Empty hearts *(u16 *)(VRAM + 0xC82A + i * 2) = 0x5014; - else + else // Filled-in hearts *(u16 *)(VRAM + 0xC82A + i * 2) = 0x5036; } - Text_InitWindowAndPrintText(&gUnknown_03004210, gContestEffectStrings[gContestMoves[a].effect], 868, 11, 35); - Text_InitWindowAndPrintText(&gUnknown_03004210, gUnknown_083CC5A2, 866, 16, 31); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gContestEffectStrings[gContestMoves[a].effect], 868, 11, 35); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, gText_Slash, 866, 16, 31); } void sub_80AED58(void) { - Text_FillWindowRectDefPalette(&gUnknown_03004210, 0, 11, 35, 28, 40); + Text_FillWindowRectDefPalette(&gWindowTemplate_Contest_MoveDescription, 0, 11, 35, 28, 40); } // unused -void sub_80AED7C(u16 move, u8 b) +void DrawMoveEffectSymbol(u16 move, u8 b) { - u8 r5 = gUnknown_02038696[b] * 5 + 2; + u8 r5 = gContestantTurnOrder[b] * 5 + 2; if (!Contest_IsMonsTurnDisabled(b) && move != MOVE_NONE) { - u16 tile = sub_80AEB68(move, b); + u16 tile = GetMoveEffectSymbolTileOffset(move, b); *(u16 *)(VRAM + 0xC028 + r5 * 64) = tile; *(u16 *)(VRAM + 0xC028 + r5 * 64 + 2) = tile + 1; @@ -2637,20 +2637,20 @@ void sub_80AED7C(u16 move, u8 b) } } -void unref_sub_80AEE20(void) +void DrawMoveEffectSymbols(void) { u8 i; for (i = 0; i < 4; i++) - sub_80AED7C(sContestantStatus[i].currMove, i); + DrawMoveEffectSymbol(sContestantStatus[i].currMove, i); } -u16 sub_80AEE4C(u8 unused) +u16 GetStarTileOffset(u8 unused) { return 0x2034; } -bool8 sub_80AEE54(u8 a, u8 b) +bool8 UpdateConditionStars(u8 a, u8 b) { u8 r9; u16 r8; @@ -2658,10 +2658,10 @@ bool8 sub_80AEE54(u8 a, u8 b) if (sContestantStatus[a].conditionMod == 0) return FALSE; - r9 = gUnknown_02038696[a] * 5 + 2; + r9 = gContestantTurnOrder[a] * 5 + 2; if (sContestantStatus[a].conditionMod == 1) { - r8 = sub_80AEE4C(a); + r8 = GetStarTileOffset(a); r4 = 0; while (sContestantStatus[a].condition / 10 > r4) { @@ -2674,7 +2674,7 @@ bool8 sub_80AEE54(u8 a, u8 b) sContestantStatus[a].conditionMod = 0; } } - else + else // CONDITION_LOSE { r8 = 0; r4 = 3; @@ -2692,15 +2692,15 @@ bool8 sub_80AEE54(u8 a, u8 b) return TRUE; } -void sub_80AEF50(void) +void DrawConditionStars(void) { s32 i; s32 r4; for (i = 0; i < 4; i++) { - u8 r8 = gUnknown_02038696[i] * 5 + 2; - u16 r6 = sub_80AEE4C(i); + u8 r8 = gContestantTurnOrder[i] * 5 + 2; + u16 r6 = GetStarTileOffset(i); r4 = 0; while (r4 < sContestantStatus[i].condition / 10) @@ -2717,25 +2717,25 @@ void sub_80AEF50(void) } } -u16 sub_80AEFE8(u8 unused, u8 b) +u16 GetStatusSymbolTileOffset(u8 unused, u8 b) { u16 var = 0; switch (b) { - case 0: + case 0: // For resistant var = 0x80; break; - case 1: + case 1: // For nervous var = 0x84; break; - case 2: + case 2: // For turn skipped var = 0x86; break; - case 3: + case 3: // For jammed/unnerved var = 0x88; break; - case 4: + case 4: // Never used var = 0x82; break; } @@ -2743,18 +2743,18 @@ u16 sub_80AEFE8(u8 unused, u8 b) return var; } -bool8 sub_80AF038(u8 a) +bool8 DrawStatusSymbol(u8 a) { bool8 r5 = TRUE; u16 r4 = 0; - u8 r6 = gUnknown_02038696[a] * 5 + 2; + u8 r6 = gContestantTurnOrder[a] * 5 + 2; if (sContestantStatus[a].resistant != 0 || sContestantStatus[a].immune != 0 || sContestantStatus[a].jamSafetyCount != 0 || sContestantStatus[a].jamReduction != 0) - r4 = sub_80AEFE8(a, 0); + r4 = GetStatusSymbolTileOffset(a, 0); else if (sContestantStatus[a].nervous) - r4 = sub_80AEFE8(a, 1); + r4 = GetStatusSymbolTileOffset(a, 1); else if (sContestantStatus[a].numTurnsSkipped != 0 || sContestantStatus[a].noMoreTurns) - r4 = sub_80AEFE8(a, 2); + r4 = GetStatusSymbolTileOffset(a, 2); else r5 = FALSE; if (r5) @@ -2774,17 +2774,17 @@ bool8 sub_80AF038(u8 a) return r5; } -void sub_80AF120(void) +void DrawStatusSymbols(void) { s32 i; for (i = 0; i < 4; i++) - sub_80AF038(i); + DrawStatusSymbol(i); } -void sub_80AF138(void) +void ContestClearGeneralTextWindow(void) { - Text_FillWindowRectDefPalette(&gUnknown_03004210, 0, 1, 15, 17, 18); + Text_FillWindowRectDefPalette(&gWindowTemplate_Contest_MoveDescription, 0, 1, 15, 17, 18); } u16 GetChosenMove(u8 a) @@ -2822,12 +2822,13 @@ void sub_80AF1E4(u8 a, u8 b) else r3 = 14; if (sContestantStatus[a].currMove == MOVE_NONE) - sub_80AE598(gDisplayedStringBattle, gUnknownText_MissedTurn, r3); + Contest_CopyStringWithColor(gDisplayedStringBattle, gUnknownText_MissedTurn, r3); else - sub_80AE598(gDisplayedStringBattle, gMoveNames[sContestantStatus[a].currMove], r3); + Contest_CopyStringWithColor( + gDisplayedStringBattle, gMoveNames[sContestantStatus[a].currMove], r3); sub_80AF2A0(a); Text_InitWindowAndPrintText( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 696 + a * 20, gUnknown_083CA318[a][0], @@ -2845,7 +2846,7 @@ void unref_sub_80AF280(u8 a) void sub_80AF2A0(u8 a) { Text_FillWindowRectDefPalette( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, 0, gUnknown_083CA318[a][0], gUnknown_083CA318[a][1], @@ -3018,42 +3019,40 @@ bool8 unref_sub_80AF5D0(u8 a, u8 b) return FALSE; } -void sub_80AF630(u8 a) +void CalculateTotalPointsForContestant(u8 a) { - gUnknown_02038688[a] = sub_80AF688(a); - gContestMonTotalPoints[a] = gContestMonRound1Points[a] + gUnknown_02038688[a]; + gContestMonRound2Points[a] = GetContestantRound2Points(a); + gContestMonTotalPoints[a] = gContestMonRound1Points[a] + gContestMonRound2Points[a]; } -void sub_80AF668(void) +void CalculateFinalScores(void) { u8 i; for (i = 0; i < 4; i++) - sub_80AF630(i); + CalculateTotalPointsForContestant(i); DetermineFinalStandings(); } -s16 sub_80AF688(u8 a) +s16 GetContestantRound2Points(u8 a) { - return gUnknown_02038680[a] * 2; + return gContestMonAppealPointTotals[a] * 2; } -// Determines standing order? void DetermineFinalStandings(void) { - u16 sp0[4] = {0}; - struct UnknownContestStruct6 sp8[4]; + u16 randomOrdering[4] = {0}; + struct ContestFinalStandings standings[4]; s32 i; - s32 j; + // Seed random order in case of ties for (i = 0; i < 4; i++) { - s32 r2; - - sp0[i] = Random(); - for (r2 = 0; r2 < i; r2++) + s32 j; + randomOrdering[i] = Random(); + for (j = 0; j < i; j++) { - if (sp0[i] == sp0[r2]) + if (randomOrdering[i] == randomOrdering[j]) { i--; break; @@ -3063,66 +3062,70 @@ void DetermineFinalStandings(void) for (i = 0; i < 4; i++) { - sp8[i].unk0 = gContestMonTotalPoints[i]; - sp8[i].unk4 = gContestMonRound1Points[i]; - sp8[i].unk8 = sp0[i]; - sp8[i].unkC = i; + standings[i].totalPoints = gContestMonTotalPoints[i]; + standings[i].round1Points = gContestMonRound1Points[i]; + standings[i].random = randomOrdering[i]; + standings[i].contestant = i; } + // Rank contestants for (i = 0; i < 3; i++) { + s32 j; for (j = 3; j > i; j--) { - if (sub_80AF828(j - 1, j, sp8)) + if (DidContestantPlaceHigher(j - 1, j, standings)) { - struct UnknownContestStruct6 temp; + // Swap contestants in array + struct ContestFinalStandings temp; - temp.unk0 = sp8[j - 1].unk0; - temp.unk4 = sp8[j - 1].unk4; - temp.unk8 = sp8[j - 1].unk8; - temp.unkC = sp8[j - 1].unkC; + temp.totalPoints = standings[j - 1].totalPoints; + temp.round1Points = standings[j - 1].round1Points; + temp.random = standings[j - 1].random; + temp.contestant = standings[j - 1].contestant; - sp8[j - 1].unk0 = sp8[j].unk0; - sp8[j - 1].unk4 = sp8[j].unk4; - sp8[j - 1].unk8 = sp8[j].unk8; - sp8[j - 1].unkC = sp8[j].unkC; + standings[j - 1].totalPoints = standings[j].totalPoints; + standings[j - 1].round1Points = standings[j].round1Points; + standings[j - 1].random = standings[j].random; + standings[j - 1].contestant = standings[j].contestant; - sp8[j].unk0 = temp.unk0; - sp8[j].unk4 = temp.unk4; - sp8[j].unk8 = temp.unk8; - sp8[j].unkC = temp.unkC; + standings[j].totalPoints = temp.totalPoints; + standings[j].round1Points = temp.round1Points; + standings[j].random = temp.random; + standings[j].contestant = temp.contestant; } } } + // Assign placements. i is the placing (0 is 1st, 1 is 2nd...) for (i = 0; i < 4; i++) - gContestFinalStandings[sp8[i].unkC] = i; + gContestFinalStandings[standings[i].contestant] = i; } -bool8 sub_80AF828(s32 a, s32 b, struct UnknownContestStruct6 *c) +bool8 DidContestantPlaceHigher(s32 a, s32 b, struct ContestFinalStandings *c) { bool8 retVal; - if (c[a].unk0 < c[b].unk0) + if (c[a].totalPoints < c[b].totalPoints) retVal = TRUE; - else if (c[a].unk0 > c[b].unk0) + else if (c[a].totalPoints > c[b].totalPoints) retVal = FALSE; - else if (c[a].unk4 < c[b].unk4) + else if (c[a].round1Points < c[b].round1Points) retVal = TRUE; - else if (c[a].unk4 > c[b].unk4) + else if (c[a].round1Points > c[b].round1Points) retVal = FALSE; - else if (c[a].unk8 < c[b].unk8) + else if (c[a].random < c[b].random) retVal = TRUE; else retVal = FALSE; return retVal; } -void sub_80AF860(void) +void ContestPrintLinkStandby(void) { gBattle_BG0_Y = 0; gBattle_BG2_Y = 0; - sub_80AF138(); + ContestClearGeneralTextWindow(); Text_InitWindowAndPrintText(&gMenuWindow, gUnknownText_LinkStandbyAndWinner, 776, 1, 15); } @@ -3359,7 +3362,7 @@ void sub_80AFC74(u8 taskId) if (r5 > 7) r5 += 24; // Seriously, a 2-byte CpuFill? Why? - CpuFill16(r6, (void *)(VRAM + 0xC000 + (0x56 + r5 + gUnknown_02038696[r7] * 160) * 2), 2); + CpuFill16(r6, (void *)(VRAM + 0xC000 + (0x56 + r5 + gContestantTurnOrder[r7] * 160) * 2), 2); if (r1 > 0) { PlaySE(SE_CONTEST_HEART); @@ -3382,7 +3385,7 @@ void sub_80AFE30(void) LoadSpriteSheet(&gUnknown_083CA350); for (i = 0; i < 4; i++) { - u8 y = gUnknown_083CA338[gUnknown_02038696[i]]; + u8 y = gUnknown_083CA338[gContestantTurnOrder[i]]; shared19338[i].unk0 = CreateSprite(&gSpriteTemplate_83CA3AC, 180, y, 1); } @@ -3451,7 +3454,7 @@ void sub_80AFFA0(void) s32 i; for (i = 0; i < 4; i++) - gSprites[shared19338[i].unk0].pos1.y = gUnknown_083CA338[gUnknown_02038696[i]]; + gSprites[shared19338[i].unk0].pos1.y = gUnknown_083CA338[gContestantTurnOrder[i]]; } void sub_80AFFE0(bool8 a) @@ -3460,7 +3463,7 @@ void sub_80AFFE0(bool8 a) for (i = 0; i < 4; i++) { - if (gUnknown_02038696[i] > 1) + if (gContestantTurnOrder[i] > 1) { if (!a) gSprites[shared19338[i].unk0].pos1.x = 180; @@ -3480,7 +3483,7 @@ void sub_80B0034(void) LoadCompressedObjectPic(&gUnknown_083CA3C4[i]); shared19338[i].unk1 = CreateSprite( &gSpriteTemplate_83CA3F4[i], - 204, gUnknown_083CA33C[gUnknown_02038696[i]], + 204, gUnknown_083CA33C[gContestantTurnOrder[i]], 0); SetSubspriteTables(&gSprites[shared19338[i].unk1], gSubspriteTables_83CA464); gSprites[shared19338[i].unk1].invisible = TRUE; @@ -3757,7 +3760,7 @@ void sub_80B0748(u8 taskId) for (i = 0; i < 4; i++) { //#define r4 r4_2 - r4 = gUnknown_02038696[i]; + r4 = gContestantTurnOrder[i]; r1 = r4 * 4; r7 = gTasks[taskId].data[r1 + 0]; @@ -3895,7 +3898,7 @@ void sub_80B0748(u8 taskId) lsls r0, 3\n\ str r0, [sp, 0xC]\n\ _080B0774:\n\ - ldr r0, _080B07F8 @ =gUnknown_02038696\n\ + ldr r0, _080B07F8 @ =gContestantTurnOrder\n\ ldr r3, [sp, 0x4]\n\ adds r0, r3, r0\n\ ldrb r4, [r0]\n\ @@ -3962,7 +3965,7 @@ _080B07D2:\n\ b _080B08EA\n\ .align 2, 0\n\ _080B07F4: .4byte gTasks\n\ -_080B07F8: .4byte gUnknown_02038696\n\ +_080B07F8: .4byte gContestantTurnOrder\n\ _080B07FC: .4byte 0x00007fff\n\ _080B0800:\n\ adds r0, r5, 0x2\n\ @@ -4194,7 +4197,7 @@ extern const struct SpriteTemplate gSpriteTemplate_83CC53C[]; u8 sub_80B09E4(u8 a) { - u8 r5 = gUnknown_02038696[a] * 40 + 32; + u8 r5 = gContestantTurnOrder[a] * 40 + 32; u8 r8; u8 r6; volatile u8 zero; @@ -4205,8 +4208,8 @@ u8 sub_80B09E4(u8 a) r6 = CreateSprite(&gSpriteTemplate_83CC53C[a], 248, r5, 29); gSprites[r6].oam.tileNum += 64; - CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02038696[a] * 5 * 64 + 0x26), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32)); - CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02038696[a] * 5 * 64 + 0x36), (u8 *)(VRAM + 0x10000 + gSprites[r6].oam.tileNum * 32)); + CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gContestantTurnOrder[a] * 5 * 64 + 0x26), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32)); + CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gContestantTurnOrder[a] * 5 * 64 + 0x36), (u8 *)(VRAM + 0x10000 + gSprites[r6].oam.tileNum * 32)); DmaFill32Defvars(3, 0, (void *)(VRAM + 0x10000 + (0x28 + gSprites[r8].oam.tileNum) * 32), 0x300); @@ -4300,7 +4303,7 @@ void unref_sub_80B0CF4(void) for (i = 0; i < 4; i++) { Text_FillWindowRectDefPalette( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, 0, gUnknown_083CA308[i][0], gUnknown_083CA308[i][1], @@ -4308,7 +4311,7 @@ void unref_sub_80B0CF4(void) gUnknown_083CA310[i][1] + 1); } sub_80AE514(); - sub_80AEB30(); + SwapMoveDescAndContestTilemaps(); } else { @@ -4329,7 +4332,7 @@ void sub_80B0D7C(void) for (i = 0; i < 4; i++) { Text_FillWindowRectDefPalette( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, 0, gUnknown_083CA308[i][0], gUnknown_083CA308[i][1], @@ -4347,11 +4350,11 @@ void sub_80B0D7C(void) } ConvertIntToDecimalStringN(sp8 + r5, r2, 0, 4); Text_InitWindowAndPrintText( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, sp8, - 592 + gUnknown_02038696[i] * 22, - gUnknown_083CA310[gUnknown_02038696[i]][0], - gUnknown_083CA310[gUnknown_02038696[i]][1]); + 592 + gContestantTurnOrder[i] * 22, + gUnknown_083CA310[gContestantTurnOrder[i]][0], + gUnknown_083CA310[gContestantTurnOrder[i]][1]); r5 = 0; } for (i = 0; i < 4; i++) @@ -4365,14 +4368,14 @@ void sub_80B0D7C(void) } ConvertIntToDecimalStringN(sp8 + r5, r2, 0, 4); Text_InitWindowAndPrintText( - &gUnknown_03004210, + &gWindowTemplate_Contest_MoveDescription, sp8, - 512 + gUnknown_02038696[i] * 20, - gUnknown_083CA308[gUnknown_02038696[i]][0], - gUnknown_083CA308[gUnknown_02038696[i]][1]); + 512 + gContestantTurnOrder[i] * 20, + gUnknown_083CA308[gContestantTurnOrder[i]][0], + gUnknown_083CA308[gContestantTurnOrder[i]][1]); r5 = 0; } - sub_80AEB30(); + SwapMoveDescAndContestTilemaps(); } } @@ -4422,24 +4425,24 @@ void SortContestants(u8 a) { for (i = 0; i < 4; i++) { - gUnknown_02038696[i] = i; + gContestantTurnOrder[i] = i; for (r4 = 0; r4 < i; r4++) { - if (gContestMonRound1Points[gUnknown_02038696[r4]] < gContestMonRound1Points[i] - || (gContestMonRound1Points[gUnknown_02038696[r4]] == gContestMonRound1Points[i] && sp4[gUnknown_02038696[r4]] < sp4[i])) + if (gContestMonRound1Points[gContestantTurnOrder[r4]] < gContestMonRound1Points[i] + || (gContestMonRound1Points[gContestantTurnOrder[r4]] == gContestMonRound1Points[i] && sp4[gContestantTurnOrder[r4]] < sp4[i])) { for (r2 = i; r2 > r4; r2--) - gUnknown_02038696[r2] = gUnknown_02038696[r2 - 1]; - gUnknown_02038696[r4] = i; + gContestantTurnOrder[r2] = gContestantTurnOrder[r2 - 1]; + gContestantTurnOrder[r4] = i; break; } } if (r4 == i) - gUnknown_02038696[i] = i; + gContestantTurnOrder[i] = i; } - memcpy(sp0, gUnknown_02038696, sizeof(sp0)); + memcpy(sp0, gContestantTurnOrder, sizeof(sp0)); for (i = 0; i < 4; i++) - gUnknown_02038696[sp0[i]] = i; + gContestantTurnOrder[sp0[i]] = i; } else { @@ -4454,7 +4457,7 @@ void SortContestants(u8 a) if (*ptr == 0xFF) { *ptr = i; - gUnknown_02038696[i] = r2; + gContestantTurnOrder[i] = r2; break; } r2++; @@ -4465,13 +4468,13 @@ void SortContestants(u8 a) for (r4 = 3; r4 > i; r4--) { if (sContestantStatus[r4 - 1].unkB_0 == sContestantStatus[r4].unkB_0 - && gUnknown_02038696[r4 - 1] < gUnknown_02038696[r4] + && gContestantTurnOrder[r4 - 1] < gContestantTurnOrder[r4] && sp4[r4 - 1] < sp4[r4]) { - u8 temp = gUnknown_02038696[r4]; + u8 temp = gContestantTurnOrder[r4]; - gUnknown_02038696[r4] = gUnknown_02038696[r4 - 1]; - gUnknown_02038696[r4 - 1] = temp; + gContestantTurnOrder[r4] = gContestantTurnOrder[r4 - 1]; + gContestantTurnOrder[r4 - 1] = temp; } } } @@ -4484,8 +4487,8 @@ void sub_80B1118(void) for (i = 0; i < 4; i++) { - //LoadPalette(shared18000.unk18004[5 + i], (gUnknown_02038696[i] + 5) * 16, 32); - LoadPalette(shared18004 + (i + 5) * 16, (gUnknown_02038696[i] + 5) * 16, 32); + //LoadPalette(shared18000.unk18004[5 + i], (gContestantTurnOrder[i] + 5) * 16, 32); + LoadPalette(shared18004 + (i + 5) * 16, (gContestantTurnOrder[i] + 5) * 16, 32); } sub_80AE514(); } @@ -4636,7 +4639,7 @@ void sub_80B146C(u8 contestant, u8 stringId) else StringCopy(gStringVar3, gText_Contest_Fear); StringExpandPlaceholders(gStringVar4, gUnknown_083CC188[stringId]); - sub_80AF138(); + ContestClearGeneralTextWindow(); Text_InitWindow8002EB0(&gMenuWindow, gStringVar4, 776, 1, 15); } @@ -4657,7 +4660,7 @@ void sub_80B159C(void) for (i = 0; i < 4; i++) { - sp0[i] = gUnknown_02038696[i]; + sp0[i] = gContestantTurnOrder[i]; sp4[i] = 0; } @@ -4686,7 +4689,7 @@ void sub_80B159C(void) for (; j < 4; j++) { if (sp4[j] == 0 && sContestantStatus[j].nextTurnOrder == 0xFF - && gUnknown_02038696[r12] > gUnknown_02038696[j]) + && gContestantTurnOrder[r12] > gContestantTurnOrder[j]) r12 = j; } sp0[r12] = i; @@ -4699,7 +4702,7 @@ void sub_80B159C(void) shared192D0.turnOrder[i] = sp0[i]; sContestantStatus[i].nextTurnOrder = 0xFF; sContestantStatus[i].turnOrderMod = 0; - gUnknown_02038696[i] = sp0[i]; + gContestantTurnOrder[i] = sp0[i]; } } @@ -4784,7 +4787,7 @@ void unref_sub_80B19D0(void) { u8 str[20]; StringCopy(str, gUnknown_083CC2EC); - Text_InitWindowAndPrintText(&gUnknown_03004210, str, 680, 0, 0); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, str, 680, 0, 0); } s8 Contest_GetMoveExcitement(u16 move) @@ -5047,7 +5050,7 @@ void sub_80B1FD0(bool8 a) GetTurnOrderNumberGfx(i), (void *)(VRAM + 0x10000 + (gSprites[shared19338[i].unk1].oam.tileNum + 5) * 32), 64); - gSprites[shared19338[i].unk1].pos1.y = gUnknown_083CA33C[gUnknown_02038696[i]]; + gSprites[shared19338[i].unk1].pos1.y = gUnknown_083CA33C[gContestantTurnOrder[i]]; gSprites[shared19338[i].unk1].invisible = FALSE; } else @@ -5073,8 +5076,8 @@ void sub_80B20C4(void) { if (shared192D0.unnervedPokes[i] != 0 && !Contest_IsMonsTurnDisabled(i)) { - u8 r4 = gUnknown_02038696[i] * 5 + 2; - u16 r0 = sub_80AEFE8(i, 3); + u8 r4 = gContestantTurnOrder[i] * 5 + 2; + u16 r0 = GetStatusSymbolTileOffset(i, 3); *(u16 *)(VRAM + 0xC000 + r4 * 64 + 0x28) = r0; *(u16 *)(VRAM + 0xC000 + r4 * 64 + 0x2A) = r0 + 1; @@ -5173,10 +5176,10 @@ void sub_80B2400(u8 taskId) { case 0: for (i = 0; i < 4; i++) - sContest.unk19218[i] = gUnknown_02038696[i]; + sContest.unk19218[i] = gContestantTurnOrder[i]; sub_80AFA5C(); sub_80B0588(); - sub_80AEF50(); + DrawConditionStars(); sub_80B1118(); sub_80B1FD0(TRUE); sub_80AFFA0(); @@ -5192,7 +5195,7 @@ void sub_80B2400(u8 taskId) sub_80AF438(); taskId2 = CreateTask(sub_80C8C80, 0); SetTaskFuncWithFollowupFunc(taskId2, sub_80C8C80, sub_80AD8DC); - sub_80AF860(); + ContestPrintLinkStandby(); gTasks[taskId].data[0] = 2; } else @@ -5206,8 +5209,8 @@ void sub_80B2400(u8 taskId) gTasks[taskId].data[0] = 3; break; case 3: - sub_80AF120(); - sub_80AEB30(); + DrawStatusSymbols(); + SwapMoveDescAndContestTilemaps(); gTasks[taskId].data[0] = 0; gTasks[taskId].func = sub_80B253C; break; @@ -5451,7 +5454,7 @@ bool8 Contest_SaveWinner(u8 a) } if (a != 0xFE) { - u8 r4 = sub_80B2C4C(a, 1); + u8 r4 = GetContestWinnerSaveIdx(a, 1); gSaveBlock1.contestWinners[r4].personality = gContestMons[i].personality; gSaveBlock1.contestWinners[r4].species = gContestMons[i].species; @@ -5478,7 +5481,7 @@ bool8 Contest_SaveWinner(u8 a) return TRUE; } -u8 sub_80B2C4C(u8 a, u8 b) +u8 GetContestWinnerSaveIdx(u8 a, u8 b) { s32 i; diff --git a/src/contest_effect.c b/src/contest_effect.c index 2cd1e5828..7c52e8075 100644 --- a/src/contest_effect.c +++ b/src/contest_effect.c @@ -501,7 +501,7 @@ static void ContestEffect_BadlyStartlesMonsInGoodCondition(void) // The appeal works great if performed first. static void ContestEffect_BetterIfFirst(void) { - if (gUnknown_02038696[shared192D0.contestant] == 0) + if (gContestantTurnOrder[shared192D0.contestant] == 0) { u16 move = sContestantStatus[shared192D0.contestant].currMove; sContestantStatus[shared192D0.contestant].appeal2 += 2 * gContestEffects[gContestMoves[move].effect].appeal; @@ -512,7 +512,7 @@ static void ContestEffect_BetterIfFirst(void) // The appeal works great if performed last. static void ContestEffect_BetterIfLast(void) { - if (gUnknown_02038696[shared192D0.contestant] == 3) + if (gContestantTurnOrder[shared192D0.contestant] == 3) { u16 move = sContestantStatus[shared192D0.contestant].currMove; sContestantStatus[shared192D0.contestant].appeal2 += 2 * gContestEffects[gContestMoves[move].effect].appeal; diff --git a/src/contest_link.c b/src/contest_link.c index be2be27ff..5c6cfe24e 100644 --- a/src/contest_link.c +++ b/src/contest_link.c @@ -480,28 +480,29 @@ void sub_80C8AD0(u8 taskId) case 3: if (IsLinkTaskFinished()) { - SendBlockToAllOpponents(gUnknown_02038680, sizeof gUnknown_02038680); + SendBlockToAllOpponents( + gContestMonAppealPointTotals, sizeof gContestMonAppealPointTotals); gTasks[taskId].data[0]++; } break; case 4: if (HaveAllPlayersReceivedBlock()) { - memcpy(gUnknown_02038680, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gUnknown_02038680); + memcpy(gContestMonAppealPointTotals, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gContestMonAppealPointTotals); gTasks[taskId].data[0]++; } break; case 6: if (IsLinkTaskFinished()) { - SendBlockToAllOpponents(gUnknown_02038688, sizeof gUnknown_02038688); + SendBlockToAllOpponents(gContestMonRound2Points, sizeof gContestMonRound2Points); gTasks[taskId].data[0]++; } break; case 7: if (HaveAllPlayersReceivedBlock()) { - memcpy(gUnknown_02038688, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gUnknown_02038688); + memcpy(gContestMonRound2Points, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gContestMonRound2Points); gTasks[taskId].data[0]++; } break; @@ -585,14 +586,14 @@ void sub_80C8C80(u8 taskId) case 9: if (IsLinkTaskFinished()) { - SendBlockToAllOpponents(gUnknown_02038696, sizeof gUnknown_02038696); + SendBlockToAllOpponents(gContestantTurnOrder, sizeof gContestantTurnOrder); gTasks[taskId].data[0]++; } break; case 10: if (HaveAllPlayersReceivedBlock()) { - memcpy(gUnknown_02038696, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gUnknown_02038696); + memcpy(gContestantTurnOrder, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gContestantTurnOrder); gTasks[taskId].data[0]++; } break; @@ -706,14 +707,14 @@ void Task_LinkContest_CommunicateTurnOrder(u8 taskId) case 0: if (IsLinkTaskFinished()) { - SendBlockToAllOpponents(gUnknown_02038696, sizeof gUnknown_02038696); + SendBlockToAllOpponents(gContestantTurnOrder, sizeof gContestantTurnOrder); gTasks[taskId].data[0]++; } break; case 1: if (HaveAllPlayersReceivedBlock()) { - memcpy(gUnknown_02038696, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gUnknown_02038696); + memcpy(gContestantTurnOrder, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof gContestantTurnOrder); gTasks[taskId].data[0]++; } break; diff --git a/src/contest_link_util.c b/src/contest_link_util.c index 0e4ff15b2..442668b9c 100644 --- a/src/contest_link_util.c +++ b/src/contest_link_util.c @@ -728,7 +728,7 @@ static void sub_80C2E14(u8 taskId) Contest_SaveWinner(gSpecialVar_ContestRank); Contest_SaveWinner(0xFE); eCurContestWinnerIsForArtist = TRUE; - eCurContestWinnerSaveIdx = sub_80B2C4C(0xfe, 0); + eCurContestWinnerSaveIdx = GetContestWinnerSaveIdx(0xfe, 0); BeginHardwarePaletteFade(0xff, 0, 0, 16, 0); gTasks[taskId].func = sub_80C2EA0; } @@ -1810,7 +1810,7 @@ s8 sub_80C39E4(u8 arg0, u8 arg1) s16 val; s8 ret; - val = gUnknown_02038688[arg0]; + val = gContestMonRound2Points[arg0]; if (val < 0) r4 = -val << 16; else @@ -1826,7 +1826,7 @@ s8 sub_80C39E4(u8 arg0, u8 arg1) if (arg1 != 0 && r2 > 10) r2 = 10; - if (gUnknown_02038688[arg0] < 0) + if (gContestMonRound2Points[arg0] < 0) ret = -r2; else ret = r2; @@ -2122,12 +2122,12 @@ void sub_80C3F00(void) r4 += 10; eContestLink80C2020Struct2018018[i].unk_00 = r4 / 10; - r4 = 1000 * ABS(gUnknown_02038688[i]) / ABS(r2); + r4 = 1000 * ABS(gContestMonRound2Points[i]) / ABS(r2); if ((r4 % 10) >= 5) r4 += 10; eContestLink80C2020Struct2018018[i].unk_04 = r4 / 10; - if (gUnknown_02038688[i] < 0) + if (gContestMonRound2Points[i] < 0) eContestLink80C2020Struct2018018[i].unk_10 = 1; r5 = 22528 * eContestLink80C2020Struct2018018[i].unk_00 / 100; @@ -2568,7 +2568,7 @@ void ScrSpecial_CheckSelectedMonAndInitContest(void) if (result != 0) { Contest_InitAllPokemon(gSpecialVar_ContestCategory, gSpecialVar_ContestRank); - InitContestMonConditions(gSpecialVar_ContestCategory); + CalculateRound1Points(gSpecialVar_ContestCategory); } gSpecialVar_Result = result; } @@ -2853,7 +2853,7 @@ void Task_LinkContest_SetUpContest(u8 taskId) sp4[i] = gTasks[taskId].data[i + 5]; gContestLinkLeaderIndex = LinkContest_GetLeaderIndex(sp4); - InitContestMonConditions(gSpecialVar_ContestCategory); + CalculateRound1Points(gSpecialVar_ContestCategory); SetTaskFuncWithFollowupFunc( taskId, Task_LinkContest_CommunicateRound1Points, Task_LinkContest_CalculateTurnOrder); } diff --git a/src/contest_util.c b/src/contest_util.c index 5fa98a453..951d9f796 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -223,13 +223,15 @@ void ShowContestWinnerCleanup(void) SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); } +// File boundary? + void ShowContestWinner(void) { if(gUnknown_0203856C) { sub_80AAF30(); eCurContestWinnerIsForArtist = TRUE; - eCurContestWinnerSaveIdx = sub_80B2C4C(254, 0); + eCurContestWinnerSaveIdx = GetContestWinnerSaveIdx(CONTEST_SAVE_FOR_ARTIST, 0); Contest_SaveWinner(3); gUnknown_0203856C = 0; } diff --git a/src/debug/crash.c b/src/debug/crash.c index 85058d285..3f9e2d685 100644 --- a/src/debug/crash.c +++ b/src/debug/crash.c @@ -4,7 +4,7 @@ #include "text.h" #include "palette.h" -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; static void CB2_CrashIdle(void); @@ -37,9 +37,9 @@ void Crash(u8 *text) SetMainCallback2(CB2_CrashIdle); DmaFill32Large(3, 0, (void *)VRAM, 0x18000, 0x1000); Text_LoadWindowTemplate(&gWindowTemplate_81E6FD8); - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6FD8); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6FD8); LoadFontDefaultPalette(&gWindowTemplate_81E6FD8); - Text_InitWindowAndPrintText(&gUnknown_03004210, text, 1, 9, 7); + Text_InitWindowAndPrintText(&gWindowTemplate_Contest_MoveDescription, text, 1, 9, 7); } static void CB2_CrashIdle(void) diff --git a/src/debug/matsuda_debug_menu.c b/src/debug/matsuda_debug_menu.c index b3a0e0ffc..c099ecc87 100644 --- a/src/debug/matsuda_debug_menu.c +++ b/src/debug/matsuda_debug_menu.c @@ -109,7 +109,7 @@ static void sub_80A9BE4(u8 taskId) DestroyTask(taskId); if (!(gIsLinkContest & 1)) - sub_80AF668(); + CalculateFinalScores(); sub_80C2358(); } @@ -182,7 +182,7 @@ static void sub_80A9D58(u8 taskId) dest[i] = gTasks[taskId].data[5 + i]; gContestLinkLeaderIndex = LinkContest_GetLeaderIndex(dest); - InitContestMonConditions((u8)gSpecialVar_ContestCategory); + CalculateRound1Points((u8)gSpecialVar_ContestCategory); SortContestants(0); SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateRound1Points, sub_80A9DBC); } @@ -607,7 +607,7 @@ void sub_80AA5E8(u8 var) static void sub_80AA614(u8 var1, u8 var2) { - u16 var = InitContestMonConditionI(var1, var2); + u16 var = CalculateContestantRound1Points(var1, var2); ConvertIntToDecimalStringN(gSharedMem, var, STR_CONV_MODE_RIGHT_ALIGN, 3); Text_InitWindowAndPrintText(&gMenuWindow, gSharedMem, 0xE2, 3, 0xC); @@ -859,7 +859,7 @@ void sub_80AACC4(void) { SetDebugMonForContest(); if (!(gIsLinkContest & 1)) - InitContestMonConditions(eMatsudaDebugVar); + CalculateRound1Points(eMatsudaDebugVar); SetMainCallback2(CB2_StartContest); } } @@ -882,7 +882,7 @@ void sub_80AAD44(struct Sprite *sprite, s8 var2) SetDebugMonForContest(); for (i = 0; i < 4; i++) - gContestMonRound1Points[i] = InitContestMonConditionI(i, gSpecialVar_ContestCategory); + gContestMonRound1Points[i] = CalculateContestantRound1Points(i, gSpecialVar_ContestCategory); SetMainCallback2(c2_exit_to_overworld_1_sub_8080DEC); } } @@ -951,15 +951,15 @@ void sub_80AAF30(void) for (i = 0; i < 3; i++) { gContestMonRound1Points[i] = 0; - gUnknown_02038680[i] = 0; + gContestMonAppealPointTotals[i] = 0; gContestMonTotalPoints[i] = 0; gContestMons[i] = gContestMons[3]; } gContestMonRound1Points[3] = 0x12C; - gUnknown_02038680[3] = 0x190; + gContestMonAppealPointTotals[3] = 0x190; gContestMonTotalPoints[3] = 0x190; - Contest_SaveWinner(0xFE); + Contest_SaveWinner(CONTEST_SAVE_FOR_ARTIST); } u8 MatsudaDebugMenu_SetHighScore(void) @@ -977,7 +977,7 @@ u8 MatsudaDebugMenu_ResetHighScore(void) for (i = 0; i < 4; i++) { gContestMonRound1Points[i] = 0; - gUnknown_02038680[i] = 0; + gContestMonAppealPointTotals[i] = 0; gContestMonTotalPoints[i] = 0; } CloseMenu(); diff --git a/src/debug/start_menu_debug.c b/src/debug/start_menu_debug.c index 1501fdd49..edc953c7e 100644 --- a/src/debug/start_menu_debug.c +++ b/src/debug/start_menu_debug.c @@ -2589,9 +2589,9 @@ void DebugMenu_8078E68(u8 a0, u8 * a1, u32 a2) } struct GameTimeDebugMenuStruct { - u16 unk0; + u16 totalPoints; u16 unk2; - u8 unk4; + u8 round1Points; u8 unk5; }; @@ -2604,7 +2604,7 @@ const struct GameTimeDebugMenuStruct gUnknown_Debug_839C5F4[] = { void DebugMenu_8078E80(s16 * a0) { Menu_BlankWindowRect(2, 15, 22, 16); - sub_8071F60(0xd0, gUnknown_Debug_839C5F4[*a0].unk4, 15); + sub_8071F60(0xd0, gUnknown_Debug_839C5F4[*a0].round1Points, 15); } void DebugMenu_8078EB0(s16 * a0) @@ -2669,7 +2669,7 @@ void DebugMenu_8078F68(u8 taskId) else { const struct GameTimeDebugMenuStruct *r2 = gUnknown_Debug_839C5F4 + data[0]; - if (DebugMenu_8077DD8(data + r2->unk5, r2->unk0, r2->unk2, gMain.newAndRepeatedKeys) == TRUE) + if (DebugMenu_8077DD8(data + r2->unk5, r2->totalPoints, r2->unk2, gMain.newAndRepeatedKeys) == TRUE) DebugMenu_8078EB0(data); } } diff --git a/src/debug/taya_debug_window.c b/src/debug/taya_debug_window.c index ca66ca01a..9a997a566 100644 --- a/src/debug/taya_debug_window.c +++ b/src/debug/taya_debug_window.c @@ -69,7 +69,7 @@ const u8 gUnknown_Debug_083C4EB0[] = _("Interview(BT)"); const struct { const u8 * text; - u32 unk4; + u32 round1Points; } gUnknown_Debug_083C4EC0[] = { {gUnknown_Debug_083C4E54, 0x0}, {gUnknown_Debug_083C4E5C, 0x1}, @@ -281,7 +281,7 @@ bool8 debug_sub_809089C(void) case -2: return FALSE; default: - gSpecialVar_0x8004 = gUnknown_Debug_083C4EC0[input].unk4; + gSpecialVar_0x8004 = gUnknown_Debug_083C4EC0[input].round1Points; switch (gSpecialVar_0x8004) { case 5: diff --git a/src/debug/watanabe_debug_menu.c b/src/debug/watanabe_debug_menu.c index 53b7dee7a..f0bb0078c 100644 --- a/src/debug/watanabe_debug_menu.c +++ b/src/debug/watanabe_debug_menu.c @@ -33,9 +33,9 @@ #include "field_effect.h" struct WatanabeDebugMenuItemSubstruct { - u32 unk0; - u32 unk4; - u8 unk8; + u32 totalPoints; + u32 round1Points; + u8 random; u8 unk9; }; @@ -60,7 +60,7 @@ struct WatanabeEwram17000 { u8 unk9; u8 unkA; u8 unkB; - u8 unkC; + u8 contestant; }; struct WatanabeEwram18000 { @@ -74,17 +74,17 @@ struct WatanabeEwram18000 { }; struct WatanabeEwram18000_2 { - u16 unk0; + u16 totalPoints; u8 unk2; u8 unk3; - u8 unk4; + u8 round1Points; u8 unk5; u8 unk6; u8 unk7; - u8 unk8; + u8 random; u8 unk9; u8 unkA; - struct PlttData unkC; + struct PlttData contestant; u16 unk10[16]; }; @@ -1367,7 +1367,7 @@ void debug_80C4AC4(u8 taskId) eWatanabe17000.unk9 = 0; eWatanabe17000.unkA = 0; eWatanabe17000.unkB = 0; - eWatanabe17000.unkC = 0; + eWatanabe17000.contestant = 0; gTasks[taskId].func = debug_80C4F48; } else if (gMain.newAndRepeatedKeys & DPAD_UP) @@ -2362,11 +2362,11 @@ const u32 gUnknown_Debug_083F8768[] = { void debug_80C6544(u8 a0) { u32 r7 = debug_80C5B60(gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]); - u32 r5 = gUnknown_Debug_083F8554[gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]].data.type4->unk0; - u32 r4 = gUnknown_Debug_083F8554[gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]].data.type4->unk4; + u32 r5 = gUnknown_Debug_083F8554[gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]].data.type4->totalPoints; + u32 r4 = gUnknown_Debug_083F8554[gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]].data.type4->round1Points; u32 r3 = gUnknown_Debug_083F8768[gUnknown_Debug_2038A1C->unk16a]; - if (gUnknown_Debug_083F8554[gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]].data.type4->unk8 == 0) + if (gUnknown_Debug_083F8554[gUnknown_Debug_083F8698[gUnknown_Debug_2038A1C->unk168].text[gUnknown_Debug_2038A1C->unk169]].data.type4->random == 0) { switch (a0) { @@ -2568,13 +2568,13 @@ void InitSeePokemonGraphics(void) REG_DISPCNT = DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON; CreateTask(debug_80C6B00, 0); gUnknown_Debug_2038A20 = &eWatanabe18000_2; - gUnknown_Debug_2038A20->unk0 = 0x115; + gUnknown_Debug_2038A20->totalPoints = 0x115; gUnknown_Debug_2038A20->unk2 = 0; gUnknown_Debug_2038A20->unk3 = 0; gUnknown_Debug_2038A20->unk5 = 0; gUnknown_Debug_2038A20->unk7 = 0; gUnknown_Debug_2038A20->unkA = 0; - gUnknown_Debug_2038A20->unk8 = 0; + gUnknown_Debug_2038A20->random = 0; spriteId = CreateSprite(&gSpriteTemplate_83F8874, 0x6C, 0x74, 0); gSprites[spriteId].data[0] = 0; StartSpriteAnim(gSprites + spriteId, 0); @@ -2670,31 +2670,31 @@ void debug_80C6B00(u8 taskId) void debug_80C6CB8(u8 taskId) { - DecompressPicFromTable_2(gMonFrontPicTable + gUnknown_Debug_2038A20->unk0, gMonFrontPicCoords[gUnknown_Debug_2038A20->unk0].coords, gMonFrontPicCoords[gUnknown_Debug_2038A20->unk0].y_offset, gMonSpriteGfx_Sprite_ptr[0], gMonSpriteGfx_Sprite_ptr[1], gUnknown_Debug_2038A20->unk0); - LoadCompressedObjectPalette(gMonPaletteTable + gUnknown_Debug_2038A20->unk0); - GetMonSpriteTemplate_803C56C(gUnknown_Debug_2038A20->unk0, 1); + DecompressPicFromTable_2(gMonFrontPicTable + gUnknown_Debug_2038A20->totalPoints, gMonFrontPicCoords[gUnknown_Debug_2038A20->totalPoints].coords, gMonFrontPicCoords[gUnknown_Debug_2038A20->totalPoints].y_offset, gMonSpriteGfx_Sprite_ptr[0], gMonSpriteGfx_Sprite_ptr[1], gUnknown_Debug_2038A20->totalPoints); + LoadCompressedObjectPalette(gMonPaletteTable + gUnknown_Debug_2038A20->totalPoints); + GetMonSpriteTemplate_803C56C(gUnknown_Debug_2038A20->totalPoints, 1); gUnknown_Debug_2038A20->unk2 = CreateSprite(&gUnknown_02024E8C, 0x28, 0x28, 0); gSprites[gUnknown_Debug_2038A20->unk2].callback = debug_69; gSprites[gUnknown_Debug_2038A20->unk2].oam.priority = 0; - DecompressPicFromTable_2(gMonBackPicTable + gUnknown_Debug_2038A20->unk0, gMonBackPicCoords[gUnknown_Debug_2038A20->unk0].coords, gMonBackPicCoords[gUnknown_Debug_2038A20->unk0].y_offset, gMonSpriteGfx_Sprite_ptr[0], gMonSpriteGfx_Sprite_ptr[2], gUnknown_Debug_2038A20->unk0); - LoadCompressedObjectPalette(gMonPaletteTable + gUnknown_Debug_2038A20->unk0); - GetMonSpriteTemplate_803C56C(gUnknown_Debug_2038A20->unk0, 2); + DecompressPicFromTable_2(gMonBackPicTable + gUnknown_Debug_2038A20->totalPoints, gMonBackPicCoords[gUnknown_Debug_2038A20->totalPoints].coords, gMonBackPicCoords[gUnknown_Debug_2038A20->totalPoints].y_offset, gMonSpriteGfx_Sprite_ptr[0], gMonSpriteGfx_Sprite_ptr[2], gUnknown_Debug_2038A20->totalPoints); + LoadCompressedObjectPalette(gMonPaletteTable + gUnknown_Debug_2038A20->totalPoints); + GetMonSpriteTemplate_803C56C(gUnknown_Debug_2038A20->totalPoints, 2); gUnknown_Debug_2038A20->unk3 = CreateSprite(&gUnknown_02024E8C, 0x28, 0x78, 0); gSprites[gUnknown_Debug_2038A20->unk3].callback = debug_69; gSprites[gUnknown_Debug_2038A20->unk3].oam.priority = 0; - gUnknown_Debug_2038A20->unk4 = CreateMonIcon(gUnknown_Debug_2038A20->unk0, sub_809D62C, 0x68, 0x2C, 0, 0); + gUnknown_Debug_2038A20->round1Points = CreateMonIcon(gUnknown_Debug_2038A20->totalPoints, sub_809D62C, 0x68, 0x2C, 0, 0); - sub_8091738(SpeciesToNationalPokedexNum(gUnknown_Debug_2038A20->unk0), 2, 0x3fc); + sub_8091738(SpeciesToNationalPokedexNum(gUnknown_Debug_2038A20->totalPoints), 2, 0x3fc); ((u16 *)(VRAM + 0xF858))[0] = 0xF3FC; ((u16 *)(VRAM + 0xF858))[1] = 0xF3FD; ((u16 *)(VRAM + 0xF858))[32] = 0xF3FE; ((u16 *)(VRAM + 0xF858))[33] = 0xF3FF; - debug_80C3800(gUnknown_Debug_2038A20->unk0, 17, 3); - debug_80C376C(gUnknown_Debug_2038A20->unk0, 26, 5); + debug_80C3800(gUnknown_Debug_2038A20->totalPoints, 17, 3); + debug_80C376C(gUnknown_Debug_2038A20->totalPoints, 26, 5); gUnknown_Debug_2038A20->unk6 = gSprites[gUnknown_Debug_2038A20->unk2].oam.paletteNum; CpuCopy16(gPlttBufferUnfaded + gUnknown_Debug_2038A20->unk6 * 16 + 0x100, gPlttBufferUnfaded + 0x80, 0x20); @@ -2704,7 +2704,7 @@ void debug_80C6CB8(u8 taskId) gUnknown_Debug_2038A20->unk9 = 0; StopCryAndClearCrySongs(); - PlayCry1(gUnknown_Debug_2038A20->unk0, 0); + PlayCry1(gUnknown_Debug_2038A20->totalPoints, 0); } void debug_80C6EE8(u8 taskId) @@ -2712,10 +2712,10 @@ void debug_80C6EE8(u8 taskId) u16 hue; CpuCopy16(gPlttBufferUnfaded + 0x80, gUnknown_Debug_2038A20->unk10, 32); hue = gPlttBufferUnfaded[gUnknown_Debug_2038A20->unk7 + 0x81]; - gUnknown_Debug_2038A20->unkC.r = hue & 0x1f; - gUnknown_Debug_2038A20->unkC.g = (hue & 0x3e0) >> 5; - gUnknown_Debug_2038A20->unkC.b = (hue & 0x7c00) >> 10; - gUnknown_Debug_2038A20->unkC.unused_15 = 0; + gUnknown_Debug_2038A20->contestant.r = hue & 0x1f; + gUnknown_Debug_2038A20->contestant.g = (hue & 0x3e0) >> 5; + gUnknown_Debug_2038A20->contestant.b = (hue & 0x7c00) >> 10; + gUnknown_Debug_2038A20->contestant.unused_15 = 0; debug_80C68CC(gUnknown_Debug_2038A20->unk7 + 1, 11, 10, 2); Menu_PrintText(gUnknown_Debug_083F8813, 13, 10); debug_80C68CC(hue, 14, 10, 4); @@ -2734,12 +2734,12 @@ void debug_80C6FA8(u8 taskId) } else if (gMain.newAndRepeatedKeys & R_BUTTON) { - gUnknown_Debug_2038A20->unk0 = debug_80C3878(0, gUnknown_Debug_2038A20->unk0); + gUnknown_Debug_2038A20->totalPoints = debug_80C3878(0, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C71FC; } else if (gMain.newAndRepeatedKeys & L_BUTTON) { - gUnknown_Debug_2038A20->unk0 = debug_80C3878(1, gUnknown_Debug_2038A20->unk0); + gUnknown_Debug_2038A20->totalPoints = debug_80C3878(1, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C71FC; } else if (gMain.newKeys & A_BUTTON) @@ -2767,9 +2767,9 @@ void debug_80C6FA8(u8 taskId) { gUnknown_Debug_2038A20->unk9 ^= 1; if (gUnknown_Debug_2038A20->unk9) - LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->unk0, 0, 0), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); + LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->totalPoints, 0, 0), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); else - LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->unk0, 0, 9), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); + LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->totalPoints, 0, 9), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); CpuCopy16(gPlttBufferUnfaded + gUnknown_Debug_2038A20->unk6 * 16 + 0x100, gPlttBufferUnfaded + 0x80, 32); CpuCopy16(gPlttBufferUnfaded + gUnknown_Debug_2038A20->unk6 * 16 + 0x100, gPlttBufferFaded + 0x80, 32); gTasks[taskId].func = debug_80C6EE8; @@ -2779,11 +2779,11 @@ void debug_80C6FA8(u8 taskId) if (gMain.newKeys & SELECT_BUTTON) { StopCryAndClearCrySongs(); - PlayCry1(gUnknown_Debug_2038A20->unk0, 0); + PlayCry1(gUnknown_Debug_2038A20->totalPoints, 0); } - gUnknown_Debug_2038A20->unk8 += 4; - gUnknown_Debug_2038A20->unk8 &= 0x1f; - ((u16 *)PLTT)[0xa1 + gUnknown_Debug_2038A20->unk7] = gUnknown_Debug_083F8790[gUnknown_Debug_2038A20->unk8]; + gUnknown_Debug_2038A20->random += 4; + gUnknown_Debug_2038A20->random &= 0x1f; + ((u16 *)PLTT)[0xa1 + gUnknown_Debug_2038A20->unk7] = gUnknown_Debug_083F8790[gUnknown_Debug_2038A20->random]; } } #else @@ -3092,7 +3092,7 @@ void debug_80C71FC(u8 taskId) DestroySprite(gSprites + gUnknown_Debug_2038A20->unk2); FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(gSprites[gUnknown_Debug_2038A20->unk3].oam.paletteNum)); DestroySprite(gSprites + gUnknown_Debug_2038A20->unk3); - sub_809D510(gSprites + gUnknown_Debug_2038A20->unk4); + sub_809D510(gSprites + gUnknown_Debug_2038A20->round1Points); gTasks[taskId].func = debug_80C6CB8; } @@ -3129,18 +3129,18 @@ void debug_80C7294(u8 taskId) switch (gUnknown_Debug_2038A20->unkA) { case 0: - if (gUnknown_Debug_2038A20->unkC.r < 31) - gUnknown_Debug_2038A20->unkC.r++; + if (gUnknown_Debug_2038A20->contestant.r < 31) + gUnknown_Debug_2038A20->contestant.r++; gTasks[taskId].func = debug_80C74E4; break; case 1: - if (gUnknown_Debug_2038A20->unkC.g < 31) - gUnknown_Debug_2038A20->unkC.g++; + if (gUnknown_Debug_2038A20->contestant.g < 31) + gUnknown_Debug_2038A20->contestant.g++; gTasks[taskId].func = debug_80C74E4; break; case 2: - if (gUnknown_Debug_2038A20->unkC.b < 31) - gUnknown_Debug_2038A20->unkC.b++; + if (gUnknown_Debug_2038A20->contestant.b < 31) + gUnknown_Debug_2038A20->contestant.b++; gTasks[taskId].func = debug_80C74E4; break; } @@ -3150,18 +3150,18 @@ void debug_80C7294(u8 taskId) switch (gUnknown_Debug_2038A20->unkA) { case 0: - if (gUnknown_Debug_2038A20->unkC.r > 0) - gUnknown_Debug_2038A20->unkC.r--; + if (gUnknown_Debug_2038A20->contestant.r > 0) + gUnknown_Debug_2038A20->contestant.r--; gTasks[taskId].func = debug_80C74E4; break; case 1: - if (gUnknown_Debug_2038A20->unkC.g > 0) - gUnknown_Debug_2038A20->unkC.g--; + if (gUnknown_Debug_2038A20->contestant.g > 0) + gUnknown_Debug_2038A20->contestant.g--; gTasks[taskId].func = debug_80C74E4; break; case 2: - if (gUnknown_Debug_2038A20->unkC.b > 0) - gUnknown_Debug_2038A20->unkC.b--; + if (gUnknown_Debug_2038A20->contestant.b > 0) + gUnknown_Debug_2038A20->contestant.b--; gTasks[taskId].func = debug_80C74E4; break; } @@ -3170,7 +3170,7 @@ void debug_80C7294(u8 taskId) void debug_80C74E4(u8 taskId) { - u16 pal = (gUnknown_Debug_2038A20->unkC.r & 0x001f) + ((gUnknown_Debug_2038A20->unkC.g << 5) & 0x03e0) + ((gUnknown_Debug_2038A20->unkC.b << 10) & 0x7c00); + u16 pal = (gUnknown_Debug_2038A20->contestant.r & 0x001f) + ((gUnknown_Debug_2038A20->contestant.g << 5) & 0x03e0) + ((gUnknown_Debug_2038A20->contestant.b << 10) & 0x7c00); gPlttBufferUnfaded[gUnknown_Debug_2038A20->unk7 + 0x81] = pal; gPlttBufferFaded[gUnknown_Debug_2038A20->unk7 + 0x81] = pal; gPlttBufferUnfaded[0x101 + gUnknown_Debug_2038A20->unk6 * 16 + gUnknown_Debug_2038A20->unk7] = pal; @@ -3190,13 +3190,13 @@ void debug_80C7584(struct Sprite *sprite) { default: case 0: - shade = gUnknown_Debug_2038A20->unkC.r; + shade = gUnknown_Debug_2038A20->contestant.r; break; case 1: - shade = gUnknown_Debug_2038A20->unkC.g; + shade = gUnknown_Debug_2038A20->contestant.g; break; case 2: - shade = gUnknown_Debug_2038A20->unkC.b; + shade = gUnknown_Debug_2038A20->contestant.b; break; } sprite->pos2.x = 4 * shade; @@ -3237,13 +3237,13 @@ void InitSeeTrainers(void) REG_DISPCNT = 0x3340; CreateTask(debug_80C777C, 0); gUnknown_Debug_2038A20 = &eWatanabe18000_2; - gUnknown_Debug_2038A20->unk0 = 0; + gUnknown_Debug_2038A20->totalPoints = 0; gUnknown_Debug_2038A20->unk2 = 0; gUnknown_Debug_2038A20->unk3 = 0; gUnknown_Debug_2038A20->unk5 = 0; gUnknown_Debug_2038A20->unk7 = 0; gUnknown_Debug_2038A20->unkA = 0; - gUnknown_Debug_2038A20->unk8 = 0; + gUnknown_Debug_2038A20->random = 0; spriteId = CreateSprite(&gSpriteTemplate_83F8874, 0x6c, 0x74, 0); gSprites[spriteId].data[0] = 0; StartSpriteAnim(gSprites + spriteId, 0); @@ -3297,14 +3297,14 @@ void debug_80C777C(u8 taskId) void debug_80C7934(u8 taskId) { - DecompressPicFromTable_2(gTrainerFrontPicTable + gUnknown_Debug_2038A20->unk0, gTrainerFrontPicCoords[gUnknown_Debug_2038A20->unk0].coords, gTrainerFrontPicCoords[gUnknown_Debug_2038A20->unk0].y_offset, gMonSpriteGfx_Sprite_ptr[0], gMonSpriteGfx_Sprite_ptr[1], gUnknown_Debug_2038A20->unk0); - LoadCompressedObjectPalette(gTrainerFrontPicPaletteTable + gUnknown_Debug_2038A20->unk0); - GetMonSpriteTemplate_803C5A0(gUnknown_Debug_2038A20->unk0, 1); + DecompressPicFromTable_2(gTrainerFrontPicTable + gUnknown_Debug_2038A20->totalPoints, gTrainerFrontPicCoords[gUnknown_Debug_2038A20->totalPoints].coords, gTrainerFrontPicCoords[gUnknown_Debug_2038A20->totalPoints].y_offset, gMonSpriteGfx_Sprite_ptr[0], gMonSpriteGfx_Sprite_ptr[1], gUnknown_Debug_2038A20->totalPoints); + LoadCompressedObjectPalette(gTrainerFrontPicPaletteTable + gUnknown_Debug_2038A20->totalPoints); + GetMonSpriteTemplate_803C5A0(gUnknown_Debug_2038A20->totalPoints, 1); gUnknown_Debug_2038A20->unk2 = CreateSprite(&gUnknown_02024E8C, 0x28, 0x28, 0); gSprites[gUnknown_Debug_2038A20->unk2].callback = debug_69; gSprites[gUnknown_Debug_2038A20->unk2].oam.priority = 0; - debug_80C376C(gUnknown_Debug_2038A20->unk0, 26, 5); + debug_80C376C(gUnknown_Debug_2038A20->totalPoints, 26, 5); gUnknown_Debug_2038A20->unk6 = gSprites[gUnknown_Debug_2038A20->unk2].oam.paletteNum; CpuCopy16(gPlttBufferUnfaded + gUnknown_Debug_2038A20->unk6 * 16 + 0x100, gPlttBufferUnfaded + 0x80, 0x20); @@ -3320,10 +3320,10 @@ void debug_80C7A54(u8 taskId) u16 hue; CpuCopy16(gPlttBufferUnfaded + 0x80, gUnknown_Debug_2038A20->unk10, 32); hue = gPlttBufferUnfaded[gUnknown_Debug_2038A20->unk7 + 0x81]; - gUnknown_Debug_2038A20->unkC.r = hue & 0x1f; - gUnknown_Debug_2038A20->unkC.g = (hue & 0x3e0) >> 5; - gUnknown_Debug_2038A20->unkC.b = (hue & 0x7c00) >> 10; - gUnknown_Debug_2038A20->unkC.unused_15 = 0; + gUnknown_Debug_2038A20->contestant.r = hue & 0x1f; + gUnknown_Debug_2038A20->contestant.g = (hue & 0x3e0) >> 5; + gUnknown_Debug_2038A20->contestant.b = (hue & 0x7c00) >> 10; + gUnknown_Debug_2038A20->contestant.unused_15 = 0; debug_80C68CC(gUnknown_Debug_2038A20->unk7 + 1, 11, 10, 2); Menu_PrintText(gUnknown_Debug_083F8813, 13, 10); debug_80C68CC(hue, 14, 10, 4); @@ -3342,12 +3342,12 @@ void debug_80C7B14(u8 taskId) } else if (gMain.newAndRepeatedKeys & R_BUTTON) { - gUnknown_Debug_2038A20->unk0 = debug_80C38B4(0, gUnknown_Debug_2038A20->unk0); + gUnknown_Debug_2038A20->totalPoints = debug_80C38B4(0, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C7D44; } else if (gMain.newAndRepeatedKeys & L_BUTTON) { - gUnknown_Debug_2038A20->unk0 = debug_80C38B4(1, gUnknown_Debug_2038A20->unk0); + gUnknown_Debug_2038A20->totalPoints = debug_80C38B4(1, gUnknown_Debug_2038A20->totalPoints); gTasks[taskId].func = debug_80C7D44; } else if (gMain.newKeys & A_BUTTON) @@ -3376,11 +3376,11 @@ void debug_80C7B14(u8 taskId) gUnknown_Debug_2038A20->unk9 ^= 1; if (gUnknown_Debug_2038A20->unk9) { - LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->unk0, 0, 0), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); + LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->totalPoints, 0, 0), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); } else { - LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->unk0, 0, 9), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); + LoadCompressedPalette(GetMonSpritePalFromOtIdPersonality(gUnknown_Debug_2038A20->totalPoints, 0, 9), gUnknown_Debug_2038A20->unk6 * 16 + 0x100, 0x20); } CpuCopy16(gPlttBufferUnfaded + gUnknown_Debug_2038A20->unk6 * 16 + 0x100, gPlttBufferUnfaded + 0x80, 32); CpuCopy16(gPlttBufferUnfaded + gUnknown_Debug_2038A20->unk6 * 16 + 0x100, gPlttBufferFaded + 0x80, 32); @@ -3388,9 +3388,9 @@ void debug_80C7B14(u8 taskId) } else { - gUnknown_Debug_2038A20->unk8 += 4; - gUnknown_Debug_2038A20->unk8 &= 0x1f; - ((u16 *)PLTT)[0xa1 + gUnknown_Debug_2038A20->unk7] = gUnknown_Debug_083F8790[gUnknown_Debug_2038A20->unk8]; + gUnknown_Debug_2038A20->random += 4; + gUnknown_Debug_2038A20->random &= 0x1f; + ((u16 *)PLTT)[0xa1 + gUnknown_Debug_2038A20->unk7] = gUnknown_Debug_083F8790[gUnknown_Debug_2038A20->random]; } } #else @@ -3683,7 +3683,7 @@ void debug_80C7D44(u8 taskId) DestroySprite(gSprites + gUnknown_Debug_2038A20->unk2); FreeSpritePaletteByTag(GetSpritePaletteTagByPaletteNum(gSprites[gUnknown_Debug_2038A20->unk3].oam.paletteNum)); DestroySprite(gSprites + gUnknown_Debug_2038A20->unk3); - sub_809D510(gSprites + gUnknown_Debug_2038A20->unk4); + sub_809D510(gSprites + gUnknown_Debug_2038A20->round1Points); gTasks[taskId].func = debug_80C7934; } @@ -3720,18 +3720,18 @@ void debug_80C7DDC(u8 taskId) switch (gUnknown_Debug_2038A20->unkA) { case 0: - if (gUnknown_Debug_2038A20->unkC.r < 31) - gUnknown_Debug_2038A20->unkC.r++; + if (gUnknown_Debug_2038A20->contestant.r < 31) + gUnknown_Debug_2038A20->contestant.r++; gTasks[taskId].func = debug_80C802C; break; case 1: - if (gUnknown_Debug_2038A20->unkC.g < 31) - gUnknown_Debug_2038A20->unkC.g++; + if (gUnknown_Debug_2038A20->contestant.g < 31) + gUnknown_Debug_2038A20->contestant.g++; gTasks[taskId].func = debug_80C802C; break; case 2: - if (gUnknown_Debug_2038A20->unkC.b < 31) - gUnknown_Debug_2038A20->unkC.b++; + if (gUnknown_Debug_2038A20->contestant.b < 31) + gUnknown_Debug_2038A20->contestant.b++; gTasks[taskId].func = debug_80C802C; break; } @@ -3741,18 +3741,18 @@ void debug_80C7DDC(u8 taskId) switch (gUnknown_Debug_2038A20->unkA) { case 0: - if (gUnknown_Debug_2038A20->unkC.r > 0) - gUnknown_Debug_2038A20->unkC.r--; + if (gUnknown_Debug_2038A20->contestant.r > 0) + gUnknown_Debug_2038A20->contestant.r--; gTasks[taskId].func = debug_80C802C; break; case 1: - if (gUnknown_Debug_2038A20->unkC.g > 0) - gUnknown_Debug_2038A20->unkC.g--; + if (gUnknown_Debug_2038A20->contestant.g > 0) + gUnknown_Debug_2038A20->contestant.g--; gTasks[taskId].func = debug_80C802C; break; case 2: - if (gUnknown_Debug_2038A20->unkC.b > 0) - gUnknown_Debug_2038A20->unkC.b--; + if (gUnknown_Debug_2038A20->contestant.b > 0) + gUnknown_Debug_2038A20->contestant.b--; gTasks[taskId].func = debug_80C802C; break; } @@ -3761,7 +3761,7 @@ void debug_80C7DDC(u8 taskId) void debug_80C802C(u8 taskId) { - u16 pal = (gUnknown_Debug_2038A20->unkC.r & 0x001f) + ((gUnknown_Debug_2038A20->unkC.g << 5) & 0x03e0) + ((gUnknown_Debug_2038A20->unkC.b << 10) & 0x7c00); + u16 pal = (gUnknown_Debug_2038A20->contestant.r & 0x001f) + ((gUnknown_Debug_2038A20->contestant.g << 5) & 0x03e0) + ((gUnknown_Debug_2038A20->contestant.b << 10) & 0x7c00); gPlttBufferUnfaded[gUnknown_Debug_2038A20->unk7 + 0x81] = pal; gPlttBufferFaded[gUnknown_Debug_2038A20->unk7 + 0x81] = pal; gPlttBufferUnfaded[0x101 + gUnknown_Debug_2038A20->unk6 * 16 + gUnknown_Debug_2038A20->unk7] = pal; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 7ea062083..a88fbca57 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -64,7 +64,7 @@ void sub_8023AD8(void); void nullsub_6(void); bool32 IsHMMove2(u16 move); -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern u8 gBattleTerrain; extern u8 gReservedSpritePaletteCount; extern u16 gMoveToLearn; @@ -204,7 +204,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, gBattle_BG3_X = 256; gBattle_BG3_Y = 0; - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6C58); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6C58); gBattleTerrain = BATTLE_TERRAIN_PLAIN; sub_800D6D4(); @@ -312,7 +312,7 @@ static void CB2_EvolutionSceneLoadGraphics(void) gBattle_BG3_X = 256; gBattle_BG3_Y = 0; - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6C58); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6C58); gBattleTerrain = BATTLE_TERRAIN_PLAIN; sub_800D6D4(); @@ -476,7 +476,7 @@ static void CB2_EvolutionSceneUpdate(void) { AnimateSprites(); BuildOamBuffer(); - Text_UpdateWindowInBattle(&gUnknown_03004210); + Text_UpdateWindowInBattle(&gWindowTemplate_Contest_MoveDescription); UpdatePaletteFade(); RunTasks(); } @@ -549,12 +549,12 @@ static void Task_EvolutionScene(u8 taskID) if (!gPaletteFade.active) { StringExpandPlaceholders(gStringVar4, BattleText_StartEvo); - Text_InitWindow8002EB0(&gUnknown_03004210, gStringVar4, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gStringVar4, 144, 2, 15); gTasks[taskID].tState++; } break; case 2: // wait for string, play cry - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) { PlayCry1(gTasks[taskID].tPreEvoSpecies, 0); gTasks[taskID].tState++; @@ -637,7 +637,7 @@ static void Task_EvolutionScene(u8 taskID) if (IsCryFinished() && !gPaletteFade.active) { StringExpandPlaceholders(gStringVar4, BattleText_FinishEvo); - Text_InitWindow8002EB0(&gUnknown_03004210, gStringVar4, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gStringVar4, 144, 2, 15); PlayBGM(MUS_EVOLVED); gTasks[taskID].tState++; SetMonData(mon, MON_DATA_SPECIES, (void*)(&gTasks[taskID].tPostEvoSpecies)); @@ -649,7 +649,7 @@ static void Task_EvolutionScene(u8 taskID) } break; case 14: // check if it wants to learn a new move - if (gUnknown_03004210.state == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0) { var = MonTryLearningNewMove(mon, gTasks[taskID].tLearnsFirstMove); if (var != 0 && !gTasks[taskID].tEvoWasStopped) @@ -706,59 +706,59 @@ static void Task_EvolutionScene(u8 taskID) if (IsCryFinished()) { StringExpandPlaceholders(gStringVar4, BattleText_StopEvo); - Text_InitWindow8002EB0(&gUnknown_03004210, gStringVar4, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gStringVar4, 144, 2, 15); gTasks[taskID].tEvoWasStopped = TRUE; gTasks[taskID].tState = 14; } break; case 19: // pokemon learned a new move, print string and play a fanfare - if (gUnknown_03004210.state == 0 && !IsSEPlaying()) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying()) { sub_8024CEC(); PlayFanfare(MUS_LEVEL_UP); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[3]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tLearnsFirstMove = 0x40; // re-used as a counter gTasks[taskID].tState++; } break; case 20: // wait a bit and check if can learn another move - if (gUnknown_03004210.state == 0 && !IsSEPlaying() && --gTasks[taskID].tLearnsFirstMove == 0) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying() && --gTasks[taskID].tLearnsFirstMove == 0) gTasks[taskID].tState = 14; break; case 21: // try to learn a new move switch (gTasks[taskID].tLearnMoveState) { case 0: - if (gUnknown_03004210.state == 0 && !IsSEPlaying()) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying()) { sub_8024CEC(); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[4]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tLearnMoveState++; } break; case 1: - if (gUnknown_03004210.state == 0 && !IsSEPlaying()) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[5]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tLearnMoveState++; } break; case 2: - if (gUnknown_03004210.state != 0) + if (gWindowTemplate_Contest_MoveDescription.state != 0) break; if (!IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[6]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tData9 = 5; gTasks[taskID].tdata10 = 9; gTasks[taskID].tLearnMoveState++; } case 3: - if (gUnknown_03004210.state == 0 && !IsSEPlaying()) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying()) { sub_8023A80(); gTasks[taskID].tLearnMoveState++; @@ -785,7 +785,7 @@ static void Task_EvolutionScene(u8 taskID) { sub_8023AD8(); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); PlaySE(SE_SELECT); if (sEvoCursorPos != 0) gTasks[taskID].tLearnMoveState = gTasks[taskID].tdata10; @@ -800,7 +800,7 @@ static void Task_EvolutionScene(u8 taskID) { sub_8023AD8(); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[292]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); PlaySE(SE_SELECT); gTasks[taskID].tLearnMoveState = gTasks[taskID].tdata10; } @@ -826,7 +826,7 @@ static void Task_EvolutionScene(u8 taskID) if (IsHMMove2(move)) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[307]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tLearnMoveState = 11; } else @@ -839,42 +839,42 @@ static void Task_EvolutionScene(u8 taskID) RemoveMonPPBonus(mon, var); SetMonMoveSlot(mon, gMoveToLearn, var); BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[207]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tLearnMoveState++; } } } break; case 7: - if (gUnknown_03004210.state == 0 && !IsSEPlaying()) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[7]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tLearnMoveState++; } break; case 8: - if (gUnknown_03004210.state == 0 && !IsSEPlaying()) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying()) { BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[208]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tState = 19; } break; case 9: BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[8]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tData9 = 10; gTasks[taskID].tdata10 = 0; gTasks[taskID].tLearnMoveState = 3; break; case 10: BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[9]); - Text_InitWindow8002EB0(&gUnknown_03004210, gDisplayedStringBattle, 144, 2, 15); + Text_InitWindow8002EB0(&gWindowTemplate_Contest_MoveDescription, gDisplayedStringBattle, 144, 2, 15); gTasks[taskID].tState = 14; break; case 11: - if (gUnknown_03004210.state == 0 && !IsSEPlaying()) + if (gWindowTemplate_Contest_MoveDescription.state == 0 && !IsSEPlaying()) gTasks[taskID].tLearnMoveState = 5; break; } @@ -1229,7 +1229,7 @@ void unref_sub_8113B50(u8 *a, u8 *b) for (sp8 = 0; sp8 < 64; sp8++) { sEvoInfo.unk84[sp8] = 0; - sEvoInfo.unk4[sp8] = 0; + sEvoInfo.round1Points[sp8] = 0; sEvoInfo.unk44[sp8] = 0; for (r6 = 0; r6 < 32; r6++) { @@ -1268,14 +1268,14 @@ void unref_sub_8113B50(u8 *a, u8 *b) case 0: if (*r2 & 0xF) { - sEvoInfo.unk10C4[sp8][sEvoInfo.unk4[sp8]] = r6; + sEvoInfo.unk10C4[sp8][sEvoInfo.round1Points[sp8]] = r6; r3 = 1; } break; case 1: if (*r2 & 0xF0) { - sEvoInfo.unk10C4[sp8][sEvoInfo.unk4[sp8]] = r6; + sEvoInfo.unk10C4[sp8][sEvoInfo.round1Points[sp8]] = r6; r3 = 1; } break; @@ -1287,16 +1287,16 @@ void unref_sub_8113B50(u8 *a, u8 *b) case 0: if (*r2 & 0xF) { - sEvoInfo.unk18C4[sp8][sEvoInfo.unk4[sp8]] = r6 - 1; - sEvoInfo.unk4[sp8]++; + sEvoInfo.unk18C4[sp8][sEvoInfo.round1Points[sp8]] = r6 - 1; + sEvoInfo.round1Points[sp8]++; r3 = 0; } break; case 1: if (*r2 & 0xF0) { - sEvoInfo.unk18C4[sp8][sEvoInfo.unk4[sp8]] = r6 - 1; - sEvoInfo.unk4[sp8]++; + sEvoInfo.unk18C4[sp8][sEvoInfo.round1Points[sp8]] = r6 - 1; + sEvoInfo.round1Points[sp8]++; r3 = 0; } break; @@ -1310,8 +1310,8 @@ void unref_sub_8113B50(u8 *a, u8 *b) } if (r3) { - sEvoInfo.unk18C4[sp8][sEvoInfo.unk4[sp8]] = r6; - sEvoInfo.unk4[sp8]++; + sEvoInfo.unk18C4[sp8][sEvoInfo.round1Points[sp8]] = r6; + sEvoInfo.round1Points[sp8]++; } //_08113D26 if (!((sp8 + 1) & 7)) @@ -1392,9 +1392,9 @@ void unref_sub_8113B50(u8 *a, u8 *b) for (sp8 = 0; sp8 < 0x40; sp8++) //_08113E3A { - if (sEvoInfo.unk4[sp8] < sEvoInfo.unk44[sp8]) + if (sEvoInfo.round1Points[sp8] < sEvoInfo.unk44[sp8]) { - for (spC = 0; spC < sEvoInfo.unk4[sp8]; spC++) + for (spC = 0; spC < sEvoInfo.round1Points[sp8]; spC++) { sp14 = 0x100; @@ -1431,19 +1431,19 @@ void unref_sub_8113B50(u8 *a, u8 *b) } } //_08113F9E - if (sEvoInfo.unk4[sp8] == sEvoInfo.unk44[sp8]) + if (sEvoInfo.round1Points[sp8] == sEvoInfo.unk44[sp8]) { - for (r6 = 0; r6 < sEvoInfo.unk4[sp8]; r6++) + for (r6 = 0; r6 < sEvoInfo.round1Points[sp8]; r6++) sub_81141F0(r6, r6, sp8); } //_08113FCC - if (sEvoInfo.unk4[sp8] > sEvoInfo.unk44[sp8]) + if (sEvoInfo.round1Points[sp8] > sEvoInfo.unk44[sp8]) { for (sp10 = 0; sp10 < sEvoInfo.unk44[sp8]; sp10++) { sp14 = 0x100; - for (r6 = 0; r6 < sEvoInfo.unk4[sp8]; r6++) + for (r6 = 0; r6 < sEvoInfo.round1Points[sp8]; r6++) { s32 r3; @@ -1472,7 +1472,7 @@ void unref_sub_8113B50(u8 *a, u8 *b) sEvoInfo.unkC4[sp8][spC] = 1; } //_08114104 - for (r6 = 0; r6 < sEvoInfo.unk4[sp8]; r6++) + for (r6 = 0; r6 < sEvoInfo.round1Points[sp8]; r6++) { sEvoInfo.unk20C4[sp8][r6] = sEvoInfo.unk30C4[sp8][r6]; sEvoInfo.unk28C4[sp8][r6] = sEvoInfo.unk38C4[sp8][r6]; diff --git a/src/party_menu.c b/src/party_menu.c index 8a3ce81d1..110453361 100644 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -480,7 +480,7 @@ extern u16 gMoveToLearn; extern u16 gUnknown_08E9A300[]; extern struct Coords8 const gUnknown_08376738[12][6]; extern u8 gUnknown_02039460[]; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern const u8 gPartyMenuMisc_Gfx[]; extern const u8 gPartyMenuMisc_Tilemap[]; @@ -678,8 +678,8 @@ bool8 InitPartyMenu(void) gMain.state++; break; case 8: - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6C90); - MultistepInitWindowTileData(&gUnknown_03004210, 1); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6C90); + MultistepInitWindowTileData(&gWindowTemplate_Contest_MoveDescription, 1); gMain.state++; break; case 9: @@ -2406,13 +2406,13 @@ void SwapValues_s16(s16 *a, s16 *b) #ifdef NONMATCHING void sub_806CF04(void) { - SwapValues_s16(&gSprites[ewram01000.unk3].pos1.x, &gSprites[ewram01000.unk4].pos1.x); - SwapValues_s16(&gSprites[ewram01000.unk3].pos1.y, &gSprites[ewram01000.unk4].pos1.y); - SwapValues_s16(&gSprites[ewram01000.unk3].pos2.x, &gSprites[ewram01000.unk4].pos2.x); - SwapValues_s16(&gSprites[ewram01000.unk3].data[0], &gSprites[ewram01000.unk4].data[0]); + SwapValues_s16(&gSprites[ewram01000.unk3].pos1.x, &gSprites[ewram01000.round1Points].pos1.x); + SwapValues_s16(&gSprites[ewram01000.unk3].pos1.y, &gSprites[ewram01000.round1Points].pos1.y); + SwapValues_s16(&gSprites[ewram01000.unk3].pos2.x, &gSprites[ewram01000.round1Points].pos2.x); + SwapValues_s16(&gSprites[ewram01000.unk3].data[0], &gSprites[ewram01000.round1Points].data[0]); gSprites[ewram01000.unk3].callback = SpriteCB_sub_806D37C; - gSprites[ewram01000.unk4].callback = SpriteCB_sub_806D37C; + gSprites[ewram01000.round1Points].callback = SpriteCB_sub_806D37C; } #else NAKED @@ -2710,7 +2710,7 @@ void sub_806D5B8(u8 monIndex) u8 right = gUnknown_08376948[IsDoubleBattle()][monIndex].right; u8 bottom = gUnknown_08376948[IsDoubleBattle()][monIndex].bottom; - Text_EraseWindowRect(&gUnknown_03004210, left, top, right, bottom); + Text_EraseWindowRect(&gWindowTemplate_Contest_MoveDescription, left, top, right, bottom); var1 = 0; CpuFastSet(&var1, OBJ_VRAM1 + monIndex * 0x400, 0x1000100); @@ -2724,7 +2724,7 @@ void sub_806D668(u8 monIndex) u8 right = gUnknown_08376978[IsDoubleBattle()][monIndex].right; u8 bottom = gUnknown_08376978[IsDoubleBattle()][monIndex].bottom; - Text_EraseWindowRect(&gUnknown_03004210, left, top, right, bottom); + Text_EraseWindowRect(&gWindowTemplate_Contest_MoveDescription, left, top, right, bottom); var1 = 0; CpuFastSet(&var1, OBJ_VRAM1 + 0x300 + monIndex * 0x400, 0x1000040); diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c index 9abea27a1..edfed2c9d 100644 --- a/src/pokedex_cry_screen.c +++ b/src/pokedex_cry_screen.c @@ -216,7 +216,7 @@ u8 sub_8119E3C(struct CryRelatedStruct *cry, u8 arg1) switch (gUnknown_03005E98) { case 0: - gPokedexCryScreenPtr->unk0014 = cry->unk0; + gPokedexCryScreenPtr->unk0014 = cry->totalPoints; gPokedexCryScreenPtr->unk0016 = cry->yPos; gPokedexCryScreenPtr->unk001A = 0; gPokedexCryScreenPtr->unk001B = 0; @@ -235,7 +235,7 @@ u8 sub_8119E3C(struct CryRelatedStruct *cry, u8 arg1) break; case 1: r7 = cry->unk2 << 11; - r6 = (cry->paletteNo << 12) + ((unsigned)(cry->unk0 << 18) >> 23); + r6 = (cry->paletteNo << 12) + ((unsigned)(cry->totalPoints << 18) >> 23); for (i = 0; i < 7; i++) { for (j = 0; j < 32; j++) diff --git a/src/region_map.c b/src/region_map.c index 8c4e694bc..44f81d586 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -1690,15 +1690,15 @@ void debug_sub_8110CCC(void) void debug_sub_8110D84(void) { - switch (sFlyDataPtr->unk4) + switch (sFlyDataPtr->round1Points) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); - sFlyDataPtr->unk4++; + sFlyDataPtr->round1Points++; break; case 1: if (!UpdatePaletteFade()) - sFlyDataPtr->unk4++; + sFlyDataPtr->round1Points++; break; case 2: switch (sub_80FAB60()) @@ -1719,7 +1719,7 @@ void debug_sub_8110D84(void) case 5: m4aSongNumStart(SE_SELECT); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0)); - sFlyDataPtr->unk4++; + sFlyDataPtr->round1Points++; break; } break; @@ -1736,14 +1736,14 @@ void debug_sub_8110D84(void) { sub_80FBCA0(); sub_80FAEC4(); - sFlyDataPtr->unk4++; + sFlyDataPtr->round1Points++; } break; case 5: if (sub_80FAFC0() == 0) { CreateRegionMapCursor(0, 0); - sFlyDataPtr->unk4++; + sFlyDataPtr->round1Points++; } break; case 6: @@ -1755,14 +1755,14 @@ void debug_sub_8110D84(void) { sub_80FBCA0(); sub_80FAEC4(); - sFlyDataPtr->unk4++; + sFlyDataPtr->round1Points++; } break; case 7: if (sub_80FAFC0() == 0) { CreateRegionMapCursor(0, 0); - sFlyDataPtr->unk4 = 3; + sFlyDataPtr->round1Points = 3; } break; } diff --git a/src/reshow_battle_screen.c b/src/reshow_battle_screen.c index e6a1081cc..072d24339 100644 --- a/src/reshow_battle_screen.c +++ b/src/reshow_battle_screen.c @@ -10,7 +10,7 @@ #include "ewram.h" extern struct SpriteTemplate gUnknown_02024E8C; -extern struct Window gUnknown_03004210; +extern struct Window gWindowTemplate_Contest_MoveDescription; extern u8 gReservedSpritePaletteCount; extern u8 gActionSelectionCursor[4]; extern u8 gBankInMenu; @@ -72,7 +72,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void) ScanlineEffect_Clear(); Text_LoadWindowTemplate(&gWindowTemplate_81E6C58); ResetPaletteFade(); - Text_InitWindowWithTemplate(&gUnknown_03004210, &gWindowTemplate_81E6C58); + Text_InitWindowWithTemplate(&gWindowTemplate_Contest_MoveDescription, &gWindowTemplate_81E6C58); gBattle_BG0_X = 0; gBattle_BG0_Y = 0; gBattle_BG1_X = 0; diff --git a/sym_common.txt b/sym_common.txt index 45414b67d..1952f24a6 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -97,7 +97,7 @@ SYMBOL(gBattle_BG3_Y, 4) SYMBOL(gBattleTextBuff1, 16) SYMBOL(gUnknown_030041D0, 48) SYMBOL(gBattle_WIN1H, 4) -SYMBOL(gUnknown_03004210, 48) +SYMBOL(gWindowTemplate_Contest_MoveDescription, 48) SYMBOL(gBattle_WIN0V, 4) SYMBOL(gBattle_WIN1V, 4) SYMBOL(gUnknown_03004250, 48)