summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-01-08 08:11:13 -0500
committerGitHub <noreply@github.com>2021-01-08 08:11:13 -0500
commitac62e8e563f9e74493a394a21c1bd8fa1570b184 (patch)
treef49db2e3e0b627e4c80857751143bcd3d6b8ecad /src
parent135fd3948a50529de11a327eba5a1ebb9e305b29 (diff)
parent90e5a5ff7e624f0f0b5f96280ebb9387179ae987 (diff)
Merge pull request #377 from Deokishisu/master
Fix Egregious Magic Numbers in GetBattleBGM
Diffstat (limited to 'src')
-rw-r--r--src/pokemon.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/pokemon.c b/src/pokemon.c
index 00c1bdc9c..ac0699e56 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -31,6 +31,7 @@
#include "constants/abilities.h"
#include "constants/flags.h"
#include "constants/moves.h"
+#include "constants/songs.h"
#include "constants/trainer_classes.h"
#include "constants/facility_trainer_classes.h"
#include "constants/hold_effects.h"
@@ -5661,40 +5662,40 @@ void ClearBattleMonForms(void)
gBattleMonForms[i] = 0;
}
-static u16 GetMUS_ForBattle(void)
+static u16 GetBattleBGM(void)
{
- if (gBattleTypeFlags & 0x1000)
- return 0x12A;
- if (gBattleTypeFlags & 0x4000)
- return 0x10A;
- if (gBattleTypeFlags & 0x2)
- return 0x10A;
- if (gBattleTypeFlags & 0x8)
+ if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON)
+ return MUS_VS_WILD;
+ if (gBattleTypeFlags & BATTLE_TYPE_REGI)
+ return MUS_RS_VS_TRAINER;
+ if (gBattleTypeFlags & BATTLE_TYPE_LINK)
+ return MUS_RS_VS_TRAINER;
+ if (gBattleTypeFlags & BATTLE_TYPE_TRAINER)
{
switch (gTrainers[gTrainerBattleOpponent_A].trainerClass)
{
- case 0x5A:
- return 0x12B;
- case 0x54:
- case 0x57:
- return 0x128;
- case 0x53:
- case 0x55:
- case 0x56:
- case 0x58:
- case 0x59:
+ case CLASS_CHAMPION_2:
+ return MUS_VS_CHAMPION;
+ case CLASS_LEADER_2:
+ case CLASS_ELITE_FOUR_2:
+ return MUS_VS_GYM_LEADER;
+ case CLASS_BOSS:
+ case CLASS_TEAM_ROCKET:
+ case CLASS_COOLTRAINER_2:
+ case CLASS_GENTLEMAN_2:
+ case CLASS_RIVAL_2:
default:
- return 0x129;
+ return MUS_VS_TRAINER;
}
}
- return 0x12A;
+ return MUS_VS_WILD;
}
void PlayBattleBGM(void)
{
ResetMapMusic();
m4aMPlayAllStop();
- PlayBGM(GetMUS_ForBattle());
+ PlayBGM(GetBattleBGM());
}
void PlayMapChosenOrBattleBGM(u16 songId)
@@ -5704,7 +5705,7 @@ void PlayMapChosenOrBattleBGM(u16 songId)
if (songId)
PlayNewMapMusic(songId);
else
- PlayNewMapMusic(GetMUS_ForBattle());
+ PlayNewMapMusic(GetBattleBGM());
}
const u32 *GetMonFrontSpritePal(struct Pokemon *mon)