diff --git a/asm/macros/event.inc b/asm/macros/event.inc index a518b7be2c..e2bf9a06e8 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -776,6 +776,16 @@ trainerbattle TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT, \trainer, 0, \lose_text .endm + @ Starts a double battle with the player against two trainers + @ Takes two trainers and defeat text for each + .macro trainerbattle_two_trainers trainer_a:req, lose_text_a:req, trainer_b:req, lose_text_b:req + .byte 0x5c + .byte TRAINER_BATTLE_TWO_TRAINERS_NO_INTRO + .2byte \trainer_a + .4byte \lose_text_a + .2byte \trainer_b + .4byte \lose_text_b + .endm @ Starts a trainer battle using the battle information stored in RAM (usually by the scripts in trainer_battle.inc, which @ are run by trainerbattle), and blocks script execution until the battle finishes. @@ -2095,7 +2105,7 @@ setvar VAR_0x8002, \tryMultiple special TrySpecialOverworldEvo .endm - + .macro ai_vs_ai_battle trainer1:req, trainer2:req setflag B_FLAG_AI_VS_AI_BATTLE setvar VAR_0x8004, \trainer1 diff --git a/include/constants/battle_setup.h b/include/constants/battle_setup.h index d825c88bc3..bb7f9adefa 100644 --- a/include/constants/battle_setup.h +++ b/include/constants/battle_setup.h @@ -14,5 +14,6 @@ #define TRAINER_BATTLE_SET_TRAINER_A 10 #define TRAINER_BATTLE_SET_TRAINER_B 11 #define TRAINER_BATTLE_HILL 12 +#define TRAINER_BATTLE_TWO_TRAINERS_NO_INTRO 13 #endif // GUARD_CONSTANTS_BATTLE_SETUP_H diff --git a/src/battle_setup.c b/src/battle_setup.c index 92fc2bea25..e92b32d4c9 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -254,6 +254,23 @@ static const struct TrainerBattleParameter sTrainerBContinueScriptBattleParams[] {&sTrainerBattleEndScript, TRAINER_PARAM_LOAD_SCRIPT_RET_ADDR}, }; +// two trainers, each with a defeat speech +static const struct TrainerBattleParameter sTrainerTwoTrainerBattleParams[] = +{ + {&sTrainerBattleMode, TRAINER_PARAM_LOAD_VAL_8BIT}, + {&sTrainerObjectEventLocalId, TRAINER_PARAM_CLEAR_VAL_16BIT}, + {&gTrainerBattleOpponent_A, TRAINER_PARAM_LOAD_VAL_16BIT}, + {&sTrainerAIntroSpeech, TRAINER_PARAM_CLEAR_VAL_32BIT}, + {&sTrainerADefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT}, + {&gTrainerBattleOpponent_B, TRAINER_PARAM_LOAD_VAL_16BIT}, + {&sTrainerBIntroSpeech, TRAINER_PARAM_CLEAR_VAL_32BIT}, + {&sTrainerBDefeatSpeech, TRAINER_PARAM_LOAD_VAL_32BIT}, + {&sTrainerVictorySpeech, TRAINER_PARAM_CLEAR_VAL_32BIT}, + {&sTrainerCannotBattleSpeech, TRAINER_PARAM_CLEAR_VAL_32BIT}, + {&sTrainerBBattleScriptRetAddr, TRAINER_PARAM_CLEAR_VAL_32BIT}, + {&sTrainerBattleEndScript, TRAINER_PARAM_LOAD_SCRIPT_RET_ADDR}, +}; + #define REMATCH(trainer1, trainer2, trainer3, trainer4, trainer5, map) \ { \ .trainerIds = {trainer1, trainer2, trainer3, trainer4, trainer5}, \ @@ -1230,6 +1247,11 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data) gTrainerBattleOpponent_B = LocalIdToHillTrainerId(gSpecialVar_LastTalked); } return EventScript_TryDoNormalTrainerBattle; + case TRAINER_BATTLE_TWO_TRAINERS_NO_INTRO: + gNoOfApproachingTrainers = 2; // set TWO_OPPONENTS gBattleTypeFlags + gApproachingTrainerId = 1; // prevent trainer approach + TrainerBattleLoadArgs(sTrainerTwoTrainerBattleParams, data); + return EventScript_DoNoIntroTrainerBattle; default: if (gApproachingTrainerId == 0) {