diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 33182e878..11fb01724 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -822,6 +822,7 @@ gBattleAnims_General:: .4byte General_SlideOffScreen @ B_ANIM_SLIDE_OFFSCREEN .4byte General_RestoreBg @ B_ANIM_RESTORE_BG .4byte General_TotemFlare @ B_ANIM_TOTEM_FLARE + .4byte General_StrongWinds @ B_ANIM_STRONG_WINDS .align 2 gBattleAnims_Special:: @@ -24397,6 +24398,30 @@ General_TotemFlare:: clearmonbg ANIM_ATTACKER end +General_StrongWinds:: + loadspritegfx ANIM_TAG_FLYING_DIRT + playsewithpan SE_M_GUST, 0 + createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_FLYING_DIRT, 0, 12, 12, RGB(20, 20, 20) + waitforvisualfinish + createvisualtask AnimTask_LoadWindstormBackground, 5, FALSE + delay 16 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 10, 2304, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 90, 2048, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 50, 2560, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 20, 2304, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 70, 1984, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 0, 2816, 96, 0 + delay 10 + createsprite gFlyingSandCrescentSpriteTemplate, ANIM_ATTACKER, 40, 60, 2560, 96, 0 + waitforvisualfinish + stopsound + end + RainbowEndureEffect: launchtemplate gBlueEndureEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2 delay 0x3 diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ecfddf762..45d654cd6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6933,7 +6933,8 @@ BattleScript_DeltaStreamActivates:: pause B_WAIT_TIME_SHORT call BattleScript_AbilityPopUp printstring STRINGID_MYSTERIOUSAIRCURRENT - waitmessage B_WAIT_TIME_LONG + waitstate + playanimation BS_ATTACKER, B_ANIM_STRONG_WINDS, NULL end3 BattleScript_AttackWeakenedByStrongWinds:: diff --git a/graphics/battle_anims/backgrounds/windstorm_brew.png b/graphics/battle_anims/backgrounds/windstorm_brew.png new file mode 100644 index 000000000..c36e720cf Binary files /dev/null and b/graphics/battle_anims/backgrounds/windstorm_brew.png differ diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index c04bc14f7..4cfcafcd3 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -523,6 +523,7 @@ #define B_ANIM_SLIDE_OFFSCREEN 26 // for Emergency Exit #define B_ANIM_RESTORE_BG 27 // for Terrain Endings #define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare +#define B_ANIM_STRONG_WINDS 29 // special animations table (gBattleAnims_Special) #define B_ANIM_LVL_UP 0 diff --git a/include/graphics.h b/include/graphics.h index dc020c401..6139e90cf 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4697,6 +4697,7 @@ extern const u32 gBattleAnimSpritePal_MagnifyingGlass[]; extern const u32 gBattleAnimSpritePal_BrownOrb[]; extern const u32 gBattleAnimSpritePal_MetalSoundWaves[]; extern const u32 gBattleAnimSpritePal_FlyingDirt[]; +extern const u32 gBattleAnimSpritePal_Windstorm[]; extern const u32 gBattleAnimSpritePal_IcicleSpear[]; extern const u32 gBattleAnimSpritePal_Hail[]; extern const u32 gBattleAnimSpritePal_GlowyRedOrb[]; @@ -5199,6 +5200,9 @@ extern const u16 gSlotMachineReelTimePikachu_Pal[]; extern const u32 gBattleAnimBgTilemap_Sandstorm[]; extern const u32 gBattleAnimBgImage_Sandstorm[]; +extern const u32 gBattleAnimBgTilemap_Windstorm[]; +extern const u32 gBattleAnimBgImage_Windstorm[]; + // Pokedex Area Screen extern const u32 gPokedexAreaScreenAreaUnknown_Gfx[]; extern const u16 gPokedexAreaScreenAreaUnknown_Pal[]; diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 2b93206ca..cce21c84e 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -5,6 +5,8 @@ #include "constants/battle_anim.h" #include "constants/rgb.h" #include "random.h" +#include "gpu_regs.h" +#include "graphics.h" extern const struct SpriteTemplate gFlashingHitSplatSpriteTemplate; @@ -30,7 +32,7 @@ static void AnimUnusedFlashingLight_Step(struct Sprite *); static void AnimSkyAttackBird(struct Sprite *); static void AnimSkyAttackBird_Step(struct Sprite *); static void AnimTask_AnimateGustTornadoPalette_Step(u8); - +static void AnimTask_LoadWindstormBackground_Step(u8 taskId); const struct SpriteTemplate gEllipticalGustSpriteTemplate = { @@ -1231,3 +1233,99 @@ static void AnimTask_SetAttackerVisibility(u8 taskId) } DestroyAnimVisualTask(taskId); } + +void AnimTask_LoadWindstormBackground(u8 taskId) +{ + int var0; + struct BattleAnimBgData animBg; + + var0 = 0; + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16)); + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); + SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0); + + if (!IsContest()) + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1); + + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X); + SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y); + + GetBattleAnimBg1Data(&animBg); + AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Windstorm, animBg.tilesOffset); + AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Windstorm, 0); + LoadCompressedPalette(gBattleAnimSpritePal_Windstorm, animBg.paletteId * 16, 32); + + if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) + var0 = 1; + + gTasks[taskId].data[0] = var0; + gTasks[taskId].func = AnimTask_LoadWindstormBackground_Step; +} + +static void AnimTask_LoadWindstormBackground_Step(u8 taskId) +{ + struct BattleAnimBgData animBg; + + if (gTasks[taskId].data[0] == 0) + gBattle_BG1_X += -6; + else + gBattle_BG1_X += 6; + + gBattle_BG1_Y += -1; + + switch (gTasks[taskId].data[12]) + { + case 0: + if (++gTasks[taskId].data[10] == 4) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11]++; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); + if (gTasks[taskId].data[11] == 7) + { + gTasks[taskId].data[12]++; + gTasks[taskId].data[11] = 0; + } + } + break; + case 1: + if (++gTasks[taskId].data[11] == 101) + { + gTasks[taskId].data[11] = 7; + gTasks[taskId].data[12]++; + } + break; + case 2: + if (++gTasks[taskId].data[10] == 4) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11]--; + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 16 - gTasks[taskId].data[11])); + if (gTasks[taskId].data[11] == 0) + { + gTasks[taskId].data[12]++; + gTasks[taskId].data[11] = 0; + } + } + break; + case 3: + GetBattleAnimBg1Data(&animBg); + ClearBattleAnimBg(animBg.bgId); + gTasks[taskId].data[12]++; + break; + case 4: + if (!IsContest()) + SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0); + + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); + DestroyAnimVisualTask(taskId); + break; + } +} diff --git a/src/graphics.c b/src/graphics.c index 4c648a479..247231d55 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1312,11 +1312,14 @@ const u32 gUnknown_08D85A1C[] = INCBIN_U32("graphics/battle_frontier/battle_tile #include "data/graphics/intro_scene.h" const u32 gBattleAnimSpriteGfx_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.4bpp.lz"); +const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz"); const u32 gBattleAnimBgTilemap_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz"); const u32 gBattleAnimBgImage_Sandstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.4bpp.lz"); -const u32 gBattleAnimSpritePal_FlyingDirt[] = INCBIN_U32("graphics/battle_anims/sprites/flying_dirt.gbapal.lz"); +const u32 gBattleAnimBgTilemap_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/sandstorm_brew.bin.lz"); +const u32 gBattleAnimBgImage_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.4bpp.lz"); +const u32 gBattleAnimSpritePal_Windstorm[] = INCBIN_U32("graphics/battle_anims/backgrounds/windstorm_brew.gbapal.lz"); const u32 gBattleAnimSpriteGfx_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.4bpp.lz"); const u32 gBattleAnimSpritePal_MetalSoundWaves[] = INCBIN_U32("graphics/battle_anims/sprites/metal_sound_waves.gbapal.lz");