Merge pull request #96 from DizzyEggg/decompile_evo_scene_graphics

Decompile Evolution graphics/scene
This commit is contained in:
Diegoisawesome 2017-10-31 13:57:29 -05:00 committed by GitHub
commit 63210c0789
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 2179 additions and 6015 deletions

View File

@ -1415,7 +1415,7 @@ _080F64F2:
adds r0, r6, 0
adds r1, r5, 0
adds r2, r4, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
adds r0, r6, 0

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -694,7 +694,7 @@ sub_80B5FE8: @ 80B5FE8
lsls r5, 16
lsrs r5, 16
adds r0, r6, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
mov r8, r0
lsls r4, 16
asrs r4, 16

View File

@ -13861,7 +13861,7 @@ sub_81B7810: @ 81B7810
cmp r4, 0
beq _081B7860
bl sub_81B06F4
ldr r0, =gUnknown_030061E8
ldr r0, =gCB2_AfterEvolution
ldr r1, [r6]
str r1, [r0]
ldrb r3, [r6, 0x9]
@ -14307,7 +14307,7 @@ sub_81B7C74: @ 81B7C74
lsrs r5, r0, 24
movs r0, 0x5
bl PlaySE
ldr r2, =gUnknown_030061E8
ldr r2, =gCB2_AfterEvolution
ldr r1, =gUnknown_0203CEC8
ldr r0, [r1]
str r0, [r2]

View File

@ -348,7 +348,7 @@ _08179E84:
adds r1, r0, 0
adds r0, r5, 0
adds r2, r4, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
ldrh r0, [r4, 0x4]

View File

@ -1087,7 +1087,7 @@ _081C4750:
ldrh r0, [r5, 0x2]
ldr r1, [r5, 0x48]
ldr r2, [r5, 0xC]
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
ldrh r0, [r4, 0x4]

View File

@ -732,7 +732,7 @@ _080F8DD8:
adds r0, r6, 0
mov r1, r8
adds r2, r5, 0
bl sub_806E7CC
bl GetMonSpritePalStructFromOtIdPersonality
adds r4, r0, 0
bl LoadCompressedObjectPalette
adds r0, r6, 0

View File

@ -10590,7 +10590,7 @@ _0807CEDC:
ldrb r0, [r0]
movs r1, 0
bl sub_807B4D0
ldr r1, =gUnknown_030061E8
ldr r1, =gCB2_AfterEvolution
ldr r0, =sub_807B60C
str r0, [r1]
ldr r7, =gUnknown_02032298
@ -10615,7 +10615,7 @@ _0807CEDC:
adds r1, 0x8F
ldrb r2, [r1]
adds r1, r4, 0
bl sub_813E1D4
bl TradeEvolutionScene
b _0807CF48
.pool
_0807CF38:
@ -12695,7 +12695,7 @@ _0807E328:
ldrb r0, [r0]
movs r1, 0
bl sub_807B4D0
ldr r1, =gUnknown_030061E8
ldr r1, =gCB2_AfterEvolution
ldr r0, =sub_807B60C
str r0, [r1]
ldr r7, =gUnknown_02032298
@ -12720,7 +12720,7 @@ _0807E328:
adds r1, 0x8F
ldrb r2, [r1]
adds r1, r4, 0
bl sub_813E1D4
bl TradeEvolutionScene
b _0807E394
.pool
_0807E384:
@ -12810,7 +12810,7 @@ _0807E434:
b _0807E4B2
.pool
_0807E444:
ldr r0, =gUnknown_030061E8
ldr r0, =gCB2_AfterEvolution
ldr r1, =sub_807EB50
mov r8, r1
str r1, [r0]
@ -12836,7 +12836,7 @@ _0807E444:
adds r1, 0x8F
ldrb r2, [r1]
adds r1, r4, 0
bl sub_813E1D4
bl TradeEvolutionScene
b _0807E4AE
.pool
_0807E494:

View File

