summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/event_scripts.s19
-rw-r--r--data/specials.inc2
-rw-r--r--include/constants/global.h2
-rw-r--r--include/constants/lilycove_lady.h12
-rw-r--r--include/global.h22
-rw-r--r--src/easy_chat.c7
-rw-r--r--src/lilycove_lady.c33
7 files changed, 48 insertions, 49 deletions
diff --git a/data/event_scripts.s b/data/event_scripts.s
index 5ad4fa778..563f7fb7b 100644
--- a/data/event_scripts.s
+++ b/data/event_scripts.s
@@ -4504,7 +4504,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A8635:: @ 82A8635
end
LilycoveCity_PokemonCenter_1F_EventScript_2A864C:: @ 82A864C
- special sub_811A858
+ special QuizLadyShowQuizQuestion
waitstate
goto LilycoveCity_PokemonCenter_1F_EventScript_2A8635
end
@@ -4557,7 +4557,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A86C7:: @ 82A86C7
goto LilycoveCity_PokemonCenter_1F_EventScript_2A8759
end
-@VAR_RESULT is essentially ignored, both scripts are identical
+@ VAR_RESULT is essentially ignored, both jumps are identical
LilycoveCity_PokemonCenter_1F_EventScript_2A86EC:: @ 82A86EC
specialvar VAR_RESULT, BufferQuizAuthorNameAndCheckIfLady
compare VAR_RESULT, 1
@@ -4727,7 +4727,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A88F6:: @ 82A88F6
goto LilycoveCity_PokemonCenter_1F_EventScript_2A890A
end
-@VAR_0x8004 here is the return value from GivePokeblockToContestLady
+@ VAR_0x8004 here is the return value from GivePokeblockToContestLady
LilycoveCity_PokemonCenter_1F_EventScript_2A890A:: @ 82A890A
applymovement 4, LilycoveCity_PokemonCenter_1F_Movement_2A89B8
waitmovement 0
@@ -4749,7 +4749,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A893F:: @ 82A893F
waitmovement 0
delay 60
-@VAR_0x8004 here is the return value from GivePokeblockToContestLady
+@ VAR_0x8004 here is the return value from GivePokeblockToContestLady
LilycoveCity_PokemonCenter_1F_EventScript_2A894C:: @ 82A894C
applymovement 4, LilycoveCity_PokemonCenter_1F_Movement_2A89C0
waitmovement 0
@@ -4814,20 +4814,19 @@ LilycoveCity_PokemonCenter_1F_Movement_2A89C2: @ 82A89C2
jump_in_place_left
step_end
-@TODO, these are CONTEST_CATEGORY_ constants, move into a new constants/contest.h?
LilycoveCity_PokemonCenter_1F_EventScript_2A89C7:: @ 82A89C7
specialvar VAR_RESULT, GetContestLadyCategory
special Script_BufferContestLadyCategoryAndMonName
special GetContestLadyMonSpecies
- compare VAR_RESULT, 0
+ compare VAR_RESULT, 0 @CONTEST_CATEGORY_COOL
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8A0A
- compare VAR_RESULT, 1
+ compare VAR_RESULT, 1 @CONTEST_CATEGORY_BEAUTY
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8A1D
- compare VAR_RESULT, 2
+ compare VAR_RESULT, 2 @CONTEST_CATEGORY_CUTE
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8A30
- compare VAR_RESULT, 3
+ compare VAR_RESULT, 3 @CONTEST_CATEGORY_SMART
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8A43
- compare VAR_RESULT, 4
+ compare VAR_RESULT, 4 @CONTEST_CATEGORY_TOUGH
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8A56
end
diff --git a/data/specials.inc b/data/specials.inc
index eaf661194..ba93b098d 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -388,7 +388,7 @@ gSpecials:: @ 81DBA64
def_special GetQuizLadyState
def_special GetQuizAuthor
def_special IsQuizLadyWaitingForChallenger
- def_special sub_811A858
+ def_special QuizLadyShowQuizQuestion
def_special QuizLadyGetPlayerAnswer
def_special IsQuizAnswerCorrect
def_special BufferQuizPrizeItem
diff --git a/include/constants/global.h b/include/constants/global.h
index ff28d6a4b..1177f0444 100644
--- a/include/constants/global.h
+++ b/include/constants/global.h
@@ -50,6 +50,8 @@
#define PYRAMID_BAG_ITEMS_COUNT 10
#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode.
+#define TRAINER_ID_LENGTH 4
+
// string lengths
#define ITEM_NAME_LENGTH 14
#define POKEMON_NAME_LENGTH 10
diff --git a/include/constants/lilycove_lady.h b/include/constants/lilycove_lady.h
index 6ef70d8a7..01f60ccf4 100644
--- a/include/constants/lilycove_lady.h
+++ b/include/constants/lilycove_lady.h
@@ -10,6 +10,8 @@
#define LILYCOVE_LADY_STATE_COMPLETED 1
#define LILYCOVE_LADY_STATE_PRIZE 2
+#define LILYCOVE_LADY_GIFT_THRESHOLD 5
+
#define QUIZ_AUTHOR_PLAYER 0
#define QUIZ_AUTHOR_OTHER_PLAYER 1
#define QUIZ_AUTHOR_LADY 2
@@ -18,13 +20,7 @@
#define QUIZ_AUTHOR_NAME_LADY 0
#define QUIZ_AUTHOR_NAME_PLAYER 1
#define QUIZ_AUTHOR_NAME_OTHER_PLAYER 2
-
-// TODO use array count macro?
-#define QUIZ_QUESTION_LEN 9 //ARRAY_COUNT(sQuizLadyQuestion#)
-#define NUM_QUIZ_QUESTIONS 16 //ARRAY_COUNT(sQuizLadyQuizQuestions)
-#define FAVOR_DESCRIPTION_NUM 6 //ARRAY_COUNT(sFavorLadyDescriptions)
-
-#define LILYCOVE_LADY_GIFT_THRESHOLD 5
-
+
+#define QUIZ_QUESTION_LEN 9
#endif
diff --git a/include/global.h b/include/global.h
index df0d0c1ea..a82fe5861 100644
--- a/include/global.h
+++ b/include/global.h
@@ -224,7 +224,7 @@ struct Apprentice
u8 number;
struct ApprenticeMon party[3];
u16 easyChatWords[6];
- u8 playerId[4];
+ u8 playerId[TRAINER_ID_LENGTH];
u8 playerName[PLAYER_NAME_LENGTH];
u8 language;
u32 checksum;
@@ -263,7 +263,7 @@ struct EmeraldBattleTowerRecord
/*0x01*/ u8 facilityClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
- /*0x0C*/ u8 trainerId[4];
+ /*0x0C*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 speechWon[6];
/*0x28*/ u16 speechLost[6];
@@ -278,7 +278,7 @@ struct BattleTowerEReaderTrainer
/*0x01*/ u8 facilityClass;
/*0x02*/ u16 winStreak;
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
- /*0x0C*/ u8 trainerId[4];
+ /*0x0C*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 farewellPlayerLost[6];
/*0x28*/ u16 farewellPlayerWon[6];
@@ -425,7 +425,7 @@ struct PlayersApprentice
struct RankingHall1P
{
- u8 id[4];
+ u8 id[TRAINER_ID_LENGTH];
u16 winStreak;
u8 name[PLAYER_NAME_LENGTH + 1];
u8 language;
@@ -433,8 +433,8 @@ struct RankingHall1P
struct RankingHall2P
{
- u8 id1[4];
- u8 id2[4];
+ u8 id1[TRAINER_ID_LENGTH];
+ u8 id2[TRAINER_ID_LENGTH];
u16 winStreak;
u8 name1[PLAYER_NAME_LENGTH + 1];
u8 name2[PLAYER_NAME_LENGTH + 1];
@@ -446,7 +446,7 @@ struct SaveBlock2
/*0x00*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x08*/ u8 playerGender; // MALE, FEMALE
/*0x09*/ u8 specialSaveWarpFlags;
- /*0x0A*/ u8 playerTrainerId[4];
+ /*0x0A*/ u8 playerTrainerId[TRAINER_ID_LENGTH];
/*0x0E*/ u16 playTimeHours;
/*0x10*/ u8 playTimeMinutes;
/*0x11*/ u8 playTimeSeconds;
@@ -495,7 +495,7 @@ struct SecretBase
/*0x1A9D*/ u8 battledOwnerToday:1;
/*0x1A9D*/ u8 registryStatus:2;
/*0x1A9E*/ u8 trainerName[PLAYER_NAME_LENGTH];
- /*0x1AA5*/ u8 trainerId[4]; // byte 0 is used for determining trainer class
+ /*0x1AA5*/ u8 trainerId[TRAINER_ID_LENGTH]; // byte 0 is used for determining trainer class
/*0x1AA9*/ u8 language;
/*0x1AAA*/ u16 numSecretBasesReceived;
/*0x1AAC*/ u8 numTimesEntered;
@@ -581,7 +581,7 @@ struct MailStruct
{
/*0x00*/ u16 words[MAIL_WORDS_COUNT];
/*0x12*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
- /*0x1A*/ u8 trainerId[4];
+ /*0x1A*/ u8 trainerId[TRAINER_ID_LENGTH];
/*0x1E*/ u16 species;
/*0x20*/ u16 itemId;
};
@@ -598,7 +598,7 @@ struct MauvilleManBard
/*0x0E*/ u16 temporaryLyrics[6];
/*0x1A*/ u8 playerName[8];
/*0x22*/ u8 filler_2DB6[0x3];
- /*0x25*/ u8 playerTrainerId[4];
+ /*0x25*/ u8 playerTrainerId[TRAINER_ID_LENGTH];
/*0x29*/ bool8 hasChangedSong;
/*0x2A*/ u8 language;
}; /*size = 0x2C*/
@@ -745,7 +745,7 @@ struct LilycoveLadyQuiz
/*0x014*/ u16 correctAnswer;
/*0x016*/ u16 playerAnswer;
/*0x018*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
- /*0x020*/ u16 playerTrainerId[4];
+ /*0x020*/ u16 playerTrainerId[TRAINER_ID_LENGTH];
/*0x028*/ u16 prize;
/*0x02a*/ bool8 waitingForChallenger;
/*0x02b*/ u8 questionId;
diff --git a/src/easy_chat.c b/src/easy_chat.c
index b95b43aea..ba54de783 100644
--- a/src/easy_chat.c
+++ b/src/easy_chat.c
@@ -241,6 +241,7 @@ struct Unk8597530
MainCallback callback;
};
+// Lilycove Quiz Lady
static const struct Unk8597530 sUnknown_08597530[] = {
{
.word = 26,
@@ -1330,7 +1331,7 @@ void ShowEasyChatScreen(void)
DoEasyChatScreen(gSpecialVar_0x8004, words, CB2_ReturnToFieldContinueScript, displayedPersonType);
}
-static void sub_811A7E4(void)
+static void CB2_QuizLadyQuestion(void)
{
LilycoveLady *lilycoveLady;
@@ -1353,9 +1354,9 @@ static void sub_811A7E4(void)
gMain.state ++;
}
-void sub_811A858(void)
+void QuizLadyShowQuizQuestion(void)
{
- SetMainCallback2(sub_811A7E4);
+ SetMainCallback2(CB2_QuizLadyQuestion);
}
static int sub_811A868(u16 word)
diff --git a/src/lilycove_lady.c b/src/lilycove_lady.c
index 339e91847..60ad9de46 100644
--- a/src/lilycove_lady.c
+++ b/src/lilycove_lady.c
@@ -126,13 +126,13 @@ static u8 GetNumAcceptedItems(const u16 *itemsArray)
static void FavorLadyPickFavorAndBestItem(void)
{
- u8 size;
- u8 idx;
+ u8 numItems;
+ u8 bestItem;
- sFavorLadyPtr->favorId = Random() % FAVOR_DESCRIPTION_NUM;
- size = GetNumAcceptedItems(sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId]);
- idx = Random() % size;
- sFavorLadyPtr->bestItem = sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId][idx];
+ sFavorLadyPtr->favorId = Random() % ARRAY_COUNT(sFavorLadyRequests);
+ numItems = GetNumAcceptedItems(sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId]);
+ bestItem = Random() % numItems;
+ sFavorLadyPtr->bestItem = sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId][bestItem];
}
static void InitLilycoveFavorLady(void)
@@ -309,7 +309,7 @@ static void QuizLadyPickQuestion(void)
u8 questionId;
u8 i;
- questionId = Random() % NUM_QUIZ_QUESTIONS;
+ questionId = Random() % ARRAY_COUNT(sQuizLadyQuizQuestions);
for (i = 0; i < QUIZ_QUESTION_LEN; i ++)
{
sQuizLadyPtr->question[i] = sQuizLadyQuizQuestions[questionId][i];
@@ -333,13 +333,13 @@ static void InitLilycoveQuizLady(void)
}
sQuizLadyPtr->correctAnswer = -1;
sQuizLadyPtr->playerAnswer = -1;
- for (i = 0; i < 4; i ++)
+ for (i = 0; i < TRAINER_ID_LENGTH; i ++)
{
sQuizLadyPtr->playerTrainerId[i] = 0;
}
sQuizLadyPtr->prize = ITEM_NONE;
sQuizLadyPtr->waitingForChallenger = FALSE;
- sQuizLadyPtr->prevQuestionId = NUM_QUIZ_QUESTIONS;
+ sQuizLadyPtr->prevQuestionId = ARRAY_COUNT(sQuizLadyQuizQuestions);
sQuizLadyPtr->language = gGameLanguage;
QuizLadyPickQuestion();
}
@@ -383,7 +383,7 @@ u8 GetQuizAuthor(void)
i = quiz->questionId;
do
{
- if (++ i >= NUM_QUIZ_QUESTIONS)
+ if (++ i >= (int)(ARRAY_COUNT(sQuizLadyQuizQuestions)))
{
i = 0;
}
@@ -455,7 +455,7 @@ static bool8 IsQuizTrainerIdNotPlayer(void)
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
notPlayer = FALSE;
- for (i = 0; i < 4; i ++)
+ for (i = 0; i < TRAINER_ID_LENGTH; i ++)
{
if (sQuizLadyPtr->playerTrainerId[i] != gSaveBlock2Ptr->playerTrainerId[i])
{
@@ -548,7 +548,7 @@ void QuizLadyPickNewQuestion(void)
}
else
{
- sQuizLadyPtr->prevQuestionId = NUM_QUIZ_QUESTIONS;
+ sQuizLadyPtr->prevQuestionId = ARRAY_COUNT(sQuizLadyQuizQuestions);
}
QuizLadyPickQuestion();
}
@@ -582,7 +582,7 @@ void QuizLadyRecordCustomQuizData(void)
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
sQuizLadyPtr->prize = gSpecialVar_ItemId;
- for (i = 0; i < 4; i ++)
+ for (i = 0; i < TRAINER_ID_LENGTH; i ++)
{
sQuizLadyPtr->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
}
@@ -613,7 +613,8 @@ void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady)
u8 i;
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
- if (lilycoveLady->quiz.prevQuestionId < NUM_QUIZ_QUESTIONS && sQuizLadyPtr->id == LILYCOVE_LADY_QUIZ)
+ if (lilycoveLady->quiz.prevQuestionId < ARRAY_COUNT(sQuizLadyQuizQuestions)
+ && sQuizLadyPtr->id == LILYCOVE_LADY_QUIZ)
{
for (i = 0; i < 4; i ++)
{
@@ -621,11 +622,11 @@ void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady)
{
break;
}
- sQuizLadyPtr->questionId = Random() % NUM_QUIZ_QUESTIONS;
+ sQuizLadyPtr->questionId = Random() % ARRAY_COUNT(sQuizLadyQuizQuestions);
}
if (lilycoveLady->quiz.prevQuestionId == sQuizLadyPtr->questionId)
{
- sQuizLadyPtr->questionId = (sQuizLadyPtr->questionId + 1) % NUM_QUIZ_QUESTIONS;
+ sQuizLadyPtr->questionId = (sQuizLadyPtr->questionId + 1) % (int)(ARRAY_COUNT(sQuizLadyQuizQuestions));
}
sQuizLadyPtr->prevQuestionId = lilycoveLady->quiz.prevQuestionId;
}