Merge pull request #2233 from gruxor/tmhm_rework

Reworked TMHM into expandable list format
This commit is contained in:
Eduardo Quezada D'Ottone 2022-08-29 04:20:45 -04:00 committed by GitHub
commit 8ca2f949e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 34812 additions and 35560 deletions

View File

@ -67,51 +67,61 @@ BattleFrontier_Lounge7_EventScript_ChooseNewLeftTutorMove::
BattleFrontier_Lounge7_EventScript_Softboiled::
setvar VAR_0x8008, 16
setvar VAR_0x8005, MOVE_SOFT_BOILED
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_SeismicToss::
setvar VAR_0x8008, 24
setvar VAR_0x8005, MOVE_SEISMIC_TOSS
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_DreamEater::
setvar VAR_0x8008, 24
setvar VAR_0x8005, MOVE_DREAM_EATER
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_MegaPunch::
setvar VAR_0x8008, 24
setvar VAR_0x8005, MOVE_MEGA_PUNCH
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_MegaKick::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_MEGA_KICK
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_BodySlam::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_BODY_SLAM
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_RockSlide::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_ROCK_SLIDE
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_Counter::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_COUNTER
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_ThunderWave::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_THUNDER_WAVE
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_SwordsDance::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_SWORDS_DANCE
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
@ -135,7 +145,6 @@ BattleFrontier_Lounge7_EventScript_ChooseRightTutorMove::
waitmessage
special ShowBattlePointsWindow
setvar VAR_TEMP_E, 1
setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_2
setvar VAR_0x8006, 0
special ShowScrollableMultichoice
waitstate
@ -159,7 +168,6 @@ BattleFrontier_Lounge7_EventScript_ChooseNewRightTutorMove::
message BattleFrontier_Lounge7_Text_TeachWhichMove
waitmessage
setvar VAR_TEMP_E, 1
setvar VAR_0x8004, SCROLL_MULTI_BF_MOVE_TUTOR_2
setvar VAR_0x8006, 1
special ShowScrollableMultichoice
waitstate
@ -181,51 +189,61 @@ BattleFrontier_Lounge7_EventScript_ChooseNewRightTutorMove::
BattleFrontier_Lounge7_EventScript_DefenseCurl::
setvar VAR_0x8008, 16
setvar VAR_0x8005, MOVE_DEFENSE_CURL
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_Snore::
setvar VAR_0x8008, 24
setvar VAR_0x8005, MOVE_SNORE
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_MudSlap::
setvar VAR_0x8008, 24
setvar VAR_0x8005, MOVE_MUD_SLAP
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_Swift::
setvar VAR_0x8008, 24
setvar VAR_0x8005, MOVE_SWIFT
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_IcyWind::
setvar VAR_0x8008, 24
setvar VAR_0x8005, MOVE_ICY_WIND
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_Endure::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_ENDURE
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_PsychUp::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_PSYCH_UP
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_IcePunch::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_ICE_PUNCH
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_ThunderPunch::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_THUNDER_PUNCH
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
BattleFrontier_Lounge7_EventScript_FirePunch::
setvar VAR_0x8008, 48
setvar VAR_0x8005, MOVE_FIRE_PUNCH
goto BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection
end
@ -246,11 +264,8 @@ BattleFrontier_Lounge7_EventScript_CancelChooseMon::
@ VAR_TEMP_D is the move selection
@ VAR_TEMP_E is which move tutor was spoken to
BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection::
copyvar VAR_0x8004, VAR_TEMP_D
copyvar VAR_0x8005, VAR_TEMP_E
special BufferBattleFrontierTutorMoveName
buffernumberstring STR_VAR_2, VAR_0x8008
copyvar VAR_0x8004, VAR_TEMP_C
msgbox BattleFrontier_Lounge7_Text_MoveWillBeXBattlePoints, MSGBOX_YESNO
goto_if_eq VAR_RESULT, NO, BattleFrontier_Lounge7_EventScript_ChooseNewMove
specialvar VAR_TEMP_1, GetFrontierBattlePoints
@ -261,7 +276,6 @@ BattleFrontier_Lounge7_EventScript_ConfirmMoveSelection::
BattleFrontier_Lounge7_EventScript_TeachTutorMove::
msgbox BattleFrontier_Lounge7_Text_TeachMoveToWhichMon, MSGBOX_DEFAULT
special GetBattleFrontierTutorMoveIndex
fadescreen FADE_TO_BLACK
special CloseBattlePointsWindow
special CloseBattleFrontierTutorWindow

