From b89c3e901e1de2f3513d74fa548373d82d3f26d0 Mon Sep 17 00:00:00 2001 From: Deokishisu <6993375+Deokishisu@users.noreply.github.com> Date: Mon, 15 Feb 2021 11:40:16 -0500 Subject: Fix giftRibbons Field in SaveBlock1 & Relabel Gift Ribbons in pokemon.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The giftRibbons field has been split out into proper subfields. The new ExternalEvent structs deal with interconnectivity between external games/peripherals and Emerald, such as PokéCoupon storage and the flag for receiving Wishmaker Jirachi. The giftRibbon fields in `PokemonSubstruct3` have also been renamed to their appropriate ribbons, and commented with distribution info if applicable. The previous `fatefulEncounter` field was actually filler, and relabeled as such, while the obedient bit was renamed `fatefulEncounter`. All relevant constants and functions dealing with the Pokémon data structure were renamed with these changes in mind. --- src/pokemon_size_record.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/pokemon_size_record.c') diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index f8b361912..5b80fd428 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -38,9 +38,9 @@ static const struct UnknownStruct sBigMonSizeTable[] = static const u8 sGiftRibbonsMonDataIds[] = { - MON_DATA_GIFT_RIBBON_1, MON_DATA_GIFT_RIBBON_2, MON_DATA_GIFT_RIBBON_3, - MON_DATA_GIFT_RIBBON_4, MON_DATA_GIFT_RIBBON_5, MON_DATA_GIFT_RIBBON_6, - MON_DATA_GIFT_RIBBON_7 + MON_DATA_MARINE_RIBBON, MON_DATA_LAND_RIBBON, MON_DATA_SKY_RIBBON, + MON_DATA_COUNTRY_RIBBON, MON_DATA_NATIONAL_RIBBON, MON_DATA_EARTH_RIBBON, + MON_DATA_WORLD_RIBBON }; extern const u8 gText_DecimalPoint[]; -- cgit v1.2.3 From e059c4fdfa0fe36aceac4b283176825ad759fe5d Mon Sep 17 00:00:00 2001 From: GriffinR Date: Wed, 17 Feb 2021 14:11:45 -0500 Subject: Use new gift ribbons size, label unused ribbons --- src/pokemon_size_record.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/pokemon_size_record.c') diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 5b80fd428..2f76c5d69 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -36,7 +36,8 @@ static const struct UnknownStruct sBigMonSizeTable[] = { 1700, 1, -26 }, }; -static const u8 sGiftRibbonsMonDataIds[] = +// - 4 for unused gift ribbon bits in MON_DATA_UNUSED_RIBBONS +static const u8 sGiftRibbonsMonDataIds[GIFT_RIBBONS_COUNT - 4] = { MON_DATA_MARINE_RIBBON, MON_DATA_LAND_RIBBON, MON_DATA_SKY_RIBBON, MON_DATA_COUNTRY_RIBBON, MON_DATA_NATIONAL_RIBBON, MON_DATA_EARTH_RIBBON, @@ -200,7 +201,7 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId) u8 array[8]; memcpy(array, sGiftRibbonsMonDataIds, sizeof(sGiftRibbonsMonDataIds)); - if (index < 11 && ribbonId < 65) + if (index < GIFT_RIBBONS_COUNT && ribbonId < 65) { gSaveBlock1Ptr->giftRibbons[index] = ribbonId; for (i = 0; i < PARTY_SIZE; i++) -- cgit v1.2.3 From 02c1fbd733da15e82687ec2d346b8151ca00ccf8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 18 Feb 2021 09:59:24 -0500 Subject: Document ribbon TV show, add new ribbon IDs/size --- src/pokemon_size_record.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/pokemon_size_record.c') diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 2f76c5d69..4beb9c83f 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -198,10 +198,10 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId) s32 i; bool32 gotRibbon = FALSE; u8 data = 1; - u8 array[8]; + u8 array[ARRAY_COUNT(sGiftRibbonsMonDataIds)]; memcpy(array, sGiftRibbonsMonDataIds, sizeof(sGiftRibbonsMonDataIds)); - if (index < GIFT_RIBBONS_COUNT && ribbonId < 65) + if (index < GIFT_RIBBONS_COUNT && ribbonId <= MAX_GIFT_RIBBON) { gSaveBlock1Ptr->giftRibbons[index] = ribbonId; for (i = 0; i < PARTY_SIZE; i++) -- cgit v1.2.3 From 608c829acde07dd780371a3adf9e7d3f546402fb Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Sat, 1 May 2021 01:41:27 -0400 Subject: change usages of float/double to f32/f64 --- src/pokemon_size_record.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pokemon_size_record.c') diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 4beb9c83f..7c88e5bf1 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -97,7 +97,7 @@ static void FormatMonSizeRecord(u8 *string, u32 size) { #ifdef UNITS_IMPERIAL //Convert size from centimeters to inches - size = (double)(size * 10) / (CM_PER_INCH * 10); + size = (f64)(size * 10) / (CM_PER_INCH * 10); #endif string = ConvertIntToDecimalStringN(string, size / 10, STR_CONV_MODE_LEFT_ALIGN, 8); -- cgit v1.2.3