Merge pull request #1415 from GriffinRichards/doc-contestutil

Some Contest clean up
This commit is contained in:
GriffinR 2021-04-27 02:29:41 -04:00 committed by GitHub
commit 18f85b5cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 439 additions and 378 deletions

View File

@ -918,10 +918,10 @@
.byte 0x76
.endm
@ Draws an image of the winner of the contest. In FireRed, this command is a nop. (The argument is discarded.)
.macro showcontestwinner a:req
@ Draws an image of the winner of the contest. winnerId is any CONTEST_WINNER_* constant.
.macro showcontestpainting winnerId:req
.byte 0x77
.byte \a
.byte \winnerId
.endm
@ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille

View File

@ -160,7 +160,7 @@ LilycoveCity_EventScript_MotelSign:: @ 81E2D11
LilycoveCity_EventScript_MuseumSign:: @ 81E2D1A
lockall
specialvar VAR_0x8004, CountPlayerContestPaintings
specialvar VAR_0x8004, CountPlayerMuseumPaintings
switch VAR_0x8004
case 0, LilycoveCity_EventScript_MuseumSignNoPaintings
msgbox LilycoveCity_Text_MuseumSignPlayersExhibit, MSGBOX_DEFAULT

View File

@ -49,7 +49,7 @@ LilycoveCity_ContestLobby_EventScript_ContestArtist:: @ 821A264
msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_ARTIST
showcontestpainting CONTEST_WINNER_ARTIST
lockall
msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO
compare VAR_RESULT, YES
@ -108,7 +108,7 @@ LilycoveCity_ContestLobby_EventScript_ReceivedArtistRibbon:: @ 821A314
return
LilycoveCity_ContestLobby_EventScript_UpdateMuseumPatrons:: @ 821A360
specialvar VAR_0x8004, CountPlayerContestPaintings
specialvar VAR_0x8004, CountPlayerMuseumPaintings
switch VAR_0x8004
case 1, LilycoveCity_ContestLobby_EventScript_ShowPatron1
case 2, LilycoveCity_ContestLobby_EventScript_ShowPatron2
@ -223,7 +223,7 @@ LilycoveCity_ContestLobby_EventScript_LinkContestArtist:: @ 821A436
msgbox LilycoveCity_ContestLobby_Text_YourPokemonSpurredMeToPaint, MSGBOX_DEFAULT
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_ARTIST
showcontestpainting CONTEST_WINNER_ARTIST
msgbox LilycoveCity_ContestLobby_Text_ShouldITakePaintingToMuseum, MSGBOX_YESNO
compare VAR_RESULT, YES
goto_if_eq LilycoveCity_ContestLobby_EventScript_TakePaintingToMuseumLink
@ -511,42 +511,42 @@ LilycoveCity_ContestLobby_EventScript_NinjaBoy:: @ 821A735
LilycoveCity_ContestLobby_EventScript_ContestWinner1:: @ 821A73E
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_HALL_1
showcontestpainting CONTEST_WINNER_HALL_1
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner2:: @ 821A745
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_HALL_2
showcontestpainting CONTEST_WINNER_HALL_2
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner3:: @ 821A74C
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_HALL_3
showcontestpainting CONTEST_WINNER_HALL_3
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner4:: @ 821A753
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_HALL_4
showcontestpainting CONTEST_WINNER_HALL_4
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner5:: @ 821A75A
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_HALL_5
showcontestpainting CONTEST_WINNER_HALL_5
releaseall
end
LilycoveCity_ContestLobby_EventScript_ContestWinner6:: @ 821A761
lockall
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_HALL_6
showcontestpainting CONTEST_WINNER_HALL_6
releaseall
end

View File

@ -94,7 +94,7 @@ LilycoveCity_LilycoveMuseum_2F_Movement_FaceExhibitHall: @ 8219863
LilycoveCity_LilycoveMuseum_2F_EventScript_Curator:: @ 8219866
lockall
goto_if_set FLAG_RECEIVED_GLASS_ORNAMENT, LilycoveCity_LilycoveMuseum_2F_EventScript_ReceivedGlassOrnament
specialvar VAR_0x8004, CountPlayerContestPaintings
specialvar VAR_0x8004, CountPlayerMuseumPaintings
switch VAR_0x8004
case 1, LilycoveCity_LilycoveMuseum_2F_EventScript_AddedPainting
case 2, LilycoveCity_LilycoveMuseum_2F_EventScript_AddedPainting
@ -185,35 +185,35 @@ LilycoveCity_LilycoveMuseum_2F_EventScript_RichBoy:: @ 821999C
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCoolPainting:: @ 82199A5
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_MUSEUM_COOL
showcontestpainting CONTEST_WINNER_MUSEUM_COOL
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowBeautyPainting:: @ 82199B3
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_MUSEUM_BEAUTY
showcontestpainting CONTEST_WINNER_MUSEUM_BEAUTY
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowCutePainting:: @ 82199C1
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_MUSEUM_CUTE
showcontestpainting CONTEST_WINNER_MUSEUM_CUTE
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowSmartPainting:: @ 82199CF
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_MUSEUM_SMART
showcontestpainting CONTEST_WINNER_MUSEUM_SMART
releaseall
end
LilycoveCity_LilycoveMuseum_2F_EventScript_ShowToughPainting:: @ 82199DD
msgbox LilycoveCity_LilycoveMuseum_2F_Text_ItsPaintingOfPokemon, MSGBOX_SIGN
fadescreen FADE_TO_BLACK
showcontestwinner CONTEST_WINNER_MUSEUM_TOUGH
showcontestpainting CONTEST_WINNER_MUSEUM_TOUGH
releaseall
end

View File

@ -119,7 +119,7 @@ gScriptCmdTable:: @ 81DB67C
.4byte ScrCmd_drawboxtext @ 0x74
.4byte ScrCmd_showmonpic @ 0x75
.4byte ScrCmd_hidemonpic @ 0x76
.4byte ScrCmd_showcontestwinner @ 0x77
.4byte ScrCmd_showcontestpainting @ 0x77
.4byte ScrCmd_braillemessage @ 0x78
.4byte ScrCmd_givemon @ 0x79
.4byte ScrCmd_giveegg @ 0x7a

View File

@ -89,14 +89,14 @@ gSpecials:: @ 81DBA64
def_special ResetTVShowState
def_special GetContestWinnerId
def_special GetContestPlayerId
def_special sub_80F8814
def_special GetNpcContestantLocalId
def_special BufferContestWinnerTrainerName
def_special BufferContestWinnerMonName
def_special BufferContestTrainerAndMonNames
def_special GetContestMonConditionRanking
def_special SetContestTrainerGfxIds
def_special TryEnterContestMon
def_special sub_80F8970
def_special GetContestantNamesAtRank
def_special SetLinkContestPlayerGfx
def_special GetContestMonCondition
def_special HasMonWonThisContestBefore
@ -147,9 +147,9 @@ gSpecials:: @ 81DBA64
def_special CountPartyAliveNonEggMons_IgnoreVar0x8004Slot
def_special ShouldReadyContestArtist
def_special SaveMuseumContestPainting
def_special DoesContestCategoryHaveWinner
def_special CountPlayerContestPaintings
def_special ShowContestWinnerPainting
def_special DoesContestCategoryHaveMuseumPainting
def_special CountPlayerMuseumPaintings
def_special ShowContestPainting @ Unused, redundant with showcontestpainting command
def_special MauvilleGymSetDefaultBarriers
def_special MauvilleGymPressSwitch
def_special ShowFieldMessageStringVar4

View File

@ -1,4 +1,4 @@
gContestPaintingCaption:: @ 827EA0C
gContestHallPaintingCaption:: @ 827EA0C
.string "{STR_VAR_1}\n"
.string "{STR_VAR_2}'s {STR_VAR_3}$"

View File

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 223 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 666 B

After

Width:  |  Height:  |  Size: 666 B

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -476,7 +476,7 @@ $(RAYQUAZAGFXDIR)/scene_4/streaks.4bpp: %.4bpp: %.png
$(RAYQUAZAGFXDIR)/scene_4/rayquaza.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 155
graphics/picture_frame/frame5.4bpp: %.4bpp: %.png
graphics/picture_frame/lobby.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 86
$(ROULETTEGFXDIR)/roulette_tilt.4bpp: $(ROULETTEGFXDIR)/shroomish.4bpp \

View File

@ -22,7 +22,9 @@
#define CONTEST_TYPE_NPC_MASTER (CONTEST_RANK_MASTER + 1)
#define CONTEST_TYPE_LINK (CONTEST_RANK_LINK + 1)
#define CONTEST_WINNER_ARTIST 0 // Winner shown by the artist, painting not necessarily saved
// IDs below - 1 are indexes into gSaveBlock1Ptr->contestWinners[]
// CONTEST_WINNER_ARTIST is for the winner of the most recent contest, and is not saved.
#define CONTEST_WINNER_ARTIST 0
#define CONTEST_WINNER_HALL_1 1
#define CONTEST_WINNER_HALL_2 2
#define CONTEST_WINNER_HALL_3 3
@ -30,8 +32,8 @@
#define CONTEST_WINNER_HALL_5 5
#define CONTEST_WINNER_HALL_6 6
#define NUM_CONTEST_HALL_WINNERS 6
#define CONTEST_WINNER_7 7
#define CONTEST_WINNER_8 8
#define CONTEST_WINNER_HALL_UNUSED_1 7 // These two have data for gDefaultContestWinners
#define CONTEST_WINNER_HALL_UNUSED_2 8 // but there are only 6 paintings in the Contest Hall
#define CONTEST_WINNER_MUSEUM_COOL 9
#define CONTEST_WINNER_MUSEUM_BEAUTY 10
#define CONTEST_WINNER_MUSEUM_CUTE 11
@ -39,6 +41,14 @@
#define CONTEST_WINNER_MUSEUM_TOUGH 13
// NUM_CONTEST_WINNERS in constants/global.h
#define MUSEUM_CONTEST_WINNERS_START (CONTEST_WINNER_MUSEUM_COOL - 1)
#define CONTEST_SAVE_FOR_MUSEUM ((u8)-1)
#define CONTEST_SAVE_FOR_ARTIST ((u8)-2)
// The number of possible captions for a Contest painting, per category
#define NUM_PAINTING_CAPTIONS 3
#define CANT_ENTER_CONTEST 0
#define CAN_ENTER_CONTEST_EQUAL_RANK 1
#define CAN_ENTER_CONTEST_HIGH_RANK 2

View File

