Improve trainer back pic-related data and code (+ smol documentation) (#6821)
This commit is contained in:
parent
4f51ea4839
commit
aae04ffc84
93
docs/tutorials/how_to_trainer_back_pic.md
Normal file
93
docs/tutorials/how_to_trainer_back_pic.md
Normal file
@ -0,0 +1,93 @@
|
||||
# How to add a new trainer back pic
|
||||
|
||||
## Content
|
||||
* [Quick Summary](#quick-summary)
|
||||
* [The Graphics](#the-graphics)
|
||||
* [1. Edit the sprites](#2-edit-the-sprites)
|
||||
* [2. Register the sprites](#2-register-the-sprites)
|
||||
* [3. Connecting pictures to the data](#2-connecting-pictures-to-the-data)
|
||||
* [The Data](#the-data)
|
||||
* [4. Defining the trainer back pic](#2-defining-the-trainer-back-pic)
|
||||
* [Usage](#usage)
|
||||
|
||||
## Quick Summary
|
||||
If you've done this before and just need a quick lookup, here's what files you need:
|
||||
1. Place graphics in [`graphics/trainers/back_pics`](./graphics/trainers/back_pics).
|
||||
2. Point game to where graphic files are found: [`src/data/graphics/trainers`](./src/data/graphics/trainers.h).
|
||||
3. Add trainer to [`include/constants/trainers.h`](./include/constants/trainers.h),
|
||||
|
||||
## The Graphics
|
||||
|
||||
### 1. Add the sprites
|
||||
We will start with a graphic that we want to use for our new trainer pic. Unlike with adding Pokémon, the trainer sprites aren't sorted in individual folders, but rather in one folder: [`graphics/trainers/back_pics`](./graphics/trainers/back_pics). **Trainers sprites cannot be more than 16 - this includes the color that will be transparent, which is the first slot of the palette.**
|
||||
|
||||
### 2. Register the sprites
|
||||
Sadly, just putting the image files into the graphics folder is not enough. To use the sprites we have to register them by linking the graphic files in [`src/data/graphics/trainers.h`](./src/data/graphics/trainers.h):
|
||||
```diff
|
||||
const u8 gTrainerBackPic_Wally[] = INCBIN_U8("graphics/trainers/back_pics/wally.4bpp");
|
||||
const u8 gTrainerBackPic_Steven[] = INCBIN_U8("graphics/trainers/back_pics/steven.4bpp");
|
||||
+const u8 gTrainerBackPic_NewOne[] = INCBIN_U8("graphics/trainers/back_pics/new_one.4bpp");
|
||||
|
||||
const u16 gTrainerBackPicPalette_Red[] = INCBIN_U16("graphics/trainers/back_pics/red.gbapal");
|
||||
const u16 gTrainerBackPicPalette_Leaf[] = INCBIN_U16("graphics/trainers/back_pics/leaf.gbapal");
|
||||
+const u16 gTrainerBackPicPalette_NewOne[] = INCBIN_U16("graphics/trainers/back_pics/new_one.gbapal");
|
||||
```
|
||||
|
||||
### 3. Connecting the Pictures to the Data
|
||||
The last few things we have to do is prepare the graphics for usage. In [`src/data/graphics/trainers.h`](./src/data/graphics/trainers.h) you'll find the `gTrainerBacksprites` struct, we need to add the trainer to this. You can just copy the last trainer type defined and edit it, but this is what it does: Connects the new trainer with the image we defined earlier.
|
||||
|
||||
So, finally, it needs to look like this:
|
||||
```diff
|
||||
#define TRAINER_BACK_SPRITE(trainerPic, yOffset, sprite, pal, anim) \
|
||||
[trainerPic] = \
|
||||
{ \
|
||||
.coordinates = {.size = 8, .y_offset = yOffset}, \
|
||||
.backPic = {.data = sprite, .size = TRAINER_PIC_SIZE, .relativeFrames = TRUE}, \
|
||||
.palette = {.data = pal, .tag = trainerPic}, \
|
||||
.animation = anim, \
|
||||
}
|
||||
|
||||
const struct TrainerBacksprite gTrainerBacksprites[] =
|
||||
{
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_BRENDAN, 4, gTrainerBackPic_Brendan, gTrainerPalette_Brendan, sBackAnims_Hoenn),
|
||||
...
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_STEVEN, 4, gTrainerBackPic_Steven, gTrainerPalette_Steven, sBackAnims_Hoenn),
|
||||
+ TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_NEW_ONE, 4, gTrainerBackPic_NewOne, gTrainerBackPicPalette_NewOne, sBackAnims_Hoenn),
|
||||
};
|
||||
```
|
||||
|
||||
**Note**: Trainer back pics can have 4 or 5 frames of animation. Trainers with 5 frames must have their `yOffset` set to 5, and their `anim` set to `sBackAnims_Kanto`.
|
||||
|
||||
### The Data
|
||||
#### 4. Defining the trainer back pic
|
||||
Finally, let's bring it all together by defining our new trainer pic in [`include/constants/trainers.h`](./include/constants/trainers.h):
|
||||
|
||||
```diff
|
||||
#define TRAINER_BACK_PIC_WALLY 6
|
||||
#define TRAINER_BACK_PIC_STEVEN 7
|
||||
+#define TRAINER_BACK_PIC_NEW_ONE 8
|
||||
```
|
||||
Remember to count the number next to the trainer pic up by one!
|
||||
|
||||
## Usage
|
||||
You can test your new trainer back pic by going to [`src/data/battle_partners.party`](./src/data/battle_partners.party) and change the `Pic` field. The syntax should match the constant (`TRAINER_BACK_PIC_NEW_ONE`) with the underscore replaced by spaces. For example:
|
||||
```diff
|
||||
=== PARTNER_STEVEN ===
|
||||
Name: STEVEN
|
||||
Class: Rival
|
||||
-Pic: Steven
|
||||
+Pic: New One
|
||||
Gender: Male
|
||||
Music: Male
|
||||
```
|
||||
|
||||
Otherwise if you use [`src/data/battle_partners.h`](./src/data/battle_partners.h), change the `trainerPic` field instead. For example:
|
||||
```diff
|
||||
[DIFFICULTY_NORMAL][PARTNER_STEVEN] =
|
||||
{
|
||||
.trainerName = _("STEVEN"),
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
- .trainerPic = TRAINER_BACK_PIC_STEVEN,
|
||||
+ .trainerPic = TRAINER_BACK_PIC_NEW_ONE,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
```
|
||||
97
docs/tutorials/how_to_trainer_front_pic.md
Normal file
97
docs/tutorials/how_to_trainer_front_pic.md
Normal file
@ -0,0 +1,97 @@
|
||||
# How to add a new trainer front pic
|
||||
|
||||
## Content
|
||||
* [Quick Summary](#quick-summary)
|
||||
* [The Graphics](#the-graphics)
|
||||
* [1. Edit the sprites](#2-edit-the-sprites)
|
||||
* [2. Register the sprites](#2-register-the-sprites)
|
||||
* [3. Connecting pictures to the data](#2-connecting-pictures-to-the-data)
|
||||
* [The Data](#the-data)
|
||||
* [4. Defining the trainer pic](#2-defining-the-trainer-pic)
|
||||
* [Usage](#usage)
|
||||
|
||||
## Quick Summary
|
||||
If you've done this before and just need a quick lookup, here's what files you need:
|
||||
1. Place graphics into [`graphics/trainers/front_pics`](./graphics/trainers/front_pics).
|
||||
2. Point game to where graphic files are found: [`src/data/graphics/trainers`](./src/data/graphics/trainers.h).
|
||||
3. Add trainer to [`include/constants/trainers.h`](./include/constants/trainers.h).
|
||||
|
||||
## The Graphics
|
||||
|
||||
### 1. Edit the sprites
|
||||
We will start with a graphic that we want to use for our new trainer pic. Unlike with adding Pokémon, the trainer sprites aren't sorted in individual folders, but rather in one folder: [`graphics/trainers/front_pics`](./graphics/trainers/front_pics). **Trainers sprites cannot be more than 16 - this includes the color that will be transparent, which is the first slot of the palette.**
|
||||
|
||||
### 2. Register the sprites
|
||||
Sadly, just putting the image files into the graphics folder is not enough. To use the sprites we have to register them by linking the graphic files in [`src/data/graphics/trainers`](./data/graphics/trainers.h):
|
||||
```diff
|
||||
const u16 gTrainerPalette_RubySapphireBrendan[] = INCBIN_U16("graphics/trainers/palettes/brendan_rs.gbapal");
|
||||
|
||||
const u32 gTrainerFrontPic_RubySapphireMay[] = INCBIN_U32("graphics/trainers/front_pics/may_rs.4bpp.smol");
|
||||
const u16 gTrainerPalette_RubySapphireMay[] = INCBIN_U16("graphics/trainers/palettes/may_rs.gbapal");
|
||||
+
|
||||
+const u32 gTrainerFrontPic_NewOne[] = INCBIN_U32("graphics/trainers/front_pics/new_one.4bpp.smol");
|
||||
+const u16 gTrainerPalette_NewOne[] = INCBIN_U16("graphics/trainers/front_pics/new_one.gbapal");
|
||||
|
||||
const u8 gTrainerBackPic_Brendan[] = INCBIN_U8("graphics/trainers/back_pics/brendan.4bpp");
|
||||
```
|
||||
|
||||
### 3. Connecting the Pictures to the Data
|
||||
The last few things we have to do is prepare the graphics for usage. In [`src/data/graphics/trainers.h`](./src/data/graphics/trainers.h) you'll find the `gTrainerSprites` struct, we need to add the trainer to this. You can just copy the last trainer type defined and edit it, but this is what it does: Connects the new trainer with the image we defined earlier.
|
||||
|
||||
So, finally, it needs to look like this:
|
||||
```diff
|
||||
#define TRAINER_SPRITE(trainerPic, picFile, paletteFile, ...) \
|
||||
[trainerPic] = \
|
||||
{ \
|
||||
.frontPic = {picFile, TRAINER_PIC_SIZE, trainerPic}, \
|
||||
.palette = {paletteFile, trainerPic}, \
|
||||
.mugshotCoords = {DEFAULT(0, __VA_ARGS__), DEFAULT_2(0, __VA_ARGS__)}, \
|
||||
.mugshotRotation = DEFAULT_3(0x200, __VA_ARGS__), \
|
||||
}
|
||||
|
||||
const struct TrainerSprite gTrainerSprites[] =
|
||||
{
|
||||
TRAINER_SPRITE(TRAINER_PIC_HIKER, gTrainerFrontPic_Hiker, gTrainerPalette_Hiker),
|
||||
TRAINER_SPRITE(TRAINER_PIC_AQUA_GRUNT_M, gTrainerFrontPic_AquaGruntM, gTrainerPalette_AquaGruntM),
|
||||
...
|
||||
TRAINER_SPRITE(TRAINER_PIC_RS_MAY, gTrainerFrontPic_RubySapphireMay, gTrainerPalette_RubySapphireMay),
|
||||
+ TRAINER_SPRITE(TRAINER_PIC_NEW_ONE, gTrainerFrontPic_NewOne, gTrainerPalette_NewOne),
|
||||
};
|
||||
```
|
||||
### The Data
|
||||
#### 4. Defining the trainer pic
|
||||
Finally, let's bring it all together by defining our new trainer pic in [`include/constants/trainers.h`](./include/constants/trainers.h):
|
||||
|
||||
```diff
|
||||
#define TRAINER_PIC_RS_MAY 92
|
||||
+#define TRAINER_PIC_NEW_ONE 93
|
||||
|
||||
#define TRAINER_BACK_PIC_BRENDAN 0
|
||||
#define TRAINER_BACK_PIC_MAY 1
|
||||
```
|
||||
Remember to count the number next to the trainer pic up by one!
|
||||
|
||||
## Usage
|
||||
You can test your trainer type by going to [`src/data/trainers.party`](./src/data/trainers.party) and change the `Pic` field. The syntax should match the constant (`TRAINER_PIC_NEW_ONE`) with the underscore replaced by spaces. For example:
|
||||
```diff
|
||||
=== TRAINER_BRENDAN_PLACEHOLDER ===
|
||||
Name: BRENDAN
|
||||
Class: RS Protag
|
||||
-Pic: RS Brendan
|
||||
+Pic: New One
|
||||
Gender: Male
|
||||
Music: Male
|
||||
Double Battle: No
|
||||
```
|
||||
|
||||
Otherwise if you use [`src/data/trainers.h`](./src/data/trainers.h), change the `.trainerPic` field instead. For example:
|
||||
```diff
|
||||
[DIFFICULTY_NORMAL][TRAINER_BRENDAN_PLACEHOLDER] =
|
||||
{
|
||||
.trainerName = _("BRENDAN"),
|
||||
.trainerClass = TRAINER_CLASS_RS_PROTAG,
|
||||
- .trainerPic = TRAINER_PIC_RS_BRENDAN,
|
||||
+ .trainerPic = TRAINER_PIC_NEW_ONE,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.doubleBattle = FALSE,
|
||||
```
|
||||
@ -1,98 +0,0 @@
|
||||
# How to add a new trainer pic
|
||||
|
||||
## Content
|
||||
* [Quick Summary](#quick-summary)
|
||||
* [The Graphics](#the-graphics)
|
||||
* [1. Edit the sprites](#2-edit-the-sprites)
|
||||
* [2. Register the sprites](#2-register-the-sprites)
|
||||
* [3. Connecting pictures to the data](#2-connecting-pictures-to-the-data)
|
||||
* [The Data](#the-data)
|
||||
* [4. Defining the trainer pic](#2-defining-the-trainer-pic)
|
||||
* [Usage](#usage)
|
||||
|
||||
## Quick Summary
|
||||
If you've done this before and just need a quick lookup, here's what files you need:
|
||||
1. GFX into [graphics/trainers/front_pics](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/graphics/trainers/front_pics)
|
||||
2. Palette into [graphics/trainers/palettes](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/graphics/trainers/palettes)
|
||||
3. Point game to where graphic files are found: [src/data/graphics/trainers](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/src/data/graphics/trainers.h)
|
||||
4. Add trainer to [include/constants/trainers.h](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/constants/trainers.h)
|
||||
|
||||
## The Graphics
|
||||
|
||||
### 1. Edit the sprites
|
||||
We will start with a graphic that we want to use for our new trainer pic. Unlike with adding Pokémon, the trainer sprites aren't sorted in individual folders, but rather in one folder:
|
||||
[graphics/trainers/front_pics](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/graphics/trainers/front_pics)
|
||||
|
||||
**Remember to limit yourself to 16 colors including transparency in the first slot!**
|
||||
|
||||
Export the palette and place into the same folder.
|
||||
|
||||
### 2. Register the sprites
|
||||
Sadly, just putting the image files into the graphics folder is not enough. To use the sprites we have to register them by linking the graphic files.
|
||||
[src/data/graphics/trainers](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/src/data/graphics/trainers.h):
|
||||
```diff
|
||||
const u16 gTrainerPalette_RubySapphireBrendan[] = INCBIN_U16("graphics/trainers/palettes/ruby_sapphire_brendan.gbapal");
|
||||
|
||||
const u32 gTrainerFrontPic_RubySapphireMay[] = INCBIN_U32("graphics/trainers/front_pics/ruby_sapphire.4bpp.lz");
|
||||
const u16 gTrainerPalette_RubySapphireMay[] = INCBIN_U16("graphics/trainers/palettes/ruby_sapphire_may.gbapal");
|
||||
|
||||
+ const u32 gTrainerFrontPic_myTrainerClass[] = INCBIN_U32("graphics/trainers/front_pics/myTrainerClass.4bpp.lz");
|
||||
+ const u16 gTrainerPalette_myTrainerClass[] = INCBIN_U16("graphics/trainers/palettes/myTrainerClass.gbapal");
|
||||
|
||||
const u8 gTrainerBackPic_Brendan[] = INCBIN_U8("graphics/trainers/back_pics/brendan.4bpp");
|
||||
```
|
||||
|
||||
### 3. Connecting the Pictures to the Data
|
||||
The last few things we have to do is prepare the graphics for usage. In [src/data/graphics/trainers.h](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/src/data/graphics/trainers.h) you'll find the gTrainerSprites struct, we need to add the trainer to this. You can just copy the last trainer type defined and edit it, but this is what it does: Connects the trainer type with the image we defined earlier.
|
||||
|
||||
So, finally, it needs to look like this:
|
||||
```diff
|
||||
define TRAINER_SPRITE(trainerPic, picFile, paletteFile, ...) \
|
||||
[trainerPic] = \
|
||||
{ \
|
||||
.frontPic = {picFile, TRAINER_PIC_SIZE, trainerPic}, \
|
||||
.palette = {paletteFile, trainerPic}, \
|
||||
.mugshotCoords = {DEFAULT(0, __VA_ARGS__), DEFAULT_2(0, __VA_ARGS__)}, \
|
||||
.mugshotRotation = DEFAULT_3(0x200, __VA_ARGS__), \
|
||||
}
|
||||
|
||||
const struct TrainerSprite gTrainerSprites[] =
|
||||
{
|
||||
TRAINER_SPRITE(TRAINER_PIC_HIKER, gTrainerFrontPic_Hiker, gTrainerPalette_Hiker),
|
||||
TRAINER_SPRITE(TRAINER_PIC_AQUA_GRUNT_M, gTrainerFrontPic_AquaGruntM, gTrainerPalette_AquaGruntM),
|
||||
...
|
||||
TRAINER_SPRITE(TRAINER_PIC_RS_MAY, gTrainerFrontPic_RubySapphireMay, gTrainerPalette_RubySapphireMay),
|
||||
TRAINER_SPRITE(TRAINER_PIC_MY_TRAINER_CLASS, gTrainerFrontPic_myTrainerClass, gTrainerPalette_myTrainerClass)
|
||||
};
|
||||
```
|
||||
### The Data
|
||||
#### 4. Defining the trainer pic
|
||||
Finally, let's bring it all together by defining our new trainer pic in [include/constants/trainers.h](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/include/constants/trainers.h):
|
||||
|
||||
```diff
|
||||
#define TRAINER_PIC_RS_MAY 92
|
||||
+ #define TRAINER_PIC_MY_TRAINER_CLASS 93
|
||||
|
||||
#define TRAINER_BACK_PIC_BRENDAN 0
|
||||
#define TRAINER_BACK_PIC_MAY 1
|
||||
```
|
||||
Remember to count the number next to the trainer pic up by one!
|
||||
|
||||
## Usage
|
||||
You can test your trainer type by going to [src/data/trainers](https://github.com/rh-hideout/pokeemerald-expansion/blob/master/src/data/trainers.h) and changing a trainer type. For example:
|
||||
```diff
|
||||
[TRAINER_BRENDAN_PLACEHOLDER] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_RS_PROTAG,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
- .trainerPic = TRAINER_PIC_RS_BRENDAN,
|
||||
+ .trainerPic = TRAINER_PIC_MY_TRAINER_CLASS,
|
||||
.trainerName = _("BRENDAN"),
|
||||
.items = {},
|
||||
.doubleBattle = FALSE,
|
||||
.aiFlags = 0,
|
||||
.partySize = ARRAY_COUNT(sParty_BrendanLinkPlaceholder),
|
||||
.party = {.NoItemDefaultMoves = sParty_BrendanLinkPlaceholder},
|
||||
},
|
||||
```
|
||||
@ -42,9 +42,9 @@ struct TrainerSprite
|
||||
|
||||
struct TrainerBacksprite
|
||||
{
|
||||
struct MonCoords coordinates;
|
||||
struct CompressedSpriteSheet backPic;
|
||||
struct SpritePalette palette;
|
||||
const struct MonCoords coordinates;
|
||||
const struct SpriteFrameImage backPic;
|
||||
const struct SpritePalette palette;
|
||||
const union AnimCmd *const *const animation;
|
||||
};
|
||||
|
||||
|
||||
@ -16,5 +16,6 @@ u16 CreateTrainerPicSprite(u16 species, bool8 isFrontPic, s16 x, s16 y, u8 palet
|
||||
u16 FreeAndDestroyTrainerPicSprite(u16 spriteId);
|
||||
u16 CreateTrainerCardTrainerPicSprite(u16 species, bool8 isFrontPic, u16 destX, u16 destY, u8 paletteSlot, u8 windowId);
|
||||
u16 PlayerGenderToFrontTrainerPicId_Debug(u8 gender, bool8 getClass);
|
||||
void CopyTrainerBackspriteFramesToDest(u8 trainerPicId, u8 *dest);
|
||||
|
||||
#endif // GUARD_TRAINER_POKEMON_SPRITES_H
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "data.h"
|
||||
#include "palette.h"
|
||||
#include "contest.h"
|
||||
#include "trainer_pokemon_sprites.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "constants/battle_palace.h"
|
||||
@ -697,8 +698,7 @@ void DecompressTrainerFrontPic(u16 frontPicId, u8 battler)
|
||||
void DecompressTrainerBackPic(u16 backPicId, u8 battler)
|
||||
{
|
||||
u8 position = GetBattlerPosition(battler);
|
||||
DecompressPicFromTable(&gTrainerBacksprites[backPicId].backPic,
|
||||
gMonSpritesGfxPtr->spritesGfx[position]);
|
||||
CopyTrainerBackspriteFramesToDest(backPicId, gMonSpritesGfxPtr->spritesGfx[position]);
|
||||
LoadPalette(gTrainerBacksprites[backPicId].palette.data,
|
||||
OBJ_PLTT_ID(battler), PLTT_SIZE_4BPP);
|
||||
}
|
||||
|
||||
@ -457,92 +457,23 @@ static const union AnimCmd *const sBackAnims_Kanto[] =
|
||||
sAnimCmd_Point_HGSS_Red_Leaf,
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_Brendan[] =
|
||||
{
|
||||
{gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Brendan + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_May[] =
|
||||
{
|
||||
{gTrainerBackPic_May + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_May + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_May + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_May + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_Red[] =
|
||||
{
|
||||
{gTrainerBackPic_Red + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Red + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Red + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Red + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Red + TRAINER_PIC_SIZE * 4, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_Leaf[] =
|
||||
{
|
||||
{gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Leaf + TRAINER_PIC_SIZE * 4, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireBrendan[] =
|
||||
{
|
||||
{gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_RubySapphireBrendan + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_RubySapphireMay[] =
|
||||
{
|
||||
{gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_RubySapphireMay + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_Wally[] =
|
||||
{
|
||||
{gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Wally + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
const struct SpriteFrameImage gTrainerBackPicTable_Steven[] =
|
||||
{
|
||||
{gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 0, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 1, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 2, TRAINER_PIC_SIZE},
|
||||
{gTrainerBackPic_Steven + TRAINER_PIC_SIZE * 3, TRAINER_PIC_SIZE},
|
||||
};
|
||||
|
||||
// .backPic goes functionally unused, since none of these pics are compressed
|
||||
// and the place they would get extracted to gets overwritten later anyway
|
||||
// the casts are so they'll play nice with the strict struct definition
|
||||
#define TRAINER_BACK_SPRITE(trainerPic, yOffset, sprite, table, pal, anim) \
|
||||
#define TRAINER_BACK_SPRITE(trainerPic, yOffset, sprite, pal, anim) \
|
||||
[trainerPic] = \
|
||||
{ \
|
||||
.coordinates = {.size = 8, .y_offset = yOffset}, \
|
||||
.backPic = {(const u32 *)sprite, TRAINER_PIC_SIZE * ARRAY_COUNT(table), trainerPic}, \
|
||||
.palette = {pal, trainerPic}, \
|
||||
.backPic = {.data = sprite, .size = TRAINER_PIC_SIZE, .relativeFrames = TRUE}, \
|
||||
.palette = {.data = pal, .tag = trainerPic}, \
|
||||
.animation = anim, \
|
||||
}
|
||||
|
||||
const struct TrainerBacksprite gTrainerBacksprites[] =
|
||||
{
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_BRENDAN, 4, gTrainerBackPic_Brendan, gTrainerBackPicTable_Brendan, gTrainerPalette_Brendan, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_MAY, 4, gTrainerBackPic_May, gTrainerBackPicTable_May, gTrainerPalette_May, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RED, 5, gTrainerBackPic_Red, gTrainerBackPicTable_Red, gTrainerBackPicPalette_Red, sBackAnims_Kanto),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_LEAF, 5, gTrainerBackPic_Leaf, gTrainerBackPicTable_Leaf, gTrainerBackPicPalette_Leaf, sBackAnims_Kanto),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN, 4, gTrainerBackPic_RubySapphireBrendan, gTrainerBackPicTable_RubySapphireBrendan, gTrainerPalette_RubySapphireBrendan, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY, 4, gTrainerBackPic_RubySapphireMay, gTrainerBackPicTable_RubySapphireMay, gTrainerPalette_RubySapphireMay, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_WALLY, 4, gTrainerBackPic_Wally, gTrainerBackPicTable_Wally, gTrainerPalette_Wally, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_STEVEN, 4, gTrainerBackPic_Steven, gTrainerBackPicTable_Steven, gTrainerPalette_Steven, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_BRENDAN, 4, gTrainerBackPic_Brendan, gTrainerPalette_Brendan, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_MAY, 4, gTrainerBackPic_May, gTrainerPalette_May, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RED, 5, gTrainerBackPic_Red, gTrainerBackPicPalette_Red, sBackAnims_Kanto),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_LEAF, 5, gTrainerBackPic_Leaf, gTrainerBackPicPalette_Leaf, sBackAnims_Kanto),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN, 4, gTrainerBackPic_RubySapphireBrendan, gTrainerPalette_RubySapphireBrendan, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY, 4, gTrainerBackPic_RubySapphireMay, gTrainerPalette_RubySapphireMay, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_WALLY, 4, gTrainerBackPic_Wally, gTrainerPalette_Wally, sBackAnims_Hoenn),
|
||||
TRAINER_BACK_SPRITE(TRAINER_BACK_PIC_STEVEN, 4, gTrainerBackPic_Steven, gTrainerPalette_Steven, sBackAnims_Hoenn),
|
||||
};
|
||||
|
||||
@ -810,80 +810,15 @@ const struct SpriteTemplate gBattlerSpriteTemplates[MAX_BATTLERS_COUNT] =
|
||||
},
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sTrainerBackSpriteTemplates[] =
|
||||
static const struct SpriteTemplate sTrainerBackSpriteTemplate =
|
||||
{
|
||||
[TRAINER_BACK_PIC_BRENDAN] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_Brendan,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
[TRAINER_BACK_PIC_MAY] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_May,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
[TRAINER_BACK_PIC_RED] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_Red,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
[TRAINER_BACK_PIC_LEAF] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_Leaf,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
[TRAINER_BACK_PIC_RUBY_SAPPHIRE_BRENDAN] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_RubySapphireBrendan,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
[TRAINER_BACK_PIC_RUBY_SAPPHIRE_MAY] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_RubySapphireMay,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
[TRAINER_BACK_PIC_WALLY] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_Wally,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
[TRAINER_BACK_PIC_STEVEN] = {
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = gTrainerBackPicTable_Steven,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
},
|
||||
.tileTag = TAG_NONE,
|
||||
.paletteTag = 0,
|
||||
.oam = &gOamData_BattleSpritePlayerSide,
|
||||
.anims = NULL,
|
||||
.images = NULL,
|
||||
.affineAnims = gAffineAnims_BattleSpritePlayerSide,
|
||||
.callback = SpriteCB_BattleSpriteStartSlideLeft,
|
||||
};
|
||||
|
||||
#define NUM_SECRET_BASE_CLASSES 5
|
||||
@ -2240,7 +2175,8 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerPicId, u8 battlerPosition
|
||||
gMultiuseSpriteTemplate.paletteTag = trainerPicId;
|
||||
if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT)
|
||||
{
|
||||
gMultiuseSpriteTemplate = sTrainerBackSpriteTemplates[trainerPicId];
|
||||
gMultiuseSpriteTemplate = sTrainerBackSpriteTemplate;
|
||||
gMultiuseSpriteTemplate.images = &gTrainerBacksprites[trainerPicId].backPic;
|
||||
gMultiuseSpriteTemplate.anims = gTrainerBacksprites[trainerPicId].animation;
|
||||
}
|
||||
else
|
||||
|
||||
@ -68,7 +68,7 @@ static bool16 DecompressPic(u16 species, u32 personality, bool8 isFrontPic, u8 *
|
||||
if (isFrontPic)
|
||||
DecompressPicFromTable(&gTrainerSprites[species].frontPic, dest);
|
||||
else
|
||||
DecompressPicFromTable(&gTrainerBacksprites[species].backPic, dest);
|
||||
CopyTrainerBackspriteFramesToDest(species, dest);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -357,3 +357,11 @@ u16 PlayerGenderToFrontTrainerPicId_Debug(u8 gender, bool8 getClass)
|
||||
}
|
||||
return gender;
|
||||
}
|
||||
|
||||
void CopyTrainerBackspriteFramesToDest(u8 trainerPicId, u8 *dest)
|
||||
{
|
||||
const struct SpriteFrameImage *frame = &gTrainerBacksprites[trainerPicId].backPic;
|
||||
// y_offset is repurposed to indicates how many frames does the trainer pic have.
|
||||
u32 size = (frame->size * gTrainerBacksprites[trainerPicId].coordinates.y_offset);
|
||||
CpuSmartCopy16(frame->data, dest, size);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user