View File

@ -7,7 +7,7 @@ SlateportCity_PokemonFanClub_EventScript_SwaggerTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_SwaggerDeclined
msgbox MoveTutor_Text_SwaggerWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_SWAGGER
setvar VAR_0x8005, MOVE_SWAGGER
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_SwaggerDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_SWAGGER
@ -33,7 +33,7 @@ MauvilleCity_EventScript_RolloutTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_RolloutDeclined
msgbox MoveTutor_Text_RolloutWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_ROLLOUT
setvar VAR_0x8005, MOVE_ROLLOUT
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_RolloutDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_ROLLOUT
@ -59,7 +59,7 @@ VerdanturfTown_PokemonCenter_1F_EventScript_FuryCutterTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_FuryCutterDeclined
msgbox MoveTutor_Text_FuryCutterWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_FURY_CUTTER
setvar VAR_0x8005, MOVE_FURY_CUTTER
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_FuryCutterDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_FURY_CUTTER
@ -85,7 +85,7 @@ LavaridgeTown_House_EventScript_MimicTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_MimicDeclined
msgbox MoveTutor_Text_MimicWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_MIMIC
setvar VAR_0x8005, MOVE_MIMIC
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_MimicDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_MIMIC
@ -111,7 +111,7 @@ FallarborTown_Mart_EventScript_MetronomeTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_MetronomeDeclined
msgbox MoveTutor_Text_MetronomeWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_METRONOME
setvar VAR_0x8005, MOVE_METRONOME
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_MetronomeDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_METRONOME
@ -137,7 +137,7 @@ FortreeCity_House2_EventScript_SleepTalkTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_SleepTalkDeclined
msgbox MoveTutor_Text_SleepTalkWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_SLEEP_TALK
setvar VAR_0x8005, MOVE_SLEEP_TALK
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_SleepTalkDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_SLEEP_TALK
@ -163,7 +163,7 @@ LilycoveCity_DepartmentStoreRooftop_EventScript_SubstituteTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_SubstituteDeclined
msgbox MoveTutor_Text_SubstituteWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_SUBSTITUTE
setvar VAR_0x8005, MOVE_SUBSTITUTE
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_SubstituteDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_SUBSTITUTE
@ -189,7 +189,7 @@ MossdeepCity_EventScript_DynamicPunchTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_DynamicPunchDeclined
msgbox MoveTutor_Text_DynamicPunchWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_DYNAMIC_PUNCH
setvar VAR_0x8005, MOVE_DYNAMIC_PUNCH
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_DynamicPunchDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_DYNAMICPUNCH
@ -215,7 +215,7 @@ SootopolisCity_PokemonCenter_1F_EventScript_DoubleEdgeTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_DoubleEdgeDeclined
msgbox MoveTutor_Text_DoubleEdgeWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_DOUBLE_EDGE
setvar VAR_0x8005, MOVE_DOUBLE_EDGE
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_DoubleEdgeDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_DOUBLE_EDGE
@ -241,7 +241,7 @@ PacifidlogTown_PokemonCenter_1F_EventScript_ExplosionTutor::
call MoveTutor_EventScript_CanOnlyBeLearnedOnce
goto_if_eq VAR_RESULT, NO, MoveTutor_EventScript_ExplosionDeclined
msgbox MoveTutor_Text_ExplosionWhichMon, MSGBOX_DEFAULT
setvar VAR_0x8005, TUTOR_MOVE_EXPLOSION
setvar VAR_0x8005, MOVE_EXPLOSION
call MoveTutor_EventScript_OpenPartyMenu
goto_if_eq VAR_RESULT, 0, MoveTutor_EventScript_ExplosionDeclined
setflag FLAG_MOVE_TUTOR_TAUGHT_EXPLOSION

View File

@ -486,7 +486,6 @@ gSpecials::
def_special CloseBattleFrontierTutorWindow
def_special ScrollableMultichoice_RedrawPersistentMenu
def_special ChooseMonForMoveTutor
def_special GetBattleFrontierTutorMoveIndex
def_special ScrollableMultichoice_ClosePersistentMenu
def_special DoDeoxysRockInteraction
def_special SetDeoxysRockPalette

View File