@ -111,11 +111,11 @@ struct ContestPokemon
u32 otId;
};
struct Shared1A004
struct ContestTempSave
{
u16 cachedWindowPalettes[16][16]; // Saved palette data before a move happens?
u16 unk18204[PLTT_BUFFER_SIZE]; // Saved copy of gPlttBufferUnfaded
u16 unk18604[PLTT_BUFFER_SIZE]; // Saved copy of gPlttBufferFaded
u16 cachedPlttBufferUnfaded[PLTT_BUFFER_SIZE];
u16 cachedPlttBufferFaded[PLTT_BUFFER_SIZE];
u8 savedJunk[0x800];
};
@ -306,7 +306,7 @@ struct ContestResources
#define eUnzippedContestAudience_Gfx (gHeap + 0x18000)
#define eContestAudienceFrame2_Gfx (gHeap + 0x19000)
#define eContestDebugMode (gHeap[0x1a000])
#define eUnknownHeap1A004 (*(struct Shared1A004 *)(gHeap + 0x1a004))
#define eContestTempSave (*(struct ContestTempSave *)(gHeap + 0x1a004))
extern struct ContestPokemon gContestMons[CONTESTANT_COUNT];
extern s16 gContestMonRound1Points[CONTESTANT_COUNT];
@ -326,8 +326,8 @@ extern u8 gHighestRibbonRank;
extern struct ContestResources *gContestResources;
extern u8 sContestBgCopyFlags;
extern struct ContestWinner gCurContestWinner;
extern u8 gUnknown_02039F5C;
extern u8 gUnknown_02039F5D;
extern u8 gCurContestWinnerIsForArtist;
extern u8 gCurContestWinnerSaveIdx;
extern u32 gContestRngValue;
// contest.c
@ -351,8 +351,8 @@ s8 Contest_GetMoveExcitement(u16 move);
bool8 IsContestantAllowedToCombo(u8 contestant);
void Contest_PrintTextToBg0WindowAt(u32 windowId, u8 *currChar, s32 x, s32 y, s32 fontId);
void ResetContestLinkResults(void);
bool8 sub_80DEDA8(u8 a);
u8 sub_80DEFA8(u8 a, u8 b);
bool8 SaveContestWinner(u8 rank);
u8 GetContestWinnerSaveIdx(u8 rank, bool8 shift);
void ClearContestWinnerPicsInContestHall(void);
void StripPlayerAndMonNamesForLinkContest(struct ContestPokemon *mon, s32 language);

View File

@ -7,8 +7,8 @@ void StartContest(void);
void BufferContestantMonSpecies(void);
void ShowContestResults(void);
void ContestLinkTransfer(u8);
void ShowContestWinnerPainting(void);
void ShowContestPainting(void);
u16 GetContestRand(void);
u8 CountPlayerContestPaintings(void);
u8 CountPlayerMuseumPaintings(void);
#endif // GUARD_CONTEST_UTIL_H

View File

@ -4924,21 +4924,21 @@ extern const u32 gRouletteMultiplier_Gfx[];
// Contest util
extern const u32 gContestResults_Gfx[];
extern const u32 gUnknown_08C19EEC[];
extern const u32 gUnknown_08C1A000[];
extern const u32 gUnknown_08C1A12C[];
extern const u32 gContestResults_WinnerBanner_Tilemap[];
extern const u32 gContestResults_Interface_Tilemap[];
extern const u32 gContestResults_Bg_Tilemap[];
extern const u32 gContestResults_Pal[];
extern const u16 gLinkContestResults_Tilemap[];
extern const u16 gNormalContestResults_Tilemap[];
extern const u16 gSuperContestResults_Tilemap[];
extern const u16 gHyperContestResults_Tilemap[];
extern const u16 gMasterContestResults_Tilemap[];
extern const u16 gCoolContestResults_Tilemap[];
extern const u16 gBeautyContestResults_Tilemap[];
extern const u16 gCuteContestResults_Tilemap[];
extern const u16 gSmartContestResults_Tilemap[];
extern const u16 gToughContestResults_Tilemap[];
extern const u16 gContestResults_Tilemap[];
extern const u16 gContestResultsTitle_Link_Tilemap[];
extern const u16 gContestResultsTitle_Normal_Tilemap[];
extern const u16 gContestResultsTitle_Super_Tilemap[];
extern const u16 gContestResultsTitle_Hyper_Tilemap[];
extern const u16 gContestResultsTitle_Master_Tilemap[];
extern const u16 gContestResultsTitle_Cool_Tilemap[];
extern const u16 gContestResultsTitle_Beauty_Tilemap[];
extern const u16 gContestResultsTitle_Cute_Tilemap[];
extern const u16 gContestResultsTitle_Smart_Tilemap[];
extern const u16 gContestResultsTitle_Tough_Tilemap[];
extern const u16 gContestResultsTitle_Tilemap[];
// Trainer Card.
extern const u16 gHoennTrainerCard0Star_Pal[];

View File

@ -17,7 +17,7 @@ void CopyMonCategoryText(int dexNum, u8 *dest);
u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth);
void PadNameString(u8 *dest, u8 padChar);
void ConvertInternationalPlayerNameStripChar(u8 *, u8);
void sub_81DB5AC(u8 *);
void ConvertInternationalContestantName(u8 *);
int sub_81DB604(u8 *);
void sub_81DB620(int windowId, int columnStart, int rowStart, int numFillTiles, int numRows);

View File

