mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Clean up Lilycove Lady
This commit is contained in:
parent
4dbaca9dc6
commit
cbf8863e5b
@ -86,6 +86,7 @@
|
||||
#define EASY_CHAT_BATTLE_WORDS_COUNT 6
|
||||
#define MOVE_NAME_LENGTH 12
|
||||
#define NUM_QUESTIONNAIRE_WORDS 4
|
||||
#define QUIZ_QUESTION_LEN 9
|
||||
|
||||
#define MALE 0
|
||||
#define FEMALE 1
|
||||
|
@ -21,8 +21,6 @@
|
||||
#define QUIZ_AUTHOR_NAME_PLAYER 1
|
||||
#define QUIZ_AUTHOR_NAME_OTHER_PLAYER 2
|
||||
|
||||
#define QUIZ_QUESTION_LEN 9
|
||||
|
||||
// Constants for how many good Pokéblocks the Contest Lady was given
|
||||
// This determines how her performance is described when her TV show comes on
|
||||
#define CONTEST_LADY_NORMAL 0
|
||||
|
@ -761,7 +761,7 @@ struct LilycoveLadyQuiz
|
||||
{
|
||||
/*0x000*/ u8 id;
|
||||
/*0x001*/ u8 state;
|
||||
/*0x002*/ u16 question[9];
|
||||
/*0x002*/ u16 question[QUIZ_QUESTION_LEN];
|
||||
/*0x014*/ u16 correctAnswer;
|
||||
/*0x016*/ u16 playerAnswer;
|
||||
/*0x018*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
|
||||
|
@ -20,7 +20,7 @@ static const u16 sLilycoveLadyGfxId[] =
|
||||
};
|
||||
|
||||
// Quiz Lady data
|
||||
static const u16 sQuizLadyQuestion1[] =
|
||||
static const u16 sQuizLadyQuestion1[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_STORES,
|
||||
@ -33,7 +33,7 @@ static const u16 sQuizLadyQuestion1[] =
|
||||
EC_WORD_POKENAV
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion2[] =
|
||||
static const u16 sQuizLadyQuestion2[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_ISN_T,
|
||||
@ -46,7 +46,7 @@ static const u16 sQuizLadyQuestion2[] =
|
||||
EC_WORD_DARK
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion3[] =
|
||||
static const u16 sQuizLadyQuestion3[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_HOW,
|
||||
EC_WORD_DO,
|
||||
@ -59,7 +59,7 @@ static const u16 sQuizLadyQuestion3[] =
|
||||
EC_WORD_CUTE_CHARM
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion4[] =
|
||||
static const u16 sQuizLadyQuestion4[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_IS,
|
||||
@ -72,7 +72,7 @@ static const u16 sQuizLadyQuestion4[] =
|
||||
EC_WORD_MACHINE
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion5[] =
|
||||
static const u16 sQuizLadyQuestion5[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_ITEM,
|
||||
@ -85,7 +85,7 @@ static const u16 sQuizLadyQuestion5[] =
|
||||
EC_WORD_PHONE
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion6[] =
|
||||
static const u16 sQuizLadyQuestion6[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_WILL,
|
||||
@ -98,7 +98,7 @@ static const u16 sQuizLadyQuestion6[] =
|
||||
EC_WORD_SWIFT_SWIM
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion7[] =
|
||||
static const u16 sQuizLadyQuestion7[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_OF,
|
||||
@ -111,7 +111,7 @@ static const u16 sQuizLadyQuestion7[] =
|
||||
EC_WORD_ROCK
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion8[] =
|
||||
static const u16 sQuizLadyQuestion8[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_WILL,
|
||||
@ -124,7 +124,7 @@ static const u16 sQuizLadyQuestion8[] =
|
||||
EC_WORD_WONDER_GUARD
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion9[] =
|
||||
static const u16 sQuizLadyQuestion9[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_WILL,
|
||||
@ -137,7 +137,7 @@ static const u16 sQuizLadyQuestion9[] =
|
||||
EC_WORD_SHED_SKIN
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion10[] =
|
||||
static const u16 sQuizLadyQuestion10[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_GOES,
|
||||
@ -150,7 +150,7 @@ static const u16 sQuizLadyQuestion10[] =
|
||||
EC_WORD_POKENAV
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion11[] =
|
||||
static const u16 sQuizLadyQuestion11[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_STORES,
|
||||
@ -163,7 +163,7 @@ static const u16 sQuizLadyQuestion11[] =
|
||||
EC_WORD_TELEVISION
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion12[] =
|
||||
static const u16 sQuizLadyQuestion12[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_WHICH,
|
||||
EC_WORD_MACHINE,
|
||||
@ -176,7 +176,7 @@ static const u16 sQuizLadyQuestion12[] =
|
||||
EC_WORD_TELEVISION
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion13[] =
|
||||
static const u16 sQuizLadyQuestion13[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_A,
|
||||
EC_WORD_POKEMON,
|
||||
@ -189,7 +189,7 @@ static const u16 sQuizLadyQuestion13[] =
|
||||
EC_WORD_LETTER
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion14[] =
|
||||
static const u16 sQuizLadyQuestion14[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_STEEL,
|
||||
EC_WORD_IS,
|
||||
@ -202,7 +202,7 @@ static const u16 sQuizLadyQuestion14[] =
|
||||
EC_EMPTY_WORD
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion15[] =
|
||||
static const u16 sQuizLadyQuestion15[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_DARK,
|
||||
EC_WORD_IS,
|
||||
@ -215,7 +215,7 @@ static const u16 sQuizLadyQuestion15[] =
|
||||
EC_EMPTY_WORD
|
||||
};
|
||||
|
||||
static const u16 sQuizLadyQuestion16[] =
|
||||
static const u16 sQuizLadyQuestion16[QUIZ_QUESTION_LEN] =
|
||||
{
|
||||
EC_WORD_GHOST,
|
||||
EC_WORD_IS,
|
||||
|
@ -119,10 +119,10 @@ void Script_GetLilycoveLadyId(void)
|
||||
|
||||
static u8 GetNumAcceptedItems(const u16 *itemsArray)
|
||||
{
|
||||
u8 items;
|
||||
u8 numItems;
|
||||
|
||||
for (items = 0; *itemsArray != ITEM_NONE; items ++, itemsArray ++);
|
||||
return items;
|
||||
for (numItems = 0; *itemsArray != ITEM_NONE; numItems++, itemsArray++);
|
||||
return numItems;
|
||||
}
|
||||
|
||||
static void FavorLadyPickFavorAndBestItem(void)
|
||||
@ -160,18 +160,12 @@ u8 GetFavorLadyState(void)
|
||||
{
|
||||
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
||||
if (sFavorLadyPtr->state == LILYCOVE_LADY_STATE_PRIZE)
|
||||
{
|
||||
return LILYCOVE_LADY_STATE_PRIZE;
|
||||
}
|
||||
else if (sFavorLadyPtr->state == LILYCOVE_LADY_STATE_COMPLETED)
|
||||
{
|
||||
return LILYCOVE_LADY_STATE_COMPLETED;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LILYCOVE_LADY_STATE_READY;
|
||||
}
|
||||
}
|
||||
|
||||
static const u8 *GetFavorLadyRequest(u8 idx)
|
||||
{
|
||||
@ -209,7 +203,7 @@ void BufferFavorLadyItemName(void)
|
||||
|
||||
static void SetFavorLadyPlayerName(const u8 *src, u8 *dest)
|
||||
{
|
||||
memset(dest, 0xFF, 8);
|
||||
memset(dest, EOS, PLAYER_NAME_LENGTH + 1);
|
||||
StringCopy7(dest, src);
|
||||
}
|
||||
|
||||
@ -254,9 +248,7 @@ static bool8 DoesFavorLadyLikeItem(u16 itemId)
|
||||
sFavorLadyPtr->numItemsGiven++;
|
||||
sFavorLadyPtr->likedItem = TRUE;
|
||||
if (sFavorLadyPtr->bestItem == itemId)
|
||||
{
|
||||
sFavorLadyPtr->numItemsGiven = LILYCOVE_LADY_GIFT_THRESHOLD;
|
||||
}
|
||||
break;
|
||||
}
|
||||
sFavorLadyPtr->likedItem = FALSE;
|
||||
@ -312,9 +304,7 @@ static void QuizLadyPickQuestion(void)
|
||||
|
||||
questionId = Random() % ARRAY_COUNT(sQuizLadyQuizQuestions);
|
||||
for (i = 0; i < QUIZ_QUESTION_LEN; i ++)
|
||||
{
|
||||
sQuizLadyPtr->question[i] = sQuizLadyQuizQuestions[questionId][i];
|
||||
}
|
||||
sQuizLadyPtr->correctAnswer = sQuizLadyQuizAnswers[questionId];
|
||||
sQuizLadyPtr->prize = sQuizLadyPrizes[questionId];
|
||||
sQuizLadyPtr->questionId = questionId;
|
||||
@ -328,16 +318,16 @@ static void InitLilycoveQuizLady(void)
|
||||
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
sQuizLadyPtr->id = LILYCOVE_LADY_QUIZ;
|
||||
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_READY;
|
||||
|
||||
for (i = 0; i < QUIZ_QUESTION_LEN; i ++)
|
||||
{
|
||||
sQuizLadyPtr->question[i] = -1;
|
||||
}
|
||||
sQuizLadyPtr->correctAnswer = -1;
|
||||
sQuizLadyPtr->playerAnswer = -1;
|
||||
sQuizLadyPtr->question[i] = EC_EMPTY_WORD;
|
||||
|
||||
sQuizLadyPtr->correctAnswer = EC_EMPTY_WORD;
|
||||
sQuizLadyPtr->playerAnswer = EC_EMPTY_WORD;
|
||||
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i ++)
|
||||
{
|
||||
sQuizLadyPtr->playerTrainerId[i] = 0;
|
||||
}
|
||||
|
||||
sQuizLadyPtr->prize = ITEM_NONE;
|
||||
sQuizLadyPtr->waitingForChallenger = FALSE;
|
||||
sQuizLadyPtr->prevQuestionId = ARRAY_COUNT(sQuizLadyQuizQuestions);
|
||||
@ -351,48 +341,37 @@ static void ResetQuizLadyForRecordMix(void)
|
||||
sQuizLadyPtr->id = LILYCOVE_LADY_QUIZ;
|
||||
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_READY;
|
||||
sQuizLadyPtr->waitingForChallenger = FALSE;
|
||||
sQuizLadyPtr->playerAnswer = -1;
|
||||
sQuizLadyPtr->playerAnswer = EC_EMPTY_WORD;
|
||||
}
|
||||
|
||||
u8 GetQuizLadyState(void)
|
||||
{
|
||||
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
if (sQuizLadyPtr->state == LILYCOVE_LADY_STATE_PRIZE)
|
||||
{
|
||||
return LILYCOVE_LADY_STATE_PRIZE;
|
||||
}
|
||||
else if (sQuizLadyPtr->state == LILYCOVE_LADY_STATE_COMPLETED)
|
||||
{
|
||||
return LILYCOVE_LADY_STATE_COMPLETED;
|
||||
}
|
||||
else
|
||||
{
|
||||
return LILYCOVE_LADY_STATE_READY;
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetQuizAuthor(void)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
s32 i, j;
|
||||
u8 authorNameId;
|
||||
struct LilycoveLadyQuiz *quiz;
|
||||
struct LilycoveLadyQuiz *quiz = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
|
||||
quiz = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
if (IsEasyChatAnswerUnlocked(quiz->correctAnswer) == FALSE)
|
||||
{
|
||||
i = quiz->questionId;
|
||||
do
|
||||
{
|
||||
if (++ i >= (int)(ARRAY_COUNT(sQuizLadyQuizQuestions)))
|
||||
{
|
||||
if (++i >= (int)ARRAY_COUNT(sQuizLadyQuizQuestions))
|
||||
i = 0;
|
||||
}
|
||||
} while (IsEasyChatAnswerUnlocked(sQuizLadyQuizAnswers[i]) == FALSE);
|
||||
|
||||
for (j = 0; j < QUIZ_QUESTION_LEN; j++)
|
||||
{
|
||||
quiz->question[j] = sQuizLadyQuizQuestions[i][j];
|
||||
}
|
||||
quiz->correctAnswer = sQuizLadyQuizAnswers[i];
|
||||
quiz->prize = sQuizLadyPrizes[i];
|
||||
quiz->questionId = i;
|
||||
@ -400,18 +379,12 @@ u8 GetQuizAuthor(void)
|
||||
}
|
||||
authorNameId = BufferQuizAuthorName();
|
||||
if (authorNameId == QUIZ_AUTHOR_NAME_LADY)
|
||||
{
|
||||
return QUIZ_AUTHOR_LADY;
|
||||
}
|
||||
else if (authorNameId == QUIZ_AUTHOR_NAME_OTHER_PLAYER || IsQuizTrainerIdNotPlayer())
|
||||
{
|
||||
return QUIZ_AUTHOR_OTHER_PLAYER;
|
||||
}
|
||||
else
|
||||
{
|
||||
return QUIZ_AUTHOR_PLAYER;
|
||||
}
|
||||
}
|
||||
|
||||
static u8 BufferQuizAuthorName(void)
|
||||
{
|
||||
@ -532,7 +505,7 @@ void SetQuizLadyState_GivePrize(void)
|
||||
void ClearQuizLadyPlayerAnswer(void)
|
||||
{
|
||||
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
sQuizLadyPtr->playerAnswer = -1;
|
||||
sQuizLadyPtr->playerAnswer = EC_EMPTY_WORD;
|
||||
}
|
||||
|
||||
void Script_QuizLadyOpenBagMenu(void)
|
||||
@ -544,13 +517,9 @@ void QuizLadyPickNewQuestion(void)
|
||||
{
|
||||
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
if (BufferQuizAuthorNameAndCheckIfLady())
|
||||
{
|
||||
sQuizLadyPtr->prevQuestionId = sQuizLadyPtr->questionId;
|
||||
}
|
||||
else
|
||||
{
|
||||
sQuizLadyPtr->prevQuestionId = ARRAY_COUNT(sQuizLadyQuizQuestions);
|
||||
}
|
||||
QuizLadyPickQuestion();
|
||||
}
|
||||
|
||||
@ -560,10 +529,8 @@ void ClearQuizLadyQuestionAndAnswer(void)
|
||||
|
||||
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
for (i = 0; i < QUIZ_QUESTION_LEN; i++)
|
||||
{
|
||||
sQuizLadyPtr->question[i] = -1;
|
||||
}
|
||||
sQuizLadyPtr->correctAnswer = -1;
|
||||
sQuizLadyPtr->question[i] = EC_EMPTY_WORD;
|
||||
sQuizLadyPtr->correctAnswer = EC_EMPTY_WORD;
|
||||
}
|
||||
|
||||
void QuizLadySetCustomQuestion(void)
|
||||
@ -584,9 +551,7 @@ void QuizLadyRecordCustomQuizData(void)
|
||||
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
||||
sQuizLadyPtr->prize = gSpecialVar_ItemId;
|
||||
for (i = 0; i < TRAINER_ID_LENGTH; i++)
|
||||
{
|
||||
sQuizLadyPtr->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
}
|
||||
StringCopy7(sQuizLadyPtr->playerName, gSaveBlock2Ptr->playerName);
|
||||
sQuizLadyPtr->language = gGameLanguage;
|
||||
}
|
||||
@ -620,15 +585,12 @@ void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (lilycoveLady->quiz.prevQuestionId != sQuizLadyPtr->questionId)
|
||||
{
|
||||
break;
|
||||
}
|
||||
sQuizLadyPtr->questionId = Random() % ARRAY_COUNT(sQuizLadyQuizQuestions);
|
||||
}
|
||||
if (lilycoveLady->quiz.prevQuestionId == sQuizLadyPtr->questionId)
|
||||
{
|
||||
sQuizLadyPtr->questionId = (sQuizLadyPtr->questionId + 1) % (int)(ARRAY_COUNT(sQuizLadyQuizQuestions));
|
||||
}
|
||||
sQuizLadyPtr->questionId = (sQuizLadyPtr->questionId + 1) % (int)ARRAY_COUNT(sQuizLadyQuizQuestions);
|
||||
|
||||
sQuizLadyPtr->prevQuestionId = lilycoveLady->quiz.prevQuestionId;
|
||||
}
|
||||
}
|
||||
@ -656,12 +618,11 @@ static void ResetContestLadyForRecordMix(void)
|
||||
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
||||
sContestLadyPtr->id = LILYCOVE_LADY_CONTEST;
|
||||
sContestLadyPtr->givenPokeblock = FALSE;
|
||||
|
||||
if (sContestLadyPtr->numGoodPokeblocksGiven == LILYCOVE_LADY_GIFT_THRESHOLD
|
||||
|| sContestLadyPtr->numOtherPokeblocksGiven == LILYCOVE_LADY_GIFT_THRESHOLD)
|
||||
{
|
||||
ResetContestLadyContestData();
|
||||
}
|
||||
}
|
||||
|
||||
static void ContestLadySavePlayerNameIfHighSheen(u8 sheen)
|
||||
{
|
||||
@ -731,18 +692,18 @@ bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock)
|
||||
return correctFlavor;
|
||||
}
|
||||
|
||||
static void BufferContestLadyCategoryAndMonName(u8 *dest1, u8 *dest2)
|
||||
static void BufferContestLadyCategoryAndMonName(u8 *category, u8 *nickname)
|
||||
{
|
||||
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
||||
StringCopy(dest1, sContestLadyCategoryNames[sContestLadyPtr->category]);
|
||||
StringCopy10(dest2, sContestLadyMonNames[sContestLadyPtr->category]);
|
||||
StringCopy(category, sContestLadyCategoryNames[sContestLadyPtr->category]);
|
||||
StringCopy10(nickname, sContestLadyMonNames[sContestLadyPtr->category]);
|
||||
}
|
||||
|
||||
void BufferContestLadyMonName(u8 *dest1, u8 *dest2)
|
||||
void BufferContestLadyMonName(u8 *category, u8 *nickname)
|
||||
{
|
||||
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
||||
*dest1 = sContestLadyPtr->category;
|
||||
StringCopy(dest2, sContestLadyMonNames[sContestLadyPtr->category]);
|
||||
*category = sContestLadyPtr->category;
|
||||
StringCopy(nickname, sContestLadyMonNames[sContestLadyPtr->category]);
|
||||
}
|
||||
|
||||
void BufferContestLadyPlayerName(u8 *dest)
|
||||
@ -779,9 +740,7 @@ bool8 HasPlayerGivenContestLadyPokeblock(void)
|
||||
{
|
||||
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
||||
if (sContestLadyPtr->givenPokeblock == TRUE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -792,9 +751,8 @@ bool8 ShouldContestLadyShowGoOnAir(void)
|
||||
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
||||
if (sContestLadyPtr->numGoodPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD
|
||||
|| sContestLadyPtr->numOtherPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD)
|
||||
{
|
||||
putOnAir = TRUE;
|
||||
}
|
||||
|
||||
return putOnAir;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user