fix anim defines

This commit is contained in:
Evan 2020-05-28 12:19:07 -06:00
parent 638d585fc0
commit fdc6e80e1e
8 changed files with 419 additions and 486 deletions

File diff suppressed because it is too large Load Diff

View File

@ -488,10 +488,6 @@ void AnimDragonDanceOrb(struct Sprite *sprite);
void AnimOverheatFlame(struct Sprite *sprite);
// battle_anim_new.c
bool8 IsMoveAnimDarkVoid(void);
bool8 IsMoveAnimFlashCannonOrSteelBeam(void);
bool8 IsMoveAnimCoreEnforcer(void);
bool8 IsMoveAnimAnchorShot(void);
void CoreEnforcerLoadBeamTarget(struct Sprite* sprite);
#endif // GUARD_BATTLE_ANIM_H

View File

@ -398,10 +398,6 @@
#define ANIM_ATK_PARTNER 2
#define ANIM_DEF_PARTNER 3
//sides
#define SIDE_ATTACKER 2
#define SIDE_TARGET 3
// stereo panning constants [0-255]
//
// 0
@ -597,28 +593,28 @@
#define BACK_ANIM_FADE_BLUE_WITH_SHAKE 0x19
// mon pal blend
#define PAL_BG 0x1
#define PAL_ATK 0x2
#define PAL_DEF 0x4
#define PAL_ATK_PARTNER 0x8
#define PAL_DEF_PARTNER 0x10
#define PAL_ALL 0x1f
#define PAL_BG_4 0x20
#define PAL_BG_5 0x40
#define PAL_ALL_BANKS 0x780
#define PAL_PLAYER1 0x80
#define PAL_PLAYER2 0x100
#define PAL_OPPONENT1 0x200
#define PAL_OPPONENT2 0x400
#define ANIM_PAL_BG 0x1
#define ANIM_PAL_ATK 0x2
#define ANIM_PAL_DEF 0x4
#define ANIM_PAL_ATK_PARTNER 0x8
#define ANIM_PAL_DEF_PARTNER 0x10
#define ANIM_PAL_ALL 0x1f
#define ANIM_PAL_BG_4 0x20
#define ANIM_PAL_BG_5 0x40
#define ANIM_PAL_ALL_BATTLERS 0x780
#define ANIM_PAL_PLAYER1 0x80
#define ANIM_PAL_PLAYER2 0x100
#define ANIM_PAL_OPPONENT1 0x200
#define ANIM_PAL_OPPONENT2 0x400
// horseshoe/fist frames
#define RIGHT_FIST 0
#define LEFT_FIST 2
#define ANIM_RIGHT_FIST 0
#define ANIM_LEFT_FIST 2
// surf wave palettes
#define SURF_PALETTE_SURF 0
#define SURF_PALETTE_MUDDY_WATER 1
#define SURF_PALETTE_SLUDGE_WAVE 2
#define ANIM_SURF_PAL_SURF 0
#define ANIM_SURF_PAL_MUDDY_WATER 1
#define ANIM_SURF_PAL_SLUDGE_WAVE 2
#endif // GUARD_CONSTANTS_BATTLE_ANIM_H

View File

@ -15,6 +15,7 @@
#include "util.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/moves.h"
EWRAM_DATA s16 gUnknown_0203A0F8[4] = {0};
@ -3034,7 +3035,7 @@ static void AnimSolarbeamSmallOrb(struct Sprite* sprite)
{
InitSpritePosToAnimAttacker(sprite, TRUE);
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && IsMoveAnimCoreEnforcer())
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gAnimMoveIndex == MOVE_CORE_ENFORCER)
{
CoreEnforcerLoadBeamTarget(sprite);
}

View File

