Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move data unification #3999

Merged
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c4f3fee
Made gBattleMoves handle the InGame name and description of battle moves
LOuroboros Jan 10, 2024
28ac83d
Reintroduced move names
LOuroboros Jan 10, 2024
85a8098
Updated GetBattleMoveName to handle Z-Move Names
LOuroboros Jan 11, 2024
623f02f
Fixed a couple of expanded move names
LOuroboros Jan 11, 2024
e94fc5e
Removed zMoveName variable of struct BattleMove and extended the name…
LOuroboros Jan 14, 2024
71b4c75
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Jan 14, 2024
b59afe0
Ditched no longer used MOVE_NAME_LENGTH constant
LOuroboros Jan 15, 2024
eb8a74c
Corrected the names of the max moves
LOuroboros Jan 15, 2024
4beb9b0
Fixed U-turn's name
LOuroboros Jan 15, 2024
9bba425
Brought back MOVE_NAME_LENGTH
LOuroboros Jan 15, 2024
bffc963
Introduced a union for Move/Z-Move names in the struct BattleMove
LOuroboros Jan 24, 2024
3e9ff66
Fixed the union for gBattleMoves move names
LOuroboros Jan 24, 2024
1945ccb
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Jan 24, 2024
8fb3ea3
Removed deprecated GetZMoveName and GetMaxMoveName
LOuroboros Jan 25, 2024
a12ffd4
Reintroduced mention to gMoveNames in sGFRomHeader
LOuroboros Jan 25, 2024
cdfcbc7
Fixed move names and ported move descriptions
Bassoonian Jan 25, 2024
e161902
Fused the struct ContestMove into the struct BattleMove
LOuroboros Jan 25, 2024
0e333e2
Removed no longer used Z_MOVE_NAME_LENGTH constant
LOuroboros Jan 25, 2024
a82c7bc
Renamed the struct BattleMove's bigMoveName variable and introduced m…
LOuroboros Jan 25, 2024
f9f422d
Reintroduced the contest parameters for Pokémon moves
Bassoonian Jan 26, 2024
ab344b8
Renamed gBattleMoves to gMovesInfo
LOuroboros Jan 26, 2024
ea6cd55
Renamed the BattleMove struct to MovesInfo
LOuroboros Jan 26, 2024
dc60e70
Removed empty lines separating battle params from contest params in g…
LOuroboros Jan 26, 2024
36bc7fe
Renamed MovesInfo to MoveInfo
LOuroboros Jan 26, 2024
1c10095
Merge branch 'upcoming' into compoundMoveNamesAndDescs
Bassoonian Jan 26, 2024
e86a4bc
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Jan 26, 2024
5da9a9f
Added Cancer Fairy's HANDLE_EXPANDED_MOVE_NAME macro
LOuroboros Jan 27, 2024
b37899d
Renamed GetBattleMoveName to GetMoveName
LOuroboros Jan 27, 2024
1b0df2c
Added a comment pointing out that the shared move descriptions are sh…
LOuroboros Jan 28, 2024
2589f0d
Re-aligned one of the escape characters of CHECK_MOVE_FLAG
LOuroboros Jan 28, 2024
0566ffd
Renamed the battle_moves.h file to moves_info.h instead for consisten…
LOuroboros Jan 28, 2024
8b149a8
Applied Eduardo's adjustments
AsparagusEduardo Jan 29, 2024
0caeb95
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Jan 29, 2024
fc208d3
Updated Pursuit test after merge
LOuroboros Jan 29, 2024
5d541c5
Merge branch 'upcoming' of https://github.com/rh-hideout/pokeemerald-…
LOuroboros Jan 29, 2024
2c2f1a6
Renamed the BATTLE_CATEGORY constants to DAMAGE_CATEGORY
LOuroboros Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct __attribute__((packed, aligned(2))) BattleMoveEffect
u16 flags:12; // coming soon...
};

