mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
Begin working on custom multi battles
This commit is contained in:
parent
10671a4f32
commit
539b05ff73
@ -228,6 +228,9 @@ HandleIntroSlide: @ 81181D4
|
||||
ldr r0, =0x00000c03
|
||||
cmp r1, r0
|
||||
beq _08118208
|
||||
adds r0, r0, #1
|
||||
cmp r1, r0
|
||||
bhi _08118208
|
||||
ldr r0, =sub_8118D68
|
||||
b _08118258
|
||||
.pool
|
||||
|
@ -47,6 +47,11 @@ EverGrandeCity_PokemonLeague_1F_Pokemart_229624: @ 8229624
|
||||
end
|
||||
|
||||
EverGrandeCity_PokemonLeague_1F_EventScript_229636:: @ 8229636
|
||||
setvar VAR_0x8004, 11
|
||||
setvar VAR_0x8006, 404
|
||||
setvar VAR_0x8007, 3
|
||||
special DoSpecialTrainerBattle
|
||||
waitstate
|
||||
lockall
|
||||
checkflag FLAG_0x107
|
||||
goto_eq EverGrandeCity_PokemonLeague_1F_EventScript_2296BB
|
||||
|
@ -861,6 +861,7 @@ extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
|
||||
extern u32 gFieldStatuses;
|
||||
extern struct FieldTimer gFieldTimers;
|
||||
extern u8 gBattlerAbility;
|
||||
extern u16 gPartnerSpriteId;
|
||||
|
||||
extern void (*gPreBattleCallback1)(void);
|
||||
extern void (*gBattleMainFunc)(void);
|
||||
|
@ -47,6 +47,7 @@ void BattleSetup_StartLegendaryBattle(void);
|
||||
void StartGroudonKyogreBattle(void);
|
||||
void StartRegiBattle(void);
|
||||
u8 BattleSetup_GetTerrainId(void);
|
||||
u8 GetTrainerBattleTransition(void);
|
||||
u8 sub_80B100C(s32 arg0);
|
||||
void ChooseStarter(void);
|
||||
void ResetTrainerOpponentIds(void);
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define SPECIAL_BATTLE_STEVEN 8
|
||||
#define SPECIAL_BATTLE_PIKE_DOUBLE 9
|
||||
#define SPECIAL_BATTLE_PYRAMID 10
|
||||
#define SPECIAL_BATTLE_MULTI 11
|
||||
|
||||
// For 'ShowFacilityResultsWindow' function which is a part of the 'CallFrontierUtilFunc' special.
|
||||
#define RESULTS_LINK_CONTEST 7
|
||||
|
@ -13,6 +13,7 @@
|
||||
#define TRAINER_LINK_OPPONENT 2048
|
||||
#define TRAINER_OPPONENT_C00 3072
|
||||
#define TRAINER_STEVEN_PARTNER 3075
|
||||
#define TRAINER_CUSTOM_PARTNER 3076
|
||||
|
||||
#define TRAINER_PIC_HIKER 0
|
||||
#define TRAINER_PIC_AQUA_GRUNT_M 1
|
||||
|
@ -1107,7 +1107,7 @@ void DrawBattleEntryBackground(void)
|
||||
}
|
||||
else if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_EREADER_TRAINER))
|
||||
{
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) || gPartnerTrainerId == TRAINER_STEVEN_PARTNER || gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
LZDecompressVram(gBattleTerrainAnimTiles_Building, (void*)(VRAM + 0x4000));
|
||||
LZDecompressVram(gBattleTerrainAnimTilemap_Building, (void*)(VRAM + 0xE000));
|
||||
|
@ -2318,7 +2318,7 @@ static void PlayerHandleDrawTrainerPic(void)
|
||||
else // First mon, on the left.
|
||||
xPos = 32;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
xPos = 90;
|
||||
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].coords) * 4 + 80;
|
||||
@ -2336,7 +2336,7 @@ static void PlayerHandleDrawTrainerPic(void)
|
||||
}
|
||||
|
||||
// Use front pic table for any tag battles unless your partner is Steven.
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
trainerPicId = PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender);
|
||||
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
|
||||
|
@ -1315,6 +1315,12 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
|
||||
xPos = 90;
|
||||
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
|
||||
}
|
||||
else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
trainerPicId = gPartnerSpriteId;
|
||||
xPos = 90;
|
||||
yPos = (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80;
|
||||
}
|
||||
else
|
||||
{
|
||||
trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId);
|
||||
@ -1323,7 +1329,7 @@ static void PlayerPartnerHandleDrawTrainerPic(void)
|
||||
}
|
||||
|
||||
// Use back pic only if the partner is Steven
|
||||
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
|
||||
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER || gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
|
||||
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
|
||||
@ -1799,6 +1805,11 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void)
|
||||
u8 spriteId = TRAINER_BACK_PIC_STEVEN;
|
||||
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
|
||||
}
|
||||
else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
u8 spriteId = gPartnerSpriteId;
|
||||
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 spriteId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId);
|
||||
|
@ -191,7 +191,6 @@ EWRAM_DATA u8 gDisplayedStringBattle[300] = {0};
|
||||
EWRAM_DATA u8 gBattleTextBuff1[TEXT_BUFF_ARRAY_COUNT] = {0};
|
||||
EWRAM_DATA u8 gBattleTextBuff2[TEXT_BUFF_ARRAY_COUNT] = {0};
|
||||
EWRAM_DATA u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT] = {0};
|
||||
EWRAM_DATA static u32 sUnusedUnknownArray[25] = {0};
|
||||
EWRAM_DATA u32 gBattleTypeFlags = 0;
|
||||
EWRAM_DATA u8 gBattleTerrain = 0;
|
||||
EWRAM_DATA u32 gUnknown_02022FF4 = 0;
|
||||
@ -288,6 +287,7 @@ EWRAM_DATA u8 gBattleMonForms[MAX_BATTLERS_COUNT] = {0};
|
||||
EWRAM_DATA u32 gFieldStatuses = 0;
|
||||
EWRAM_DATA struct FieldTimer gFieldTimers = {0};
|
||||
EWRAM_DATA u8 gBattlerAbility = 0;
|
||||
EWRAM_DATA u16 gPartnerSpriteId = 0;
|
||||
|
||||
// IWRAM common vars
|
||||
void (*gPreBattleCallback1)(void);
|
||||
@ -616,7 +616,7 @@ static void CB2_InitBattleInternal(void)
|
||||
|
||||
gBattle_WIN0H = 240;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER && gPartnerTrainerId < TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
gBattle_WIN0V = 159;
|
||||
gBattle_WIN1H = 240;
|
||||
@ -2693,7 +2693,7 @@ static void sub_80398D0(struct Sprite *sprite)
|
||||
{
|
||||
sprite->invisible = FALSE;
|
||||
sprite->callback = SpriteCallbackDummy_2;
|
||||
sUnusedUnknownArray[0] = 0;
|
||||
// sUnusedUnknownArray[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2684,7 +2684,7 @@ static const u8 *BattleStringGetPlayerName(u8 *text, u8 battlerId)
|
||||
toCpy = gSaveBlock2Ptr->playerName;
|
||||
break;
|
||||
case B_POSITION_PLAYER_RIGHT:
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_MULTI))
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & (BATTLE_TYPE_RECORDED | BATTLE_TYPE_MULTI))
|
||||
{
|
||||
toCpy = gLinkPlayers[2].name;
|
||||
}
|
||||
|
@ -3360,7 +3360,7 @@ static bool32 IsBattleLostForPlayer(void)
|
||||
u32 i;
|
||||
u32 HP_count = 0;
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && (gPartnerTrainerId == TRAINER_STEVEN_PARTNER || gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER))
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
|
@ -79,7 +79,6 @@ static void DoStandardWildBattle(bool32 isDouble);
|
||||
static void CB2_EndWildBattle(void);
|
||||
static void CB2_EndScriptedWildBattle(void);
|
||||
static u8 GetWildBattleTransition(void);
|
||||
static u8 GetTrainerBattleTransition(void);
|
||||
static void sub_80B1218(void);
|
||||
static void sub_80B1234(void);
|
||||
static void CB2_GiveStarter(void);
|
||||
@ -795,7 +794,7 @@ static u8 GetWildBattleTransition(void)
|
||||
}
|
||||
}
|
||||
|
||||
static u8 GetTrainerBattleTransition(void)
|
||||
u8 GetTrainerBattleTransition(void)
|
||||
{
|
||||
u8 minPartyCount;
|
||||
u8 transitionType;
|
||||
|
@ -792,6 +792,10 @@ u8 GetFrontierOpponentClass(u16 trainerId)
|
||||
{
|
||||
trainerClass = gTrainers[TRAINER_STEVEN].trainerClass;
|
||||
}
|
||||
else if (trainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
trainerClass = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].trainerClass;
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
{
|
||||
trainerClass = gFacilityClassToTrainerClass[gFacilityTrainers[trainerId].facilityClass];
|
||||
@ -875,6 +879,11 @@ void GetFrontierTrainerName(u8 *dst, u16 trainerId)
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
|
||||
dst[i] = gTrainers[TRAINER_STEVEN].trainerName[i];
|
||||
}
|
||||
else if (trainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
for (i = 0; gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].trainerName[i] != EOS; i++)
|
||||
dst[i] = gTrainers[trainerId - TRAINER_CUSTOM_PARTNER].trainerName[i];
|
||||
}
|
||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||
{
|
||||
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
|
||||
@ -1463,6 +1472,19 @@ void DoSpecialTrainerBattle(void)
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
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;
|
||||
gPartnerSpriteId = gSpecialVar_0x8007;
|
||||
FillPartnerParty(gSpecialVar_0x8006 + TRAINER_CUSTOM_PARTNER);
|
||||
gApproachingTrainerId = 0;
|
||||
BattleSetup_ConfigureTrainerBattle(MossdeepCity_SpaceCenter_2F_EventScript_224157 + 1);
|
||||
gApproachingTrainerId = 1;
|
||||
BattleSetup_ConfigureTrainerBattle(MossdeepCity_SpaceCenter_2F_EventScript_224166 + 1);
|
||||
gPartnerTrainerId = gSpecialVar_0x8006 + TRAINER_CUSTOM_PARTNER;
|
||||
CreateTask(Task_StartBattleAfterTransition, 1);
|
||||
PlayMapChosenOrBattleBGM(0);
|
||||
BattleTransition_StartOnField(GetTrainerBattleTransition());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2307,6 +2329,14 @@ static void FillPartnerParty(u16 trainerId)
|
||||
CalculateMonStats(&gPlayerParty[3 + i]);
|
||||
}
|
||||
}
|
||||
else if (trainerId >= TRAINER_CUSTOM_PARTNER)
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
// Temporary.
|
||||
CreateMon(&gPlayerParty[3 + i], Random() % NUM_SPECIES, Random() % MAX_LEVEL, Random() % 31, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
else if (trainerId == TRAINER_EREADER)
|
||||
{
|
||||
// Scrapped, lol.
|
||||
|
Loading…
Reference in New Issue
Block a user