sovereignx/include/data.h

232 lines
6.8 KiB
C
Raw Normal View History

2019-04-04 22:08:53 +01:00
#ifndef GUARD_DATA_H
#define GUARD_DATA_H
#include "constants/moves.h"
#include "constants/trainers.h"
2019-04-04 22:08:53 +01:00
2019-04-06 22:20:16 +01:00
#define SPECIES_SHINY_TAG 5000
2019-04-04 22:08:53 +01:00
2021-10-03 04:47:59 +01:00
#define MAX_TRAINER_ITEMS 4
#define TRAINER_PIC_WIDTH 64
#define TRAINER_PIC_HEIGHT 64
#define TRAINER_PIC_SIZE (TRAINER_PIC_WIDTH * TRAINER_PIC_HEIGHT / 2)
// Red and Leaf's back pics have 5 frames, but this is presumably irrelevant in the places this is used.
#define MAX_TRAINER_PIC_FRAMES 4
enum {
BATTLER_AFFINE_NORMAL,
BATTLER_AFFINE_EMERGE,
BATTLER_AFFINE_RETURN,
};
2019-04-04 22:08:53 +01:00
struct MonCoords
{
// This would use a bitfield, but some function
// uses it as a u8 and casting won't match.
u8 size; // u8 width:4, height:4;
u8 y_offset;
};
struct TrainerSprite
{
u8 y_offset;
struct CompressedSpriteSheet frontPic;
struct CompressedSpritePalette palette;
const union AnimCmd *const *const animation;
const struct Coords16 mugshotCoords;
s16 mugshotRotation;
};
struct TrainerBacksprite
{
struct MonCoords coordinates;
struct CompressedSpriteSheet backPic;
struct CompressedSpritePalette palette;
const union AnimCmd *const *const animation;
};
2021-11-01 16:02:08 +00:00
#define MON_COORDS_SIZE(width, height)(DIV_ROUND_UP(width, 8) << 4 | DIV_ROUND_UP(height, 8))
#define GET_MON_COORDS_WIDTH(size)((size >> 4) * 8)
#define GET_MON_COORDS_HEIGHT(size)((size & 0xF) * 8)
#define TRAINER_PARTY_IVS(hp, atk, def, speed, spatk, spdef) (hp | (atk << 5) | (def << 10) | (speed << 15) | (spatk << 20) | (spdef << 25))
#define TRAINER_PARTY_EVS(hp, atk, def, speed, spatk, spdef) ((const u8[6]){hp,atk,def,spatk,spdef,speed})
// Shared by both trainer and frontier mons
// See CreateNPCTrainerPartyFromTrainer and CreateFacilityMon
2023-07-05 23:29:28 +01:00
struct TrainerMon
{
const u8 *nickname;
const u8 *ev;
u32 iv;
u16 moves[4];
u16 species;
u16 heldItem;
u16 ability;
u8 lvl;
u8 ball;
u8 friendship;
u8 nature:5;
bool8 gender:2;
bool8 isShiny:1;
u8 dynamaxLevel:4;
u8 teraType:5;
bool8 gigantamaxFactor:1;
bool8 shouldDynamax:1;
bool8 shouldTerastal:1;
};
2021-11-01 16:02:08 +00:00
2023-07-05 23:31:08 +01:00
#define TRAINER_PARTY(partyArray) partyArray, .partySize = ARRAY_COUNT(partyArray)
2019-04-04 22:53:06 +01:00
struct Trainer
{
/*0x00*/ u32 aiFlags;
2023-07-05 23:29:28 +01:00
/*0x04*/ const struct TrainerMon *party;
/*0x08*/ u16 items[MAX_TRAINER_ITEMS];
/*0x10*/ u8 trainerClass;
/*0x11*/ u8 encounterMusic_gender; // last bit is gender
/*0x12*/ u8 trainerPic;
/*0x13*/ u8 trainerName[TRAINER_NAME_LENGTH + 1];
/*0x1E*/ bool8 doubleBattle:1;
bool8 mugshotEnabled:1;
u8 startingStatus:6; // this trainer starts a battle with a given status. see include/constants/battle.h for values
/*0x1F*/ u8 mugshotColor;
/*0x20*/ u8 partySize;
2019-04-04 22:53:06 +01:00
};
struct TrainerClass
{
u8 name[13];
u8 money;
u16 ball;
};
struct TypeInfo
{
u8 name[TYPE_NAME_LENGTH + 1];
u8 generic[17];
u8 palette;
u16 zMove;
u16 maxMove;
const u32 *const paletteTMHM;
//u16 enhanceItem;
//u16 berry;
//u16 gem;
//u16 plate;
//u16 memory;
//u16 zCrystal;
//u16 teraShard;
//u16 arceusForm;
};
2021-01-23 04:22:37 +00:00
extern const u16 gMinigameDigits_Pal[];
extern const u32 gMinigameDigits_Gfx[];
2019-04-04 22:08:53 +01:00
2021-01-23 04:22:37 +00:00
extern const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[];
extern const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[];
extern const struct SpriteFrameImage gBattlerPicTable_PlayerRight[];
extern const struct SpriteFrameImage gBattlerPicTable_OpponentRight[];
2019-04-04 22:08:53 +01:00
extern const struct SpriteFrameImage gTrainerBackPicTable_Brendan[];
extern const struct SpriteFrameImage gTrainerBackPicTable_May[];
extern const struct SpriteFrameImage gTrainerBackPicTable_Red[];
extern const struct SpriteFrameImage gTrainerBackPicTable_Leaf[];
extern const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireBrendan[];
extern const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireMay[];
extern const struct SpriteFrameImage gTrainerBackPicTable_Wally[];
extern const struct SpriteFrameImage gTrainerBackPicTable_Steven[];
2021-01-23 04:22:37 +00:00
extern const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[];
extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[];
extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteContest[];
2019-04-04 22:08:53 +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
extern const union AnimCmd sAnim_GeneralFrame0[];
extern const union AnimCmd sAnim_GeneralFrame3[];
extern const union AnimCmd *const gAnims_MonPic[];
extern const union AnimCmd *const sAnims_Trainer[];
extern const struct TrainerSprite gTrainerSprites[];
extern const struct TrainerBacksprite gTrainerBacksprites[];
2019-04-04 22:08:53 +01:00
extern const struct Trainer gTrainers[];
extern const struct Trainer gBattlePartners[];
extern const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT];
2019-04-04 22:08:53 +01:00
static inline u16 SanitizeTrainerId(u16 trainerId)
{
if (trainerId >= TRAINERS_COUNT)
return TRAINER_NONE;
return trainerId;
}
static inline const struct Trainer *GetTrainerStructFromId(u16 trainerId)
{
return &gTrainers[SanitizeTrainerId(trainerId)];
}
static inline const u8 GetTrainerClassFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].trainerClass;
}
static inline const u8 *GetTrainerClassNameFromId(u16 trainerId)
{
if (trainerId > TRAINER_PARTNER(PARTNER_NONE))
return gTrainerClasses[gBattlePartners[trainerId - TRAINER_PARTNER(PARTNER_NONE)].trainerClass].name;
return gTrainerClasses[GetTrainerClassFromId(trainerId)].name;
}
static inline const u8 *GetTrainerNameFromId(u16 trainerId)
{
if (trainerId > TRAINER_PARTNER(PARTNER_NONE))
return gBattlePartners[trainerId - TRAINER_PARTNER(PARTNER_NONE)].trainerName;
return gTrainers[SanitizeTrainerId(trainerId)].trainerName;
}
static inline const u8 GetTrainerPicFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].trainerPic;
}
static inline const u8 GetTrainerStartingStatusFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].startingStatus;
}
static inline const bool32 IsTrainerDoubleBattle(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].doubleBattle;
}
static inline const u8 GetTrainerPartySizeFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].partySize;
}
static inline const bool32 DoesTrainerHaveMugshot(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].mugshotEnabled;
}
static inline const u8 GetTrainerMugshotColorFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].mugshotColor;
}
static inline const u16 *GetTrainerItemsFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].items;
}
static inline const struct TrainerMon *GetTrainerPartyFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].party;
}
static inline const bool32 GetTrainerAIFlagsFromId(u16 trainerId)
{
return gTrainers[SanitizeTrainerId(trainerId)].aiFlags;
}
2019-04-04 22:08:53 +01:00
#endif // GUARD_DATA_H