Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-1.8.4 pret merge (2024/05/26) #4631

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data/scripts/safari_zone.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
50 changes: 49 additions & 1 deletion graphics/pokedex/bg_hoenn.pal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JASC-PAL
0100
48
96
123 131 0
255 255 255
222 222 222
Expand Down Expand Up @@ -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
51 changes: 0 additions & 51 deletions graphics/pokedex/caught_screen.pal

This file was deleted.

6 changes: 6 additions & 0 deletions include/constants/pokemon_icon.h
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/battle_anim_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -3950,7 +3950,7 @@ const struct SpriteTemplate gAppleAcidDripTemplate =
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
.anims = gAnims_AcidPoisonDroplet,
.anims = &gAnims_PoisonProjectile[1],
.images = NULL,
.affineAnims = gAffineAnims_Droplet,
.callback = SpriteCB_AcidDripSingleTarget
Expand Down
14 changes: 3 additions & 11 deletions src/battle_anim_poison.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,7 @@ static const union AnimCmd sAnim_SludgeBombHit[] =
const union AnimCmd *const gAnims_PoisonProjectile[] =
{
sAnim_PoisonProjectile,
};

const union AnimCmd *const gAnims_AcidPoisonDroplet[] =
{
sAnim_AcidPoisonDroplet,
};

static const union AnimCmd *const sAnims_SludgeBombHit[] =
{
sAnim_SludgeBombHit,
};

Expand Down Expand Up @@ -125,7 +117,7 @@ const struct SpriteTemplate gSludgeBombHitParticleSpriteTemplate =
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
.oam = &gOamData_AffineNormal_ObjNormal_16x16,
.anims = sAnims_SludgeBombHit,
.anims = &gAnims_PoisonProjectile[2],
.images = NULL,
.affineAnims = sAffineAnims_SludgeBombHit,
.callback = AnimSludgeBombHitParticle,
Expand All @@ -148,7 +140,7 @@ const struct SpriteTemplate gAcidPoisonDropletSpriteTemplate =
.tileTag = ANIM_TAG_POISON_BUBBLE,
.paletteTag = ANIM_TAG_POISON_BUBBLE,
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
.anims = gAnims_AcidPoisonDroplet,
.anims = &gAnims_PoisonProjectile[1],
.images = NULL,
.affineAnims = gAffineAnims_Droplet,
.callback = AnimAcidPoisonDroplet,
Expand Down Expand Up @@ -193,7 +185,7 @@ const struct SpriteTemplate gGreenPoisonDrip =
.tileTag = ANIM_TAG_GREEN_POISON_BUBBLE,
.paletteTag = ANIM_TAG_GREEN_POISON_BUBBLE,
.oam = &gOamData_AffineDouble_ObjNormal_16x16,
.anims = gAnims_AcidPoisonDroplet,
.anims = &gAnims_PoisonProjectile[1],
.images = NULL,
.affineAnims = gAffineAnims_Droplet,
.callback = AnimAcidPoisonDroplet,
Expand Down
1 change: 0 additions & 1 deletion src/graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,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");
Expand Down
2 changes: 1 addition & 1 deletion src/pokedex.c
Original file line number Diff line number Diff line change
Expand Up @@ -4090,7 +4090,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));
}
}

Expand Down
70 changes: 39 additions & 31 deletions src/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -4820,16 +4820,11 @@ u16 ModifyStatByNature(u8 nature, u16 stat, u8 statIndex)
return retVal;
}

#define IS_LEAGUE_BATTLE(trainerClass) \
((gBattleTypeFlags & BATTLE_TYPE_TRAINER) \
&& (trainerClass == TRAINER_CLASS_ELITE_FOUR \
|| trainerClass == TRAINER_CLASS_LEADER \
|| trainerClass == TRAINER_CLASS_CHAMPION)) \

void AdjustFriendship(struct Pokemon *mon, u8 event)
{
u16 species, heldItem;
u8 holdEffect;
s8 mod;

if (ShouldSkipFriendshipChange())
return;
Expand Down Expand Up @@ -4864,26 +4859,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(opponentTrainerClass)))
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 (!(opponentTrainerClass == TRAINER_CLASS_LEADER
|| opponentTrainerClass == TRAINER_CLASS_ELITE_FOUR
|| opponentTrainerClass == 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);
}
}

Expand Down Expand Up @@ -5013,14 +5025,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])))
{
Expand Down
3 changes: 1 addition & 2 deletions src/pokemon_icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "pokemon_icon.h"
#include "sprite.h"
#include "data.h"

#define POKE_ICON_BASE_PAL_TAG 56000
#include "constants/pokemon_icon.h"

struct MonIconSpriteTemplate
{
Expand Down
3 changes: 2 additions & 1 deletion src/pokemon_storage_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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
Expand Down Expand Up @@ -217,7 +218,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_MON_ICON_3, // Used implicitly in CreateMonIconSprite
Expand Down
Loading