@ -410,7 +410,7 @@ gUnknown_085B51E4:: @ 85B51E4
gUnknown_085B5884:: @ 85B5884
.incbin "baserom.gba", 0x5b5884, 0x40
gUnknown_085B58C4:: @ 85B58C4
gText_ShedinjaJapaneseName2:: @ 85B58C4
.incbin "baserom.gba", 0x5b58c4, 0x5
gUnknown_085B58C9:: @ 85B58C9

View File

@ -1,18 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.incbin "baserom.gba", 0x5f53cc, 0x40
gUnknown_085F540C:: @ 85F540C
.incbin "baserom.gba", 0x5f540c, 0x10
gUnknown_085F541C:: @ 85F541C
.incbin "baserom.gba", 0x5f541c, 0x24
gUnknown_085F5440:: @ 85F5440
.incbin "baserom.gba", 0x5f5440, 0x18
gUnknown_085F5458:: @ 85F5458
.incbin "baserom.gba", 0x5f5458, 0x38

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
49 82 82
82 106 106
106 131 131
139 156 156
164 180 180
197 205 205
222 230 230
255 255 255

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

View File

@ -229,6 +229,7 @@
#define BATTLE_TERRAIN_ROCK 6
#define BATTLE_TERRAIN_CAVE 7
#define BATTLE_TERRAIN_INSIDE 8
#define BATTLE_TERRAIN_PLAIN 9
// array entries for battle communication
#define MULTIUSE_STATE 0x0

View File

@ -215,6 +215,7 @@ extern u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT];
extern u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT];
extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT];
extern const u8* const gBattleStringsTable[];
extern const u8* const gStatNamesTable[];
extern const u8* const gPokeblockWasTooXStringTable[];
extern const u8* const gRefereeStringsTable[];

View File

@ -0,0 +1,15 @@
#ifndef GUARD_EVOLUTION_GRAPHICS_H
#define GUARD_EVOLUTION_GRAPHICS_H
void LoadEvoSparkleSpriteAndPal(void);
u8 LaunchTask_PreEvoSparklesSet1(u16 arg0);
u8 LaunchTask_PreEvoSparklesSet2(void);
u8 LaunchTask_PostEvoSparklesSet1(void);
u8 LaunchTask_PostEvoSparklesSet2AndFlash(u16 species);
u8 LaunchTask_PostEvoSparklesSet2AndFlash_Trade(u16 species);
u8 sub_817C3A0(u8 preEvoSpriteID, u8 postEvoSpriteID);
#define EvoGraphicsTaskEvoStop data[8]
#endif // GUARD_EVOLUTION_GRAPHICS_H

View File

@ -1,8 +1,8 @@
#ifndef GUARD_EVOLUTION_SCENE_H
#define GUARD_EVOLUTION_SCENE_H
void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID);
void BeginEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID);
void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, u8 partyID);
void TradeEvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, u8 preEvoSpriteID, u8 partyID);
extern void (*gCB2_AfterEvolution)(void);

View File

@ -620,7 +620,7 @@ void SetWildMonHeldItem(void);
u16 GetMonEVCount(struct Pokemon *);
const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon);
const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality);
const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality);
bool32 IsHMMove2(u16 move);
bool8 IsPokeSpriteNotFlipped(u16 species);
bool8 IsMonShiny(struct Pokemon *mon);

View File

