summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-11-07 09:23:21 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2019-11-07 09:23:21 -0500
commit64485f5cd106285e6ed7ec461db49e02b6308d8a (patch)
tree2e10109e1907705991155c8a86b9d82b5ae2de9c
parented426e1f8fb52a79eed074597b210a0f60a30106 (diff)
TRAINER_SECRET_BASE propagation
-rw-r--r--data/battle_scripts_1.s3
-rw-r--r--include/constants/trainers.h1
-rw-r--r--src/battle_script_commands.c6
3 files changed, 6 insertions, 4 deletions
diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s
index c4b0117a5..b802723b7 100644
--- a/data/battle_scripts_1.s
+++ b/data/battle_scripts_1.s
@@ -8,6 +8,7 @@
#include "constants/species.h"
#include "constants/pokemon.h"
#include "constants/songs.h"
+#include "constants/trainers.h"
#include "constants/game_stat.h"
#include "battle_string_ids.h"
.include "asm/macros/battle_script.inc"
@@ -2931,7 +2932,7 @@ BattleScript_PayDayMoneyAndPickUpItems::
BattleScript_LocalBattleLost::
jumpifbattletype BATTLE_TYPE_TRAINER_TOWER, BattleScript_BattleTowerLost
jumpifbattletype BATTLE_TYPE_EREADER_TRAINER, BattleScript_EReaderOrSecretBaseTrainerEnd
- jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, 1024, BattleScript_EReaderOrSecretBaseTrainerEnd
+ jumpifhalfword CMP_EQUAL, gTrainerBattleOpponent_A, TRAINER_SECRET_BASE, BattleScript_EReaderOrSecretBaseTrainerEnd
jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, 0, BattleScript_RivalBattleLost
BattleScript_LocalBattleLostPrintWhiteOut::
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_LocalBattleLostEnd
diff --git a/include/constants/trainers.h b/include/constants/trainers.h
index d8c429ed5..30e11c14f 100644
--- a/include/constants/trainers.h
+++ b/include/constants/trainers.h
@@ -165,6 +165,7 @@
#define TRAINER_PIC_LADY 146
#define TRAINER_PIC_PAINTER 147
+// Leftover from R/S
#define TRAINER_SECRET_BASE 1024
#define F_TRAINER_FEMALE (1 << 7)
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 0eba68f29..181f59b09 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -5176,7 +5176,7 @@ static void atk5D_getmoneyreward(void)
// The whole function is using wrong registers.
if (gBattleOutcome == B_OUTCOME_WON)
{
- if (gTrainerBattleOpponent_A == 0x400)
+ if (gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
{
moneyReward = 20 * gBattleResources->secretBase->party.levels[0] * gBattleStruct->moneyMultiplier;
}
@@ -8810,7 +8810,7 @@ static void atkD2_tryswapitems(void) // trick
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER_TOWER
|| (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT
&& !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_EREADER_TRAINER))
- && gTrainerBattleOpponent_A != 0x400))
+ && gTrainerBattleOpponent_A != TRAINER_SECRET_BASE))
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}
@@ -8821,7 +8821,7 @@ static void atkD2_tryswapitems(void) // trick
// you can't swap items if they were knocked off in regular battles
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_EREADER_TRAINER))
- && gTrainerBattleOpponent_A != 0x400
+ && gTrainerBattleOpponent_A != TRAINER_SECRET_BASE
&& (gWishFutureKnock.knockedOffMons[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]
|| gWishFutureKnock.knockedOffMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]]))
{