document remaining funcs

This commit is contained in:
GriffinR 2019-08-05 20:37:09 -04:00 committed by huderlem
parent 7fc99f3952
commit d931ba9602
11 changed files with 263 additions and 268 deletions

View File

@ -19,6 +19,7 @@
#include "constants/vars.h"
#include "constants/weather.h"
#include "constants/trainer_hill.h"
#include "constants/lilycove_lady.h"
#include "constants/battle.h"
#include "constants/metatile_labels.h"
.include "asm/macros.inc"
@ -4283,9 +4284,9 @@ GraniteCave_B1F_Movement_2A8369: @ 82A8369
LilycoveCity_PokemonCenter_1F_EventScript_2A836B:: @ 82A836B
special Script_GetLilycoveLadyId
switch VAR_RESULT
case 0, LilycoveCity_PokemonCenter_1F_EventScript_2A8554
case 1, LilycoveCity_PokemonCenter_1F_EventScript_2A8395
case 2, LilycoveCity_PokemonCenter_1F_EventScript_2A882A
case LILYCOVE_LADY_QUIZ, LilycoveCity_PokemonCenter_1F_EventScript_2A8554
case LILYCOVE_LADY_FAVOR, LilycoveCity_PokemonCenter_1F_EventScript_2A8395
case LILYCOVE_LADY_CONTEST, LilycoveCity_PokemonCenter_1F_EventScript_2A882A
end
LilycoveCity_PokemonCenter_1F_EventScript_2A8395:: @ 82A8395
@ -4293,11 +4294,11 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A8395:: @ 82A8395
faceplayer
msgbox LilycoveCity_PokemonCenter_1F_Text_2A8A69, MSGBOX_DEFAULT
specialvar VAR_RESULT, GetFavorLadyState
compare VAR_RESULT, 0
compare VAR_RESULT, LILYCOVE_LADY_STATE_READY
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A83D0
compare VAR_RESULT, 1
compare VAR_RESULT, LILYCOVE_LADY_STATE_COMPLETED
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A83C6
compare VAR_RESULT, 2
compare VAR_RESULT, LILYCOVE_LADY_STATE_PRIZE
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8510
end
@ -4307,9 +4308,9 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A83C6:: @ 82A83C6
end
LilycoveCity_PokemonCenter_1F_EventScript_2A83D0:: @ 82A83D0
special BufferFavorLadyDescription
special BufferFavorLadyRequest
msgbox LilycoveCity_PokemonCenter_1F_Text_2A8A7D, MSGBOX_DEFAULT
specialvar VAR_RESULT, sub_818DC60
specialvar VAR_RESULT, HasAnotherPlayerGivenFavorLadyItem
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8435
compare VAR_RESULT, 1
@ -4357,7 +4358,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A845E:: @ 82A845E
LilycoveCity_PokemonCenter_1F_EventScript_2A846C:: @ 82A846C
fadescreen 1
setvar VAR_RESULT, 0
special FavorLadyOpenBagMenu
special Script_FavorLadyOpenBagMenu
waitstate
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A848E
@ -4374,7 +4375,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A848E:: @ 82A848E
end
LilycoveCity_PokemonCenter_1F_EventScript_2A84AD:: @ 82A84AD
specialvar VAR_RESULT, Script_ShowFavorLadyItem
specialvar VAR_RESULT, Script_DoesFavorLadyLikeItem
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A84C9
compare VAR_RESULT, 1
@ -4382,13 +4383,13 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A84AD:: @ 82A84AD
end
LilycoveCity_PokemonCenter_1F_EventScript_2A84C9:: @ 82A84C9
special BufferFavorLadyDescription
special BufferFavorLadyRequest
msgbox LilycoveCity_PokemonCenter_1F_Text_2A8C0F, MSGBOX_DEFAULT
release
end
LilycoveCity_PokemonCenter_1F_EventScript_2A84D6:: @ 82A84D6
specialvar VAR_RESULT, DidFavorLadyLoveItem
specialvar VAR_RESULT, IsFavorLadyThresholdMet
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A84F2
compare VAR_RESULT, 1
@ -4396,13 +4397,13 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A84D6:: @ 82A84D6
end
LilycoveCity_PokemonCenter_1F_EventScript_2A84F2:: @ 82A84F2
special BufferFavorLadyDescription
special BufferFavorLadyRequest
msgbox LilycoveCity_PokemonCenter_1F_Text_2A8C6F, MSGBOX_DEFAULT
release
end
LilycoveCity_PokemonCenter_1F_EventScript_2A84FF:: @ 82A84FF
special BufferFavorLadyDescription
special BufferFavorLadyRequest
msgbox LilycoveCity_PokemonCenter_1F_Text_2A8CC8, MSGBOX_DEFAULT
goto LilycoveCity_PokemonCenter_1F_EventScript_2A8510
end
@ -4433,21 +4434,21 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A8554:: @ 82A8554
faceplayer
msgbox LilycoveCity_PokemonCenter_1F_Text_2A8E2B, MSGBOX_DEFAULT
specialvar VAR_RESULT, GetQuizLadyState
compare VAR_RESULT, 0
compare VAR_RESULT, LILYCOVE_LADY_STATE_READY
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8585
compare VAR_RESULT, 1
compare VAR_RESULT, LILYCOVE_LADY_STATE_COMPLETED
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A85AC
compare VAR_RESULT, 2
compare VAR_RESULT, LILYCOVE_LADY_STATE_PRIZE
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A86EC
end
LilycoveCity_PokemonCenter_1F_EventScript_2A8585:: @ 82A8585
specialvar VAR_RESULT, GetQuizAuthor
compare VAR_RESULT, 0
compare VAR_RESULT, QUIZ_AUTHOR_PLAYER
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A85C8
compare VAR_RESULT, 1
compare VAR_RESULT, QUIZ_AUTHOR_OTHER_PLAYER
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A85D2
compare VAR_RESULT, 2
compare VAR_RESULT, QUIZ_AUTHOR_LADY
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A85E0
end
@ -4489,7 +4490,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A8612:: @ 82A8612
end
LilycoveCity_PokemonCenter_1F_EventScript_2A861C:: @ 82A861C
special ClearQuizLadyResponse
special ClearQuizLadyPlayerAnswer
compare VAR_0x8004, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A864C
compare VAR_0x8004, EASY_CHAT_TYPE_QUIZ_ANSWER
@ -4509,7 +4510,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A864C:: @ 82A864C
end
LilycoveCity_PokemonCenter_1F_EventScript_2A8656:: @ 82A8656
special QuizLadyShowEasyChatScreen
special QuizLadyGetPlayerAnswer
waitstate
goto LilycoveCity_PokemonCenter_1F_EventScript_2A8635
end
@ -4530,7 +4531,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A867F:: @ 82A867F
LilycoveCity_PokemonCenter_1F_EventScript_2A8689:: @ 82A8689
special SetQuizLadyState_Complete
msgbox LilycoveCity_PokemonCenter_1F_Text_2A8F4D, MSGBOX_DEFAULT
specialvar VAR_RESULT, sub_818E308
specialvar VAR_RESULT, IsQuizAnswerCorrect
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A86C7
compare VAR_RESULT, 1
@ -4546,8 +4547,8 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A86B0:: @ 82A86B0
end
LilycoveCity_PokemonCenter_1F_EventScript_2A86C7:: @ 82A86C7
special sub_818E538
special sub_818E274
special BufferQuizCorrectAnswer
special BufferQuizPrizeName
playse SE_HAZURE
delay 10
playse SE_HAZURE
@ -4556,8 +4557,9 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A86C7:: @ 82A86C7
goto LilycoveCity_PokemonCenter_1F_EventScript_2A8759
end
@VAR_RESULT is essentially ignored, both scripts are identical
LilycoveCity_PokemonCenter_1F_EventScript_2A86EC:: @ 82A86EC
specialvar VAR_RESULT, sub_818E298
specialvar VAR_RESULT, BufferQuizAuthorNameAndCheckIfLady
compare VAR_RESULT, 1
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8708
compare VAR_RESULT, 0
@ -4599,7 +4601,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A8759:: @ 82A8759
end
LilycoveCity_PokemonCenter_1F_EventScript_2A8778:: @ 82A8778
special sub_818E3EC
special QuizLadyPickNewQuestion
msgbox LilycoveCity_PokemonCenter_1F_Text_2A9131, MSGBOX_DEFAULT
release
end
@ -4610,7 +4612,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A8785:: @ 82A8785
LilycoveCity_PokemonCenter_1F_EventScript_2A878D:: @ 82A878D
fadescreen 1
setvar VAR_RESULT, 0
special sub_818E3E0
special Script_QuizLadyOpenBagMenu
waitstate
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A87AF
@ -4628,13 +4630,13 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A87AF:: @ 82A87AF
LilycoveCity_PokemonCenter_1F_EventScript_2A87CE:: @ 82A87CE
msgbox LilycoveCity_PokemonCenter_1F_Text_2A9270, MSGBOX_DEFAULT
special sub_818E430
special ClearQuizLadyResponse
setvar VAR_0x8004, 16
special ClearQuizLadyQuestionAndAnswer
special ClearQuizLadyPlayerAnswer
setvar VAR_0x8004, EASY_CHAT_TYPE_QUIZ_QUESTION
LilycoveCity_PokemonCenter_1F_EventScript_2A87E1:: @ 82A87E1
fadescreen 1
special sub_818E47C
special QuizLadySetCustomQuestion
waitstate
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A87F8
@ -4650,9 +4652,9 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A87F8:: @ 82A87F8
end
LilycoveCity_PokemonCenter_1F_EventScript_2A8817:: @ 82A8817
special sub_818E490
special sub_818E4A4
special sub_818E510
special QuizLadyTakePrizeForCustomQuiz
special QuizLadyRecordCustomQuizData
special QuizLadySetWaitingForChallenger
msgbox LilycoveCity_PokemonCenter_1F_Text_2A9336, MSGBOX_DEFAULT
release
end
@ -4661,15 +4663,16 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A882A:: @ 82A882A
lock
faceplayer
msgbox LilycoveCity_PokemonCenter_1F_Text_2A93A7, MSGBOX_DEFAULT
specialvar VAR_RESULT, sub_818E8B4
specialvar VAR_RESULT, HasPlayerGivenContestLadyPokeblock
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8850
compare VAR_RESULT, 1
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A886C
end
@ Redundant with above script, VAR_RESULT will always be 0 here
LilycoveCity_PokemonCenter_1F_EventScript_2A8850:: @ 82A8850
specialvar VAR_RESULT, sub_818E8E0
specialvar VAR_RESULT, ShouldContestLadyShowGoOnAir
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8876
compare VAR_RESULT, 1
@ -4682,7 +4685,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A886C:: @ 82A886C
end
LilycoveCity_PokemonCenter_1F_EventScript_2A8876:: @ 82A8876
special sub_818E914
special Script_BufferContestLadyCategoryAndMonName
msgbox LilycoveCity_PokemonCenter_1F_Text_2A93F4, MSGBOX_DEFAULT
checkitem ITEM_POKEBLOCK_CASE, 1
compare VAR_RESULT, 0
@ -4719,11 +4722,12 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A88D7:: @ 82A88D7
LilycoveCity_PokemonCenter_1F_EventScript_2A88F6:: @ 82A88F6
msgbox LilycoveCity_PokemonCenter_1F_Text_2A9571, MSGBOX_DEFAULT
special ContestLadyGivenPokeblock
special SetContestLadyGivenPokeblock
special GetContestLadyMonSpecies
goto LilycoveCity_PokemonCenter_1F_EventScript_2A890A
end
@VAR_0x8004 here is the return value from GivePokeblockToContestLady
LilycoveCity_PokemonCenter_1F_EventScript_2A890A:: @ 82A890A
applymovement 4, LilycoveCity_PokemonCenter_1F_Movement_2A89B8
waitmovement 0
@ -4745,6 +4749,7 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A893F:: @ 82A893F
waitmovement 0
delay 60
@VAR_0x8004 here is the return value from GivePokeblockToContestLady
LilycoveCity_PokemonCenter_1F_EventScript_2A894C:: @ 82A894C
applymovement 4, LilycoveCity_PokemonCenter_1F_Movement_2A89C0
waitmovement 0
@ -4761,13 +4766,13 @@ LilycoveCity_PokemonCenter_1F_EventScript_2A8970:: @ 82A8970
end
LilycoveCity_PokemonCenter_1F_EventScript_2A897E:: @ 82A897E
special sub_818E914
special Script_BufferContestLadyCategoryAndMonName
msgbox LilycoveCity_PokemonCenter_1F_Text_2A9605, MSGBOX_DEFAULT
goto LilycoveCity_PokemonCenter_1F_EventScript_2A898F
end
LilycoveCity_PokemonCenter_1F_EventScript_2A898F:: @ 82A898F
specialvar VAR_RESULT, sub_818E8E0
specialvar VAR_RESULT, ShouldContestLadyShowGoOnAir
compare VAR_RESULT, 1
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A89A1
release
@ -4809,9 +4814,10 @@ 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 sub_818E914
special Script_BufferContestLadyCategoryAndMonName
special GetContestLadyMonSpecies
compare VAR_RESULT, 0
goto_if_eq LilycoveCity_PokemonCenter_1F_EventScript_2A8A0A

