From c64453efe50959e6286e984a2a7dda47a1d86831 Mon Sep 17 00:00:00 2001 From: NT_x86 Date: Sat, 13 Apr 2024 10:14:31 +0300 Subject: [PATCH 1/6] Fix poison projectile array being incorrectly combined into three seperate arrays --- src/battle_anim_poison.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/battle_anim_poison.c b/src/battle_anim_poison.c index d9a15c835cf6..bfe1fc835f8a 100644 --- a/src/battle_anim_poison.c +++ b/src/battle_anim_poison.c @@ -59,15 +59,7 @@ static const union AnimCmd sAnim_SludgeBombHit[] = static const union AnimCmd *const sAnims_PoisonProjectile[] = { sAnim_PoisonProjectile, -}; - -static const union AnimCmd *const sAnims_AcidPoisonDroplet[] = -{ sAnim_AcidPoisonDroplet, -}; - -static const union AnimCmd *const sAnims_SludgeBombHit[] = -{ sAnim_SludgeBombHit, }; @@ -122,7 +114,7 @@ const struct SpriteTemplate gSludgeBombHitParticleSpriteTemplate = .tileTag = ANIM_TAG_POISON_BUBBLE, .paletteTag = ANIM_TAG_POISON_BUBBLE, .oam = &gOamData_AffineNormal_ObjNormal_16x16, - .anims = sAnims_SludgeBombHit, + .anims = &sAnims_PoisonProjectile[2], .images = NULL, .affineAnims = sAffineAnims_SludgeBombHit, .callback = AnimSludgeBombHitParticle, @@ -145,7 +137,7 @@ const struct SpriteTemplate gAcidPoisonDropletSpriteTemplate = .tileTag = ANIM_TAG_POISON_BUBBLE, .paletteTag = ANIM_TAG_POISON_BUBBLE, .oam = &gOamData_AffineDouble_ObjNormal_16x16, - .anims = sAnims_AcidPoisonDroplet, + .anims = &sAnims_PoisonProjectile[1], .images = NULL, .affineAnims = gAffineAnims_Droplet, .callback = AnimAcidPoisonDroplet, From 2b78a85828eb40b68a0973615665fd22b961bfd9 Mon Sep 17 00:00:00 2001 From: NT_x86 Date: Sat, 13 Apr 2024 13:09:24 +0300 Subject: [PATCH 2/6] Fix hoenn pokedex palette being split in two --- graphics/pokedex/bg_hoenn.pal | 50 ++++++++++++++++++++++++++++- graphics/pokedex/caught_screen.pal | 51 ------------------------------ src/graphics.c | 1 - src/pokedex.c | 2 +- 4 files changed, 50 insertions(+), 54 deletions(-) delete mode 100644 graphics/pokedex/caught_screen.pal diff --git a/graphics/pokedex/bg_hoenn.pal b/graphics/pokedex/bg_hoenn.pal index 569c7821a9db..01bd8a3a3d70 100644 --- a/graphics/pokedex/bg_hoenn.pal +++ b/graphics/pokedex/bg_hoenn.pal @@ -1,6 +1,6 @@ JASC-PAL 0100 -48 +96 123 131 0 255 255 255 222 222 222 @@ -49,3 +49,51 @@ JASC-PAL 49 139 255 189 156 90 0 0 0 +123 131 0 +255 255 255 +255 238 0 +255 189 0 +255 115 0 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +49 213 74 +24 131 32 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +189 0 0 +74 148 180 +8 90 131 +189 156 90 +0 0 0 +123 131 0 +255 255 255 +197 32 32 +189 189 189 +164 164 164 +98 98 115 +41 57 65 +41 57 106 +0 0 41 +255 255 255 +238 246 57 +255 0 189 +180 205 246 +49 139 255 +189 156 90 +0 0 0 diff --git a/graphics/pokedex/caught_screen.pal b/graphics/pokedex/caught_screen.pal deleted file mode 100644 index 26da98a84c9d..000000000000 --- a/graphics/pokedex/caught_screen.pal +++ /dev/null @@ -1,51 +0,0 @@ -JASC-PAL -0100 -48 -123 131 0 -255 255 255 -255 238 0 -255 189 0 -255 115 0 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -255 0 189 -49 213 74 -24 131 32 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -189 0 0 -74 148 180 -8 90 131 -189 156 90 -0 0 0 -123 131 0 -255 255 255 -197 32 32 -189 189 189 -164 164 164 -98 98 115 -41 57 65 -41 57 106 -0 0 41 -255 255 255 -238 246 57 -255 0 189 -180 205 246 -49 139 255 -189 156 90 -0 0 0 diff --git a/src/graphics.c b/src/graphics.c index 8f1bc89ea641..26120226951e 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1230,7 +1230,6 @@ const u16 gFrontierPassMedalsGold_Pal[] = INCBIN_U16("graphics/frontier_pass/gol // Pokédex const u16 gPokedexBgHoenn_Pal[] = INCBIN_U16("graphics/pokedex/bg_hoenn.gbapal"); -const u16 gPokedexCaughtScreen_Pal[] = INCBIN_U16("graphics/pokedex/caught_screen.gbapal"); const u16 gPokedexSearchResults_Pal[] = INCBIN_U16("graphics/pokedex/search_results_bg.gbapal"); const u16 gPokedexBgNational_Pal[] = INCBIN_U16("graphics/pokedex/bg_national.gbapal"); const u32 gPokedexMenu_Gfx[] = INCBIN_U32("graphics/pokedex/menu.4bpp.lz"); diff --git a/src/pokedex.c b/src/pokedex.c index 0d1520a49084..09a25b872b2d 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4036,7 +4036,7 @@ static void Task_HandleCaughtMonPageInput(u8 taskId) } else { - LoadPalette(gPokedexCaughtScreen_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); + LoadPalette(gPokedexBgHoenn_Pal + 49, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7)); } } From 5dbd90b917c2474cd89b45b2c2e33e1544c43b0e Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 19 Apr 2024 14:17:12 -0400 Subject: [PATCH 3/6] Use Only One Loop in RandomlyGivePartyPokerus (#1991) --- src/pokemon.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 6ee052fda576..2b8f4fc95fb4 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -6038,14 +6038,10 @@ void RandomlyGivePartyPokerus(struct Pokemon *party) do { - do - { - rnd = Random() % PARTY_SIZE; - mon = &party[rnd]; - } - while (!GetMonData(mon, MON_DATA_SPECIES, 0)); + rnd = Random() % PARTY_SIZE; + mon = &party[rnd]; } - while (GetMonData(mon, MON_DATA_IS_EGG, 0)); + while (!GetMonData(mon, MON_DATA_SPECIES, 0) || GetMonData(mon, MON_DATA_IS_EGG, 0)); if (!(CheckPartyHasHadPokerus(party, gBitTable[rnd]))) { From 411d7e617777a3a7e7c60fdaf5d73d39a2695599 Mon Sep 17 00:00:00 2001 From: Jaizu Date: Tue, 14 May 2024 12:48:20 +0200 Subject: [PATCH 4/6] Make AdjustFriendship more readable --- src/pokemon.c | 60 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 24 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 2b8f4fc95fb4..ef8e7e9e0536 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5877,16 +5877,11 @@ u16 ModifyStatByNature(u8 nature, u16 stat, u8 statIndex) return retVal; } -#define IS_LEAGUE_BATTLE \ - ((gBattleTypeFlags & BATTLE_TYPE_TRAINER) \ - && (gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR \ - || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_LEADER \ - || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_CHAMPION)) \ - void AdjustFriendship(struct Pokemon *mon, u8 event) { u16 species, heldItem; u8 holdEffect; + s8 mod; if (ShouldSkipFriendshipChange()) return; @@ -5916,26 +5911,43 @@ void AdjustFriendship(struct Pokemon *mon, u8 event) if (friendship > 199) friendshipLevel++; - if ((event != FRIENDSHIP_EVENT_WALKING || !(Random() & 1)) - && (event != FRIENDSHIP_EVENT_LEAGUE_BATTLE || IS_LEAGUE_BATTLE)) + if (event == FRIENDSHIP_EVENT_WALKING) { - s8 mod = sFriendshipEventModifiers[event][friendshipLevel]; - if (mod > 0 && holdEffect == HOLD_EFFECT_FRIENDSHIP_UP) - mod = (150 * mod) / 100; - friendship += mod; - if (mod > 0) - { - if (GetMonData(mon, MON_DATA_POKEBALL, 0) == ITEM_LUXURY_BALL) - friendship++; - if (GetMonData(mon, MON_DATA_MET_LOCATION, 0) == GetCurrentRegionMapSectionId()) - friendship++; - } - if (friendship < 0) - friendship = 0; - if (friendship > MAX_FRIENDSHIP) - friendship = MAX_FRIENDSHIP; - SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); + // 50% chance every 128 steps + if (Random() & 1) + return; } + if (event == FRIENDSHIP_EVENT_LEAGUE_BATTLE) + { + // Only if it's a trainer battle with league progression significance + if (!(gBattleTypeFlags & BATTLE_TYPE_TRAINER)) + return; + if (!(gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_LEADER + || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_ELITE_FOUR + || gTrainers[gTrainerBattleOpponent_A].trainerClass == TRAINER_CLASS_CHAMPION)) + return; + } + + mod = sFriendshipEventModifiers[event][friendshipLevel]; + if (mod > 0 && holdEffect == HOLD_EFFECT_FRIENDSHIP_UP) + // 50% increase, rounding down + mod = (150 * mod) / 100; + + friendship += mod; + if (mod > 0) + { + if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) + friendship++; + if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId()) + friendship++; + } + + if (friendship < 0) + friendship = 0; + if (friendship > MAX_FRIENDSHIP) + friendship = MAX_FRIENDSHIP; + + SetMonData(mon, MON_DATA_FRIENDSHIP, &friendship); } } From ef03daf6d4798e450d1bb3cfab1267738d3d0a92 Mon Sep 17 00:00:00 2001 From: Jaizu Date: Sun, 19 May 2024 12:52:04 +0200 Subject: [PATCH 5/6] Fix Pokeblock script missing a releaseall --- data/scripts/safari_zone.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/scripts/safari_zone.inc b/data/scripts/safari_zone.inc index eb6a90abdfd7..77e795a0eb99 100644 --- a/data/scripts/safari_zone.inc +++ b/data/scripts/safari_zone.inc @@ -53,6 +53,9 @@ SafariZone_EventScript_ChoosePokeblock:: special OpenPokeblockCaseOnFeeder waitstate goto_if_ne VAR_RESULT, 0xFFFF, SafariZone_EventScript_PokeblockPlaced +#ifdef BUGFIX + releaseall @ Only gets called from EventScript_PokeBlockFeeder which uses lockall. +#endif end SafariZone_EventScript_PokeblockPlaced:: From b592c6eae5015e6b01198212444a3b852bda27d0 Mon Sep 17 00:00:00 2001 From: sneed Date: Thu, 23 May 2024 02:45:22 +0300 Subject: [PATCH 6/6] Add POKE_ICON_BASE_PAL_TAG to a header --- include/constants/pokemon_icon.h | 6 ++++++ src/pokemon_icon.c | 3 +-- src/pokemon_storage_system.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 include/constants/pokemon_icon.h diff --git a/include/constants/pokemon_icon.h b/include/constants/pokemon_icon.h new file mode 100644 index 000000000000..d57d5111a97d --- /dev/null +++ b/include/constants/pokemon_icon.h @@ -0,0 +1,6 @@ +#ifndef GUARD_CONSTANTS_POKEMON_ICON_H +#define GUARD_CONSTANTS_POKEMON_ICON_H + +#define POKE_ICON_BASE_PAL_TAG 56000 + +#endif // GUARD_CONSTANTS_POKEMON_ICON_H diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index e659eebe21b0..caed0bcdc381 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -4,8 +4,7 @@ #include "palette.h" #include "pokemon_icon.h" #include "sprite.h" - -#define POKE_ICON_BASE_PAL_TAG 56000 +#include "constants/pokemon_icon.h" #define INVALID_ICON_SPECIES SPECIES_OLD_UNOWN_J // Oddly specific, used when an icon should be a ?. Any of the 'old unown' would work diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index c8c87961c874..b398b887527d 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -40,6 +40,7 @@ #include "constants/moves.h" #include "constants/rgb.h" #include "constants/songs.h" +#include "constants/pokemon_icon.h" /* NOTE: This file is large. Some general groups of functions have @@ -215,7 +216,7 @@ enum { #define BOXID_CANCELED 201 enum { - PALTAG_MON_ICON_0 = 56000, + PALTAG_MON_ICON_0 = POKE_ICON_BASE_PAL_TAG, PALTAG_MON_ICON_1, // Used implicitly in CreateMonIconSprite PALTAG_MON_ICON_2, // Used implicitly in CreateMonIconSprite PALTAG_3, // Unused