@ -4,6 +4,7 @@
#include "trig.h"
#include "constants/songs.h"
#include "sound.h"
#include "constants/moves.h"
static void AnimLightning(struct Sprite *);
static void AnimLightning_Step(struct Sprite *);
@ -843,7 +844,7 @@ void AnimThunderWave(struct Sprite *sprite)
sprite->pos1.x += gBattleAnimArgs[0];
sprite->pos1.y += gBattleAnimArgs[1];
if (IsMoveAnimAnchorShot())
if (gAnimMoveIndex == MOVE_ANCHOR_SHOT)
spriteId = CreateSprite(&gAnchorShotChainTemplate, sprite->pos1.x + 32, sprite->pos1.y, sprite->subpriority);
else
spriteId = CreateSprite(&gThunderWaveSpriteTemplate, sprite->pos1.x + 32, sprite->pos1.y, sprite->subpriority);
@ -903,7 +904,7 @@ static void AnimTask_ElectricChargingParticles_Step(u8 taskId)
{
u8 spriteId;
task->data[12] = 0;
if (IsMoveAnimFlashCannonOrSteelBeam())
if (gAnimMoveIndex == MOVE_FLASH_CANNON || gAnimMoveIndex == MOVE_STEEL_BEAM)
spriteId = CreateSprite(&gLightOfRuinGrayChargeTemplate, task->data[14], task->data[15], 2);
else
spriteId = CreateSprite(&gElectricChargingParticlesSpriteTemplate, task->data[14], task->data[15], 2);

View File

@ -9,6 +9,7 @@
#include "sound.h"
#include "trig.h"
#include "util.h"
#include "constants/moves.h"
static void AnimConfuseRayBallBounce(struct Sprite *);
static void AnimConfuseRayBallBounce_Step1(struct Sprite *);
@ -874,7 +875,7 @@ void AnimTask_DestinyBondWhiteShadow(u8 taskId)
&& battler != (gBattleAnimAttacker ^ 2)
&& IsBattlerSpriteVisible(battler))
{
if (IsMoveAnimDarkVoid())
if (gAnimMoveIndex == MOVE_DARK_VOID)
spriteId = CreateSprite(&gDarkVoidBlackHoleTemplate, baseX, baseY, 55); //dark void
else
spriteId = CreateSprite(&gDestinyBondWhiteShadowSpriteTemplate, baseX, baseY, 55); //destiny bond
@ -900,7 +901,7 @@ void AnimTask_DestinyBondWhiteShadow(u8 taskId)
}
else
{
if (IsMoveAnimDarkVoid())
if (gAnimMoveIndex == MOVE_DARK_VOID)
spriteId = CreateSprite(&gDarkVoidBlackHoleTemplate, baseX, baseY, 55); //dark void
else
spriteId = CreateSprite(&gDestinyBondWhiteShadowSpriteTemplate, baseX, baseY, 55); //destiny bond

View File

@ -15,9 +15,6 @@
#include "battle_controllers.h"
#include "constants/moves.h"
// defines
#define PARTNER(battler) (battler ^ BIT_FLANK)
//// function declarations
static void SpriteCB_SpriteToCentreOfSide(struct Sprite* sprite);
static void SpriteCB_SpriteOnMonForDuration(struct Sprite *sprite);
@ -4055,10 +4052,10 @@ static u8 LoadBattleAnimTarget(u8 arg)
battler = gBattleAnimTarget;
break;
case 2:
battler = PARTNER(gBattleAnimAttacker);
battler = BATTLE_PARTNER(gBattleAnimAttacker);
break;
case 3:
battler = PARTNER(gBattleAnimTarget);
battler = BATTLE_PARTNER(gBattleAnimTarget);
break;
}
}
@ -4073,12 +4070,12 @@ static u8 LoadBattleAnimTarget(u8 arg)
return battler;
}
static u8 GetProperCentredCoord(u8 bank, u8 coordType)
static u8 GetProperCentredCoord(u8 battler, u8 coordType)
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
return (GetBattlerSpriteCoord2(bank, coordType) + GetBattlerSpriteCoord2(PARTNER(bank), coordType)) / 2;
return (GetBattlerSpriteCoord2(battler, coordType) + GetBattlerSpriteCoord2(BATTLE_PARTNER(battler), coordType)) / 2;
return GetBattlerSpriteCoord(bank, coordType);
return GetBattlerSpriteCoord(battler, coordType);
}
static void InitSpritePosToGivenTarget(struct Sprite* sprite, u8 target)
@ -4095,9 +4092,9 @@ static void InitSpritePosToAnimTargetsCentre(struct Sprite *sprite, bool8 respec
if (!respectMonPicOffsets)
{
sprite->pos1.x = (GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_X)
+ GetBattlerSpriteCoord2(PARTNER(gBattleAnimTarget), BATTLER_COORD_X)) / 2;
+ GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_X)) / 2;
sprite->pos1.y = (GetBattlerSpriteCoord2(gBattleAnimTarget, BATTLER_COORD_Y)
+ GetBattlerSpriteCoord2(PARTNER(gBattleAnimTarget), BATTLER_COORD_Y)) / 2;
+ GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_Y)) / 2;
}
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
@ -4109,16 +4106,16 @@ static void InitSpritePosToAnimAttackersCentre(struct Sprite *sprite, bool8 resp
if (!respectMonPicOffsets)
{
sprite->pos1.x = (GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_X)
+ GetBattlerSpriteCoord2(PARTNER(gBattleAnimAttacker), BATTLER_COORD_X)) / 2;
+ GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X)) / 2;
sprite->pos1.y = (GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_Y)
+ GetBattlerSpriteCoord2(PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y)) / 2;
+ GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y)) / 2;
}
else
{
sprite->pos1.x = (GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_X_2)
+ GetBattlerSpriteCoord2(PARTNER(gBattleAnimAttacker), BATTLER_COORD_X_2)) / 2;
+ GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_X_2)) / 2;
sprite->pos1.y = (GetBattlerSpriteCoord2(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET)
+ GetBattlerSpriteCoord2(PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y_PIC_OFFSET)) / 2;
+ GetBattlerSpriteCoord2(BATTLE_PARTNER(gBattleAnimAttacker), BATTLER_COORD_Y_PIC_OFFSET)) / 2;
}
SetAnimSpriteInitialXOffset(sprite, gBattleAnimArgs[0]);
@ -4275,11 +4272,11 @@ static void SpriteCB_CoreEnforcerBeam(struct Sprite* sprite)
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[2] = (GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2)
+ GetBattlerSpriteCoord(PARTNER(gBattleAnimTarget), BATTLER_COORD_X_2)) / 2;
+ GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_X_2)) / 2;
sprite->data[4] = (GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET)
+ GetBattlerSpriteCoord(PARTNER(gBattleAnimTarget), BATTLER_COORD_Y_PIC_OFFSET)) / 2;
+ GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_Y_PIC_OFFSET)) / 2;
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
@ -4324,7 +4321,7 @@ static void SpriteCB_TranslateAnimSpriteToTargetMonLocationDoubles(struct Sprite
//arg 0: initial x pixel offset
//arg 1: initial y pixel offset
//arg 2: speed
//arg 3: anim bank
//arg 3: anim battler
static void SpriteCB_FallingObject(struct Sprite *sprite)
{
u8 target = LoadBattleAnimTarget(3);
@ -4740,7 +4737,7 @@ static void SpriteCB_AcidDripSingleTarget(struct Sprite *sprite)
//Causes an object to fall from the sky.
//arg 0: initial x pixel offset
//arg 1: initial y pixel offset
//arg 2: anim bank
//arg 2: anim battler
static void SpriteCB_WaterDroplet(struct Sprite *sprite)
{
u8 target = LoadBattleAnimTarget(2);
@ -4816,7 +4813,7 @@ static void SpriteCB_SurroundingRing(struct Sprite *sprite)
//Imitates launching a beam of light towards the sky
//arg 0: initial x pixel offset
//arg 1: initial y pixel offset
//arg 2: bank
//arg 2: battler
//arg 3: duration
//arg 4: Anim num
//arg 5: affine anim start delay
@ -4942,55 +4939,15 @@ void AnimTask_SquishTarget(u8 taskId)
task->func = AnimTask_WaitAffineAnim;
}
void AnimTask_IsTargetPartner(u8 taskId)
{
if (gBattleAnimTarget == PARTNER(gBattleAnimAttacker))
gBattleAnimArgs[0] = 1;
else
gBattleAnimArgs[0] = 0;
DestroyAnimVisualTask(taskId);
}
void AnimTask_AllBanksInvisible(u8 taskId)
{
int i;
u8 spriteId;
for (i = 0; i < gBattlersCount; ++i)
{
spriteId = gBattlerSpriteIds[i];
if (spriteId != 0xFF)
gSprites[spriteId].invisible = TRUE;
}
DestroyAnimVisualTask(taskId);
}
void AnimTask_AllBanksVisible(u8 taskId)
{
int i;
u8 spriteId;
for (i = 0; i < gBattlersCount; ++i)
{
spriteId = gBattlerSpriteIds[i];
if (spriteId != 0xFF)
gSprites[spriteId].invisible = FALSE;
}
DestroyAnimVisualTask(taskId);
}
void CoreEnforcerLoadBeamTarget(struct Sprite* sprite)
{
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[1] = sprite->pos1.x;
sprite->data[2] = (GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2)
+ GetBattlerSpriteCoord(PARTNER(gBattleAnimTarget), BATTLER_COORD_X_2)) / 2;
+ GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_X_2)) / 2;
sprite->data[3] = sprite->pos1.y;
sprite->data[4] = (GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET)
+ GetBattlerSpriteCoord(PARTNER(gBattleAnimTarget), BATTLER_COORD_Y_PIC_OFFSET)) / 2;
+ GetBattlerSpriteCoord(BATTLE_PARTNER(gBattleAnimTarget), BATTLER_COORD_Y_PIC_OFFSET)) / 2;
}
void AnimTask_CreateBestowItem(u8 taskId)
@ -5035,24 +4992,3 @@ void AnimTask_TechnoBlast(u8 taskId)
DestroyAnimVisualTask(taskId);
}
// move checks
bool8 IsMoveAnimDarkVoid(void)
{
return gAnimMoveIndex == MOVE_DARK_VOID;
}
bool8 IsMoveAnimFlashCannonOrSteelBeam(void)
{
return gAnimMoveIndex == MOVE_FLASH_CANNON || gAnimMoveIndex == MOVE_STEEL_BEAM;
}
bool8 IsMoveAnimCoreEnforcer(void)
{
return gAnimMoveIndex == MOVE_CORE_ENFORCER;
}
bool8 IsMoveAnimAnchorShot(void)
{
return gAnimMoveIndex == MOVE_ANCHOR_SHOT;
}

View File

@ -1077,14 +1077,16 @@ void AnimTask_CreateSurfWave(u8 taskId)
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Surf, animBg.tilesOffset);
switch (gBattleAnimArgs[0])
{
case SURF_PALETTE_SURF:
case ANIM_SURF_PAL_SURF:
default:
LoadCompressedPalette(gBattleAnimBgPalette_Surf, animBg.paletteId * 16, 32);
break;
case SURF_PALETTE_MUDDY_WATER:
case ANIM_SURF_PAL_MUDDY_WATER:
LoadCompressedPalette(gBattleAnimBackgroundImageMuddyWater_Pal, animBg.paletteId * 16, 32);
case SURF_PALETTE_SLUDGE_WAVE:
break;
case ANIM_SURF_PAL_SLUDGE_WAVE:
LoadCompressedPalette(gBattleAnimBgPalette_SludgeWave, animBg.paletteId * 16, 32);
break;
}
taskId2 = CreateTask(AnimTask_SurfWaveScanlineEffect, gTasks[taskId].priority + 1);