View File

@ -375,42 +375,42 @@ gSpecials:: @ 81DBA64
def_special SetLilycoveLadyGfx
def_special Script_GetLilycoveLadyId
def_special GetFavorLadyState
def_special BufferFavorLadyDescription
def_special sub_818DC60
def_special BufferFavorLadyRequest
def_special HasAnotherPlayerGivenFavorLadyItem
def_special BufferFavorLadyItemName
def_special BufferFavorLadyPlayerName
def_special DidFavorLadyLikeItem
def_special FavorLadyOpenBagMenu
def_special Script_ShowFavorLadyItem
def_special DidFavorLadyLoveItem
def_special Script_FavorLadyOpenBagMenu
def_special Script_DoesFavorLadyLikeItem
def_special IsFavorLadyThresholdMet
def_special FavorLadyGetPrize
def_special SetFavorLadyState_Complete
def_special GetQuizLadyState
def_special GetQuizAuthor
def_special IsQuizLadyWaitingForChallenger
def_special sub_811A858
def_special QuizLadyShowEasyChatScreen
def_special sub_818E308
def_special QuizLadyGetPlayerAnswer
def_special IsQuizAnswerCorrect
def_special BufferQuizPrizeItem
def_special SetQuizLadyState_Complete
def_special sub_818E298
def_special BufferQuizAuthorNameAndCheckIfLady
def_special SetQuizLadyState_GivePrize
def_special ClearQuizLadyResponse
def_special sub_818E3E0
def_special sub_818E430
def_special sub_818E47C
def_special sub_818E490
def_special ClearQuizLadyPlayerAnswer
def_special Script_QuizLadyOpenBagMenu
def_special ClearQuizLadyQuestionAndAnswer
def_special QuizLadySetCustomQuestion
def_special QuizLadyTakePrizeForCustomQuiz
def_special sub_813986C
def_special sub_818E4A4
def_special sub_818E510
def_special sub_818E538
def_special sub_818E274
def_special sub_818E3EC
def_special sub_818E8E0
def_special sub_818E8B4
def_special sub_818E914
def_special QuizLadyRecordCustomQuizData
def_special QuizLadySetWaitingForChallenger
def_special BufferQuizCorrectAnswer
def_special BufferQuizPrizeName
def_special QuizLadyPickNewQuestion
def_special ShouldContestLadyShowGoOnAir
def_special HasPlayerGivenContestLadyPokeblock
def_special Script_BufferContestLadyCategoryAndMonName
def_special OpenPokeblockCaseForContestLady
def_special ContestLadyGivenPokeblock
def_special SetContestLadyGivenPokeblock
def_special GetContestLadyMonSpecies
def_special GetContestLadyCategory
def_special PutLilycoveContestLadyShowOnTheAir

