sovereignx/src/battle_anim_mons.c

2473 lines
72 KiB
C
Raw Normal View History

2018-10-06 22:04:53 +01:00
#include "global.h"
#include "battle.h"
#include "battle_anim.h"
#include "battle_interface.h"
2018-11-14 00:01:50 +00:00
#include "bg.h"
2018-10-06 22:04:53 +01:00
#include "contest.h"
2019-04-04 22:53:06 +01:00
#include "data.h"
2018-10-06 22:04:53 +01:00
#include "decompress.h"
2018-11-14 00:01:50 +00:00
#include "dma3.h"
#include "gpu_regs.h"
#include "malloc.h"
2018-10-06 22:04:53 +01:00
#include "palette.h"
#include "pokemon_icon.h"
#include "sprite.h"
#include "task.h"
#include "trig.h"
#include "util.h"
2018-11-14 00:01:50 +00:00
#include "constants/battle_anim.h"
2018-10-06 22:04:53 +01:00
#define IS_DOUBLE_BATTLE() ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
2019-10-15 00:26:47 +01:00
extern const struct OamData gOamData_AffineNormal_ObjNormal_64x64;
2018-10-06 22:04:53 +01:00
2021-11-08 18:18:58 +00:00
static void AnimTranslateLinear_WithFollowup_SetCornerVecX(struct Sprite *sprite);
2021-01-23 05:40:46 +00:00
static void AnimFastTranslateLinearWaitEnd(struct Sprite *sprite);
2019-10-20 09:47:56 +01:00
static void AnimThrowProjectile_Step(struct Sprite *sprite);
2021-11-01 16:41:21 +00:00
static void AnimBattlerTrace(struct Sprite *sprite);
2021-01-23 05:40:46 +00:00
static void AnimWeatherBallUp_Step(struct Sprite *sprite);
2019-02-06 19:17:09 +00:00
static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId);
2020-02-20 05:04:42 +00:00
static void AnimTask_BlendPalInAndOutSetup(struct Task *task);
2021-01-23 05:40:46 +00:00
static void AnimTask_AlphaFadeIn_Step(u8 taskId);
static void AnimTask_AttackerPunchWithTrace_Step(u8 taskId);
static void AnimTask_BlendMonInAndOut_Step(u8 taskId);
2021-11-01 16:41:21 +00:00
static bool8 ShouldRotScaleSpeciesBeFlipped(void);
static void CreateBattlerTrace(struct Task *task, u8 taskId);
2018-10-07 11:32:20 +01:00
2021-11-01 16:02:08 +00:00
EWRAM_DATA static union AffineAnimCmd *sAnimTaskAffineAnim = NULL;
2018-10-06 22:04:53 +01:00
const struct UCoords8 sBattlerCoords[][MAX_BATTLERS_COUNT] =
2018-10-06 22:04:53 +01:00
{
2021-10-04 15:21:03 +01:00
{ // Single battle
2018-10-06 22:04:53 +01:00
{ 72, 80 },
{ 176, 40 },
{ 48, 40 },
{ 112, 80 },
},
2021-10-04 15:21:03 +01:00
{ // Double battle
2018-10-06 22:04:53 +01:00
{ 32, 80 },
{ 200, 40 },
{ 90, 88 },
{ 152, 32 },
},
};
// Placeholders for Pokémon sprites to be created for a move animation effect (e.g. Role Play / Snatch)
2021-01-23 04:22:37 +00:00
#define TAG_MOVE_EFFECT_MON_1 55125
#define TAG_MOVE_EFFECT_MON_2 55126
2022-08-17 16:44:20 +01:00
static const struct SpriteTemplate sSpriteTemplates_MoveEffectMons[] =
2018-10-06 22:04:53 +01:00
{
{
2021-01-23 04:22:37 +00:00
.tileTag = TAG_MOVE_EFFECT_MON_1,
.paletteTag = TAG_MOVE_EFFECT_MON_1,
2019-10-15 00:26:47 +01:00
.oam = &gOamData_AffineNormal_ObjNormal_64x64,
2018-10-06 22:04:53 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
},
{
2021-01-23 04:22:37 +00:00
.tileTag = TAG_MOVE_EFFECT_MON_2,
.paletteTag = TAG_MOVE_EFFECT_MON_2,
2019-10-15 00:26:47 +01:00
.oam = &gOamData_AffineNormal_ObjNormal_64x64,
2018-10-06 22:04:53 +01:00
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
}
};
2022-08-17 16:44:20 +01:00
static const struct SpriteSheet sSpriteSheets_MoveEffectMons[] =
2018-10-06 22:04:53 +01:00
{
2021-03-29 14:38:19 +01:00
{ gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_1, },
{ gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, },
2018-10-06 22:04:53 +01:00
};
2018-12-18 04:08:08 +00:00
u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType)
2018-10-06 22:04:53 +01:00
{
u8 retVal;
u16 species;
2019-08-08 12:06:55 +01:00
struct Pokemon *mon, *illusionMon;
2018-10-06 22:04:53 +01:00
struct BattleSpriteInfo *spriteInfo;
if (IsContest())
{
2018-12-18 04:08:08 +00:00
if (coordType == BATTLER_COORD_Y_PIC_OFFSET && battlerId == 3)
coordType = BATTLER_COORD_Y;
2018-10-06 22:04:53 +01:00
}
2018-12-18 04:08:08 +00:00
switch (coordType)
2018-10-06 22:04:53 +01:00
{
case BATTLER_COORD_X:
case BATTLER_COORD_X_2:
retVal = sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].x;
2018-10-06 22:04:53 +01:00
break;
case BATTLER_COORD_Y:
retVal = sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].y;
2018-10-06 22:04:53 +01:00
break;
2018-12-18 04:08:08 +00:00
case BATTLER_COORD_Y_PIC_OFFSET:
case BATTLER_COORD_Y_PIC_OFFSET_DEFAULT:
2018-10-06 22:04:53 +01:00
default:
if (IsContest())
{
2020-08-14 00:10:23 +01:00
if (gContestResources->moveAnim->hasTargetAnim)
species = gContestResources->moveAnim->targetSpecies;
2018-10-06 22:04:53 +01:00
else
2020-08-14 00:10:23 +01:00
species = gContestResources->moveAnim->species;
2018-10-06 22:04:53 +01:00
}
else
{
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
2019-08-08 12:06:55 +01:00
mon = &gEnemyParty[gBattlerPartyIndexes[battlerId]];
2018-10-06 22:04:53 +01:00
else
2019-08-08 12:06:55 +01:00
mon = &gPlayerParty[gBattlerPartyIndexes[battlerId]];
illusionMon = GetIllusionMonPtr(battlerId);
if (illusionMon != NULL)
mon = illusionMon;
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
species = GetMonData(mon, MON_DATA_SPECIES);
else
species = spriteInfo[battlerId].transformSpecies;
2018-10-06 22:04:53 +01:00
}
2018-12-18 04:08:08 +00:00
if (coordType == BATTLER_COORD_Y_PIC_OFFSET)
2018-10-06 22:04:53 +01:00
retVal = GetBattlerSpriteFinal_Y(battlerId, species, TRUE);
else
retVal = GetBattlerSpriteFinal_Y(battlerId, species, FALSE);
break;
}
return retVal;
}
u8 GetBattlerYDelta(u8 battlerId, u16 species)
{
u32 personality;
struct BattleSpriteInfo *spriteInfo;
u8 ret;
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
species = SanitizeSpeciesId(species);
2018-10-06 22:04:53 +01:00
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || IsContest())
{
2023-01-07 14:39:56 +00:00
if (species == SPECIES_UNOWN)
{
if (IsContest())
{
if (gContestResources->moveAnim->hasTargetAnim)
personality = gContestResources->moveAnim->targetPersonality;
else
personality = gContestResources->moveAnim->personality;
}
else
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY);
else
personality = gTransformedPersonalities[battlerId];
}
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
species = GetUnownSpeciesId(personality);
2023-01-07 14:39:56 +00:00
}
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
ret = gSpeciesInfo[species].backPicYOffset;
2018-10-06 22:04:53 +01:00
}
else
{
2023-01-07 14:39:56 +00:00
if (species == SPECIES_UNOWN)
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY);
else
personality = gTransformedPersonalities[battlerId];
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
species = GetUnownSpeciesId(personality);
2023-01-07 14:39:56 +00:00
}
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
ret = gSpeciesInfo[species].frontPicYOffset;
2018-10-06 22:04:53 +01:00
}
return ret;
}
u8 GetBattlerElevation(u8 battlerId, u16 species)
{
u8 ret = 0;
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
{
if (!IsContest())
{
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
species = SanitizeSpeciesId(species);
ret = gSpeciesInfo[species].enemyMonElevation;
2018-10-06 22:04:53 +01:00
}
}
return ret;
}
u8 GetBattlerSpriteFinal_Y(u8 battlerId, u16 species, bool8 a3)
{
u16 offset;
u8 y;
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || IsContest())
{
offset = GetBattlerYDelta(battlerId, species);
}
else
{
offset = GetBattlerYDelta(battlerId, species);
offset -= GetBattlerElevation(battlerId, species);
}
y = offset + sBattlerCoords[WhichBattleCoords(battlerId)][GetBattlerPosition(battlerId)].y;
2018-10-06 22:04:53 +01:00
if (a3)
{
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
y += 8;
2021-11-01 16:41:21 +00:00
if (y > DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8)
y = DISPLAY_HEIGHT - MON_PIC_HEIGHT + 8;
2018-10-06 22:04:53 +01:00
}
return y;
}
2018-12-18 04:08:08 +00:00
u8 GetBattlerSpriteCoord2(u8 battlerId, u8 coordType)
2018-10-06 22:04:53 +01:00
{
u16 species;
struct BattleSpriteInfo *spriteInfo;
2018-12-18 04:08:08 +00:00
if (coordType == BATTLER_COORD_Y_PIC_OFFSET || coordType == BATTLER_COORD_Y_PIC_OFFSET_DEFAULT)
2018-10-06 22:04:53 +01:00
{
if (IsContest())
{
2020-08-14 00:10:23 +01:00
if (gContestResources->moveAnim->hasTargetAnim)
species = gContestResources->moveAnim->targetSpecies;
2018-10-06 22:04:53 +01:00
else
2020-08-14 00:10:23 +01:00
species = gContestResources->moveAnim->species;
2018-10-06 22:04:53 +01:00
}
else
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
species = gAnimBattlerSpecies[battlerId];
else
species = spriteInfo[battlerId].transformSpecies;
}
2018-12-18 04:08:08 +00:00
if (coordType == BATTLER_COORD_Y_PIC_OFFSET)
2018-10-06 22:04:53 +01:00
return GetBattlerSpriteFinal_Y(battlerId, species, TRUE);
else
return GetBattlerSpriteFinal_Y(battlerId, species, FALSE);
}
else
{
2018-12-18 04:08:08 +00:00
return GetBattlerSpriteCoord(battlerId, coordType);
2018-10-06 22:04:53 +01:00
}
}
u8 GetBattlerSpriteDefault_Y(u8 battlerId)
{
2018-12-18 04:08:08 +00:00
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET_DEFAULT);
2018-10-06 22:04:53 +01:00
}
u8 GetSubstituteSpriteDefault_Y(u8 battlerId)
{
u16 y;
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 16;
else
y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 17;
return y;
}
u8 GetBattlerYCoordWithElevation(u8 battlerId)
{
u16 species;
u8 y;
struct BattleSpriteInfo *spriteInfo;
y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y);
if (!IsContest())
{
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
else
species = spriteInfo[battlerId].transformSpecies;
}
else
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
else
species = spriteInfo[battlerId].transformSpecies;
}
if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
y -= GetBattlerElevation(battlerId, species);
}
return y;
}
2018-12-18 04:08:08 +00:00
u8 GetAnimBattlerSpriteId(u8 animBattler)
2018-10-06 22:04:53 +01:00
{
u32 partner;
2018-10-06 22:04:53 +01:00
switch (animBattler)
2018-10-06 22:04:53 +01:00
{
case ANIM_ATTACKER:
2018-10-06 22:04:53 +01:00
if (IsBattlerSpritePresent(gBattleAnimAttacker))
{
return gBattlerSpriteIds[gBattleAnimAttacker];
2018-10-06 22:04:53 +01:00
}
else
{
2021-11-08 18:18:58 +00:00
return SPRITE_NONE;
2018-10-06 22:04:53 +01:00
}
break;
case ANIM_TARGET:
2018-10-06 22:04:53 +01:00
if (IsBattlerSpritePresent(gBattleAnimTarget))
{
return gBattlerSpriteIds[gBattleAnimTarget];
2018-10-06 22:04:53 +01:00
}
else
{
2021-11-08 18:18:58 +00:00
return SPRITE_NONE;
2018-10-06 22:04:53 +01:00
}
break;
case ANIM_ATK_PARTNER:
2018-10-06 22:04:53 +01:00
if (!IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
2021-11-08 18:18:58 +00:00
return SPRITE_NONE;
2018-10-06 22:04:53 +01:00
else
return gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)];
break;
case ANIM_DEF_PARTNER:
2018-10-06 22:04:53 +01:00
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
return gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)];
else
2021-11-08 18:18:58 +00:00
return SPRITE_NONE;
break;
case ANIM_PLAYER_LEFT ... ANIM_OPPONENT_RIGHT:
partner = animBattler - MAX_BATTLERS_COUNT;
if (IsBattlerSpriteVisible(partner))
return gBattlerSpriteIds[partner];
else
return SPRITE_NONE;
break;
default:
return SPRITE_NONE;
2018-10-06 22:04:53 +01:00
}
}
2022-07-29 16:15:33 +01:00
void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*callback)(struct Sprite *))
2018-10-06 22:04:53 +01:00
{
sprite->data[6] = (u32)(callback) & 0xffff;
sprite->data[7] = (u32)(callback) >> 16;
}
void SetCallbackToStoredInData6(struct Sprite *sprite)
{
u32 callback = (u16)sprite->data[6] | (sprite->data[7] << 16);
sprite->callback = (void (*)(struct Sprite *))callback;
}
2021-11-08 18:18:58 +00:00
// Sprite data for TranslateSpriteInCircle/Ellipse and related
#define sCirclePos data[0]
#define sAmplitude data[1]
#define sCircleSpeed data[2]
#define sDuration data[3]
// TranslateSpriteInGrowingCircle
#define sAmplitudeSpeed data[4]
#define sAmplitudeChange data[5]
// TranslateSpriteInEllipse
#define sAmplitudeX sAmplitude
#define sAmplitudeY data[4]
2022-08-17 16:44:20 +01:00
// TranslateSpriteInLissajousCurve
2021-11-08 18:18:58 +00:00
#define sCirclePosX sCirclePos
#define sCircleSpeedX sCircleSpeed
#define sCirclePosY data[4]
#define sCircleSpeedY data[5]
void TranslateSpriteInCircle(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
if (sprite->sDuration)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
sprite->x2 = Sin(sprite->sCirclePos, sprite->sAmplitude);
sprite->y2 = Cos(sprite->sCirclePos, sprite->sAmplitude);
sprite->sCirclePos += sprite->sCircleSpeed;
if (sprite->sCirclePos >= 0x100)
sprite->sCirclePos -= 0x100;
else if (sprite->sCirclePos < 0)
sprite->sCirclePos += 0x100;
sprite->sDuration--;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2021-11-08 18:18:58 +00:00
void TranslateSpriteInGrowingCircle(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
if (sprite->sDuration)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
sprite->x2 = Sin(sprite->sCirclePos, (sprite->sAmplitudeChange >> 8) + sprite->sAmplitude);
sprite->y2 = Cos(sprite->sCirclePos, (sprite->sAmplitudeChange >> 8) + sprite->sAmplitude);
sprite->sCirclePos += sprite->sCircleSpeed;
sprite->sAmplitudeChange += sprite->sAmplitudeSpeed;
if (sprite->sCirclePos >= 0x100)
sprite->sCirclePos -= 0x100;
else if (sprite->sCirclePos < 0)
sprite->sCirclePos += 0x100;
sprite->sDuration--;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2021-11-08 18:18:58 +00:00
// Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc.
static void UNUSED TranslateSpriteInLissajousCurve(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
if (sprite->sDuration)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
sprite->x2 = Sin(sprite->sCirclePosX, sprite->sAmplitude);
sprite->y2 = Cos(sprite->sCirclePosY, sprite->sAmplitude);
sprite->sCirclePosX += sprite->sCircleSpeedX;
sprite->sCirclePosY += sprite->sCircleSpeedY;
2021-11-08 18:18:58 +00:00
if (sprite->sCirclePosX >= 0x100)
sprite->sCirclePosX -= 0x100;
else if (sprite->sCirclePosX < 0)
sprite->sCirclePosX += 0x100;
if (sprite->sCirclePosY >= 0x100)
sprite->sCirclePosY -= 0x100;
else if (sprite->sCirclePosY < 0)
sprite->sCirclePosY += 0x100;
sprite->sDuration--;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2021-11-08 18:18:58 +00:00
void TranslateSpriteInEllipse(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
if (sprite->sDuration)
2018-10-06 22:04:53 +01:00
{
2021-11-08 18:18:58 +00:00
sprite->x2 = Sin(sprite->sCirclePos, sprite->sAmplitudeX);
sprite->y2 = Cos(sprite->sCirclePos, sprite->sAmplitudeY);
sprite->sCirclePos += sprite->sCircleSpeed;
if (sprite->sCirclePos >= 0x100)
sprite->sCirclePos -= 0x100;
else if (sprite->sCirclePos < 0)
sprite->sCirclePos += 0x100;
sprite->sDuration--;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2021-11-08 18:18:58 +00:00
#undef sCirclePos
#undef sAmplitude
#undef sCircleSpeed
#undef sDuration
#undef sAmplitudeSpeed
#undef sAmplitudeChange
#undef sAmplitudeX
#undef sAmplitudeY
#undef sCirclePosX
#undef sCircleSpeedX
#undef sCirclePosY
#undef sCircleSpeedY
2018-10-06 22:04:53 +01:00
// Simply waits until the sprite's data[0] hits zero.
// This is used to let sprite anims or affine anims to run for a designated
// duration.
2018-11-26 15:55:31 +00:00
void WaitAnimForDuration(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->data[0] > 0)
sprite->data[0]--;
else
SetCallbackToStoredInData6(sprite);
}
2021-11-01 16:41:21 +00:00
// Sprite data for ConvertPosDataToTranslateLinearData
2021-11-08 18:18:58 +00:00
#define sStepsX data[0]
2021-11-01 16:41:21 +00:00
#define sStartX data[1]
#define sTargetX data[2]
#define sStartY data[3]
#define sTargetY data[4]
// Sprite data for TranslateSpriteLinear
#define sMoveSteps data[0]
#define sSpeedX data[1]
#define sSpeedY data[2]
// Functionally unused
static void AnimPosToTranslateLinear(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-01 16:41:21 +00:00
ConvertPosDataToTranslateLinearData(sprite);
2019-02-06 19:17:09 +00:00
sprite->callback = TranslateSpriteLinear;
2018-10-06 22:04:53 +01:00
sprite->callback(sprite);
}
2021-11-01 16:41:21 +00:00
void ConvertPosDataToTranslateLinearData(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
s16 old;
2019-02-06 19:17:09 +00:00
int xDiff;
2018-10-06 22:04:53 +01:00
2021-11-01 16:41:21 +00:00
if (sprite->sStartX > sprite->sTargetX)
sprite->sStepsX = -sprite->sStepsX;
xDiff = sprite->sTargetX - sprite->sStartX;
old = sprite->sStepsX;
sprite->sMoveSteps = abs(xDiff / sprite->sStepsX);
sprite->sSpeedY = (sprite->sTargetY - sprite->sStartY) / sprite->sMoveSteps;
sprite->sSpeedX = old;
2018-10-06 22:04:53 +01:00
}
2019-02-06 19:17:09 +00:00
void TranslateSpriteLinear(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-01 16:41:21 +00:00
if (sprite->sMoveSteps > 0)
2018-10-06 22:04:53 +01:00
{
2021-11-01 16:41:21 +00:00
sprite->sMoveSteps--;
sprite->x2 += sprite->sSpeedX;
sprite->y2 += sprite->sSpeedY;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2019-02-06 19:17:09 +00:00
void TranslateSpriteLinearFixedPoint(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->data[0] > 0)
{
sprite->data[0]--;
sprite->data[3] += sprite->data[1];
sprite->data[4] += sprite->data[2];
2021-07-07 14:11:52 +01:00
sprite->x2 = sprite->data[3] >> 8;
sprite->y2 = sprite->data[4] >> 8;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2019-02-06 19:17:09 +00:00
static void TranslateSpriteLinearFixedPointIconFrame(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->data[0] > 0)
{
sprite->data[0]--;
sprite->data[3] += sprite->data[1];
sprite->data[4] += sprite->data[2];
2021-07-07 14:11:52 +01:00
sprite->x2 = sprite->data[3] >> 8;
sprite->y2 = sprite->data[4] >> 8;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
2019-02-06 19:17:09 +00:00
2018-10-06 22:04:53 +01:00
UpdateMonIconFrame(sprite);
}
static void UNUSED TranslateSpriteToBattleTargetPos(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-01 16:41:21 +00:00
sprite->sStartX = sprite->x + sprite->x2;
sprite->sStartY = sprite->y + sprite->y2;
sprite->sTargetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2);
sprite->sTargetY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = AnimPosToTranslateLinear;
2018-10-06 22:04:53 +01:00
}
2021-11-01 16:41:21 +00:00
// Same as TranslateSpriteLinear but takes an id to specify which sprite to move
void TranslateSpriteLinearById(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->data[0] > 0)
{
sprite->data[0]--;
2021-07-07 14:11:52 +01:00
gSprites[sprite->data[3]].x2 += sprite->data[1];
gSprites[sprite->data[3]].y2 += sprite->data[2];
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2021-11-01 16:41:21 +00:00
void TranslateSpriteLinearByIdFixedPoint(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->data[0] > 0)
{
sprite->data[0]--;
sprite->data[3] += sprite->data[1];
sprite->data[4] += sprite->data[2];
2021-07-07 14:11:52 +01:00
gSprites[sprite->data[5]].x2 = sprite->data[3] >> 8;
gSprites[sprite->data[5]].y2 = sprite->data[4] >> 8;
2018-10-06 22:04:53 +01:00
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2019-02-06 19:17:09 +00:00
void TranslateSpriteLinearAndFlicker(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->data[0] > 0)
{
sprite->data[0]--;
2021-07-07 14:11:52 +01:00
sprite->x2 = sprite->data[2] >> 8;
2018-10-06 22:04:53 +01:00
sprite->data[2] += sprite->data[1];
2021-07-07 14:11:52 +01:00
sprite->y2 = sprite->data[4] >> 8;
2018-10-06 22:04:53 +01:00
sprite->data[4] += sprite->data[3];
if (sprite->data[0] % sprite->data[5] == 0)
{
if (sprite->data[5])
sprite->invisible ^= 1;
}
}
else
{
SetCallbackToStoredInData6(sprite);
}
}
2018-12-18 04:08:08 +00:00
void DestroySpriteAndMatrix(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
FreeSpriteOamMatrix(sprite);
DestroyAnimSprite(sprite);
}
static void UNUSED TranslateSpriteToBattleAttackerPos(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-01 16:41:21 +00:00
sprite->sStartX = sprite->x + sprite->x2;
sprite->sStartY = sprite->y + sprite->y2;
sprite->sTargetX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->sTargetY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = AnimPosToTranslateLinear;
2018-10-06 22:04:53 +01:00
}
2021-11-08 18:18:58 +00:00
#undef sStepsX
#undef sStartX
#undef sTargetX
#undef sStartY
#undef sTargetY
static void UNUSED EndUnkPaletteAnim(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-11-01 16:01:51 +00:00
PaletteStruct_ResetById(sprite->data[5]);
2018-12-18 04:08:08 +00:00
DestroySpriteAndMatrix(sprite);
2018-10-06 22:04:53 +01:00
}
2018-12-18 04:08:08 +00:00
void RunStoredCallbackWhenAffineAnimEnds(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->affineAnimEnded)
SetCallbackToStoredInData6(sprite);
}
2018-12-18 04:08:08 +00:00
void RunStoredCallbackWhenAnimEnds(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
if (sprite->animEnded)
SetCallbackToStoredInData6(sprite);
}
2019-02-06 19:17:09 +00:00
void DestroyAnimSpriteAndDisableBlend(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroyAnimSprite(sprite);
}
2018-12-31 17:01:37 +00:00
void DestroyAnimVisualTaskAndDisableBlend(u8 taskId)
2018-10-06 22:04:53 +01:00
{
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroyAnimVisualTask(taskId);
}
2018-12-18 04:08:08 +00:00
void SetSpriteCoordsToAnimAttackerCoords(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-10-06 22:04:53 +01:00
}
2018-12-20 03:13:26 +00:00
// Sets the initial x offset of the anim sprite depending on the horizontal orientation
// of the two involved mons.
void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 xOffset)
2018-10-06 22:04:53 +01:00
{
2018-12-18 04:08:08 +00:00
u16 attackerX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X);
u16 targetX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X);
2018-10-06 22:04:53 +01:00
2018-12-18 04:08:08 +00:00
if (attackerX > targetX)
2018-10-06 22:04:53 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->x -= xOffset;
2018-10-06 22:04:53 +01:00
}
2018-12-18 04:08:08 +00:00
else if (attackerX < targetX)
2018-10-06 22:04:53 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->x += xOffset;
2018-10-06 22:04:53 +01:00
}
else
{
2018-12-18 04:08:08 +00:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
2021-07-07 14:11:52 +01:00
sprite->x -= xOffset;
2018-10-06 22:04:53 +01:00
else
2021-07-07 14:11:52 +01:00
sprite->x += xOffset;
2018-10-06 22:04:53 +01:00
}
}
2018-11-25 23:00:18 +00:00
void InitAnimArcTranslation(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
2018-10-06 22:04:53 +01:00
InitAnimLinearTranslation(sprite);
sprite->data[6] = 0x8000 / sprite->data[0];
sprite->data[7] = 0;
}
2019-02-06 19:17:09 +00:00
bool8 TranslateAnimHorizontalArc(struct Sprite *sprite)
2018-10-06 22:04:53 +01:00
{
2018-12-20 03:13:26 +00:00
if (AnimTranslateLinear(sprite))
2018-10-06 22:04:53 +01:00
return TRUE;
sprite->data[7] += sprite->data[6];
2021-07-07 14:11:52 +01:00
sprite->y2 += Sin((u8)(sprite->data[7] >> 8), sprite->data[5]);
2018-10-06 22:04:53 +01:00
return FALSE;
}
2018-10-07 11:32:20 +01:00
2019-02-06 19:17:09 +00:00
bool8 TranslateAnimVerticalArc(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
if (AnimTranslateLinear(sprite))
2018-10-07 11:32:20 +01:00
return TRUE;
sprite->data[7] += sprite->data[6];
2021-07-07 14:11:52 +01:00
sprite->x2 += Sin((u8)(sprite->data[7] >> 8), sprite->data[5]);
2018-10-07 11:32:20 +01:00
return FALSE;
}
2019-02-06 19:17:09 +00:00
void SetSpritePrimaryCoordsFromSecondaryCoords(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
2018-10-07 11:32:20 +01:00
}
2018-12-20 03:13:26 +00:00
void InitSpritePosToAnimTarget(struct Sprite *sprite, bool8 respectMonPicOffsets)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
// Battle anim sprites are automatically created at the anim target's center, which
// is why there is no else clause for the "respectMonPicOffsets" check.
if (!respectMonPicOffsets)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->x = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_Y);
2018-10-07 11:32:20 +01:00
}
2018-12-20 03:13:26 +00:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2021-07-07 14:11:52 +01:00
sprite->y += gBattleAnimArgs[1];
2018-10-07 11:32:20 +01:00
}
2018-12-24 16:48:57 +00:00
void InitSpritePosToAnimAttacker(struct Sprite *sprite, bool8 respectMonPicOffsets)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
if (!respectMonPicOffsets)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->x = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_Y);
2018-10-07 11:32:20 +01:00
}
else
{
2021-07-07 14:11:52 +01:00
sprite->x = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2018-10-07 11:32:20 +01:00
}
2018-12-20 03:13:26 +00:00
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
2021-07-07 14:11:52 +01:00
sprite->y += gBattleAnimArgs[1];
2018-10-07 11:32:20 +01:00
}
void InitSpritePosToAnimAttackerPartner(struct Sprite *sprite, bool8 respectMonPicOffsets)
{
if (!respectMonPicOffsets)
{
sprite->x = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y);
}
else
{
sprite->x = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y_PIC_OFFSET);
}
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
sprite->y += gBattleAnimArgs[1];
}
bool32 InitSpritePosToAnimBattler(u32 animBattlerId, struct Sprite *sprite, bool8 respectMonPicOffsets)
{
u32 battlerId = GetAnimBattlerId(animBattlerId);
if (GetAnimBattlerSpriteId(animBattlerId) == 0xFF || !IsBattlerSpriteVisible(battlerId))
{
DestroyAnimSprite(sprite);
return FALSE;
}
if (!respectMonPicOffsets)
{
sprite->x = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_X);
sprite->y = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_Y);
}
else if (animBattlerId != ANIM_TARGET)
{
sprite->x = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord2(battlerId, BATTLER_COORD_Y_PIC_OFFSET);
}
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
sprite->y += gBattleAnimArgs[1];
return TRUE;
}
2018-10-07 11:32:20 +01:00
u8 GetBattlerAtPosition(u8 position)
{
u8 i;
for (i = 0; i < gBattlersCount; i++)
{
if (GetBattlerPosition(i) == position)
2018-10-07 11:32:20 +01:00
break;
}
return i;
}
bool8 IsBattlerSpritePresent(u8 battlerId)
{
if (IsContest())
{
if (gBattleAnimAttacker == battlerId)
return TRUE;
else if (gBattleAnimTarget == battlerId)
return TRUE;
else
return FALSE;
}
else
{
if (GetBattlerPosition(battlerId) == 0xff)
2018-10-07 11:32:20 +01:00
return FALSE;
2019-08-08 12:06:55 +01:00
if (!gBattleStruct->spriteIgnore0Hp)
2018-10-07 11:32:20 +01:00
{
2019-08-08 12:06:55 +01:00
if (GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
{
if (GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_HP) == 0)
return FALSE;
}
else
{
if (GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_HP) == 0)
return FALSE;
}
2018-10-07 11:32:20 +01:00
}
2019-08-08 12:06:55 +01:00
return TRUE;
2018-10-07 11:32:20 +01:00
}
}
bool8 IsDoubleBattle(void)
2018-10-07 11:32:20 +01:00
{
return IS_DOUBLE_BATTLE();
}
#define BG_ANIM_PAL_1 8
#define BG_ANIM_PAL_2 9
#define BG_ANIM_PAL_CONTEST 14
2021-02-27 23:41:30 +00:00
void GetBattleAnimBg1Data(struct BattleAnimBgData *out)
2018-10-07 11:32:20 +01:00
{
if (IsContest())
{
2021-10-04 15:21:03 +01:00
out->bgTiles = gBattleAnimBgTileBuffer;
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
out->paletteId = BG_ANIM_PAL_CONTEST;
out->bgId = 1;
out->tilesOffset = 0;
out->unused = 0;
2018-10-07 11:32:20 +01:00
}
else
{
2021-10-04 15:21:03 +01:00
out->bgTiles = gBattleAnimBgTileBuffer;
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
out->paletteId = BG_ANIM_PAL_1;
out->bgId = 1;
out->tilesOffset = 0x200;
out->unused = 0;
2018-10-07 11:32:20 +01:00
}
}
2021-02-27 23:41:30 +00:00
void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId)
2018-10-07 11:32:20 +01:00
{
if (IsContest())
{
2021-10-04 15:21:03 +01:00
out->bgTiles = gBattleAnimBgTileBuffer;
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
out->paletteId = BG_ANIM_PAL_CONTEST;
2021-02-27 23:41:30 +00:00
out->bgId = 1;
out->tilesOffset = 0;
out->unused = 0;
2018-10-07 11:32:20 +01:00
}
2021-02-27 23:41:30 +00:00
else if (bgId == 1)
2018-10-07 11:32:20 +01:00
{
2021-02-27 23:41:30 +00:00
GetBattleAnimBg1Data(out);
2018-10-07 11:32:20 +01:00
}
else
{
2021-10-04 15:21:03 +01:00
out->bgTiles = gBattleAnimBgTileBuffer;
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
out->paletteId = BG_ANIM_PAL_2;
2021-02-27 23:41:30 +00:00
out->bgId = 2;
out->tilesOffset = 0x300;
out->unused = 0;
2018-10-07 11:32:20 +01:00
}
}
2021-11-08 18:18:58 +00:00
void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battlerId)
2018-10-07 11:32:20 +01:00
{
2021-10-04 15:21:03 +01:00
out->bgTiles = gBattleAnimBgTileBuffer;
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
2018-10-07 11:32:20 +01:00
if (IsContest())
{
out->paletteId = BG_ANIM_PAL_CONTEST;
2021-02-27 23:41:30 +00:00
out->bgId = 1;
out->tilesOffset = 0;
out->unused = 0;
2018-10-07 11:32:20 +01:00
}
2018-12-20 03:13:26 +00:00
else if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1)
2018-10-07 11:32:20 +01:00
{
out->paletteId = BG_ANIM_PAL_1;
2021-02-27 23:41:30 +00:00
out->bgId = 1;
out->tilesOffset = 0x200;
out->unused = 0;
2018-10-07 11:32:20 +01:00
}
else
{
out->paletteId = BG_ANIM_PAL_2;
2021-02-27 23:41:30 +00:00
out->bgId = 2;
out->tilesOffset = 0x300;
out->unused = 0;
2018-10-07 11:32:20 +01:00
}
}
2021-02-27 23:41:30 +00:00
void ClearBattleAnimBg(u32 bgId)
2018-10-07 11:32:20 +01:00
{
2021-02-27 23:41:30 +00:00
struct BattleAnimBgData bgAnimData;
2018-10-07 11:32:20 +01:00
2021-02-27 23:41:30 +00:00
GetBattleAnimBgData(&bgAnimData, bgId);
CpuFill32(0, bgAnimData.bgTiles, 0x2000);
LoadBgTiles(bgAnimData.bgId, bgAnimData.bgTiles, 0x2000, bgAnimData.tilesOffset);
FillBgTilemapBufferRect(bgAnimData.bgId, 0, 0, 0, 32, 64, 17);
CopyBgTilemapBufferToVram(bgAnimData.bgId);
2018-10-07 11:32:20 +01:00
}
2019-02-06 19:17:09 +00:00
void AnimLoadCompressedBgGfx(u32 bgId, const u32 *src, u32 tilesOffset)
2018-10-07 11:32:20 +01:00
{
2021-10-04 15:21:03 +01:00
CpuFill32(0, gBattleAnimBgTileBuffer, 0x2000);
LZDecompressWram(src, gBattleAnimBgTileBuffer);
LoadBgTiles(bgId, gBattleAnimBgTileBuffer, 0x2000, tilesOffset);
2018-10-07 11:32:20 +01:00
}
2019-02-06 19:17:09 +00:00
static void InitAnimBgTilemapBuffer(u32 bgId, const void *src)
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
FillBgTilemapBufferRect(bgId, 0, 0, 0, 32, 64, 17);
2018-10-07 11:32:20 +01:00
CopyToBgTilemapBuffer(bgId, src, 0, 0);
}
2019-02-06 19:17:09 +00:00
void AnimLoadCompressedBgTilemap(u32 bgId, const void *src)
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
InitAnimBgTilemapBuffer(bgId, src);
2018-10-07 11:32:20 +01:00
CopyBgTilemapBufferToVram(bgId);
}
2021-10-04 15:21:03 +01:00
void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData *data, const void *src, bool32 largeScreen)
2018-10-07 11:32:20 +01:00
{
2021-10-04 15:21:03 +01:00
InitAnimBgTilemapBuffer(data->bgId, src);
2018-10-07 11:32:20 +01:00
if (IsContest() == TRUE)
2021-10-04 15:21:03 +01:00
RelocateBattleBgPal(data->paletteId, data->bgTilemap, 0, largeScreen);
CopyBgTilemapBufferToVram(data->bgId);
2018-10-07 11:32:20 +01:00
}
2019-11-24 17:00:51 +00:00
u8 GetBattleBgPaletteNum(void)
2018-10-07 11:32:20 +01:00
{
if (IsContest())
return 1;
else
return 2;
}
void UpdateAnimBg3ScreenSize(bool8 largeScreenSize)
2018-10-07 11:32:20 +01:00
{
if (!largeScreenSize || IsContest())
2018-10-07 11:32:20 +01:00
{
SetAnimBgAttribute(3, BG_ANIM_SCREEN_SIZE, 0);
SetAnimBgAttribute(3, BG_ANIM_AREA_OVERFLOW_MODE, 1);
}
else
{
SetAnimBgAttribute(3, BG_ANIM_SCREEN_SIZE, 1);
SetAnimBgAttribute(3, BG_ANIM_AREA_OVERFLOW_MODE, 0);
}
}
2022-12-09 17:34:55 +00:00
void Trade_MoveSelectedMonToTarget(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
2018-11-25 23:00:18 +00:00
InitSpriteDataForLinearTranslation(sprite);
2019-02-06 19:17:09 +00:00
sprite->callback = TranslateSpriteLinearFixedPointIconFrame;
2018-10-07 11:32:20 +01:00
sprite->callback(sprite);
}
2018-11-25 23:00:18 +00:00
void InitSpriteDataForLinearTranslation(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
s16 x = (sprite->data[2] - sprite->data[1]) << 8;
s16 y = (sprite->data[4] - sprite->data[3]) << 8;
sprite->data[1] = SAFE_DIV(x, sprite->data[0]);
sprite->data[2] = SAFE_DIV(y, sprite->data[0]);
2018-10-07 11:32:20 +01:00
sprite->data[4] = 0;
sprite->data[3] = 0;
}
void InitAnimLinearTranslation(struct Sprite *sprite)
{
int x = sprite->data[2] - sprite->data[1];
int y = sprite->data[4] - sprite->data[3];
bool8 movingLeft = x < 0;
bool8 movingUp = y < 0;
u16 xDelta = abs(x) << 8;
u16 yDelta = abs(y) << 8;
xDelta = xDelta / sprite->data[0];
yDelta = yDelta / sprite->data[0];
if (movingLeft)
xDelta |= 1;
else
xDelta &= ~1;
if (movingUp)
yDelta |= 1;
else
yDelta &= ~1;
sprite->data[1] = xDelta;
sprite->data[2] = yDelta;
sprite->data[4] = 0;
sprite->data[3] = 0;
}
2018-11-25 23:00:18 +00:00
void StartAnimLinearTranslation(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
2018-10-07 11:32:20 +01:00
InitAnimLinearTranslation(sprite);
2021-11-08 18:18:58 +00:00
sprite->callback = AnimTranslateLinear_WithFollowup;
2018-10-07 11:32:20 +01:00
sprite->callback(sprite);
}
static void UNUSED StartAnimLinearTranslation_SetCornerVecX(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
2018-10-07 11:32:20 +01:00
InitAnimLinearTranslation(sprite);
2021-11-08 18:18:58 +00:00
sprite->callback = AnimTranslateLinear_WithFollowup_SetCornerVecX;
2018-10-07 11:32:20 +01:00
sprite->callback(sprite);
}
2018-12-20 03:13:26 +00:00
bool8 AnimTranslateLinear(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
u16 v1, v2, x, y;
if (!sprite->data[0])
return TRUE;
v1 = sprite->data[1];
v2 = sprite->data[2];
x = sprite->data[3];
y = sprite->data[4];
x += v1;
y += v2;
if (v1 & 1)
2021-07-07 14:11:52 +01:00
sprite->x2 = -(x >> 8);
2018-10-07 11:32:20 +01:00
else
2021-07-07 14:11:52 +01:00
sprite->x2 = x >> 8;
2018-10-07 11:32:20 +01:00
if (v2 & 1)
2021-07-07 14:11:52 +01:00
sprite->y2 = -(y >> 8);
2018-10-07 11:32:20 +01:00
else
2021-07-07 14:11:52 +01:00
sprite->y2 = y >> 8;
2018-10-07 11:32:20 +01:00
sprite->data[3] = x;
sprite->data[4] = y;
sprite->data[0]--;
return FALSE;
}
2021-11-08 18:18:58 +00:00
void AnimTranslateLinear_WithFollowup(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
if (AnimTranslateLinear(sprite))
2018-10-07 11:32:20 +01:00
SetCallbackToStoredInData6(sprite);
}
2021-11-01 16:41:21 +00:00
// Functionally unused
2021-11-08 18:18:58 +00:00
static void AnimTranslateLinear_WithFollowup_SetCornerVecX(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-11-08 18:18:58 +00:00
AnimSetCenterToCornerVecX(sprite);
2018-12-20 03:13:26 +00:00
if (AnimTranslateLinear(sprite))
2018-10-07 11:32:20 +01:00
SetCallbackToStoredInData6(sprite);
}
2021-01-23 05:40:46 +00:00
void InitAnimLinearTranslationWithSpeed(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
int v1 = abs(sprite->data[2] - sprite->data[1]) << 8;
sprite->data[0] = v1 / sprite->data[0];
InitAnimLinearTranslation(sprite);
}
2021-01-23 05:40:46 +00:00
void InitAnimLinearTranslationWithSpeedAndPos(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
2021-01-23 05:40:46 +00:00
InitAnimLinearTranslationWithSpeed(sprite);
2021-11-08 18:18:58 +00:00
sprite->callback = AnimTranslateLinear_WithFollowup;
2018-10-07 11:32:20 +01:00
sprite->callback(sprite);
}
2018-12-20 03:13:26 +00:00
static void InitAnimFastLinearTranslation(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
int xDiff = sprite->data[2] - sprite->data[1];
int yDiff = sprite->data[4] - sprite->data[3];
bool8 x_sign = xDiff < 0;
bool8 y_sign = yDiff < 0;
u16 x2 = abs(xDiff) << 4;
u16 y2 = abs(yDiff) << 4;
2018-10-07 11:32:20 +01:00
x2 /= sprite->data[0];
y2 /= sprite->data[0];
if (x_sign)
x2 |= 1;
else
x2 &= ~1;
if (y_sign)
y2 |= 1;
else
y2 &= ~1;
sprite->data[1] = x2;
sprite->data[2] = y2;
sprite->data[4] = 0;
sprite->data[3] = 0;
}
2018-12-20 03:13:26 +00:00
void InitAndRunAnimFastLinearTranslation(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
2018-12-20 03:13:26 +00:00
InitAnimFastLinearTranslation(sprite);
2021-01-23 05:40:46 +00:00
sprite->callback = AnimFastTranslateLinearWaitEnd;
2018-10-07 11:32:20 +01:00
sprite->callback(sprite);
}
2018-12-20 03:13:26 +00:00
bool8 AnimFastTranslateLinear(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
u16 v1, v2, x, y;
if (!sprite->data[0])
return TRUE;
v1 = sprite->data[1];
v2 = sprite->data[2];
x = sprite->data[3];
y = sprite->data[4];
x += v1;
y += v2;
if (v1 & 1)
2021-07-07 14:11:52 +01:00
sprite->x2 = -(x >> 4);
2018-10-07 11:32:20 +01:00
else
2021-07-07 14:11:52 +01:00
sprite->x2 = x >> 4;
2018-10-07 11:32:20 +01:00
if (v2 & 1)
2021-07-07 14:11:52 +01:00
sprite->y2 = -(y >> 4);
2018-10-07 11:32:20 +01:00
else
2021-07-07 14:11:52 +01:00
sprite->y2 = y >> 4;
2018-10-07 11:32:20 +01:00
sprite->data[3] = x;
sprite->data[4] = y;
sprite->data[0]--;
return FALSE;
}
2021-01-23 05:40:46 +00:00
static void AnimFastTranslateLinearWaitEnd(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
if (AnimFastTranslateLinear(sprite))
2018-10-07 11:32:20 +01:00
SetCallbackToStoredInData6(sprite);
}
2018-12-20 03:13:26 +00:00
void InitAnimFastLinearTranslationWithSpeed(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
int xDiff = abs(sprite->data[2] - sprite->data[1]) << 4;
sprite->data[0] = xDiff / sprite->data[0];
InitAnimFastLinearTranslation(sprite);
2018-10-07 11:32:20 +01:00
}
2021-01-23 05:40:46 +00:00
void InitAnimFastLinearTranslationWithSpeedAndPos(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
2018-12-20 03:13:26 +00:00
InitAnimFastLinearTranslationWithSpeed(sprite);
2021-01-23 05:40:46 +00:00
sprite->callback = AnimFastTranslateLinearWaitEnd;
2018-10-07 11:32:20 +01:00
sprite->callback(sprite);
}
2018-12-18 04:08:08 +00:00
void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation)
2018-10-07 11:32:20 +01:00
{
int i;
struct ObjAffineSrcData src;
struct OamMatrix matrix;
src.xScale = xScale;
src.yScale = yScale;
src.rotation = rotation;
2021-11-01 16:41:21 +00:00
if (ShouldRotScaleSpeciesBeFlipped())
2018-10-07 11:32:20 +01:00
src.xScale = -src.xScale;
i = gSprites[spriteId].oam.matrixNum;
ObjAffineSet(&src, &matrix, 1, 2);
gOamMatrices[i].a = matrix.a;
gOamMatrices[i].b = matrix.b;
gOamMatrices[i].c = matrix.c;
gOamMatrices[i].d = matrix.d;
}
2021-11-01 16:41:21 +00:00
// Pokémon in Contests (except Unown) should be flipped.
static bool8 ShouldRotScaleSpeciesBeFlipped(void)
2018-10-07 11:32:20 +01:00
{
2023-01-07 14:39:56 +00:00
if (IsContest())
{
if (gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].data[2] == SPECIES_UNOWN)
return FALSE;
else
return TRUE;
}
else
{
return FALSE;
}
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode)
2018-10-07 11:32:20 +01:00
{
u8 battlerId = gSprites[spriteId].data[0];
if (IsContest() || IsBattlerSpriteVisible(battlerId))
gSprites[spriteId].invisible = FALSE;
gSprites[spriteId].oam.objMode = objMode;
gSprites[spriteId].affineAnimPaused = TRUE;
if (!IsContest() && !gSprites[spriteId].oam.affineMode)
2018-12-18 04:08:08 +00:00
gSprites[spriteId].oam.matrixNum = gBattleSpritesDataPtr->healthBoxesData[battlerId].matrixNum;
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_DOUBLE;
2018-10-07 11:32:20 +01:00
CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode);
}
2018-12-18 04:08:08 +00:00
void ResetSpriteRotScale(u8 spriteId)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
SetSpriteRotScale(spriteId, 0x100, 0x100, 0);
gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_NORMAL;
2018-10-07 11:32:20 +01:00
gSprites[spriteId].affineAnimPaused = FALSE;
CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode);
}
2018-12-18 04:08:08 +00:00
// Sets the sprite's y offset equal to the y displacement caused by the
// matrix's rotation.
void SetBattlerSpriteYOffsetFromRotation(u8 spriteId)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
u16 matrixNum = gSprites[spriteId].oam.matrixNum;
// The "c" component of the battler sprite matrix contains the sine of the rotation angle divided by some scale amount.
s16 c = gOamMatrices[matrixNum].c;
2018-10-07 11:32:20 +01:00
if (c < 0)
c = -c;
2018-12-18 04:08:08 +00:00
2021-07-07 14:11:52 +01:00
gSprites[spriteId].y2 = c >> 3;
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
void TrySetSpriteRotScale(struct Sprite *sprite, bool8 recalcCenterVector, s16 xScale, s16 yScale, u16 rotation)
2018-10-07 11:32:20 +01:00
{
int i;
struct ObjAffineSrcData src;
struct OamMatrix matrix;
if (sprite->oam.affineMode & 1)
{
sprite->affineAnimPaused = TRUE;
2018-12-18 04:08:08 +00:00
if (recalcCenterVector)
2018-10-07 11:32:20 +01:00
CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode);
src.xScale = xScale;
src.yScale = yScale;
src.rotation = rotation;
2021-11-01 16:41:21 +00:00
if (ShouldRotScaleSpeciesBeFlipped())
2018-10-07 11:32:20 +01:00
src.xScale = -src.xScale;
i = sprite->oam.matrixNum;
ObjAffineSet(&src, &matrix, 1, 2);
gOamMatrices[i].a = matrix.a;
gOamMatrices[i].b = matrix.b;
gOamMatrices[i].c = matrix.c;
gOamMatrices[i].d = matrix.d;
}
}
void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
TrySetSpriteRotScale(sprite, TRUE, 0x100, 0x100, 0);
2018-10-07 11:32:20 +01:00
sprite->affineAnimPaused = FALSE;
CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode);
}
2022-06-01 17:41:57 +01:00
static u16 ArcTan2_(s16 x, s16 y)
2018-10-07 11:32:20 +01:00
{
2022-06-01 17:41:57 +01:00
return ArcTan2(x, y);
2018-10-07 11:32:20 +01:00
}
2022-06-01 17:41:57 +01:00
u16 ArcTan2Neg(s16 x, s16 y)
2018-10-07 11:32:20 +01:00
{
2022-06-01 17:41:57 +01:00
u16 var = ArcTan2_(x, y);
2018-10-07 11:32:20 +01:00
return -var;
}
void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor)
2018-10-07 11:32:20 +01:00
{
int i;
2018-12-18 04:08:08 +00:00
struct PlttData *originalColor;
struct PlttData *destColor;
2018-10-07 11:32:20 +01:00
u16 average;
2023-05-23 18:16:18 +01:00
u16 paletteOffset = PLTT_ID(paletteNum);
2018-10-07 11:32:20 +01:00
2018-12-18 04:08:08 +00:00
if (!restoreOriginalColor)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
for (i = 0; i < 16; i++)
2018-10-07 11:32:20 +01:00
{
2023-05-23 18:16:18 +01:00
originalColor = (struct PlttData *)&gPlttBufferUnfaded[paletteOffset + i];
2018-12-18 04:08:08 +00:00
average = originalColor->r + originalColor->g + originalColor->b;
2018-10-07 11:32:20 +01:00
average /= 3;
2023-05-23 18:16:18 +01:00
destColor = (struct PlttData *)&gPlttBufferFaded[paletteOffset + i];
2018-12-18 04:08:08 +00:00
destColor->r = average;
destColor->g = average;
destColor->b = average;
2018-10-07 11:32:20 +01:00
}
}
else
{
2023-05-23 18:16:18 +01:00
CpuCopy32(&gPlttBufferUnfaded[paletteOffset], &gPlttBufferFaded[paletteOffset], PLTT_SIZE_4BPP);
2018-10-07 11:32:20 +01:00
}
}
u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2)
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
u32 selectedPalettes = 0;
2018-10-07 11:32:20 +01:00
u32 shift;
2019-02-06 19:17:09 +00:00
if (battleBackground)
2018-10-07 11:32:20 +01:00
{
if (!IsContest())
selectedPalettes = 0xe; // Palettes 1, 2, and 3
2018-10-07 11:32:20 +01:00
else
2019-11-24 17:00:51 +00:00
selectedPalettes = 1 << GetBattleBgPaletteNum();
2018-10-07 11:32:20 +01:00
}
2019-02-06 19:17:09 +00:00
if (attacker)
2018-10-07 11:32:20 +01:00
{
shift = gBattleAnimAttacker + 16;
2019-02-06 19:17:09 +00:00
selectedPalettes |= 1 << shift;
2018-10-07 11:32:20 +01:00
}
2019-02-06 19:17:09 +00:00
if (target)
{
2018-10-07 11:32:20 +01:00
shift = gBattleAnimTarget + 16;
2019-02-06 19:17:09 +00:00
selectedPalettes |= 1 << shift;
2018-10-07 11:32:20 +01:00
}
2019-02-06 19:17:09 +00:00
if (attackerPartner)
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
shift = BATTLE_PARTNER(gBattleAnimAttacker) + 16;
selectedPalettes |= 1 << shift;
2018-10-07 11:32:20 +01:00
}
}
2019-02-06 19:17:09 +00:00
if (targetPartner)
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
shift = BATTLE_PARTNER(gBattleAnimTarget) + 16;
selectedPalettes |= 1 << shift;
2018-10-07 11:32:20 +01:00
}
}
if (anim1)
2018-10-07 11:32:20 +01:00
{
if (!IsContest())
selectedPalettes |= 1 << BG_ANIM_PAL_1;
2018-10-07 11:32:20 +01:00
else
selectedPalettes |= 1 << BG_ANIM_PAL_CONTEST;
2018-10-07 11:32:20 +01:00
}
if (anim2)
2018-10-07 11:32:20 +01:00
{
if (!IsContest())
selectedPalettes |= 1 << BG_ANIM_PAL_2;
2018-10-07 11:32:20 +01:00
}
2019-02-06 19:17:09 +00:00
return selectedPalettes;
2018-10-07 11:32:20 +01:00
}
2021-02-27 23:41:30 +00:00
u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight)
2018-10-07 11:32:20 +01:00
{
2021-02-27 23:41:30 +00:00
u32 selectedPalettes = 0;
2018-10-07 11:32:20 +01:00
u32 shift;
if (IsContest())
{
2021-02-27 23:41:30 +00:00
if (playerLeft)
2018-10-07 11:32:20 +01:00
{
2021-02-27 23:41:30 +00:00
selectedPalettes |= 1 << 18;
return selectedPalettes;
2018-10-07 11:32:20 +01:00
}
}
else
{
2021-02-27 23:41:30 +00:00
if (playerLeft)
2018-10-07 11:32:20 +01:00
{
if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_PLAYER_LEFT)))
{
2021-02-27 23:41:30 +00:00
selectedPalettes |= 1 << (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) + 16);
2018-10-07 11:32:20 +01:00
}
}
2021-02-27 23:41:30 +00:00
if (playerRight)
2018-10-07 11:32:20 +01:00
{
if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT)))
{
shift = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT) + 16;
2021-02-27 23:41:30 +00:00
selectedPalettes |= 1 << shift;
2018-10-07 11:32:20 +01:00
}
}
2021-02-27 23:41:30 +00:00
if (opponentLeft)
2018-10-07 11:32:20 +01:00
{
if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT)))
{
shift = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT) + 16;
2021-02-27 23:41:30 +00:00
selectedPalettes |= 1 << shift;
2018-10-07 11:32:20 +01:00
}
}
2021-02-27 23:41:30 +00:00
if (opponentRight)
2018-10-07 11:32:20 +01:00
{
if (IsBattlerSpriteVisible(GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT)))
{
shift = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT) + 16;
2021-02-27 23:41:30 +00:00
selectedPalettes |= 1 << shift;
2018-10-07 11:32:20 +01:00
}
}
}
2021-02-27 23:41:30 +00:00
return selectedPalettes;
2018-10-07 11:32:20 +01:00
}
2022-08-17 16:44:20 +01:00
u8 GetSpritePalIdxByBattler(u8 battler)
2018-10-07 11:32:20 +01:00
{
2021-01-23 05:40:46 +00:00
return battler;
2018-10-07 11:32:20 +01:00
}
static u8 UNUSED GetSpritePalIdxByPosition(u8 position)
2018-10-07 11:32:20 +01:00
{
return GetBattlerAtPosition(position);
}
2019-10-20 15:22:53 +01:00
void AnimSpriteOnMonPos(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
bool8 var;
if (!sprite->data[0])
{
if (!gBattleAnimArgs[3])
var = TRUE;
else
var = FALSE;
if (gBattleAnimArgs[2] == 0)
2018-12-20 03:13:26 +00:00
InitSpritePosToAnimAttacker(sprite, var);
else if (gBattleAnimArgs[2] == 1)
2018-12-20 03:13:26 +00:00
InitSpritePosToAnimTarget(sprite, var);
else if (gBattleAnimArgs[2] == 2)
InitSpritePosToAnimAttackerPartner(sprite, var);
2018-10-07 11:32:20 +01:00
sprite->data[0]++;
}
else if (sprite->animEnded || sprite->affineAnimEnded)
{
2018-12-18 04:08:08 +00:00
DestroySpriteAndMatrix(sprite);
2018-10-07 11:32:20 +01:00
}
}
// Linearly translates a sprite to a target position on the
// other mon's sprite.
// arg 0: initial x offset
// arg 1: initial y offset
// arg 2: target x offset
// arg 3: target y offset
// arg 4: duration
// arg 5: lower 8 bits = location on attacking mon, upper 8 bits = location on target mon pick to target
void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite)
{
2022-08-17 16:44:20 +01:00
bool8 respectMonPicOffsets;
2018-12-18 04:08:08 +00:00
u8 coordType;
2018-10-07 11:32:20 +01:00
if (!(gBattleAnimArgs[5] & 0xff00))
2022-08-17 16:44:20 +01:00
respectMonPicOffsets = TRUE;
2018-10-07 11:32:20 +01:00
else
2022-08-17 16:44:20 +01:00
respectMonPicOffsets = FALSE;
2018-10-07 11:32:20 +01:00
if (!(gBattleAnimArgs[5] & 0xff))
2018-12-18 04:08:08 +00:00
coordType = BATTLER_COORD_Y_PIC_OFFSET;
2018-10-07 11:32:20 +01:00
else
2018-12-18 04:08:08 +00:00
coordType = BATTLER_COORD_Y;
2018-10-07 11:32:20 +01:00
2022-08-17 16:44:20 +01:00
InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets);
2018-10-07 11:32:20 +01:00
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
2018-12-18 04:08:08 +00:00
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, coordType) + gBattleAnimArgs[3];
2018-11-25 23:00:18 +00:00
sprite->callback = StartAnimLinearTranslation;
2018-10-07 11:32:20 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2019-10-20 09:47:56 +01:00
void AnimThrowProjectile(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2022-07-25 19:59:14 +01:00
InitSpritePosToAnimAttacker(sprite, TRUE);
2018-10-07 11:32:20 +01:00
if (GetBattlerSide(gBattleAnimAttacker))
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
sprite->data[0] = gBattleAnimArgs[4];
2019-02-06 19:17:09 +00:00
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3];
2018-10-07 11:32:20 +01:00
sprite->data[5] = gBattleAnimArgs[5];
2018-11-25 23:00:18 +00:00
InitAnimArcTranslation(sprite);
2019-10-20 09:47:56 +01:00
sprite->callback = AnimThrowProjectile_Step;
2018-10-07 11:32:20 +01:00
}
2019-10-20 09:47:56 +01:00
static void AnimThrowProjectile_Step(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2019-02-06 19:17:09 +00:00
if (TranslateAnimHorizontalArc(sprite))
2018-10-07 11:32:20 +01:00
DestroyAnimSprite(sprite);
}
2020-02-14 23:11:04 +00:00
void AnimTravelDiagonally(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
bool8 r4;
2019-02-06 19:17:09 +00:00
u8 battlerId, coordType;
2018-10-07 11:32:20 +01:00
if (!gBattleAnimArgs[6])
{
r4 = TRUE;
2019-02-06 19:17:09 +00:00
coordType = BATTLER_COORD_Y_PIC_OFFSET;
2018-10-07 11:32:20 +01:00
}
else
{
r4 = FALSE;
2019-02-06 19:17:09 +00:00
coordType = BATTLER_COORD_Y;
2018-10-07 11:32:20 +01:00
}
2020-02-14 23:11:04 +00:00
if (gBattleAnimArgs[5] == ANIM_ATTACKER)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
InitSpritePosToAnimAttacker(sprite, r4);
2018-10-07 11:32:20 +01:00
battlerId = gBattleAnimAttacker;
}
else
{
2018-12-20 03:13:26 +00:00
InitSpritePosToAnimTarget(sprite, r4);
2018-10-07 11:32:20 +01:00
battlerId = gBattleAnimTarget;
}
if (GetBattlerSide(gBattleAnimAttacker))
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
2018-12-20 03:13:26 +00:00
InitSpritePosToAnimTarget(sprite, r4);
2018-10-07 11:32:20 +01:00
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + gBattleAnimArgs[2];
2019-02-06 19:17:09 +00:00
sprite->data[4] = GetBattlerSpriteCoord(battlerId, coordType) + gBattleAnimArgs[3];
2018-11-25 23:00:18 +00:00
sprite->callback = StartAnimLinearTranslation;
2018-10-07 11:32:20 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2018-12-18 04:08:08 +00:00
s16 CloneBattlerSpriteWithBlend(u8 animBattler)
2018-10-07 11:32:20 +01:00
{
u16 i;
2018-12-18 04:08:08 +00:00
u8 spriteId = GetAnimBattlerSpriteId(animBattler);
2018-10-07 11:32:20 +01:00
2021-02-20 05:30:37 +00:00
if (spriteId != SPRITE_NONE)
2018-10-07 11:32:20 +01:00
{
for (i = 0; i < MAX_SPRITES; i++)
{
if (!gSprites[i].inUse)
{
gSprites[i] = gSprites[spriteId];
2018-12-18 04:08:08 +00:00
gSprites[i].oam.objMode = ST_OAM_OBJ_BLEND;
2018-10-07 11:32:20 +01:00
gSprites[i].invisible = FALSE;
return i;
}
}
}
return -1;
2018-10-07 11:32:20 +01:00
}
2021-11-01 16:41:21 +00:00
void DestroySpriteWithActiveSheet(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
sprite->usingSheet = TRUE;
DestroySprite(sprite);
}
2020-02-20 05:04:42 +00:00
// Only used to fade Moonlight moon sprite in
void AnimTask_AlphaFadeIn(u8 taskId)
2018-10-07 11:32:20 +01:00
{
s16 v1 = 0;
s16 v2 = 0;
if (gBattleAnimArgs[2] > gBattleAnimArgs[0])
v2 = 1;
if (gBattleAnimArgs[2] < gBattleAnimArgs[0])
v2 = -1;
if (gBattleAnimArgs[3] > gBattleAnimArgs[1])
v1 = 1;
if (gBattleAnimArgs[3] < gBattleAnimArgs[1])
v1 = -1;
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = gBattleAnimArgs[4];
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = gBattleAnimArgs[0];
gTasks[taskId].data[4] = gBattleAnimArgs[1];
gTasks[taskId].data[5] = v2;
gTasks[taskId].data[6] = v1;
gTasks[taskId].data[7] = gBattleAnimArgs[2];
gTasks[taskId].data[8] = gBattleAnimArgs[3];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gBattleAnimArgs[0], gBattleAnimArgs[1]));
2021-01-23 05:40:46 +00:00
gTasks[taskId].func = AnimTask_AlphaFadeIn_Step;
2018-10-07 11:32:20 +01:00
}
2021-01-23 05:40:46 +00:00
static void AnimTask_AlphaFadeIn_Step(u8 taskId)
2018-10-07 11:32:20 +01:00
{
struct Task *task = &gTasks[taskId];
if (++task->data[0] > task->data[1])
{
task->data[0] = 0;
if (++task->data[2] & 1)
{
if (task->data[3] != task->data[7])
task->data[3] += task->data[5];
}
else
{
if (task->data[4] != task->data[8])
task->data[4] += task->data[6];
}
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4]));
if (task->data[3] == task->data[7] && task->data[4] == task->data[8])
{
DestroyAnimVisualTask(taskId);
return;
}
}
}
// Linearly blends a mon's sprite colors with a target color with increasing
// strength, and then blends out to the original color.
// arg 0: anim bank
// arg 1: blend color
// arg 2: target blend coefficient
// arg 3: initial delay
// arg 4: number of times to blend in and out
void AnimTask_BlendMonInAndOut(u8 task)
{
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
2021-02-20 05:30:37 +00:00
if (spriteId == SPRITE_NONE)
2018-10-07 11:32:20 +01:00
{
DestroyAnimVisualTask(task);
return;
}
2022-08-19 15:29:35 +01:00
gTasks[task].data[0] = OBJ_PLTT_ID(gSprites[spriteId].oam.paletteNum) + 1;
2020-02-20 05:04:42 +00:00
AnimTask_BlendPalInAndOutSetup(&gTasks[task]);
2018-10-07 11:32:20 +01:00
}
2020-02-20 05:04:42 +00:00
static void AnimTask_BlendPalInAndOutSetup(struct Task *task)
2018-10-07 11:32:20 +01:00
{
task->data[1] = gBattleAnimArgs[1];
task->data[2] = 0;
task->data[3] = gBattleAnimArgs[2];
task->data[4] = 0;
task->data[5] = gBattleAnimArgs[3];
task->data[6] = 0;
task->data[7] = gBattleAnimArgs[4];
2021-01-23 05:40:46 +00:00
task->func = AnimTask_BlendMonInAndOut_Step;
2018-10-07 11:32:20 +01:00
}
2021-01-23 05:40:46 +00:00
static void AnimTask_BlendMonInAndOut_Step(u8 taskId)
2018-10-07 11:32:20 +01:00
{
struct Task *task = &gTasks[taskId];
if (++task->data[4] >= task->data[5])
{
task->data[4] = 0;
if (!task->data[6])
{
task->data[2]++;
BlendPalette(task->data[0], 15, task->data[2], task->data[1]);
if (task->data[2] == task->data[3])
task->data[6] = 1;
}
else
{
task->data[2]--;
BlendPalette(task->data[0], 15, task->data[2], task->data[1]);
if (!task->data[2])
{
if (--task->data[7])
{
task->data[4] = 0;
task->data[6] = 0;
}
else
{
DestroyAnimVisualTask(taskId);
return;
}
}
}
}
}
2020-02-20 05:04:42 +00:00
// See AnimTask_BlendMonInAndOut. Same, but ANIM_TAG_* instead of mon
void AnimTask_BlendPalInAndOutByTag(u8 task)
2018-10-07 11:32:20 +01:00
{
u8 palette = IndexOfSpritePaletteTag(gBattleAnimArgs[0]);
if (palette == 0xff)
{
DestroyAnimVisualTask(task);
return;
}
gTasks[task].data[0] = (palette * 0x10) + 0x101;
2020-02-20 05:04:42 +00:00
AnimTask_BlendPalInAndOutSetup(&gTasks[task]);
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union AffineAnimCmd *affineAnimCmds)
2018-10-07 11:32:20 +01:00
{
task->data[7] = 0;
task->data[8] = 0;
task->data[9] = 0;
2018-12-18 04:08:08 +00:00
task->data[15] = spriteId;
2018-10-07 11:32:20 +01:00
task->data[10] = 0x100;
task->data[11] = 0x100;
task->data[12] = 0;
2018-12-18 04:08:08 +00:00
StorePointerInVars(&task->data[13], &task->data[14], affineAnimCmds);
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
bool8 RunAffineAnimFromTaskData(struct Task *task)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:02:08 +00:00
sAnimTaskAffineAnim = &((union AffineAnimCmd *)LoadPointerFromVars(task->data[13], task->data[14]))[task->data[7]];
switch (sAnimTaskAffineAnim->type)
2018-10-07 11:32:20 +01:00
{
default:
2021-11-01 16:02:08 +00:00
if (!sAnimTaskAffineAnim->frame.duration)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:02:08 +00:00
task->data[10] = sAnimTaskAffineAnim->frame.xScale;
task->data[11] = sAnimTaskAffineAnim->frame.yScale;
task->data[12] = sAnimTaskAffineAnim->frame.rotation;
2018-10-07 11:32:20 +01:00
task->data[7]++;
2021-11-01 16:02:08 +00:00
sAnimTaskAffineAnim++;
2018-10-07 11:32:20 +01:00
}
2021-11-01 16:02:08 +00:00
task->data[10] += sAnimTaskAffineAnim->frame.xScale;
task->data[11] += sAnimTaskAffineAnim->frame.yScale;
task->data[12] += sAnimTaskAffineAnim->frame.rotation;
2018-12-18 04:08:08 +00:00
SetSpriteRotScale(task->data[15], task->data[10], task->data[11], task->data[12]);
SetBattlerSpriteYOffsetFromYScale(task->data[15]);
2021-11-01 16:02:08 +00:00
if (++task->data[8] >= sAnimTaskAffineAnim->frame.duration)
2018-10-07 11:32:20 +01:00
{
task->data[8] = 0;
task->data[7]++;
}
break;
case AFFINEANIMCMDTYPE_JUMP:
2021-11-01 16:02:08 +00:00
task->data[7] = sAnimTaskAffineAnim->jump.target;
2018-10-07 11:32:20 +01:00
break;
case AFFINEANIMCMDTYPE_LOOP:
2021-11-01 16:02:08 +00:00
if (sAnimTaskAffineAnim->loop.count)
2018-10-07 11:32:20 +01:00
{
if (task->data[9])
{
if (!--task->data[9])
{
task->data[7]++;
break;
}
}
else
{
2021-11-01 16:02:08 +00:00
task->data[9] = sAnimTaskAffineAnim->loop.count;
2018-10-07 11:32:20 +01:00
}
if (!task->data[7])
{
break;
}
for (;;)
{
task->data[7]--;
2021-11-01 16:02:08 +00:00
sAnimTaskAffineAnim--;
if (sAnimTaskAffineAnim->type == AFFINEANIMCMDTYPE_LOOP)
2018-10-07 11:32:20 +01:00
{
task->data[7]++;
return TRUE;
}
if (!task->data[7])
return TRUE;
}
}
task->data[7]++;
break;
case AFFINEANIMCMDTYPE_END:
2021-07-07 14:11:52 +01:00
gSprites[task->data[15]].y2 = 0;
2018-12-18 04:08:08 +00:00
ResetSpriteRotScale(task->data[15]);
2018-10-07 11:32:20 +01:00
return FALSE;
}
return TRUE;
}
2018-12-18 04:08:08 +00:00
// Sets the sprite's y offset equal to the y displacement caused by the
// matrix's scale in the y dimension.
void SetBattlerSpriteYOffsetFromYScale(u8 spriteId)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:02:08 +00:00
int var = MON_PIC_HEIGHT - GetBattlerYDeltaFromSpriteId(spriteId) * 2;
2018-10-07 11:32:20 +01:00
u16 matrix = gSprites[spriteId].oam.matrixNum;
2021-03-19 22:17:43 +00:00
int var2 = SAFE_DIV(var << 8, gOamMatrices[matrix].d);
2018-10-07 11:32:20 +01:00
2021-11-01 16:02:08 +00:00
if (var2 > MON_PIC_HEIGHT * 2)
var2 = MON_PIC_HEIGHT * 2;
2021-07-07 14:11:52 +01:00
gSprites[spriteId].y2 = (var - var2) / 2;
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
// Sets the sprite's y offset equal to the y displacement caused by another sprite
// matrix's scale in the y dimension.
void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:02:08 +00:00
int var = MON_PIC_HEIGHT - GetBattlerYDeltaFromSpriteId(otherSpriteId) * 2;
2018-10-07 11:32:20 +01:00
u16 matrix = gSprites[spriteId].oam.matrixNum;
2021-03-19 22:17:43 +00:00
int var2 = SAFE_DIV(var << 8, gOamMatrices[matrix].d);
2018-10-07 11:32:20 +01:00
2021-11-01 16:02:08 +00:00
if (var2 > MON_PIC_HEIGHT * 2)
var2 = MON_PIC_HEIGHT * 2;
2021-07-07 14:11:52 +01:00
gSprites[spriteId].y2 = (var - var2) / 2;
2018-10-07 11:32:20 +01:00
}
2019-02-06 19:17:09 +00:00
static u16 GetBattlerYDeltaFromSpriteId(u8 spriteId)
2018-10-07 11:32:20 +01:00
{
struct BattleSpriteInfo *spriteInfo;
u8 battlerId = gSprites[spriteId].data[0];
u16 species;
u16 i;
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
{
if (gBattlerSpriteIds[i] == spriteId)
{
if (IsContest())
{
2020-08-14 00:10:23 +01:00
species = gContestResources->moveAnim->species;
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return gSpeciesInfo[species].backPicYOffset;
2018-10-07 11:32:20 +01:00
}
else
{
if (GetBattlerSide(i) == B_SIDE_PLAYER)
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES);
else
species = spriteInfo[battlerId].transformSpecies;
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return gSpeciesInfo[species].backPicYOffset;
2018-10-07 11:32:20 +01:00
}
else
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[i]], MON_DATA_SPECIES);
else
species = spriteInfo[battlerId].transformSpecies;
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return gSpeciesInfo[species].frontPicYOffset;
2018-10-07 11:32:20 +01:00
}
}
}
}
2021-11-01 16:02:08 +00:00
return MON_PIC_HEIGHT;
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
void StorePointerInVars(s16 *lo, s16 *hi, const void *ptr)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
*lo = ((intptr_t) ptr) & 0xffff;
*hi = (((intptr_t) ptr) >> 16) & 0xffff;
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
void *LoadPointerFromVars(s16 lo, s16 hi)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
return (void *)((u16)lo | ((u16)hi << 16));
2018-10-07 11:32:20 +01:00
}
void PrepareEruptAnimTaskData(struct Task *task, u8 spriteId, s16 xScaleStart, s16 yScaleStart, s16 xScaleEnd, s16 yScaleEnd, u16 duration)
2018-10-07 11:32:20 +01:00
{
task->data[8] = duration;
task->data[15] = spriteId;
task->data[9] = xScaleStart;
task->data[10] = yScaleStart;
task->data[13] = xScaleEnd;
task->data[14] = yScaleEnd;
task->data[11] = (xScaleEnd - xScaleStart) / duration;
task->data[12] = (yScaleEnd - yScaleStart) / duration;
2018-10-07 11:32:20 +01:00
}
u8 UpdateEruptAnimTask(struct Task *task)
2018-10-07 11:32:20 +01:00
{
if (!task->data[8])
return 0;
if (--task->data[8] != 0)
{
task->data[9] += task->data[11];
task->data[10] += task->data[12];
}
else
{
task->data[9] = task->data[13];
task->data[10] = task->data[14];
}
2018-12-18 04:08:08 +00:00
SetSpriteRotScale(task->data[15], task->data[9], task->data[10], 0);
2018-10-07 11:32:20 +01:00
if (task->data[8])
2018-12-18 04:08:08 +00:00
SetBattlerSpriteYOffsetFromYScale(task->data[15]);
2018-10-07 11:32:20 +01:00
else
2021-07-07 14:11:52 +01:00
gSprites[task->data[15]].y2 = 0;
2018-10-07 11:32:20 +01:00
return task->data[8];
}
void AnimTask_GetFrustrationPowerLevel(u8 taskId)
{
u16 powerLevel;
if (gAnimFriendship <= 30)
powerLevel = 0;
else if (gAnimFriendship <= 100)
powerLevel = 1;
else if (gAnimFriendship <= 200)
powerLevel = 2;
else
powerLevel = 3;
2020-02-19 18:13:28 +00:00
gBattleAnimArgs[ARG_RET_ID] = powerLevel;
2018-10-07 11:32:20 +01:00
DestroyAnimVisualTask(taskId);
}
static void UNUSED SetPriorityForVisibleBattlers(u8 priority)
2018-10-07 11:32:20 +01:00
{
if (IsBattlerSpriteVisible(gBattleAnimTarget))
gSprites[gBattlerSpriteIds[gBattleAnimTarget]].oam.priority = priority;
if (IsBattlerSpriteVisible(gBattleAnimAttacker))
gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].oam.priority = priority;
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimTarget)))
gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimTarget)]].oam.priority = priority;
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)))
gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority = priority;
}
2021-10-04 15:21:03 +01:00
void InitPrioritiesForVisibleBattlers(void)
2018-10-07 11:32:20 +01:00
{
int i;
for (i = 0; i < gBattlersCount; i++)
{
if (IsBattlerSpriteVisible(i))
{
2018-12-18 04:08:08 +00:00
gSprites[gBattlerSpriteIds[i]].subpriority = GetBattlerSpriteSubpriority(i);
2018-10-07 11:32:20 +01:00
gSprites[gBattlerSpriteIds[i]].oam.priority = 2;
}
}
}
2018-12-18 04:08:08 +00:00
u8 GetBattlerSpriteSubpriority(u8 battlerId)
2018-10-07 11:32:20 +01:00
{
u8 position;
2018-12-18 04:08:08 +00:00
u8 subpriority;
2018-10-07 11:32:20 +01:00
if (IsContest())
{
if (battlerId == 2)
return 30;
else
return 40;
}
else
{
position = GetBattlerPosition(battlerId);
if (position == B_POSITION_PLAYER_LEFT)
2018-12-18 04:08:08 +00:00
subpriority = 30;
2018-10-07 11:32:20 +01:00
else if (position == B_POSITION_PLAYER_RIGHT)
2018-12-18 04:08:08 +00:00
subpriority = 20;
2018-10-07 11:32:20 +01:00
else if (position == B_POSITION_OPPONENT_LEFT)
2018-12-18 04:08:08 +00:00
subpriority = 40;
2018-10-07 11:32:20 +01:00
else
2018-12-18 04:08:08 +00:00
subpriority = 50;
2018-10-07 11:32:20 +01:00
}
2018-12-18 04:08:08 +00:00
return subpriority;
2018-10-07 11:32:20 +01:00
}
2018-12-20 03:13:26 +00:00
u8 GetBattlerSpriteBGPriority(u8 battlerId)
2018-10-07 11:32:20 +01:00
{
u8 position = GetBattlerPosition(battlerId);
if (IsContest())
return 2;
else if (position == B_POSITION_PLAYER_LEFT || position == B_POSITION_OPPONENT_RIGHT)
return GetAnimBgAttribute(2, BG_ANIM_PRIORITY);
else
return GetAnimBgAttribute(1, BG_ANIM_PRIORITY);
}
2018-12-20 03:13:26 +00:00
u8 GetBattlerSpriteBGPriorityRank(u8 battlerId)
2018-10-07 11:32:20 +01:00
{
if (!IsContest())
{
u8 position = GetBattlerPosition(battlerId);
if (position == B_POSITION_PLAYER_LEFT || position == B_POSITION_OPPONENT_RIGHT)
return 2;
else
return 1;
}
return 1;
}
// Create Pokémon sprite to be used for a move animation effect (e.g. Role Play / Snatch)
u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, bool8 isShiny, u32 battlerId)
2018-10-07 11:32:20 +01:00
{
u8 spriteId;
2022-08-17 16:44:20 +01:00
u16 sheet = LoadSpriteSheet(&sSpriteSheets_MoveEffectMons[id]);
u16 palette = AllocSpritePalette(sSpriteTemplates_MoveEffectMons[id].paletteTag);
2018-10-07 11:32:20 +01:00
2020-02-20 05:04:42 +00:00
if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL)
gMonSpritesGfxPtr->buffer = AllocZeroed(MON_PIC_SIZE * MAX_MON_PIC_FRAMES);
2018-10-07 11:32:20 +01:00
if (!isBackpic)
{
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, isShiny, personality), OBJ_PLTT_ID(palette), PLTT_SIZE_4BPP);
LoadSpecialPokePic(gMonSpritesGfxPtr->buffer,
2020-12-22 06:39:19 +00:00
species,
personality,
TRUE);
2018-10-07 11:32:20 +01:00
}
else
{
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, isShiny, personality), OBJ_PLTT_ID(palette), PLTT_SIZE_4BPP);
LoadSpecialPokePic(gMonSpritesGfxPtr->buffer,
2020-12-22 06:39:19 +00:00
species,
personality,
FALSE);
2018-10-07 11:32:20 +01:00
}
2021-03-29 14:38:19 +01:00
RequestDma3Copy(gMonSpritesGfxPtr->buffer, (void *)(OBJ_VRAM0 + (sheet * 0x20)), MON_PIC_SIZE, 1);
2020-02-20 05:04:42 +00:00
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
2018-10-07 11:32:20 +01:00
if (!isBackpic)
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gSpeciesInfo[species].frontPicYOffset, subpriority);
2018-10-07 11:32:20 +01:00
else
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gSpeciesInfo[species].backPicYOffset, subpriority);
2018-10-07 11:32:20 +01:00
if (IsContest())
{
gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteContest;
StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_NORMAL);
2018-10-07 11:32:20 +01:00
}
return spriteId;
}
2018-12-30 16:58:42 +00:00
void DestroySpriteAndFreeResources_(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
DestroySpriteAndFreeResources(sprite);
}
2018-12-30 16:58:42 +00:00
s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr)
2018-10-07 11:32:20 +01:00
{
u16 species;
u32 personality;
int ret;
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
u8 size;
u8 y_offset;
2018-10-07 11:32:20 +01:00
struct BattleSpriteInfo *spriteInfo;
if (IsContest())
{
2020-08-14 00:10:23 +01:00
if (gContestResources->moveAnim->hasTargetAnim)
2018-10-07 11:32:20 +01:00
{
2020-08-14 00:10:23 +01:00
species = gContestResources->moveAnim->targetSpecies;
personality = gContestResources->moveAnim->targetPersonality;
2018-10-07 11:32:20 +01:00
}
else
{
2020-08-14 00:10:23 +01:00
species = gContestResources->moveAnim->species;
personality = gContestResources->moveAnim->personality;
2018-10-07 11:32:20 +01:00
}
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
species = SanitizeSpeciesId(species);
2023-01-07 14:39:56 +00:00
if (species == SPECIES_UNOWN)
species = GetUnownSpeciesId(personality);
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
size = gSpeciesInfo[species].backPicSize;
y_offset = gSpeciesInfo[species].backPicYOffset;
2018-10-07 11:32:20 +01:00
}
else
{
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
{
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY);
}
else
{
species = spriteInfo[battlerId].transformSpecies;
personality = gTransformedPersonalities[battlerId];
}
2018-12-30 16:58:42 +00:00
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
species = SanitizeSpeciesId(species);
2023-01-07 14:39:56 +00:00
if (species == SPECIES_UNOWN)
species = GetUnownSpeciesId(personality);
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
if (gSpeciesInfo[species].backPicFemale != NULL && IsPersonalityFemale(species, personality))
size = gSpeciesInfo[species].backPicSizeFemale;
2018-10-07 11:32:20 +01:00
else
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
size = gSpeciesInfo[species].backPicSize;
y_offset = gSpeciesInfo[species].backPicYOffset;
2018-10-07 11:32:20 +01:00
}
else
{
spriteInfo = gBattleSpritesDataPtr->battlerData;
if (!spriteInfo[battlerId].transformSpecies)
{
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY);
}
else
{
species = spriteInfo[battlerId].transformSpecies;
personality = gTransformedPersonalities[battlerId];
}
2018-12-30 16:58:42 +00:00
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
species = SanitizeSpeciesId(species);
2023-01-07 14:39:56 +00:00
if (species == SPECIES_UNOWN)
species = GetUnownSpeciesId(personality);
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
if (gSpeciesInfo[species].frontPicFemale != NULL && IsPersonalityFemale(species, personality))
size = gSpeciesInfo[species].frontPicSizeFemale;
2018-10-07 11:32:20 +01:00
else
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
size = gSpeciesInfo[species].frontPicSize;
y_offset = gSpeciesInfo[species].frontPicYOffset;
2018-10-07 11:32:20 +01:00
}
}
2018-12-30 16:58:42 +00:00
switch (attr)
2018-10-07 11:32:20 +01:00
{
2018-12-30 16:58:42 +00:00
case BATTLER_COORD_ATTR_HEIGHT:
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return GET_MON_COORDS_HEIGHT(size);
2018-12-30 16:58:42 +00:00
case BATTLER_COORD_ATTR_WIDTH:
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return GET_MON_COORDS_WIDTH(size);
2018-12-30 16:58:42 +00:00
case BATTLER_COORD_ATTR_LEFT:
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) - (GET_MON_COORDS_WIDTH(size) / 2);
2018-12-30 16:58:42 +00:00
case BATTLER_COORD_ATTR_RIGHT:
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X_2) + (GET_MON_COORDS_WIDTH(size) / 2);
2018-12-30 16:58:42 +00:00
case BATTLER_COORD_ATTR_TOP:
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) - (GET_MON_COORDS_HEIGHT(size) / 2);
2018-12-30 16:58:42 +00:00
case BATTLER_COORD_ATTR_BOTTOM:
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y_PIC_OFFSET) + (GET_MON_COORDS_HEIGHT(size) / 2);
2018-12-30 16:58:42 +00:00
case BATTLER_COORD_ATTR_RAW_BOTTOM:
ret = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 31;
Species Simplifier™ - Part 3 (#3562) * Added SpeciesInfo fields # Conflicts: # include/pokemon.h * Added missing comments * Renamed gigantamax to isGigantamax * Converted species flags to agbcc bit flags * Added padding after flags * Pikachu form config * Dex text * Reordered Paradox flag * Missing Pikachu ifdef comments * Moved P_GEN_x_POKEMON settings to the species_families file * Gen 1 Dex entries * Renamed file to species_enabled.h * Prevent Pokémon from evolving if their evolution is disabled * Prevent Pokémon from being affected by Eviolite if their evolution is disabled * Prevent Pokémon offspring if they're disabled * Corrected imprementation of evolution prevention It could potentially overwrite items by accident * Cross-evo configs * Gen 2 dex entries * Changed cry table to use assignable IDs # Conflicts: # include/pokemon.h * Form table pointers * Beginning support for moving data to gSpeciesInfo * Pokédexes reads text from gSpeciesInfo * Reading species names from gSpeciesInfo * Fixed erroneous copy-paste * Moved Bulbasaur to Raichu Family data do gSpeciesinfo * Added female pic sizes * Macros for Front, Back, Palette and Learnsets * Sandshrew to Dugtrio Families * Obtains Height/Weight from gSpeciesInfo * Read category from gSpeciesInfo * Removed unused data from pokedex_entries.h * Moved Gen 1 data to gSpeciesInfo * Moved Gen 2 data to gSpeciesInfo + fixed Ursaluna Bloodmoon not producing Teddiursa eggs * Moved Gen 3 data to gSpeciesInfo * Moved Gen 4 data to gSpeciesInfo * HGSS dex properly shows form sprites * Fixed data type for GetSpeciesHeight/Weight * Reading Pokédex Size data from gSpeciesInfo * Cleaned up mon graphic decompression function * Reading Front Pics gSpeciesInfo * Reading Back Pics gSpeciesInfo * Updated uses of GetMonSpritePalStruct to allow loading the data directly instead of reading the struct * Reading palettes from gSpeciesInfo * Reading animation delay from gSpeciesInfo * Fixed Pokémon Debug Menu not reading animation delay * Reading front anim Id from gSpeciesInfo * Reading back anim Id from gSpeciesInfo * Reading Animation Frames from gSpeciesInfo * Reading Icon Sprites from gSpeciesInfo * Reading Icon Palette IDs from gSpeciesInfo * Reading Footprints from gSpeciesInfo * Reading Mon Pic sizes from gSpeciesInfo * Separate mon pic sizes for female mon * Reading Level Up Learnsets from gSpeciesInfo * Reading Teachable Learnsets from gSpeciesInfo * Reading National Dex Number from gSpeciesInfo * Reading Enemy Mon Elevation from gSpeciesInfo * Reading Evolutions from gSpeciesInfo * Reading form table from gSpeciesInfo * Fixed button label inconsistency in pokémon debug menu * Reading form change table from gSpeciesInfo * Removed need to define mon graphics in include/graphics.h * Reordered mon graphics by family * Fixed National dex number offset * gFrontierBannedSpecies now checks IsSpeciesEnabled * Added 3 more toggles for Fusions, Primal Reversions and Ultra Burst * Gen 3 & 4 family toggles for dex entries * Fixed missing Mr. Rime data * Gen 1 dex descriptions as compound strings * Gen 2 dex descriptions as compound strings * Gen 3 dex descriptions as compound strings * Gen 4 dex descriptions as compound strings * Fixed compile in agbcc * Moved Gen 5 data to gSpeciesInfo * Using PLACEHOLDER_ANIM_SINGLE_FRAME when needed (same hash) * Renamed PLACEHOLDER_TWO_FRAME_ANIMATION to PLACEHOLDER_ANIM_TWO_FRAMES * Fixed capitalization for front pic anims * Fixed `CanEvolve` * Moved Gen 6 data to gSpeciesInfo * Gen 7 without macros * Gen 8 without macros * Gen 9 without macros * Fixed Gen 9 sound data * Finished moving Gen 7 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Ultra Necrozma is now included in the fusion forms define * Cries are now properly excluded from the rom when disabling species * Removed P_GEN_x_POKEMON from form_change_tables.h * Fixed Yanmega's cry ignoring the P_GEN_4_CROSS_EVOS setting * Added P_NEW_EVOS_IN_REGIONAL_DEX setting * Automatic ASSUMPTION_FAIL when used species are disabled * Finished moving Gen 8 data in macros (by Alex) Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> * Expanded Alcremie macro * Finished moving Gen 9 data in macros (by Alex) * Fixed missing data for Komala and Marshadow * Form species id tables use family toggles + added missing Ursaluna form species id table * Fixed Genesect palettes * Fixed Flabébé family graphics * Fixed Minior Graphics * Fixed missing Calyrex data * Family toggles in mon graphcis (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed missing Ogerpon data * Ordered Level Up Learnsets (missing toggles) Also added White Basculin learnset * Added more Minior synonyms * Fixed enamorus order * Reordered teachable learnsets * Removed sSpeciesXXX level up learnsets + reordered * Removed unneeded assumes * Removed unused extra animations * Family toggles in mon level up learnsets (By Jasper/Bassoonian) Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed Phione graphics inclusion * Family toggles for Teachable Learnsets Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Ordered Front Pic Anims * Family toggles for front pic animations Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS dex incorrectly showing the wrong mon when catching it * Family toggles for Egg Moves + reodered Co-authored-by: Bassoonian <iasperbassoonian@gmail.com> * Fixed HGSS not checking for null footprints * Review changes * Fixed Female difference mon not using their macros * Fixed Alcremie Macro * Fixed compile error when disabling the Bulbasaur family * Fixed Turtwig and Chimchar family + Houndour and Mareep cries not being excluded properly * Re-added missing Egg graphical data * Fixed crash during the Birch Intro when Lotad is disabled * Renamed PALLETE to PALETTES * Removed extra spacing for YOffsets * Fixed compile when only disabling cross-gen evolutions * Added Tera Forms define (Ogerpon and Terapagos) * Fixed Necrozma macro * Removed .noFlip = FALSE * Fixed dex number in summary screen for forms when nat dex is disabled * Fixed Paldean form paths --------- Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com> Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
2023-12-08 14:05:10 +00:00
return ret - y_offset;
2018-10-07 11:32:20 +01:00
default:
return 0;
}
}
2018-12-20 03:13:26 +00:00
void SetAverageBattlerPositions(u8 battlerId, bool8 respectMonPicOffsets, s16 *x, s16 *y)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
u8 xCoordType, yCoordType;
s16 battlerX, battlerY;
s16 partnerX, partnerY;
2018-10-07 11:32:20 +01:00
2018-12-20 03:13:26 +00:00
if (!respectMonPicOffsets)
2018-10-07 11:32:20 +01:00
{
2018-12-20 03:13:26 +00:00
xCoordType = BATTLER_COORD_X;
yCoordType = BATTLER_COORD_Y;
2018-10-07 11:32:20 +01:00
}
else
{
2018-12-20 03:13:26 +00:00
xCoordType = BATTLER_COORD_X_2;
yCoordType = BATTLER_COORD_Y_PIC_OFFSET;
2018-10-07 11:32:20 +01:00
}
2018-12-20 03:13:26 +00:00
battlerX = GetBattlerSpriteCoord(battlerId, xCoordType);
battlerY = GetBattlerSpriteCoord(battlerId, yCoordType);
2018-10-07 11:32:20 +01:00
if (IsDoubleBattle() && !IsContest())
{
2018-12-20 03:13:26 +00:00
partnerX = GetBattlerSpriteCoord(BATTLE_PARTNER(battlerId), xCoordType);
partnerY = GetBattlerSpriteCoord(BATTLE_PARTNER(battlerId), yCoordType);
2018-10-07 11:32:20 +01:00
}
else
{
2018-12-20 03:13:26 +00:00
partnerX = battlerX;
partnerY = battlerY;
2018-10-07 11:32:20 +01:00
}
2018-12-20 03:13:26 +00:00
*x = (battlerX + partnerX) / 2;
*y = (battlerY + partnerY) / 2;
2018-10-07 11:32:20 +01:00
}
2021-02-27 23:41:30 +00:00
u8 CreateInvisibleSpriteCopy(int battlerId, u8 spriteId, int species)
2018-10-07 11:32:20 +01:00
{
u8 newSpriteId = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy);
gSprites[newSpriteId] = gSprites[spriteId];
gSprites[newSpriteId].usingSheet = TRUE;
gSprites[newSpriteId].oam.priority = 0;
gSprites[newSpriteId].oam.objMode = ST_OAM_OBJ_WINDOW;
2018-10-07 11:32:20 +01:00
gSprites[newSpriteId].oam.tileNum = gSprites[spriteId].oam.tileNum;
gSprites[newSpriteId].callback = SpriteCallbackDummy;
return newSpriteId;
}
2021-04-24 23:26:25 +01:00
void AnimTranslateLinearAndFlicker_Flipped(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2018-10-07 11:32:20 +01:00
if (GetBattlerSide(gBattleAnimAttacker))
{
2021-07-07 14:11:52 +01:00
sprite->x -= gBattleAnimArgs[0];
2018-10-07 11:32:20 +01:00
gBattleAnimArgs[3] = -gBattleAnimArgs[3];
sprite->hFlip = TRUE;
}
else
{
2021-07-07 14:11:52 +01:00
sprite->x += gBattleAnimArgs[0];
2018-10-07 11:32:20 +01:00
}
2021-07-07 14:11:52 +01:00
sprite->y += gBattleAnimArgs[1];
2018-10-07 11:32:20 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[3] = gBattleAnimArgs[4];
sprite->data[5] = gBattleAnimArgs[5];
2018-12-18 04:08:08 +00:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
2019-02-06 19:17:09 +00:00
sprite->callback = TranslateSpriteLinearAndFlicker;
2018-10-07 11:32:20 +01:00
}
2021-02-27 23:41:30 +00:00
// Used by three different unused battle anim sprite templates.
2021-04-24 23:26:25 +01:00
void AnimTranslateLinearAndFlicker(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
2021-07-07 14:11:52 +01:00
sprite->x -= gBattleAnimArgs[0];
2018-10-07 11:32:20 +01:00
gBattleAnimArgs[3] *= -1;
}
else
{
2021-07-07 14:11:52 +01:00
sprite->x += gBattleAnimArgs[0];
2018-10-07 11:32:20 +01:00
}
2021-07-07 14:11:52 +01:00
sprite->y += gBattleAnimArgs[1];
2018-10-07 11:32:20 +01:00
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = gBattleAnimArgs[3];
sprite->data[3] = gBattleAnimArgs[4];
sprite->data[5] = gBattleAnimArgs[5];
StartSpriteAnim(sprite, gBattleAnimArgs[6]);
2018-12-18 04:08:08 +00:00
StoreSpriteCallbackInData6(sprite, DestroySpriteAndMatrix);
2019-02-06 19:17:09 +00:00
sprite->callback = TranslateSpriteLinearAndFlicker;
2018-10-07 11:32:20 +01:00
}
2020-02-14 23:11:04 +00:00
// Used by Detect/Disable
void AnimSpinningSparkle(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
SetSpriteCoordsToAnimAttackerCoords(sprite);
2018-10-07 11:32:20 +01:00
if (GetBattlerSide(gBattleAnimAttacker))
2021-07-07 14:11:52 +01:00
sprite->x -= gBattleAnimArgs[0];
2018-10-07 11:32:20 +01:00
else
2021-07-07 14:11:52 +01:00
sprite->x += gBattleAnimArgs[0];
sprite->y += gBattleAnimArgs[1];
2018-12-18 04:08:08 +00:00
sprite->callback = RunStoredCallbackWhenAnimEnds;
2018-10-07 11:32:20 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
2021-11-01 16:41:21 +00:00
// Task and sprite data for AnimTask_AttackerPunchWithTrace
#define tBattlerSpriteId data[0]
#define tMoveSpeed data[1]
#define tState data[2]
#define tCounter data[3]
#define tPaletteNum data[4]
#define tNumTracesActive data[5]
#define tPriority data[6]
#define sActiveTime data[0]
#define sTaskId data[1]
#define sSpriteId data[2]
2020-02-16 22:49:24 +00:00
// Slides attacker to right and back with a cloned trace of the specified color
// arg0: Trace palette blend color
// arg1: Trace palette blend coeff
void AnimTask_AttackerPunchWithTrace(u8 taskId)
2018-10-07 11:32:20 +01:00
{
u16 src;
u16 dest;
struct Task *task = &gTasks[taskId];
2021-11-01 16:41:21 +00:00
task->tBattlerSpriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->tMoveSpeed = (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) ? -8 : 8;
task->tState = 0;
task->tCounter = 0;
gSprites[task->tBattlerSpriteId].x2 -= task->tBattlerSpriteId;
task->tPaletteNum = AllocSpritePalette(ANIM_TAG_BENT_SPOON);
task->tNumTracesActive = 0;
2022-08-19 15:29:35 +01:00
dest = OBJ_PLTT_ID2(task->tPaletteNum);
src = OBJ_PLTT_ID2(gSprites[task->tBattlerSpriteId].oam.paletteNum);
2021-11-01 16:41:21 +00:00
// Set trace's priority based on battler's subpriority
task->tPriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
if (task->tPriority == 20 || task->tPriority == 40)
task->tPriority = 2;
2018-10-07 11:32:20 +01:00
else
2021-11-01 16:41:21 +00:00
task->tPriority = 3;
2022-08-19 15:29:35 +01:00
CpuCopy32(&gPlttBufferUnfaded[src], &gPlttBufferFaded[dest], PLTT_SIZE_4BPP);
2018-10-07 11:32:20 +01:00
BlendPalette(dest, 16, gBattleAnimArgs[1], gBattleAnimArgs[0]);
2021-01-23 05:40:46 +00:00
task->func = AnimTask_AttackerPunchWithTrace_Step;
2018-10-07 11:32:20 +01:00
}
2021-01-23 05:40:46 +00:00
static void AnimTask_AttackerPunchWithTrace_Step(u8 taskId)
2018-10-07 11:32:20 +01:00
{
struct Task *task = &gTasks[taskId];
2021-11-01 16:41:21 +00:00
switch (task->tState)
2018-10-07 11:32:20 +01:00
{
case 0:
2021-11-01 16:41:21 +00:00
// Move forward
CreateBattlerTrace(task, taskId);
gSprites[task->tBattlerSpriteId].x2 += task->tMoveSpeed;
if (++task->tCounter == 5)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:41:21 +00:00
task->tCounter--;
task->tState++;
2018-10-07 11:32:20 +01:00
}
break;
case 1:
2021-11-01 16:41:21 +00:00
// Move back (do same number of traces as before)
CreateBattlerTrace(task, taskId);
gSprites[task->tBattlerSpriteId].x2 -= task->tMoveSpeed;
if (--task->tCounter == 0)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:41:21 +00:00
gSprites[task->tBattlerSpriteId].x2 = 0;
task->tState++;
2018-10-07 11:32:20 +01:00
}
break;
case 2:
2021-11-01 16:41:21 +00:00
if (task->tNumTracesActive == 0)
2018-10-07 11:32:20 +01:00
{
FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON);
DestroyAnimVisualTask(taskId);
}
break;
}
}
2021-11-01 16:41:21 +00:00
static void CreateBattlerTrace(struct Task *task, u8 taskId)
2018-10-07 11:32:20 +01:00
{
2018-12-18 04:08:08 +00:00
s16 spriteId = CloneBattlerSpriteWithBlend(0);
2018-10-07 11:32:20 +01:00
if (spriteId >= 0)
{
2021-11-01 16:41:21 +00:00
gSprites[spriteId].oam.priority = task->tPriority;
gSprites[spriteId].oam.paletteNum = task->tPaletteNum;
gSprites[spriteId].sActiveTime = 8;
gSprites[spriteId].sTaskId = taskId;
gSprites[spriteId].sSpriteId = spriteId;
gSprites[spriteId].x2 = gSprites[task->tBattlerSpriteId].x2;
gSprites[spriteId].callback = AnimBattlerTrace;
task->tNumTracesActive++;
2018-10-07 11:32:20 +01:00
}
}
2021-11-01 16:41:21 +00:00
// Just waits until destroyed
static void AnimBattlerTrace(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:41:21 +00:00
if (--sprite->sActiveTime == 0)
2018-10-07 11:32:20 +01:00
{
2021-11-01 16:41:21 +00:00
gTasks[sprite->sTaskId].tNumTracesActive--;
DestroySpriteWithActiveSheet(sprite);
2018-10-07 11:32:20 +01:00
}
}
2021-11-01 16:41:21 +00:00
#undef tBattlerSpriteId
#undef tMoveSpeed
#undef tState
#undef tCounter
#undef tPaletteNum
#undef tNumTracesActive
#undef tPriority
#undef sActiveTime
#undef sTaskId
#undef sSpriteId
2020-02-20 01:22:53 +00:00
void AnimWeatherBallUp(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
2021-07-07 14:11:52 +01:00
sprite->x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
2022-08-27 05:59:12 +01:00
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
2018-10-07 11:32:20 +01:00
sprite->data[0] = 5;
else
sprite->data[0] = -10;
sprite->data[1] = -40;
2021-01-23 05:40:46 +00:00
sprite->callback = AnimWeatherBallUp_Step;
2018-10-07 11:32:20 +01:00
}
2021-01-23 05:40:46 +00:00
static void AnimWeatherBallUp_Step(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
sprite->data[2] += sprite->data[0];
sprite->data[3] += sprite->data[1];
2021-07-07 14:11:52 +01:00
sprite->x2 = sprite->data[2] / 10;
sprite->y2 = sprite->data[3] / 10;
2018-10-07 11:32:20 +01:00
if (sprite->data[1] < -20)
sprite->data[1]++;
2021-07-07 14:11:52 +01:00
if (sprite->y + sprite->y2 < -32)
2018-10-07 11:32:20 +01:00
DestroyAnimSprite(sprite);
}
2020-02-20 01:22:53 +00:00
void AnimWeatherBallDown(struct Sprite *sprite)
2018-10-07 11:32:20 +01:00
{
int x;
sprite->data[0] = gBattleAnimArgs[2];
2021-07-07 14:11:52 +01:00
sprite->data[2] = sprite->x + gBattleAnimArgs[4];
sprite->data[4] = sprite->y + gBattleAnimArgs[5];
2022-08-27 05:59:12 +01:00
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
2018-10-07 11:32:20 +01:00
{
x = (u16)gBattleAnimArgs[4] + 30;
2021-07-07 14:11:52 +01:00
sprite->x += x;
sprite->y = gBattleAnimArgs[5] - 20;
2018-10-07 11:32:20 +01:00
}
else
{
x = (u16)gBattleAnimArgs[4] - 30;
2021-07-07 14:11:52 +01:00
sprite->x += x;
sprite->y = gBattleAnimArgs[5] - 80;
2018-10-07 11:32:20 +01:00
}
2018-11-25 23:00:18 +00:00
sprite->callback = StartAnimLinearTranslation;
2018-10-07 11:32:20 +01:00
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}