- 7
- Posts
- 2
- Years
- Seen Dec 9, 2024
[mods please don't delete this, I'm trying to move this from decomp/disassembly help to the tutorials; I'm sorry for not posting in the right spot :( ]
I would like to start with a few disclaimers, one, that I did not discover/create this, this was started and on Whack-a-Hack by Thorec_A_C and posted on November 9th 2022, and two, this was left abandoned by Thorec_A_C and has bugs that need fixed. If there are any new developments or mistranslations please let me know and I will do my best to keep this post updated!
[Original Link]: https://whackahack.com/foro/threads/animacion-pokemon-al-estilo-blanco-y-negro-en-pokeemerald.67772/
Now that the credits are out of the way, I will post a very rough translation (someone that doesnt know spanish well) for folk that don't know Spanish at all
Thorec_A_C:
"Cleaning up the PC I have found this, which comes from the following post [https://whackahack.com/foro/threads/animacion-pokemon-estilo-blanco-y-negro.65464/#post-470531], more than a year and a half has passed, almost nothing... Total, I no longer remembered it and so that it is lost forever, I publish it although it is a bit halfway done, that's why I put it in research and not in tutorials.
The question, this is a way to implement animations of the Pokémon "Black and White style" in decomp, specifically in pokeemerald. I'm going to explain it to the best of my ability, though I'm not very familiar with decomp code.
This implementation is far from professional, it was a bit of trial and error, and it has some bugs. Curiously, these bugs are the same as the famous BugMania patch for Fire red that recreates these same animations.
To begin, explain that Emerald's animations have 2 parts: one where the sprite frames are loaded and repeated x number of times with x duration each repetition; the other that modifies the sprites giving them effects, a twist, stretching them, etc.
To start we are going to make the frames repeat indefinitely to simulate a continuous animation like Black and White:
Let's go to: pokeemerald\src\data\pokemon_graphics\front_pic_anims.h
Here we find a function for each of the Pokémon. Torchic's for example is:
[DIV]
Code:
static const union AnimCmd sAnim_TORCHIC_1[] =
{
ANIMCMD_FRAME(0, 7),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 10),
ANIMCMD_END,
};
[/DIV]
Where ANIMCMD_FRAME(X, Y) indicates each repetition of the frame, the X indicates the ID of the frame and the Y the duration.
We modify the function by this:
[DIV]
Code:
static const union AnimCmd sAnim_TORCHIC_1[] =
{
ANIMCMD_FRAME(0, 7),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 10),
ANIMCMD_LOOP(1),
ANIMCMD_JUMP(0),
ANIMCMD_END,
};
[/DIV]
By adding loop and jump the animation starts to run indefinitely. We must add this for all the Pokémon that we want to have this animation.
There is a problem with this and that is that by never ending the animation the combat does not continue. However, removing the effects of the animations that I mentioned before, solves it. Although there is a way to keep the effects with the loop, I am not going to put it because it ends up giving visual artifacts in the combats, according to my experience, they are also executed only once at the beginning and it is strange with the continuous animation.
To do this we go to: pokeemerald\src\pokemon_animation.c
And we take any of the effect functions available in Emerald, for example I take the one from Unown, which is static void Anim_ZigzagFast(struct Sprite *sprite)and I replace everything with:
[DIV]
Code:
static void Anim_ZigzagFast(struct Sprite *sprite)
{
sprite->callback = SpriteCallbackDummy;
}
[/DIV]
We already have an effect canceled so now we go to: pokeemerald\src\pokemon.c
And we assign that function to all the Pokémon that have continuous animation in static const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] =
For example Bulbasaur would look like this: [SPECIES_BULBASAUR - 1] = ANIM_ZIGZAG_FAST,
With this we would already have implemented the system.
Now comes the bad, there are 3 bugs with this:
When we access the menu of the Pokémon team or the backpack in a battle, when we return to the battle scene, the animation does not run.
Stat changes and the effects of some attacks like Fortitude or Curse give graphical errors.
When switching Pokémon in a battle with a trainer, the animation of the second and subsequent Pokémon does not start.
The first bug I know how to fix, all credits and thanks go to kakarotto , another forum user who helped me fix it at the time.
To fix this we do the following:
In pokeemerald\include\battle_main.h we add to the list at the beginning:
void SpriteCb_WildMonAnimate2(struct Sprite *sprite);
In pokeemerald\src\battle_main.c we add:
[DIV]
void SpriteCb_WildMonAnimate2(struct Sprite *sprite)
{
if (!gPaletteFade.active)
{
BattleAnimateFrontSprite(sprite, sprite->sSpeciesId, FALSE, 1);
}
}
[/DIV]
In pokeemerald\src\reshow_battle_screen.c we add at the beginning in the list #include "battle_main.h"
And then in the static void function CreateBattlerSprite(u8 battler) we indicate in "gSprites[gBattlerSpriteIds[battler]].callback =" the previous function being as follows: gSprites[gBattlerSpriteIds[battler]].callback = SpriteCb_WildMonAnimate2;
This fixes the first bug I mentioned.
Regarding the other 2 I don't know how to solve them, as I mentioned I think they are also present in the BugMania patch. In this gif you can see both bugs:
https://i.ibb.co/PY1jcBQ/bugs.gif
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20012-d75ff9a6f988ab808a64a5342510c951.jpg)
For the visual effects error, I think the key is to make the animation stop while the effect is taking place, in many attacks it already does, you can see if you implement this, for a few tenths of a second while doing the attack animation. This should be added to attacks that fail like Fortitude or Curse.
Regarding the stat changes I understand that you should look at pokeemerald\src\battle_anim_utility_funcs.c but I'm not sure.
And with the bug of the trainers I have no idea, what I investigated at the time did not lead me to anything. Maybe some decomp expert who is interested in this topic can contribute something.
Finally comment that although this works with the sprites of Emerald, the result is not very good since when using only 2 frames the animations are abrupt. However with 4 frames the result is quite good. Important, do not use more than 4 frames per Pokémon since, according to what I have read, it exceeds what the ram memory of the game can support in double combat, although I am not very sure about it.
Visual example, animation with 2 frames:
https://whackahack.com/foro/attachments/2frames-gif.12216/
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20013-861432041a73b23943d0dabf514dde18.jpg)
Animations with 4 frames:
https://whackahack.com/foro/attachments/4frames-gif.12214/
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20014-a91253ab09b658fc795f978a296f6887.jpg)
https://whackahack.com/foro/attachments/4frames2-gif.12215/
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20015-b4bd990120abacad171a90dda408f12e.jpg)
Another thing to take into account of this is the space of the rom, since we are putting twice as many frames per Pokémon.
I have little more to add to this. I hope it will be useful to someone and if any member manages to fix the bugs and share it with the community I would be very grateful."
I would like to start with a few disclaimers, one, that I did not discover/create this, this was started and on Whack-a-Hack by Thorec_A_C and posted on November 9th 2022, and two, this was left abandoned by Thorec_A_C and has bugs that need fixed. If there are any new developments or mistranslations please let me know and I will do my best to keep this post updated!
[Original Link]: https://whackahack.com/foro/threads/animacion-pokemon-al-estilo-blanco-y-negro-en-pokeemerald.67772/
Now that the credits are out of the way, I will post a very rough translation (someone that doesnt know spanish well) for folk that don't know Spanish at all
Thorec_A_C:
"Cleaning up the PC I have found this, which comes from the following post [https://whackahack.com/foro/threads/animacion-pokemon-estilo-blanco-y-negro.65464/#post-470531], more than a year and a half has passed, almost nothing... Total, I no longer remembered it and so that it is lost forever, I publish it although it is a bit halfway done, that's why I put it in research and not in tutorials.
The question, this is a way to implement animations of the Pokémon "Black and White style" in decomp, specifically in pokeemerald. I'm going to explain it to the best of my ability, though I'm not very familiar with decomp code.
This implementation is far from professional, it was a bit of trial and error, and it has some bugs. Curiously, these bugs are the same as the famous BugMania patch for Fire red that recreates these same animations.
To begin, explain that Emerald's animations have 2 parts: one where the sprite frames are loaded and repeated x number of times with x duration each repetition; the other that modifies the sprites giving them effects, a twist, stretching them, etc.
To start we are going to make the frames repeat indefinitely to simulate a continuous animation like Black and White:
Spoiler:
Let's go to: pokeemerald\src\data\pokemon_graphics\front_pic_anims.h
Here we find a function for each of the Pokémon. Torchic's for example is:
[DIV]
Code:
static const union AnimCmd sAnim_TORCHIC_1[] =
{
ANIMCMD_FRAME(0, 7),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 10),
ANIMCMD_END,
};
[/DIV]
Where ANIMCMD_FRAME(X, Y) indicates each repetition of the frame, the X indicates the ID of the frame and the Y the duration.
We modify the function by this:
[DIV]
Code:
static const union AnimCmd sAnim_TORCHIC_1[] =
{
ANIMCMD_FRAME(0, 7),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(1, 4),
ANIMCMD_FRAME(0, 10),
ANIMCMD_LOOP(1),
ANIMCMD_JUMP(0),
ANIMCMD_END,
};
[/DIV]
By adding loop and jump the animation starts to run indefinitely. We must add this for all the Pokémon that we want to have this animation.
There is a problem with this and that is that by never ending the animation the combat does not continue. However, removing the effects of the animations that I mentioned before, solves it. Although there is a way to keep the effects with the loop, I am not going to put it because it ends up giving visual artifacts in the combats, according to my experience, they are also executed only once at the beginning and it is strange with the continuous animation.
To do this we go to: pokeemerald\src\pokemon_animation.c
And we take any of the effect functions available in Emerald, for example I take the one from Unown, which is static void Anim_ZigzagFast(struct Sprite *sprite)and I replace everything with:
[DIV]
Code:
static void Anim_ZigzagFast(struct Sprite *sprite)
{
sprite->callback = SpriteCallbackDummy;
}
[/DIV]
We already have an effect canceled so now we go to: pokeemerald\src\pokemon.c
And we assign that function to all the Pokémon that have continuous animation in static const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] =
For example Bulbasaur would look like this: [SPECIES_BULBASAUR - 1] = ANIM_ZIGZAG_FAST,
With this we would already have implemented the system.
Now comes the bad, there are 3 bugs with this:
When we access the menu of the Pokémon team or the backpack in a battle, when we return to the battle scene, the animation does not run.
Stat changes and the effects of some attacks like Fortitude or Curse give graphical errors.
When switching Pokémon in a battle with a trainer, the animation of the second and subsequent Pokémon does not start.
The first bug I know how to fix, all credits and thanks go to kakarotto , another forum user who helped me fix it at the time.
To fix this we do the following:
Spoiler:
In pokeemerald\include\battle_main.h we add to the list at the beginning:
void SpriteCb_WildMonAnimate2(struct Sprite *sprite);
In pokeemerald\src\battle_main.c we add:
[DIV]
void SpriteCb_WildMonAnimate2(struct Sprite *sprite)
{
if (!gPaletteFade.active)
{
BattleAnimateFrontSprite(sprite, sprite->sSpeciesId, FALSE, 1);
}
}
[/DIV]
In pokeemerald\src\reshow_battle_screen.c we add at the beginning in the list #include "battle_main.h"
And then in the static void function CreateBattlerSprite(u8 battler) we indicate in "gSprites[gBattlerSpriteIds[battler]].callback =" the previous function being as follows: gSprites[gBattlerSpriteIds[battler]].callback = SpriteCb_WildMonAnimate2;
This fixes the first bug I mentioned.
Regarding the other 2 I don't know how to solve them, as I mentioned I think they are also present in the BugMania patch. In this gif you can see both bugs:
https://i.ibb.co/PY1jcBQ/bugs.gif
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20012-d75ff9a6f988ab808a64a5342510c951.jpg)
For the visual effects error, I think the key is to make the animation stop while the effect is taking place, in many attacks it already does, you can see if you implement this, for a few tenths of a second while doing the attack animation. This should be added to attacks that fail like Fortitude or Curse.
Regarding the stat changes I understand that you should look at pokeemerald\src\battle_anim_utility_funcs.c but I'm not sure.
And with the bug of the trainers I have no idea, what I investigated at the time did not lead me to anything. Maybe some decomp expert who is interested in this topic can contribute something.
Finally comment that although this works with the sprites of Emerald, the result is not very good since when using only 2 frames the animations are abrupt. However with 4 frames the result is quite good. Important, do not use more than 4 frames per Pokémon since, according to what I have read, it exceeds what the ram memory of the game can support in double combat, although I am not very sure about it.
Visual example, animation with 2 frames:
https://whackahack.com/foro/attachments/2frames-gif.12216/
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20013-861432041a73b23943d0dabf514dde18.jpg)
Animations with 4 frames:
https://whackahack.com/foro/attachments/4frames-gif.12214/
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20014-a91253ab09b658fc795f978a296f6887.jpg)
https://whackahack.com/foro/attachments/4frames2-gif.12215/
![[PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald [PokeCommunity.com] Animated Battle Sprites In the Style of Black and White in Pokeemerald](https://data.pokecommunity.com/attachments/20/20015-b4bd990120abacad171a90dda408f12e.jpg)
Another thing to take into account of this is the space of the rom, since we are putting twice as many frames per Pokémon.
I have little more to add to this. I hope it will be useful to someone and if any member manages to fix the bugs and share it with the community I would be very grateful."