mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Document generic argument names in battle anim palettes
This commit is contained in:
parent
5e6d8a77e4
commit
a8437493c1
File diff suppressed because it is too large
Load Diff
@ -118,7 +118,7 @@ void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation);
|
||||
void InitSpriteDataForLinearTranslation(struct Sprite *sprite);
|
||||
void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode);
|
||||
void SetBattlerSpriteYOffsetFromRotation(u8 spriteId);
|
||||
u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7);
|
||||
u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2);
|
||||
u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight);
|
||||
u8 AnimDummyReturnArg(u8 battler);
|
||||
s16 CloneBattlerSpriteWithBlend(u8);
|
||||
@ -229,7 +229,7 @@ void DestroyAnimSpriteAfterTimer(struct Sprite *sprite);
|
||||
// battle_anim_smokescreen.c
|
||||
u8 SmokescreenImpact(s16 x, s16 y, u8 a3);
|
||||
|
||||
u32 UnpackSelectedBattleBgPalettes(s16);
|
||||
u32 UnpackSelectedBattlePalettes(s16);
|
||||
|
||||
u8 GetBattlerSpriteFinal_Y(u8, u16, u8);
|
||||
|
||||
|
@ -413,4 +413,21 @@
|
||||
#define ANIM_WEATHER_SANDSTORM 3
|
||||
#define ANIM_WEATHER_HAIL 4
|
||||
|
||||
// Flags given to various functions to indicate which palettes to consider.
|
||||
// Handled by UnpackSelectedBattlePalettes
|
||||
#define F_PAL_BG (1 << 0)
|
||||
#define F_PAL_ATTACKER (1 << 1)
|
||||
#define F_PAL_TARGET (1 << 2)
|
||||
#define F_PAL_ATK_PARTNER (1 << 3)
|
||||
#define F_PAL_DEF_PARTNER (1 << 4)
|
||||
#define F_PAL_ANIM_1 (1 << 5) // Palette set for GetBattleAnimBg1Data/GetBgDataForTransform. Only used (ineffectually?) by Aromatherapy.
|
||||
#define F_PAL_ANIM_2 (1 << 6) // Palette set for GetBattleAnimBgData/GetBgDataForTransform. Unused.
|
||||
#define F_PAL_ATK_SIDE (F_PAL_ATTACKER | F_PAL_ATK_PARTNER)
|
||||
#define F_PAL_DEF_SIDE (F_PAL_TARGET | F_PAL_DEF_PARTNER)
|
||||
#define F_PAL_BATTLERS (F_PAL_ATK_SIDE | F_PAL_DEF_SIDE)
|
||||
// The below are only used by AnimTask_BlendBattleAnimPal to get battler sprite palettes by position rather than by role.
|
||||
// It's redundant with F_PAL_BATTLERS, because they're only ever used together to refer to all the battlers at once.
|
||||
#define F_PAL_BATTLERS_2 (1 << 7 | 1 << 8 | 1 << 9 | 1 << 10)
|
||||
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_ANIM_H
|
||||
|
@ -4343,7 +4343,7 @@ static void AnimLockOnTarget_Step4(struct Sprite* sprite)
|
||||
sprite->data[1] = 0;
|
||||
}
|
||||
|
||||
BlendPalettes(GetBattleBgPalettesMask(1, 1, 1, 1, 1, 0, 0), sprite->data[1], RGB(31, 31, 31));
|
||||
BlendPalettes(GetBattlePalettesMask(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE), sprite->data[1], RGB(31, 31, 31));
|
||||
if (sprite->data[1] == 16)
|
||||
{
|
||||
int pal;
|
||||
@ -4998,7 +4998,7 @@ static void AnimMoonlightSparkle_Step(struct Sprite* sprite)
|
||||
|
||||
void AnimTask_MoonlightEndFade(u8 taskId)
|
||||
{
|
||||
int a = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF;
|
||||
int a = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) & 0xFFFF;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
|
@ -3116,7 +3116,7 @@ static void AnimTask_FakeOut_Step2(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].data[11] = 0x88;
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_LIGHTEN);
|
||||
BlendPalettes(GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0), 16, RGB(31, 31, 31));
|
||||
BlendPalettes(GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), 16, RGB(31, 31, 31));
|
||||
}
|
||||
else if (gTasks[taskId].data[10] > 4)
|
||||
{
|
||||
|
@ -1004,7 +1004,7 @@ static void AnimTask_CurseStretchingBlackBg_Step1(u8 taskId)
|
||||
right = DISPLAY_WIDTH;
|
||||
top = 0;
|
||||
bottom = 112;
|
||||
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
||||
selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB(0, 0, 0));
|
||||
gTasks[taskId].func = AnimTask_CurseStretchingBlackBg_Step2;
|
||||
}
|
||||
|
@ -908,13 +908,17 @@ bool8 IsDoubleBattle(void)
|
||||
return IS_DOUBLE_BATTLE();
|
||||
}
|
||||
|
||||
#define BG_ANIM_PAL_1 8
|
||||
#define BG_ANIM_PAL_2 9
|
||||
#define BG_ANIM_PAL_CONTEST 14
|
||||
|
||||
void GetBattleAnimBg1Data(struct BattleAnimBgData *out)
|
||||
{
|
||||
if (IsContest())
|
||||
{
|
||||
out->bgTiles = gBattleAnimBgTileBuffer;
|
||||
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
|
||||
out->paletteId = 14;
|
||||
out->paletteId = BG_ANIM_PAL_CONTEST;
|
||||
out->bgId = 1;
|
||||
out->tilesOffset = 0;
|
||||
out->unused = 0;
|
||||
@ -923,7 +927,7 @@ void GetBattleAnimBg1Data(struct BattleAnimBgData *out)
|
||||
{
|
||||
out->bgTiles = gBattleAnimBgTileBuffer;
|
||||
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
|
||||
out->paletteId = 8;
|
||||
out->paletteId = BG_ANIM_PAL_1;
|
||||
out->bgId = 1;
|
||||
out->tilesOffset = 0x200;
|
||||
out->unused = 0;
|
||||
@ -936,7 +940,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId)
|
||||
{
|
||||
out->bgTiles = gBattleAnimBgTileBuffer;
|
||||
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
|
||||
out->paletteId = 14;
|
||||
out->paletteId = BG_ANIM_PAL_CONTEST;
|
||||
out->bgId = 1;
|
||||
out->tilesOffset = 0;
|
||||
out->unused = 0;
|
||||
@ -949,7 +953,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId)
|
||||
{
|
||||
out->bgTiles = gBattleAnimBgTileBuffer;
|
||||
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
|
||||
out->paletteId = 9;
|
||||
out->paletteId = BG_ANIM_PAL_2;
|
||||
out->bgId = 2;
|
||||
out->tilesOffset = 0x300;
|
||||
out->unused = 0;
|
||||
@ -962,21 +966,21 @@ void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battlerId)
|
||||
out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer;
|
||||
if (IsContest())
|
||||
{
|
||||
out->paletteId = 14;
|
||||
out->paletteId = BG_ANIM_PAL_CONTEST;
|
||||
out->bgId = 1;
|
||||
out->tilesOffset = 0;
|
||||
out->unused = 0;
|
||||
}
|
||||
else if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1)
|
||||
{
|
||||
out->paletteId = 8;
|
||||
out->paletteId = BG_ANIM_PAL_1;
|
||||
out->bgId = 1;
|
||||
out->tilesOffset = 0x200;
|
||||
out->unused = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
out->paletteId = 9;
|
||||
out->paletteId = BG_ANIM_PAL_2;
|
||||
out->bgId = 2;
|
||||
out->tilesOffset = 0x300;
|
||||
out->unused = 0;
|
||||
@ -1401,7 +1405,7 @@ void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor)
|
||||
}
|
||||
}
|
||||
|
||||
u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7)
|
||||
u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2)
|
||||
{
|
||||
u32 selectedPalettes = 0;
|
||||
u32 shift;
|
||||
@ -1409,7 +1413,7 @@ u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 atta
|
||||
if (battleBackground)
|
||||
{
|
||||
if (!IsContest())
|
||||
selectedPalettes = 0xe;
|
||||
selectedPalettes = 0xe; // Palettes 1, 2, and 3
|
||||
else
|
||||
selectedPalettes = 1 << GetBattleBgPaletteNum();
|
||||
}
|
||||
@ -1439,17 +1443,17 @@ u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 atta
|
||||
selectedPalettes |= 1 << shift;
|
||||
}
|
||||
}
|
||||
if (a6)
|
||||
if (anim1)
|
||||
{
|
||||
if (!IsContest())
|
||||
selectedPalettes |= 0x100;
|
||||
selectedPalettes |= 1 << BG_ANIM_PAL_1;
|
||||
else
|
||||
selectedPalettes |= 0x4000;
|
||||
selectedPalettes |= 1 << BG_ANIM_PAL_CONTEST;
|
||||
}
|
||||
if (a7)
|
||||
if (anim2)
|
||||
{
|
||||
if (!IsContest())
|
||||
selectedPalettes |= 0x200;
|
||||
selectedPalettes |= 1 << BG_ANIM_PAL_2;
|
||||
}
|
||||
return selectedPalettes;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ static void AnimConfusionDuck_Step(struct Sprite *sprite)
|
||||
// arg 4: blend color
|
||||
static void AnimSimplePaletteBlend(struct Sprite *sprite)
|
||||
{
|
||||
u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]);
|
||||
u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]);
|
||||
BeginNormalPaletteFade(selectedPalettes, gBattleAnimArgs[1], gBattleAnimArgs[2], gBattleAnimArgs[3], gBattleAnimArgs[4]);
|
||||
sprite->invisible = TRUE;
|
||||
sprite->callback = AnimSimplePaletteBlend_Step;
|
||||
@ -312,23 +312,23 @@ static void AnimSimplePaletteBlend(struct Sprite *sprite)
|
||||
|
||||
// Unpacks a bitfield and returns a bitmask of its selected palettes.
|
||||
// Bits 0-6 of the selector parameter result in the following palettes being selected:
|
||||
// 0: battle background palettes (BG palettes 1, 2, and 3)
|
||||
// 1: gBattleAnimAttacker OBJ palette
|
||||
// 2: gBattleAnimTarget OBJ palette
|
||||
// 3: gBattleAnimAttacker partner OBJ palette
|
||||
// 4: gBattleAnimTarget partner OBJ palette
|
||||
// 5: BG palette 4
|
||||
// 6: BG palette 5
|
||||
u32 UnpackSelectedBattleBgPalettes(s16 selector)
|
||||
// 0: F_PAL_BG, battle background palettes (BG palettes 1, 2, and 3)
|
||||
// 1: F_PAL_ATTACKER, gBattleAnimAttacker OBJ palette
|
||||
// 2: F_PAL_TARGET, gBattleAnimTarget OBJ palette
|
||||
// 3: F_PAL_ATK_PARTNER, gBattleAnimAttacker partner OBJ palette
|
||||
// 4: F_PAL_DEF_PARTNER, gBattleAnimTarget partner OBJ palette
|
||||
// 5: F_PAL_ANIM_1, BG palette 8 (or 14, if in Contest)
|
||||
// 6: F_PAL_ANIM_2, BG palette 9
|
||||
u32 UnpackSelectedBattlePalettes(s16 selector)
|
||||
{
|
||||
u8 battleBackground = selector & 1;
|
||||
u8 attacker = (selector >> 1) & 1;
|
||||
u8 target = (selector >> 2) & 1;
|
||||
u8 attackerPartner = (selector >> 3) & 1;
|
||||
u8 targetPartner = (selector >> 4) & 1;
|
||||
u8 arg5 = (selector >> 5) & 1;
|
||||
u8 arg6 = (selector >> 6) & 1;
|
||||
return GetBattleBgPalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, arg5, arg6);
|
||||
bool8 battleBackground = selector & 1;
|
||||
bool8 attacker = (selector >> 1) & 1;
|
||||
bool8 target = (selector >> 2) & 1;
|
||||
bool8 attackerPartner = (selector >> 3) & 1;
|
||||
bool8 targetPartner = (selector >> 4) & 1;
|
||||
bool8 anim1 = (selector >> 5) & 1;
|
||||
bool8 anim2 = (selector >> 6) & 1;
|
||||
return GetBattlePalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, anim1, anim2);
|
||||
}
|
||||
|
||||
static void AnimSimplePaletteBlend_Step(struct Sprite *sprite)
|
||||
@ -350,7 +350,7 @@ static void AnimComplexPaletteBlend(struct Sprite *sprite)
|
||||
sprite->data[6] = gBattleAnimArgs[6];
|
||||
sprite->data[7] = gBattleAnimArgs[0];
|
||||
|
||||
selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]);
|
||||
selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]);
|
||||
BlendPalettes(selectedPalettes, gBattleAnimArgs[4], gBattleAnimArgs[3]);
|
||||
sprite->invisible = TRUE;
|
||||
sprite->callback = AnimComplexPaletteBlend_Step1;
|
||||
@ -375,7 +375,7 @@ static void AnimComplexPaletteBlend_Step1(struct Sprite *sprite)
|
||||
return;
|
||||
}
|
||||
|
||||
selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]);
|
||||
selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]);
|
||||
if (sprite->data[1] & 0x100)
|
||||
BlendPalettes(selectedPalettes, sprite->data[4], sprite->data[3]);
|
||||
else
|
||||
@ -392,7 +392,7 @@ static void AnimComplexPaletteBlend_Step2(struct Sprite *sprite)
|
||||
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]);
|
||||
selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]);
|
||||
BlendPalettes(selectedPalettes, 0, 0);
|
||||
DestroyAnimSprite(sprite);
|
||||
}
|
||||
@ -442,7 +442,7 @@ void AnimTask_BlendColorCycle(u8 taskId)
|
||||
|
||||
static void BlendColorCycle(u8 taskId, u8 startBlendAmount, u8 targetBlendAmount)
|
||||
{
|
||||
u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gTasks[taskId].tPalSelector);
|
||||
u32 selectedPalettes = UnpackSelectedBattlePalettes(gTasks[taskId].tPalSelector);
|
||||
BeginNormalPaletteFade(
|
||||
selectedPalettes,
|
||||
gTasks[taskId].tDelay,
|
||||
@ -721,7 +721,7 @@ void AnimTask_InvertScreenColor(u8 taskId)
|
||||
u8 targetBattler = gBattleAnimTarget;
|
||||
|
||||
if (gBattleAnimArgs[0] & 0x100)
|
||||
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
||||
selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
|
||||
if (gBattleAnimArgs[1] & 0x100)
|
||||
selectedPalettes |= (0x10000 << attackerBattler);
|
||||
|
@ -690,7 +690,7 @@ void AnimTask_SwitchOutBallEffect(u8 taskId)
|
||||
priority = gSprites[spriteId].oam.priority;
|
||||
subpriority = gSprites[spriteId].subpriority;
|
||||
gTasks[taskId].data[10] = AnimateBallOpenParticles(x, y + 32, priority, subpriority, ballId);
|
||||
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
||||
selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
gTasks[taskId].data[11] = LaunchBallFadeMonTask(FALSE, gBattleAnimAttacker, selectedPalettes, ballId);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
|
@ -47,7 +47,7 @@ const u8 gBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFS
|
||||
|
||||
void AnimTask_BlendBattleAnimPal(u8 taskId)
|
||||
{
|
||||
u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]);
|
||||
u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]);
|
||||
selectedPalettes |= GetBattleMonSpritePalettesMask((gBattleAnimArgs[0] >> 7) & 1,
|
||||
(gBattleAnimArgs[0] >> 8) & 1,
|
||||
(gBattleAnimArgs[0] >> 9) & 1,
|
||||
@ -62,7 +62,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId)
|
||||
u8 animBattlers[2];
|
||||
|
||||
animBattlers[1] = 0xFF;
|
||||
selectedPalettes = UnpackSelectedBattleBgPalettes(1);
|
||||
selectedPalettes = UnpackSelectedBattlePalettes(F_PAL_BG);
|
||||
switch (gBattleAnimArgs[0])
|
||||
{
|
||||
case 2:
|
||||
@ -105,7 +105,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId)
|
||||
|
||||
void AnimTask_SetCamouflageBlend(u8 taskId)
|
||||
{
|
||||
u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]);
|
||||
u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]);
|
||||
switch (gBattleTerrain)
|
||||
{
|
||||
case BATTLE_TERRAIN_GRASS:
|
||||
@ -607,7 +607,7 @@ void AnimTask_Flash(u8 taskId)
|
||||
SetPalettesToColor(selectedPalettes, RGB_BLACK);
|
||||
gTasks[taskId].data[14] = selectedPalettes >> 16;
|
||||
|
||||
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF;
|
||||
selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) & 0xFFFF;
|
||||
SetPalettesToColor(selectedPalettes, RGB_WHITEALPHA);
|
||||
gTasks[taskId].data[15] = selectedPalettes;
|
||||
|
||||
@ -923,7 +923,7 @@ void AnimTask_CopyPalUnfadedToBackup(u8 taskId)
|
||||
|
||||
if (gBattleAnimArgs[0] == 0)
|
||||
{
|
||||
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
||||
selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
while ((selectedPalettes & 1) == 0)
|
||||
{
|
||||
selectedPalettes >>= 1;
|
||||
@ -950,7 +950,7 @@ void AnimTask_CopyPalUnfadedFromBackup(u8 taskId)
|
||||
|
||||
if (gBattleAnimArgs[0] == 0)
|
||||
{
|
||||
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
||||
selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
while ((selectedPalettes & 1) == 0)
|
||||
{
|
||||
selectedPalettes >>= 1;
|
||||
@ -977,7 +977,7 @@ void AnimTask_CopyPalFadedToUnfaded(u8 taskId)
|
||||
|
||||
if (gBattleAnimArgs[0] == 0)
|
||||
{
|
||||
selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0);
|
||||
selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE);
|
||||
while ((selectedPalettes & 1) == 0)
|
||||
{
|
||||
selectedPalettes >>= 1;
|
||||
|
Loading…
Reference in New Issue
Block a user