Reworked TMHM into expandable list format

This commit is contained in:
crater-git 2022-08-23 21:44:42 -04:00
parent 4f333766fa
commit 45511fcc44
7 changed files with 29404 additions and 24780 deletions

View File

@ -397,6 +397,7 @@ extern const struct BaseStats gBaseStats[];
extern const u8 *const gItemEffectTable[];
extern const u32 gExperienceTables[][MAX_LEVEL + 1];
extern const struct LevelUpMove *const gLevelUpLearnsets[];
extern const u16 *const gTMHMLearnsets[];
extern const u8 gPPUpGetMask[];
extern const u8 gPPUpClearMask[];
extern const u8 gPPUpAddValues[];
@ -509,8 +510,8 @@ u8 CheckPartyHasHadPokerus(struct Pokemon *party, u8 selection);
void UpdatePartyPokerusTime(u16 days);
void PartySpreadPokerus(struct Pokemon *party);
bool8 TryIncrementMonLevel(struct Pokemon *mon);
u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm);
u32 CanSpeciesLearnTMHM(u16 species, u8 tm);
u32 CanMonLearnTMHM(struct Pokemon *mon, u16 move);
u32 CanSpeciesLearnTMHM(u16 species, u16 move);
u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves);
u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves);
u8 GetNumberOfRelearnableMoves(struct Pokemon *mon);

View File

@ -376,7 +376,7 @@ static u16 GetRandomAlternateMove(u8 monId)
do
{
id = Random() % (NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES);
shouldUseMove = CanSpeciesLearnTMHM(species, id);
shouldUseMove = CanSpeciesLearnTMHM(species, ItemIdToBattleMoveId(ITEM_TM01 + id));
}
while (!shouldUseMove);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -695,7 +695,8 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
{
for (j = 0; j < NUM_TECHNICAL_MACHINES + NUM_HIDDEN_MACHINES; j++)
{
if (sHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j) && CanMonLearnTMHM(egg, j))
u16 moveId = ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j);
if (sHatchedEggFatherMoves[i] == moveId && CanMonLearnTMHM(egg, moveId))
{
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]);

View File

@ -2038,7 +2038,7 @@ static u8 CanMonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor)
if (item >= ITEM_TM01)
{
if (!CanMonLearnTMHM(mon, item - ITEM_TM01 - ((item > ITEM_TM100) ? 50 : 0)))
if (!CanMonLearnTMHM(mon, ItemIdToBattleMoveId(item)))
return CANNOT_LEARN_MOVE;
else
move = ItemIdToBattleMoveId(item);

View File

@ -1890,17 +1890,18 @@ const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] =
[NATURE_QUIRKY] = { 0, 0, 0, 0, 0},
};
#include "data/pokemon/tmhm_learnsets.h"
#include "data/pokemon/trainer_class_lookups.h"
#include "data/pokemon/experience_tables.h"
#include "data/pokemon/base_stats.h"
#include "data/pokemon/level_up_learnsets.h"
#include "data/pokemon/tmhm_learnsets.h"
#if P_NEW_POKEMON == TRUE
#include "data/pokemon/evolution.h"
#else
#include "data/pokemon/evolution_old.h"
#endif
#include "data/pokemon/level_up_learnset_pointers.h"
#include "data/pokemon/tmhm_learnset_pointers.h"
#include "data/pokemon/form_species_tables.h"
#include "data/pokemon/form_species_table_pointers.h"
#include "data/pokemon/form_change_tables.h"
@ -7243,40 +7244,43 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon)
}
}
u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm)
u32 CanMonLearnTMHM(struct Pokemon *mon, u16 move)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
if (species == SPECIES_EGG)
{
return 0;
}
else if (tm < 32)
{
u32 mask = 1 << tm;
return gTMHMLearnsets[species][0] & mask;
return FALSE;
}
else
{
u32 mask = 1 << (tm - 32);
return gTMHMLearnsets[species][1] & mask;
u32 i;
for (i = 0; gTMHMLearnsets[species][i] != MOVE_UNAVAILABLE; i++)
{
if (gTMHMLearnsets[species][i] == move) {
return TRUE;
}
}
return FALSE;
}
}
u32 CanSpeciesLearnTMHM(u16 species, u8 tm)
u32 CanSpeciesLearnTMHM(u16 species, u16 move)
{
if (species == SPECIES_EGG)
{
return 0;
}
else if (tm < 32)
{
u32 mask = 1 << tm;
return gTMHMLearnsets[species][0] & mask;
return FALSE;
}
else
{
u32 mask = 1 << (tm - 32);
return gTMHMLearnsets[species][1] & mask;
u32 i;
for (i = 0; gTMHMLearnsets[species][i] != MOVE_UNAVAILABLE; i++)
{
if (gTMHMLearnsets[species][i] == move) {
return TRUE;
}
}
return FALSE;
}
}