use sound panning constants in battle_anim_scripts

This commit is contained in:
garak 2018-10-19 15:57:19 -04:00
parent 72f9afcbf4
commit 901f3ff557
14 changed files with 1051 additions and 1039 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,9 +31,6 @@ struct BattleAnimBackground
#define ANIM_ARGS_COUNT 8
#define PAN_SIDE_PLAYER -64
#define PAN_SIDE_OPPONENT 63
extern void (*gAnimScriptCallback)(void);
extern bool8 gAnimScriptActive;
extern u8 gAnimVisualTaskCount;

View File

@ -7,6 +7,20 @@
#define ANIM_ATK_PARTNER 2
#define ANIM_DEF_PARTNER 3
// stereo panning constants [0-255]
//
// 0
// . .
// . .
// 192 . . 63
// . .
// . .
// . .
// 127
//
#define SOUND_PAN_ATTACKER -64
#define SOUND_PAN_TARGET 63
// move background ids
#define BG_DARK_ 0 // the same as BG_DARK but is unused
#define BG_DARK 1

View File

@ -1265,39 +1265,39 @@ s8 BattleAnimAdjustPanning(s8 pan)
if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gBattleAnimAttacker].statusAnimActive)
{
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
else
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
}
else if (IsContest())
{
if (gBattleAnimAttacker != gBattleAnimTarget || gBattleAnimAttacker != 2 || pan != PAN_SIDE_OPPONENT)
if (gBattleAnimAttacker != gBattleAnimTarget || gBattleAnimAttacker != 2 || pan != SOUND_PAN_TARGET)
pan *= -1;
}
else if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
{
if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER)
{
if (pan == PAN_SIDE_OPPONENT)
pan = PAN_SIDE_PLAYER;
else if (pan != PAN_SIDE_PLAYER)
if (pan == SOUND_PAN_TARGET)
pan = SOUND_PAN_ATTACKER;
else if (pan != SOUND_PAN_ATTACKER)
pan *= -1;
}
}
else if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_OPPONENT)
{
if (pan == PAN_SIDE_PLAYER)
pan = PAN_SIDE_OPPONENT;
if (pan == SOUND_PAN_ATTACKER)
pan = SOUND_PAN_TARGET;
}
else
{
pan *= -1;
}
if (pan > PAN_SIDE_OPPONENT)
pan = PAN_SIDE_OPPONENT;
else if (pan < PAN_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
if (pan > SOUND_PAN_TARGET)
pan = SOUND_PAN_TARGET;
else if (pan < SOUND_PAN_ATTACKER)
pan = SOUND_PAN_ATTACKER;
return pan;
}
@ -1307,9 +1307,9 @@ s8 BattleAnimAdjustPanning2(s8 pan)
if (!IsContest() && gBattleSpritesDataPtr->healthBoxesData[gBattleAnimAttacker].statusAnimActive)
{
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
else
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
}
else
{
@ -1323,10 +1323,10 @@ s16 KeepPanInRange(s16 panArg)
{
s16 pan = panArg;
if (pan > PAN_SIDE_OPPONENT)
pan = PAN_SIDE_OPPONENT;
else if (pan < PAN_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
if (pan > SOUND_PAN_TARGET)
pan = SOUND_PAN_TARGET;
else if (pan < SOUND_PAN_ATTACKER)
pan = SOUND_PAN_ATTACKER;
return pan;
}

View File

@ -23,8 +23,8 @@ void sub_8158B30(u8 taskId)
gTasks[taskId].data[0] = gBattleAnimArgs[0];
gTasks[taskId].data[1] = gBattleAnimArgs[1];
pan1 = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
pan2 = BattleAnimAdjustPanning(PAN_SIDE_OPPONENT);
pan1 = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
pan2 = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
panIncrement = CalculatePanIncrement(pan1, pan2, 2);
gTasks[taskId].data[2] = pan1;
@ -64,7 +64,7 @@ static void sub_8158C04(u8 taskId)
s8 pan;
gTasks[taskId].data[10] = 0;
pan = BattleAnimAdjustPanning(PAN_SIDE_OPPONENT);
pan = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
PlaySE12WithPanning(gTasks[taskId].data[1], pan);
if (++gTasks[taskId].data[11] == 2)
DestroyAnimSoundTask(taskId);
@ -127,7 +127,7 @@ static void sub_8158D08(u8 taskId)
void sub_8158D8C(u8 taskId)
{
u16 species = 0;
s8 pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
s8 pan = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
@ -173,7 +173,7 @@ void sub_8158D8C(u8 taskId)
void sub_8158E9C(u8 taskId)
{
u16 species = 0;
s8 pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
s8 pan = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
@ -278,7 +278,7 @@ void sub_81590B8(u8 taskId)
s8 pan;
gTasks[taskId].data[10] = gBattleAnimArgs[0];
pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
pan = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
if (IsContest())
species = gContestResources->field_18->field_0;

View File

@ -1364,7 +1364,7 @@ static void LinkOpponentHandleFaintAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
PlaySE12WithPanning(SE_POKE_DEAD, SOUND_PAN_TARGET);
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
gBattlerControllerFuncs[gActiveBattler] = sub_8064C14;
}
@ -1660,9 +1660,9 @@ static void LinkOpponentHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
LinkOpponentBufferExecCompleted();

View File

@ -1187,7 +1187,7 @@ static void LinkPartnerHandleFaintAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
PlaySE12WithPanning(SE_POKE_DEAD, SOUND_PAN_ATTACKER);
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00;
@ -1485,9 +1485,9 @@ static void LinkPartnerHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
LinkPartnerBufferExecCompleted();

View File

@ -1402,7 +1402,7 @@ static void OpponentHandleFaintAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
PlaySE12WithPanning(SE_POKE_DEAD, SOUND_PAN_TARGET);
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
gBattlerControllerFuncs[gActiveBattler] = sub_805FAC4;
}
@ -1810,9 +1810,9 @@ static void OpponentHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
OpponentBufferExecCompleted();

View File

@ -2407,7 +2407,7 @@ static void PlayerHandleFaintAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
PlaySE12WithPanning(SE_POKE_DEAD, SOUND_PAN_ATTACKER);
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00;
@ -2882,9 +2882,9 @@ static void PlayerHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
PlayerBufferExecCompleted();

View File

@ -1382,7 +1382,7 @@ static void PlayerPartnerHandleFaintAnimation(void)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
PlaySE12WithPanning(SE_POKE_DEAD, SOUND_PAN_ATTACKER);
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = 5;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_8039C00;
@ -1739,9 +1739,9 @@ static void PlayerPartnerHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
PlayerPartnerBufferExecCompleted();

View File

@ -1295,7 +1295,7 @@ static void RecordedOpponentHandleFaintAnimation(void)
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_OPPONENT);
PlaySE12WithPanning(SE_POKE_DEAD, SOUND_PAN_TARGET);
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
gBattlerControllerFuncs[gActiveBattler] = sub_8186D58;
}
@ -1603,9 +1603,9 @@ static void RecordedOpponentHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
RecordedOpponentBufferExecCompleted();

View File

@ -1624,9 +1624,9 @@ static void RecordedPlayerHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
RecordedPlayerBufferExecCompleted();

View File

@ -594,9 +594,9 @@ static void SafariHandlePlaySE(void)
s8 pan;
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
else
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
SafariBufferExecCompleted();

View File

@ -20,6 +20,7 @@
#include "international_string_util.h"
#include "safari_zone.h"
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "constants/rgb.h"
#include "data2.h"
@ -1889,9 +1890,9 @@ static void SpriteCB_StatusSummaryBallsOnBattleStart(struct Sprite *sprite)
if (sprite->pos2.x == 0)
{
pan = PAN_SIDE_OPPONENT;
pan = SOUND_PAN_TARGET;
if (var1 != 0)
pan = PAN_SIDE_PLAYER;
pan = SOUND_PAN_ATTACKER;
if (sprite->data[7] != 0)
PlaySE2WithPanning(SE_TB_KARA, pan);