diff options
-rw-r--r-- | data/event_scripts.s | 11 | ||||
-rw-r--r-- | data/maps/Route117/map.json | 2 | ||||
-rw-r--r-- | data/maps/Route117_PokemonDayCare/map.json | 2 | ||||
-rw-r--r-- | data/scripts/day_care.inc | 301 | ||||
-rw-r--r-- | data/specials.inc | 6 | ||||
-rw-r--r-- | include/constants/daycare.h | 27 | ||||
-rw-r--r-- | include/constants/global.h | 1 | ||||
-rw-r--r-- | include/constants/pokemon.h | 2 | ||||
-rw-r--r-- | include/daycare.h | 8 | ||||
-rw-r--r-- | include/egg_hatch.h | 4 | ||||
-rw-r--r-- | src/battle_script_commands.c | 136 | ||||
-rw-r--r-- | src/battle_transition.c | 5 | ||||
-rw-r--r-- | src/bg.c | 69 | ||||
-rw-r--r-- | src/daycare.c | 276 | ||||
-rw-r--r-- | src/egg_hatch.c | 32 | ||||
-rw-r--r-- | src/pokemon_summary_screen.c | 40 | ||||
-rw-r--r-- | src/strings.c | 2 |
17 files changed, 442 insertions, 482 deletions
diff --git a/data/event_scripts.s b/data/event_scripts.s index df061f4ac..2b8678851 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1,8 +1,11 @@ #include "constants/global.h" +#include "constants/battle.h" #include "constants/battle_frontier.h" #include "constants/battle_setup.h" #include "constants/berry.h" #include "constants/contest.h" +#include "constants/daycare.h" +#include "constants/decorations.h" #include "constants/easy_chat.h" #include "constants/event_objects.h" #include "constants/event_object_movement_constants.h" @@ -10,26 +13,24 @@ #include "constants/field_specials.h" #include "constants/flags.h" #include "constants/game_stat.h" -#include "constants/decorations.h" #include "constants/item.h" #include "constants/items.h" #include "constants/heal_locations.h" #include "constants/layouts.h" +#include "constants/lilycove_lady.h" #include "constants/map_scripts.h" #include "constants/maps.h" +#include "constants/metatile_labels.h" #include "constants/moves.h" #include "constants/pokemon.h" #include "constants/script_menu.h" #include "constants/secret_bases.h" #include "constants/songs.h" #include "constants/species.h" +#include "constants/trainer_hill.h" #include "constants/trainers.h" #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" .include "asm/macros/event.inc" .include "constants/constants.inc" diff --git a/data/maps/Route117/map.json b/data/maps/Route117/map.json index b29b58639..12420784c 100644 --- a/data/maps/Route117/map.json +++ b/data/maps/Route117/map.json @@ -61,7 +61,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route117_EventScript_291C18", + "script": "Route117_EventScript_DaycareMan", "flag": "0" }, { diff --git a/data/maps/Route117_PokemonDayCare/map.json b/data/maps/Route117_PokemonDayCare/map.json index c233701e5..9cb052633 100644 --- a/data/maps/Route117_PokemonDayCare/map.json +++ b/data/maps/Route117_PokemonDayCare/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route117_PokemonDayCare_EventScript_291D11", + "script": "Route117_PokemonDayCare_EventScript_DaycareWoman", "flag": "0" } ], diff --git a/data/scripts/day_care.inc b/data/scripts/day_care.inc index 8c4f14327..062fd9f5a 100644 --- a/data/scripts/day_care.inc +++ b/data/scripts/day_care.inc @@ -1,245 +1,245 @@ -Route117_EventScript_291C18:: @ 8291C18 +Route117_EventScript_DaycareMan:: @ 8291C18 lock faceplayer special GetDaycareMonNicknames specialvar VAR_RESULT, GetDaycareState - compare VAR_RESULT, 1 - goto_if_eq Route117_EventScript_291C4D - compare VAR_RESULT, 2 - goto_if_eq Route117_EventScript_291CD1 - compare VAR_RESULT, 3 - goto_if_eq Route117_EventScript_291CE8 - msgbox Route117_Text_291FCF, MSGBOX_DEFAULT + compare VAR_RESULT, DAYCARE_EGG_WAITING + goto_if_eq Route117_EventScript_DaycareEggWaiting + compare VAR_RESULT, DAYCARE_ONE_MON + goto_if_eq Route117_EventScript_CheckOnOneMon + compare VAR_RESULT, DAYCARE_TWO_MONS + goto_if_eq Route117_EventScript_CheckOnTwoMons + msgbox Route117_Text_SeeWifeIfYoudLikeMeToRaiseMon, MSGBOX_DEFAULT release end -Route117_EventScript_291C4D:: @ 8291C4D - msgbox Route117_Text_29205D, MSGBOX_YESNO +Route117_EventScript_DaycareEggWaiting:: @ 8291C4D + msgbox Route117_Text_DoYouWantEgg, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_EventScript_291C83 - msgbox Route117_Text_2922C6, MSGBOX_YESNO + goto_if_eq Route117_EventScript_DaycareAcceptEgg + msgbox Route117_Text_IWillKeepDoYouWantIt, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_EventScript_291C83 - msgbox Route117_Text_292149, MSGBOX_DEFAULT + goto_if_eq Route117_EventScript_DaycareAcceptEgg + msgbox Route117_Text_IllKeepIt, MSGBOX_DEFAULT clearflag FLAG_PENDING_DAYCARE_EGG special RejectEggFromDayCare release end -Route117_EventScript_291C83:: @ 8291C83 +Route117_EventScript_DaycareAcceptEgg:: @ 8291C83 specialvar VAR_RESULT, CalculatePlayerPartyCount - compare VAR_RESULT, 6 - goto_if_ne Route117_EventScript_291C9D - msgbox Route117_Text_29216A, MSGBOX_DEFAULT + compare VAR_RESULT, PARTY_SIZE + goto_if_ne Route117_EventScript_DaycareReceiveEgg + msgbox Route117_Text_YouHaveNoRoomForIt, MSGBOX_DEFAULT release end -Route117_EventScript_291C9D:: @ 8291C9D - message Route117_Text_2921A4 +Route117_EventScript_DaycareReceiveEgg:: @ 8291C9D + message Route117_Text_ReceivedEgg playfanfare MUS_FANFA1 waitfanfare waitbuttonpress - msgbox Route117_Text_2921CF, MSGBOX_DEFAULT + msgbox Route117_Text_TakeGoodCareOfIt, MSGBOX_DEFAULT special GiveEggFromDaycare clearflag FLAG_PENDING_DAYCARE_EGG release end -Route117_EventScript_291CB7:: @ 8291CB7 - specialvar VAR_RESULT, sub_8071614 +Route117_EventScript_CheckMonReceivedMail:: @ 8291CB7 + specialvar VAR_RESULT, CheckDaycareMonReceivedMail compare VAR_RESULT, 1 - call_if_eq Route117_EventScript_291CC8 + call_if_eq Route117_EventScript_MonReceivedMail return -Route117_EventScript_291CC8:: @ 8291CC8 - msgbox Route117_Text_2921E5, MSGBOX_DEFAULT +Route117_EventScript_MonReceivedMail:: @ 8291CC8 + msgbox Route117_Text_FriendlyWithOtherTrainersMon, MSGBOX_DEFAULT return -Route117_EventScript_291CD1:: @ 8291CD1 +Route117_EventScript_CheckOnOneMon:: @ 8291CD1 special GetDaycareMonNicknames - msgbox Route117_Text_292114, MSGBOX_DEFAULT + msgbox Route117_Text_YourMonIsDoingFine, MSGBOX_DEFAULT setvar VAR_0x8004, 0 - call Route117_EventScript_291CB7 + call Route117_EventScript_CheckMonReceivedMail release end -Route117_EventScript_291CE8:: @ 8291CE8 +Route117_EventScript_CheckOnTwoMons:: @ 8291CE8 special GetDaycareMonNicknames - msgbox Route117_Text_292299, MSGBOX_DEFAULT + msgbox Route117_Text_YourMonsAreDoingFine, MSGBOX_DEFAULT special SetDaycareCompatibilityString special ShowFieldMessageStringVar4 waitmessage waitbuttonpress setvar VAR_0x8004, 0 - call Route117_EventScript_291CB7 + call Route117_EventScript_CheckMonReceivedMail setvar VAR_0x8004, 1 - call Route117_EventScript_291CB7 + call Route117_EventScript_CheckMonReceivedMail release end -Route117_PokemonDayCare_EventScript_291D11:: @ 8291D11 +Route117_PokemonDayCare_EventScript_DaycareWoman:: @ 8291D11 lock faceplayer specialvar VAR_RESULT, GetDaycareState + compare VAR_RESULT, DAYCARE_EGG_WAITING + goto_if_eq Route117_PokemonDayCare_EventScript_EggWaiting + compare VAR_RESULT, DAYCARE_ONE_MON + goto_if_eq Route117_PokemonDayCare_EventScript_OneMonInDaycare + compare VAR_RESULT, DAYCARE_TWO_MONS + goto_if_eq Route117_PokemonDayCare_EventScript_TwoMonsInDaycare + msgbox Route117_PokemonDayCare_Text_WouldYouLikeUsToRaiseAMon, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291E0B - compare VAR_RESULT, 2 - goto_if_eq Route117_PokemonDayCare_EventScript_291E2F - compare VAR_RESULT, 3 - goto_if_eq Route117_PokemonDayCare_EventScript_291F5C - msgbox Route117_PokemonDayCare_Text_2922F4, MSGBOX_YESNO - compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291D56 + goto_if_eq Route117_PokemonDayCare_EventScript_GiveMonToRaise msgbox Route117_PokemonDayCare_Text_292416, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_EventScript_291D56:: @ 8291D56 +Route117_PokemonDayCare_EventScript_GiveMonToRaise:: @ 8291D56 specialvar VAR_RESULT, CountPartyNonEggMons compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291DED - specialvar VAR_RESULT, sub_80722E0 + goto_if_eq Route117_PokemonDayCare_EventScript_OnlyOneMon + specialvar VAR_RESULT, CountPartyAliveNonEggMons compare VAR_RESULT, 2 - goto_if_eq Route117_PokemonDayCare_EventScript_291E01 - msgbox Route117_PokemonDayCare_Text_292349, MSGBOX_DEFAULT + goto_if_eq Route117_PokemonDayCare_EventScript_OnlyTwoAliveMons + msgbox Route117_PokemonDayCare_Text_WhichMonShouldWeRaise, MSGBOX_DEFAULT fadescreen 1 special ChooseSendDaycareMon waitstate compare VAR_0x8004, 255 - goto_if_eq Route117_PokemonDayCare_EventScript_291DCA + goto_if_eq Route117_PokemonDayCare_EventScript_ComeAgain specialvar VAR_RESULT, CountPartyAliveNonEggMons_IgnoreVar0x8004Slot compare VAR_RESULT, 0 - goto_if_eq Route117_PokemonDayCare_EventScript_291DF7 - specialvar VAR_0x8005, GetSelectedMonNickAndSpecies + goto_if_eq Route117_PokemonDayCare_EventScript_OnlyOneAliveMon + specialvar VAR_0x8005, GetSelectedMonNicknameAndSpecies waitse playmoncry VAR_0x8005, 0 - msgbox Route117_PokemonDayCare_Text_292370, MSGBOX_DEFAULT + msgbox Route117_PokemonDayCare_Text_WellRaiseYourMon, MSGBOX_DEFAULT waitmoncry special StoreSelectedPokemonInDaycare incrementgamestat GAME_STAT_USED_DAYCARE specialvar VAR_RESULT, GetDaycareState - compare VAR_RESULT, 2 - goto_if_eq Route117_PokemonDayCare_EventScript_291DD4 + compare VAR_RESULT, DAYCARE_ONE_MON + goto_if_eq Route117_PokemonDayCare_EventScript_CanRaiseOneMore release end -Route117_PokemonDayCare_EventScript_291DCA:: @ 8291DCA - msgbox Route117_PokemonDayCare_Text_292476, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_ComeAgain:: @ 8291DCA + msgbox Route117_PokemonDayCare_Text_ComeAgain, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_EventScript_291DD4:: @ 8291DD4 - msgbox Route117_PokemonDayCare_Text_2923AF, MSGBOX_YESNO +Route117_PokemonDayCare_EventScript_CanRaiseOneMore:: @ 8291DD4 + msgbox Route117_PokemonDayCare_Text_WeCanRaiseOneMore, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291D56 - goto Route117_PokemonDayCare_EventScript_291DCA + goto_if_eq Route117_PokemonDayCare_EventScript_GiveMonToRaise + goto Route117_PokemonDayCare_EventScript_ComeAgain end -Route117_PokemonDayCare_EventScript_291DED:: @ 8291DED - msgbox Route117_PokemonDayCare_Text_2925BB, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_OnlyOneMon:: @ 8291DED + msgbox Route117_PokemonDayCare_Text_YouHaveJustOneMon, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_EventScript_291DF7:: @ 8291DF7 - msgbox Route117_PokemonDayCare_Text_292617, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_OnlyOneAliveMon:: @ 8291DF7 + msgbox Route117_PokemonDayCare_Text_WhatWillYouBattleWith, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_EventScript_291E01:: @ 8291E01 - msgbox Route117_PokemonDayCare_Text_29266D, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_OnlyTwoAliveMons:: @ 8291E01 + msgbox Route117_PokemonDayCare_Text_YoullBeLeftWithJustOne, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_EventScript_291E0B:: @ 8291E0B - msgbox Route117_PokemonDayCare_Text_2923F6, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_EggWaiting:: @ 8291E0B + msgbox Route117_PokemonDayCare_Text_HusbandWasLookingForYou, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_EventScript_291E15:: @ 8291E15 - msgbox Route117_PokemonDayCare_Text_2924CC, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_YourMonHasGrownXLevels:: @ 8291E15 + msgbox Route117_PokemonDayCare_Text_YourMonHasGrownXLevels, MSGBOX_DEFAULT return -Route117_PokemonDayCare_EventScript_291E1E:: @ 8291E1E +Route117_PokemonDayCare_EventScript_DisplayLevelsGained:: @ 8291E1E specialvar VAR_RESULT, GetNumLevelsGainedFromDaycare compare VAR_RESULT, 0 - call_if_ne Route117_PokemonDayCare_EventScript_291E15 + call_if_ne Route117_PokemonDayCare_EventScript_YourMonHasGrownXLevels return -Route117_PokemonDayCare_EventScript_291E2F:: @ 8291E2F - msgbox Route117_PokemonDayCare_Text_292488, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_OneMonInDaycare:: @ 8291E2F + msgbox Route117_PokemonDayCare_Text_GoodToSeeYou, MSGBOX_DEFAULT setvar VAR_0x8004, 0 - call Route117_PokemonDayCare_EventScript_291E1E - msgbox Route117_PokemonDayCare_Text_2923AF, MSGBOX_YESNO + call Route117_PokemonDayCare_EventScript_DisplayLevelsGained + msgbox Route117_PokemonDayCare_Text_WeCanRaiseOneMore, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291D56 - msgbox Route117_PokemonDayCare_Text_2925F6, MSGBOX_YESNO + goto_if_eq Route117_PokemonDayCare_EventScript_GiveMonToRaise + msgbox Route117_PokemonDayCare_Text_TakeYourMonBack, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291E6D - goto Route117_PokemonDayCare_EventScript_291DCA + goto_if_eq Route117_PokemonDayCare_EventScript_TryRetrieveMon + goto Route117_PokemonDayCare_EventScript_ComeAgain end -Route117_PokemonDayCare_EventScript_291E6D:: @ 8291E6D +Route117_PokemonDayCare_EventScript_TryRetrieveMon:: @ 8291E6D specialvar VAR_RESULT, CalculatePlayerPartyCount - compare VAR_RESULT, 6 - goto_if_eq Route117_PokemonDayCare_EventScript_291F3D + compare VAR_RESULT, PARTY_SIZE + goto_if_eq Route117_PokemonDayCare_EventScript_NoRoom specialvar VAR_RESULT, GetDaycareState setvar VAR_0x8004, 0 - compare VAR_RESULT, 2 - goto_if_eq Route117_PokemonDayCare_EventScript_291EAC + compare VAR_RESULT, DAYCARE_ONE_MON + goto_if_eq Route117_PokemonDayCare_EventScript_CostPrompt special ShowDaycareLevelMenu waitstate copyvar VAR_0x8004, VAR_RESULT - compare VAR_RESULT, 2 - goto_if_eq Route117_PokemonDayCare_EventScript_291DCA - goto Route117_PokemonDayCare_EventScript_291EAC + compare VAR_RESULT, DAYCARE_EXITED_LEVEL_MENU + goto_if_eq Route117_PokemonDayCare_EventScript_ComeAgain + goto Route117_PokemonDayCare_EventScript_CostPrompt end -Route117_PokemonDayCare_EventScript_291EAC:: @ 8291EAC +Route117_PokemonDayCare_EventScript_CostPrompt:: @ 8291EAC special GetDaycareCost - msgbox Route117_PokemonDayCare_Text_292549, MSGBOX_YESNO + msgbox Route117_PokemonDayCare_Text_ItWillCostX, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291EC8 - goto Route117_PokemonDayCare_EventScript_291DCA + goto_if_eq Route117_PokemonDayCare_EventScript_CheckEnoughMoney + goto Route117_PokemonDayCare_EventScript_ComeAgain end -Route117_PokemonDayCare_EventScript_291EC8:: @ 8291EC8 +Route117_PokemonDayCare_EventScript_CheckEnoughMoney:: @ 8291EC8 specialvar VAR_RESULT, IsEnoughForCostInVar0x8005 compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291EE2 - msgbox Route117_PokemonDayCare_Text_292432, MSGBOX_DEFAULT + goto_if_eq Route117_PokemonDayCare_EventScript_RetrieveMon + msgbox Route117_PokemonDayCare_Text_NotEnoughMoney, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_EventScript_291EE2:: @ 8291EE2 - applymovement 1, Route117_PokemonDayCare_Movement_291F47 +Route117_PokemonDayCare_EventScript_RetrieveMon:: @ 8291EE2 + applymovement 1, Route117_PokemonDayCare_Movement_RetrieveDaycareMon waitmovement 0 specialvar VAR_RESULT, TakePokemonFromDaycare special SubtractMoneyFromVar0x8005 playse SE_REGI - msgbox Route117_PokemonDayCare_Text_292575, MSGBOX_DEFAULT + msgbox Route117_PokemonDayCare_Text_HeresYourMon, MSGBOX_DEFAULT waitse playmoncry VAR_RESULT, 0 - msgbox Route117_PokemonDayCare_Text_292593, MSGBOX_DEFAULT + msgbox Route117_PokemonDayCare_Text_TookBackMon, MSGBOX_DEFAULT waitmoncry specialvar VAR_RESULT, GetDaycareState - compare VAR_RESULT, 2 - goto_if_eq Route117_PokemonDayCare_EventScript_291F24 - goto Route117_PokemonDayCare_EventScript_291DCA + compare VAR_RESULT, DAYCARE_ONE_MON + goto_if_eq Route117_PokemonDayCare_EventScript_AskRetrieveOtherMon + goto Route117_PokemonDayCare_EventScript_ComeAgain end -Route117_PokemonDayCare_EventScript_291F24:: @ 8291F24 - msgbox Route117_PokemonDayCare_Text_29244F, MSGBOX_YESNO +Route117_PokemonDayCare_EventScript_AskRetrieveOtherMon:: @ 8291F24 + msgbox Route117_PokemonDayCare_Text_TakeOtherOneBackToo, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291E6D - goto Route117_PokemonDayCare_EventScript_291DCA + goto_if_eq Route117_PokemonDayCare_EventScript_TryRetrieveMon + goto Route117_PokemonDayCare_EventScript_ComeAgain end -Route117_PokemonDayCare_EventScript_291F3D:: @ 8291F3D - msgbox Route117_PokemonDayCare_Text_2924EF, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_NoRoom:: @ 8291F3D + msgbox Route117_PokemonDayCare_Text_YourTeamIsFull, MSGBOX_DEFAULT release end -Route117_PokemonDayCare_Movement_291F47: @ 8291F47 +Route117_PokemonDayCare_Movement_RetrieveDaycareMon: @ 8291F47 delay_16 delay_16 face_left @@ -261,50 +261,52 @@ Route117_PokemonDayCare_Movement_291F47: @ 8291F47 walk_slow_down step_end +@ Unused. Possibly a commented script, or a typo end added to the above Movement script Route117_PokemonDayCare_EventScript_291F5B:: @ 8291F5B end -Route117_PokemonDayCare_EventScript_291F5C:: @ 8291F5C - msgbox Route117_PokemonDayCare_Text_292488, MSGBOX_DEFAULT +Route117_PokemonDayCare_EventScript_TwoMonsInDaycare:: @ 8291F5C + msgbox Route117_PokemonDayCare_Text_GoodToSeeYou, MSGBOX_DEFAULT setvar VAR_0x8004, 0 - call Route117_PokemonDayCare_EventScript_291E1E + call Route117_PokemonDayCare_EventScript_DisplayLevelsGained setvar VAR_0x8004, 1 - call Route117_PokemonDayCare_EventScript_291E1E - msgbox Route117_PokemonDayCare_Text_2925F6, MSGBOX_YESNO + call Route117_PokemonDayCare_EventScript_DisplayLevelsGained + msgbox Route117_PokemonDayCare_Text_TakeYourMonBack, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route117_PokemonDayCare_EventScript_291E6D - msgbox Route117_PokemonDayCare_Text_292476, MSGBOX_DEFAULT + goto_if_eq Route117_PokemonDayCare_EventScript_TryRetrieveMon + msgbox Route117_PokemonDayCare_Text_ComeAgain, MSGBOX_DEFAULT release end +@ Unused Route117_PokemonDayCare_EventScript_291F95:: @ 8291F95 special ShowDaycareLevelMenu waitstate compare VAR_RESULT, 2 - goto_if_eq Route117_PokemonDayCare_EventScript_291DCA + goto_if_eq Route117_PokemonDayCare_EventScript_ComeAgain copyvar VAR_0x8004, VAR_RESULT specialvar VAR_RESULT, TakePokemonFromDaycare - msgbox Route117_PokemonDayCare_Text_292575, MSGBOX_DEFAULT - msgbox Route117_PokemonDayCare_Text_292476, MSGBOX_DEFAULT + msgbox Route117_PokemonDayCare_Text_HeresYourMon, MSGBOX_DEFAULT + msgbox Route117_PokemonDayCare_Text_ComeAgain, MSGBOX_DEFAULT release end EventScript_EggHatch:: @ 8291FC0 lockall - msgbox Text_292668, MSGBOX_DEFAULT + msgbox Text_EggHatchHuh, MSGBOX_DEFAULT special EggHatch waitstate releaseall end -Route117_Text_291FCF: @ 8291FCF +Route117_Text_SeeWifeIfYoudLikeMeToRaiseMon: @ 8291FCF .string "I'm the DAY-CARE MAN.\p" .string "I help take care of the precious\n" .string "POKéMON of TRAINERS.\p" .string "If you'd like me to raise your POKéMON,\n" .string "have a word with my wife.$" -Route117_Text_29205D: @ 829205D +Route117_Text_DoYouWantEgg: @ 829205D .string "Ah, it's you!\p" .string "We were raising your POKéMON,\n" .string "and my goodness, were we surprised!\p" @@ -313,124 +315,125 @@ Route117_Text_29205D: @ 829205D .string "but your POKéMON had it.\p" .string "You do want it, yes?$" -Route117_Text_292114: @ 8292114 +Route117_Text_YourMonIsDoingFine: @ 8292114 .string "Ah, it's you! Good to see you.\n" .string "Your {STR_VAR_1}'s doing fine.$" -Route117_Text_292149: @ 8292149 +Route117_Text_IllKeepIt: @ 8292149 .string "Well then, I'll keep it.\n" .string "Thanks!$" -Route117_Text_29216A: @ 829216A +Route117_Text_YouHaveNoRoomForIt: @ 829216A .string "You have no room for it…\n" .string "Come back when you've made room.$" -Route117_Text_2921A4: @ 82921A4 +Route117_Text_ReceivedEgg: @ 82921A4 .string "{PLAYER} received the EGG from\n" .string "the DAY-CARE MAN.$" -Route117_Text_2921CF: @ 82921CF +Route117_Text_TakeGoodCareOfIt: @ 82921CF .string "Take good care of it.$" -Route117_Text_2921E5: @ 82921E5 +Route117_Text_FriendlyWithOtherTrainersMon: @ 82921E5 .string "By the way, about your {STR_VAR_1},\n" .string "it seemed to be friendly with\l" .string "{STR_VAR_2}'s {STR_VAR_3}.\p" .string "I may even have seen it receiving\n" .string "a piece of MAIL.$" -Route117_Text_29225A: @ 829225A +@ Unused +Route117_Text_SeeWifeIfYouWantToPickUpMon: @ 829225A .string "If you want to pick up your POKéMON,\n" .string "have a word with my wife.$" -Route117_Text_292299: @ 8292299 +Route117_Text_YourMonsAreDoingFine: @ 8292299 .string "Ah, it's you! Your {STR_VAR_1} and\n" .string "{STR_VAR_2} are doing fine.$" -Route117_Text_2922C6: @ 82922C6 +Route117_Text_IWillKeepDoYouWantIt: @ 82922C6 .string "I really will keep it.\n" .string "You do want this, yes?$" -Route117_PokemonDayCare_Text_2922F4: @ 82922F4 +Route117_PokemonDayCare_Text_WouldYouLikeUsToRaiseAMon: @ 82922F4 .string "I'm the DAY-CARE LADY.\p" .string "We can raise POKéMON for you.\p" .string "Would you like us to raise one?$" -Route117_PokemonDayCare_Text_292349: @ 8292349 +Route117_PokemonDayCare_Text_WhichMonShouldWeRaise: @ 8292349 .string "Which POKéMON should we raise for\n" .string "you?$" -Route117_PokemonDayCare_Text_292370: @ 8292370 +Route117_PokemonDayCare_Text_WellRaiseYourMon: @ 8292370 .string "Fine, we'll raise your {STR_VAR_1}\n" .string "for a while.\p" .string "Come back for it later.$" -Route117_PokemonDayCare_Text_2923AF: @ 82923AF +Route117_PokemonDayCare_Text_WeCanRaiseOneMore: @ 82923AF .string "We can raise two of your POKéMON.\n" .string "Would you like us to raise one more?$" -Route117_PokemonDayCare_Text_2923F6: @ 82923F6 +Route117_PokemonDayCare_Text_HusbandWasLookingForYou: @ 82923F6 .string "My husband was looking for you.$" Route117_PokemonDayCare_Text_292416: @ 8292416 .string "Oh, fine, then.\n" .string "Come again.$" -Route117_PokemonDayCare_Text_292432: @ 8292432 +Route117_PokemonDayCare_Text_NotEnoughMoney: @ 8292432 .string "You don't have enough money…$" -Route117_PokemonDayCare_Text_29244F: @ 829244F +Route117_PokemonDayCare_Text_TakeOtherOneBackToo: @ 829244F .string "Will you take back the other one,\n" .string "too?$" -Route117_PokemonDayCare_Text_292476: @ 8292476 +Route117_PokemonDayCare_Text_ComeAgain: @ 8292476 .string "Fine.\n" .string "Come again.$" -Route117_PokemonDayCare_Text_292488: @ 8292488 +Route117_PokemonDayCare_Text_GoodToSeeYou: @ 8292488 .string "Ah, it's you! Good to see you.\n" .string "Your POKéMON can only be doing good!$" -Route117_PokemonDayCare_Text_2924CC: @ 82924CC +Route117_PokemonDayCare_Text_YourMonHasGrownXLevels: @ 82924CC .string "By level, your {STR_VAR_1} has\n" .string "grown by {STR_VAR_2}.$" -Route117_PokemonDayCare_Text_2924EF: @ 82924EF +Route117_PokemonDayCare_Text_YourTeamIsFull: @ 82924EF .string "Your POKéMON team is full.\n" .string "Make room, then come see me.$" Route117_PokemonDayCare_Text_292527: @ 8292527 .string "Which POKéMON will you take back?$" -Route117_PokemonDayCare_Text_292549: @ 8292549 +Route117_PokemonDayCare_Text_ItWillCostX: @ 8292549 .string "If you want your {STR_VAR_1} back,\n" .string "it will cost ¥{STR_VAR_2}.$" -Route117_PokemonDayCare_Text_292575: @ 8292575 +Route117_PokemonDayCare_Text_HeresYourMon: @ 8292575 .string "Perfect!\n" .string "Here's your POKéMON.$" -Route117_PokemonDayCare_Text_292593: @ 8292593 +Route117_PokemonDayCare_Text_TookBackMon: @ 8292593 .string "{PLAYER} took back {STR_VAR_1} from\n" .string "the DAY-CARE LADY.$" -Route117_PokemonDayCare_Text_2925BB: @ 82925BB +Route117_PokemonDayCare_Text_YouHaveJustOneMon: @ 82925BB .string "Oh? But you have just one\n" .string "POKéMON.\p" .string "Come back another time.$" -Route117_PokemonDayCare_Text_2925F6: @ 82925F6 +Route117_PokemonDayCare_Text_TakeYourMonBack: @ 82925F6 .string "Will you take your POKéMON back?$" -Route117_PokemonDayCare_Text_292617: @ 8292617 +Route117_PokemonDayCare_Text_WhatWillYouBattleWith: @ 8292617 .string "If you leave me that POKéMON,\n" .string "what will you battle with?\p" .string "Come back another time.$" -Text_292668: @ 8292668 +Text_EggHatchHuh: @ 8292668 .string "Huh?$" -Route117_PokemonDayCare_Text_29266D: @ 829266D +Route117_PokemonDayCare_Text_YoullBeLeftWithJustOne: @ 829266D .string "Huh?\n" .string "Now, now.\p" .string "If you leave that POKéMON with\n" diff --git a/data/specials.inc b/data/specials.inc index fadf24d04..4ae2ebe4e 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -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 @@ -206,7 +206,7 @@ gSpecials:: @ 81DBA64 def_special TakePokemonFromDaycare def_special ScriptHatchMon def_special EggHatch - def_special sub_8071614 + def_special CheckDaycareMonReceivedMail def_special ShowLinkBattleRecords def_special IsEnoughForCostInVar0x8005 def_special SubtractMoneyFromVar0x8005 @@ -530,7 +530,7 @@ gSpecials:: @ 81DBA64 def_special sub_80B4808 def_special ResetHealLocationFromDewford def_special sub_81B9918 - def_special sub_80722E0 + def_special CountPartyAliveNonEggMons def_special TryPrepareSecondApproachingTrainer def_special RemoveRecordsWindow def_special CloseDeptStoreElevatorWindow diff --git a/include/constants/daycare.h b/include/constants/daycare.h new file mode 100644 index 000000000..103f920f2 --- /dev/null +++ b/include/constants/daycare.h @@ -0,0 +1,27 @@ +#ifndef GUARD_DAYCARE_CONSTANTS_H +#define GUARD_DAYCARE_CONSTANTS_H + +// Parent compatability scores +#define PARENTS_INCOMPATIBLE 0 +#define PARENTS_LOW_COMPATIBILITY 20 +#define PARENTS_MED_COMPATABILITY 50 +#define PARENTS_MAX_COMPATABILITY 70 + +// Daycare state +#define DAYCARE_NO_MONS 0 +#define DAYCARE_EGG_WAITING 1 +#define DAYCARE_ONE_MON 2 +#define DAYCARE_TWO_MONS 3 + +#define INHERITED_IV_COUNT 3 +#define EGG_HATCH_LEVEL 5 +#define EGG_GENDER_MALE 0x8000 // used to create a male egg from a female-only parent species (e.g. Nidoran) + +#define DAYCARE_LEVEL_MENU_EXIT 5 +#define DAYCARE_EXITED_LEVEL_MENU 2 // would be redundant with above if GF had used the same value + +// Array buffers +#define EGG_MOVES_ARRAY_COUNT 10 +#define EGG_LVL_UP_MOVES_ARRAY_COUNT 50 + +#endif //GUARD_DAYCARE_CONSTANTS_H diff --git a/include/constants/global.h b/include/constants/global.h index 31b89c709..091f735f4 100644 --- a/include/constants/global.h +++ b/include/constants/global.h @@ -65,6 +65,7 @@ #define MALE 0 #define FEMALE 1 +#define GENDER_COUNT 2 #define OPTIONS_BUTTON_MODE_NORMAL 0 #define OPTIONS_BUTTON_MODE_LR 1 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 14c2acdf6..52a4f0254 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -41,6 +41,8 @@ #define EGG_GROUP_DRAGON 14 #define EGG_GROUP_UNDISCOVERED 15 +#define EGG_GROUPS_PER_MON 2 + // Pokemon natures #define NATURE_HARDY 0 #define NATURE_LONELY 1 diff --git a/include/daycare.h b/include/daycare.h index ecd875865..7d6f2fb19 100644 --- a/include/daycare.h +++ b/include/daycare.h @@ -1,10 +1,10 @@ #ifndef GUARD_DAYCARE_H #define GUARD_DAYCARE_H -#define EGG_HATCH_LEVEL 5 +#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); diff --git a/include/egg_hatch.h b/include/egg_hatch.h index 862d33947..64d07c813 100644 --- a/include/egg_hatch.h +++ b/include/egg_hatch.h @@ -2,9 +2,9 @@ #define GUARD_EGG_HATCH_H void ScriptHatchMon(void); -bool8 sub_8071614(void); +bool8 CheckDaycareMonReceivedMail(void); void EggHatch(void); u8 GetEggStepsToSubtract(void); -u16 sub_80722E0(void); +u16 CountPartyAliveNonEggMons(void); #endif // GUARD_EGG_HATCH_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4002852b7..35d47fa82 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1681,29 +1681,22 @@ static void atk07_adjustnormaldamage(void) RecordItemEffectBattle(gBattlerTarget, holdEffect); gSpecialStatuses[gBattlerTarget].focusBanded = 1; } - if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) - goto END; - if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattlerTarget].endured - && !gSpecialStatuses[gBattlerTarget].focusBanded) - goto END; - - if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage) - goto END; - - gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1; - - if (gProtectStructs[gBattlerTarget].endured) + if (!(gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) + && (gBattleMoves[gCurrentMove].effect == EFFECT_FALSE_SWIPE || gProtectStructs[gBattlerTarget].endured || gSpecialStatuses[gBattlerTarget].focusBanded) + && gBattleMons[gBattlerTarget].hp <= gBattleMoveDamage) { - gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; - } - else if (gSpecialStatuses[gBattlerTarget].focusBanded) - { - gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; - gLastUsedItem = gBattleMons[gBattlerTarget].item; + gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1; + if (gProtectStructs[gBattlerTarget].endured) + { + gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; + } + else if (gSpecialStatuses[gBattlerTarget].focusBanded) + { + gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; + gLastUsedItem = gBattleMons[gBattlerTarget].item; + } } - - END: - gBattlescriptCurrInstr++; + gBattlescriptCurrInstr++; } static void atk08_adjustnormaldamage2(void) // The same as 0x7 except it doesn't check for false swipe move effect. @@ -1730,27 +1723,22 @@ static void atk08_adjustnormaldamage2(void) // The same as 0x7 except it doesn't RecordItemEffectBattle(gBattlerTarget, holdEffect); gSpecialStatuses[gBattlerTarget].focusBanded = 1; } - if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) - goto END; - if (!gProtectStructs[gBattlerTarget].endured && !gSpecialStatuses[gBattlerTarget].focusBanded) - goto END; - if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage) - goto END; - - gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1; - - if (gProtectStructs[gBattlerTarget].endured) - { - gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; - } - else if (gSpecialStatuses[gBattlerTarget].focusBanded) + if (!(gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) + && (gProtectStructs[gBattlerTarget].endured || gSpecialStatuses[gBattlerTarget].focusBanded) + && gBattleMons[gBattlerTarget].hp <= gBattleMoveDamage) { - gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; - gLastUsedItem = gBattleMons[gBattlerTarget].item; + gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1; + if (gProtectStructs[gBattlerTarget].endured) + { + gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; + } + else if (gSpecialStatuses[gBattlerTarget].focusBanded) + { + gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; + gLastUsedItem = gBattleMons[gBattlerTarget].item; + } } - - END: - gBattlescriptCurrInstr++; + gBattlescriptCurrInstr++; } static void atk09_attackanimation(void) @@ -4564,27 +4552,26 @@ static void atk49_moveend(void) gBattleScripting.atk49_state++; break; case ATK49_CHOICE_MOVE: // update choice band move - if (!(gHitMarker & HITMARKER_OBEYS) || holdEffectAtk != HOLD_EFFECT_CHOICE_BAND - || gChosenMove == MOVE_STRUGGLE || (*choicedMoveAtk != 0 && *choicedMoveAtk != 0xFFFF)) - goto LOOP; - if (gChosenMove == MOVE_BATON_PASS && !(gMoveResultFlags & MOVE_RESULT_FAILED)) + if (gHitMarker & HITMARKER_OBEYS + && holdEffectAtk == HOLD_EFFECT_CHOICE_BAND + && gChosenMove != MOVE_STRUGGLE + && (*choicedMoveAtk == 0 || *choicedMoveAtk == 0xFFFF)) { - gBattleScripting.atk49_state++; - break; - } - *choicedMoveAtk = gChosenMove; - LOOP: - { - for (i = 0; i < MAX_MON_MOVES; i++) + if (gChosenMove == MOVE_BATON_PASS && !(gMoveResultFlags & MOVE_RESULT_FAILED)) { - if (gBattleMons[gBattlerAttacker].moves[i] == *choicedMoveAtk) - break; + ++gBattleScripting.atk49_state; + break; } - if (i == MAX_MON_MOVES) - *choicedMoveAtk = 0; - - gBattleScripting.atk49_state++; + *choicedMoveAtk = gChosenMove; + } + for (i = 0; i < MAX_MON_MOVES; ++i) + { + if (gBattleMons[gBattlerAttacker].moves[i] == *choicedMoveAtk) + break; } + if (i == MAX_MON_MOVES) + *choicedMoveAtk = 0; + ++gBattleScripting.atk49_state; break; case ATK49_CHANGED_ITEMS: // changed held items for (i = 0; i < gBattlersCount; i++) @@ -6152,29 +6139,22 @@ static void atk69_adjustsetdamage(void) // The same as 0x7, except there's no ra RecordItemEffectBattle(gBattlerTarget, holdEffect); gSpecialStatuses[gBattlerTarget].focusBanded = 1; } - if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) - goto END; - if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattlerTarget].endured - && !gSpecialStatuses[gBattlerTarget].focusBanded) - goto END; - - if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage) - goto END; - - gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1; - - if (gProtectStructs[gBattlerTarget].endured) - { - gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; - } - else if (gSpecialStatuses[gBattlerTarget].focusBanded) + if (!(gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE) + && (gBattleMoves[gCurrentMove].effect == EFFECT_FALSE_SWIPE || gProtectStructs[gBattlerTarget].endured || gSpecialStatuses[gBattlerTarget].focusBanded) + && gBattleMons[gBattlerTarget].hp <= gBattleMoveDamage) { - gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; - gLastUsedItem = gBattleMons[gBattlerTarget].item; + gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1; + if (gProtectStructs[gBattlerTarget].endured) + { + gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED; + } + else if (gSpecialStatuses[gBattlerTarget].focusBanded) + { + gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON; + gLastUsedItem = gBattleMons[gBattlerTarget].item; + } } - - END: - gBattlescriptCurrInstr++; + gBattlescriptCurrInstr++; } static void atk6A_removeitem(void) diff --git a/src/battle_transition.c b/src/battle_transition.c index 3e86fcf51..fb7fd0c2f 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1961,9 +1961,10 @@ static bool8 Phase2_Ripple_Func2(struct Task *task) for (i = 0; i < 160; i++, r4 += r8) { - // todo: fix the asm s16 var = r4 >> 8; - asm(""); + + var++; + var--; gScanlineEffectRegBuffers[0][i] = sTransitionStructPtr->field_16 + Sin(var, r3); } @@ -1174,78 +1174,29 @@ u32 GetTileMapIndexFromCoords(s32 x, s32 y, s32 screenSize, u32 screenWidth, u32 return (y * 0x20) + x; } -#ifdef NONMATCHING // This one has some weird switch statement cases that refuse to cooperate void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2) { u16 var; + + if (palette1 == 16) + goto CASE_16; switch (palette1) { case 0 ... 16: - if (palette1 != 16) - var = ((*src + tileOffset) & 0xFFF) + ((palette1 + palette2) << 12); - else - var = ((*dest & 0xFC00) + (palette2 << 12)) | ((*src + tileOffset) & 0x3FF); + var = ((*src + tileOffset) & 0xFFF) + ((palette1 + palette2) << 12); + break; + CASE_16: + var = *dest; + var &= 0xFC00; + var += palette2 << 12; + var |= (*src + tileOffset) & 0x3FF; break; default: var = *src + tileOffset + (palette2 << 12); break; } - *dest = var; } -#else -NAKED -void CopyTileMapEntry(const u16 *src, u16 *dest, s32 palette1, s32 tileOffset, s32 palette2) -{ - asm("push {r4-r6,lr}\n\ - add r4, r0, #0\n\ - add r6, r1, #0\n\ - ldr r5, [sp, #0x10]\n\ - cmp r2, #0x10\n\ - beq _08002B14\n\ - cmp r2, #0x10\n\ - bgt _08002B34\n\ - cmp r2, #0\n\ - blt _08002B34\n\ - ldrh r0, [r4]\n\ - add r0, r3\n\ - ldr r3, =0x00000fff\n\ - add r1, r3, #0\n\ - and r0, r1\n\ - add r1, r2, r5\n\ - lsl r1, #12\n\ - b _08002B3A\n\ - .pool\n\ -_08002B14:\n\ - ldrh r1, [r6]\n\ - mov r0, #0xFC\n\ - lsl r0, #8\n\ - and r1, r0\n\ - lsl r2, r5, #12\n\ - add r2, r1, r2\n\ - ldrh r0, [r4]\n\ - add r0, r3\n\ - ldr r3, =0x000003ff\n\ - add r1, r3, #0\n\ - and r0, r1\n\ - orr r0, r2\n\ - b _08002B3C\n\ - .pool\n\ -_08002B34:\n\ - ldrh r0, [r4]\n\ - add r0, r3\n\ - lsl r1, r5, #12\n\ -_08002B3A:\n\ - add r0, r1\n\ -_08002B3C:\n\ - lsl r0, #16\n\ - lsr r1, r0, #16\n\ - strh r1, [r6]\n\ - pop {r4-r6}\n\ - pop {r0}\n\ - bx r0\n"); -} -#endif // NONMATCHING u32 GetBgType(u8 bg) { diff --git a/src/daycare.c b/src/daycare.c index dc44b4887..e5445ee21 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -3,14 +3,11 @@ #include "battle.h" #include "daycare.h" #include "string_util.h" -#include "constants/species.h" -#include "constants/items.h" #include "mail.h" #include "pokemon_storage_system.h" #include "event_data.h" #include "random.h" #include "main.h" -#include "constants/moves.h" #include "egg_hatch.h" #include "text.h" #include "menu.h" @@ -22,9 +19,10 @@ #include "party_menu.h" #include "list_menu.h" #include "overworld.h" - -#define EGG_MOVES_ARRAY_COUNT 10 -#define EGG_LVL_UP_MOVES_ARRAY_COUNT 50 +#include "constants/items.h" +#include "constants/moves.h" +#include "constants/region_map_sections.h" +#include "constants/species.h" // this file's functions static void ClearDaycareMonMail(struct DayCareMail *mail); @@ -52,11 +50,13 @@ static const struct WindowTemplate sDaycareLevelMenuWindowTemplate = .baseBlock = 8 }; +// Indices here are assigned by Task_HandleDaycareLevelMenuInput to VAR_RESULT, +// which is copied to VAR_0x8004 and used as an index for GetDaycareCost static const struct ListMenuItem sLevelMenuItems[] = { {gExpandedPlaceholder_Empty, 0}, {gExpandedPlaceholder_Empty, 1}, - {gText_Exit, 5} + {gText_Exit, DAYCARE_LEVEL_MENU_EXIT} }; static const struct ListMenuTemplate sDaycareListMenuLevelTemplate = @@ -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); @@ -202,8 +202,8 @@ void StoreSelectedPokemonInDaycare(void) static void ShiftDaycareSlots(struct DayCare *daycare) { // This condition is only satisfied when the player takes out the first pokemon from the daycare. - if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != 0 - && GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) == 0) + if (GetBoxMonData(&daycare->mons[1].mon, MON_DATA_SPECIES) != SPECIES_NONE + && GetBoxMonData(&daycare->mons[0].mon, MON_DATA_SPECIES) == SPECIES_NONE) { daycare->mons[0].mon = daycare->mons[1].mon; ZeroBoxMonData(&daycare->mons[1].mon); @@ -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; @@ -419,18 +419,18 @@ static u16 GetEggSpecies(u16 species) return species; } -static s32 GetSlotToInheritNature(struct DayCare *daycare) +static s32 GetParentToInheritNature(struct DayCare *daycare) { u32 species[DAYCARE_MON_COUNT]; s32 i; s32 dittoCount; - s32 slot = -1; + s32 parent = -1; // search for female gender for (i = 0; i < DAYCARE_MON_COUNT; i++) { if (GetBoxMonGender(&daycare->mons[i].mon) == MON_FEMALE) - slot = i; + parent = i; } // search for ditto @@ -438,50 +438,52 @@ static s32 GetSlotToInheritNature(struct DayCare *daycare) { species[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES); if (species[i] == SPECIES_DITTO) - dittoCount++, slot = i; + dittoCount++, parent = i; } // coin flip on ...two Dittos - if (dittoCount == 2) + if (dittoCount == DAYCARE_MON_COUNT) { if (Random() >= USHRT_MAX / 2) - slot = 0; + parent = 0; else - slot = 1; + parent = 1; } - // nature inheritance only if holds everstone - if (GetBoxMonData(&daycare->mons[slot].mon, MON_DATA_HELD_ITEM) != ITEM_EVERSTONE + // Don't inherit nature if not holding Everstone + if (GetBoxMonData(&daycare->mons[parent].mon, MON_DATA_HELD_ITEM) != ITEM_EVERSTONE || Random() >= USHRT_MAX / 2) { return -1; } - return slot; + return parent; } static void _TriggerPendingDaycareEgg(struct DayCare *daycare) { - s32 natureSlot; + s32 parent; s32 natureTries = 0; SeedRng2(gMain.vblankCounter2); - natureSlot = GetSlotToInheritNature(daycare); + parent = GetParentToInheritNature(daycare); - if (natureSlot < 0) + // don't inherit nature + if (parent < 0) { - daycare->offspringPersonality = (Random2() << 0x10) | ((Random() % 0xfffe) + 1); + daycare->offspringPersonality = (Random2() << 16) | ((Random() % 0xfffe) + 1); } + // inherit nature else { - u8 wantedNature = GetNatureFromPersonality(GetBoxMonData(&daycare->mons[natureSlot].mon, MON_DATA_PERSONALITY, NULL)); + u8 wantedNature = GetNatureFromPersonality(GetBoxMonData(&daycare->mons[parent].mon, MON_DATA_PERSONALITY, NULL)); u32 personality; do { - personality = (Random2() << 0x10) | (Random()); + personality = (Random2() << 16) | (Random()); if (wantedNature == GetNatureFromPersonality(personality) && personality != 0) - break; // we found a personality with the same nature + break; // found a personality with the same nature natureTries++; } while (natureTries <= 2400); @@ -492,9 +494,10 @@ static void _TriggerPendingDaycareEgg(struct DayCare *daycare) FlagSet(FLAG_PENDING_DAYCARE_EGG); } +// Functionally unused static void _TriggerPendingDaycareMaleEgg(struct DayCare *daycare) { - daycare->offspringPersonality = (Random()) | (0x8000); + daycare->offspringPersonality = (Random()) | (EGG_GENDER_MALE); FlagSet(FLAG_PENDING_DAYCARE_EGG); } @@ -503,6 +506,7 @@ void TriggerPendingDaycareEgg(void) _TriggerPendingDaycareEgg(&gSaveBlock1Ptr->daycare); } +// Unused static void TriggerPendingDaycareMaleEgg(void) { _TriggerPendingDaycareMaleEgg(&gSaveBlock1Ptr->daycare); @@ -532,9 +536,9 @@ static void RemoveIVIndexFromList(u8 *ivs, u8 selectedIv) static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) { u8 i; - u8 selectedIvs[3]; + u8 selectedIvs[INHERITED_IV_COUNT]; u8 availableIVs[NUM_STATS]; - u8 whichParent[ARRAY_COUNT(selectedIvs)]; + u8 whichParents[INHERITED_IV_COUNT]; u8 iv; // Initialize a list of IV indices. @@ -544,48 +548,46 @@ static void InheritIVs(struct Pokemon *egg, struct DayCare *daycare) } // Select the 3 IVs that will be inherited. - for (i = 0; i < ARRAY_COUNT(selectedIvs); i++) + for (i = 0; i < INHERITED_IV_COUNT; i++) { - // Randomly pick an IV from the available list. + // Randomly pick an IV from the available list and stop from being chosen again. selectedIvs[i] = availableIVs[Random() % (NUM_STATS - i)]; - - // Remove the selected IV index from the available IV indices. RemoveIVIndexFromList(availableIVs, i); } // Determine which parent each of the selected IVs should inherit from. - for (i = 0; i < ARRAY_COUNT(selectedIvs); i++) + for (i = 0; i < INHERITED_IV_COUNT; i++) { - whichParent[i] = Random() % 2; + whichParents[i] = Random() % DAYCARE_MON_COUNT; } // Set each of inherited IVs on the egg mon. - for (i = 0; i < ARRAY_COUNT(selectedIvs); i++) + for (i = 0; i < INHERITED_IV_COUNT; i++) { 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; } @@ -638,14 +640,14 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru numSharedParentMoves = 0; for (i = 0; i < MAX_MON_MOVES; i++) { - sHatchedEggMotherMoves[i] = 0; - sHatchedEggFatherMoves[i] = 0; - sHatchedEggFinalMoves[i] = 0; + sHatchedEggMotherMoves[i] = MOVE_NONE; + sHatchedEggFatherMoves[i] = MOVE_NONE; + sHatchedEggFinalMoves[i] = MOVE_NONE; } for (i = 0; i < EGG_MOVES_ARRAY_COUNT; i++) - sHatchedEggEggMoves[i] = 0; + sHatchedEggEggMoves[i] = MOVE_NONE; for (i = 0; i < EGG_LVL_UP_MOVES_ARRAY_COUNT; i++) - sHatchedEggLevelUpMoves[i] = 0; + sHatchedEggLevelUpMoves[i] = MOVE_NONE; numLevelUpMoves = GetLevelUpMovesBySpecies(GetMonData(egg, MON_DATA_SPECIES), sHatchedEggLevelUpMoves); for (i = 0; i < MAX_MON_MOVES; i++) @@ -761,13 +763,10 @@ static void GiveVoltTackleIfLightBall(struct Pokemon *mon, struct DayCare *dayca static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parentSlots) { u16 i; - u16 species[2]; + u16 species[DAYCARE_MON_COUNT]; u16 eggSpecies; - // Determine which of the daycare mons is the mother and father of the egg. - // The 0th index of the parentSlots array is considered the mother slot, and the - // 1st index is the father slot. - for (i = 0; i < 2; i++) + for (i = 0; i < DAYCARE_MON_COUNT; i++) { species[i] = GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES); if (species[i] == SPECIES_DITTO) @@ -783,11 +782,11 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent } eggSpecies = GetEggSpecies(species[parentSlots[0]]); - if (eggSpecies == SPECIES_NIDORAN_F && daycare->offspringPersonality & 0x8000) + if (eggSpecies == SPECIES_NIDORAN_F && daycare->offspringPersonality & EGG_GENDER_MALE) { eggSpecies = SPECIES_NIDORAN_M; } - if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & 0x8000) + if (eggSpecies == SPECIES_ILLUMISE && daycare->offspringPersonality & EGG_GENDER_MALE) { eggSpecies = SPECIES_VOLBEAT; } @@ -795,19 +794,19 @@ static u16 DetermineEggSpeciesAndParentSlots(struct DayCare *daycare, u8 *parent // Make Ditto the "mother" slot if the other daycare mon is male. if (species[parentSlots[1]] == SPECIES_DITTO && GetBoxMonGender(&daycare->mons[parentSlots[0]].mon) != MON_FEMALE) { - u8 temp = parentSlots[1]; + u8 ditto = parentSlots[1]; parentSlots[1] = parentSlots[0]; - parentSlots[0] = temp; + parentSlots[0] = ditto; } return eggSpecies; } -static void _GiveEggFromDaycare(struct DayCare *daycare) // give_egg +static void _GiveEggFromDaycare(struct DayCare *daycare) { struct Pokemon egg; u16 species; - u8 parentSlots[2]; // 0th index is "mother" daycare slot, 1st is "father" + u8 parentSlots[DAYCARE_MON_COUNT]; bool8 isEgg; species = DetermineEggSpeciesAndParentSlots(daycare, parentSlots); @@ -835,7 +834,7 @@ void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation) u8 metLocation; u8 isEgg; - CreateMon(mon, species, EGG_HATCH_LEVEL, 0x20, FALSE, 0, OT_ID_PLAYER_ID, 0); + CreateMon(mon, species, EGG_HATCH_LEVEL, 32, FALSE, 0, OT_ID_PLAYER_ID, 0); metLevel = 0; ball = ITEM_POKE_BALL; language = LANGUAGE_JAPANESE; @@ -846,7 +845,7 @@ void CreateEgg(struct Pokemon *mon, u16 species, bool8 setHotSpringsLocation) SetMonData(mon, MON_DATA_LANGUAGE, &language); if (setHotSpringsLocation) { - metLocation = 253; // hot springs; see PokemonSummaryScreen_PrintEggTrainerMemo + metLocation = METLOC_SPECIAL_EGG; SetMonData(mon, MON_DATA_MET_LOCATION, &metLocation); } @@ -862,7 +861,7 @@ static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare * u8 language; personality = daycare->offspringPersonality; - CreateMon(mon, species, EGG_HATCH_LEVEL, 0x20, TRUE, personality, OT_ID_PLAYER_ID, 0); + CreateMon(mon, species, EGG_HATCH_LEVEL, 32, TRUE, personality, OT_ID_PLAYER_ID, 0); metLevel = 0; ball = ITEM_POKE_BALL; language = LANGUAGE_JAPANESE; @@ -878,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; @@ -888,15 +887,16 @@ static bool8 _DoEggActions_CheckHatch(struct DayCare *daycare) daycare->mons[i].steps++, validEggs++; } - // try to trigger poke sex - if (daycare->offspringPersonality == 0 && validEggs == 2 && (daycare->mons[1].steps & 0xFF) == 0xFF) + // 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(); @@ -909,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; @@ -918,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; @@ -926,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) @@ -947,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); } @@ -971,26 +971,19 @@ void GetDaycareMonNicknames(void) u8 GetDaycareState(void) { - // The daycare can be in 4 possible states: - // 0: default state--no deposited mons, no egg - // 1: there is an egg waiting for the player to pick it up - // 2: there is a single pokemon in the daycare - // 3: there are two pokemon in the daycare, no egg - u8 numMons; if (IsEggPending(&gSaveBlock1Ptr->daycare)) { - // There is an Egg waiting for the player. - return 1; + return DAYCARE_EGG_WAITING; } numMons = CountPokemonInDaycare(&gSaveBlock1Ptr->daycare); if (numMons != 0) { - return numMons + 1; + return numMons + 1; // DAYCARE_ONE_MON or DAYCARE_TWO_MONS } - return 0; + return DAYCARE_NO_MONS; } static u8 GetDaycarePokemonCount(void) @@ -1002,15 +995,15 @@ static u8 GetDaycarePokemonCount(void) return 0; } +// Determine if the two given egg group lists contain any of the +// same egg groups. static bool8 EggGroupsOverlap(u16 *eggGroups1, u16 *eggGroups2) { - // Determine if the two given egg group lists contain any of the - // same egg groups. s32 i, j; - for (i = 0; i < 2; i++) + for (i = 0; i < EGG_GROUPS_PER_MON; i++) { - for (j = 0; j < 2; j++) + for (j = 0; j < EGG_GROUPS_PER_MON; j++) { if (eggGroups1[i] == eggGroups2[j]) return TRUE; @@ -1023,12 +1016,12 @@ static bool8 EggGroupsOverlap(u16 *eggGroups1, u16 *eggGroups2) static u8 GetDaycareCompatibilityScore(struct DayCare *daycare) { u32 i; - u16 eggGroups[2][2]; - u16 species[2]; - u32 trainerIds[2]; - u32 genders[2]; + u16 eggGroups[DAYCARE_MON_COUNT][EGG_GROUPS_PER_MON]; + u16 species[DAYCARE_MON_COUNT]; + u32 trainerIds[DAYCARE_MON_COUNT]; + u32 genders[DAYCARE_MON_COUNT]; - for (i = 0; i < 2; i++) + for (i = 0; i < DAYCARE_MON_COUNT; i++) { u32 personality; @@ -1042,41 +1035,42 @@ static u8 GetDaycareCompatibilityScore(struct DayCare *daycare) // check unbreedable egg group if (eggGroups[0][0] == EGG_GROUP_UNDISCOVERED || eggGroups[1][0] == EGG_GROUP_UNDISCOVERED) - return 0; + return PARENTS_INCOMPATIBLE; // two Ditto can't breed if (eggGroups[0][0] == EGG_GROUP_DITTO && eggGroups[1][0] == EGG_GROUP_DITTO) - return 0; + return PARENTS_INCOMPATIBLE; - // now that we checked, one ditto can breed with any other mon + // one parent is Ditto if (eggGroups[0][0] == EGG_GROUP_DITTO || eggGroups[1][0] == EGG_GROUP_DITTO) { - if (trainerIds[0] == trainerIds[1]) // same trainer - return 20; + if (trainerIds[0] == trainerIds[1]) + return PARENTS_LOW_COMPATIBILITY; - return 50; // different trainers, more chance of poke sex + return PARENTS_MED_COMPATABILITY; } + // neither parent is Ditto else { - if (genders[0] == genders[1]) // no homo - return 0; + if (genders[0] == genders[1]) + return PARENTS_INCOMPATIBLE; if (genders[0] == MON_GENDERLESS || genders[1] == MON_GENDERLESS) - return 0; - if (!EggGroupsOverlap(eggGroups[0], eggGroups[1])) // not compatible with each other - return 0; + return PARENTS_INCOMPATIBLE; + if (!EggGroupsOverlap(eggGroups[0], eggGroups[1])) + return PARENTS_INCOMPATIBLE; - if (species[0] == species[1]) // same species + if (species[0] == species[1]) { - if (trainerIds[0] == trainerIds[1]) // same species and trainer - return 50; + if (trainerIds[0] == trainerIds[1]) + return PARENTS_MED_COMPATABILITY; // same species, same trainer - return 70; // different trainers, same species + return PARENTS_MAX_COMPATABILITY; // same species, different trainers } else { - if (trainerIds[0] != trainerIds[1]) // different trainers, different species - return 50; + if (trainerIds[0] != trainerIds[1]) + return PARENTS_MED_COMPATABILITY; // different species, different trainers - return 20; // different species, same trainer + return PARENTS_LOW_COMPATIBILITY; // different species, same trainer } } } @@ -1093,13 +1087,13 @@ void SetDaycareCompatibilityString(void) relationshipScore = GetDaycareCompatibilityScoreFromSave(); whichString = 0; - if (relationshipScore == 0) + if (relationshipScore == PARENTS_INCOMPATIBLE) whichString = 3; - if (relationshipScore == 20) + if (relationshipScore == PARENTS_LOW_COMPATIBILITY) whichString = 2; - if (relationshipScore == 50) + if (relationshipScore == PARENTS_MED_COMPATABILITY) whichString = 1; - if (relationshipScore == 70) + if (relationshipScore == PARENTS_MAX_COMPATABILITY) whichString = 0; StringCopy(gStringVar4, sCompatibilityMessages[whichString]); @@ -1108,20 +1102,20 @@ void SetDaycareCompatibilityString(void) bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio) { u8 i; - u8 symbolsCount[2]; // male, female - symbolsCount[0] = symbolsCount[1] = 0; + u8 symbolsCount[GENDER_COUNT]; + symbolsCount[MALE] = symbolsCount[FEMALE] = 0; for (i = 0; name[i] != EOS; i++) { if (name[i] == CHAR_MALE) - symbolsCount[0]++; + symbolsCount[MALE]++; if (name[i] == CHAR_FEMALE) - symbolsCount[1]++; + symbolsCount[FEMALE]++; } - if (genderRatio == MON_MALE && symbolsCount[0] != 0 && symbolsCount[1] == 0) + if (genderRatio == MON_MALE && symbolsCount[MALE] != 0 && symbolsCount[FEMALE] == 0) return TRUE; - if (genderRatio == MON_FEMALE && symbolsCount[1] != 0 && symbolsCount[0] == 0) + if (genderRatio == MON_FEMALE && symbolsCount[FEMALE] != 0 && symbolsCount[MALE] == 0) return TRUE; return FALSE; @@ -1150,13 +1144,13 @@ static u8 *AppendMonGenderSymbol(u8 *name, struct BoxPokemon *boxMon) static void GetDaycareLevelMenuText(struct DayCare *daycare, u8 *dest) { - u8 monNames[2][20]; + u8 monNames[DAYCARE_MON_COUNT][20]; u8 i; *dest = EOS; - for (i = 0; i < 2; i++) + 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); } @@ -1174,7 +1168,7 @@ static void GetDaycareLevelMenuLevelText(struct DayCare *daycare, u8 *dest) u8 text[20]; *dest = EOS; - for (i = 0; i < 2; i++) + for (i = 0; i < DAYCARE_MON_COUNT; i++) { StringAppend(dest, gText_Lv); level = GetLevelAfterDaycareSteps(&daycare->mons[i].mon, daycare->mons[i].steps); @@ -1206,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) @@ -1234,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); } } @@ -1254,8 +1248,8 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId) case 1: gSpecialVar_Result = input; break; - case 5: - gSpecialVar_Result = 2; + case DAYCARE_LEVEL_MENU_EXIT: + gSpecialVar_Result = DAYCARE_EXITED_LEVEL_MENU; break; } DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL); @@ -1266,7 +1260,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId) } else if (gMain.newKeys & B_BUTTON) { - gSpecialVar_Result = 2; + gSpecialVar_Result = DAYCARE_EXITED_LEVEL_MENU; DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL); ClearStdWindowAndFrame(gTasks[taskId].tWindowId, TRUE); RemoveWindow(gTasks[taskId].tWindowId); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 4fba8578c..1eaf4e4a1 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -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); @@ -388,17 +388,17 @@ void ScriptHatchMon(void) AddHatchedMonToParty(gSpecialVar_0x8004); } -static bool8 sub_807158C(struct DayCare *daycare, u8 daycareId) +static bool8 _CheckDaycareMonReceivedMail(struct DayCare *daycare, u8 daycareId) { - u8 nick[0x20]; + u8 nickname[32]; struct DaycareMon *daycareMon = &daycare->mons[daycareId]; - GetBoxMonNick(&daycareMon->mon, nick); - if (daycareMon->mail.message.itemId != 0 - && (StringCompareWithoutExtCtrlCodes(nick, daycareMon->mail.monName) != 0 + GetBoxMonNickname(&daycareMon->mon, nickname); + if (daycareMon->mail.message.itemId != ITEM_NONE + && (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; @@ -406,9 +406,9 @@ static bool8 sub_807158C(struct DayCare *daycare, u8 daycareId) return FALSE; } -bool8 sub_8071614(void) +bool8 CheckDaycareMonReceivedMail(void) { - return sub_807158C(&gSaveBlock1Ptr->daycare, gSpecialVar_0x8004); + return _CheckDaycareMonReceivedMail(&gSaveBlock1Ptr->daycare, gSpecialVar_0x8004); } static u8 EggHatchCreateMonSprite(u8 a0, u8 switchID, u8 pokeID, u16* speciesLoc) @@ -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); @@ -880,9 +880,9 @@ u8 GetEggStepsToSubtract(void) return 1; } -u16 sub_80722E0(void) +u16 CountPartyAliveNonEggMons(void) { u16 aliveNonEggMonsCount = CountStorageNonEggMons(); - aliveNonEggMonsCount += CountPartyAliveNonEggMonsExcept(6); + aliveNonEggMonsCount += CountPartyAliveNonEggMonsExcept(PARTY_SIZE); return aliveNonEggMonsCount; } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 932ed5b08..8697c557f 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -224,10 +224,10 @@ static void DrawExperienceProgressBar(struct Pokemon* mon); static void DrawContestMoveHearts(u16 move); static void LimitEggSummaryPageDisplay(void); static void ResetWindows(void); -static void sub_81C25E8(void); -static void sub_81C2628(void); -static void sub_81C2794(void); -static void sub_81C27DC(struct Pokemon *mon, u16 a); +static void PrintMonInfo(void); +static void PrintNotEggInfo(void); +static void PrintEggInfo(void); +static void PrintGenderSymbol(struct Pokemon *mon, u16 a); static void PrintPageNamesAndStatsPageToWindows(void); static void CreatePageWindowTilemaps(u8 a); static void ClearPageWindowTilemaps(u8 a); @@ -1173,7 +1173,7 @@ static bool8 SummaryScreen_LoadGraphics(void) gMain.state++; break; case 11: - sub_81C25E8(); + PrintMonInfo(); gMain.state++; break; case 12: @@ -1449,7 +1449,7 @@ static void sub_81C0348(void) DrawPokerusCuredSymbol(&sMonSummaryScreen->currentMon); } -static void sub_81C0434(void) +static void FreeSummaryScreen(void) { FreeAllWindowBuffers(); Free(sMonSummaryScreen); @@ -1474,7 +1474,7 @@ static void CloseSummaryScreen(u8 taskId) m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100); if (gMonSpritesGfxPtr == 0) sub_806F47C(0); - sub_81C0434(); + FreeSummaryScreen(); DestroyTask(taskId); } } @@ -1625,7 +1625,7 @@ static void sub_81C0704(u8 taskId) SetTypeIcons(); break; case 10: - sub_81C25E8(); + PrintMonInfo(); break; case 11: PrintPageSpecificText(sMonSummaryScreen->currPageIndex); @@ -2571,7 +2571,7 @@ static void DrawPokerusCuredSymbol(struct Pokemon *mon) // This checks if the mo schedule_bg_copy_tilemap_to_vram(3); } -static void sub_81C228C(bool8 isMonShiny) +static void SetDexNumberColor(bool8 isMonShiny) { if (!isMonShiny) sub_8199C30(3, 1, 4, 8, 8, 0); @@ -2695,19 +2695,19 @@ static void SummaryScreen_PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, AddTextPrinterParameterized4(windowId, 1, x, y, 0, lineSpacing, sTextColors_861CD2C[colorId], 0, string); } -static void sub_81C25E8(void) +static void PrintMonInfo(void) { FillWindowPixelBuffer(PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER, PIXEL_FILL(0)); FillWindowPixelBuffer(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME, PIXEL_FILL(0)); FillWindowPixelBuffer(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, PIXEL_FILL(0)); if (!sMonSummaryScreen->summary.isEgg) - sub_81C2628(); + PrintNotEggInfo(); else - sub_81C2794(); + PrintEggInfo(); schedule_bg_copy_tilemap_to_vram(0); } -static void sub_81C2628(void) +static void PrintNotEggInfo(void) { u8 strArray[16]; struct Pokemon *mon = &sMonSummaryScreen->currentMon; @@ -2721,12 +2721,12 @@ static void sub_81C2628(void) if (!IsMonShiny(mon)) { SummaryScreen_PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER, gStringVar1, 0, 1, 0, 1); - sub_81C228C(FALSE); + SetDexNumberColor(FALSE); } else { SummaryScreen_PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER, gStringVar1, 0, 1, 0, 7); - sub_81C228C(TRUE); + SetDexNumberColor(TRUE); } PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER); } @@ -2734,9 +2734,9 @@ static void sub_81C2628(void) { ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_DEX_NUMBER); if (!IsMonShiny(mon)) - sub_81C228C(FALSE); + SetDexNumberColor(FALSE); else - sub_81C228C(TRUE); + SetDexNumberColor(TRUE); } StringCopy(gStringVar1, &gText_LevelSymbol[0]); ConvertIntToDecimalStringN(gStringVar2, summary->level, 0, 3); @@ -2747,12 +2747,12 @@ static void sub_81C2628(void) strArray[0] = CHAR_SLASH; StringCopy(&strArray[1], &gSpeciesNames[summary->species2][0]); SummaryScreen_PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_SPECIES, &strArray[0], 0, 1, 0, 1); - sub_81C27DC(mon, summary->species2); + PrintGenderSymbol(mon, summary->species2); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME); PutWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); } -static void sub_81C2794(void) +static void PrintEggInfo(void) { GetMonNickname(&sMonSummaryScreen->currentMon, gStringVar1); SummaryScreen_PrintTextOnWindow(PSS_LABEL_WINDOW_PORTRAIT_NICKNAME, gStringVar1, 0, 1, 0, 1); @@ -2761,7 +2761,7 @@ static void sub_81C2794(void) ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES); } -static void sub_81C27DC(struct Pokemon *mon, u16 species) +static void PrintGenderSymbol(struct Pokemon *mon, u16 species) { if (species != SPECIES_NIDORAN_M && species != SPECIES_NIDORAN_F) { diff --git a/src/strings.c b/src/strings.c index 36674e875..ed702958e 100644 --- a/src/strings.c +++ b/src/strings.c @@ -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"); |