pokeemerald/src/pokemon_summary_screen.c

4175 lines
113 KiB
C
Raw Normal View History

2017-10-09 19:32:57 +02:00
#include "global.h"
2018-08-15 06:56:11 +02:00
#include "main.h"
2017-09-20 21:07:24 +02:00
#include "battle.h"
2018-08-15 06:56:11 +02:00
#include "battle_anim.h"
#include "battle_frontier_2.h"
#include "battle_message.h"
#include "battle_tent.h"
2017-10-09 19:17:13 +02:00
#include "bg.h"
2018-08-15 06:56:11 +02:00
#include "contest.h"
#include "contest_effect.h"
#include "data2.h"
#include "daycare.h"
2017-09-20 21:07:24 +02:00
#include "decompress.h"
2018-08-15 06:56:11 +02:00
#include "dynamic_placeholder_text_util.h"
#include "event_data.h"
#include "gpu_regs.h"
#include "graphics.h"
#include "international_string_util.h"
2017-10-19 01:25:08 +02:00
#include "item.h"
#include "link.h"
2017-09-20 21:07:24 +02:00
#include "m4a.h"
#include "malloc.h"
2018-08-15 06:56:11 +02:00
#include "menu.h"
#include "menu_helpers.h"
#include "mon_markings.h"
#include "party_menu.h"
2017-09-20 21:07:24 +02:00
#include "palette.h"
2018-08-15 06:56:11 +02:00
#include "pokeball.h"
2017-09-20 21:07:24 +02:00
#include "pokemon.h"
2018-08-15 06:56:11 +02:00
#include "pokemon_storage_system.h"
#include "pokemon_summary_screen.h"
2018-08-15 06:56:11 +02:00
#include "region_map.h"
#include "scanline_effect.h"
2017-09-20 21:07:24 +02:00
#include "sound.h"
#include "sprite.h"
#include "string_util.h"
2018-08-15 06:56:11 +02:00
#include "strings.h"
2017-09-20 21:07:24 +02:00
#include "task.h"
2017-10-19 01:25:08 +02:00
#include "text.h"
2018-08-15 06:56:11 +02:00
#include "tv.h"
2017-09-20 21:07:24 +02:00
#include "window.h"
2018-08-15 06:56:11 +02:00
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/region_map_sections.h"
2018-08-15 06:56:11 +02:00
#include "constants/songs.h"
#include "constants/species.h"
2017-10-19 01:25:08 +02:00
2018-08-15 06:56:11 +02:00
static EWRAM_DATA struct UnkSummaryStruct
{
/*0x00*/ union {
2018-08-15 06:56:11 +02:00
struct Pokemon *mons;
struct BoxPokemon *boxMons;
} monList;
/*0x04*/ MainCallback callback;
/*0x08*/ struct Sprite *markingsSprite;
2018-08-15 06:56:11 +02:00
/*0x0C*/ struct Pokemon currentMon;
/*0x70*/ struct PokeSummary
{
u16 species; // 0x0
u16 species2; // 0x2
u8 isEgg; // 0x4
u8 level; // 0x5
u8 ribbonCount; // 0x6
2018-08-15 06:56:11 +02:00
u8 unk7; // 0x7
u8 altAbility; // 0x8
u8 metLocation; // 0x9
u8 metLevel; // 0xA
u8 metGame; // 0xB
u32 pid; // 0xC
u32 exp; // 0x10
u16 moves[4]; // 0x14
u8 pp[4]; // 0x1C
u16 currentHP; // 0x20
u16 maxHP; // 0x22
u16 atk; // 0x24
u16 def; // 0x26
u16 spatk; // 0x28
u16 spdef; // 0x2A
u16 speed; // 0x2C
u16 item; // 0x2E
u16 friendship; // 0x30
u8 OTGender; // 0x32
u8 nature; // 0x33
u8 ppBonuses; // 0x34
u8 sanity; // 0x35
u8 OTName[8]; // 0x36
u8 unk3E[9]; // 0x3E
u32 OTID; // 0x48
} summary;
u16 bgTilemapBuffer1[0x800];
u16 bgTilemapBuffer2[0x800];
u16 bgTilemapBuffer3[0x800];
u16 bgTilemapBuffer4[0x800];
u8 mode;
bool8 isBoxMon;
u8 curMonIndex;
u8 maxMonIndex;
u8 currPageIndex;
u8 minPageIndex;
u8 maxPageIndex;
2018-08-15 06:56:11 +02:00
bool8 unk40C3;
u16 newMove;
u8 firstMoveIndex;
u8 secondMoveIndex;
bool8 unk40C8;
u8 unk40C9;
u8 filler40CA;
u8 windowIds[8];
u8 spriteIds[28];
bool8 unk40EF;
s16 unk40F0;
u8 unk_filler4[6];
} *gUnknown_0203CF1C = NULL;
EWRAM_DATA u8 gUnknown_0203CF20 = 0;
static EWRAM_DATA u8 gUnknown_0203CF21 = 0;
static EWRAM_DATA u8 gFiller_0203CF22[2] = {0};
static EWRAM_DATA u8 sUnusedTaskId = 0;
static EWRAM_DATA u8 gFiller_0203CF25[3] = {0};
2017-09-20 21:07:24 +02:00
2018-08-15 06:56:11 +02:00
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
struct UnkStruct_61CC04
{
const u16 *ptr;
u16 field_4;
u8 field_6;
u8 field_7;
u8 field_8;
u8 field_9;
};
2017-09-20 21:07:24 +02:00
2018-08-15 06:56:11 +02:00
// forward declarations
bool8 sub_81B1250(void);
bool8 sub_81BFB10(void);
2017-09-20 21:07:24 +02:00
void sub_81BFAE4(void);
static void InitBGs(void);
2018-08-15 06:56:11 +02:00
u8 sub_81BFEB0(void);
void CopyMonToSummaryStruct(struct Pokemon* a);
bool8 ExtractMonDataToSummaryStruct(struct Pokemon* a);
2018-08-15 06:56:11 +02:00
void sub_81C0348(void);
2017-09-20 21:07:24 +02:00
void sub_81C0484(u8 taskId);
2018-08-15 06:56:11 +02:00
void sub_81C0510(u8 taskId);
2017-09-20 21:07:24 +02:00
void sub_81C0604(u8 taskId, s8 a);
void sub_81C0704(u8 taskId);
2017-09-21 03:25:48 +02:00
s8 sub_81C08F8(s8 a);
2018-08-15 06:56:11 +02:00
s8 sub_81C09B4(s8 a);
2017-10-03 21:42:28 +02:00
bool8 sub_81C0A50(struct Pokemon* mon);
2018-08-15 06:56:11 +02:00
void sub_81C0A8C(u8 taskId, s8 a);
2017-09-24 02:23:55 +02:00
void sub_81C0B8C(u8 taskId);
void sub_81C0C68(u8 taskId);
2018-08-15 06:56:11 +02:00
void sub_81C0CC4(u8 taskId);
2017-09-24 02:23:55 +02:00
void sub_81C0D44(u8 taskId);
2018-08-15 06:56:11 +02:00
void sub_81C0E24(void);
void sub_81C0E48(u8 taskId);
2017-09-24 02:23:55 +02:00
void sub_81C0F44(u8 taskId);
2018-08-15 06:56:11 +02:00
bool8 sub_81C1040(void);
2017-09-24 02:23:55 +02:00
void sub_81C1070(s16* a, s8 b, u8* c);
void sub_81C11F4(u8 a);
void sub_81C129C(u8 a);
2017-10-03 21:42:28 +02:00
void sub_81C12E4(u8 taskId);
void sub_81C13B0(u8 taskId, bool8 b);
2017-10-03 21:42:28 +02:00
void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b);
void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b);
2018-08-15 06:56:11 +02:00
void sub_81C171C(u8 taskId);
2017-10-09 19:17:13 +02:00
void sub_81C174C(u8 taskId);
2018-08-15 06:56:11 +02:00
bool8 sub_81C18A8(void);
2017-10-09 19:17:13 +02:00
void sub_81C18F4(u8 a);
void sub_81C1940(u8 taskId);
2018-08-15 06:56:11 +02:00
void sub_81C1BA0(void);
void sub_81C1DA4(u16 a, s16 b);
void sub_81C1E20(u8 taskId);
void sub_81C1EFC(u16 a, s16 b, u16 c);
2017-10-09 19:17:13 +02:00
void sub_81C1F80(u8 taskId);
2018-08-15 06:56:11 +02:00
void sub_81C2074(u16 a, s16 b);
void sub_81C20F0(u8 taskId);
void sub_81C2194(u16 *a, u16 b, u8 c);
void sub_81C2228(struct Pokemon* mon);
void sub_81C22CC(struct Pokemon* mon);
void sub_81C240C(u16 a);
void sub_81C2524(void);
void sub_81C2554(void);
void sub_81C25E8(void);
void sub_81C2628(void);
void sub_81C2794(void);
2017-10-19 01:25:08 +02:00
void sub_81C27DC(struct Pokemon *mon, u16 a);
void PrintRentalMonStatsPage(void);
2018-08-15 06:56:11 +02:00
void sub_81C2AFC(u8 a);
void sub_81C2C38(u8 a);
2017-10-19 01:25:08 +02:00
void sub_81C2D68(u8 a);
2018-08-15 06:56:11 +02:00
void sub_81C2D9C(u8 a);
void sub_81C2DE4(u8 a);
void sub_81C2E00(void);
void sub_81C2E40(u8 taskId);
void PrintMonOTName(void);
void PrintMonOTID(void);
void PrintMonAbilityName(void);
void PrintMonAbilityDescription(void);
void BufferMonTrainerMemo(void);
void PrintMonTrainerMemo(void);
void BufferNatureString(void);
void GetMetLevelString(u8 *a);
bool8 DoesMonOTMatchOwner(void);
bool8 MonCameFromGBAGames(void);
bool8 IsInGamePartnerMon(void);
void PrintEggOTName(void);
void PrintEggOTID(void);
void PrintEggState(void);
void PrintEggMemo(void);
2018-08-15 06:56:11 +02:00
void sub_81C3554(u8 taskId);
void PrintHeldItemName(void);
2018-08-15 06:56:11 +02:00
void sub_81C3530(void);
void PrintRibbonCount(void);
void BufferLeftColumnStats(void);
void PrintLeftColumnStats(void);
void BufferRightColumnStats(void);
void PrintRightColumnStats(void);
void PrintExpPointsNextLevel(void);
2018-08-15 06:56:11 +02:00
void sub_81C3984(void);
void sub_81C39F0(u8 taskId);
void PrintMoveNameAndPP(u8 a);
2018-08-15 06:56:11 +02:00
void sub_81C3D08(void);
void sub_81C3D54(u8 taskId);
2017-10-19 01:25:08 +02:00
void sub_81C3E2C(u8 a);
2018-08-15 06:56:11 +02:00
void sub_81C3E9C(u16 a);
void PrintNewMoveDetailsOrCancelText(void);
2018-08-15 06:56:11 +02:00
void sub_81C4064(void);
void sub_81C40A0(u8 a, u8 b);
void sub_81C4154(void);
void sub_81C4190(void);
void sub_81C4204(u8 a, u8 b);
void sub_81C424C(void);
void sub_81C4280(void);
void sub_81C42C8(void);
void sub_81C43A0(void);
void sub_81C4420(void);
void sub_81C4484(void);
void sub_81C44F0(void);
void sub_81C4568(u8 a, u8 b);
u8 sub_81C45F4(struct Pokemon *a, s16 *b);
u8 sub_81C47B4(struct Pokemon *unused);
void sub_81C4844(struct Sprite *);
void sub_81C488C(u8 a);
void DestoryUnusedTask(void);
2018-08-15 06:56:11 +02:00
void sub_81C48F0(void);
void sub_81C4984(struct Pokemon *mon);
void sub_81C49E0(struct Pokemon *mon);
void sub_81C4A08(struct Pokemon *mon);
void sub_81C4A88(void);
void sub_81C4AF8(u8 a);
void sub_81C4BE4(struct Sprite *sprite);
void sub_81C4C60(u8 a);
void sub_81C4C84(u8 a);
void sub_81C4D18(u8 a);
2017-09-20 21:07:24 +02:00
2018-08-12 00:03:19 +02:00
// const rom data
#include "data/text/move_descriptions.h"
2018-08-15 06:56:11 +02:00
#include "data/text/nature_names.h"
static const struct BgTemplate gUnknown_0861CBB4[] =
{
{
.bg = 0,
.charBaseIndex = 0,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0,
},
{
.bg = 1,
.charBaseIndex = 2,
.mapBaseIndex = 27,
.screenSize = 1,
.paletteMode = 0,
.priority = 1,
.baseTile = 0,
},
{
.bg = 2,
.charBaseIndex = 2,
.mapBaseIndex = 25,
.screenSize = 1,
.paletteMode = 0,
.priority = 2,
.baseTile = 0,
},
{
.bg = 3,
.charBaseIndex = 2,
.mapBaseIndex = 29,
.screenSize = 1,
.paletteMode = 0,
.priority = 3,
.baseTile = 0,
},
};
static const u16 gUnknown_0861CBC4[] = INCBIN_U16("graphics/interface/unk_tilemap2.bin");
static const struct UnkStruct_61CC04 gUnknown_0861CBEC =
{
gUnknown_0861CBC4, 1, 10, 2, 0, 18
};
static const struct UnkStruct_61CC04 gUnknown_0861CBF8 =
{
gUnknown_0861CBC4, 1, 10, 2, 0, 50
};
static const struct UnkStruct_61CC04 gUnknown_0861CC04 =
{
gSummaryScreenPowAcc_Tilemap, 0, 10, 7, 0, 45
};
static const struct UnkStruct_61CC04 gUnknown_0861CC10 =
{
gUnknown_08DC3C34, 0, 10, 7, 0, 45
};
static const s8 gUnknown_0861CC1C[] = {0, 2, 3, 1, 4, 5};
static const struct WindowTemplate gUnknown_0861CC24[] =
{
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0001 },
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0017 },
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x002d },
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0043 },
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0059 },
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0069 },
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0079 },
{ 0x00, 0x0b, 0x04, 0x00, 0x02, 0x06, 0x0089 },
{ 0x00, 0x0b, 0x04, 0x12, 0x02, 0x06, 0x0089 },
{ 0x00, 0x0b, 0x06, 0x12, 0x02, 0x06, 0x00ad },
{ 0x00, 0x0a, 0x07, 0x06, 0x06, 0x06, 0x00d1 },
{ 0x00, 0x16, 0x07, 0x05, 0x06, 0x06, 0x00f5 },
{ 0x00, 0x0a, 0x0e, 0x0b, 0x04, 0x06, 0x0113 },
{ 0x00, 0x00, 0x12, 0x06, 0x02, 0x06, 0x013f },
{ 0x00, 0x01, 0x0f, 0x09, 0x04, 0x06, 0x014b },
{ 0x00, 0x01, 0x0f, 0x05, 0x04, 0x06, 0x016f },
{ 0x00, 0x16, 0x04, 0x00, 0x02, 0x06, 0x0183 },
{ 0x00, 0x01, 0x02, 0x04, 0x02, 0x07, 0x0183 },
{ 0x00, 0x01, 0x0c, 0x09, 0x02, 0x06, 0x018b },
{ 0x00, 0x01, 0x0e, 0x09, 0x04, 0x06, 0x019d },
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate gUnknown_0861CCCC[] =
{
{ 0x00, 0x0b, 0x04, 0x0b, 0x02, 0x06, 0x01c1 },
{ 0x00, 0x16, 0x04, 0x07, 0x02, 0x06, 0x01d7 },
{ 0x00, 0x0b, 0x09, 0x12, 0x04, 0x06, 0x01e5 },
{ 0x00, 0x0b, 0x0e, 0x12, 0x06, 0x06, 0x022d },
};
static const struct WindowTemplate gUnknown_0861CCEC[] =
{
{ 0x00, 0x0a, 0x04, 0x0a, 0x02, 0x06, 0x01c1 },
{ 0x00, 0x14, 0x04, 0x0a, 0x02, 0x06, 0x01d5 },
{ 0x00, 0x10, 0x07, 0x06, 0x06, 0x06, 0x01e9 },
{ 0x00, 0x1b, 0x07, 0x03, 0x06, 0x06, 0x020d },
{ 0x00, 0x18, 0x0e, 0x06, 0x04, 0x06, 0x021f },
};
static const struct WindowTemplate gUnknown_0861CD14[] =
{
{ 0x00, 0x0f, 0x04, 0x09, 0x0a, 0x06, 0x01c1 },
{ 0x00, 0x18, 0x04, 0x06, 0x0a, 0x08, 0x021b },
{ 0x00, 0x0a, 0x0f, 0x14, 0x04, 0x06, 0x0257 },
};
static const u8 sTextColors_861CD2C[][3] =
{
{0, 1, 2},
{0, 3, 4},
{0, 5, 6},
{0, 7, 8},
{0, 9, 10},
{0, 11, 12},
{0, 13, 14},
{0, 7, 8},
{13, 15, 14},
{0, 1, 2},
{0, 3, 4},
{0, 5, 6},
{0, 7, 8}
};
static const u8 gUnknown_0861CD53[] = INCBIN_U8("graphics/interface/summary_a_button.4bpp");
static const u8 gUnknown_0861CDD3[] = INCBIN_U8("graphics/interface/summary_b_button.4bpp");
static void (*const gUnknown_0861CE54[])(void) =
{
sub_81C2E00,
sub_81C3530,
sub_81C3984,
sub_81C3D08
};
static void (*const gUnknown_0861CE64[])(u8 taskId) =
{
sub_81C2E40,
sub_81C3554,
sub_81C39F0,
sub_81C3D54
};
static const u8 gUnknown_0861CE74[] = _("{COLOR LIGHT_RED}{SHADOW GREEN}");
static const u8 gUnknown_0861CE7B[] = _("{COLOR WHITE}{SHADOW DARK_GREY}");
static const u8 gUnknown_0861CE82[] = _("{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}\n{SPECIAL_F7 0x03}");
static const u8 gUnknown_0861CE8E[] = _("{SPECIAL_F7 0x00}\n{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}");
static const u8 gUnknown_0861CE97[] = _("{PP}{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}");
static const struct OamData gOamData_861CEA0 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 1,
.x = 0,
.matrixNum = 0,
.size = 2,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd gSpriteAnim_861CEA8[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEB0[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEB8[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEC0[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEC8[] = {
ANIMCMD_FRAME(32, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CED0[] = {
ANIMCMD_FRAME(40, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CED8[] = {
ANIMCMD_FRAME(48, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEE0[] = {
ANIMCMD_FRAME(56, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEE8[] = {
ANIMCMD_FRAME(64, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEF0[] = {
ANIMCMD_FRAME(72, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CEF8[] = {
ANIMCMD_FRAME(80, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF00[] = {
ANIMCMD_FRAME(88, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF08[] = {
ANIMCMD_FRAME(96, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF10[] = {
ANIMCMD_FRAME(104, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF18[] = {
ANIMCMD_FRAME(112, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF20[] = {
ANIMCMD_FRAME(120, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF28[] = {
ANIMCMD_FRAME(128, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF30[] = {
ANIMCMD_FRAME(136, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF38[] = {
ANIMCMD_FRAME(144, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF40[] = {
ANIMCMD_FRAME(152, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF48[] = {
ANIMCMD_FRAME(160, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF50[] = {
ANIMCMD_FRAME(168, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861CF58[] = {
ANIMCMD_FRAME(176, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd *const gSpriteAnimTable_861CF60[] = {
gSpriteAnim_861CEA8,
gSpriteAnim_861CEB0,
gSpriteAnim_861CEB8,
gSpriteAnim_861CEC0,
gSpriteAnim_861CEC8,
gSpriteAnim_861CED0,
gSpriteAnim_861CED8,
gSpriteAnim_861CEE0,
gSpriteAnim_861CEE8,
gSpriteAnim_861CEF0,
gSpriteAnim_861CEF8,
gSpriteAnim_861CF00,
gSpriteAnim_861CF08,
gSpriteAnim_861CF10,
gSpriteAnim_861CF18,
gSpriteAnim_861CF20,
gSpriteAnim_861CF28,
gSpriteAnim_861CF30,
gSpriteAnim_861CF38,
gSpriteAnim_861CF40,
gSpriteAnim_861CF48,
gSpriteAnim_861CF50,
gSpriteAnim_861CF58,
};
static const struct CompressedSpriteSheet gUnknown_0861CFBC =
{
.data = gMoveTypes_Gfx,
.size = 0x1700,
.tag = 30002
};
static const struct SpriteTemplate gUnknown_0861CFC4 =
{
.tileTag = 30002,
.paletteTag = 30002,
.oam = &gOamData_861CEA0,
.anims = gSpriteAnimTable_861CF60,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const u8 gUnknown_0861CFDC[] = {13, 13, 14, 14, 13, 13, 15, 14, 13, 15, 13, 14, 15, 13, 14, 14, 15, 13, 13, 14, 14, 15, 13};
static const struct OamData gOamData_861CFF4 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd gSpriteAnim_861CFFC[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D004[] = {
ANIMCMD_FRAME(4, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D00C[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D014[] = {
ANIMCMD_FRAME(12, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D01C[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D024[] = {
ANIMCMD_FRAME(16, 0, TRUE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D02C[] = {
ANIMCMD_FRAME(20, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D034[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D03C[] = {
ANIMCMD_FRAME(24, 0, TRUE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D044[] = {
ANIMCMD_FRAME(28, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd *const gSpriteAnimTable_861D04C[] = {
gSpriteAnim_861CFFC,
gSpriteAnim_861D004,
gSpriteAnim_861D00C,
gSpriteAnim_861D014,
gSpriteAnim_861D01C,
gSpriteAnim_861D024,
gSpriteAnim_861D02C,
gSpriteAnim_861D034,
gSpriteAnim_861D03C,
gSpriteAnim_861D044,
};
static const struct CompressedSpriteSheet gUnknown_0861D074 =
{
.data = gUnknown_08D97BEC,
.size = 0x400,
.tag = 30000
};
static const struct CompressedSpritePalette gUnknown_0861D07C =
{
.data = gUnknown_08D97CF4,
.tag = 30000
};
static const struct SpriteTemplate gUnknown_0861D084 =
{
.tileTag = 30000,
.paletteTag = 30000,
.oam = &gOamData_861CFF4,
.anims = gSpriteAnimTable_861D04C,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
const struct OamData gOamData_861D09C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 1,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 3,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd gSpriteAnim_861D0A4[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D0AC[] = {
ANIMCMD_FRAME(4, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D0B4[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D0BC[] = {
ANIMCMD_FRAME(12, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D0C4[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D0CC[] = {
ANIMCMD_FRAME(20, 0, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd gSpriteAnim_861D0D4[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END
};
const union AnimCmd *const gSpriteAnimTable_861D0DC[] = {
gSpriteAnim_861D0A4,
gSpriteAnim_861D0AC,
gSpriteAnim_861D0B4,
gSpriteAnim_861D0BC,
gSpriteAnim_861D0C4,
gSpriteAnim_861D0CC,
gSpriteAnim_861D0D4,
};
static const struct CompressedSpriteSheet gUnknown_0861D0F8 =
{
.data = gStatusGfx_Icons,
.size = 0x380,
.tag = 30001
};
static const struct CompressedSpritePalette gUnknown_0861D100 =
{
.data = gStatusPal_Icons,
.tag = 30001
};
static const struct SpriteTemplate gUnknown_0861D108 =
{
.tileTag = 30001,
.paletteTag = 30001,
.oam = &gOamData_861D09C,
.anims = gSpriteAnimTable_861D0DC,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const u16 gUnknown_0861D120[] = INCBIN_U16("graphics/interface/summary_markings.gbapal");
2018-08-12 00:03:19 +02:00
// code
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void))
2018-08-15 06:56:11 +02:00
{
gUnknown_0203CF1C = AllocZeroed(sizeof(*gUnknown_0203CF1C));
gUnknown_0203CF1C->mode = mode;
gUnknown_0203CF1C->monList.mons = mons;
gUnknown_0203CF1C->curMonIndex = monIndex;
gUnknown_0203CF1C->maxMonIndex = maxMonIndex;
gUnknown_0203CF1C->callback = callback;
if (mode == PSS_MODE_UNK2)
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->isBoxMon = TRUE;
2017-09-20 21:07:24 +02:00
else
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->isBoxMon = FALSE;
switch (mode)
2017-09-20 21:07:24 +02:00
{
case PSS_MODE_NORMAL:
case PSS_MODE_UNK2:
gUnknown_0203CF1C->minPageIndex = 0;
gUnknown_0203CF1C->maxPageIndex = 3;
2017-10-03 21:42:28 +02:00
break;
case PSS_MODE_UNK1:
gUnknown_0203CF1C->minPageIndex = 0;
gUnknown_0203CF1C->maxPageIndex = 3;
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->unk40C8 = TRUE;
2017-10-03 21:42:28 +02:00
break;
case PSS_MODE_SELECT_MOVE:
gUnknown_0203CF1C->minPageIndex = 2;
gUnknown_0203CF1C->maxPageIndex = 3;
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->unk40C3 = TRUE;
2017-10-03 21:42:28 +02:00
break;
2017-09-20 21:07:24 +02:00
}
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->currPageIndex = gUnknown_0203CF1C->minPageIndex;
2018-08-15 06:56:11 +02:00
sub_81C488C(-1);
2017-10-09 19:32:57 +02:00
if (gMonSpritesGfxPtr == 0)
2017-09-20 21:07:24 +02:00
sub_806F2AC(0, 0);
2018-08-15 06:56:11 +02:00
2017-09-20 21:07:24 +02:00
SetMainCallback2(sub_81BFAE4);
}
2018-08-15 06:56:11 +02:00
void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove)
2017-09-20 21:07:24 +02:00
{
ShowPokemonSummaryScreen(PSS_MODE_SELECT_MOVE, mons, monIndex, maxMonIndex, callback);
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->newMove = newMove;
2017-09-20 21:07:24 +02:00
}
void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void))
2017-09-20 21:07:24 +02:00
{
ShowPokemonSummaryScreen(mode, mons, monIndex, maxMonIndex, callback);
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->unk40EF = TRUE;
2017-09-20 21:07:24 +02:00
}
void sub_81BFAB4(void)
{
RunTasks();
AnimateSprites();
BuildOamBuffer();
do_scheduled_bg_tilemap_copies_to_vram();
UpdatePaletteFade();
}
void sub_81BFAD0(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
2018-08-15 06:56:11 +02:00
void sub_81BFAE4(void)
2017-09-20 21:07:24 +02:00
{
2018-08-15 06:56:11 +02:00
while (sub_81221EC() != TRUE && sub_81BFB10() != TRUE && sub_81221AC() != TRUE);
2017-09-20 21:07:24 +02:00
}
2017-10-03 21:42:28 +02:00
bool8 sub_81BFB10(void)
2017-09-20 21:07:24 +02:00
{
2017-10-03 21:42:28 +02:00
switch (gMain.state)
{
case 0:
SetVBlankHBlankCallbacksToNull();
2017-12-09 21:23:40 +01:00
ResetVramOamAndBgCntRegs();
2017-10-03 21:42:28 +02:00
clear_scheduled_bg_copies_to_vram();
gMain.state++;
break;
case 1:
2018-01-16 18:59:06 +01:00
ScanlineEffect_Stop();
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 2:
ResetPaletteFade();
gPaletteFade.bufferTransferDisabled = 1;
gMain.state++;
break;
case 3:
ResetSpriteData();
gMain.state++;
break;
case 4:
FreeAllSpritePalettes();
gMain.state++;
break;
case 5:
InitBGs();
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0 = 0;
gMain.state++;
break;
case 6:
2018-08-15 06:56:11 +02:00
if (sub_81BFEB0() != FALSE)
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 7:
sub_81C2554();
gMain.state++;
break;
case 8:
sub_81C1BA0();
gMain.state++;
break;
case 9:
CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon);
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0 = 0;
gMain.state++;
break;
case 10:
if (ExtractMonDataToSummaryStruct(&gUnknown_0203CF1C->currentMon) != 0)
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 11:
sub_81C25E8();
gMain.state++;
break;
case 12:
PrintRentalMonStatsPage();
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 13:
sub_81C2D9C(gUnknown_0203CF1C->currPageIndex);
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 14:
sub_81C0348();
gMain.state++;
break;
case 15:
sub_81C2AFC(gUnknown_0203CF1C->currPageIndex);
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 16:
sub_81C4190();
sub_81C42C8();
gUnknown_0203CF1C->unk40F0 = 0;
gMain.state++;
break;
case 17:
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->spriteIds[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0);
if (gUnknown_0203CF1C->spriteIds[0] != 0xFF)
2017-09-20 21:07:24 +02:00
{
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0 = 0;
gMain.state++;
2017-09-20 21:07:24 +02:00
}
2017-10-03 21:42:28 +02:00
break;
case 18:
2017-10-20 22:28:38 +02:00
sub_81C4984(&gUnknown_0203CF1C->currentMon);
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 19:
2017-10-20 22:28:38 +02:00
sub_81C4A08(&gUnknown_0203CF1C->currentMon);
2017-10-03 21:42:28 +02:00
gMain.state++;
break;
case 20:
sub_81C4A88();
gMain.state++;
break;
case 21:
sub_81C4280();
gMain.state++;
break;
case 22:
if (gUnknown_0203CF1C->mode != PSS_MODE_SELECT_MOVE)
2017-10-03 21:42:28 +02:00
CreateTask(sub_81C0510, 0);
else
CreateTask(sub_81C171C, 0);
gMain.state++;
break;
case 23:
BlendPalettes(-1, 16, 0);
gMain.state++;
break;
case 24:
2018-07-15 13:23:38 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
2017-10-03 21:42:28 +02:00
gPaletteFade.bufferTransferDisabled = 0;
gMain.state++;
break;
default:
SetVBlankCallback(sub_81BFAD0);
SetMainCallback2(sub_81BFAB4);
return TRUE;
}
return FALSE;
2017-09-20 21:07:24 +02:00
}
static void InitBGs(void)
2017-09-20 21:07:24 +02:00
{
ResetBgsAndClearDma3BusyFlags(0);
2018-08-15 06:56:11 +02:00
InitBgsFromTemplates(0, gUnknown_0861CBB4, ARRAY_COUNT(gUnknown_0861CBB4));
SetBgTilemapBuffer(1, &gUnknown_0203CF1C->bgTilemapBuffer3);
SetBgTilemapBuffer(2, &gUnknown_0203CF1C->bgTilemapBuffer2);
SetBgTilemapBuffer(3, &gUnknown_0203CF1C->bgTilemapBuffer1);
2017-12-09 21:23:40 +01:00
ResetAllBgsCoordinates();
2017-09-20 21:07:24 +02:00
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
schedule_bg_copy_tilemap_to_vram(3);
2017-10-20 22:18:29 +02:00
SetGpuReg(REG_OFFSET_DISPCNT, 0x1040);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
2017-09-20 21:07:24 +02:00
ShowBg(0);
ShowBg(1);
ShowBg(2);
ShowBg(3);
}
2018-08-15 06:56:11 +02:00
bool8 sub_81BFEB0(void)
2017-09-20 21:07:24 +02:00
{
switch (gUnknown_0203CF1C->unk40F0)
{
2017-10-03 21:42:28 +02:00
case 0:
reset_temp_tile_data_buffers();
decompress_and_copy_tile_data_to_vram(1, &gUnknown_08D97D0C, 0, 0, 0);
gUnknown_0203CF1C->unk40F0++;
break;
case 1:
if (free_temp_tile_data_buffers_if_possible() != 1)
{
2018-08-15 06:56:11 +02:00
LZDecompressWram(&gUnknown_08D9862C, &gUnknown_0203CF1C->bgTilemapBuffer1[0]);
2017-09-20 21:07:24 +02:00
gUnknown_0203CF1C->unk40F0++;
2017-10-03 21:42:28 +02:00
}
break;
case 2:
2018-08-15 06:56:11 +02:00
LZDecompressWram(&gUnknown_08D98CC8, &gUnknown_0203CF1C->bgTilemapBuffer1[0x400]);
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0++;
break;
case 3:
2018-08-15 06:56:11 +02:00
LZDecompressWram(&gUnknown_08D987FC, &gUnknown_0203CF1C->bgTilemapBuffer2[0x400]);
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0++;
break;
case 4:
2018-08-15 06:56:11 +02:00
LZDecompressWram(&gUnknown_08D9898C, &gUnknown_0203CF1C->bgTilemapBuffer3[0x400]);
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0++;
break;
case 5:
2018-08-15 06:56:11 +02:00
LZDecompressWram(&gUnknown_08D98B28, &gUnknown_0203CF1C->bgTilemapBuffer4[0x400]);
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0++;
break;
case 6:
LoadCompressedPalette(&gUnknown_08D9853C, 0, 0x100);
LoadPalette(&gUnknown_08D85620, 0x81, 0x1E);
gUnknown_0203CF1C->unk40F0++;
break;
case 7:
LoadCompressedObjectPic(&gUnknown_0861CFBC);
gUnknown_0203CF1C->unk40F0++;
break;
case 8:
LoadCompressedObjectPic(&gUnknown_0861D074);
gUnknown_0203CF1C->unk40F0++;
break;
case 9:
LoadCompressedObjectPic(&gUnknown_0861D0F8);
gUnknown_0203CF1C->unk40F0++;
break;
case 10:
LoadCompressedObjectPalette(&gUnknown_0861D100);
gUnknown_0203CF1C->unk40F0++;
break;
case 11:
LoadCompressedObjectPalette(&gUnknown_0861D07C);
gUnknown_0203CF1C->unk40F0++;
break;
case 12:
2017-12-26 07:39:01 +01:00
LoadCompressedPalette(&gMoveTypes_Pal, 0x1D0, 0x60);
2017-10-03 21:42:28 +02:00
gUnknown_0203CF1C->unk40F0 = 0;
2018-08-15 06:56:11 +02:00
return TRUE;
2017-09-20 21:07:24 +02:00
}
2018-08-15 06:56:11 +02:00
return FALSE;
2017-09-20 21:07:24 +02:00
}
void CopyMonToSummaryStruct(struct Pokemon *mon)
2017-09-20 21:07:24 +02:00
{
2018-08-15 06:56:11 +02:00
if (!gUnknown_0203CF1C->isBoxMon)
2017-09-20 21:07:24 +02:00
{
2018-08-15 06:56:11 +02:00
struct Pokemon *partyMon = gUnknown_0203CF1C->monList.mons;
*mon = partyMon[gUnknown_0203CF1C->curMonIndex];
2017-09-20 21:07:24 +02:00
}
else
2017-09-22 21:17:59 +02:00
{
2018-08-15 06:56:11 +02:00
struct BoxPokemon *boxMon = gUnknown_0203CF1C->monList.boxMons;
BoxMonToMon(&boxMon[gUnknown_0203CF1C->curMonIndex], mon);
2017-09-22 21:17:59 +02:00
}
2017-09-20 21:07:24 +02:00
}
bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a)
2017-09-20 21:07:24 +02:00
{
u32 i;
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
2017-09-20 21:07:24 +02:00
switch (gUnknown_0203CF1C->unk40F0)
{
2017-10-03 21:42:28 +02:00
case 0:
sum->species = GetMonData(a, MON_DATA_SPECIES);
sum->species2 = GetMonData(a, MON_DATA_SPECIES2);
sum->exp = GetMonData(a, MON_DATA_EXP);
sum->level = GetMonData(a, MON_DATA_LEVEL);
2017-10-20 22:18:29 +02:00
sum->altAbility = GetMonData(a, MON_DATA_ALT_ABILITY);
2017-10-03 21:42:28 +02:00
sum->item = GetMonData(a, MON_DATA_HELD_ITEM);
sum->pid = GetMonData(a, MON_DATA_PERSONALITY);
sum->sanity = GetMonData(a, MON_DATA_SANITY_BIT1);
if (sum->sanity)
sum->isEgg = TRUE;
2017-10-03 21:42:28 +02:00
else
sum->isEgg = GetMonData(a, MON_DATA_IS_EGG);
2017-10-03 21:42:28 +02:00
break;
case 1:
for (i = 0; i < 4; i++)
{
sum->moves[i] = GetMonData(a, MON_DATA_MOVE1+i);
sum->pp[i] = GetMonData(a, MON_DATA_PP1+i);
}
sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES);
break;
case 2:
if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE)
2017-10-03 21:42:28 +02:00
{
sum->nature = GetNature(a);
sum->currentHP = GetMonData(a, MON_DATA_HP);
sum->maxHP = GetMonData(a, MON_DATA_MAX_HP);
sum->atk = GetMonData(a, MON_DATA_ATK);
sum->def = GetMonData(a, MON_DATA_DEF);
sum->spatk = GetMonData(a, MON_DATA_SPATK);
sum->spdef = GetMonData(a, MON_DATA_SPDEF);
sum->speed = GetMonData(a, MON_DATA_SPEED);
2017-10-03 21:42:28 +02:00
}
else
{
sum->nature = GetNature(a);
sum->currentHP = GetMonData(a, MON_DATA_HP);
sum->maxHP = GetMonData(a, MON_DATA_MAX_HP);
sum->atk = GetMonData(a, MON_DATA_ATK2);
sum->def = GetMonData(a, MON_DATA_DEF2);
sum->spatk = GetMonData(a, MON_DATA_SPATK2);
sum->spdef = GetMonData(a, MON_DATA_SPDEF2);
sum->speed = GetMonData(a, MON_DATA_SPEED2);
2017-10-03 21:42:28 +02:00
}
break;
case 3:
GetMonData(a, MON_DATA_OT_NAME, &sum->OTName);
ConvertInternationalString((u8*)&sum->OTName, GetMonData(a, MON_DATA_LANGUAGE));
sum->unk7 = sub_81B205C(a);
sum->OTGender = GetMonData(a, MON_DATA_OT_GENDER);
sum->OTID = GetMonData(a, MON_DATA_OT_ID);
sum->metLocation = GetMonData(a, MON_DATA_MET_LOCATION);
sum->metLevel = GetMonData(a, MON_DATA_MET_LEVEL);
sum->metGame = GetMonData(a, MON_DATA_MET_GAME);
sum->friendship = GetMonData(a, MON_DATA_FRIENDSHIP);
break;
default:
sum->ribbonCount = GetMonData(a, MON_DATA_RIBBON_COUNT);
2017-10-03 21:42:28 +02:00
return TRUE;
2017-09-20 21:07:24 +02:00
}
gUnknown_0203CF1C->unk40F0++;
2017-10-03 21:42:28 +02:00
return FALSE;
2017-09-20 21:07:24 +02:00
}
2017-10-03 21:42:28 +02:00
void sub_81C0348(void)
2017-09-20 21:07:24 +02:00
{
if (gUnknown_0203CF1C->currPageIndex != 2 && gUnknown_0203CF1C->currPageIndex != 3)
2017-09-20 21:07:24 +02:00
{
sub_81C1DA4(0, 255);
sub_81C1EFC(0, 255, 0);
}
else
{
2018-08-15 06:56:11 +02:00
sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]);
sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 0);
sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 0);
SetBgTilemapBuffer(1, &gUnknown_0203CF1C->bgTilemapBuffer4);
SetBgTilemapBuffer(2, &gUnknown_0203CF1C->bgTilemapBuffer3);
2017-09-20 21:07:24 +02:00
ChangeBgX(2, 0x10000, 1);
2018-08-15 06:56:11 +02:00
ClearWindowTilemap(19);
ClearWindowTilemap(13);
2017-09-20 21:07:24 +02:00
}
if (gUnknown_0203CF1C->summary.unk7 == 0)
2017-10-03 21:42:28 +02:00
{
2017-09-20 21:07:24 +02:00
sub_81C2074(0, 0xFF);
2017-10-03 21:42:28 +02:00
}
2017-09-20 21:07:24 +02:00
else
{
if (gUnknown_0203CF1C->currPageIndex != 2 && gUnknown_0203CF1C->currPageIndex != 3)
2018-08-15 06:56:11 +02:00
PutWindowTilemap(13);
2017-09-20 21:07:24 +02:00
}
sub_81C2524();
2017-10-20 22:28:38 +02:00
sub_81C2228(&gUnknown_0203CF1C->currentMon);
2017-09-20 21:07:24 +02:00
}
2018-08-15 06:56:11 +02:00
void sub_81C0434(void)
2017-09-20 21:07:24 +02:00
{
FreeAllWindowBuffers();
Free(gUnknown_0203CF1C);
}
void sub_81C044C(u8 taskId)
{
2018-07-15 13:23:38 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0);
2017-09-20 21:07:24 +02:00
gTasks[taskId].func = sub_81C0484;
}
void sub_81C0484(u8 taskId)
{
2017-10-03 21:42:28 +02:00
if (sub_81221EC() != 1 && !gPaletteFade.active)
2017-09-20 21:07:24 +02:00
{
2018-08-15 06:56:11 +02:00
SetMainCallback2(gUnknown_0203CF1C->callback);
gUnknown_0203CF20 = gUnknown_0203CF1C->curMonIndex;
DestoryUnusedTask();
2017-09-20 21:07:24 +02:00
ResetSpriteData();
FreeAllSpritePalettes();
StopCryAndClearCrySongs();
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 0x100);
2017-10-09 19:32:57 +02:00
if (gMonSpritesGfxPtr == 0)
2017-09-20 21:07:24 +02:00
sub_806F47C(0);
sub_81C0434();
DestroyTask(taskId);
}
}
void sub_81C0510(u8 taskId)
{
2017-10-03 21:42:28 +02:00
if (sub_81221EC() != 1 && !gPaletteFade.active)
2017-09-20 21:07:24 +02:00
{
if (gMain.newKeys & DPAD_UP)
2017-10-03 21:42:28 +02:00
{
2017-09-20 21:07:24 +02:00
sub_81C0604(taskId, -1);
2017-10-03 21:42:28 +02:00
}
2017-09-20 21:07:24 +02:00
else if (gMain.newKeys & DPAD_DOWN)
{
sub_81C0604(taskId, 1);
}
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysState() == 1)
2017-10-03 21:42:28 +02:00
{
2017-09-20 21:07:24 +02:00
sub_81C0A8C(taskId, -1);
2017-10-03 21:42:28 +02:00
}
2017-09-20 21:07:24 +02:00
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysState() == 2)
2017-10-03 21:42:28 +02:00
{
2017-09-20 21:07:24 +02:00
sub_81C0A8C(taskId, 1);
2017-10-03 21:42:28 +02:00
}
2017-09-20 21:07:24 +02:00
else if (gMain.newKeys & A_BUTTON)
{
if (gUnknown_0203CF1C->currPageIndex != 1)
2017-09-20 21:07:24 +02:00
{
if (gUnknown_0203CF1C->currPageIndex == 0)
2017-09-20 21:07:24 +02:00
{
sub_81C48F0();
2017-10-03 21:42:28 +02:00
PlaySE(SE_SELECT);
2017-09-20 21:07:24 +02:00
sub_81C044C(taskId);
}
else
{
2017-10-03 21:42:28 +02:00
PlaySE(SE_SELECT);
2017-09-20 21:07:24 +02:00
sub_81C0E48(taskId);
}
}
}
else if (gMain.newKeys & B_BUTTON)
{
sub_81C48F0();
2017-10-03 21:42:28 +02:00
PlaySE(SE_SELECT);
2017-09-20 21:07:24 +02:00
sub_81C044C(taskId);
}
}
}
2017-09-21 03:25:48 +02:00
void sub_81C0604(u8 taskId, s8 a)
2017-09-20 21:07:24 +02:00
{
s8 r4_2;
2017-09-22 21:17:59 +02:00
2018-08-15 06:56:11 +02:00
if (!gUnknown_0203CF1C->unk40C3)
2017-09-20 21:07:24 +02:00
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->isBoxMon == TRUE)
2017-09-20 21:07:24 +02:00
{
if (gUnknown_0203CF1C->currPageIndex != 0)
2017-09-20 21:07:24 +02:00
{
2017-09-22 21:17:59 +02:00
if (a == 1)
a = 0;
else
a = 2;
2017-09-20 21:07:24 +02:00
}
else
2017-09-22 21:17:59 +02:00
{
if (a == 1)
a = 1;
else
a = 3;
}
2018-08-15 06:56:11 +02:00
r4_2 = sub_80D214C(gUnknown_0203CF1C->monList.boxMons, gUnknown_0203CF1C->curMonIndex, gUnknown_0203CF1C->maxMonIndex, a);
2017-09-20 21:07:24 +02:00
}
else if (sub_81B1250() == 1)
{
r4_2 = sub_81C09B4(a);
}
else
2017-09-22 21:17:59 +02:00
{
2017-09-20 21:07:24 +02:00
r4_2 = sub_81C08F8(a);
2017-09-22 21:17:59 +02:00
}
2017-09-20 21:07:24 +02:00
if (r4_2 != -1)
{
2017-09-22 21:17:59 +02:00
PlaySE(SE_SELECT);
2017-09-20 21:07:24 +02:00
if (gUnknown_0203CF1C->summary.unk7 != 0)
{
sub_81C4204(2, 1);
ClearWindowTilemap(13);
2017-09-20 21:07:24 +02:00
schedule_bg_copy_tilemap_to_vram(0);
sub_81C2074(0, 2);
}
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->curMonIndex = r4_2;
2017-09-20 21:07:24 +02:00
gTasks[taskId].data[0] = 0;
gTasks[taskId].func = sub_81C0704;
}
}
2017-09-21 03:25:48 +02:00
}
2017-09-22 21:17:59 +02:00
void sub_81C0704(u8 taskId)
2017-09-21 03:25:48 +02:00
{
s16 *data = gTasks[taskId].data;
2017-09-23 00:28:18 +02:00
2017-09-21 03:25:48 +02:00
switch (data[0])
{
2017-09-23 00:28:18 +02:00
case 0:
StopCryAndClearCrySongs();
break;
case 1:
DestoryUnusedTask();
2018-08-15 06:56:11 +02:00
DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[0]]);
2017-09-23 00:28:18 +02:00
break;
case 2:
2018-08-15 06:56:11 +02:00
DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[1]]);
2017-09-23 00:28:18 +02:00
break;
case 3:
CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon);
2017-09-23 00:28:18 +02:00
gUnknown_0203CF1C->unk40F0 = 0;
break;
case 4:
if (ExtractMonDataToSummaryStruct(&gUnknown_0203CF1C->currentMon) == FALSE)
2017-09-23 00:28:18 +02:00
return;
break;
case 5:
2017-10-20 22:28:38 +02:00
sub_81C49E0(&gUnknown_0203CF1C->currentMon);
2017-09-23 00:28:18 +02:00
break;
case 6:
2017-10-20 22:28:38 +02:00
sub_81C4A08(&gUnknown_0203CF1C->currentMon);
2017-09-23 00:28:18 +02:00
break;
case 7:
if (gUnknown_0203CF1C->summary.unk7)
sub_81C2074(10, -2);
2017-10-20 22:28:38 +02:00
sub_81C2228(&gUnknown_0203CF1C->currentMon);
2017-09-23 00:28:18 +02:00
data[1] = 0;
break;
case 8:
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->spriteIds[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]);
if (gUnknown_0203CF1C->spriteIds[0] == 0xFF)
2017-09-23 00:28:18 +02:00
return;
2018-08-15 06:56:11 +02:00
gSprites[gUnknown_0203CF1C->spriteIds[0]].data[2] = 1;
2017-09-23 00:28:18 +02:00
sub_81C0E24();
data[1] = 0;
break;
case 9:
sub_81C4280();
break;
case 10:
sub_81C25E8();
break;
case 11:
sub_81C2D9C(gUnknown_0203CF1C->currPageIndex);
2017-09-23 00:28:18 +02:00
sub_81C2524();
break;
case 12:
2018-08-15 06:56:11 +02:00
gSprites[gUnknown_0203CF1C->spriteIds[0]].data[2] = 0;
2017-09-23 00:28:18 +02:00
break;
default:
if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0)
{
data[0] = 0;
gTasks[taskId].func = sub_81C0510;
}
return;
2017-09-21 03:25:48 +02:00
}
2017-09-23 00:28:18 +02:00
data[0]++;
2017-09-22 21:17:59 +02:00
}
s8 sub_81C08F8(s8 a)
{
2018-08-15 06:56:11 +02:00
struct Pokemon *mon = gUnknown_0203CF1C->monList.mons;
2017-09-24 02:23:55 +02:00
if (gUnknown_0203CF1C->currPageIndex == 0)
2017-09-22 21:17:59 +02:00
{
2018-08-15 06:56:11 +02:00
if (a == -1 && gUnknown_0203CF1C->curMonIndex == 0)
2017-09-24 02:23:55 +02:00
return -1;
2018-08-15 06:56:11 +02:00
if (a == 1 && gUnknown_0203CF1C->curMonIndex >= gUnknown_0203CF1C->maxMonIndex)
2017-09-24 02:23:55 +02:00
return -1;
2018-08-15 06:56:11 +02:00
return gUnknown_0203CF1C->curMonIndex + a;
2017-09-22 21:17:59 +02:00
}
else
{
2018-08-15 06:56:11 +02:00
s8 index = gUnknown_0203CF1C->curMonIndex;
2017-09-24 02:23:55 +02:00
do
2017-09-22 21:17:59 +02:00
{
2017-09-24 02:23:55 +02:00
index += a;
2018-08-15 06:56:11 +02:00
if (index < 0 || index > gUnknown_0203CF1C->maxMonIndex)
2017-09-22 21:17:59 +02:00
return -1;
2017-10-20 22:18:29 +02:00
} while (GetMonData(&mon[index], MON_DATA_IS_EGG) != 0);
2017-09-24 02:23:55 +02:00
return index;
2017-09-22 21:17:59 +02:00
}
}
s8 sub_81C09B4(s8 a)
{
2018-08-15 06:56:11 +02:00
struct Pokemon *mon = gUnknown_0203CF1C->monList.mons;
2017-09-22 21:17:59 +02:00
s8 r5 = 0;
2017-09-24 02:23:55 +02:00
u8 i;
for (i = 0; i < 6; i++)
2017-09-22 21:17:59 +02:00
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->curMonIndex)
2017-09-22 21:17:59 +02:00
{
2017-09-24 02:23:55 +02:00
r5 = i;
break;
2017-09-22 21:17:59 +02:00
}
}
2017-09-24 02:23:55 +02:00
2018-08-15 06:56:11 +02:00
while (TRUE)
2017-09-22 21:17:59 +02:00
{
int b;
2018-08-15 06:56:11 +02:00
const s8* c = gUnknown_0861CC1C;
2017-09-24 02:23:55 +02:00
2017-09-22 21:17:59 +02:00
r5 += a;
2017-09-24 02:23:55 +02:00
if (r5 < 0 || r5 >= 6)
2017-09-22 21:17:59 +02:00
return -1;
2017-09-24 02:23:55 +02:00
b = c[r5];
2017-10-20 22:18:29 +02:00
if (sub_81C0A50(&mon[b]) == TRUE)
2017-09-24 02:23:55 +02:00
return b;
2017-09-22 21:17:59 +02:00
}
}
2017-10-03 21:42:28 +02:00
bool8 sub_81C0A50(struct Pokemon* mon)
2017-09-22 21:17:59 +02:00
{
if (GetMonData(mon, MON_DATA_SPECIES) == 0)
2017-10-03 21:42:28 +02:00
return FALSE;
2018-08-15 06:56:11 +02:00
else if (gUnknown_0203CF1C->curMonIndex != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0)
2017-10-03 21:42:28 +02:00
return TRUE;
2017-09-22 21:17:59 +02:00
else
2017-10-03 21:42:28 +02:00
return FALSE;
2017-09-24 02:23:55 +02:00
}
void sub_81C0A8C(u8 taskId, s8 b)
{
2017-10-20 22:18:29 +02:00
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
2017-09-24 02:23:55 +02:00
s16 *data = gTasks[taskId].data;
if (summary->isEgg)
return;
else if (b == -1 && gUnknown_0203CF1C->currPageIndex == gUnknown_0203CF1C->minPageIndex)
2017-09-24 02:23:55 +02:00
return;
else if (b == 1 && gUnknown_0203CF1C->currPageIndex == gUnknown_0203CF1C->maxPageIndex)
2017-09-24 02:23:55 +02:00
return;
2018-08-15 06:56:11 +02:00
2017-09-24 02:23:55 +02:00
PlaySE(SE_SELECT);
sub_81C2C38(gUnknown_0203CF1C->currPageIndex);
gUnknown_0203CF1C->currPageIndex += b;
2017-09-24 02:23:55 +02:00
data[0] = 0;
if (b == 1)
SetTaskFuncWithFollowupFunc(taskId, sub_81C0B8C, gTasks[taskId].func);
else
SetTaskFuncWithFollowupFunc(taskId, sub_81C0CC4, gTasks[taskId].func);
sub_81C2DE4(gUnknown_0203CF1C->currPageIndex);
2017-09-24 02:23:55 +02:00
sub_81C424C();
}
void sub_81C0B8C(u8 taskId)
{
s16 *data = gTasks[taskId].data;
if (data[0] == 0)
{
if (gUnknown_0203CF1C->unk40C9 == 0)
{
data[1] = 1;
SetBgAttribute(1, 7, 1);
SetBgAttribute(2, 7, 2);
schedule_bg_copy_tilemap_to_vram(1);
}
else
{
data[1] = 2;
SetBgAttribute(2, 7, 1);
SetBgAttribute(1, 7, 2);
schedule_bg_copy_tilemap_to_vram(2);
}
ChangeBgX(data[1], 0, 0);
SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->currPageIndex << 12) + 0xBC));
2017-09-24 02:23:55 +02:00
ShowBg(1);
ShowBg(2);
}
ChangeBgX(data[1], 0x2000, 1);
data[0] += 32;
if (data[0] > 0xFF)
gTasks[taskId].func = sub_81C0C68;
}
void sub_81C0C68(u8 taskId)
{
s16 *data = gTasks[taskId].data;
gUnknown_0203CF1C->unk40C9 ^= 1;
data[1] = 0;
data[0] = 0;
sub_81C1BA0();
sub_81C2AFC(gUnknown_0203CF1C->currPageIndex);
2017-09-24 02:23:55 +02:00
sub_81C4280();
sub_81C0E24();
SwitchTaskToFollowupFunc(taskId);
}
void sub_81C0CC4(u8 taskId)
{
s16 *data = gTasks[taskId].data;
if (data[0] == 0)
{
if (gUnknown_0203CF1C->unk40C9 == 0)
data[1] = 2;
else
data[1] = 1;
ChangeBgX(data[1], 0x10000, 0);
}
ChangeBgX(data[1], 0x2000, 2);
data[0] += 32;
if (data[0] > 0xFF)
gTasks[taskId].func = sub_81C0D44;
}
void sub_81C0D44(u8 taskId)
{
s16 *data = gTasks[taskId].data;
if (gUnknown_0203CF1C->unk40C9 == 0)
{
SetBgAttribute(1, 7, 1);
SetBgAttribute(2, 7, 2);
schedule_bg_copy_tilemap_to_vram(2);
}
else
{
SetBgAttribute(2, 7, 1);
SetBgAttribute(1, 7, 2);
schedule_bg_copy_tilemap_to_vram(1);
}
if (gUnknown_0203CF1C->currPageIndex > 1)
2017-09-24 02:23:55 +02:00
{
SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->currPageIndex << 12) + 0xFFFFF0BC));
2017-09-24 02:23:55 +02:00
ChangeBgX(data[1], 0x10000, 0);
}
ShowBg(1);
ShowBg(2);
gUnknown_0203CF1C->unk40C9 ^= 1;
data[1] = 0;
data[0] = 0;
sub_81C1BA0();
sub_81C2AFC(gUnknown_0203CF1C->currPageIndex);
2017-09-24 02:23:55 +02:00
sub_81C4280();
sub_81C0E24();
SwitchTaskToFollowupFunc(taskId);
}
2018-08-15 06:56:11 +02:00
void sub_81C0E24(void)
2017-09-24 02:23:55 +02:00
{
if (gUnknown_0203CF1C->currPageIndex == 1)
2017-10-20 22:28:38 +02:00
sub_81C22CC(&gUnknown_0203CF1C->currentMon);
2017-09-24 02:23:55 +02:00
}
void sub_81C0E48(u8 taskId)
{
u16 move;
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->firstMoveIndex = 0;
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex];
2017-09-24 02:23:55 +02:00
ClearWindowTilemap(0x13);
2018-08-15 06:56:11 +02:00
if (gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible == 0)
2017-09-24 02:23:55 +02:00
ClearWindowTilemap(0xD);
sub_81C1DA4(9, -3);
sub_81C1EFC(9, -3, move);
2018-08-15 06:56:11 +02:00
if (!gUnknown_0203CF1C->unk40C8)
2017-09-24 02:23:55 +02:00
{
ClearWindowTilemap(5);
PutWindowTilemap(6);
}
2018-08-15 06:56:11 +02:00
sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 0);
sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 0);
2017-09-24 02:23:55 +02:00
sub_81C3E9C(move);
PrintNewMoveDetailsOrCancelText();
2017-09-24 02:23:55 +02:00
sub_81C44F0();
schedule_bg_copy_tilemap_to_vram(0);
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
sub_81C4AF8(8);
gTasks[taskId].func = sub_81C0F44;
}
void sub_81C0F44(u8 taskId)
{
u8 id = taskId;
s16 *data = gTasks[taskId].data;
2017-10-03 21:42:28 +02:00
2017-09-24 02:23:55 +02:00
if (sub_81221EC() != 1)
{
if (gMain.newKeys & DPAD_UP)
{
data[0] = 4;
2018-08-15 06:56:11 +02:00
sub_81C1070(data, -1, &gUnknown_0203CF1C->firstMoveIndex);
2017-09-24 02:23:55 +02:00
}
else if (gMain.newKeys & DPAD_DOWN)
{
data[0] = 4;
2018-08-15 06:56:11 +02:00
sub_81C1070(data, 1, &gUnknown_0203CF1C->firstMoveIndex);
2017-09-24 02:23:55 +02:00
}
else if (gMain.newKeys & A_BUTTON)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->unk40C8 == TRUE
|| (gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES))
2017-09-24 02:23:55 +02:00
{
PlaySE(SE_SELECT);
sub_81C11F4(taskId);
}
2017-10-03 21:42:28 +02:00
else if (sub_81C1040() == TRUE)
2017-09-24 02:23:55 +02:00
{
PlaySE(SE_SELECT);
sub_81C129C(taskId);
}
else
2017-10-03 21:42:28 +02:00
{
PlaySE(SE_HAZURE);
}
2017-09-24 02:23:55 +02:00
}
else if (gMain.newKeys & B_BUTTON)
{
PlaySE(SE_SELECT);
sub_81C11F4(id);
}
}
}
2017-10-03 21:42:28 +02:00
bool8 sub_81C1040(void)
2017-09-24 02:23:55 +02:00
{
u8 i;
2017-10-03 21:42:28 +02:00
for (i = 1; i < 4; i++)
2017-09-24 02:23:55 +02:00
{
if (gUnknown_0203CF1C->summary.moves[i] != 0)
2017-10-03 21:42:28 +02:00
return TRUE;
2017-09-24 02:23:55 +02:00
}
2017-10-03 21:42:28 +02:00
return FALSE;
2017-09-24 02:23:55 +02:00
}
2017-10-03 21:42:28 +02:00
void sub_81C1070(s16 *a, s8 b, u8 *c)
2017-09-24 02:23:55 +02:00
{
s8 i;
2017-10-03 21:42:28 +02:00
s8 moveIndex;
u16 move;
2017-09-24 02:23:55 +02:00
PlaySE(SE_SELECT);
2017-10-03 21:42:28 +02:00
moveIndex = *c;
for (i = 0; i < 4; i++)
2017-09-24 02:23:55 +02:00
{
2017-10-03 21:42:28 +02:00
moveIndex += b;
if (moveIndex > a[0])
moveIndex = 0;
else if (moveIndex < 0)
moveIndex = a[0];
if (moveIndex == 4)
{
2018-08-15 06:56:11 +02:00
move = gUnknown_0203CF1C->newMove;
2017-09-24 02:23:55 +02:00
break;
2017-10-03 21:42:28 +02:00
}
move = gUnknown_0203CF1C->summary.moves[moveIndex];
if (move != 0)
break;
}
sub_81C240C(move);
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
sub_81C3E9C(move);
2018-08-15 06:56:11 +02:00
if ((*c == 4 && gUnknown_0203CF1C->newMove == MOVE_NONE) || a[1] == 1)
2017-10-03 21:42:28 +02:00
{
ClearWindowTilemap(19);
2018-08-15 06:56:11 +02:00
if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible)
2017-10-03 21:42:28 +02:00
ClearWindowTilemap(13);
schedule_bg_copy_tilemap_to_vram(0);
sub_81C1DA4(9, -3);
sub_81C1EFC(9, -3, move);
}
2018-08-15 06:56:11 +02:00
if (*c != 4 && moveIndex == 4 && gUnknown_0203CF1C->newMove == MOVE_NONE)
2017-10-03 21:42:28 +02:00
{
ClearWindowTilemap(14);
ClearWindowTilemap(15);
schedule_bg_copy_tilemap_to_vram(0);
sub_81C1DA4(0, 3);
sub_81C1EFC(0, 3, 0);
}
*c = moveIndex;
2018-08-15 06:56:11 +02:00
if (c == &gUnknown_0203CF1C->firstMoveIndex)
2017-10-03 21:42:28 +02:00
sub_81C4D18(8);
else
sub_81C4D18(18);
}
void sub_81C11F4(u8 taskId)
{
sub_81C4C60(8);
ClearWindowTilemap(6);
PutWindowTilemap(5);
sub_81C3E9C(0);
2018-08-15 06:56:11 +02:00
sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 1);
sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 1);
2017-10-03 21:42:28 +02:00
sub_81C4064();
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES)
2017-10-03 21:42:28 +02:00
{
ClearWindowTilemap(14);
ClearWindowTilemap(15);
sub_81C1DA4(0, 3);
sub_81C1EFC(0, 3, 0);
2017-09-24 02:23:55 +02:00
}
2017-10-03 21:42:28 +02:00
schedule_bg_copy_tilemap_to_vram(0);
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_81C0510;
}
void sub_81C129C(u8 taskId)
{
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->secondMoveIndex = gUnknown_0203CF1C->firstMoveIndex;
2017-10-03 21:42:28 +02:00
sub_81C4C84(1);
sub_81C4AF8(18);
gTasks[taskId].func = sub_81C12E4;
}
void sub_81C12E4(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (sub_81221EC() != TRUE)
2017-10-03 21:42:28 +02:00
{
if (gMain.newKeys & DPAD_UP)
{
data[0] = 3;
2018-08-15 06:56:11 +02:00
sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->secondMoveIndex);
2017-10-03 21:42:28 +02:00
}
else if (gMain.newKeys & DPAD_DOWN)
{
data[0] = 3;
2018-08-15 06:56:11 +02:00
sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->secondMoveIndex);
2017-10-03 21:42:28 +02:00
}
else if (gMain.newKeys & A_BUTTON)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->firstMoveIndex == gUnknown_0203CF1C->secondMoveIndex)
2017-10-03 21:42:28 +02:00
{
sub_81C13B0(taskId, 0);
}
else
{
2017-10-03 21:42:28 +02:00
sub_81C13B0(taskId, 1);
}
2017-10-03 21:42:28 +02:00
}
else if (gMain.newKeys & B_BUTTON)
{
sub_81C13B0(taskId, 0);
}
2017-10-03 21:42:28 +02:00
}
}
void sub_81C13B0(u8 taskId, bool8 b)
2017-10-03 21:42:28 +02:00
{
u16 move;
2017-10-03 21:42:28 +02:00
PlaySE(SE_SELECT);
sub_81C4C84(0);
sub_81C4C60(18);
if (b == TRUE)
2017-10-03 21:42:28 +02:00
{
2018-08-15 06:56:11 +02:00
if (!gUnknown_0203CF1C->isBoxMon)
2017-10-03 21:42:28 +02:00
{
2018-08-15 06:56:11 +02:00
struct Pokemon *why = gUnknown_0203CF1C->monList.mons;
sub_81C14BC(&why[gUnknown_0203CF1C->curMonIndex], gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex);
2017-10-03 21:42:28 +02:00
}
else
{
2018-08-15 06:56:11 +02:00
struct BoxPokemon *why = gUnknown_0203CF1C->monList.boxMons;
sub_81C15EC(&why[gUnknown_0203CF1C->curMonIndex], gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex);
2017-10-03 21:42:28 +02:00
}
CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon);
2018-08-15 06:56:11 +02:00
sub_81C40A0(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex);
sub_81C4568(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex);
gUnknown_0203CF1C->firstMoveIndex = gUnknown_0203CF1C->secondMoveIndex;
2017-10-03 21:42:28 +02:00
}
2018-08-15 06:56:11 +02:00
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex];
2017-10-03 21:42:28 +02:00
sub_81C3E9C(move);
sub_81C240C(move);
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_81C0F44;
}
2017-10-09 19:17:13 +02:00
#ifdef NONMATCHING
void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
2017-10-03 21:42:28 +02:00
{
2017-10-04 19:27:50 +02:00
u16 localMoveTo;
u16 localMoveFrom;
u8 localPpTo;
u8 localPpFrom;
u8 localPpBonuses;
u16* moveFromPtr;
2017-10-09 19:17:13 +02:00
u16* moveToPtr;
2017-10-04 19:27:50 +02:00
u8* ppFromPtr;
u8* ppToPtr;
u8* ppBonusesPtr;
2017-10-09 19:17:13 +02:00
2017-10-04 19:27:50 +02:00
moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId];
localMoveFrom = *moveFromPtr;
moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId];
localMoveTo = *moveToPtr;
ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId];
localPpFrom = *ppFromPtr;
2017-10-09 19:17:13 +02:00
2017-10-04 19:27:50 +02:00
ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId];
localPpTo = *ppToPtr;
ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses;
localPpBonuses = *ppBonusesPtr;
2017-10-09 19:17:13 +02:00
{
u8 bitsFrom, bitsTo;
bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1);
bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1);
2017-10-04 19:27:50 +02:00
2017-10-09 19:17:13 +02:00
localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]);
localPpBonuses &= ~(gUnknown_08329D22[swappingToId]);
localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1)));
}
SetMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo);
SetMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom);
SetMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo);
SetMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom);
2017-10-04 19:27:50 +02:00
SetMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses);
*moveFromPtr = localMoveTo;
*moveToPtr = localMoveFrom;
*ppFromPtr = localPpTo;
*ppToPtr = localPpFrom;
*ppBonusesPtr = localPpBonuses;
2017-10-09 19:17:13 +02:00
}
#else
NAKED
2017-10-09 19:17:13 +02:00
void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
{
asm(".syntax 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, 0x28\n\
adds r7, r0, 0\n\
adds r4, r1, 0\n\
adds r6, r2, 0\n\
lsls r4, 24\n\
lsrs r4, 24\n\
lsls r6, 24\n\
lsrs r6, 24\n\
ldr r0, =gUnknown_0203CF1C\n\
ldr r2, [r0]\n\
lsls r0, r4, 1\n\
mov r10, r0\n\
adds r1, r2, 0\n\
adds r1, 0x84\n\
adds r0, r1, r0\n\
str r0, [sp, 0x8]\n\
ldrh r0, [r0]\n\
mov r3, sp\n\
adds r3, 0x2\n\
str r3, [sp, 0x1C]\n\
strh r0, [r3]\n\
lsls r0, r6, 1\n\
mov r9, r0\n\
add r1, r9\n\
str r1, [sp, 0xC]\n\
ldrh r1, [r1]\n\
mov r0, sp\n\
strh r1, [r0]\n\
adds r1, r2, 0\n\
adds r1, 0x8C\n\
adds r3, r1, r4\n\
str r3, [sp, 0x10]\n\
ldrb r0, [r3]\n\
mov r3, sp\n\
adds r3, 0x5\n\
str r3, [sp, 0x24]\n\
strb r0, [r3]\n\
adds r1, r6\n\
str r1, [sp, 0x14]\n\
ldrb r0, [r1]\n\
mov r1, sp\n\
adds r1, 0x4\n\
str r1, [sp, 0x20]\n\
strb r0, [r1]\n\
adds r2, 0xA4\n\
str r2, [sp, 0x18]\n\
ldrb r0, [r2]\n\
mov r5, sp\n\
adds r5, 0x6\n\
strb r0, [r5]\n\
ldr r1, =gUnknown_08329D22\n\
adds r0, r4, r1\n\
ldrb r0, [r0]\n\
mov r8, r0\n\
ldrb r0, [r5]\n\
adds r2, r0, 0\n\
mov r3, r8\n\
ands r2, r3\n\
mov r3, r10\n\
asrs r2, r3\n\
lsls r2, 24\n\
lsrs r2, 24\n\
adds r1, r6, r1\n\
ldrb r1, [r1]\n\
mov r12, r1\n\
adds r1, r0, 0\n\
mov r3, r12\n\
ands r1, r3\n\
mov r3, r9\n\
asrs r1, r3\n\
lsls r1, 24\n\
lsrs r1, 24\n\
mov r3, r8\n\
bics r0, r3\n\
strb r0, [r5]\n\
ldrb r0, [r5]\n\
mov r3, r12\n\
bics r0, r3\n\
strb r0, [r5]\n\
mov r0, r9\n\
lsls r2, r0\n\
mov r3, r10\n\
lsls r1, r3\n\
adds r2, r1\n\
ldrb r0, [r5]\n\
orrs r0, r2\n\
strb r0, [r5]\n\
adds r1, r4, 0\n\
adds r1, 0xD\n\
adds r0, r7, 0\n\
mov r2, sp\n\
bl SetMonData\n\
adds r1, r6, 0\n\
adds r1, 0xD\n\
adds r0, r7, 0\n\
ldr r2, [sp, 0x1C]\n\
bl SetMonData\n\
adds r4, 0x11\n\
adds r0, r7, 0\n\
adds r1, r4, 0\n\
ldr r2, [sp, 0x20]\n\
bl SetMonData\n\
adds r6, 0x11\n\
adds r0, r7, 0\n\
adds r1, r6, 0\n\
ldr r2, [sp, 0x24]\n\
bl SetMonData\n\
adds r0, r7, 0\n\
movs r1, 0x15\n\
adds r2, r5, 0\n\
bl SetMonData\n\
mov r0, sp\n\
ldrh r0, [r0]\n\
ldr r1, [sp, 0x8]\n\
strh r0, [r1]\n\
ldr r3, [sp, 0x1C]\n\
ldrh r0, [r3]\n\
ldr r1, [sp, 0xC]\n\
strh r0, [r1]\n\
ldr r3, [sp, 0x20]\n\
ldrb r0, [r3]\n\
ldr r1, [sp, 0x10]\n\
strb r0, [r1]\n\
ldr r3, [sp, 0x24]\n\
ldrb r0, [r3]\n\
ldr r1, [sp, 0x14]\n\
strb r0, [r1]\n\
ldrb r0, [r5]\n\
ldr r3, [sp, 0x18]\n\
strb r0, [r3]\n\
add sp, 0x28\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided\n");
}
#endif
#ifdef NONMATCHING
void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
{
u16 localMoveTo;
u16 localMoveFrom;
u8 localPpTo;
u8 localPpFrom;
u8 localPpBonuses;
u16* moveFromPtr;
u16* moveToPtr;
u8* ppFromPtr;
u8* ppToPtr;
u8* ppBonusesPtr;
moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId];
localMoveFrom = *moveFromPtr;
moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId];
localMoveTo = *moveToPtr;
ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId];
localPpFrom = *ppFromPtr;
ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId];
localPpTo = *ppToPtr;
ppBonusesPtr = &gUnknown_0203CF1C->summary.ppBonuses;
localPpBonuses = *ppBonusesPtr;
{
u8 bitsFrom, bitsTo;
bitsFrom = (localPpBonuses & gUnknown_08329D22[swappingFromId]) >> (swappingFromId << 1);
bitsTo = (localPpBonuses & gUnknown_08329D22[swappingToId]) >> (swappingToId << 1);
localPpBonuses &= ~(gUnknown_08329D22[swappingFromId]);
localPpBonuses &= ~(gUnknown_08329D22[swappingToId]);
localPpBonuses |= ((bitsFrom << (swappingToId << 1)) + (bitsTo << (swappingToId << 1)));
}
SetBoxMonData(mon, swappingFromId + MON_DATA_MOVE1, &localMoveTo);
SetBoxMonData(mon, swappingToId + MON_DATA_MOVE1, &localMoveFrom);
SetBoxMonData(mon, swappingFromId + MON_DATA_PP1, &localPpTo);
SetBoxMonData(mon, swappingToId + MON_DATA_PP1, &localPpFrom);
SetBoxMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses);
*moveFromPtr = localMoveTo;
*moveToPtr = localMoveFrom;
*ppFromPtr = localPpTo;
*ppToPtr = localPpFrom;
*ppBonusesPtr = localPpBonuses;
}
#else
NAKED
2017-10-09 19:17:13 +02:00
void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
{
asm(".syntax 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, 0x28\n\
adds r7, r0, 0\n\
adds r4, r1, 0\n\
adds r6, r2, 0\n\
lsls r4, 24\n\
lsrs r4, 24\n\
lsls r6, 24\n\
lsrs r6, 24\n\
ldr r0, =gUnknown_0203CF1C\n\
ldr r2, [r0]\n\
lsls r0, r4, 1\n\
mov r10, r0\n\
adds r1, r2, 0\n\
adds r1, 0x84\n\
adds r0, r1, r0\n\
str r0, [sp, 0x8]\n\
ldrh r0, [r0]\n\
mov r3, sp\n\
adds r3, 0x2\n\
str r3, [sp, 0x1C]\n\
strh r0, [r3]\n\
lsls r0, r6, 1\n\
mov r9, r0\n\
add r1, r9\n\
str r1, [sp, 0xC]\n\
ldrh r1, [r1]\n\
mov r0, sp\n\
strh r1, [r0]\n\
adds r1, r2, 0\n\
adds r1, 0x8C\n\
adds r3, r1, r4\n\
str r3, [sp, 0x10]\n\
ldrb r0, [r3]\n\
mov r3, sp\n\
adds r3, 0x5\n\
str r3, [sp, 0x24]\n\
strb r0, [r3]\n\
adds r1, r6\n\
str r1, [sp, 0x14]\n\
ldrb r0, [r1]\n\
mov r1, sp\n\
adds r1, 0x4\n\
str r1, [sp, 0x20]\n\
strb r0, [r1]\n\
adds r2, 0xA4\n\
str r2, [sp, 0x18]\n\
ldrb r0, [r2]\n\
mov r5, sp\n\
adds r5, 0x6\n\
strb r0, [r5]\n\
ldr r1, =gUnknown_08329D22\n\
adds r0, r4, r1\n\
ldrb r0, [r0]\n\
mov r8, r0\n\
ldrb r0, [r5]\n\
adds r2, r0, 0\n\
mov r3, r8\n\
ands r2, r3\n\
mov r3, r10\n\
asrs r2, r3\n\
lsls r2, 24\n\
lsrs r2, 24\n\
adds r1, r6, r1\n\
ldrb r1, [r1]\n\
mov r12, r1\n\
adds r1, r0, 0\n\
mov r3, r12\n\
ands r1, r3\n\
mov r3, r9\n\
asrs r1, r3\n\
lsls r1, 24\n\
lsrs r1, 24\n\
mov r3, r8\n\
bics r0, r3\n\
strb r0, [r5]\n\
ldrb r0, [r5]\n\
mov r3, r12\n\
bics r0, r3\n\
strb r0, [r5]\n\
mov r0, r9\n\
lsls r2, r0\n\
mov r3, r10\n\
lsls r1, r3\n\
adds r2, r1\n\
ldrb r0, [r5]\n\
orrs r0, r2\n\
strb r0, [r5]\n\
adds r1, r4, 0\n\
adds r1, 0xD\n\
adds r0, r7, 0\n\
mov r2, sp\n\
bl SetBoxMonData\n\
adds r1, r6, 0\n\
adds r1, 0xD\n\
adds r0, r7, 0\n\
ldr r2, [sp, 0x1C]\n\
bl SetBoxMonData\n\
adds r4, 0x11\n\
adds r0, r7, 0\n\
adds r1, r4, 0\n\
ldr r2, [sp, 0x20]\n\
bl SetBoxMonData\n\
adds r6, 0x11\n\
adds r0, r7, 0\n\
adds r1, r6, 0\n\
ldr r2, [sp, 0x24]\n\
bl SetBoxMonData\n\
adds r0, r7, 0\n\
movs r1, 0x15\n\
adds r2, r5, 0\n\
bl SetBoxMonData\n\
mov r0, sp\n\
ldrh r0, [r0]\n\
ldr r1, [sp, 0x8]\n\
strh r0, [r1]\n\
ldr r3, [sp, 0x1C]\n\
ldrh r0, [r3]\n\
ldr r1, [sp, 0xC]\n\
strh r0, [r1]\n\
ldr r3, [sp, 0x20]\n\
ldrb r0, [r3]\n\
ldr r1, [sp, 0x10]\n\
strb r0, [r1]\n\
ldr r3, [sp, 0x24]\n\
ldrb r0, [r3]\n\
ldr r1, [sp, 0x14]\n\
strb r0, [r1]\n\
ldrb r0, [r5]\n\
ldr r3, [sp, 0x18]\n\
strb r0, [r3]\n\
add sp, 0x28\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided\n");
}
#endif
void sub_81C171C(u8 taskId)
{
sub_81C44F0();
sub_81C4AF8(8);
gTasks[taskId].func = sub_81C174C;
}
void sub_81C174C(u8 taskId)
{
s16* data = gTasks[taskId].data;
2017-11-14 20:23:25 +01:00
2017-10-09 19:17:13 +02:00
if (sub_81221EC() != 1)
{
if (gPaletteFade.active != 1)
{
if (gMain.newKeys & DPAD_UP)
{
data[0] = 4;
2018-08-15 06:56:11 +02:00
sub_81C1070(data, -1, &gUnknown_0203CF1C->firstMoveIndex);
2017-10-09 19:17:13 +02:00
}
else if (gMain.newKeys & DPAD_DOWN)
{
data[0] = 4;
2018-08-15 06:56:11 +02:00
sub_81C1070(data, 1, &gUnknown_0203CF1C->firstMoveIndex);
2017-10-09 19:17:13 +02:00
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
{
sub_81C0A8C(taskId, -1);
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
{
sub_81C0A8C(taskId, 1);
}
else if (gMain.newKeys & A_BUTTON)
{
2017-10-22 21:12:48 +02:00
if (sub_81C18A8() == TRUE)
2017-10-09 19:17:13 +02:00
{
sub_81C48F0();
PlaySE(SE_SELECT);
2018-08-15 06:56:11 +02:00
gUnknown_0203CF21 = gUnknown_0203CF1C->firstMoveIndex;
2017-10-09 19:17:13 +02:00
gSpecialVar_0x8005 = gUnknown_0203CF21;
sub_81C044C(taskId);
}
else
{
2018-05-11 07:33:32 +02:00
PlaySE(SE_HAZURE);
2017-10-09 19:17:13 +02:00
sub_81C18F4(taskId);
}
}
else if (gMain.newKeys & B_BUTTON)
{
u32 var1;
sub_81C48F0();
PlaySE(SE_SELECT);
gUnknown_0203CF21 = 4;
gSpecialVar_0x8005 = 4;
sub_81C044C(taskId);
2017-11-14 20:23:25 +01:00
}
2017-10-09 19:17:13 +02:00
}
}
}
2018-08-15 06:56:11 +02:00
bool8 sub_81C18A8(void)
2017-10-09 19:17:13 +02:00
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES || gUnknown_0203CF1C->newMove == MOVE_NONE || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]) != 1)
2017-10-22 21:01:34 +02:00
return TRUE;
2017-10-09 19:17:13 +02:00
else
2017-10-22 21:01:34 +02:00
return FALSE;
2017-10-09 19:17:13 +02:00
}
void sub_81C18F4(u8 taskId)
{
ClearWindowTilemap(14);
ClearWindowTilemap(15);
schedule_bg_copy_tilemap_to_vram(0);
sub_81C1DA4(0, 3);
sub_81C1EFC(0, 3, 0);
sub_81C4154();
gTasks[taskId].func = sub_81C1940;
}
void sub_81C1940(u8 taskId)
{
s16* data = gTasks[taskId].data;
u16 move;
if (FuncIsActiveTask(sub_81C1E20) != 1)
{
if (gMain.newKeys & DPAD_UP)
{
data[1] = 1;
data[0] = 4;
2018-08-15 06:56:11 +02:00
sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->firstMoveIndex);
2017-10-09 19:17:13 +02:00
data[1] = 0;
gTasks[taskId].func = sub_81C174C;
}
else if (gMain.newKeys & DPAD_DOWN)
{
data[1] = 1;
data[0] = 4;
2018-08-15 06:56:11 +02:00
sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->firstMoveIndex);
2017-10-09 19:17:13 +02:00
data[1] = 0;
gTasks[taskId].func = sub_81C174C;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
{
if (gUnknown_0203CF1C->currPageIndex != 2)
2017-10-09 19:17:13 +02:00
{
ClearWindowTilemap(19);
2018-08-15 06:56:11 +02:00
if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible)
2017-10-09 19:17:13 +02:00
ClearWindowTilemap(13);
2018-08-15 06:56:11 +02:00
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex];
2017-10-09 19:17:13 +02:00
gTasks[taskId].func = sub_81C174C;
sub_81C0A8C(taskId, -1);
sub_81C1DA4(9, -2);
sub_81C1EFC(9, -2, move);
}
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
{
if (gUnknown_0203CF1C->currPageIndex != 3)
2017-10-09 19:17:13 +02:00
{
ClearWindowTilemap(19);
2018-08-15 06:56:11 +02:00
if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible)
2017-10-09 19:17:13 +02:00
ClearWindowTilemap(13);
2018-08-15 06:56:11 +02:00
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex];
2017-10-09 19:17:13 +02:00
gTasks[taskId].func = sub_81C174C;
sub_81C0A8C(taskId, 1);
sub_81C1DA4(9, -2);
sub_81C1EFC(9, -2, move);
}
}
else if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
ClearWindowTilemap(19);
2018-08-15 06:56:11 +02:00
if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible)
2017-10-09 19:17:13 +02:00
ClearWindowTilemap(13);
2018-08-15 06:56:11 +02:00
move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex];
2017-10-09 19:17:13 +02:00
sub_81C3E9C(move);
schedule_bg_copy_tilemap_to_vram(0);
sub_81C1DA4(9, -3);
sub_81C1EFC(9, -3, move);
gTasks[taskId].func = sub_81C174C;
}
}
}
2018-08-15 06:56:11 +02:00
u8 sub_81C1B94(void)
2017-10-09 19:17:13 +02:00
{
return gUnknown_0203CF21;
}
2018-08-15 06:56:11 +02:00
void sub_81C1BA0(void)
2017-10-09 19:17:13 +02:00
{
u16 *alloced = Alloc(32);
u8 i;
for (i = 0; i < 4; i++)
{
u8 j = i << 1;
if (i < gUnknown_0203CF1C->minPageIndex)
2017-10-09 19:17:13 +02:00
{
alloced[j+0] = 0x40;
alloced[j+1] = 0x40;
alloced[j+8] = 0x50;
alloced[j+9] = 0x50;
}
else if (i > gUnknown_0203CF1C->maxPageIndex)
2017-10-09 19:17:13 +02:00
{
alloced[j+0] = 0x4A;
alloced[j+1] = 0x4A;
alloced[j+8] = 0x5A;
alloced[j+9] = 0x5A;
}
else if (i < gUnknown_0203CF1C->currPageIndex)
2017-10-09 19:17:13 +02:00
{
alloced[j+0] = 0x46;
alloced[j+1] = 0x47;
alloced[j+8] = 0x56;
alloced[j+9] = 0x57;
}
else if (i == gUnknown_0203CF1C->currPageIndex)
2017-10-09 19:17:13 +02:00
{
if (i != gUnknown_0203CF1C->maxPageIndex)
2017-10-09 19:17:13 +02:00
{
alloced[j+0] = 0x41;
alloced[j+1] = 0x42;
alloced[j+8] = 0x51;
alloced[j+9] = 0x52;
}
else
{
alloced[j+0] = 0x4B;
alloced[j+1] = 0x4C;
alloced[j+8] = 0x5B;
alloced[j+9] = 0x5C;
}
}
else if (i != gUnknown_0203CF1C->maxPageIndex)
2017-10-09 19:17:13 +02:00
{
alloced[j+0] = 0x43;
alloced[j+1] = 0x44;
alloced[j+8] = 0x53;
alloced[j+9] = 0x54;
}
else
{
alloced[j+0] = 0x48;
alloced[j+1] = 0x49;
alloced[j+8] = 0x58;
alloced[j+9] = 0x59;
}
}
CopyToBgTilemapBufferRect_ChangePalette(3, alloced, 11, 0, 8, 2, 16);
schedule_bg_copy_tilemap_to_vram(3);
Free(alloced);
}
2018-08-15 06:56:11 +02:00
void sub_81C1CB0(const struct UnkStruct_61CC04 *unkStruct, u16 *dest, u8 c, bool8 d)
2017-10-09 19:17:13 +02:00
{
2018-08-15 06:56:11 +02:00
u16 i;
u16 *alloced = Alloc(unkStruct->field_6 * 2 * unkStruct->field_7);
CpuFill16(unkStruct->field_4, alloced, unkStruct->field_6 * 2 * unkStruct->field_7);
if (unkStruct->field_6 != c)
2017-10-09 19:17:13 +02:00
{
if (!d)
{
2018-08-15 06:56:11 +02:00
for (i = 0; i < unkStruct->field_7; i++)
2017-10-09 19:17:13 +02:00
{
2018-08-15 06:56:11 +02:00
CpuCopy16(&unkStruct->ptr[c + unkStruct->field_6 * i], &alloced[unkStruct->field_6 * i], (unkStruct->field_6 - c) * 2);
2017-10-09 19:17:13 +02:00
}
}
else
{
2018-08-15 06:56:11 +02:00
for (i = 0; i < unkStruct->field_7; i++)
2017-10-09 19:17:13 +02:00
{
2018-08-15 06:56:11 +02:00
CpuCopy16(&unkStruct->ptr[unkStruct->field_6 * i], &alloced[c + unkStruct->field_6 * i], (unkStruct->field_6 - c) * 2);
2017-10-09 19:17:13 +02:00
}
}
}
2018-08-15 06:56:11 +02:00
for (i = 0; i < unkStruct->field_7; i++)
2017-10-09 19:17:13 +02:00
{
2018-08-15 06:56:11 +02:00
CpuCopy16(&alloced[unkStruct->field_6 * i], &dest[(unkStruct->field_9 + i) * 32 + unkStruct->field_8], unkStruct->field_6 * 2);
2017-10-09 19:17:13 +02:00
}
Free(alloced);
}
void sub_81C1DA4(u16 a, s16 b)
{
if (b > gUnknown_0861CC04.field_6)
b = gUnknown_0861CC04.field_6;
if (b == 0 || b == gUnknown_0861CC04.field_6)
{
2018-08-15 06:56:11 +02:00
sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->bgTilemapBuffer3[0], b, 1);
2017-10-09 19:17:13 +02:00
}
else
{
u8 taskId = FindTaskIdByFunc(sub_81C1E20);
if (taskId == 0xFF)
{
taskId = CreateTask(sub_81C1E20, 8);
}
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = a;
}
}
void sub_81C1E20(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[1] += data[0];
if (data[1] < 0)
{
data[1] = 0;
}
else if (data[1] > gUnknown_0861CC04.field_6)
{
data[1] = gUnknown_0861CC04.field_6;
}
2018-08-15 06:56:11 +02:00
sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->bgTilemapBuffer3[0], data[1], 1);
2017-10-09 19:17:13 +02:00
if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6)
{
if (data[0] < 0)
{
if (gUnknown_0203CF1C->currPageIndex == 2)
2017-10-09 19:17:13 +02:00
PutWindowTilemap(14);
}
else
{
2018-08-15 06:56:11 +02:00
if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible)
2017-10-09 19:17:13 +02:00
PutWindowTilemap(13);
PutWindowTilemap(19);
}
schedule_bg_copy_tilemap_to_vram(0);
DestroyTask(taskId);
}
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
}
void sub_81C1EFC(u16 a, s16 b, u16 move)
{
if (b > gUnknown_0861CC10.field_6)
b = gUnknown_0861CC10.field_6;
if (b == 0 || b == gUnknown_0861CC10.field_6)
2018-08-15 06:56:11 +02:00
sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->bgTilemapBuffer4[0], b, 1);
2017-10-09 19:17:13 +02:00
else
{
u8 taskId = FindTaskIdByFunc(sub_81C1F80);
if (taskId == 0xFF)
taskId = CreateTask(sub_81C1F80, 8);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = a;
gTasks[taskId].data[2] = move;
}
}
void sub_81C1F80(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[1] += data[0];
if (data[1] < 0)
{
data[1] = 0;
}
else if (data[1] > gUnknown_0861CC10.field_6)
{
data[1] = gUnknown_0861CC10.field_6;
}
2018-08-15 06:56:11 +02:00
sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->bgTilemapBuffer4[0], data[1], 1);
2017-10-09 19:17:13 +02:00
if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6)
{
if (data[0] < 0)
{
if (gUnknown_0203CF1C->currPageIndex == 3 && FuncIsActiveTask(sub_81C0B8C) == 0)
2017-10-09 19:17:13 +02:00
PutWindowTilemap(15);
sub_81C240C(data[2]);
}
2017-11-14 20:23:25 +01:00
else
2017-10-09 19:17:13 +02:00
{
2018-08-15 06:56:11 +02:00
if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible)
2017-10-09 19:17:13 +02:00
{
PutWindowTilemap(13);
}
PutWindowTilemap(19);
}
schedule_bg_copy_tilemap_to_vram(0);
DestroyTask(taskId);
}
schedule_bg_copy_tilemap_to_vram(1);
schedule_bg_copy_tilemap_to_vram(2);
}
void sub_81C2074(u16 a, s16 b)
{
if (b > gUnknown_0861CBEC.field_6)
b = gUnknown_0861CBEC.field_6;
if (b == 0 || b == gUnknown_0861CBEC.field_6)
{
2018-08-15 06:56:11 +02:00
sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->bgTilemapBuffer1[0], b, 0);
sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->bgTilemapBuffer1[0], b, 0);
2017-10-09 19:17:13 +02:00
}
else
{
u8 taskId = CreateTask(sub_81C20F0, 8);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = a;
}
}
void sub_81C20F0(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[1] += data[0];
if (data[1] < 0)
data[1] = 0;
else if (data[1] > gUnknown_0861CBEC.field_6)
data[1] = gUnknown_0861CBEC.field_6;
2018-08-15 06:56:11 +02:00
sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->bgTilemapBuffer1[0], data[1], 0);
sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->bgTilemapBuffer1[0], data[1], 0);
2017-10-09 19:17:13 +02:00
schedule_bg_copy_tilemap_to_vram(3);
if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6)
{
if (data[0] < 0)
{
sub_81C4A88();
PutWindowTilemap(13);
schedule_bg_copy_tilemap_to_vram(0);
}
DestroyTask(taskId);
}
}
2018-08-15 06:56:11 +02:00
void sub_81C2194(u16 *output, u16 palette, bool8 c)
2017-10-09 19:17:13 +02:00
{
u16 i;
2018-08-15 06:56:11 +02:00
u32 var;
palette <<= 12;
2017-10-09 19:17:13 +02:00
var = 0x56A;
if (c == 0)
{
for (i = 0; i < 20; i++)
{
2018-08-15 06:56:11 +02:00
output[var + i] = gSummaryScreenWindow_Tilemap[i] + palette;
output[var + i + 0x20] = gSummaryScreenWindow_Tilemap[i] + palette;
output[var + i + 0x40] = gSummaryScreenWindow_Tilemap[i + 20] + palette;
2017-10-09 19:17:13 +02:00
}
}
else
{
for (i = 0; i < 20; i++)
{
2018-08-15 06:56:11 +02:00
output[var + i] = gSummaryScreenWindow_Tilemap[i + 20] + palette;
output[var + i + 0x20] = gSummaryScreenWindow_Tilemap[i + 40] + palette;
output[var + i + 0x40] = gSummaryScreenWindow_Tilemap[i + 40] + palette;
2017-10-09 19:17:13 +02:00
}
}
2017-10-09 22:49:14 +02:00
}
2018-08-15 06:56:11 +02:00
void sub_81C2228(struct Pokemon *mon)
2017-10-09 22:49:14 +02:00
{
if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0))
{
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->bgTilemapBuffer1[0x223] = 0x2C;
gUnknown_0203CF1C->bgTilemapBuffer1[0x623] = 0x2C;
2017-10-09 22:49:14 +02:00
}
else
{
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->bgTilemapBuffer1[0x223] = 0x81A;
gUnknown_0203CF1C->bgTilemapBuffer1[0x623] = 0x81A;
2017-10-09 22:49:14 +02:00
}
schedule_bg_copy_tilemap_to_vram(3);
}
void sub_81C228C(bool8 isMonShiny)
2017-10-09 22:49:14 +02:00
{
if (!isMonShiny)
2017-10-09 22:49:14 +02:00
sub_8199C30(3, 1, 4, 8, 8, 0);
else
sub_8199C30(3, 1, 4, 8, 8, 5);
schedule_bg_copy_tilemap_to_vram(3);
2017-10-19 01:25:08 +02:00
}
void sub_81C22CC(struct Pokemon *unused)
{
s64 r6r7;
2017-10-20 22:18:29 +02:00
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
2017-10-19 01:25:08 +02:00
u16 *r9;
u8 i;
if (summary->level < MAX_MON_LEVEL)
{
u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
u32 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
r6r7 = r4 * 64 / r1;
if (r6r7 == 0 && r4 != 0)
r6r7 = 1;
}
else
{
r6r7 = 0;
}
2018-08-15 06:56:11 +02:00
r9 = &gUnknown_0203CF1C->bgTilemapBuffer2[0x655];
2017-10-19 01:25:08 +02:00
for (i = 0; i < 8; i++)
{
if (r6r7 > 7)
r9[i] = 0x206A;
else
r9[i] = 0x2062 + (r6r7 % 8);
r6r7 -= 8;
if (r6r7 < 0)
r6r7 = 0;
}
2018-08-15 06:56:11 +02:00
if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->bgTilemapBuffer2)
2017-10-19 01:25:08 +02:00
schedule_bg_copy_tilemap_to_vram(1);
else
schedule_bg_copy_tilemap_to_vram(2);
}
void sub_81C240C(u16 move)
{
u16* tilemap = &gUnknown_0203CF1C->bgTilemapBuffer4[0x400];
2017-10-19 01:25:08 +02:00
u8 i;
u8 effectValue;
2017-10-19 01:25:08 +02:00
if (move != MOVE_NONE)
{
effectValue = gContestEffects[gContestMoves[move].effect].appeal;
if (effectValue != 0xFF)
effectValue /= 10;
for (i = 0; i < 8; i++)
2017-10-19 01:25:08 +02:00
{
if (effectValue != 0xFF && i < effectValue)
2017-10-19 01:25:08 +02:00
{
tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = 0x103A;
2017-10-19 01:25:08 +02:00
}
else
{
tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = 0x1039;
}
2017-10-19 01:25:08 +02:00
}
effectValue = gContestEffects[gContestMoves[move].effect].jam;
if (effectValue != 0xFF)
effectValue /= 10;
for (i = 0; i < 8; i++)
2017-10-19 01:25:08 +02:00
{
if (effectValue != 0xFF && i < effectValue)
2017-10-19 01:25:08 +02:00
{
tilemap[(i / 4 * 32) + (i & 3) + 0x226] = 0x103C;
2017-10-19 01:25:08 +02:00
}
else
{
tilemap[(i / 4 * 32) + (i & 3) + 0x226] = 0x103D;
}
2017-10-19 01:25:08 +02:00
}
}
}
2018-08-15 06:56:11 +02:00
void sub_81C2524(void)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->summary.isEgg)
2017-10-19 01:25:08 +02:00
ChangeBgX(3, 0x10000, 0);
else
ChangeBgX(3, 0, 0);
}
2018-08-15 06:56:11 +02:00
void sub_81C2554(void)
2017-10-19 01:25:08 +02:00
{
u8 i;
2018-08-15 06:56:11 +02:00
InitWindows(gUnknown_0861CC24);
2017-10-19 01:25:08 +02:00
DeactivateAllTextPrinters();
2017-10-19 01:25:08 +02:00
for (i = 0; i < 20; i++)
{
2017-10-19 01:25:08 +02:00
FillWindowPixelBuffer(i, 0);
}
2017-10-19 01:25:08 +02:00
for (i = 0; i < 8; i++)
{
gUnknown_0203CF1C->windowIds[i] = 0xFF;
}
2017-10-19 01:25:08 +02:00
}
static void SummaryScreen_PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId)
2017-10-19 01:25:08 +02:00
{
AddTextPrinterParameterized2(windowId, 1, x, y, 0, lineSpacing, sTextColors_861CD2C[colorId], 0, string);
2017-10-19 01:25:08 +02:00
}
2018-08-15 06:56:11 +02:00
void sub_81C25E8(void)
2017-10-19 01:25:08 +02:00
{
FillWindowPixelBuffer(17, 0);
FillWindowPixelBuffer(18, 0);
FillWindowPixelBuffer(19, 0);
if (!gUnknown_0203CF1C->summary.isEgg)
2017-10-19 01:25:08 +02:00
sub_81C2628();
else
sub_81C2794();
schedule_bg_copy_tilemap_to_vram(0);
}
2018-08-15 06:56:11 +02:00
void sub_81C2628(void)
2017-10-19 01:25:08 +02:00
{
u8 strArray[16];
2017-10-20 22:28:38 +02:00
struct Pokemon *mon = &gUnknown_0203CF1C->currentMon;
2017-10-20 22:18:29 +02:00
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
u16 dexNum = SpeciesToPokedexNum(summary->species);
if (dexNum != 0xFFFF)
2017-10-19 01:25:08 +02:00
{
StringCopy(gStringVar1, &gText_UnkCtrlF908Clear01[0]);
ConvertIntToDecimalStringN(gStringVar2, dexNum, 2, 3);
2017-10-19 01:25:08 +02:00
StringAppend(gStringVar1, gStringVar2);
if (!IsMonShiny(mon))
2017-10-19 01:25:08 +02:00
{
SummaryScreen_PrintTextOnWindow(17, gStringVar1, 0, 1, 0, 1);
sub_81C228C(FALSE);
2017-10-19 01:25:08 +02:00
}
else
{
SummaryScreen_PrintTextOnWindow(17, gStringVar1, 0, 1, 0, 7);
sub_81C228C(TRUE);
2017-10-19 01:25:08 +02:00
}
PutWindowTilemap(17);
}
else
{
ClearWindowTilemap(17);
if (!IsMonShiny(mon))
sub_81C228C(FALSE);
2017-10-19 01:25:08 +02:00
else
sub_81C228C(TRUE);
2017-10-19 01:25:08 +02:00
}
StringCopy(gStringVar1, &gText_LevelSymbol[0]);
ConvertIntToDecimalStringN(gStringVar2, summary->level, 0, 3);
StringAppend(gStringVar1, gStringVar2);
SummaryScreen_PrintTextOnWindow(19, gStringVar1, 0x18, 17, 0, 1);
2017-10-19 01:25:08 +02:00
GetMonNickname(mon, gStringVar1);
SummaryScreen_PrintTextOnWindow(18, gStringVar1, 0, 1, 0, 1);
2017-10-19 01:25:08 +02:00
strArray[0] = CHAR_SLASH;
StringCopy(&strArray[1], &gSpeciesNames[summary->species2][0]);
SummaryScreen_PrintTextOnWindow(19, &strArray[0], 0, 1, 0, 1);
2017-10-19 01:25:08 +02:00
sub_81C27DC(mon, summary->species2);
PutWindowTilemap(18);
PutWindowTilemap(19);
}
2018-08-15 06:56:11 +02:00
void sub_81C2794(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:28:38 +02:00
GetMonNickname(&gUnknown_0203CF1C->currentMon, gStringVar1);
SummaryScreen_PrintTextOnWindow(18, gStringVar1, 0, 1, 0, 1);
2017-10-19 01:25:08 +02:00
PutWindowTilemap(18);
ClearWindowTilemap(17);
ClearWindowTilemap(19);
}
void sub_81C27DC(struct Pokemon *mon, u16 a)
{
if (a != SPECIES_NIDORAN_M && a != SPECIES_NIDORAN_F)
{
u8 gender = GetMonGender(mon);
switch (gender)
{
case 0:
SummaryScreen_PrintTextOnWindow(19, &gText_MaleSymbol[0], 57, 17, 0, 3);
2017-10-19 01:25:08 +02:00
break;
case 0xFE:
SummaryScreen_PrintTextOnWindow(19, &gText_FemaleSymbol[0], 57, 17, 0, 4);
2017-10-19 01:25:08 +02:00
break;
}
}
}
void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x)
{
BlitBitmapToWindow(windowId, (bButton) ? gUnknown_0861CDD3 : gUnknown_0861CDD3 - 0x80, x, 0, 16, 16);
}
void PrintRentalMonStatsPage(void)
{
int stringXPos;
int iconXPos;
int statsXPos;
SummaryScreen_PrintTextOnWindow(0, gText_PkmnInfo, 2, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(1, gText_PkmnSkills, 2, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(2, gText_BattleMoves, 2, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(3, gText_ContestMoves, 2, 1, 0, 1);
stringXPos = GetStringRightAlignXOffset(1, gText_Cancel2, 0x3E);
iconXPos = stringXPos - 16;
if (iconXPos < 0)
iconXPos = 0;
PrintAOrBButtonIcon(4, FALSE, iconXPos);
SummaryScreen_PrintTextOnWindow(4, gText_Cancel2, stringXPos, 1, 0, 0);
stringXPos = GetStringRightAlignXOffset(1, gText_Info, 0x3E);
iconXPos = stringXPos - 16;
if (iconXPos < 0)
iconXPos = 0;
PrintAOrBButtonIcon(5, FALSE, iconXPos);
SummaryScreen_PrintTextOnWindow(5, gText_Info, stringXPos, 1, 0, 0);
stringXPos = GetStringRightAlignXOffset(1, gText_Switch, 0x3E);
iconXPos = stringXPos - 16;
if (iconXPos < 0)
iconXPos = 0;
PrintAOrBButtonIcon(6, FALSE, iconXPos);
SummaryScreen_PrintTextOnWindow(6, gText_Switch, stringXPos, 1, 0, 0);
SummaryScreen_PrintTextOnWindow(8, gText_RentalPkmn, 0, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(9, gText_TypeSlash, 0, 1, 0, 0);
statsXPos = 6 + GetStringCenterAlignXOffset(1, gText_HP4, 42);
SummaryScreen_PrintTextOnWindow(10, gText_HP4, statsXPos, 1, 0, 1);
statsXPos = 6 + GetStringCenterAlignXOffset(1, gText_Attack3, 42);
SummaryScreen_PrintTextOnWindow(10, gText_Attack3, statsXPos, 17, 0, 1);
statsXPos = 6 + GetStringCenterAlignXOffset(1, gText_Defense3, 42);
SummaryScreen_PrintTextOnWindow(10, gText_Defense3, statsXPos, 33, 0, 1);
statsXPos = 2 + GetStringCenterAlignXOffset(1, gText_SpAtk4, 36);
SummaryScreen_PrintTextOnWindow(11, gText_SpAtk4, statsXPos, 1, 0, 1);
statsXPos = 2 + GetStringCenterAlignXOffset(1, gText_SpDef4, 36);
SummaryScreen_PrintTextOnWindow(11, gText_SpDef4, statsXPos, 17, 0, 1);
statsXPos = 2 + GetStringCenterAlignXOffset(1, gText_Speed2, 36);
SummaryScreen_PrintTextOnWindow(11, gText_Speed2, statsXPos, 33, 0, 1);
SummaryScreen_PrintTextOnWindow(12, gText_ExpPoints, 6, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(12, gText_NextLv, 6, 17, 0, 1);
SummaryScreen_PrintTextOnWindow(13, gText_Status, 2, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(14, gText_Power, 0, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(14, gText_Accuracy2, 0, 17, 0, 1);
SummaryScreen_PrintTextOnWindow(15, gText_Appeal, 0, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(15, gText_Jam, 0, 17, 0, 1);
2017-10-19 01:25:08 +02:00
}
void sub_81C2AFC(u8 a)
{
u8 i;
ClearWindowTilemap(0);
ClearWindowTilemap(1);
ClearWindowTilemap(2);
ClearWindowTilemap(3);
switch (a)
{
case 0:
PutWindowTilemap(0);
PutWindowTilemap(4);
2017-10-23 03:00:08 +02:00
if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE)
2017-10-19 01:25:08 +02:00
PutWindowTilemap(8);
PutWindowTilemap(9);
break;
case 1:
PutWindowTilemap(1);
PutWindowTilemap(10);
PutWindowTilemap(11);
PutWindowTilemap(12);
break;
case 2:
PutWindowTilemap(2);
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES)
2017-10-19 01:25:08 +02:00
PutWindowTilemap(14);
}
else
{
2017-10-19 01:25:08 +02:00
PutWindowTilemap(5);
}
2017-10-19 01:25:08 +02:00
break;
case 3:
PutWindowTilemap(3);
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES)
2017-10-19 01:25:08 +02:00
PutWindowTilemap(15);
}
else
{
2017-10-19 01:25:08 +02:00
PutWindowTilemap(5);
}
2017-10-19 01:25:08 +02:00
break;
}
for (i = 0; i < 8; i++)
{
2018-08-15 06:56:11 +02:00
PutWindowTilemap(gUnknown_0203CF1C->windowIds[i]);
2017-10-19 01:25:08 +02:00
}
schedule_bg_copy_tilemap_to_vram(0);
}
void sub_81C2C38(u8 a)
{
u8 i;
switch (a)
{
case 0:
ClearWindowTilemap(4);
2017-10-23 03:00:08 +02:00
if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE)
2017-10-19 01:25:08 +02:00
ClearWindowTilemap(8);
ClearWindowTilemap(9);
break;
case 1:
ClearWindowTilemap(10);
ClearWindowTilemap(11);
ClearWindowTilemap(12);
break;
case 2:
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES)
2017-10-19 01:25:08 +02:00
ClearWindowTilemap(14);
}
else
{
2017-10-19 01:25:08 +02:00
ClearWindowTilemap(5);
}
2017-10-19 01:25:08 +02:00
break;
case 3:
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES)
2017-10-19 01:25:08 +02:00
ClearWindowTilemap(15);
}
else
{
2017-10-19 01:25:08 +02:00
ClearWindowTilemap(5);
}
2017-10-19 01:25:08 +02:00
break;
}
for (i = 0; i < 8; i++)
sub_81C2D68(i);
schedule_bg_copy_tilemap_to_vram(0);
}
u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId)
2017-10-19 01:25:08 +02:00
{
u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[templateId]);
2018-04-12 19:06:07 +02:00
if (*windowIdPtr == 0xFF)
2017-10-19 01:25:08 +02:00
{
*windowIdPtr = AddWindow(&template[templateId]);
2018-04-12 19:06:07 +02:00
FillWindowPixelBuffer(*windowIdPtr, 0);
2017-10-19 01:25:08 +02:00
}
2018-04-12 19:06:07 +02:00
return *windowIdPtr;
2017-10-19 01:25:08 +02:00
}
void sub_81C2D68(u8 a)
{
2018-08-15 06:56:11 +02:00
u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[a]);
2018-04-12 19:06:07 +02:00
if (*windowIdPtr != 0xFF)
2017-10-19 01:25:08 +02:00
{
2018-04-12 19:06:07 +02:00
ClearWindowTilemap(*windowIdPtr);
RemoveWindow(*windowIdPtr);
*windowIdPtr = 0xFF;
2017-10-19 01:25:08 +02:00
}
}
void sub_81C2D9C(u8 pageIndex)
2017-10-19 01:25:08 +02:00
{
u16 i;
for (i = 0; i < 8; i++)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->windowIds[i] != 0xFF)
FillWindowPixelBuffer(gUnknown_0203CF1C->windowIds[i], 0);
2017-10-19 01:25:08 +02:00
}
gUnknown_0861CE54[pageIndex]();
2017-10-19 01:25:08 +02:00
}
void sub_81C2DE4(u8 pageIndex)
2017-10-19 01:25:08 +02:00
{
CreateTask(gUnknown_0861CE64[pageIndex], 16);
2017-10-19 01:25:08 +02:00
}
2018-08-15 06:56:11 +02:00
void sub_81C2E00(void)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->summary.isEgg)
{
PrintEggOTName();
PrintEggOTID();
PrintEggState();
PrintEggMemo();
2017-10-19 01:25:08 +02:00
}
else
{
PrintMonOTName();
PrintMonOTID();
PrintMonAbilityName();
PrintMonAbilityDescription();
BufferMonTrainerMemo();
PrintMonTrainerMemo();
2017-10-19 01:25:08 +02:00
}
}
void sub_81C2E40(u8 taskId)
{
s16 *data = gTasks[taskId].data;
switch (data[0])
2017-10-19 01:25:08 +02:00
{
case 1:
PrintMonOTName();
2017-10-19 01:25:08 +02:00
break;
case 2:
PrintMonOTID();
2017-10-19 01:25:08 +02:00
break;
case 3:
PrintMonAbilityName();
2017-10-19 01:25:08 +02:00
break;
case 4:
PrintMonAbilityDescription();
2017-10-19 01:25:08 +02:00
break;
case 5:
BufferMonTrainerMemo();
2017-10-19 01:25:08 +02:00
break;
case 6:
PrintMonTrainerMemo();
break;
case 7:
2017-10-19 01:25:08 +02:00
DestroyTask(taskId);
return;
}
data[0]++;
}
void PrintMonOTName(void)
2017-10-19 01:25:08 +02:00
{
u8 windowId;
int x;
if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE)
2017-10-19 01:25:08 +02:00
{
windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0);
SummaryScreen_PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1);
x = GetStringWidth(1, gText_OTSlash, 0);
2017-10-19 01:25:08 +02:00
if (gUnknown_0203CF1C->summary.OTGender == 0)
SummaryScreen_PrintTextOnWindow(windowId, gUnknown_0203CF1C->summary.OTName, x, 1, 0, 5);
2017-10-19 01:25:08 +02:00
else
SummaryScreen_PrintTextOnWindow(windowId, gUnknown_0203CF1C->summary.OTName, x, 1, 0, 6);
2017-10-19 01:25:08 +02:00
}
}
void PrintMonOTID(void)
2017-10-19 01:25:08 +02:00
{
int xPos;
2017-10-23 03:00:08 +02:00
if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE)
2017-10-19 01:25:08 +02:00
{
ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5);
xPos = GetStringRightAlignXOffset(1, gStringVar1, 56);
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, xPos, 1, 0, 1);
2017-10-19 01:25:08 +02:00
}
}
void PrintMonAbilityName(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility);
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1);
2017-10-19 01:25:08 +02:00
}
void PrintMonAbilityDescription(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility);
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0);
2017-10-19 01:25:08 +02:00
}
void BufferMonTrainerMemo(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
2018-08-15 06:56:11 +02:00
const u8 *text;
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_0861CE74);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_0861CE7B);
BufferNatureString();
if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE || IsInGamePartnerMon() == TRUE)
{
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_XNature);
}
2017-10-19 01:25:08 +02:00
else
{
u8 *metLevelString = Alloc(32);
u8 *metLocationString = Alloc(32);
GetMetLevelString(metLevelString);
if (sum->metLocation < MAPSEC_NONE)
2017-10-19 01:25:08 +02:00
{
sub_8124610(metLocationString, sum->metLocation);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, metLocationString);
2017-10-19 01:25:08 +02:00
}
if (DoesMonOTMatchOwner() == TRUE)
2017-10-19 01:25:08 +02:00
{
if (sum->metLevel == 0)
text = (sum->metLocation >= MAPSEC_NONE) ? gText_XNatureHatchedSomewhereAt : gText_XNatureHatchedAtYZ;
2017-10-19 01:25:08 +02:00
else
text = (sum->metLocation >= MAPSEC_NONE) ? gText_XNatureMetSomewhereAt : gText_XNatureMetAtYZ;
2017-10-19 01:25:08 +02:00
}
else if (sum->metLocation == MAPSEC_FATEFUL_ENCOUNTER)
{
2017-10-19 01:25:08 +02:00
text = gText_XNatureFatefulEncounter;
}
else if (sum->metLocation != MAPSEC_IN_GAME_TRADE && MonCameFromGBAGames())
{
text = (sum->metLocation >= MAPSEC_NONE) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt;
}
2017-10-19 01:25:08 +02:00
else
{
2017-10-19 01:25:08 +02:00
text = gText_XNatureObtainedInTrade;
}
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, text);
Free(metLevelString);
Free(metLocationString);
2017-10-19 01:25:08 +02:00
}
}
void PrintMonTrainerMemo(void)
2017-10-19 01:25:08 +02:00
{
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0);
2017-10-19 01:25:08 +02:00
}
void BufferNatureString(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
struct UnkSummaryStruct *sumStruct = gUnknown_0203CF1C;
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gNatureNamePointers[sumStruct->summary.nature]);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(5, gText_EmptyString5);
2017-10-19 01:25:08 +02:00
}
void GetMetLevelString(u8 *output)
2017-10-19 01:25:08 +02:00
{
u8 level = gUnknown_0203CF1C->summary.metLevel;
if (level == 0)
2018-03-06 13:29:10 +01:00
level = EGG_HATCH_LEVEL;
ConvertIntToDecimalStringN(output, level, 0, 3);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, output);
2017-10-19 01:25:08 +02:00
}
bool8 DoesMonOTMatchOwner(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
u32 trainerId;
u8 gender;
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->monList.mons == gEnemyParty)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
u8 multiID = GetMultiplayerId() ^ 1;
trainerId = (u16)gLinkPlayers[multiID].trainerId;
gender = gLinkPlayers[multiID].gender;
2017-10-19 01:25:08 +02:00
StringCopy(gStringVar1, gLinkPlayers[multiID].name);
}
else
{
trainerId = GetPlayerIDAsU32() & 0xFFFF;
gender = gSaveBlock2Ptr->playerGender;
2017-10-19 01:25:08 +02:00
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
}
if (gender != sum->OTGender || trainerId != (sum->OTID & 0xFFFF) || StringCompareWithoutExtCtrlCodes(gStringVar1, sum->OTName))
2017-10-19 01:25:08 +02:00
{
return FALSE;
2017-10-19 01:25:08 +02:00
}
return TRUE;
2017-10-19 01:25:08 +02:00
}
bool8 MonCameFromGBAGames(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
if (sum->metGame > 0 && sum->metGame <= VERSION_LEAF_GREEN)
2017-10-22 21:01:34 +02:00
return TRUE;
return FALSE;
2017-10-19 01:25:08 +02:00
}
bool8 MonCameFromRSE(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
if (sum->metGame > 0 && sum->metGame <= VERSION_EMERALD)
2017-10-22 21:01:34 +02:00
return TRUE;
return FALSE;
2017-10-19 01:25:08 +02:00
}
bool8 IsInGamePartnerMon(void)
2017-10-19 01:25:08 +02:00
{
if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->curMonIndex == 1 || gUnknown_0203CF1C->curMonIndex == 4 || gUnknown_0203CF1C->curMonIndex == 5)
2017-10-22 21:01:34 +02:00
return TRUE;
2017-10-19 01:25:08 +02:00
}
2017-10-22 21:01:34 +02:00
return FALSE;
2017-10-19 01:25:08 +02:00
}
void PrintEggOTName(void)
2017-10-19 01:25:08 +02:00
{
u32 windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0);
2018-08-15 06:56:11 +02:00
u32 width = GetStringWidth(1, gText_OTSlash, 0);
SummaryScreen_PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1);
SummaryScreen_PrintTextOnWindow(windowId, gText_FiveMarks, width, 1, 0, 1);
2017-10-19 01:25:08 +02:00
}
void PrintEggOTID(void)
2017-10-19 01:25:08 +02:00
{
int x;
2017-10-19 01:25:08 +02:00
StringCopy(gStringVar1, gText_UnkCtrlF907F908);
StringAppend(gStringVar1, gText_FiveMarks);
x = GetStringRightAlignXOffset(1, gStringVar1, 56);
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, x, 1, 0, 1);
2017-10-19 01:25:08 +02:00
}
void PrintEggState(void)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 *text;
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
if (gUnknown_0203CF1C->summary.sanity == TRUE)
2017-10-19 01:25:08 +02:00
text = gText_EggWillTakeALongTime;
else if (sum->friendship <= 5)
text = gText_EggAboutToHatch;
else if (sum->friendship <= 10)
text = gText_EggWillHatchSoon;
else if (sum->friendship <= 40)
text = gText_EggWillTakeSomeTime;
else
text = gText_EggWillTakeALongTime;
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), text, 0, 1, 0, 0);
2017-10-19 01:25:08 +02:00
}
void PrintEggMemo(void)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 *text;
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
2017-10-19 01:25:08 +02:00
if (gUnknown_0203CF1C->summary.sanity != 1)
{
if (sum->metLocation == MAPSEC_FATEFUL_ENCOUNTER)
2017-10-19 01:25:08 +02:00
text = gText_PeculiarEggNicePlace;
else if (MonCameFromGBAGames() == FALSE || DoesMonOTMatchOwner() == FALSE)
2017-10-19 01:25:08 +02:00
text = gText_PeculiarEggTrade;
else if (sum->metLocation == MAPSEC_SPECIAL_EGG)
text = (MonCameFromRSE() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler;
2017-10-19 01:25:08 +02:00
else
text = gText_OddEggFoundByCouple;
}
else
{
2017-10-19 01:25:08 +02:00
text = gText_OddEggFoundByCouple;
}
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), text, 0, 1, 0, 0);
2017-10-19 01:25:08 +02:00
}
2018-08-15 06:56:11 +02:00
void sub_81C3530(void)
2017-10-19 01:25:08 +02:00
{
PrintHeldItemName();
PrintRibbonCount();
BufferLeftColumnStats();
PrintLeftColumnStats();
BufferRightColumnStats();
PrintRightColumnStats();
PrintExpPointsNextLevel();
2017-10-19 01:25:08 +02:00
}
void sub_81C3554(u8 taskId)
{
s16 *data = gTasks[taskId].data;
switch (data[0])
2017-10-19 01:25:08 +02:00
{
case 1:
PrintHeldItemName();
2017-10-19 01:25:08 +02:00
break;
case 2:
PrintRibbonCount();
2017-10-19 01:25:08 +02:00
break;
case 3:
BufferLeftColumnStats();
2017-10-19 01:25:08 +02:00
break;
case 4:
PrintLeftColumnStats();
2017-10-19 01:25:08 +02:00
break;
case 5:
BufferRightColumnStats();
2017-10-19 01:25:08 +02:00
break;
case 6:
PrintRightColumnStats();
2017-10-19 01:25:08 +02:00
break;
case 7:
PrintExpPointsNextLevel();
break;
case 8:
2017-10-19 01:25:08 +02:00
DestroyTask(taskId);
return;
}
data[0]++;
}
void PrintHeldItemName(void)
2017-10-19 01:25:08 +02:00
{
2018-04-29 13:36:26 +02:00
const u8 *text;
2017-10-19 01:25:08 +02:00
int offset;
if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == TRUE && (gUnknown_0203CF1C->curMonIndex == 1 || gUnknown_0203CF1C->curMonIndex == 4 || gUnknown_0203CF1C->curMonIndex == 5))
2017-10-19 01:25:08 +02:00
{
2018-04-29 13:36:26 +02:00
text = ItemId_GetName(ITEM_ENIGMA_BERRY);
2017-10-19 01:25:08 +02:00
}
else if (gUnknown_0203CF1C->summary.item == ITEM_NONE)
{
2017-10-19 01:25:08 +02:00
text = gText_None;
}
2017-10-19 01:25:08 +02:00
else
{
CopyItemName(gUnknown_0203CF1C->summary.item, gStringVar1);
text = gStringVar1;
}
offset = GetStringCenterAlignXOffset(1, text, 72) + 6;
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 0), text, offset, 1, 0, 0);
2017-10-19 01:25:08 +02:00
}
void PrintRibbonCount(void)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 *text;
2017-10-19 01:25:08 +02:00
int offset;
if (gUnknown_0203CF1C->summary.ribbonCount == 0)
{
2017-10-19 01:25:08 +02:00
text = gText_None;
}
2017-10-19 01:25:08 +02:00
else
{
ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.ribbonCount, 1, 2);
2017-10-19 01:25:08 +02:00
StringExpandPlaceholders(gStringVar4, gText_RibbonsVar1);
text = gStringVar4;
}
offset = GetStringCenterAlignXOffset(1, text, 70) + 6;
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 1), text, offset, 1, 0, 0);
2017-10-19 01:25:08 +02:00
}
void BufferLeftColumnStats(void)
2017-10-19 01:25:08 +02:00
{
u8 *currentHPString = Alloc(8);
u8 *maxHPString = Alloc(8);
u8 *attackString = Alloc(8);
u8 *defenseString = Alloc(8);
ConvertIntToDecimalStringN(currentHPString, gUnknown_0203CF1C->summary.currentHP, 1, 3);
ConvertIntToDecimalStringN(maxHPString, gUnknown_0203CF1C->summary.maxHP, 1, 3);
ConvertIntToDecimalStringN(attackString, gUnknown_0203CF1C->summary.atk, 1, 7);
ConvertIntToDecimalStringN(defenseString, gUnknown_0203CF1C->summary.def, 1, 7);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, currentHPString);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, maxHPString);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, attackString);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, defenseString);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE82);
Free(currentHPString);
Free(maxHPString);
Free(attackString);
Free(defenseString);
2017-10-19 01:25:08 +02:00
}
void PrintLeftColumnStats(void)
2017-10-19 01:25:08 +02:00
{
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0);
2017-10-19 01:25:08 +02:00
}
void BufferRightColumnStats(void)
2017-10-19 01:25:08 +02:00
{
ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.spatk, 1, 3);
ConvertIntToDecimalStringN(gStringVar2, gUnknown_0203CF1C->summary.spdef, 1, 3);
ConvertIntToDecimalStringN(gStringVar3, gUnknown_0203CF1C->summary.speed, 1, 3);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gStringVar3);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE8E);
2017-10-19 01:25:08 +02:00
}
void PrintRightColumnStats(void)
2017-10-19 01:25:08 +02:00
{
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0);
2017-10-19 01:25:08 +02:00
}
void PrintExpPointsNextLevel(void)
2017-10-19 01:25:08 +02:00
{
2017-10-20 22:18:29 +02:00
struct PokeSummary *sum = &gUnknown_0203CF1C->summary;
u8 windowId = AddWindowFromTemplateList(gUnknown_0861CCEC, 4);
2017-10-19 01:25:08 +02:00
int offset;
u32 expToNextLevel;
2017-10-19 01:25:08 +02:00
ConvertIntToDecimalStringN(gStringVar1, sum->exp, 1, 7);
offset = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2;
SummaryScreen_PrintTextOnWindow(windowId, gStringVar1, offset, 1, 0, 0);
2017-10-19 01:25:08 +02:00
if (sum->level < MAX_MON_LEVEL)
expToNextLevel = gExperienceTables[gBaseStats[sum->species].growthRate][sum->level + 1] - sum->exp;
else
expToNextLevel = 0;
2017-10-19 01:25:08 +02:00
ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, 1, 6);
offset = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2;
SummaryScreen_PrintTextOnWindow(windowId, gStringVar1, offset, 17, 0, 0);
2017-10-19 01:25:08 +02:00
}
2018-08-15 06:56:11 +02:00
void sub_81C3984(void)
2017-10-19 01:25:08 +02:00
{
PrintMoveNameAndPP(0);
PrintMoveNameAndPP(1);
PrintMoveNameAndPP(2);
PrintMoveNameAndPP(3);
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
PrintNewMoveDetailsOrCancelText();
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->newMove != MOVE_NONE)
sub_81C3E9C(gUnknown_0203CF1C->newMove);
2017-10-19 01:25:08 +02:00
}
else
{
2018-08-15 06:56:11 +02:00
sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]);
}
2017-10-19 01:25:08 +02:00
}
}
void sub_81C39F0(u8 taskId)
{
s16 *data = gTasks[taskId].data;
switch (data[0])
2017-10-19 01:25:08 +02:00
{
case 1:
PrintMoveNameAndPP(0);
2017-10-19 01:25:08 +02:00
break;
case 2:
PrintMoveNameAndPP(1);
2017-10-19 01:25:08 +02:00
break;
case 3:
PrintMoveNameAndPP(2);
2017-10-19 01:25:08 +02:00
break;
case 4:
PrintMoveNameAndPP(3);
2017-10-19 01:25:08 +02:00
break;
case 5:
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
PrintNewMoveDetailsOrCancelText();
break;
case 6:
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)
data[1] = gUnknown_0203CF1C->newMove;
2017-10-19 01:25:08 +02:00
else
2018-08-15 06:56:11 +02:00
data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex];
2017-10-19 01:25:08 +02:00
}
break;
case 7:
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES)
2017-10-19 01:25:08 +02:00
sub_81C3E9C(data[1]);
}
break;
case 8:
2017-10-19 01:25:08 +02:00
DestroyTask(taskId);
return;
}
data[0]++;
}
void PrintMoveNameAndPP(u8 moveIndex)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
u8 pp;
u32 ppState;
const u8 *text;
u32 offset;
struct UnkSummaryStruct *summaryStruct = gUnknown_0203CF1C;
u8 moveNameWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
u8 ppValueWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 1);
u16 move = summaryStruct->summary.moves[moveIndex];
2018-08-15 06:56:11 +02:00
if (move != 0)
2017-10-19 01:25:08 +02:00
{
pp = CalculatePPWithBonus(move, summaryStruct->summary.ppBonuses, moveIndex);
SummaryScreen_PrintTextOnWindow(moveNameWindowId, gMoveNames[move], 0, moveIndex * 16 + 1, 0, 1);
ConvertIntToDecimalStringN(gStringVar1, summaryStruct->summary.pp[moveIndex], 1, 2);
2018-08-15 06:56:11 +02:00
ConvertIntToDecimalStringN(gStringVar2, pp, 1, 2);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE97);
2017-10-19 01:25:08 +02:00
text = gStringVar4;
ppState = GetCurrentPpToMaxPpState(summaryStruct->summary.pp[moveIndex], pp) + 9;
offset = GetStringRightAlignXOffset(1, text, 44);
2017-10-19 01:25:08 +02:00
}
else
{
SummaryScreen_PrintTextOnWindow(moveNameWindowId, gText_OneDash, 0, moveIndex * 16 + 1, 0, 1);
2017-10-19 01:25:08 +02:00
text = gText_TwoDashes;
2018-08-15 06:56:11 +02:00
ppState = 12;
offset = GetStringCenterAlignXOffset(1, text, 44);
2017-10-19 01:25:08 +02:00
}
SummaryScreen_PrintTextOnWindow(ppValueWindowId, text, offset, moveIndex * 16 + 1, 0, ppState);
2017-10-19 01:25:08 +02:00
}
void PrintMovePowerAndAccuracy(u16 moveIndex)
2017-10-19 01:25:08 +02:00
{
2018-08-15 06:56:11 +02:00
const u8 *text;
if (moveIndex != 0)
2017-10-19 01:25:08 +02:00
{
FillWindowPixelRect(14, 0, 53, 0, 19, 32);
if (gBattleMoves[moveIndex].power < 2)
{
2017-10-19 01:25:08 +02:00
text = gText_ThreeDashes;
}
2017-10-19 01:25:08 +02:00
else
{
ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].power, 1, 3);
2017-10-19 01:25:08 +02:00
text = gStringVar1;
}
SummaryScreen_PrintTextOnWindow(14, text, 53, 1, 0, 0);
if (gBattleMoves[moveIndex].accuracy == 0)
{
2017-10-19 01:25:08 +02:00
text = gText_ThreeDashes;
}
2017-10-19 01:25:08 +02:00
else
{
ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].accuracy, 1, 3);
2017-10-19 01:25:08 +02:00
text = gStringVar1;
}
SummaryScreen_PrintTextOnWindow(14, text, 53, 17, 0, 0);
2017-10-19 01:25:08 +02:00
}
}
2018-08-15 06:56:11 +02:00
void sub_81C3D08(void)
2017-10-19 01:25:08 +02:00
{
PrintMoveNameAndPP(0);
PrintMoveNameAndPP(1);
PrintMoveNameAndPP(2);
PrintMoveNameAndPP(3);
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
PrintNewMoveDetailsOrCancelText();
2018-08-15 06:56:11 +02:00
sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex);
2017-10-19 01:25:08 +02:00
}
}
void sub_81C3D54(u8 taskId)
{
s16 *data = gTasks[taskId].data;
s16 dataa = data[0] - 1;
2017-11-14 20:23:25 +01:00
2017-10-19 01:25:08 +02:00
switch (dataa)
{
case 0:
PrintMoveNameAndPP(0);
2017-10-19 01:25:08 +02:00
break;
case 1:
PrintMoveNameAndPP(1);
2017-10-19 01:25:08 +02:00
break;
case 2:
PrintMoveNameAndPP(2);
2017-10-19 01:25:08 +02:00
break;
case 3:
PrintMoveNameAndPP(3);
2017-10-19 01:25:08 +02:00
break;
case 4:
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
PrintNewMoveDetailsOrCancelText();
2017-10-19 01:25:08 +02:00
break;
case 5:
if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE)
2017-10-19 01:25:08 +02:00
{
if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES)
2018-08-15 06:56:11 +02:00
sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex);
2017-10-19 01:25:08 +02:00
}
break;
case 6:
DestroyTask(taskId);
return;
}
data[0]++;
2017-11-14 20:23:25 +01:00
}
void sub_81C3E2C(u8 moveSlot)
{
u16 move;
if (moveSlot == 4)
2018-08-15 06:56:11 +02:00
move = gUnknown_0203CF1C->newMove;
else
move = gUnknown_0203CF1C->summary.moves[moveSlot];
if (move != MOVE_NONE)
{
u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2);
SummaryScreen_PrintTextOnWindow(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0);
}
}
void sub_81C3E9C(u16 move)
{
u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2);
FillWindowPixelBuffer(windowId, 0);
if (move != MOVE_NONE)
{
if (gUnknown_0203CF1C->currPageIndex == 2)
{
PrintMovePowerAndAccuracy(move);
SummaryScreen_PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0);
}
else
{
SummaryScreen_PrintTextOnWindow(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0);
}
PutWindowTilemap(windowId);
}
else
{
ClearWindowTilemap(windowId);
}
schedule_bg_copy_tilemap_to_vram(0);
}
void PrintNewMoveDetailsOrCancelText(void)
{
u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1);
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->newMove == MOVE_NONE)
{
SummaryScreen_PrintTextOnWindow(windowId1, gText_Cancel, 0, 65, 0, 1);
}
else
{
2018-08-15 06:56:11 +02:00
u16 move = gUnknown_0203CF1C->newMove;
if (gUnknown_0203CF1C->currPageIndex == 2)
SummaryScreen_PrintTextOnWindow(windowId1, gMoveNames[move], 0, 65, 0, 6);
else
SummaryScreen_PrintTextOnWindow(windowId1, gMoveNames[move], 0, 65, 0, 5);
ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].pp, 1, 2);
DynamicPlaceholderTextUtil_Reset();
DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1);
DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar1);
DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE97);
SummaryScreen_PrintTextOnWindow(windowId2, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x2C), 0x41, 0, 12);
}
}
void sub_81C4064(void)
{
u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
FillWindowPixelRect(windowId, 0, 0, 66, 72, 16);
CopyWindowToVram(windowId, 2);
}
void sub_81C40A0(u8 moveIndex1, u8 moveIndex2)
{
u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0);
u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1);
FillWindowPixelRect(windowId1, 0, 0, moveIndex1 * 16, 0x48, 0x10);
FillWindowPixelRect(windowId1, 0, 0, moveIndex2 * 16, 0x48, 0x10);
FillWindowPixelRect(windowId2, 0, 0, moveIndex1 * 16, 0x30, 0x10);
FillWindowPixelRect(windowId2, 0, 0, moveIndex2 * 16, 0x30, 0x10);
PrintMoveNameAndPP(moveIndex1);
PrintMoveNameAndPP(moveIndex2);
}
void sub_81C4154(void)
{
u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2);
FillWindowPixelBuffer(windowId, 0);
SummaryScreen_PrintTextOnWindow(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0);
}
void sub_81C4190(void)
{
u8 i;
for (i = 0; i < 28; i++)
2018-08-15 06:56:11 +02:00
gUnknown_0203CF1C->spriteIds[i] |= 0xFF;
}
void sub_81C41C0(u8 spriteArrayId)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->spriteIds[spriteArrayId] != 0xFF)
{
2018-08-15 06:56:11 +02:00
DestroySprite(&gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]]);
gUnknown_0203CF1C->spriteIds[spriteArrayId] = 0xFF;
}
}
void sub_81C4204(u8 spriteArrayId, bool8 invisible)
{
2018-08-15 06:56:11 +02:00
gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]].invisible = invisible;
}
void sub_81C424C(void)
{
u8 i;
for (i = 3; i < 28; i++)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->spriteIds[i] != 0xFF)
sub_81C4204(i, TRUE);
}
}
void sub_81C4280(void)
{
switch (gUnknown_0203CF1C->currPageIndex)
{
case 0:
sub_81C43A0();
break;
case 2:
sub_81C4420();
sub_81C44F0();
break;
case 3:
sub_81C4484();
sub_81C44F0();
break;
}
}
void sub_81C42C8(void)
{
u8 i;
for (i = 3; i < 8; i++)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->spriteIds[i] == 0xFF)
gUnknown_0203CF1C->spriteIds[i] = CreateSprite(&gUnknown_0861CFC4, 0, 0, 2);
sub_81C4204(i, TRUE);
}
}
void sub_81C4318(u8 typeId, u8 x, u8 y, u8 spriteArrayId)
{
2018-08-15 06:56:11 +02:00
struct Sprite *sprite = &gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]];
StartSpriteAnim(sprite, typeId);
sprite->oam.paletteNum = gUnknown_0861CFDC[typeId];
sprite->pos1.x = x + 16;
sprite->pos1.y = y + 8;
sub_81C4204(spriteArrayId, FALSE);
}
void sub_81C43A0(void)
{
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
if (summary->isEgg)
{
sub_81C4318(TYPE_MYSTERY, 0x78, 0x30, 3);
sub_81C4204(4, TRUE);
}
else
{
sub_81C4318(gBaseStats[summary->species].type1, 0x78, 0x30, 3);
if (gBaseStats[summary->species].type1 != gBaseStats[summary->species].type2)
{
sub_81C4318(gBaseStats[summary->species].type2, 0xA0, 0x30, 4);
sub_81C4204(4, FALSE);
}
else
{
sub_81C4204(4, TRUE);
}
}
}
void sub_81C4420(void)
{
u8 i;
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
for (i = 0; i < 4; i++)
{
if (summary->moves[i] != MOVE_NONE)
sub_81C4318(gBattleMoves[summary->moves[i]].type, 0x55, 0x20 + (i * 0x10), i + 3);
else
sub_81C4204(i + 3, TRUE);
}
}
void sub_81C4484(void)
{
u8 i;
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
for (i = 0; i < 4; i++)
{
if (summary->moves[i] != MOVE_NONE)
sub_81C4318(NUMBER_OF_MON_TYPES + gContestMoves[summary->moves[i]].contestCategory, 0x55, 0x20 + (i * 0x10), i + 3);
else
sub_81C4204(i + 3, TRUE);
}
}
void sub_81C44F0(void)
{
2018-08-15 06:56:11 +02:00
if (gUnknown_0203CF1C->newMove == MOVE_NONE)
{
sub_81C4204(7, TRUE);
}
else
{
if (gUnknown_0203CF1C->currPageIndex == 2)
2018-08-15 06:56:11 +02:00
sub_81C4318(gBattleMoves[gUnknown_0203CF1C->newMove].type, 0x55, 0x60, 7);
else
sub_81C4318(NUMBER_OF_MON_TYPES + gContestMoves[gUnknown_0203CF1C->newMove].contestCategory, 0x55, 0x60, 7);
}
}
void sub_81C4568(u8 a0, u8 a1)
{
struct Sprite *sprite1 = &gSprites[gUnknown_0203CF1C->spriteIds[a0 + 3]];
struct Sprite *sprite2 = &gSprites[gUnknown_0203CF1C->spriteIds[a1 + 3]];
u8 temp = sprite1->animNum;
sprite1->animNum = sprite2->animNum;
sprite2->animNum = temp;
temp = sprite1->oam.paletteNum;
sprite1->oam.paletteNum = sprite2->oam.paletteNum;
sprite2->oam.paletteNum = temp;
sprite1->animBeginning = TRUE;
sprite1->animEnded = FALSE;
sprite2->animBeginning = TRUE;
sprite2->animEnded = FALSE;
}
u8 sub_81C45F4(struct Pokemon *mon, s16 *a1)
{
const struct CompressedSpritePalette *pal;
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
switch (*a1)
{
default:
return sub_81C47B4(mon);
case 0:
if (gMain.inBattle)
{
if (sub_80688F8(3, gUnknown_0203CF1C->curMonIndex))
{
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid);
}
else
{
HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid);
}
}
else
{
if (gMonSpritesGfxPtr != NULL)
{
if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE)
2018-08-15 06:56:11 +02:00
{
HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid);
}
else
{
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid);
}
}
else
{
if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE)
2018-08-15 06:56:11 +02:00
{
HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], sub_806F4F8(0, 1), summary->species2, summary->pid);
}
else
{
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2], sub_806F4F8(0, 1), summary->species2, summary->pid);
}
}
}
(*a1)++;
return -1;
case 1:
pal = GetMonSpritePalStructFromOtIdPersonality(summary->species2, summary->OTID, summary->pid);
LoadCompressedObjectPalette(pal);
SetMultiuseSpriteTemplateToPokemon(pal->tag, 1);
(*a1)++;
return -1;
}
}
void sub_81C4778(void)
{
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
if (!summary->isEgg)
{
if (ShouldPlayNormalMonCry(&gUnknown_0203CF1C->currentMon) == TRUE)
{
PlayCry3(summary->species2, 0, 0);
}
else
{
PlayCry3(summary->species2, 0, 11);
}
}
}
u8 sub_81C47B4(struct Pokemon *unused)
{
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
u8 spriteId = CreateSprite(&gMultiuseSpriteTemplate, 40, 64, 5);
struct Sprite *sprite = &gSprites[spriteId];
FreeSpriteOamMatrix(sprite);
sprite->data[0] = summary->species2;
sprite->data[2] = 0;
gSprites[spriteId].callback = sub_81C4844;
sprite->oam.priority = 0;
if (!IsMonSpriteNotFlipped(summary->species2))
{
sprite->hFlip = TRUE;
}
else
{
sprite->hFlip = FALSE;
}
return spriteId;
}
void sub_81C4844(struct Sprite *sprite)
{
struct PokeSummary *summary = &gUnknown_0203CF1C->summary;
if (!gPaletteFade.active && sprite->data[2] != 1)
{
sprite->data[1] = IsMonSpriteNotFlipped(sprite->data[0]);
sub_81C4778();
PokemonSummaryDoMonAnimation(sprite, sprite->data[0], summary->isEgg);
}
}
void sub_81C488C(u8 a0)
{
sUnusedTaskId = a0;
}
void DestoryUnusedTask(void)
2018-08-15 06:56:11 +02:00
{
if (sUnusedTaskId != 0xFF)
{
DestroyTask(sUnusedTaskId);
sUnusedTaskId = 0xFF;
}
}
bool32 sub_81C48B4(void)
{
if (gSprites[gUnknown_0203CF1C->spriteIds[0]].callback == SpriteCallbackDummy)
{
return FALSE;
}
else
{
return TRUE;
}
}
void sub_81C48F0(void)
{
u16 i;
u16 paletteIndex;
gSprites[gUnknown_0203CF1C->spriteIds[0]].animPaused = TRUE;
gSprites[gUnknown_0203CF1C->spriteIds[0]].callback = SpriteCallbackDummy;
sub_806EE98();
paletteIndex = (gSprites[gUnknown_0203CF1C->spriteIds[0]].oam.paletteNum * 16) | 0x100;
for (i = 0; i < 16; i++)
{
gPlttBufferUnfaded[(u16)(i + paletteIndex)] = gPlttBufferFaded[(u16)(i + paletteIndex)];
}
}
void sub_81C4984(struct Pokemon *mon)
{
struct Sprite *sprite = sub_811FF94(30003, 30003, gUnknown_0861D120);
gUnknown_0203CF1C->markingsSprite = sprite;
2018-08-15 06:56:11 +02:00
if (sprite != NULL)
{
StartSpriteAnim(sprite, GetMonData(mon, MON_DATA_MARKINGS));
gUnknown_0203CF1C->markingsSprite->pos1.x = 60;
gUnknown_0203CF1C->markingsSprite->pos1.y = 26;
gUnknown_0203CF1C->markingsSprite->oam.priority = 1;
2018-08-15 06:56:11 +02:00
}
}
void sub_81C49E0(struct Pokemon *mon)
{
DestroySprite(gUnknown_0203CF1C->markingsSprite);
2018-08-15 06:56:11 +02:00
FreeSpriteTilesByTag(30003);
sub_81C4984(mon);
}
void sub_81C4A08(struct Pokemon *mon)
{
u8 ball = ItemIdToBallId(GetMonData(mon, MON_DATA_POKEBALL));
LoadBallGfx(ball);
gUnknown_0203CF1C->spriteIds[1] = CreateSprite(&gBallSpriteTemplates[ball], 16, 136, 0);
gSprites[gUnknown_0203CF1C->spriteIds[1]].callback = SpriteCallbackDummy;
gSprites[gUnknown_0203CF1C->spriteIds[1]].oam.priority = 3;
}
void sub_81C4A88(void)
{
u8 *spriteId = &gUnknown_0203CF1C->spriteIds[2];
u8 anim;
if (*spriteId == 0xFF)
{
*spriteId = CreateSprite(&gUnknown_0861D108, 64, 152, 0);
}
anim = sub_81B205C(&gUnknown_0203CF1C->currentMon);
if (anim != 0)
{
StartSpriteAnim(&gSprites[*spriteId], anim - 1);
sub_81C4204(2, FALSE);
}
else
{
sub_81C4204(2, TRUE);
}
}
void sub_81C4AF8(u8 a0)
{
u8 i;
u8 *spriteIds = &gUnknown_0203CF1C->spriteIds[a0];
if (gUnknown_0203CF1C->currPageIndex > 1)
2018-08-15 06:56:11 +02:00
{
u8 subsprite = 0;
if (a0 == 8)
{
subsprite = 1;
}
for (i = 0; i < 10; i++)
{
spriteIds[i] = CreateSprite(&gUnknown_0861D084, i * 16 + 89, 40, subsprite);
if (i == 0)
{
StartSpriteAnim(&gSprites[spriteIds[0]], 4);
}
else if (i == 9)
{
StartSpriteAnim(&gSprites[spriteIds[9]], 5);
}
else
{
StartSpriteAnim(&gSprites[spriteIds[i]], 6);
}
gSprites[spriteIds[i]].callback = sub_81C4BE4;
gSprites[spriteIds[i]].data[0] = a0;
gSprites[spriteIds[i]].data[1] = 0;
}
}
}
void sub_81C4BE4(struct Sprite *sprite)
{
if (sprite->animNum > 3 && sprite->animNum < 7)
{
sprite->data[1] = (sprite->data[1] + 1) & 0x1F;
if (sprite->data[1] > 24)
{
sprite->invisible = TRUE;
}
else
2018-08-15 06:56:11 +02:00
{
sprite->invisible = FALSE;
}
}
else
{
sprite->data[1] = 0;
sprite->invisible = FALSE;
}
if (sprite->data[0] == 8)
{
sprite->pos2.y = gUnknown_0203CF1C->firstMoveIndex * 16;
}
else
{
sprite->pos2.y = gUnknown_0203CF1C->secondMoveIndex * 16;
}
}
void sub_81C4C60(u8 a0)
{
u8 i;
for (i = 0; i < 10; i++)
{
sub_81C41C0(a0 + i);
}
}
void sub_81C4C84(u8 a0)
{
u8 i;
u8 *spriteIds = &gUnknown_0203CF1C->spriteIds[8];
a0 *= 3;
for (i = 0; i < 10; i++)
{
if (i == 0)
{
StartSpriteAnim(&gSprites[spriteIds[0]], a0 + 4);
}
else if (i == 9)
{
StartSpriteAnim(&gSprites[spriteIds[9]], a0 + 5);
}
else
{
StartSpriteAnim(&gSprites[spriteIds[i]], a0 + 6);
}
}
}
void sub_81C4D18(u8 a0)
{
u8 i;
u8 *spriteIds = &gUnknown_0203CF1C->spriteIds[a0];
for (i = 0; i < 10; i++)
{
gSprites[spriteIds[i]].data[1] = 0;
gSprites[spriteIds[i]].invisible = FALSE;
}
}