mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
Misc contest cleanup
This commit is contained in:
parent
dbe24f0baa
commit
bc9fc38254
@ -160,7 +160,7 @@ LilycoveCity_EventScript_MotelSign:: @ 81E2D11
|
|||||||
|
|
||||||
LilycoveCity_EventScript_MuseumSign:: @ 81E2D1A
|
LilycoveCity_EventScript_MuseumSign:: @ 81E2D1A
|
||||||
lockall
|
lockall
|
||||||
specialvar VAR_0x8004, CountPlayerContestPaintings
|
specialvar VAR_0x8004, CountPlayerMuseumPaintings
|
||||||
switch VAR_0x8004
|
switch VAR_0x8004
|
||||||
case 0, LilycoveCity_EventScript_MuseumSignNoPaintings
|
case 0, LilycoveCity_EventScript_MuseumSignNoPaintings
|
||||||
msgbox LilycoveCity_Text_MuseumSignPlayersExhibit, MSGBOX_DEFAULT
|
msgbox LilycoveCity_Text_MuseumSignPlayersExhibit, MSGBOX_DEFAULT
|
||||||
|
@ -108,7 +108,7 @@ LilycoveCity_ContestLobby_EventScript_ReceivedArtistRibbon:: @ 821A314
|
|||||||
return
|
return
|
||||||
|
|
||||||
LilycoveCity_ContestLobby_EventScript_UpdateMuseumPatrons:: @ 821A360
|
LilycoveCity_ContestLobby_EventScript_UpdateMuseumPatrons:: @ 821A360
|
||||||
specialvar VAR_0x8004, CountPlayerContestPaintings
|
specialvar VAR_0x8004, CountPlayerMuseumPaintings
|
||||||
switch VAR_0x8004
|
switch VAR_0x8004
|
||||||
case 1, LilycoveCity_ContestLobby_EventScript_ShowPatron1
|
case 1, LilycoveCity_ContestLobby_EventScript_ShowPatron1
|
||||||
case 2, LilycoveCity_ContestLobby_EventScript_ShowPatron2
|
case 2, LilycoveCity_ContestLobby_EventScript_ShowPatron2
|
||||||
|
@ -94,7 +94,7 @@ LilycoveCity_LilycoveMuseum_2F_Movement_FaceExhibitHall: @ 8219863
|
|||||||
LilycoveCity_LilycoveMuseum_2F_EventScript_Curator:: @ 8219866
|
LilycoveCity_LilycoveMuseum_2F_EventScript_Curator:: @ 8219866
|
||||||
lockall
|
lockall
|
||||||
goto_if_set FLAG_RECEIVED_GLASS_ORNAMENT, LilycoveCity_LilycoveMuseum_2F_EventScript_ReceivedGlassOrnament
|
goto_if_set FLAG_RECEIVED_GLASS_ORNAMENT, LilycoveCity_LilycoveMuseum_2F_EventScript_ReceivedGlassOrnament
|
||||||
specialvar VAR_0x8004, CountPlayerContestPaintings
|
specialvar VAR_0x8004, CountPlayerMuseumPaintings
|
||||||
switch VAR_0x8004
|
switch VAR_0x8004
|
||||||
case 1, LilycoveCity_LilycoveMuseum_2F_EventScript_AddedPainting
|
case 1, LilycoveCity_LilycoveMuseum_2F_EventScript_AddedPainting
|
||||||
case 2, LilycoveCity_LilycoveMuseum_2F_EventScript_AddedPainting
|
case 2, LilycoveCity_LilycoveMuseum_2F_EventScript_AddedPainting
|
||||||
|
@ -89,14 +89,14 @@ gSpecials:: @ 81DBA64
|
|||||||
def_special ResetTVShowState
|
def_special ResetTVShowState
|
||||||
def_special GetContestWinnerId
|
def_special GetContestWinnerId
|
||||||
def_special GetContestPlayerId
|
def_special GetContestPlayerId
|
||||||
def_special sub_80F8814
|
def_special GetNpcContestantLocalId
|
||||||
def_special BufferContestWinnerTrainerName
|
def_special BufferContestWinnerTrainerName
|
||||||
def_special BufferContestWinnerMonName
|
def_special BufferContestWinnerMonName
|
||||||
def_special BufferContestTrainerAndMonNames
|
def_special BufferContestTrainerAndMonNames
|
||||||
def_special GetContestMonConditionRanking
|
def_special GetContestMonConditionRanking
|
||||||
def_special SetContestTrainerGfxIds
|
def_special SetContestTrainerGfxIds
|
||||||
def_special TryEnterContestMon
|
def_special TryEnterContestMon
|
||||||
def_special sub_80F8970
|
def_special GetContestantNamesAtRank
|
||||||
def_special SetLinkContestPlayerGfx
|
def_special SetLinkContestPlayerGfx
|
||||||
def_special GetContestMonCondition
|
def_special GetContestMonCondition
|
||||||
def_special HasMonWonThisContestBefore
|
def_special HasMonWonThisContestBefore
|
||||||
@ -147,8 +147,8 @@ gSpecials:: @ 81DBA64
|
|||||||
def_special CountPartyAliveNonEggMons_IgnoreVar0x8004Slot
|
def_special CountPartyAliveNonEggMons_IgnoreVar0x8004Slot
|
||||||
def_special ShouldReadyContestArtist
|
def_special ShouldReadyContestArtist
|
||||||
def_special SaveMuseumContestPainting
|
def_special SaveMuseumContestPainting
|
||||||
def_special DoesContestCategoryHaveWinner
|
def_special DoesContestCategoryHaveMuseumPainting
|
||||||
def_special CountPlayerContestPaintings
|
def_special CountPlayerMuseumPaintings
|
||||||
def_special ShowContestPainting @ Unused, redundant with showcontestpainting command
|
def_special ShowContestPainting @ Unused, redundant with showcontestpainting command
|
||||||
def_special MauvilleGymSetDefaultBarriers
|
def_special MauvilleGymSetDefaultBarriers
|
||||||
def_special MauvilleGymPressSwitch
|
def_special MauvilleGymPressSwitch
|
||||||
|
@ -32,8 +32,8 @@
|
|||||||
#define CONTEST_WINNER_HALL_5 5
|
#define CONTEST_WINNER_HALL_5 5
|
||||||
#define CONTEST_WINNER_HALL_6 6
|
#define CONTEST_WINNER_HALL_6 6
|
||||||
#define NUM_CONTEST_HALL_WINNERS 6
|
#define NUM_CONTEST_HALL_WINNERS 6
|
||||||
#define CONTEST_WINNER_HALL_UNUSED 7
|
#define CONTEST_WINNER_HALL_UNUSED_1 7 // These two have data for gDefaultContestWinners
|
||||||
#define CONTEST_WINNER_MUSEUM_UNUSED 8
|
#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_COOL 9
|
||||||
#define CONTEST_WINNER_MUSEUM_BEAUTY 10
|
#define CONTEST_WINNER_MUSEUM_BEAUTY 10
|
||||||
#define CONTEST_WINNER_MUSEUM_CUTE 11
|
#define CONTEST_WINNER_MUSEUM_CUTE 11
|
||||||
@ -41,14 +41,14 @@
|
|||||||
#define CONTEST_WINNER_MUSEUM_TOUGH 13
|
#define CONTEST_WINNER_MUSEUM_TOUGH 13
|
||||||
// NUM_CONTEST_WINNERS in constants/global.h
|
// NUM_CONTEST_WINNERS in constants/global.h
|
||||||
|
|
||||||
#define MUSEUM_CONTEST_WINNERS_START CONTEST_WINNER_MUSEUM_UNUSED
|
#define MUSEUM_CONTEST_WINNERS_START (CONTEST_WINNER_MUSEUM_COOL - 1)
|
||||||
|
|
||||||
// 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_MUSEUM ((u8)-1)
|
||||||
#define CONTEST_SAVE_FOR_ARTIST ((u8)-2)
|
#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 CANT_ENTER_CONTEST 0
|
||||||
#define CAN_ENTER_CONTEST_EQUAL_RANK 1
|
#define CAN_ENTER_CONTEST_EQUAL_RANK 1
|
||||||
#define CAN_ENTER_CONTEST_HIGH_RANK 2
|
#define CAN_ENTER_CONTEST_HIGH_RANK 2
|
||||||
|
@ -111,11 +111,11 @@ struct ContestPokemon
|
|||||||
u32 otId;
|
u32 otId;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Shared1A004
|
struct ContestTempSave
|
||||||
{
|
{
|
||||||
u16 cachedWindowPalettes[16][16]; // Saved palette data before a move happens?
|
u16 cachedWindowPalettes[16][16]; // Saved palette data before a move happens?
|
||||||
u16 unk18204[PLTT_BUFFER_SIZE]; // Saved copy of gPlttBufferUnfaded
|
u16 cachedPlttBufferUnfaded[PLTT_BUFFER_SIZE];
|
||||||
u16 unk18604[PLTT_BUFFER_SIZE]; // Saved copy of gPlttBufferFaded
|
u16 cachedPlttBufferFaded[PLTT_BUFFER_SIZE];
|
||||||
u8 savedJunk[0x800];
|
u8 savedJunk[0x800];
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -306,7 +306,7 @@ struct ContestResources
|
|||||||
#define eUnzippedContestAudience_Gfx (gHeap + 0x18000)
|
#define eUnzippedContestAudience_Gfx (gHeap + 0x18000)
|
||||||
#define eContestAudienceFrame2_Gfx (gHeap + 0x19000)
|
#define eContestAudienceFrame2_Gfx (gHeap + 0x19000)
|
||||||
#define eContestDebugMode (gHeap[0x1a000])
|
#define eContestDebugMode (gHeap[0x1a000])
|
||||||
#define eUnknownHeap1A004 (*(struct Shared1A004 *)(gHeap + 0x1a004))
|
#define eContestTempSave (*(struct ContestTempSave *)(gHeap + 0x1a004))
|
||||||
|
|
||||||
extern struct ContestPokemon gContestMons[CONTESTANT_COUNT];
|
extern struct ContestPokemon gContestMons[CONTESTANT_COUNT];
|
||||||
extern s16 gContestMonRound1Points[CONTESTANT_COUNT];
|
extern s16 gContestMonRound1Points[CONTESTANT_COUNT];
|
||||||
|
@ -9,6 +9,6 @@ void ShowContestResults(void);
|
|||||||
void ContestLinkTransfer(u8);
|
void ContestLinkTransfer(u8);
|
||||||
void ShowContestPainting(void);
|
void ShowContestPainting(void);
|
||||||
u16 GetContestRand(void);
|
u16 GetContestRand(void);
|
||||||
u8 CountPlayerContestPaintings(void);
|
u8 CountPlayerMuseumPaintings(void);
|
||||||
|
|
||||||
#endif // GUARD_CONTEST_UTIL_H
|
#endif // GUARD_CONTEST_UTIL_H
|
||||||
|
@ -17,7 +17,7 @@ void CopyMonCategoryText(int dexNum, u8 *dest);
|
|||||||
u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth);
|
u8 *sub_81DB494(u8 *str, int fontId, const u8 *str2, int totalStringWidth);
|
||||||
void PadNameString(u8 *dest, u8 padChar);
|
void PadNameString(u8 *dest, u8 padChar);
|
||||||
void ConvertInternationalPlayerNameStripChar(u8 *, u8);
|
void ConvertInternationalPlayerNameStripChar(u8 *, u8);
|
||||||
void sub_81DB5AC(u8 *);
|
void ConvertInternationalContestantName(u8 *);
|
||||||
int sub_81DB604(u8 *);
|
int sub_81DB604(u8 *);
|
||||||
void sub_81DB620(int windowId, int columnStart, int rowStart, int numFillTiles, int numRows);
|
void sub_81DB620(int windowId, int columnStart, int rowStart, int numFillTiles, int numRows);
|
||||||
|
|
||||||
|
@ -1034,7 +1034,7 @@ void LoadContestBgAfterMoveAnim(void)
|
|||||||
{
|
{
|
||||||
u32 contestantWindowId = 5 + i;
|
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);
|
CopyToBgTilemapBuffer(2, gUnknown_08C17170, 0, 0);
|
||||||
CopyBgTilemapBufferToVram(2);
|
CopyBgTilemapBufferToVram(2);
|
||||||
// This is a bug, and copies random junk. savedJunk is never read.
|
// 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;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
LoadCompressedPalette(gOldContestPalette, 0, 0x200);
|
LoadCompressedPalette(gOldContestPalette, 0, 0x200);
|
||||||
@ -1328,7 +1328,7 @@ static bool8 SetupContestGraphics(u8 *stateVar)
|
|||||||
CpuCopy32(gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, tempPalette2, 16 * sizeof(u16));
|
CpuCopy32(gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, tempPalette2, 16 * sizeof(u16));
|
||||||
CpuCopy32(tempPalette2, gPlttBufferUnfaded + 128, 16 * sizeof(u16));
|
CpuCopy32(tempPalette2, gPlttBufferUnfaded + 128, 16 * sizeof(u16));
|
||||||
CpuCopy32(tempPalette1, gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, 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();
|
LoadContestPalettes();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
@ -1468,7 +1468,7 @@ static void Task_DisplayAppealNumberText(u8 taskId)
|
|||||||
gBattle_BG0_Y = 0;
|
gBattle_BG0_Y = 0;
|
||||||
gBattle_BG2_Y = 0;
|
gBattle_BG2_Y = 0;
|
||||||
ContestDebugDoPrint();
|
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);
|
ConvertIntToDecimalStringN(gStringVar1, eContest.appealNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
|
||||||
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
|
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
|
||||||
StringCopy(gDisplayedStringBattle, gText_AppealNumWhichMoveWillBePlayed);
|
StringCopy(gDisplayedStringBattle, gText_AppealNumWhichMoveWillBePlayed);
|
||||||
@ -1667,8 +1667,8 @@ static void Task_HideMoveSelectScreen(u8 taskId)
|
|||||||
}
|
}
|
||||||
Contest_SetBgCopyFlags(0);
|
Contest_SetBgCopyFlags(0);
|
||||||
// This seems to be a bug; it should have just copied PLTT_BUFFER_SIZE.
|
// This seems to be a bug; it should have just copied PLTT_BUFFER_SIZE.
|
||||||
DmaCopy32Defvars(3, gPlttBufferFaded, eUnknownHeap1A004.unk18604, PLTT_BUFFER_SIZE * 2);
|
DmaCopy32Defvars(3, gPlttBufferFaded, eContestTempSave.cachedPlttBufferFaded, PLTT_BUFFER_SIZE * 2);
|
||||||
LoadPalette(eUnknownHeap1A004.unk18204, 0, PLTT_BUFFER_SIZE * 2);
|
LoadPalette(eContestTempSave.cachedPlttBufferUnfaded, 0, PLTT_BUFFER_SIZE * 2);
|
||||||
gTasks[taskId].data[0] = 0;
|
gTasks[taskId].data[0] = 0;
|
||||||
gTasks[taskId].data[1] = 0;
|
gTasks[taskId].data[1] = 0;
|
||||||
gTasks[taskId].func = Task_HideApplauseMeterForAppealStart;
|
gTasks[taskId].func = Task_HideApplauseMeterForAppealStart;
|
||||||
@ -2554,7 +2554,7 @@ static void Task_WaitForHeartSliders(u8 taskId)
|
|||||||
|
|
||||||
static void sub_80DA348(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[0] = 0;
|
||||||
gTasks[taskId].data[1] = 2;
|
gTasks[taskId].data[1] = 2;
|
||||||
gTasks[taskId].func = Task_WaitPrintRoundResult;
|
gTasks[taskId].func = Task_WaitPrintRoundResult;
|
||||||
@ -4412,7 +4412,7 @@ static void DrawContestantWindows(void)
|
|||||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||||
{
|
{
|
||||||
s32 windowId = i + 5;
|
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();
|
DrawContestantWindowText();
|
||||||
}
|
}
|
||||||
@ -5530,7 +5530,6 @@ bool8 SaveContestWinner(u8 rank)
|
|||||||
if (rank == CONTEST_SAVE_FOR_MUSEUM && i != gContestPlayerMonIndex)
|
if (rank == CONTEST_SAVE_FOR_MUSEUM && i != gContestPlayerMonIndex)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
||||||
// Adjust the random painting caption depending on the category
|
// Adjust the random painting caption depending on the category
|
||||||
switch (gSpecialVar_ContestCategory)
|
switch (gSpecialVar_ContestCategory)
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ static const struct OamData sContestPaintingMonOamData =
|
|||||||
.paletteNum = 0,
|
.paletteNum = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u16 sBg_Palette[] = {RGB_BLACK, RGB_BLACK};
|
static const u16 sBgPalette[] = {RGB_BLACK, RGB_BLACK};
|
||||||
|
|
||||||
void SetContestWinnerForPainting(int contestWinnerId)
|
void SetContestWinnerForPainting(int contestWinnerId)
|
||||||
{
|
{
|
||||||
@ -223,7 +223,7 @@ static void ShowContestPainting(void)
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
PrintContestPaintingCaption(gCurContestWinnerSaveIdx, gCurContestWinnerIsForArtist);
|
PrintContestPaintingCaption(gCurContestWinnerSaveIdx, gCurContestWinnerIsForArtist);
|
||||||
LoadPalette(sBg_Palette, 0, 1 * 2);
|
LoadPalette(sBgPalette, 0, 1 * 2);
|
||||||
DmaClear32(3, PLTT, PLTT_SIZE);
|
DmaClear32(3, PLTT, PLTT_SIZE);
|
||||||
BeginFastPaletteFade(2);
|
BeginFastPaletteFade(2);
|
||||||
SetVBlankCallback(VBlankCB_ContestPainting);
|
SetVBlankCallback(VBlankCB_ContestPainting);
|
||||||
@ -278,12 +278,13 @@ static void InitContestPaintingWindow(void)
|
|||||||
ShowBg(1);
|
ShowBg(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PrintContestPaintingCaption(u8 contestType, bool8 noCaption)
|
static void PrintContestPaintingCaption(u8 contestType, bool8 isForArtist)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
u8 category;
|
u8 category;
|
||||||
|
|
||||||
if (noCaption == TRUE)
|
// Artist's painting has no caption
|
||||||
|
if (isForArtist == TRUE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
category = gContestPaintingWinner->contestCategory;
|
category = gContestPaintingWinner->contestCategory;
|
||||||
@ -294,7 +295,7 @@ static void PrintContestPaintingCaption(u8 contestType, bool8 noCaption)
|
|||||||
StringAppend(gStringVar1, gText_Space);
|
StringAppend(gStringVar1, gText_Space);
|
||||||
StringAppend(gStringVar1, sContestRankNames[gContestPaintingWinner->contestRank]);
|
StringAppend(gStringVar1, sContestRankNames[gContestPaintingWinner->contestRank]);
|
||||||
StringCopy(gStringVar2, gContestPaintingWinner->trainerName);
|
StringCopy(gStringVar2, gContestPaintingWinner->trainerName);
|
||||||
sub_81DB5AC(gStringVar2);
|
ConvertInternationalContestantName(gStringVar2);
|
||||||
StringCopy(gStringVar3, gContestPaintingWinner->monName);
|
StringCopy(gStringVar3, gContestPaintingWinner->monName);
|
||||||
StringExpandPlaceholders(gStringVar4, gContestHallPaintingCaption);
|
StringExpandPlaceholders(gStringVar4, gContestHallPaintingCaption);
|
||||||
}
|
}
|
||||||
|
@ -856,7 +856,7 @@ static void Task_AnnounceWinner(u8 taskId)
|
|||||||
gTasks[taskId].tTimer = 0;
|
gTasks[taskId].tTimer = 0;
|
||||||
GET_CONTEST_WINNER_ID(i);
|
GET_CONTEST_WINNER_ID(i);
|
||||||
StringCopy(gStringVar1, gContestMons[i].trainerName);
|
StringCopy(gStringVar1, gContestMons[i].trainerName);
|
||||||
sub_81DB5AC(gStringVar1);
|
ConvertInternationalContestantName(gStringVar1);
|
||||||
StringCopy(gStringVar2, gContestMons[i].nickname);
|
StringCopy(gStringVar2, gContestMons[i].nickname);
|
||||||
StringExpandPlaceholders(winnerTextBuffer, gText_ContestantsMonWon);
|
StringExpandPlaceholders(winnerTextBuffer, gText_ContestantsMonWon);
|
||||||
x = DrawResultsTextWindow(winnerTextBuffer, sContestResults->data->slidingTextBoxSpriteId);
|
x = DrawResultsTextWindow(winnerTextBuffer, sContestResults->data->slidingTextBoxSpriteId);
|
||||||
@ -2057,7 +2057,7 @@ void GiveMonContestRibbon(void)
|
|||||||
void BufferContestantTrainerName(void)
|
void BufferContestantTrainerName(void)
|
||||||
{
|
{
|
||||||
StringCopy(gStringVar1, gContestMons[gSpecialVar_0x8006].trainerName);
|
StringCopy(gStringVar1, gContestMons[gSpecialVar_0x8006].trainerName);
|
||||||
sub_81DB5AC(gStringVar1);
|
ConvertInternationalContestantName(gStringVar1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferContestantMonNickname(void)
|
void BufferContestantMonNickname(void)
|
||||||
@ -2096,7 +2096,7 @@ void BufferContestWinnerTrainerName(void)
|
|||||||
u8 i;
|
u8 i;
|
||||||
GET_CONTEST_WINNER_ID(i);
|
GET_CONTEST_WINNER_ID(i);
|
||||||
StringCopy(gStringVar3, gContestMons[i].trainerName);
|
StringCopy(gStringVar3, gContestMons[i].trainerName);
|
||||||
sub_81DB5AC(gStringVar3);
|
ConvertInternationalContestantName(gStringVar3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferContestWinnerMonName(void)
|
void BufferContestWinnerMonName(void)
|
||||||
@ -2279,6 +2279,10 @@ static void Task_LinkContest_WaitDisconnect(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
A section of contest script functions starts here
|
||||||
|
*/
|
||||||
|
|
||||||
void SetContestTrainerGfxIds(void)
|
void SetContestTrainerGfxIds(void)
|
||||||
{
|
{
|
||||||
gSaveBlock1Ptr->vars[VAR_OBJ_GFX_ID_0 - VARS_START] = gContestMons[0].trainerGfxId;
|
gSaveBlock1Ptr->vars[VAR_OBJ_GFX_ID_0 - VARS_START] = gContestMons[0].trainerGfxId;
|
||||||
@ -2287,27 +2291,27 @@ void SetContestTrainerGfxIds(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
void sub_80F8814(void)
|
void GetNpcContestantLocalId(void)
|
||||||
{
|
{
|
||||||
u16 var1;
|
u16 localId;
|
||||||
u8 var0 = gSpecialVar_0x8005;
|
u8 contestant = gSpecialVar_0x8005;
|
||||||
switch (var0)
|
switch (contestant)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
var1 = 3;
|
localId = 3;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
var1 = 4;
|
localId = 4;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
var1 = 5;
|
localId = 5;
|
||||||
break;
|
break;
|
||||||
default:
|
default: // Invalid
|
||||||
var1 = 100;
|
localId = 100;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gSpecialVar_0x8004 = var1;
|
gSpecialVar_0x8004 = localId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferContestTrainerAndMonNames(void)
|
void BufferContestTrainerAndMonNames(void)
|
||||||
@ -2318,26 +2322,26 @@ void BufferContestTrainerAndMonNames(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
void DoesContestCategoryHaveWinner(void)
|
void DoesContestCategoryHaveMuseumPainting(void)
|
||||||
{
|
{
|
||||||
int contestWinner;
|
int contestWinner;
|
||||||
switch (gSpecialVar_ContestCategory)
|
switch (gSpecialVar_ContestCategory)
|
||||||
{
|
{
|
||||||
case CONTEST_CATEGORY_COOL:
|
case CONTEST_CATEGORY_COOL:
|
||||||
contestWinner = 8;
|
contestWinner = CONTEST_WINNER_MUSEUM_COOL - 1;
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_BEAUTY:
|
case CONTEST_CATEGORY_BEAUTY:
|
||||||
contestWinner = 9;
|
contestWinner = CONTEST_WINNER_MUSEUM_BEAUTY - 1;
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_CUTE:
|
case CONTEST_CATEGORY_CUTE:
|
||||||
contestWinner = 10;
|
contestWinner = CONTEST_WINNER_MUSEUM_CUTE - 1;
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_SMART:
|
case CONTEST_CATEGORY_SMART:
|
||||||
contestWinner = 11;
|
contestWinner = CONTEST_WINNER_MUSEUM_SMART - 1;
|
||||||
break;
|
break;
|
||||||
case CONTEST_CATEGORY_TOUGH:
|
case CONTEST_CATEGORY_TOUGH:
|
||||||
default:
|
default:
|
||||||
contestWinner = 12;
|
contestWinner = CONTEST_WINNER_MUSEUM_TOUGH - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2366,14 +2370,14 @@ void ShouldReadyContestArtist(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CountPlayerContestPaintings(void)
|
u8 CountPlayerMuseumPaintings(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u8 count = 0;
|
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++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2381,19 +2385,21 @@ u8 CountPlayerContestPaintings(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unused
|
// Unused
|
||||||
void sub_80F8970(void)
|
void GetContestantNamesAtRank(void)
|
||||||
{
|
{
|
||||||
s16 conditions[CONTESTANT_COUNT];
|
s16 conditions[CONTESTANT_COUNT];
|
||||||
int i, j;
|
int i, j;
|
||||||
s16 condition;
|
s16 condition;
|
||||||
s8 var0;
|
s8 numAtCondition;
|
||||||
u8 var2;
|
u8 contestantOffset;
|
||||||
u8 r8;
|
u8 tieRank;
|
||||||
u8 r7;
|
u8 rank;
|
||||||
|
|
||||||
|
// Get round 1 points
|
||||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||||
conditions[i] = gContestMonRound1Points[i];
|
conditions[i] = gContestMonRound1Points[i];
|
||||||
|
|
||||||
|
// Sort round 1 points
|
||||||
for (i = 0; i < CONTESTANT_COUNT - 1; i++)
|
for (i = 0; i < CONTESTANT_COUNT - 1; i++)
|
||||||
{
|
{
|
||||||
for (j = CONTESTANT_COUNT - 1; j > i; j--)
|
for (j = CONTESTANT_COUNT - 1; j > i; j--)
|
||||||
@ -2406,47 +2412,54 @@ void sub_80F8970(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get round 1 points at specified rank
|
||||||
condition = conditions[gSpecialVar_0x8006];
|
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++)
|
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (conditions[i] == condition)
|
if (conditions[i] == condition)
|
||||||
{
|
{
|
||||||
var0++;
|
numAtCondition++;
|
||||||
if (i == gSpecialVar_0x8006)
|
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++)
|
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (conditions[i] == condition)
|
if (conditions[i] == condition)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
rank = i;
|
||||||
|
|
||||||
r7 = i;
|
// Get contestant id of player at rank (taking ties into account)
|
||||||
var2 = r8;
|
contestantOffset = tieRank;
|
||||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (condition == gContestMonRound1Points[i])
|
if (condition == gContestMonRound1Points[i])
|
||||||
{
|
{
|
||||||
if (var2 == 1)
|
if (contestantOffset == 1)
|
||||||
break;
|
break;
|
||||||
var2--;
|
contestantOffset--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use contestant id to get names
|
||||||
StringCopy(gStringVar1, gContestMons[i].nickname);
|
StringCopy(gStringVar1, gContestMons[i].nickname);
|
||||||
StringCopy(gStringVar2, gContestMons[i].trainerName);
|
StringCopy(gStringVar2, gContestMons[i].trainerName);
|
||||||
sub_81DB5AC(gStringVar2);
|
ConvertInternationalContestantName(gStringVar2);
|
||||||
|
|
||||||
if (var0 == 1)
|
// Return adjusted rank
|
||||||
gSpecialVar_0x8006 = r7;
|
if (numAtCondition == 1)
|
||||||
else if (r8 == var0)
|
gSpecialVar_0x8006 = rank;
|
||||||
gSpecialVar_0x8006 = r7;
|
else if (tieRank == numAtCondition)
|
||||||
|
gSpecialVar_0x8006 = rank;
|
||||||
else
|
else
|
||||||
gSpecialVar_0x8006 = r7 + 4;
|
gSpecialVar_0x8006 = rank + CONTESTANT_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ExitContestPainting(void)
|
static void ExitContestPainting(void)
|
||||||
|
@ -192,7 +192,7 @@ const struct ContestWinner gDefaultContestWinners[] =
|
|||||||
.trainerName = _("HANA"),
|
.trainerName = _("HANA"),
|
||||||
.contestRank = CONTEST_RANK_HYPER
|
.contestRank = CONTEST_RANK_HYPER
|
||||||
},
|
},
|
||||||
[CONTEST_WINNER_HALL_UNUSED - 1] = {
|
[CONTEST_WINNER_HALL_UNUSED_1 - 1] = {
|
||||||
.personality = 0,
|
.personality = 0,
|
||||||
.trainerId = 0xFFFF,
|
.trainerId = 0xFFFF,
|
||||||
.species = SPECIES_LOUDRED,
|
.species = SPECIES_LOUDRED,
|
||||||
@ -201,7 +201,7 @@ const struct ContestWinner gDefaultContestWinners[] =
|
|||||||
.trainerName = _("BRYANT"),
|
.trainerName = _("BRYANT"),
|
||||||
.contestRank = CONTEST_RANK_HYPER
|
.contestRank = CONTEST_RANK_HYPER
|
||||||
},
|
},
|
||||||
[CONTEST_WINNER_MUSEUM_UNUSED - 1] = {
|
[CONTEST_WINNER_HALL_UNUSED_2 - 1] = {
|
||||||
.personality = 0,
|
.personality = 0,
|
||||||
.trainerId = 0xFFFF,
|
.trainerId = 0xFFFF,
|
||||||
.species = SPECIES_DELCATTY,
|
.species = SPECIES_DELCATTY,
|
||||||
|
@ -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)
|
if (*str++ == EXT_CTRL_CODE_BEGIN && *str++ == EXT_CTRL_CODE_JPN)
|
||||||
{
|
{
|
||||||
|
@ -48,23 +48,19 @@
|
|||||||
|
|
||||||
extern const u8 EventScript_ResetAllMapFlags[];
|
extern const u8 EventScript_ResetAllMapFlags[];
|
||||||
|
|
||||||
// this file's functions
|
|
||||||
static void ClearFrontierRecord(void);
|
static void ClearFrontierRecord(void);
|
||||||
static void WarpToTruck(void);
|
static void WarpToTruck(void);
|
||||||
static void ResetMiniGamesRecords(void);
|
static void ResetMiniGamesRecords(void);
|
||||||
|
|
||||||
// EWRAM vars
|
|
||||||
EWRAM_DATA bool8 gDifferentSaveFile = FALSE;
|
EWRAM_DATA bool8 gDifferentSaveFile = FALSE;
|
||||||
EWRAM_DATA bool8 gEnableContestDebugging = FALSE;
|
EWRAM_DATA bool8 gEnableContestDebugging = FALSE;
|
||||||
|
|
||||||
// const rom data
|
|
||||||
static const struct ContestWinner sContestWinnerPicDummy =
|
static const struct ContestWinner sContestWinnerPicDummy =
|
||||||
{
|
{
|
||||||
.monName = _(""),
|
.monName = _(""),
|
||||||
.trainerName = _("")
|
.trainerName = _("")
|
||||||
};
|
};
|
||||||
|
|
||||||
// code
|
|
||||||
void SetTrainerId(u32 trainerId, u8 *dst)
|
void SetTrainerId(u32 trainerId, u8 *dst)
|
||||||
{
|
{
|
||||||
dst[0] = trainerId;
|
dst[0] = trainerId;
|
||||||
@ -114,7 +110,9 @@ void ClearAllContestWinnerPics(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
ClearContestWinnerPicsInContestHall();
|
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;
|
gSaveBlock1Ptr->contestWinners[i] = sContestWinnerPicDummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,7 +661,7 @@ u32 CountPlayerTrainerStars(void)
|
|||||||
stars++;
|
stars++;
|
||||||
if (HasAllHoennMons())
|
if (HasAllHoennMons())
|
||||||
stars++;
|
stars++;
|
||||||
if (CountPlayerContestPaintings() > 4)
|
if (CountPlayerMuseumPaintings() >= CONTEST_CATEGORIES_COUNT)
|
||||||
stars++;
|
stars++;
|
||||||
if (HasAllFrontierSymbols())
|
if (HasAllFrontierSymbols())
|
||||||
stars++;
|
stars++;
|
||||||
@ -735,7 +735,7 @@ static void SetPlayerCardData(struct TrainerCard *trainerCard, u8 cardType)
|
|||||||
case CARD_TYPE_FRLG:
|
case CARD_TYPE_FRLG:
|
||||||
trainerCard->contestsWithFriends = GetCappedGameStat(GAME_STAT_WON_LINK_CONTEST, 999);
|
trainerCard->contestsWithFriends = GetCappedGameStat(GAME_STAT_WON_LINK_CONTEST, 999);
|
||||||
trainerCard->pokeblocksWithFriends = GetCappedGameStat(GAME_STAT_POKEBLOCKS_WITH_FRIENDS, 0xFFFF);
|
trainerCard->pokeblocksWithFriends = GetCappedGameStat(GAME_STAT_POKEBLOCKS_WITH_FRIENDS, 0xFFFF);
|
||||||
if (CountPlayerContestPaintings() > 4)
|
if (CountPlayerMuseumPaintings() >= CONTEST_CATEGORIES_COUNT)
|
||||||
trainerCard->hasAllPaintings = TRUE;
|
trainerCard->hasAllPaintings = TRUE;
|
||||||
trainerCard->stars = GetRubyTrainerStars(trainerCard);
|
trainerCard->stars = GetRubyTrainerStars(trainerCard);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user