From 1f4ef2a0fb26f10f37686aa9c0da6b356f898721 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 25 Aug 2022 10:32:14 -0300 Subject: [PATCH 1/3] Added constants for GetLeadMonFriendshipScore --- data/maps/PacifidlogTown_House2/scripts.inc | 4 ++-- .../maps/SlateportCity_PokemonFanClub/scripts.inc | 2 +- .../scripts.inc | 14 +++++++------- include/constants/pokemon.h | 9 +++++++++ src/field_specials.c | 15 ++++++++------- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/data/maps/PacifidlogTown_House2/scripts.inc b/data/maps/PacifidlogTown_House2/scripts.inc index 3dedcec30f..b5868625f0 100644 --- a/data/maps/PacifidlogTown_House2/scripts.inc +++ b/data/maps/PacifidlogTown_House2/scripts.inc @@ -11,9 +11,9 @@ PacifidlogTown_House2_EventScript_FanClubYoungerBrother:: call_if_unset FLAG_MET_FANCLUB_YOUNGER_BROTHER, PacifidlogTown_House2_EventScript_FirstMonAssessment setflag FLAG_MET_FANCLUB_YOUNGER_BROTHER specialvar VAR_RESULT, GetLeadMonFriendshipScore - goto_if_ge VAR_RESULT, 4, PacifidlogTown_House2_EventScript_GiveReturn + goto_if_ge VAR_RESULT, FRIENDSHIP_GE_150, PacifidlogTown_House2_EventScript_GiveReturn specialvar VAR_RESULT, GetLeadMonFriendshipScore - goto_if_ge VAR_RESULT, 2, PacifidlogTown_House2_EventScript_PutInEffort + goto_if_ge VAR_RESULT, FRIENDSHIP_GE_50, PacifidlogTown_House2_EventScript_PutInEffort goto PacifidlogTown_House2_EventScript_GiveFrustration end diff --git a/data/maps/SlateportCity_PokemonFanClub/scripts.inc b/data/maps/SlateportCity_PokemonFanClub/scripts.inc index b97e29a028..22145e774b 100644 --- a/data/maps/SlateportCity_PokemonFanClub/scripts.inc +++ b/data/maps/SlateportCity_PokemonFanClub/scripts.inc @@ -192,7 +192,7 @@ SlateportCity_PokemonFanClub_EventScript_SootheBellWoman:: goto_if_set FLAG_RECEIVED_SOOTHE_BELL, SlateportCity_PokemonFanClub_EventScript_ReceivedSootheBell msgbox SlateportCity_PokemonFanClub_Text_ShowMePokemonThatLoveYou, MSGBOX_DEFAULT specialvar VAR_RESULT, GetLeadMonFriendshipScore - goto_if_ge VAR_RESULT, 4, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell + goto_if_ge VAR_RESULT, FRIENDSHIP_GE_150, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell release end diff --git a/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc b/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc index 84cdef029e..98ac7273e0 100644 --- a/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc +++ b/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc @@ -7,13 +7,13 @@ VerdanturfTown_FriendshipRatersHouse_EventScript_FriendshipRater:: msgbox VerdanturfTown_FriendshipRatersHouse_Text_SeeHowMuchPokemonLikesYou, MSGBOX_DEFAULT specialvar VAR_RESULT, GetLeadMonFriendshipScore switch VAR_RESULT - case 0, VerdanturfTown_FriendshipRatersHouse_EventScript_DetestsYou - case 1, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary - case 2, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou - case 3, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou - case 4, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot - case 5, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy - case 6, VerdanturfTown_FriendshipRatersHouse_EventScript_AdoresYou + case FRIENDSHIP_NONE, VerdanturfTown_FriendshipRatersHouse_EventScript_DetestsYou + case FRIENDSHIP_GE_1, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary + case FRIENDSHIP_GE_50, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou + case FRIENDSHIP_GE_100, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou + case FRIENDSHIP_GE_150, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot + case FRIENDSHIP_GE_200, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy + case FRIENDSHIP_MAX, VerdanturfTown_FriendshipRatersHouse_EventScript_AdoresYou release end diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 40af999fde..01449fab90 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -181,6 +181,15 @@ #define FRIENDSHIP_EVENT_FAINT_FIELD_PSN 7 #define FRIENDSHIP_EVENT_FAINT_LARGE 8 // If opponent was >= 30 levels higher. See AdjustFriendshipOnBattleFaint +// Constants for GetLeadMonFriendshipScore +#define FRIENDSHIP_NONE 0 +#define FRIENDSHIP_GE_1 1 +#define FRIENDSHIP_GE_50 2 +#define FRIENDSHIP_GE_100 3 +#define FRIENDSHIP_GE_150 4 +#define FRIENDSHIP_GE_200 5 +#define FRIENDSHIP_MAX 6 + #define MAX_FRIENDSHIP 255 #define MAX_SHEEN 255 #define MAX_CONDITION 255 diff --git a/src/field_specials.c b/src/field_specials.c index 7c226e7a39..41f84dff70 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -65,6 +65,7 @@ #include "constants/weather.h" #include "constants/metatile_labels.h" #include "palette.h" +#include "constants/pokemon.h" EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE; EWRAM_DATA u8 gBikeCollisions = 0; @@ -941,19 +942,19 @@ u8 GetLeadMonFriendshipScore(void) { struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()]; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP) - return 6; + return FRIENDSHIP_MAX; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200) - return 5; + return FRIENDSHIP_GE_200; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150) - return 4; + return FRIENDSHIP_GE_150; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100) - return 3; + return FRIENDSHIP_GE_100; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50) - return 2; + return FRIENDSHIP_GE_50; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1) - return 1; + return FRIENDSHIP_GE_1; - return 0; + return FRIENDSHIP_NONE; } static void CB2_FieldShowRegionMap(void) From 11d6ae48205d01710d4fc8c961bd29f053272678 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 25 Aug 2022 11:34:37 -0300 Subject: [PATCH 2/3] Renamed the GetLeadMonFriendshipScore constants --- data/maps/PacifidlogTown_House2/scripts.inc | 4 ++-- data/maps/SlateportCity_PokemonFanClub/scripts.inc | 2 +- .../scripts.inc | 10 +++++----- include/constants/pokemon.h | 14 +++++++------- src/field_specials.c | 10 +++++----- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/data/maps/PacifidlogTown_House2/scripts.inc b/data/maps/PacifidlogTown_House2/scripts.inc index b5868625f0..175b477e7a 100644 --- a/data/maps/PacifidlogTown_House2/scripts.inc +++ b/data/maps/PacifidlogTown_House2/scripts.inc @@ -11,9 +11,9 @@ PacifidlogTown_House2_EventScript_FanClubYoungerBrother:: call_if_unset FLAG_MET_FANCLUB_YOUNGER_BROTHER, PacifidlogTown_House2_EventScript_FirstMonAssessment setflag FLAG_MET_FANCLUB_YOUNGER_BROTHER specialvar VAR_RESULT, GetLeadMonFriendshipScore - goto_if_ge VAR_RESULT, FRIENDSHIP_GE_150, PacifidlogTown_House2_EventScript_GiveReturn + goto_if_ge VAR_RESULT, FRIENDSHIP_150_TO_199, PacifidlogTown_House2_EventScript_GiveReturn specialvar VAR_RESULT, GetLeadMonFriendshipScore - goto_if_ge VAR_RESULT, FRIENDSHIP_GE_50, PacifidlogTown_House2_EventScript_PutInEffort + goto_if_ge VAR_RESULT, FRIENDSHIP_50_TO_99, PacifidlogTown_House2_EventScript_PutInEffort goto PacifidlogTown_House2_EventScript_GiveFrustration end diff --git a/data/maps/SlateportCity_PokemonFanClub/scripts.inc b/data/maps/SlateportCity_PokemonFanClub/scripts.inc index 22145e774b..3b50428614 100644 --- a/data/maps/SlateportCity_PokemonFanClub/scripts.inc +++ b/data/maps/SlateportCity_PokemonFanClub/scripts.inc @@ -192,7 +192,7 @@ SlateportCity_PokemonFanClub_EventScript_SootheBellWoman:: goto_if_set FLAG_RECEIVED_SOOTHE_BELL, SlateportCity_PokemonFanClub_EventScript_ReceivedSootheBell msgbox SlateportCity_PokemonFanClub_Text_ShowMePokemonThatLoveYou, MSGBOX_DEFAULT specialvar VAR_RESULT, GetLeadMonFriendshipScore - goto_if_ge VAR_RESULT, FRIENDSHIP_GE_150, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell + goto_if_ge VAR_RESULT, FRIENDSHIP_150_TO_199, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell release end diff --git a/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc b/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc index 98ac7273e0..97e522471f 100644 --- a/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc +++ b/data/maps/VerdanturfTown_FriendshipRatersHouse/scripts.inc @@ -8,11 +8,11 @@ VerdanturfTown_FriendshipRatersHouse_EventScript_FriendshipRater:: specialvar VAR_RESULT, GetLeadMonFriendshipScore switch VAR_RESULT case FRIENDSHIP_NONE, VerdanturfTown_FriendshipRatersHouse_EventScript_DetestsYou - case FRIENDSHIP_GE_1, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary - case FRIENDSHIP_GE_50, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou - case FRIENDSHIP_GE_100, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou - case FRIENDSHIP_GE_150, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot - case FRIENDSHIP_GE_200, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy + case FRIENDSHIP_1_TO_49, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary + case FRIENDSHIP_50_TO_99, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou + case FRIENDSHIP_100_TO_149, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou + case FRIENDSHIP_150_TO_199, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot + case FRIENDSHIP_200_TO_254, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy case FRIENDSHIP_MAX, VerdanturfTown_FriendshipRatersHouse_EventScript_AdoresYou release end diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 01449fab90..0e17357a32 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -182,13 +182,13 @@ #define FRIENDSHIP_EVENT_FAINT_LARGE 8 // If opponent was >= 30 levels higher. See AdjustFriendshipOnBattleFaint // Constants for GetLeadMonFriendshipScore -#define FRIENDSHIP_NONE 0 -#define FRIENDSHIP_GE_1 1 -#define FRIENDSHIP_GE_50 2 -#define FRIENDSHIP_GE_100 3 -#define FRIENDSHIP_GE_150 4 -#define FRIENDSHIP_GE_200 5 -#define FRIENDSHIP_MAX 6 +#define FRIENDSHIP_NONE 0 +#define FRIENDSHIP_1_TO_49 1 +#define FRIENDSHIP_50_TO_99 2 +#define FRIENDSHIP_100_TO_149 3 +#define FRIENDSHIP_150_TO_199 4 +#define FRIENDSHIP_200_TO_254 5 +#define FRIENDSHIP_MAX 6 #define MAX_FRIENDSHIP 255 #define MAX_SHEEN 255 diff --git a/src/field_specials.c b/src/field_specials.c index 41f84dff70..9a2742b70b 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -944,15 +944,15 @@ u8 GetLeadMonFriendshipScore(void) if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == MAX_FRIENDSHIP) return FRIENDSHIP_MAX; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200) - return FRIENDSHIP_GE_200; + return FRIENDSHIP_200_TO_254; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150) - return FRIENDSHIP_GE_150; + return FRIENDSHIP_150_TO_199; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100) - return FRIENDSHIP_GE_100; + return FRIENDSHIP_100_TO_149; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50) - return FRIENDSHIP_GE_50; + return FRIENDSHIP_50_TO_99; if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1) - return FRIENDSHIP_GE_1; + return FRIENDSHIP_1_TO_49; return FRIENDSHIP_NONE; } From 23bf67c63ffd46258f8a435314c8fb67213cd9b6 Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Thu, 25 Aug 2022 11:43:01 -0300 Subject: [PATCH 3/3] Removed unnecessary inclusion of header in src/field_specials.c --- src/field_specials.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/field_specials.c b/src/field_specials.c index 9a2742b70b..6aa62d22f4 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -65,7 +65,6 @@ #include "constants/weather.h" #include "constants/metatile_labels.h" #include "palette.h" -#include "constants/pokemon.h" EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE; EWRAM_DATA u8 gBikeCollisions = 0;