View File

@ -0,0 +1,30 @@
#ifndef GUARD_LILYCOVE_LADY_CONSTANTS_H
#define GUARD_LILYCOVE_LADY_CONSTANTS_H
#define LILYCOVE_LADY_QUIZ 0
#define LILYCOVE_LADY_FAVOR 1
#define LILYCOVE_LADY_CONTEST 2
#define LILYCOVE_LADY_COUNT 3
#define LILYCOVE_LADY_STATE_READY 0
#define LILYCOVE_LADY_STATE_COMPLETED 1
#define LILYCOVE_LADY_STATE_PRIZE 2
#define QUIZ_AUTHOR_PLAYER 0
#define QUIZ_AUTHOR_OTHER_PLAYER 1
#define QUIZ_AUTHOR_LADY 2
// Would be redundant with the above set if GF hadn't mixed the order
#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
#endif

View File

@ -737,24 +737,16 @@ struct RecordMixingDayCareMail
bool16 holdsItem[DAYCARE_MON_COUNT];
};
enum
{
LILYCOVE_LADY_QUIZ,
LILYCOVE_LADY_FAVOR,
LILYCOVE_LADY_CONTEST,
LILYCOVE_LADY_COUNT
};
struct LilycoveLadyQuiz
{
/*0x000*/ u8 id;
/*0x001*/ u8 state;
/*0x002*/ u16 question[9];
/*0x014*/ u16 answer;
/*0x016*/ u16 response;
/*0x014*/ u16 correctAnswer;
/*0x016*/ u16 playerAnswer;
/*0x018*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x020*/ u16 playerTrainerId[4];
/*0x028*/ u16 itemId;
/*0x028*/ u16 prize;
/*0x02a*/ bool8 waitingForChallenger;
/*0x02b*/ u8 questionId;
/*0x02c*/ u8 prevQuestionId;
@ -778,10 +770,10 @@ struct LilycoveLadyContest
{
/*0x000*/ u8 id;
/*0x001*/ bool8 givenPokeblock;
/*0x002*/ u8 fave_pkblk;
/*0x003*/ u8 other_pkblk;
/*0x002*/ u8 numGoodPokeblocksGiven;
/*0x003*/ u8 numOtherPokeblocksGiven;
/*0x004*/ u8 playerName[PLAYER_NAME_LENGTH + 1];
/*0x00c*/ u8 max_sheen;
/*0x00c*/ u8 maxSheen;
/*0x00d*/ u8 category;
/*0x00e*/ u8 language;
};

View File

@ -69,8 +69,8 @@ extern u16 gSpecialVar_ItemId;
// Exported ROM declarations
void sub_81AAC14(void);
void sub_81AAC50(void);
void sub_81AAC70(void);
void FavorLadyOpenBagMenu(void);
void QuizLadyOpenBagMenu(void);
void sub_81AAC28(void);
void sub_81AABB0(void);
void SetInitialScrollAndCursorPositions(u8 pocketId);

View File

@ -3,10 +3,10 @@
u8 GetLilycoveLadyId(void);
void InitLilycoveLady(void);
void ReadyLilycoveLady(void);
void sub_818DEF4(void);
void sub_818E564(void);
void sub_818E570(const LilycoveLady *lilycoveLady);
void ResetLilycoveLadyForRecordMix(void);
void FieldCallback_FavorLadyEnableScriptContexts(void);
void FieldCallback_QuizLadyEnableScriptContexts(void);
void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady);
bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock);
void BufferContestLadyMonName(u8 *dest1, u8 *dest2);
void BufferContestLadyPlayerName(u8 *dest);

