2018-10-25 23:46:23 +02:00
|
|
|
#include "global.h"
|
|
|
|
#include "battle_anim.h"
|
2018-11-19 16:28:55 +01:00
|
|
|
#include "contest.h"
|
|
|
|
#include "gpu_regs.h"
|
|
|
|
#include "graphics.h"
|
2019-09-09 03:07:54 +02:00
|
|
|
#include "malloc.h"
|
2018-11-19 16:28:55 +01:00
|
|
|
#include "palette.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "sprite.h"
|
|
|
|
#include "task.h"
|
|
|
|
#include "util.h"
|
2018-10-25 23:46:23 +02:00
|
|
|
#include "constants/rgb.h"
|
2018-11-19 16:28:55 +01:00
|
|
|
#include "constants/songs.h"
|
|
|
|
|
|
|
|
struct AnimStatsChangeData
|
|
|
|
{
|
|
|
|
u8 battler1;
|
|
|
|
u8 battler2;
|
|
|
|
u8 higherPriority;
|
|
|
|
s16 data[8];
|
|
|
|
u16 species;
|
|
|
|
};
|
|
|
|
|
|
|
|
static EWRAM_DATA struct AnimStatsChangeData *sAnimStatsChangeData = {0};
|
|
|
|
|
|
|
|
static void StartBlendAnimSpriteColor(u8, u32);
|
|
|
|
static void AnimTask_BlendSpriteColor_Step2(u8);
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_HardwarePaletteFade_Step(u8);
|
|
|
|
static void AnimTask_TraceMonBlended_Step(u8);
|
|
|
|
static void AnimMonTrace(struct Sprite*);
|
|
|
|
static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8);
|
2021-02-28 00:41:30 +01:00
|
|
|
static void StatsChangeAnimation_Step1(u8);
|
|
|
|
static void StatsChangeAnimation_Step2(u8);
|
|
|
|
static void StatsChangeAnimation_Step3(u8);
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_Flash_Step(u8);
|
2021-02-28 00:41:30 +01:00
|
|
|
static void SetPalettesToColor(u32, u16);
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_UpdateSlidingBg(u8);
|
2021-02-28 00:41:30 +01:00
|
|
|
static void UpdateMonScrollingBgMask(u8);
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_WaitAndRestoreVisibility(u8);
|
2018-10-25 23:46:23 +02:00
|
|
|
|
2021-02-28 16:47:03 +01:00
|
|
|
static const u16 sCurseLinesPalette[] = { RGB_WHITE };
|
2018-10-25 23:46:23 +02:00
|
|
|
|
2021-01-23 05:22:37 +01:00
|
|
|
// These belong in battle_intro.c, but putting them there causes 2 bytes of alignment padding
|
2018-12-13 06:18:25 +01:00
|
|
|
// between the two .rodata segments. Perhaps battle_intro.c actually belongs in this file, too.
|
2021-01-23 05:22:37 +01:00
|
|
|
const u8 gBattleAnimBgCntSet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT};
|
|
|
|
const u8 gBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT};
|
2018-11-19 16:28:55 +01:00
|
|
|
|
2020-02-16 23:49:24 +01:00
|
|
|
void AnimTask_BlendBattleAnimPal(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]);
|
|
|
|
selectedPalettes |= GetBattleMonSpritePalettesMask((gBattleAnimArgs[0] >> 7) & 1,
|
2018-11-19 16:28:55 +01:00
|
|
|
(gBattleAnimArgs[0] >> 8) & 1,
|
|
|
|
(gBattleAnimArgs[0] >> 9) & 1,
|
|
|
|
(gBattleAnimArgs[0] >> 10) & 1);
|
|
|
|
StartBlendAnimSpriteColor(taskId, selectedPalettes);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_BlendBattleAnimPalExclude(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u8 battler;
|
|
|
|
u32 selectedPalettes;
|
|
|
|
u8 animBattlers[2];
|
|
|
|
|
|
|
|
animBattlers[1] = 0xFF;
|
2021-02-28 00:41:30 +01:00
|
|
|
selectedPalettes = UnpackSelectedBattleBgPalettes(1);
|
2018-11-19 16:28:55 +01:00
|
|
|
switch (gBattleAnimArgs[0])
|
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
selectedPalettes = 0;
|
|
|
|
// fall through
|
2020-02-20 06:04:42 +01:00
|
|
|
case ANIM_ATTACKER:
|
2018-11-19 16:28:55 +01:00
|
|
|
animBattlers[0] = gBattleAnimAttacker;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
selectedPalettes = 0;
|
|
|
|
// fall through
|
2020-02-20 06:04:42 +01:00
|
|
|
case ANIM_TARGET:
|
2018-11-19 16:28:55 +01:00
|
|
|
animBattlers[0] = gBattleAnimTarget;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
animBattlers[0] = gBattleAnimAttacker;
|
|
|
|
animBattlers[1] = gBattleAnimTarget;
|
|
|
|
break;
|
|
|
|
case 5:
|
2018-12-05 15:31:01 +01:00
|
|
|
animBattlers[0] = 0xFF;
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
selectedPalettes = 0;
|
|
|
|
animBattlers[0] = BATTLE_PARTNER(gBattleAnimAttacker);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
selectedPalettes = 0;
|
|
|
|
animBattlers[0] = BATTLE_PARTNER(gBattleAnimTarget);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
|
|
|
|
{
|
|
|
|
if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler))
|
2021-01-23 06:40:46 +01:00
|
|
|
selectedPalettes |= 0x10000 << AnimDummyReturnArg(battler);
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
StartBlendAnimSpriteColor(taskId, selectedPalettes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_SetCamouflageBlend(u8 taskId)
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]);
|
2018-11-19 16:28:55 +01:00
|
|
|
switch (gBattleTerrain)
|
|
|
|
{
|
|
|
|
case BATTLE_TERRAIN_GRASS:
|
|
|
|
gBattleAnimArgs[4] = RGB(12, 24, 2);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_LONG_GRASS:
|
|
|
|
gBattleAnimArgs[4] = RGB(0, 15, 2);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_SAND:
|
|
|
|
gBattleAnimArgs[4] = RGB(30, 24, 11);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_UNDERWATER:
|
|
|
|
gBattleAnimArgs[4] = RGB(0, 0, 18);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_WATER:
|
|
|
|
gBattleAnimArgs[4] = RGB(11, 22, 31);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_POND:
|
|
|
|
gBattleAnimArgs[4] = RGB(11, 22, 31);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_MOUNTAIN:
|
|
|
|
gBattleAnimArgs[4] = RGB(22, 16, 10);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_CAVE:
|
|
|
|
gBattleAnimArgs[4] = RGB(14, 9, 3);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_BUILDING:
|
|
|
|
gBattleAnimArgs[4] = RGB(31, 31, 31);
|
|
|
|
break;
|
|
|
|
case BATTLE_TERRAIN_PLAIN:
|
|
|
|
gBattleAnimArgs[4] = RGB(31, 31, 31);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
StartBlendAnimSpriteColor(taskId, selectedPalettes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_BlendParticle(u8 taskId)
|
|
|
|
{
|
|
|
|
u8 paletteIndex = IndexOfSpritePaletteTag(gBattleAnimArgs[0]);
|
|
|
|
u32 selectedPalettes = 1 << (paletteIndex + 16);
|
|
|
|
StartBlendAnimSpriteColor(taskId, selectedPalettes);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StartBlendAnimSpriteColor(u8 taskId, u32 selectedPalettes)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[0] = selectedPalettes;
|
|
|
|
gTasks[taskId].data[1] = selectedPalettes >> 16;
|
|
|
|
gTasks[taskId].data[2] = gBattleAnimArgs[1];
|
|
|
|
gTasks[taskId].data[3] = gBattleAnimArgs[2];
|
|
|
|
gTasks[taskId].data[4] = gBattleAnimArgs[3];
|
|
|
|
gTasks[taskId].data[5] = gBattleAnimArgs[4];
|
|
|
|
gTasks[taskId].data[10] = gBattleAnimArgs[2];
|
|
|
|
gTasks[taskId].func = AnimTask_BlendSpriteColor_Step2;
|
|
|
|
gTasks[taskId].func(taskId);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void AnimTask_BlendSpriteColor_Step2(u8 taskId)
|
|
|
|
{
|
|
|
|
u32 selectedPalettes;
|
|
|
|
u16 singlePaletteMask = 0;
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[9] == gTasks[taskId].data[2])
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[9] = 0;
|
|
|
|
selectedPalettes = gTasks[taskId].data[0] | (gTasks[taskId].data[1] << 16);
|
|
|
|
while (selectedPalettes != 0)
|
|
|
|
{
|
|
|
|
if (selectedPalettes & 1)
|
|
|
|
BlendPalette(singlePaletteMask, 16, gTasks[taskId].data[10], gTasks[taskId].data[5]);
|
|
|
|
singlePaletteMask += 0x10;
|
|
|
|
selectedPalettes >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[10] < gTasks[taskId].data[4])
|
|
|
|
gTasks[taskId].data[10]++;
|
|
|
|
else if (gTasks[taskId].data[10] > gTasks[taskId].data[4])
|
|
|
|
gTasks[taskId].data[10]--;
|
|
|
|
else
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[9]++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
void AnimTask_HardwarePaletteFade(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
BeginHardwarePaletteFade(
|
|
|
|
gBattleAnimArgs[0],
|
|
|
|
gBattleAnimArgs[1],
|
|
|
|
gBattleAnimArgs[2],
|
|
|
|
gBattleAnimArgs[3],
|
|
|
|
gBattleAnimArgs[4]);
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
gTasks[taskId].func = AnimTask_HardwarePaletteFade_Step;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_HardwarePaletteFade_Step(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
if (!gPaletteFade.active)
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
// Used to leave blended traces of a mon, usually to imply speed as in Agility or Aerial Ace
|
|
|
|
void AnimTask_TraceMonBlended(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
task->data[0] = gBattleAnimArgs[0];
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = gBattleAnimArgs[1];
|
|
|
|
task->data[3] = gBattleAnimArgs[2];
|
|
|
|
task->data[4] = gBattleAnimArgs[3];
|
|
|
|
task->data[5] = 0;
|
2020-02-22 00:22:18 +01:00
|
|
|
task->func = AnimTask_TraceMonBlended_Step;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_TraceMonBlended_Step(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
if (task->data[4])
|
|
|
|
{
|
|
|
|
if (task->data[1])
|
|
|
|
{
|
|
|
|
task->data[1]--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-12-18 05:08:08 +01:00
|
|
|
task->data[6] = CloneBattlerSpriteWithBlend(task->data[0]);
|
2018-11-19 16:28:55 +01:00
|
|
|
if (task->data[6] >= 0)
|
|
|
|
{
|
|
|
|
gSprites[task->data[6]].oam.priority = task->data[0] ? 1 : 2;
|
|
|
|
gSprites[task->data[6]].data[0] = task->data[3];
|
|
|
|
gSprites[task->data[6]].data[1] = taskId;
|
|
|
|
gSprites[task->data[6]].data[2] = 5;
|
2020-02-22 00:22:18 +01:00
|
|
|
gSprites[task->data[6]].callback = AnimMonTrace;
|
2018-11-19 16:28:55 +01:00
|
|
|
task->data[5]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
task->data[4]--;
|
|
|
|
task->data[1] = task->data[2];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (task->data[5] == 0)
|
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimMonTrace(struct Sprite *sprite)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
if (sprite->data[0])
|
|
|
|
{
|
|
|
|
sprite->data[0]--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[sprite->data[1]].data[sprite->data[2]]--;
|
|
|
|
obj_delete_but_dont_free_vram(sprite);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
// Only used by Curse for non-Ghost mons
|
|
|
|
void AnimTask_DrawFallingWhiteLinesOnAttacker(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u16 species;
|
|
|
|
int spriteId, newSpriteId;
|
|
|
|
u16 var0;
|
|
|
|
u16 bg1Cnt;
|
2021-02-28 00:41:30 +01:00
|
|
|
struct BattleAnimBgData animBgData;
|
2018-11-19 16:28:55 +01:00
|
|
|
|
|
|
|
var0 = 0;
|
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
|
|
|
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
|
|
|
|
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
|
|
|
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 12));
|
|
|
|
bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
|
|
|
|
((struct BgCnt *)&bg1Cnt)->priority = 0;
|
|
|
|
((struct BgCnt *)&bg1Cnt)->screenSize = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
|
|
|
|
|
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
((struct BgCnt *)&bg1Cnt)->charBaseBlock = 1;
|
|
|
|
SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsDoubleBattle() && !IsContest())
|
|
|
|
{
|
|
|
|
if (GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_OPPONENT_RIGHT
|
|
|
|
|| GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_PLAYER_LEFT)
|
|
|
|
{
|
|
|
|
if (IsBattlerSpriteVisible(BATTLE_PARTNER(gBattleAnimAttacker)) == TRUE)
|
|
|
|
{
|
|
|
|
gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority -= 1;
|
|
|
|
((struct BgCnt *)&bg1Cnt)->priority = 1;
|
|
|
|
SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
|
|
|
|
var0 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsContest())
|
|
|
|
{
|
2020-08-14 01:10:23 +02:00
|
|
|
species = gContestResources->moveAnim->species;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_SPECIES);
|
|
|
|
else
|
|
|
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimAttacker]], MON_DATA_SPECIES);
|
|
|
|
}
|
|
|
|
|
2020-02-20 22:22:33 +01:00
|
|
|
spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER);
|
2021-02-28 00:41:30 +01:00
|
|
|
newSpriteId = CreateInvisibleSpriteCopy(gBattleAnimAttacker, spriteId, species);
|
|
|
|
GetBattleAnimBg1Data(&animBgData);
|
|
|
|
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleAnimMaskTilemap_Curse, 0);
|
|
|
|
AnimLoadCompressedBgGfx(animBgData.bgId, gBattleAnimMaskImage_Curse, animBgData.tilesOffset);
|
2021-02-28 16:47:03 +01:00
|
|
|
LoadPalette(sCurseLinesPalette, animBgData.paletteId * 16 + 1, 2);
|
2018-11-19 16:28:55 +01:00
|
|
|
|
2021-07-07 15:11:52 +02:00
|
|
|
gBattle_BG1_X = -gSprites[spriteId].x + 32;
|
|
|
|
gBattle_BG1_Y = -gSprites[spriteId].y + 32;
|
2018-11-19 16:28:55 +01:00
|
|
|
gTasks[taskId].data[0] = newSpriteId;
|
|
|
|
gTasks[taskId].data[6] = var0;
|
2020-02-22 00:22:18 +01:00
|
|
|
gTasks[taskId].func = AnimTask_DrawFallingWhiteLinesOnAttacker_Step;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_DrawFallingWhiteLinesOnAttacker_Step(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
struct BattleAnimBgData animBgData;
|
2018-11-19 16:28:55 +01:00
|
|
|
struct Sprite *sprite;
|
|
|
|
u16 bg1Cnt;
|
|
|
|
|
|
|
|
gTasks[taskId].data[10] += 4;
|
|
|
|
gBattle_BG1_Y -= 4;
|
|
|
|
if (gTasks[taskId].data[10] == 64)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] = 0;
|
|
|
|
gBattle_BG1_Y += 64;
|
|
|
|
if (++gTasks[taskId].data[11] == 4)
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
ResetBattleAnimBg(0);
|
2018-11-19 16:28:55 +01:00
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
|
|
|
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
|
|
|
|
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
|
|
|
|
((struct BgCnt *)&bg1Cnt)->charBaseBlock = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
sprite = &gSprites[GetAnimBattlerSpriteId(0)]; // unused
|
|
|
|
sprite = &gSprites[gTasks[taskId].data[0]];
|
|
|
|
DestroySprite(sprite);
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
GetBattleAnimBg1Data(&animBgData);
|
|
|
|
ClearBattleAnimBg(animBgData.bgId);
|
2018-11-19 16:28:55 +01:00
|
|
|
if (gTasks[taskId].data[6] == 1)
|
|
|
|
gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++;
|
|
|
|
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
void InitStatsChangeAnimation(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
|
|
|
sAnimStatsChangeData = AllocZeroed(sizeof(struct AnimStatsChangeData));
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
sAnimStatsChangeData->data[i] = gBattleAnimArgs[i];
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
gTasks[taskId].func = StatsChangeAnimation_Step1;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
static void StatsChangeAnimation_Step1(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
if (sAnimStatsChangeData->data[2] == 0)
|
|
|
|
sAnimStatsChangeData->battler1 = gBattleAnimAttacker;
|
|
|
|
else
|
|
|
|
sAnimStatsChangeData->battler1 = gBattleAnimTarget;
|
|
|
|
|
|
|
|
sAnimStatsChangeData->battler2 = BATTLE_PARTNER(sAnimStatsChangeData->battler1);
|
|
|
|
if (IsContest() || (sAnimStatsChangeData->data[3] && !IsBattlerSpriteVisible(sAnimStatsChangeData->battler2)))
|
|
|
|
sAnimStatsChangeData->data[3] = 0;
|
|
|
|
|
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
|
|
|
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
|
|
|
|
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
|
|
|
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
|
|
|
|
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, 0);
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_SCREEN_SIZE, 0);
|
|
|
|
if (!IsContest())
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 1);
|
|
|
|
|
|
|
|
if (IsDoubleBattle() && sAnimStatsChangeData->data[3] == 0)
|
|
|
|
{
|
|
|
|
if (GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_OPPONENT_RIGHT
|
|
|
|
|| GetBattlerPosition(sAnimStatsChangeData->battler1) == B_POSITION_PLAYER_LEFT)
|
|
|
|
{
|
|
|
|
if (IsBattlerSpriteVisible(sAnimStatsChangeData->battler2) == TRUE)
|
|
|
|
{
|
|
|
|
gSprites[gBattlerSpriteIds[sAnimStatsChangeData->battler2]].oam.priority -= 1;
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1);
|
|
|
|
sAnimStatsChangeData->higherPriority = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsContest())
|
|
|
|
{
|
2020-08-14 01:10:23 +02:00
|
|
|
sAnimStatsChangeData->species = gContestResources->moveAnim->species;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(sAnimStatsChangeData->battler1) != B_SIDE_PLAYER)
|
|
|
|
sAnimStatsChangeData->species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[sAnimStatsChangeData->battler1]], MON_DATA_SPECIES);
|
|
|
|
else
|
|
|
|
sAnimStatsChangeData->species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[sAnimStatsChangeData->battler1]], MON_DATA_SPECIES);
|
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
gTasks[taskId].func = StatsChangeAnimation_Step2;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
static void StatsChangeAnimation_Step2(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
struct BattleAnimBgData animBgData;
|
2018-11-19 16:28:55 +01:00
|
|
|
u8 spriteId, spriteId2;
|
|
|
|
u8 battlerSpriteId;
|
|
|
|
|
|
|
|
spriteId2 = 0;
|
|
|
|
battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler1];
|
2021-02-28 00:41:30 +01:00
|
|
|
spriteId = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler1, battlerSpriteId, sAnimStatsChangeData->species);
|
2018-11-19 16:28:55 +01:00
|
|
|
if (sAnimStatsChangeData->data[3])
|
|
|
|
{
|
|
|
|
battlerSpriteId = gBattlerSpriteIds[sAnimStatsChangeData->battler2];
|
2021-02-28 00:41:30 +01:00
|
|
|
spriteId2 = CreateInvisibleSpriteCopy(sAnimStatsChangeData->battler2, battlerSpriteId, sAnimStatsChangeData->species);
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
GetBattleAnimBg1Data(&animBgData);
|
2018-11-19 16:28:55 +01:00
|
|
|
if (sAnimStatsChangeData->data[0] == 0)
|
2021-02-28 00:41:30 +01:00
|
|
|
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask1_Tilemap, 0);
|
2018-11-19 16:28:55 +01:00
|
|
|
else
|
2021-02-28 00:41:30 +01:00
|
|
|
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleStatMask2_Tilemap, 0);
|
2018-11-19 16:28:55 +01:00
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
AnimLoadCompressedBgGfx(animBgData.bgId, gBattleStatMask_Gfx, animBgData.tilesOffset);
|
2018-11-19 16:28:55 +01:00
|
|
|
switch (sAnimStatsChangeData->data[1])
|
|
|
|
{
|
|
|
|
case 0:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask2_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
case 1:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask1_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
case 2:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask3_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
case 3:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask4_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
case 4:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask6_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
case 5:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask7_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
case 6:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask8_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
default:
|
2021-02-28 00:41:30 +01:00
|
|
|
LoadCompressedPalette(gBattleStatMask5_Pal, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gBattle_BG1_X = 0;
|
|
|
|
gBattle_BG1_Y = 0;
|
|
|
|
|
|
|
|
if (sAnimStatsChangeData->data[0] == 1)
|
|
|
|
{
|
|
|
|
gBattle_BG1_X = 64;
|
|
|
|
gTasks[taskId].data[1] = -3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[1] = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sAnimStatsChangeData->data[4] == 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[4] = 10;
|
|
|
|
gTasks[taskId].data[5] = 20;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[4] = 13;
|
|
|
|
gTasks[taskId].data[5] = 30;
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[taskId].data[0] = spriteId;
|
|
|
|
gTasks[taskId].data[2] = sAnimStatsChangeData->data[3];
|
|
|
|
gTasks[taskId].data[3] = spriteId2;
|
|
|
|
gTasks[taskId].data[6] = sAnimStatsChangeData->higherPriority;
|
|
|
|
gTasks[taskId].data[7] = gBattlerSpriteIds[sAnimStatsChangeData->battler2];
|
2021-02-28 00:41:30 +01:00
|
|
|
gTasks[taskId].func = StatsChangeAnimation_Step3;
|
2018-11-19 16:28:55 +01:00
|
|
|
|
|
|
|
if (sAnimStatsChangeData->data[0] == 0)
|
2020-08-21 00:02:00 +02:00
|
|
|
PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(-64));
|
2018-11-19 16:28:55 +01:00
|
|
|
else
|
2020-08-21 00:02:00 +02:00
|
|
|
PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(-64));
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
static void StatsChangeAnimation_Step3(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
gBattle_BG1_Y += gTasks[taskId].data[1];
|
|
|
|
|
|
|
|
switch (gTasks[taskId].data[15])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (gTasks[taskId].data[11]++ > 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[11] = 0;
|
|
|
|
gTasks[taskId].data[12]++;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
|
|
|
|
if (gTasks[taskId].data[12] == gTasks[taskId].data[4])
|
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++gTasks[taskId].data[10] == gTasks[taskId].data[5])
|
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (gTasks[taskId].data[11]++ > 0)
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[11] = 0;
|
|
|
|
gTasks[taskId].data[12]--;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
|
|
|
|
if (gTasks[taskId].data[12] == 0)
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
ResetBattleAnimBg(0);
|
2020-07-28 01:17:34 +02:00
|
|
|
gTasks[taskId].data[15]++;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
|
|
|
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
|
|
|
|
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
|
|
|
|
|
|
|
if (!IsContest())
|
|
|
|
SetAnimBgAttribute(1, BG_ANIM_CHAR_BASE_BLOCK, 0);
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
DestroySprite(&gSprites[gTasks[taskId].data[0]]);
|
|
|
|
if (gTasks[taskId].data[2])
|
|
|
|
DestroySprite(&gSprites[gTasks[taskId].data[3]]);
|
|
|
|
|
|
|
|
if (gTasks[taskId].data[6] == 1)
|
|
|
|
gSprites[gTasks[taskId].data[7]].oam.priority++;
|
|
|
|
|
|
|
|
Free(sAnimStatsChangeData);
|
|
|
|
sAnimStatsChangeData = NULL;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
void AnimTask_Flash(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
u32 selectedPalettes = GetBattleMonSpritePalettesMask(1, 1, 1, 1);
|
|
|
|
SetPalettesToColor(selectedPalettes, RGB_BLACK);
|
2018-11-19 16:28:55 +01:00
|
|
|
gTasks[taskId].data[14] = selectedPalettes >> 16;
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF;
|
|
|
|
SetPalettesToColor(selectedPalettes, RGB_WHITEALPHA);
|
2018-11-19 16:28:55 +01:00
|
|
|
gTasks[taskId].data[15] = selectedPalettes;
|
|
|
|
|
|
|
|
gTasks[taskId].data[0] = 0;
|
|
|
|
gTasks[taskId].data[1] = 0;
|
2020-02-22 00:22:18 +01:00
|
|
|
gTasks[taskId].func = AnimTask_Flash_Step;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_Flash_Step(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
struct Task *task = &gTasks[taskId];
|
|
|
|
|
|
|
|
switch (task->data[0])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (++task->data[1] > 6)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2] = 16;
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++task->data[1] > 1)
|
|
|
|
{
|
|
|
|
task->data[1] = 0;
|
|
|
|
task->data[2]--;
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++)
|
|
|
|
{
|
|
|
|
if ((task->data[15] >> i) & 1)
|
|
|
|
{
|
|
|
|
u16 paletteOffset = i * 16;
|
|
|
|
BlendPalette(paletteOffset, 16, task->data[2], 0xFFFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((task->data[14] >> i) & 1)
|
|
|
|
{
|
|
|
|
u16 paletteOffset = i * 16 + 0x100;
|
|
|
|
BlendPalette(paletteOffset, 16, task->data[2], 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (task->data[2] == 0)
|
|
|
|
task->data[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
static void SetPalettesToColor(u32 selectedPalettes, u16 color)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
|
|
|
for (i = 0; i < 32; i++)
|
|
|
|
{
|
|
|
|
if (selectedPalettes & 1)
|
|
|
|
{
|
|
|
|
u16 curOffset = i * 16;
|
|
|
|
u16 paletteOffset = curOffset;
|
|
|
|
while (curOffset < paletteOffset + 16)
|
|
|
|
{
|
|
|
|
gPlttBufferFaded[curOffset] = color;
|
|
|
|
curOffset++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
selectedPalettes >>= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-19 19:13:28 +01:00
|
|
|
void AnimTask_BlendNonAttackerPalettes(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u32 battler;
|
|
|
|
int j;
|
|
|
|
u32 selectedPalettes = 0;
|
|
|
|
|
|
|
|
for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
|
|
|
|
{
|
|
|
|
if (gBattleAnimAttacker != battler)
|
|
|
|
selectedPalettes |= 1 << (battler + 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (j = 5; j != 0; j--)
|
|
|
|
gBattleAnimArgs[j] = gBattleAnimArgs[j - 1];
|
|
|
|
|
|
|
|
StartBlendAnimSpriteColor(taskId, selectedPalettes);
|
|
|
|
}
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
void AnimTask_StartSlidingBg(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u8 newTaskId;
|
|
|
|
|
2021-02-27 18:04:45 +01:00
|
|
|
UpdateAnimBg3ScreenSize(FALSE);
|
2020-02-22 00:22:18 +01:00
|
|
|
newTaskId = CreateTask(AnimTask_UpdateSlidingBg, 5);
|
2018-11-19 16:28:55 +01:00
|
|
|
if (gBattleAnimArgs[2] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
|
|
|
|
{
|
|
|
|
gBattleAnimArgs[0] = -gBattleAnimArgs[0];
|
|
|
|
gBattleAnimArgs[1] = -gBattleAnimArgs[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
gTasks[newTaskId].data[1] = gBattleAnimArgs[0];
|
|
|
|
gTasks[newTaskId].data[2] = gBattleAnimArgs[1];
|
|
|
|
gTasks[newTaskId].data[3] = gBattleAnimArgs[3];
|
|
|
|
gTasks[newTaskId].data[0]++;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_UpdateSlidingBg(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].data[10] += gTasks[taskId].data[1];
|
|
|
|
gTasks[taskId].data[11] += gTasks[taskId].data[2];
|
|
|
|
gBattle_BG3_X += gTasks[taskId].data[10] >> 8;
|
|
|
|
gBattle_BG3_Y += gTasks[taskId].data[11] >> 8;
|
|
|
|
gTasks[taskId].data[10] &= 0xFF;
|
|
|
|
gTasks[taskId].data[11] &= 0xFF;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[7] == gTasks[taskId].data[3])
|
|
|
|
{
|
|
|
|
gBattle_BG3_X = 0;
|
|
|
|
gBattle_BG3_Y = 0;
|
2021-02-27 18:04:45 +01:00
|
|
|
UpdateAnimBg3ScreenSize(TRUE);
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_GetAttackerSide(u8 taskId)
|
|
|
|
{
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = GetBattlerSide(gBattleAnimAttacker);
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_GetTargetSide(u8 taskId)
|
|
|
|
{
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = GetBattlerSide(gBattleAnimTarget);
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_GetTargetIsAttackerPartner(u8 taskId)
|
|
|
|
{
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = BATTLE_PARTNER(gBattleAnimAttacker) == gBattleAnimTarget;
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-14 22:05:43 +01:00
|
|
|
// For hiding or subsequently revealing all other battlers
|
2020-02-20 02:22:53 +01:00
|
|
|
void AnimTask_SetAllNonAttackersInvisiblity(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u16 battler;
|
|
|
|
|
|
|
|
for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
|
|
|
|
{
|
|
|
|
if (battler != gBattleAnimAttacker && IsBattlerSpriteVisible(battler))
|
2021-02-28 00:41:30 +01:00
|
|
|
gSprites[gBattlerSpriteIds[battler]].invisible = gBattleAnimArgs[0];
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u16 species;
|
|
|
|
u8 spriteId, spriteId2;
|
|
|
|
u16 bg1Cnt;
|
2021-02-28 00:41:30 +01:00
|
|
|
struct BattleAnimBgData animBgData;
|
2018-11-19 16:28:55 +01:00
|
|
|
u8 battler2;
|
|
|
|
|
|
|
|
spriteId2 = 0;
|
2021-02-28 00:41:30 +01:00
|
|
|
battler2 = BATTLE_PARTNER(battler);
|
2018-11-19 16:28:55 +01:00
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
if (IsContest() || (includePartner && !IsBattlerSpriteVisible(battler2)))
|
|
|
|
includePartner = FALSE;
|
2018-11-19 16:28:55 +01:00
|
|
|
|
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
|
|
|
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
|
|
|
|
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
|
|
|
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG1 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
|
|
|
|
bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
|
|
|
|
((vBgCnt *)&bg1Cnt)->priority = 0;
|
|
|
|
((vBgCnt *)&bg1Cnt)->screenSize = 0;
|
|
|
|
((vBgCnt *)&bg1Cnt)->areaOverflowMode = 1;
|
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
((vBgCnt *)&bg1Cnt)->charBaseBlock = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
|
|
|
|
|
|
|
|
if (IsContest())
|
|
|
|
{
|
2020-08-14 01:10:23 +02:00
|
|
|
species = gContestResources->moveAnim->species;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
if (GetBattlerSide(battler) != B_SIDE_PLAYER)
|
|
|
|
species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES);
|
2018-11-19 16:28:55 +01:00
|
|
|
else
|
2021-02-28 00:41:30 +01:00
|
|
|
species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES);
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
spriteId = CreateInvisibleSpriteCopy(battler, gBattlerSpriteIds[battler], species);
|
|
|
|
if (includePartner)
|
|
|
|
spriteId2 = CreateInvisibleSpriteCopy(battler2, gBattlerSpriteIds[battler2], species);
|
2018-11-19 16:28:55 +01:00
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
GetBattleAnimBg1Data(&animBgData);
|
|
|
|
AnimLoadCompressedBgTilemapHandleContest(&animBgData, tilemap, 0);
|
|
|
|
AnimLoadCompressedBgGfx(animBgData.bgId, gfx, animBgData.tilesOffset);
|
|
|
|
LoadCompressedPalette(palette, animBgData.paletteId * 16, 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
|
|
|
|
gBattle_BG1_X = 0;
|
|
|
|
gBattle_BG1_Y = 0;
|
2021-02-28 00:41:30 +01:00
|
|
|
gTasks[taskId].data[1] = scrollSpeed;
|
|
|
|
gTasks[taskId].data[4] = numFadeSteps;
|
|
|
|
gTasks[taskId].data[5] = duration;
|
|
|
|
gTasks[taskId].data[6] = fadeStepDelay;
|
2018-11-19 16:28:55 +01:00
|
|
|
gTasks[taskId].data[0] = spriteId;
|
2021-02-28 00:41:30 +01:00
|
|
|
gTasks[taskId].data[2] = includePartner;
|
2018-11-19 16:28:55 +01:00
|
|
|
gTasks[taskId].data[3] = spriteId2;
|
2021-02-28 00:41:30 +01:00
|
|
|
gTasks[taskId].func = UpdateMonScrollingBgMask;
|
2018-11-19 16:28:55 +01:00
|
|
|
}
|
|
|
|
|
2021-02-28 00:41:30 +01:00
|
|
|
static void UpdateMonScrollingBgMask(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
gTasks[taskId].data[13] += gTasks[taskId].data[1] < 0 ? -gTasks[taskId].data[1] : gTasks[taskId].data[1];
|
|
|
|
if (gTasks[taskId].data[1] < 0)
|
|
|
|
gBattle_BG1_Y -= gTasks[taskId].data[13] >> 8;
|
|
|
|
else
|
|
|
|
gBattle_BG1_Y += gTasks[taskId].data[13] >> 8;
|
|
|
|
|
|
|
|
gTasks[taskId].data[13] &= 0xFF;
|
|
|
|
switch (gTasks[taskId].data[15])
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if (gTasks[taskId].data[11]++ >= gTasks[taskId].data[6])
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[11] = 0;
|
|
|
|
gTasks[taskId].data[12]++;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
|
|
|
|
if (gTasks[taskId].data[12] == gTasks[taskId].data[4])
|
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (++gTasks[taskId].data[10] == gTasks[taskId].data[5])
|
|
|
|
gTasks[taskId].data[15]++;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
if (gTasks[taskId].data[11]++ >= gTasks[taskId].data[6])
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[11] = 0;
|
|
|
|
gTasks[taskId].data[12]--;
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[12], 16 - gTasks[taskId].data[12]));
|
|
|
|
if (gTasks[taskId].data[12] == 0)
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
ResetBattleAnimBg(0);
|
2018-11-19 16:28:55 +01:00
|
|
|
gBattle_WIN0H = 0;
|
|
|
|
gBattle_WIN0V = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR
|
|
|
|
| WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR
|
|
|
|
| WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR);
|
|
|
|
if (!IsContest())
|
|
|
|
{
|
|
|
|
u16 bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT);
|
|
|
|
((vBgCnt *)&bg1Cnt)->charBaseBlock = 0;
|
|
|
|
SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetGpuReg(REG_OFFSET_DISPCNT, GetGpuReg(REG_OFFSET_DISPCNT) ^ DISPCNT_OBJWIN_ON);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDCNT, 0);
|
|
|
|
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
|
|
|
|
DestroySprite(&gSprites[gTasks[taskId].data[0]]);
|
|
|
|
if (gTasks[taskId].data[2])
|
|
|
|
DestroySprite(&gSprites[gTasks[taskId].data[3]]);
|
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_GetBattleTerrain(u8 taskId)
|
|
|
|
{
|
|
|
|
gBattleAnimArgs[0] = gBattleTerrain;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2021-10-05 02:51:51 +02:00
|
|
|
void AnimTask_GetFieldTerrain(u8 taskId)
|
|
|
|
{
|
|
|
|
gBattleAnimArgs[0] = gFieldStatuses & STATUS_FIELD_TERRAIN_ANY;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_AllocBackupPalBuffer(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
2020-02-20 06:04:42 +01:00
|
|
|
gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000);
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_FreeBackupPalBuffer(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
2020-02-20 06:04:42 +01:00
|
|
|
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_CopyPalUnfadedToBackup(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u32 selectedPalettes;
|
|
|
|
int paletteIndex = 0;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[0] == 0)
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
2018-11-19 16:28:55 +01:00
|
|
|
while ((selectedPalettes & 1) == 0)
|
|
|
|
{
|
|
|
|
selectedPalettes >>= 1;
|
|
|
|
paletteIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gBattleAnimArgs[0] == 1)
|
|
|
|
{
|
|
|
|
paletteIndex = gBattleAnimAttacker + 16;
|
|
|
|
}
|
|
|
|
else if (gBattleAnimArgs[0] == 2)
|
|
|
|
{
|
|
|
|
paletteIndex = gBattleAnimTarget + 16;
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
memcpy(&gMonSpritesGfxPtr->buffer[gBattleAnimArgs[1] * 16], &gPlttBufferUnfaded[paletteIndex * 16], 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_CopyPalUnfadedFromBackup(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u32 selectedPalettes;
|
|
|
|
int paletteIndex = 0;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[0] == 0)
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
2018-11-19 16:28:55 +01:00
|
|
|
while ((selectedPalettes & 1) == 0)
|
|
|
|
{
|
|
|
|
selectedPalettes >>= 1;
|
|
|
|
paletteIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gBattleAnimArgs[0] == 1)
|
|
|
|
{
|
|
|
|
paletteIndex = gBattleAnimAttacker + 16;
|
|
|
|
}
|
|
|
|
else if (gBattleAnimArgs[0] == 2)
|
|
|
|
{
|
|
|
|
paletteIndex = gBattleAnimTarget + 16;
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
memcpy(&gPlttBufferUnfaded[paletteIndex * 16], &gMonSpritesGfxPtr->buffer[gBattleAnimArgs[1] * 16], 32);
|
2018-11-19 16:28:55 +01:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_CopyPalFadedToUnfaded(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
u32 selectedPalettes;
|
|
|
|
int paletteIndex = 0;
|
|
|
|
|
|
|
|
if (gBattleAnimArgs[0] == 0)
|
|
|
|
{
|
2021-02-28 00:41:30 +01:00
|
|
|
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
2018-11-19 16:28:55 +01:00
|
|
|
while ((selectedPalettes & 1) == 0)
|
|
|
|
{
|
|
|
|
selectedPalettes >>= 1;
|
|
|
|
paletteIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gBattleAnimArgs[0] == 1)
|
|
|
|
{
|
|
|
|
paletteIndex = gBattleAnimAttacker + 16;
|
|
|
|
}
|
|
|
|
else if (gBattleAnimArgs[0] == 2)
|
|
|
|
{
|
|
|
|
paletteIndex = gBattleAnimTarget + 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(&gPlttBufferUnfaded[paletteIndex * 16], &gPlttBufferFaded[paletteIndex * 16], 32);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_IsContest(u8 taskId)
|
|
|
|
{
|
|
|
|
if (IsContest())
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = TRUE;
|
2018-11-19 16:28:55 +01:00
|
|
|
else
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = FALSE;
|
2018-11-19 16:28:55 +01:00
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_SetAnimAttackerAndTargetForEffectTgt(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
gBattleAnimAttacker = gBattlerTarget;
|
|
|
|
gBattleAnimTarget = gEffectBattler;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
|
|
|
void AnimTask_IsTargetSameSide(u8 taskId)
|
|
|
|
{
|
|
|
|
if (GetBattlerSide(gBattleAnimAttacker) == GetBattlerSide(gBattleAnimTarget))
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = TRUE;
|
2018-11-19 16:28:55 +01:00
|
|
|
else
|
2020-02-19 19:13:28 +01:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = FALSE;
|
2018-11-19 16:28:55 +01:00
|
|
|
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-15 00:11:04 +01:00
|
|
|
void AnimTask_SetAnimTargetToBattlerTarget(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
gBattleAnimTarget = gBattlerTarget;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-20 06:04:42 +01:00
|
|
|
void AnimTask_SetAnimAttackerAndTargetForEffectAtk(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
gBattleAnimAttacker = gBattlerAttacker;
|
|
|
|
gBattleAnimTarget = gEffectBattler;
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
void AnimTask_SetAttackerInvisibleWaitForSignal(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
if (IsContest())
|
|
|
|
{
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gTasks[taskId].data[0] = gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible;
|
2020-02-15 00:11:04 +01:00
|
|
|
gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible = TRUE;
|
2020-02-22 00:22:18 +01:00
|
|
|
gTasks[taskId].func = AnimTask_WaitAndRestoreVisibility;
|
2018-11-19 16:28:55 +01:00
|
|
|
gAnimVisualTaskCount--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-22 00:22:18 +01:00
|
|
|
static void AnimTask_WaitAndRestoreVisibility(u8 taskId)
|
2018-11-19 16:28:55 +01:00
|
|
|
{
|
|
|
|
if (gBattleAnimArgs[7] == 0x1000)
|
|
|
|
{
|
|
|
|
gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].invisible = (u8)gTasks[taskId].data[0] & 1;
|
|
|
|
DestroyTask(taskId);
|
|
|
|
}
|
|
|
|
}
|
2019-04-01 14:43:18 +02:00
|
|
|
|
|
|
|
void AnimTask_IsDoubleBattle(u8 taskId)
|
|
|
|
{
|
|
|
|
gBattleAnimArgs[7] = (IsDoubleBattle() && !IsContest());
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
2020-04-18 18:04:20 +02:00
|
|
|
|
|
|
|
void AnimTask_CanBattlerSwitch(u8 taskId)
|
|
|
|
{
|
2020-07-08 17:50:12 +02:00
|
|
|
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
|
2020-07-08 17:51:01 +02:00
|
|
|
gBattleAnimArgs[ARG_RET_ID] = FALSE;
|
2020-07-08 17:50:12 +02:00
|
|
|
else
|
|
|
|
gBattleAnimArgs[ARG_RET_ID] = CanBattlerSwitch(GetAnimBattlerId(gBattleAnimArgs[0]));
|
2020-04-18 18:04:20 +02:00
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
2020-07-15 17:21:12 +02:00
|
|
|
|
|
|
|
void AnimTask_SetInvisible(u8 taskId)
|
|
|
|
{
|
|
|
|
u32 battlerId = GetAnimBattlerId(gBattleAnimArgs[0]);
|
|
|
|
u32 spriteId = gBattlerSpriteIds[battlerId];
|
|
|
|
|
|
|
|
gSprites[spriteId].invisible = gBattleSpritesDataPtr->battlerData[battlerId].invisible = gBattleAnimArgs[1];
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|
2021-06-08 12:13:40 +02:00
|
|
|
|
|
|
|
void AnimTask_SetAnimTargetToAttackerOpposite(u8 taskId)
|
|
|
|
{
|
|
|
|
gBattleAnimTarget = BATTLE_OPPOSITE(gBattleAnimAttacker);
|
|
|
|
DestroyAnimVisualTask(taskId);
|
|
|
|
}
|