@ -180,7 +180,7 @@ SECTIONS {
asm/rom6.o(.text);
asm/battle_records.o(.text);
asm/pokedex_area_screen.o(.text);
asm/evolution_scene.o(.text);
src/evolution_scene.o(.text);
asm/roulette.o(.text);
asm/pokedex_cry_screen.o(.text);
src/coins.o(.text);
@ -225,7 +225,7 @@ SECTIONS {
asm/pokeblock_feed.o(.text);
src/clear_save_data_screen.o(.text);
asm/intro_credits_graphics.o(.text);
asm/evolution_graphics.o(.text);
src/evolution_graphics.o(.text);
asm/bard_music.o(.text);
asm/fldeff_teleport.o(.text);
asm/battle_link_817C95C.o(.text);
@ -447,7 +447,7 @@ SECTIONS {
data/pokeblock_feed.o(.rodata);
src/clear_save_data_screen.o(.rodata);
data/intro_credits_graphics.o(.rodata);
data/evolution_graphics.o(.rodata);
src/evolution_graphics.o(.rodata);
data/bard_music.o(.rodata);
data/data_860A4AC.o(.rodata);
src/battle_controller_recorded_opponent.o(.rodata);

View File

@ -85,7 +85,7 @@ extern u16 gTrainerBattleOpponent_B;
extern struct BattleEnigmaBerry gEnigmaBerries[BATTLE_BANKS_COUNT];
extern void (*gPreBattleCallback1)(void);
extern void (*gBattleMainFunc)(void);
extern void (*gUnknown_030061E8)(void);
extern void (*gCB2_AfterEvolution)(void);
extern struct UnknownPokemonStruct2 gUnknown_02022FF8[3]; // what is it used for?
extern struct UnknownPokemonStruct2* gUnknown_02023058; // what is it used for?
extern u8 gUnknown_02039B28[]; // possibly a struct?
@ -4938,7 +4938,7 @@ static void HandleEndTurn_FinishBattle(void)
BeginFastPaletteFade(3);
FadeOutMapMusic(5);
gBattleMainFunc = FreeResetData_ReturnToOvOrDoEvolutions;
gUnknown_030061E8 = BattleMainCB2;
gCB2_AfterEvolution = BattleMainCB2;
}
else
{

View File

@ -124,7 +124,7 @@ static void sub_818D0C4(u16 species, u32 otId, u32 personality, u8 paletteSlot,
else
{
gUnknown_0203CCEC.paletteTag = paletteTag;
LoadCompressedObjectPalette(sub_806E7CC(species, otId, personality));
LoadCompressedObjectPalette(GetMonSpritePalStructFromOtIdPersonality(species, otId, personality));
}
}
else

611
src/evolution_graphics.c Normal file
View File

@ -0,0 +1,611 @@
#include "global.h"
#include "evolution_graphics.h"
#include "sprite.h"
#include "trig.h"
#include "rng.h"
#include "decompress.h"
#include "task.h"
#include "sound.h"
#include "songs.h"
#include "palette.h"
// this file's functions
static void EvoSparkle_DummySpriteCb(struct Sprite* sprite);
static void EvoTask_BeginPreSet1_FadeAndPlaySE(u8 taskID);
static void EvoTask_CreatePreEvoSparkleSet1(u8 taskID);
static void EvoTask_WaitForPre1SparklesToGoUp(u8 taskID);
static void EvoTask_BeginPreSparklesSet2(u8 taskID);
static void EvoTask_CreatePreEvoSparklesSet2(u8 taskID);
static void EvoTask_DestroyPreSet2Task(u8 taskID);
static void EvoTask_BeginPostSparklesSet1(u8 taskID);
static void EvoTask_CreatePostEvoSparklesSet1(u8 taskID);
static void EvoTask_DestroyPostSet1Task(u8 taskID);
static void EvoTask_BeginPostSparklesSet2_AndFlash(u8 taskID);
static void EvoTask_CreatePostEvoSparklesSet2_AndFlash(u8 taskID);
static void EvoTask_BeginPostSparklesSet2_AndFlash_Trade(u8 taskID);
static void EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade(u8 taskID);
static void EvoTask_DestroyPostSet2AndFlashTask(u8 taskID);
static void sub_817C4EC(u8 taskID);
static void sub_817C510(u8 taskID);
static void PreEvoVisible_PostEvoInvisible_KillTask(u8 taskID);
static void PreEvoInvisible_PostEvoVisible_KillTask(u8 taskID);
static void sub_817C560(u8 taskID);
static const u16 sEvoSparklePalette[] = INCBIN_U16("graphics/misc/evo_sparkle.gbapal");
static const u8 sEvoSparkleTiles[] = INCBIN_U8("graphics/misc/evo_sparkle.4bpp.lz");
static const struct CompressedSpriteSheet sEvoSparkleSpriteSheets[] =
{
{sEvoSparkleTiles, 0x20, 1001},
{NULL, 0, 0}
};
static const struct SpritePalette sEvoSparkleSpritePals[] =
{
{sEvoSparklePalette, 1001},
{NULL, 0}
};
static const struct OamData sOamData_EvoSparkle =
{
.y = 160,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 0,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sSpriteAnim_EvoSparkle[] =
{
ANIMCMD_FRAME(0, 8),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_EvoSparkle[] =
{
sSpriteAnim_EvoSparkle,
};
static const struct SpriteTemplate sEvoSparkleSpriteTemplate =
{
.tileTag = 1001,
.paletteTag = 1001,
.oam = &sOamData_EvoSparkle,
.anims = sSpriteAnimTable_EvoSparkle,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = EvoSparkle_DummySpriteCb
};
static const s16 sEvoSparkleMatrices[] =
{
0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, 0x240, 0x200, 0x1C0,
0x180, 0x140, 0x100, -4, 0x10, -3, 0x30, -2, 0x50,
-1, 0x70, 0x1, 0x70, 0x2, 0x50, 0x3, 0x30, 0x4, 0x10
};
static void EvoSparkle_DummySpriteCb(struct Sprite *sprite)
{
}
static void SetEvoSparklesMatrices(void)
{
u16 i;
for (i = 0; i < 12; i++)
{
SetOamMatrix(20 + i, sEvoSparkleMatrices[i], 0, 0, sEvoSparkleMatrices[i]);
}
}
static void SpriteCB_PreEvoSparkleSet1(struct Sprite* sprite)
{
if (sprite->pos1.y > 8)
{
u8 matrixNum;
sprite->pos1.y = 88 - (sprite->data7 * sprite->data7) / 80;
sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5) / 4;
sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5);
sprite->data6 += 4;
if (sprite->data7 & 1)
sprite->data5--;
sprite->data7++;
if (sprite->pos2.y > 0)
sprite->subpriority = 1;
else
sprite->subpriority = 20;
matrixNum = sprite->data5 / 4 + 20;
if (matrixNum > 31)
matrixNum = 31;
sprite->oam.matrixNum = matrixNum;
}
else
DestroySprite(sprite);
}
static void CreatePreEvoSparkleSet1(u8 arg0)
{
u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 88, 0);
if (spriteID != MAX_SPRITES)
{
gSprites[spriteID].data5 = 48;
gSprites[spriteID].data6 = arg0;
gSprites[spriteID].data7 = 0;
gSprites[spriteID].oam.affineMode = 1;
gSprites[spriteID].oam.matrixNum = 31;
gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet1;
}
}
static void SpriteCB_PreEvoSparkleSet2(struct Sprite* sprite)
{
if (sprite->pos1.y < 88)
{
sprite->pos1.y = 8 + (sprite->data7 * sprite->data7) / 5;
sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5) / 4;
sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5);
sprite->data5 = 8 + Sin((u8)(sprite->data7 * 4), 40);
sprite->data7++;
}
else
DestroySprite(sprite);
}
static void CreatePreEvoSparkleSet2(u8 arg0)
{
u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 8, 0);
if (spriteID != MAX_SPRITES)
{
gSprites[spriteID].data5 = 8;
gSprites[spriteID].data6 = arg0;
gSprites[spriteID].data7 = 0;
gSprites[spriteID].oam.affineMode = 1;
gSprites[spriteID].oam.matrixNum = 25;
gSprites[spriteID].subpriority = 1;
gSprites[spriteID].callback = SpriteCB_PreEvoSparkleSet2;
}
}
static void SpriteCB_PostEvoSparkleSet1(struct Sprite* sprite)
{
if (sprite->data5 > 8)
{
sprite->pos2.y = Sin((u8)(sprite->data6), sprite->data5);
sprite->pos2.x = Cos((u8)(sprite->data6), sprite->data5);
sprite->data5 -= sprite->data3;
sprite->data6 += 4;
}
else
DestroySprite(sprite);
}
static void CreatePostEvoSparkleSet1(u8 arg0, u8 arg1)
{
u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0);
if (spriteID != MAX_SPRITES)
{
gSprites[spriteID].data3 = arg1;
gSprites[spriteID].data5 = 120;
gSprites[spriteID].data6 = arg0;
gSprites[spriteID].data7 = 0;
gSprites[spriteID].oam.affineMode = 1;
gSprites[spriteID].oam.matrixNum = 31;
gSprites[spriteID].subpriority = 1;
gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet1;
}
}
static void SpriteCB_PostEvoSparkleSet2(struct Sprite* sprite)
{
if (!(sprite->data7 & 3))
sprite->pos1.y++;
if (sprite->data6 < 128)
{
u8 matrixNum;
sprite->pos2.y = -Sin((u8)(sprite->data6), sprite->data5);
sprite->pos1.x = 120 + (sprite->data3 * sprite->data7) / 3;
sprite->data6++;
matrixNum = 31 - (sprite->data6 * 12 / 128);
if (sprite->data6 > 64)
sprite->subpriority = 1;
else
{
sprite->invisible = 0;
sprite->subpriority = 20;
if (sprite->data6 > 112 && sprite->data6 & 1)
sprite->invisible = 1;
}
if (matrixNum < 20)
matrixNum = 20;
sprite->oam.matrixNum = matrixNum;
sprite->data7++;
}
else
DestroySprite(sprite);
}
static void CreatePostEvoSparkleSet2(u8 arg0)
{
u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0);
if (spriteID != MAX_SPRITES)
{
gSprites[spriteID].data3 = 3 - (Random() % 7);
gSprites[spriteID].data5 = 48 + (Random() & 0x3F);
gSprites[spriteID].data7 = 0;
gSprites[spriteID].oam.affineMode = 1;
gSprites[spriteID].oam.matrixNum = 31;
gSprites[spriteID].subpriority = 20;
gSprites[spriteID].callback = SpriteCB_PostEvoSparkleSet2;
}
}
void LoadEvoSparkleSpriteAndPal(void)
{
LoadCompressedObjectPicUsingHeap(&sEvoSparkleSpriteSheets[0]);
LoadSpritePalettes(sEvoSparkleSpritePals);
}
#define tFrameCounter data[15]
u8 LaunchTask_PreEvoSparklesSet1(u16 arg0)
{
u8 taskID = CreateTask(EvoTask_BeginPreSet1_FadeAndPlaySE, 0);
gTasks[taskID].data[1] = arg0;
return taskID;
}
static void EvoTask_BeginPreSet1_FadeAndPlaySE(u8 taskID)
{
SetEvoSparklesMatrices();
gTasks[taskID].tFrameCounter = 0;
BeginNormalPaletteFade(3 << gTasks[taskID].data[1], 0xA, 0, 0x10, 0x7FFF);
gTasks[taskID].func = EvoTask_CreatePreEvoSparkleSet1;
PlaySE(SE_W025);
}
static void EvoTask_CreatePreEvoSparkleSet1(u8 taskID)
{
if (gTasks[taskID].tFrameCounter < 64)
{
if (!(gTasks[taskID].tFrameCounter & 7))
{
u8 i;
for (i = 0; i < 4; i++)
CreatePreEvoSparkleSet1((0x78 & gTasks[taskID].tFrameCounter) * 2 + i * 64);
}
gTasks[taskID].tFrameCounter++;
}
else
{
gTasks[taskID].tFrameCounter = 96;
gTasks[taskID].func = EvoTask_WaitForPre1SparklesToGoUp;
}
}
static void EvoTask_WaitForPre1SparklesToGoUp(u8 taskID)
{
if (gTasks[taskID].tFrameCounter != 0)
gTasks[taskID].tFrameCounter--;
else
DestroyTask(taskID);
}
u8 LaunchTask_PreEvoSparklesSet2(void)
{
return CreateTask(EvoTask_BeginPreSparklesSet2, 0);
}
static void EvoTask_BeginPreSparklesSet2(u8 taskID)
{
SetEvoSparklesMatrices();
gTasks[taskID].tFrameCounter = 0;
gTasks[taskID].func = EvoTask_CreatePreEvoSparklesSet2;
PlaySE(SE_W062B);
}
static void EvoTask_CreatePreEvoSparklesSet2(u8 taskID)
{
if (gTasks[taskID].tFrameCounter < 96)
{
if (gTasks[taskID].tFrameCounter < 6)
{
u8 i;
for (i = 0; i < 9; i++)
CreatePreEvoSparkleSet2(i * 16);
}
gTasks[taskID].tFrameCounter++;
}
else
gTasks[taskID].func = EvoTask_DestroyPreSet2Task;
}
static void EvoTask_DestroyPreSet2Task(u8 taskID)
{
DestroyTask(taskID);
}
u8 LaunchTask_PostEvoSparklesSet1(void)
{
return CreateTask(EvoTask_BeginPostSparklesSet1, 0);
}
static void EvoTask_BeginPostSparklesSet1(u8 taskID)
{
SetEvoSparklesMatrices();
gTasks[taskID].tFrameCounter = 0;
gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet1;
PlaySE(SE_REAPOKE);
}
static void EvoTask_CreatePostEvoSparklesSet1(u8 taskID)
{
if (gTasks[taskID].tFrameCounter < 48)
{
if (gTasks[taskID].tFrameCounter == 0)
{
u8 i;
for (i = 0; i < 16; i++)
CreatePostEvoSparkleSet1(i * 16, 4);
}
if (gTasks[taskID].tFrameCounter == 32)
{
u8 i;
for (i = 0; i < 16; i++)
CreatePostEvoSparkleSet1(i * 16, 8);
}
gTasks[taskID].tFrameCounter++;
}
else
gTasks[taskID].func = EvoTask_DestroyPostSet1Task;
}
static void EvoTask_DestroyPostSet1Task(u8 taskID)
{
DestroyTask(taskID);
}
u8 LaunchTask_PostEvoSparklesSet2AndFlash(u16 species)
{
u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash, 0);
gTasks[taskID].data[2] = species;
return taskID;
}
static void EvoTask_BeginPostSparklesSet2_AndFlash(u8 taskID)
{
SetEvoSparklesMatrices();
gTasks[taskID].tFrameCounter = 0;
CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30);
BeginNormalPaletteFade(0xFFF9041C, 0, 0, 0x10, 0x7FFF); // was 0xFFF9001C in R/S
gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash;
PlaySE(SE_W080);
}
static void EvoTask_CreatePostEvoSparklesSet2_AndFlash(u8 taskID)
{
if (gTasks[taskID].tFrameCounter < 128)
{
u8 i;
switch (gTasks[taskID].tFrameCounter)
{
default:
if (gTasks[taskID].tFrameCounter < 50)
CreatePostEvoSparkleSet2(Random() & 7);
break;
case 0:
for (i = 0; i < 8; i++)
CreatePostEvoSparkleSet2(i);
break;
case 32:
BeginNormalPaletteFade(0xFFFF041C, 0x10, 0x10, 0, 0x7FFF); // was 0xFFF9001C in R/S
break;
}
gTasks[taskID].tFrameCounter++;
}
else
gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask;
}
static void EvoTask_DestroyPostSet2AndFlashTask(u8 taskID)
{
if (!gPaletteFade.active)
DestroyTask(taskID);
}
u8 LaunchTask_PostEvoSparklesSet2AndFlash_Trade(u16 species)
{
u8 taskID = CreateTask(EvoTask_BeginPostSparklesSet2_AndFlash_Trade, 0);
gTasks[taskID].data[2] = species;
return taskID;
}
static void EvoTask_BeginPostSparklesSet2_AndFlash_Trade(u8 taskID)
{
SetEvoSparklesMatrices();
gTasks[taskID].tFrameCounter = 0;
CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30);
BeginNormalPaletteFade(0xFFF90400, 0, 0, 0x10, 0x7FFF); // was 0xFFFF0001 in R/S
gTasks[taskID].func = EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade;
PlaySE(SE_W080);
}
static void EvoTask_CreatePostEvoSparklesSet2_AndFlash_Trade(u8 taskID)
{
if (gTasks[taskID].tFrameCounter < 128)
{
u8 i;
switch (gTasks[taskID].tFrameCounter)
{
default:
if (gTasks[taskID].tFrameCounter < 50)
CreatePostEvoSparkleSet2(Random() & 7);
break;
case 0:
for (i = 0; i < 8; i++)
CreatePostEvoSparkleSet2(i);
break;
case 32:
BeginNormalPaletteFade(0xFFFF0400, 0x10, 0x10, 0, 0x7FFF); // was 0xFFFF0001 in R/S
break;
}
gTasks[taskID].tFrameCounter++;
}
else
gTasks[taskID].func = EvoTask_DestroyPostSet2AndFlashTask;
}
#undef tFrameCounter
static void PokeEvoSprite_DummySpriteCB(struct Sprite* sprite)
{
}
#define tPreEvoSpriteID data[1]
#define tPostEvoSpriteID data[2]
#define tEvoStopped data[8]
u8 sub_817C3A0(u8 preEvoSpriteID, u8 postEvoSpriteID)
{
u16 i;
u16 stack[16];
u8 taskID;
s32 toDiv;
for (i = 0; i < 16; i++)
stack[i] = 0x7FFF;
taskID = CreateTask(sub_817C4EC, 0);
gTasks[taskID].tPreEvoSpriteID = preEvoSpriteID;
gTasks[taskID].tPostEvoSpriteID = postEvoSpriteID;
gTasks[taskID].data[3] = 256;
gTasks[taskID].data[4] = 16;
toDiv = 65536;
SetOamMatrix(30, 256, 0, 0, 256);
SetOamMatrix(31, toDiv / gTasks[taskID].data[4], 0, 0, toDiv / gTasks[taskID].data[4]);
gSprites[preEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB;
gSprites[preEvoSpriteID].oam.affineMode = 1;
gSprites[preEvoSpriteID].oam.matrixNum = 30;
gSprites[preEvoSpriteID].invisible = 0;
CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[preEvoSpriteID].oam.paletteNum * 16)], 16);
gSprites[postEvoSpriteID].callback = PokeEvoSprite_DummySpriteCB;
gSprites[postEvoSpriteID].oam.affineMode = 1;
gSprites[postEvoSpriteID].oam.matrixNum = 31;
gSprites[postEvoSpriteID].invisible = 0;
CpuSet(stack, &gPlttBufferFaded[0x100 + (gSprites[postEvoSpriteID].oam.paletteNum * 16)], 16);
gTasks[taskID].tEvoStopped = FALSE;
return taskID;
}
static void sub_817C4EC(u8 taskID)
{
gTasks[taskID].data[5] = 0;
gTasks[taskID].data[6] = 8;
gTasks[taskID].func = sub_817C510;
}
static void sub_817C510(u8 taskID)
{
if (gTasks[taskID].tEvoStopped)
PreEvoVisible_PostEvoInvisible_KillTask(taskID);
else if (gTasks[taskID].data[6] == 128)
PreEvoInvisible_PostEvoVisible_KillTask(taskID);
else
{
gTasks[taskID].data[6] += 2;
gTasks[taskID].data[5] ^= 1;
gTasks[taskID].func = sub_817C560;
}
}
static void sub_817C560(u8 taskID)
{
if (gTasks[taskID].tEvoStopped)
gTasks[taskID].func = PreEvoVisible_PostEvoInvisible_KillTask;
else
{
u16 oamMatrixArg;
u8 r6 = 0;
if (gTasks[taskID].data[5] == 0)
{
if (gTasks[taskID].data[3] < 256 - gTasks[taskID].data[6])
gTasks[taskID].data[3] += gTasks[taskID].data[6];
else
{
gTasks[taskID].data[3] = 256;
r6++;
}
if (gTasks[taskID].data[4] > 16 + gTasks[taskID].data[6])
gTasks[taskID].data[4] -= gTasks[taskID].data[6];
else
{
gTasks[taskID].data[4] = 16;
r6++;
}
}
else
{
if (gTasks[taskID].data[4] < 256 - gTasks[taskID].data[6])
gTasks[taskID].data[4] += gTasks[taskID].data[6];
else
{
gTasks[taskID].data[4] = 256;
r6++;
}
if (gTasks[taskID].data[3] > 16 + gTasks[taskID].data[6])
gTasks[taskID].data[3] -= gTasks[taskID].data[6];
else
{
gTasks[taskID].data[3] = 16;
r6++;
}
}
oamMatrixArg = 65536 / gTasks[taskID].data[3];
SetOamMatrix(30, oamMatrixArg, 0, 0, oamMatrixArg);
oamMatrixArg = 65536 / gTasks[taskID].data[4];
SetOamMatrix(31, oamMatrixArg, 0, 0, oamMatrixArg);
if (r6 == 2)
gTasks[taskID].func = sub_817C510;
}
}
static void PreEvoInvisible_PostEvoVisible_KillTask(u8 taskID)
{
gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = 0;
gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0;
gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = 1;
gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = 0;
gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0;
gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = 0;
DestroyTask(taskID);
}
static void PreEvoVisible_PostEvoInvisible_KillTask(u8 taskID)
{
gSprites[gTasks[taskID].tPreEvoSpriteID].oam.affineMode = 0;
gSprites[gTasks[taskID].tPreEvoSpriteID].oam.matrixNum = 0;
gSprites[gTasks[taskID].tPreEvoSpriteID].invisible = 0;
gSprites[gTasks[taskID].tPostEvoSpriteID].oam.affineMode = 0;
gSprites[gTasks[taskID].tPostEvoSpriteID].oam.matrixNum = 0;
gSprites[gTasks[taskID].tPostEvoSpriteID].invisible = 1;
DestroyTask(taskID);
}

1506
src/evolution_scene.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1267,10 +1267,10 @@ const struct CompressedSpritePalette *sub_806E794(struct Pokemon *mon)
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0);
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0);
return sub_806E7CC(species, otId, personality);
return GetMonSpritePalStructFromOtIdPersonality(species, otId, personality);
}
const struct CompressedSpritePalette *sub_806E7CC(u16 species, u32 otId , u32 personality)
const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality)
{
u32 shinyValue;

View File

@ -370,7 +370,7 @@ gUnknown_030061C4: @ 30061C4
gUnknown_030061D0: @ 30061D0
.space 0x18
gUnknown_030061E8: @ 30061E8
gCB2_AfterEvolution: @ 30061E8
.space 0x4
gUnknown_030061EC: @ 30061EC

View File

@ -1280,11 +1280,7 @@ gUnknown_0203AB78: @ 203AB78
gUnknown_0203AB7C: @ 203AB7C
.space 0x4
gUnknown_0203AB80: @ 203AB80
.space 0x4
gUnknown_0203AB84: @ 203AB84
.space 0x4
.include "src/evolution_scene.o"
gUnknown_0203AB88: @ 203AB88
.space 0x4