From 8f289714b2037c2d01bc7d6826aa6e527b630632 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sat, 5 Nov 2022 20:57:55 -0300 Subject: [PATCH] Moved form change defines and descriptions to their own header --- include/battle.h | 1 + include/constants/form_change_types.h | 81 +++++++++++++++++++++++++++ include/constants/pokemon.h | 19 ------- src/data/pokemon/form_change_tables.h | 78 -------------------------- src/daycare.c | 1 + src/field_poison.c | 1 + src/party_menu.c | 1 + src/pokemon.c | 1 + src/pokemon_storage_system.c | 1 + 9 files changed, 87 insertions(+), 97 deletions(-) create mode 100644 include/constants/form_change_types.h diff --git a/include/battle.h b/include/battle.h index 544514f13..e0baf8895 100644 --- a/include/battle.h +++ b/include/battle.h @@ -3,6 +3,7 @@ // should they be included here or included individually by every file? #include "constants/battle.h" +#include "constants/form_change_types.h" #include "battle_main.h" #include "battle_message.h" #include "battle_util.h" diff --git a/include/constants/form_change_types.h b/include/constants/form_change_types.h new file mode 100644 index 000000000..1eb2af30a --- /dev/null +++ b/include/constants/form_change_types.h @@ -0,0 +1,81 @@ + +// FORM_CHANGE_BATTLE_HP_PERCENT param2 arguments +#define HP_HIGHER_THAN 1 +#define HP_LOWER_EQ_THAN 2 +// FORM_CHANGE_MOVE param2 Arguments +#define WHEN_LEARNED 0 +#define WHEN_FORGOTTEN 1 +// FORM_CHANGE_ITEM_USE param2 Arguments +#define DAY 1 +#define NIGHT 2 + +#define FORM_CHANGE_END 0 // Form table terminator + +// Form change that activates when the specified item is given to or taken from the selected Pokémon. +// param1: item to hold. +// param2: ability to check for, optional. +#define FORM_CHANGE_ITEM_HOLD 1 + +// Form change that activates when the item is used on the selected Pokémon. +// param1: item to use +// param2: time of day to check, optional. +// - DAY if Form change that activates in the daytime. +// - NIGHT if Form change that activates at nighttime. +#define FORM_CHANGE_ITEM_USE 2 + +// TODO: Form change that activates when the Pokémon learns or forgets the move. +// param1: move to check for +// param2: +// - WHEN_LEARNED if Form change that activates when move is forgotten +// - WHEN_FORGOTTEN if Form change that activates when move is learned +#define FORM_CHANGE_MOVE 3 + +// Form change that activates when the Pokémon is withdrawn from the PC or Daycare. +// Daycare withdraw done, PC withdraw TODO. +// - No parameters. +#define FORM_CHANGE_WITHDRAW 4 + +// Form change that activates when the Pokémon faints, either in battle or in the overworld by poison. +// If species is not specified and it's on the player's side, it will try to use the value +// saved in gBattleStruct->changedSpecies from a previous form change. +// - No parameters. +#define FORM_CHANGE_FAINT 5 + +// Form change that activates when the Pokémon is sent out at the beginning of a battle +// param1: item to hold, optional +// param2: a move that will be replaced, optional +// param3: a new move to replace it with, optional +#define FORM_CHANGE_BATTLE_BEGIN 6 + +// Form change that activates at the end of a battle. If species is not specified and it's on the player's side, it will try to use the value saved in gBattleStruct->changedSpecies from a previous form change. +// param1: item to hold, optional +// param2: a move that will be replaced, optional +// param3: a new move to replace it with, optional +#define FORM_CHANGE_BATTLE_END 7 + +// Form change that activates when the Pokémon is switched out in battle. +// - No parameters. +#define FORM_CHANGE_BATTLE_SWITCH 8 + +// Form change that activates when the Pokémon's HP % passes a certain threshold. +// param1: Ability to check. +// param2: HP comparer +// - HP_HIGHER_THAN if the form triggers when the current HP is higher than the specified threshold. +// - HP_LOWER_EQ_THAN if the form triggers when the current HP is lower or equal than the specified threshold. +// param3: HP percentage threshold. +#define FORM_CHANGE_BATTLE_HP_PERCENT 9 + +// Form change that activates when the mon has the defined item. +// If it's on the player's side, it also requires ITEM_MEGA_RING in the user's bag and for the player to trigger it by pressing START before selecting a move. +// param1: item to hold. +#define FORM_CHANGE_MEGA_EVOLUTION_ITEM 10 + +// Form change that activates when the mon has the defined move. +// If it's on the player's side, it also requires ITEM_MEGA_RING in the user's bag and for the player to trigger it by pressing START before selecting a move. +// param1: move to have. +#define FORM_CHANGE_MEGA_EVOLUTION_MOVE 11 + +// Form change that activates automatically when entering battle with the specified item. +// If the item is a Red Orb, it uses the Omega Symbol for the animation and icon. Otherwise, it defaults to the Alpha symbol. +// param1: item to hold. +#define FORM_CHANGE_PRIMAL_REVERSION 12 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 088015d06..7ba16fc57 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -313,25 +313,6 @@ #define EVO_MODE_BATTLE_SPECIAL 4 #define EVO_MODE_OVERWORLD_SPECIAL 5 -// Form change types -#define FORM_CHANGE_END 0 // Form table terminator -#define FORM_CHANGE_ITEM_HOLD 1 -#define FORM_CHANGE_ITEM_USE 2 -#define FORM_CHANGE_MOVE 3 // Todo -#define FORM_CHANGE_WITHDRAW 4 // Daycare done, Todo PC -#define FORM_CHANGE_FAINT 5 -#define FORM_CHANGE_BATTLE_BEGIN 6 -#define FORM_CHANGE_BATTLE_END 7 -#define FORM_CHANGE_BATTLE_SWITCH 8 -#define FORM_CHANGE_BATTLE_HP_PERCENT 9 -#define FORM_CHANGE_MEGA_EVOLUTION_ITEM 10 -#define FORM_CHANGE_MEGA_EVOLUTION_MOVE 11 -#define FORM_CHANGE_PRIMAL_REVERSION 12 - -// FORM_CHANGE_BATTLE_HP_PERCENT param2 arguments -#define HP_HIGHER_THAN 1 -#define HP_LOWER_EQ_THAN 2 - #define MON_PIC_WIDTH 64 #define MON_PIC_HEIGHT 64 #define MON_PIC_SIZE (MON_PIC_WIDTH * MON_PIC_HEIGHT / 2) diff --git a/src/data/pokemon/form_change_tables.h b/src/data/pokemon/form_change_tables.h index 1df1d7581..4bb0c5780 100644 --- a/src/data/pokemon/form_change_tables.h +++ b/src/data/pokemon/form_change_tables.h @@ -1,81 +1,3 @@ -/* -FORM_CHANGE_ITEM_HOLD: - Form change activates when the specified item is given to or taken from the selected Pokémon. - Alternatively, form change activates when the specified item is is given to or taken from - the selected Pokémon that has a particular ability. - param1 = item to hold - param2 = ability to check for, optional - -FORM_CHANGE_ITEM_USE: - Form change activates when the item is used on the selected Pokémon. - param1 = item to use - param2 = DAY if form change activates in the daytime, optional - NIGHT if form change activates at nighttime, optional - -FORM_CHANGE_MOVE: - Form change activates when the Pokémon learns or forgets the move. - param1 = move to check for - param2 = WHEN_LEARNED if form change activates when move is forgotten - WHEN_FORGOTTEN if form change activates when move is learned - -FORM_CHANGE_WITHDRAW: - Form change activates when the Pokémon is withdrawn from the PC or Daycare. - No parameters. - -FORM_CHANGE_FAINT: - Form change activates when the Pokémon faints, either in battle or in the overworld by poison. - If species is not specified and it's on the player's side, it will try to use the value - saved in gBattleStruct->changedSpecies from a previous form change. - No parameters. - -FORM_CHANGE_BATTLE_BEGIN: - Form change activates when the Pokémon is sent out at the beginning of a battle - param1 = item to hold, optional - param2 = a move that will be replaced, optional - param3 = a new move to replace it with, optional - -FORM_CHANGE_BATTLE_END: - Form change activates at the end of a battle. If species is not specified and it's on the player's side, - it will try to use the value saved in gBattleStruct->changedSpecies from a previous form change. - param1 = item to hold, optional - param2 = a move that will be replaced, optional - param3 = a new move to replace it with, optional - -FORM_CHANGE_BATTLE_SWITCH: - Form change activates when the Pokémon is switched out in battle. - No parameters. - -FORM_CHANGE_BATTLE_HP_PERCENT: - Form change activates when the Pokémon's HP % passes a certain threshold. - param1 = Ability to check. - param2 = HP_HIGHER_THAN if the form triggers when the current HP is higher than the specified threshold. - HP_LOWER_EQ_THAN if the form triggers when the current HP is lower or equal than the specified threshold. - param3 = HP percentage threshold. - -FORM_CHANGE_MEGA_EVOLUTION_ITEM: - Form change activates when the mon has the defined item. If it's on the player's side, it also requires - ITEM_MEGA_RING in the user's bag and for the player to choose to enable it. - param1 = item to hold. - -FORM_CHANGE_MEGA_EVOLUTION_MOVE: - Form change activates when the mon has the defined move. If it's on the player's side, it also requires - ITEM_MEGA_RING in the user's bag and for the player to choose to enable it. - param1 = move to have. - -FORM_CHANGE_PRIMAL_REVERSION: - Form change activates automatically when entering battle with the specified item. If the item is a Red Orb, - it uses the Omega Symbol for the animation and icon. Otherwise, it defaults to Alpha. - param1 = item to hold. -*/ - -// FORM_CHANGE_MOVE param2 Arguments -#define WHEN_LEARNED 0 -#define WHEN_FORGOTTEN 1 - -// FORM_CHANGE_ITEM_USE param2 Arguments -#define DAY 1 -#define NIGHT 2 - static const struct FormChange sVenusaurFormChangeTable[] = { {FORM_CHANGE_MEGA_EVOLUTION_ITEM, SPECIES_VENUSAUR_MEGA, ITEM_VENUSAURITE}, {FORM_CHANGE_FAINT, SPECIES_VENUSAUR}, diff --git a/src/daycare.c b/src/daycare.c index 82280077b..f0eae449e 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -20,6 +20,7 @@ #include "list_menu.h" #include "overworld.h" #include "item.h" +#include "constants/form_change_types.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/region_map_sections.h" diff --git a/src/field_poison.c b/src/field_poison.c index 68a345919..d1bd381cd 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -15,6 +15,7 @@ #include "task.h" #include "trainer_hill.h" #include "constants/field_poison.h" +#include "constants/form_change_types.h" #include "constants/party_menu.h" static bool32 IsMonValidSpecies(struct Pokemon *pokemon) diff --git a/src/party_menu.c b/src/party_menu.c index da87352b5..a3b65fe36 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -66,6 +66,7 @@ #include "constants/battle.h" #include "constants/battle_frontier.h" #include "constants/field_effects.h" +#include "constants/form_change_types.h" #include "constants/item_effects.h" #include "constants/items.h" #include "constants/moves.h" diff --git a/src/pokemon.c b/src/pokemon.c index b5d963376..9c13bd17e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -43,6 +43,7 @@ #include "constants/battle_frontier.h" #include "constants/battle_move_effects.h" #include "constants/battle_script_commands.h" +#include "constants/form_change_types.h" #include "constants/hold_effects.h" #include "constants/item_effects.h" #include "constants/items.h" diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 3ede591e8..e1a38569b 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -36,6 +36,7 @@ #include "trig.h" #include "walda_phrase.h" #include "window.h" +#include "constants/form_change_types.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/rgb.h"