fixes teachable moves change from rhh

This commit is contained in:
TheXaman 2023-03-25 14:50:15 +01:00
parent eaa74ca7cc
commit 207fcec599
3 changed files with 39 additions and 66 deletions

View file

@ -90,6 +90,10 @@ void BufferMoveDeleterNicknameAndMove(void);
void GetNumMovesSelectedMonHas(void);
void MoveDeleterChooseMoveToForget(void);
#ifndef BATTLE_ENGINE
bool8 CanLearnTutorMove(u16, u8);
#else
u16 GetTMHMMoves(u16 position);
#endif
#endif // GUARD_PARTY_MENU_H

View file

@ -6424,3 +6424,8 @@ void IsLastMonThatKnowsSurf(void)
gSpecialVar_Result = TRUE;
}
}
u16 GetTMHMMoves(u16 position)
{
return sTMHMMoves[position];
}

View file

@ -142,7 +142,11 @@ static EWRAM_DATA u16 sLastSelectedPokemon = 0;
static EWRAM_DATA u8 sPokeBallRotation = 0;
static EWRAM_DATA struct PokedexListItem *sPokedexListItem = NULL;
//Pokedex Plus HGSS_Ui
#ifndef BATTLE_ENGINE
#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + TUTOR_MOVE_COUNT)
#else
#define MOVES_COUNT_TOTAL (EGG_MOVES_ARRAY_COUNT + MAX_LEVEL_UP_MOVES + NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES + 20)
#endif
EWRAM_DATA static u16 sStatsMoves[MOVES_COUNT_TOTAL] = {0};
EWRAM_DATA static u16 sStatsMovesTMHM_ID[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0};
@ -5417,72 +5421,6 @@ static int DoPokedexSearch(u8 dexMode, u8 order, u8 abcGroup, u8 bodyColor, u8 t
sPokedexView->pokemonListCount = resultsCount;
}
// Search by move
if (move != 0xFFFF)
{
//Calc tutor move ID
tutorMoveId = 0xFF;
for (i = 0; i < TUTOR_MOVE_COUNT; i++)
{
if (move == gTutorMoves[i])
{
tutorMoveId = i;
break;
}
}
//Calc tm move ID
tmMoveId = 0xFF;
for (i = 0; i < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; i++)
{
if (move == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + i))
{
tmMoveId = (ITEM_TM01_FOCUS_PUNCH + i);
break;
}
}
for (i = 0, resultsCount = 0; i < sPokedexView->pokemonListCount; i++)
{
species = NationalPokedexNumToSpecies(sPokedexView->pokedexList[i].dexNum);
#ifdef POKEMON_EXPANSION
// Mega pokemon don't have distinct learnsets from their base form; so use base species for calculation
if (species >= SPECIES_VENUSAUR_MEGA && species <= SPECIES_GROUDON_PRIMAL)
species = GetFormSpeciesId(species, 0);
#endif
//LevelUp
if (SpeciesCanLearnLvlUpMove(species, move))
{
sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i];
resultsCount++;
continue;
}
//TMHM
if (CanSpeciesLearnTMHM(species, tmMoveId))
{
sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i];
resultsCount++;
continue;
}
//Tutor
if (CanLearnTutorMove(species, tutorMoveId))
{
sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i];
resultsCount++;
continue;
}
//EGGs
if (SpeciesCanLearnEggMove(species, move))
{
sPokedexView->pokedexList[resultsCount] = sPokedexView->pokedexList[i];
resultsCount++;
continue;
}
}
sPokedexView->pokemonListCount = resultsCount;
}
if (sPokedexView->pokemonListCount != 0)
{
for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++)
@ -6769,7 +6707,11 @@ static bool8 CalculateMoves(void)
u16 statsMovesEgg[EGG_MOVES_ARRAY_COUNT] = {0};
u16 statsMovesLevelUp[MAX_LEVEL_UP_MOVES] = {0};
u16 statsMovesTMHM[NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES] = {0};
#ifndef BATTLE_ENGINE
u16 statsMovesTutor[TUTOR_MOVE_COUNT] = {0};
#else
u16 move;
#endif
u8 numEggMoves = 0;
u8 numLevelUpMoves = 0;
@ -6802,6 +6744,7 @@ static bool8 CalculateMoves(void)
movesTotal++;
}
#ifndef BATTLE_ENGINE
//TMHM moves
for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++)
{
@ -6824,6 +6767,27 @@ static bool8 CalculateMoves(void)
movesTotal++;
}
}
#else
for (i = 0; gTeachableLearnsets[species][i] != MOVE_UNAVAILABLE; i++)
{
move = gTeachableLearnsets[species][i];
for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++)
{
if (GetTMHMMoves(j) == move)
{
sStatsMovesTMHM_ID[numTMHMMoves] = (ITEM_TM01_FOCUS_PUNCH + j);
numTMHMMoves++;
break;
}
}
if (j >= NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES)
numTutorMoves++;
sStatsMoves[movesTotal] = move;
movesTotal++;
}
#endif
sPokedexView->numEggMoves = numEggMoves;
sPokedexView->numLevelUpMoves = numLevelUpMoves;