mirror of
https://github.com/pret/pokefirered.git
synced 2026-09-28 20:08:52 -05:00
fixed pokedex entry handling for forms, removed unused
This commit is contained in:
@@ -819,8 +819,6 @@ struct BattleScripting
|
||||
u8 switchCase; // Special switching conditions, eg. red card
|
||||
u8 overrideBerryRequirements;
|
||||
u8 stickyWebStatDrop; // To prevent Defiant activating on a Court Change'd Sticky Web
|
||||
// TODO: remove pokefirered members
|
||||
u8 dmgMultiplier;
|
||||
};
|
||||
|
||||
struct BattleSpriteInfo
|
||||
|
||||
@@ -390,13 +390,8 @@
|
||||
#define MOVE_EFFECT_FLORAL_HEALING 77
|
||||
#define MOVE_EFFECT_SECRET_POWER 78
|
||||
#define MOVE_EFFECT_PSYCHIC_NOISE 79
|
||||
// TODO: old pokefirered move effects, remove with new battle system
|
||||
#define MOVE_EFFECT_RECOIL_25 80
|
||||
#define MOVE_EFFECT_RAPIDSPIN 81
|
||||
#define MOVE_EFFECT_REMOVE_PARALYSIS 82
|
||||
#define MOVE_EFFECT_RECOIL_33 83
|
||||
|
||||
#define NUM_MOVE_EFFECTS 84
|
||||
#define NUM_MOVE_EFFECTS 80
|
||||
|
||||
#define MOVE_EFFECT_AFFECTS_USER 0x2000
|
||||
#define MOVE_EFFECT_CERTAIN 0x4000
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#define sSWITCH_CASE (gBattleScripting + 0x36) // switchCase
|
||||
#define sBERRY_OVERRIDE (gBattleScripting + 0x37) // overrideBerryRequirements
|
||||
#define sSTICKY_WEB_STAT_DROP (gBattleScripting + 0x38) // stickyWebStatDrop
|
||||
#define sDMG_MULTIPLIER (gBattleScripting + 0x39) // dmgMultiplier
|
||||
|
||||
// Array entries for battle communication
|
||||
#define MULTIUSE_STATE 0
|
||||
|
||||
@@ -1631,8 +1631,6 @@
|
||||
|
||||
#define SPECIES_EGG SPECIES_MIMIKYU_TOTEM_BUSTED + 1
|
||||
|
||||
#define KANTO_SPECIES_END SPECIES_MEW // TODO: remove
|
||||
|
||||
#define NUM_SPECIES SPECIES_EGG
|
||||
|
||||
#endif // GUARD_CONSTANTS_SPECIES_H
|
||||
|
||||
@@ -756,6 +756,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem, s
|
||||
u16 NationalPokedexNumToSpecies(u16 nationalNum);
|
||||
u16 SpeciesToNationalPokedexNum(u16 species);
|
||||
u16 SpeciesToKantoDexNum(u16 species);
|
||||
bool32 IsSpeciesInKantoDex(u16 species);
|
||||
u16 KantoToNationalOrder(u16 kantoNum);
|
||||
u16 NationalToKantoOrder(u16 nationalNum);
|
||||
u16 HoennToNationalOrder(u16 hoennNum);
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef GUARD_POKEMON_ITEM_EFFECTS
|
||||
#define GUARD_POKEMON_ITEM_EFFECTS
|
||||
|
||||
#include "pokemon.h"
|
||||
|
||||
// TODO once pokemon item effects is decompiled
|
||||
/*
|
||||
struct PokemonItemEffect
|
||||
{
|
||||
//field 0
|
||||
u8 xAtk : 4; // x1, x2, x4, x8 = xF
|
||||
u8 field_0_x10 : 1; // x10
|
||||
u8 critRatioUp : 1; // x20
|
||||
u8 field_0_x40 : 1; // x40
|
||||
u8 cureInfatuation : 1; // x80
|
||||
|
||||
/*field 1
|
||||
u8 xSpeed : 4; // x1, x2, x4, x8 = xF
|
||||
u8 xDefense : 4; // x10, x20, x40, xF0
|
||||
|
||||
/*field 2
|
||||
u8 xSpAtk : 4; // x1, x2, x4, x8 = xF
|
||||
u8 xAccuracy : 4; // x10, x20, x40, xF0
|
||||
|
||||
/*field 3
|
||||
u8 cureConfusion : 1; // x1
|
||||
u8 cureParalysis : 1; // x2
|
||||
u8 cureFreeze : 1; // x4
|
||||
u8 cureBurn : 1; // x8
|
||||
u8 curePoison : 1; // x10
|
||||
u8 cureSleep : 1; // x20
|
||||
u8 field_3_x40 : 1; // x40
|
||||
u8 cantLowerStats : 1; // x80
|
||||
|
||||
/*field 4
|
||||
u8 hpEv : 1; // x1
|
||||
u8 attackEv : 1; // x2
|
||||
u8 healHp : 1; // x4
|
||||
u8 field_4_x8 : 1; // x8
|
||||
u8 field_4_x10 : 1; // x10
|
||||
u8 ppUp : 1; // x20
|
||||
u8 levelUp : 1; // x40
|
||||
u8 evolutionStone : 1; // x80
|
||||
|
||||
/*field 5
|
||||
u8 defEv: 1; // x1
|
||||
u8 speedEv : 1; // x2
|
||||
u8 spDefEv : 1; // x4
|
||||
u8 spAtkEv : 1; // x8
|
||||
u8 ppMax : 1; // x10
|
||||
u8 field_5_x20 : 1; // x20
|
||||
u8 field_5_x40 : 1; // x40
|
||||
u8 field_5_x80 : 1; // x80
|
||||
|
||||
/*field 6
|
||||
u8 value;
|
||||
};
|
||||
|
||||
bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 itemId, u8 partyId, u8 monMoveIndex, u8 a5);
|
||||
*/
|
||||
|
||||
#endif // GUARD_POKEMON_ITEM_EFFECTS
|
||||
@@ -8263,52 +8263,52 @@
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_METAGROSS"
|
||||
"species": "SPECIES_GEODUDE_ALOLAN"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_METAGROSS"
|
||||
"species": "SPECIES_GEODUDE_ALOLAN"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_LICKILICKY"
|
||||
"species": "SPECIES_SIRFETCHD"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_LICKILICKY"
|
||||
"species": "SPECIES_SIRFETCHD"
|
||||
},
|
||||
{
|
||||
"min_level": 2,
|
||||
"max_level": 2,
|
||||
"species": "SPECIES_LICKILICKY"
|
||||
"species": "SPECIES_GEODUDE_ALOLAN"
|
||||
},
|
||||
{
|
||||
"min_level": 2,
|
||||
"max_level": 2,
|
||||
"species": "SPECIES_LICKILICKY"
|
||||
"species": "SPECIES_GEODUDE_ALOLAN"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_ZAMAZENTA"
|
||||
"species": "SPECIES_SALAMENCE"
|
||||
},
|
||||
{
|
||||
"min_level": 3,
|
||||
"max_level": 3,
|
||||
"species": "SPECIES_ANNIHILAPE"
|
||||
"species": "SPECIES_SALAMENCE"
|
||||
},
|
||||
{
|
||||
"min_level": 4,
|
||||
"max_level": 4,
|
||||
"species": "SPECIES_ANNIHILAPE"
|
||||
"species": "SPECIES_SALAMENCE"
|
||||
},
|
||||
{
|
||||
"min_level": 4,
|
||||
"max_level": 4,
|
||||
"species": "SPECIES_ANNIHILAPE"
|
||||
"species": "SPECIES_SALAMENCE"
|
||||
},
|
||||
{
|
||||
"min_level": 5,
|
||||
|
||||
@@ -3165,7 +3165,7 @@ u8 DexScreen_DestroyAreaScreenResources(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool8 DexScreen_MonHasCategoryEntry(u16 species)
|
||||
static bool32 DexScreen_MonHasCategoryEntry(u16 species)
|
||||
{
|
||||
u16 i, j, k;
|
||||
u16 natDexNum = SpeciesToNationalPokedexNum(species);
|
||||
@@ -3185,13 +3185,9 @@ static bool8 DexScreen_MonHasCategoryEntry(u16 species)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int DexScreen_CanShowMonInDex(u16 species)
|
||||
static bool32 DexScreen_CanShowMonInDex(u16 species)
|
||||
{
|
||||
if (IsNationalPokedexEnabled() == TRUE && DexScreen_MonHasCategoryEntry(species))
|
||||
return TRUE;
|
||||
if (SpeciesToKantoDexNum(species) > 0)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return (IsNationalPokedexEnabled() || IsSpeciesInKantoDex(species)) && DexScreen_MonHasCategoryEntry(species);
|
||||
}
|
||||
|
||||
static u8 DexScreen_IsPageUnlocked(u8 categoryNum, u8 pageNum)
|
||||
@@ -3206,7 +3202,7 @@ static u8 DexScreen_IsPageUnlocked(u8 categoryNum, u8 pageNum)
|
||||
if (i < count)
|
||||
{
|
||||
species = gDexCategories[categoryNum].page[pageNum].species[i];
|
||||
if (DexScreen_CanShowMonInDex(species) == TRUE && DexScreen_GetSetPokedexFlag(species, FLAG_GET_SEEN, TRUE))
|
||||
if (DexScreen_CanShowMonInDex(species) && DexScreen_GetSetPokedexFlag(species, FLAG_GET_SEEN, TRUE))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -3240,7 +3236,7 @@ void DexScreen_CreateCategoryPageSpeciesList(u8 categoryNum, u8 pageNum)
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
species = gDexCategories[categoryNum].page[pageNum].species[i];
|
||||
if (DexScreen_CanShowMonInDex(species) == TRUE && DexScreen_GetSetPokedexFlag(species, FLAG_GET_SEEN, TRUE))
|
||||
if (DexScreen_CanShowMonInDex(species) && DexScreen_GetSetPokedexFlag(species, FLAG_GET_SEEN, TRUE))
|
||||
{
|
||||
sPokedexScreenData->pageSpecies[sPokedexScreenData->numMonsOnPage] = gDexCategories[categoryNum].page[pageNum].species[i];
|
||||
sPokedexScreenData->numMonsOnPage++;
|
||||
@@ -3292,14 +3288,14 @@ static u8 DexScreen_LookUpCategoryBySpecies(u16 species)
|
||||
for (k = 0, posInPage = 0; k < categoryPageCount; k++)
|
||||
{
|
||||
dexSpecies = gDexCategories[i].page[j].species[k];
|
||||
if (species == dexSpecies)
|
||||
if (SpeciesToNationalPokedexNum(species) == SpeciesToNationalPokedexNum(dexSpecies))
|
||||
{
|
||||
sPokedexScreenData->category = i;
|
||||
sPokedexScreenData->pageNum = j;
|
||||
sPokedexScreenData->categoryCursorPosInPage = posInPage;
|
||||
return FALSE;
|
||||
}
|
||||
if (DexScreen_CanShowMonInDex(dexSpecies) == TRUE && DexScreen_GetSetPokedexFlag(dexSpecies, FLAG_GET_SEEN, TRUE))
|
||||
if (DexScreen_CanShowMonInDex(dexSpecies) && DexScreen_GetSetPokedexFlag(dexSpecies, FLAG_GET_SEEN, TRUE))
|
||||
posInPage++;
|
||||
}
|
||||
}
|
||||
@@ -3329,7 +3325,7 @@ u8 DexScreen_RegisterMonToPokedex(u16 species)
|
||||
DexScreen_GetSetPokedexFlag(species, FLAG_SET_SEEN, TRUE);
|
||||
DexScreen_GetSetPokedexFlag(species, FLAG_SET_CAUGHT, TRUE);
|
||||
|
||||
if ((!IsNationalPokedexEnabled() && SpeciesToKantoDexNum(species) == KANTO_DEX_NONE) || !DexScreen_MonHasCategoryEntry(species))
|
||||
if ((!IsNationalPokedexEnabled() && !IsSpeciesInKantoDex(species)) || !DexScreen_MonHasCategoryEntry(species))
|
||||
return CreateTask(Task_DexScreen_RegisterNonKantoMonBeforeNationalDex, 0);
|
||||
|
||||
DexScreen_LoadResources();
|
||||
|
||||
@@ -4523,6 +4523,11 @@ u16 SpeciesToKantoDexNum(u16 species)
|
||||
return NationalToKantoOrder(SpeciesToNationalPokedexNum(species));
|
||||
}
|
||||
|
||||
bool32 IsSpeciesInKantoDex(u16 species)
|
||||
{
|
||||
return SpeciesToKantoDexNum(species) != KANTO_DEX_NONE;
|
||||
}
|
||||
|
||||
u16 KantoToNationalOrder(u16 kantoNum)
|
||||
{
|
||||
if (KANTO_DEX_NONE < kantoNum && kantoNum < KANTO_DEX_COUNT)
|
||||
|
||||
32
src/trade.c
32
src/trade.c
@@ -2754,23 +2754,11 @@ static u32 CanTradeSelectedMon(struct Pokemon * playerParty, int partyCount, int
|
||||
// Cant trade Eggs or non-Kanto mons if player doesn't have National Dex
|
||||
if (!IsNationalPokedexEnabled())
|
||||
{
|
||||
// See comment below
|
||||
#ifdef BUGFIX
|
||||
if (species2[monIdx] == SPECIES_EGG)
|
||||
return CANT_TRADE_EGG_YET;
|
||||
#endif
|
||||
|
||||
if (species2[monIdx] > KANTO_SPECIES_END)
|
||||
if (!IsSpeciesInKantoDex(species2[monIdx]))
|
||||
return CANT_TRADE_NATIONAL;
|
||||
|
||||
// This is meant to be SPECIES_EGG. There are obviously no circumstances
|
||||
// where you're allowed to trade SPECIES_NONE, so it wouldn't make sense to
|
||||
// only check this if the National Dex is missing. SPECIES_EGG will accidentally
|
||||
// be handled instead by the conditional above. Both of these problems are fixed in Emerald.
|
||||
#ifndef BUGFIX
|
||||
if (species2[monIdx] == SPECIES_NONE)
|
||||
return CANT_TRADE_EGG_YET;
|
||||
#endif
|
||||
}
|
||||
|
||||
partner = &gLinkPlayers[GetMultiplayerId() ^ 1];
|
||||
@@ -2783,16 +2771,14 @@ static u32 CanTradeSelectedMon(struct Pokemon * playerParty, int partyCount, int
|
||||
if (species2[monIdx] == SPECIES_EGG)
|
||||
return CANT_TRADE_PARTNER_EGG_YET;
|
||||
|
||||
if (species2[monIdx] > KANTO_SPECIES_END)
|
||||
if (!IsSpeciesInKantoDex(species2[monIdx]))
|
||||
return CANT_TRADE_INVALID_MON;
|
||||
}
|
||||
}
|
||||
|
||||
if (species[monIdx] == SPECIES_DEOXYS || species[monIdx] == SPECIES_MEW)
|
||||
{
|
||||
if (!GetMonData(&playerParty[monIdx], MON_DATA_MODERN_FATEFUL_ENCOUNTER))
|
||||
return CANT_TRADE_INVALID_MON;
|
||||
}
|
||||
// Can't trade specific species
|
||||
if (gSpeciesInfo[species[monIdx]].cannotBeTraded)
|
||||
return CANT_TRADE_INVALID_MON;
|
||||
|
||||
// Make Eggs not count for numMonsLeft
|
||||
for (i = 0; i < partyCount; i++)
|
||||
@@ -2918,15 +2904,15 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf
|
||||
if (playerSpecies2 == SPECIES_EGG)
|
||||
return UR_TRADE_MSG_EGG_CANT_BE_TRADED;
|
||||
|
||||
if (playerSpecies2 > KANTO_SPECIES_END)
|
||||
if (!IsSpeciesInKantoDex(playerSpecies2))
|
||||
return UR_TRADE_MSG_MON_CANT_BE_TRADED_2;
|
||||
|
||||
if (partnerSpecies > KANTO_SPECIES_END)
|
||||
if (!IsSpeciesInKantoDex(partnerSpecies))
|
||||
return UR_TRADE_MSG_PARTNERS_MON_CANT_BE_TRADED;
|
||||
}
|
||||
|
||||
// If the partner doesn't have the National Dex then the player's offer has to be a Kanto Pokémon
|
||||
if (!partnerHasNationalDex && playerSpecies2 > KANTO_SPECIES_END)
|
||||
if (!partnerHasNationalDex && !IsSpeciesInKantoDex(playerSpecies2))
|
||||
return UR_TRADE_MSG_PARTNER_CANT_ACCEPT_MON;
|
||||
|
||||
// Trade is allowed
|
||||
@@ -2947,7 +2933,7 @@ int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 sp
|
||||
if (species2 == SPECIES_EGG)
|
||||
return CANT_REGISTER_EGG;
|
||||
|
||||
if (species2 > KANTO_SPECIES_END && species2 != SPECIES_EGG)
|
||||
if (!IsSpeciesInKantoDex(species2) && species2 != SPECIES_EGG)
|
||||
return CANT_REGISTER_MON;
|
||||
|
||||
return CAN_REGISTER_MON;
|
||||
|
||||
Reference in New Issue
Block a user