2019-04-04 22:08:53 +01:00
|
|
|
#ifndef GUARD_DATA_H
|
|
|
|
#define GUARD_DATA_H
|
|
|
|
|
|
|
|
#include "constants/moves.h"
|
2024-01-04 12:30:42 +00:00
|
|
|
#include "constants/trainers.h"
|
2019-04-04 22:08:53 +01:00
|
|
|
|
2021-10-03 04:47:59 +01:00
|
|
|
#define MAX_TRAINER_ITEMS 4
|
|
|
|
|
2022-10-11 03:07:34 +01:00
|
|
|
#define TRAINER_PIC_WIDTH 64
|
|
|
|
#define TRAINER_PIC_HEIGHT 64
|
|
|
|
#define TRAINER_PIC_SIZE (TRAINER_PIC_WIDTH * TRAINER_PIC_HEIGHT / 2)
|
|
|
|
|
2023-02-01 20:59:02 +00:00
|
|
|
// 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
|
2022-10-11 03:07:34 +01:00
|
|
|
|
2021-04-25 04:29:49 +01:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2023-12-20 22:14:33 +00:00
|
|
|
struct TrainerSprite
|
|
|
|
{
|
|
|
|
u8 y_offset;
|
|
|
|
struct CompressedSpriteSheet frontPic;
|
|
|
|
struct CompressedSpritePalette palette;
|
|
|
|
const union AnimCmd *const *const animation;
|
2024-01-15 23:45:13 +00:00
|
|
|
const struct Coords16 mugshotCoords;
|
|
|
|
s16 mugshotRotation;
|
2023-12-20 22:14:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TrainerBacksprite
|
|
|
|
{
|
|
|
|
struct MonCoords coordinates;
|
|
|
|
struct CompressedSpriteSheet backPic;
|
|
|
|
struct CompressedSpritePalette palette;
|
|
|
|
const union AnimCmd *const *const animation;
|
|
|
|
};
|
|
|
|
|
2024-08-15 18:34:56 +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)
|
2023-02-23 22:14:14 +00:00
|
|
|
#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})
|
|
|
|
|
2024-03-29 07:47:17 +00:00
|
|
|
// Shared by both trainer and frontier mons
|
|
|
|
// See CreateNPCTrainerPartyFromTrainer and CreateFacilityMon
|
2023-07-05 23:29:28 +01:00
|
|
|
struct TrainerMon
|
2023-02-23 22:14:14 +00:00
|
|
|
{
|
|
|
|
const u8 *nickname;
|
|
|
|
const u8 *ev;
|
|
|
|
u32 iv;
|
|
|
|
u16 moves[4];
|
|
|
|
u16 species;
|
|
|
|
u16 heldItem;
|
|
|
|
u16 ability;
|
|
|
|
u8 lvl;
|
|
|
|
u8 ball;
|
|
|
|
u8 friendship;
|
2024-03-29 16:43:33 +00:00
|
|
|
u8 nature:5;
|
|
|
|
bool8 gender:2;
|
|
|
|
bool8 isShiny:1;
|
Terastallization (#4110)
* wrote foundational terastal tests
* implemented baseline test-only Tera functionality; modified GetBattlerType + STAB calculations, misc. changes to some moves
* added tests and func. for Stellar type, more tests for Tera Blast
* more tests for Stellar type, Conversion fixes, Color Change + Conversion2 future proof
* implemented tera blast, expanded stellar type func., fixed tests
* last set of Tera/Tera Blast tests for checklist, protean fix
* implemented in-battle Terastallization, WIP stellar indicator and tera animation
* fixed bad merge
* expanded NUMBER_OF_MON_TYPES, cut down on TYPE_STELLAR hackiness, added Stellar type to summary
* fixed type indicators
* added tera logic to AI
* implemented code review changes, added B_TERA_ORB_NO_COST
* updated AI to calc damage with Tera when applicable; minor rework to AI gimmick handling
* fixed Tera Blast split choice occuring when not Terastallized
* fixed Tera Blast using Last Respects BP calcs
* added tera type to TrainerMon, code review tweaks
2024-04-24 10:17:46 +01:00
|
|
|
u8 teraType:5;
|
2024-03-29 16:43:33 +00:00
|
|
|
bool8 gigantamaxFactor:1;
|
2024-07-13 19:56:18 +01:00
|
|
|
u8 shouldUseDynamax:1;
|
|
|
|
u8 padding1:1;
|
|
|
|
u8 dynamaxLevel:4;
|
|
|
|
u8 padding2:4;
|
2023-02-23 22:14:14 +00:00
|
|
|
};
|
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
|
|
|
|
{
|
2023-02-23 22:14:14 +00:00
|
|
|
/*0x00*/ u32 aiFlags;
|
2023-07-05 23:29:28 +01:00
|
|
|
/*0x04*/ const struct TrainerMon *party;
|
2023-02-23 22:14:14 +00:00
|
|
|
/*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;
|
2024-01-15 23:45:13 +00:00
|
|
|
bool8 mugshotEnabled:1;
|
2024-02-14 09:05:37 +00:00
|
|
|
u8 startingStatus:6; // this trainer starts a battle with a given status. see include/constants/battle.h for values
|
2024-01-15 23:45:13 +00:00
|
|
|
/*0x1F*/ u8 mugshotColor;
|
|
|
|
/*0x20*/ u8 partySize;
|
2019-04-04 22:53:06 +01:00
|
|
|
};
|
|
|
|
|
2024-01-04 12:30:42 +00:00
|
|
|
struct TrainerClass
|
|
|
|
{
|
|
|
|
u8 name[13];
|
|
|
|
u8 money;
|
|
|
|
u16 ball;
|
2019-04-04 22:53:06 +01:00
|
|
|
};
|
|
|
|
|
2024-03-12 10:57:38 +00:00
|
|
|
struct TypeInfo
|
|
|
|
{
|
|
|
|
u8 name[TYPE_NAME_LENGTH + 1];
|
|
|
|
u8 generic[17];
|
|
|
|
u8 palette;
|
2024-03-12 11:32:06 +00:00
|
|
|
u16 zMove;
|
2024-03-12 10:57:38 +00:00
|
|
|
u16 maxMove;
|
2024-06-01 06:38:22 +01:00
|
|
|
u16 teraTypeRGBValue; // Most values pulled from the Tera type icon palette.
|
|
|
|
u16 damageCategory:2; // Used for B_PHYSICAL_SPECIAL_SPLIT <= GEN_3
|
2024-08-11 16:55:51 +01:00
|
|
|
u16 useSecondTypeIconPalette:1;
|
|
|
|
u16 isSpecialCaseType:1;
|
|
|
|
u16 padding:12;
|
2024-04-29 18:29:00 +01:00
|
|
|
const u32 *const paletteTMHM;
|
2024-03-12 10:57:38 +00:00
|
|
|
//u16 enhanceItem;
|
|
|
|
//u16 berry;
|
|
|
|
//u16 gem;
|
|
|
|
//u16 plate;
|
|
|
|
//u16 memory;
|
|
|
|
//u16 zCrystal;
|
|
|
|
//u16 teraShard;
|
2024-03-12 11:32:06 +00:00
|
|
|
//u16 arceusForm;
|
2024-03-12 10:57:38 +00:00
|
|
|
};
|
|
|
|
|
2024-05-18 15:40:09 +01:00
|
|
|
struct FollowerMsgInfo
|
|
|
|
{
|
2021-12-31 21:10:01 +00:00
|
|
|
const u8 *text;
|
|
|
|
const u8 *script;
|
|
|
|
};
|
|
|
|
|
2021-04-15 03:02:51 +01:00
|
|
|
struct FollowerMessagePool
|
|
|
|
{
|
2024-05-18 15:40:09 +01:00
|
|
|
const struct FollowerMsgInfo *messages;
|
|
|
|
const u8 *script;
|
2021-04-15 03:02:51 +01:00
|
|
|
u16 length;
|
|
|
|
};
|
|
|
|
|
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[];
|
2021-04-25 04:29:49 +01:00
|
|
|
extern const union AffineAnimCmd *const gAffineAnims_BattleSpriteContest[];
|
2019-04-04 22:08:53 +01:00
|
|
|
|
2023-12-08 14:05:10 +00:00
|
|
|
extern const union AnimCmd sAnim_GeneralFrame0[];
|
2023-12-20 22:14:33 +00:00
|
|
|
extern const union AnimCmd sAnim_GeneralFrame3[];
|
2021-04-25 04:29:49 +01:00
|
|
|
extern const union AnimCmd *const gAnims_MonPic[];
|
2024-02-06 21:24:36 +00:00
|
|
|
extern const union AnimCmd *const sAnims_Trainer[];
|
2023-12-20 22:14:33 +00:00
|
|
|
extern const struct TrainerSprite gTrainerSprites[];
|
|
|
|
extern const struct TrainerBacksprite gTrainerBacksprites[];
|
2019-04-04 22:08:53 +01:00
|
|
|
|
|
|
|
extern const struct Trainer gTrainers[];
|
2023-12-20 11:38:28 +00:00
|
|
|
extern const struct Trainer gBattlePartners[];
|
|
|
|
|
2024-01-04 12:30:42 +00:00
|
|
|
extern const struct TrainerClass gTrainerClasses[TRAINER_CLASS_COUNT];
|
2019-04-04 22:08:53 +01:00
|
|
|
|
2021-04-15 03:02:51 +01:00
|
|
|
// Follower text messages
|
2021-12-31 21:10:01 +00:00
|
|
|
extern const struct FollowerMsgInfo gFollowerHappyMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerNeutralMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerSadMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerUpsetMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerAngryMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerPensiveMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerLoveMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerSurpriseMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerCuriousMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerMusicMessages[];
|
|
|
|
extern const struct FollowerMsgInfo gFollowerPoisonedMessages[];
|
2021-04-15 03:02:51 +01:00
|
|
|
|
2024-02-22 13:22:57 +00: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))
|
2024-04-22 09:20:37 +01:00
|
|
|
return gTrainerClasses[gBattlePartners[trainerId - TRAINER_PARTNER(PARTNER_NONE)].trainerClass].name;
|
2024-02-22 13:22:57 +00:00
|
|
|
return gTrainerClasses[GetTrainerClassFromId(trainerId)].name;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const u8 *GetTrainerNameFromId(u16 trainerId)
|
|
|
|
{
|
|
|
|
if (trainerId > TRAINER_PARTNER(PARTNER_NONE))
|
2024-04-22 09:20:37 +01:00
|
|
|
return gBattlePartners[trainerId - TRAINER_PARTNER(PARTNER_NONE)].trainerName;
|
2024-02-22 13:22:57 +00:00
|
|
|
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
|