pokeemerald/src/battle_dome.c

6334 lines
224 KiB
C
Raw Normal View History

2018-08-15 15:49:50 +02:00
#include "global.h"
2018-08-25 19:59:47 +02:00
#include "battle_dome.h"
2018-08-15 15:49:50 +02:00
#include "battle.h"
#include "battle_main.h"
2018-08-15 15:49:50 +02:00
#include "battle_setup.h"
2018-08-25 18:46:15 +02:00
#include "battle_tower.h"
2018-10-30 22:17:03 +01:00
#include "frontier_util.h"
2018-08-15 23:04:46 +02:00
#include "battle_message.h"
2018-08-15 15:49:50 +02:00
#include "event_data.h"
#include "overworld.h"
#include "util.h"
#include "malloc.h"
2018-08-15 23:04:46 +02:00
#include "string_util.h"
#include "random.h"
2018-08-18 00:54:18 +02:00
#include "task.h"
#include "main.h"
#include "gpu_regs.h"
#include "text.h"
#include "bg.h"
#include "window.h"
2019-02-08 18:08:25 +01:00
#include "strings.h"
2018-08-18 00:54:18 +02:00
#include "palette.h"
#include "decompress.h"
2018-12-24 00:02:29 +01:00
#include "party_menu.h"
2018-08-18 00:54:18 +02:00
#include "menu.h"
2018-08-18 19:52:25 +02:00
#include "sound.h"
2018-08-18 00:54:18 +02:00
#include "pokemon_icon.h"
2019-04-04 23:53:06 +02:00
#include "data.h"
2018-08-19 17:13:05 +02:00
#include "international_string_util.h"
2018-08-19 01:06:10 +02:00
#include "trainer_pokemon_sprites.h"
2018-08-21 23:36:59 +02:00
#include "scanline_effect.h"
2018-12-05 22:21:26 +01:00
#include "script_pokemon_util_80F87D8.h"
2018-10-21 09:24:57 +02:00
#include "graphics.h"
#include "constants/battle_dome.h"
#include "constants/frontier_util.h"
2018-08-15 15:49:50 +02:00
#include "constants/species.h"
2018-08-15 23:04:46 +02:00
#include "constants/moves.h"
#include "constants/pokemon.h"
2018-08-15 23:04:46 +02:00
#include "constants/trainers.h"
#include "constants/abilities.h"
2018-08-18 19:52:25 +02:00
#include "constants/songs.h"
2018-08-25 19:59:47 +02:00
#include "constants/battle_frontier.h"
2018-08-29 20:38:54 +02:00
#include "constants/rgb.h"
2018-08-18 19:52:25 +02:00
2018-08-25 19:59:47 +02:00
struct BattleDomeStruct
2018-08-18 00:54:18 +02:00
{
2018-08-25 19:59:47 +02:00
u8 arr[DOME_TOURNAMENT_TRAINERS_COUNT];
u8 unk_10;
u8 unk_11[3];
2018-08-18 00:54:18 +02:00
};
2018-08-25 19:59:47 +02:00
struct UnkStruct_860DD10
{
u8 x;
u8 y;
u16 src;
};
#define DOME_TRAINERS gSaveBlock2Ptr->frontier.domeTrainers
#define DOME_MONS gSaveBlock2Ptr->frontier.domeMonIds
2018-08-15 15:49:50 +02:00
// This file's functions.
2018-08-25 19:59:47 +02:00
static u8 GetDomeTrainerMonIvs(u16 trainerId);
2019-02-08 18:08:25 +01:00
static void SwapDomeTrainers(int id1, int id2, u16 *statsArray);
static void CalcDomeMonStats(u16 species, int level, int ivs, u8 evBits, u8 nature, int *stats);
static void CreateDomeOpponentMons(u16 tournamentTrainerId);
static int sub_818FCBC(u16 tournamentTrainerId, bool8 arg1);
static int sub_818FDB8(u16 tournamentTrainerId, bool8 arg1);
static int GetTypeEffectivenessPoints(int move, int species, int arg2);
static int SelectOpponentMonsFromParty(int *arr, bool8 arg1);
2019-02-08 18:08:25 +01:00
static void Task_ShowOpponentInfo(u8 taskId);
2018-08-25 19:59:47 +02:00
static void sub_8190CD4(u8 taskId);
static u8 sub_819221C(u8 taskId);
2019-02-08 18:08:25 +01:00
static void InitDomeFacilityTrainersAndMons(void);
static int TrainerIdToTournamentId(u16 trainerId);
2018-08-25 19:59:47 +02:00
static u16 TrainerIdOfPlayerOpponent(void);
2019-02-08 18:08:25 +01:00
static void Task_ShowTourneyTree(u8 taskId);
2018-08-25 19:59:47 +02:00
static void sub_8194950(u8 taskId);
2018-08-25 11:55:16 +02:00
static void CB2_BattleDome(void);
2018-08-25 18:46:15 +02:00
static void VblankCb0_BattleDome(void);
2018-08-21 23:36:59 +02:00
static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo);
2018-08-19 20:21:37 +02:00
static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId);
2019-02-08 18:08:25 +01:00
static int sub_8192F08(u8, u8*);
2018-08-25 19:59:47 +02:00
static u8 GetDomeBrainTrainerPicId(void);
static u8 GetDomeBrainTrainerClass(void);
2019-02-08 18:08:25 +01:00
static void CopyDomeBrainTrainerName(u8 *str);
static void CopyDomeTrainerName(u8 *str, u16 trainerId);
2018-08-25 19:59:47 +02:00
static void HblankCb_BattleDome(void);
2018-08-25 18:46:15 +02:00
static void VblankCb1_BattleDome(void);
2019-02-08 18:08:25 +01:00
static u8 UpdateTourneyTreeCursor(u8 taskId);
2018-08-25 19:59:47 +02:00
static void DecideRoundWinners(u8 roundId);
static u8 sub_81953E8(u8 tournamentId, u8);
static void sub_81948EC(u8, u8);
2018-08-26 15:51:14 +02:00
static void sub_8190B40(struct Sprite *sprite);
static void sub_8190C6C(struct Sprite *sprite);
2019-02-08 18:08:25 +01:00
static void InitDomeChallenge(void);
static void GetDomeData(void);
static void SetDomeData(void);
static void BufferDomeRoundText(void);
static void BufferDomeOpponentName(void);
static void InitDomeOpponentParty(void);
2018-08-26 15:51:14 +02:00
static void ShowDomeOpponentInfo(void);
2019-02-08 18:08:25 +01:00
static void ShowDomeTourneyTree(void);
static void ShowPreviousDomeResultsTourneyTree(void);
static void SetDomeOpponentId(void);
static void SetDomeOpponentGraphicsId(void);
static void ShowNonInteractiveDomeTourneyTree(void);
static void ResolveDomeRoundWinners(void);
static void SaveDomeChallenge(void);
static void IncrementDomeStreaks(void);
static void ResetSketchedMoves(void);
2019-02-08 18:08:25 +01:00
static void RestoreDomePlayerPartyHeldItems(void);
static void ReduceDomePlayerPartyToSelectedMons(void);
2019-02-08 18:08:25 +01:00
static void GetPlayerSeededBeforeOpponent(void);
static void BufferLastDomeWinnerName(void);
static void InitRandomTourneyTreeResults(void);
2018-08-26 15:51:14 +02:00
static void InitDomeTrainers(void);
2018-08-26 14:40:36 +02:00
2018-08-25 19:59:47 +02:00
// EWRAM variables.
EWRAM_DATA u32 gPlayerPartyLostHP = 0; // never read
static EWRAM_DATA u32 sPlayerPartyMaxHP = 0; // never read
2018-08-25 19:59:47 +02:00
static EWRAM_DATA struct BattleDomeStruct *sBattleDomeStruct = {0};
static EWRAM_DATA u8 *sTilemapBuffer = NULL;
// Const rom data.
2019-02-08 22:07:42 +01:00
static const u8 sMovePointsForDomeTrainers[MOVES_COUNT][DOME_TOURNAMENT_TRAINERS_COUNT] =
2018-08-19 22:26:07 +02:00
{
[MOVE_NONE] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
[MOVE_POUND] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
[MOVE_KARATE_CHOP] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
[MOVE_DOUBLE_SLAP] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
[MOVE_COMET_PUNCH] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
[MOVE_MEGA_PUNCH] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
[MOVE_PAY_DAY] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1},
[MOVE_FIRE_PUNCH] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1},
[MOVE_ICE_PUNCH] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1},
[MOVE_THUNDER_PUNCH] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1},
[MOVE_SCRATCH] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
[MOVE_VICE_GRIP] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
};
static const u8 sUnusedArray[] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 3, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 0, 0, 2,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 2, 253, 0, 0, 0, 0, 0, 253, 0, 0, 0, 0, 0, 253, 0,
0, 0, 0, 0, 253, 0, 0, 0, 0, 0, 253, 254, 0, 0, 0, 0,
0, 254, 0, 0, 0, 0, 0, 254, 0, 0, 0, 0, 0, 254, 0, 0,
0, 0, 0, 254, 0, 0, 0, 0, 0,
};
2019-02-08 18:08:25 +01:00
static const u8 sTourneyTreeCursorMovementMap[][5][4]=
2018-08-26 14:40:36 +02:00
{
{{0x07, 0x01, 0x08, 0x10}, {0x07, 0x01, 0x08, 0x10}, {0x07, 0x01, 0x08, 0x10}, {0x07, 0x01, 0x08, 0x10}, {0x07, 0x01, 0x08, 0x10}},
{{0x00, 0x02, 0x09, 0x10}, {0x00, 0x02, 0x09, 0x10}, {0x00, 0x02, 0x09, 0x10}, {0x00, 0x02, 0x09, 0x10}, {0x00, 0x02, 0x09, 0x10}},
{{0x01, 0x03, 0x0a, 0x11}, {0x01, 0x03, 0x0a, 0x11}, {0x01, 0x03, 0x0a, 0x11}, {0x01, 0x03, 0x0a, 0x11}, {0x01, 0x03, 0x0a, 0x11}},
{{0x02, 0x04, 0x0b, 0x11}, {0x02, 0x04, 0x0b, 0x11}, {0x02, 0x04, 0x0b, 0x11}, {0x02, 0x04, 0x0b, 0x11}, {0x02, 0x04, 0x0b, 0x11}},
{{0x03, 0x05, 0x0c, 0x12}, {0x03, 0x05, 0x0c, 0x12}, {0x03, 0x05, 0x0c, 0x12}, {0x03, 0x05, 0x0c, 0x12}, {0x03, 0x05, 0x0c, 0x12}},
{{0x04, 0x06, 0x0d, 0x12}, {0x04, 0x06, 0x0d, 0x12}, {0x04, 0x06, 0x0d, 0x12}, {0x04, 0x06, 0x0d, 0x12}, {0x04, 0x06, 0x0d, 0x12}},
{{0x05, 0x07, 0x0e, 0x13}, {0x05, 0x07, 0x0e, 0x13}, {0x05, 0x07, 0x0e, 0x13}, {0x05, 0x07, 0x0e, 0x13}, {0x05, 0x07, 0x0e, 0x13}},
{{0x06, 0x00, 0x0f, 0x13}, {0x06, 0x00, 0x0f, 0x13}, {0x06, 0x00, 0x0f, 0x13}, {0x06, 0x00, 0x0f, 0x13}, {0x06, 0x00, 0x0f, 0x13}},
{{0x1f, 0x09, 0x14, 0x1f}, {0x1f, 0x09, 0x14, 0x1f}, {0x1f, 0x09, 0x14, 0x1f}, {0x1f, 0x09, 0x14, 0x1f}, {0x1f, 0x09, 0x14, 0x1f}},
{{0x08, 0x0a, 0x14, 0x01}, {0x08, 0x0a, 0x14, 0x01}, {0x08, 0x0a, 0x14, 0x01}, {0x08, 0x0a, 0x14, 0x01}, {0x08, 0x0a, 0x14, 0x01}},
{{0x09, 0x0b, 0x15, 0x02}, {0x09, 0x0b, 0x15, 0x02}, {0x09, 0x0b, 0x15, 0x02}, {0x09, 0x0b, 0x15, 0x02}, {0x09, 0x0b, 0x15, 0x02}},
{{0x0a, 0x0c, 0x15, 0x03}, {0x0a, 0x0c, 0x15, 0x03}, {0x0a, 0x0c, 0x15, 0x03}, {0x0a, 0x0c, 0x15, 0x03}, {0x0a, 0x0c, 0x15, 0x03}},
{{0x0b, 0x0d, 0x16, 0x04}, {0x0b, 0x0d, 0x16, 0x04}, {0x0b, 0x0d, 0x16, 0x04}, {0x0b, 0x0d, 0x16, 0x04}, {0x0b, 0x0d, 0x16, 0x04}},
{{0x0c, 0x0e, 0x16, 0x05}, {0x0c, 0x0e, 0x16, 0x05}, {0x0c, 0x0e, 0x16, 0x05}, {0x0c, 0x0e, 0x16, 0x05}, {0x0c, 0x0e, 0x16, 0x05}},
{{0x0d, 0x0f, 0x17, 0x06}, {0x0d, 0x0f, 0x17, 0x06}, {0x0d, 0x0f, 0x17, 0x06}, {0x0d, 0x0f, 0x17, 0x06}, {0x0d, 0x0f, 0x17, 0x06}},
{{0x0e, 0x1f, 0x17, 0x07}, {0x0e, 0x1f, 0x17, 0x07}, {0x0e, 0x1f, 0x17, 0x07}, {0x0e, 0x1f, 0x17, 0x07}, {0x0e, 0x1f, 0x17, 0x07}},
{{0x13, 0x11, 0x00, 0x14}, {0x13, 0x11, 0x00, 0x18}, {0x13, 0x11, 0x00, 0x18}, {0x13, 0x11, 0x00, 0x18}, {0x13, 0x11, 0x00, 0x18}},
{{0x10, 0x12, 0x02, 0x15}, {0x10, 0x12, 0x02, 0x18}, {0x10, 0x12, 0x02, 0x18}, {0x10, 0x12, 0x02, 0x18}, {0x10, 0x12, 0x02, 0x18}},
{{0x11, 0x13, 0x04, 0x16}, {0x11, 0x13, 0x04, 0x19}, {0x11, 0x13, 0x04, 0x19}, {0x11, 0x13, 0x04, 0x19}, {0x11, 0x13, 0x04, 0x19}},
{{0x12, 0x10, 0x06, 0x17}, {0x12, 0x10, 0x06, 0x19}, {0x12, 0x10, 0x06, 0x19}, {0x12, 0x10, 0x06, 0x19}, {0x12, 0x10, 0x06, 0x19}},
{{0x17, 0x15, 0x10, 0x08}, {0x17, 0x15, 0x1a, 0x08}, {0x17, 0x15, 0x1a, 0x08}, {0x17, 0x15, 0x1a, 0x08}, {0x17, 0x15, 0x1a, 0x08}},
{{0x14, 0x16, 0x11, 0x0a}, {0x14, 0x16, 0x1a, 0x0a}, {0x14, 0x16, 0x1a, 0x0a}, {0x14, 0x16, 0x1a, 0x0a}, {0x14, 0x16, 0x1a, 0x0a}},
{{0x15, 0x17, 0x12, 0x0c}, {0x15, 0x17, 0x1b, 0x0c}, {0x15, 0x17, 0x1b, 0x0c}, {0x15, 0x17, 0x1b, 0x0c}, {0x15, 0x17, 0x1b, 0x0c}},
{{0x16, 0x14, 0x13, 0x0e}, {0x16, 0x14, 0x1b, 0x0e}, {0x16, 0x14, 0x1b, 0x0e}, {0x16, 0x14, 0x1b, 0x0e}, {0x16, 0x14, 0x1b, 0x0e}},
{{0xff, 0xff, 0xff, 0xff}, {0x19, 0x19, 0x10, 0x1a}, {0x19, 0x19, 0x10, 0x1c}, {0x19, 0x19, 0x10, 0x1c}, {0x19, 0x19, 0x10, 0x1c}},
{{0xff, 0xff, 0xff, 0xff}, {0x18, 0x18, 0x12, 0x1b}, {0x18, 0x18, 0x12, 0x1c}, {0x18, 0x18, 0x12, 0x1c}, {0x18, 0x18, 0x12, 0x1c}},
{{0xff, 0xff, 0xff, 0xff}, {0x1b, 0x1b, 0x18, 0x14}, {0x1b, 0x1b, 0x1d, 0x14}, {0x1b, 0x1b, 0x1d, 0x14}, {0x1b, 0x1b, 0x1d, 0x14}},
{{0xff, 0xff, 0xff, 0xff}, {0x1a, 0x1a, 0x19, 0x16}, {0x1a, 0x1a, 0x1d, 0x16}, {0x1a, 0x1a, 0x1d, 0x16}, {0x1a, 0x1a, 0x1d, 0x16}},
{{0xff, 0xff, 0xff, 0xff}, {0xff, 0xff, 0xff, 0xff}, {0xff, 0xff, 0x18, 0x1d}, {0xff, 0xff, 0x18, 0x1e}, {0xff, 0xff, 0x18, 0x1e}},
{{0xff, 0xff, 0xff, 0xff}, {0xff, 0xff, 0xff, 0xff}, {0xff, 0xff, 0x1c, 0x1a}, {0xff, 0xff, 0x1e, 0x1a}, {0xff, 0xff, 0x1e, 0x1a}},
{{0xff, 0xff, 0xff, 0xff}, {0xff, 0xff, 0xff, 0xff}, {0xff, 0xff, 0xff, 0xff}, {0xff, 0xff, 0x1c, 0x1d}, {0xff, 0xff, 0x1c, 0x1d}},
{{0x0f, 0x08, 0x08, 0x00}, {0x0f, 0x08, 0x08, 0x00}, {0x0f, 0x08, 0x08, 0x00}, {0x0f, 0x08, 0x08, 0x00}, {0x0f, 0x08, 0x08, 0x00}},
};
static const struct BgTemplate gUnknown_0860CE74[4] =
{
{
.bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 28,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 29,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
},
{
.bg = 2,
.charBaseIndex = 2,
.mapBaseIndex = 30,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0
},
{
.bg = 3,
.charBaseIndex = 2,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0
},
};
static const struct BgTemplate sOpponentInfoBgTemplates[4] =
2018-08-26 14:40:36 +02:00
{
{
.bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 20,
.screenSize = 3,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 24,
.screenSize = 3,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 2,
.charBaseIndex = 2,
.mapBaseIndex = 28,
.screenSize = 3,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
},
{
.bg = 3,
.charBaseIndex = 2,
.mapBaseIndex = 7,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
},
};
2018-08-26 15:51:14 +02:00
static const struct WindowTemplate gUnknown_0860CE94[] =
2018-08-26 14:40:36 +02:00
{
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 0,
.tilemapTop = 3,
.width = 8,
.height = 16,
.paletteNum = 15,
.baseBlock = 16,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 22,
.tilemapTop = 3,
.width = 8,
.height = 16,
.paletteNum = 15,
.baseBlock = 144,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 8,
.tilemapTop = 1,
.width = 14,
.height = 2,
.paletteNum = 15,
.baseBlock = 272,
},
DUMMY_WIN_TEMPLATE,
};
static const struct WindowTemplate sOpponentInfoWindowTemplates[] =
2018-08-26 14:40:36 +02:00
{
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 2,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 1,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 16,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 53,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 19,
.tilemapTop = 7,
.width = 9,
.height = 3,
.paletteNum = 15,
.baseBlock = 69,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 16,
.tilemapTop = 10,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 96,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 12,
.width = 26,
.height = 7,
.paletteNum = 15,
.baseBlock = 112,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 5,
.tilemapTop = 2,
.width = 23,
.height = 2,
.paletteNum = 15,
.baseBlock = 294,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 340,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 20,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 356,
},
{
2018-10-27 00:53:07 +02:00
.bg = 0,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 16,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 372,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 2,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 1,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 16,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 53,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 19,
.tilemapTop = 7,
.width = 9,
.height = 3,
.paletteNum = 15,
.baseBlock = 69,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 16,
.tilemapTop = 10,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 96,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 12,
.width = 26,
.height = 7,
.paletteNum = 15,
.baseBlock = 112,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 5,
.tilemapTop = 2,
.width = 23,
.height = 2,
.paletteNum = 15,
.baseBlock = 294,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 340,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 20,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 15,
.baseBlock = 356,
},
{
2018-10-27 00:53:07 +02:00
.bg = 1,
2018-08-26 14:40:36 +02:00
.tilemapLeft = 2,
.tilemapTop = 16,
.width = 26,
.height = 2,
.paletteNum = 15,
.baseBlock = 372,
},
2018-08-26 15:51:14 +02:00
// UB: No DUMMY_WIN_TEMPLATE at the array's end.
2018-08-26 14:40:36 +02:00
};
2019-02-08 18:08:25 +01:00
static const struct ScanlineEffectParams sTourneyTreeScanlineEffectParams =
2018-08-26 14:40:36 +02:00
{
.dmaDest = (void *)REG_ADDR_BG3CNT,
2019-02-08 18:08:25 +01:00
.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT,
2018-08-26 14:40:36 +02:00
.initState = 1,
};
2019-02-08 18:08:25 +01:00
static const struct CompressedSpriteSheet sDomeOptionsSpriteSheet[] =
2018-08-26 14:40:36 +02:00
{
2018-08-26 15:51:14 +02:00
{gBattleFrontierGfx_DomeOptions, 0x0600, 0x0000},
{},
2018-08-26 14:40:36 +02:00
};
static const struct CompressedSpritePalette gUnknown_0860CF60[] =
{
2018-08-26 15:51:14 +02:00
{gUnknown_08D85444, 0x0000},
{},
2018-08-26 14:40:36 +02:00
};
static const struct OamData gUnknown_0860CF70 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
2018-08-26 14:40:36 +02:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x16),
2018-08-26 14:40:36 +02:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(16x16),
2018-08-26 14:40:36 +02:00
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
2018-08-26 15:51:14 +02:00
static const struct OamData gUnknown_0860CF78 =
2018-08-26 14:40:36 +02:00
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
2018-08-26 14:40:36 +02:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x16),
2018-08-26 14:40:36 +02:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x16),
2018-08-26 14:40:36 +02:00
.tileNum = 0,
.priority = 0,
.paletteNum = 1,
.affineParam = 0,
};
static const struct OamData gUnknown_0860CF80 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
2018-08-26 14:40:36 +02:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x8),
2018-08-26 14:40:36 +02:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(16x8),
2018-08-26 14:40:36 +02:00
.tileNum = 0,
.priority = 0,
.paletteNum = 2,
.affineParam = 0,
};
static const struct OamData gUnknown_0860CF88 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
2018-08-26 14:40:36 +02:00
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(8x16),
2018-08-26 14:40:36 +02:00
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(8x16),
2018-08-26 14:40:36 +02:00
.tileNum = 0,
.priority = 0,
.paletteNum = 2,
.affineParam = 0,
};
static const union AnimCmd gUnknown_0860CF90[] =
{
ANIMCMD_FRAME(20, 1),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0860CF98[] =
{
ANIMCMD_FRAME(24, 1),
ANIMCMD_END,
};
static const union AnimCmd * const gUnknown_0860CFA0[] =
{
gUnknown_0860CF90,
gUnknown_0860CF98,
};
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860CFA8 =
{
.tileTag = 0x0000,
.paletteTag = 0xffff,
.oam = &gUnknown_0860CF70,
.anims = gUnknown_0860CFA0,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860CFC0[] =
{
2018-08-26 15:51:14 +02:00
ANIMCMD_FRAME(8, 1),
2018-08-26 14:40:36 +02:00
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0860CFC8[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END,
};
static const union AnimCmd * const gUnknown_0860CFD0[] =
{
gUnknown_0860CFC0,
gUnknown_0860CFC8,
};
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860CFD8 =
{
.tileTag = 0x0000,
.paletteTag = 0xffff,
.oam = &gUnknown_0860CF78,
.anims = gUnknown_0860CFD0,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860CFF0[] =
{
ANIMCMD_FRAME(40, 1),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0860CFF8[] =
{
ANIMCMD_FRAME(32, 1),
ANIMCMD_END,
};
static const union AnimCmd * const gUnknown_0860D000[] =
{
gUnknown_0860CFF0,
gUnknown_0860CFF8,
};
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860D008 =
{
.tileTag = 0x0000,
.paletteTag = 0xffff,
.oam = &gUnknown_0860CF78,
.anims = gUnknown_0860D000,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860D020[] =
{
ANIMCMD_FRAME(18, 1),
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0860D028[] =
{
ANIMCMD_FRAME(18, 1, .vFlip = TRUE),
2018-08-26 14:40:36 +02:00
ANIMCMD_END,
};
2018-08-26 15:51:14 +02:00
2018-08-26 14:40:36 +02:00
static const union AnimCmd gUnknown_0860D030[] =
{
ANIMCMD_FRAME(16, 1, .hFlip = TRUE),
2018-08-26 14:40:36 +02:00
ANIMCMD_END,
};
static const union AnimCmd gUnknown_0860D038[] =
{
ANIMCMD_FRAME(16, 1),
ANIMCMD_END,
};
static const union AnimCmd * const gUnknown_0860D040[] =
{
gUnknown_0860D020,
gUnknown_0860D028,
};
static const union AnimCmd * const gUnknown_0860D048[] =
{
gUnknown_0860D030,
gUnknown_0860D038,
};
2018-08-26 16:45:08 +02:00
static const struct SpriteTemplate gUnknown_0860D050 =
{
.tileTag = 0x0000,
.paletteTag = 0xffff,
.oam = &gUnknown_0860CF88,
.anims = gUnknown_0860D048,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_8190B40
};
static const struct SpriteTemplate gUnknown_0860D068 =
{
.tileTag = 0x0000,
.paletteTag = 0xffff,
.oam = &gUnknown_0860CF80,
.anims = gUnknown_0860D040,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_8190C6C
};
2018-08-26 14:40:36 +02:00
2019-02-08 18:08:25 +01:00
static const u8 sTourneyTreeTrainerIds[] = {0, 8, 12, 4, 7, 15, 11, 3, 2, 10, 14, 6, 5, 13, 9, 1};
2018-08-26 14:40:36 +02:00
2019-02-08 18:08:25 +01:00
static void (* const sBattleDomeFunctions[])(void) =
2018-08-26 14:40:36 +02:00
{
[BATTLE_DOME_FUNC_INIT] = InitDomeChallenge,
[BATTLE_DOME_FUNC_GET_DATA] = GetDomeData,
[BATTLE_DOME_FUNC_SET_DATA] = SetDomeData,
[BATTLE_DOME_FUNC_GET_ROUND_TEXT] = BufferDomeRoundText,
[BATTLE_DOME_FUNC_GET_OPPONENT_NAME] = BufferDomeOpponentName,
[BATTLE_DOME_FUNC_INIT_OPPONENT_PARTY] = InitDomeOpponentParty,
[BATTLE_DOME_FUNC_SHOW_OPPONENT_INFO] = ShowDomeOpponentInfo,
[BATTLE_DOME_FUNC_SHOW_TOURNEY_TREE] = ShowDomeTourneyTree,
[BATTLE_DOME_FUNC_SHOW_PREV_RESULTS_TREE] = ShowPreviousDomeResultsTourneyTree,
[BATTLE_DOME_FUNC_SET_OPPONENT_ID] = SetDomeOpponentId,
[BATTLE_DOME_FUNC_SET_OPPONENT_GFX] = SetDomeOpponentGraphicsId,
[BATTLE_DOME_FUNC_SHOW_STATIC_TOURNEY_TREE] = ShowNonInteractiveDomeTourneyTree,
[BATTLE_DOME_FUNC_RESOLVE_WINNERS] = ResolveDomeRoundWinners,
[BATTLE_DOME_FUNC_SAVE] = SaveDomeChallenge,
[BATTLE_DOME_FUNC_INCREMENT_STREAK] = IncrementDomeStreaks,
[BATTLE_DOME_FUNC_SET_TRAINERS] = InitDomeFacilityTrainersAndMons,
[BATTLE_DOME_FUNC_RESET_SKETCH] = ResetSketchedMoves,
[BATTLE_DOME_FUNC_RESTORE_HELD_ITEMS] = RestoreDomePlayerPartyHeldItems,
[BATTLE_DOME_FUNC_REDUCE_PARTY] = ReduceDomePlayerPartyToSelectedMons,
[BATTLE_DOME_FUNC_COMPARE_SEEDS] = GetPlayerSeededBeforeOpponent,
[BATTLE_DOME_FUNC_GET_WINNER_NAME] = BufferLastDomeWinnerName,
[BATTLE_DOME_FUNC_INIT_RESULTS_TREE] = InitRandomTourneyTreeResults,
[BATTLE_DOME_FUNC_INIT_TRAINERS] = InitDomeTrainers,
2018-08-26 14:40:36 +02:00
};
2019-11-24 22:58:40 +01:00
static const u32 sWinStreakFlags[][2] =
2018-08-26 14:40:36 +02:00
{
2019-11-24 22:58:40 +01:00
{STREAK_DOME_SINGLES_50, STREAK_DOME_SINGLES_OPEN},
{STREAK_DOME_DOUBLES_50, STREAK_DOME_DOUBLES_OPEN},
2018-08-26 14:40:36 +02:00
};
2019-11-24 22:58:40 +01:00
static const u32 sWinStreakMasks[][2] =
2018-08-26 14:40:36 +02:00
{
2019-11-24 22:58:40 +01:00
{~(STREAK_DOME_SINGLES_50), ~(STREAK_DOME_SINGLES_OPEN)},
{~(STREAK_DOME_DOUBLES_50), ~(STREAK_DOME_DOUBLES_OPEN)},
2018-08-26 14:40:36 +02:00
};
2018-08-26 21:41:47 +02:00
static const u8 sIdToOpponentId[DOME_TOURNAMENT_TRAINERS_COUNT][DOME_ROUNDS_COUNT] =
{
[0] = {8, 0, 4, 8},
[1] = {9, 12, 8, 0},
[2] = {10, 8, 12, 0},
[3] = {11, 4, 0, 8},
[4] = {12, 0, 4, 8},
[5] = {13, 12, 8, 0},
[6] = {14, 8, 12, 0},
[7] = {15, 4, 0, 8},
[8] = {0, 0, 4, 8},
[9] = {1, 12, 8, 0},
[10] = {2, 8, 12, 0},
[11] = {3, 4, 0, 8},
[12] = {4, 0, 4, 8},
[13] = {5, 12, 8, 0},
[14] = {6, 8, 12, 0},
[15] = {7, 4, 0, 8},
2018-08-26 14:40:36 +02:00
};
static const u8 gUnknown_0860D14C[] = {0x00, 0x08, 0x04, 0x0c, 0x07, 0x0f, 0x03, 0x0b, 0x02, 0x0a, 0x06, 0x0e, 0x05, 0x0d, 0x01, 0x09};
2018-08-26 15:51:14 +02:00
static const u8 gUnknown_0860D15C[][4] =
{
{0x00, 0x08, 0x0c, 0x0e},
{0x00, 0x08, 0x0c, 0x0e},
{0x01, 0x08, 0x0c, 0x0e},
{0x01, 0x08, 0x0c, 0x0e},
{0x02, 0x09, 0x0c, 0x0e},
{0x02, 0x09, 0x0c, 0x0e},
{0x03, 0x09, 0x0c, 0x0e},
{0x03, 0x09, 0x0c, 0x0e},
{0x04, 0x0a, 0x0d, 0x0e},
{0x04, 0x0a, 0x0d, 0x0e},
{0x05, 0x0a, 0x0d, 0x0e},
{0x05, 0x0a, 0x0d, 0x0e},
{0x06, 0x0b, 0x0d, 0x0e},
{0x06, 0x0b, 0x0d, 0x0e},
{0x07, 0x0b, 0x0d, 0x0e},
{0x07, 0x0b, 0x0d, 0x0e},
2018-08-26 14:40:36 +02:00
};
static const u8 gUnknown_0860D19C[DOME_ROUNDS_COUNT] =
{
[DOME_ROUND1] = 23,
[DOME_ROUND2] = 27,
[DOME_SEMIFINAL] = 29,
[DOME_FINAL] = 30
};
2018-08-26 14:40:36 +02:00
static const u8 gUnknown_0860D1A0[][4] =
{
{0x10, 0x18, 0x1c, 0x1e},
{0x11, 0x18, 0x1c, 0x1e},
{0x12, 0x19, 0x1c, 0x1e},
{0x13, 0x19, 0x1c, 0x1e},
{0x14, 0x1a, 0x1d, 0x1e},
{0x15, 0x1a, 0x1d, 0x1e},
{0x16, 0x1b, 0x1d, 0x1e},
{0x17, 0x1b, 0x1d, 0x1e},
};
static const u8 gUnknown_0860D1C0[] = {0x00, 0x0f, 0x08, 0x07, 0x03, 0x0c, 0x0b, 0x04, 0x01, 0x0e, 0x09, 0x06, 0x02, 0x0d, 0x0a, 0x05};
2019-02-08 18:08:25 +01:00
static const u8 *const sBattleDomePotentialTexts[] =
{
gBattleDomeOpponentPotentialText1,
gBattleDomeOpponentPotentialText2,
gBattleDomeOpponentPotentialText3,
gBattleDomeOpponentPotentialText4,
gBattleDomeOpponentPotentialText5,
gBattleDomeOpponentPotentialText6,
gBattleDomeOpponentPotentialText7,
gBattleDomeOpponentPotentialText8,
gBattleDomeOpponentPotentialText9,
gBattleDomeOpponentPotentialText10,
gBattleDomeOpponentPotentialText11,
gBattleDomeOpponentPotentialText12,
gBattleDomeOpponentPotentialText13,
gBattleDomeOpponentPotentialText14,
gBattleDomeOpponentPotentialText15,
gBattleDomeOpponentPotentialText16,
gBattleDomeOpponentPotentialText17,
2018-08-26 14:40:36 +02:00
};
2019-02-08 18:08:25 +01:00
static const u8 *const sBattleDomeOpponentStyleTexts[] =
{
gBattleDomeOpponentStyleText1,
gBattleDomeOpponentStyleText2,
gBattleDomeOpponentStyleText3,
gBattleDomeOpponentStyleText4,
gBattleDomeOpponentStyleText5,
gBattleDomeOpponentStyleText6,
gBattleDomeOpponentStyleText7,
gBattleDomeOpponentStyleText8,
gBattleDomeOpponentStyleText9,
gBattleDomeOpponentStyleText10,
gBattleDomeOpponentStyleText11,
gBattleDomeOpponentStyleText12,
gBattleDomeOpponentStyleText13,
gBattleDomeOpponentStyleText14,
gBattleDomeOpponentStyleText15,
gBattleDomeOpponentStyleText16,
gBattleDomeOpponentStyleText17,
gBattleDomeOpponentStyleText18,
gBattleDomeOpponentStyleText19,
gBattleDomeOpponentStyleText20,
gBattleDomeOpponentStyleText21,
gBattleDomeOpponentStyleText22,
gBattleDomeOpponentStyleText23,
gBattleDomeOpponentStyleText24,
gBattleDomeOpponentStyleText25,
gBattleDomeOpponentStyleText26,
gBattleDomeOpponentStyleText27,
gBattleDomeOpponentStyleText28,
gBattleDomeOpponentStyleTextUnused1,
gBattleDomeOpponentStyleTextUnused2,
gBattleDomeOpponentStyleTextUnused3,
gBattleDomeOpponentStyleTextUnused4,
2018-08-26 14:40:36 +02:00
};
2019-02-08 18:08:25 +01:00
static const u8 *const sBattleDomeOpponentStatsTexts[] =
{
gBattleDomeOpponentStatsText1,
gBattleDomeOpponentStatsText2,
gBattleDomeOpponentStatsText3,
gBattleDomeOpponentStatsText4,
gBattleDomeOpponentStatsText5,
gBattleDomeOpponentStatsText6,
gBattleDomeOpponentStatsText7,
gBattleDomeOpponentStatsText8,
gBattleDomeOpponentStatsText9,
gBattleDomeOpponentStatsText10,
gBattleDomeOpponentStatsText11,
gBattleDomeOpponentStatsText12,
gBattleDomeOpponentStatsText13,
gBattleDomeOpponentStatsText14,
gBattleDomeOpponentStatsText15,
gBattleDomeOpponentStatsText16,
gBattleDomeOpponentStatsText17,
gBattleDomeOpponentStatsText18,
gBattleDomeOpponentStatsText19,
gBattleDomeOpponentStatsText20,
gBattleDomeOpponentStatsText21,
gBattleDomeOpponentStatsText22,
gBattleDomeOpponentStatsText23,
gBattleDomeOpponentStatsText24,
gBattleDomeOpponentStatsText25,
gBattleDomeOpponentStatsText26,
gBattleDomeOpponentStatsText27,
gBattleDomeOpponentStatsText28,
gBattleDomeOpponentStatsText29,
gBattleDomeOpponentStatsText30,
gBattleDomeOpponentStatsText31,
gBattleDomeOpponentStatsText32,
gBattleDomeOpponentStatsText33,
gBattleDomeOpponentStatsText34,
gBattleDomeOpponentStatsText35,
gBattleDomeOpponentStatsText36,
gBattleDomeOpponentStatsText37,
gBattleDomeOpponentStatsText38,
gBattleDomeOpponentStatsText39,
gBattleDomeOpponentStatsText40,
gBattleDomeOpponentStatsText41,
gBattleDomeOpponentStatsText42,
gBattleDomeOpponentStatsText43,
2018-08-26 14:40:36 +02:00
};
2018-08-26 15:51:14 +02:00
static const u8 sInfoTrainerMonX[] = {0x68, 0x88, 0x68};
static const u8 sInfoTrainerMonY[] = {0x26, 0x3e, 0x4e};
static const u8 sSpeciesNameTextYCoords[] = {0, 4, 0};
2018-08-26 14:40:36 +02:00
static const u8 gUnknown_0860D349[] = {0x00, 0x05, 0x09, 0x0c, 0x0e, 0x00, 0x00};
2019-02-08 18:08:25 +01:00
static const u8 *const sBattleDomeMatchNumberTexts[] =
{
gBattleDomeMatchNumberText1,
gBattleDomeMatchNumberText2,
gBattleDomeMatchNumberText3,
gBattleDomeMatchNumberText4,
gBattleDomeMatchNumberText5,
gBattleDomeMatchNumberText6,
gBattleDomeMatchNumberText7,
gBattleDomeMatchNumberText8,
gBattleDomeMatchNumberText9,
gBattleDomeMatchNumberText10,
gBattleDomeMatchNumberText11,
gBattleDomeMatchNumberText12,
gBattleDomeMatchNumberText13,
gBattleDomeMatchNumberText14,
gBattleDomeMatchNumberText15,
2018-08-26 14:40:36 +02:00
};
2019-02-08 18:08:25 +01:00
static const u8 *const sBattleDomeWinTexts[] =
2018-08-26 14:40:36 +02:00
{
2019-02-08 18:08:25 +01:00
gBattleDomeWinText1,
gBattleDomeWinText2,
gBattleDomeWinText3,
gBattleDomeWinText4,
gBattleDomeWinText5,
gBattleDomeWinText6,
gBattleDomeWinText7,
2018-08-26 14:40:36 +02:00
};
2018-08-26 15:51:14 +02:00
static const u8 sFirstTrainerMonX[] = {0x60, 0x60, 0x60};
static const u8 sFirstTrainerMonY[] = {0x38, 0x50, 0x68};
static const u8 sSecondTrainerMonX[] = {0x90, 0x90, 0x90};
static const u8 sSecondTrainerMonY[] = {0x38, 0x50, 0x68};
2018-08-26 14:40:36 +02:00
static const u8 gUnknown_0860D3B4[] = {0, 8, 12, 4, 7, 15, 11, 3, 2, 10, 14, 6, 5, 13, 9, 1};
static const u8 gUnknown_0860D3C4[DOME_TOURNAMENT_MATCHES_COUNT][3] =
{
{ 0, 2, DOME_ROUND1},
{ 2, 2, DOME_ROUND1},
{ 4, 2, DOME_ROUND1},
{ 6, 2, DOME_ROUND1},
{ 8, 2, DOME_ROUND1},
{10, 2, DOME_ROUND1},
{12, 2, DOME_ROUND1},
{14, 2, DOME_ROUND1},
{ 0, 4, DOME_ROUND2},
{ 4, 4, DOME_ROUND2},
{ 8, 4, DOME_ROUND2},
{12, 4, DOME_ROUND2},
{ 0, 8, DOME_SEMIFINAL},
{ 8, 8, DOME_SEMIFINAL},
{ 0, 16, DOME_FINAL},
2018-08-26 14:40:36 +02:00
};
static const u8 gUnknown_0860D3F1[DOME_TOURNAMENT_TRAINERS_COUNT][2] =
2018-08-26 14:40:36 +02:00
{
{0x00, 0x00},
{0x01, 0x70},
{0x01, 0x00},
{0x00, 0x70},
{0x00, 0x30},
{0x01, 0x40},
{0x01, 0x30},
{0x00, 0x40},
{0x00, 0x10},
{0x01, 0x60},
{0x01, 0x10},
{0x00, 0x60},
{0x00, 0x20},
{0x01, 0x50},
{0x01, 0x20},
{0x00, 0x50},
};
static const u8 gUnknown_0860D411[][2] =
{
{0x44, 0x21},
{0x44, 0x31},
{0x44, 0x41},
{0x44, 0x51},
{0x44, 0x61},
{0x44, 0x71},
{0x44, 0x81},
{0x44, 0x91},
{0xac, 0x21},
{0xac, 0x31},
{0xac, 0x41},
{0xac, 0x51},
{0xac, 0x61},
{0xac, 0x71},
{0xac, 0x81},
{0xac, 0x91},
{0x57, 0x29},
{0x57, 0x49},
{0x57, 0x69},
{0x57, 0x89},
{0x99, 0x29},
{0x99, 0x49},
{0x99, 0x69},
{0x99, 0x89},
{0x5f, 0x39},
{0x5f, 0x79},
{0x91, 0x39},
{0x91, 0x79},
{0x67, 0x59},
{0x89, 0x59},
{0x78, 0x59},
};
static const struct UnkStruct_860DD10 gUnknown_0860d450[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x09},
{.src = 0x6023, .y = 0x04, .x = 0x0a},
{.src = 0x6047, .y = 0x05, .x = 0x0a},
{.src = 0x6043, .y = 0x05, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d460[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x09},
{.src = 0x6023, .y = 0x04, .x = 0x0a},
{.src = 0x6047, .y = 0x05, .x = 0x0a},
{.src = 0x6023, .y = 0x05, .x = 0x0b},
{.src = 0x6027, .y = 0x06, .x = 0x0b},
{.src = 0x6047, .y = 0x07, .x = 0x0b},
{.src = 0x6043, .y = 0x07, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d47c[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x09},
{.src = 0x6023, .y = 0x04, .x = 0x0a},
{.src = 0x6047, .y = 0x05, .x = 0x0a},
{.src = 0x6023, .y = 0x05, .x = 0x0b},
{.src = 0x6027, .y = 0x06, .x = 0x0b},
{.src = 0x6047, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d4a8[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x09},
{.src = 0x6023, .y = 0x04, .x = 0x0a},
{.src = 0x6047, .y = 0x05, .x = 0x0a},
{.src = 0x6023, .y = 0x05, .x = 0x0b},
{.src = 0x6027, .y = 0x06, .x = 0x0b},
{.src = 0x6047, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d4dc[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x09},
{.src = 0x6021, .y = 0x06, .x = 0x0a},
{.src = 0x6027, .y = 0x05, .x = 0x0a},
{.src = 0x6043, .y = 0x05, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d4ec[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x09},
{.src = 0x6021, .y = 0x06, .x = 0x0a},
{.src = 0x6027, .y = 0x05, .x = 0x0a},
{.src = 0x6023, .y = 0x05, .x = 0x0b},
{.src = 0x6027, .y = 0x06, .x = 0x0b},
{.src = 0x6047, .y = 0x07, .x = 0x0b},
{.src = 0x6043, .y = 0x07, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d508[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x09},
{.src = 0x6021, .y = 0x06, .x = 0x0a},
{.src = 0x6027, .y = 0x05, .x = 0x0a},
{.src = 0x6023, .y = 0x05, .x = 0x0b},
{.src = 0x6027, .y = 0x06, .x = 0x0b},
{.src = 0x6047, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d534[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x09},
{.src = 0x6021, .y = 0x06, .x = 0x0a},
{.src = 0x6027, .y = 0x05, .x = 0x0a},
{.src = 0x6023, .y = 0x05, .x = 0x0b},
{.src = 0x6027, .y = 0x06, .x = 0x0b},
{.src = 0x6047, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d568[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x09},
{.src = 0x6023, .y = 0x08, .x = 0x0a},
{.src = 0x6047, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d578[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x09},
{.src = 0x6023, .y = 0x08, .x = 0x0a},
{.src = 0x6047, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
{.src = 0x6027, .y = 0x08, .x = 0x0b},
{.src = 0x6027, .y = 0x07, .x = 0x0b},
{.src = 0x6043, .y = 0x07, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d594[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x09},
{.src = 0x6023, .y = 0x08, .x = 0x0a},
{.src = 0x6047, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
{.src = 0x6027, .y = 0x08, .x = 0x0b},
{.src = 0x6027, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d5c0[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x09},
{.src = 0x6023, .y = 0x08, .x = 0x0a},
{.src = 0x6047, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
{.src = 0x6027, .y = 0x08, .x = 0x0b},
{.src = 0x6027, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d5f4[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x09},
{.src = 0x6021, .y = 0x0a, .x = 0x0a},
{.src = 0x6027, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d604[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x09},
{.src = 0x6021, .y = 0x0a, .x = 0x0a},
{.src = 0x6027, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
{.src = 0x6027, .y = 0x08, .x = 0x0b},
{.src = 0x6027, .y = 0x07, .x = 0x0b},
{.src = 0x6043, .y = 0x07, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d620[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x09},
{.src = 0x6021, .y = 0x0a, .x = 0x0a},
{.src = 0x6027, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
{.src = 0x6027, .y = 0x08, .x = 0x0b},
{.src = 0x6027, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d64c[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x09},
{.src = 0x6021, .y = 0x0a, .x = 0x0a},
{.src = 0x6027, .y = 0x09, .x = 0x0a},
{.src = 0x6021, .y = 0x09, .x = 0x0b},
{.src = 0x6027, .y = 0x08, .x = 0x0b},
{.src = 0x6027, .y = 0x07, .x = 0x0b},
{.src = 0x6023, .y = 0x07, .x = 0x0c},
{.src = 0x6027, .y = 0x08, .x = 0x0c},
{.src = 0x6027, .y = 0x09, .x = 0x0c},
{.src = 0x6027, .y = 0x0a, .x = 0x0c},
{.src = 0x603b, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d680[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x09},
{.src = 0x6023, .y = 0x0c, .x = 0x0a},
{.src = 0x6047, .y = 0x0d, .x = 0x0a},
{.src = 0x6043, .y = 0x0d, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d690[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x09},
{.src = 0x6023, .y = 0x0c, .x = 0x0a},
{.src = 0x6047, .y = 0x0d, .x = 0x0a},
{.src = 0x6023, .y = 0x0d, .x = 0x0b},
{.src = 0x6027, .y = 0x0e, .x = 0x0b},
{.src = 0x6047, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d6ac[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x09},
{.src = 0x6023, .y = 0x0c, .x = 0x0a},
{.src = 0x6047, .y = 0x0d, .x = 0x0a},
{.src = 0x6023, .y = 0x0d, .x = 0x0b},
{.src = 0x6027, .y = 0x0e, .x = 0x0b},
{.src = 0x6047, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d6d8[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x09},
{.src = 0x6023, .y = 0x0c, .x = 0x0a},
{.src = 0x6047, .y = 0x0d, .x = 0x0a},
{.src = 0x6023, .y = 0x0d, .x = 0x0b},
{.src = 0x6027, .y = 0x0e, .x = 0x0b},
{.src = 0x6047, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d70c[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x09},
{.src = 0x6021, .y = 0x0e, .x = 0x0a},
{.src = 0x6027, .y = 0x0d, .x = 0x0a},
{.src = 0x6043, .y = 0x0d, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d71c[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x09},
{.src = 0x6021, .y = 0x0e, .x = 0x0a},
{.src = 0x6027, .y = 0x0d, .x = 0x0a},
{.src = 0x6023, .y = 0x0d, .x = 0x0b},
{.src = 0x6027, .y = 0x0e, .x = 0x0b},
{.src = 0x6047, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d738[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x09},
{.src = 0x6021, .y = 0x0e, .x = 0x0a},
{.src = 0x6027, .y = 0x0d, .x = 0x0a},
{.src = 0x6023, .y = 0x0d, .x = 0x0b},
{.src = 0x6027, .y = 0x0e, .x = 0x0b},
{.src = 0x6047, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d764[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x09},
{.src = 0x6021, .y = 0x0e, .x = 0x0a},
{.src = 0x6027, .y = 0x0d, .x = 0x0a},
{.src = 0x6023, .y = 0x0d, .x = 0x0b},
{.src = 0x6027, .y = 0x0e, .x = 0x0b},
{.src = 0x6047, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d798[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x09},
{.src = 0x6023, .y = 0x10, .x = 0x0a},
{.src = 0x6047, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d7a8[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x09},
{.src = 0x6023, .y = 0x10, .x = 0x0a},
{.src = 0x6047, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
{.src = 0x6027, .y = 0x10, .x = 0x0b},
{.src = 0x6027, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d7c4[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x09},
{.src = 0x6023, .y = 0x10, .x = 0x0a},
{.src = 0x6047, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
{.src = 0x6027, .y = 0x10, .x = 0x0b},
{.src = 0x6027, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d7f0[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x09},
{.src = 0x6023, .y = 0x10, .x = 0x0a},
{.src = 0x6047, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
{.src = 0x6027, .y = 0x10, .x = 0x0b},
{.src = 0x6027, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d824[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x09},
{.src = 0x602b, .y = 0x12, .x = 0x0a},
{.src = 0x6027, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
};
static const struct UnkStruct_860DD10 gUnknown_0860d834[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x09},
{.src = 0x602b, .y = 0x12, .x = 0x0a},
{.src = 0x6027, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
{.src = 0x6027, .y = 0x10, .x = 0x0b},
{.src = 0x6027, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d850[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x09},
{.src = 0x602b, .y = 0x12, .x = 0x0a},
{.src = 0x6027, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
{.src = 0x6027, .y = 0x10, .x = 0x0b},
{.src = 0x6027, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
};
static const struct UnkStruct_860DD10 gUnknown_0860d87c[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x09},
{.src = 0x602b, .y = 0x12, .x = 0x0a},
{.src = 0x6027, .y = 0x11, .x = 0x0a},
{.src = 0x6021, .y = 0x11, .x = 0x0b},
{.src = 0x6027, .y = 0x10, .x = 0x0b},
{.src = 0x6027, .y = 0x0f, .x = 0x0b},
{.src = 0x6021, .y = 0x0f, .x = 0x0c},
{.src = 0x6033, .y = 0x0e, .x = 0x0c},
{.src = 0x6032, .y = 0x0d, .x = 0x0c},
{.src = 0x6031, .y = 0x0c, .x = 0x0c},
{.src = 0x6030, .y = 0x0b, .x = 0x0c},
{.src = 0x602c, .y = 0x0b, .x = 0x0d},
{.src = 0x602d, .y = 0x0b, .x = 0x0e},
};
static const struct UnkStruct_860DD10 gUnknown_0860d8b0[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x14},
{.src = 0x6025, .y = 0x04, .x = 0x13},
{.src = 0x6049, .y = 0x05, .x = 0x13},
{.src = 0x6045, .y = 0x05, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860d8c0[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x14},
{.src = 0x6025, .y = 0x04, .x = 0x13},
{.src = 0x6049, .y = 0x05, .x = 0x13},
{.src = 0x6025, .y = 0x05, .x = 0x12},
{.src = 0x6029, .y = 0x06, .x = 0x12},
{.src = 0x6049, .y = 0x07, .x = 0x12},
{.src = 0x6045, .y = 0x07, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860d8dc[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x14},
{.src = 0x6025, .y = 0x04, .x = 0x13},
{.src = 0x6049, .y = 0x05, .x = 0x13},
{.src = 0x6025, .y = 0x05, .x = 0x12},
{.src = 0x6029, .y = 0x06, .x = 0x12},
{.src = 0x6049, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860d908[] =
{
{.src = 0x6021, .y = 0x04, .x = 0x14},
{.src = 0x6025, .y = 0x04, .x = 0x13},
{.src = 0x6049, .y = 0x05, .x = 0x13},
{.src = 0x6025, .y = 0x05, .x = 0x12},
{.src = 0x6029, .y = 0x06, .x = 0x12},
{.src = 0x6049, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
static const struct UnkStruct_860DD10 gUnknown_0860d93c[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x14},
{.src = 0x6021, .y = 0x06, .x = 0x13},
{.src = 0x6029, .y = 0x05, .x = 0x13},
{.src = 0x6045, .y = 0x05, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860d94c[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x14},
{.src = 0x6021, .y = 0x06, .x = 0x13},
{.src = 0x6029, .y = 0x05, .x = 0x13},
{.src = 0x6025, .y = 0x05, .x = 0x12},
{.src = 0x6029, .y = 0x06, .x = 0x12},
{.src = 0x6049, .y = 0x07, .x = 0x12},
{.src = 0x6045, .y = 0x07, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860d968[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x14},
{.src = 0x6021, .y = 0x06, .x = 0x13},
{.src = 0x6029, .y = 0x05, .x = 0x13},
{.src = 0x6025, .y = 0x05, .x = 0x12},
{.src = 0x6029, .y = 0x06, .x = 0x12},
{.src = 0x6049, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860d994[] =
{
{.src = 0x6021, .y = 0x06, .x = 0x14},
{.src = 0x6021, .y = 0x06, .x = 0x13},
{.src = 0x6029, .y = 0x05, .x = 0x13},
{.src = 0x6025, .y = 0x05, .x = 0x12},
{.src = 0x6029, .y = 0x06, .x = 0x12},
{.src = 0x6049, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
static const struct UnkStruct_860DD10 gUnknown_0860d9c8[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x14},
{.src = 0x6025, .y = 0x08, .x = 0x13},
{.src = 0x6049, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860d9d8[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x14},
{.src = 0x6025, .y = 0x08, .x = 0x13},
{.src = 0x6049, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
{.src = 0x6029, .y = 0x08, .x = 0x12},
{.src = 0x6029, .y = 0x07, .x = 0x12},
{.src = 0x6045, .y = 0x07, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860d9f4[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x14},
{.src = 0x6025, .y = 0x08, .x = 0x13},
{.src = 0x6049, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
{.src = 0x6029, .y = 0x08, .x = 0x12},
{.src = 0x6029, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860da20[] =
{
{.src = 0x6021, .y = 0x08, .x = 0x14},
{.src = 0x6025, .y = 0x08, .x = 0x13},
{.src = 0x6049, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
{.src = 0x6029, .y = 0x08, .x = 0x12},
{.src = 0x6029, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
static const struct UnkStruct_860DD10 gUnknown_0860da54[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x14},
{.src = 0x6021, .y = 0x0a, .x = 0x13},
{.src = 0x6029, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860da64[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x14},
{.src = 0x6021, .y = 0x0a, .x = 0x13},
{.src = 0x6029, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
{.src = 0x6029, .y = 0x08, .x = 0x12},
{.src = 0x6029, .y = 0x07, .x = 0x12},
{.src = 0x6045, .y = 0x07, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860da80[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x14},
{.src = 0x6021, .y = 0x0a, .x = 0x13},
{.src = 0x6029, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
{.src = 0x6029, .y = 0x08, .x = 0x12},
{.src = 0x6029, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860daac[] =
{
{.src = 0x6021, .y = 0x0a, .x = 0x14},
{.src = 0x6021, .y = 0x0a, .x = 0x13},
{.src = 0x6029, .y = 0x09, .x = 0x13},
{.src = 0x6021, .y = 0x09, .x = 0x12},
{.src = 0x6029, .y = 0x08, .x = 0x12},
{.src = 0x6029, .y = 0x07, .x = 0x12},
{.src = 0x6025, .y = 0x07, .x = 0x11},
{.src = 0x6029, .y = 0x08, .x = 0x11},
{.src = 0x6029, .y = 0x09, .x = 0x11},
{.src = 0x6029, .y = 0x0a, .x = 0x11},
{.src = 0x603c, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
static const struct UnkStruct_860DD10 gUnknown_0860dae0[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x14},
{.src = 0x6025, .y = 0x0c, .x = 0x13},
{.src = 0x6049, .y = 0x0d, .x = 0x13},
{.src = 0x6045, .y = 0x0d, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860daf0[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x14},
{.src = 0x6025, .y = 0x0c, .x = 0x13},
{.src = 0x6049, .y = 0x0d, .x = 0x13},
{.src = 0x6025, .y = 0x0d, .x = 0x12},
{.src = 0x6029, .y = 0x0e, .x = 0x12},
{.src = 0x6049, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860db0c[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x14},
{.src = 0x6025, .y = 0x0c, .x = 0x13},
{.src = 0x6049, .y = 0x0d, .x = 0x13},
{.src = 0x6025, .y = 0x0d, .x = 0x12},
{.src = 0x6029, .y = 0x0e, .x = 0x12},
{.src = 0x6049, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860db38[] =
{
{.src = 0x6021, .y = 0x0c, .x = 0x14},
{.src = 0x6025, .y = 0x0c, .x = 0x13},
{.src = 0x6049, .y = 0x0d, .x = 0x13},
{.src = 0x6025, .y = 0x0d, .x = 0x12},
{.src = 0x6029, .y = 0x0e, .x = 0x12},
{.src = 0x6049, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
static const struct UnkStruct_860DD10 gUnknown_0860db6c[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x14},
{.src = 0x6021, .y = 0x0e, .x = 0x13},
{.src = 0x6029, .y = 0x0d, .x = 0x13},
{.src = 0x6045, .y = 0x0d, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860db7c[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x14},
{.src = 0x6021, .y = 0x0e, .x = 0x13},
{.src = 0x6029, .y = 0x0d, .x = 0x13},
{.src = 0x6025, .y = 0x0d, .x = 0x12},
{.src = 0x6029, .y = 0x0e, .x = 0x12},
{.src = 0x6049, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860db98[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x14},
{.src = 0x6021, .y = 0x0e, .x = 0x13},
{.src = 0x6029, .y = 0x0d, .x = 0x13},
{.src = 0x6025, .y = 0x0d, .x = 0x12},
{.src = 0x6029, .y = 0x0e, .x = 0x12},
{.src = 0x6049, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860dbc4[] =
{
{.src = 0x6021, .y = 0x0e, .x = 0x14},
{.src = 0x6021, .y = 0x0e, .x = 0x13},
{.src = 0x6029, .y = 0x0d, .x = 0x13},
{.src = 0x6025, .y = 0x0d, .x = 0x12},
{.src = 0x6029, .y = 0x0e, .x = 0x12},
{.src = 0x6049, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
static const struct UnkStruct_860DD10 gUnknown_0860dbf8[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x14},
{.src = 0x6025, .y = 0x10, .x = 0x13},
{.src = 0x6049, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860dc08[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x14},
{.src = 0x6025, .y = 0x10, .x = 0x13},
{.src = 0x6049, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
{.src = 0x6029, .y = 0x10, .x = 0x12},
{.src = 0x6029, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860dc24[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x14},
{.src = 0x6025, .y = 0x10, .x = 0x13},
{.src = 0x6049, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
{.src = 0x6029, .y = 0x10, .x = 0x12},
{.src = 0x6029, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860dc50[] =
{
{.src = 0x6021, .y = 0x10, .x = 0x14},
{.src = 0x6025, .y = 0x10, .x = 0x13},
{.src = 0x6049, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
{.src = 0x6029, .y = 0x10, .x = 0x12},
{.src = 0x6029, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
static const struct UnkStruct_860DD10 gUnknown_0860dc84[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x14},
{.src = 0x602b, .y = 0x12, .x = 0x13},
{.src = 0x6029, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
};
static const struct UnkStruct_860DD10 gUnknown_0860dc94[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x14},
{.src = 0x602b, .y = 0x12, .x = 0x13},
{.src = 0x6029, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
{.src = 0x6029, .y = 0x10, .x = 0x12},
{.src = 0x6029, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860dcb0[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x14},
{.src = 0x602b, .y = 0x12, .x = 0x13},
{.src = 0x6029, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
{.src = 0x6029, .y = 0x10, .x = 0x12},
{.src = 0x6029, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
};
static const struct UnkStruct_860DD10 gUnknown_0860dcdc[] =
{
{.src = 0x602b, .y = 0x12, .x = 0x14},
{.src = 0x602b, .y = 0x12, .x = 0x13},
{.src = 0x6029, .y = 0x11, .x = 0x13},
{.src = 0x6021, .y = 0x11, .x = 0x12},
{.src = 0x6029, .y = 0x10, .x = 0x12},
{.src = 0x6029, .y = 0x0f, .x = 0x12},
{.src = 0x6021, .y = 0x0f, .x = 0x11},
{.src = 0x6038, .y = 0x0e, .x = 0x11},
{.src = 0x6037, .y = 0x0d, .x = 0x11},
{.src = 0x6036, .y = 0x0c, .x = 0x11},
{.src = 0x6035, .y = 0x0b, .x = 0x11},
{.src = 0x602f, .y = 0x0b, .x = 0x10},
{.src = 0x602e, .y = 0x0b, .x = 0x0f},
};
2018-08-26 15:51:14 +02:00
static const struct UnkStruct_860DD10 * const gUnknown_0860DD10[DOME_TOURNAMENT_TRAINERS_COUNT][4] =
2018-08-26 14:40:36 +02:00
{
{gUnknown_0860d450, gUnknown_0860d460, gUnknown_0860d47c, gUnknown_0860d4a8},
{gUnknown_0860dc84, gUnknown_0860dc94, gUnknown_0860dcb0, gUnknown_0860dcdc},
{gUnknown_0860d8b0, gUnknown_0860d8c0, gUnknown_0860d8dc, gUnknown_0860d908},
{gUnknown_0860d824, gUnknown_0860d834, gUnknown_0860d850, gUnknown_0860d87c},
{gUnknown_0860d5f4, gUnknown_0860d604, gUnknown_0860d620, gUnknown_0860d64c},
{gUnknown_0860dae0, gUnknown_0860daf0, gUnknown_0860db0c, gUnknown_0860db38},
{gUnknown_0860da54, gUnknown_0860da64, gUnknown_0860da80, gUnknown_0860daac},
{gUnknown_0860d680, gUnknown_0860d690, gUnknown_0860d6ac, gUnknown_0860d6d8},
{gUnknown_0860d4dc, gUnknown_0860d4ec, gUnknown_0860d508, gUnknown_0860d534},
{gUnknown_0860dbf8, gUnknown_0860dc08, gUnknown_0860dc24, gUnknown_0860dc50},
{gUnknown_0860d93c, gUnknown_0860d94c, gUnknown_0860d968, gUnknown_0860d994},
{gUnknown_0860d798, gUnknown_0860d7a8, gUnknown_0860d7c4, gUnknown_0860d7f0},
{gUnknown_0860d568, gUnknown_0860d578, gUnknown_0860d594, gUnknown_0860d5c0},
{gUnknown_0860db6c, gUnknown_0860db7c, gUnknown_0860db98, gUnknown_0860dbc4},
{gUnknown_0860d9c8, gUnknown_0860d9d8, gUnknown_0860d9f4, gUnknown_0860da20},
{gUnknown_0860d70c, gUnknown_0860d71c, gUnknown_0860d738, gUnknown_0860d764},
};
2018-08-26 15:51:14 +02:00
static const u8 gUnknown_0860DE10[DOME_TOURNAMENT_TRAINERS_COUNT][4] =
2018-08-26 14:40:36 +02:00
{
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
{0x04, 0x07, 0x0b, 0x0d},
};
2018-08-15 15:49:50 +02:00
// code
2018-08-25 19:59:47 +02:00
void CallBattleDomeFunction(void)
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
sBattleDomeFunctions[gSpecialVar_0x8004]();
2018-08-15 15:49:50 +02:00
}
2019-02-08 18:08:25 +01:00
static void InitDomeChallenge(void)
2018-08-15 15:49:50 +02:00
{
2018-08-25 19:59:47 +02:00
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
2018-08-15 15:49:50 +02:00
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr->frontier.challengeStatus = 0;
2018-10-21 00:06:42 +02:00
gSaveBlock2Ptr->frontier.curChallengeBattleNum = 0;
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr->frontier.challengePaused = FALSE;
2018-08-15 15:49:50 +02:00
gSaveBlock2Ptr->frontier.field_CA9_b = 0;
2019-11-24 22:58:40 +01:00
if (!(gSaveBlock2Ptr->frontier.winStreakActiveFlags & sWinStreakFlags[battleMode][lvlMode]))
2018-10-27 17:39:05 +02:00
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = 0;
2018-08-15 15:49:50 +02:00
2018-12-27 23:30:47 +01:00
SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1);
2018-08-15 15:49:50 +02:00
gTrainerBattleOpponent_A = 0;
}
2019-02-08 18:08:25 +01:00
static void GetDomeData(void)
2018-08-15 15:49:50 +02:00
{
2018-08-25 19:59:47 +02:00
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
2018-08-15 15:49:50 +02:00
switch (gSpecialVar_0x8005)
{
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK:
2018-10-27 17:39:05 +02:00
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
2018-08-15 15:49:50 +02:00
break;
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK_ACTIVE:
2019-11-24 22:58:40 +01:00
gSpecialVar_Result = ((gSaveBlock2Ptr->frontier.winStreakActiveFlags & sWinStreakFlags[battleMode][lvlMode]) != 0);
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_ATTEMPTED_SINGLES_50:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeAttemptedSingles50;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_ATTEMPTED_SINGLES_OPEN:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeAttemptedSinglesOpen;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_HAS_WON_SINGLES_50:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeHasWonSingles50;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_HAS_WON_SINGLES_OPEN:
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeHasWonSinglesOpen;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_ATTEMPTED_CHALLENGE:
2018-08-25 19:59:47 +02:00
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
2018-08-15 15:49:50 +02:00
{
if (lvlMode != FRONTIER_LVL_50)
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeAttemptedDoublesOpen;
2018-08-15 15:49:50 +02:00
else
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeAttemptedDoubles50;
2018-08-15 15:49:50 +02:00
}
else
{
if (lvlMode != FRONTIER_LVL_50)
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeAttemptedSinglesOpen;
2018-08-15 15:49:50 +02:00
else
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeAttemptedSingles50;
2018-08-15 15:49:50 +02:00
}
break;
case DOME_DATA_HAS_WON_CHALLENGE:
2018-08-25 19:59:47 +02:00
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
2018-08-15 15:49:50 +02:00
{
if (lvlMode != FRONTIER_LVL_50)
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeHasWonDoublesOpen;
2018-08-15 15:49:50 +02:00
else
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeHasWonDoubles50;
2018-08-15 15:49:50 +02:00
}
else
{
if (lvlMode != FRONTIER_LVL_50)
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeHasWonSinglesOpen;
2018-08-15 15:49:50 +02:00
else
gSpecialVar_Result = gSaveBlock2Ptr->frontier.domeHasWonSingles50;
2018-08-15 15:49:50 +02:00
}
break;
case DOME_DATA_SELECTED_MONS:
2019-10-18 01:22:03 +02:00
ClearSelectedPartyOrder();
2019-11-24 22:58:40 +01:00
gSelectedOrderFromParty[0] = gSaveBlock2Ptr->frontier.selectedPartyMons[3];
gSelectedOrderFromParty[1] = gSaveBlock2Ptr->frontier.selectedPartyMons[3] >> 8;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_LAST_TOURNEY_TYPE:
gSpecialVar_Result = (gSaveBlock2Ptr->frontier.domeLvlMode * 2) - 3 + gSaveBlock2Ptr->frontier.domeBattleMode;
2018-08-15 15:49:50 +02:00
break;
}
}
2019-02-08 18:08:25 +01:00
static void SetDomeData(void)
2018-08-15 15:49:50 +02:00
{
2018-08-25 19:59:47 +02:00
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u32 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
2018-08-15 15:49:50 +02:00
switch (gSpecialVar_0x8005)
{
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK:
2018-10-27 17:39:05 +02:00
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
break;
2019-11-29 04:46:39 +01:00
case DOME_DATA_WIN_STREAK_ACTIVE:
2018-08-15 15:49:50 +02:00
if (gSpecialVar_0x8006)
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr->frontier.winStreakActiveFlags |= sWinStreakFlags[battleMode][lvlMode];
2018-08-15 15:49:50 +02:00
else
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr->frontier.winStreakActiveFlags &= sWinStreakMasks[battleMode][lvlMode];
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_ATTEMPTED_SINGLES_50:
gSaveBlock2Ptr->frontier.domeAttemptedSingles50 = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_ATTEMPTED_SINGLES_OPEN:
gSaveBlock2Ptr->frontier.domeAttemptedSinglesOpen = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_HAS_WON_SINGLES_50:
gSaveBlock2Ptr->frontier.domeHasWonSingles50 = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_HAS_WON_SINGLES_OPEN:
gSaveBlock2Ptr->frontier.domeHasWonSinglesOpen = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
break;
case DOME_DATA_ATTEMPTED_CHALLENGE:
2018-08-25 19:59:47 +02:00
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
2018-08-15 15:49:50 +02:00
{
if (lvlMode != FRONTIER_LVL_50)
gSaveBlock2Ptr->frontier.domeAttemptedDoublesOpen = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
else
gSaveBlock2Ptr->frontier.domeAttemptedDoubles50 = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
}
else
{
if (lvlMode != FRONTIER_LVL_50)
gSaveBlock2Ptr->frontier.domeAttemptedSinglesOpen = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
else
gSaveBlock2Ptr->frontier.domeAttemptedSingles50 = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
}
break;
case DOME_DATA_HAS_WON_CHALLENGE:
2018-08-25 19:59:47 +02:00
if (VarGet(VAR_FRONTIER_BATTLE_MODE) == FRONTIER_MODE_DOUBLES)
2018-08-15 15:49:50 +02:00
{
if (lvlMode != FRONTIER_LVL_50)
gSaveBlock2Ptr->frontier.domeHasWonDoublesOpen = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
else
gSaveBlock2Ptr->frontier.domeHasWonDoubles50 = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
}
else
{
if (lvlMode != FRONTIER_LVL_50)
gSaveBlock2Ptr->frontier.domeHasWonSinglesOpen = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
else
gSaveBlock2Ptr->frontier.domeHasWonSingles50 = gSpecialVar_0x8006;
2018-08-15 15:49:50 +02:00
}
break;
case DOME_DATA_SELECTED_MONS:
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr->frontier.selectedPartyMons[3] = T1_READ_16(gSelectedOrderFromParty);
2018-08-15 15:49:50 +02:00
break;
}
}
2018-08-26 15:51:14 +02:00
static void InitDomeTrainers(void)
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
int i, j, k;
int monLevel;
int species[FRONTIER_PARTY_SIZE];
2019-02-08 18:08:25 +01:00
int monTypesBits, monTypesCount;
int trainerId;
int monSetId;
u16 *statSums;
2019-02-08 18:08:25 +01:00
int *statValues;
u8 ivs = 0;
species[0] = 0;
species[1] = 0;
species[2] = 0;
statSums = AllocZeroed(sizeof(u16) * DOME_TOURNAMENT_TRAINERS_COUNT);
statValues = AllocZeroed(sizeof(int) * NUM_STATS);
2018-08-15 15:49:50 +02:00
gSaveBlock2Ptr->frontier.domeLvlMode = gSaveBlock2Ptr->frontier.lvlMode + 1;
gSaveBlock2Ptr->frontier.domeBattleMode = VarGet(VAR_FRONTIER_BATTLE_MODE) + 1;
DOME_TRAINERS[0].trainerId = TRAINER_PLAYER;
DOME_TRAINERS[0].isEliminated = FALSE;
DOME_TRAINERS[0].eliminatedAt = 0;
DOME_TRAINERS[0].forfeited = FALSE;
2018-08-15 15:49:50 +02:00
2019-11-24 22:58:40 +01:00
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-15 15:49:50 +02:00
{
DOME_MONS[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_SPECIES, NULL);
for (j = 0; j < MAX_MON_MOVES; j++)
gSaveBlock2Ptr->frontier.field_EFC[i].moves[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + j, NULL);
2019-11-24 22:58:40 +01:00
for (j = 0; j < NUM_STATS; j++)
gSaveBlock2Ptr->frontier.field_EFC[i].evs[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_HP_EV + j, NULL);
2018-08-15 15:49:50 +02:00
gSaveBlock2Ptr->frontier.field_EFC[i].nature = GetNature(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1]);
2018-08-15 15:49:50 +02:00
}
for (i = 1; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
2018-08-15 15:49:50 +02:00
{
if (i > 5)
2018-08-15 15:49:50 +02:00
{
do
2018-08-15 15:49:50 +02:00
{
2018-10-27 21:01:35 +02:00
trainerId = sub_8162548(GetCurrentFacilityWinStreak(), 0);
for (j = 1; j < i; j++)
2018-08-15 15:49:50 +02:00
{
if (DOME_TRAINERS[j].trainerId == trainerId)
2018-08-15 15:49:50 +02:00
break;
}
} while (j != i);
DOME_TRAINERS[i].trainerId = trainerId;
2018-08-15 15:49:50 +02:00
}
else
{
do
2018-08-15 15:49:50 +02:00
{
2018-10-27 21:01:35 +02:00
trainerId = sub_8162548(GetCurrentFacilityWinStreak() + 1, 0);
for (j = 1; j < i; j++)
2018-08-15 15:49:50 +02:00
{
if (DOME_TRAINERS[j].trainerId == trainerId)
2018-08-15 15:49:50 +02:00
break;
}
} while (j != i);
DOME_TRAINERS[i].trainerId = trainerId;
2018-08-15 15:49:50 +02:00
}
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
2018-08-15 15:49:50 +02:00
{
// Make sure the mon is valid.
2018-08-15 15:49:50 +02:00
do
{
2018-11-11 16:44:27 +01:00
monSetId = RandomizeFacilityTrainerMonSet(trainerId);
for (k = 0; k < j; k++)
2018-08-15 15:49:50 +02:00
{
int checkingMonSetId = DOME_MONS[i][k];
2018-11-11 16:44:27 +01:00
if (checkingMonSetId == monSetId
|| species[0] == gFacilityTrainerMons[monSetId].species
|| species[1] == gFacilityTrainerMons[monSetId].species
|| gFacilityTrainerMons[checkingMonSetId].itemTableId == gFacilityTrainerMons[monSetId].itemTableId)
2018-08-15 15:49:50 +02:00
break;
}
} while (k != j);
2018-08-15 15:49:50 +02:00
DOME_MONS[i][j] = monSetId;
2018-11-11 16:44:27 +01:00
species[j] = gFacilityTrainerMons[monSetId].species;
2018-08-15 15:49:50 +02:00
}
DOME_TRAINERS[i].isEliminated = FALSE;
DOME_TRAINERS[i].eliminatedAt = 0;
DOME_TRAINERS[i].forfeited = FALSE;
2018-08-15 15:49:50 +02:00
}
monTypesBits = 0;
statSums[0] = 0;
2019-11-24 22:58:40 +01:00
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-15 15:49:50 +02:00
{
2019-11-24 22:58:40 +01:00
trainerId = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_ATK, NULL);
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_DEF, NULL);
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPATK, NULL);
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPDEF, NULL);
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPEED, NULL);
statSums[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_MAX_HP, NULL);
monTypesBits |= gBitTable[gBaseStats[GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL)].type1];
monTypesBits |= gBitTable[gBaseStats[GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL)].type2];
2018-08-15 15:49:50 +02:00
}
for (monTypesCount = 0, j = 0; j < 32; j++)
2018-08-15 15:49:50 +02:00
{
if (monTypesBits & 1)
monTypesCount++;
monTypesBits >>= 1;
}
monLevel = SetFacilityPtrsGetLevel();
statSums[0] += (monTypesCount * monLevel) / 20;
2018-08-15 15:49:50 +02:00
for (i = 1; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
2018-08-15 15:49:50 +02:00
{
monTypesBits = 0;
statSums[i] = 0;
ivs = GetDomeTrainerMonIvs(DOME_TRAINERS[i].trainerId);
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
2018-08-15 15:49:50 +02:00
{
CalcDomeMonStats(gFacilityTrainerMons[DOME_MONS[i][j]].species,
monLevel, ivs,
gFacilityTrainerMons[DOME_MONS[i][j]].evSpread,
gFacilityTrainerMons[DOME_MONS[i][j]].nature,
statValues);
statSums[i] += statValues[STAT_ATK];
statSums[i] += statValues[STAT_DEF];
statSums[i] += statValues[STAT_SPATK];
statSums[i] += statValues[STAT_SPDEF];
statSums[i] += statValues[STAT_SPEED];
statSums[i] += statValues[STAT_HP];
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[DOME_MONS[i][j]].species].type1];
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[DOME_MONS[i][j]].species].type2];
}
for (monTypesCount = 0, j = 0; j < 32; j++)
{
if (monTypesBits & 1)
monTypesCount++;
monTypesBits >>= 1;
2018-08-15 15:49:50 +02:00
}
statSums[i] += (monTypesCount * monLevel) / 20;
2018-08-15 15:49:50 +02:00
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT - 1; i++)
{
for (j = i + 1; j < DOME_TOURNAMENT_TRAINERS_COUNT; j++)
{
if (statSums[i] < statSums[j])
{
SwapDomeTrainers(i, j, statSums);
}
else
{
if (statSums[i] == statSums[j])
{
if (DOME_TRAINERS[j].trainerId == TRAINER_PLAYER)
SwapDomeTrainers(i, j, statSums);
else if (DOME_TRAINERS[i].trainerId > DOME_TRAINERS[j].trainerId)
SwapDomeTrainers(i, j, statSums);
}
}
}
}
if (GetFrontierBrainStatus() != FRONTIER_BRAIN_NOT_READY)
{
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (DOME_TRAINERS[i].trainerId == TRAINER_PLAYER)
break;
}
if (gUnknown_0860D3F1[i][0] != 0)
{
j = 0;
DOME_TRAINERS[j].trainerId = TRAINER_FRONTIER_BRAIN;
}
else
{
j = 1;
DOME_TRAINERS[j].trainerId = TRAINER_FRONTIER_BRAIN;
}
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
DOME_MONS[j][i] = GetFrontierBrainMonSpecies(i);
}
Free(statSums);
Free(statValues);
2018-08-15 15:49:50 +02:00
}
#define CALC_STAT(base, statIndex) \
{ \
u8 baseStat = gBaseStats[species].base; \
stats[statIndex] = (((2 * baseStat + ivs + evs[statIndex] / 4) * level) / 100) + 5; \
stats[statIndex] = (u8) ModifyStatByNature(nature, stats[statIndex], statIndex); \
}
2019-02-08 18:08:25 +01:00
static void CalcDomeMonStats(u16 species, int level, int ivs, u8 evBits, u8 nature, int *stats)
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
int i, count;
2018-08-15 15:49:50 +02:00
u8 bits;
u16 resultingEvs;
2019-02-08 18:08:25 +01:00
int evs[NUM_STATS];
2018-08-15 15:49:50 +02:00
count = 0, bits = evBits;
2018-11-18 20:00:36 +01:00
for (i = 0; i < NUM_STATS; bits >>= 1, i++)
2018-08-15 15:49:50 +02:00
{
if (bits & 1)
count++;
}
2018-08-29 20:38:54 +02:00
resultingEvs = MAX_TOTAL_EVS / count;
2018-11-18 20:00:36 +01:00
for (i = 0; i < NUM_STATS; bits <<= 1, i++)
2018-08-15 15:49:50 +02:00
{
evs[i] = 0;
if (evBits & bits)
evs[i] = resultingEvs;
}
if (species == SPECIES_SHEDINJA)
{
stats[STAT_HP] = 1;
}
else
{
2019-02-08 18:08:25 +01:00
int n = 2 * gBaseStats[species].baseHP;
2018-08-15 15:49:50 +02:00
stats[STAT_HP] = (((n + ivs + evs[STAT_HP] / 4) * level) / 100) + level + 10;
}
CALC_STAT(baseAttack, STAT_ATK);
CALC_STAT(baseDefense, STAT_DEF);
CALC_STAT(baseSpeed, STAT_SPEED);
CALC_STAT(baseSpAttack, STAT_SPATK);
CALC_STAT(baseSpDefense, STAT_SPDEF);
}
2019-02-08 18:08:25 +01:00
static void SwapDomeTrainers(int id1, int id2, u16 *statsArray)
2018-08-15 15:49:50 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-15 15:49:50 +02:00
u16 temp;
2018-08-30 15:01:07 +02:00
SWAP(statsArray[id1], statsArray[id2], temp);
SWAP(DOME_TRAINERS[id1].trainerId, DOME_TRAINERS[id2].trainerId, temp);
2018-08-15 15:49:50 +02:00
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
SWAP(DOME_MONS[id1][i], DOME_MONS[id2][i], temp);
2018-08-15 15:49:50 +02:00
}
2018-08-15 23:04:46 +02:00
2019-02-08 18:08:25 +01:00
static void BufferDomeRoundText(void)
2018-08-15 23:04:46 +02:00
{
2018-10-21 00:06:42 +02:00
StringCopy(gStringVar1, gRoundsStringTable[gSaveBlock2Ptr->frontier.curChallengeBattleNum]);
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void BufferDomeOpponentName(void)
2018-08-15 23:04:46 +02:00
{
2018-10-21 00:06:42 +02:00
StringCopy(gStringVar1, gRoundsStringTable[gSaveBlock2Ptr->frontier.curChallengeBattleNum]);
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName(gStringVar2, gTrainerBattleOpponent_A);
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void InitDomeOpponentParty(void)
2018-08-15 23:04:46 +02:00
{
gPlayerPartyLostHP = 0;
sPlayerPartyMaxHP = GetMonData(&gPlayerParty[0], MON_DATA_MAX_HP, NULL);
sPlayerPartyMaxHP += GetMonData(&gPlayerParty[1], MON_DATA_MAX_HP, NULL);
2018-08-15 23:04:46 +02:00
CalculatePlayerPartyCount();
2019-02-08 18:08:25 +01:00
CreateDomeOpponentMons(TrainerIdToTournamentId(gTrainerBattleOpponent_A));
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void CreateDomeOpponentMon(u8 monPartyId, u16 tournamentTrainerId, u8 tournamentMonId, u32 otId)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
u8 friendship = MAX_FRIENDSHIP;
u8 fixedIv = GetDomeTrainerMonIvs(tournamentTrainerId); // BUG: Should be using DOME_TRAINERS[tournamentTrainerId].trainerId instead of tournamentTrainerId. As a result, all Pokemon have ivs of 3.
u8 level = SetFacilityPtrsGetLevel();
2018-11-11 16:44:27 +01:00
CreateMonWithEVSpreadNatureOTID(&gEnemyParty[monPartyId],
gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][tournamentMonId]].species,
2018-08-15 23:04:46 +02:00
level,
gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][tournamentMonId]].nature,
2018-08-15 23:04:46 +02:00
fixedIv,
gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][tournamentMonId]].evSpread, otId);
2018-08-15 23:04:46 +02:00
friendship = MAX_FRIENDSHIP;
for (i = 0; i < MAX_MON_MOVES; i++)
2018-08-15 23:04:46 +02:00
{
SetMonMoveSlot(&gEnemyParty[monPartyId],
gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][tournamentMonId]].moves[i], i);
if (gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][tournamentMonId]].moves[i] == MOVE_FRUSTRATION)
friendship = 0;
2018-08-15 23:04:46 +02:00
}
SetMonData(&gEnemyParty[monPartyId], MON_DATA_FRIENDSHIP, &friendship);
2018-08-15 23:04:46 +02:00
SetMonData(&gEnemyParty[monPartyId], MON_DATA_HELD_ITEM,
&gBattleFrontierHeldItems[gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][tournamentMonId]].itemTableId]);
2018-08-15 23:04:46 +02:00
}
2019-02-08 18:08:25 +01:00
static void CreateDomeOpponentMons(u16 tournamentTrainerId)
2018-08-15 23:04:46 +02:00
{
u8 monsCount = 0;
u32 otId = 0;
int i, selectedMonBits;
2018-08-15 23:04:46 +02:00
ZeroEnemyPartyMons();
selectedMonBits = GetDomeTrainerSelectedMons(tournamentTrainerId);
2018-08-15 23:04:46 +02:00
otId = Random32();
2018-08-15 23:04:46 +02:00
if (Random() % 10 > 5)
{
// Create mon if it was selected, starting from front
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-15 23:04:46 +02:00
{
if (selectedMonBits & 1)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
CreateDomeOpponentMon(monsCount, tournamentTrainerId, i, otId);
2018-08-15 23:04:46 +02:00
monsCount++;
}
selectedMonBits >>= 1;
2018-08-15 23:04:46 +02:00
}
}
else
{
// Create mon if it was selected, starting from back
for (i = FRONTIER_PARTY_SIZE - 1; i >= 0; i--)
2018-08-15 23:04:46 +02:00
{
if (selectedMonBits & 4)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
CreateDomeOpponentMon(monsCount, tournamentTrainerId, i, otId);
2018-08-15 23:04:46 +02:00
monsCount++;
}
selectedMonBits <<= 1;
2018-08-15 23:04:46 +02:00
}
}
}
int GetDomeTrainerSelectedMons(u16 tournamentTrainerId)
2018-08-15 23:04:46 +02:00
{
int selectedMonBits;
2018-08-15 23:04:46 +02:00
if (Random() & 1)
{
selectedMonBits = sub_818FCBC(tournamentTrainerId, FALSE);
if (selectedMonBits == 0)
selectedMonBits = sub_818FDB8(tournamentTrainerId, TRUE);
2018-08-15 23:04:46 +02:00
}
else
{
selectedMonBits = sub_818FDB8(tournamentTrainerId, FALSE);
if (selectedMonBits == 0)
selectedMonBits = sub_818FCBC(tournamentTrainerId, TRUE);
2018-08-15 23:04:46 +02:00
}
return selectedMonBits;
2018-08-15 23:04:46 +02:00
}
static int sub_818FCBC(u16 tournamentTrainerId, bool8 allowRandom)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i, moveId, playerMonId;
int partyMovePoints[FRONTIER_PARTY_SIZE];
2018-08-15 23:04:46 +02:00
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-15 23:04:46 +02:00
{
partyMovePoints[i] = 0;
for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
2018-08-15 23:04:46 +02:00
{
for (playerMonId = 0; playerMonId < FRONTIER_PARTY_SIZE; playerMonId++)
2018-08-15 23:04:46 +02:00
{
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
2018-08-15 23:04:46 +02:00
{
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId),
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_PERSONALITY);
2018-08-15 23:04:46 +02:00
}
else
{
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId],
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_PERSONALITY);
2018-08-15 23:04:46 +02:00
}
}
}
}
return SelectOpponentMonsFromParty(partyMovePoints, allowRandom);
2018-08-15 23:04:46 +02:00
}
static int sub_818FDB8(u16 tournamentTrainerId, bool8 allowRandom)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i, moveId, playerMonId;
int partyMovePoints[FRONTIER_PARTY_SIZE];
2018-08-15 23:04:46 +02:00
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-15 23:04:46 +02:00
{
partyMovePoints[i] = 0;
for (moveId = 0; moveId < MAX_MON_MOVES; moveId++)
2018-08-15 23:04:46 +02:00
{
for (playerMonId = 0; playerMonId < FRONTIER_PARTY_SIZE; playerMonId++)
2018-08-15 23:04:46 +02:00
{
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
2018-08-15 23:04:46 +02:00
{
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId),
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_OT_ID);
2018-08-15 23:04:46 +02:00
}
else
{
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId],
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_OT_ID);
2018-08-15 23:04:46 +02:00
}
}
}
}
return SelectOpponentMonsFromParty(partyMovePoints, allowRandom);
2018-08-15 23:04:46 +02:00
}
static int SelectOpponentMonsFromParty(int *partyMovePoints, bool8 allowRandom)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int i, j;
int selectedMonBits = 0;
int partyPositions[FRONTIER_PARTY_SIZE];
2018-08-15 23:04:46 +02:00
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
partyPositions[i] = i;
2018-08-15 23:04:46 +02:00
// All party mons have equal move score totals, choose randomly
if (partyMovePoints[0] == partyMovePoints[1]
&& partyMovePoints[0] == partyMovePoints[2])
2018-08-15 23:04:46 +02:00
{
if (allowRandom)
2018-08-15 23:04:46 +02:00
{
i = 0;
while (i != DOME_BATTLE_PARTY_SIZE)
2018-08-15 23:04:46 +02:00
{
u32 rand = Random() & FRONTIER_PARTY_SIZE;
if (rand != FRONTIER_PARTY_SIZE && !(selectedMonBits & gBitTable[rand]))
2018-08-15 23:04:46 +02:00
{
selectedMonBits |= gBitTable[rand];
2018-08-15 23:04:46 +02:00
i++;
}
}
}
}
else
{
for (i = 0; i < DOME_BATTLE_PARTY_SIZE; i++)
2018-08-15 23:04:46 +02:00
{
for (j = i + 1; j < FRONTIER_PARTY_SIZE; j++)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int temp;
2018-08-15 23:04:46 +02:00
if (partyMovePoints[i] < partyMovePoints[j])
2018-08-15 23:04:46 +02:00
{
SWAP(partyMovePoints[i], partyMovePoints[j],temp)
SWAP(partyPositions[i], partyPositions[j], temp)
2018-08-15 23:04:46 +02:00
}
if (partyMovePoints[i] == partyMovePoints[j] && (Random() & 1))
2018-08-15 23:04:46 +02:00
{
SWAP(partyMovePoints[i], partyMovePoints[j],temp)
SWAP(partyPositions[i], partyPositions[j], temp)
2018-08-15 23:04:46 +02:00
}
}
}
for (i = 0; i < DOME_BATTLE_PARTY_SIZE; i++)
2018-08-15 23:04:46 +02:00
{
selectedMonBits |= gBitTable[partyPositions[i]];
2018-08-15 23:04:46 +02:00
}
}
return selectedMonBits;
2018-08-15 23:04:46 +02:00
}
2018-08-26 21:41:47 +02:00
#define TYPE_x0 0
#define TYPE_x0_25 5
#define TYPE_x0_50 10
#define TYPE_x1 20
#define TYPE_x2 40
#define TYPE_x4 80
2018-08-18 00:54:18 +02:00
// Functionally equivalent, while loop is impossible to match.
// arg2 is either 2, a personality, or an OTID
2018-08-18 00:54:18 +02:00
#ifdef NONMATCHING
2019-02-08 18:08:25 +01:00
static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2)
2018-08-15 23:04:46 +02:00
{
2019-02-08 18:08:25 +01:00
int defType1, defType2, defAbility, moveType;
int i = 0;
int typePower = TYPE_x1;
2018-08-15 23:04:46 +02:00
if (move == MOVE_NONE || move == 0xFFFF || gBattleMoves[move].power == 0)
2018-08-15 23:04:46 +02:00
return 0;
2018-08-26 21:41:47 +02:00
defType1 = gBaseStats[targetSpecies].type1;
defType2 = gBaseStats[targetSpecies].type2;
defAbility = gBaseStats[targetSpecies].abilities[0];
2018-08-15 23:04:46 +02:00
moveType = gBattleMoves[move].type;
2018-08-26 21:41:47 +02:00
if (defAbility == ABILITY_LEVITATE && moveType == TYPE_GROUND)
2018-08-15 23:04:46 +02:00
{
if (arg2 == 1)
typePower = 8;
}
else
{
while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE)
2018-08-15 23:04:46 +02:00
{
if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT)
2018-08-15 23:04:46 +02:00
{
i += 3;
continue;
2018-08-15 23:04:46 +02:00
}
else if (TYPE_EFFECT_ATK_TYPE(i) == moveType)
2018-08-15 23:04:46 +02:00
{
// BUG: * 2 is not necessary and makes the condition always false if the ability is wonder guard.
if (TYPE_EFFECT_DEF_TYPE(i) == defType1 && (defAbility != ABILITY_WONDER_GUARD || TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE * 2))
typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10;
if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2 && (defAbility != ABILITY_WONDER_GUARD || TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE * 2))
typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10;
2018-08-15 23:04:46 +02:00
}
i += 3;
2018-08-15 23:04:46 +02:00
}
}
switch (arg2)
{
case 0:
switch (typePower)
{
case TYPE_x0_50:
case TYPE_x0_25:
case TYPE_x0:
2018-08-15 23:04:46 +02:00
default:
typePower = 0;
break;
case TYPE_x1:
2018-08-15 23:04:46 +02:00
typePower = 2;
break;
case TYPE_x2:
2018-08-15 23:04:46 +02:00
typePower = 4;
break;
case TYPE_x4:
2018-08-15 23:04:46 +02:00
typePower = 8;
break;
}
break;
case 1:
switch (typePower)
{
default:
case TYPE_x1:
2018-08-15 23:04:46 +02:00
typePower = 0;
break;
case TYPE_x0_25:
2018-08-15 23:04:46 +02:00
typePower = 4;
break;
case TYPE_x0:
2018-08-15 23:04:46 +02:00
typePower = 8;
break;
case TYPE_x0_50:
2018-08-15 23:04:46 +02:00
typePower = 2;
break;
case TYPE_x2:
2018-08-15 23:04:46 +02:00
typePower = -2;
break;
case TYPE_x4:
2018-08-15 23:04:46 +02:00
typePower = -4;
break;
}
break;
case 2:
switch (typePower)
{
2018-08-26 21:41:47 +02:00
case TYPE_x0:
2018-08-15 23:04:46 +02:00
typePower = -16;
break;
2018-08-26 21:41:47 +02:00
case TYPE_x0_25:
2018-08-15 23:04:46 +02:00
typePower = -8;
break;
2018-08-26 21:41:47 +02:00
case TYPE_x0_50:
2018-08-15 23:04:46 +02:00
default:
typePower = 0;
break;
2018-08-26 21:41:47 +02:00
case TYPE_x1:
2018-08-15 23:04:46 +02:00
typePower = 4;
break;
2018-08-26 21:41:47 +02:00
case TYPE_x2:
2018-08-15 23:04:46 +02:00
typePower = 12;
break;
2018-08-26 21:41:47 +02:00
case TYPE_x4:
2018-08-15 23:04:46 +02:00
typePower = 20;
break;
}
break;
}
return typePower;
2018-08-16 22:46:02 +02:00
}
2018-08-18 00:54:18 +02:00
#else
NAKED
2019-02-08 18:08:25 +01:00
static int GetTypeEffectivenessPoints(int move, int species, int arg2)
2018-08-18 00:54:18 +02:00
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x8\n\
adds r3, r0, 0\n\
adds r4, r1, 0\n\
str r2, [sp]\n\
movs r6, 0\n\
movs r2, 0x14\n\
cmp r3, 0\n\
beq _0818FFF0\n\
ldr r0, =0x0000ffff\n\
cmp r3, r0\n\
beq _0818FFF0\n\
ldr r0, =gBattleMoves\n\
lsls r1, r3, 1\n\
adds r1, r3\n\
lsls r1, 2\n\
adds r3, r1, r0\n\
ldrb r0, [r3, 0x1]\n\
cmp r0, 0\n\
bne _0818FFFC\n\
2018-08-18 00:54:18 +02:00
_0818FFF0:\n\
movs r0, 0\n\
b _08190156\n\
.pool\n\
2018-08-18 00:54:18 +02:00
_0818FFFC:\n\
ldr r1, =gBaseStats\n\
lsls r0, r4, 3\n\
subs r0, r4\n\
lsls r0, 2\n\
adds r0, r1\n\
ldrb r1, [r0, 0x6]\n\
mov r10, r1\n\
ldrb r1, [r0, 0x7]\n\
mov r9, r1\n\
ldrb r0, [r0, 0x16]\n\
mov r8, r0\n\
ldrb r3, [r3, 0x2]\n\
str r3, [sp, 0x4]\n\
cmp r0, 0x1A\n\
bne _0819002C\n\
cmp r3, 0x4\n\
bne _0819002C\n\
ldr r0, [sp]\n\
cmp r0, 0x1\n\
bne _081900AA\n\
movs r2, 0x8\n\
b _081900A4\n\
.pool\n\
2018-08-18 00:54:18 +02:00
_0819002C:\n\
ldr r0, =gTypeEffectiveness\n\
adds r1, r6, r0\n\
ldrb r0, [r1]\n\
ldr r7, =gTypeEffectiveness\n\
cmp r0, 0xFF\n\
beq _081900A4\n\
adds r4, r1, 0\n\
2018-08-18 00:54:18 +02:00
_0819003A:\n\
ldrb r0, [r4]\n\
cmp r0, 0xFE\n\
beq _08190096\n\
ldrb r0, [r4]\n\
ldr r1, [sp, 0x4]\n\
cmp r0, r1\n\
bne _08190096\n\
ldrb r0, [r4, 0x1]\n\
adds r5, r6, 0x1\n\
cmp r0, r10\n\
bne _0819006C\n\
adds r1, r6, 0x2\n\
mov r0, r8\n\
cmp r0, 0x19\n\
bne _0819005E\n\
ldrb r0, [r4, 0x2]\n\
cmp r0, 0x28\n\
bne _0819006C\n\
2018-08-18 00:54:18 +02:00
_0819005E:\n\
adds r0, r1, r7\n\
ldrb r0, [r0]\n\
muls r0, r2\n\
movs r1, 0xA\n\
bl __divsi3\n\
adds r2, r0, 0\n\
2018-08-18 00:54:18 +02:00
_0819006C:\n\
adds r0, r5, r7\n\
ldrb r0, [r0]\n\
cmp r0, r9\n\
bne _08190096\n\
cmp r10, r9\n\
beq _08190096\n\
adds r1, r6, 0x2\n\
mov r0, r8\n\
cmp r0, 0x19\n\
bne _08190088\n\
adds r0, r1, r7\n\
ldrb r0, [r0]\n\
cmp r0, 0x28\n\
bne _08190096\n\
2018-08-18 00:54:18 +02:00
_08190088:\n\
adds r0, r1, r7\n\
ldrb r0, [r0]\n\
muls r0, r2\n\
movs r1, 0xA\n\
bl __divsi3\n\
adds r2, r0, 0\n\
2018-08-18 00:54:18 +02:00
_08190096:\n\
adds r4, 0x3\n\
adds r6, 0x3\n\
ldr r1, =gTypeEffectiveness\n\
adds r0, r6, r1\n\
ldrb r0, [r0]\n\
cmp r0, 0xFF\n\
bne _0819003A\n\
2018-08-18 00:54:18 +02:00
_081900A4:\n\
ldr r0, [sp]\n\
cmp r0, 0x1\n\
beq _081900E0\n\
2018-08-18 00:54:18 +02:00
_081900AA:\n\
ldr r1, [sp]\n\
cmp r1, 0x1\n\
bgt _081900BC\n\
cmp r1, 0\n\
beq _081900C4\n\
b _08190154\n\
.pool\n\
2018-08-18 00:54:18 +02:00
_081900BC:\n\
ldr r0, [sp]\n\
cmp r0, 0x2\n\
beq _08190114\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_081900C4:\n\
cmp r2, 0xA\n\
beq _08190146\n\
cmp r2, 0xA\n\
ble _08190146\n\
cmp r2, 0x28\n\
beq _0819014A\n\
cmp r2, 0x28\n\
bgt _081900DA\n\
cmp r2, 0x14\n\
beq _08190104\n\
b _08190146\n\
2018-08-18 00:54:18 +02:00
_081900DA:\n\
cmp r2, 0x50\n\
bne _08190146\n\
b _08190100\n\
2018-08-18 00:54:18 +02:00
_081900E0:\n\
cmp r2, 0xA\n\
beq _08190104\n\
cmp r2, 0xA\n\
bgt _081900F2\n\
cmp r2, 0\n\
beq _08190100\n\
cmp r2, 0x5\n\
beq _0819014A\n\
b _08190146\n\
2018-08-18 00:54:18 +02:00
_081900F2:\n\
cmp r2, 0x28\n\
beq _08190108\n\
cmp r2, 0x28\n\
ble _08190146\n\
cmp r2, 0x50\n\
beq _0819010E\n\
b _08190146\n\
2018-08-18 00:54:18 +02:00
_08190100:\n\
movs r2, 0x8\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_08190104:\n\
movs r2, 0x2\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_08190108:\n\
movs r2, 0x2\n\
negs r2, r2\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_0819010E:\n\
movs r2, 0x4\n\
negs r2, r2\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_08190114:\n\
cmp r2, 0xA\n\
beq _08190146\n\
cmp r2, 0xA\n\
bgt _08190126\n\
cmp r2, 0\n\
beq _0819013A\n\
cmp r2, 0x5\n\
beq _08190140\n\
b _08190146\n\
2018-08-18 00:54:18 +02:00
_08190126:\n\
cmp r2, 0x28\n\
beq _0819014E\n\
cmp r2, 0x28\n\
bgt _08190134\n\
cmp r2, 0x14\n\
beq _0819014A\n\
b _08190146\n\
2018-08-18 00:54:18 +02:00
_08190134:\n\
cmp r2, 0x50\n\
beq _08190152\n\
b _08190146\n\
2018-08-18 00:54:18 +02:00
_0819013A:\n\
movs r2, 0x10\n\
negs r2, r2\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_08190140:\n\
movs r2, 0x8\n\
negs r2, r2\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_08190146:\n\
movs r2, 0\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_0819014A:\n\
movs r2, 0x4\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_0819014E:\n\
movs r2, 0xC\n\
b _08190154\n\
2018-08-18 00:54:18 +02:00
_08190152:\n\
movs r2, 0x14\n\
2018-08-18 00:54:18 +02:00
_08190154:\n\
adds r0, r2, 0\n\
2018-08-18 00:54:18 +02:00
_08190156:\n\
add sp, 0x8\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1\n\
2018-08-18 00:54:18 +02:00
");
}
#endif // NONMATCHING
2018-08-25 19:59:47 +02:00
static u8 GetDomeTrainerMonIvs(u16 trainerId)
2018-08-18 00:54:18 +02:00
{
u8 fixedIv;
if (trainerId <= 99)
fixedIv = 3;
else if (trainerId <= 119)
fixedIv = 6;
else if (trainerId <= 139)
fixedIv = 9;
else if (trainerId <= 159)
fixedIv = 12;
else if (trainerId <= 179)
fixedIv = 15;
else if (trainerId <= 199)
fixedIv = 18;
else if (trainerId <= 219)
fixedIv = 21;
else
fixedIv = 31;
return fixedIv;
}
2019-02-08 18:08:25 +01:00
static int TournamentIdOfOpponent(int roundId, int trainerId)
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int i, j, val;
2018-08-18 00:54:18 +02:00
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (DOME_TRAINERS[i].trainerId == trainerId)
2018-08-18 00:54:18 +02:00
break;
}
2018-08-18 19:52:25 +02:00
if (roundId != DOME_ROUND1)
2018-08-18 00:54:18 +02:00
{
2018-08-18 19:52:25 +02:00
if (roundId == DOME_FINAL)
2018-08-26 21:41:47 +02:00
val = sIdToOpponentId[i][roundId] + 8;
2018-08-18 00:54:18 +02:00
else
2018-08-26 21:41:47 +02:00
val = sIdToOpponentId[i][roundId] + 4;
2018-08-18 00:54:18 +02:00
2018-08-26 21:41:47 +02:00
for (j = sIdToOpponentId[i][roundId]; j < val; j++)
2018-08-18 00:54:18 +02:00
{
if (gUnknown_0860D14C[j] != i && !DOME_TRAINERS[gUnknown_0860D14C[j]].isEliminated)
2018-08-18 00:54:18 +02:00
break;
}
if (j != val)
return gUnknown_0860D14C[j];
else
return 0xFF;
2018-08-18 00:54:18 +02:00
}
else
{
if (!DOME_TRAINERS[sIdToOpponentId[i][roundId]].isEliminated)
2018-08-26 21:41:47 +02:00
return sIdToOpponentId[i][roundId];
2018-08-18 00:54:18 +02:00
else
return 0xFF;
2018-08-18 00:54:18 +02:00
}
}
2019-02-08 18:08:25 +01:00
static void SetDomeOpponentId(void)
2018-08-18 00:54:18 +02:00
{
2018-08-18 19:52:25 +02:00
gTrainerBattleOpponent_A = TrainerIdOfPlayerOpponent();
2018-08-18 00:54:18 +02:00
}
2018-08-25 19:59:47 +02:00
static u16 TrainerIdOfPlayerOpponent(void)
2018-08-18 00:54:18 +02:00
{
return DOME_TRAINERS[TournamentIdOfOpponent(gSaveBlock2Ptr->frontier.curChallengeBattleNum, TRAINER_PLAYER)].trainerId;
2018-08-18 00:54:18 +02:00
}
2019-02-08 18:08:25 +01:00
static void SetDomeOpponentGraphicsId(void)
2018-08-18 00:54:18 +02:00
{
2018-10-21 00:06:42 +02:00
SetBattleFacilityTrainerGfxId(gTrainerBattleOpponent_A, 0);
2018-08-18 00:54:18 +02:00
}
static void SaveDomeChallenge(void)
2018-08-18 00:54:18 +02:00
{
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr->frontier.challengeStatus = gSpecialVar_0x8005;
2018-08-18 00:54:18 +02:00
VarSet(VAR_TEMP_0, 0);
2019-11-24 22:58:40 +01:00
gSaveBlock2Ptr->frontier.challengePaused = TRUE;
SaveGameFrontier();
2018-08-18 00:54:18 +02:00
}
static void IncrementDomeStreaks(void)
2018-08-18 00:54:18 +02:00
{
2018-08-25 19:59:47 +02:00
u8 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
u8 battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
2018-08-18 00:54:18 +02:00
2018-10-27 17:39:05 +02:00
if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] < 999)
gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode]++;
if (gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode] < 999)
gSaveBlock2Ptr->frontier.domeTotalChampionships[battleMode][lvlMode]++;
2018-08-18 00:54:18 +02:00
2018-10-27 17:39:05 +02:00
if (gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode] > gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode])
gSaveBlock2Ptr->frontier.domeRecordWinStreaks[battleMode][lvlMode] = gSaveBlock2Ptr->frontier.domeWinStreaks[battleMode][lvlMode];
2018-08-18 00:54:18 +02:00
}
2018-08-26 15:51:14 +02:00
static void ShowDomeOpponentInfo(void)
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
u8 taskId = CreateTask(Task_ShowOpponentInfo, 0);
2018-08-18 00:54:18 +02:00
gTasks[taskId].data[0] = 0;
2018-08-18 19:52:25 +02:00
gTasks[taskId].data[1] = TrainerIdToTournamentId(TrainerIdOfPlayerOpponent());
2018-08-18 00:54:18 +02:00
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3] = 0;
2018-08-25 11:55:16 +02:00
SetMainCallback2(CB2_BattleDome);
2018-08-18 00:54:18 +02:00
}
2019-02-08 18:08:25 +01:00
static void Task_ShowOpponentInfo(u8 taskId)
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
int r5 = gTasks[taskId].data[1];
int r9 = gTasks[taskId].data[2];
int r7 = gTasks[taskId].data[3];
2018-08-18 00:54:18 +02:00
switch (gTasks[taskId].data[0])
{
case 0:
SetHBlankCallback(NULL);
SetVBlankCallback(NULL);
EnableInterrupts(INTR_FLAG_VBLANK);
CpuFill32(0, (void *)VRAM, VRAM_SIZE);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sOpponentInfoBgTemplates, ARRAY_COUNT(sOpponentInfoBgTemplates));
InitWindows(sOpponentInfoWindowTemplates);
2018-08-18 00:54:18 +02:00
DeactivateAllTextPrinters();
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
gBattle_BG3_X = 0;
gBattle_BG3_Y = 0;
if (r9 == 2)
gBattle_BG2_X = 0, gBattle_BG2_Y = 0;
else
gBattle_BG2_X = 0, gBattle_BG2_Y = 160;
gTasks[taskId].data[0]++;
break;
case 1:
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_MOSAIC, 0);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_WIN1H, 0);
SetGpuReg(REG_OFFSET_WIN1V, 0);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR);
2018-08-18 00:54:18 +02:00
ResetPaletteFade();
ResetSpriteData();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 4;
gTasks[taskId].data[0]++;
break;
case 2:
DecompressAndLoadBgGfxUsingHeap(2, gUnknown_08D83D50, 0x2000, 0, 0);
DecompressAndLoadBgGfxUsingHeap(2, gUnknown_08D84970, 0x2000, 0, 1);
DecompressAndLoadBgGfxUsingHeap(3, gUnknown_08D84F00, 0x800, 0, 1);
2019-02-08 18:08:25 +01:00
LoadCompressedSpriteSheet(sDomeOptionsSpriteSheet);
2018-08-18 00:54:18 +02:00
LoadCompressedPalette(gUnknown_08D85358, 0, 0x200);
LoadCompressedPalette(gUnknown_08D85444, 0x100, 0x200);
2019-11-07 01:18:11 +01:00
LoadCompressedPalette(gBattleWindowTextPalette, 0xF0, 0x20);
2018-08-18 00:54:18 +02:00
if (r9 == 2)
LoadCompressedPalette(gUnknown_08D854C8, 0x50, 0x20);
CpuFill32(0, gPlttBufferFaded, 0x400);
ShowBg(0);
ShowBg(1);
ShowBg(2);
ShowBg(3);
gTasks[taskId].data[0]++;
break;
case 3:
2018-08-25 18:46:15 +02:00
SetVBlankCallback(VblankCb0_BattleDome);
2018-08-25 19:59:47 +02:00
sBattleDomeStruct = AllocZeroed(sizeof(*sBattleDomeStruct));
2018-08-18 00:54:18 +02:00
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
2019-01-13 12:12:27 +01:00
sBattleDomeStruct->arr[i] = 0xFF;
2018-08-18 00:54:18 +02:00
LoadMonIconPalettes();
i = CreateTask(sub_8190CD4, 0);
gTasks[i].data[0] = 0;
gTasks[i].data[2] = 0;
gTasks[i].data[3] = r9;
gTasks[i].data[4] = r7;
if (r9 == 2)
{
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard(0, r5);
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10 = 1;
2018-08-18 00:54:18 +02:00
}
else
{
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(0, r5);
2018-08-18 00:54:18 +02:00
}
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP);
if (r9 != 0)
{
r7 = CreateSprite(&gUnknown_0860D068, 120, 4, 0);
StartSpriteAnim(&gSprites[r7], 0);
gSprites[r7].data[0] = i;
r7 = CreateSprite(&gUnknown_0860D068, 120, 156, 0);
StartSpriteAnim(&gSprites[r7], 1);
gSprites[r7].data[0] = i;
r7 = CreateSprite(&gUnknown_0860D050, 6, 80, 0);
StartSpriteAnim(&gSprites[r7], 0);
gSprites[r7].data[0] = i;
gSprites[r7].data[1] = 0;
if (r9 == 1)
gSprites[r7].invisible = TRUE;
2018-08-18 00:54:18 +02:00
r7 = CreateSprite(&gUnknown_0860D050, 234, 80, 0);
StartSpriteAnim(&gSprites[r7], 1);
gSprites[r7].data[0] = i;
gSprites[r7].data[1] = 1;
}
DestroyTask(taskId);
break;
}
}
2018-08-20 22:56:05 +02:00
// Note: Card scrolling up means the current card goes down and another one appears from top.
// The same is true for scrolling left.
// That means that the sprite needs to move with the moving card in the opposite scrolling direction.
static void SpriteCb_TrainerIconCardScrollUp(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
sprite->pos1.y += 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.y >= -32)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 40)
sprite->callback = SpriteCallbackDummy;
}
else
{
if (sprite->pos1.y >= 192)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_TrainerIconCardScrollDown(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
sprite->pos1.y -= 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.y <= 192)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 40)
sprite->callback = SpriteCallbackDummy;
}
else
{
if (sprite->pos1.y <= -32)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_TrainerIconCardScrollLeft(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
sprite->pos1.x += 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.x >= -32)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 64)
sprite->callback = SpriteCallbackDummy;
}
else
{
if (sprite->pos1.x >= 272)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_TrainerIconCardScrollRight(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
sprite->pos1.x -= 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.x <= 272)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 64)
sprite->callback = SpriteCallbackDummy;
}
else
{
if (sprite->pos1.x <= -32)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-19 01:06:10 +02:00
FreeAndDestroyTrainerPicSprite(sprite->data[3]);
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-20 22:56:05 +02:00
#define sMonIconStill data[3]
static void SpriteCb_MonIcon(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if (!sprite->sMonIconStill)
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame(sprite);
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollUp(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if (!sprite->sMonIconStill)
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame(sprite);
sprite->pos1.y += 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.y >= -16)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 40)
2018-08-20 22:56:05 +02:00
sprite->callback = SpriteCb_MonIcon;
2018-08-18 00:54:18 +02:00
}
else
{
if (sprite->pos1.y >= 176)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-18 00:54:18 +02:00
sub_80D2EF8(sprite);
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollDown(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if (!sprite->sMonIconStill)
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame(sprite);
sprite->pos1.y -= 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.y <= 176)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 40)
2018-08-20 22:56:05 +02:00
sprite->callback = SpriteCb_MonIcon;
2018-08-18 00:54:18 +02:00
}
else
{
if (sprite->pos1.y <= -16)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-18 00:54:18 +02:00
sub_80D2EF8(sprite);
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollLeft(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if (!sprite->sMonIconStill)
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame(sprite);
sprite->pos1.x += 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.x >= -16)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 64)
2018-08-20 22:56:05 +02:00
sprite->callback = SpriteCb_MonIcon;
2018-08-18 00:54:18 +02:00
}
else
{
if (sprite->pos1.x >= 256)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-18 00:54:18 +02:00
sub_80D2EF8(sprite);
}
}
}
2018-08-20 22:56:05 +02:00
static void SpriteCb_MonIconCardScrollRight(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
2018-08-20 22:56:05 +02:00
if (!sprite->sMonIconStill)
2018-08-18 00:54:18 +02:00
UpdateMonIconFrame(sprite);
sprite->pos1.x -= 4;
if (sprite->data[0] != 0)
{
if (sprite->pos1.x <= 256)
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
if (++sprite->data[1] == 64)
2018-08-20 22:56:05 +02:00
sprite->callback = SpriteCb_MonIcon;
2018-08-18 00:54:18 +02:00
}
else
{
if (sprite->pos1.x <= -16)
{
sBattleDomeStruct->arr[sprite->data[2]] = 0xFF;
2018-08-18 00:54:18 +02:00
sub_80D2EF8(sprite);
}
}
}
2018-08-26 15:51:14 +02:00
static void sub_8190B40(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int taskId1 = sprite->data[0];
int arrId = gTasks[gTasks[taskId1].data[4]].data[1];
int tournmanetTrainerId = sTourneyTreeTrainerIds[arrId];
int roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
2018-08-18 00:54:18 +02:00
if (gTasks[taskId1].data[3] == 1)
{
if (sprite->data[1])
{
if ((DOME_TRAINERS[tournmanetTrainerId].isEliminated
&& sBattleDomeStruct->unk_10 - 1 < DOME_TRAINERS[tournmanetTrainerId].eliminatedAt))
2018-08-18 00:54:18 +02:00
{
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
}
else if (!DOME_TRAINERS[tournmanetTrainerId].isEliminated
2018-10-21 00:06:42 +02:00
&& sBattleDomeStruct->unk_10 - 1 < roundId)
2018-08-18 00:54:18 +02:00
{
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
}
else
{
if (gTasks[taskId1].data[0] == 2)
sprite->invisible = TRUE;
2018-08-18 00:54:18 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 != 0)
2018-08-18 00:54:18 +02:00
{
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
}
else
{
if (gTasks[taskId1].data[0] == 2)
sprite->invisible = TRUE;
2018-08-18 00:54:18 +02:00
}
}
}
else
{
if (sprite->data[1])
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 > 1)
2018-08-18 00:54:18 +02:00
{
if (gTasks[taskId1].data[0] == 2)
sprite->invisible = TRUE;
2018-08-18 00:54:18 +02:00
}
else
{
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 != 0)
2018-08-18 00:54:18 +02:00
{
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
}
else
{
if (gTasks[taskId1].data[0] == 2)
sprite->invisible = TRUE;
2018-08-18 00:54:18 +02:00
}
}
}
}
2018-08-26 15:51:14 +02:00
static void sub_8190C6C(struct Sprite *sprite)
2018-08-18 00:54:18 +02:00
{
2019-02-08 18:08:25 +01:00
int taskId1 = sprite->data[0];
2018-08-18 00:54:18 +02:00
if (gTasks[taskId1].data[3] == 1)
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 != 0)
2018-08-18 00:54:18 +02:00
{
if (gTasks[taskId1].data[0] == 2)
sprite->invisible = TRUE;
2018-08-18 00:54:18 +02:00
}
else
{
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
}
}
else
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 != 1)
2018-08-18 00:54:18 +02:00
{
if (gTasks[taskId1].data[0] == 2)
sprite->invisible = TRUE;
2018-08-18 00:54:18 +02:00
}
else
{
sprite->invisible = FALSE;
2018-08-18 00:54:18 +02:00
}
}
}
2018-08-25 19:59:47 +02:00
static void sub_8190CD4(u8 taskId)
{
2019-02-08 18:08:25 +01:00
int i;
int windowId = 0;
int r9 = gTasks[taskId].data[3];
int taskId2 = gTasks[taskId].data[4];
int trainerTournamentId = 0;
int matchNo = 0;
switch (gTasks[taskId].data[0])
{
case 0:
if (!gPaletteFade.active)
{
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
gTasks[taskId].data[0] = 1;
}
break;
case 1:
if (!gPaletteFade.active)
gTasks[taskId].data[0] = 2;
break;
case 2:
i = sub_819221C(taskId);
switch (i)
{
case 9:
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].data[0] = 8;
break;
case 1 ... 8:
gTasks[taskId].data[5] = i;
if (gTasks[taskId].data[2] != 0)
2018-08-20 22:56:05 +02:00
windowId = 9;
else
2018-08-20 22:56:05 +02:00
windowId = 0;
2018-08-20 22:56:05 +02:00
for (i = windowId; i < windowId + 9; i++)
{
CopyWindowToVram(i, 2);
FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
gTasks[taskId].data[0] = 3;
break;
case 0:
break;
}
break;
case 3:
i = gTasks[taskId].data[5];
switch (i)
{
case 1:
case 5:
if (gTasks[taskId].data[2])
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 160;
}
else
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 160;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
}
if (i == 1)
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 0)
{
gBattle_BG2_X = 0;
gBattle_BG2_Y = 320;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 0x10, trainerTournamentId);
}
else
{
gBattle_BG2_X = 256;
gBattle_BG2_Y = 0;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 0x10, trainerTournamentId);
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10 = 0;
}
}
else
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 0)
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-25 19:59:47 +02:00
sub_8192F08(matchNo, sBattleDomeStruct->unk_11);
gBattle_BG2_X = 0;
gBattle_BG2_Y = 320;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct->unk_11[0];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 0x10, trainerTournamentId);
}
2018-08-25 19:59:47 +02:00
else if (sBattleDomeStruct->unk_10 == 2)
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-25 19:59:47 +02:00
sub_8192F08(matchNo, sBattleDomeStruct->unk_11);
gBattle_BG2_X = 0;
gBattle_BG2_Y = 320;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct->unk_11[1];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 0x10, trainerTournamentId);
}
else
{
gBattle_BG2_X = 256;
gBattle_BG2_Y = 160;
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard(gTasks[taskId].data[2] | 0x10, matchNo);
}
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2; i++)
{
if (i < 2)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollUp;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollUp;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
for (i = DOME_TOURNAMENT_TRAINERS_COUNT / 2; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (i < 10)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollUp;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollUp;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
gTasks[taskId].data[0] = 4;
gTasks[taskId].data[5] = 0;
break;
case 2:
case 6:
if (gTasks[taskId].data[2])
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = -160;
}
else
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = -160;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
}
if (i == 2)
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 0)
{
gBattle_BG2_X = 0;
gBattle_BG2_Y = 160;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 4, trainerTournamentId);
}
else
{
gBattle_BG2_X = 0;
gBattle_BG2_Y = 0;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 4, trainerTournamentId);
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10 = 0;
}
}
else
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 0)
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-25 19:59:47 +02:00
sub_8192F08(matchNo, sBattleDomeStruct->unk_11);
gBattle_BG2_X = 0;
gBattle_BG2_Y = 160;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct->unk_11[0];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 4, trainerTournamentId);
}
2018-08-25 19:59:47 +02:00
else if (sBattleDomeStruct->unk_10 == 2)
{
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-25 19:59:47 +02:00
sub_8192F08(matchNo, sBattleDomeStruct->unk_11);
gBattle_BG2_X = 0;
gBattle_BG2_Y = 160;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct->unk_11[1];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 4, trainerTournamentId);
}
else
{
gBattle_BG2_X = 256;
gBattle_BG2_Y = 0;
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard(gTasks[taskId].data[2] | 4, matchNo);
}
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2; i++)
{
if (i < 2)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollDown;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollDown;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
for (i = DOME_TOURNAMENT_TRAINERS_COUNT / 2; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (i < 10)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollDown;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollDown;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
gTasks[taskId].data[0] = 5;
gTasks[taskId].data[5] = 0;
break;
case 3:
if (gTasks[taskId].data[2])
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 256;
gBattle_BG1_Y = 0;
}
else
{
gBattle_BG0_X = 256;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
}
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 0)
{
gBattle_BG2_X = 256;
gBattle_BG2_Y = 160;
2019-02-08 18:08:25 +01:00
trainerTournamentId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 8, trainerTournamentId);
}
else
{
gBattle_BG2_X = 256;
gBattle_BG2_Y = 0;
2018-08-26 15:51:14 +02:00
matchNo = gUnknown_0860D15C[gTasks[taskId2].data[1]][sBattleDomeStruct->unk_10 - 1];
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard(gTasks[taskId].data[2] | 8, matchNo);
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2; i++)
{
if (i < 2)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
for (i = DOME_TOURNAMENT_TRAINERS_COUNT / 2; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (i < 10)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
gTasks[taskId].data[0] = 6;
gTasks[taskId].data[5] = 0;
break;
case 7:
if (gTasks[taskId].data[2])
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 256;
gBattle_BG1_Y = 0;
}
else
{
gBattle_BG0_X = 256;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
}
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 0)
{
gBattle_BG2_X = 256;
gBattle_BG2_Y = 160;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct->unk_11[0];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 8, trainerTournamentId);
}
else
{
gBattle_BG2_X = 0;
gBattle_BG2_Y = 160;
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard(gTasks[taskId].data[2] | 8, matchNo);
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2; i++)
{
if (i < 2)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
for (i = DOME_TOURNAMENT_TRAINERS_COUNT / 2; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (i < 10)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollLeft;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
gTasks[taskId].data[0] = 6;
gTasks[taskId].data[5] = 0;
break;
case 4:
if (gTasks[taskId].data[2])
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = -256;
gBattle_BG1_Y = 0;
}
else
{
gBattle_BG0_X = -256;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
}
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 1)
{
gBattle_BG2_X = 0;
gBattle_BG2_Y = 160;
}
else
{
gBattle_BG2_X = 0;
gBattle_BG2_Y = 0;
}
2018-08-26 15:51:14 +02:00
matchNo = gUnknown_0860D15C[gTasks[taskId2].data[1]][sBattleDomeStruct->unk_10 - 1];
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard(gTasks[taskId].data[2] | 2, matchNo);
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2; i++)
{
if (i < 2)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
for (i = DOME_TOURNAMENT_TRAINERS_COUNT / 2; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (i < 10)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
gTasks[taskId].data[0] = 7;
gTasks[taskId].data[5] = 0;
break;
case 8:
if (gTasks[taskId].data[2])
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = -256;
gBattle_BG1_Y = 0;
}
else
{
gBattle_BG0_X = -256;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
}
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 2)
{
gBattle_BG2_X = 256;
gBattle_BG2_Y = 160;
2018-08-25 19:59:47 +02:00
trainerTournamentId = sBattleDomeStruct->unk_11[1];
2018-08-19 20:21:37 +02:00
DisplayTrainerInfoOnCard(gTasks[taskId].data[2] | 2, trainerTournamentId);
}
else
{
gBattle_BG2_X = 0;
gBattle_BG2_Y = 160;
2018-08-20 22:56:05 +02:00
matchNo = gTasks[taskId2].data[1] - 16;
2018-08-21 23:36:59 +02:00
DisplayMatchInfoOnCard(gTasks[taskId].data[2] | 2, matchNo);
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2; i++)
{
if (i < 2)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2] ^ 1;
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
for (i = DOME_TOURNAMENT_TRAINERS_COUNT / 2; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (i < 10)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_TrainerIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
gSprites[sBattleDomeStruct->arr[i]].data[3] = sBattleDomeStruct->arr[i];
}
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[i]].callback = SpriteCb_MonIconCardScrollRight;
gSprites[sBattleDomeStruct->arr[i]].data[0] = gTasks[taskId].data[2];
gSprites[sBattleDomeStruct->arr[i]].data[1] = 0;
gSprites[sBattleDomeStruct->arr[i]].data[2] = i;
}
}
}
gTasks[taskId].data[0] = 7;
gTasks[taskId].data[5] = 0;
break;
}
break;
case 4:
if (++gTasks[taskId].data[5] != 41)
{
gBattle_BG0_Y -= 4;
gBattle_BG1_Y -= 4;
gBattle_BG2_Y -= 4;
}
else
{
gTasks[taskId].data[0] = 2;
}
break;
case 5:
if (++gTasks[taskId].data[5] != 41)
{
gBattle_BG0_Y += 4;
gBattle_BG1_Y += 4;
gBattle_BG2_Y += 4;
}
else
{
gTasks[taskId].data[0] = 2;
}
break;
case 6:
if (++gTasks[taskId].data[5] != 65)
{
gBattle_BG0_X -= 4;
gBattle_BG1_X -= 4;
gBattle_BG2_X -= 4;
}
else
{
gTasks[taskId].data[0] = 2;
}
break;
case 7:
if (++gTasks[taskId].data[5] != 65)
{
gBattle_BG0_X += 4;
gBattle_BG1_X += 4;
gBattle_BG2_X += 4;
}
else
{
gTasks[taskId].data[0] = 2;
}
break;
case 8:
if (!gPaletteFade.active)
{
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT / 2; i++)
{
if (i < 2)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
2018-08-25 19:59:47 +02:00
FreeAndDestroyTrainerPicSprite(sBattleDomeStruct->arr[i]);
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
2018-08-25 19:59:47 +02:00
sub_80D2EF8(&gSprites[sBattleDomeStruct->arr[i]]);
}
}
for (i = DOME_TOURNAMENT_TRAINERS_COUNT / 2; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (i < 10)
{
if (sBattleDomeStruct->arr[i] != 0xFF)
2018-08-25 19:59:47 +02:00
FreeAndDestroyTrainerPicSprite(sBattleDomeStruct->arr[i]);
}
else
{
if (sBattleDomeStruct->arr[i] != 0xFF)
2018-08-25 19:59:47 +02:00
sub_80D2EF8(&gSprites[sBattleDomeStruct->arr[i]]);
}
}
FreeMonIconPalettes();
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL(sBattleDomeStruct);
FreeAllWindowBuffers();
if (r9 == 0)
{
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
}
else
{
2019-02-08 18:08:25 +01:00
i = CreateTask(Task_ShowTourneyTree, 0);
gTasks[i].data[0] = 0;
gTasks[i].data[1] = 0;
gTasks[i].data[2] = 3;
gTasks[i].data[3] = gTasks[taskId].data[4];
gTasks[i].data[4] = gTasks[taskId2].data[6];
}
DestroyTask(taskId);
}
break;
}
}
2018-08-18 19:52:25 +02:00
2018-08-25 19:59:47 +02:00
static u8 sub_819221C(u8 taskId)
2018-08-18 19:52:25 +02:00
{
u8 retVal = 0;
2019-02-08 18:08:25 +01:00
int taskId2 = gTasks[taskId].data[4];
int r5 = gTasks[taskId2].data[1];
u8 r10 = sTourneyTreeTrainerIds[r5];
2018-10-21 00:06:42 +02:00
u16 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
2018-08-18 19:52:25 +02:00
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
retVal = 9;
2018-08-19 01:06:10 +02:00
if (gTasks[taskId].data[3] == 0)
return retVal;
if (gTasks[taskId].data[3] == 1)
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
if (gMain.newKeys & DPAD_UP && sBattleDomeStruct->unk_10 == 0)
2018-08-18 19:52:25 +02:00
{
2018-08-19 01:06:10 +02:00
if (r5 == 0)
r5 = 15;
else
r5--;
retVal = 1;
2018-08-18 19:52:25 +02:00
}
2018-08-25 19:59:47 +02:00
else if (gMain.newKeys & DPAD_DOWN && sBattleDomeStruct->unk_10 == 0)
2018-08-18 19:52:25 +02:00
{
2018-08-19 01:06:10 +02:00
if (r5 == 15)
r5 = 0;
else
r5++;
retVal = 2;
}
2018-08-25 19:59:47 +02:00
else if (gMain.newKeys & DPAD_LEFT && sBattleDomeStruct->unk_10 != 0)
2018-08-19 01:06:10 +02:00
{
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10--;
2018-08-19 01:06:10 +02:00
retVal = 3;
}
else if (gMain.newKeys & DPAD_RIGHT)
{
if (DOME_TRAINERS[r10].isEliminated && sBattleDomeStruct->unk_10 - 1 < DOME_TRAINERS[r10].eliminatedAt)
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10++;
2018-08-19 01:06:10 +02:00
retVal = 4;
2018-08-18 19:52:25 +02:00
}
if (!DOME_TRAINERS[r10].isEliminated && sBattleDomeStruct->unk_10 - 1 < roundId)
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10++;
2018-08-19 01:06:10 +02:00
retVal = 4;
2018-08-18 19:52:25 +02:00
}
2018-08-19 01:06:10 +02:00
}
2018-08-18 19:52:25 +02:00
2018-08-19 01:06:10 +02:00
if (retVal == 9)
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 != 0)
gTasks[taskId2].data[1] = gUnknown_0860D1A0[r5 / 2][sBattleDomeStruct->unk_10 - 1];
2018-08-19 01:06:10 +02:00
else
gTasks[taskId2].data[1] = r5;
}
}
else
{
2018-08-25 19:59:47 +02:00
if (gMain.newKeys & DPAD_UP && sBattleDomeStruct->unk_10 == 1)
2018-08-19 01:06:10 +02:00
{
if (r5 == 16)
r5 = gUnknown_0860D19C[roundId];
else
r5--;
retVal = 5;
}
2018-08-25 19:59:47 +02:00
else if (gMain.newKeys & DPAD_DOWN && sBattleDomeStruct->unk_10 == 1)
2018-08-19 01:06:10 +02:00
{
if (r5 == gUnknown_0860D19C[roundId])
r5 = 16;
else
r5++;
retVal = 6;
}
2018-08-25 19:59:47 +02:00
else if (gMain.newKeys & DPAD_LEFT && sBattleDomeStruct->unk_10 != 0)
2018-08-19 01:06:10 +02:00
{
retVal = 7;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10--;
2018-08-19 01:06:10 +02:00
}
2018-08-25 19:59:47 +02:00
else if (gMain.newKeys & DPAD_RIGHT && (sBattleDomeStruct->unk_10 == 0 || sBattleDomeStruct->unk_10 == 1))
2018-08-19 01:06:10 +02:00
{
retVal = 8;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10++;
2018-08-18 19:52:25 +02:00
}
2018-08-19 01:06:10 +02:00
if (retVal == 9)
2018-08-18 19:52:25 +02:00
{
2018-08-25 19:59:47 +02:00
if (sBattleDomeStruct->unk_10 == 0)
gTasks[taskId2].data[1] = gUnknown_0860D1C0[sBattleDomeStruct->unk_11[0]];
else if (sBattleDomeStruct->unk_10 == 2)
gTasks[taskId2].data[1] = gUnknown_0860D1C0[sBattleDomeStruct->unk_11[1]];
2018-08-19 01:06:10 +02:00
else
gTasks[taskId2].data[1] = r5;
2018-08-18 19:52:25 +02:00
}
}
2018-08-19 01:06:10 +02:00
if (retVal != 0 && retVal != 9)
{
PlaySE(SE_SELECT);
gTasks[taskId2].data[1] = r5;
gTasks[taskId].data[2] ^= 1;
}
2018-08-18 19:52:25 +02:00
return retVal;
}
2018-08-19 01:06:10 +02:00
2018-08-19 20:21:37 +02:00
static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTournamentId)
2018-08-19 01:06:10 +02:00
{
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter;
2019-02-08 18:08:25 +01:00
int i, j, k;
int trainerId = 0;
2018-08-19 20:21:37 +02:00
u8 nature = 0;
2019-02-08 18:08:25 +01:00
int arrId = 0;
int windowId = 0;
int x = 0, y = 0;
2018-08-19 20:21:37 +02:00
u8 palSlot = 0;
s16 *allocatedArray = AllocZeroed(sizeof(s16) * 18);
trainerId = DOME_TRAINERS[trainerTournamentId].trainerId;
2018-08-19 17:13:05 +02:00
2018-08-19 20:21:37 +02:00
if (flags & 1)
arrId = 8, windowId = 9, palSlot = 2;
if (flags & 2)
2018-08-19 17:13:05 +02:00
x = 256;
2018-08-19 20:21:37 +02:00
if (flags & 4)
2018-08-19 17:13:05 +02:00
y = 160;
2018-08-19 20:21:37 +02:00
if (flags & 8)
2018-08-19 17:13:05 +02:00
x = -256;
2018-08-19 20:21:37 +02:00
if (flags & 0x10)
2018-08-19 17:13:05 +02:00
y = -160;
if (trainerId == TRAINER_PLAYER)
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[arrId] = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), TRUE, x + 48, y + 64, palSlot + 12, 0xFFFF);
2018-08-19 17:13:05 +02:00
else if (trainerId == TRAINER_FRONTIER_BRAIN)
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[arrId] = CreateTrainerPicSprite(GetDomeBrainTrainerPicId(), TRUE, x + 48, y + 64, palSlot + 12, 0xFFFF);
2018-08-19 17:13:05 +02:00
else
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[arrId] = CreateTrainerPicSprite(GetFrontierTrainerFrontSpriteId(trainerId), TRUE, x + 48, y + 64, palSlot + 12, 0xFFFF);
2018-08-19 17:13:05 +02:00
2018-08-19 20:21:37 +02:00
if (flags & 0x1E)
gSprites[sBattleDomeStruct->arr[arrId]].invisible = TRUE;
2018-08-19 17:13:05 +02:00
for (i = 0; i < 3; i++)
{
if (trainerId == TRAINER_PLAYER)
2018-08-19 20:21:37 +02:00
{
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(DOME_MONS[trainerTournamentId][i],
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sInfoTrainerMonX[i],
y + sInfoTrainerMonY[i],
2018-08-19 17:13:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].oam.priority = 0;
2018-08-19 20:21:37 +02:00
}
2018-08-19 17:13:05 +02:00
else if (trainerId == TRAINER_FRONTIER_BRAIN)
2018-08-19 20:21:37 +02:00
{
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(DOME_MONS[trainerTournamentId][i],
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sInfoTrainerMonX[i],
y + sInfoTrainerMonY[i],
2018-08-19 17:13:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].oam.priority = 0;
2018-08-19 20:21:37 +02:00
}
2018-08-19 17:13:05 +02:00
else
2018-08-19 20:21:37 +02:00
{
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[DOME_MONS[trainerTournamentId][i]].species,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sInfoTrainerMonX[i],
y + sInfoTrainerMonY[i],
2018-08-19 17:13:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].oam.priority = 0;
2018-08-19 20:21:37 +02:00
}
if (flags & 0x1E)
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].invisible = TRUE;
2018-08-19 17:13:05 +02:00
}
textPrinter.fontId = 2;
textPrinter.x = 0;
textPrinter.y = 0;
2018-08-19 20:21:37 +02:00
textPrinter.currentX = textPrinter.x;
textPrinter.currentY = textPrinter.y;
2018-08-19 17:13:05 +02:00
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
2018-11-06 18:30:21 +01:00
textPrinter.unk = 0;
textPrinter.fgColor = TEXT_DYNAMIC_COLOR_5;
textPrinter.bgColor = TEXT_COLOR_TRANSPARENT;
textPrinter.shadowColor = TEXT_DYNAMIC_COLOR_4;
2018-08-19 17:13:05 +02:00
i = 0;
if (trainerId == TRAINER_PLAYER)
j = gFacilityClassToTrainerClass[FACILITY_CLASS_BRENDAN];
2018-08-19 17:13:05 +02:00
else if (trainerId == TRAINER_FRONTIER_BRAIN)
j = GetDomeBrainTrainerClass();
else
j = GetFrontierOpponentClass(trainerId);
for (;gTrainerClassNames[j][i] != EOS; i++)
gStringVar1[i] = gTrainerClassNames[j][i];
gStringVar1[i] = CHAR_SPACE;
gStringVar1[i + 1] = EOS;
if (trainerId == TRAINER_PLAYER)
{
StringAppend(gStringVar1, gSaveBlock2Ptr->playerName);
}
else if (trainerId == TRAINER_FRONTIER_BRAIN)
{
CopyDomeBrainTrainerName(gStringVar2);
StringAppend(gStringVar1, gStringVar2);
}
else
{
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName(gStringVar2, trainerId);
2018-08-19 17:13:05 +02:00
StringAppend(gStringVar1, gStringVar2);
}
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, gStringVar1, 0xD0, textPrinter.letterSpacing);
2018-11-06 17:44:48 +01:00
textPrinter.currentChar = gStringVar1;
2018-08-19 17:13:05 +02:00
textPrinter.windowId = windowId;
PutWindowTilemap(windowId);
CopyWindowToVram(windowId, 3);
AddTextPrinter(&textPrinter, 0, NULL);
textPrinter.letterSpacing = 0;
for (i = 0; i < 3; i++)
{
textPrinter.currentY = sSpeciesNameTextYCoords[i];
2018-08-19 17:13:05 +02:00
if (trainerId == TRAINER_PLAYER)
textPrinter.currentChar = gSpeciesNames[DOME_MONS[trainerTournamentId][i]];
2018-08-19 17:13:05 +02:00
else if (trainerId == TRAINER_FRONTIER_BRAIN)
textPrinter.currentChar = gSpeciesNames[DOME_MONS[trainerTournamentId][i]];
2018-08-19 17:13:05 +02:00
else
textPrinter.currentChar = gSpeciesNames[gFacilityTrainerMons[DOME_MONS[trainerTournamentId][i]].species];
2018-08-19 17:13:05 +02:00
2018-08-19 20:21:37 +02:00
textPrinter.windowId = 1 + i + windowId;
2018-08-19 17:13:05 +02:00
if (i == 1)
textPrinter.currentX = 7;
else
textPrinter.currentX = 0;
2018-08-19 20:21:37 +02:00
PutWindowTilemap(1 + i + windowId);
CopyWindowToVram(1 + i + windowId, 3);
2018-08-19 17:13:05 +02:00
AddTextPrinter(&textPrinter, 0, NULL);
}
PutWindowTilemap(windowId + 4);
CopyWindowToVram(windowId + 4, 3);
if (trainerId == TRAINER_FRONTIER_BRAIN)
2019-02-08 18:08:25 +01:00
textPrinter.currentChar = sBattleDomePotentialTexts[16];
2018-08-19 17:13:05 +02:00
else
2019-02-08 18:08:25 +01:00
textPrinter.currentChar = sBattleDomePotentialTexts[trainerTournamentId];
2018-08-19 17:13:05 +02:00
textPrinter.fontId = 1;
textPrinter.windowId = windowId + 4;
textPrinter.currentX = 0;
textPrinter.y = 4;
textPrinter.currentY = 4;
AddTextPrinter(&textPrinter, 0, NULL);
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-19 17:13:05 +02:00
{
for (j = 0; j < MAX_MON_MOVES; j++)
2018-08-19 17:13:05 +02:00
{
for (k = 0; k < DOME_TOURNAMENT_TRAINERS_COUNT; k++)
{
if (trainerId == TRAINER_FRONTIER_BRAIN)
2018-11-01 21:31:10 +01:00
allocatedArray[k] += sMovePointsForDomeTrainers[GetFrontierBrainMonMove(i, j)][k];
2018-08-19 17:13:05 +02:00
else if (trainerId == TRAINER_PLAYER)
2018-08-25 19:59:47 +02:00
allocatedArray[k] += sMovePointsForDomeTrainers[gSaveBlock2Ptr->frontier.field_EFC[i].moves[j]][k];
2018-08-19 17:13:05 +02:00
else
allocatedArray[k] += sMovePointsForDomeTrainers[gFacilityTrainerMons[DOME_MONS[trainerTournamentId][i]].moves[j]][k];
2018-08-19 17:13:05 +02:00
}
}
}
for (i = 0; i < ARRAY_COUNT(gUnknown_0860C988); i++)
{
2019-02-08 18:08:25 +01:00
int r4 = 0;
2018-08-19 17:13:05 +02:00
for (k = 0, j = 0; j < DOME_TOURNAMENT_TRAINERS_COUNT; j++)
{
if (gUnknown_0860C988[i][j] != 0)
{
r4++;
if (allocatedArray[j] != 0 && allocatedArray[j] >= gUnknown_0860C988[i][j])
k++;
}
}
if (r4 == k)
break;
}
2019-02-08 18:08:25 +01:00
textPrinter.currentChar = sBattleDomeOpponentStyleTexts[i];
2018-08-19 17:13:05 +02:00
textPrinter.y = 20;
textPrinter.currentY = 20;
AddTextPrinter(&textPrinter, 0, NULL);
for (i = 0; i < 18; i++)
allocatedArray[i] = 0;
if (trainerId == TRAINER_FRONTIER_BRAIN || trainerId == TRAINER_PLAYER)
{
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-19 17:13:05 +02:00
{
for (j = 0; j < NUM_STATS; j++)
2018-08-19 17:13:05 +02:00
{
if (trainerId == TRAINER_FRONTIER_BRAIN)
2018-11-01 21:31:10 +01:00
allocatedArray[j] = GetFrontierBrainMonEvs(i, j);
2018-08-19 17:13:05 +02:00
else
allocatedArray[j] = gSaveBlock2Ptr->frontier.field_EFC[i].evs[j];
}
allocatedArray[6] += allocatedArray[0];
for (j = 0; j < 5; j++)
{
if (trainerId == TRAINER_FRONTIER_BRAIN)
2018-11-01 21:31:10 +01:00
nature = GetFrontierBrainMonNature(i);
2018-08-19 17:13:05 +02:00
else
nature = gSaveBlock2Ptr->frontier.field_EFC[i].nature;
if (gNatureStatTable[nature][j] > 0)
{
allocatedArray[j + 7] += (allocatedArray[j + 1] * 110) / 100;
}
else if (gNatureStatTable[nature][j] < 0)
{
allocatedArray[j + 7] += (allocatedArray[j + 1] * 90) / 100;
allocatedArray[j + 13]++;
}
else
{
allocatedArray[j + 7] += allocatedArray[j + 1];
}
}
}
for (j = 0, i = 0; i < 6; i++)
j += allocatedArray[6 + i];
for (i = 0; i < 6; i++)
allocatedArray[i] = (allocatedArray[6 + i] * 100) / j;
}
else
{
for (i = 0; i < 3; i++)
{
int evBits = gFacilityTrainerMons[DOME_MONS[trainerTournamentId][i]].evSpread;
2018-11-18 20:00:36 +01:00
for (k = 0, j = 0; j < NUM_STATS; j++)
2018-08-19 17:13:05 +02:00
{
allocatedArray[j] = 0;
if (evBits & 1)
k++;
evBits >>= 1;
}
2018-08-29 20:38:54 +02:00
k = MAX_TOTAL_EVS / k;
evBits = gFacilityTrainerMons[DOME_MONS[trainerTournamentId][i]].evSpread;
2018-11-18 20:00:36 +01:00
for (j = 0; j < NUM_STATS; j++)
2018-08-19 17:13:05 +02:00
{
if (evBits & 1)
allocatedArray[j] = k;
evBits >>= 1;
}
allocatedArray[6] += allocatedArray[0];
for (j = 0; j < 5; j++)
{
nature = gFacilityTrainerMons[DOME_MONS[trainerTournamentId][i]].nature;
2018-08-19 17:13:05 +02:00
if (gNatureStatTable[nature][j] > 0)
{
allocatedArray[j + 7] += (allocatedArray[j + 1] * 110) / 100;
}
else if (gNatureStatTable[nature][j] < 0)
{
allocatedArray[j + 7] += (allocatedArray[j + 1] * 90) / 100;
allocatedArray[j + 13]++;
}
else
{
allocatedArray[j + 7] += allocatedArray[j + 1];
}
}
}
for (j = 0, i = 0; i < 6; i++)
j += allocatedArray[i + 6];
for (i = 0; i < 6; i++)
allocatedArray[i] = (allocatedArray[6 + i] * 100) / j;
}
for (i = 0, j = 0, k = 0; k < 6; k++)
{
if (allocatedArray[k] > 29)
{
if (i == 2)
{
if (allocatedArray[6] < allocatedArray[k])
{
if (allocatedArray[7] < allocatedArray[k])
{
if (allocatedArray[6] < allocatedArray[7])
{
2018-08-19 20:21:37 +02:00
allocatedArray[6] = allocatedArray[7];
2018-08-19 17:13:05 +02:00
allocatedArray[7] = k;
}
else
{
allocatedArray[7] = k;
}
}
else
{
2018-08-19 20:21:37 +02:00
allocatedArray[6] = allocatedArray[7];
2018-08-19 17:13:05 +02:00
allocatedArray[7] = k;
}
}
else
{
if (allocatedArray[7] < allocatedArray[k])
allocatedArray[7] = k;
}
}
else
{
2018-08-19 20:21:37 +02:00
allocatedArray[i + 6] = k;
2018-08-19 17:13:05 +02:00
i++;
}
}
if (allocatedArray[k] == 0)
{
if (j == 2)
{
if (allocatedArray[k + 12] >= 2
2018-08-19 20:21:37 +02:00
|| ((allocatedArray[k + 12] == 1 && allocatedArray[12 + allocatedArray[8]] == 0 && allocatedArray[12 + allocatedArray[9]] == 0)
2018-08-19 17:13:05 +02:00
)
)
{
allocatedArray[8] = allocatedArray[9];
allocatedArray[9] = k;
}
else if (allocatedArray[k + 12] == 1 && allocatedArray[12 + allocatedArray[8]] == 0)
{
allocatedArray[8] = allocatedArray[9];
allocatedArray[9] = k;
}
else if (allocatedArray[k + 12] == 1 && allocatedArray[12 + allocatedArray[9]] == 0)
{
allocatedArray[9] = k;
}
}
else
{
allocatedArray[j + 8] = k;
j++;
}
}
}
if (i == 2)
i = gUnknown_0860D349[allocatedArray[6]] + (allocatedArray[7] - (allocatedArray[6] + 1));
else if (i == 1)
i = allocatedArray[6] + 15;
else if (j == 2)
i = gUnknown_0860D349[allocatedArray[8]] + (allocatedArray[9] - (allocatedArray[8] + 1)) + 21;
else if (j == 1)
i = allocatedArray[8] + 36;
else
i = 42;
2018-08-19 01:06:10 +02:00
2019-02-08 18:08:25 +01:00
textPrinter.currentChar = sBattleDomeOpponentStatsTexts[i];
2018-08-19 17:13:05 +02:00
textPrinter.y = 36;
textPrinter.currentY = 36;
AddTextPrinter(&textPrinter, 0, NULL);
Free(allocatedArray);
2018-08-19 01:06:10 +02:00
}
2018-08-19 22:26:07 +02:00
static int sub_8192F08(u8 matchNum, u8 *arg1)
2018-08-19 22:26:07 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-19 22:26:07 +02:00
u8 tournamentId;
2019-02-08 18:08:25 +01:00
int retVal = 0;
int count = 0;
2018-08-19 22:26:07 +02:00
for (i = gUnknown_0860D3C4[matchNum][0]; i < gUnknown_0860D3C4[matchNum][0] + gUnknown_0860D3C4[matchNum][1]; i++)
2018-08-19 22:26:07 +02:00
{
tournamentId = gUnknown_0860D3B4[i];
if (!DOME_TRAINERS[tournamentId].isEliminated)
2018-08-19 22:26:07 +02:00
{
arg1[count] = tournamentId;
if (DOME_TRAINERS[tournamentId].trainerId == TRAINER_PLAYER)
2018-08-19 22:26:07 +02:00
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
else if (DOME_TRAINERS[tournamentId].trainerId == TRAINER_FRONTIER_BRAIN)
2018-08-19 22:26:07 +02:00
CopyDomeBrainTrainerName(gStringVar1);
else
CopyDomeTrainerName(gStringVar1, DOME_TRAINERS[tournamentId].trainerId);
2018-08-19 22:26:07 +02:00
count++;
}
}
if (count == 2)
return 0;
for (i = gUnknown_0860D3C4[matchNum][0]; i < gUnknown_0860D3C4[matchNum][0] + gUnknown_0860D3C4[matchNum][1]; i++)
2018-08-19 22:26:07 +02:00
{
tournamentId = gUnknown_0860D3B4[i];
if (DOME_TRAINERS[tournamentId].isEliminated
&& DOME_TRAINERS[tournamentId].eliminatedAt >= gUnknown_0860D3C4[matchNum][2])
2018-08-19 22:26:07 +02:00
{
arg1[count] = tournamentId;
count++;
if (DOME_TRAINERS[tournamentId].eliminatedAt == gUnknown_0860D3C4[matchNum][2])
2018-08-19 22:26:07 +02:00
{
StringCopy(gStringVar2, gMoveNames[gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId]]);
retVal = DOME_TRAINERS[tournamentId].forfeited * 2;
if (gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId] == MOVE_NONE && DOME_TRAINERS[tournamentId].forfeited == FALSE)
2018-08-19 22:26:07 +02:00
retVal = 4;
}
else
{
if (DOME_TRAINERS[tournamentId].trainerId == TRAINER_PLAYER)
2018-08-19 22:26:07 +02:00
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
else if (DOME_TRAINERS[tournamentId].trainerId == TRAINER_FRONTIER_BRAIN)
2018-08-19 22:26:07 +02:00
CopyDomeBrainTrainerName(gStringVar1);
else
CopyDomeTrainerName(gStringVar1, DOME_TRAINERS[tournamentId].trainerId);
2018-08-19 22:26:07 +02:00
}
}
if (count == 2)
break;
}
if (matchNum == 14)
2018-08-19 22:26:07 +02:00
return retVal + 2;
else
return retVal + 1;
}
2018-08-20 22:56:05 +02:00
2018-08-21 23:36:59 +02:00
static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo)
2018-08-20 22:56:05 +02:00
{
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter;
2019-02-08 18:08:25 +01:00
int tournamentIds[2];
int trainerIds[2];
2018-08-20 22:56:05 +02:00
bool32 lost[2];
2019-02-08 18:08:25 +01:00
int i;
int winStringId = 0;
int arrId = 0;
int windowId = 0;
int x = 0, y = 0;
2018-08-20 22:56:05 +02:00
u8 palSlot = 0;
if (flags & 1)
arrId = 8, windowId = 9, palSlot = 2;
if (flags & 2)
x = 256;
if (flags & 4)
y = 160;
if (flags & 8)
x = -256;
if (flags & 0x10)
y = -160;
// Copy trainers information to handy arrays.
2018-08-25 19:59:47 +02:00
winStringId = sub_8192F08(matchNo, sBattleDomeStruct->unk_11);
2018-08-20 22:56:05 +02:00
for (i = 0; i < 2; i++)
{
2018-08-25 19:59:47 +02:00
tournamentIds[i] = sBattleDomeStruct->unk_11[i];
trainerIds[i] = DOME_TRAINERS[tournamentIds[i]].trainerId;
if (DOME_TRAINERS[tournamentIds[i]].eliminatedAt <= gUnknown_0860D3C4[matchNo][2]
&& DOME_TRAINERS[tournamentIds[i]].isEliminated)
2018-08-20 22:56:05 +02:00
lost[i] = TRUE;
else
lost[i] = FALSE;
}
// Draw first trainer sprite.
if (trainerIds[0] == TRAINER_PLAYER)
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[arrId] = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), TRUE, x + 48, y + 88, palSlot + 12, 0xFFFF);
2018-08-20 22:56:05 +02:00
else if (trainerIds[0] == TRAINER_FRONTIER_BRAIN)
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[arrId] = CreateTrainerPicSprite(GetDomeBrainTrainerPicId(), TRUE, x + 48, y + 88, palSlot + 12, 0xFFFF);
2018-08-20 22:56:05 +02:00
else
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[arrId] = CreateTrainerPicSprite(GetFrontierTrainerFrontSpriteId(trainerIds[0]), TRUE, x + 48, y + 88, palSlot + 12, 0xFFFF);
2018-08-20 22:56:05 +02:00
if (flags & 0x1E)
gSprites[sBattleDomeStruct->arr[arrId]].invisible = TRUE;
2018-08-20 22:56:05 +02:00
if (lost[0])
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[arrId]].oam.paletteNum = 3;
2018-08-20 22:56:05 +02:00
// Draw second trainer sprite.
if (trainerIds[1] == TRAINER_PLAYER)
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[1 + arrId] = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), TRUE, x + 192, y + 88, palSlot + 13, 0xFFFF);
2018-08-20 22:56:05 +02:00
else if (trainerIds[1] == TRAINER_FRONTIER_BRAIN)
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[1 + arrId] = CreateTrainerPicSprite(GetDomeBrainTrainerPicId(), TRUE, x + 192, y + 88, palSlot + 13, 0xFFFF);
2018-08-20 22:56:05 +02:00
else
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->arr[1 + arrId] = CreateTrainerPicSprite(GetFrontierTrainerFrontSpriteId(trainerIds[1]), TRUE, x + 192, y + 88, palSlot + 13, 0xFFFF);
2018-08-20 22:56:05 +02:00
if (flags & 0x1E)
gSprites[sBattleDomeStruct->arr[1 + arrId]].invisible = TRUE;
2018-08-20 22:56:05 +02:00
if (lost[1])
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[1 + arrId]].oam.paletteNum = 3;
2018-08-20 22:56:05 +02:00
// Draw first trainer's pokemon icons.
for (i = 0; i < 3; i++)
{
if (trainerIds[0] == TRAINER_PLAYER)
{
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[0]][i],
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sFirstTrainerMonX[i],
y + sFirstTrainerMonY[i],
2018-08-20 22:56:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].oam.priority = 0;
2018-08-20 22:56:05 +02:00
}
else if (trainerIds[0] == TRAINER_FRONTIER_BRAIN)
{
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[0]][i],
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sFirstTrainerMonX[i],
y + sFirstTrainerMonY[i],
2018-08-20 22:56:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].oam.priority = 0;
2018-08-20 22:56:05 +02:00
}
else
{
sBattleDomeStruct->arr[2 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[DOME_MONS[tournamentIds[0]][i]].species,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sFirstTrainerMonX[i],
y + sFirstTrainerMonY[i],
2018-08-20 22:56:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].oam.priority = 0;
2018-08-20 22:56:05 +02:00
}
if (flags & 0x1E)
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].invisible = TRUE;
2018-08-20 22:56:05 +02:00
if (lost[0])
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].oam.paletteNum = 3;
gSprites[sBattleDomeStruct->arr[2 + i + arrId]].sMonIconStill = TRUE;
2018-08-20 22:56:05 +02:00
}
}
// Draw second trainer's pokemon icons.
for (i = 0; i < 3; i++)
{
if (trainerIds[1] == TRAINER_PLAYER)
{
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[1]][i],
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sSecondTrainerMonX[i],
y + sSecondTrainerMonY[i],
2018-08-20 22:56:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[5 + i + arrId]].oam.priority = 0;
2018-08-20 22:56:05 +02:00
}
else if (trainerIds[1] == TRAINER_FRONTIER_BRAIN)
{
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(DOME_MONS[tournamentIds[1]][i],
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sSecondTrainerMonX[i],
y + sSecondTrainerMonY[i],
2018-08-20 22:56:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[5 + i + arrId]].oam.priority = 0;
2018-08-20 22:56:05 +02:00
}
else
{
sBattleDomeStruct->arr[5 + i + arrId] = CreateMonIcon(gFacilityTrainerMons[DOME_MONS[tournamentIds[1]][i]].species,
2018-08-20 22:56:05 +02:00
SpriteCb_MonIcon,
2018-08-26 15:51:14 +02:00
x | sSecondTrainerMonX[i],
y + sSecondTrainerMonY[i],
2018-08-20 22:56:05 +02:00
0, 0, TRUE);
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[5 + i + arrId]].oam.priority = 0;
2018-08-20 22:56:05 +02:00
}
if (flags & 0x1E)
gSprites[sBattleDomeStruct->arr[5 + i + arrId]].invisible = TRUE;
2018-08-20 22:56:05 +02:00
if (lost[1])
{
2018-08-25 19:59:47 +02:00
gSprites[sBattleDomeStruct->arr[5 + i + arrId]].oam.paletteNum = 3;
gSprites[sBattleDomeStruct->arr[5 + i + arrId]].sMonIconStill = TRUE;
2018-08-20 22:56:05 +02:00
}
}
// Print the win string (or 'Let the battle begin!' one).
textPrinter.x = 0;
textPrinter.y = 2;
textPrinter.currentX = textPrinter.x;
textPrinter.currentY = textPrinter.y;
textPrinter.letterSpacing = 0;
textPrinter.lineSpacing = 0;
2018-11-06 18:30:21 +01:00
textPrinter.unk = 0;
2018-08-20 22:56:05 +02:00
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
2019-02-08 18:08:25 +01:00
StringExpandPlaceholders(gStringVar4, sBattleDomeWinTexts[winStringId]);
2018-11-06 17:44:48 +01:00
textPrinter.currentChar = gStringVar4;
2018-08-20 22:56:05 +02:00
textPrinter.windowId = windowId + 8;
textPrinter.fontId = 1;
PutWindowTilemap(windowId + 8);
CopyWindowToVram(windowId + 8, 3);
textPrinter.currentX = 0;
textPrinter.currentY = textPrinter.y = 0;
AddTextPrinter(&textPrinter, 0, NULL);
// Print first trainer's name.
if (trainerIds[0] == TRAINER_PLAYER)
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
else if (trainerIds[0] == TRAINER_FRONTIER_BRAIN)
CopyDomeBrainTrainerName(gStringVar1);
else
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName(gStringVar1, trainerIds[0]);
2018-08-20 22:56:05 +02:00
textPrinter.fontId = 2;
textPrinter.letterSpacing = 2;
2018-11-06 17:44:48 +01:00
textPrinter.currentChar = gStringVar1;
2018-08-20 22:56:05 +02:00
textPrinter.windowId = windowId + 6;
2018-11-06 17:44:48 +01:00
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
2018-08-20 22:56:05 +02:00
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 6);
CopyWindowToVram(windowId + 6, 3);
AddTextPrinter(&textPrinter, 0, NULL);
// Print second trainer's name.
if (trainerIds[1] == TRAINER_PLAYER)
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
else if (trainerIds[1] == TRAINER_FRONTIER_BRAIN)
CopyDomeBrainTrainerName(gStringVar1);
else
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName(gStringVar1, trainerIds[1]);
2018-08-20 22:56:05 +02:00
2018-11-06 17:44:48 +01:00
textPrinter.currentChar = gStringVar1;
2018-08-20 22:56:05 +02:00
textPrinter.windowId = windowId + 7;
2018-11-06 17:44:48 +01:00
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x40, textPrinter.letterSpacing);
2018-08-20 22:56:05 +02:00
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 7);
CopyWindowToVram(windowId + 7, 3);
AddTextPrinter(&textPrinter, 0, NULL);
// Print match number.
textPrinter.letterSpacing = 0;
2019-02-08 18:08:25 +01:00
textPrinter.currentChar = sBattleDomeMatchNumberTexts[matchNo];
2018-08-20 22:56:05 +02:00
textPrinter.windowId = windowId + 5;
2018-11-06 17:44:48 +01:00
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0xA0, textPrinter.letterSpacing);
2018-08-20 22:56:05 +02:00
textPrinter.currentY = textPrinter.y = 2;
PutWindowTilemap(windowId + 5);
CopyWindowToVram(windowId + 5, 3);
AddTextPrinter(&textPrinter, 0, NULL);
}
2018-08-21 23:36:59 +02:00
2019-02-08 18:08:25 +01:00
static void ShowDomeTourneyTree(void)
2018-08-21 23:36:59 +02:00
{
2019-02-08 18:08:25 +01:00
u8 taskId = CreateTask(Task_ShowTourneyTree, 0);
2018-08-21 23:36:59 +02:00
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 2;
gTasks[taskId].data[4] = 0;
2018-08-25 11:55:16 +02:00
SetMainCallback2(CB2_BattleDome);
2018-08-21 23:36:59 +02:00
}
2019-02-08 18:08:25 +01:00
static void ShowPreviousDomeResultsTourneyTree(void)
2018-08-21 23:36:59 +02:00
{
u8 taskId;
2019-02-08 18:08:25 +01:00
InitDomeFacilityTrainersAndMons();
gSaveBlock2Ptr->frontier.lvlMode = gSaveBlock2Ptr->frontier.domeLvlMode - 1;
gSaveBlock2Ptr->frontier.curChallengeBattleNum = DOME_FINAL;
2019-02-08 18:08:25 +01:00
taskId = CreateTask(Task_ShowTourneyTree, 0);
2018-08-21 23:36:59 +02:00
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = 2;
gTasks[taskId].data[4] = 1;
2018-08-25 11:55:16 +02:00
SetMainCallback2(CB2_BattleDome);
2018-08-21 23:36:59 +02:00
}
2018-08-26 15:51:14 +02:00
static void sub_819395C(u8 taskId)
2018-08-21 23:36:59 +02:00
{
u8 newTaskId = 0;
2019-02-08 18:08:25 +01:00
int spriteId = gTasks[taskId].data[1];
2018-08-21 23:36:59 +02:00
switch (gTasks[taskId].data[0])
{
case 0:
if (!gPaletteFade.active)
{
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
2018-08-21 23:36:59 +02:00
gTasks[taskId].data[0] = 1;
StartSpriteAnim(&gSprites[spriteId], 1);
}
break;
case 1:
if (!gPaletteFade.active)
gTasks[taskId].data[0] = 2;
break;
case 2:
2019-02-08 18:08:25 +01:00
switch (UpdateTourneyTreeCursor(taskId))
2018-08-21 23:36:59 +02:00
{
case 0:
default:
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
2018-08-21 23:36:59 +02:00
gTasks[taskId].data[0] = 7;
break;
case 1:
break;
case 2:
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
2018-08-21 23:36:59 +02:00
gTasks[taskId].data[0] = 3;
break;
case 3:
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
2018-08-21 23:36:59 +02:00
gTasks[taskId].data[0] = 5;
break;
}
break;
case 3:
if (!gPaletteFade.active)
{
FreeAllWindowBuffers();
ScanlineEffect_Stop();
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL(sTilemapBuffer);
2019-02-08 18:08:25 +01:00
newTaskId = CreateTask(Task_ShowOpponentInfo, 0);
2018-08-21 23:36:59 +02:00
gTasks[newTaskId].data[0] = 0;
2019-02-08 18:08:25 +01:00
gTasks[newTaskId].data[1] = sTourneyTreeTrainerIds[spriteId];
2018-08-21 23:36:59 +02:00
gTasks[newTaskId].data[2] = 1;
gTasks[newTaskId].data[3] = taskId;
gTasks[taskId].data[0] = 4;
2018-08-25 19:59:47 +02:00
sBattleDomeStruct->unk_10 = 0;
2018-08-21 23:36:59 +02:00
}
break;
case 4:
break;
case 5:
if (!gPaletteFade.active)
{
FreeAllWindowBuffers();
ScanlineEffect_Stop();
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL(sTilemapBuffer);
2019-02-08 18:08:25 +01:00
newTaskId = CreateTask(Task_ShowOpponentInfo, 0);
2018-08-21 23:36:59 +02:00
gTasks[newTaskId].data[0] = 0;
gTasks[newTaskId].data[1] = spriteId - 16;
gTasks[newTaskId].data[2] = 2;
gTasks[newTaskId].data[3] = taskId;
gTasks[taskId].data[0] = 6;
}
break;
case 6:
break;
case 7:
if (!gPaletteFade.active)
{
FreeAllWindowBuffers();
ScanlineEffect_Stop();
2018-08-25 19:59:47 +02:00
FREE_AND_SET_NULL(sTilemapBuffer);
2018-08-21 23:36:59 +02:00
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
DestroyTask(gTasks[taskId].data[7]);
DestroyTask(taskId);
}
break;
}
}
2019-02-08 18:08:25 +01:00
static u8 UpdateTourneyTreeCursor(u8 taskId)
2018-08-21 23:36:59 +02:00
{
u8 retVal = 1;
2019-02-08 18:08:25 +01:00
int direction = 4;
int tourneyTreeCursorSpriteId = gTasks[taskId].data[1];
int roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
2018-08-21 23:36:59 +02:00
2019-02-08 18:08:25 +01:00
if (gMain.newKeys == B_BUTTON || (gMain.newKeys & A_BUTTON && tourneyTreeCursorSpriteId == 31))
2018-08-21 23:36:59 +02:00
{
PlaySE(SE_SELECT);
retVal = 0;
}
else if (gMain.newKeys & A_BUTTON)
{
if (tourneyTreeCursorSpriteId < DOME_TOURNAMENT_TRAINERS_COUNT)
2018-08-21 23:36:59 +02:00
{
PlaySE(SE_SELECT);
retVal = 2;
}
else
{
PlaySE(SE_SELECT);
retVal = 3;
}
}
else
{
2019-02-08 18:08:25 +01:00
if (gMain.newKeys == DPAD_UP && sTourneyTreeCursorMovementMap[tourneyTreeCursorSpriteId][roundId][0] != 0xFF)
direction = 0;
else if (gMain.newKeys == DPAD_DOWN && sTourneyTreeCursorMovementMap[tourneyTreeCursorSpriteId][roundId][1] != 0xFF)
direction = 1;
else if (gMain.newKeys == DPAD_LEFT && sTourneyTreeCursorMovementMap[tourneyTreeCursorSpriteId][roundId][2] != 0xFF)
direction = 2;
else if (gMain.newKeys == DPAD_RIGHT && sTourneyTreeCursorMovementMap[tourneyTreeCursorSpriteId][roundId][3] != 0xFF)
direction = 3;
2018-08-21 23:36:59 +02:00
}
2019-02-08 18:08:25 +01:00
if (direction != 4)
2018-08-21 23:36:59 +02:00
{
PlaySE(SE_SELECT);
2019-02-08 18:08:25 +01:00
StartSpriteAnim(&gSprites[tourneyTreeCursorSpriteId], 0);
tourneyTreeCursorSpriteId = sTourneyTreeCursorMovementMap[tourneyTreeCursorSpriteId][roundId][direction];
StartSpriteAnim(&gSprites[tourneyTreeCursorSpriteId], 1);
gTasks[taskId].data[1] = tourneyTreeCursorSpriteId;
2018-08-21 23:36:59 +02:00
}
return retVal;
}
2018-08-25 11:55:16 +02:00
2019-02-08 18:08:25 +01:00
static void ShowNonInteractiveDomeTourneyTree(void)
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
u8 taskId = CreateTask(Task_ShowTourneyTree, 0);
2018-08-25 11:55:16 +02:00
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 1;
gTasks[taskId].data[2] = 2;
gTasks[taskId].data[4] = 0;
SetMainCallback2(CB2_BattleDome);
}
2019-02-08 18:08:25 +01:00
static void ResolveDomeRoundWinners(void)
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-25 11:55:16 +02:00
if (gSpecialVar_0x8005 == DOME_PLAYER_WON_MATCH)
2018-08-25 11:55:16 +02:00
{
DOME_TRAINERS[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].isEliminated = TRUE;
DOME_TRAINERS[TrainerIdToTournamentId(gTrainerBattleOpponent_A)].eliminatedAt = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
gSaveBlock2Ptr->frontier.domeWinningMoves[TrainerIdToTournamentId(gTrainerBattleOpponent_A)] = gBattleResults.lastUsedMovePlayer;
2018-10-21 00:06:42 +02:00
if (gSaveBlock2Ptr->frontier.curChallengeBattleNum < DOME_FINAL)
DecideRoundWinners(gSaveBlock2Ptr->frontier.curChallengeBattleNum);
2018-08-25 11:55:16 +02:00
}
else // DOME_PLAYER_LOST_MATCH or DOME_PLAYER_RETIRED
2018-08-25 11:55:16 +02:00
{
DOME_TRAINERS[TrainerIdToTournamentId(TRAINER_PLAYER)].isEliminated = TRUE;
DOME_TRAINERS[TrainerIdToTournamentId(TRAINER_PLAYER)].eliminatedAt = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
gSaveBlock2Ptr->frontier.domeWinningMoves[TrainerIdToTournamentId(TRAINER_PLAYER)] = gBattleResults.lastUsedMoveOpponent;
if (gBattleOutcome == B_OUTCOME_FORFEITED || gSpecialVar_0x8005 == DOME_PLAYER_RETIRED)
DOME_TRAINERS[TrainerIdToTournamentId(TRAINER_PLAYER)].forfeited = TRUE;
2018-10-21 00:06:42 +02:00
for (i = gSaveBlock2Ptr->frontier.curChallengeBattleNum; i < DOME_ROUNDS_COUNT; i++)
2018-08-25 18:46:15 +02:00
DecideRoundWinners(i);
2018-08-25 11:55:16 +02:00
}
}
2019-02-08 18:08:25 +01:00
static u16 GetWinningMove(int winnerTournamentId, int loserTournamentId, u8 roundId)
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i, j, k;
int moveScores[MAX_MON_MOVES * FRONTIER_PARTY_SIZE];
u16 moveIds[MAX_MON_MOVES * FRONTIER_PARTY_SIZE];
2018-08-25 11:55:16 +02:00
u16 bestScore = 0;
u16 bestId = 0;
2019-02-08 18:08:25 +01:00
int movePower = 0;
2018-10-27 00:04:18 +02:00
SetFacilityPtrsGetLevel();
2018-08-25 11:55:16 +02:00
// Calc move points of all 4 moves for all 3 pokemon hitting all 3 target mons.
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
2018-08-25 11:55:16 +02:00
{
for (j = 0; j < MAX_MON_MOVES; j++)
2018-08-25 11:55:16 +02:00
{
// TODO: Clean this up, looks like a different data structure (2D array)
moveScores[i * MAX_MON_MOVES + j] = 0;
if (DOME_TRAINERS[winnerTournamentId].trainerId == TRAINER_FRONTIER_BRAIN)
moveIds[i * MAX_MON_MOVES + j] = GetFrontierBrainMonMove(i, j);
2018-08-25 11:55:16 +02:00
else
moveIds[i * MAX_MON_MOVES + j] = gFacilityTrainerMons[DOME_MONS[winnerTournamentId][i]].moves[j];
2018-08-25 11:55:16 +02:00
movePower = gBattleMoves[moveIds[i * MAX_MON_MOVES + j]].power;
2018-08-25 11:55:16 +02:00
if (movePower == 0)
movePower = 40;
else if (movePower == 1)
movePower = 60;
else if (moveIds[i * MAX_MON_MOVES + j] == MOVE_SELF_DESTRUCT
|| moveIds[i * MAX_MON_MOVES + j] == MOVE_EXPLOSION)
2018-08-25 11:55:16 +02:00
movePower /= 2;
for (k = 0; k < FRONTIER_PARTY_SIZE; k++)
2018-08-25 11:55:16 +02:00
{
u32 var = 0;
u16 targetSpecies = SPECIES_NONE;
u16 targetAbility = ABILITY_NONE;
2018-08-25 11:55:16 +02:00
do
{
var = Random32();
} while (gFacilityTrainerMons[DOME_MONS[loserTournamentId][k]].nature != GetNatureFromPersonality(var));
2018-08-25 11:55:16 +02:00
targetSpecies = gFacilityTrainerMons[DOME_MONS[loserTournamentId][k]].species;
2018-08-25 11:55:16 +02:00
if (var & 1)
targetAbility = gBaseStats[targetSpecies].abilities[1];
2018-08-25 11:55:16 +02:00
else
targetAbility = gBaseStats[targetSpecies].abilities[0];
2018-08-25 11:55:16 +02:00
var = AI_TypeCalc(moveIds[i * MAX_MON_MOVES + j], targetSpecies, targetAbility);
2018-08-25 11:55:16 +02:00
if (var & MOVE_RESULT_NOT_VERY_EFFECTIVE && var & MOVE_RESULT_SUPER_EFFECTIVE)
moveScores[i * MAX_MON_MOVES + j] += movePower;
2018-08-25 11:55:16 +02:00
else if (var & MOVE_RESULT_NO_EFFECT)
moveScores[i * MAX_MON_MOVES + j] += 0;
2018-08-25 11:55:16 +02:00
else if (var & MOVE_RESULT_SUPER_EFFECTIVE)
moveScores[i * MAX_MON_MOVES + j] += movePower * 2;
2018-08-25 11:55:16 +02:00
else if (var & MOVE_RESULT_NOT_VERY_EFFECTIVE)
moveScores[i * MAX_MON_MOVES + j] += movePower / 2;
2018-08-25 11:55:16 +02:00
else
moveScores[i * MAX_MON_MOVES + j] += movePower;
2018-08-25 11:55:16 +02:00
}
if (bestScore < moveScores[i * MAX_MON_MOVES + j])
2018-08-25 11:55:16 +02:00
{
bestId = i * MAX_MON_MOVES + j;
bestScore = moveScores[i * MAX_MON_MOVES + j];
2018-08-25 11:55:16 +02:00
}
else if (bestScore == moveScores[i * MAX_MON_MOVES + j])
2018-08-25 11:55:16 +02:00
{
if (moveIds[bestId] < moveIds[i * MAX_MON_MOVES + j]) // Why not use (Random() & 1) instead of promoting moves with a higher id?
bestId = i * MAX_MON_MOVES + j;
2018-08-25 11:55:16 +02:00
}
}
}
j = bestId;
goto LABEL;
while (j != 0)
{
for (j = 0, k = 0; k < MAX_MON_MOVES * FRONTIER_PARTY_SIZE; k++)
2018-08-25 11:55:16 +02:00
{
if (bestScore < moveScores[k])
{
j = k;
bestScore = moveScores[k];
}
else if (bestScore == moveScores[k] && moveIds[j] < moveIds[k])
{
j = k;
}
}
if (i == roundId - 1)
break;
LABEL:
{
for (i = 0; i < roundId - 1; i++)
{
if (gSaveBlock2Ptr->frontier.domeWinningMoves[sub_81953E8(winnerTournamentId, i)] == moveIds[j])
2018-08-25 11:55:16 +02:00
break;
}
if (i == roundId - 1)
break;
moveScores[j] = 0;
bestScore = 0;
j = 0;
for (k = 0; k < MAX_MON_MOVES * FRONTIER_PARTY_SIZE; k++)
2018-08-25 11:55:16 +02:00
j += moveScores[k];
}
}
if (moveScores[j] == 0)
j = bestId;
return moveIds[j];
}
2019-02-08 18:08:25 +01:00
static void Task_ShowTourneyTree(u8 taskId)
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter;
2019-02-08 18:08:25 +01:00
int r10 = gTasks[taskId].data[1];
int r4 = gTasks[taskId].data[2];
2018-08-25 11:55:16 +02:00
switch (gTasks[taskId].data[0])
{
case 0:
SetHBlankCallback(NULL);
SetVBlankCallback(NULL);
EnableInterrupts(INTR_FLAG_HBLANK | INTR_FLAG_VBLANK);
CpuFill32(0, (void *)VRAM, VRAM_SIZE);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_0860CE74, ARRAY_COUNT(gUnknown_0860CE74));
InitWindows(gUnknown_0860CE94);
DeactivateAllTextPrinters();
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0xB00, 0);
gTasks[taskId].data[0]++;
break;
case 1:
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
SetGpuReg(REG_OFFSET_MOSAIC, 0);
SetGpuReg(REG_OFFSET_WIN0H, 0x5860);
SetGpuReg(REG_OFFSET_WIN0V, 0x9F);
SetGpuReg(REG_OFFSET_WIN1H, 0x9098);
SetGpuReg(REG_OFFSET_WIN1V, 0x9F);
SetGpuReg(REG_OFFSET_WININ, 0);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR);
2018-08-25 11:55:16 +02:00
ResetPaletteFade();
ResetSpriteData();
FreeAllSpritePalettes();
gTasks[taskId].data[0]++;
break;
case 2:
2018-08-25 19:59:47 +02:00
sTilemapBuffer = AllocZeroed(0x800);
LZDecompressWram(gUnknown_08D83900, sTilemapBuffer);
SetBgTilemapBuffer(1, sTilemapBuffer);
2018-08-25 11:55:16 +02:00
CopyBgTilemapBufferToVram(1);
DecompressAndLoadBgGfxUsingHeap(1, gUnknown_08D82F10, 0x2000, 0, 0);
DecompressAndLoadBgGfxUsingHeap(2, gUnknown_08D834FC, 0x2000, 0, 0);
DecompressAndLoadBgGfxUsingHeap(2, gUnknown_08D83B2C, 0x2000, 0, 1);
DecompressAndLoadBgGfxUsingHeap(3, gUnknown_08D83C3C, 0x2000, 0, 1);
LoadCompressedPalette(gUnknown_08D85358, 0, 0x200);
LoadCompressedPalette(gUnknown_08D85444, 0x100, 0x200);
2019-11-07 01:18:11 +01:00
LoadCompressedPalette(gBattleWindowTextPalette, 0xF0, 0x20);
2018-08-25 11:55:16 +02:00
CpuFill32(0, gPlttBufferFaded, 0x400);
ShowBg(0);
ShowBg(1);
ShowBg(2);
ShowBg(3);
gTasks[taskId].data[0]++;
break;
case 3:
2019-02-08 18:08:25 +01:00
LoadCompressedSpriteSheet(sDomeOptionsSpriteSheet);
2018-08-25 11:55:16 +02:00
if (r10 == 0)
{
for (i = 0; i < (unsigned) 31; i++)
CreateSprite(&gUnknown_0860CFA8, gUnknown_0860D411[i][0], gUnknown_0860D411[i][1], 0);
if (gTasks[taskId].data[4])
CreateSprite(&gUnknown_0860D008, 218, 12, 0);
else
CreateSprite(&gUnknown_0860CFD8, 218, 12, 0);
}
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_1D_MAP);
gTasks[taskId].data[0]++;
break;
case 4:
textPrinter.fontId = 2;
2018-11-06 17:44:48 +01:00
textPrinter.currentChar = gText_BattleTourney;
2018-08-25 11:55:16 +02:00
textPrinter.windowId = 2;
textPrinter.x = 0;
textPrinter.y = 0;
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
2018-11-06 17:44:48 +01:00
textPrinter.currentX = GetStringCenterAlignXOffsetWithLetterSpacing(textPrinter.fontId, textPrinter.currentChar, 0x70, textPrinter.letterSpacing);
2018-08-25 11:55:16 +02:00
textPrinter.currentY = 1;
2018-11-06 18:30:21 +01:00
textPrinter.unk = 0;
2018-08-25 11:55:16 +02:00
textPrinter.fgColor = 14;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
AddTextPrinter(&textPrinter, 0, NULL);
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
2019-02-08 18:08:25 +01:00
int roundId, var2;
2018-08-25 11:55:16 +02:00
CopyDomeTrainerName(gDisplayedStringBattle, DOME_TRAINERS[i].trainerId);
2018-08-25 11:55:16 +02:00
if (r10 == 1)
{
if (DOME_TRAINERS[i].isEliminated)
2018-08-25 11:55:16 +02:00
{
if (DOME_TRAINERS[i].eliminatedAt != 0)
2018-08-25 11:55:16 +02:00
{
var2 = DOME_TRAINERS[i].eliminatedAt - 1;
2018-08-25 11:55:16 +02:00
sub_81948EC(i, var2);
}
}
2018-10-21 00:06:42 +02:00
else if (gSaveBlock2Ptr->frontier.curChallengeBattleNum != DOME_ROUND2)
2018-08-25 11:55:16 +02:00
{
2018-10-21 00:06:42 +02:00
sub_81948EC(i, gSaveBlock2Ptr->frontier.curChallengeBattleNum - 2);
2018-08-25 11:55:16 +02:00
}
}
else if (r10 == 0)
{
if (DOME_TRAINERS[i].isEliminated)
2018-08-25 11:55:16 +02:00
{
if (DOME_TRAINERS[i].eliminatedAt != 0)
2018-08-25 11:55:16 +02:00
{
var2 = DOME_TRAINERS[i].eliminatedAt - 1;
2018-08-25 11:55:16 +02:00
sub_81948EC(i, var2);
}
}
2018-10-21 00:06:42 +02:00
else if (gSaveBlock2Ptr->frontier.curChallengeBattleNum != DOME_ROUND1)
2018-08-25 11:55:16 +02:00
{
if (gTasks[taskId].data[4])
2018-10-21 00:06:42 +02:00
var2 = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
2018-08-25 11:55:16 +02:00
else
2018-10-21 00:06:42 +02:00
var2 = gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1;
2018-08-25 11:55:16 +02:00
sub_81948EC(i, var2);
}
}
if (gTasks[taskId].data[4])
2018-10-21 00:06:42 +02:00
roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
2018-08-25 11:55:16 +02:00
else
2018-10-21 00:06:42 +02:00
roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1;
2018-08-25 11:55:16 +02:00
if ( ((r10 == 1 && DOME_TRAINERS[i].eliminatedAt < gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1)
|| (r10 == 0 && DOME_TRAINERS[i].eliminatedAt <= roundId))
&& DOME_TRAINERS[i].isEliminated)
2018-08-25 11:55:16 +02:00
{
if (DOME_TRAINERS[i].trainerId == TRAINER_PLAYER)
2018-08-25 11:55:16 +02:00
{
textPrinter.fgColor = 3;
textPrinter.shadowColor = 4;
}
else
{
textPrinter.fgColor = 11;
textPrinter.shadowColor = 13;
}
}
else
{
if (DOME_TRAINERS[i].trainerId == TRAINER_PLAYER)
2018-08-25 11:55:16 +02:00
{
textPrinter.fgColor = 3;
textPrinter.shadowColor = 4;
}
else
{
textPrinter.fgColor = 14;
textPrinter.shadowColor = 13;
}
}
if (gUnknown_0860D3F1[i][0] == 0)
textPrinter.currentX = GetStringWidthDifference(textPrinter.fontId, gDisplayedStringBattle, 0x3D, textPrinter.letterSpacing);
else
textPrinter.currentX = 3;
2018-11-06 17:44:48 +01:00
textPrinter.currentChar = gDisplayedStringBattle;
2018-08-25 11:55:16 +02:00
textPrinter.windowId = gUnknown_0860D3F1[i][0];
textPrinter.currentY = gUnknown_0860D3F1[i][1];
AddTextPrinter(&textPrinter, 0, NULL);
}
gTasks[taskId].data[0]++;
break;
case 5:
PutWindowTilemap(0);
PutWindowTilemap(1);
PutWindowTilemap(2);
CopyWindowToVram(0, 3);
CopyWindowToVram(1, 3);
CopyWindowToVram(2, 3);
2018-08-25 19:59:47 +02:00
SetHBlankCallback(HblankCb_BattleDome);
2018-08-25 18:46:15 +02:00
SetVBlankCallback(VblankCb1_BattleDome);
2018-08-25 11:55:16 +02:00
if (r4 == 2)
{
if (r10 == 0)
{
i = CreateTask(sub_819395C, 0);
gTasks[i].data[0] = r10;
gTasks[i].data[1] = r10;
gTasks[i].data[6] = gTasks[taskId].data[4];
}
else
{
i = CreateTask(sub_8194950, 0);
gTasks[i].data[0] = 0;
}
}
else
{
i = gTasks[taskId].data[3];
gTasks[i].data[0] = 0;
}
ScanlineEffect_Clear();
2019-01-05 19:27:23 +01:00
i = 0;
while (i < 91)
{
2019-02-08 18:08:25 +01:00
gScanlineEffectRegBuffers[0][i] = BGCNT_PRIORITY(2) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_CHARBASE(2) | BGCNT_TXT256x256;
gScanlineEffectRegBuffers[1][i] = BGCNT_PRIORITY(2) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_CHARBASE(2) | BGCNT_TXT256x256;
2019-01-05 19:27:23 +01:00
i++;
}
while (i < 160)
{
2019-02-08 18:08:25 +01:00
gScanlineEffectRegBuffers[0][i] = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_CHARBASE(2) | BGCNT_TXT256x256;
gScanlineEffectRegBuffers[1][i] = BGCNT_PRIORITY(1) | BGCNT_SCREENBASE(31) | BGCNT_16COLOR | BGCNT_CHARBASE(2) | BGCNT_TXT256x256;
2019-01-05 19:27:23 +01:00
i++;
}
2019-02-08 18:08:25 +01:00
ScanlineEffect_SetParams(sTourneyTreeScanlineEffectParams);
2018-08-25 11:55:16 +02:00
DestroyTask(taskId);
break;
}
}
2018-08-25 19:59:47 +02:00
static void sub_81948EC(u8 tournamentId, u8 arg1)
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-25 19:59:47 +02:00
const struct UnkStruct_860DD10 *structPtr = gUnknown_0860DD10[tournamentId][arg1];
2018-08-25 11:55:16 +02:00
for (i = 0; i < gUnknown_0860DE10[tournamentId][arg1]; i++)
CopyToBgTilemapBufferRect_ChangePalette(1, &structPtr[i].src, structPtr[i].x, structPtr[i].y, 1, 1, 0x11);
CopyBgTilemapBufferToVram(1);
}
2018-08-25 19:59:47 +02:00
static void sub_8194950(u8 taskId)
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-11-06 17:44:48 +01:00
struct TextPrinterTemplate textPrinter;
2018-08-25 11:55:16 +02:00
switch (gTasks[taskId].data[0])
{
case 0:
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
2018-08-25 11:55:16 +02:00
gTasks[taskId].data[0] = 1;
break;
case 1:
if (!gPaletteFade.active)
{
gTasks[taskId].data[0] = 2;
gTasks[taskId].data[3] = 64;
textPrinter.fontId = 2;
textPrinter.x = 0;
textPrinter.y = 0;
textPrinter.letterSpacing = 2;
textPrinter.lineSpacing = 0;
2018-11-06 18:30:21 +01:00
textPrinter.unk = 0;
2018-08-25 11:55:16 +02:00
textPrinter.fgColor = 11;
textPrinter.bgColor = 0;
textPrinter.shadowColor = 13;
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
CopyDomeTrainerName(gDisplayedStringBattle, DOME_TRAINERS[i].trainerId);
if (DOME_TRAINERS[i].eliminatedAt == gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1
&& DOME_TRAINERS[i].isEliminated)
2018-08-25 11:55:16 +02:00
{
if (gUnknown_0860D3F1[i][0] == 0)
textPrinter.currentX = GetStringWidthDifference(textPrinter.fontId, gDisplayedStringBattle, 0x3D, textPrinter.letterSpacing);
else
textPrinter.currentX = 3;
2018-11-06 17:44:48 +01:00
textPrinter.currentChar = gDisplayedStringBattle;
2018-08-25 11:55:16 +02:00
textPrinter.windowId = gUnknown_0860D3F1[i][0];
textPrinter.currentY = gUnknown_0860D3F1[i][1];
AddTextPrinter(&textPrinter, 0, NULL);
}
if (!DOME_TRAINERS[i].isEliminated)
2018-08-25 11:55:16 +02:00
{
2019-02-08 18:08:25 +01:00
int roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum - 1;
2018-10-21 00:06:42 +02:00
sub_81948EC(i, roundId);
2018-08-25 11:55:16 +02:00
}
}
}
break;
case 2:
if (--gTasks[taskId].data[3] == 0)
gTasks[taskId].data[0] = 3;
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
2018-08-29 20:38:54 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
2018-08-25 11:55:16 +02:00
gTasks[taskId].data[0] = 4;
}
break;
case 4:
if (!gPaletteFade.active)
{
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
DestroyTask(taskId);
}
break;
}
}
static void CB2_BattleDome(void)
{
AnimateSprites();
BuildOamBuffer();
RunTextPrinters();
UpdatePaletteFade();
RunTasks();
}
2018-08-25 18:46:15 +02:00
static void VblankCb0_BattleDome(void)
{
ChangeBgX(3, 0x80, 1);
ChangeBgY(3, 0x80, 2);
SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X);
SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y);
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X);
SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y);
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
#define SET_WIN0H_WIN1H(win0H, win1H) \
{ \
*(vu32*)(REG_ADDR_WIN0H) = ((win0H << 16) | (win1H)); \
}
2018-08-25 19:59:47 +02:00
static void HblankCb_BattleDome(void)
2018-08-25 18:46:15 +02:00
{
register u32 vCount asm("r0") = REG_VCOUNT;
register u32 vCount_ asm("r1") = vCount;
if (vCount > 41)
{
if (vCount < 50)
{
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
2018-08-25 18:46:15 +02:00
return;
}
else if (vCount > 57)
{
if (vCount < 75)
{
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H(WIN_RANGE(144, 152), WIN_RANGE(88, 96));
2018-08-25 18:46:15 +02:00
return;
}
else if (vCount < 82)
{
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
2018-08-25 18:46:15 +02:00
return;
}
else if (vCount > 94)
{
if (vCount < 103)
{
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
2018-08-25 18:46:15 +02:00
return;
}
else if (vCount < 119)
{
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H(WIN_RANGE(144, 152), WIN_RANGE(88, 96));
2018-08-25 18:46:15 +02:00
return;
}
else if (vCount > 126)
{
if (vCount_ < 135)
{
REG_WININ = WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_OBJ | WININ_WIN0_CLR
| WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_OBJ | WININ_WIN1_CLR;
2018-09-08 02:24:33 +02:00
SET_WIN0H_WIN1H(WIN_RANGE(152, 155), WIN_RANGE(85, 88));
2018-08-25 18:46:15 +02:00
return;
}
}
}
}
}
REG_WININ = WININ_WIN0_BG_ALL | WININ_WIN0_CLR | WININ_WIN0_OBJ
| WININ_WIN1_BG_ALL | WININ_WIN1_CLR | WININ_WIN1_OBJ;
2018-08-25 18:46:15 +02:00
SET_WIN0H_WIN1H(0, 0);
}
static void VblankCb1_BattleDome(void)
{
SetGpuReg(REG_OFFSET_BG0HOFS, gBattle_BG0_X);
SetGpuReg(REG_OFFSET_BG0VOFS, gBattle_BG0_Y);
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
ChangeBgY(2, 0x80, 2);
ChangeBgY(3, 0x80, 1);
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
ScanlineEffect_InitHBlankDmaTransfer();
}
2019-02-08 18:08:25 +01:00
static void InitDomeFacilityTrainersAndMons(void)
2018-08-25 18:46:15 +02:00
{
gFacilityTrainerMons = gBattleFrontierMons;
gFacilityTrainers = gBattleFrontierTrainers;
}
static void ResetSketchedMoves(void)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i, moveSlot;
2018-08-25 18:46:15 +02:00
for (i = 0; i < 2; i++)
{
2019-02-08 18:08:25 +01:00
int playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gSelectedOrderFromParty[i] - 1] - 1;
int count;
2018-08-25 18:46:15 +02:00
for (moveSlot = 0; moveSlot < MAX_MON_MOVES; moveSlot++)
2018-08-25 18:46:15 +02:00
{
count = 0;
while (count < MAX_MON_MOVES)
2018-08-25 18:46:15 +02:00
{
if (GetMonData(&gSaveBlock1Ptr->playerParty[playerMonId], MON_DATA_MOVE1 + count, NULL) == GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + moveSlot, NULL))
break;
count++;
}
if (count == MAX_MON_MOVES)
2018-08-25 18:46:15 +02:00
SetMonMoveSlot(&gPlayerParty[i], MOVE_SKETCH, moveSlot);
}
gSaveBlock1Ptr->playerParty[playerMonId] = gPlayerParty[i];
}
}
2019-02-08 18:08:25 +01:00
static void RestoreDomePlayerPartyHeldItems(void)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-25 18:46:15 +02:00
for (i = 0; i < DOME_BATTLE_PARTY_SIZE; i++)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gSelectedOrderFromParty[i] - 1] - 1;
2018-08-25 18:46:15 +02:00
u16 item = GetMonData(&gSaveBlock1Ptr->playerParty[playerMonId], MON_DATA_HELD_ITEM, NULL);
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
}
}
static void ReduceDomePlayerPartyToSelectedMons(void)
2018-08-25 18:46:15 +02:00
{
2018-11-25 22:50:54 +01:00
ReducePlayerPartyToSelectedMons();
2018-08-25 18:46:15 +02:00
}
2019-02-08 18:08:25 +01:00
static void GetPlayerSeededBeforeOpponent(void)
2018-08-25 18:46:15 +02:00
{
if (TrainerIdToTournamentId(gTrainerBattleOpponent_A) > TrainerIdToTournamentId(TRAINER_PLAYER))
gSpecialVar_Result = 1;
else
gSpecialVar_Result = 2;
}
2019-02-08 18:08:25 +01:00
static void BufferLastDomeWinnerName(void)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-25 18:46:15 +02:00
2019-02-08 18:08:25 +01:00
InitDomeFacilityTrainersAndMons();
2018-08-25 18:46:15 +02:00
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (!DOME_TRAINERS[i].isEliminated)
2018-08-25 18:46:15 +02:00
break;
}
CopyDomeTrainerName(gStringVar1, DOME_TRAINERS[i].trainerId);
2018-08-25 18:46:15 +02:00
}
// For showing the previous tourney results before the player has entered a challenge
static void InitRandomTourneyTreeResults(void)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i, j, k;
int monLevel;
int species[FRONTIER_PARTY_SIZE];
2019-02-08 18:08:25 +01:00
int monTypesBits;
int trainerId;
int monSetId;
2018-08-25 18:46:15 +02:00
u8 lvlMode;
u16 *statSums;
2019-02-08 18:08:25 +01:00
int *statValues;
2018-08-25 18:46:15 +02:00
u8 ivs = 0;
species[0] = 0;
species[1] = 0;
species[2] = 0;
if ((gSaveBlock2Ptr->frontier.domeLvlMode != -gSaveBlock2Ptr->frontier.domeBattleMode) && gSaveBlock2Ptr->frontier.challengeStatus != CHALLENGE_STATUS_SAVING)
2018-08-25 18:46:15 +02:00
return;
statSums = AllocZeroed(sizeof(u16) * DOME_TOURNAMENT_TRAINERS_COUNT);
statValues = AllocZeroed(sizeof(int) * NUM_STATS);
2018-08-25 19:59:47 +02:00
lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
gSaveBlock2Ptr->frontier.lvlMode = FRONTIER_LVL_50;
2018-08-25 18:46:15 +02:00
// This one, I'd like to call a 'C fakematching'.
{
u8 one;
gSaveBlock2Ptr->frontier.domeLvlMode = (one = 1);
gSaveBlock2Ptr->frontier.domeBattleMode = one;
2018-08-25 18:46:15 +02:00
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
do
{
if (i < 5)
trainerId = Random() % 10;
else if (i < 15)
trainerId = Random() % 20 + 10;
else
trainerId = Random() % 10 + 30;
for (j = 0; j < i; j++)
{
if (DOME_TRAINERS[j].trainerId == trainerId)
2018-08-25 18:46:15 +02:00
break;
}
} while (j != i);
DOME_TRAINERS[i].trainerId = trainerId;
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
2018-08-25 18:46:15 +02:00
{
// Make sure the mon is valid.
do
{
2018-11-11 16:44:27 +01:00
monSetId = RandomizeFacilityTrainerMonSet(trainerId);
2018-08-25 18:46:15 +02:00
for (k = 0; k < j; k++)
{
int checkingMonId = DOME_MONS[i][k];
2018-11-11 16:44:27 +01:00
if (checkingMonId == monSetId
|| species[0] == gFacilityTrainerMons[monSetId].species
|| species[1] == gFacilityTrainerMons[monSetId].species
|| gFacilityTrainerMons[checkingMonId].itemTableId == gFacilityTrainerMons[monSetId].itemTableId)
2018-08-25 18:46:15 +02:00
break;
}
} while (k != j);
DOME_MONS[i][j] = monSetId;
2018-11-11 16:44:27 +01:00
species[j] = gFacilityTrainerMons[monSetId].species;
2018-08-25 18:46:15 +02:00
}
DOME_TRAINERS[i].isEliminated = FALSE;
DOME_TRAINERS[i].eliminatedAt = 0;
DOME_TRAINERS[i].forfeited = FALSE;
2018-08-25 18:46:15 +02:00
}
monLevel = 50;
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
monTypesBits = 0;
statSums[i] = 0;
ivs = GetDomeTrainerMonIvs(DOME_TRAINERS[i].trainerId);
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
{
CalcDomeMonStats(gFacilityTrainerMons[DOME_MONS[i][j]].species,
monLevel, ivs,
gFacilityTrainerMons[DOME_MONS[i][j]].evSpread,
gFacilityTrainerMons[DOME_MONS[i][j]].nature,
statValues);
statSums[i] += statValues[STAT_ATK];
statSums[i] += statValues[STAT_DEF];
statSums[i] += statValues[STAT_SPATK];
statSums[i] += statValues[STAT_SPDEF];
statSums[i] += statValues[STAT_SPEED];
statSums[i] += statValues[STAT_HP];
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[DOME_MONS[i][j]].species].type1];
monTypesBits |= gBitTable[gBaseStats[gFacilityTrainerMons[DOME_MONS[i][j]].species].type2];
}
// Because GF hates temporary vars, trainerId acts like monTypesCount here.
for (trainerId = 0, j = 0; j < 32; j++)
{
if (monTypesBits & 1)
trainerId++;
monTypesBits >>= 1;
}
statSums[i] += (trainerId * monLevel) / 20;
}
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT - 1; i++)
{
for (j = i + 1; j < DOME_TOURNAMENT_TRAINERS_COUNT; j++)
{
if (statSums[i] < statSums[j])
{
SwapDomeTrainers(i, j, statSums);
}
else if (statSums[i] == statSums[j])
{
if (DOME_TRAINERS[i].trainerId > DOME_TRAINERS[j].trainerId)
2018-08-25 18:46:15 +02:00
SwapDomeTrainers(i, j, statSums);
}
}
}
2018-08-25 18:46:15 +02:00
Free(statSums);
Free(statValues);
2018-08-25 18:46:15 +02:00
for (i = 0; i < DOME_ROUNDS_COUNT; i++)
2018-08-25 18:46:15 +02:00
DecideRoundWinners(i);
2018-08-25 19:59:47 +02:00
gSaveBlock2Ptr->frontier.lvlMode = lvlMode;
2018-08-25 18:46:15 +02:00
}
2019-02-08 18:08:25 +01:00
static int TrainerIdToTournamentId(u16 trainerId)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-25 18:46:15 +02:00
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (DOME_TRAINERS[i].trainerId == trainerId)
2018-08-25 18:46:15 +02:00
break;
}
return i;
}
// The same as the above one, but has global scope.
2019-02-08 18:08:25 +01:00
int TrainerIdToDomeTournamentId(u16 trainerId)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-25 18:46:15 +02:00
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (DOME_TRAINERS[i].trainerId == trainerId)
2018-08-25 18:46:15 +02:00
break;
}
return i;
}
2019-02-08 18:08:25 +01:00
static u8 sub_81953E8(u8 tournamentId, u8 round)
2018-08-25 18:46:15 +02:00
{
u8 arr[2];
2019-02-08 18:08:25 +01:00
sub_8192F08(gUnknown_0860D1A0[gUnknown_0860D1C0[tournamentId] / 2][round] - 16, arr);
2018-08-25 18:46:15 +02:00
if (tournamentId == arr[0])
return arr[1];
else
return arr[0];
}
2018-08-25 19:59:47 +02:00
static void DecideRoundWinners(u8 roundId)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
int moveSlot, monId1, monId2;
int tournamentId1, tournamentId2;
int species;
int points1 = 0, points2 = 0;
2018-08-25 18:46:15 +02:00
for (i = 0; i < DOME_TOURNAMENT_TRAINERS_COUNT; i++)
{
if (DOME_TRAINERS[i].isEliminated || DOME_TRAINERS[i].trainerId == TRAINER_PLAYER)
2018-08-25 18:46:15 +02:00
continue;
tournamentId1 = i;
tournamentId2 = TournamentIdOfOpponent(roundId, DOME_TRAINERS[tournamentId1].trainerId);
2018-08-25 18:46:15 +02:00
// Frontier Brain always wins, check tournamentId1.
if (DOME_TRAINERS[tournamentId1].trainerId == TRAINER_FRONTIER_BRAIN && tournamentId2 != 0xFF)
2018-08-25 18:46:15 +02:00
{
DOME_TRAINERS[tournamentId2].isEliminated = TRUE;
DOME_TRAINERS[tournamentId2].eliminatedAt = roundId;
gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId2] = GetWinningMove(tournamentId1, tournamentId2, roundId);
2018-08-25 18:46:15 +02:00
}
// Frontier Brain always wins, check tournamentId2.
else if (DOME_TRAINERS[tournamentId2].trainerId == TRAINER_FRONTIER_BRAIN && tournamentId1 != 0xFF)
2018-08-25 18:46:15 +02:00
{
DOME_TRAINERS[tournamentId1].isEliminated = TRUE;
DOME_TRAINERS[tournamentId1].eliminatedAt = roundId;
gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId1] = GetWinningMove(tournamentId2, tournamentId1, roundId);
2018-08-25 18:46:15 +02:00
}
// Decide which one of two trainers wins!
else if (tournamentId2 != 0xFF)
2018-08-25 18:46:15 +02:00
{
// BUG: points1 and points2 are not cleared at the beginning of the loop resulting in not fair results.
// Calculate points for both trainers.
for (monId1 = 0; monId1 < FRONTIER_PARTY_SIZE; monId1++)
2018-08-25 18:46:15 +02:00
{
for (moveSlot = 0; moveSlot < MAX_MON_MOVES; moveSlot++)
2018-08-25 18:46:15 +02:00
{
for (monId2 = 0; monId2 < FRONTIER_PARTY_SIZE; monId2++)
2018-08-25 18:46:15 +02:00
{
points1 += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentId1][monId1]].moves[moveSlot],
gFacilityTrainerMons[DOME_MONS[tournamentId2][monId2]].species, 2);
2018-08-25 18:46:15 +02:00
}
}
species = gFacilityTrainerMons[DOME_MONS[tournamentId1][monId1]].species;
2018-08-25 18:46:15 +02:00
points1 += ( gBaseStats[species].baseHP
+ gBaseStats[species].baseAttack
+ gBaseStats[species].baseDefense
+ gBaseStats[species].baseSpeed
+ gBaseStats[species].baseSpAttack
+ gBaseStats[species].baseSpDefense) / 10;
}
// Random part of the formula.
points1 += (Random() & 0x1F);
// Favor trainers with higher id;
points1 += tournamentId1;
for (monId1 = 0; monId1 < FRONTIER_PARTY_SIZE; monId1++)
2018-08-25 18:46:15 +02:00
{
for (moveSlot = 0; moveSlot < MAX_MON_MOVES; moveSlot++)
2018-08-25 18:46:15 +02:00
{
for (monId2 = 0; monId2 < FRONTIER_PARTY_SIZE; monId2++)
2018-08-25 18:46:15 +02:00
{
points2 += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentId2][monId1]].moves[moveSlot],
gFacilityTrainerMons[DOME_MONS[tournamentId1][monId2]].species, 2);
2018-08-25 18:46:15 +02:00
}
}
species = gFacilityTrainerMons[DOME_MONS[tournamentId2][monId1]].species;
2018-08-25 18:46:15 +02:00
points2 += ( gBaseStats[species].baseHP
+ gBaseStats[species].baseAttack
+ gBaseStats[species].baseDefense
+ gBaseStats[species].baseSpeed
+ gBaseStats[species].baseSpAttack
+ gBaseStats[species].baseSpDefense) / 10;
}
// Random part of the formula.
points2 += (Random() & 0x1F);
// Favor trainers with higher id;
points2 += tournamentId2;
if (points1 > points2)
{
DOME_TRAINERS[tournamentId2].isEliminated = TRUE;
DOME_TRAINERS[tournamentId2].eliminatedAt = roundId;
gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId2] = GetWinningMove(tournamentId1, tournamentId2, roundId);
2018-08-25 18:46:15 +02:00
}
else if (points1 < points2)
{
DOME_TRAINERS[tournamentId1].isEliminated = TRUE;
DOME_TRAINERS[tournamentId1].eliminatedAt = roundId;
gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId1] = GetWinningMove(tournamentId2, tournamentId1, roundId);
2018-08-25 18:46:15 +02:00
}
// Points are the same, so we favor the one with the higher id.
else if (tournamentId1 > tournamentId2)
{
DOME_TRAINERS[tournamentId2].isEliminated = TRUE;
DOME_TRAINERS[tournamentId2].eliminatedAt = roundId;
gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId2] = GetWinningMove(tournamentId1, tournamentId2, roundId);
2018-08-25 18:46:15 +02:00
}
else
{
DOME_TRAINERS[tournamentId1].isEliminated = TRUE;
DOME_TRAINERS[tournamentId1].eliminatedAt = roundId;
gSaveBlock2Ptr->frontier.domeWinningMoves[tournamentId1] = GetWinningMove(tournamentId2, tournamentId1, roundId);
2018-08-25 18:46:15 +02:00
}
}
}
}
2019-02-08 18:08:25 +01:00
static void CopyDomeTrainerName(u8 *str, u16 trainerId)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i = 0;
2018-10-27 00:04:18 +02:00
SetFacilityPtrsGetLevel();
2018-08-25 18:46:15 +02:00
if (trainerId == TRAINER_FRONTIER_BRAIN)
{
2019-02-08 18:08:25 +01:00
CopyDomeBrainTrainerName(str);
2018-08-25 18:46:15 +02:00
}
else
{
if (trainerId == TRAINER_PLAYER)
{
2018-09-01 22:03:21 +02:00
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
2019-02-08 18:08:25 +01:00
str[i] = gSaveBlock2Ptr->playerName[i];
2018-08-25 18:46:15 +02:00
}
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
2018-08-25 18:46:15 +02:00
{
2018-10-21 00:06:42 +02:00
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
2019-02-08 18:08:25 +01:00
str[i] = gFacilityTrainers[trainerId].trainerName[i];
2018-08-25 18:46:15 +02:00
}
2019-02-08 18:08:25 +01:00
str[i] = EOS;
2018-08-25 18:46:15 +02:00
}
}
2018-08-25 19:59:47 +02:00
static u8 GetDomeBrainTrainerPicId(void)
2018-08-25 18:46:15 +02:00
{
return gTrainers[TRAINER_TUCKER].trainerPic;
}
2018-08-25 19:59:47 +02:00
static u8 GetDomeBrainTrainerClass(void)
2018-08-25 18:46:15 +02:00
{
return gTrainers[TRAINER_TUCKER].trainerClass;
}
2019-02-08 18:08:25 +01:00
static void CopyDomeBrainTrainerName(u8 *str)
2018-08-25 18:46:15 +02:00
{
2019-02-08 18:08:25 +01:00
int i;
2018-08-25 18:46:15 +02:00
2018-10-21 00:06:42 +02:00
for (i = 0; i < PLAYER_NAME_LENGTH; i++)
2019-02-08 18:08:25 +01:00
str[i] = gTrainers[TRAINER_TUCKER].trainerName[i];
str[i] = EOS;
2018-08-25 18:46:15 +02:00
}