#define GET_MOVE_BATTLESCRIPT(move) gBattleMoveEffects[gBattleMoves[move].effect].battleScript
#define GET_MOVE_BATTLESCRIPT(move) gBattleMoveEffects[gMovesInfo[move].effect].battleScript

struct ResourceFlags
{
Expand Down Expand Up @@ -786,14 +786,14 @@ STATIC_ASSERT(sizeof(((struct BattleStruct *)0)->palaceFlags) * 8 >= MAX_BATTLER
if (gBattleStruct->dynamicMoveType) \
typeArg = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; \
else \
typeArg = gBattleMoves[move].type; \
typeArg = gMovesInfo[move].type; \
}

#define IS_MOVE_PHYSICAL(move)(GetBattleMoveCategory(move) == BATTLE_CATEGORY_PHYSICAL)
#define IS_MOVE_SPECIAL(move)(GetBattleMoveCategory(move) == BATTLE_CATEGORY_SPECIAL)
#define IS_MOVE_STATUS(move)(gBattleMoves[move].category == BATTLE_CATEGORY_STATUS)
#define IS_MOVE_STATUS(move)(gMovesInfo[move].category == BATTLE_CATEGORY_STATUS)

#define IS_MOVE_RECOIL(move)(gBattleMoves[move].recoil > 0 || gBattleMoves[move].effect == EFFECT_RECOIL_IF_MISS)
#define IS_MOVE_RECOIL(move)(gMovesInfo[move].recoil > 0 || gMovesInfo[move].effect == EFFECT_RECOIL_IF_MISS)

#define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0) || (gBattleStruct->enduredDamage & gBitTable[gBattlerTarget]))
Expand Down
1 change: 0 additions & 1 deletion include/battle_dynamax.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ bool32 ShouldUseMaxMove(u16 battlerId, u16 baseMove);
u16 GetMaxMove(u16 battlerId, u16 baseMove);
u8 GetMaxMovePower(u16 move);
bool32 IsMaxMove(u16 move);
const u8 *GetMaxMoveName(u16 move);
void ChooseDamageNonTypesString(u8 type);

void BS_UpdateDynamax(void);
Expand Down
1 change: 0 additions & 1 deletion include/battle_z_move.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void HideZMoveTriggerSprite(void);
bool32 IsZMoveTriggerSpriteActive(void);
void DestroyZMoveTriggerSprite(void);
bool32 MoveSelectionDisplayZMove(u16 zmove, u32 battler);
const u8 *GetZMoveName(u16 move);
void SetZEffect(void);
bool32 IsZMoveUsable(u8 battler, u16 moveIndex);
void GetUsableZMoves(u8 battler, u16 *moves);
Expand Down
2 changes: 1 addition & 1 deletion include/config/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#define B_FAINT_SWITCH_IN GEN_LATEST // In Gen4+, sending out a new Pokémon after the previous one fainted happens at the end of the turn. Before, it would happen after each action.

// Move data settings
#define B_UPDATED_MOVE_DATA GEN_LATEST // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets and chances of secondary effects.
#define B_UPDATED_MOVE_DATA GEN_LATEST // Updates move data in gMovesInfo, including Power, Accuracy, PP, stat changes, targets and chances of secondary effects.
#define B_UPDATED_MOVE_TYPES GEN_LATEST // Updates move types.
#define B_UPDATED_MOVE_FLAGS GEN_LATEST // Updates move flags.
#define B_PHYSICAL_SPECIAL_SPLIT GEN_LATEST // In Gen3, the move's type determines if it will do physical or special damage. The split icon in the summary will reflect this.
Expand Down
9 changes: 0 additions & 9 deletions include/contest_effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,13 @@
#define GUARD_CONTEST_EFFECT_H
#define MAX_COMBO_MOVES 5

struct ContestMove
{
u8 effect;
u8 contestCategory:3;
u8 comboStarterId;
u8 comboMoves[MAX_COMBO_MOVES];
};

struct ContestEffect
{
u8 effectType;
u8 appeal;
u8 jam;
};

extern const struct ContestMove gContestMoves[];
extern const struct ContestEffect gContestEffects[];
extern const u8 *const gContestEffectDescriptionPointers[];
extern const u8 *const gContestMoveTypeTextPointers[];
Expand Down
3 changes: 0 additions & 3 deletions include/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,5 @@ extern const struct Trainer gTrainers[];
extern const struct Trainer gBattlePartners[];

extern const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT];
extern const u8 gMoveNames[MOVES_COUNT_DYNAMAX][MOVE_NAME_LENGTH + 1];
extern const u8 *const gZMoveNames[];
extern const u8 *const gMaxMoveNames[];

