pokeemmo/src/data.c
Martin Griffin 8bd5ac2e7a
Competitive-formatted parties (#3545)
$ python3 migration_scripts/convert_parties.py src/data/trainers.h src/data/trainer_parties.h src/data/npc_trainers.party
Is available to convert Trainer Control-formatted trainers/parties into
Competitive-formatted ones.

Multiple '#include's can be placed in the trainer section of src/data.c
to support spreading the trainers across multiple .party files.

trainerproc does not interpret the values, leaving that job to the C
compiler, so we use '#line' to associate those errors with the lines in
the .party file(s). Because the columns don't make sense we use
-fno-show-column and -fno-diagostics-show-caret. We might want to move
gTrainers into its own file so that the rest of src/data.c isn't
affected by those flags.

Extensions (misfeatures, imo):
- .party files are passed through cpp, so '#define's are supported, and so
  are '// ...' and '/* ... */' comments.
- .party files also support writing, e.g. 'SPECIES_PIKACHU' instead of
  'Pikachu'. This allows people to write constants explicitly if they
  like.

Pragmas:
- '#pragma trainerproc ivs explicit' requires an explicit 'IVs:' line
  rather than defaulting to 31s.
- '#pragma trainerproc ivs <IVs>' changes the default IVs.
- '#pragma trainerproc level explicit' requires an explicit 'Level:'
  line rather than defaulting to 100.
- '#pragma trainerproc level <level>' changes the default level.

Co-authored-by: Eduardo Quezada <eduardo602002@gmail.com>
Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
2024-04-06 15:05:15 -03:00

234 lines
6.2 KiB
C

#include "global.h"
#include "malloc.h"
#include "battle.h"
#include "data.h"
#include "graphics.h"
#include "battle_transition.h"
#include "constants/abilities.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/trainers.h"
#include "constants/battle_ai.h"
const u16 gMinigameDigits_Pal[] = INCBIN_U16("graphics/link/minigame_digits.gbapal");
const u32 gMinigameDigits_Gfx[] = INCBIN_U32("graphics/link/minigame_digits.4bpp.lz");
static const u32 sMinigameDigitsThin_Gfx[] = INCBIN_U32("graphics/link/minigame_digits2.4bpp.lz"); // Unused
#define BATTLER_OFFSET(i) (gHeap + 0x8000 + MON_PIC_SIZE * (i))
const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[] =
{
{BATTLER_OFFSET(0), MON_PIC_SIZE},
{BATTLER_OFFSET(1), MON_PIC_SIZE},
{BATTLER_OFFSET(2), MON_PIC_SIZE},
{BATTLER_OFFSET(3), MON_PIC_SIZE},
};
const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[] =
{
{BATTLER_OFFSET(4), MON_PIC_SIZE},
{BATTLER_OFFSET(5), MON_PIC_SIZE},
{BATTLER_OFFSET(6), MON_PIC_SIZE},
{BATTLER_OFFSET(7), MON_PIC_SIZE},
};
const struct SpriteFrameImage gBattlerPicTable_PlayerRight[] =
{
{BATTLER_OFFSET(8), MON_PIC_SIZE},
{BATTLER_OFFSET(9), MON_PIC_SIZE},
{BATTLER_OFFSET(10), MON_PIC_SIZE},
{BATTLER_OFFSET(11), MON_PIC_SIZE},
};
const struct SpriteFrameImage gBattlerPicTable_OpponentRight[] =
{
{BATTLER_OFFSET(12), MON_PIC_SIZE},
{BATTLER_OFFSET(13), MON_PIC_SIZE},
{BATTLER_OFFSET(14), MON_PIC_SIZE},
{BATTLER_OFFSET(15), MON_PIC_SIZE},
};
const union AnimCmd sAnim_GeneralFrame0[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END,
};
const union AnimCmd sAnim_GeneralFrame3[] =
{
ANIMCMD_FRAME(3, 0),
ANIMCMD_END,
};
// Many of these affine anims seem to go unused, and
// instead SetSpriteRotScale is used to manipulate
// the battler sprites directly (for instance, in AnimTask_SwitchOutShrinkMon).
// Those with explicit indexes are referenced elsewhere.
static const union AffineAnimCmd sAffineAnim_Battler_Normal[] =
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_Flipped[] =
{
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_Emerge[] =
{
AFFINEANIMCMD_FRAME(0x28, 0x28, 0, 0),
AFFINEANIMCMD_FRAME(0x12, 0x12, 0, 12),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_Return[] =
{
AFFINEANIMCMD_FRAME( -0x2, -0x2, 0, 18),
AFFINEANIMCMD_FRAME(-0x10, -0x10, 0, 15),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_HorizontalSquishLoop[] =
{
AFFINEANIMCMD_FRAME(0xA0, 0x100, 0, 0),
AFFINEANIMCMD_FRAME( 0x4, 0x0, 0, 8),
AFFINEANIMCMD_FRAME(-0x4, 0x0, 0, 8),
AFFINEANIMCMD_JUMP(1),
};
static const union AffineAnimCmd sAffineAnim_Battler_Grow[] =
{
AFFINEANIMCMD_FRAME(0x2, 0x2, 0, 20),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_Shrink[] =
{
AFFINEANIMCMD_FRAME(-0x2, -0x2, 0, 20),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_BigToSmall[] =
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(-0x10, -0x10, 0, 9),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_GrowLarge[] =
{
AFFINEANIMCMD_FRAME(0x4, 0x4, 0, 63),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_TipRight[] =
{
AFFINEANIMCMD_FRAME(0x0, 0x0, -3, 5),
AFFINEANIMCMD_FRAME(0x0, 0x0, 3, 5),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gAffineAnims_BattleSpritePlayerSide[] =
{
[BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Normal,
[BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge,
[BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return,
sAffineAnim_Battler_HorizontalSquishLoop,
sAffineAnim_Battler_Grow,
sAffineAnim_Battler_Shrink,
sAffineAnim_Battler_GrowLarge,
sAffineAnim_Battler_TipRight,
sAffineAnim_Battler_BigToSmall,
};
static const union AffineAnimCmd sAffineAnim_Battler_SpinShrink[] =
{
AFFINEANIMCMD_FRAME(-0x4, -0x4, 4, 63),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_TipLeft[] =
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 3, 5),
AFFINEANIMCMD_FRAME(0x0, 0x0, -3, 5),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_RotateUpAndBack[] =
{
AFFINEANIMCMD_FRAME(0x0, 0x0, -5, 20),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 20),
AFFINEANIMCMD_FRAME(0x0, 0x0, 5, 20),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_Battler_Spin[] =
{
AFFINEANIMCMD_FRAME(0x0, 0x0, 9, 110),
AFFINEANIMCMD_END,
};
const union AffineAnimCmd *const gAffineAnims_BattleSpriteOpponentSide[] =
{
[BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Normal,
[BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge,
[BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return,
sAffineAnim_Battler_HorizontalSquishLoop,
sAffineAnim_Battler_Grow,
sAffineAnim_Battler_Shrink,
sAffineAnim_Battler_SpinShrink,
sAffineAnim_Battler_TipLeft,
sAffineAnim_Battler_RotateUpAndBack,
sAffineAnim_Battler_BigToSmall,
sAffineAnim_Battler_Spin,
};
const union AffineAnimCmd *const gAffineAnims_BattleSpriteContest[] =
{
[BATTLER_AFFINE_NORMAL] = sAffineAnim_Battler_Flipped,
[BATTLER_AFFINE_EMERGE] = sAffineAnim_Battler_Emerge,
[BATTLER_AFFINE_RETURN] = sAffineAnim_Battler_Return,
sAffineAnim_Battler_HorizontalSquishLoop,
sAffineAnim_Battler_Grow,
sAffineAnim_Battler_Shrink,
sAffineAnim_Battler_SpinShrink,
sAffineAnim_Battler_TipLeft,
sAffineAnim_Battler_RotateUpAndBack,
sAffineAnim_Battler_BigToSmall,
sAffineAnim_Battler_Spin,
};
static const union AnimCmd sAnim_MonPic_0[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END,
};
static const union AnimCmd sAnim_MonPic_1[] =
{
ANIMCMD_FRAME(1, 0),
ANIMCMD_END,
};
const union AnimCmd *const gAnims_MonPic[MAX_MON_PIC_FRAMES] =
{
sAnim_MonPic_0,
sAnim_MonPic_1,
};
const union AnimCmd *const sAnims_Trainer[] ={
sAnim_GeneralFrame0,
sAnim_GeneralFrame0,
};
#include "data/trainer_parties.h"
const struct Trainer gTrainers[] =
{
#include "data/trainers.h"
};