@ -12,38 +12,6 @@
#define AILMENT_PKRS 6
#define AILMENT_FNT 7
#define TUTOR_MOVE_MEGA_PUNCH 0
#define TUTOR_MOVE_SWORDS_DANCE 1
#define TUTOR_MOVE_MEGA_KICK 2
#define TUTOR_MOVE_BODY_SLAM 3
#define TUTOR_MOVE_DOUBLE_EDGE 4
#define TUTOR_MOVE_COUNTER 5
#define TUTOR_MOVE_SEISMIC_TOSS 6
#define TUTOR_MOVE_MIMIC 7
#define TUTOR_MOVE_METRONOME 8
#define TUTOR_MOVE_SOFT_BOILED 9
#define TUTOR_MOVE_DREAM_EATER 10
#define TUTOR_MOVE_THUNDER_WAVE 11
#define TUTOR_MOVE_EXPLOSION 12
#define TUTOR_MOVE_ROCK_SLIDE 13
#define TUTOR_MOVE_SUBSTITUTE 14
#define TUTOR_MOVE_DYNAMIC_PUNCH 15
#define TUTOR_MOVE_ROLLOUT 16
#define TUTOR_MOVE_PSYCH_UP 17
#define TUTOR_MOVE_SNORE 18
#define TUTOR_MOVE_ICY_WIND 19
#define TUTOR_MOVE_ENDURE 20
#define TUTOR_MOVE_MUD_SLAP 21
#define TUTOR_MOVE_ICE_PUNCH 22
#define TUTOR_MOVE_SWAGGER 23
#define TUTOR_MOVE_SLEEP_TALK 24
#define TUTOR_MOVE_SWIFT 25
#define TUTOR_MOVE_DEFENSE_CURL 26
#define TUTOR_MOVE_THUNDER_PUNCH 27
#define TUTOR_MOVE_FIRE_PUNCH 28
#define TUTOR_MOVE_FURY_CUTTER 29
#define TUTOR_MOVE_COUNT 30
#define PARTY_LAYOUT_SINGLE 0
#define PARTY_LAYOUT_DOUBLE 1
#define PARTY_LAYOUT_MULTI 2

View File

@ -29,8 +29,6 @@ extern u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2];
extern void (*gItemUseCB)(u8, TaskFunc);
extern const u16 gTutorMoves[];
void AnimatePartySlot(u8 slot, u8 animNum);
bool8 IsMultiBattle(void);
u8 GetCursorSelectionMonId(void);

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 gTeachableLearnsets[];
extern const u8 gPPUpGetMask[];
extern const u8 gPPUpClearMask[];
extern const u8 gPPUpAddValues[];
@ -509,8 +510,7 @@ 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);
u8 CanLearnTeachableMove(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 = CanLearnTeachableMove(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

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 + j);
if (sHatchedEggFatherMoves[i] == moveId && CanLearnTeachableMove(GetMonData(egg, MON_DATA_SPECIES2), moveId))
{
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]);

View File

@ -2973,40 +2973,9 @@ static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused)
}
}
static const u16 sBattleFrontier_TutorMoves1[] =
{
MOVE_SOFT_BOILED,
MOVE_SEISMIC_TOSS,
MOVE_DREAM_EATER,
MOVE_MEGA_PUNCH,
MOVE_MEGA_KICK,
MOVE_BODY_SLAM,
MOVE_ROCK_SLIDE,
MOVE_COUNTER,
MOVE_THUNDER_WAVE,
MOVE_SWORDS_DANCE
};
static const u16 sBattleFrontier_TutorMoves2[] =
{
MOVE_DEFENSE_CURL,
MOVE_SNORE,
MOVE_MUD_SLAP,
MOVE_SWIFT,
MOVE_ICY_WIND,
MOVE_ENDURE,
MOVE_PSYCH_UP,
MOVE_ICE_PUNCH,
MOVE_THUNDER_PUNCH,
MOVE_FIRE_PUNCH
};
void BufferBattleFrontierTutorMoveName(void)
{
if (gSpecialVar_0x8005 != 0)
StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves2[gSpecialVar_0x8004]]);
else
StringCopy(gStringVar1, gMoveNames[sBattleFrontier_TutorMoves1[gSpecialVar_0x8004]]);
StringCopy(gStringVar1, gMoveNames[gSpecialVar_0x8005]);
}
static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection)
@ -3102,44 +3071,6 @@ void ScrollableMultichoice_RedrawPersistentMenu(void)
}
}
void GetBattleFrontierTutorMoveIndex(void)
{
u8 i;
u16 moveTutor = 0;
u16 moveIndex = 0;
gSpecialVar_0x8005 = 0;
moveTutor = VarGet(VAR_TEMP_E);
moveIndex = VarGet(VAR_TEMP_D);
if (moveTutor != 0)
{
i = 0;
do
{
if (gTutorMoves[i] == sBattleFrontier_TutorMoves2[moveIndex])
{
gSpecialVar_0x8005 = i;
break;
}
i++;
} while (i < TUTOR_MOVE_COUNT);
}
else
{
i = 0;
do
{
if (gTutorMoves[i] == sBattleFrontier_TutorMoves1[moveIndex])
{
gSpecialVar_0x8005 = i;
break;
}
i++;
} while (i < TUTOR_MOVE_COUNT);
}
}
// Never called
// Close a scrollable multichoice that stays open after selection
void ScrollableMultichoice_ClosePersistentMenu(void)