#endif // GUARD_DATA_H
17 changes: 15 additions & 2 deletions include/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "constants/items.h"
#include "constants/region_map_sections.h"
#include "constants/map_groups.h"
#include "contest_effect.h"

#define GET_BASE_SPECIES_ID(speciesId) (GetFormSpeciesId(speciesId, 0))
#define FORM_SPECIES_END (0xffff)
Expand Down Expand Up @@ -443,8 +444,13 @@ struct SpeciesInfo /*0x8C*/
/* 0x84 */ const struct FormChange *formChangeTable;
};

struct BattleMove
struct MoveInfo
{
union {
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
u8 moveName[MOVE_NAME_LENGTH + 1];
const u8 *longMoveName;
} name;
const u8 *description;
u16 effect;
u8 power;
u8 type:5;
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -515,6 +521,12 @@ struct BattleMove

// primary/secondary effects
const struct AdditionalEffect *additionalEffects;

// contest parameters
u8 contestEffect;
u8 contestCategory:3;
u8 contestComboStarterId;
u8 contestComboMoves[MAX_COMBO_MOVES];
};

#define EFFECTS_ARR(...) (const struct AdditionalEffect[]) {__VA_ARGS__}
Expand Down Expand Up @@ -597,7 +609,7 @@ extern u8 gEnemyPartyCount;
extern struct Pokemon gEnemyParty[PARTY_SIZE];
extern struct SpriteTemplate gMultiuseSpriteTemplate;

extern const struct BattleMove gBattleMoves[];
extern const struct MoveInfo gMovesInfo[];
extern const u8 gFacilityClassToPicIndex[];
extern const u8 gFacilityClassToTrainerClass[];
extern const struct SpeciesInfo gSpeciesInfo[];
Expand Down Expand Up @@ -791,5 +803,6 @@ u16 GetCryIdBySpecies(u16 species);
u16 GetSpeciesPreEvolution(u16 species);
void HealPokemon(struct Pokemon *mon);
void HealBoxPokemon(struct BoxPokemon *boxMon);
const u8 *GetBattleMoveName(u16 moveId);
LOuroboros marked this conversation as resolved.
Show resolved Hide resolved

