2017-09-19 22:17:23 +02:00
|
|
|
#include "global.h"
|
2017-09-19 22:55:53 +02:00
|
|
|
#include "main.h"
|
2017-10-12 09:06:19 +02:00
|
|
|
#include "overworld.h"
|
2018-12-24 22:19:40 +01:00
|
|
|
#include "fldeff.h"
|
|
|
|
#include "field_specials.h"
|
|
|
|
#include "pokeblock.h"
|
2017-09-19 22:17:23 +02:00
|
|
|
#include "event_data.h"
|
2017-09-20 03:58:32 +02:00
|
|
|
#include "script.h"
|
2017-12-05 19:27:33 +01:00
|
|
|
#include "random.h"
|
2017-09-19 23:04:17 +02:00
|
|
|
#include "string_util.h"
|
2017-09-20 03:28:01 +02:00
|
|
|
#include "item.h"
|
2017-12-05 18:55:48 +01:00
|
|
|
#include "constants/items.h"
|
2017-09-20 03:47:15 +02:00
|
|
|
#include "item_menu.h"
|
2017-09-19 23:07:36 +02:00
|
|
|
#include "text.h"
|
2017-09-20 17:44:20 +02:00
|
|
|
#include "easy_chat.h"
|
2017-09-19 22:17:23 +02:00
|
|
|
#include "lilycove_lady.h"
|
2019-08-04 10:22:19 +02:00
|
|
|
#include "contest.h"
|
|
|
|
#include "strings.h"
|
2019-08-06 02:37:09 +02:00
|
|
|
#include "constants/lilycove_lady.h"
|
2019-08-18 07:35:30 +02:00
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
#include "data/lilycove_lady.h"
|
2017-09-19 22:17:23 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static void InitLilycoveQuizLady(void);
|
2019-08-04 10:38:59 +02:00
|
|
|
static void InitLilycoveFavorLady(void);
|
2019-08-04 10:22:19 +02:00
|
|
|
static void InitLilycoveContestLady(void);
|
2019-08-06 02:37:09 +02:00
|
|
|
static void ResetQuizLadyForRecordMix(void);
|
|
|
|
static void ResetFavorLadyForRecordMix(void);
|
|
|
|
static void ResetContestLadyForRecordMix(void);
|
|
|
|
static u8 BufferQuizAuthorName(void);
|
2019-08-04 10:22:19 +02:00
|
|
|
static bool8 IsQuizTrainerIdNotPlayer(void);
|
|
|
|
static u8 GetPlayerNameLength(const u8 *);
|
2017-09-19 22:17:23 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static EWRAM_DATA struct LilycoveLadyFavor *sFavorLadyPtr = NULL;
|
|
|
|
static EWRAM_DATA struct LilycoveLadyQuiz *sQuizLadyPtr = NULL;
|
|
|
|
static EWRAM_DATA struct LilycoveLadyContest *sContestLadyPtr = NULL;
|
2017-09-20 22:32:37 +02:00
|
|
|
|
2017-11-11 01:12:18 +01:00
|
|
|
extern EWRAM_DATA u16 gSpecialVar_ItemId;
|
2017-09-19 22:17:23 +02:00
|
|
|
|
|
|
|
u8 GetLilycoveLadyId(void)
|
|
|
|
{
|
2017-09-20 22:49:22 +02:00
|
|
|
return gSaveBlock1Ptr->lilycoveLady.id;
|
2017-09-19 22:17:23 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
void SetLilycoveLadyGfx(void)
|
2017-09-19 22:17:23 +02:00
|
|
|
{
|
|
|
|
LilycoveLady *lilycoveLady;
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
VarSet(VAR_OBJ_GFX_ID_0, sLilycoveLadyGfxId[GetLilycoveLadyId()]);
|
2017-09-19 22:17:23 +02:00
|
|
|
if (GetLilycoveLadyId() == LILYCOVE_LADY_CONTEST)
|
|
|
|
{
|
|
|
|
lilycoveLady = &gSaveBlock1Ptr->lilycoveLady;
|
2019-08-04 10:22:19 +02:00
|
|
|
VarSet(VAR_OBJ_GFX_ID_1, sContestLadyMonGfxId[lilycoveLady->contest.category]);
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = TRUE;
|
2017-09-19 22:17:23 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = FALSE;
|
2017-09-19 22:17:23 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
void InitLilycoveLady(void)
|
2017-09-19 22:17:23 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
u16 id = ((gSaveBlock2Ptr->playerTrainerId[1] << 8) | gSaveBlock2Ptr->playerTrainerId[0]);
|
|
|
|
id %= 6;
|
2017-09-19 22:17:23 +02:00
|
|
|
id >>= 1;
|
|
|
|
switch (id)
|
|
|
|
{
|
|
|
|
case LILYCOVE_LADY_QUIZ:
|
2019-08-04 10:22:19 +02:00
|
|
|
InitLilycoveQuizLady();
|
2017-09-19 22:17:23 +02:00
|
|
|
break;
|
2019-08-04 10:38:59 +02:00
|
|
|
case LILYCOVE_LADY_FAVOR:
|
|
|
|
InitLilycoveFavorLady();
|
2017-09-19 22:17:23 +02:00
|
|
|
break;
|
|
|
|
case LILYCOVE_LADY_CONTEST:
|
2019-08-04 10:22:19 +02:00
|
|
|
InitLilycoveContestLady();
|
2017-09-19 22:17:23 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-09-19 22:21:50 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void ResetLilycoveLadyForRecordMix(void)
|
2017-09-19 22:21:50 +02:00
|
|
|
{
|
|
|
|
switch (GetLilycoveLadyId())
|
|
|
|
{
|
|
|
|
case LILYCOVE_LADY_QUIZ:
|
2019-08-06 02:37:09 +02:00
|
|
|
ResetQuizLadyForRecordMix();
|
2017-09-19 22:21:50 +02:00
|
|
|
break;
|
2019-08-04 10:38:59 +02:00
|
|
|
case LILYCOVE_LADY_FAVOR:
|
2019-08-06 02:37:09 +02:00
|
|
|
ResetFavorLadyForRecordMix();
|
2017-09-19 22:21:50 +02:00
|
|
|
break;
|
|
|
|
case LILYCOVE_LADY_CONTEST:
|
2019-08-06 02:37:09 +02:00
|
|
|
ResetContestLadyForRecordMix();
|
2017-09-19 22:21:50 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
// Unused
|
2019-08-05 05:12:49 +02:00
|
|
|
void InitLilycoveLadyRandomly(void)
|
2017-09-19 22:21:50 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
u8 lady = Random() % LILYCOVE_LADY_COUNT;
|
2017-09-19 22:21:50 +02:00
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
switch (lady)
|
2017-09-19 22:21:50 +02:00
|
|
|
{
|
|
|
|
case LILYCOVE_LADY_QUIZ:
|
2019-08-04 10:22:19 +02:00
|
|
|
InitLilycoveQuizLady();
|
2017-09-19 22:21:50 +02:00
|
|
|
break;
|
2019-08-04 10:38:59 +02:00
|
|
|
case LILYCOVE_LADY_FAVOR:
|
|
|
|
InitLilycoveFavorLady();
|
2017-09-19 22:21:50 +02:00
|
|
|
break;
|
|
|
|
case LILYCOVE_LADY_CONTEST:
|
2019-08-04 10:22:19 +02:00
|
|
|
InitLilycoveContestLady();
|
2017-09-19 22:21:50 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-09-19 22:24:42 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
void Script_GetLilycoveLadyId(void)
|
2017-09-19 22:24:42 +02:00
|
|
|
{
|
2017-11-11 01:12:18 +01:00
|
|
|
gSpecialVar_Result = GetLilycoveLadyId();
|
2017-09-19 22:24:42 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static u8 GetNumAcceptedItems(const u16 *itemsArray)
|
2017-09-19 22:24:42 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
u8 items;
|
2017-09-19 22:24:42 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
for (items = 0; *itemsArray != ITEM_NONE; items ++, itemsArray ++);
|
|
|
|
return items;
|
2017-09-19 22:24:42 +02:00
|
|
|
}
|
2017-09-19 22:32:33 +02:00
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
static void FavorLadyPickFavorAndBestItem(void)
|
2017-09-19 22:32:33 +02:00
|
|
|
{
|
2019-08-06 19:52:10 +02:00
|
|
|
u8 numItems;
|
|
|
|
u8 bestItem;
|
2017-09-19 22:32:33 +02:00
|
|
|
|
2019-08-06 19:52:10 +02:00
|
|
|
sFavorLadyPtr->favorId = Random() % ARRAY_COUNT(sFavorLadyRequests);
|
|
|
|
numItems = GetNumAcceptedItems(sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId]);
|
|
|
|
bestItem = Random() % numItems;
|
|
|
|
sFavorLadyPtr->bestItem = sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId][bestItem];
|
2017-09-19 22:32:33 +02:00
|
|
|
}
|
2017-09-19 22:55:53 +02:00
|
|
|
|
2019-08-04 10:38:59 +02:00
|
|
|
static void InitLilycoveFavorLady(void)
|
2017-09-19 22:55:53 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
|
|
|
sFavorLadyPtr->id = LILYCOVE_LADY_FAVOR;
|
2019-08-05 05:12:49 +02:00
|
|
|
sFavorLadyPtr->state = LILYCOVE_LADY_STATE_READY;
|
2019-08-04 10:22:19 +02:00
|
|
|
sFavorLadyPtr->playerName[0] = EOS;
|
2019-08-05 05:12:49 +02:00
|
|
|
sFavorLadyPtr->likedItem = FALSE;
|
|
|
|
sFavorLadyPtr->numItemsGiven = 0;
|
2019-08-04 10:22:19 +02:00
|
|
|
sFavorLadyPtr->itemId = ITEM_NONE;
|
|
|
|
sFavorLadyPtr->language = gGameLanguage;
|
2019-08-05 05:12:49 +02:00
|
|
|
FavorLadyPickFavorAndBestItem();
|
2017-09-19 22:55:53 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static void ResetFavorLadyForRecordMix(void)
|
2017-09-19 22:55:53 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
|
|
|
sFavorLadyPtr->id = LILYCOVE_LADY_FAVOR;
|
2019-08-05 05:12:49 +02:00
|
|
|
sFavorLadyPtr->state = LILYCOVE_LADY_STATE_READY;
|
2017-09-19 22:55:53 +02:00
|
|
|
}
|
2017-09-19 23:04:17 +02:00
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
u8 GetFavorLadyState(void)
|
2017-09-19 23:04:17 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-05 05:12:49 +02:00
|
|
|
if (sFavorLadyPtr->state == LILYCOVE_LADY_STATE_PRIZE)
|
2017-09-19 23:04:17 +02:00
|
|
|
{
|
2019-08-05 05:12:49 +02:00
|
|
|
return LILYCOVE_LADY_STATE_PRIZE;
|
2017-09-19 23:04:17 +02:00
|
|
|
}
|
2019-08-05 05:12:49 +02:00
|
|
|
else if (sFavorLadyPtr->state == LILYCOVE_LADY_STATE_COMPLETED)
|
2017-09-19 23:04:17 +02:00
|
|
|
{
|
2019-08-05 05:12:49 +02:00
|
|
|
return LILYCOVE_LADY_STATE_COMPLETED;
|
2017-09-19 23:04:17 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-05 05:12:49 +02:00
|
|
|
return LILYCOVE_LADY_STATE_READY;
|
2017-09-19 23:04:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static const u8 *GetFavorLadyRequest(u8 idx)
|
2017-09-19 23:04:17 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
return sFavorLadyRequests[idx];
|
2017-09-19 23:04:17 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void BufferFavorLadyRequest(void)
|
2017-09-19 23:04:17 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-06 02:37:09 +02:00
|
|
|
StringCopy(gStringVar1, GetFavorLadyRequest(sFavorLadyPtr->favorId));
|
2017-09-19 23:04:17 +02:00
|
|
|
}
|
2017-09-19 23:07:36 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
bool8 HasAnotherPlayerGivenFavorLadyItem(void)
|
2017-09-19 23:07:36 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-04 10:22:19 +02:00
|
|
|
if (sFavorLadyPtr->playerName[0] != EOS)
|
2017-09-19 23:07:36 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
StringCopy7(gStringVar3, sFavorLadyPtr->playerName);
|
|
|
|
ConvertInternationalString(gStringVar3, sFavorLadyPtr->language);
|
2017-09-19 23:07:36 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-09-20 03:28:01 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static void BufferItemName(u8 *dest, u16 itemId)
|
2017-09-20 03:28:01 +02:00
|
|
|
{
|
2018-04-29 13:36:26 +02:00
|
|
|
StringCopy(dest, ItemId_GetName(itemId));
|
2017-09-20 03:28:01 +02:00
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
void BufferFavorLadyItemName(void)
|
2017-09-20 03:28:01 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-04 10:22:19 +02:00
|
|
|
BufferItemName(gStringVar2, sFavorLadyPtr->itemId);
|
2017-09-20 03:28:01 +02:00
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
static void SetFavorLadyPlayerName(const u8 *src, u8 *dest)
|
2017-09-20 03:28:01 +02:00
|
|
|
{
|
|
|
|
memset(dest, 0xFF, 8);
|
|
|
|
StringCopy7(dest, src);
|
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
void BufferFavorLadyPlayerName(void)
|
2017-09-20 03:28:01 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-05 05:12:49 +02:00
|
|
|
SetFavorLadyPlayerName(sFavorLadyPtr->playerName, gStringVar3);
|
2019-08-04 10:22:19 +02:00
|
|
|
ConvertInternationalString(gStringVar3, sFavorLadyPtr->language);
|
2017-09-20 03:28:01 +02:00
|
|
|
}
|
2017-09-20 03:47:15 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
// Only used to determine if a record-mixed player had given her an item she liked
|
2019-08-05 05:12:49 +02:00
|
|
|
bool8 DidFavorLadyLikeItem(void)
|
2017-09-20 03:47:15 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-05 05:12:49 +02:00
|
|
|
return sFavorLadyPtr->likedItem ? TRUE : FALSE;
|
2017-09-20 03:47:15 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void Script_FavorLadyOpenBagMenu(void)
|
2017-09-20 03:47:15 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
FavorLadyOpenBagMenu();
|
2017-09-20 03:47:15 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static bool8 DoesFavorLadyLikeItem(u16 itemId)
|
2017-09-20 03:47:15 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
u8 numItems;
|
2017-09-20 03:47:15 +02:00
|
|
|
u8 i;
|
2019-08-05 05:12:49 +02:00
|
|
|
bool8 likedItem;
|
2017-09-20 03:47:15 +02:00
|
|
|
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-04 10:22:19 +02:00
|
|
|
numItems = GetNumAcceptedItems(sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId]);
|
2019-08-05 05:12:49 +02:00
|
|
|
sFavorLadyPtr->state = LILYCOVE_LADY_STATE_COMPLETED;
|
2019-08-04 10:22:19 +02:00
|
|
|
BufferItemName(gStringVar2, itemId);
|
|
|
|
sFavorLadyPtr->itemId = itemId;
|
2019-08-05 05:12:49 +02:00
|
|
|
SetFavorLadyPlayerName(gSaveBlock2Ptr->playerName, sFavorLadyPtr->playerName);
|
2019-08-04 10:22:19 +02:00
|
|
|
sFavorLadyPtr->language = gGameLanguage;
|
2019-08-05 05:12:49 +02:00
|
|
|
likedItem = FALSE;
|
2019-08-04 10:22:19 +02:00
|
|
|
for (i = 0; i < numItems; i ++)
|
2017-09-20 03:47:15 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
if (sFavorLadyAcceptedItemLists[sFavorLadyPtr->favorId][i] == itemId)
|
2017-09-20 03:47:15 +02:00
|
|
|
{
|
2019-08-05 05:12:49 +02:00
|
|
|
likedItem = TRUE;
|
|
|
|
sFavorLadyPtr->numItemsGiven++;
|
|
|
|
sFavorLadyPtr->likedItem = TRUE;
|
|
|
|
if (sFavorLadyPtr->bestItem == itemId)
|
2017-09-20 03:47:15 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
sFavorLadyPtr->numItemsGiven = LILYCOVE_LADY_GIFT_THRESHOLD;
|
2017-09-20 03:47:15 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2019-08-05 05:12:49 +02:00
|
|
|
sFavorLadyPtr->likedItem = FALSE;
|
2017-09-20 03:47:15 +02:00
|
|
|
}
|
2019-08-05 05:12:49 +02:00
|
|
|
return likedItem;
|
2017-09-20 03:47:15 +02:00
|
|
|
}
|
2017-09-20 03:58:32 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
bool8 Script_DoesFavorLadyLikeItem(void)
|
2017-09-20 03:58:32 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
return DoesFavorLadyLikeItem(gSpecialVar_ItemId);
|
2017-09-20 03:58:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
bool8 IsFavorLadyThresholdMet(void)
|
2017-09-20 03:58:32 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
u8 numItemsGiven;
|
2017-09-20 03:58:32 +02:00
|
|
|
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-06 02:37:09 +02:00
|
|
|
numItemsGiven = sFavorLadyPtr->numItemsGiven;
|
|
|
|
return numItemsGiven < LILYCOVE_LADY_GIFT_THRESHOLD ? FALSE : TRUE;
|
2017-09-20 03:58:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static void FavorLadyBufferPrizeName(u16 prize)
|
2017-09-20 03:58:32 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
BufferItemName(gStringVar2, prize);
|
2017-09-20 03:58:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
u16 FavorLadyGetPrize(void)
|
2017-09-20 03:58:32 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
u16 prize;
|
2017-09-20 03:58:32 +02:00
|
|
|
|
2019-08-04 10:38:59 +02:00
|
|
|
sFavorLadyPtr = &gSaveBlock1Ptr->lilycoveLady.favor;
|
2019-08-06 02:37:09 +02:00
|
|
|
prize = sFavorLadyPrizes[sFavorLadyPtr->favorId];
|
|
|
|
FavorLadyBufferPrizeName(prize);
|
2019-08-05 05:12:49 +02:00
|
|
|
sFavorLadyPtr->state = LILYCOVE_LADY_STATE_PRIZE;
|
2019-08-06 02:37:09 +02:00
|
|
|
return prize;
|
2017-09-20 03:58:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
void SetFavorLadyState_Complete(void)
|
2017-09-20 03:58:32 +02:00
|
|
|
{
|
2019-08-04 10:38:59 +02:00
|
|
|
InitLilycoveFavorLady();
|
2019-08-05 05:12:49 +02:00
|
|
|
sFavorLadyPtr->state = LILYCOVE_LADY_STATE_COMPLETED;
|
2017-09-20 03:58:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void FieldCallback_FavorLadyEnableScriptContexts(void)
|
2017-09-20 03:58:32 +02:00
|
|
|
{
|
|
|
|
EnableBothScriptContexts();
|
|
|
|
}
|
2017-09-20 04:25:31 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static void QuizLadyPickQuestion(void)
|
2017-09-20 04:25:31 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
u8 questionId;
|
2017-09-20 04:25:31 +02:00
|
|
|
u8 i;
|
2017-09-20 16:45:00 +02:00
|
|
|
|
2019-08-06 19:52:10 +02:00
|
|
|
questionId = Random() % ARRAY_COUNT(sQuizLadyQuizQuestions);
|
2019-08-04 10:22:19 +02:00
|
|
|
for (i = 0; i < QUIZ_QUESTION_LEN; i ++)
|
2017-09-20 04:25:31 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->question[i] = sQuizLadyQuizQuestions[questionId][i];
|
2017-09-20 04:25:31 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
sQuizLadyPtr->correctAnswer = sQuizLadyQuizAnswers[questionId];
|
|
|
|
sQuizLadyPtr->prize = sQuizLadyPrizes[questionId];
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->questionId = questionId;
|
|
|
|
sQuizLadyPtr->playerName[0] = EOS;
|
2017-09-20 04:25:31 +02:00
|
|
|
}
|
2017-09-20 04:35:40 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static void InitLilycoveQuizLady(void)
|
2017-09-20 04:35:40 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
|
|
|
sQuizLadyPtr->id = LILYCOVE_LADY_QUIZ;
|
2019-08-05 05:12:49 +02:00
|
|
|
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_READY;
|
2019-08-04 10:22:19 +02:00
|
|
|
for (i = 0; i < QUIZ_QUESTION_LEN; i ++)
|
2017-09-20 04:35:40 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->question[i] = -1;
|
2017-09-20 04:35:40 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
sQuizLadyPtr->correctAnswer = -1;
|
|
|
|
sQuizLadyPtr->playerAnswer = -1;
|
2019-08-06 19:52:10 +02:00
|
|
|
for (i = 0; i < TRAINER_ID_LENGTH; i ++)
|
2017-09-20 04:35:40 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->playerTrainerId[i] = 0;
|
2017-09-20 04:35:40 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
sQuizLadyPtr->prize = ITEM_NONE;
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->waitingForChallenger = FALSE;
|
2019-08-06 19:52:10 +02:00
|
|
|
sQuizLadyPtr->prevQuestionId = ARRAY_COUNT(sQuizLadyQuizQuestions);
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->language = gGameLanguage;
|
2019-08-06 02:37:09 +02:00
|
|
|
QuizLadyPickQuestion();
|
2017-09-20 04:35:40 +02:00
|
|
|
}
|
2017-09-20 04:57:22 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static void ResetQuizLadyForRecordMix(void)
|
2017-09-20 04:57:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
|
|
|
sQuizLadyPtr->id = LILYCOVE_LADY_QUIZ;
|
2019-08-05 05:12:49 +02:00
|
|
|
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_READY;
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->waitingForChallenger = FALSE;
|
2019-08-06 02:37:09 +02:00
|
|
|
sQuizLadyPtr->playerAnswer = -1;
|
2017-09-20 04:57:22 +02:00
|
|
|
}
|
2017-09-20 05:31:05 +02:00
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
u8 GetQuizLadyState(void)
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-05 05:12:49 +02:00
|
|
|
if (sQuizLadyPtr->state == LILYCOVE_LADY_STATE_PRIZE)
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
2019-08-05 05:12:49 +02:00
|
|
|
return LILYCOVE_LADY_STATE_PRIZE;
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
2019-08-05 05:12:49 +02:00
|
|
|
else if (sQuizLadyPtr->state == LILYCOVE_LADY_STATE_COMPLETED)
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
2019-08-05 05:12:49 +02:00
|
|
|
return LILYCOVE_LADY_STATE_COMPLETED;
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-05 05:12:49 +02:00
|
|
|
return LILYCOVE_LADY_STATE_READY;
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
u8 GetQuizAuthor(void)
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int j;
|
2019-08-06 02:37:09 +02:00
|
|
|
u8 authorNameId;
|
2017-09-20 05:31:05 +02:00
|
|
|
struct LilycoveLadyQuiz *quiz;
|
|
|
|
|
|
|
|
quiz = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
if (sub_811F8D8(quiz->correctAnswer) == 0)
|
2019-08-04 10:22:19 +02:00
|
|
|
{
|
|
|
|
i = quiz->questionId;
|
2017-09-20 05:31:05 +02:00
|
|
|
do
|
|
|
|
{
|
2019-08-06 19:52:10 +02:00
|
|
|
if (++ i >= (int)(ARRAY_COUNT(sQuizLadyQuizQuestions)))
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
|
|
|
i = 0;
|
|
|
|
}
|
2019-08-04 10:22:19 +02:00
|
|
|
} while (sub_811F8D8(sQuizLadyQuizAnswers[i]) == 0);
|
|
|
|
for (j = 0; j < QUIZ_QUESTION_LEN; j ++)
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
quiz->question[j] = sQuizLadyQuizQuestions[i][j];
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
quiz->correctAnswer = sQuizLadyQuizAnswers[i];
|
|
|
|
quiz->prize = sQuizLadyPrizes[i];
|
2019-08-04 10:22:19 +02:00
|
|
|
quiz->questionId = i;
|
2017-09-20 16:45:00 +02:00
|
|
|
quiz->playerName[0] = EOS;
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
authorNameId = BufferQuizAuthorName();
|
|
|
|
if (authorNameId == QUIZ_AUTHOR_NAME_LADY)
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
return QUIZ_AUTHOR_LADY;
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
else if (authorNameId == QUIZ_AUTHOR_NAME_OTHER_PLAYER || IsQuizTrainerIdNotPlayer())
|
2017-09-20 05:31:05 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
return QUIZ_AUTHOR_OTHER_PLAYER;
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
return QUIZ_AUTHOR_PLAYER;
|
2017-09-20 05:31:05 +02:00
|
|
|
}
|
|
|
|
}
|
2017-09-20 16:45:00 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static u8 BufferQuizAuthorName(void)
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
u8 authorNameId;
|
2019-08-04 10:22:19 +02:00
|
|
|
u8 nameLen;
|
2017-09-20 16:45:00 +02:00
|
|
|
u8 i;
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
authorNameId = QUIZ_AUTHOR_NAME_PLAYER;
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
|
|
|
if (sQuizLadyPtr->playerName[0] == EOS)
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-04 16:15:50 +02:00
|
|
|
StringCopy7(gStringVar1, gText_QuizLady_Lady);
|
2019-08-06 02:37:09 +02:00
|
|
|
authorNameId = QUIZ_AUTHOR_NAME_LADY;
|
2017-09-20 16:45:00 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
StringCopy7(gStringVar1, sQuizLadyPtr->playerName);
|
|
|
|
ConvertInternationalString(gStringVar1, sQuizLadyPtr->language);
|
|
|
|
nameLen = GetPlayerNameLength(sQuizLadyPtr->playerName);
|
|
|
|
if (nameLen == GetPlayerNameLength(gSaveBlock2Ptr->playerName))
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
u8 *name = sQuizLadyPtr->playerName;
|
|
|
|
for (i = 0; i < nameLen; i ++)
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
name = sQuizLadyPtr->playerName;
|
2018-02-28 19:37:48 +01:00
|
|
|
if (name[i] != gSaveBlock2Ptr->playerName[i])
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
authorNameId = QUIZ_AUTHOR_NAME_OTHER_PLAYER;
|
2017-09-20 16:45:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
return authorNameId;
|
2017-09-20 16:45:00 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static bool8 IsQuizTrainerIdNotPlayer(void)
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
bool8 notPlayer;
|
2017-09-20 16:45:00 +02:00
|
|
|
u8 i;
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
|
|
|
notPlayer = FALSE;
|
2019-08-06 19:52:10 +02:00
|
|
|
for (i = 0; i < TRAINER_ID_LENGTH; i ++)
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
if (sQuizLadyPtr->playerTrainerId[i] != gSaveBlock2Ptr->playerTrainerId[i])
|
2017-09-20 16:45:00 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
notPlayer = TRUE;
|
2017-09-20 16:45:00 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-08-04 10:22:19 +02:00
|
|
|
return notPlayer;
|
2017-09-20 16:45:00 +02:00
|
|
|
}
|
2017-09-20 17:25:46 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static u8 GetPlayerNameLength(const u8 *playerName)
|
2017-09-20 17:25:46 +02:00
|
|
|
{
|
|
|
|
u8 len;
|
|
|
|
const u8 *ptr;
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
for (len = 0, ptr = playerName; *ptr != EOS; len ++, ptr ++);
|
2017-09-20 17:25:46 +02:00
|
|
|
return len;
|
|
|
|
}
|
2017-09-20 17:30:09 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void BufferQuizPrizeName(void)
|
2017-09-20 17:30:09 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
StringCopy(gStringVar1, ItemId_GetName(sQuizLadyPtr->prize));
|
2017-09-20 17:30:09 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
bool8 BufferQuizAuthorNameAndCheckIfLady(void)
|
2017-09-20 17:30:09 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
if (BufferQuizAuthorName() == QUIZ_AUTHOR_NAME_LADY)
|
2017-09-20 17:30:09 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->language = gGameLanguage;
|
2017-09-20 17:30:09 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-09-20 17:44:20 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
bool8 IsQuizLadyWaitingForChallenger(void)
|
2017-09-20 17:44:20 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
|
|
|
return sQuizLadyPtr->waitingForChallenger;
|
2017-09-20 17:44:20 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void QuizLadyGetPlayerAnswer(void)
|
2017-09-20 17:44:20 +02:00
|
|
|
{
|
2019-02-27 19:45:31 +01:00
|
|
|
ShowEasyChatScreen();
|
2017-09-20 17:44:20 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
bool8 IsQuizAnswerCorrect(void)
|
2017-09-20 17:44:20 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
CopyEasyChatWord(gStringVar1, sQuizLadyPtr->correctAnswer);
|
|
|
|
CopyEasyChatWord(gStringVar2, sQuizLadyPtr->playerAnswer);
|
2017-09-20 17:44:20 +02:00
|
|
|
return StringCompare(gStringVar1, gStringVar2) ? FALSE : TRUE;
|
|
|
|
}
|
2017-09-20 17:48:11 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
void BufferQuizPrizeItem(void)
|
2017-09-20 17:48:11 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
gSpecialVar_0x8005 = sQuizLadyPtr->prize;
|
2017-09-20 17:48:11 +02:00
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
void SetQuizLadyState_Complete(void)
|
2017-09-20 17:48:11 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-05 05:12:49 +02:00
|
|
|
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_COMPLETED;
|
2017-09-20 17:48:11 +02:00
|
|
|
}
|
|
|
|
|
2019-08-05 05:12:49 +02:00
|
|
|
void SetQuizLadyState_GivePrize(void)
|
2017-09-20 17:48:11 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-05 05:12:49 +02:00
|
|
|
sQuizLadyPtr->state = LILYCOVE_LADY_STATE_PRIZE;
|
2017-09-20 17:48:11 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void ClearQuizLadyPlayerAnswer(void)
|
2017-09-20 17:48:11 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
sQuizLadyPtr->playerAnswer = -1;
|
2017-09-20 17:48:11 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void Script_QuizLadyOpenBagMenu(void)
|
2017-09-20 17:48:11 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
QuizLadyOpenBagMenu();
|
2017-09-20 17:48:11 +02:00
|
|
|
}
|
2017-09-20 18:56:45 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void QuizLadyPickNewQuestion(void)
|
2017-09-20 18:56:45 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
if (BufferQuizAuthorNameAndCheckIfLady())
|
2017-09-20 18:56:45 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->prevQuestionId = sQuizLadyPtr->questionId;
|
2017-09-20 18:56:45 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-06 19:52:10 +02:00
|
|
|
sQuizLadyPtr->prevQuestionId = ARRAY_COUNT(sQuizLadyQuizQuestions);
|
2017-09-20 18:56:45 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
QuizLadyPickQuestion();
|
2017-09-20 18:56:45 +02:00
|
|
|
}
|
2017-09-20 22:12:18 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void ClearQuizLadyQuestionAndAnswer(void)
|
2017-09-20 22:12:18 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
|
|
|
for (i = 0; i < QUIZ_QUESTION_LEN; i ++)
|
2017-09-20 22:12:18 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->question[i] = -1;
|
2017-09-20 22:12:18 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
sQuizLadyPtr->correctAnswer = -1;
|
2017-09-20 22:12:18 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void QuizLadySetCustomQuestion(void)
|
2017-09-20 22:12:18 +02:00
|
|
|
{
|
2019-02-27 19:45:31 +01:00
|
|
|
gSpecialVar_0x8004 = EASY_CHAT_TYPE_QUIZ_SET_QUESTION;
|
|
|
|
ShowEasyChatScreen();
|
2017-09-20 22:12:18 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void QuizLadyTakePrizeForCustomQuiz(void)
|
2017-09-20 22:12:18 +02:00
|
|
|
{
|
2017-11-11 01:12:18 +01:00
|
|
|
RemoveBagItem(gSpecialVar_ItemId, 1);
|
2017-09-20 22:12:18 +02:00
|
|
|
}
|
2017-09-20 22:32:37 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void QuizLadyRecordCustomQuizData(void)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
sQuizLadyPtr->prize = gSpecialVar_ItemId;
|
2019-08-06 19:52:10 +02:00
|
|
|
for (i = 0; i < TRAINER_ID_LENGTH; i ++)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
2017-09-20 22:32:37 +02:00
|
|
|
}
|
2019-08-04 10:22:19 +02:00
|
|
|
StringCopy7(sQuizLadyPtr->playerName, gSaveBlock2Ptr->playerName);
|
|
|
|
sQuizLadyPtr->language = gGameLanguage;
|
2017-09-20 22:32:37 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void QuizLadySetWaitingForChallenger(void)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
|
|
|
sQuizLadyPtr->waitingForChallenger = TRUE;
|
2017-09-20 22:32:37 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void BufferQuizCorrectAnswer(void)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 02:37:09 +02:00
|
|
|
CopyEasyChatWord(gStringVar3, sQuizLadyPtr->correctAnswer);
|
2017-09-20 22:32:37 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
|
|
|
|
void FieldCallback_QuizLadyEnableScriptContexts(void)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
|
|
|
EnableBothScriptContexts();
|
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void QuizLadyClearQuestionForRecordMix(const LilycoveLady *lilycoveLady)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr = &gSaveBlock1Ptr->lilycoveLady.quiz;
|
2019-08-06 19:52:10 +02:00
|
|
|
if (lilycoveLady->quiz.prevQuestionId < ARRAY_COUNT(sQuizLadyQuizQuestions)
|
|
|
|
&& sQuizLadyPtr->id == LILYCOVE_LADY_QUIZ)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
|
|
|
for (i = 0; i < 4; i ++)
|
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
if (lilycoveLady->quiz.prevQuestionId != sQuizLadyPtr->questionId)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
2019-08-06 19:52:10 +02:00
|
|
|
sQuizLadyPtr->questionId = Random() % ARRAY_COUNT(sQuizLadyQuizQuestions);
|
2017-09-20 22:32:37 +02:00
|
|
|
}
|
2019-08-04 10:22:19 +02:00
|
|
|
if (lilycoveLady->quiz.prevQuestionId == sQuizLadyPtr->questionId)
|
2017-09-20 22:32:37 +02:00
|
|
|
{
|
2019-08-06 19:52:10 +02:00
|
|
|
sQuizLadyPtr->questionId = (sQuizLadyPtr->questionId + 1) % (int)(ARRAY_COUNT(sQuizLadyQuizQuestions));
|
2017-09-20 22:32:37 +02:00
|
|
|
}
|
2019-08-04 10:22:19 +02:00
|
|
|
sQuizLadyPtr->prevQuestionId = lilycoveLady->quiz.prevQuestionId;
|
2017-09-20 22:32:37 +02:00
|
|
|
}
|
|
|
|
}
|
2017-09-20 22:49:22 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static void ResetContestLadyContestData(void)
|
2017-09-20 22:49:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr->playerName[0] = EOS;
|
2019-08-06 02:37:09 +02:00
|
|
|
sContestLadyPtr->numGoodPokeblocksGiven = 0;
|
|
|
|
sContestLadyPtr->numOtherPokeblocksGiven = 0;
|
|
|
|
sContestLadyPtr->maxSheen = 0;
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr->category = Random() % CONTEST_CATEGORIES_COUNT;
|
2017-09-20 22:49:22 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
static void InitLilycoveContestLady(void)
|
2017-09-20 22:49:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
sContestLadyPtr->id = LILYCOVE_LADY_CONTEST;
|
2019-08-04 18:00:42 +02:00
|
|
|
sContestLadyPtr->givenPokeblock = FALSE;
|
2019-08-04 10:22:19 +02:00
|
|
|
ResetContestLadyContestData();
|
|
|
|
sContestLadyPtr->language = gGameLanguage;
|
2017-09-20 22:49:22 +02:00
|
|
|
}
|
2017-09-21 02:08:05 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static void ResetContestLadyForRecordMix(void)
|
2017-09-21 02:08:05 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
sContestLadyPtr->id = LILYCOVE_LADY_CONTEST;
|
2019-08-04 18:00:42 +02:00
|
|
|
sContestLadyPtr->givenPokeblock = FALSE;
|
2019-08-06 02:37:09 +02:00
|
|
|
if (sContestLadyPtr->numGoodPokeblocksGiven == LILYCOVE_LADY_GIFT_THRESHOLD
|
|
|
|
|| sContestLadyPtr->numOtherPokeblocksGiven == LILYCOVE_LADY_GIFT_THRESHOLD)
|
2017-09-21 02:08:05 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
ResetContestLadyContestData();
|
2017-09-21 02:08:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
static void ContestLadySavePlayerNameIfHighSheen(u8 sheen)
|
2017-09-21 02:08:05 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
2019-08-06 02:37:09 +02:00
|
|
|
if (sContestLadyPtr->maxSheen <= sheen)
|
2017-09-21 02:08:05 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
sContestLadyPtr->maxSheen = sheen;
|
2019-08-04 10:22:19 +02:00
|
|
|
memset(sContestLadyPtr->playerName, EOS, sizeof(sContestLadyPtr->playerName));
|
|
|
|
memcpy(sContestLadyPtr->playerName, gSaveBlock2Ptr->playerName, sizeof(sContestLadyPtr->playerName));
|
|
|
|
sContestLadyPtr->language = gGameLanguage;
|
2017-09-21 02:08:05 +02:00
|
|
|
}
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
|
|
|
|
2017-12-16 15:10:29 +01:00
|
|
|
bool8 GivePokeblockToContestLady(struct Pokeblock *pokeblock)
|
2017-09-21 02:16:11 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
u8 sheen = 0;
|
|
|
|
bool8 correctFlavor = FALSE;
|
2017-09-21 02:16:11 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
switch (sContestLadyPtr->category)
|
2017-09-21 02:16:11 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
case CONTEST_CATEGORY_COOL:
|
2017-09-21 02:16:11 +02:00
|
|
|
if (pokeblock->spicy != 0)
|
|
|
|
{
|
|
|
|
sheen = pokeblock->spicy;
|
2019-08-06 02:37:09 +02:00
|
|
|
correctFlavor = TRUE;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
|
|
|
break;
|
2019-08-04 10:22:19 +02:00
|
|
|
case CONTEST_CATEGORY_BEAUTY:
|
2017-09-21 02:16:11 +02:00
|
|
|
if (pokeblock->dry != 0)
|
|
|
|
{
|
|
|
|
sheen = pokeblock->dry;
|
2019-08-06 02:37:09 +02:00
|
|
|
correctFlavor = TRUE;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
|
|
|
break;
|
2019-08-04 10:22:19 +02:00
|
|
|
case CONTEST_CATEGORY_CUTE:
|
2017-09-21 02:16:11 +02:00
|
|
|
if (pokeblock->sweet != 0)
|
|
|
|
{
|
|
|
|
sheen = pokeblock->sweet;
|
2019-08-06 02:37:09 +02:00
|
|
|
correctFlavor = TRUE;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
|
|
|
break;
|
2019-08-04 10:22:19 +02:00
|
|
|
case CONTEST_CATEGORY_SMART:
|
2017-09-21 02:16:11 +02:00
|
|
|
if (pokeblock->bitter != 0)
|
|
|
|
{
|
|
|
|
sheen = pokeblock->bitter;
|
2019-08-06 02:37:09 +02:00
|
|
|
correctFlavor = TRUE;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
|
|
|
break;
|
2019-08-04 10:22:19 +02:00
|
|
|
case CONTEST_CATEGORY_TOUGH:
|
2017-09-21 02:16:11 +02:00
|
|
|
if (pokeblock->sour != 0)
|
|
|
|
{
|
|
|
|
sheen = pokeblock->sour;
|
2019-08-06 02:37:09 +02:00
|
|
|
correctFlavor = TRUE;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
if (correctFlavor == TRUE)
|
2017-09-21 02:16:11 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
ContestLadySavePlayerNameIfHighSheen(sheen);
|
|
|
|
sContestLadyPtr->numGoodPokeblocksGiven++;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
sContestLadyPtr->numOtherPokeblocksGiven++;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
return correctFlavor;
|
2017-09-21 02:16:11 +02:00
|
|
|
}
|
2017-09-21 02:24:22 +02:00
|
|
|
|
2019-08-04 20:23:54 +02:00
|
|
|
static void BufferContestLadyCategoryAndMonName(u8 *dest1, u8 *dest2)
|
2017-09-21 02:24:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
StringCopy(dest1, sContestLadyCategoryNames[sContestLadyPtr->category]);
|
|
|
|
StringCopy10(dest2, sContestLadyMonNames[sContestLadyPtr->category]);
|
2017-09-21 02:24:22 +02:00
|
|
|
}
|
2017-09-21 02:32:22 +02:00
|
|
|
|
2019-08-04 20:23:54 +02:00
|
|
|
void BufferContestLadyMonName(u8 *dest1, u8 *dest2)
|
2017-09-21 02:32:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
*dest1 = sContestLadyPtr->category;
|
|
|
|
StringCopy(dest2, sContestLadyMonNames[sContestLadyPtr->category]);
|
2017-09-21 02:32:22 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 20:23:54 +02:00
|
|
|
void BufferContestLadyPlayerName(u8 *dest)
|
2017-09-21 02:32:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
StringCopy(dest, sContestLadyPtr->playerName);
|
2017-09-21 02:32:22 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 20:23:54 +02:00
|
|
|
void BufferContestLadyLanguage(u8 *dest)
|
2017-09-21 02:32:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
*dest = sContestLadyPtr->language;
|
2017-09-21 02:32:22 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
void BufferContestName(u8 *dest, u8 category)
|
2017-09-21 02:32:22 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
StringCopy(dest, sContestNames[category]);
|
2017-09-21 02:32:22 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
// 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
|
2017-09-21 02:32:22 +02:00
|
|
|
u8 sub_818E880(void)
|
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
2019-08-06 02:37:09 +02:00
|
|
|
if (sContestLadyPtr->numGoodPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD)
|
2017-09-21 02:32:22 +02:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
else if (sContestLadyPtr->numGoodPokeblocksGiven == 0)
|
2017-09-21 02:32:22 +02:00
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2017-09-21 02:48:32 +02:00
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
|
|
|
|
bool8 HasPlayerGivenContestLadyPokeblock(void)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
2019-08-04 18:00:42 +02:00
|
|
|
if (sContestLadyPtr->givenPokeblock == TRUE)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
bool8 ShouldContestLadyShowGoOnAir(void)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
bool8 putOnAir = FALSE;
|
2017-09-21 02:48:32 +02:00
|
|
|
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
2019-08-06 02:37:09 +02:00
|
|
|
if (sContestLadyPtr->numGoodPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD
|
|
|
|
|| sContestLadyPtr->numOtherPokeblocksGiven >= LILYCOVE_LADY_GIFT_THRESHOLD)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2019-08-06 02:37:09 +02:00
|
|
|
putOnAir = TRUE;
|
2017-09-21 02:48:32 +02:00
|
|
|
}
|
2019-08-06 02:37:09 +02:00
|
|
|
return putOnAir;
|
2017-09-21 02:48:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void Script_BufferContestLadyCategoryAndMonName(void)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2019-08-04 20:23:54 +02:00
|
|
|
BufferContestLadyCategoryAndMonName(gStringVar2, gStringVar1);
|
2017-09-21 02:48:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 18:00:42 +02:00
|
|
|
void OpenPokeblockCaseForContestLady(void)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2018-02-14 00:58:22 +01:00
|
|
|
OpenPokeblockCase(3, CB2_ReturnToField);
|
2017-09-21 02:48:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 02:37:09 +02:00
|
|
|
void SetContestLadyGivenPokeblock(void)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
2019-08-04 18:00:42 +02:00
|
|
|
sContestLadyPtr->givenPokeblock = TRUE;
|
2017-09-21 02:48:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 18:00:42 +02:00
|
|
|
void GetContestLadyMonSpecies(void)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
gSpecialVar_0x8005 = sContestLadyMonSpecies[sContestLadyPtr->category];
|
2017-09-21 02:48:32 +02:00
|
|
|
}
|
|
|
|
|
2019-08-04 18:00:42 +02:00
|
|
|
u8 GetContestLadyCategory(void)
|
2017-09-21 02:48:32 +02:00
|
|
|
{
|
2019-08-04 10:22:19 +02:00
|
|
|
sContestLadyPtr = &gSaveBlock1Ptr->lilycoveLady.contest;
|
|
|
|
return sContestLadyPtr->category;
|
2017-09-21 02:48:32 +02:00
|
|
|
}
|