View File

@ -266,7 +266,7 @@ static const u16 sQuizLadyQuizAnswers[] =
EC_WORD_PLUSH_DOLL,
EC_WORD_ICE,
EC_WORD_FIGHTING,
EC_WORD_DARK // DARK is accepted as the correct answer despite the fact that it's wrong
EC_WORD_DARK
};
static const u16 sQuizLadyPrizes[] =
@ -290,7 +290,7 @@ static const u16 sQuizLadyPrizes[] =
};
// Favor Lady data
static const u8 *const sFavorLadyDescriptions[] =
static const u8 *const sFavorLadyRequests[] =
{
gText_FavorLady_Slippery,
gText_FavorLady_Roundish,

View File

@ -30,6 +30,7 @@
#include "constants/easy_chat.h"
#include "constants/event_objects.h"
#include "constants/flags.h"
#include "constants/lilycove_lady.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/rgb.h"
@ -1305,7 +1306,7 @@ void ShowEasyChatScreen(void)
displayedPersonType = EASY_CHAT_PERSON_BOY;
break;
case EASY_CHAT_TYPE_QUIZ_ANSWER:
words = &gSaveBlock1Ptr->lilycoveLady.quiz.response;
words = &gSaveBlock1Ptr->lilycoveLady.quiz.playerAnswer;
break;
case EASY_CHAT_TYPE_QUIZ_QUESTION:
return;
@ -1313,7 +1314,7 @@ void ShowEasyChatScreen(void)
words = gSaveBlock1Ptr->lilycoveLady.quiz.question;
break;
case EASY_CHAT_TYPE_QUIZ_SET_ANSWER:
words = &gSaveBlock1Ptr->lilycoveLady.quiz.answer;
words = &gSaveBlock1Ptr->lilycoveLady.quiz.correctAnswer;
break;
case EASY_CHAT_TYPE_APPRENTICE:
words = gSaveBlock2Ptr->apprentices[0].easyChatWords;
@ -1343,7 +1344,7 @@ static void sub_811A7E4(void)
if (!gPaletteFade.active)
{
lilycoveLady = &gSaveBlock1Ptr->lilycoveLady;
lilycoveLady->quiz.response = -1;
lilycoveLady->quiz.playerAnswer = -1;
CleanupOverworldWindowsAndTilemaps();
DoQuizQuestionEasyChatScreen();
}
@ -1387,7 +1388,7 @@ static void DoQuizAnswerEasyChatScreen(void)
{
DoEasyChatScreen(
EASY_CHAT_TYPE_QUIZ_ANSWER,
&gSaveBlock1Ptr->lilycoveLady.quiz.response,
&gSaveBlock1Ptr->lilycoveLady.quiz.playerAnswer,
CB2_ReturnToFieldContinueScript,
EASY_CHAT_PERSON_DISPLAY_NONE);
}
@ -1403,7 +1404,7 @@ static void DoQuizQuestionEasyChatScreen(void)
static void DoQuizSetAnswerEasyChatScreen(void)
{
DoEasyChatScreen(EASY_CHAT_TYPE_QUIZ_SET_ANSWER,
&gSaveBlock1Ptr->lilycoveLady.quiz.answer,
&gSaveBlock1Ptr->lilycoveLady.quiz.correctAnswer,
CB2_ReturnToFieldContinueScript,
EASY_CHAT_PERSON_DISPLAY_NONE);
}
@ -2660,7 +2661,7 @@ static int sub_811BD64(void)
return sub_811BCF4();
saveBlock1 = gSaveBlock1Ptr;
for (i = 0; i < 9; i++)
for (i = 0; i < QUIZ_QUESTION_LEN; i++)
{
if (saveBlock1->lilycoveLady.quiz.question[i] != 0xFFFF)
return 0;
@ -2676,7 +2677,7 @@ static int sub_811BDB0(void)
return sub_811BCF4();
quiz = &gSaveBlock1Ptr->lilycoveLady.quiz;
return quiz->answer == 0xFFFF ? 1 : 0;
return quiz->correctAnswer == 0xFFFF ? 1 : 0;
}
static void sub_811BDF0(u8 *arg0)

View File

@ -118,9 +118,9 @@ void sub_81AD9C0(u8);
void sub_81ADB14(u8);
void sub_81ADA7C(u8);
void sub_81ADC0C(u8);
void bag_menu_leave_maybe_3(void);
void bag_menu_leave_maybe_2(void);
void bag_menu_leave_maybe(void);
void CB2_FavorLadyExitBagMenu(void);
void CB2_QuizLadyExitBagMenu(void);
void sub_81ABA6C(void);
static void SetPocketListPositions(void);
void sub_81ABAE0(void);
@ -493,20 +493,20 @@ void sub_81AAC14(void)
void sub_81AAC28(void)
{
GoToBagMenu(RETURN_LOCATION_FIELD_6, POCKETS_COUNT, bag_menu_leave_maybe_3);
GoToBagMenu(RETURN_LOCATION_FIELD_6, POCKETS_COUNT, bag_menu_leave_maybe);
gSpecialVar_0x8005 = 0;
gSpecialVar_Result = 0;
}
void sub_81AAC50(void)
void FavorLadyOpenBagMenu(void)
{
GoToBagMenu(RETURN_LOCATION_FIELD_4, POCKETS_COUNT, bag_menu_leave_maybe_2);
GoToBagMenu(RETURN_LOCATION_FIELD_4, POCKETS_COUNT, CB2_FavorLadyExitBagMenu);
gSpecialVar_Result = 0;
}
void sub_81AAC70(void)
void QuizLadyOpenBagMenu(void)
{
GoToBagMenu(RETURN_LOCATION_FIELD_5, POCKETS_COUNT, bag_menu_leave_maybe);
GoToBagMenu(RETURN_LOCATION_FIELD_5, POCKETS_COUNT, CB2_QuizLadyExitBagMenu);
gSpecialVar_Result = 0;
}
@ -2202,7 +2202,7 @@ void unknown_ItemMenu_Show(u8 taskId)
unknown_ItemMenu_Confirm(taskId);
}
void bag_menu_leave_maybe_3(void)
void bag_menu_leave_maybe(void)
{
gFieldCallback = Apprentice_EnableBothScriptContexts;
SetMainCallback2(CB2_ReturnToField);
@ -2216,9 +2216,9 @@ void unknown_ItemMenu_Give2(u8 taskId)
unknown_ItemMenu_Confirm(taskId);
}
void bag_menu_leave_maybe_2(void)
void CB2_FavorLadyExitBagMenu(void)
{
gFieldCallback = sub_818DEF4;
gFieldCallback = FieldCallback_FavorLadyEnableScriptContexts;
SetMainCallback2(CB2_ReturnToField);
}
@ -2229,9 +2229,9 @@ void unknown_ItemMenu_Confirm2(u8 taskId)
unknown_ItemMenu_Confirm(taskId);
}
void bag_menu_leave_maybe(void)
void CB2_QuizLadyExitBagMenu(void)
{
gFieldCallback = sub_818E564;
gFieldCallback = FieldCallback_QuizLadyEnableScriptContexts;
SetMainCallback2(CB2_ReturnToField);
}