#endif // GUARD_POKEMON_H
14 changes: 7 additions & 7 deletions include/test/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*
* ASSUMPTIONS
* {
* ASSUME(gBattleMoves[MOVE_STUN_SPORE].effect == EFFECT_PARALYZE);
* ASSUME(gMovesInfo[MOVE_STUN_SPORE].effect == EFFECT_PARALYZE);
* }
*
* SINGLE_BATTLE_TEST("Stun Spore inflicts paralysis")
Expand Down Expand Up @@ -87,7 +87,7 @@
* SINGLE_BATTLE_TEST("Stun Spore does not affect Grass-types")
* {
* GIVEN {
* ASSUME(gBattleMoves[MOVE_STUN_SPORE].powderMove);
* ASSUME(gMovesInfo[MOVE_STUN_SPORE].powderMove);
* ASSUME(gSpeciesInfo[SPECIES_ODDISH].types[0] == TYPE_GRASS);
* PLAYER(SPECIES_ODDISH); // 1.
* OPPONENT(SPECIES_ODDISH); // 2.
Expand Down Expand Up @@ -129,7 +129,7 @@
* PARAMETRIZE { raiseAttack = FALSE; }
* PARAMETRIZE { raiseAttack = TRUE; }
* GIVEN {
* ASSUME(gBattleMoves[MOVE_TACKLE].category == BATTLE_CATEGORY_PHYSICAL);
* ASSUME(gMovesInfo[MOVE_TACKLE].category == BATTLE_CATEGORY_PHYSICAL);
* PLAYER(SPECIES_WOBBUFFET);
* OPPONENT(SPECIES_WOBBUFFET);
* } WHEN {
Expand Down Expand Up @@ -176,7 +176,7 @@
* Pokémon we can observe the damage of a physical attack with and
* without the burn. To document that this test assumes the attack is
* physical we can use:
* ASSUME(gBattleMoves[MOVE_WHATEVER].category == BATTLE_CATEGORY_PHYSICAL);
* ASSUME(gMovesInfo[MOVE_WHATEVER].category == BATTLE_CATEGORY_PHYSICAL);
*
* ASSUMPTIONS
* Should be placed immediately after any #includes and contain any
Expand All @@ -186,7 +186,7 @@
* move_effect_poison_hit.c should be:
* ASSUMPTIONS
* {
* ASSUME(gBattleMoves[MOVE_POISON_STING].effect == EFFECT_POISON_HIT);
* ASSUME(gMovesInfo[MOVE_POISON_STING].effect == EFFECT_POISON_HIT);
* }
*
* SINGLE_BATTLE_TEST(name, results...) and DOUBLE_BATTLE_TEST(name, results...)
Expand Down Expand Up @@ -228,7 +228,7 @@
* PARAMETRIZE { hp = 99; }
* PARAMETRIZE { hp = 33; }
* GIVEN {
* ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE);
* ASSUME(gMovesInfo[MOVE_EMBER].type == TYPE_FIRE);
* PLAYER(SPECIES_CHARMANDER) { Ability(ABILITY_BLAZE); MaxHP(99); HP(hp); }
* OPPONENT(SPECIES_WOBBUFFET);
* } WHEN {
Expand Down Expand Up @@ -265,7 +265,7 @@
*
* If the tag is not provided, runs the test 50 times and computes an
* approximate pass ratio.
* PASSES_RANDOMLY(gBattleMoves[move].accuracy, 100);
* PASSES_RANDOMLY(gMovesInfo[move].accuracy, 100);
* Note that this mode of PASSES_RANDOMLY makes the tests run very
* slowly and should be avoided where possible. If the mechanic you are
* testing is missing its tag, you should add it.
Expand Down
8 changes: 4 additions & 4 deletions src/apprentice.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ static void CreateApprenticeMenu(u8 menu)
case APPRENTICE_ASK_MOVES:
left = 17;
top = 8;
strings[0] = gMoveNames[gApprenticeQuestionData->moveId1];
strings[1] = gMoveNames[gApprenticeQuestionData->moveId2];
strings[0] = GetBattleMoveName(gApprenticeQuestionData->moveId1);
strings[1] = GetBattleMoveName(gApprenticeQuestionData->moveId2);
break;
case APPRENTICE_ASK_GIVE:
left = 18;
Expand Down Expand Up @@ -1041,10 +1041,10 @@ static void ApprenticeBufferString(void)
StringCopy(stringDst, GetSpeciesName(gApprenticeQuestionData->speciesId));
break;
case APPRENTICE_BUFF_MOVE1:
StringCopy(stringDst, gMoveNames[gApprenticeQuestionData->moveId1]);
StringCopy(stringDst, GetBattleMoveName(gApprenticeQuestionData->moveId1));
break;
case APPRENTICE_BUFF_MOVE2:
StringCopy(stringDst, gMoveNames[gApprenticeQuestionData->moveId2]);
StringCopy(stringDst, GetBattleMoveName(gApprenticeQuestionData->moveId2));
break;
case APPRENTICE_BUFF_ITEM:
StringCopy(stringDst, ItemId_GetName(PLAYER_APPRENTICE.questions[CURRENT_QUESTION_NUM].data));
Expand Down
Loading
Loading