pokeemerald/include/data.h

169 lines
6.1 KiB
C
Raw Normal View History

2019-04-04 23:08:53 +02:00
#ifndef GUARD_DATA_H
#define GUARD_DATA_H
#include "constants/moves.h"
2019-04-06 23:20:16 +02:00
#define SPECIES_SHINY_TAG 5000
2019-04-04 23:08:53 +02:00
2021-10-03 05:47:59 +02: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 23:08:53 +02: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;
};
2021-11-01 17:02:08 +01: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})
#define TRAINER_PARTY_NATURE(nature) (nature+1)
struct TrainerMonCustomized
{
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;
};
2021-11-01 17:02:08 +01:00
2019-04-04 23:53:06 +02:00
struct TrainerMonNoItemDefaultMoves
{
u16 iv;
u8 lvl;
u16 species;
};
struct TrainerMonItemDefaultMoves
{
u16 iv;
u8 lvl;
u16 species;
u16 heldItem;
};
struct TrainerMonNoItemCustomMoves
{
u16 iv;
u8 lvl;
u16 species;
2019-09-08 17:53:48 +02:00
u16 moves[MAX_MON_MOVES];
2019-04-04 23:53:06 +02:00
};
struct TrainerMonItemCustomMoves
{
u16 iv;
u8 lvl;
u16 species;
u16 heldItem;
2019-09-08 17:53:48 +02:00
u16 moves[MAX_MON_MOVES];
2019-04-04 23:53:06 +02:00
};
#define NO_ITEM_DEFAULT_MOVES(party) { .NoItemDefaultMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = 0
#define NO_ITEM_CUSTOM_MOVES(party) { .NoItemCustomMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET
#define ITEM_DEFAULT_MOVES(party) { .ItemDefaultMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_HELD_ITEM
#define ITEM_CUSTOM_MOVES(party) { .ItemCustomMoves = party }, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET | F_TRAINER_PARTY_HELD_ITEM
#define EVERYTHING_CUSTOMIZED(party) { .EverythingCustomized = party}, .partySize = ARRAY_COUNT(party), .partyFlags = F_TRAINER_PARTY_EVERYTHING_CUSTOMIZED
2019-04-04 23:53:06 +02:00
union TrainerMonPtr
{
const struct TrainerMonNoItemDefaultMoves *NoItemDefaultMoves;
const struct TrainerMonNoItemCustomMoves *NoItemCustomMoves;
const struct TrainerMonItemDefaultMoves *ItemDefaultMoves;
const struct TrainerMonItemCustomMoves *ItemCustomMoves;
const struct TrainerMonCustomized *EverythingCustomized;
2019-04-04 23:53:06 +02:00
};
struct Trainer
{
/*0x00*/ u32 aiFlags;
/*0x04*/ union TrainerMonPtr 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;
u8 partyFlags:7;
/*0x1F*/ u8 partySize;
2019-04-04 23:53:06 +02:00
};
#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F))
2021-01-23 05:22:37 +01:00
extern const u16 gMinigameDigits_Pal[];
extern const u32 gMinigameDigits_Gfx[];
2019-04-04 23:08:53 +02:00
2021-01-23 05:22:37 +01: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 23:08:53 +02: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 05:22:37 +01: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 23:08:53 +02:00
extern const union AnimCmd *const gAnims_MonPic[];
2019-04-04 23:08:53 +02:00
extern const struct MonCoords gMonFrontPicCoords[];
extern const struct MonCoords gMonBackPicCoords[];
extern const struct CompressedSpriteSheet gMonBackPicTable[];
2020-11-06 20:45:25 +01:00
extern const struct CompressedSpriteSheet gMonBackPicTableFemale[];
2019-04-04 23:08:53 +02:00
extern const struct CompressedSpritePalette gMonPaletteTable[];
2020-11-06 21:12:57 +01:00
extern const struct CompressedSpritePalette gMonPaletteTableFemale[];
2019-04-04 23:08:53 +02:00
extern const struct CompressedSpritePalette gMonShinyPaletteTable[];
2020-11-06 21:12:57 +01:00
extern const struct CompressedSpritePalette gMonShinyPaletteTableFemale[];
2019-04-04 23:08:53 +02:00
extern const union AnimCmd *const *const gTrainerFrontAnimsPtrTable[];
extern const struct MonCoords gTrainerFrontPicCoords[];
extern const struct CompressedSpriteSheet gTrainerFrontPicTable[];
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const union AnimCmd *const *const gTrainerBackAnimsPtrTable[];
extern const struct MonCoords gTrainerBackPicCoords[];
extern const struct CompressedSpriteSheet gTrainerBackPicTable[]; // functionally unused
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern const u8 gEnemyMonElevation[NUM_SPECIES];
2019-04-04 23:53:06 +02:00
extern const union AnimCmd *const *const gMonFrontAnimsPtrTable[];
2019-04-04 23:08:53 +02:00
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
2020-11-06 20:21:45 +01:00
extern const struct CompressedSpriteSheet gMonFrontPicTableFemale[];
2019-04-04 23:08:53 +02:00
extern const struct Trainer gTrainers[];
extern const u8 gTrainerClassNames[][13];
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
extern const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1];
2020-11-26 21:56:18 +01:00
extern const u8 *const gZMoveNames[];
2019-04-04 23:08:53 +02:00
#endif // GUARD_DATA_H