mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Review changes for #817
This commit is contained in:
parent
4e98a0cc4b
commit
37373c1b21
@ -110,7 +110,7 @@ Route117_PokemonDayCare_EventScript_GiveMonToRaise:: @ 8291D56
|
||||
specialvar VAR_RESULT, CountPartyAliveNonEggMons_IgnoreVar0x8004Slot
|
||||
compare VAR_RESULT, 0
|
||||
goto_if_eq Route117_PokemonDayCare_EventScript_OnlyOneAliveMon
|
||||
specialvar VAR_0x8005, GetSelectedMonNickAndSpecies
|
||||
specialvar VAR_0x8005, GetSelectedMonNicknameAndSpecies
|
||||
waitse
|
||||
playmoncry VAR_0x8005, 0
|
||||
msgbox Route117_PokemonDayCare_Text_WellRaiseYourMon, MSGBOX_DEFAULT
|
||||
|
@ -197,7 +197,7 @@ gSpecials:: @ 81DBA64
|
||||
def_special RejectEggFromDayCare
|
||||
def_special GiveEggFromDaycare
|
||||
def_special SetDaycareCompatibilityString
|
||||
def_special GetSelectedMonNickAndSpecies
|
||||
def_special GetSelectedMonNicknameAndSpecies
|
||||
def_special StoreSelectedPokemonInDaycare
|
||||
def_special ChooseSendDaycareMon
|
||||
def_special ShowDaycareLevelMenu
|
||||
|
@ -3,8 +3,8 @@
|
||||
|
||||
#include "constants/daycare.h"
|
||||
|
||||
u8 *GetMonNick(struct Pokemon *mon, u8 *dest);
|
||||
u8 *GetBoxMonNick(struct BoxPokemon *mon, u8 *dest);
|
||||
u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest);
|
||||
u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest);
|
||||
u8 CountPokemonInDaycare(struct DayCare *daycare);
|
||||
void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDayCareMail *daycareMail);
|
||||
void StoreSelectedPokemonInDaycare(void);
|
||||
@ -16,7 +16,7 @@ void RejectEggFromDayCare(void);
|
||||
void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation);
|
||||
void GiveEggFromDaycare(void);
|
||||
bool8 ShouldEggHatch(void);
|
||||
u16 GetSelectedMonNickAndSpecies(void);
|
||||
u16 GetSelectedMonNicknameAndSpecies(void);
|
||||
void GetDaycareMonNicknames(void);
|
||||
u8 GetDaycareState(void);
|
||||
void SetDaycareCompatibilityString(void);
|
||||
|
@ -91,7 +91,7 @@ static const u8 *const sCompatibilityMessages[] =
|
||||
|
||||
static const u8 sJapaneseEggNickname[] = _("タマゴ"); // "tamago" ("egg" in Japanese)
|
||||
|
||||
u8 *GetMonNick(struct Pokemon *mon, u8 *dest)
|
||||
u8 *GetMonNickname2(struct Pokemon *mon, u8 *dest)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
@ -99,7 +99,7 @@ u8 *GetMonNick(struct Pokemon *mon, u8 *dest)
|
||||
return StringCopy10(dest, nickname);
|
||||
}
|
||||
|
||||
u8 *GetBoxMonNick(struct BoxPokemon *mon, u8 *dest)
|
||||
u8 *GetBoxMonNickname(struct BoxPokemon *mon, u8 *dest)
|
||||
{
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
@ -169,7 +169,7 @@ static void StorePokemonInDaycare(struct Pokemon *mon, struct DaycareMon *daycar
|
||||
u8 mailId;
|
||||
|
||||
StringCopy(daycareMon->mail.OT_name, gSaveBlock2Ptr->playerName);
|
||||
GetMonNick(mon, daycareMon->mail.monName);
|
||||
GetMonNickname2(mon, daycareMon->mail.monName);
|
||||
StripExtCtrlCodes(daycareMon->mail.monName);
|
||||
daycareMon->mail.gameLanguage = LANGUAGE_ENGLISH;
|
||||
daycareMon->mail.monLanguage = GetMonData(mon, MON_DATA_LANGUAGE);
|
||||
@ -254,7 +254,7 @@ static u16 TakeSelectedPokemonFromDaycare(struct DaycareMon *daycareMon)
|
||||
u32 experience;
|
||||
struct Pokemon pokemon;
|
||||
|
||||
GetBoxMonNick(&daycareMon->mon, gStringVar1);
|
||||
GetBoxMonNickname(&daycareMon->mon, gStringVar1);
|
||||
species = GetBoxMonData(&daycareMon->mon, MON_DATA_SPECIES);
|
||||
BoxMonToMon(&daycareMon->mon, &pokemon);
|
||||
|
||||
@ -314,7 +314,7 @@ static u8 GetNumLevelsGainedForDaycareMon(struct DaycareMon *daycareMon)
|
||||
{
|
||||
u8 numLevelsGained = GetNumLevelsGainedFromSteps(daycareMon);
|
||||
ConvertIntToDecimalStringN(gStringVar2, numLevelsGained, STR_CONV_MODE_LEFT_ALIGN, 2);
|
||||
GetBoxMonNick(&daycareMon->mon, gStringVar1);
|
||||
GetBoxMonNickname(&daycareMon->mon, gStringVar1);
|
||||
return numLevelsGained;
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ static u32 GetDaycareCostForSelectedMon(struct DaycareMon *daycareMon)
|
||||
u32 cost;
|
||||
|
||||
u8 numLevelsGained = GetNumLevelsGainedFromSteps(daycareMon);
|
||||
GetBoxMonNick(&daycareMon->mon, gStringVar1);
|
||||
GetBoxMonNickname(&daycareMon->mon, gStringVar1);
|
||||
cost = 100 + 100 * numLevelsGained;
|
||||
ConvertIntToDecimalStringN(gStringVar2, cost, STR_CONV_MODE_LEFT_ALIGN, 5);
|
||||
return cost;
|
||||
@ -538,7 +538,7 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare)
|
||||
u8 i;
|
||||
u8 selectedIvs[INHERITED_IV_COUNT];
|
||||
u8 availableIVs[NUM_STATS];
|
||||
u8 whichParent[INHERITED_IV_COUNT];
|
||||
u8 whichParents[INHERITED_IV_COUNT];
|
||||
u8 iv;
|
||||
|
||||
// Initialize a list of IV indices.
|
||||
@ -558,7 +558,7 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare)
|
||||
// Determine which parent each of the selected IVs should inherit from.
|
||||
for (i = 0; i < INHERITED_IV_COUNT; i++)
|
||||
{
|
||||
whichParent[i] = Random() % DAYCARE_MON_COUNT;
|
||||
whichParents[i] = Random() % DAYCARE_MON_COUNT;
|
||||
}
|
||||
|
||||
// Set each of inherited IVs on the egg mon.
|
||||
@ -567,27 +567,27 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare)
|
||||
switch (selectedIvs[i])
|
||||
{
|
||||
case 0:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_HP_IV);
|
||||
iv = GetBoxMonData(&daycare->mons[whichParents[i]].mon, MON_DATA_HP_IV);
|
||||
SetMonData(egg, MON_DATA_HP_IV, &iv);
|
||||
break;
|
||||
case 1:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_ATK_IV);
|
||||
iv = GetBoxMonData(&daycare->mons[whichParents[i]].mon, MON_DATA_ATK_IV);
|
||||
SetMonData(egg, MON_DATA_ATK_IV, &iv);
|
||||
break;
|
||||
case 2:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_DEF_IV);
|
||||
iv = GetBoxMonData(&daycare->mons[whichParents[i]].mon, MON_DATA_DEF_IV);
|
||||
SetMonData(egg, MON_DATA_DEF_IV, &iv);
|
||||
break;
|
||||
case 3:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_SPEED_IV);
|
||||
iv = GetBoxMonData(&daycare->mons[whichParents[i]].mon, MON_DATA_SPEED_IV);
|
||||
SetMonData(egg, MON_DATA_SPEED_IV, &iv);
|
||||
break;
|
||||
case 4:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_SPATK_IV);
|
||||
iv = GetBoxMonData(&daycare->mons[whichParents[i]].mon, MON_DATA_SPATK_IV);
|
||||
SetMonData(egg, MON_DATA_SPATK_IV, &iv);
|
||||
break;
|
||||
case 5:
|
||||
iv = GetBoxMonData(&daycare->mons[whichParent[i]].mon, MON_DATA_SPDEF_IV);
|
||||
iv = GetBoxMonData(&daycare->mons[whichParents[i]].mon, MON_DATA_SPDEF_IV);
|
||||
SetMonData(egg, MON_DATA_SPDEF_IV, &iv);
|
||||
break;
|
||||
}
|
||||
@ -877,7 +877,7 @@ void GiveEggFromDaycare(void)
|
||||
_GiveEggFromDaycare(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
static bool8 TryProduceOrHatchEgg(struct DayCare *daycare)
|
||||
{
|
||||
u32 i, validEggs = 0;
|
||||
|
||||
@ -887,15 +887,16 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
daycare->mons[i].steps++, validEggs++;
|
||||
}
|
||||
|
||||
// try to trigger poke sex
|
||||
// Check if an egg should be produced
|
||||
if (daycare->offspringPersonality == 0 && validEggs == DAYCARE_MON_COUNT && (daycare->mons[1].steps & 0xFF) == 0xFF)
|
||||
{
|
||||
u8 loveScore = GetDaycareCompatibilityScore(daycare);
|
||||
if (loveScore > (Random() * 100u) / USHRT_MAX)
|
||||
u8 compatability = GetDaycareCompatibilityScore(daycare);
|
||||
if (compatability > (Random() * 100u) / USHRT_MAX)
|
||||
TriggerPendingDaycareEgg();
|
||||
}
|
||||
|
||||
if (++daycare->stepCounter == 255) // hatch an egg
|
||||
// Hatch Egg
|
||||
if (++daycare->stepCounter == 255)
|
||||
{
|
||||
u32 steps;
|
||||
u8 toSub = GetEggStepsToSubtract();
|
||||
@ -908,7 +909,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
continue;
|
||||
|
||||
steps = GetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP);
|
||||
if (steps != 0) // subtract needed steps
|
||||
if (steps != 0)
|
||||
{
|
||||
if (steps >= toSub)
|
||||
steps -= toSub;
|
||||
@ -917,7 +918,7 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
|
||||
SetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP, &steps);
|
||||
}
|
||||
else // hatch the egg
|
||||
else
|
||||
{
|
||||
gSpecialVar_0x8004 = i;
|
||||
return TRUE;
|
||||
@ -925,12 +926,12 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare)
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE; // no hatching
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 ShouldEggHatch(void)
|
||||
{
|
||||
return _DoEggActions_CheckHatch(&gSaveBlock1Ptr->daycare);
|
||||
return TryProduceOrHatchEgg(&gSaveBlock1Ptr->daycare);
|
||||
}
|
||||
|
||||
static bool8 IsEggPending(struct DayCare *daycare)
|
||||
@ -946,20 +947,20 @@ static void _GetDaycareMonNicknames(struct DayCare *daycare)
|
||||
u8 text[12];
|
||||
if (GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) != 0)
|
||||
{
|
||||
GetBoxMonNick(&daycare->mons[0].mon, gStringVar1);
|
||||
GetBoxMonNickname(&daycare->mons[0].mon, gStringVar1);
|
||||
GetBoxMonData(&daycare->mons[0].mon, MON_DATA_OT_NAME, text);
|
||||
StringCopy(gStringVar3, text);
|
||||
}
|
||||
|
||||
if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != 0)
|
||||
{
|
||||
GetBoxMonNick(&daycare->mons[1].mon, gStringVar2);
|
||||
GetBoxMonNickname(&daycare->mons[1].mon, gStringVar2);
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetSelectedMonNickAndSpecies(void)
|
||||
u16 GetSelectedMonNicknameAndSpecies(void)
|
||||
{
|
||||
GetBoxMonNick(&gPlayerParty[GetCursorSelectionMonId()].box, gStringVar1);
|
||||
GetBoxMonNickname(&gPlayerParty[GetCursorSelectionMonId()].box, gStringVar1);
|
||||
return GetBoxMonData(&gPlayerParty[GetCursorSelectionMonId()].box, MON_DATA_SPECIES);
|
||||
}
|
||||
|
||||
@ -1149,7 +1150,7 @@ static void GetDaycareLevelMenuText(struct DayCare *daycare, u8 *dest)
|
||||
*dest = EOS;
|
||||
for (i = 0; i < DAYCARE_MON_COUNT; i++)
|
||||
{
|
||||
GetBoxMonNick(&daycare->mons[i].mon, monNames[i]);
|
||||
GetBoxMonNickname(&daycare->mons[i].mon, monNames[i]);
|
||||
AppendMonGenderSymbol(monNames[i], &daycare->mons[i].mon);
|
||||
}
|
||||
|
||||
@ -1199,13 +1200,13 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y)
|
||||
AddTextPrinter(&printer, 0xFF, NULL);
|
||||
}
|
||||
|
||||
static void DaycarePrintMonNick(struct DayCare *daycare, u8 windowId, u32 daycareSlotId, u32 y)
|
||||
static void DaycarePrintMonNickname(struct DayCare *daycare, u8 windowId, u32 daycareSlotId, u32 y)
|
||||
{
|
||||
u8 nick[POKEMON_NAME_LENGTH * 2];
|
||||
u8 nickname[POKEMON_NAME_LENGTH * 2];
|
||||
|
||||
GetBoxMonNick(&daycare->mons[daycareSlotId].mon, nick);
|
||||
AppendMonGenderSymbol(nick, &daycare->mons[daycareSlotId].mon);
|
||||
DaycareAddTextPrinter(windowId, nick, 8, y);
|
||||
GetBoxMonNickname(&daycare->mons[daycareSlotId].mon, nickname);
|
||||
AppendMonGenderSymbol(nickname, &daycare->mons[daycareSlotId].mon);
|
||||
DaycareAddTextPrinter(windowId, nickname, 8, y);
|
||||
}
|
||||
|
||||
static void DaycarePrintMonLvl(struct DayCare *daycare, u8 windowId, u32 daycareSlotId, u32 y)
|
||||
@ -1227,7 +1228,7 @@ static void DaycarePrintMonInfo(u8 windowId, s32 daycareSlotId, u8 y)
|
||||
{
|
||||
if (daycareSlotId < (unsigned) DAYCARE_MON_COUNT)
|
||||
{
|
||||
DaycarePrintMonNick(&gSaveBlock1Ptr->daycare, windowId, daycareSlotId, y);
|
||||
DaycarePrintMonNickname(&gSaveBlock1Ptr->daycare, windowId, daycareSlotId, y);
|
||||
DaycarePrintMonLvl(&gSaveBlock1Ptr->daycare, windowId, daycareSlotId, y);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ struct EggHatchData
|
||||
|
||||
extern const u32 gUnknown_08331F60[]; // tilemap gameboy circle
|
||||
extern const u8 gText_HatchedFromEgg[];
|
||||
extern const u8 gText_NickHatchPrompt[];
|
||||
extern const u8 gText_NicknameHatchPrompt[];
|
||||
|
||||
static void Task_EggHatch(u8 taskID);
|
||||
static void CB2_EggHatch_0(void);
|
||||
@ -368,7 +368,7 @@ static void AddHatchedMonToParty(u8 id)
|
||||
GetSetPokedexFlag(pokeNum, FLAG_SET_SEEN);
|
||||
GetSetPokedexFlag(pokeNum, FLAG_SET_CAUGHT);
|
||||
|
||||
GetMonNick(mon, gStringVar1);
|
||||
GetMonNickname2(mon, gStringVar1);
|
||||
|
||||
ball = ITEM_POKE_BALL;
|
||||
SetMonData(mon, MON_DATA_POKEBALL, &ball);
|
||||
@ -390,15 +390,15 @@ void ScriptHatchMon(void)
|
||||
|
||||
static bool8 _CheckDaycareMonReceivedMail(struct DayCare *daycare, u8 daycareId)
|
||||
{
|
||||
u8 nick[32];
|
||||
u8 nickname[32];
|
||||
struct DaycareMon *daycareMon = &daycare->mons[daycareId];
|
||||
|
||||
GetBoxMonNick(&daycareMon->mon, nick);
|
||||
GetBoxMonNickname(&daycareMon->mon, nickname);
|
||||
if (daycareMon->mail.message.itemId != ITEM_NONE
|
||||
&& (StringCompareWithoutExtCtrlCodes(nick, daycareMon->mail.monName) != 0
|
||||
&& (StringCompareWithoutExtCtrlCodes(nickname, daycareMon->mail.monName) != 0
|
||||
|| StringCompareWithoutExtCtrlCodes(gSaveBlock2Ptr->playerName, daycareMon->mail.OT_name) != 0))
|
||||
{
|
||||
StringCopy(gStringVar1, nick);
|
||||
StringCopy(gStringVar1, nickname);
|
||||
TVShowConvertInternationalString(gStringVar2, daycareMon->mail.OT_name, daycareMon->mail.gameLanguage);
|
||||
TVShowConvertInternationalString(gStringVar3, daycareMon->mail.monName, daycareMon->mail.monLanguage);
|
||||
return TRUE;
|
||||
@ -634,7 +634,7 @@ static void CB2_EggHatch_1(void)
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
GetMonNick(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar1);
|
||||
GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar1);
|
||||
StringExpandPlaceholders(gStringVar4, gText_HatchedFromEgg);
|
||||
EggHatchPrintMessage(sEggHatchData->windowId, gStringVar4, 0, 3, 0xFF);
|
||||
PlayFanfare(MUS_FANFA5);
|
||||
@ -651,8 +651,8 @@ static void CB2_EggHatch_1(void)
|
||||
sEggHatchData->CB2_state++;
|
||||
break;
|
||||
case 8:
|
||||
GetMonNick(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar1);
|
||||
StringExpandPlaceholders(gStringVar4, gText_NickHatchPrompt);
|
||||
GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar1);
|
||||
StringExpandPlaceholders(gStringVar4, gText_NicknameHatchPrompt);
|
||||
EggHatchPrintMessage(sEggHatchData->windowId, gStringVar4, 0, 2, 1);
|
||||
sEggHatchData->CB2_state++;
|
||||
break;
|
||||
@ -668,7 +668,7 @@ static void CB2_EggHatch_1(void)
|
||||
switch (Menu_ProcessInputNoWrapClearOnChoose())
|
||||
{
|
||||
case 0:
|
||||
GetMonNick(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar3);
|
||||
GetMonNickname2(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar3);
|
||||
species = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_SPECIES);
|
||||
gender = GetMonGender(&gPlayerParty[sEggHatchData->eggPartyID]);
|
||||
personality = GetMonData(&gPlayerParty[sEggHatchData->eggPartyID], MON_DATA_PERSONALITY, 0);
|
||||
|
@ -1291,7 +1291,7 @@ const u8 gMatchCall_MayTrainersPokemonText[] = _("I'll use any POKéMON!");
|
||||
const u8 gMatchCall_MaySelfIntroductionText_Line1[] = _("My POKéMON and I help");
|
||||
const u8 gMatchCall_MaySelfIntroductionText_Line2[] = _("my father's research.");
|
||||
const u8 gText_HatchedFromEgg[] = _("{STR_VAR_1} hatched from the EGG!");
|
||||
const u8 gText_NickHatchPrompt[] = _("Would you like to nickname the newly\nhatched {STR_VAR_1}?");
|
||||
const u8 gText_NicknameHatchPrompt[] = _("Would you like to nickname the newly\nhatched {STR_VAR_1}?");
|
||||
ALIGNED(4) const u8 gText_ReadyToBerryCrush[] = _("Are you ready to BERRY-CRUSH?\nPlease pick a BERRY for use.\p");
|
||||
ALIGNED(4) const u8 gText_WaitForAllChooseBerry[] = _("Please wait while each member\nchooses a BERRY.");
|
||||
ALIGNED(4) const u8 gText_EndedWithXUnitsPowder[] = _("{PAUSE_MUSIC}{PLAY_BGM MUS_FANFA1}You ended up with {STR_VAR_1} units of\nsilky-smooth BERRY POWDER.{RESUME_MUSIC}\pYour total amount of BERRY POWDER\nis {STR_VAR_2}.\p");
|
||||
|
Loading…
Reference in New Issue
Block a user