Custom wild multi battles functionality

This commit is contained in:
DizzyEggg 2018-11-24 17:31:45 +01:00
parent 1c8e574646
commit cc635c5e6d
6 changed files with 15 additions and 9 deletions

View File

@ -2180,9 +2180,9 @@ sub_81B1250: @ 81B1250
push {lr}
ldr r0, =gBattleTypeFlags
ldr r0, [r0]
movs r1, 0x49
movs r1, 0x41
ands r0, r1
cmp r0, 0x49
cmp r0, 0x41
bne _081B1280
ldr r0, =gMain
ldr r1, =0x00000439

View File

@ -49,8 +49,8 @@ EverGrandeCity_PokemonLeague_1F_Pokemart_229624: @ 8229624
EverGrandeCity_PokemonLeague_1F_EventScript_229636:: @ 8229636
special SavePlayerParty
trainerbattle 10, 406, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF
trainerbattle 11, 402, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF
trainerbattle 10, 264, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF
trainerbattle 11, 263, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF
setvar VAR_0x8004, 11
setvar VAR_0x8005, 0

View File

@ -47,6 +47,7 @@ void BattleSetup_StartLegendaryBattle(void);
void StartGroudonKyogreBattle(void);
void StartRegiBattle(void);
u8 BattleSetup_GetTerrainId(void);
u8 GetWildBattleTransition(void);
u8 GetTrainerBattleTransition(void);
u8 sub_80B100C(s32 arg0);
void ChooseStarter(void);

View File

@ -3442,7 +3442,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT
|| GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)
|| (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT && gBattleTypeFlags & BATTLE_TYPE_TRAINER))
{
BtlController_EmitDrawTrainerPic(0);
MarkBattlerForControllerExec(gActiveBattler);

View File

@ -78,7 +78,6 @@ static void DoSafariBattle(void);
static void DoStandardWildBattle(bool32 isDouble);
static void CB2_EndWildBattle(void);
static void CB2_EndScriptedWildBattle(void);
static u8 GetWildBattleTransition(void);
static void sub_80B1218(void);
static void sub_80B1234(void);
static void CB2_GiveStarter(void);
@ -772,7 +771,7 @@ static u8 GetSumOfEnemyPartyLevel(u16 opponentId, u8 numMons)
return sum;
}
static u8 GetWildBattleTransition(void)
u8 GetWildBattleTransition(void)
{
u8 transitionType = GetBattleTransitionTypeByMap();
u8 enemyLevel = GetMonData(&gEnemyParty[0], MON_DATA_LEVEL);

View File

@ -1480,13 +1480,19 @@ void DoSpecialTrainerBattle(void)
BattleTransition_StartOnField(B_TRANSITION_MAGMA);
break;
case SPECIAL_BATTLE_MULTI:
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER;
if (gSpecialVar_0x8005 & 1)
gBattleTypeFlags = BATTLE_TYPE_DOUBLE | BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER;
else
gBattleTypeFlags = BATTLE_TYPE_TRAINER | BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_MULTI | BATTLE_TYPE_INGAME_PARTNER;
gPartnerSpriteId = gSpecialVar_0x8007;
FillPartnerParty(gSpecialVar_0x8006 + TRAINER_CUSTOM_PARTNER);
gPartnerTrainerId = gSpecialVar_0x8006 + TRAINER_CUSTOM_PARTNER;
CreateTask(Task_StartBattleAfterTransition, 1);
PlayMapChosenOrBattleBGM(0);
BattleTransition_StartOnField(GetTrainerBattleTransition());
if (gSpecialVar_0x8005 & 1)
BattleTransition_StartOnField(GetWildBattleTransition());
else
BattleTransition_StartOnField(GetTrainerBattleTransition());
break;
}
}