View File

@ -267,8 +267,8 @@ static void DisplayPartyPokemonMaxHPCheck(struct Pokemon *, struct PartyMenuBox
static void DisplayPartyPokemonHPBarCheck(struct Pokemon *, struct PartyMenuBox *);
static void DisplayPartyPokemonDescriptionText(u8, struct PartyMenuBox *, u8);
static bool8 IsMonAllowedInMinigame(u8);
static void DisplayPartyPokemonDataToTeachMove(u8, u16, u8);
static u8 CanMonLearnTMTutor(struct Pokemon *, u16, u8);
static void DisplayPartyPokemonDataToTeachMove(u8, u16);
static u8 CanTeachMove(struct Pokemon *, u16);
static void DisplayPartyPokemonBarDetail(u8, const u8 *, u8, const u8 *);
static void DisplayPartyPokemonLevel(u8, struct PartyMenuBox *);
static void DisplayPartyPokemonGender(u8, u16, u8 *, struct PartyMenuBox *);
@ -328,8 +328,6 @@ static bool16 IsMonAllowedInPokemonJump(struct Pokemon *);
static bool16 IsMonAllowedInDodrioBerryPicking(struct Pokemon *);
static void Task_CancelParticipationYesNo(u8);
static void Task_HandleCancelParticipationYesNoInput(u8);
static bool8 CanLearnTutorMove(u16, u8);
static u16 GetTutorMove(u8);
static bool8 ShouldUseChooseMonText(void);
static void SetPartyMonFieldSelectionActions(struct Pokemon *, u8);
static u8 GetPartyMenuActionsTypeInBattle(struct Pokemon *);
@ -481,7 +479,6 @@ static bool8 SetUpFieldMove_Dive(void);
void TryItemHoldFormChange(struct Pokemon *mon);
// static const data
#include "data/pokemon/tutor_learnsets.h"
#include "data/party_menu.h"
// code
@ -975,7 +972,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot)
if (gPartyMenu.action == PARTY_ACTION_MOVE_TUTOR)
{
gSpecialVar_Result = FALSE;
DisplayPartyPokemonDataToTeachMove(slot, 0, gSpecialVar_0x8005);
DisplayPartyPokemonDataToTeachMove(slot, gSpecialVar_0x8005);
}
else
{
@ -987,7 +984,7 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot)
default:
return FALSE;
case 1: // TM/HM
DisplayPartyPokemonDataToTeachMove(slot, item, 0);
DisplayPartyPokemonDataToTeachMove(slot, ItemIdToBattleMoveId(item));
break;
case 2: // Evolution stone
if (!GetMonData(currentPokemon, MON_DATA_IS_EGG) && GetEvolutionTargetSpecies(currentPokemon, EVO_MODE_ITEM_CHECK, item, NULL) != SPECIES_NONE)
@ -999,9 +996,9 @@ static bool8 DisplayPartyPokemonDataForMoveTutorOrEvolutionItem(u8 slot)
return TRUE;
}
static void DisplayPartyPokemonDataToTeachMove(u8 slot, u16 item, u8 tutor)
static void DisplayPartyPokemonDataToTeachMove(u8 slot, u16 move)
{
switch (CanMonLearnTMTutor(&gPlayerParty[slot], item, tutor))
switch (CanTeachMove(&gPlayerParty[slot], move))
{
case CANNOT_LEARN_MOVE:
case CANNOT_LEARN_MOVE_IS_EGG:
@ -2031,47 +2028,18 @@ static void Task_HandleCancelParticipationYesNoInput(u8 taskId)
}
}
static u8 CanMonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor)
static u8 CanTeachMove(struct Pokemon *mon, u16 move)
{
u16 move;
if (GetMonData(mon, MON_DATA_IS_EGG))
return CANNOT_LEARN_MOVE_IS_EGG;
if (item >= ITEM_TM01)
{
if (!CanMonLearnTMHM(mon, item - ITEM_TM01 - ((item > ITEM_TM100) ? 50 : 0)))
return CANNOT_LEARN_MOVE;
else
move = ItemIdToBattleMoveId(item);
}
else
{
if (!CanLearnTutorMove(GetMonData(mon, MON_DATA_SPECIES), tutor))
return CANNOT_LEARN_MOVE;
else
move = GetTutorMove(tutor);
}
if (MonKnowsMove(mon, move) == TRUE)
else if (!CanLearnTeachableMove(GetMonData(mon, MON_DATA_SPECIES2), move))
return CANNOT_LEARN_MOVE;
else if (MonKnowsMove(mon, move) == TRUE)
return ALREADY_KNOWS_MOVE;
else
return CAN_LEARN_MOVE;
}
static u16 GetTutorMove(u8 tutor)
{
return gTutorMoves[tutor];
}
static bool8 CanLearnTutorMove(u16 species, u8 tutor)
{
if (sTutorLearnsets[species] & (1 << tutor))
return TRUE;
else
return FALSE;
}
static void InitPartyMenuWindows(u8 layout)
{
u8 i;
@ -4954,19 +4922,18 @@ static void DisplayLearnMoveMessageAndClose(u8 taskId, const u8 *str)
void ItemUseCB_TMHM(u8 taskId, TaskFunc task)
{
struct Pokemon *mon;
s16 *move;
u16 item;
u16 item = gSpecialVar_ItemId;
u16 move = ItemIdToBattleMoveId(item);
gPartyMenu.data1 = move;
PlaySE(SE_SELECT);
mon = &gPlayerParty[gPartyMenu.slotId];
move = &gPartyMenu.data1;
item = gSpecialVar_ItemId;
GetMonNickname(mon, gStringVar1);
move[0] = ItemIdToBattleMoveId(item);
StringCopy(gStringVar2, gMoveNames[move[0]]);
move[1] = 0;
switch (CanMonLearnTMTutor(mon, item, 0))
GetMonNickname(mon, gStringVar1);
StringCopy(gStringVar2, gMoveNames[move]);
switch (CanTeachMove(mon, move))
{
case CANNOT_LEARN_MOVE:
DisplayLearnMoveMessageAndClose(taskId, gText_PkmnCantLearnMove);
@ -4976,7 +4943,7 @@ void ItemUseCB_TMHM(u8 taskId, TaskFunc task)
return;
}
if (GiveMoveToMon(mon, move[0]) != MON_HAS_MAX_MOVES)
if (GiveMoveToMon(mon, move) != MON_HAS_MAX_MOVES)
{
gTasks[taskId].func = Task_LearnedMove;
}
@ -5727,10 +5694,10 @@ static void TryTutorSelectedMon(u8 taskId)
mon = &gPlayerParty[gPartyMenu.slotId];
move = &gPartyMenu.data1;
GetMonNickname(mon, gStringVar1);
gPartyMenu.data1 = GetTutorMove(gSpecialVar_0x8005);
gPartyMenu.data1 = gSpecialVar_0x8005;
StringCopy(gStringVar2, gMoveNames[gPartyMenu.data1]);
move[1] = 2;
switch (CanMonLearnTMTutor(mon, 0, gSpecialVar_0x8005))
switch (CanTeachMove(mon, gPartyMenu.data1))
{
case CANNOT_LEARN_MOVE:
DisplayLearnMoveMessageAndClose(taskId, gText_PkmnCantLearnMove);

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/teachable_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/teachable_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"
@ -7263,40 +7264,22 @@ bool8 TryIncrementMonLevel(struct Pokemon *mon)
}
}
u32 CanMonLearnTMHM(struct Pokemon *mon, u8 tm)
{
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;
}
else
{
u32 mask = 1 << (tm - 32);
return gTMHMLearnsets[species][1] & mask;
}
}
u32 CanSpeciesLearnTMHM(u16 species, u8 tm)
u8 CanLearnTeachableMove(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;
u8 i;
for (i = 0; gTeachableLearnsets[species][i] != MOVE_UNAVAILABLE; i++)
{
if (gTeachableLearnsets[species][i] == move) {
return TRUE;
}
}
return FALSE;
}
}