View File

@ -15,44 +15,17 @@
#include "easy_chat.h"
#include "lilycove_lady.h"
#include "contest.h"
#include "berry.h"
#include "strings.h"
// TODO use array count macro?
#define QUIZ_QUESTION_LEN 9 //len of sQuizLadyQuestion#
#define NUM_QUIZ_QUESTIONS 16 //len of sQuizLadyQuizQuestions
#define FAVOR_DESCRIPTION_NUM 6 //len of sFavorLadyDescriptions
// TODO not a great name? The number of successes required to receive
// an item from the favor lady. Reached automatically if the randomly
// selected 'best' item is given to her
#define FAVOR_GIFT_MAX 5
enum
{
QUIZ_AUTHOR_LADY,
QUIZ_AUTHOR_PLAYER,
QUIZ_AUTHOR_OTHER_PLAYER
};
enum
{
LILYCOVE_LADY_STATE_READY,
LILYCOVE_LADY_STATE_COMPLETED,
LILYCOVE_LADY_STATE_PRIZE
};
#include "constants/lilycove_lady.h"
#include "data/lilycove_lady.h"
static void InitLilycoveQuizLady(void);
static void InitLilycoveFavorLady(void);
static void InitLilycoveContestLady(void);
static void ReadyQuizLady(void);
static void ReadyFavorLady(void);
static void ReadyContestLady(void);
static u8 BufferAuthorName(void);
static void ResetQuizLadyForRecordMix(void);
static void ResetFavorLadyForRecordMix(void);
static void ResetContestLadyForRecordMix(void);
static u8 BufferQuizAuthorName(void);
static bool8 IsQuizTrainerIdNotPlayer(void);
static u8 GetPlayerNameLength(const u8 *);
@ -86,10 +59,8 @@ void SetLilycoveLadyGfx(void)
void InitLilycoveLady(void)
{
u16 id;
id = ((gSaveBlock2Ptr->playerTrainerId[1] << 8) | gSaveBlock2Ptr->playerTrainerId[0]);
id %= 6; //TODO num lilycove ladies * 2. constant?
u16 id = ((gSaveBlock2Ptr->playerTrainerId[1] << 8) | gSaveBlock2Ptr->playerTrainerId[0]);
id %= 6;
id >>= 1;
switch (id)
{
@ -105,29 +76,27 @@ void InitLilycoveLady(void)
}
}
// Used after mixing records
void ReadyLilycoveLady(void)
void ResetLilycoveLadyForRecordMix(void)
{
switch (GetLilycoveLadyId())
{
case LILYCOVE_LADY_QUIZ:
ReadyQuizLady();
ResetQuizLadyForRecordMix();
break;
case LILYCOVE_LADY_FAVOR:
ReadyFavorLady();
ResetFavorLadyForRecordMix();
break;
case LILYCOVE_LADY_CONTEST:
ReadyContestLady();
ResetContestLadyForRecordMix();
break;
}
}
// Unused?
// Unused
void InitLilycoveLadyRandomly(void)
{
u8 lady;
u8 lady = Random() % LILYCOVE_LADY_COUNT;
lady = Random() % LILYCOVE_LADY_COUNT;
switch (lady)
{
case LILYCOVE_LADY_QUIZ:
@ -179,7 +148,7 @@ static void InitLilycoveFavorLady(void)
FavorLadyPickFavorAndBestItem();
}
static void ReadyFavorLady(void)
static void ResetFavorLadyForRecordMix(void)
{
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
sFavorLadyPtr->id = LILYCOVE_LADY_FAVOR;
@ -203,18 +172,18 @@ u8 GetFavorLadyState(void)
}
}
static const u8 *GetFavorLadyDescription(u8 idx)
static const u8 *GetFavorLadyRequest(u8 idx)
{
return sFavorLadyDescriptions[idx];
return sFavorLadyRequests[idx];
}
void BufferFavorLadyDescription(void)
void BufferFavorLadyRequest(void)
{
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
StringCopy(gStringVar1, GetFavorLadyDescription(sFavorLadyPtr->favorId));
StringCopy(gStringVar1, GetFavorLadyRequest(sFavorLadyPtr->favorId));
}
bool8 sub_818DC60(void)
bool8 HasAnotherPlayerGivenFavorLadyItem(void)
{
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
if (sFavorLadyPtr->playerName[0] != EOS)
@ -250,19 +219,19 @@ void BufferFavorLadyPlayerName(void)
ConvertInternationalString(gStringVar3, sFavorLadyPtr->language);
}
// Only used to determine if a record-mixed player had given her an item she liked
bool8 DidFavorLadyLikeItem(void)
{
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
return sFavorLadyPtr->likedItem ? TRUE : FALSE;
}
void FavorLadyOpenBagMenu(void)
void Script_FavorLadyOpenBagMenu(void)
{
sub_81AAC50();
FavorLadyOpenBagMenu();
}
//TODO rename?
static bool8 ShowFavorLadyItem(u16 itemId)
static bool8 DoesFavorLadyLikeItem(u16 itemId)
{
u8 numItems;
u8 i;
@ -285,7 +254,7 @@ static bool8 ShowFavorLadyItem(u16 itemId)
sFavorLadyPtr->likedItem = TRUE;
if (sFavorLadyPtr->bestItem == itemId)
{
sFavorLadyPtr->numItemsGiven = FAVOR_GIFT_MAX;
sFavorLadyPtr->numItemsGiven = LILYCOVE_LADY_GIFT_THRESHOLD;
}
break;
}
@ -294,35 +263,34 @@ static bool8 ShowFavorLadyItem(u16 itemId)
return likedItem;
}
bool8 Script_ShowFavorLadyItem(void)
bool8 Script_DoesFavorLadyLikeItem(void)
{
return ShowFavorLadyItem(gSpecialVar_ItemId);
return DoesFavorLadyLikeItem(gSpecialVar_ItemId);
}
//was item given the best item / have they given her 5 items
bool8 DidFavorLadyLoveItem(void)
bool8 IsFavorLadyThresholdMet(void)
{
u8 checkval;
u8 numItemsGiven;
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
checkval = sFavorLadyPtr->numItemsGiven;
return checkval < FAVOR_GIFT_MAX ? FALSE : TRUE;
numItemsGiven = sFavorLadyPtr->numItemsGiven;
return numItemsGiven < LILYCOVE_LADY_GIFT_THRESHOLD ? FALSE : TRUE;
}
static void BufferPrizeName(u16 itemId)
static void FavorLadyBufferPrizeName(u16 prize)
{
BufferItemName(gStringVar2, itemId);
BufferItemName(gStringVar2, prize);
}
u16 FavorLadyGetPrize(void)
{
u16 itemId;
u16 prize;
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
itemId = sFavorLadyPrizes[sFavorLadyPtr->favorId];
BufferPrizeName(itemId);
prize = sFavorLadyPrizes[sFavorLadyPtr->favorId];
FavorLadyBufferPrizeName(prize);
sFavorLadyPtr->state = LILYCOVE_LADY_STATE_PRIZE;
return itemId;
return prize;
}
void SetFavorLadyState_Complete(void)
@ -331,12 +299,12 @@ void SetFavorLadyState_Complete(void)
sFavorLadyPtr->state = LILYCOVE_LADY_STATE_COMPLETED;
}
void sub_818DEF4(void)
void FieldCallback_FavorLadyEnableScriptContexts(void)
{
EnableBothScriptContexts();
}
static void PickQuizQuestion(void)
static void QuizLadyPickQuestion(void)
{
u8 questionId;
u8 i;
@ -346,8 +314,8 @@ static void PickQuizQuestion(void)
{
sQuizLadyPtr->question[i] = sQuizLadyQuizQuestions[questionId][i];
}
sQuizLadyPtr->answer = sQuizLadyQuizAnswers[questionId];
sQuizLadyPtr->itemId = sQuizLadyPrizes[questionId];
sQuizLadyPtr->correctAnswer = sQuizLadyQuizAnswers[questionId];
sQuizLadyPtr->prize = sQuizLadyPrizes[questionId];
sQuizLadyPtr->questionId = questionId;
sQuizLadyPtr->playerName[0] = EOS;
}
@ -363,26 +331,26 @@ static void InitLilycoveQuizLady(void)
{
sQuizLadyPtr->question[i] = -1;
}
sQuizLadyPtr->answer = -1;
sQuizLadyPtr->response = -1;
sQuizLadyPtr->correctAnswer = -1;
sQuizLadyPtr->playerAnswer = -1;
for (i = 0; i < 4; i ++)
{
sQuizLadyPtr->playerTrainerId[i] = 0;
}
sQuizLadyPtr->itemId = ITEM_NONE;
sQuizLadyPtr->prize = ITEM_NONE;
sQuizLadyPtr->waitingForChallenger = FALSE;
sQuizLadyPtr->prevQuestionId = NUM_QUIZ_QUESTIONS;
sQuizLadyPtr->language = gGameLanguage;
PickQuizQuestion();
QuizLadyPickQuestion();
}
static void ReadyQuizLady(void)
static void ResetQuizLadyForRecordMix(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
sQuizLadyPtr->id = LILYCOVE_LADY_QUIZ;
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_READY;
sQuizLadyPtr->waitingForChallenger = FALSE;
sQuizLadyPtr->response = -1;
sQuizLadyPtr->playerAnswer = -1;
}
u8 GetQuizLadyState(void)
@ -402,19 +370,15 @@ u8 GetQuizLadyState(void)
}
}
// TODO enum? another enum might be excessive. why did GF swap the order from AUTHOR
// 0: waiting for someone to attempt player's quiz
// 1: ready to attempt other player's quiz
// 2: ready to attempt lady's quiz
u8 GetQuizAuthor(void)
{
int i;
int j;
u8 author;
u8 authorNameId;
struct LilycoveLadyQuiz *quiz;
quiz = &gSaveBlock1Ptr->lilycoveLady.quiz;
if (sub_811F8D8(quiz->answer) == 0)
if (sub_811F8D8(quiz->correctAnswer) == 0)
{
i = quiz->questionId;
do
@ -428,38 +392,38 @@ u8 GetQuizAuthor(void)
{
quiz->question[j] = sQuizLadyQuizQuestions[i][j];
}
quiz->answer = sQuizLadyQuizAnswers[i];
quiz->itemId = sQuizLadyPrizes[i];
quiz->correctAnswer = sQuizLadyQuizAnswers[i];
quiz->prize = sQuizLadyPrizes[i];
quiz->questionId = i;
quiz->playerName[0] = EOS;
}
author = BufferAuthorName();
if (author == QUIZ_AUTHOR_LADY)
authorNameId = BufferQuizAuthorName();
if (authorNameId == QUIZ_AUTHOR_NAME_LADY)
{
return 2;
return QUIZ_AUTHOR_LADY;
}
else if (author == QUIZ_AUTHOR_OTHER_PLAYER || IsQuizTrainerIdNotPlayer())
else if (authorNameId == QUIZ_AUTHOR_NAME_OTHER_PLAYER || IsQuizTrainerIdNotPlayer())
{
return 1;
return QUIZ_AUTHOR_OTHER_PLAYER;
}
else
{
return 0;
return QUIZ_AUTHOR_PLAYER;
}
}
static u8 BufferAuthorName(void)
static u8 BufferQuizAuthorName(void)
{
u8 author;
u8 authorNameId;
u8 nameLen;
u8 i;
author = QUIZ_AUTHOR_PLAYER;
authorNameId = QUIZ_AUTHOR_NAME_PLAYER;
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
if (sQuizLadyPtr->playerName[0] == EOS)
{
StringCopy7(gStringVar1, gText_QuizLady_Lady);
author = QUIZ_AUTHOR_LADY;
authorNameId = QUIZ_AUTHOR_NAME_LADY;
}
else
{
@ -474,14 +438,14 @@ static u8 BufferAuthorName(void)
name = sQuizLadyPtr->playerName;
if (name[i] != gSaveBlock2Ptr->playerName[i])
{
author = QUIZ_AUTHOR_OTHER_PLAYER;
authorNameId = QUIZ_AUTHOR_NAME_OTHER_PLAYER;
break;
}
}
}
}
return author;
return authorNameId;
}
static bool8 IsQuizTrainerIdNotPlayer(void)
@ -511,15 +475,15 @@ static u8 GetPlayerNameLength(const u8 *playerName)
return len;
}
void sub_818E274(void)
void BufferQuizPrizeName(void)
{
StringCopy(gStringVar1, ItemId_GetName(sQuizLadyPtr->itemId));
StringCopy(gStringVar1, ItemId_GetName(sQuizLadyPtr->prize));
}
bool8 sub_818E298(void)
bool8 BufferQuizAuthorNameAndCheckIfLady(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
if (BufferAuthorName() == QUIZ_AUTHOR_LADY)
if (BufferQuizAuthorName() == QUIZ_AUTHOR_NAME_LADY)
{
sQuizLadyPtr->language = gGameLanguage;
return TRUE;
@ -533,23 +497,23 @@ bool8 IsQuizLadyWaitingForChallenger(void)
return sQuizLadyPtr->waitingForChallenger;
}
void QuizLadyShowEasyChatScreen(void)
void QuizLadyGetPlayerAnswer(void)
{
ShowEasyChatScreen();
}
bool8 sub_818E308(void)
bool8 IsQuizAnswerCorrect(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
CopyEasyChatWord(gStringVar1, sQuizLadyPtr->answer);
CopyEasyChatWord(gStringVar2, sQuizLadyPtr->response);
CopyEasyChatWord(gStringVar1, sQuizLadyPtr->correctAnswer);
CopyEasyChatWord(gStringVar2, sQuizLadyPtr->playerAnswer);
return StringCompare(gStringVar1, gStringVar2) ? FALSE : TRUE;
}
void BufferQuizPrizeItem(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
gSpecialVar_0x8005 = sQuizLadyPtr->itemId;
gSpecialVar_0x8005 = sQuizLadyPtr->prize;
}
void SetQuizLadyState_Complete(void)
@ -564,21 +528,21 @@ void SetQuizLadyState_GivePrize(void)
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_PRIZE;
}
void ClearQuizLadyResponse(void)
void ClearQuizLadyPlayerAnswer(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
sQuizLadyPtr->response = -1;
sQuizLadyPtr->playerAnswer = -1;
}
void sub_818E3E0(void)
void Script_QuizLadyOpenBagMenu(void)
{
sub_81AAC70();
QuizLadyOpenBagMenu();
}
void sub_818E3EC(void)
void QuizLadyPickNewQuestion(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
if (sub_818E298())
if (BufferQuizAuthorNameAndCheckIfLady())
{
sQuizLadyPtr->prevQuestionId = sQuizLadyPtr->questionId;
}
@ -586,10 +550,10 @@ void sub_818E3EC(void)
{
sQuizLadyPtr->prevQuestionId = NUM_QUIZ_QUESTIONS;
}
PickQuizQuestion();
QuizLadyPickQuestion();
}
void sub_818E430(void)
void ClearQuizLadyQuestionAndAnswer(void)
{
u8 i;
@ -598,26 +562,26 @@ void sub_818E430(void)
{
sQuizLadyPtr->question[i] = -1;
}
sQuizLadyPtr->answer = -1;
sQuizLadyPtr->correctAnswer = -1;
}
void sub_818E47C(void)
void QuizLadySetCustomQuestion(void)
{
gSpecialVar_0x8004 = EASY_CHAT_TYPE_QUIZ_SET_QUESTION;
ShowEasyChatScreen();
}
void sub_818E490(void)
void QuizLadyTakePrizeForCustomQuiz(void)
{
RemoveBagItem(gSpecialVar_ItemId, 1);
}
void sub_818E4A4(void)
void QuizLadyRecordCustomQuizData(void)
{
u8 i;
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
sQuizLadyPtr->itemId = gSpecialVar_ItemId;
sQuizLadyPtr->prize = gSpecialVar_ItemId;
for (i = 0; i < 4; i ++)
{
sQuizLadyPtr->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
@ -626,24 +590,25 @@ void sub_818E4A4(void)
sQuizLadyPtr->language = gGameLanguage;
}
void sub_818E510(void)
void QuizLadySetWaitingForChallenger(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
sQuizLadyPtr->waitingForChallenger = TRUE;
}
void sub_818E538(void)
void BufferQuizCorrectAnswer(void)
{
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
CopyEasyChatWord(gStringVar3, sQuizLadyPtr->answer);
CopyEasyChatWord(gStringVar3, sQuizLadyPtr->correctAnswer);
}
void sub_818E564(void)
void FieldCallback_QuizLadyEnableScriptContexts(void)
{
EnableBothScriptContexts();
}
void sub_818E570(const LilycoveLady *lilycoveLady)
void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady)
{
u8 i;
@ -669,9 +634,9 @@ void sub_818E570(const LilycoveLady *lilycoveLady)
static void ResetContestLadyContestData(void)
{
sContestLadyPtr->playerName[0] = EOS;
sContestLadyPtr->fave_pkblk = 0;
sContestLadyPtr->other_pkblk = 0;
sContestLadyPtr->max_sheen = 0;
sContestLadyPtr->numGoodPokeblocksGiven = 0;
sContestLadyPtr->numOtherPokeblocksGiven = 0;
sContestLadyPtr->maxSheen = 0;
sContestLadyPtr->category = Random() % CONTEST_CATEGORIES_COUNT;
}
@ -684,24 +649,24 @@ static void InitLilycoveContestLady(void)
sContestLadyPtr->language = gGameLanguage;
}
static void ReadyContestLady(void)
static void ResetContestLadyForRecordMix(void)
{
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
sContestLadyPtr->id = LILYCOVE_LADY_CONTEST;
sContestLadyPtr->givenPokeblock = FALSE;
if (sContestLadyPtr->fave_pkblk == FLAVOR_COUNT
|| sContestLadyPtr->other_pkblk == FLAVOR_COUNT)
if (sContestLadyPtr->numGoodPokeblocksGiven == LILYCOVE_LADY_GIFT_THRESHOLD
|| sContestLadyPtr->numOtherPokeblocksGiven == LILYCOVE_LADY_GIFT_THRESHOLD)
{
ResetContestLadyContestData();
}
}
static void sub_818E6B0(u8 sheen)
static void ContestLadySavePlayerNameIfHighSheen(u8 sheen)
{
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
if (sContestLadyPtr->max_sheen <= sheen)
if (sContestLadyPtr->maxSheen <= sheen)
{
sContestLadyPtr->max_sheen = sheen;
sContestLadyPtr->maxSheen = sheen;
memset(sContestLadyPtr->playerName, EOS, sizeof(sContestLadyPtr->playerName));
memcpy(sContestLadyPtr->playerName, gSaveBlock2Ptr->playerName, sizeof(sContestLadyPtr->playerName));
sContestLadyPtr->language = gGameLanguage;
@ -710,11 +675,9 @@ static void sub_818E6B0(u8 sheen)
bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock)
{
u8 sheen;
bool8 response;
u8 sheen = 0;
bool8 correctFlavor = FALSE;
sheen = 0;
response = FALSE;
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
switch (sContestLadyPtr->category)
{
@ -722,48 +685,48 @@ bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock)
if (pokeblock->spicy != 0)
{
sheen = pokeblock->spicy;
response = TRUE;
correctFlavor = TRUE;
}
break;
case CONTEST_CATEGORY_BEAUTY:
if (pokeblock->dry != 0)
{
sheen = pokeblock->dry;
response = TRUE;
correctFlavor = TRUE;
}
break;
case CONTEST_CATEGORY_CUTE:
if (pokeblock->sweet != 0)
{
sheen = pokeblock->sweet;
response = TRUE;
correctFlavor = TRUE;
}
break;
case CONTEST_CATEGORY_SMART:
if (pokeblock->bitter != 0)
{
sheen = pokeblock->bitter;
response = TRUE;
correctFlavor = TRUE;
}
break;
case CONTEST_CATEGORY_TOUGH:
if (pokeblock->sour != 0)
{
sheen = pokeblock->sour;
response = TRUE;
correctFlavor = TRUE;
}
break;
}
if (response == TRUE)
if (correctFlavor == TRUE)
{
sub_818E6B0(sheen);
sContestLadyPtr->fave_pkblk ++;
ContestLadySavePlayerNameIfHighSheen(sheen);
sContestLadyPtr->numGoodPokeblocksGiven++;
}
else
{
sContestLadyPtr->other_pkblk ++;
sContestLadyPtr->numOtherPokeblocksGiven++;
}
return response;
return correctFlavor;
}
static void BufferContestLadyCategoryAndMonName(u8 *dest1, u8 *dest2)
@ -797,14 +760,18 @@ void BufferContestName(u8 *dest, u8 category)
StringCopy(dest, sContestNames[category]);
}
// used in tv.c to determine sTVShowState for Contest Lady show
// if return val is 1, sTVShowState is 1
// if return val is 2, sTVShowState is 3
// if return val is 0, sTVShowState is 2
u8 sub_818E880(void)
{
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
if (sContestLadyPtr->fave_pkblk >= FLAVOR_COUNT)
if (sContestLadyPtr->numGoodPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD)
{
return 1;
}
else if (sContestLadyPtr->fave_pkblk == 0)
else if (sContestLadyPtr->numGoodPokeblocksGiven == 0)
{
return 2;
}
@ -814,7 +781,8 @@ u8 sub_818E880(void)
}
}
bool8 sub_818E8B4(void)
bool8 HasPlayerGivenContestLadyPokeblock(void)
{
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
if (sContestLadyPtr->givenPokeblock == TRUE)
@ -824,22 +792,20 @@ bool8 sub_818E8B4(void)
return FALSE;
}
bool8 sub_818E8E0(void)
bool8 ShouldContestLadyShowGoOnAir(void)
{
bool8 response;
bool8 putOnAir = FALSE;
response = FALSE;
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
if (sContestLadyPtr->fave_pkblk >= FLAVOR_COUNT
|| sContestLadyPtr->other_pkblk >= FLAVOR_COUNT)
if (sContestLadyPtr->numGoodPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD
|| sContestLadyPtr->numOtherPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD)
{
response = TRUE;
putOnAir = TRUE;
}
return response;
return putOnAir;
}
// called when mon enjoys pokeblock
void sub_818E914(void)
void Script_BufferContestLadyCategoryAndMonName(void)
{
BufferContestLadyCategoryAndMonName(gStringVar2, gStringVar1);
}
@ -849,7 +815,7 @@ void OpenPokeblockCaseForContestLady(void)
OpenPokeblockCase(3, CB2_ReturnToField);
}
void ContestLadyGivenPokeblock(void)
void SetContestLadyGivenPokeblock(void)
{
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
sContestLadyPtr->givenPokeblock = TRUE;

View File

@ -701,10 +701,10 @@ static void ReceiveLilycoveLadyData(LilycoveLady *lilycoveLady, size_t recordSiz
}
memcpy(sLilycoveLadySave, (void *)lilycoveLady + recordSize * mixIndices[which], sizeof(LilycoveLady));
ReadyLilycoveLady();
ResetLilycoveLadyForRecordMix();
if (dest != NULL)
{
sub_818E570(dest);
QuizLadyClearQuestionForRecordMix(dest);
free(dest);
}
}