diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 84fdd592a..f3f17c5d8 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -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 diff --git a/data/maps/LilycoveCity_ContestLobby/scripts.inc b/data/maps/LilycoveCity_ContestLobby/scripts.inc index 300d4dfab..3642bc1d1 100644 --- a/data/maps/LilycoveCity_ContestLobby/scripts.inc +++ b/data/maps/LilycoveCity_ContestLobby/scripts.inc @@ -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 @@ -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 diff --git a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc index 4cebebd82..c769f4b55 100644 --- a/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc +++ b/data/maps/LilycoveCity_LilycoveMuseum_2F/scripts.inc @@ -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 diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index a26ce6bf2..9e54ad52b 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -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 diff --git a/data/specials.inc b/data/specials.inc index f672a7b87..4c2a6dc73 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -149,7 +149,7 @@ gSpecials:: @ 81DBA64 def_special SaveMuseumContestPainting def_special DoesContestCategoryHaveWinner def_special CountPlayerContestPaintings - def_special ShowContestWinnerPainting + def_special ShowContestPainting @ Unused, redundant with showcontestpainting command def_special MauvilleGymSetDefaultBarriers def_special MauvilleGymPressSwitch def_special ShowFieldMessageStringVar4 diff --git a/data/text/contest_painting.inc b/data/text/contest_painting.inc index 78ae80153..b423fbb27 100644 --- a/data/text/contest_painting.inc +++ b/data/text/contest_painting.inc @@ -1,4 +1,4 @@ -gContestPaintingCaption:: @ 827EA0C +gContestHallPaintingCaption:: @ 827EA0C .string "{STR_VAR_1}\n" .string "{STR_VAR_2}'s {STR_VAR_3}$" diff --git a/graphics/picture_frame/frame1.png b/graphics/picture_frame/beauty.png similarity index 100% rename from graphics/picture_frame/frame1.png rename to graphics/picture_frame/beauty.png diff --git a/graphics/picture_frame/frame1_map.bin b/graphics/picture_frame/beauty_map.bin similarity index 100% rename from graphics/picture_frame/frame1_map.bin rename to graphics/picture_frame/beauty_map.bin diff --git a/graphics/picture_frame/frame0.png b/graphics/picture_frame/cool.png similarity index 100% rename from graphics/picture_frame/frame0.png rename to graphics/picture_frame/cool.png diff --git a/graphics/picture_frame/frame0_map.bin b/graphics/picture_frame/cool_map.bin similarity index 100% rename from graphics/picture_frame/frame0_map.bin rename to graphics/picture_frame/cool_map.bin diff --git a/graphics/picture_frame/frame2.png b/graphics/picture_frame/cute.png similarity index 100% rename from graphics/picture_frame/frame2.png rename to graphics/picture_frame/cute.png diff --git a/graphics/picture_frame/frame2_map.bin b/graphics/picture_frame/cute_map.bin similarity index 100% rename from graphics/picture_frame/frame2_map.bin rename to graphics/picture_frame/cute_map.bin diff --git a/graphics/picture_frame/frame5.png b/graphics/picture_frame/lobby.png similarity index 100% rename from graphics/picture_frame/frame5.png rename to graphics/picture_frame/lobby.png diff --git a/graphics/picture_frame/frame5_map.bin b/graphics/picture_frame/lobby_map.bin similarity index 100% rename from graphics/picture_frame/frame5_map.bin rename to graphics/picture_frame/lobby_map.bin diff --git a/graphics/picture_frame/frame3.png b/graphics/picture_frame/smart.png similarity index 100% rename from graphics/picture_frame/frame3.png rename to graphics/picture_frame/smart.png diff --git a/graphics/picture_frame/frame3_map.bin b/graphics/picture_frame/smart_map.bin similarity index 100% rename from graphics/picture_frame/frame3_map.bin rename to graphics/picture_frame/smart_map.bin diff --git a/graphics/picture_frame/frame4.png b/graphics/picture_frame/tough.png similarity index 100% rename from graphics/picture_frame/frame4.png rename to graphics/picture_frame/tough.png diff --git a/graphics/picture_frame/frame4_map.bin b/graphics/picture_frame/tough_map.bin similarity index 100% rename from graphics/picture_frame/frame4_map.bin rename to graphics/picture_frame/tough_map.bin diff --git a/graphics_file_rules.mk b/graphics_file_rules.mk index 6a3bf4006..a369d973e 100644 --- a/graphics_file_rules.mk +++ b/graphics_file_rules.mk @@ -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 \ diff --git a/include/constants/contest.h b/include/constants/contest.h index 9eb6b26e4..c18af0817 100644 --- a/include/constants/contest.h +++ b/include/constants/contest.h @@ -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 7 +#define CONTEST_WINNER_MUSEUM_UNUSED 8 #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_UNUSED + +// The number of possible captions for a Contest painting, per category +#define NUM_PAINTING_CAPTIONS 3 + +#define CONTEST_SAVE_FOR_MUSEUM ((u8)-1) +#define CONTEST_SAVE_FOR_ARTIST ((u8)-2) + #define CANT_ENTER_CONTEST 0 #define CAN_ENTER_CONTEST_EQUAL_RANK 1 #define CAN_ENTER_CONTEST_HIGH_RANK 2 diff --git a/include/contest.h b/include/contest.h index 1dd4340bd..6469bf628 100644 --- a/include/contest.h +++ b/include/contest.h @@ -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); diff --git a/include/contest_util.h b/include/contest_util.h index 76f9ae522..5b0c5559a 100644 --- a/include/contest_util.h +++ b/include/contest_util.h @@ -7,7 +7,7 @@ void StartContest(void); void BufferContestantMonSpecies(void); void ShowContestResults(void); void ContestLinkTransfer(u8); -void ShowContestWinnerPainting(void); +void ShowContestPainting(void); u16 GetContestRand(void); u8 CountPlayerContestPaintings(void); diff --git a/src/contest.c b/src/contest.c index 246fc1e50..59f50fcfc 100644 --- a/src/contest.c +++ b/src/contest.c @@ -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; @@ -5516,40 +5516,47 @@ 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 +5567,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 +5599,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 +5629,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]; } diff --git a/src/contest_painting.c b/src/contest_painting.c index 4f0bf9245..ca5d8c0a9 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -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 sBg_Palette[] = {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(sBg_Palette, 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,47 @@ 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 noCaption) { int x; u8 category; - if (arg1 == TRUE) + if (noCaption == 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); 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 +321,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 +415,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 +465,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 +523,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 +588,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); } diff --git a/src/contest_util.c b/src/contest_util.c index 700e44606..c490a2f0e 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -606,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(); @@ -656,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; } @@ -2349,7 +2349,7 @@ void DoesContestCategoryHaveWinner(void) void SaveMuseumContestPainting(void) { - sub_80DEDA8(0xFF); + SaveContestWinner(CONTEST_SAVE_FOR_MUSEUM); } void ShouldReadyContestArtist(void) @@ -2449,15 +2449,15 @@ void sub_80F8970(void) gSpecialVar_0x8006 = r7 + 4; } -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) diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h index 127457bbe..a3d19c36c 100644 --- a/src/data/contest_opponents.h +++ b/src/data/contest_opponents.h @@ -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] = { .personality = 0, .trainerId = 0xFFFF, .species = SPECIES_LOUDRED, @@ -201,7 +201,7 @@ const struct ContestWinner gDefaultContestWinners[] = .trainerName = _("BRYANT"), .contestRank = CONTEST_RANK_HYPER }, - { + [CONTEST_WINNER_MUSEUM_UNUSED - 1] = { .personality = 0, .trainerId = 0xFFFF, .species = SPECIES_DELCATTY, diff --git a/src/scrcmd.c b/src/scrcmd.c index 7dc02b6a8..0ee20d1c6 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -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; }