@ -350,8 +350,8 @@ EWRAM_DATA u8 gHighestRibbonRank = 0;
EWRAM_DATA struct ContestResources *gContestResources = NULL;
EWRAM_DATA u8 sContestBgCopyFlags = 0;
EWRAM_DATA struct ContestWinner gCurContestWinner = {0};
EWRAM_DATA bool8 gUnknown_02039F5C = 0;
EWRAM_DATA u8 gUnknown_02039F5D = 0;
EWRAM_DATA bool8 gCurContestWinnerIsForArtist = 0;
EWRAM_DATA u8 gCurContestWinnerSaveIdx = 0;
// IWRAM common vars.
u32 gContestRngValue;
@ -1034,7 +1034,7 @@ void LoadContestBgAfterMoveAnim(void)
{
u32 contestantWindowId = 5 + i;
LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId], 16 * (5 + gContestantTurnOrder[i]), sizeof((eUnknownHeap1A004.cachedWindowPalettes[contestantWindowId])));
LoadPalette(eContestTempSave.cachedWindowPalettes[contestantWindowId], 16 * (5 + gContestantTurnOrder[i]), sizeof((eContestTempSave.cachedWindowPalettes[contestantWindowId])));
}
}
@ -1320,7 +1320,7 @@ static bool8 SetupContestGraphics(u8 *stateVar)
CopyToBgTilemapBuffer(2, gUnknown_08C17170, 0, 0);
CopyBgTilemapBufferToVram(2);
// This is a bug, and copies random junk. savedJunk is never read.
DmaCopy32Defvars(3, gContestResources->contestBgTilemaps[2], eUnknownHeap1A004.savedJunk, sizeof(eUnknownHeap1A004.savedJunk));
DmaCopy32Defvars(3, gContestResources->contestBgTilemaps[2], eContestTempSave.savedJunk, sizeof(eContestTempSave.savedJunk));
break;
case 5:
LoadCompressedPalette(gOldContestPalette, 0, 0x200);
@ -1328,7 +1328,7 @@ static bool8 SetupContestGraphics(u8 *stateVar)
CpuCopy32(gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, tempPalette2, 16 * sizeof(u16));
CpuCopy32(tempPalette2, gPlttBufferUnfaded + 128, 16 * sizeof(u16));
CpuCopy32(tempPalette1, gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, 16 * sizeof(u16));
DmaCopy32Defvars(3, gPlttBufferUnfaded, eUnknownHeap1A004.cachedWindowPalettes, sizeof(eUnknownHeap1A004.cachedWindowPalettes));
DmaCopy32Defvars(3, gPlttBufferUnfaded, eContestTempSave.cachedWindowPalettes, sizeof(eContestTempSave.cachedWindowPalettes));
LoadContestPalettes();
break;
case 6:
@ -1468,7 +1468,7 @@ static void Task_DisplayAppealNumberText(u8 taskId)
gBattle_BG0_Y = 0;
gBattle_BG2_Y = 0;
ContestDebugDoPrint();
DmaCopy32Defvars(3, gPlttBufferUnfaded, eUnknownHeap1A004.unk18204, PLTT_BUFFER_SIZE * 2);
DmaCopy32Defvars(3, gPlttBufferUnfaded, eContestTempSave.cachedPlttBufferUnfaded, PLTT_BUFFER_SIZE * 2);
ConvertIntToDecimalStringN(gStringVar1, eContest.appealNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
StringCopy(gDisplayedStringBattle, gText_AppealNumWhichMoveWillBePlayed);
@ -1667,8 +1667,8 @@ static void Task_HideMoveSelectScreen(u8 taskId)
}
Contest_SetBgCopyFlags(0);
// This seems to be a bug; it should have just copied PLTT_BUFFER_SIZE.
DmaCopy32Defvars(3, gPlttBufferFaded, eUnknownHeap1A004.unk18604, PLTT_BUFFER_SIZE * 2);
LoadPalette(eUnknownHeap1A004.unk18204, 0, PLTT_BUFFER_SIZE * 2);
DmaCopy32Defvars(3, gPlttBufferFaded, eContestTempSave.cachedPlttBufferFaded, PLTT_BUFFER_SIZE * 2);
LoadPalette(eContestTempSave.cachedPlttBufferUnfaded, 0, PLTT_BUFFER_SIZE * 2);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].func = Task_HideApplauseMeterForAppealStart;
@ -2554,7 +2554,7 @@ static void Task_WaitForHeartSliders(u8 taskId)
static void sub_80DA348(u8 taskId)
{
DmaCopy32Defvars(3, eUnknownHeap1A004.unk18204, gPlttBufferUnfaded, PLTT_BUFFER_SIZE * 2);
DmaCopy32Defvars(3, eContestTempSave.cachedPlttBufferUnfaded, gPlttBufferUnfaded, PLTT_BUFFER_SIZE * 2);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 2;
gTasks[taskId].func = Task_WaitPrintRoundResult;
@ -4412,7 +4412,7 @@ static void DrawContestantWindows(void)
for (i = 0; i < CONTESTANT_COUNT; i++)
{
s32 windowId = i + 5;
LoadPalette(eUnknownHeap1A004.cachedWindowPalettes[windowId], (gContestantTurnOrder[i] + 5) * 16, sizeof(eUnknownHeap1A004.cachedWindowPalettes[0]));
LoadPalette(eContestTempSave.cachedWindowPalettes[windowId], (gContestantTurnOrder[i] + 5) * 16, sizeof(eContestTempSave.cachedWindowPalettes[0]));
}
DrawContestantWindowText();
}
@ -5516,40 +5516,46 @@ void ResetContestLinkResults(void)
gSaveBlock2Ptr->contestLinkResults[i][j] = 0;
}
bool8 sub_80DEDA8(u8 rank)
bool8 SaveContestWinner(u8 rank)
{
s32 i;
u8 r7 = Random() % 3;
u8 captionId = Random() % NUM_PAINTING_CAPTIONS;
// Get the index of the winner among the contestants
for (i = 0; i < CONTESTANT_COUNT - 1; i++)
{
if (gContestFinalStandings[i] == 0)
break;
}
if (rank == 0xFF && i != gContestPlayerMonIndex)
// Exit if attempting to save a Pokémon other than the player's to the museum
if (rank == CONTEST_SAVE_FOR_MUSEUM && i != gContestPlayerMonIndex)
return FALSE;
// Adjust the random painting caption depending on the category
switch (gSpecialVar_ContestCategory)
{
case CONTEST_CATEGORY_COOL:
r7 += 0;
captionId += NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_COOL;
break;
case CONTEST_CATEGORY_BEAUTY:
r7 += 3;
captionId += NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_BEAUTY;
break;
case CONTEST_CATEGORY_CUTE:
r7 += 6;
captionId += NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_CUTE;
break;
case CONTEST_CATEGORY_SMART:
r7 += 9;
captionId += NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_SMART;
break;
case CONTEST_CATEGORY_TOUGH:
r7 += 12;
captionId += NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_TOUGH;
break;
}
if (rank != 0xFE)
{
u8 id = sub_80DEFA8(rank, 1);
if (rank != CONTEST_SAVE_FOR_ARTIST)
{
// Save winner in the saveblock
// Used to save any winner for the Contest Hall or the Museum
// but excludes the temporary save used by the artist
u8 id = GetContestWinnerSaveIdx(rank, TRUE);
gSaveBlock1Ptr->contestWinners[id].personality = gContestMons[i].personality;
gSaveBlock1Ptr->contestWinners[id].species = gContestMons[i].species;
gSaveBlock1Ptr->contestWinners[id].trainerId = gContestMons[i].otId;
@ -5560,24 +5566,29 @@ bool8 sub_80DEDA8(u8 rank)
else
gSaveBlock1Ptr->contestWinners[id].contestRank = gSpecialVar_ContestRank;
if (rank != 0xFF)
if (rank != CONTEST_SAVE_FOR_MUSEUM)
gSaveBlock1Ptr->contestWinners[id].contestCategory = gSpecialVar_ContestCategory;
else
gSaveBlock1Ptr->contestWinners[id].contestCategory = r7;
gSaveBlock1Ptr->contestWinners[id].contestCategory = captionId;
}
else
{
// Set the most recent winner so the artist can show the player their painting
gCurContestWinner.personality = gContestMons[i].personality;
gCurContestWinner.trainerId = gContestMons[i].otId;
gCurContestWinner.species = gContestMons[i].species;
StringCopy(gCurContestWinner.monName, gContestMons[i].nickname);
StringCopy(gCurContestWinner.trainerName, gContestMons[i].trainerName);
gCurContestWinner.contestCategory = r7;
gCurContestWinner.contestCategory = captionId;
}
return TRUE;
}
u8 sub_80DEFA8(u8 rank, u8 b)
// Rank is either a regular contest rank (for saving winners to show in the Contest Hall)
// Or one of two special IDs listed below (for saving winners to show in Museum, or from the artist)
// If just retrieving the index where the winner *would* go, shift is FALSE
// If actually preparing to insert the winner into the saveblock, shift is TRUE
u8 GetContestWinnerSaveIdx(u8 rank, bool8 shift)
{
s32 i;
@ -5587,13 +5598,15 @@ u8 sub_80DEFA8(u8 rank, u8 b)
case CONTEST_RANK_SUPER:
case CONTEST_RANK_HYPER:
case CONTEST_RANK_MASTER:
if (b != 0)
if (shift)
{
for (i = NUM_CONTEST_HALL_WINNERS - 1; i >= 1; i--)
for (i = NUM_CONTEST_HALL_WINNERS - 1; i > 0; i--)
memcpy(&gSaveBlock1Ptr->contestWinners[i], &gSaveBlock1Ptr->contestWinners[i - 1], sizeof(struct ContestWinner));
}
return 0;
return CONTEST_WINNER_HALL_1 - 1;
default:
// case CONTEST_SAVE_FOR_MUSEUM:
// case CONTEST_SAVE_FOR_ARTIST:
switch (gSpecialVar_ContestCategory)
{
case CONTEST_CATEGORY_COOL:
@ -5615,7 +5628,7 @@ void ClearContestWinnerPicsInContestHall(void)
{
s32 i;
for (i = 0; i < 8; i++)
for (i = 0; i < MUSEUM_CONTEST_WINNERS_START; i++)
gSaveBlock1Ptr->contestWinners[i] = gDefaultContestWinners[i];
}

View File

@ -21,18 +21,16 @@
#include "window.h"
#include "constants/rgb.h"
// IWRAM common
u16 (*gContestMonPixels)[][32];
struct ImageProcessingContext gImageProcessingContext;
struct ContestWinner *gContestPaintingWinner;
u16 *gContestPaintingMonPalette;
// IWRAM bss
static u8 gContestPaintingState;
static u16 gContestPaintingMosaicVal;
static u16 gContestPaintingFadeCounter;
static bool8 gUnknown_030011F6;
static u8 gContestPaintingWindowId;
static u8 sHoldState;
static u16 sMosaicVal;
static u16 sFadeCounter;
static bool8 sVarsInitialized;
static u8 sWindowId;
static void ShowContestPainting(void);
static void HoldContestPainting(void);
@ -44,7 +42,7 @@ static void PrintContestPaintingCaption(u8, u8);
static void VBlankCB_ContestPainting(void);
static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)[64][64]);
extern const u8 gContestPaintingCaption[];
extern const u8 gContestHallPaintingCaption[];
extern const u8 gContestCoolness[];
extern const u8 gContestBeauty[];
extern const u8 gContestCuteness[];
@ -71,39 +69,39 @@ extern const u8 gContestPaintingTough1[];
extern const u8 gContestPaintingTough2[];
extern const u8 gContestPaintingTough3[];
const u16 gPictureFramePalettes[] = INCBIN_U16("graphics/picture_frame/bg.gbapal");
const u8 gPictureFrameTiles_0[] = INCBIN_U8("graphics/picture_frame/frame0.4bpp.rl");
const u8 gPictureFrameTiles_1[] = INCBIN_U8("graphics/picture_frame/frame1.4bpp.rl");
const u8 gPictureFrameTiles_2[] = INCBIN_U8("graphics/picture_frame/frame2.4bpp.rl");
const u8 gPictureFrameTiles_3[] = INCBIN_U8("graphics/picture_frame/frame3.4bpp.rl");
const u8 gPictureFrameTiles_4[] = INCBIN_U8("graphics/picture_frame/frame4.4bpp.rl");
const u8 gPictureFrameTiles_5[] = INCBIN_U8("graphics/picture_frame/frame5.4bpp.rl");
const u8 gPictureFrameTilemap_0[] = INCBIN_U8("graphics/picture_frame/frame0_map.bin.rl");
const u8 gPictureFrameTilemap_1[] = INCBIN_U8("graphics/picture_frame/frame1_map.bin.rl");
const u8 gPictureFrameTilemap_2[] = INCBIN_U8("graphics/picture_frame/frame2_map.bin.rl");
const u8 gPictureFrameTilemap_3[] = INCBIN_U8("graphics/picture_frame/frame3_map.bin.rl");
const u8 gPictureFrameTilemap_4[] = INCBIN_U8("graphics/picture_frame/frame4_map.bin.rl");
const u8 gPictureFrameTilemap_5[] = INCBIN_U8("graphics/picture_frame/frame5_map.bin.rl");
static const u16 sPictureFramePalettes[] = INCBIN_U16("graphics/picture_frame/bg.gbapal");
static const u8 sPictureFrameTiles_Cool[] = INCBIN_U8("graphics/picture_frame/cool.4bpp.rl");
static const u8 sPictureFrameTiles_Beauty[] = INCBIN_U8("graphics/picture_frame/beauty.4bpp.rl");
static const u8 sPictureFrameTiles_Cute[] = INCBIN_U8("graphics/picture_frame/cute.4bpp.rl");
static const u8 sPictureFrameTiles_Smart[] = INCBIN_U8("graphics/picture_frame/smart.4bpp.rl");
static const u8 sPictureFrameTiles_Tough[] = INCBIN_U8("graphics/picture_frame/tough.4bpp.rl");
static const u8 sPictureFrameTiles_HallLobby[] = INCBIN_U8("graphics/picture_frame/lobby.4bpp.rl");
static const u8 sPictureFrameTilemap_Cool[] = INCBIN_U8("graphics/picture_frame/cool_map.bin.rl");
static const u8 sPictureFrameTilemap_Beauty[] = INCBIN_U8("graphics/picture_frame/beauty_map.bin.rl");
static const u8 sPictureFrameTilemap_Cute[] = INCBIN_U8("graphics/picture_frame/cute_map.bin.rl");
static const u8 sPictureFrameTilemap_Smart[] = INCBIN_U8("graphics/picture_frame/smart_map.bin.rl");
static const u8 sPictureFrameTilemap_Tough[] = INCBIN_U8("graphics/picture_frame/tough_map.bin.rl");
static const u8 sPictureFrameTilemap_HallLobby[] = INCBIN_U8("graphics/picture_frame/lobby_map.bin.rl");
static const u8 *const sContestCategoryNames_Unused[] =
{
gContestCoolness,
gContestBeauty,
gContestCuteness,
gContestSmartness,
gContestToughness,
[CONTEST_CATEGORY_COOL] = gContestCoolness,
[CONTEST_CATEGORY_BEAUTY] = gContestBeauty,
[CONTEST_CATEGORY_CUTE] = gContestCuteness,
[CONTEST_CATEGORY_SMART] = gContestSmartness,
[CONTEST_CATEGORY_TOUGH] = gContestToughness,
};
static const u8 *const sContestRankNames[] =
{
gContestRankNormal,
gContestRankSuper,
gContestRankHyper,
gContestRankMaster,
gContestLink,
[CONTEST_RANK_NORMAL] = gContestRankNormal,
[CONTEST_RANK_SUPER] = gContestRankSuper,
[CONTEST_RANK_HYPER] = gContestRankHyper,
[CONTEST_RANK_MASTER] = gContestRankMaster,
[CONTEST_RANK_LINK] = gContestLink,
};
static const struct BgTemplate sContestPaintingBgTemplates[] =
static const struct BgTemplate sBgTemplates[] =
{
{
.bg = 1,
@ -116,7 +114,7 @@ static const struct BgTemplate sContestPaintingBgTemplates[] =
},
};
static const struct WindowTemplate sContestPaintingWindowTemplate =
static const struct WindowTemplate sWindowTemplate =
{
.bg = 1,
.tilemapLeft = 2,
@ -127,23 +125,23 @@ static const struct WindowTemplate sContestPaintingWindowTemplate =
.baseBlock = 1,
};
static const u8 *const sContestPaintingDescriptionPointers[] =
static const u8 *const sMuseumCaptions[NUM_PAINTING_CAPTIONS * CONTEST_CATEGORIES_COUNT] =
{
gContestPaintingCool1,
gContestPaintingCool2,
gContestPaintingCool3,
gContestPaintingBeauty1,
gContestPaintingBeauty2,
gContestPaintingBeauty3,
gContestPaintingCute1,
gContestPaintingCute2,
gContestPaintingCute3,
gContestPaintingSmart1,
gContestPaintingSmart2,
gContestPaintingSmart3,
gContestPaintingTough1,
gContestPaintingTough2,
gContestPaintingTough3,
[0 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_COOL] = gContestPaintingCool1,
[1 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_COOL] = gContestPaintingCool2,
[2 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_COOL] = gContestPaintingCool3,
[0 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_BEAUTY] = gContestPaintingBeauty1,
[1 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_BEAUTY] = gContestPaintingBeauty2,
[2 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_BEAUTY] = gContestPaintingBeauty3,
[0 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_CUTE] = gContestPaintingCute1,
[1 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_CUTE] = gContestPaintingCute2,
[2 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_CUTE] = gContestPaintingCute3,
[0 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_SMART] = gContestPaintingSmart1,
[1 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_SMART] = gContestPaintingSmart2,
[2 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_SMART] = gContestPaintingSmart3,
[0 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_TOUGH] = gContestPaintingTough1,
[1 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_TOUGH] = gContestPaintingTough2,
[2 + NUM_PAINTING_CAPTIONS * CONTEST_CATEGORY_TOUGH] = gContestPaintingTough3,
};
static const struct OamData sContestPaintingMonOamData =
@ -161,15 +159,15 @@ static const struct OamData sContestPaintingMonOamData =
.paletteNum = 0,
};
const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)};
static const u16 sBgPalette[] = {RGB_BLACK, RGB_BLACK};
void SetContestWinnerForPainting(int contestWinnerId)
{
u8 *ptr1 = &gUnknown_02039F5D;
u8 *ptr2 = &gUnknown_02039F5C;
u8 *saveIdx = &gCurContestWinnerSaveIdx;
u8 *isForArtist = &gCurContestWinnerIsForArtist;
gCurContestWinner = gSaveBlock1Ptr->contestWinners[contestWinnerId - 1];
*ptr1 = contestWinnerId - 1;
*ptr2 = FALSE;
*saveIdx = contestWinnerId - 1;
*isForArtist = FALSE;
}
void CB2_ContestPainting(void)
@ -189,7 +187,7 @@ static void CB2_QuitContestPainting(void)
SetMainCallback2(gMain.savedCallback);
FREE_AND_SET_NULL(gContestPaintingMonPalette);
FREE_AND_SET_NULL(gContestMonPixels);
RemoveWindow(gContestPaintingWindowId);
RemoveWindow(sWindowId);
Free(GetBgTilemapBuffer(1));
FreeMonSpritesGfx();
}
@ -203,13 +201,13 @@ static void ShowContestPainting(void)
SetVBlankCallback(NULL);
AllocateMonSpritesGfx();
gContestPaintingWinner = &gCurContestWinner;
InitContestPaintingVars(1);
InitContestPaintingVars(TRUE);
InitContestPaintingBg();
gMain.state++;
break;
case 1:
ResetPaletteFade();
DmaFillLarge32(3, 0, (void *)BG_VRAM, 0x18000, 0x1000);
DmaFillLarge32(3, 0, (void *)VRAM, VRAM_SIZE, 0x1000);
ResetSpriteData();
gMain.state++;
break;
@ -220,16 +218,16 @@ static void ShowContestPainting(void)
gMain.state++;
break;
case 3:
CreateContestPaintingPicture(gUnknown_02039F5D, gUnknown_02039F5C);
CreateContestPaintingPicture(gCurContestWinnerSaveIdx, gCurContestWinnerIsForArtist);
gMain.state++;
break;
case 4:
PrintContestPaintingCaption(gUnknown_02039F5D, gUnknown_02039F5C);
LoadPalette(gUnknown_085B0838, 0, 1 * 2);
PrintContestPaintingCaption(gCurContestWinnerSaveIdx, gCurContestWinnerIsForArtist);
LoadPalette(sBgPalette, 0, 1 * 2);
DmaClear32(3, PLTT, PLTT_SIZE);
BeginFastPaletteFade(2);
SetVBlankCallback(VBlankCB_ContestPainting);
gContestPaintingState = 0;
sHoldState = 0;
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON);
SetMainCallback2(CB2_HoldContestPainting);
break;
@ -238,29 +236,29 @@ static void ShowContestPainting(void)
static void HoldContestPainting(void)
{
switch (gContestPaintingState)
switch (sHoldState)
{
case 0:
if (!gPaletteFade.active)
gContestPaintingState = 1;
if (gUnknown_030011F6 && gContestPaintingFadeCounter)
gContestPaintingFadeCounter--;
sHoldState = 1;
if (sVarsInitialized && sFadeCounter)
sFadeCounter--;
break;
case 1:
if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
{
gContestPaintingState++;
sHoldState++;
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB(0, 0, 0));
}
if (gUnknown_030011F6)
gContestPaintingFadeCounter = 0;
if (sVarsInitialized)
sFadeCounter = 0;
break;
case 2:
if (!gPaletteFade.active)
SetMainCallback2(CB2_QuitContestPainting);
if (gUnknown_030011F6 && gContestPaintingFadeCounter < 30)
gContestPaintingFadeCounter++;
if (sVarsInitialized && sFadeCounter < 30)
sFadeCounter++;
break;
}
}
@ -268,45 +266,48 @@ static void HoldContestPainting(void)
static void InitContestPaintingWindow(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sContestPaintingBgTemplates, ARRAY_COUNT(sContestPaintingBgTemplates));
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
gContestPaintingWindowId = AddWindow(&sContestPaintingWindowTemplate);
sWindowId = AddWindow(&sWindowTemplate);
DeactivateAllTextPrinters();
FillWindowPixelBuffer(gContestPaintingWindowId, PIXEL_FILL(0));
PutWindowTilemap(gContestPaintingWindowId);
CopyWindowToVram(gContestPaintingWindowId, 3);
FillWindowPixelBuffer(sWindowId, PIXEL_FILL(0));
PutWindowTilemap(sWindowId);
CopyWindowToVram(sWindowId, 3);
ShowBg(1);
}
static void PrintContestPaintingCaption(u8 contestType, bool8 arg1)
static void PrintContestPaintingCaption(u8 contestType, bool8 isForArtist)
{
int x;
u8 category;
if (arg1 == TRUE)
// Artist's painting has no caption
if (isForArtist == TRUE)
return;
category = gContestPaintingWinner->contestCategory;
if (contestType < 8)
if (contestType < MUSEUM_CONTEST_WINNERS_START)
{
// Contest Hall caption
BufferContestName(gStringVar1, category);
StringAppend(gStringVar1, gText_Space);
StringAppend(gStringVar1, sContestRankNames[gContestPaintingWinner->contestRank]);
StringCopy(gStringVar2, gContestPaintingWinner->trainerName);
sub_81DB5AC(gStringVar2);
ConvertInternationalContestantName(gStringVar2);
StringCopy(gStringVar3, gContestPaintingWinner->monName);
StringExpandPlaceholders(gStringVar4, gContestPaintingCaption);
StringExpandPlaceholders(gStringVar4, gContestHallPaintingCaption);
}
else
{
// Museum caption
StringCopy(gStringVar1, gContestPaintingWinner->monName);
StringExpandPlaceholders(gStringVar4, sContestPaintingDescriptionPointers[category]);
StringExpandPlaceholders(gStringVar4, sMuseumCaptions[category]);
}
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
AddTextPrinterParameterized(gContestPaintingWindowId, 1, gStringVar4, x, 1, 0, 0);
AddTextPrinterParameterized(sWindowId, 1, gStringVar4, x, 1, 0, 0);
CopyBgTilemapBufferToVram(1);
}
@ -321,33 +322,34 @@ static void InitContestPaintingBg(void)
SetGpuReg(REG_OFFSET_BLDY, 0);
}
static void InitContestPaintingVars(bool8 arg0)
static void InitContestPaintingVars(bool8 reset)
{
if (arg0 == FALSE)
if (reset == FALSE)
{
gUnknown_030011F6 = FALSE;
gContestPaintingMosaicVal = 0;
gContestPaintingFadeCounter = 0;
// Never reached
sVarsInitialized = FALSE;
sMosaicVal = 0;
sFadeCounter = 0;
}
else
{
gUnknown_030011F6 = TRUE;
gContestPaintingMosaicVal = 15;
gContestPaintingFadeCounter = 30;
sVarsInitialized = TRUE;
sMosaicVal = 15;
sFadeCounter = 30;
}
}
static void UpdateContestPaintingMosaicEffect(void)
{
if (!gUnknown_030011F6)
if (!sVarsInitialized)
{
SetGpuReg(REG_OFFSET_MOSAIC, 0);
}
else
{
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(10) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256);
gContestPaintingMosaicVal = gContestPaintingFadeCounter / 2;
SetGpuReg(REG_OFFSET_MOSAIC, (gContestPaintingMosaicVal << 12) | (gContestPaintingMosaicVal << 8) | (gContestPaintingMosaicVal << 4) | (gContestPaintingMosaicVal << 0));
sMosaicVal = sFadeCounter / 2;
SetGpuReg(REG_OFFSET_MOSAIC, (sMosaicVal << 12) | (sMosaicVal << 8) | (sMosaicVal << 4) | (sMosaicVal << 0));
}
}
@ -414,34 +416,35 @@ static void _InitContestMonPixels(u8 *spriteGfx, u16 *palette, u16 (*destPixels)
#define VRAM_PICTURE_DATA(x, y) (((u16 *)(BG_SCREEN_ADDR(12)))[(y) * 32 + (x)])
static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1)
static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 isForArtist)
{
u8 x, y;
LoadPalette(gPictureFramePalettes, 0, 0x100);
if (arg1 == TRUE)
LoadPalette(sPictureFramePalettes, 0, 0x100);
if (isForArtist == TRUE)
{
switch (gContestPaintingWinner->contestCategory / 3)
// Load Artist's frame
switch (gContestPaintingWinner->contestCategory / NUM_PAINTING_CAPTIONS)
{
case CONTEST_CATEGORY_COOL:
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_0, gContestMonPixels);
RLUnCompVram(sPictureFrameTiles_Cool, (void *)VRAM);
RLUnCompWram(sPictureFrameTilemap_Cool, gContestMonPixels);
break;
case CONTEST_CATEGORY_BEAUTY:
RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_1, gContestMonPixels);
RLUnCompVram(sPictureFrameTiles_Beauty, (void *)VRAM);
RLUnCompWram(sPictureFrameTilemap_Beauty, gContestMonPixels);
break;
case CONTEST_CATEGORY_CUTE:
RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_2, gContestMonPixels);
RLUnCompVram(sPictureFrameTiles_Cute, (void *)VRAM);
RLUnCompWram(sPictureFrameTilemap_Cute, gContestMonPixels);
break;
case CONTEST_CATEGORY_SMART:
RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_3, gContestMonPixels);
RLUnCompVram(sPictureFrameTiles_Smart, (void *)VRAM);
RLUnCompWram(sPictureFrameTilemap_Smart, gContestMonPixels);
break;
case CONTEST_CATEGORY_TOUGH:
RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_4, gContestMonPixels);
RLUnCompVram(sPictureFrameTiles_Tough, (void *)VRAM);
RLUnCompWram(sPictureFrameTilemap_Tough, gContestMonPixels);
break;
}
@ -463,34 +466,36 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 arg1)
for (x = 0; x < 16; x++)
VRAM_PICTURE_DATA(x + 7, 2) = (*gContestMonPixels)[2][7];
}
else if (contestWinnerId < 8)
else if (contestWinnerId < MUSEUM_CONTEST_WINNERS_START)
{
RLUnCompVram(gPictureFrameTiles_5, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_5, (void *)(BG_SCREEN_ADDR(12)));
// Load Contest Hall lobby frame
RLUnCompVram(sPictureFrameTiles_HallLobby, (void *)VRAM);
RLUnCompVram(sPictureFrameTilemap_HallLobby, (void *)(BG_SCREEN_ADDR(12)));
}
else
{
switch (gContestPaintingWinner->contestCategory / 3)
// Load Museum frame
switch (gContestPaintingWinner->contestCategory / NUM_PAINTING_CAPTIONS)
{
case CONTEST_CATEGORY_COOL:
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_0, (void *)(BG_SCREEN_ADDR(12)));
RLUnCompVram(sPictureFrameTiles_Cool, (void *)VRAM);
RLUnCompVram(sPictureFrameTilemap_Cool, (void *)(BG_SCREEN_ADDR(12)));
break;
case CONTEST_CATEGORY_BEAUTY:
RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_1, (void *)(BG_SCREEN_ADDR(12)));
RLUnCompVram(sPictureFrameTiles_Beauty, (void *)VRAM);
RLUnCompVram(sPictureFrameTilemap_Beauty, (void *)(BG_SCREEN_ADDR(12)));
break;
case CONTEST_CATEGORY_CUTE:
RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_2, (void *)(BG_SCREEN_ADDR(12)));
RLUnCompVram(sPictureFrameTiles_Cute, (void *)VRAM);
RLUnCompVram(sPictureFrameTilemap_Cute, (void *)(BG_SCREEN_ADDR(12)));
break;
case CONTEST_CATEGORY_SMART:
RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_3, (void *)(BG_SCREEN_ADDR(12)));
RLUnCompVram(sPictureFrameTiles_Smart, (void *)VRAM);
RLUnCompVram(sPictureFrameTilemap_Smart, (void *)(BG_SCREEN_ADDR(12)));
break;
case CONTEST_CATEGORY_TOUGH:
RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_4, (void *)(BG_SCREEN_ADDR(12)));
RLUnCompVram(sPictureFrameTiles_Tough, (void *)VRAM);
RLUnCompVram(sPictureFrameTilemap_Tough, (void *)(BG_SCREEN_ADDR(12)));
break;
}
}
@ -519,10 +524,10 @@ static u8 GetImageEffectForContestWinner(u8 contestWinnerId)
{
u8 contestCategory;
if (contestWinnerId < 8)
if (contestWinnerId < MUSEUM_CONTEST_WINNERS_START)
contestCategory = gContestPaintingWinner->contestCategory;
else
contestCategory = gContestPaintingWinner->contestCategory / 3;
contestCategory = gContestPaintingWinner->contestCategory / NUM_PAINTING_CAPTIONS;
switch (contestCategory)
{
@ -584,12 +589,12 @@ static void DoContestPaintingImageProcessing(u8 imageEffect)
LoadPalette(gContestPaintingMonPalette, 0x100, 0x200);
}
static void CreateContestPaintingPicture(u8 contestWinnerId, bool8 arg1)
static void CreateContestPaintingPicture(u8 contestWinnerId, bool8 isForArtist)
{
AllocPaintingResources();
InitContestMonPixels(gContestPaintingWinner->species, 0);
DoContestPaintingImageProcessing(GetImageEffectForContestWinner(contestWinnerId));
InitPaintingMonOamData(contestWinnerId);
LoadContestPaintingFrame(contestWinnerId, arg1);
LoadContestPaintingFrame(contestWinnerId, isForArtist);
}

View File

@ -61,10 +61,29 @@ enum {
#define GET_CONTEST_WINNER_ID(i) { for ((i) = 0; (i) < CONTESTANT_COUNT && gContestFinalStandings[(i)] != 0; (i)++); }
// Gfx/pal tags for the text window sprites on the contest results screen.
// Both types of text windows are made up of 4 individual sprites
// These tags are used by the spritesheets, and implicitly in the loop in CreateResultsTextWindowSprites
#define TAG_TEXT_WINDOW_BASE 3009
enum {
TAG_RESULTS_TEXT_WINDOW_LEFT = TAG_TEXT_WINDOW_BASE,
TAG_RESULTS_TEXT_WINDOW_MIDLEFT,
TAG_RESULTS_TEXT_WINDOW_MIDRIGHT,
TAG_RESULTS_TEXT_WINDOW_RIGHT,
TAG_LINK_TEXT_WINDOW_LEFT,
TAG_LINK_TEXT_WINDOW_MIDLEFT,
TAG_LINK_TEXT_WINDOW_MIDRIGHT,
TAG_LINK_TEXT_WINDOW_RIGHT, // 3016
};
#define TAG_CONFETTI 3017
#define TAG_WIRELESS_INDICATOR_WINDOW 22222
#define MAX_BAR_LENGTH 87
// Starting x/y for the sliding results screen text box
#define TEXT_BOX_X (DISPLAY_WIDTH + 32)
#define TEXT_BOX_Y (DISPLAY_HEIGHT - 16)
struct ContestResultsInternal
{
u8 slidingTextBoxSpriteId;
@ -105,14 +124,14 @@ struct ContestResults
static EWRAM_DATA struct ContestResults *sContestResults = NULL;
static void LoadAllContestMonIconPalettes(void);
static void LoadContestResultsTilemaps(void);
static void LoadContestResultsTitleBarTilemaps(void);
static u8 GetNumPreliminaryPoints(u8, bool8);
static s8 GetNumRound2Points(u8, bool8);
static void AddContestTextPrinter(int, u8 *, int);
static void AllocContestResults(void);
static void FreeContestResults(void);
static void LoadAllContestMonIcons(u8, u8);
static void LoadContestResultSprites(void);
static void CreateResultsTextWindowSprites(void);
static void TryCreateWirelessSprites(void);
static void Task_StartShowContestResults(u8 taskId);
static void CB2_StartShowContestResults(void);
@ -166,11 +185,11 @@ static void SpriteCB_Confetti(struct Sprite *sprite);
static void Task_ShowContestEntryMonPic(u8 taskId);
static void Task_LinkContestWaitForConnection(u8 taskId);
static const u16 sUnknown_0858D6B0[] = INCBIN_U16("graphics/unknown/unknown_58D6B0.gbapal");
static const u8 sUnknown_0858D6D0[] = INCBIN_U8("graphics/unknown/unknown_58D6D0.4bpp");
static const u16 sResultsTextWindow_Pal[] = INCBIN_U16("graphics/contest/results_screen/text_window.gbapal");
static const u8 sResultsTextWindow_Gfx[] = INCBIN_U8("graphics/contest/results_screen/text_window.4bpp");
static const u16 sMiscBlank_Pal[] = INCBIN_U16("graphics/interface/blank.gbapal");
static const struct OamData sOamData_858D7F0 =
static const struct OamData sOamData_ResultsTextWindow =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -187,33 +206,33 @@ static const struct OamData sOamData_858D7F0 =
.affineParam = 0,
};
static const struct SpriteTemplate sSpriteTemplate_858D7F8 =
static const struct SpriteTemplate sSpriteTemplate_ResultsTextWindow =
{
.tileTag = 3009,
.paletteTag = 3009,
.oam = &sOamData_858D7F0,
.tileTag = TAG_TEXT_WINDOW_BASE,
.paletteTag = TAG_TEXT_WINDOW_BASE,
.oam = &sOamData_ResultsTextWindow,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct SpriteSheet sUnknown_0858D810[] =
static const struct SpriteSheet sSpriteSheets_ResultsTextWindow[] =
{
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3009 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3010 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3011 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3012 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3013 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3014 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3015 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = 3016 },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_RESULTS_TEXT_WINDOW_LEFT },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_RESULTS_TEXT_WINDOW_MIDLEFT },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_RESULTS_TEXT_WINDOW_MIDRIGHT },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_RESULTS_TEXT_WINDOW_RIGHT },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_LINK_TEXT_WINDOW_LEFT },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_LINK_TEXT_WINDOW_MIDLEFT },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_LINK_TEXT_WINDOW_MIDRIGHT },
{ .data = gMiscBlank_Gfx, .size = 0x400, .tag = TAG_LINK_TEXT_WINDOW_RIGHT },
};
static const struct SpritePalette sUnknown_0858D850 =
static const struct SpritePalette sSpritePalette_ResultsTextWindow =
{
.data = sMiscBlank_Pal,
.tag = 3009,
.tag = TAG_TEXT_WINDOW_BASE,
};
static const struct OamData sOamData_Confetti =
@ -339,7 +358,7 @@ static const struct WindowTemplate sWindowTemplates[] =
DUMMY_WIN_TEMPLATE,
};
static const struct OamData sUnknown_0858D8C0 =
static const struct OamData sOamData_WirelessIndicatorWindow =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -357,22 +376,22 @@ static const struct OamData sUnknown_0858D8C0 =
};
static const struct SpriteTemplate sSpriteTemplate_858D8C8 =
static const struct SpriteTemplate sSpriteTemplate_WirelessIndicatorWindow =
{
.tileTag = 22222,
.tileTag = TAG_WIRELESS_INDICATOR_WINDOW,
.paletteTag = 0,
.oam = &sUnknown_0858D8C0,
.oam = &sOamData_WirelessIndicatorWindow,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct SpriteSheet sUnknown_0858D8E0 =
static const struct SpriteSheet sSpriteSheet_WirelessIndicatorWindow =
{
.data = gMiscBlank_Gfx,
.size = 0x200,
.tag = 22222
.tag = TAG_WIRELESS_INDICATOR_WINDOW
};
static const u8 sContestLinkTextColors[4] = {TEXT_COLOR_WHITE, TEXT_DYNAMIC_COLOR_6, TEXT_DYNAMIC_COLOR_5};
@ -430,12 +449,12 @@ static void LoadContestResultsBgGfx(void)
u16 tile1, tile2;
LZDecompressVram(gContestResults_Gfx, (void *)BG_CHAR_ADDR(0));
CopyToBgTilemapBuffer(3, gUnknown_08C1A12C, 0, 0);
CopyToBgTilemapBuffer(2, gUnknown_08C1A000, 0, 0);
CopyToBgTilemapBuffer(0, gUnknown_08C19EEC, 0, 0);
LoadContestResultsTilemaps();
CopyToBgTilemapBuffer(3, gContestResults_Bg_Tilemap, 0, 0);
CopyToBgTilemapBuffer(2, gContestResults_Interface_Tilemap, 0, 0);
CopyToBgTilemapBuffer(0, gContestResults_WinnerBanner_Tilemap, 0, 0);
LoadContestResultsTitleBarTilemaps();
LoadCompressedPalette(gContestResults_Pal, 0, 0x200);
LoadPalette(sUnknown_0858D6B0, 0xF0, 0x20);
LoadPalette(sResultsTextWindow_Pal, 0xF0, sizeof(sResultsTextWindow_Pal));
for (i = 0; i < CONTESTANT_COUNT; i++)
{
@ -515,14 +534,14 @@ static void CB2_StartShowContestResults(void)
LoadAllContestMonNames();
memset(sContestResults->data, 0, sizeof(*sContestResults->data));
memset(sContestResults->monResults, 0, sizeof(*sContestResults->monResults));
LoadContestResultSprites();
CreateResultsTextWindowSprites();
TryCreateWirelessSprites();
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
gPaletteFade.bufferTransferDisabled = FALSE;
sContestResults->data->showResultsTaskId = CreateTask(Task_ShowContestResults, 5);
SetMainCallback2(CB2_ShowContestResults);
gBattle_WIN1H = WIN_RANGE(0, DISPLAY_WIDTH);
gBattle_WIN1V = WIN_RANGE(128, DISPLAY_HEIGHT);
gBattle_WIN1V = WIN_RANGE(DISPLAY_HEIGHT - 32, DISPLAY_HEIGHT);
CreateTask(Task_SlideContestResultsBg, 20);
CalculateContestantsResultData();
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS)
@ -587,10 +606,10 @@ static void Task_ShowContestResults(u8 taskId)
}
TryGainNewFanFromCounter(FANCOUNTER_FINISHED_CONTEST);
sub_80DEDA8(gSpecialVar_ContestRank);
sub_80DEDA8(0xFE);
gUnknown_02039F5C = TRUE;
gUnknown_02039F5D = sub_80DEFA8(0xFE, 0);
SaveContestWinner(gSpecialVar_ContestRank); // Save for lobby painting
SaveContestWinner(CONTEST_SAVE_FOR_ARTIST);
gCurContestWinnerIsForArtist = TRUE;
gCurContestWinnerSaveIdx = GetContestWinnerSaveIdx(CONTEST_SAVE_FOR_ARTIST, FALSE);
var = VarGet(VAR_CONTEST_HALL_STATE);
VarSet(VAR_CONTEST_HALL_STATE, 0);
SetContinueGameWarpStatusToDynamicWarp();
@ -637,10 +656,10 @@ static void Task_ShowContestResults(u8 taskId)
if (gContestFinalStandings[gContestPlayerMonIndex] == 0)
IncrementGameStat(GAME_STAT_WON_CONTEST);
sub_80DEDA8(gSpecialVar_ContestRank);
sub_80DEDA8(0xFE);
gUnknown_02039F5C = TRUE;
gUnknown_02039F5D = sub_80DEFA8(0xFE, 0);
SaveContestWinner(gSpecialVar_ContestRank); // Save for lobby painting
SaveContestWinner(CONTEST_SAVE_FOR_ARTIST);
gCurContestWinnerIsForArtist = TRUE;
gCurContestWinnerSaveIdx = GetContestWinnerSaveIdx(CONTEST_SAVE_FOR_ARTIST, FALSE);
TryGainNewFanFromCounter(FANCOUNTER_FINISHED_CONTEST);
gTasks[taskId].func = Task_AnnouncePreliminaryResults;
}
@ -679,7 +698,7 @@ static void Task_AnnouncePreliminaryResults(u8 taskId)
{
CreateTask(Task_FlashStarsAndHearts, 20);
x = DrawResultsTextWindow(gText_AnnouncingResults, sContestResults->data->slidingTextBoxSpriteId);
StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, 120, 1088);
StartTextBoxSlideIn(x, TEXT_BOX_Y, 120, 1088);
gTasks[taskId].tState++;
}
else if (gTasks[taskId].tState == 1)
@ -702,7 +721,7 @@ static void Task_AnnouncePreliminaryResults(u8 taskId)
else if (gTasks[taskId].tState == 3)
{
x = DrawResultsTextWindow(gText_PreliminaryResults, sContestResults->data->slidingTextBoxSpriteId);
StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, -1, 1088);
StartTextBoxSlideIn(x, TEXT_BOX_Y, -1, 1088);
gTasks[taskId].tState++;
}
else if (gTasks[taskId].tState == 4)
@ -752,7 +771,7 @@ static void Task_AnnounceRound2Results(u8 taskId)
{
gTasks[taskId].tTimer = 0;
x = DrawResultsTextWindow(gText_Round2Results, sContestResults->data->slidingTextBoxSpriteId);
StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, -1, 1088);
StartTextBoxSlideIn(x, TEXT_BOX_Y, -1, 1088);
}
}
else if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_ARRIVED)
@ -837,11 +856,11 @@ static void Task_AnnounceWinner(u8 taskId)
gTasks[taskId].tTimer = 0;
GET_CONTEST_WINNER_ID(i);
StringCopy(gStringVar1, gContestMons[i].trainerName);
sub_81DB5AC(gStringVar1);
ConvertInternationalContestantName(gStringVar1);
StringCopy(gStringVar2, gContestMons[i].nickname);
StringExpandPlaceholders(winnerTextBuffer, gText_ContestantsMonWon);
x = DrawResultsTextWindow(winnerTextBuffer, sContestResults->data->slidingTextBoxSpriteId);
StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, -1, 1088);
StartTextBoxSlideIn(x, TEXT_BOX_Y, -1, 1088);
gTasks[taskId].tState++;
}
break;
@ -892,7 +911,7 @@ static void Task_ShowWinnerMonBanner(u8 taskId)
LoadCompressedSpritePalette(pokePal);
SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_OPPONENT_LEFT);
gMultiuseSpriteTemplate.paletteTag = pokePal->tag;
spriteId = CreateSprite(&gMultiuseSpriteTemplate, DISPLAY_WIDTH + 32, 80, 10);
spriteId = CreateSprite(&gMultiuseSpriteTemplate, DISPLAY_WIDTH + 32, DISPLAY_HEIGHT / 2, 10);
gSprites[spriteId].data[1] = species;
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].callback = SpriteCB_WinnerMonSlideIn;
@ -1136,9 +1155,9 @@ static void TryCreateWirelessSprites(void)
LoadWirelessStatusIndicatorSpriteGfx();
CreateWirelessStatusIndicatorSprite(8, 8);
gSprites[gWirelessStatusIndicatorSpriteId].subpriority = 1;
sheet = LoadSpriteSheet(&sUnknown_0858D8E0);
sheet = LoadSpriteSheet(&sSpriteSheet_WirelessIndicatorWindow);
RequestDma3Fill(0xFFFFFFFF, (void *)BG_CHAR_ADDR(4) + sheet * 0x20, 0x80, 1);
spriteId = CreateSprite(&sSpriteTemplate_858D8C8, 8, 8, 0);
spriteId = CreateSprite(&sSpriteTemplate_WirelessIndicatorWindow, 8, 8, 0);
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_WINDOW;
}
}
@ -1150,14 +1169,13 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
int strWidth;
u8 *spriteTilePtrs[4];
u8 *dst;
{
struct WindowTemplate windowTemplate;
memset(&windowTemplate, 0, sizeof(windowTemplate));
windowTemplate.width = 30;
windowTemplate.height = 2;
windowId = AddWindow(&windowTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
}
origWidth = GetStringWidth(1, text, 0);
strWidth = (origWidth + 9) / 8;
@ -1169,16 +1187,16 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
s32 i;
struct Sprite *sprite;
const u8 *src, *windowTilesPtr;
windowTilesPtr = (u8 *)(GetWindowAttribute(windowId, WINDOW_TILE_DATA));
src = (u8 *)(sUnknown_0858D6D0);
windowTilesPtr = (u8 *)GetWindowAttribute(windowId, WINDOW_TILE_DATA);
src = (u8 *)sResultsTextWindow_Gfx;
sprite = &gSprites[spriteId];
spriteTilePtrs[0] = (u8 *)(sprite->oam.tileNum * 32 + OBJ_VRAM0);
for (i = 1; i < 4; i++)
for (i = 1; i < (int)ARRAY_COUNT(spriteTilePtrs); i++)
spriteTilePtrs[i] = (void*)(gSprites[sprite->data[i - 1]].oam.tileNum * 32 + OBJ_VRAM0);
for (i = 0; i < 4; i++)
for (i = 0; i < (int)ARRAY_COUNT(spriteTilePtrs); i++)
CpuFill32(0, spriteTilePtrs[i], 0x400);
dst = spriteTilePtrs[0];
@ -1208,27 +1226,31 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
return (DISPLAY_WIDTH - (strWidth + 2) * 8) / 2;
}
static void LoadContestResultSprites(void)
static void CreateResultsTextWindowSprites(void)
{
int i;
struct SpriteTemplate template;
u8 spriteIds[ARRAY_COUNT(sUnknown_0858D810)];
u8 spriteIds[ARRAY_COUNT(sSpriteSheets_ResultsTextWindow)];
template = sSpriteTemplate_858D7F8;
for (i = 0; i < (int)ARRAY_COUNT(sUnknown_0858D810); i++)
LoadSpriteSheet(&sUnknown_0858D810[i]);
template = sSpriteTemplate_ResultsTextWindow;
for (i = 0; i < (int)ARRAY_COUNT(sSpriteSheets_ResultsTextWindow); i++)
LoadSpriteSheet(&sSpriteSheets_ResultsTextWindow[i]);
LoadSpritePalette(&sUnknown_0858D850);
for (i = 0; i < (int)ARRAY_COUNT(sUnknown_0858D810); i++)
LoadSpritePalette(&sSpritePalette_ResultsTextWindow);
// Create sprites for the two window types, each made up of 4 sprites
for (i = 0; i < (int)ARRAY_COUNT(sSpriteSheets_ResultsTextWindow); i++)
{
spriteIds[i] = CreateSprite(&template, DISPLAY_WIDTH + 32, DISPLAY_HEIGHT - 16, 10);
spriteIds[i] = CreateSprite(&template, TEXT_BOX_X, TEXT_BOX_Y, 10);
template.tileTag++;
}
// Save sprite ids of the sliding text box onto its leftmost sprite
gSprites[spriteIds[0]].data[0] = spriteIds[1];
gSprites[spriteIds[0]].data[1] = spriteIds[2];
gSprites[spriteIds[0]].data[2] = spriteIds[3];
// Save sprite ids of the link text box onto its leftmost sprite
gSprites[spriteIds[4]].data[0] = spriteIds[5];
gSprites[spriteIds[4]].data[1] = spriteIds[6];
gSprites[spriteIds[4]].data[2] = spriteIds[7];
@ -1248,7 +1270,7 @@ static void LoadContestResultSprites(void)
static void StartTextBoxSlideIn(s16 x, u16 y, u16 slideOutTimer, u16 slideIncrement)
{
struct Sprite *sprite = &gSprites[sContestResults->data->slidingTextBoxSpriteId];
sprite->pos1.x = DISPLAY_WIDTH + 32;
sprite->pos1.x = TEXT_BOX_X;
sprite->pos1.y = y;
sprite->pos2.x = 0;
sprite->pos2.y = 0;
@ -1275,8 +1297,8 @@ static void StartTextBoxSlideOut(u16 slideIncrement)
static void EndTextBoxSlideOut(struct Sprite *sprite)
{
sprite->pos1.x = DISPLAY_WIDTH + 32;
sprite->pos1.y = DISPLAY_HEIGHT - 16;
sprite->pos1.x = TEXT_BOX_X;
sprite->pos1.y = TEXT_BOX_Y;
sprite->pos2.y = 0;
sprite->pos2.x = 0;
sprite->callback = SpriteCallbackDummy;
@ -1377,7 +1399,7 @@ static void HideLinkResultsTextBox(void)
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
}
static void LoadContestResultsTilemaps(void)
static void LoadContestResultsTitleBarTilemaps(void)
{
u8 palette;
int x, y;
@ -1386,58 +1408,58 @@ static void LoadContestResultsTilemaps(void)
y = 1;
if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK)
{
CopyToBgTilemapBufferRect(2, gLinkContestResults_Tilemap, 5, 1, 5, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Link_Tilemap, 5, 1, 5, 2);
x = 10;
}
else if (gSpecialVar_ContestRank == CONTEST_RANK_NORMAL)
{
CopyToBgTilemapBufferRect(2, gNormalContestResults_Tilemap, 5, 1, 10, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Normal_Tilemap, 5, 1, 10, 2);
x = 15;
}
else if (gSpecialVar_ContestRank == CONTEST_RANK_SUPER)
{
CopyToBgTilemapBufferRect(2, gSuperContestResults_Tilemap, 5, 1, 10, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Super_Tilemap, 5, 1, 10, 2);
x = 15;
}
else if (gSpecialVar_ContestRank == CONTEST_RANK_HYPER)
{
CopyToBgTilemapBufferRect(2, gHyperContestResults_Tilemap, 5, 1, 10, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Hyper_Tilemap, 5, 1, 10, 2);
x = 15;
}
else // CONTEST_RANK_MASTER
{
CopyToBgTilemapBufferRect(2, gMasterContestResults_Tilemap, 5, 1, 10, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Master_Tilemap, 5, 1, 10, 2);
x = 15;
}
if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_COOL)
{
palette = 0;
CopyToBgTilemapBufferRect(2, gCoolContestResults_Tilemap, x, y, 5, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Cool_Tilemap, x, y, 5, 2);
}
else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_BEAUTY)
{
palette = 1;
CopyToBgTilemapBufferRect(2, gBeautyContestResults_Tilemap, x, y, 5, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Beauty_Tilemap, x, y, 5, 2);
}
else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_CUTE)
{
palette = 2;
CopyToBgTilemapBufferRect(2, gCuteContestResults_Tilemap, x, y, 5, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Cute_Tilemap, x, y, 5, 2);
}
else if (gSpecialVar_ContestCategory == CONTEST_CATEGORY_SMART)
{
palette = 3;
CopyToBgTilemapBufferRect(2, gSmartContestResults_Tilemap, x, y, 5, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Smart_Tilemap, x, y, 5, 2);
}
else // CONTEST_CATEGORY_TOUGH
{
palette = 4;
CopyToBgTilemapBufferRect(2, gToughContestResults_Tilemap, x, y, 5, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Tough_Tilemap, x, y, 5, 2);
}
x += 5;
CopyToBgTilemapBufferRect(2, gContestResults_Tilemap, x, y, 6, 2);
CopyToBgTilemapBufferRect(2, gContestResultsTitle_Tilemap, x, y, 6, 2);
CopyToBgTilemapBufferRect_ChangePalette(2, sContestResults->tilemapBuffers[2], 0, 0, 32, 4, palette);
}
@ -1567,10 +1589,10 @@ static void SpriteCB_WinnerMonSlideIn(struct Sprite *sprite)
sprite->pos1.x -= delta >> 8;
sprite->data[1] += 0x600;
sprite->data[1] &= 0xFF;
if (sprite->pos1.x < 120)
sprite->pos1.x = 120;
if (sprite->pos1.x < DISPLAY_WIDTH / 2)
sprite->pos1.x = DISPLAY_WIDTH / 2;
if (sprite->pos1.x == 120)
if (sprite->pos1.x == DISPLAY_WIDTH / 2)
{
sprite->callback = SpriteCallbackDummy;
sprite->data[1] = 0;
@ -1628,7 +1650,7 @@ static void SpriteCB_Confetti(struct Sprite *sprite)
if (sContestResults->data->destroyConfetti)
sprite->invisible = TRUE;
if (sprite->pos1.x > 248 || sprite->pos1.y > 116)
if (sprite->pos1.x > DISPLAY_WIDTH + 8 || sprite->pos1.y > 116)
{
DestroySprite(sprite);
sContestResults->data->confettiCount--;
@ -2035,7 +2057,7 @@ void GiveMonContestRibbon(void)
void BufferContestantTrainerName(void)
{
StringCopy(gStringVar1, gContestMons[gSpecialVar_0x8006].trainerName);
sub_81DB5AC(gStringVar1);
ConvertInternationalContestantName(gStringVar1);
}
void BufferContestantMonNickname(void)
@ -2074,7 +2096,7 @@ void BufferContestWinnerTrainerName(void)
u8 i;
GET_CONTEST_WINNER_ID(i);
StringCopy(gStringVar3, gContestMons[i].trainerName);
sub_81DB5AC(gStringVar3);
ConvertInternationalContestantName(gStringVar3);
}
void BufferContestWinnerMonName(void)
@ -2257,6 +2279,10 @@ static void Task_LinkContest_WaitDisconnect(u8 taskId)
}
}
/*
A section of contest script functions starts here
*/
void SetContestTrainerGfxIds(void)
{
gSaveBlock1Ptr->vars[VAR_OBJ_GFX_ID_0 - VARS_START] = gContestMons[0].trainerGfxId;
@ -2265,27 +2291,27 @@ void SetContestTrainerGfxIds(void)
}
// Unused
void sub_80F8814(void)
void GetNpcContestantLocalId(void)
{
u16 var1;
u8 var0 = gSpecialVar_0x8005;
switch (var0)
u16 localId;
u8 contestant = gSpecialVar_0x8005;
switch (contestant)
{
case 0:
var1 = 3;
localId = 3;
break;
case 1:
var1 = 4;
localId = 4;
break;
case 2:
var1 = 5;
localId = 5;
break;
default:
var1 = 100;
default: // Invalid
localId = 100;
break;
}
gSpecialVar_0x8004 = var1;
gSpecialVar_0x8004 = localId;
}
void BufferContestTrainerAndMonNames(void)
@ -2296,26 +2322,26 @@ void BufferContestTrainerAndMonNames(void)
}
// Unused
void DoesContestCategoryHaveWinner(void)
void DoesContestCategoryHaveMuseumPainting(void)
{
int contestWinner;
switch (gSpecialVar_ContestCategory)
{
case CONTEST_CATEGORY_COOL:
contestWinner = 8;
contestWinner = CONTEST_WINNER_MUSEUM_COOL - 1;
break;
case CONTEST_CATEGORY_BEAUTY:
contestWinner = 9;
contestWinner = CONTEST_WINNER_MUSEUM_BEAUTY - 1;
break;
case CONTEST_CATEGORY_CUTE:
contestWinner = 10;
contestWinner = CONTEST_WINNER_MUSEUM_CUTE - 1;
break;
case CONTEST_CATEGORY_SMART:
contestWinner = 11;
contestWinner = CONTEST_WINNER_MUSEUM_SMART - 1;
break;
case CONTEST_CATEGORY_TOUGH:
default:
contestWinner = 12;
contestWinner = CONTEST_WINNER_MUSEUM_TOUGH - 1;
break;
}
@ -2327,7 +2353,7 @@ void DoesContestCategoryHaveWinner(void)
void SaveMuseumContestPainting(void)
{
sub_80DEDA8(0xFF);
SaveContestWinner(CONTEST_SAVE_FOR_MUSEUM);
}
void ShouldReadyContestArtist(void)
@ -2344,14 +2370,14 @@ void ShouldReadyContestArtist(void)
}
}
u8 CountPlayerContestPaintings(void)
u8 CountPlayerMuseumPaintings(void)
{
int i;
u8 count = 0;
for (i = 0; i < 5; i++)
for (i = 0; i < NUM_CONTEST_WINNERS - MUSEUM_CONTEST_WINNERS_START; i++)
{
if (gSaveBlock1Ptr->contestWinners[8 + i].species)
if (gSaveBlock1Ptr->contestWinners[MUSEUM_CONTEST_WINNERS_START + i].species)
count++;
}
@ -2359,19 +2385,21 @@ u8 CountPlayerContestPaintings(void)
}
// Unused
void sub_80F8970(void)
void GetContestantNamesAtRank(void)
{
s16 conditions[CONTESTANT_COUNT];
int i, j;
s16 condition;
s8 var0;
u8 var2;
u8 r8;
u8 r7;
s8 numAtCondition;
u8 contestantOffset;
u8 tieRank;
u8 rank;
// Get round 1 points
for (i = 0; i < CONTESTANT_COUNT; i++)
conditions[i] = gContestMonRound1Points[i];
// Sort round 1 points
for (i = 0; i < CONTESTANT_COUNT - 1; i++)
{
for (j = CONTESTANT_COUNT - 1; j > i; j--)
@ -2384,58 +2412,65 @@ void sub_80F8970(void)
}
}
// Get round 1 points at specified rank
condition = conditions[gSpecialVar_0x8006];
var0 = 0;
r8 = 0;
// Count number of contestants with the same number of points
numAtCondition = 0;
tieRank = 0;
for (i = 0; i < CONTESTANT_COUNT; i++)
{
if (conditions[i] == condition)
{
var0++;
numAtCondition++;
if (i == gSpecialVar_0x8006)
r8 = var0;
tieRank = numAtCondition;
}
}
// Get rank of first contestant with the same number of points
for (i = 0; i < CONTESTANT_COUNT; i++)
{
if (conditions[i] == condition)
break;
}
rank = i;
r7 = i;
var2 = r8;
// Get contestant id of player at rank (taking ties into account)
contestantOffset = tieRank;
for (i = 0; i < CONTESTANT_COUNT; i++)
{
if (condition == gContestMonRound1Points[i])
{
if (var2 == 1)
if (contestantOffset == 1)
break;
var2--;
contestantOffset--;
}
}
// Use contestant id to get names
StringCopy(gStringVar1, gContestMons[i].nickname);
StringCopy(gStringVar2, gContestMons[i].trainerName);
sub_81DB5AC(gStringVar2);
ConvertInternationalContestantName(gStringVar2);
if (var0 == 1)
gSpecialVar_0x8006 = r7;
else if (r8 == var0)
gSpecialVar_0x8006 = r7;
// Return adjusted rank
if (numAtCondition == 1)
gSpecialVar_0x8006 = rank;
else if (tieRank == numAtCondition)
gSpecialVar_0x8006 = rank;
else
gSpecialVar_0x8006 = r7 + 4;
gSpecialVar_0x8006 = rank + CONTESTANT_COUNT;
}
static void ExitContestWinnerPainting(void)
static void ExitContestPainting(void)
{
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
void ShowContestWinnerPainting(void)
void ShowContestPainting(void)
{
SetMainCallback2(CB2_ContestPainting);
gMain.savedCallback = ExitContestWinnerPainting;
gMain.savedCallback = ExitContestPainting;
}
void SetLinkContestPlayerGfx(void)

View File

@ -138,7 +138,7 @@
const struct ContestWinner gDefaultContestWinners[] =
{
{
[CONTEST_WINNER_HALL_1 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_ELECTRIKE,
@ -147,7 +147,7 @@ const struct ContestWinner gDefaultContestWinners[] =
.trainerName = _("EZRA"),
.contestRank = CONTEST_RANK_NORMAL
},
{
[CONTEST_WINNER_HALL_2 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_TROPIUS,
@ -156,7 +156,7 @@ const struct ContestWinner gDefaultContestWinners[] =
.trainerName = _("ALLAN"),
.contestRank = CONTEST_RANK_HYPER
},
{
[CONTEST_WINNER_HALL_3 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_XATU,
@ -165,7 +165,7 @@ const struct ContestWinner gDefaultContestWinners[] =
.trainerName = _("JULIET"),
.contestRank = CONTEST_RANK_NORMAL
},
{
[CONTEST_WINNER_HALL_4 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_PLUSLE,
@ -174,7 +174,7 @@ const struct ContestWinner gDefaultContestWinners[] =
.trainerName = _("BAILY"),
.contestRank = CONTEST_RANK_MASTER
},
{
[CONTEST_WINNER_HALL_5 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_SHUPPET,
@ -183,7 +183,7 @@ const struct ContestWinner gDefaultContestWinners[] =
.trainerName = _("MELANY"),
.contestRank = CONTEST_RANK_SUPER
},
{
[CONTEST_WINNER_HALL_6 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_ZANGOOSE,
@ -192,7 +192,7 @@ const struct ContestWinner gDefaultContestWinners[] =
.trainerName = _("HANA"),
.contestRank = CONTEST_RANK_HYPER
},
{
[CONTEST_WINNER_HALL_UNUSED_1 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_LOUDRED,
@ -201,7 +201,7 @@ const struct ContestWinner gDefaultContestWinners[] =
.trainerName = _("BRYANT"),
.contestRank = CONTEST_RANK_HYPER
},
{
[CONTEST_WINNER_HALL_UNUSED_2 - 1] = {
.personality = 0,
.trainerId = 0xFFFF,
.species = SPECIES_DELCATTY,

View File

@ -471,11 +471,11 @@ const u8 gContestSliderHeart_Gfx[] = INCBIN_U8("graphics/contest/slider_heart.4b
const u32 gUnknownGfx_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.4bpp.lz");
const u32 gUnknownPal_C19470[] = INCBIN_U32("graphics/unknown/unknown_C19470.gbapal.lz");
const u32 gContestResults_Gfx[] = INCBIN_U32("graphics/contest/results_screen.4bpp.lz");
const u32 gUnknown_08C19EEC[] = INCBIN_U32("graphics/contest/misc_2_tilemap_1.bin.lz");
const u32 gUnknown_08C1A000[] = INCBIN_U32("graphics/contest/misc_2_tilemap_2.bin.lz");
const u32 gUnknown_08C1A12C[] = INCBIN_U32("graphics/contest/misc_2_tilemap_3.bin.lz");
const u32 gContestResults_Pal[] = INCBIN_U32("graphics/contest/results_screen.gbapal.lz");
const u32 gContestResults_Gfx[] = INCBIN_U32("graphics/contest/results_screen/tiles.4bpp.lz");
const u32 gContestResults_WinnerBanner_Tilemap[] = INCBIN_U32("graphics/contest/results_screen/winner_banner.bin.lz");
const u32 gContestResults_Interface_Tilemap[] = INCBIN_U32("graphics/contest/results_screen/interface.bin.lz");
const u32 gContestResults_Bg_Tilemap[] = INCBIN_U32("graphics/contest/results_screen/bg.bin.lz");
const u32 gContestResults_Pal[] = INCBIN_U32("graphics/contest/results_screen/tiles.gbapal.lz");
const u32 gBattleAnimSpriteGfx_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.4bpp.lz");
const u32 gBattleAnimSpritePal_Impact[] = INCBIN_U32("graphics/battle_anims/sprites/impact.gbapal.lz");
@ -1296,17 +1296,17 @@ const u8 gBagMenuHMIcon_Gfx[] = INCBIN_U8("graphics/interface/hm.4bpp");
// contest results screen
const u16 gNormalContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_normal.bin");
const u16 gSuperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_super.bin");
const u16 gHyperContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_hyper.bin");
const u16 gMasterContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_master.bin");
const u16 gLinkContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_link.bin");
const u16 gCoolContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cool.bin");
const u16 gBeautyContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_beauty.bin");
const u16 gCuteContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_cute.bin");
const u16 gSmartContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_smart.bin");
const u16 gToughContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen_tough.bin");
const u16 gContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_screen.bin");
const u16 gContestResultsTitle_Normal_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_normal.bin");
const u16 gContestResultsTitle_Super_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_super.bin");
const u16 gContestResultsTitle_Hyper_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_hyper.bin");
const u16 gContestResultsTitle_Master_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_master.bin");
const u16 gContestResultsTitle_Link_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_link.bin");
const u16 gContestResultsTitle_Cool_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_cool.bin");
const u16 gContestResultsTitle_Beauty_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_beauty.bin");
const u16 gContestResultsTitle_Cute_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_cute.bin");
const u16 gContestResultsTitle_Smart_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_smart.bin");
const u16 gContestResultsTitle_Tough_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title_tough.bin");
const u16 gContestResultsTitle_Tilemap[] = INCBIN_U16("graphics/contest/results_screen/title.bin");
// pokenav

View File

@ -185,7 +185,7 @@ void ConvertInternationalPlayerNameStripChar(u8 *str, u8 removeChar)
}
}
void sub_81DB5AC(u8 *str)
void ConvertInternationalContestantName(u8 *str)
{
if (*str++ == EXT_CTRL_CODE_BEGIN && *str++ == EXT_CTRL_CODE_JPN)
{

View File

@ -48,23 +48,19 @@
extern const u8 EventScript_ResetAllMapFlags[];
// this file's functions
static void ClearFrontierRecord(void);
static void WarpToTruck(void);
static void ResetMiniGamesRecords(void);
// EWRAM vars
EWRAM_DATA bool8 gDifferentSaveFile = FALSE;
EWRAM_DATA bool8 gEnableContestDebugging = FALSE;
// const rom data
static const struct ContestWinner sContestWinnerPicDummy =
{
.monName = _(""),
.trainerName = _("")
};
// code
void SetTrainerId(u32 trainerId, u8 *dst)
{
dst[0] = trainerId;
@ -114,7 +110,9 @@ void ClearAllContestWinnerPics(void)
s32 i;
ClearContestWinnerPicsInContestHall();
for (i = 8; i < 13; i++)
// Clear Museum paintings
for (i = MUSEUM_CONTEST_WINNERS_START; i < NUM_CONTEST_WINNERS; i++)
gSaveBlock1Ptr->contestWinners[i] = sContestWinnerPicDummy;
}

View File

@ -1466,15 +1466,15 @@ bool8 ScrCmd_hidemonpic(struct ScriptContext *ctx)
return TRUE;
}
bool8 ScrCmd_showcontestwinner(struct ScriptContext *ctx)
bool8 ScrCmd_showcontestpainting(struct ScriptContext *ctx)
{
u8 contestWinnerId = ScriptReadByte(ctx);
// Don't save artist's painting yet
// Artist's painting is temporary and already has its data loaded
if (contestWinnerId != CONTEST_WINNER_ARTIST)
SetContestWinnerForPainting(contestWinnerId);
ShowContestWinnerPainting();
ShowContestPainting();
ScriptContext1_Stop();
return TRUE;
}

View File

@ -661,7 +661,7 @@ u32 CountPlayerTrainerStars(void)
stars++;
if (HasAllHoennMons())
stars++;
if (CountPlayerContestPaintings() > 4)
if (CountPlayerMuseumPaintings() >= CONTEST_CATEGORIES_COUNT)
stars++;
if (HasAllFrontierSymbols())
stars++;
@ -735,7 +735,7 @@ static void SetPlayerCardData(struct TrainerCard *trainerCard, u8 cardType)
case CARD_TYPE_FRLG:
trainerCard->contestsWithFriends = GetCappedGameStat(GAME_STAT_WON_LINK_CONTEST, 999);
trainerCard->pokeblocksWithFriends = GetCappedGameStat(GAME_STAT_POKEBLOCKS_WITH_FRIENDS, 0xFFFF);
if (CountPlayerContestPaintings() > 4)
if (CountPlayerMuseumPaintings() >= CONTEST_CATEGORIES_COUNT)
trainerCard->hasAllPaintings = TRUE;
trainerCard->stars = GetRubyTrainerStars(trainerCard);
break;