From 75b07292c99bdae7efe539bbe797aa4c381c880e Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Wed, 28 Mar 2018 19:20:20 +0200 Subject: [PATCH 01/21] Translate first functions of learn move --- asm/learn_move.s | 14 ++++-- graphics/pokedex/arrows.png | Bin 0 -> 303 bytes include/learn_move.h | 36 ++++++++++++++++ src/learn_move.c | 83 ++++++++++++++++++++++++++++++++++++ 4 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 graphics/pokedex/arrows.png create mode 100644 include/learn_move.h create mode 100644 src/learn_move.c diff --git a/asm/learn_move.s b/asm/learn_move.s index a33bd11b6..1faff5637 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -5,6 +5,7 @@ .text +/* thumb_func_start sub_8160624 sub_8160624: @ 8160624 push {lr} @@ -14,7 +15,9 @@ sub_8160624: @ 8160624 pop {r0} bx r0 thumb_func_end sub_8160624 +*/ +/* thumb_func_start sub_8160638 sub_8160638: @ 8160638 push {lr} @@ -35,7 +38,9 @@ sub_8160638: @ 8160638 bx r0 .pool thumb_func_end sub_8160638 +*/ +/* thumb_func_start sub_8160664 sub_8160664: @ 8160664 push {r4,lr} @@ -60,7 +65,9 @@ _08160688: bx r0 .pool thumb_func_end sub_8160664 +*/ +/* thumb_func_start sub_81606A0 sub_81606A0: @ 81606A0 push {r4-r6,lr} @@ -75,7 +82,7 @@ sub_81606A0: @ 81606A0 str r0, [r6] ldr r1, =gSpecialVar_0x8004 ldrh r1, [r1] - adds r0, 0x44 + adds r0, 0x44 partymon movs r5, 0 strb r1, [r0] ldr r0, =sub_8160624 @@ -100,8 +107,8 @@ sub_81606A0: @ 81606A0 bl ListMenuInit ldr r1, [r6] movs r2, 0x89 - lsls r2, 1 - adds r1, r2 + lsls r2, 1 //0x112 + adds r1, r2 //partymon + 0x112 strb r0, [r1] movs r0, 0 movs r1, 0 @@ -114,6 +121,7 @@ sub_81606A0: @ 81606A0 bx r0 .pool thumb_func_end sub_81606A0 +*/ thumb_func_start sub_8160740 sub_8160740: @ 8160740 diff --git a/graphics/pokedex/arrows.png b/graphics/pokedex/arrows.png new file mode 100644 index 0000000000000000000000000000000000000000..2abf39366e45e76afedc93ae41fc57b59253f68b GIT binary patch literal 303 zcmeAS@N?(olHy`uVBq!ia0vp^96+4F!VDxYwdwT(DT4r?5Lbr(K*;cnf#E6x!%?6h z4si4+Nb>*x|MI(%ZGfy@o-U3d5>sm@9OOEpz~jPxe%*bAo!kG{e__@+F>iaop4a9% zYFoRPZjh6E<)fx};BQNF1gB-k)C;Q@eT)?8owg`LNApLuRom{UwTu2G_zU}STYaoj zYrB`rw>NC#!ynPUv#Lwy&TKx^RN45{j-5B$VTY6MJ*mX|{=(B4^_XMWcJLHP-db_d zG^ZfYdwO|iL<1xHa^A;IJI~k&b_&noaNqm0=G1|2nw-)G4<3g4Nk5&f|9ppartyMon = gSpecialVar_0x8004; + + SetVBlankCallback(sub_8160624); + sub_81607EC(); + sub_81D2824(0); + + //pointer to ? + (&gUnknown_0203BC38)[0] = 0; + (&gUnknown_0203BC38)[2] = 0; + (&gUnknown_0203BC38)[4] = 0; + + sub_8161280(); + LoadSpriteSheet(&gUnknown_085CEBB0); + LoadSpritePalette(&gUnknown_085CEBB8); + sub_81610B8(); + + ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); + FillPalette(0, 0, 2); + SetMainCallback2(sub_816082C); +} From 990784a6d91a9b119ff974e3594a7bd5070549fc Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Wed, 28 Mar 2018 21:45:35 +0200 Subject: [PATCH 02/21] Improve comments --- src/learn_move.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/learn_move.c b/src/learn_move.c index 3a1ac72f4..36bf76eff 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -14,7 +14,7 @@ extern void (*gFieldCallback)(void); extern struct LearnMoveStruct *gUnknown_0203BC34; -// Ew, just copied from poeruby... +// Ew, just copied from pokeruby... const u16 gDexArrows_Pal[] = INCBIN_U16("graphics/pokedex/arrows.gbapal"); const u8 gDexArrows_Gfx[] = INCBIN_U8("graphics/pokedex/arrows.4bpp"); const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526}; @@ -50,6 +50,7 @@ void sub_8160664(u8 taskId) void sub_81606A0(void) //CB2_InitLearnMove { + //Less calls than pokeruby, is it normal ? ResetSpriteData(); FreeAllSpritePalettes(); ResetTasks(); @@ -57,17 +58,17 @@ void sub_81606A0(void) //CB2_InitLearnMove //LearnMoveStruct** - gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? //r1 = &gSpecialVar_0x8004; //What is this global ? //u8* partyMon = gUnknown_0203BC34 + 0x44 //partyMon ? //*partyMon = r1; + gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; SetVBlankCallback(sub_8160624); sub_81607EC(); sub_81D2824(0); - //pointer to ? + //gUnknown_0203BC38 ? (&gUnknown_0203BC38)[0] = 0; (&gUnknown_0203BC38)[2] = 0; (&gUnknown_0203BC38)[4] = 0; From cfacd23248ba56f5bca30895154625a06761ab45 Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Thu, 29 Mar 2018 11:56:10 +0200 Subject: [PATCH 03/21] Fix temporarily --- include/learn_move.h | 8 +++++++- src/learn_move.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/learn_move.h b/include/learn_move.h index 951cd6cb0..da03fe5ae 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -31,6 +31,12 @@ struct LearnMoveStruct *gUnknown_0203BC34 = NULL; void sub_8160624(void); void sub_8160638(void); -const struct SpritePalette gUnknown_08402D88 = {gDexArrows_Pal, 5526}; +// Ew, just copied from pokeruby... +//const u16 gDexArrows_Pal[] = INCBIN_U16("graphics/pokedex/arrows.gbapal"); +//const u8 gDexArrows_Gfx[] = INCBIN_U8("graphics/pokedex/arrows.4bpp"); +//const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526}; +//const struct SpriteSheet gUnknown_085CEBB0 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525}; + +void *gUnknown_0203BC38 = (void*)0x0203BC38; #endif //GUARD_LEAN_MOVE_H diff --git a/src/learn_move.c b/src/learn_move.c index 36bf76eff..d75e0a460 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -14,12 +14,6 @@ extern void (*gFieldCallback)(void); extern struct LearnMoveStruct *gUnknown_0203BC34; -// Ew, just copied from pokeruby... -const u16 gDexArrows_Pal[] = INCBIN_U16("graphics/pokedex/arrows.gbapal"); -const u8 gDexArrows_Gfx[] = INCBIN_U8("graphics/pokedex/arrows.4bpp"); -const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526}; -const struct SpriteSheet gUnknown_085CEBB0 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525}; - static struct LearnMoveStruct *sLearnMoveStruct; static void sub_8160664(u8 taskId); void sub_81606A0(void); //CB2_InitLearnMove @@ -50,6 +44,12 @@ void sub_8160664(u8 taskId) void sub_81606A0(void) //CB2_InitLearnMove { + //FIXME + void (*sub_81607EC)(void) = (void*)0x081607EC; + void (*sub_81D2824)(void*) = (void*)0x081D2824; + void (*sub_81610B8)(void) = (void*)0x081610B8; + void (*sub_8161280)(void) = (void*)0x08161280; + //Less calls than pokeruby, is it normal ? ResetSpriteData(); FreeAllSpritePalettes(); @@ -74,11 +74,11 @@ void sub_81606A0(void) //CB2_InitLearnMove (&gUnknown_0203BC38)[4] = 0; sub_8161280(); - LoadSpriteSheet(&gUnknown_085CEBB0); - LoadSpritePalette(&gUnknown_085CEBB8); + LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); + LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); sub_81610B8(); ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); FillPalette(0, 0, 2); - SetMainCallback2(sub_816082C); + SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); } From 17b9f5d892ad34e4af3b407e2ee44a83506ee2f3 Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Thu, 29 Mar 2018 15:46:10 +0200 Subject: [PATCH 04/21] Fix compile error --- asm/learn_move.s | 4 ++-- include/learn_move.h | 6 +++--- ld_script.txt | 1 + src/learn_move.c | 16 +++++++++++++++- 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/asm/learn_move.s b/asm/learn_move.s index 1faff5637..ab3c84ec2 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -82,7 +82,7 @@ sub_81606A0: @ 81606A0 str r0, [r6] ldr r1, =gSpecialVar_0x8004 ldrh r1, [r1] - adds r0, 0x44 partymon + adds r0, 0x44 movs r5, 0 strb r1, [r0] ldr r0, =sub_8160624 @@ -129,7 +129,7 @@ sub_8160740: @ 8160740 bl ResetSpriteData bl FreeAllSpritePalettes bl ResetTasks - bl clear_scheduled_bg_copies_to_vram + bl clear_scheduled_bg_copies_to_vram // ldr r5, =gUnknown_0203BC34 movs r0, 0x8C lsls r0, 1 diff --git a/include/learn_move.h b/include/learn_move.h index da03fe5ae..ed95b6206 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -1,5 +1,5 @@ -#ifndef GUARD_LEAN_MOVE_H -#define GUARD_LEAN_MOVE_H +#ifndef GUARD_LEARN_MOVE_H +#define GUARD_LEARN_MOVE_H struct LearnMoveStruct { @@ -39,4 +39,4 @@ void sub_8160638(void); void *gUnknown_0203BC38 = (void*)0x0203BC38; -#endif //GUARD_LEAN_MOVE_H +#endif //GUARD_LEARN_MOVE_H diff --git a/ld_script.txt b/ld_script.txt index 7ead2a863..cbc58dc8d 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -210,6 +210,7 @@ SECTIONS { src/fldeff_sweetscent.o(.text); asm/battle_anim_815A0D4.o(.text); asm/learn_move.o(.text); + src/learn_move.o(.text); src/fldeff_softboiled.o(.text); src/decoration_inventory.o(.text); src/roamer.o(.text); diff --git a/src/learn_move.c b/src/learn_move.c index d75e0a460..f83707624 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -17,6 +17,7 @@ extern struct LearnMoveStruct *gUnknown_0203BC34; static struct LearnMoveStruct *sLearnMoveStruct; static void sub_8160664(u8 taskId); void sub_81606A0(void); //CB2_InitLearnMove +void sub_8160740(void); void sub_8160624(void) //VBlankCB_LearnMove { @@ -56,7 +57,6 @@ void sub_81606A0(void) //CB2_InitLearnMove ResetTasks(); clear_scheduled_bg_copies_to_vram(); - //LearnMoveStruct** //r1 = &gSpecialVar_0x8004; //What is this global ? //u8* partyMon = gUnknown_0203BC34 + 0x44 //partyMon ? @@ -82,3 +82,17 @@ void sub_81606A0(void) //CB2_InitLearnMove FillPalette(0, 0, 2); SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); } + +/* +void sub_8160740(void) +{ + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + clear_scheduled_bg_copies_to_vram(); + + gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? + gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; + gUnknown_0203BC34->unk2C6 = gSpecialVar_0x8005; +} +*/ From 6e919da4aad94338e5d8132c3808f122bf5b7c79 Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Thu, 29 Mar 2018 20:41:29 +0200 Subject: [PATCH 05/21] Change order in ld_script.txt --- ld_script.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ld_script.txt b/ld_script.txt index cbc58dc8d..464dc7841 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -209,8 +209,8 @@ SECTIONS { src/battle_controller_safari.o(.text); src/fldeff_sweetscent.o(.text); asm/battle_anim_815A0D4.o(.text); - asm/learn_move.o(.text); src/learn_move.o(.text); + asm/learn_move.o(.text); src/fldeff_softboiled.o(.text); src/decoration_inventory.o(.text); src/roamer.o(.text); From 09e29a5cf8695cf43fe8ac18004049b07a59ccc5 Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Sun, 1 Apr 2018 18:22:09 +0200 Subject: [PATCH 06/21] Fix three functions to have the right checksum --- asm/learn_move.s | 6 +- include/learn_move.h | 2 +- src/learn_move.c | 129 +++++++++++++++++++++++++------------------ 3 files changed, 78 insertions(+), 59 deletions(-) diff --git a/asm/learn_move.s b/asm/learn_move.s index ab3c84ec2..5fd507c2d 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -67,7 +67,6 @@ _08160688: thumb_func_end sub_8160664 */ -/* thumb_func_start sub_81606A0 sub_81606A0: @ 81606A0 push {r4-r6,lr} @@ -121,7 +120,6 @@ sub_81606A0: @ 81606A0 bx r0 .pool thumb_func_end sub_81606A0 -*/ thumb_func_start sub_8160740 sub_8160740: @ 8160740 @@ -148,7 +146,7 @@ sub_8160740: @ 8160740 adds r0, 0x45 strb r1, [r0] ldr r0, =sub_8160624 - bl SetVBlankCallback + bl SetVBlankCallback // bl sub_81607EC ldr r4, =gUnknown_0203BC38 ldrb r0, [r4, 0x4] @@ -157,7 +155,7 @@ sub_8160740: @ 8160740 ldr r0, =gUnknown_085CEBB0 bl LoadSpriteSheet ldr r0, =gUnknown_085CEBB8 - bl LoadSpritePalette + bl LoadSpritePalette // bl sub_81610B8 ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r4] diff --git a/include/learn_move.h b/include/learn_move.h index ed95b6206..7779e85a0 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -37,6 +37,6 @@ void sub_8160638(void); //const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526}; //const struct SpriteSheet gUnknown_085CEBB0 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525}; -void *gUnknown_0203BC38 = (void*)0x0203BC38; +u8 *gUnknown_0203BC38 = (void*)0x0203BC38; #endif //GUARD_LEARN_MOVE_H diff --git a/src/learn_move.c b/src/learn_move.c index f83707624..faa73a2d0 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -30,7 +30,7 @@ void sub_8160638(void) //TeachMoveTutorMove { ScriptContext2_Enable(); CreateTask(sub_8160664, 0xA); - BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); } void sub_8160664(u8 taskId) @@ -43,56 +43,77 @@ void sub_8160664(u8 taskId) } } -void sub_81606A0(void) //CB2_InitLearnMove -{ - //FIXME - void (*sub_81607EC)(void) = (void*)0x081607EC; - void (*sub_81D2824)(void*) = (void*)0x081D2824; - void (*sub_81610B8)(void) = (void*)0x081610B8; - void (*sub_8161280)(void) = (void*)0x08161280; - - //Less calls than pokeruby, is it normal ? - ResetSpriteData(); - FreeAllSpritePalettes(); - ResetTasks(); - clear_scheduled_bg_copies_to_vram(); - - //LearnMoveStruct** - //r1 = &gSpecialVar_0x8004; //What is this global ? - //u8* partyMon = gUnknown_0203BC34 + 0x44 //partyMon ? - //*partyMon = r1; - gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? - gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; - - SetVBlankCallback(sub_8160624); - sub_81607EC(); - sub_81D2824(0); - - //gUnknown_0203BC38 ? - (&gUnknown_0203BC38)[0] = 0; - (&gUnknown_0203BC38)[2] = 0; - (&gUnknown_0203BC38)[4] = 0; - - sub_8161280(); - LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); - LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); - sub_81610B8(); - - ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); - FillPalette(0, 0, 2); - SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); -} - -/* -void sub_8160740(void) -{ - ResetSpriteData(); - FreeAllSpritePalettes(); - ResetTasks(); - clear_scheduled_bg_copies_to_vram(); - - gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? - gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; - gUnknown_0203BC34->unk2C6 = gSpecialVar_0x8005; -} -*/ +// void sub_81606A0(void) //CB2_InitLearnMove +// { +// //FIXME +// void (*sub_81607EC)(void) = (void*)0x081607EC; +// void (*sub_81D2824)(u16) = (void*)0x081D2824; +// void (*sub_81610B8)(void) = (void*)0x081610B8; +// void (*sub_8161280)(void) = (void*)0x08161280; +// +// //Less calls than pokeruby, is it normal ? +// ResetSpriteData(); +// FreeAllSpritePalettes(); +// ResetTasks(); +// clear_scheduled_bg_copies_to_vram(); +// +// //LearnMoveStruct** +// //r1 = &gSpecialVar_0x8004; //What is this global ? +// //u8* partyMon = gUnknown_0203BC34 + 0x44 //partyMon ? +// //*partyMon = r1; +// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? +// gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; +// +// SetVBlankCallback(sub_8160624); +// sub_81607EC(); +// sub_81D2824(0); +// +// //gUnknown_0203BC38 ? +// (gUnknown_0203BC38)[0] = 0; +// (gUnknown_0203BC38)[2] = 0; +// (gUnknown_0203BC38)[4] = 0; +// +// sub_8161280(); +// LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); +// LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); +// sub_81610B8(); +// +// ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); +// FillPalette(0, 0, 2); +// SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); +// } +// +// void sub_8160740(void) +// { +// void (*sub_81607EC)(void) = (void*)0x081607EC; +// void (*sub_81D2824)(u16) = (void*)0x081D2824; +// void (*sub_81610B8)(void) = (void*)0x081610B8; +// void (*sub_8161280)(void) = (void*)0x08161280; +// +// u8 data; +// +// ResetSpriteData(); +// FreeAllSpritePalettes(); +// ResetTasks(); +// clear_scheduled_bg_copies_to_vram(); +// +// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? +// gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; //gUnknown_0203BC34 + 68 +// gUnknown_0203BC34->unk2C6 = gSpecialVar_0x8005; //gUnknown_0203BC34 + 69 +// +// SetVBlankCallback(sub_8160624); +// sub_81607EC(); +// +// //gUnknown_0203BC38 ? +// sub_81D2824(*((u8*)&gUnknown_0203BC38 + 4)); +// sub_8161280(); +// +// LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); +// LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); +// +// data = ListMenuInit(&gMultiuseListMenuTemplate, *gUnknown_0203BC38, *((u8*)gUnknown_0203BC38 + 2)); +// *(u8*)(gUnknown_0203BC34 + 274) = data; +// FillPalette(0, 0, 2); +// SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); +// } +// */ From b2e8ee836d6334e525df3163d7b018b64f68ec95 Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Mon, 2 Apr 2018 20:06:40 +0200 Subject: [PATCH 07/21] sub_81607EC and sub_816082C --- asm/learn_move.s | 4 ++ include/learn_move.h | 9 +++- ld_script.txt | 1 + src/learn_move.c | 100 ++++++++++++++++++++++++++++++++----------- sym_ewram.txt | 11 ++--- 5 files changed, 90 insertions(+), 35 deletions(-) diff --git a/asm/learn_move.s b/asm/learn_move.s index 5fd507c2d..4f0a6abb4 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -178,6 +178,7 @@ sub_8160740: @ 8160740 .pool thumb_func_end sub_8160740 +/* thumb_func_start sub_81607EC sub_81607EC: @ 81607EC push {lr} @@ -204,7 +205,9 @@ sub_81607EC: @ 81607EC bx r0 .pool thumb_func_end sub_81607EC +*/ +/* thumb_func_start sub_816082C sub_816082C: @ 816082C push {lr} @@ -217,6 +220,7 @@ sub_816082C: @ 816082C pop {r0} bx r0 thumb_func_end sub_816082C +*/ thumb_func_start sub_816084C sub_816084C: @ 816084C diff --git a/include/learn_move.h b/include/learn_move.h index 7779e85a0..6ab2ba6f4 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -1,6 +1,7 @@ #ifndef GUARD_LEARN_MOVE_H #define GUARD_LEARN_MOVE_H +//this struct is probably wrong struct LearnMoveStruct { u8 state; @@ -26,7 +27,9 @@ struct LearnMoveStruct u8 unk2C6; }; -struct LearnMoveStruct *gUnknown_0203BC34 = NULL; +//struct LearnMoveStruct *gUnknown_0203BC34 = NULL; + +//extern u8 *gUnknown_0203BC34; void sub_8160624(void); void sub_8160638(void); @@ -37,6 +40,8 @@ void sub_8160638(void); //const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526}; //const struct SpriteSheet gUnknown_085CEBB0 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525}; -u8 *gUnknown_0203BC38 = (void*)0x0203BC38; +//u8 *gUnknown_0203BC38 = (void*)0x0203BC38; +//extern u8 gUnknown_0203BC38[8]; +//u8 gUnknown_0203BC38; #endif //GUARD_LEARN_MOVE_H diff --git a/ld_script.txt b/ld_script.txt index 464dc7841..ac1c80c22 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -490,6 +490,7 @@ SECTIONS { src/battle_controller_safari.o(.rodata); data/battle_anim_815A0D4.o(.rodata); data/learn_move.o(.rodata); + src/learn_move.o(.rodata); src/roamer.o(.rodata); data/battle_tower.o(.rodata); src/use_pokeblock.o(.rodata); diff --git a/src/learn_move.c b/src/learn_move.c index faa73a2d0..0f5063fae 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -5,20 +5,34 @@ #include "sprite.h" #include "palette.h" #include "menu.h" +#include "menu_helpers.h" #include "list_menu.h" #include "malloc.h" #include "field_screen.h" #include "event_data.h" +#include "bg.h" +#include "gpu_regs.h" #include "learn_move.h" -extern void (*gFieldCallback)(void); -extern struct LearnMoveStruct *gUnknown_0203BC34; +EWRAM_DATA u8 *gUnknown_0203BC34 = 0; +EWRAM_DATA u8 gUnknown_0203BC38[8] = {0}; + +extern void (*gFieldCallback)(void); +extern const struct SpritePalette gUnknown_085CEBB8; +extern const struct SpriteSheet gUnknown_085CEBB0; +extern const struct BgTemplate gUnknown_085CEC28; +extern void sub_81D2824(u16); +//extern struct LearnMoveStruct *gUnknown_0203BC34; + +//static struct LearnMoveStruct *sLearnMoveStruct; -static struct LearnMoveStruct *sLearnMoveStruct; static void sub_8160664(u8 taskId); void sub_81606A0(void); //CB2_InitLearnMove void sub_8160740(void); +void sub_81607EC(void); +void sub_816082C(void); + void sub_8160624(void) //VBlankCB_LearnMove { LoadOam(); @@ -45,12 +59,9 @@ void sub_8160664(u8 taskId) // void sub_81606A0(void) //CB2_InitLearnMove // { -// //FIXME -// void (*sub_81607EC)(void) = (void*)0x081607EC; -// void (*sub_81D2824)(u16) = (void*)0x081D2824; -// void (*sub_81610B8)(void) = (void*)0x081610B8; -// void (*sub_8161280)(void) = (void*)0x08161280; -// +// //AGBPrint("test\n"); +// //AGBPrintFlush(); +// //NoCashGBAPrint("test\n"); // //Less calls than pokeruby, is it normal ? // ResetSpriteData(); // FreeAllSpritePalettes(); @@ -58,34 +69,46 @@ void sub_8160664(u8 taskId) // clear_scheduled_bg_copies_to_vram(); // // //LearnMoveStruct** -// //r1 = &gSpecialVar_0x8004; //What is this global ? -// //u8* partyMon = gUnknown_0203BC34 + 0x44 //partyMon ? -// //*partyMon = r1; // gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? -// gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; +// //gUnknown_0203BC34->movesToLearn[0] = gSpecialVar_0x8004; +// ((u8*)gUnknown_0203BC34)[68] = gSpecialVar_0x8004; // // SetVBlankCallback(sub_8160624); +// //SetVBlankCallback(/*FIXME sub_8160624*/ (void()(u16))0x081D2824); // sub_81607EC(); // sub_81D2824(0); // // //gUnknown_0203BC38 ? +// // weird instruction // (gUnknown_0203BC38)[0] = 0; // (gUnknown_0203BC38)[2] = 0; // (gUnknown_0203BC38)[4] = 0; // -// sub_8161280(); -// LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); -// LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); -// sub_81610B8(); +// //FIXME +// //sub_8161280(); +// __asm__("bl sub_8161280"); // -// ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); +// //LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); +// //LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); +// LoadSpriteSheet(&gUnknown_085CEBB0); +// LoadSpritePalette(&gUnknown_085CEBB8); +// //sub_81610B8(); +// //FIXME +// __asm__("bl sub_81610B8"); +// +// ((u8*)gUnknown_0203BC34)[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]); // FillPalette(0, 0, 2); -// SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); +// //SetMainCallback2(sub_816082C/*(void*)0x0816082C()*/); +// //SetMainCallback2(sub_816082C/*(void*)0x0816082C()*/); +// //FIXME +// __asm__( +// "ldr r0, =sub_816082C", +// "bl SetMainCallback2" +// ); // } -// + // void sub_8160740(void) // { -// void (*sub_81607EC)(void) = (void*)0x081607EC; // void (*sub_81D2824)(u16) = (void*)0x081D2824; // void (*sub_81610B8)(void) = (void*)0x081610B8; // void (*sub_8161280)(void) = (void*)0x08161280; @@ -105,15 +128,42 @@ void sub_8160664(u8 taskId) // sub_81607EC(); // // //gUnknown_0203BC38 ? -// sub_81D2824(*((u8*)&gUnknown_0203BC38 + 4)); +// sub_81D2824(gUnknown_0203BC38[4]); // sub_8161280(); // -// LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); -// LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); +// LoadSpriteSheet(&gUnknown_085CEBB0); +// LoadSpritePalette(&gUnknown_085CEBB8); +// //LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); +// //LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); // // data = ListMenuInit(&gMultiuseListMenuTemplate, *gUnknown_0203BC38, *((u8*)gUnknown_0203BC38 + 2)); // *(u8*)(gUnknown_0203BC34 + 274) = data; // FillPalette(0, 0, 2); // SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); // } -// */ + +void sub_81607EC(void) +{ + ResetVramOamAndBgCntRegs(); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, &gUnknown_085CEC28, 2); + ResetAllBgsCoordinates(); + SetGpuReg(0, 0x1040); + ShowBg(0); + ShowBg(1); + SetGpuReg(0x50, 0); +} +void sub_816082C(void) +{ + //FIXME + //sub_8160868(); + //void(*sub_8160868)(void) = (void (*)(void))0x08160868; + //sub_8160868(); + __asm__("bl sub_8160868"); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); + +} diff --git a/sym_ewram.txt b/sym_ewram.txt index 96862ccd5..b88df9b0f 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -784,19 +784,14 @@ gUnknown_0203ABB8: @ 203ABB8 .space 0x4 .include "src/save.o" - + .space 0x4 /*unused var?*/ .include "src/mystery_event_script.o" -gUnknown_0203BC34: @ 203BC34 - .space 0x4 - -gUnknown_0203BC38: @ 203BC38 - .space 0x8 - + .include "src/learn_move.o" .include "src/decoration_inventory.o" - .include "src/roamer.o" + .include "src/roamer.o" gUnknown_0203BC88: @ 203BC88 .space 0x4 From 2f96282c7f56ae90bc62b2710c8430abd2b345f3 Mon Sep 17 00:00:00 2001 From: Edouard Veyrier Date: Tue, 3 Apr 2018 00:07:55 +0200 Subject: [PATCH 08/21] cleaner --- asm/learn_move.s | 10 ++- include/learn_move.h | 40 ----------- src/learn_move.c | 154 +++++++++++++++++-------------------------- 3 files changed, 69 insertions(+), 135 deletions(-) diff --git a/asm/learn_move.s b/asm/learn_move.s index 4f0a6abb4..5500f5a58 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -67,6 +67,7 @@ _08160688: thumb_func_end sub_8160664 */ +/* thumb_func_start sub_81606A0 sub_81606A0: @ 81606A0 push {r4-r6,lr} @@ -120,14 +121,16 @@ sub_81606A0: @ 81606A0 bx r0 .pool thumb_func_end sub_81606A0 +*/ +/* thumb_func_start sub_8160740 sub_8160740: @ 8160740 push {r4,r5,lr} bl ResetSpriteData bl FreeAllSpritePalettes bl ResetTasks - bl clear_scheduled_bg_copies_to_vram // + bl clear_scheduled_bg_copies_to_vram ldr r5, =gUnknown_0203BC34 movs r0, 0x8C lsls r0, 1 @@ -146,7 +149,7 @@ sub_8160740: @ 8160740 adds r0, 0x45 strb r1, [r0] ldr r0, =sub_8160624 - bl SetVBlankCallback // + bl SetVBlankCallback bl sub_81607EC ldr r4, =gUnknown_0203BC38 ldrb r0, [r4, 0x4] @@ -155,7 +158,7 @@ sub_8160740: @ 8160740 ldr r0, =gUnknown_085CEBB0 bl LoadSpriteSheet ldr r0, =gUnknown_085CEBB8 - bl LoadSpritePalette // + bl LoadSpritePalette bl sub_81610B8 ldr r0, =gMultiuseListMenuTemplate ldrh r1, [r4] @@ -177,6 +180,7 @@ sub_8160740: @ 8160740 bx r0 .pool thumb_func_end sub_8160740 +*/ /* thumb_func_start sub_81607EC diff --git a/include/learn_move.h b/include/learn_move.h index 6ab2ba6f4..034d689d4 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -1,47 +1,7 @@ #ifndef GUARD_LEARN_MOVE_H #define GUARD_LEARN_MOVE_H -//this struct is probably wrong -struct LearnMoveStruct -{ - u8 state; - u8 filler1; - u8 unk2; - u8 spriteIDs[20]; - u8 filler17[1]; - u8 unk18; - u8 unk19; - u8 numMenuChoices; - u8 menuSelection; - u8 unk1C; - bool8 unk1D; - u8 unk1E; - u8 filler1F; - /*0x020*/ u16 movesToLearn[20]; - u8 filler48[0x52-0x48]; - u8 moveNames[6][0x19]; - u8 fillerE8[0x2C3-0xE8]; - bool8 unk2C3; - bool8 showContestInfo; - /*0x2C5*/ u8 partyMon; - u8 unk2C6; -}; - -//struct LearnMoveStruct *gUnknown_0203BC34 = NULL; - -//extern u8 *gUnknown_0203BC34; - void sub_8160624(void); void sub_8160638(void); -// Ew, just copied from pokeruby... -//const u16 gDexArrows_Pal[] = INCBIN_U16("graphics/pokedex/arrows.gbapal"); -//const u8 gDexArrows_Gfx[] = INCBIN_U8("graphics/pokedex/arrows.4bpp"); -//const struct SpritePalette gUnknown_085CEBB8 = {gDexArrows_Pal, 5526}; -//const struct SpriteSheet gUnknown_085CEBB0 = {gDexArrows_Gfx, sizeof(gDexArrows_Gfx), 5525}; - -//u8 *gUnknown_0203BC38 = (void*)0x0203BC38; -//extern u8 gUnknown_0203BC38[8]; -//u8 gUnknown_0203BC38; - #endif //GUARD_LEARN_MOVE_H diff --git a/src/learn_move.c b/src/learn_move.c index 0f5063fae..addae6a38 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -22,14 +22,15 @@ extern const struct SpritePalette gUnknown_085CEBB8; extern const struct SpriteSheet gUnknown_085CEBB0; extern const struct BgTemplate gUnknown_085CEC28; extern void sub_81D2824(u16); -//extern struct LearnMoveStruct *gUnknown_0203BC34; -//static struct LearnMoveStruct *sLearnMoveStruct; +void sub_8160868(void); +void sub_8161280(void); +void sub_81610B8(void); +void sub_816082C(void); static void sub_8160664(u8 taskId); void sub_81606A0(void); //CB2_InitLearnMove void sub_8160740(void); - void sub_81607EC(void); void sub_816082C(void); @@ -57,90 +58,63 @@ void sub_8160664(u8 taskId) } } -// void sub_81606A0(void) //CB2_InitLearnMove -// { -// //AGBPrint("test\n"); -// //AGBPrintFlush(); -// //NoCashGBAPrint("test\n"); -// //Less calls than pokeruby, is it normal ? -// ResetSpriteData(); -// FreeAllSpritePalettes(); -// ResetTasks(); -// clear_scheduled_bg_copies_to_vram(); -// -// //LearnMoveStruct** -// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? -// //gUnknown_0203BC34->movesToLearn[0] = gSpecialVar_0x8004; -// ((u8*)gUnknown_0203BC34)[68] = gSpecialVar_0x8004; -// -// SetVBlankCallback(sub_8160624); -// //SetVBlankCallback(/*FIXME sub_8160624*/ (void()(u16))0x081D2824); -// sub_81607EC(); -// sub_81D2824(0); -// -// //gUnknown_0203BC38 ? -// // weird instruction -// (gUnknown_0203BC38)[0] = 0; -// (gUnknown_0203BC38)[2] = 0; -// (gUnknown_0203BC38)[4] = 0; -// -// //FIXME -// //sub_8161280(); -// __asm__("bl sub_8161280"); -// -// //LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); -// //LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); -// LoadSpriteSheet(&gUnknown_085CEBB0); -// LoadSpritePalette(&gUnknown_085CEBB8); -// //sub_81610B8(); -// //FIXME -// __asm__("bl sub_81610B8"); -// -// ((u8*)gUnknown_0203BC34)[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]); -// FillPalette(0, 0, 2); -// //SetMainCallback2(sub_816082C/*(void*)0x0816082C()*/); -// //SetMainCallback2(sub_816082C/*(void*)0x0816082C()*/); -// //FIXME -// __asm__( -// "ldr r0, =sub_816082C", -// "bl SetMainCallback2" -// ); -// } +// Doesn't match +void sub_81606A0(void) //CB2_InitLearnMove +{ + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + clear_scheduled_bg_copies_to_vram(); -// void sub_8160740(void) -// { -// void (*sub_81D2824)(u16) = (void*)0x081D2824; -// void (*sub_81610B8)(void) = (void*)0x081610B8; -// void (*sub_8161280)(void) = (void*)0x08161280; -// -// u8 data; -// -// ResetSpriteData(); -// FreeAllSpritePalettes(); -// ResetTasks(); -// clear_scheduled_bg_copies_to_vram(); -// -// gUnknown_0203BC34 = AllocZeroed(0x118);//gUnknown_0203BC34 is a global pointer to LearnMoveStruct ? -// gUnknown_0203BC34->partyMon = gSpecialVar_0x8004; //gUnknown_0203BC34 + 68 -// gUnknown_0203BC34->unk2C6 = gSpecialVar_0x8005; //gUnknown_0203BC34 + 69 -// -// SetVBlankCallback(sub_8160624); -// sub_81607EC(); -// -// //gUnknown_0203BC38 ? -// sub_81D2824(gUnknown_0203BC38[4]); -// sub_8161280(); -// -// LoadSpriteSheet(&gUnknown_085CEBB0); -// LoadSpritePalette(&gUnknown_085CEBB8); -// //LoadSpriteSheet(/*FIXME &gUnknown_085CEBB0*/(void*)0x085CEBB0); -// //LoadSpritePalette(/*FIXME &gUnknown_085CEBB8*/(void*)0x085CEBB8); -// -// data = ListMenuInit(&gMultiuseListMenuTemplate, *gUnknown_0203BC38, *((u8*)gUnknown_0203BC38 + 2)); -// *(u8*)(gUnknown_0203BC34 + 274) = data; -// FillPalette(0, 0, 2); -// SetMainCallback2(/*FIXME sub_816082C*/(void*)0x0816082C); -// } + gUnknown_0203BC34 = AllocZeroed(0x118); //gUnknown_0203BC34 ? + gUnknown_0203BC34[68] = gSpecialVar_0x8004; + + SetVBlankCallback(sub_8160624); + sub_81607EC(); + sub_81D2824(0); + + //gUnknown_0203BC38 ? + gUnknown_0203BC38[0] = 0; + gUnknown_0203BC38[2] = 0; + gUnknown_0203BC38[4] = 0; + + sub_8161280(); + + LoadSpriteSheet(&gUnknown_085CEBB0); + LoadSpritePalette(&gUnknown_085CEBB8); + sub_81610B8(); + + gUnknown_0203BC34[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]); + FillPalette(0, 0, 2); + SetMainCallback2(sub_816082C); +} + +// Doesn't match +void sub_8160740(void) +{ + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + clear_scheduled_bg_copies_to_vram(); + + gUnknown_0203BC34 = AllocZeroed(0x118); //gUnknown_0203BC34 ? + gUnknown_0203BC34[68] = gSpecialVar_0x8004; + gUnknown_0203BC34[69] = gSpecialVar_0x8005; + + SetVBlankCallback(sub_8160624); + sub_81607EC(); + + //gUnknown_0203BC38 ? + sub_81D2824(gUnknown_0203BC38[4]); + sub_8161280(); + + LoadSpriteSheet(&gUnknown_085CEBB0); + LoadSpritePalette(&gUnknown_085CEBB8); + + gUnknown_0203BC34[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]); + FillPalette(0, 0, 2); + SetMainCallback2(sub_816082C); +} void sub_81607EC(void) { @@ -153,17 +127,13 @@ void sub_81607EC(void) ShowBg(1); SetGpuReg(0x50, 0); } + void sub_816082C(void) { - //FIXME - //sub_8160868(); - //void(*sub_8160868)(void) = (void (*)(void))0x08160868; - //sub_8160868(); - __asm__("bl sub_8160868"); + sub_8160868(); RunTasks(); AnimateSprites(); BuildOamBuffer(); do_scheduled_bg_tilemap_copies_to_vram(); UpdatePaletteFade(); - } From 2dd5fc23d4d34890e17a412ae9ad80e23c7aa50d Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Sun, 12 Aug 2018 12:54:07 -0700 Subject: [PATCH 09/21] Prepare learn_move for merge --- asm/battle_frontier_2.s | 2 +- asm/easy_chat.s | 8 +- asm/learn_move.s | 1652 -------------------- asm/party_menu.s | 26 +- asm/pokemon_storage_system.s | 8 +- asm/pokemon_summary_screen.s | 2 +- asm/rom_8011DC0.s | 8 +- asm/script_menu.s | 4 +- asm/shop.s | 2 +- asm/slot_machine.s | 2 +- asm/trade.s | 6 +- asm/use_pokeblock.s | 2 +- data/learn_move.s | 93 -- data/maps/FallarborTown_House2/scripts.inc | 2 +- data/specials.inc | 2 +- include/learn_move.h | 4 +- include/list_menu.h | 2 + include/menu.h | 4 +- include/pokemon_summary_screen.h | 1 + include/pokenav.h | 5 +- include/strings.h | 10 + ld_script.txt | 1 - src/battle_script_commands.c | 4 +- src/berry_blender.c | 2 +- src/clear_save_data_screen.c | 2 +- src/egg_hatch.c | 2 +- src/evolution_scene.c | 8 +- src/item_menu.c | 2 +- src/learn_move.c | 877 +++++++++-- src/main_menu.c | 4 +- src/menu.c | 8 +- src/menu_helpers.c | 2 +- src/player_pc.c | 4 +- src/pokeblock.c | 2 +- src/pokemon_summary_screen.c | 2 +- src/secret_base.c | 2 +- src/start_menu.c | 6 +- src/starter_choose.c | 2 +- src/wallclock.c | 2 +- 39 files changed, 875 insertions(+), 1902 deletions(-) delete mode 100644 data/learn_move.s diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 38e0d2e62..8f2d7b0e0 100644 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -11771,7 +11771,7 @@ sub_81A070C: @ 81A070C ldrsh r0, [r4, r1] cmp r0, 0 bne _081A0730 - bl ProcessMenuInputNoWrapAround + bl Menu_ProcessInputNoWrapAround b _081A0734 .pool _081A0730: diff --git a/asm/easy_chat.s b/asm/easy_chat.s index 4ee0fa2ae..dadc5bda4 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -1635,7 +1635,7 @@ _0811AF86: thumb_func_start sub_811AF8C sub_811AF8C: @ 811AF8C push {lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -1684,7 +1684,7 @@ _0811AFE6: thumb_func_start sub_811AFEC sub_811AFEC: @ 811AFEC push {r4,lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -1727,7 +1727,7 @@ _0811B03A: thumb_func_start sub_811B040 sub_811B040: @ 811B040 push {lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -1832,7 +1832,7 @@ sub_811B0E8: @ 811B0E8 thumb_func_start sub_811B0F8 sub_811B0F8: @ 811B0F8 push {r4,lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 diff --git a/asm/learn_move.s b/asm/learn_move.s index 2bd50789c..2428f2984 100644 --- a/asm/learn_move.s +++ b/asm/learn_move.s @@ -5,1656 +5,4 @@ .text -/* - thumb_func_start sub_8160624 -sub_8160624: @ 8160624 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8160624 -*/ - -/* - thumb_func_start sub_8160638 -sub_8160638: @ 8160638 - push {lr} - sub sp, 0x4 - bl ScriptContext2_Enable - ldr r0, =sub_8160664 - movs r1, 0xA - bl CreateTask - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8160638 -*/ - -/* - thumb_func_start sub_8160664 -sub_8160664: @ 8160664 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08160688 - ldr r0, =sub_81606A0 - bl SetMainCallback2 - ldr r1, =gFieldCallback - ldr r0, =sub_80AF168 - str r0, [r1] - adds r0, r4, 0 - bl DestroyTask -_08160688: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8160664 -*/ - -/* - thumb_func_start sub_81606A0 -sub_81606A0: @ 81606A0 - push {r4-r6,lr} - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - bl clear_scheduled_bg_copies_to_vram - ldr r6, =gUnknown_0203BC34 - movs r0, 0x8C - lsls r0, 1 - bl AllocZeroed - str r0, [r6] - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - adds r0, 0x44 - movs r5, 0 - strb r1, [r0] - ldr r0, =sub_8160624 - bl SetVBlankCallback - bl sub_81607EC - movs r0, 0 - bl sub_81D2824 - ldr r4, =gUnknown_0203BC38 - movs r0, 0 - strh r5, [r4] - strh r5, [r4, 0x2] - strb r0, [r4, 0x4] - bl sub_8161280 - ldr r0, =gUnknown_085CEBB0 - bl LoadSpriteSheet - ldr r0, =gUnknown_085CEBB8 - bl LoadSpritePalette - bl sub_81610B8 - ldr r0, =gMultiuseListMenuTemplate - ldrh r1, [r4] - ldrh r2, [r4, 0x2] - bl ListMenuInit - ldr r1, [r6] - movs r2, 0x89 - lsls r2, 1 //0x112 - adds r1, r2 //partymon + 0x112 - strb r0, [r1] - movs r0, 0 - movs r1, 0 - movs r2, 0x2 - bl FillPalette - ldr r0, =sub_816082C - bl SetMainCallback2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81606A0 -*/ - -/* - thumb_func_start sub_8160740 -sub_8160740: @ 8160740 - push {r4,r5,lr} - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - bl clear_scheduled_bg_copies_to_vram - ldr r5, =gUnknown_0203BC34 - movs r0, 0x8C - lsls r0, 1 - bl AllocZeroed - str r0, [r5] - movs r1, 0x1C - strb r1, [r0] - ldr r0, [r5] - ldr r1, =gSpecialVar_0x8004 - ldrh r1, [r1] - adds r0, 0x44 - strb r1, [r0] - ldr r0, [r5] - ldr r1, =gSpecialVar_0x8005 - ldrh r1, [r1] - adds r0, 0x45 - strb r1, [r0] - ldr r0, =sub_8160624 - bl SetVBlankCallback - bl sub_81607EC - ldr r4, =gUnknown_0203BC38 - ldrb r0, [r4, 0x4] - bl sub_81D2824 - bl sub_8161280 - ldr r0, =gUnknown_085CEBB0 - bl LoadSpriteSheet - ldr r0, =gUnknown_085CEBB8 - bl LoadSpritePalette - bl sub_81610B8 - ldr r0, =gMultiuseListMenuTemplate - ldrh r1, [r4] - ldrh r2, [r4, 0x2] - bl ListMenuInit - ldr r1, [r5] - movs r2, 0x89 - lsls r2, 1 - adds r1, r2 - strb r0, [r1] - movs r0, 0 - movs r1, 0 - movs r2, 0x2 - bl FillPalette - ldr r0, =sub_816082C - bl SetMainCallback2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8160740 -*/ - -/* - thumb_func_start sub_81607EC -sub_81607EC: @ 81607EC - push {lr} - bl ResetVramOamAndBgCntRegs - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085CEC28 - movs r0, 0 - movs r2, 0x2 - bl InitBgsFromTemplates - bl ResetAllBgsCoordinates - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_81607EC -*/ - -/* - thumb_func_start sub_816082C -sub_816082C: @ 816082C - push {lr} - bl sub_8160868 - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl do_scheduled_bg_tilemap_copies_to_vram - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_816082C -*/ - - thumb_func_start sub_816084C -sub_816084C: @ 816084C - push {r4,lr} - adds r1, r0, 0 - ldr r4, =gStringVar4 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - bl sub_81D2BF4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_816084C - - thumb_func_start sub_8160868 -sub_8160868: @ 8160868 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - ldr r1, =gUnknown_0203BC34 - ldr r0, [r1] - ldrb r0, [r0] - adds r7, r1, 0 - cmp r0, 0x21 - bls _0816087E - b _08160E8A -_0816087E: - lsls r0, 2 - ldr r1, =_08160890 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08160890: - .4byte _08160918 - .4byte _08160932 - .4byte _0816094C - .4byte _08160954 - .4byte _0816095C - .4byte _08160964 - .4byte _08160980 - .4byte _08160E8A - .4byte _08160988 - .4byte _081609A8 - .4byte _08160E8A - .4byte _08160E8A - .4byte _08160A44 - .4byte _08160A64 - .4byte _08160CB8 - .4byte _08160CD8 - .4byte _08160AB8 - .4byte _08160AD0 - .4byte _08160AEC - .4byte _08160C1C - .4byte _08160C48 - .4byte _08160C98 - .4byte _08160CA6 - .4byte _08160E8A - .4byte _08160B2C - .4byte _08160B60 - .4byte _08160B80 - .4byte _08160BDC - .4byte _08160CFC - .4byte _08160D48 - .4byte _08160E0C - .4byte _08160E38 - .4byte _08160E58 - .4byte _08160E70 -_08160918: - ldr r1, [r7] - ldrb r0, [r1] - adds r0, 0x1 - movs r4, 0 - strb r0, [r1] - movs r0, 0 - bl render_previous_quest_text - movs r0, 0x1 - negs r0, r0 - str r4, [sp] - movs r1, 0 - b _08160CAE -_08160932: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08160940 - b _08160E8A -_08160940: - ldr r1, [r7] - movs r0, 0x4 - b _08160E88 - .pool -_0816094C: - ldr r1, [r7] - ldrb r0, [r1] - adds r0, 0x1 - b _08160E88 -_08160954: - movs r0, 0 - bl render_previous_quest_text - b _0816096A -_0816095C: - movs r0, 0 - bl sub_8160F50 - b _08160E8A -_08160964: - movs r0, 0 - bl sub_8161074 -_0816096A: - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - bl sub_81611AC - b _08160E8A - .pool -_08160980: - movs r0, 0x1 - bl sub_8160F50 - b _08160E8A -_08160988: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - beq _08160994 - b _08160E8A -_08160994: - bl sub_81D2C50 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _08160E88 - .pool -_081609A8: - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - bne _08160A0A - ldr r5, =gUnknown_0203BC34 - ldr r0, [r5] - adds r0, 0x44 - ldrb r1, [r0] - movs r0, 0x64 - adds r4, r1, 0 - muls r4, r0 - ldr r0, =gPlayerParty - adds r4, r0 - bl sub_8161054 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - adds r0, r4, 0 - bl GiveMoveToMon - lsls r0, 16 - ldr r1, =0xffff0000 - cmp r0, r1 - beq _08160A04 - ldr r0, =gText_PkmnLearnedMove4 - bl sub_816084C - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x1 - strh r0, [r1] - ldr r1, [r5] - movs r0, 0x1F - b _08160E88 - .pool -_08160A04: - ldr r1, [r5] - movs r0, 0x10 - b _08160E88 -_08160A0A: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08160A18 - cmp r1, 0x1 - beq _08160A18 - b _08160E8A -_08160A18: - ldr r0, =gUnknown_0203BC38 - ldrb r0, [r0, 0x4] - cmp r0, 0 - bne _08160A30 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x3 - b _08160E88 - .pool -_08160A30: - cmp r0, 0x1 - beq _08160A36 - b _08160E8A -_08160A36: - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x5 - b _08160E88 - .pool -_08160A44: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - beq _08160A50 - b _08160E8A -_08160A50: - bl sub_81D2C50 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _08160E88 - .pool -_08160A64: - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - bne _08160A7C - ldr r0, =gSpecialVar_0x8004 - strh r1, [r0] - b _08160E82 - .pool -_08160A7C: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08160A8A - cmp r1, 0x1 - beq _08160A8A - b _08160E8A -_08160A8A: - ldr r0, =gUnknown_0203BC38 - ldrb r0, [r0, 0x4] - cmp r0, 0 - bne _08160AA4 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x3 - b _08160E88 - .pool -_08160AA4: - cmp r0, 0x1 - beq _08160AAA - b _08160E8A -_08160AAA: - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x5 - b _08160E88 - .pool -_08160AB8: - ldr r0, =gText_PkmnTryingToLearnMove - bl sub_816084C - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _08160E88 - .pool -_08160AD0: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - beq _08160ADC - b _08160E8A -_08160ADC: - bl sub_81D2C50 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x12 - b _08160E88 - .pool -_08160AEC: - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - bne _08160B10 - ldr r0, =gText_WhichMoveToForget2 - bl sub_816084C - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x13 - b _08160E88 - .pool -_08160B10: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08160B1E - cmp r1, 0x1 - beq _08160B1E - b _08160E8A -_08160B1E: - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x18 - b _08160E88 - .pool -_08160B2C: - ldr r4, =gStringVar2 - bl sub_8161054 - movs r1, 0xD - muls r1, r0 - ldr r0, =gMoveNames - adds r1, r0 - adds r0, r4, 0 - bl StringCopy - ldr r0, =gText_StopTryingToTeachMove - bl sub_816084C - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _08160E88 - .pool -_08160B60: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - beq _08160B6C - b _08160E8A -_08160B6C: - bl sub_81D2C50 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _08160E88 - .pool -_08160B80: - bl ProcessMenuInputNoWrap_ - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0 - bne _08160B98 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x1B - b _08160E88 - .pool -_08160B98: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08160BA6 - cmp r1, 0x1 - beq _08160BA6 - b _08160E8A -_08160BA6: - ldr r0, =gUnknown_0203BC38 - ldrb r0, [r0, 0x4] - cmp r0, 0 - bne _08160BC4 - ldr r2, =gUnknown_0203BC34 - ldr r1, [r2] - movs r0, 0x3 - strb r0, [r1] - adds r7, r2, 0 - b _08160BD0 - .pool -_08160BC4: - ldr r7, =gUnknown_0203BC34 - cmp r0, 0x1 - bne _08160BD0 - ldr r1, [r7] - movs r0, 0x5 - strb r0, [r1] -_08160BD0: - ldr r1, [r7] - movs r0, 0x10 - b _08160E88 - .pool -_08160BDC: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - beq _08160BE8 - b _08160E8A -_08160BE8: - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r0, =gUnknown_0203BC38 - ldrb r0, [r0, 0x4] - cmp r0, 0 - bne _08160C08 - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x3 - b _08160E88 - .pool -_08160C08: - cmp r0, 0x1 - beq _08160C0E - b _08160E8A -_08160C0E: - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x5 - b _08160E88 - .pool -_08160C1C: - bl sub_81D2C3C - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0 - beq _08160C2A - b _08160E8A -_08160C2A: - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x14 - strb r0, [r1] - subs r0, 0x15 - str r2, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - b _08160E8A - .pool -_08160C48: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08160C56 - b _08160E8A -_08160C56: - bl sub_8161054 - lsls r0, 16 - lsrs r0, 16 - ldr r4, =gPlayerParty - ldr r1, =gUnknown_0203BC34 - ldr r1, [r1] - adds r1, 0x44 - ldrb r1, [r1] - ldr r2, =gPlayerPartyCount - ldrb r2, [r2] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r3, =sub_8160740 - str r0, [sp] - adds r0, r4, 0 - bl sub_81BFA38 - bl sub_8160EA0 - b _08160E8A - .pool -_08160C98: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - beq _08160CA4 - b _08160E8A -_08160CA4: - b _08160E82 -_08160CA6: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] -_08160CAE: - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - b _08160E8A -_08160CB8: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - b _08160E88 - .pool -_08160CD8: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08160CE6 - b _08160E8A -_08160CE6: - bl sub_8160EA0 - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - b _08160E8A - .pool -_08160CFC: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - ldr r0, =gUnknown_0203BC38 - ldrb r0, [r0, 0x4] - cmp r0, 0 - bne _08160D30 - movs r0, 0x1 - bl render_previous_quest_text - b _08160D3A - .pool -_08160D30: - cmp r0, 0x1 - bne _08160D3A - movs r0, 0x1 - bl sub_8161074 -_08160D3A: - bl sub_8161234 - movs r0, 0x3 - movs r1, 0x2 - bl CopyWindowToVram - b _08160E8A -_08160D48: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08160D56 - b _08160E8A -_08160D56: - ldr r1, [r7] - adds r2, r1, 0 - adds r2, 0x45 - ldrb r0, [r2] - cmp r0, 0x4 - bne _08160D6C - movs r0, 0x18 - b _08160E88 - .pool -_08160D6C: - adds r0, r1, 0 - adds r0, 0x44 - ldrb r0, [r0] - movs r4, 0x64 - muls r0, r4 - ldr r5, =gPlayerParty - adds r0, r5 - ldrb r1, [r2] - adds r1, 0xD - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - ldr r2, =gStringVar3 - movs r1, 0xD - mov r8, r1 - mov r1, r8 - muls r1, r0 - ldr r6, =gMoveNames - adds r1, r6 - adds r0, r2, 0 - bl StringCopy - ldr r1, [r7] - adds r0, r1, 0 - adds r0, 0x44 - ldrb r0, [r0] - muls r0, r4 - adds r0, r5 - adds r1, 0x45 - ldrb r1, [r1] - bl RemoveMonPPBonus - ldr r0, [r7] - adds r0, 0x44 - ldrb r0, [r0] - muls r4, r0 - adds r4, r5 - bl sub_8161054 - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldr r0, [r7] - adds r0, 0x45 - ldrb r2, [r0] - adds r0, r4, 0 - bl SetMonMoveSlot - ldr r4, =gStringVar2 - bl sub_8161054 - mov r1, r8 - muls r1, r0 - adds r1, r6 - adds r0, r4, 0 - bl StringCopy - ldr r0, =gText_12AndPoof - bl sub_816084C - ldr r1, [r7] - movs r0, 0x1E - strb r0, [r1] - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x1 - strh r0, [r1] - b _08160E8A - .pool -_08160E0C: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - bne _08160E8A - ldr r0, =gText_PkmnForgotMoveAndLearnedNew - bl sub_816084C - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x1F - strb r0, [r1] - ldr r0, =0x0000016f - bl PlayFanfare - b _08160E8A - .pool -_08160E38: - bl sub_81D2C3C - lsls r0, 16 - cmp r0, 0 - bne _08160E8A - ldr r0, =0x0000016f - bl PlayFanfare - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x20 - b _08160E88 - .pool -_08160E58: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _08160E8A - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0x21 - b _08160E88 - .pool -_08160E70: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08160E8A - movs r0, 0x5 - bl PlaySE -_08160E82: - ldr r0, =gUnknown_0203BC34 - ldr r1, [r0] - movs r0, 0xE -_08160E88: - strb r0, [r1] -_08160E8A: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8160868 - - thumb_func_start sub_8160EA0 -sub_8160EA0: @ 8160EA0 - push {r4,lr} - bl sub_8161234 - ldr r4, =gUnknown_0203BC34 - ldr r0, [r4] - movs r1, 0x89 - lsls r1, 1 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gUnknown_0203BC38 - adds r2, r1, 0x2 - bl DestroyListMenuTask - bl FreeAllWindowBuffers - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] - bl ResetSpriteData - bl FreeAllSpritePalettes - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8160EA0 - - thumb_func_start render_previous_quest_text -render_previous_quest_text: @ 8160EE0 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - movs r2, 0 - ldr r6, =gSprites - ldr r4, =gUnknown_0203BC34 - movs r3, 0x4 -_08160EF0: - ldr r0, [r4] - adds r0, 0x1 - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r3 - strb r1, [r0] - adds r2, 0x1 - cmp r2, 0xF - ble _08160EF0 - cmp r5, 0 - bne _08160F38 - ldr r4, =gStringVar4 - ldr r1, =gText_TeachWhichMoveToPkmn - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl PrintTextOnWindow -_08160F38: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end render_previous_quest_text - - thumb_func_start sub_8160F50 -sub_8160F50: @ 8160F50 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r6, =gUnknown_0203BC34 - ldr r0, [r6] - movs r4, 0x89 - lsls r4, 1 - adds r0, r4 - ldrb r0, [r0] - bl ListMenuHandleInputGetItemId - adds r5, r0, 0 - ldr r0, [r6] - adds r0, r4 - ldrb r0, [r0] - ldr r4, =gUnknown_0203BC38 - adds r2, r4, 0x2 - adds r1, r4, 0 - bl ListMenuGetScrollAndRow - movs r0, 0x2 - negs r0, r0 - cmp r5, r0 - beq _08160FE4 - adds r0, 0x1 - cmp r5, r0 - bne _08161010 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0 - bne _08160F9C - bl GetLRKeysState - lsls r0, 24 - cmp r0, 0 - beq _0816103E -_08160F9C: - movs r0, 0x5 - bl PlaySE - cmp r7, 0 - bne _08160FC4 - movs r0, 0x1 - bl PutWindowTilemap - ldr r0, [r6] - movs r1, 0x5 - strb r1, [r0] - movs r0, 0x1 - strb r0, [r4, 0x4] - b _08160FD4 - .pool -_08160FC4: - movs r0, 0 - bl PutWindowTilemap - ldr r0, [r6] - movs r2, 0 - movs r1, 0x3 - strb r1, [r0] - strb r2, [r4, 0x4] -_08160FD4: - movs r0, 0x1 - bl schedule_bg_copy_tilemap_to_vram - bl sub_8161054 - bl sub_816137C - b _0816103E -_08160FE4: - movs r0, 0x5 - bl PlaySE - bl sub_8161234 - ldr r1, [r6] - movs r0, 0xC - strb r0, [r1] - ldr r4, =gStringVar4 - ldr r1, =gText_GiveUpTeachingNewMove - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - bl sub_81D2BF4 - b _0816103E - .pool -_08161010: - movs r0, 0x5 - bl PlaySE - bl sub_8161234 - ldr r1, [r6] - movs r0, 0x8 - strb r0, [r1] - ldr r0, =gStringVar2 - movs r1, 0xD - muls r1, r5 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_TeachX - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - bl sub_81D2BF4 -_0816103E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8160F50 - - thumb_func_start sub_8161054 -sub_8161054: @ 8161054 - ldr r0, =gUnknown_0203BC34 - ldr r2, [r0] - ldr r1, =gUnknown_0203BC38 - ldrh r0, [r1, 0x2] - ldrh r1, [r1] - adds r0, r1 - lsls r0, 3 - adds r2, 0x4C - adds r2, r0 - ldr r0, [r2] - bx lr - .pool - thumb_func_end sub_8161054 - - thumb_func_start sub_8161074 -sub_8161074: @ 8161074 - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _081610A6 - ldr r4, =gStringVar4 - ldr r1, =gText_TeachWhichMoveToPkmn - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x3 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x1 - str r0, [sp] - str r5, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl PrintTextOnWindow -_081610A6: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8161074 - - thumb_func_start sub_81610B8 -sub_81610B8: @ 81610B8 - push {r4-r7,lr} - ldr r2, =gUnknown_0203BC34 - ldr r0, [r2] - movs r1, 0x8A - lsls r1, 1 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r2] - ldr r2, =0x00000113 - adds r1, r0, r2 - movs r0, 0x1 - negs r0, r0 - strb r0, [r1] - bl sub_81611AC - movs r4, 0 - ldr r5, =gUnknown_085CEC10 -_081610DC: - adds r2, r4, 0 - cmp r4, 0 - bge _081610E4 - adds r2, r4, 0x3 -_081610E4: - asrs r2, 2 - lsls r1, r2, 2 - subs r1, r4, r1 - lsls r1, 19 - movs r0, 0xD0 - lsls r0, 15 - adds r1, r0 - asrs r1, 16 - lsls r2, 19 - movs r0, 0x90 - lsls r0, 14 - adds r2, r0 - asrs r2, 16 - adds r0, r5, 0 - movs r3, 0 - bl CreateSprite - ldr r2, =gUnknown_0203BC34 - ldr r1, [r2] - adds r1, 0x1 - adds r1, r4 - strb r0, [r1] - adds r4, 0x1 - cmp r4, 0x7 - ble _081610DC - movs r4, 0 - ldr r7, =gUnknown_085CEC10 - adds r6, r2, 0 -_0816111C: - adds r2, r4, 0 - cmp r4, 0 - bge _08161124 - adds r2, r4, 0x3 -_08161124: - asrs r2, 2 - lsls r1, r2, 2 - subs r1, r4, r1 - lsls r1, 19 - movs r0, 0xD0 - lsls r0, 15 - adds r1, r0 - asrs r1, 16 - lsls r2, 19 - movs r0, 0xD0 - lsls r0, 14 - adds r2, r0 - asrs r2, 16 - adds r0, r7, 0 - movs r3, 0 - bl CreateSprite - ldr r1, [r6] - adds r2, r4, 0 - adds r2, 0x8 - adds r1, 0x1 - adds r1, r2 - strb r0, [r1] - ldr r0, [r6] - adds r0, 0x1 - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r5, =gSprites - adds r0, r5 - movs r1, 0x2 - bl StartSpriteAnim - adds r4, 0x1 - cmp r4, 0x7 - ble _0816111C - movs r4, 0 - ldr r3, =gUnknown_0203BC34 - movs r2, 0x4 -_08161176: - ldr r0, [r3] - adds r0, 0x1 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0xF - ble _08161176 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81610B8 - - thumb_func_start sub_81611AC -sub_81611AC: @ 81611AC - push {r4-r6,lr} - ldr r4, =gUnknown_0203BC34 - ldr r1, [r4] - movs r2, 0x8A - lsls r2, 1 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0xFF - bne _081611D4 - ldr r0, =gUnknown_085CEBC0 - movs r3, 0x8B - lsls r3, 1 - adds r1, r3 - bl AddScrollIndicatorArrowPair - ldr r1, [r4] - movs r5, 0x8A - lsls r5, 1 - adds r1, r5 - strb r0, [r1] -_081611D4: - ldr r0, [r4] - ldr r6, =0x00000113 - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0xFF - bne _08161210 - ldr r0, =gTempScrollArrowTemplate - adds r2, r0, 0 - ldr r1, =gUnknown_085CEBD0 - ldm r1!, {r3,r5,r6} - stm r2!, {r3,r5,r6} - ldr r1, [r1] - str r1, [r2] - ldr r2, [r4] - movs r3, 0x88 - lsls r3, 1 - adds r1, r2, r3 - ldrb r1, [r1] - ldr r5, =0x00000111 - adds r2, r5 - ldrb r2, [r2] - subs r1, r2 - strh r1, [r0, 0x8] - ldr r1, =gUnknown_0203BC38 - bl AddScrollIndicatorArrowPair - ldr r1, [r4] - ldr r6, =0x00000113 - adds r1, r6 - strb r0, [r1] -_08161210: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81611AC - - thumb_func_start sub_8161234 -sub_8161234: @ 8161234 - push {r4,lr} - ldr r4, =gUnknown_0203BC34 - ldr r0, [r4] - movs r2, 0x8A - lsls r2, 1 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _08161256 - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - movs r1, 0x8A - lsls r1, 1 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] -_08161256: - ldr r0, [r4] - ldr r2, =0x00000113 - adds r1, r0, r2 - ldrb r0, [r1] - cmp r0, 0xFF - beq _08161270 - bl RemoveScrollIndicatorArrowPair - ldr r0, [r4] - ldr r2, =0x00000113 - adds r1, r0, r2 - movs r0, 0xFF - strb r0, [r1] -_08161270: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8161234 - - thumb_func_start sub_8161280 -sub_8161280: @ 8161280 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0xC - ldr r4, =gUnknown_0203BC34 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x44 - ldrb r2, [r0] - movs r0, 0x64 - muls r0, r2 - ldr r2, =gPlayerParty - adds r0, r2 - adds r1, 0x12 - bl GetMoveRelearnerMoves - ldr r1, [r4] - movs r6, 0x88 - lsls r6, 1 - adds r1, r6 - strb r0, [r1] - movs r5, 0 - ldr r0, [r4] - adds r0, r6 - ldrb r0, [r0] - cmp r5, r0 - bge _081612F6 - mov r8, r4 - movs r0, 0xD - mov r12, r0 - ldr r2, =gMoveNames - mov r9, r2 -_081612C2: - mov r7, r8 - ldr r4, [r7] - lsls r3, r5, 3 - adds r2, r4, 0 - adds r2, 0x48 - adds r2, r3 - lsls r0, r5, 1 - adds r1, r4, 0 - adds r1, 0x12 - adds r1, r0 - ldrh r0, [r1] - mov r7, r12 - muls r7, r0 - adds r0, r7, 0 - add r0, r9 - str r0, [r2] - adds r0, r4, 0 - adds r0, 0x4C - adds r0, r3 - ldrh r1, [r1] - str r1, [r0] - adds r5, 0x1 - adds r0, r4, r6 - ldrb r0, [r0] - cmp r5, r0 - blt _081612C2 -_081612F6: - ldr r4, =gUnknown_0203BC34 - ldr r0, [r4] - adds r0, 0x44 - ldrb r1, [r0] - movs r0, 0x64 - muls r0, r1 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x2 - mov r2, sp - bl GetMonData - ldr r0, =gStringVar1 - mov r1, sp - bl StringCopy10 - ldr r2, [r4] - movs r5, 0x88 - lsls r5, 1 - adds r3, r2, r5 - ldrb r0, [r3] - lsls r0, 3 - adds r1, r2, 0 - adds r1, 0x48 - adds r1, r0 - ldr r0, =gText_Cancel - str r0, [r1] - ldrb r0, [r3] - lsls r0, 3 - adds r2, 0x4C - adds r2, r0 - movs r0, 0x2 - negs r0, r0 - str r0, [r2] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x48 - adds r1, r5 - ldrb r1, [r1] - bl sub_81D28C8 - ldr r1, [r4] - ldr r2, =0x00000111 - adds r1, r2 - strb r0, [r1] - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8161280 - - thumb_func_start sub_816137C -sub_816137C: @ 816137C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r4, r0, 0 - ldr r0, =gUnknown_0203BC38 - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _08161394 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - bne _081613CC -_08161394: - movs r5, 0 - ldr r4, =gSprites - ldr r3, =gUnknown_0203BC34 - movs r2, 0x4 -_0816139C: - ldr r0, [r3] - adds r0, 0x1 - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0xF - bls _0816139C - b _081614FE - .pool -_081613CC: - ldr r1, =gContestEffects - ldr r0, =gContestMoves - lsls r4, 3 - adds r0, r4, r0 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x1] - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r6, r0, 24 - mov r8, r4 - cmp r6, 0xFF - bne _081613EE - movs r6, 0 -_081613EE: - movs r5, 0 - ldr r7, =gUnknown_0203BC34 - ldr r4, =gSprites -_081613F4: - cmp r5, r6 - bcs _08161420 - ldr r0, [r7] - adds r0, 0x1 - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - bl StartSpriteAnim - b _08161436 - .pool -_08161420: - ldr r0, [r7] - adds r0, 0x1 - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0 - bl StartSpriteAnim -_08161436: - ldr r0, [r7] - adds r0, 0x1 - adds r0, r5 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - movs r3, 0x5 - negs r3, r3 - adds r2, r3, 0 - ands r1, r2 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x7 - bls _081613F4 - ldr r1, =gContestEffects - ldr r0, =gContestMoves - add r0, r8 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x2] - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0xFF - bne _0816147C - movs r6, 0 -_0816147C: - movs r5, 0 - ldr r0, =gUnknown_0203BC34 - mov r8, r0 - ldr r7, =gSprites -_08161484: - cmp r5, r6 - bcs _081614B8 - mov r1, r8 - ldr r0, [r1] - adds r4, r5, 0 - adds r4, 0x8 - adds r0, 0x1 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0x3 - bl StartSpriteAnim - b _081614D4 - .pool -_081614B8: - mov r3, r8 - ldr r0, [r3] - adds r4, r5, 0 - adds r4, 0x8 - adds r0, 0x1 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r1, 0x2 - bl StartSpriteAnim -_081614D4: - mov r1, r8 - ldr r0, [r1] - adds r0, 0x1 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - adds r0, 0x3E - ldrb r1, [r0] - movs r3, 0x5 - negs r3, r3 - adds r2, r3, 0 - ands r1, r2 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - cmp r5, 0x7 - bls _08161484 -_081614FE: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_816137C - .align 2, 0 @ Don't pad with nop. diff --git a/asm/party_menu.s b/asm/party_menu.s index 0d5c6b631..5c70e218e 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -2740,7 +2740,7 @@ sub_81B1708: @ 81B1708 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -4196,7 +4196,7 @@ sub_81B227C: @ 81B227C push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -6692,7 +6692,7 @@ sub_81B3730: @ 81B3730 ldrb r0, [r0, 0x17] cmp r0, 0x3 bhi _081B3774 - bl ProcessMenuInputNoWrapAround_other + bl Menu_ProcessInputNoWrapAround_other b _081B3778 .pool _081B3774: @@ -8138,7 +8138,7 @@ sub_81B43DC: @ 81B43DC push {r4-r6,lr} lsls r0, 24 lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -8671,7 +8671,7 @@ sub_81B48DC: @ 81B48DC muls r1, r0 ldr r0, =gPlayerParty adds r4, r1, r0 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -8963,7 +8963,7 @@ sub_81B4BA0: @ 81B4BA0 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -9069,7 +9069,7 @@ sub_81B4C94: @ 81B4C94 push {r7} lsls r0, 24 lsrs r5, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -9877,7 +9877,7 @@ sub_81B5430: @ 81B5430 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -10171,7 +10171,7 @@ sub_81B56D8: @ 81B56D8 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -13156,7 +13156,7 @@ sub_81B7028: @ 81B7028 push {r4,lr} lsls r0, 24 lsrs r4, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -13235,7 +13235,7 @@ sub_81B70B8: @ 81B70B8 ldr r3, =sub_81B70F0 ldrh r4, [r4, 0xE] str r4, [sp] - bl sub_81BFA38 + bl ShowSelectMovePokemonSummaryScreen add sp, 0x4 pop {r4} pop {r0} @@ -13458,7 +13458,7 @@ sub_81B72C8: @ 81B72C8 muls r1, r0 ldr r0, =gPlayerParty adds r4, r1, r0 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r5, r0, 24 cmp r5, 0 @@ -15240,7 +15240,7 @@ sub_81B82D4: @ 81B82D4 push {r4-r7,lr} lsls r0, 24 lsrs r5, r0, 24 - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 24e041b7f..e4475c159 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -3409,7 +3409,7 @@ _080C8F0C: adds r0, 0x1 strb r0, [r1] _080C8F22: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -4133,7 +4133,7 @@ _080C9584: b _080C9664 .pool _080C95A4: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -4927,7 +4927,7 @@ _080C9C78: b _080C9CAA .pool _080C9C8C: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -5058,7 +5058,7 @@ _080C9DAC: b _080C9DE0 .pool _080C9DC0: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index b2cba6dab..91b1693fd 100644 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -3040,7 +3040,7 @@ sub_81C5F68: @ 81C5F68 lsrs r0, 24 cmp r0, 0x1 beq _081C5FD0 - bl ProcessMenuInputNoWrapAround + bl Menu_ProcessInputNoWrapAround lsls r0, 24 asrs r4, r0, 24 movs r0, 0x2 diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 61324b207..306e2892d 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -2920,7 +2920,7 @@ _080170E0: negs r0, r0 b _08017110 _080170F2: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 movs r2, 0x80 @@ -6278,7 +6278,7 @@ _08018BD6: b _08018C3E .pool _08018BE4: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r6, r0, 24 movs r1, 0x80 @@ -28890,7 +28890,7 @@ _0802426A: bl sub_8197930 b _080242D0 _08024270: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r4, r0, 24 movs r0, 0x2 @@ -47811,7 +47811,7 @@ _0802DA84: thumb_func_start sub_802DA8C sub_802DA8C: @ 802DA8C push {lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r0, 24 pop {r1} diff --git a/asm/script_menu.s b/asm/script_menu.s index 670740a77..b521121bf 100644 --- a/asm/script_menu.s +++ b/asm/script_menu.s @@ -327,7 +327,7 @@ _080E2090: ldrsh r0, [r5, r1] cmp r0, 0 bne _080E209E - bl ProcessMenuInputNoWrapAround + bl Menu_ProcessInputNoWrapAround b _080E20A2 _080E209E: bl ProcessMenuInput @@ -444,7 +444,7 @@ task_yes_no_maybe: @ 80E215C b _080E21C4 .pool _080E2180: - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 movs r0, 0x1 diff --git a/asm/shop.s b/asm/shop.s index 1412fef22..30a5ec278 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -137,7 +137,7 @@ Task_ShopMenu: @ 80DFB88 lsls r0, 24 lsrs r4, r0, 24 adds r5, r4, 0 - bl ProcessMenuInputNoWrapAround + bl Menu_ProcessInputNoWrapAround lsls r0, 24 asrs r2, r0, 24 movs r0, 0x2 diff --git a/asm/slot_machine.s b/asm/slot_machine.s index 4f76d1b69..0f7b84d3c 100644 --- a/asm/slot_machine.s +++ b/asm/slot_machine.s @@ -1581,7 +1581,7 @@ sub_812B158: @ 812B158 thumb_func_start sub_812B1B0 sub_812B1B0: @ 812B1B0 push {lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 diff --git a/asm/trade.s b/asm/trade.s index 763b1a9ec..19dfd5ff9 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -3349,7 +3349,7 @@ sub_8078EF8: @ 8078EF8 sub_8078F50: @ 8078F50 push {lr} sub sp, 0x4 - bl ProcessMenuInputNoWrapAround + bl Menu_ProcessInputNoWrapAround lsls r0, 24 asrs r0, 24 movs r1, 0x1 @@ -3695,7 +3695,7 @@ _0807920E: thumb_func_start sub_8079218 sub_8079218: @ 8079218 push {lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 @@ -3797,7 +3797,7 @@ _080792D8: thumb_func_start sub_80792E4 sub_80792E4: @ 80792E4 push {lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 asrs r1, r0, 24 cmp r1, 0 diff --git a/asm/use_pokeblock.s b/asm/use_pokeblock.s index 5047ec65e..4cee3c4d9 100644 --- a/asm/use_pokeblock.s +++ b/asm/use_pokeblock.s @@ -900,7 +900,7 @@ sub_8166D44: @ 8166D44 thumb_func_start sub_8166DE4 sub_8166DE4: @ 8166DE4 push {r4,lr} - bl ProcessMenuInputNoWrap_ + bl Menu_ProcessInputNoWrap_ lsls r0, 24 lsrs r4, r0, 24 asrs r1, r0, 24 diff --git a/data/learn_move.s b/data/learn_move.s deleted file mode 100644 index 0a2c31e58..000000000 --- a/data/learn_move.s +++ /dev/null @@ -1,93 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -gUnknown_085CE9F8:: @ 85CE9F8 - .incbin "graphics/interface/ui_learn_move.gbapal" - -gUnknown_085CEA18:: @ 85CEA18 - .incbin "graphics/interface/ui_learn_move.4bpp" - -gUnknown_085CEB98:: @ 85CEB98 - .2byte 0 - .2byte 0 - .2byte 0 - .2byte 0 - .2byte 0x8000 - .2byte 0 - .2byte 0 - .2byte 0 - .2byte 0x4000 - .2byte 0 - .2byte 0 - .2byte 0 - -gUnknown_085CEBB0:: @ 85CEBB0 - obj_tiles gUnknown_085CEA18, 0x180, 0x1595 - -gUnknown_085CEBB8:: @ 85CEBB8 - obj_pal gUnknown_085CE9F8, 0x1596 - -gUnknown_085CEBC0:: @ 85CEBC0 - .byte 0 - .byte 0x1B - .byte 16 - .byte 1 - .byte 0x75 - .byte 16 - .2byte 0xFFFF - .2byte 0xFFFF - .2byte 0x14CD - .2byte 0x14CD - .byte 0, 0 - -gUnknown_085CEBD0:: @ 85CEBD0 - .byte 2 - .byte 0xC0 - .byte 8 - .byte 3 - .byte 0xC0 - .byte 0x68 - .2byte 0 - .2byte 0 - .2byte 0x1531 - .2byte 0x1531 - .byte 0, 0 - -gUnknown_085CEBE0:: @ 85CEBE0 - .2byte 8 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_085CEBE8:: @ 85CEBE8 - .2byte 9 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_085CEBF0:: @ 85CEBF0 - .2byte 10 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_085CEBF8:: @ 85CEBF8 - .2byte 11 - .2byte 5 - .2byte 0xFFFF - .2byte 0 - -gUnknown_085CEC00:: @ 85CEC00 - .4byte gUnknown_085CEBE0 - .4byte gUnknown_085CEBE8 - .4byte gUnknown_085CEBF0 - .4byte gUnknown_085CEBF8 - -gUnknown_085CEC10:: @ 85CEC10 - spr_template 0x1595, 0x1596, gUnknown_085CEB98, gUnknown_085CEC00, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_085CEC28:: @ 85CEC28 - .4byte 0x1F0 - .4byte 0x11E1 diff --git a/data/maps/FallarborTown_House2/scripts.inc b/data/maps/FallarborTown_House2/scripts.inc index b78756e0a..7ab0666e8 100644 --- a/data/maps/FallarborTown_House2/scripts.inc +++ b/data/maps/FallarborTown_House2/scripts.inc @@ -38,7 +38,7 @@ FallarborTown_House2_EventScript_2013D6:: @ 82013D6 FallarborTown_House2_EventScript_20140C:: @ 820140C msgbox FallarborTown_House2_Text_2015C3, 4 - special sub_8160638 + special TeachMoveTutorMove waitstate compare VAR_0x8004, 0 goto_eq FallarborTown_House2_EventScript_2013D6 diff --git a/data/specials.inc b/data/specials.inc index 86355f484..01bb9cb89 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -235,7 +235,7 @@ gSpecials:: @ 81DBA64 def_special sub_81B9770 def_special sub_81B9718 def_special sub_81B96D0 - def_special sub_8160638 + def_special TeachMoveTutorMove def_special GetRecordedCyclingRoadResults def_special Special_BeginCyclingRoadChallenge def_special GetPlayerAvatarBike diff --git a/include/learn_move.h b/include/learn_move.h index 034d689d4..9a7a779df 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -1,7 +1,7 @@ #ifndef GUARD_LEARN_MOVE_H #define GUARD_LEARN_MOVE_H -void sub_8160624(void); -void sub_8160638(void); +void VBlankCB_LearnMove(void); +void TeachMoveTutorMove(void); #endif //GUARD_LEARN_MOVE_H diff --git a/include/list_menu.h b/include/list_menu.h index d38980213..ee3d60f3d 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -1,6 +1,8 @@ #ifndef GUARD_LIST_MENU_H #define GUARD_LIST_MENU_H +#include "window.h" + #define LIST_NOTHING_CHOSEN -1 #define LIST_B_PRESSED -2 #define LIST_HEADER -3 diff --git a/include/menu.h b/include/menu.h index 4cc43dd4c..5dfd99c64 100644 --- a/include/menu.h +++ b/include/menu.h @@ -46,7 +46,7 @@ void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs); u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos); u8 GetMenuCursorPos(void); s8 ProcessMenuInput(void); -s8 ProcessMenuInputNoWrapAround(void); +s8 Menu_ProcessInputNoWrapAround(void); void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); void reset_temp_tile_data_buffers(void); void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size, u16 offset, u8 mode); @@ -54,7 +54,7 @@ bool8 free_temp_tile_data_buffers_if_possible(void); struct WindowTemplate CreateWindowTemplate(u8, u8, u8, u8, u8, u8, u16); void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos); void copy_decompressed_tile_data_to_vram_autofree(u8 bgId, const void *src, int size, u16 offset, u8 mode); -s8 ProcessMenuInputNoWrap_(void); +s8 Menu_ProcessInputNoWrap_(void); s8 ProcessMenuInput_other(void); void do_scheduled_bg_tilemap_copies_to_vram(void); void clear_scheduled_bg_copies_to_vram(void); diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index adadcea03..75caa9a3a 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -2,5 +2,6 @@ #define GUARD_POKEMON_SUMMARY_SCREEN_H void sub_81C4F98(u8, void(*)(void)); +void ShowSelectMovePokemonSummaryScreen(void *a, u8 b, u8 c, void *d, u16 e); #endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/include/pokenav.h b/include/pokenav.h index 2bca4db94..1fef8c91b 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -22,6 +22,9 @@ void sub_81D1D04(u8); bool8 sub_81D1C44(u8); void sub_81D5FB4(u16*); bool8 sub_81D4A58(struct EventObject*); - +void sub_81D2BF4(u8 *); +u16 sub_81D2C3C(void); +void sub_81D2C50(void); +u8 sub_81D28C8(const struct ListMenuItem *items, u16 numChoices); #endif //GUARD_POKENAV_H diff --git a/include/strings.h b/include/strings.h index 528f70f69..f8d108eba 100644 --- a/include/strings.h +++ b/include/strings.h @@ -762,4 +762,14 @@ extern const u8 gText_Winona[]; extern const u8 gText_Phoebe[]; extern const u8 gText_Glacia[]; +extern const u8 gText_PkmnLearnedMove4[]; +extern const u8 gText_PkmnTryingToLearnMove[]; +extern const u8 gText_WhichMoveToForget2[]; +extern const u8 gText_StopTryingToTeachMove[]; +extern const u8 gText_12AndPoof[]; +extern const u8 gText_PkmnForgotMoveAndLearnedNew[]; +extern const u8 gText_TeachWhichMoveToPkmn[]; +extern const u8 gText_GiveUpTeachingNewMove[]; +extern const u8 gText_TeachX[]; + #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index 69e677e9b..972ced45b 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -486,7 +486,6 @@ SECTIONS { data/contest_ai.o(.rodata); src/battle_controller_safari.o(.rodata); data/battle_anim_815A0D4.o(.rodata); - data/learn_move.o(.rodata); src/learn_move.o(.rodata); src/roamer.o(.rodata); data/battle_tower.o(.rodata); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7f5a4fb48..b13727a12 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -55,7 +55,7 @@ extern const u8* const gBattleScriptsForMoveEffects[]; // functions extern void sub_81A5718(u8 battlerId); // battle frontier 2 extern void sub_81A56B4(void); // battle frontier 2 -extern void sub_81BFA38(struct Pokemon* party, u8 monPartyId, u8 monCount, void (*callback)(void), u16 move); // pokemon summary screen +extern void ShowSelectMovePokemonSummaryScreen(struct Pokemon* party, u8 monPartyId, u8 monCount, void (*callback)(void), u16 move); // pokemon summary screen extern u8 sub_81C1B94(void); // pokemon summary screen extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokenav.s extern void sub_81D3640(u8 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); // pokenav.s @@ -5732,7 +5732,7 @@ static void atk5A_yesnoboxlearnmove(void) if (!gPaletteFade.active) { FreeAllWindowBuffers(); - sub_81BFA38(gPlayerParty, gBattleStruct->expGetterMonId, gPlayerPartyCount - 1, ReshowBattleScreenAfterMenu, gMoveToLearn); + ShowSelectMovePokemonSummaryScreen(gPlayerParty, gBattleStruct->expGetterMonId, gPlayerPartyCount - 1, ReshowBattleScreenAfterMenu, gMoveToLearn); gBattleScripting.learnMoveState++; } break; diff --git a/src/berry_blender.c b/src/berry_blender.c index 257c7233f..46b0f76ad 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -2436,7 +2436,7 @@ static void CB2_HandleBlenderEndGame(void) sBerryBlenderData->gameEndState++; break; case 10: - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 1: case -1: diff --git a/src/clear_save_data_screen.c b/src/clear_save_data_screen.c index 266ea8250..5c1f7db20 100644 --- a/src/clear_save_data_screen.c +++ b/src/clear_save_data_screen.c @@ -86,7 +86,7 @@ static void Task_DoClearSaveDataScreenYesNo(u8 taskId) static void Task_ClearSaveDataScreenYesNoChoice(u8 taskId) { - switch(ProcessMenuInputNoWrap_()) + switch(Menu_ProcessInputNoWrap_()) { case 0: FillWindowPixelBuffer(0, 17); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 67876f33b..ab0cd92a2 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -659,7 +659,7 @@ static void CB2_EggHatch_1(void) } break; case 10: - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: GetMonNick(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar3); diff --git a/src/evolution_scene.c b/src/evolution_scene.c index f039c5f24..7960d6cba 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -66,7 +66,7 @@ extern void sub_807F19C(void); extern void sub_807B140(void); extern void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); extern void Overworld_PlaySpecialMapMusic(void); -extern void sub_81BFA38(struct Pokemon *party, u8 monId, u8 partyCount, void *CB2_ptr, u16 move); +extern void ShowSelectMovePokemonSummaryScreen(struct Pokemon *party, u8 monId, u8 partyCount, void *CB2_ptr, u16 move); extern u8 sub_81C1B94(void); extern void sub_807F1A8(u8 arg0, const u8 *arg1, u8 arg2); extern void sub_800E084(void); @@ -918,7 +918,7 @@ static void Task_EvolutionScene(u8 taskID) if (!gPaletteFade.active) { FreeAllWindowBuffers(); - sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + ShowSelectMovePokemonSummaryScreen(gPlayerParty, gTasks[taskID].tPartyID, gPlayerPartyCount - 1, CB2_EvolutionSceneLoadGraphics, gMoveToLearn); gTasks[taskID].tLearnMoveState++; @@ -1222,7 +1222,7 @@ static void Task_TradeEvolutionScene(u8 taskID) } break; case 4: - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: sEvoCursorPos = 0; @@ -1252,7 +1252,7 @@ static void Task_TradeEvolutionScene(u8 taskID) Free(GetBgTilemapBuffer(0)); FreeAllWindowBuffers(); - sub_81BFA38(gPlayerParty, gTasks[taskID].tPartyID, + ShowSelectMovePokemonSummaryScreen(gPlayerParty, gTasks[taskID].tPartyID, gPlayerPartyCount - 1, CB2_TradeEvolutionSceneLoadGraphics, gMoveToLearn); gTasks[taskID].tLearnMoveState++; diff --git a/src/item_menu.c b/src/item_menu.c index d134e6375..f58c2b8b3 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -1369,7 +1369,7 @@ void Task_HandleInBattleItemMenuInput(u8 taskId) { if (sub_81221EC() != TRUE) { - s8 r4 = ProcessMenuInputNoWrapAround(); + s8 r4 = Menu_ProcessInputNoWrapAround(); switch (r4) { case -2: diff --git a/src/learn_move.c b/src/learn_move.c index addae6a38..b65fd2045 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -1,26 +1,219 @@ #include "global.h" #include "main.h" -#include "task.h" -#include "script.h" -#include "sprite.h" -#include "palette.h" -#include "menu.h" -#include "menu_helpers.h" -#include "list_menu.h" -#include "malloc.h" -#include "field_screen.h" -#include "event_data.h" #include "bg.h" +#include "data2.h" +#include "event_data.h" +#include "field_screen.h" #include "gpu_regs.h" #include "learn_move.h" +#include "list_menu.h" +#include "malloc.h" +#include "menu.h" +#include "menu_helpers.h" +#include "overworld.h" +#include "palette.h" +#include "pokemon_summary_screen.h" +#include "pokenav.h" +#include "script.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "constants/rgb.h" +#include "constants/songs.h" -EWRAM_DATA u8 *gUnknown_0203BC34 = 0; -EWRAM_DATA u8 gUnknown_0203BC38[8] = {0}; +struct LearnMoveStruct +{ + u8 state; + u8 spriteIds[16]; /*0x001*/ + u8 filler11; /*0x011*/ + u16 movesToLearn[4]; /*0x012*/ + u8 filler1A[0x44 - 0x1A]; /*0x01A*/ + u8 partyMon; /*0x044*/ + u8 unk045; /*0x045*/ + u8 filler46[2]; /*0x046*/ + struct ListMenuItem menuItems[4]; /*0x048*/ + u8 filler68[0x110 - 0x68]; /*0x068*/ + u8 numMenuChoices; /*0x110*/ + u8 unk111; /*0x111*/ + u8 listMenuTask; /*0x112*/ + u8 unk113; /*0x113*/ + u8 unk114; /*0x114*/ + u16 unk116; /*0x116*/ +}; + +EWRAM_DATA struct LearnMoveStruct *sLearnMoveStruct = {0}; +EWRAM_DATA struct { + u16 listOffset; + u16 listRow; + u8 showContestInfo; +} gUnknown_0203BC38 = {0}; extern void (*gFieldCallback)(void); -extern const struct SpritePalette gUnknown_085CEBB8; -extern const struct SpriteSheet gUnknown_085CEBB0; -extern const struct BgTemplate gUnknown_085CEC28; + +const u16 gUnknown_085CE9F8[] = INCBIN_U16("graphics/interface/ui_learn_move.gbapal"); +const u8 gUnknown_085CEA18[] = INCBIN_U8("graphics/interface/ui_learn_move.4bpp"); + +const struct OamData gUnknown_085CEB98 = +{ + .y = 0, + .affineMode = 0, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 0, + .bpp = ST_OAM_4BPP, + .shape = ST_OAM_SQUARE, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct OamData gUnknown_085CEBA0 = +{ + .y = 0, + .affineMode = 0, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 0, + .bpp = ST_OAM_4BPP, + .shape = ST_OAM_V_RECTANGLE, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct OamData gUnknown_085CEBA8 = +{ + .y = 0, + .affineMode = 0, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 0, + .bpp = ST_OAM_4BPP, + .shape = ST_OAM_H_RECTANGLE, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0, +}; + +const struct SpriteSheet gUnknown_085CEBB0 = +{ + .data = gUnknown_085CEA18, + .size = 0x180, + .tag = 5525 +}; + +const struct SpritePalette gUnknown_085CEBB8 = +{ + .data = gUnknown_085CE9F8, + .tag = 5526 +}; + +const struct ScrollArrowsTemplate gUnknown_085CEBC0 = +{ + .firstArrowType = 0, + .firstX = 27, + .firstY = 16, + .secondArrowType = 1, + .secondX = 117, + .secondY = 16, + .fullyUpThreshold = -1, + .fullyDownThreshold = -1, + .tileTag = 5325, + .palTag = 5325, + .palNum = 0, +}; + +const struct ScrollArrowsTemplate gUnknown_085CEBD0 = +{ + .firstArrowType = 2, + .firstX = 192, + .firstY = 8, + .secondArrowType = 3, + .secondX = 192, + .secondY = 104, + .fullyUpThreshold = 0, + .fullyDownThreshold = 0, + .tileTag = 5425, + .palTag = 5425, + .palNum = 0, +}; + +const union AnimCmd gUnknown_085CEBE0[] = +{ + ANIMCMD_FRAME(8, 5, FALSE, FALSE), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_085CEBE8[] = +{ + ANIMCMD_FRAME(9, 5, FALSE, FALSE), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_085CEBF0[] = +{ + ANIMCMD_FRAME(10, 5, FALSE, FALSE), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_085CEBF8[] = +{ + ANIMCMD_FRAME(11, 5, FALSE, FALSE), + ANIMCMD_END +}; + +const union AnimCmd *const gUnknown_085CEC00[] = +{ + gUnknown_085CEBE0, + gUnknown_085CEBE8, + gUnknown_085CEBF0, + gUnknown_085CEBF8, +}; + +const struct SpriteTemplate gUnknown_085CEC10 = +{ + .tileTag = 5525, + .paletteTag = 5526, + .oam = &gUnknown_085CEB98, + .anims = gUnknown_085CEC00, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct BgTemplate gUnknown_085CEC28[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0, + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 30, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0, + }, +}; + extern void sub_81D2824(u16); void sub_8160868(void); @@ -29,111 +222,621 @@ void sub_81610B8(void); void sub_816082C(void); static void sub_8160664(u8 taskId); -void sub_81606A0(void); //CB2_InitLearnMove +void CB2_InitLearnMove(void); void sub_8160740(void); void sub_81607EC(void); void sub_816082C(void); -void sub_8160624(void) //VBlankCB_LearnMove +void VBlankCB_LearnMove(void) { - LoadOam(); - ProcessSpriteCopyRequests(); - TransferPlttBuffer(); + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); } -void sub_8160638(void) //TeachMoveTutorMove +void TeachMoveTutorMove(void) { - ScriptContext2_Enable(); - CreateTask(sub_8160664, 0xA); - BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + ScriptContext2_Enable(); + CreateTask(sub_8160664, 0xA); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); } void sub_8160664(u8 taskId) { - if (!gPaletteFade.active) - { - SetMainCallback2(sub_81606A0); - gFieldCallback = sub_80AF168; - DestroyTask(taskId); - } + if (!gPaletteFade.active) + { + SetMainCallback2(CB2_InitLearnMove); + gFieldCallback = sub_80AF168; + DestroyTask(taskId); + } } -// Doesn't match -void sub_81606A0(void) //CB2_InitLearnMove +void CB2_InitLearnMove(void) { - ResetSpriteData(); - FreeAllSpritePalettes(); - ResetTasks(); - clear_scheduled_bg_copies_to_vram(); + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + clear_scheduled_bg_copies_to_vram(); + sLearnMoveStruct = AllocZeroed(sizeof(struct LearnMoveStruct)); + sLearnMoveStruct->partyMon = gSpecialVar_0x8004; + SetVBlankCallback(VBlankCB_LearnMove); - gUnknown_0203BC34 = AllocZeroed(0x118); //gUnknown_0203BC34 ? - gUnknown_0203BC34[68] = gSpecialVar_0x8004; + sub_81607EC(); + sub_81D2824(0); - SetVBlankCallback(sub_8160624); - sub_81607EC(); - sub_81D2824(0); + gUnknown_0203BC38.listOffset = 0; + gUnknown_0203BC38.listRow = 0; + gUnknown_0203BC38.showContestInfo = 0; - //gUnknown_0203BC38 ? - gUnknown_0203BC38[0] = 0; - gUnknown_0203BC38[2] = 0; - gUnknown_0203BC38[4] = 0; + sub_8161280(); - sub_8161280(); + LoadSpriteSheet(&gUnknown_085CEBB0); + LoadSpritePalette(&gUnknown_085CEBB8); + sub_81610B8(); - LoadSpriteSheet(&gUnknown_085CEBB0); - LoadSpritePalette(&gUnknown_085CEBB8); - sub_81610B8(); - - gUnknown_0203BC34[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]); - FillPalette(0, 0, 2); - SetMainCallback2(sub_816082C); + sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38.listOffset, gUnknown_0203BC38.listRow); + FillPalette(RGB_BLACK, 0, 2); + SetMainCallback2(sub_816082C); } -// Doesn't match void sub_8160740(void) { - ResetSpriteData(); - FreeAllSpritePalettes(); - ResetTasks(); - clear_scheduled_bg_copies_to_vram(); + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + clear_scheduled_bg_copies_to_vram(); + sLearnMoveStruct = AllocZeroed(sizeof(struct LearnMoveStruct)); + sLearnMoveStruct->state = 28; + sLearnMoveStruct->partyMon = gSpecialVar_0x8004; + sLearnMoveStruct->unk045 = gSpecialVar_0x8005; + SetVBlankCallback(VBlankCB_LearnMove); - gUnknown_0203BC34 = AllocZeroed(0x118); //gUnknown_0203BC34 ? - gUnknown_0203BC34[68] = gSpecialVar_0x8004; - gUnknown_0203BC34[69] = gSpecialVar_0x8005; + sub_81607EC(); + sub_81D2824(gUnknown_0203BC38.showContestInfo); + sub_8161280(); - SetVBlankCallback(sub_8160624); - sub_81607EC(); + LoadSpriteSheet(&gUnknown_085CEBB0); + LoadSpritePalette(&gUnknown_085CEBB8); + sub_81610B8(); - //gUnknown_0203BC38 ? - sub_81D2824(gUnknown_0203BC38[4]); - sub_8161280(); - - LoadSpriteSheet(&gUnknown_085CEBB0); - LoadSpritePalette(&gUnknown_085CEBB8); - - gUnknown_0203BC34[274] = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38[0], gUnknown_0203BC38[2]); - FillPalette(0, 0, 2); - SetMainCallback2(sub_816082C); + sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38.listOffset, gUnknown_0203BC38.listRow); + FillPalette(RGB_BLACK, 0, 2); + SetMainCallback2(sub_816082C); } void sub_81607EC(void) { - ResetVramOamAndBgCntRegs(); - ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, &gUnknown_085CEC28, 2); - ResetAllBgsCoordinates(); - SetGpuReg(0, 0x1040); - ShowBg(0); - ShowBg(1); - SetGpuReg(0x50, 0); + ResetVramOamAndBgCntRegs(); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_085CEC28, 2); + ResetAllBgsCoordinates(); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_OBJ_ON); + ShowBg(0); + ShowBg(1); + SetGpuReg(REG_OFFSET_BLDCNT, 0); } void sub_816082C(void) { - sub_8160868(); - RunTasks(); - AnimateSprites(); - BuildOamBuffer(); - do_scheduled_bg_tilemap_copies_to_vram(); - UpdatePaletteFade(); + sub_8160868(); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +void sub_816084C(const u8 *src) +{ + StringExpandPlaceholders(gStringVar4, src); + sub_81D2BF4(gStringVar4); +} + +void sub_81611AC(void); +void sub_8160F50(u8); +void sub_8161074(u8); +s32 sub_8161054(void); +void sub_8160EA0(void); +void sub_8161234(void); +void render_previous_quest_text(bool8); + +void sub_8160868(void) +{ + switch (sLearnMoveStruct->state) + { + case 0: + sLearnMoveStruct->state++; + render_previous_quest_text(FALSE); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + break; + case 1: + if (!gPaletteFade.active) + { + sLearnMoveStruct->state = 4; + } + break; + case 2: + sLearnMoveStruct->state++; + break; + case 3: + render_previous_quest_text(FALSE); + sLearnMoveStruct->state++; + sub_81611AC(); + break; + case 4: + sub_8160F50(0); + return; + case 5: + sub_8161074(0); + sLearnMoveStruct->state++; + sub_81611AC(); + break; + case 6: + sub_8160F50(1); + break; + case 8: + if (!sub_81D2C3C()) + { + sub_81D2C50(); + sLearnMoveStruct->state++; + } + break; + case 9: + { + s8 selection = Menu_ProcessInputNoWrap_(); + + if (selection == 0) + { + if (GiveMoveToMon(&gPlayerParty[sLearnMoveStruct->partyMon], sub_8161054()) != 0xFFFF) + { + sub_816084C(gText_PkmnLearnedMove4); + gSpecialVar_0x8004 = 1; + sLearnMoveStruct->state = 31; + } + else + { + sLearnMoveStruct->state = 16; + } + } + else if (selection == -1 || selection == 1) + { + if (gUnknown_0203BC38.showContestInfo == FALSE) + { + sLearnMoveStruct->state = 3; + } + else if (gUnknown_0203BC38.showContestInfo == TRUE) + { + sLearnMoveStruct->state = 5; + } + } + } + break; + case 12: + if (!sub_81D2C3C()) + { + sub_81D2C50(); + sLearnMoveStruct->state++; + } + break; + case 13: + { + s8 selection = Menu_ProcessInputNoWrap_(); + + if (selection == 0) + { + gSpecialVar_0x8004 = selection; + sLearnMoveStruct->state = 14; + } + else if (selection == -1 || selection == 1) + { + if (gUnknown_0203BC38.showContestInfo == FALSE) + { + sLearnMoveStruct->state = 3; + } + else if (gUnknown_0203BC38.showContestInfo == TRUE) + { + sLearnMoveStruct->state = 5; + } + } + } + break; + case 16: + sub_816084C(gText_PkmnTryingToLearnMove); + sLearnMoveStruct->state++; + break; + case 17: + if (!sub_81D2C3C()) + { + sub_81D2C50(); + sLearnMoveStruct->state = 18; + } + break; + case 18: + { + s8 var = Menu_ProcessInputNoWrap_(); + + if (var == 0) + { + sub_816084C(gText_WhichMoveToForget2); + sLearnMoveStruct->state = 19; + } + else if (var == -1 || var == 1) + { + sLearnMoveStruct->state = 24; + } + } + break; + case 24: + StringCopy(gStringVar2, gMoveNames[sub_8161054()]); + sub_816084C(gText_StopTryingToTeachMove); + sLearnMoveStruct->state++; + break; + case 25: + if (!sub_81D2C3C()) + { + sub_81D2C50(); + sLearnMoveStruct->state++; + } + break; + case 26: + { + s8 var = Menu_ProcessInputNoWrap_(); + + if (var == 0) + { + sLearnMoveStruct->state = 27; + } + else if (var == -1 || var == 1) + { + // What's the point? It gets set to 16, anyway. + if (gUnknown_0203BC38.showContestInfo == FALSE) + { + sLearnMoveStruct->state = 3; + } + else if (gUnknown_0203BC38.showContestInfo == TRUE) + { + sLearnMoveStruct->state = 5; + } + sLearnMoveStruct->state = 16; + } + } + break; + case 27: + if (!sub_81D2C3C()) + { + FillWindowPixelBuffer(3, 0x11); + if (gUnknown_0203BC38.showContestInfo == FALSE) + { + sLearnMoveStruct->state = 3; + } + else if (gUnknown_0203BC38.showContestInfo == TRUE) + { + sLearnMoveStruct->state = 5; + } + } + break; + case 19: + if (!sub_81D2C3C()) + { + sLearnMoveStruct->state = 20; + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + } + break; + case 20: + if (!gPaletteFade.active) + { + ShowSelectMovePokemonSummaryScreen(gPlayerParty, sLearnMoveStruct->partyMon, gPlayerPartyCount - 1, sub_8160740, sub_8161054()); + sub_8160EA0(); + } + break; + case 21: + if (!sub_81D2C3C()) + { + sLearnMoveStruct->state = 14; + } + break; + case 22: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + break; + case 14: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + sLearnMoveStruct->state++; + break; + case 15: + if (!gPaletteFade.active) + { + sub_8160EA0(); + SetMainCallback2(CB2_ReturnToField); + } + break; + case 28: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); + sLearnMoveStruct->state++; + if (gUnknown_0203BC38.showContestInfo == FALSE) + { + render_previous_quest_text(TRUE); + } + else if (gUnknown_0203BC38.showContestInfo == TRUE) + { + sub_8161074(1); + } + sub_8161234(); + CopyWindowToVram(3, 2); + break; + case 29: + if (!gPaletteFade.active) + { + if (sLearnMoveStruct->unk045 == 4) + { + sLearnMoveStruct->state = 24; + } + else + { + u16 moveId = GetMonData(&gPlayerParty[sLearnMoveStruct->partyMon], MON_DATA_MOVE1 + sLearnMoveStruct->unk045); + + StringCopy(gStringVar3, gMoveNames[moveId]); + RemoveMonPPBonus(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->unk045); + SetMonMoveSlot(&gPlayerParty[sLearnMoveStruct->partyMon], sub_8161054(), sLearnMoveStruct->unk045); + StringCopy(gStringVar2, gMoveNames[sub_8161054()]); + sub_816084C(gText_12AndPoof); + sLearnMoveStruct->state = 30; + gSpecialVar_0x8004 = 1; + } + } + break; + case 30: + if (!sub_81D2C3C()) + { + sub_816084C(gText_PkmnForgotMoveAndLearnedNew); + sLearnMoveStruct->state = 31; + PlayFanfare(MUS_FANFA1); + } + break; + case 31: + if (!sub_81D2C3C()) + { + PlayFanfare(MUS_FANFA1); + sLearnMoveStruct->state = 32; + } + break; + case 32: + if (IsFanfareTaskInactive()) + { + sLearnMoveStruct->state = 33; + } + break; + case 33: + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_SELECT); + sLearnMoveStruct->state = 14; + } + break; + } +} + +void sub_8160EA0(void) +{ + sub_8161234(); + DestroyListMenuTask(sLearnMoveStruct->listMenuTask, &gUnknown_0203BC38.listOffset, &gUnknown_0203BC38.listRow); + FreeAllWindowBuffers(); + FREE_AND_SET_NULL(sLearnMoveStruct); + ResetSpriteData(); + FreeAllSpritePalettes(); +} + +void render_previous_quest_text(bool8 a) +{ + s32 i; + + for (i = 0; i < 16; i++) + { + gSprites[sLearnMoveStruct->spriteIds[i]].invisible = TRUE; + } + + if (!a) + { + StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn); + FillWindowPixelBuffer(3, 0x11); + PrintTextOnWindow(3, 1, gStringVar4, 0, 1, 0, NULL); + } +} + +void sub_816137C(s32); + +void sub_8160F50(u8 a0) +{ + s32 itemId = ListMenuHandleInputGetItemId(sLearnMoveStruct->listMenuTask); + ListMenuGetScrollAndRow(sLearnMoveStruct->listMenuTask, &gUnknown_0203BC38.listOffset, &gUnknown_0203BC38.listRow); + + switch (itemId) + { + case LIST_NOTHING_CHOSEN: + if (!(gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysState()) + { + break; + } + + PlaySE(SE_SELECT); + + if (a0 == 0) + { + PutWindowTilemap(1); + sLearnMoveStruct->state = 5; + gUnknown_0203BC38.showContestInfo = TRUE; + } + else + { + PutWindowTilemap(0); + sLearnMoveStruct->state = 3; + gUnknown_0203BC38.showContestInfo = FALSE; + } + + schedule_bg_copy_tilemap_to_vram(1); + sub_816137C(sub_8161054()); + break; + case LIST_B_PRESSED: + PlaySE(SE_SELECT); + sub_8161234(); + sLearnMoveStruct->state = 12; + StringExpandPlaceholders(gStringVar4, gText_GiveUpTeachingNewMove); + sub_81D2BF4(gStringVar4); + break; + default: + PlaySE(SE_SELECT); + sub_8161234(); + sLearnMoveStruct->state = 8; + StringCopy(gStringVar2, gMoveNames[itemId]); + StringExpandPlaceholders(gStringVar4, gText_TeachX); + sub_81D2BF4(gStringVar4); + break; + } +} + +s32 sub_8161054(void) +{ + return sLearnMoveStruct->menuItems[gUnknown_0203BC38.listRow + gUnknown_0203BC38.listOffset].id; +} + +void sub_8161074(u8 a0) +{ + if (!a0) + { + StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn); + FillWindowPixelBuffer(3, 0x11); + PrintTextOnWindow(3, 1, gStringVar4, 0, 1, 0, NULL); + } +} + +void sub_81610B8(void) +{ + int i; + + sLearnMoveStruct->unk114 = 0xFF; + sLearnMoveStruct->unk113 = -1; + sub_81611AC(); + + for (i = 0; i < 8; i++) + { + sLearnMoveStruct->spriteIds[i] = CreateSprite(&gUnknown_085CEC10, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 36, 0); + } + + for (i = 0; i < 8; i++) + { + sLearnMoveStruct->spriteIds[i + 8] = CreateSprite(&gUnknown_085CEC10, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 52, 0); + StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i + 8]], 2); + } + + for (i = 0; i < 16; i++) + { + gSprites[sLearnMoveStruct->spriteIds[i]].invisible = TRUE; + } +} + +void sub_81611AC(void) +{ + if (sLearnMoveStruct->unk114 == 0xFF) + { + sLearnMoveStruct->unk114 = AddScrollIndicatorArrowPair(&gUnknown_085CEBC0, &sLearnMoveStruct->unk116); + } + + if (sLearnMoveStruct->unk113 == 0xFF) + { + gTempScrollArrowTemplate = gUnknown_085CEBD0; + gTempScrollArrowTemplate.fullyDownThreshold = sLearnMoveStruct->numMenuChoices - sLearnMoveStruct->unk111; + sLearnMoveStruct->unk113 = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, &gUnknown_0203BC38.listOffset); + } +} + +void sub_8161234(void) +{ + if (sLearnMoveStruct->unk114 != 0xFF) + { + RemoveScrollIndicatorArrowPair(sLearnMoveStruct->unk114); + sLearnMoveStruct->unk114 = 0xFF; + } + + if (sLearnMoveStruct->unk113 != 0xFF) + { + RemoveScrollIndicatorArrowPair(sLearnMoveStruct->unk113); + sLearnMoveStruct->unk113 = 0xFF; + } +} + +void sub_8161280(void) +{ + s32 i; + u8 nickname[POKEMON_NAME_LENGTH + 1]; + + sLearnMoveStruct->numMenuChoices = GetMoveRelearnerMoves(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->movesToLearn); + + for (i = 0; i < sLearnMoveStruct->numMenuChoices; i++) + { + sLearnMoveStruct->menuItems[i].name = gMoveNames[sLearnMoveStruct->movesToLearn[i]]; + sLearnMoveStruct->menuItems[i].id = sLearnMoveStruct->movesToLearn[i]; + } + + GetMonData(&gPlayerParty[sLearnMoveStruct->partyMon], MON_DATA_NICKNAME, nickname); + StringCopy10(gStringVar1, nickname); + sLearnMoveStruct->menuItems[sLearnMoveStruct->numMenuChoices].name = gText_Cancel; + sLearnMoveStruct->menuItems[sLearnMoveStruct->numMenuChoices].id = LIST_B_PRESSED; + sLearnMoveStruct->numMenuChoices++; + sLearnMoveStruct->unk111 = sub_81D28C8(sLearnMoveStruct->menuItems, sLearnMoveStruct->numMenuChoices); +} + +void sub_816137C(s32 item) +{ + u16 i; + + if (!gUnknown_0203BC38.showContestInfo || item == LIST_NOTHING_CHOSEN) + { + for (i = 0; i < 16; i++) + { + gSprites[sLearnMoveStruct->spriteIds[i]].invisible = TRUE; + } + } + else + { + u8 temp1 = gContestEffects[gContestMoves[item].effect].appeal / 10; + + if (temp1 == 0xFF) + { + temp1 = 0; + } + + for (i = 0; i < 8; i++) + { + if (i < temp1) + { + StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 1); + } + else + { + StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 0); + } + gSprites[sLearnMoveStruct->spriteIds[i]].invisible = FALSE; + } + + temp1 = gContestEffects[gContestMoves[item].effect].jam / 10; + + if (temp1 == 0xFF) + { + temp1 = 0; + } + + for (i = 0; i < 8; i++) + { + if (i < temp1) + { + StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 3); + } + else + { + StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 2); + } + gSprites[sLearnMoveStruct->spriteIds[i]].invisible = FALSE; + } + } } diff --git a/src/main_menu.c b/src/main_menu.c index 3afe1abe5..052035e34 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1362,7 +1362,7 @@ void task_new_game_prof_birch_speech_part2_3(u8 taskId) void task_new_game_prof_birch_speech_part2_4(u8 taskId) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: PlaySE(SE_SELECT); @@ -1802,7 +1802,7 @@ void sub_8031D74(void) s8 sub_8031DB4(void) { - return ProcessMenuInputNoWrapAround(); + return Menu_ProcessInputNoWrapAround(); } void set_default_player_name(u8 nameId) diff --git a/src/menu.c b/src/menu.c index f4ffec023..eda9513ba 100644 --- a/src/menu.c +++ b/src/menu.c @@ -986,7 +986,7 @@ s8 ProcessMenuInput(void) return MENU_NOTHING_CHOSEN; } -s8 ProcessMenuInputNoWrapAround(void) +s8 Menu_ProcessInputNoWrapAround(void) { u8 oldPos = gUnknown_0203CD90.cursorPos; @@ -1044,7 +1044,7 @@ s8 ProcessMenuInput_other(void) return MENU_NOTHING_CHOSEN; } -s8 ProcessMenuInputNoWrapAround_other(void) +s8 Menu_ProcessInputNoWrapAround_other(void) { u8 oldPos = gUnknown_0203CD90.cursorPos; @@ -1187,9 +1187,9 @@ void sub_8198C34(const struct WindowTemplate *window, u8 fontId, u16 baseTileNum sub_8198AF8(window, fontId, 0, 1, baseTileNum, paletteNum, 0); } -s8 ProcessMenuInputNoWrap_(void) +s8 Menu_ProcessInputNoWrap_(void) { - s8 result = ProcessMenuInputNoWrapAround(); + s8 result = Menu_ProcessInputNoWrapAround(); if (result != MENU_NOTHING_CHOSEN) sub_8198C78(); return result; diff --git a/src/menu_helpers.c b/src/menu_helpers.c index 178fbb5fa..217fdabae 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -169,7 +169,7 @@ void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *templa static void Task_CallYesOrNoCallback(u8 taskId) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: PlaySE(SE_SELECT); diff --git a/src/player_pc.c b/src/player_pc.c index ba18b45ab..ef00e2e06 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -272,7 +272,7 @@ static void PlayerPCProcessMenuInput(u8 taskId) if(gPcItemMenuOptionsNum > 3) inputOptionId = ProcessMenuInput(); else - inputOptionId = ProcessMenuInputNoWrapAround(); + inputOptionId = Menu_ProcessInputNoWrapAround(); switch(inputOptionId) { @@ -686,7 +686,7 @@ static void Mailbox_DrawYesNoBeforeMove(u8 taskId) static void Mailbox_MoveToBagYesNoPrompt(u8 taskId) { - switch(ProcessMenuInputNoWrap_()) + switch(Menu_ProcessInputNoWrap_()) { case 0: Mailbox_DoMailMoveToBag(taskId); diff --git a/src/pokeblock.c b/src/pokeblock.c index 7dd20b237..e615693b9 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -1042,7 +1042,7 @@ static void Task_HandlePokeblockOptionsInput(u8 taskId) if (sub_81221EC() == TRUE) return; - itemId = ProcessMenuInputNoWrapAround(); + itemId = Menu_ProcessInputNoWrapAround(); if (itemId == MENU_NOTHING_CHOSEN) { return; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 728b887f8..55600b3c4 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -384,7 +384,7 @@ void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) SetMainCallback2(sub_81BFAE4); } -void sub_81BFA38(void *a, u8 b, u8 c, void *d, u16 e) +void ShowSelectMovePokemonSummaryScreen(void *a, u8 b, u8 c, void *d, u16 e) { sub_81BF8EC(3, a, b, c, d); gUnknown_0203CF1C->unk40C4 = e; diff --git a/src/secret_base.c b/src/secret_base.c index c71f7ed23..b75163200 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -997,7 +997,7 @@ void sub_80E9FB0(u8 taskId) { s8 input; - input = ProcessMenuInputNoWrapAround(); + input = Menu_ProcessInputNoWrapAround(); switch (input) { case -1: diff --git a/src/start_menu.c b/src/start_menu.c index 7591d3b57..60271317a 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -985,7 +985,7 @@ static u8 SaveYesNoCallback(void) static u8 SaveConfirmInputCallback(void) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: // Yes switch (gSaveFileStatus) @@ -1045,7 +1045,7 @@ static u8 SaveConfirmOverwriteCallback(void) static u8 SaveOverwriteInputCallback(void) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: // Yes sSaveDialogCallback = SaveSavingMessageCallback; @@ -1169,7 +1169,7 @@ static u8 BattlePyramidRetireYesNoCallback(void) static u8 BattlePyramidRetireInputCallback(void) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: // Yes return SAVE_CANCELED; diff --git a/src/starter_choose.c b/src/starter_choose.c index b55b0fbc5..36e2b121a 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -258,7 +258,7 @@ static void Task_StarterChoose5(u8 taskId) { u8 spriteId; - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: // YES // Return the starter choice and exit. diff --git a/src/wallclock.c b/src/wallclock.c index 3d95d75ac..5be20d5c9 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -763,7 +763,7 @@ static void Task_SetClock3(u8 taskId) static void Task_SetClock4(u8 taskId) { - switch (ProcessMenuInputNoWrap_()) + switch (Menu_ProcessInputNoWrap_()) { case 0: PlaySE(SE_SELECT); From b40957c09b0fdebae2923b9080e1a08d92ad0812 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Sun, 12 Aug 2018 13:33:41 -0700 Subject: [PATCH 10/21] Finish decompiling learn_move --- include/learn_move.h | 2 +- include/pokenav.h | 1 + src/event_data.c | 8 +- src/learn_move.c | 186 +++++++++++++++++++++---------------------- src/slot_machine.c | 2 +- 5 files changed, 96 insertions(+), 103 deletions(-) diff --git a/include/learn_move.h b/include/learn_move.h index 9a7a779df..2acc21cde 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -1,7 +1,7 @@ #ifndef GUARD_LEARN_MOVE_H #define GUARD_LEARN_MOVE_H -void VBlankCB_LearnMove(void); void TeachMoveTutorMove(void); +void sub_816137C(s32); #endif //GUARD_LEARN_MOVE_H diff --git a/include/pokenav.h b/include/pokenav.h index 1fef8c91b..dd3fd4905 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -26,5 +26,6 @@ void sub_81D2BF4(u8 *); u16 sub_81D2C3C(void); void sub_81D2C50(void); u8 sub_81D28C8(const struct ListMenuItem *items, u16 numChoices); +void sub_81D2824(u16); #endif //GUARD_POKENAV_H diff --git a/src/event_data.c b/src/event_data.c index 2cbe50f13..8a998fe26 100644 --- a/src/event_data.c +++ b/src/event_data.c @@ -168,8 +168,8 @@ u16 *GetVarPointer(u16 id) return NULL; else if (id < SPECIAL_VARS_START) return &gSaveBlock1Ptr->vars[id - VARS_START]; - else - return gSpecialVars[id - SPECIAL_VARS_START]; + else + return gSpecialVars[id - SPECIAL_VARS_START]; } u16 VarGet(u16 id) @@ -200,8 +200,8 @@ u8 *GetFlagPointer(u16 id) return NULL; else if (id < SPECIAL_FLAGS_START) return &gSaveBlock1Ptr->flags[id / 8]; - else - return &gUnknown_020375FC[(id - SPECIAL_FLAGS_START) / 8]; + else + return &gUnknown_020375FC[(id - SPECIAL_FLAGS_START) / 8]; } u8 FlagSet(u16 id) diff --git a/src/learn_move.c b/src/learn_move.c index b65fd2045..9058a3287 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -1,6 +1,7 @@ #include "global.h" #include "main.h" #include "bg.h" +#include "contest_effect.h" #include "data2.h" #include "event_data.h" #include "field_screen.h" @@ -23,34 +24,31 @@ #include "constants/rgb.h" #include "constants/songs.h" -struct LearnMoveStruct +static EWRAM_DATA struct { u8 state; - u8 spriteIds[16]; /*0x001*/ - u8 filler11; /*0x011*/ - u16 movesToLearn[4]; /*0x012*/ - u8 filler1A[0x44 - 0x1A]; /*0x01A*/ - u8 partyMon; /*0x044*/ - u8 unk045; /*0x045*/ - u8 filler46[2]; /*0x046*/ - struct ListMenuItem menuItems[4]; /*0x048*/ - u8 filler68[0x110 - 0x68]; /*0x068*/ - u8 numMenuChoices; /*0x110*/ - u8 unk111; /*0x111*/ - u8 listMenuTask; /*0x112*/ - u8 unk113; /*0x113*/ - u8 unk114; /*0x114*/ - u16 unk116; /*0x116*/ -}; + u8 spriteIds[16]; /*0x001*/ + u8 filler11; /*0x011*/ + u16 movesToLearn[4]; /*0x012*/ + u8 filler1A[0x44 - 0x1A]; /*0x01A*/ + u8 partyMon; /*0x044*/ + u8 unk045; /*0x045*/ + u8 filler46[2]; /*0x046*/ + struct ListMenuItem menuItems[4]; /*0x048*/ + u8 filler68[0x110 - 0x68]; /*0x068*/ + u8 numMenuChoices; /*0x110*/ + u8 unk111; /*0x111*/ + u8 listMenuTask; /*0x112*/ + u8 unk113; /*0x113*/ + u8 unk114; /*0x114*/ + u16 unk116; /*0x116*/ +} *sLearnMoveStruct = {0}; -EWRAM_DATA struct LearnMoveStruct *sLearnMoveStruct = {0}; -EWRAM_DATA struct { +static EWRAM_DATA struct { u16 listOffset; u16 listRow; u8 showContestInfo; -} gUnknown_0203BC38 = {0}; - -extern void (*gFieldCallback)(void); +} sLearnMoveStruct2 = {0}; const u16 gUnknown_085CE9F8[] = INCBIN_U16("graphics/interface/ui_learn_move.gbapal"); const u8 gUnknown_085CEA18[] = INCBIN_U8("graphics/interface/ui_learn_move.4bpp"); @@ -214,20 +212,23 @@ const struct BgTemplate gUnknown_085CEC28[] = }, }; -extern void sub_81D2824(u16); - -void sub_8160868(void); -void sub_8161280(void); -void sub_81610B8(void); -void sub_816082C(void); - +static void sub_8160868(void); +static void sub_8161280(void); +static void sub_81610B8(void); +static void sub_816082C(void); static void sub_8160664(u8 taskId); -void CB2_InitLearnMove(void); -void sub_8160740(void); -void sub_81607EC(void); -void sub_816082C(void); +static void CB2_InitLearnMove(void); +static void sub_8160740(void); +static void sub_81607EC(void); +static void sub_81611AC(void); +static void sub_8160F50(u8); +static void sub_8161074(u8); +static s32 sub_8161054(void); +static void sub_8160EA0(void); +static void sub_8161234(void); +static void render_previous_quest_text(bool8); -void VBlankCB_LearnMove(void) +static void VBlankCB_LearnMove(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -241,7 +242,7 @@ void TeachMoveTutorMove(void) BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); } -void sub_8160664(u8 taskId) +static void sub_8160664(u8 taskId) { if (!gPaletteFade.active) { @@ -251,22 +252,22 @@ void sub_8160664(u8 taskId) } } -void CB2_InitLearnMove(void) +static void CB2_InitLearnMove(void) { ResetSpriteData(); FreeAllSpritePalettes(); ResetTasks(); clear_scheduled_bg_copies_to_vram(); - sLearnMoveStruct = AllocZeroed(sizeof(struct LearnMoveStruct)); + sLearnMoveStruct = AllocZeroed(sizeof(*sLearnMoveStruct)); sLearnMoveStruct->partyMon = gSpecialVar_0x8004; SetVBlankCallback(VBlankCB_LearnMove); sub_81607EC(); sub_81D2824(0); - gUnknown_0203BC38.listOffset = 0; - gUnknown_0203BC38.listRow = 0; - gUnknown_0203BC38.showContestInfo = 0; + sLearnMoveStruct2.listOffset = 0; + sLearnMoveStruct2.listRow = 0; + sLearnMoveStruct2.showContestInfo = 0; sub_8161280(); @@ -274,37 +275,37 @@ void CB2_InitLearnMove(void) LoadSpritePalette(&gUnknown_085CEBB8); sub_81610B8(); - sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38.listOffset, gUnknown_0203BC38.listRow); + sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sLearnMoveStruct2.listOffset, sLearnMoveStruct2.listRow); FillPalette(RGB_BLACK, 0, 2); SetMainCallback2(sub_816082C); } -void sub_8160740(void) +static void sub_8160740(void) { ResetSpriteData(); FreeAllSpritePalettes(); ResetTasks(); clear_scheduled_bg_copies_to_vram(); - sLearnMoveStruct = AllocZeroed(sizeof(struct LearnMoveStruct)); + sLearnMoveStruct = AllocZeroed(sizeof(*sLearnMoveStruct)); sLearnMoveStruct->state = 28; sLearnMoveStruct->partyMon = gSpecialVar_0x8004; sLearnMoveStruct->unk045 = gSpecialVar_0x8005; SetVBlankCallback(VBlankCB_LearnMove); sub_81607EC(); - sub_81D2824(gUnknown_0203BC38.showContestInfo); + sub_81D2824(sLearnMoveStruct2.showContestInfo); sub_8161280(); LoadSpriteSheet(&gUnknown_085CEBB0); LoadSpritePalette(&gUnknown_085CEBB8); sub_81610B8(); - sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, gUnknown_0203BC38.listOffset, gUnknown_0203BC38.listRow); + sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sLearnMoveStruct2.listOffset, sLearnMoveStruct2.listRow); FillPalette(RGB_BLACK, 0, 2); SetMainCallback2(sub_816082C); } -void sub_81607EC(void) +static void sub_81607EC(void) { ResetVramOamAndBgCntRegs(); ResetBgsAndClearDma3BusyFlags(0); @@ -318,7 +319,7 @@ void sub_81607EC(void) SetGpuReg(REG_OFFSET_BLDCNT, 0); } -void sub_816082C(void) +static void sub_816082C(void) { sub_8160868(); RunTasks(); @@ -328,21 +329,13 @@ void sub_816082C(void) UpdatePaletteFade(); } -void sub_816084C(const u8 *src) +static void sub_816084C(const u8 *src) { StringExpandPlaceholders(gStringVar4, src); sub_81D2BF4(gStringVar4); } -void sub_81611AC(void); -void sub_8160F50(u8); -void sub_8161074(u8); -s32 sub_8161054(void); -void sub_8160EA0(void); -void sub_8161234(void); -void render_previous_quest_text(bool8); - -void sub_8160868(void) +static void sub_8160868(void) { switch (sLearnMoveStruct->state) { @@ -402,11 +395,11 @@ void sub_8160868(void) } else if (selection == -1 || selection == 1) { - if (gUnknown_0203BC38.showContestInfo == FALSE) + if (sLearnMoveStruct2.showContestInfo == FALSE) { sLearnMoveStruct->state = 3; } - else if (gUnknown_0203BC38.showContestInfo == TRUE) + else if (sLearnMoveStruct2.showContestInfo == TRUE) { sLearnMoveStruct->state = 5; } @@ -431,11 +424,11 @@ void sub_8160868(void) } else if (selection == -1 || selection == 1) { - if (gUnknown_0203BC38.showContestInfo == FALSE) + if (sLearnMoveStruct2.showContestInfo == FALSE) { sLearnMoveStruct->state = 3; } - else if (gUnknown_0203BC38.showContestInfo == TRUE) + else if (sLearnMoveStruct2.showContestInfo == TRUE) { sLearnMoveStruct->state = 5; } @@ -491,11 +484,11 @@ void sub_8160868(void) else if (var == -1 || var == 1) { // What's the point? It gets set to 16, anyway. - if (gUnknown_0203BC38.showContestInfo == FALSE) + if (sLearnMoveStruct2.showContestInfo == FALSE) { sLearnMoveStruct->state = 3; } - else if (gUnknown_0203BC38.showContestInfo == TRUE) + else if (sLearnMoveStruct2.showContestInfo == TRUE) { sLearnMoveStruct->state = 5; } @@ -507,11 +500,11 @@ void sub_8160868(void) if (!sub_81D2C3C()) { FillWindowPixelBuffer(3, 0x11); - if (gUnknown_0203BC38.showContestInfo == FALSE) + if (sLearnMoveStruct2.showContestInfo == FALSE) { sLearnMoveStruct->state = 3; } - else if (gUnknown_0203BC38.showContestInfo == TRUE) + else if (sLearnMoveStruct2.showContestInfo == TRUE) { sLearnMoveStruct->state = 5; } @@ -554,11 +547,11 @@ void sub_8160868(void) case 28: BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); sLearnMoveStruct->state++; - if (gUnknown_0203BC38.showContestInfo == FALSE) + if (sLearnMoveStruct2.showContestInfo == FALSE) { render_previous_quest_text(TRUE); } - else if (gUnknown_0203BC38.showContestInfo == TRUE) + else if (sLearnMoveStruct2.showContestInfo == TRUE) { sub_8161074(1); } @@ -617,17 +610,17 @@ void sub_8160868(void) } } -void sub_8160EA0(void) +static void sub_8160EA0(void) { sub_8161234(); - DestroyListMenuTask(sLearnMoveStruct->listMenuTask, &gUnknown_0203BC38.listOffset, &gUnknown_0203BC38.listRow); + DestroyListMenuTask(sLearnMoveStruct->listMenuTask, &sLearnMoveStruct2.listOffset, &sLearnMoveStruct2.listRow); FreeAllWindowBuffers(); FREE_AND_SET_NULL(sLearnMoveStruct); ResetSpriteData(); FreeAllSpritePalettes(); } -void render_previous_quest_text(bool8 a) +static void render_previous_quest_text(bool8 a) { s32 i; @@ -644,12 +637,10 @@ void render_previous_quest_text(bool8 a) } } -void sub_816137C(s32); - -void sub_8160F50(u8 a0) +static void sub_8160F50(u8 a0) { s32 itemId = ListMenuHandleInputGetItemId(sLearnMoveStruct->listMenuTask); - ListMenuGetScrollAndRow(sLearnMoveStruct->listMenuTask, &gUnknown_0203BC38.listOffset, &gUnknown_0203BC38.listRow); + ListMenuGetScrollAndRow(sLearnMoveStruct->listMenuTask, &sLearnMoveStruct2.listOffset, &sLearnMoveStruct2.listRow); switch (itemId) { @@ -665,13 +656,13 @@ void sub_8160F50(u8 a0) { PutWindowTilemap(1); sLearnMoveStruct->state = 5; - gUnknown_0203BC38.showContestInfo = TRUE; + sLearnMoveStruct2.showContestInfo = TRUE; } else { PutWindowTilemap(0); sLearnMoveStruct->state = 3; - gUnknown_0203BC38.showContestInfo = FALSE; + sLearnMoveStruct2.showContestInfo = FALSE; } schedule_bg_copy_tilemap_to_vram(1); @@ -695,12 +686,12 @@ void sub_8160F50(u8 a0) } } -s32 sub_8161054(void) +static s32 sub_8161054(void) { - return sLearnMoveStruct->menuItems[gUnknown_0203BC38.listRow + gUnknown_0203BC38.listOffset].id; + return sLearnMoveStruct->menuItems[sLearnMoveStruct2.listRow + sLearnMoveStruct2.listOffset].id; } -void sub_8161074(u8 a0) +static void sub_8161074(u8 a0) { if (!a0) { @@ -710,11 +701,11 @@ void sub_8161074(u8 a0) } } -void sub_81610B8(void) +static void sub_81610B8(void) { int i; - sLearnMoveStruct->unk114 = 0xFF; + sLearnMoveStruct->unk114 = -1; sLearnMoveStruct->unk113 = -1; sub_81611AC(); @@ -735,7 +726,7 @@ void sub_81610B8(void) } } -void sub_81611AC(void) +static void sub_81611AC(void) { if (sLearnMoveStruct->unk114 == 0xFF) { @@ -746,11 +737,11 @@ void sub_81611AC(void) { gTempScrollArrowTemplate = gUnknown_085CEBD0; gTempScrollArrowTemplate.fullyDownThreshold = sLearnMoveStruct->numMenuChoices - sLearnMoveStruct->unk111; - sLearnMoveStruct->unk113 = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, &gUnknown_0203BC38.listOffset); + sLearnMoveStruct->unk113 = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, &sLearnMoveStruct2.listOffset); } } -void sub_8161234(void) +static void sub_8161234(void) { if (sLearnMoveStruct->unk114 != 0xFF) { @@ -765,7 +756,7 @@ void sub_8161234(void) } } -void sub_8161280(void) +static void sub_8161280(void) { s32 i; u8 nickname[POKEMON_NAME_LENGTH + 1]; @@ -788,9 +779,10 @@ void sub_8161280(void) void sub_816137C(s32 item) { + u16 numHearts; u16 i; - if (!gUnknown_0203BC38.showContestInfo || item == LIST_NOTHING_CHOSEN) + if (!sLearnMoveStruct2.showContestInfo || item == LIST_B_PRESSED) { for (i = 0; i < 16; i++) { @@ -799,16 +791,16 @@ void sub_816137C(s32 item) } else { - u8 temp1 = gContestEffects[gContestMoves[item].effect].appeal / 10; + numHearts = (u8)(gContestEffects[gContestMoves[item].effect].appeal / 10); - if (temp1 == 0xFF) + if (numHearts == 0xFF) { - temp1 = 0; + numHearts = 0; } for (i = 0; i < 8; i++) { - if (i < temp1) + if (i < numHearts) { StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 1); } @@ -819,24 +811,24 @@ void sub_816137C(s32 item) gSprites[sLearnMoveStruct->spriteIds[i]].invisible = FALSE; } - temp1 = gContestEffects[gContestMoves[item].effect].jam / 10; + numHearts = (u8)(gContestEffects[gContestMoves[item].effect].jam / 10); - if (temp1 == 0xFF) + if (numHearts == 0xFF) { - temp1 = 0; + numHearts = 0; } for (i = 0; i < 8; i++) { - if (i < temp1) + if (i < numHearts) { - StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 3); + StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i + 8]], 3); } else { - StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 2); + StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i + 8]], 2); } - gSprites[sLearnMoveStruct->spriteIds[i]].invisible = FALSE; + gSprites[sLearnMoveStruct->spriteIds[i + 8]].invisible = FALSE; } } } diff --git a/src/slot_machine.c b/src/slot_machine.c index 5422103c3..6b6a46cf8 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -975,7 +975,7 @@ bool8 sub_8102318(struct Task *task) bool8 sub_8102344(struct Task *task) { - s8 input = ProcessMenuInputNoWrap_(); + s8 input = Menu_ProcessInputNoWrap_(); if (input == 0) { sub_8197434(0, TRUE); From 6dac87abfd2bea0ddf126cdc1e9c31757c8fee36 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Sun, 12 Aug 2018 14:01:08 -0700 Subject: [PATCH 11/21] Cleanup and document learn_move --- asm/learn_move.s | 8 -- asm/pokenav.s | 2 +- include/learn_move.h | 2 +- include/pokenav.h | 1 + ld_script.txt | 1 - src/learn_move.c | 181 +++++++++++++++++++++---------------------- 6 files changed, 93 insertions(+), 102 deletions(-) delete mode 100644 asm/learn_move.s diff --git a/asm/learn_move.s b/asm/learn_move.s deleted file mode 100644 index 2428f2984..000000000 --- a/asm/learn_move.s +++ /dev/null @@ -1,8 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/pokenav.s b/asm/pokenav.s index c9fe787e0..250eca0f2 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -22585,7 +22585,7 @@ sub_81D2ACC: @ 81D2ACC push {r7} sub sp, 0xC adds r4, r0, 0 - bl sub_816137C + bl ShowHideHearts movs r0, 0x1 movs r1, 0x11 bl FillWindowPixelBuffer diff --git a/include/learn_move.h b/include/learn_move.h index 2acc21cde..542ae6a5a 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -2,6 +2,6 @@ #define GUARD_LEARN_MOVE_H void TeachMoveTutorMove(void); -void sub_816137C(s32); +void ShowHideHearts(s32); #endif //GUARD_LEARN_MOVE_H diff --git a/include/pokenav.h b/include/pokenav.h index dd3fd4905..b595e2be9 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -1,6 +1,7 @@ #ifndef GUARD_POKENAV_H #define GUARD_POKENAV_H #include "player_pc.h" +#include "list_menu.h" bool8 sub_81D5C18(void); bool8 sub_81D20BC(void *arg0); diff --git a/ld_script.txt b/ld_script.txt index 1bd90e19a..5f9d35617 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -209,7 +209,6 @@ SECTIONS { src/fldeff_sweetscent.o(.text); asm/battle_anim_815A0D4.o(.text); src/learn_move.o(.text); - asm/learn_move.o(.text); src/fldeff_softboiled.o(.text); src/decoration_inventory.o(.text); src/roamer.o(.text); diff --git a/src/learn_move.c b/src/learn_move.c index 9058a3287..e288a393d 100644 --- a/src/learn_move.c +++ b/src/learn_move.c @@ -1,5 +1,6 @@ #include "global.h" #include "main.h" +#include "battle.h" #include "bg.h" #include "contest_effect.h" #include "data2.h" @@ -28,20 +29,18 @@ static EWRAM_DATA struct { u8 state; u8 spriteIds[16]; /*0x001*/ - u8 filler11; /*0x011*/ u16 movesToLearn[4]; /*0x012*/ u8 filler1A[0x44 - 0x1A]; /*0x01A*/ u8 partyMon; /*0x044*/ - u8 unk045; /*0x045*/ - u8 filler46[2]; /*0x046*/ - struct ListMenuItem menuItems[4]; /*0x048*/ - u8 filler68[0x110 - 0x68]; /*0x068*/ + u8 moveSlot; /*0x045*/ + struct ListMenuItem menuItems[20]; /*0x048*/ + u8 fillerE8[0x110 - 0xE8]; /*0x0E8*/ u8 numMenuChoices; /*0x110*/ - u8 unk111; /*0x111*/ + u8 numToShowAtOnce; /*0x111*/ u8 listMenuTask; /*0x112*/ - u8 unk113; /*0x113*/ - u8 unk114; /*0x114*/ - u16 unk116; /*0x116*/ + u8 scrollArrowTaskId1; /*0x113*/ + u8 scrollArrowTaskId2; /*0x114*/ + u16 scrollOffset; /*0x116*/ } *sLearnMoveStruct = {0}; static EWRAM_DATA struct { @@ -212,21 +211,21 @@ const struct BgTemplate gUnknown_085CEC28[] = }, }; -static void sub_8160868(void); -static void sub_8161280(void); -static void sub_81610B8(void); -static void sub_816082C(void); -static void sub_8160664(u8 taskId); +static void LearnMoveMain(void); +static void CreateMenuItemsList(void); +static void CreateHearts(void); +static void CB2_Main(void); +static void Task_WaitForFadeOut(u8 taskId); static void CB2_InitLearnMove(void); -static void sub_8160740(void); -static void sub_81607EC(void); -static void sub_81611AC(void); -static void sub_8160F50(u8); -static void sub_8161074(u8); -static s32 sub_8161054(void); -static void sub_8160EA0(void); -static void sub_8161234(void); -static void render_previous_quest_text(bool8); +static void CB2_InitLearnMoveReturnFromSelectMove(void); +static void InitBGs(void); +static void AddScrollArrows(void); +static void HandleInput(u8); +static void ShowTeachMoveText(u8); +static s32 GetCurrentItemId(void); +static void FreeListMenuResources(void); +static void RemoveScrollArrows(void); +static void HideSpritesAndPrintTeachText(bool8); static void VBlankCB_LearnMove(void) { @@ -238,11 +237,11 @@ static void VBlankCB_LearnMove(void) void TeachMoveTutorMove(void) { ScriptContext2_Enable(); - CreateTask(sub_8160664, 0xA); + CreateTask(Task_WaitForFadeOut, 0xA); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0); } -static void sub_8160664(u8 taskId) +static void Task_WaitForFadeOut(u8 taskId) { if (!gPaletteFade.active) { @@ -262,25 +261,25 @@ static void CB2_InitLearnMove(void) sLearnMoveStruct->partyMon = gSpecialVar_0x8004; SetVBlankCallback(VBlankCB_LearnMove); - sub_81607EC(); + InitBGs(); sub_81D2824(0); sLearnMoveStruct2.listOffset = 0; sLearnMoveStruct2.listRow = 0; - sLearnMoveStruct2.showContestInfo = 0; + sLearnMoveStruct2.showContestInfo = FALSE; - sub_8161280(); + CreateMenuItemsList(); LoadSpriteSheet(&gUnknown_085CEBB0); LoadSpritePalette(&gUnknown_085CEBB8); - sub_81610B8(); + CreateHearts(); sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sLearnMoveStruct2.listOffset, sLearnMoveStruct2.listRow); FillPalette(RGB_BLACK, 0, 2); - SetMainCallback2(sub_816082C); + SetMainCallback2(CB2_Main); } -static void sub_8160740(void) +static void CB2_InitLearnMoveReturnFromSelectMove(void) { ResetSpriteData(); FreeAllSpritePalettes(); @@ -289,23 +288,23 @@ static void sub_8160740(void) sLearnMoveStruct = AllocZeroed(sizeof(*sLearnMoveStruct)); sLearnMoveStruct->state = 28; sLearnMoveStruct->partyMon = gSpecialVar_0x8004; - sLearnMoveStruct->unk045 = gSpecialVar_0x8005; + sLearnMoveStruct->moveSlot = gSpecialVar_0x8005; SetVBlankCallback(VBlankCB_LearnMove); - sub_81607EC(); + InitBGs(); sub_81D2824(sLearnMoveStruct2.showContestInfo); - sub_8161280(); + CreateMenuItemsList(); LoadSpriteSheet(&gUnknown_085CEBB0); LoadSpritePalette(&gUnknown_085CEBB8); - sub_81610B8(); + CreateHearts(); sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sLearnMoveStruct2.listOffset, sLearnMoveStruct2.listRow); FillPalette(RGB_BLACK, 0, 2); - SetMainCallback2(sub_816082C); + SetMainCallback2(CB2_Main); } -static void sub_81607EC(void) +static void InitBGs(void) { ResetVramOamAndBgCntRegs(); ResetBgsAndClearDma3BusyFlags(0); @@ -319,9 +318,9 @@ static void sub_81607EC(void) SetGpuReg(REG_OFFSET_BLDCNT, 0); } -static void sub_816082C(void) +static void CB2_Main(void) { - sub_8160868(); + LearnMoveMain(); RunTasks(); AnimateSprites(); BuildOamBuffer(); @@ -335,13 +334,13 @@ static void sub_816084C(const u8 *src) sub_81D2BF4(gStringVar4); } -static void sub_8160868(void) +static void LearnMoveMain(void) { switch (sLearnMoveStruct->state) { case 0: sLearnMoveStruct->state++; - render_previous_quest_text(FALSE); + HideSpritesAndPrintTeachText(FALSE); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK); break; case 1: @@ -354,20 +353,20 @@ static void sub_8160868(void) sLearnMoveStruct->state++; break; case 3: - render_previous_quest_text(FALSE); + HideSpritesAndPrintTeachText(FALSE); sLearnMoveStruct->state++; - sub_81611AC(); + AddScrollArrows(); break; case 4: - sub_8160F50(0); + HandleInput(FALSE); return; case 5: - sub_8161074(0); + ShowTeachMoveText(FALSE); sLearnMoveStruct->state++; - sub_81611AC(); + AddScrollArrows(); break; case 6: - sub_8160F50(1); + HandleInput(TRUE); break; case 8: if (!sub_81D2C3C()) @@ -382,7 +381,7 @@ static void sub_8160868(void) if (selection == 0) { - if (GiveMoveToMon(&gPlayerParty[sLearnMoveStruct->partyMon], sub_8161054()) != 0xFFFF) + if (GiveMoveToMon(&gPlayerParty[sLearnMoveStruct->partyMon], GetCurrentItemId()) != 0xFFFF) { sub_816084C(gText_PkmnLearnedMove4); gSpecialVar_0x8004 = 1; @@ -462,7 +461,7 @@ static void sub_8160868(void) } break; case 24: - StringCopy(gStringVar2, gMoveNames[sub_8161054()]); + StringCopy(gStringVar2, gMoveNames[GetCurrentItemId()]); sub_816084C(gText_StopTryingToTeachMove); sLearnMoveStruct->state++; break; @@ -520,8 +519,8 @@ static void sub_8160868(void) case 20: if (!gPaletteFade.active) { - ShowSelectMovePokemonSummaryScreen(gPlayerParty, sLearnMoveStruct->partyMon, gPlayerPartyCount - 1, sub_8160740, sub_8161054()); - sub_8160EA0(); + ShowSelectMovePokemonSummaryScreen(gPlayerParty, sLearnMoveStruct->partyMon, gPlayerPartyCount - 1, CB2_InitLearnMoveReturnFromSelectMove, GetCurrentItemId()); + FreeListMenuResources(); } break; case 21: @@ -540,7 +539,7 @@ static void sub_8160868(void) case 15: if (!gPaletteFade.active) { - sub_8160EA0(); + FreeListMenuResources(); SetMainCallback2(CB2_ReturnToField); } break; @@ -549,30 +548,30 @@ static void sub_8160868(void) sLearnMoveStruct->state++; if (sLearnMoveStruct2.showContestInfo == FALSE) { - render_previous_quest_text(TRUE); + HideSpritesAndPrintTeachText(TRUE); } else if (sLearnMoveStruct2.showContestInfo == TRUE) { - sub_8161074(1); + ShowTeachMoveText(TRUE); } - sub_8161234(); + RemoveScrollArrows(); CopyWindowToVram(3, 2); break; case 29: if (!gPaletteFade.active) { - if (sLearnMoveStruct->unk045 == 4) + if (sLearnMoveStruct->moveSlot == MAX_MON_MOVES) { sLearnMoveStruct->state = 24; } else { - u16 moveId = GetMonData(&gPlayerParty[sLearnMoveStruct->partyMon], MON_DATA_MOVE1 + sLearnMoveStruct->unk045); + u16 moveId = GetMonData(&gPlayerParty[sLearnMoveStruct->partyMon], MON_DATA_MOVE1 + sLearnMoveStruct->moveSlot); StringCopy(gStringVar3, gMoveNames[moveId]); - RemoveMonPPBonus(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->unk045); - SetMonMoveSlot(&gPlayerParty[sLearnMoveStruct->partyMon], sub_8161054(), sLearnMoveStruct->unk045); - StringCopy(gStringVar2, gMoveNames[sub_8161054()]); + RemoveMonPPBonus(&gPlayerParty[sLearnMoveStruct->partyMon], sLearnMoveStruct->moveSlot); + SetMonMoveSlot(&gPlayerParty[sLearnMoveStruct->partyMon], GetCurrentItemId(), sLearnMoveStruct->moveSlot); + StringCopy(gStringVar2, gMoveNames[GetCurrentItemId()]); sub_816084C(gText_12AndPoof); sLearnMoveStruct->state = 30; gSpecialVar_0x8004 = 1; @@ -610,9 +609,9 @@ static void sub_8160868(void) } } -static void sub_8160EA0(void) +static void FreeListMenuResources(void) { - sub_8161234(); + RemoveScrollArrows(); DestroyListMenuTask(sLearnMoveStruct->listMenuTask, &sLearnMoveStruct2.listOffset, &sLearnMoveStruct2.listRow); FreeAllWindowBuffers(); FREE_AND_SET_NULL(sLearnMoveStruct); @@ -620,7 +619,7 @@ static void sub_8160EA0(void) FreeAllSpritePalettes(); } -static void render_previous_quest_text(bool8 a) +static void HideSpritesAndPrintTeachText(bool8 a) { s32 i; @@ -637,7 +636,7 @@ static void render_previous_quest_text(bool8 a) } } -static void sub_8160F50(u8 a0) +static void HandleInput(bool8 showContest) { s32 itemId = ListMenuHandleInputGetItemId(sLearnMoveStruct->listMenuTask); ListMenuGetScrollAndRow(sLearnMoveStruct->listMenuTask, &sLearnMoveStruct2.listOffset, &sLearnMoveStruct2.listRow); @@ -652,7 +651,7 @@ static void sub_8160F50(u8 a0) PlaySE(SE_SELECT); - if (a0 == 0) + if (showContest == FALSE) { PutWindowTilemap(1); sLearnMoveStruct->state = 5; @@ -666,18 +665,18 @@ static void sub_8160F50(u8 a0) } schedule_bg_copy_tilemap_to_vram(1); - sub_816137C(sub_8161054()); + ShowHideHearts(GetCurrentItemId()); break; case LIST_B_PRESSED: PlaySE(SE_SELECT); - sub_8161234(); + RemoveScrollArrows(); sLearnMoveStruct->state = 12; StringExpandPlaceholders(gStringVar4, gText_GiveUpTeachingNewMove); sub_81D2BF4(gStringVar4); break; default: PlaySE(SE_SELECT); - sub_8161234(); + RemoveScrollArrows(); sLearnMoveStruct->state = 8; StringCopy(gStringVar2, gMoveNames[itemId]); StringExpandPlaceholders(gStringVar4, gText_TeachX); @@ -686,14 +685,14 @@ static void sub_8160F50(u8 a0) } } -static s32 sub_8161054(void) +static s32 GetCurrentItemId(void) { return sLearnMoveStruct->menuItems[sLearnMoveStruct2.listRow + sLearnMoveStruct2.listOffset].id; } -static void sub_8161074(u8 a0) +static void ShowTeachMoveText(bool8 showContest) { - if (!a0) + if (showContest == FALSE) { StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn); FillWindowPixelBuffer(3, 0x11); @@ -701,13 +700,13 @@ static void sub_8161074(u8 a0) } } -static void sub_81610B8(void) +static void CreateHearts(void) { int i; - sLearnMoveStruct->unk114 = -1; - sLearnMoveStruct->unk113 = -1; - sub_81611AC(); + sLearnMoveStruct->scrollArrowTaskId2 = -1; + sLearnMoveStruct->scrollArrowTaskId1 = -1; + AddScrollArrows(); for (i = 0; i < 8; i++) { @@ -726,37 +725,37 @@ static void sub_81610B8(void) } } -static void sub_81611AC(void) +static void AddScrollArrows(void) { - if (sLearnMoveStruct->unk114 == 0xFF) + if (sLearnMoveStruct->scrollArrowTaskId2 == 0xFF) { - sLearnMoveStruct->unk114 = AddScrollIndicatorArrowPair(&gUnknown_085CEBC0, &sLearnMoveStruct->unk116); + sLearnMoveStruct->scrollArrowTaskId2 = AddScrollIndicatorArrowPair(&gUnknown_085CEBC0, &sLearnMoveStruct->scrollOffset); } - if (sLearnMoveStruct->unk113 == 0xFF) + if (sLearnMoveStruct->scrollArrowTaskId1 == 0xFF) { gTempScrollArrowTemplate = gUnknown_085CEBD0; - gTempScrollArrowTemplate.fullyDownThreshold = sLearnMoveStruct->numMenuChoices - sLearnMoveStruct->unk111; - sLearnMoveStruct->unk113 = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, &sLearnMoveStruct2.listOffset); + gTempScrollArrowTemplate.fullyDownThreshold = sLearnMoveStruct->numMenuChoices - sLearnMoveStruct->numToShowAtOnce; + sLearnMoveStruct->scrollArrowTaskId1 = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, &sLearnMoveStruct2.listOffset); } } -static void sub_8161234(void) +static void RemoveScrollArrows(void) { - if (sLearnMoveStruct->unk114 != 0xFF) + if (sLearnMoveStruct->scrollArrowTaskId2 != 0xFF) { - RemoveScrollIndicatorArrowPair(sLearnMoveStruct->unk114); - sLearnMoveStruct->unk114 = 0xFF; + RemoveScrollIndicatorArrowPair(sLearnMoveStruct->scrollArrowTaskId2); + sLearnMoveStruct->scrollArrowTaskId2 = 0xFF; } - if (sLearnMoveStruct->unk113 != 0xFF) + if (sLearnMoveStruct->scrollArrowTaskId1 != 0xFF) { - RemoveScrollIndicatorArrowPair(sLearnMoveStruct->unk113); - sLearnMoveStruct->unk113 = 0xFF; + RemoveScrollIndicatorArrowPair(sLearnMoveStruct->scrollArrowTaskId1); + sLearnMoveStruct->scrollArrowTaskId1 = 0xFF; } } -static void sub_8161280(void) +static void CreateMenuItemsList(void) { s32 i; u8 nickname[POKEMON_NAME_LENGTH + 1]; @@ -774,10 +773,10 @@ static void sub_8161280(void) sLearnMoveStruct->menuItems[sLearnMoveStruct->numMenuChoices].name = gText_Cancel; sLearnMoveStruct->menuItems[sLearnMoveStruct->numMenuChoices].id = LIST_B_PRESSED; sLearnMoveStruct->numMenuChoices++; - sLearnMoveStruct->unk111 = sub_81D28C8(sLearnMoveStruct->menuItems, sLearnMoveStruct->numMenuChoices); + sLearnMoveStruct->numToShowAtOnce = sub_81D28C8(sLearnMoveStruct->menuItems, sLearnMoveStruct->numMenuChoices); } -void sub_816137C(s32 item) +void ShowHideHearts(s32 item) { u16 numHearts; u16 i; From a07d69d7c2e65ed8ea71ec88cc3c4cadbb444510 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 14 Aug 2018 21:56:11 -0700 Subject: [PATCH 12/21] Finish pokemon_summary_screen --- ...emon_summary_screen.s => battle_pyramid.s} | 1533 +---------- data/pokemon_summary_screen.s | 507 ---- data/unk_pokedex_area_screen_helper.s | 110 + include/battle_controllers.h | 2 + include/battle_frontier_2.h | 1 + include/battle_tent.h | 6 + include/contest_effect.h | 1 + include/graphics.h | 20 + include/m4a.h | 1 + include/menu.h | 2 + include/menu_helpers.h | 1 + include/mon_markings.h | 2 + include/party_menu.h | 3 + include/pokeball.h | 2 + include/pokemon_storage_system.h | 1 + include/pokemon_summary_screen.h | 2 +- include/region_map.h | 1 + include/strings.h | 48 + ld_script.txt | 7 +- src/battle_pyramid.c | 248 ++ src/data/text/nature_names.h | 54 + src/pokemon_summary_screen.c | 2396 +++++++++-------- src/unk_pokedex_area_screen_helper.c | 75 + sym_ewram.txt | 27 +- 24 files changed, 1930 insertions(+), 3120 deletions(-) rename asm/{pokemon_summary_screen.s => battle_pyramid.s} (70%) delete mode 100644 data/pokemon_summary_screen.s create mode 100644 data/unk_pokedex_area_screen_helper.s create mode 100644 include/battle_tent.h create mode 100644 src/battle_pyramid.c create mode 100644 src/data/text/nature_names.h create mode 100644 src/unk_pokedex_area_screen_helper.c diff --git a/asm/pokemon_summary_screen.s b/asm/battle_pyramid.s similarity index 70% rename from asm/pokemon_summary_screen.s rename to asm/battle_pyramid.s index 91b1693fd..ea07fdd0a 100644 --- a/asm/pokemon_summary_screen.s +++ b/asm/battle_pyramid.s @@ -5,1523 +5,6 @@ .text - - - thumb_func_start sub_81C4568 -sub_81C4568: @ 81C4568 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_0203CF1C - ldr r2, [r2] - adds r0, 0x3 - ldr r3, =0x000040d3 - adds r2, r3 - adds r0, r2, r0 - ldrb r0, [r0] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r5, =gSprites - adds r4, r5 - adds r1, 0x3 - adds r2, r1 - ldrb r0, [r2] - lsls r3, r0, 4 - adds r3, r0 - lsls r3, 2 - adds r3, r5 - adds r5, r4, 0 - adds r5, 0x2A - ldrb r1, [r5] - adds r2, r3, 0 - adds r2, 0x2A - ldrb r0, [r2] - strb r0, [r5] - strb r1, [r2] - ldrb r6, [r4, 0x5] - lsrs r5, r6, 4 - ldrb r2, [r3, 0x5] - lsrs r2, 4 - lsls r2, 4 - movs r1, 0xF - adds r0, r1, 0 - ands r0, r6 - orrs r0, r2 - strb r0, [r4, 0x5] - lsls r5, 4 - ldrb r0, [r3, 0x5] - ands r1, r0 - orrs r1, r5 - strb r1, [r3, 0x5] - adds r4, 0x3F - ldrb r0, [r4] - movs r2, 0x4 - orrs r0, r2 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - strb r0, [r4] - adds r3, 0x3F - ldrb r0, [r3] - orrs r0, r2 - ands r0, r1 - strb r0, [r3] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4568 - - thumb_func_start sub_81C45F4 -sub_81C45F4: @ 81C45F4 - push {r4-r6,lr} - adds r3, r0, 0 - adds r6, r1, 0 - ldr r0, =gUnknown_0203CF1C - ldr r2, [r0] - adds r5, r2, 0 - adds r5, 0x70 - movs r1, 0 - ldrsh r0, [r6, r1] - cmp r0, 0 - beq _081C4620 - cmp r0, 0x1 - bne _081C4610 - b _081C4750 -_081C4610: - adds r0, r3, 0 - bl sub_81C47B4 - lsls r0, 24 - lsrs r0, 24 - b _081C4770 - .pool -_081C4620: - ldr r0, =gMain - ldr r1, =0x00000439 - adds r0, r1 - ldrb r1, [r0] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _081C4680 - ldr r1, =0x000040be - adds r0, r2, r1 - ldrb r1, [r0] - movs r0, 0x3 - bl sub_80688F8 - lsls r0, 24 - cmp r0, 0 - beq _081C4668 - ldrh r2, [r5, 0x2] - lsls r0, r2, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - ldr r1, [r1, 0x8] - b _081C46D6 - .pool -_081C4668: - ldrh r2, [r5, 0x2] - lsls r0, r2, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, =gMonSpritesGfxPtr - ldr r1, [r1] - b _081C46B0 - .pool -_081C4680: - ldr r0, =gMonSpritesGfxPtr - ldr r3, [r0] - adds r4, r0, 0 - cmp r3, 0 - beq _081C46E4 - ldr r1, [r2] - ldr r0, =gPlayerParty - cmp r1, r0 - beq _081C46A6 - ldr r1, =0x000040bc - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x2 - beq _081C46A6 - adds r1, 0x33 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C46CC -_081C46A6: - ldrh r2, [r5, 0x2] - lsls r0, r2, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, [r4] -_081C46B0: - ldr r1, [r1, 0x8] - ldr r3, [r5, 0xC] - bl HandleLoadSpecialPokePic_2 - b _081C4768 - .pool -_081C46CC: - ldrh r2, [r5, 0x2] - lsls r0, r2, 3 - ldr r1, =gMonFrontPicTable - adds r0, r1 - ldr r1, [r3, 0x8] -_081C46D6: - ldr r3, [r5, 0xC] - bl HandleLoadSpecialPokePic_DontHandleDeoxys - b _081C4768 - .pool -_081C46E4: - ldr r1, [r2] - ldr r0, =gPlayerParty - cmp r1, r0 - beq _081C4700 - ldr r1, =0x000040bc - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x2 - beq _081C4700 - adds r1, 0x33 - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bne _081C472C -_081C4700: - ldrh r4, [r5, 0x2] - lsls r4, 3 - ldr r0, =gMonFrontPicTable - adds r4, r0 - movs r0, 0 - movs r1, 0x1 - bl sub_806F4F8 - adds r1, r0, 0 - ldrh r2, [r5, 0x2] - ldr r3, [r5, 0xC] - adds r0, r4, 0 - bl HandleLoadSpecialPokePic_2 - b _081C4768 - .pool -_081C472C: - ldrh r4, [r5, 0x2] - lsls r4, 3 - ldr r0, =gMonFrontPicTable - adds r4, r0 - movs r0, 0 - movs r1, 0x1 - bl sub_806F4F8 - adds r1, r0, 0 - ldrh r2, [r5, 0x2] - ldr r3, [r5, 0xC] - adds r0, r4, 0 - bl HandleLoadSpecialPokePic_DontHandleDeoxys - b _081C4768 - .pool -_081C4750: - ldrh r0, [r5, 0x2] - ldr r1, [r5, 0x48] - ldr r2, [r5, 0xC] - bl GetMonSpritePalStructFromOtIdPersonality - adds r4, r0, 0 - bl LoadCompressedObjectPalette - ldrh r0, [r4, 0x4] - movs r1, 0x1 - bl SetMultiuseSpriteTemplateToPokemon -_081C4768: - ldrh r0, [r6] - adds r0, 0x1 - strh r0, [r6] - movs r0, 0xFF -_081C4770: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_81C45F4 - - thumb_func_start sub_81C4778 -sub_81C4778: @ 81C4778 - push {r4,lr} - ldr r0, =gUnknown_0203CF1C - ldr r1, [r0] - adds r4, r1, 0 - adds r4, 0x70 - ldrb r0, [r4, 0x4] - cmp r0, 0 - bne _081C47AE - adds r0, r1, 0 - adds r0, 0xC - bl ShouldPlayNormalMonCry - cmp r0, 0x1 - bne _081C47A4 - ldrh r0, [r4, 0x2] - movs r1, 0 - movs r2, 0 - bl PlayCry3 - b _081C47AE - .pool -_081C47A4: - ldrh r0, [r4, 0x2] - movs r1, 0 - movs r2, 0xB - bl PlayCry3 -_081C47AE: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81C4778 - - thumb_func_start sub_81C47B4 -sub_81C47B4: @ 81C47B4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gUnknown_0203CF1C - ldr r6, [r0] - adds r6, 0x70 - ldr r0, =gMultiuseSpriteTemplate - movs r1, 0x28 - movs r2, 0x40 - movs r3, 0x5 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r4, r0, 4 - add r4, r8 - lsls r4, 2 - ldr r5, =gSprites - adds r7, r4, r5 - adds r0, r7, 0 - bl FreeSpriteOamMatrix - ldrh r0, [r6, 0x2] - movs r1, 0 - strh r0, [r7, 0x2E] - strh r1, [r7, 0x32] - adds r5, 0x1C - adds r4, r5 - ldr r0, =sub_81C4844 - str r0, [r4] - ldrb r1, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - strb r0, [r7, 0x5] - ldrh r0, [r6, 0x2] - bl IsMonSpriteNotFlipped - lsls r0, 24 - cmp r0, 0 - bne _081C4828 - adds r0, r7, 0 - adds r0, 0x3F - ldrb r1, [r0] - movs r2, 0x1 - orrs r1, r2 - strb r1, [r0] - b _081C4836 - .pool -_081C4828: - adds r2, r7, 0 - adds r2, 0x3F - ldrb r1, [r2] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2] -_081C4836: - mov r0, r8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81C47B4 - - thumb_func_start sub_81C4844 -sub_81C4844: @ 81C4844 - push {r4,r5,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - adds r5, r0, 0 - adds r5, 0x70 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081C487E - movs r1, 0x32 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _081C487E - ldrh r0, [r4, 0x2E] - bl IsMonSpriteNotFlipped - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x30] - bl sub_81C4778 - ldrh r1, [r4, 0x2E] - ldrb r2, [r5, 0x4] - adds r0, r4, 0 - bl PokemonSummaryDoMonAnimation -_081C487E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4844 - - thumb_func_start sub_81C488C -sub_81C488C: @ 81C488C - ldr r1, =gUnknown_0203CF24 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_81C488C - - thumb_func_start sub_81C4898 -sub_81C4898: @ 81C4898 - push {r4,lr} - ldr r4, =gUnknown_0203CF24 - ldrb r0, [r4] - cmp r0, 0xFF - beq _081C48AA - bl DestroyTask - movs r0, 0xFF - strb r0, [r4] -_081C48AA: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4898 - - thumb_func_start sub_81C48B4 -sub_81C48B4: @ 81C48B4 - push {lr} - ldr r2, =gSprites - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040d3 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _081C48E8 - movs r0, 0x1 - b _081C48EA - .pool -_081C48E8: - movs r0, 0 -_081C48EA: - pop {r1} - bx r1 - thumb_func_end sub_81C48B4 - - thumb_func_start sub_81C48F0 -sub_81C48F0: @ 81C48F0 - push {r4-r6,lr} - ldr r6, =gSprites - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - ldr r4, =0x000040d3 - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r5] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - bl sub_806EE98 - ldr r0, [r5] - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - lsls r3, r0, 4 - movs r1, 0x80 - lsls r1, 1 - adds r0, r1, 0 - orrs r3, r0 - movs r2, 0 - ldr r5, =gPlttBufferUnfaded - ldr r4, =gPlttBufferFaded -_081C494C: - adds r0, r2, r3 - lsls r0, 16 - lsrs r0, 15 - adds r1, r0, r5 - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0xF - bls _081C494C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C48F0 - - thumb_func_start sub_81C4984 -sub_81C4984: @ 81C4984 - push {r4-r6,lr} - adds r5, r0, 0 - ldr r1, =0x00007533 - ldr r2, =gUnknown_0861D120 - adds r0, r1, 0 - bl sub_811FF94 - adds r4, r0, 0 - ldr r6, =gUnknown_0203CF1C - ldr r0, [r6] - str r4, [r0, 0x8] - cmp r4, 0 - beq _081C49CE - adds r0, r5, 0 - movs r1, 0x8 - bl GetMonData - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - ldr r1, [r6] - ldr r2, [r1, 0x8] - movs r0, 0x3C - strh r0, [r2, 0x20] - ldr r2, [r1, 0x8] - movs r0, 0x1A - strh r0, [r2, 0x22] - ldr r2, [r1, 0x8] - ldrb r1, [r2, 0x5] - subs r0, 0x27 - ands r0, r1 - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x5] -_081C49CE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4984 - - thumb_func_start sub_81C49E0 -sub_81C49E0: @ 81C49E0 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r0, [r0, 0x8] - bl DestroySprite - ldr r0, =0x00007533 - bl FreeSpriteTilesByTag - adds r0, r4, 0 - bl sub_81C4984 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C49E0 - - thumb_func_start sub_81C4A08 -sub_81C4A08: @ 81C4A08 - push {r4,lr} - movs r1, 0x26 - bl GetMonData - lsls r0, 16 - lsrs r0, 16 - bl ItemIdToBallId - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl LoadBallGfx - lsls r0, r4, 1 - adds r0, r4 - lsls r0, 3 - ldr r1, =gBallSpriteTemplates - adds r0, r1 - movs r1, 0x10 - movs r2, 0x88 - movs r3, 0 - bl CreateSprite - ldr r2, =gUnknown_0203CF1C - ldr r1, [r2] - ldr r3, =0x000040d4 - adds r1, r3 - strb r0, [r1] - ldr r4, =gSprites - ldr r2, [r2] - adds r2, r3 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x5] - movs r2, 0xC - orrs r1, r2 - strb r1, [r0, 0x5] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4A08 - - thumb_func_start sub_81C4A88 -sub_81C4A88: @ 81C4A88 - push {r4,r5,lr} - ldr r5, =gUnknown_0203CF1C - ldr r0, [r5] - ldr r1, =0x000040d5 - adds r4, r0, r1 - ldrb r0, [r4] - cmp r0, 0xFF - bne _081C4AA6 - ldr r0, =gUnknown_0861D108 - movs r1, 0x40 - movs r2, 0x98 - movs r3, 0 - bl CreateSprite - strb r0, [r4] -_081C4AA6: - ldr r0, [r5] - adds r0, 0xC - bl sub_81B205C - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _081C4AE8 - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - subs r1, r2, 0x1 - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnim - movs r0, 0x2 - movs r1, 0 - bl sub_81C4204 - b _081C4AF0 - .pool -_081C4AE8: - movs r0, 0x2 - movs r1, 0x1 - bl sub_81C4204 -_081C4AF0: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C4A88 - - thumb_func_start sub_81C4AF8 -sub_81C4AF8: @ 81C4AF8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gUnknown_0203CF1C - ldr r1, =0x000040d3 - add r1, r8 - ldr r0, [r0] - adds r7, r0, r1 - ldr r1, =0x000040c0 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x1 - bls _081C4BD2 - movs r0, 0 - mov r9, r0 - mov r1, r8 - cmp r1, 0x8 - bne _081C4B2A - movs r0, 0x1 - mov r9, r0 -_081C4B2A: - movs r5, 0 - ldr r6, =gSprites - mov r10, r5 -_081C4B30: - lsls r1, r5, 20 - movs r0, 0xB2 - lsls r0, 15 - adds r1, r0 - asrs r1, 16 - ldr r0, =gUnknown_0861D084 - movs r2, 0x28 - mov r3, r9 - bl CreateSprite - adds r1, r7, r5 - strb r0, [r1] - adds r4, r1, 0 - cmp r5, 0 - bne _081C4B74 - ldrb r1, [r7] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x4 - bl StartSpriteAnim - b _081C4B9A - .pool -_081C4B74: - cmp r5, 0x9 - bne _081C4B8A - ldrb r1, [r7, 0x9] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x5 - bl StartSpriteAnim - b _081C4B9A -_081C4B8A: - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - movs r1, 0x6 - bl StartSpriteAnim -_081C4B9A: - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r6, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_81C4BE4 - str r1, [r0] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r8 - strh r1, [r0, 0x2E] - ldrb r1, [r4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r10 - strh r1, [r0, 0x30] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x9 - bls _081C4B30 -_081C4BD2: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4AF8 - - thumb_func_start sub_81C4BE4 -sub_81C4BE4: @ 81C4BE4 - push {lr} - adds r3, r0, 0 - adds r0, 0x2A - ldrb r0, [r0] - subs r0, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _081C4C1C - ldrh r0, [r3, 0x30] - adds r0, 0x1 - movs r1, 0x1F - ands r0, r1 - strh r0, [r3, 0x30] - cmp r0, 0x18 - ble _081C4C10 - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - b _081C4C2A -_081C4C10: - adds r2, r3, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - b _081C4C28 -_081C4C1C: - movs r0, 0 - strh r0, [r3, 0x30] - adds r2, r3, 0 - adds r2, 0x3E - ldrb r1, [r2] - subs r0, 0x5 -_081C4C28: - ands r0, r1 -_081C4C2A: - strb r0, [r2] - movs r1, 0x2E - ldrsh r0, [r3, r1] - cmp r0, 0x8 - bne _081C4C44 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c6 - b _081C4C4A - .pool -_081C4C44: - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040c7 -_081C4C4A: - adds r0, r1 - ldrb r0, [r0] - lsls r0, 4 - strh r0, [r3, 0x26] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4BE4 - - thumb_func_start sub_81C4C60 -sub_81C4C60: @ 81C4C60 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 -_081C4C68: - adds r0, r5, r4 - lsls r0, 24 - lsrs r0, 24 - bl sub_81C41C0 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _081C4C68 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81C4C60 - - thumb_func_start sub_81C4C84 -sub_81C4C84: @ 81C4C84 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gUnknown_0203CF1C - ldr r0, [r0] - ldr r1, =0x000040db - adds r5, r0, r1 - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 24 - movs r4, 0 - ldr r7, =gSprites - movs r2, 0x80 - lsls r2, 19 - adds r2, r0 - mov r9, r2 - lsrs r6, r0, 24 - movs r1, 0xA0 - lsls r1, 19 - adds r1, r0 - mov r8, r1 -_081C4CB4: - cmp r4, 0 - bne _081C4CD4 - ldrb r1, [r5] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - mov r2, r9 - b _081C4CE4 - .pool -_081C4CD4: - cmp r4, 0x9 - bne _081C4CEC - ldrb r1, [r5, 0x9] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - mov r2, r8 -_081C4CE4: - lsrs r1, r2, 24 - bl StartSpriteAnim - b _081C4D02 -_081C4CEC: - adds r0, r5, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - adds r1, r6, 0x6 - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnim -_081C4D02: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x9 - bls _081C4CB4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81C4C84 - - thumb_func_start sub_81C4D18 -sub_81C4D18: @ 81C4D18 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203CF1C - ldr r2, =0x000040d3 - adds r0, r2 - ldr r1, [r1] - adds r5, r1, r0 - movs r3, 0 - ldr r4, =gSprites - movs r7, 0x5 - negs r7, r7 - movs r6, 0 -_081C4D32: - adds r2, r5, r3 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - strh r6, [r0, 0x30] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r7, 0 - ands r0, r2 - strb r0, [r1] - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x9 - bls _081C4D32 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4D18 - - thumb_func_start sub_81C4D70 -sub_81C4D70: @ 81C4D70 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r0, 0 - ldr r4, =gUnknown_0203CF28 - movs r0, 0x4 - bl Alloc - str r0, [r4] - ldr r1, [r5] - lsls r0, r1, 20 - lsrs r4, r0, 30 - cmp r4, 0 - bne _081C4DDC - lsls r0, r1, 30 - lsrs r0, 30 - movs r1, 0x8 - movs r2, 0 - bl SetBgAttribute - ldr r3, [r5] - lsls r0, r3, 30 - lsrs r0, 30 - ldr r1, =gUnknown_0861D1A0 - lsls r3, 22 - lsrs r3, 24 - str r4, [sp] - movs r2, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r0, [r5] - lsls r0, 30 - lsrs r0, 30 - ldr r1, =gUnknown_0861DEF4 - movs r2, 0x1 - str r2, [sp] - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, [r5] - lsls r1, 22 - lsrs r1, 24 - str r4, [sp] - movs r2, 0x20 - movs r3, 0x20 - bl sub_8199D3C - b _081C4E2E - .pool -_081C4DDC: - lsls r0, r1, 30 - lsrs r0, 30 - movs r1, 0x8 - movs r2, 0x2 - bl SetBgAttribute - ldr r0, [r5] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x9 - movs r2, 0x1 - bl SetBgAttribute - ldr r3, [r5] - lsls r0, r3, 30 - lsrs r0, 30 - ldr r1, =gUnknown_0861E208 - lsls r3, 22 - lsrs r3, 24 - movs r2, 0 - str r2, [sp] - bl decompress_and_copy_tile_data_to_vram - ldr r0, [r5] - lsls r0, 30 - lsrs r0, 30 - ldr r1, =gUnknown_0861EF64 - movs r4, 0x1 - str r4, [sp] - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, [r5] - lsls r1, 22 - lsrs r1, 24 - str r4, [sp] - movs r2, 0x40 - movs r3, 0x40 - bl sub_8199D3C -_081C4E2E: - ldr r0, [r5] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - ldr r0, [r5] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r0, [r5] - lsls r0, 30 - lsrs r0, 30 - movs r1, 0x4 - movs r2, 0x1 - bl SetBgAttribute - ldr r0, =gUnknown_0861D140 - ldr r1, =gPlttBufferUnfaded + 0xE0 - ldr r2, =0x04000018 - bl CpuSet - ldr r0, =gUnknown_0203CF28 - ldr r1, [r0] - ldr r0, [r5] - lsls r0, 30 - lsrs r0, 30 - strb r0, [r1] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4D70 - - thumb_func_start sub_81C4E90 -sub_81C4E90: @ 81C4E90 - push {lr} - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _081C4EA0 - movs r0, 0x1 - b _081C4EAC -_081C4EA0: - ldr r0, =gUnknown_0203CF28 - ldr r0, [r0] - ldrb r0, [r0] - bl ShowBg - movs r0, 0 -_081C4EAC: - pop {r1} - bx r1 - .pool - thumb_func_end sub_81C4E90 - - thumb_func_start sub_81C4EB4 -sub_81C4EB4: @ 81C4EB4 - push {r4,lr} - ldr r4, =gUnknown_0203CF28 - ldr r0, [r4] - cmp r0, 0 - beq _081C4EC6 - bl Free - movs r0, 0 - str r0, [r4] -_081C4EC6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4EB4 - - thumb_func_start sub_81C4ED0 -sub_81C4ED0: @ 81C4ED0 - push {lr} - adds r1, r0, 0 - ldr r0, =gUnknown_0203CF28 - ldr r0, [r0] - ldrb r0, [r0] - lsls r1, 8 - movs r2, 0 - bl ChangeBgY - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4ED0 - - thumb_func_start sub_81C4EEC -sub_81C4EEC: @ 81C4EEC - ldr r1, =gUnknown_0203CF30 - movs r0, 0 - strh r0, [r1, 0x6] - strh r0, [r1, 0x8] - bx lr - .pool - thumb_func_end sub_81C4EEC - - thumb_func_start sub_81C4EFC -sub_81C4EFC: @ 81C4EFC - push {lr} - ldr r1, =CB2_ReturnToFieldWithOpenMenu - movs r0, 0 - bl sub_81C4F98 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4EFC - - thumb_func_start sub_81C4F10 -sub_81C4F10: @ 81C4F10 - push {lr} - ldr r1, =SetCB2ToReshowScreenAfterMenu2 - movs r0, 0x1 - bl sub_81C4F98 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4F10 - - thumb_func_start sub_81C4F24 -sub_81C4F24: @ 81C4F24 - push {lr} - bl ScriptContext2_Enable - movs r0, 0x1 - movs r1, 0 - bl FadeScreen - ldr r0, =sub_81C4F44 - movs r1, 0xA - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4F24 - - thumb_func_start sub_81C4F44 -sub_81C4F44: @ 81C4F44 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _081C4F6E - bl overworld_free_bg_tilemaps - ldr r0, =gFieldCallback2 - ldr r1, =hm_add_c3_without_phase_2 - str r1, [r0] - ldr r1, =CB2_ReturnToField - movs r0, 0x3 - bl sub_81C4F98 - adds r0, r4, 0 - bl DestroyTask -_081C4F6E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4F44 - - thumb_func_start sub_81C4F84 -sub_81C4F84: @ 81C4F84 - push {lr} - ldr r0, =gUnknown_0203CF30 - ldr r1, [r0] - movs r0, 0x4 - bl sub_81C4F98 - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4F84 - - thumb_func_start sub_81C4F98 -sub_81C4F98: @ 81C4F98 - push {r4-r6,lr} - adds r5, r1, 0 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r6, =gUnknown_0203CF2C - ldr r0, =0x0000098c - bl AllocZeroed - str r0, [r6] - cmp r4, 0x4 - beq _081C4FB2 - ldr r0, =gUnknown_0203CF30 - strb r4, [r0, 0x4] -_081C4FB2: - cmp r5, 0 - beq _081C4FBA - ldr r0, =gUnknown_0203CF30 - str r5, [r0] -_081C4FBA: - ldr r0, [r6] - movs r1, 0 - str r1, [r0] - ldr r1, =0x00000814 - adds r0, r1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, [r6] - ldr r1, =0x00000816 - adds r0, r1 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0] - ldr r0, [r6] - ldr r1, =0x00000804 - adds r0, r1 - movs r1, 0xFF - movs r2, 0xB - bl memset - ldr r0, [r6] - ldr r1, =0x0000080f - adds r0, r1 - movs r1, 0xFF - movs r2, 0x5 - bl memset - ldr r0, =sub_81C504C - bl SetMainCallback2 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C4F98 - - thumb_func_start sub_81C501C -sub_81C501C: @ 81C501C - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl do_scheduled_bg_tilemap_copies_to_vram - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_81C501C - - thumb_func_start sub_81C5038 -sub_81C5038: @ 81C5038 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_81C5038 - - thumb_func_start sub_81C504C -sub_81C504C: @ 81C504C - push {lr} -_081C504E: - bl sub_81221EC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C5072 - bl sub_81C5078 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _081C5072 - bl sub_81221AC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _081C504E -_081C5072: - pop {r0} - bx r0 - thumb_func_end sub_81C504C - - thumb_func_start sub_81C5078 -sub_81C5078: @ 81C5078 - push {lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x10 - bls _081C508C - b _081C51BC -_081C508C: - lsls r0, 2 - ldr r1, =_081C50A0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081C50A0: - .4byte _081C50E4 - .4byte _081C50EE - .4byte _081C50F4 - .4byte _081C50FA - .4byte _081C510C - .4byte _081C5112 - .4byte _081C5122 - .4byte _081C513C - .4byte _081C5148 - .4byte _081C514E - .4byte _081C515C - .4byte _081C5162 - .4byte _081C5168 - .4byte _081C516E - .4byte _081C5174 - .4byte _081C517A - .4byte _081C5188 -_081C50E4: - bl SetVBlankHBlankCallbacksToNull - bl clear_scheduled_bg_copies_to_vram - b _081C51A2 -_081C50EE: - bl ScanlineEffect_Stop - b _081C51A2 -_081C50F4: - bl FreeAllSpritePalettes - b _081C51A2 -_081C50FA: - bl ResetPaletteFade - ldr r2, =gPaletteFade - ldrb r0, [r2, 0x8] - movs r1, 0x80 - orrs r0, r1 - b _081C51A0 - .pool -_081C510C: - bl ResetSpriteData - b _081C51A2 -_081C5112: - bl sub_81221AC - lsls r0, 24 - cmp r0, 0 - bne _081C51A2 - bl ResetTasks - b _081C51A2 -_081C5122: - bl sub_81C51DC - ldr r0, =gUnknown_0203CF2C - ldr r0, [r0] - ldr r1, =0x00000984 - adds r0, r1 - movs r1, 0 - strh r1, [r0] - b _081C51A2 - .pool -_081C513C: - bl sub_81C5238 - lsls r0, 24 - cmp r0, 0 - beq _081C51D4 - b _081C51A2 -_081C5148: - bl sub_81C6BD8 - b _081C51A2 -_081C514E: - bl sub_81C5924 - bl sub_81C59BC - bl sub_81C5A20 - b _081C51A2 -_081C515C: - bl sub_81C5314 - b _081C51A2 -_081C5162: - bl sub_81C56F8 - b _081C51A2 -_081C5168: - bl sub_81C6EF4 - b _081C51A2 -_081C516E: - bl sub_81C5674 - b _081C51A2 -_081C5174: - bl sub_81C700C - b _081C51A2 -_081C517A: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x10 - movs r2, 0 - bl BlendPalettes - b _081C51A2 -_081C5188: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - movs r0, 0x7F - ands r0, r1 -_081C51A0: - strb r0, [r2, 0x8] -_081C51A2: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _081C51D4 - .pool -_081C51BC: - ldr r0, =sub_81C5038 - bl SetVBlankCallback - ldr r0, =sub_81C501C - bl SetMainCallback2 - movs r0, 0x1 - b _081C51D6 - .pool -_081C51D4: - movs r0, 0 -_081C51D6: - add sp, 0x4 - pop {r1} - bx r1 - thumb_func_end sub_81C5078 - - thumb_func_start sub_81C51DC -sub_81C51DC: @ 81C51DC - push {lr} - bl ResetVramOamAndBgCntRegs - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0861F2B4 - movs r0, 0 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r0, =gUnknown_0203CF2C - ldr r1, [r0] - adds r1, 0x4 - movs r0, 0x2 - bl SetBgTilemapBuffer - bl ResetAllBgsCoordinates - movs r0, 0x2 - bl schedule_bg_copy_tilemap_to_vram - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_81C51DC - thumb_func_start sub_81C5238 sub_81C5238: @ 81C5238 push {r4,lr} @@ -2001,7 +484,7 @@ sub_81C5674: @ 81C5674 ldr r0, =0x00000b5e str r0, [sp, 0x4] str r0, [sp, 0x8] - ldr r0, =gUnknown_0203CF38 + ldr r0, =gUnknown_0203CF30+8 str r0, [sp, 0xC] movs r0, 0x2 movs r1, 0xAC @@ -2604,7 +1087,7 @@ sub_81C5B4C: @ 81C5B4C cmp r0, 0 bne _081C5BBC ldrb r0, [r2] - ldr r4, =gUnknown_0203CF38 + ldr r4, =gUnknown_0203CF30+8 subs r2, r4, 0x2 adds r1, r4, 0 bl DestroyListMenuTask @@ -2706,7 +1189,7 @@ _081C5C5C: bl ListMenuHandleInputGetItemId adds r6, r0, 0 ldrb r0, [r7] - ldr r1, =gUnknown_0203CF38 + ldr r1, =gUnknown_0203CF30+8 mov r8, r1 mov r2, r8 subs r2, 0x2 @@ -3763,7 +2246,7 @@ sub_81C65CC: @ 81C65CC lsls r0, 3 ldr r1, =gTasks + 0x8 adds r4, r0, r1 - ldr r6, =gUnknown_0203CF38 + ldr r6, =gUnknown_0203CF30+8 subs r7, r6, 0x2 ldr r0, =gMain ldrh r1, [r0, 0x2E] @@ -4089,7 +2572,7 @@ sub_81C68B0: @ 81C68B0 movs r0, 0x5 bl PlaySE ldrb r0, [r4] - ldr r1, =gUnknown_0203CF38 + ldr r1, =gUnknown_0203CF30+8 subs r2, r1, 0x2 bl ListMenuGetScrollAndRow b _081C6940 @@ -4099,7 +2582,7 @@ _081C68F8: bl ListMenuHandleInputGetItemId adds r6, r0, 0 ldrb r0, [r4] - ldr r4, =gUnknown_0203CF38 + ldr r4, =gUnknown_0203CF30+8 subs r2, r4, 0x2 adds r1, r4, 0 bl ListMenuGetScrollAndRow @@ -4156,7 +2639,7 @@ sub_81C6964: @ 81C6964 lsls r0, 3 ldr r1, =gTasks + 0x8 adds r5, r0, r1 - ldr r7, =gUnknown_0203CF38 + ldr r7, =gUnknown_0203CF30+8 subs r0, r7, 0x2 mov r8, r0 ldrh r0, [r0] @@ -4234,7 +2717,7 @@ sub_81C6A14: @ 81C6A14 lsls r0, 3 ldr r1, =gTasks + 0x8 adds r4, r0, r1 - ldr r5, =gUnknown_0203CF38 + ldr r5, =gUnknown_0203CF30+8 subs r7, r5, 0x2 ldr r0, =gUnknown_0203CF2C ldr r0, [r0] diff --git a/data/pokemon_summary_screen.s b/data/pokemon_summary_screen.s deleted file mode 100644 index 0c22aa6cd..000000000 --- a/data/pokemon_summary_screen.s +++ /dev/null @@ -1,507 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - -@ 861CAAC - .include "data/text/nature_names.inc" - - .align 2 -gUnknown_0861CBB4:: @ 861CBB4 - .4byte 0x000001f0, 0x000013b9, 0x0000239a, 0x000033db - - .align 2 -gUnknown_0861CBC4:: @ 861CBC4 - .incbin "graphics/interface/unk_tilemap2.bin" - - .align 2 -gUnknown_0861CBEC:: @ 861CBEC - .4byte gUnknown_0861CBC4 - .byte 0x01, 0x00, 0x0a, 0x02, 0x00, 0x12 - - .align 2 -gUnknown_0861CBF8:: @ 861CBF8 - .4byte gUnknown_0861CBC4 - .byte 0x01, 0x00, 0x0a, 0x02, 0x00, 0x32 - - .align 2 -gUnknown_0861CC04:: @ 861CC04 - .4byte gSummaryScreenPowAcc_Tilemap - .byte 0x00 - .byte 0x00 - .byte 0x0A - .byte 0x07 - .byte 0x00 - .byte 0x2D - - .align 2 -gUnknown_0861CC10:: @ 861CC10 - .4byte gUnknown_08DC3C34 - .byte 0x00 - .byte 0x00 - .byte 0x0A - .byte 0x07 - .byte 0x00 - .byte 0x2D - - .align 2 -gUnknown_0861CC1C:: @ 861CC1C - .byte 0x00, 0x02, 0x03, 0x01, 0x04, 0x05, 0x00, 0x00 - - .align 2 -gUnknown_0861CC24:: @ 861CC24 - window_template 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0001 - window_template 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0017 - window_template 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x002d - window_template 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0043 - window_template 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0059 - window_template 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0069 - window_template 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0079 - window_template 0x00, 0x0b, 0x04, 0x00, 0x02, 0x06, 0x0089 - window_template 0x00, 0x0b, 0x04, 0x12, 0x02, 0x06, 0x0089 - window_template 0x00, 0x0b, 0x06, 0x12, 0x02, 0x06, 0x00ad - window_template 0x00, 0x0a, 0x07, 0x06, 0x06, 0x06, 0x00d1 - window_template 0x00, 0x16, 0x07, 0x05, 0x06, 0x06, 0x00f5 - window_template 0x00, 0x0a, 0x0e, 0x0b, 0x04, 0x06, 0x0113 - window_template 0x00, 0x00, 0x12, 0x06, 0x02, 0x06, 0x013f - window_template 0x00, 0x01, 0x0f, 0x09, 0x04, 0x06, 0x014b - window_template 0x00, 0x01, 0x0f, 0x05, 0x04, 0x06, 0x016f - window_template 0x00, 0x16, 0x04, 0x00, 0x02, 0x06, 0x0183 - window_template 0x00, 0x01, 0x02, 0x04, 0x02, 0x07, 0x0183 - window_template 0x00, 0x01, 0x0c, 0x09, 0x02, 0x06, 0x018b - window_template 0x00, 0x01, 0x0e, 0x09, 0x04, 0x06, 0x019d - null_window_template - - .align 2 -gUnknown_0861CCCC:: @ 861CCCC - window_template 0x00, 0x0b, 0x04, 0x0b, 0x02, 0x06, 0x01c1 - window_template 0x00, 0x16, 0x04, 0x07, 0x02, 0x06, 0x01d7 - window_template 0x00, 0x0b, 0x09, 0x12, 0x04, 0x06, 0x01e5 - window_template 0x00, 0x0b, 0x0e, 0x12, 0x06, 0x06, 0x022d - - .align 2 -gUnknown_0861CCEC:: @ 861CCEC - window_template 0x00, 0x0a, 0x04, 0x0a, 0x02, 0x06, 0x01c1 - window_template 0x00, 0x14, 0x04, 0x0a, 0x02, 0x06, 0x01d5 - window_template 0x00, 0x10, 0x07, 0x06, 0x06, 0x06, 0x01e9 - window_template 0x00, 0x1b, 0x07, 0x03, 0x06, 0x06, 0x020d - window_template 0x00, 0x18, 0x0e, 0x06, 0x04, 0x06, 0x021f - - .align 2 -gUnknown_0861CD14:: @ 861CD14 - window_template 0x00, 0x0f, 0x04, 0x09, 0x0a, 0x06, 0x01c1 - window_template 0x00, 0x18, 0x04, 0x06, 0x0a, 0x08, 0x021b - window_template 0x00, 0x0a, 0x0f, 0x14, 0x04, 0x06, 0x0257 - -gUnknown_0861CD2C:: @ 861CD2C - .byte 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x00, 0x05, 0x06, 0x00, 0x07, 0x08, 0x00, 0x09, 0x0a, 0x00, 0x0b, 0x0c, 0x00, 0x0d, 0x0e, 0x00, 0x07, 0x08, 0x0d, 0x0f, 0x0e, 0x00, 0x01, 0x02, 0x00, 0x03 - .byte 0x04, 0x00, 0x05, 0x06, 0x00, 0x07, 0x08 - -gUnknown_0861CD53:: @ 861CD53 - .incbin "graphics/interface/summary_a_button.4bpp" - -gUnknown_0861CDD3:: @ 861CDD3 - .incbin "graphics/interface/summary_b_button.4bpp" - - .align 2 -gUnknown_0861CE54:: @ 861CE54 - .4byte sub_81C2E00 - .4byte sub_81C3530 - .4byte sub_81C3984 - .4byte sub_81C3D08 - - .align 2 -gUnknown_0861CE64:: @ 861CE64 - .4byte sub_81C2E40 - .4byte sub_81C3554 - .4byte sub_81C39F0 - .4byte sub_81C3D54 - -gUnknown_0861CE74:: @ 861CE74 - .string "{COLOR LIGHT_RED}{SHADOW GREEN}$" - -gUnknown_0861CE7B:: @ 861CE7B - .string "{COLOR WHITE}{SHADOW DARK_GREY}$" - -gUnknown_0861CE82:: @ 861CE82 - .string "{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}\n" - .string "{SPECIAL_F7 0x02}\n" - .string "{SPECIAL_F7 0x03}$" - -gUnknown_0861CE8E:: @ 861CE8E - .string "{SPECIAL_F7 0x00}\n" - .string "{SPECIAL_F7 0x01}\n" - .string "{SPECIAL_F7 0x02}$" - -gUnknown_0861CE97:: @ 861CE97 - .string "{PP}{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}$" - - .align 2 -gOamData_861CEA0:: @ 861CEA0 - .2byte 0x4000, 0x8000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_861CEA8:: @ 861CEA8 - .2byte 0x0000, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEB0:: @ 861CEB0 - .2byte 0x0008, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEB8:: @ 861CEB8 - .2byte 0x0010, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEC0:: @ 861CEC0 - .2byte 0x0018, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEC8:: @ 861CEC8 - .2byte 0x0020, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CED0:: @ 861CED0 - .2byte 0x0028, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CED8:: @ 861CED8 - .2byte 0x0030, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEE0:: @ 861CEE0 - .2byte 0x0038, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEE8:: @ 861CEE8 - .2byte 0x0040, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEF0:: @ 861CEF0 - .2byte 0x0048, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CEF8:: @ 861CEF8 - .2byte 0x0050, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF00:: @ 861CF00 - .2byte 0x0058, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF08:: @ 861CF08 - .2byte 0x0060, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF10:: @ 861CF10 - .2byte 0x0068, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF18:: @ 861CF18 - .2byte 0x0070, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF20:: @ 861CF20 - .2byte 0x0078, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF28:: @ 861CF28 - .2byte 0x0080, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF30:: @ 861CF30 - .2byte 0x0088, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF38:: @ 861CF38 - .2byte 0x0090, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF40:: @ 861CF40 - .2byte 0x0098, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF48:: @ 861CF48 - .2byte 0x00a0, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF50:: @ 861CF50 - .2byte 0x00a8, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861CF58:: @ 861CF58 - .2byte 0x00b0, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_861CF60:: @ 861CF60 - .4byte gSpriteAnim_861CEA8 - .4byte gSpriteAnim_861CEB0 - .4byte gSpriteAnim_861CEB8 - .4byte gSpriteAnim_861CEC0 - .4byte gSpriteAnim_861CEC8 - .4byte gSpriteAnim_861CED0 - .4byte gSpriteAnim_861CED8 - .4byte gSpriteAnim_861CEE0 - .4byte gSpriteAnim_861CEE8 - .4byte gSpriteAnim_861CEF0 - .4byte gSpriteAnim_861CEF8 - .4byte gSpriteAnim_861CF00 - .4byte gSpriteAnim_861CF08 - .4byte gSpriteAnim_861CF10 - .4byte gSpriteAnim_861CF18 - .4byte gSpriteAnim_861CF20 - .4byte gSpriteAnim_861CF28 - .4byte gSpriteAnim_861CF30 - .4byte gSpriteAnim_861CF38 - .4byte gSpriteAnim_861CF40 - .4byte gSpriteAnim_861CF48 - .4byte gSpriteAnim_861CF50 - .4byte gSpriteAnim_861CF58 - - .align 2 -gUnknown_0861CFBC:: @ 861CFBC - obj_tiles gMoveTypes_Gfx, 0x1700, 0x7532 - - .align 2 -gUnknown_0861CFC4:: @ 861CFC4 - spr_template 0x7532, 0x7532, gOamData_861CEA0, gSpriteAnimTable_861CF60, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - -gUnknown_0861CFDC:: @ 861CFDC - .byte 0x0d, 0x0d, 0x0e, 0x0e, 0x0d, 0x0d, 0x0f, 0x0e, 0x0d, 0x0f, 0x0d, 0x0e, 0x0f, 0x0d, 0x0e, 0x0e, 0x0f, 0x0d, 0x0d, 0x0e, 0x0e, 0x0f, 0x0d, 0x00 - - .align 2 -gOamData_861CFF4:: @ 861CFF4 - .2byte 0x0000, 0x4000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_861CFFC:: @ 861CFFC - .2byte 0x0000, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D004:: @ 861D004 - .2byte 0x0004, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D00C:: @ 861D00C - .2byte 0x0008, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D014:: @ 861D014 - .2byte 0x000c, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D01C:: @ 861D01C - .2byte 0x0010, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D024:: @ 861D024 - .2byte 0x0010, 0x0040, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D02C:: @ 861D02C - .2byte 0x0014, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D034:: @ 861D034 - .2byte 0x0018, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D03C:: @ 861D03C - .2byte 0x0018, 0x0040, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D044:: @ 861D044 - .2byte 0x001c, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_861D04C:: @ 861D04C - .4byte gSpriteAnim_861CFFC - .4byte gSpriteAnim_861D004 - .4byte gSpriteAnim_861D00C - .4byte gSpriteAnim_861D014 - .4byte gSpriteAnim_861D01C - .4byte gSpriteAnim_861D024 - .4byte gSpriteAnim_861D02C - .4byte gSpriteAnim_861D034 - .4byte gSpriteAnim_861D03C - .4byte gSpriteAnim_861D044 - - .align 2 -gUnknown_0861D074:: @ 861D074 - obj_tiles gUnknown_08D97BEC, 0x0400, 0x7530 - - .align 2 -gUnknown_0861D07C:: @ 861D07C - obj_pal gUnknown_08D97CF4, 0x7530 - - .align 2 -gUnknown_0861D084:: @ 861D084 - spr_template 0x7530, 0x7530, gOamData_861CFF4, gSpriteAnimTable_861D04C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gOamData_861D09C:: @ 861D09C - .2byte 0x4000, 0x4000, 0x0c00, 0x0000 - - .align 2 -gSpriteAnim_861D0A4:: @ 861D0A4 - .2byte 0x0000, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D0AC:: @ 861D0AC - .2byte 0x0004, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D0B4:: @ 861D0B4 - .2byte 0x0008, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D0BC:: @ 861D0BC - .2byte 0x000c, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D0C4:: @ 861D0C4 - .2byte 0x0010, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D0CC:: @ 861D0CC - .2byte 0x0014, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnim_861D0D4:: @ 861D0D4 - .2byte 0x0018, 0x0000, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_861D0DC:: @ 861D0DC - .4byte gSpriteAnim_861D0A4 - .4byte gSpriteAnim_861D0AC - .4byte gSpriteAnim_861D0B4 - .4byte gSpriteAnim_861D0BC - .4byte gSpriteAnim_861D0C4 - .4byte gSpriteAnim_861D0CC - .4byte gSpriteAnim_861D0D4 - - .align 2 -gUnknown_0861D0F8:: @ 861D0F8 - obj_tiles gStatusGfx_Icons, 0x0380, 0x7531 - - .align 2 -gUnknown_0861D100:: @ 861D100 - obj_pal gStatusPal_Icons, 0x7531 - - .align 2 -gUnknown_0861D108:: @ 861D108 - spr_template 0x7531, 0x7531, gOamData_861D09C, gSpriteAnimTable_861D0DC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_0861D120:: @ 861D120 - .incbin "graphics/interface/summary_markings.gbapal" - - .align 2 -gUnknown_0861D140:: @ 861D140 - .incbin "graphics/interface/region_map.gbapal" - - .align 2 -gUnknown_0861D1A0:: @ 861D1A0 - .incbin "graphics/interface/region_map.8bpp.lz" - - .align 2 -gUnknown_0861DEF4:: @ 861DEF4 - .incbin "graphics/interface/region_map.bin.lz" - - .align 2 -gUnknown_0861E208:: @ 861E208 - .incbin "graphics/interface/region_map_affine.8bpp.lz" - - .align 2 -gUnknown_0861EF64:: @ 861EF64 - .incbin "graphics/interface/region_map_affine.bin.lz" - - .align 2 -gUnknown_0861F2B4:: @ 861F2B4 - .4byte 0x000011f0, 0x000001e1, 0x000021de - - .align 2 -gUnknown_0861F2C0:: @ 861F2C0 - .4byte 0x00000000, sub_81C5460, sub_81C5518, 0x00000000, 0x00080000, 0x07003021 - - .align 2 -gUnknown_0861F2D8:: @ 861F2D8 - .4byte gMenuText_Use, sub_81C61E0 - .4byte gMenuText_Toss, sub_81C62C4 - .4byte gMenuText_Give, sub_81C6648 - .4byte gText_Cancel2, sub_81C6258 - .4byte gMenuText_Use, sub_81C679C - .4byte gText_EmptyString2, NULL - -gUnknown_0861F308:: @ 861F308 - .byte 0x00, 0x02, 0x01, 0x03 - -gUnknown_0861F30C:: @ 861F30C - .byte 0x01, 0x03 - -gUnknown_0861F30E:: @ 861F30E - .byte 0x04, 0x03 - -gUnknown_0861F310:: @ 861F310 - .byte 0x03, 0x00, 0x00, 0x00 - -gUnknown_0861F314:: @ 861F314 - .4byte sub_81C654C - .4byte sub_81C63D0 - -gUnknown_0861F31C:: @ 861F31C - .byte 0x00, 0x02, 0x03, 0x00, 0x03, 0x01, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_0861F328:: @ 861F328 - window_template 0x00, 0x0e, 0x02, 0x0f, 0x10, 0x0f, 0x001e - window_template 0x00, 0x00, 0x0d, 0x0e, 0x06, 0x0f, 0x010e - window_template 0x01, 0x02, 0x0f, 0x1b, 0x04, 0x0f, 0x0162 - window_template 0x01, 0x18, 0x11, 0x05, 0x02, 0x0f, 0x01ce - null_window_template - - .align 2 -gUnknown_0861F350:: @ 861F350 - window_template 0x01, 0x16, 0x11, 0x07, 0x02, 0x0f, 0x01d8 - window_template 0x01, 0x16, 0x0f, 0x07, 0x04, 0x0f, 0x01d8 - window_template 0x01, 0x0f, 0x0f, 0x0e, 0x04, 0x0f, 0x01d8 - window_template 0x01, 0x0f, 0x0d, 0x0e, 0x06, 0x0f, 0x01d8 - - .align 2 -gUnknown_0861F370:: @ 861F370 - window_template 0x01, 0x18, 0x0f, 0x05, 0x04, 0x0f, 0x01d8 - - .align 2 -gOamData_861F378:: @ 861F378 - .2byte 0x0100, 0xc000, 0x0400, 0x0000 - - .align 2 -gSpriteAnim_861F380:: @ 861F380 - .2byte 0x0000, 0x0004, 0xffff, 0x0000 - - .align 2 -gSpriteAnimTable_861F388:: @ 861F388 - .4byte gSpriteAnim_861F380 - - .align 2 -gSpriteAffineAnim_861F38C:: @ 861F38C - .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnim_861F39C:: @ 861F39C - .2byte 0x0000, 0x0000, 0x02fe, 0x0000, 0x0000, 0x0000, 0x0402, 0x0000, 0x0000, 0x0000, 0x04fe, 0x0000, 0x0000, 0x0000, 0x0202, 0x0000 - .2byte 0x7fff, 0x0000, 0x0000, 0x0000 - - .align 2 -gSpriteAffineAnimTable_861F3C4:: @ 861F3C4 - .4byte gSpriteAffineAnim_861F38C - .4byte gSpriteAffineAnim_861F39C - - .align 2 -gUnknown_0861F3CC:: @ 861F3CC - obj_tiles gBattleFrontierGfx_PyramidBag, 0x0800, 0x1024 - - .align 2 -gUnknown_0861F3D4:: @ 861F3D4 - spr_template 0x1024, 0x1024, gOamData_861F378, gSpriteAnimTable_861F388, NULL, gSpriteAffineAnimTable_861F3C4, SpriteCallbackDummy - diff --git a/data/unk_pokedex_area_screen_helper.s b/data/unk_pokedex_area_screen_helper.s new file mode 100644 index 000000000..2f3881446 --- /dev/null +++ b/data/unk_pokedex_area_screen_helper.s @@ -0,0 +1,110 @@ + .include "asm/macros.inc" + .include "constants/constants.inc" + + .section .rodata + + .align 2 +gUnknown_0861D1A0:: @ 861D1A0 + .incbin "graphics/interface/region_map.8bpp.lz" + + .align 2 +gUnknown_0861DEF4:: @ 861DEF4 + .incbin "graphics/interface/region_map.bin.lz" + + .align 2 +gUnknown_0861E208:: @ 861E208 + .incbin "graphics/interface/region_map_affine.8bpp.lz" + + .align 2 +gUnknown_0861EF64:: @ 861EF64 + .incbin "graphics/interface/region_map_affine.bin.lz" + + .align 2 +gUnknown_0861F2B4:: @ 861F2B4 + .4byte 0x000011f0, 0x000001e1, 0x000021de + + .align 2 +gUnknown_0861F2C0:: @ 861F2C0 + .4byte 0x00000000, sub_81C5460, sub_81C5518, 0x00000000, 0x00080000, 0x07003021 + + .align 2 +gUnknown_0861F2D8:: @ 861F2D8 + .4byte gMenuText_Use, sub_81C61E0 + .4byte gMenuText_Toss, sub_81C62C4 + .4byte gMenuText_Give, sub_81C6648 + .4byte gText_Cancel2, sub_81C6258 + .4byte gMenuText_Use, sub_81C679C + .4byte gText_EmptyString2, NULL + +gUnknown_0861F308:: @ 861F308 + .byte 0x00, 0x02, 0x01, 0x03 + +gUnknown_0861F30C:: @ 861F30C + .byte 0x01, 0x03 + +gUnknown_0861F30E:: @ 861F30E + .byte 0x04, 0x03 + +gUnknown_0861F310:: @ 861F310 + .byte 0x03, 0x00, 0x00, 0x00 + +gUnknown_0861F314:: @ 861F314 + .4byte sub_81C654C + .4byte sub_81C63D0 + +gUnknown_0861F31C:: @ 861F31C + .byte 0x00, 0x02, 0x03, 0x00, 0x03, 0x01, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00 + + .align 2 +gUnknown_0861F328:: @ 861F328 + window_template 0x00, 0x0e, 0x02, 0x0f, 0x10, 0x0f, 0x001e + window_template 0x00, 0x00, 0x0d, 0x0e, 0x06, 0x0f, 0x010e + window_template 0x01, 0x02, 0x0f, 0x1b, 0x04, 0x0f, 0x0162 + window_template 0x01, 0x18, 0x11, 0x05, 0x02, 0x0f, 0x01ce + null_window_template + + .align 2 +gUnknown_0861F350:: @ 861F350 + window_template 0x01, 0x16, 0x11, 0x07, 0x02, 0x0f, 0x01d8 + window_template 0x01, 0x16, 0x0f, 0x07, 0x04, 0x0f, 0x01d8 + window_template 0x01, 0x0f, 0x0f, 0x0e, 0x04, 0x0f, 0x01d8 + window_template 0x01, 0x0f, 0x0d, 0x0e, 0x06, 0x0f, 0x01d8 + + .align 2 +gUnknown_0861F370:: @ 861F370 + window_template 0x01, 0x18, 0x0f, 0x05, 0x04, 0x0f, 0x01d8 + + .align 2 +gOamData_861F378:: @ 861F378 + .2byte 0x0100, 0xc000, 0x0400, 0x0000 + + .align 2 +gSpriteAnim_861F380:: @ 861F380 + .2byte 0x0000, 0x0004, 0xffff, 0x0000 + + .align 2 +gSpriteAnimTable_861F388:: @ 861F388 + .4byte gSpriteAnim_861F380 + + .align 2 +gSpriteAffineAnim_861F38C:: @ 861F38C + .2byte 0x0100, 0x0100, 0x0000, 0x0000, 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gSpriteAffineAnim_861F39C:: @ 861F39C + .2byte 0x0000, 0x0000, 0x02fe, 0x0000, 0x0000, 0x0000, 0x0402, 0x0000, 0x0000, 0x0000, 0x04fe, 0x0000, 0x0000, 0x0000, 0x0202, 0x0000 + .2byte 0x7fff, 0x0000, 0x0000, 0x0000 + + .align 2 +gSpriteAffineAnimTable_861F3C4:: @ 861F3C4 + .4byte gSpriteAffineAnim_861F38C + .4byte gSpriteAffineAnim_861F39C + + .align 2 +gUnknown_0861F3CC:: @ 861F3CC + obj_tiles gBattleFrontierGfx_PyramidBag, 0x0800, 0x1024 + + .align 2 +gUnknown_0861F3D4:: @ 861F3D4 + spr_template 0x1024, 0x1024, gOamData_861F378, gSpriteAnimTable_861F388, NULL, gSpriteAffineAnimTable_861F3C4, SpriteCallbackDummy + diff --git a/include/battle_controllers.h b/include/battle_controllers.h index ff5a629af..b449bb501 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -1,6 +1,8 @@ #ifndef GUARD_BATTLE_CONTROLLERS_H #define GUARD_BATTLE_CONTROLLERS_H +#include "battle.h" + enum { REQUEST_ALL_BATTLE, diff --git a/include/battle_frontier_2.h b/include/battle_frontier_2.h index d410749b9..09e974068 100644 --- a/include/battle_frontier_2.h +++ b/include/battle_frontier_2.h @@ -11,5 +11,6 @@ void sub_81AA078(u16*, u8); void sub_81A4C30(void); void sub_819A4F8(void); void sub_819DC00(void); +bool8 sub_81A6BF4(void); #endif // GUARD_BATTLE_FRONTIER_2_H diff --git a/include/battle_tent.h b/include/battle_tent.h new file mode 100644 index 000000000..a894d4cfb --- /dev/null +++ b/include/battle_tent.h @@ -0,0 +1,6 @@ +#ifndef GUARD_BATTLE_TENT_H +#define GUARD_BATTLE_TENT_H + +bool8 sub_81B9E94(void); + +#endif //GUARD_BATTLE_TENT_H diff --git a/include/contest_effect.h b/include/contest_effect.h index 3484ca5df..c8f5e389a 100644 --- a/include/contest_effect.h +++ b/include/contest_effect.h @@ -18,5 +18,6 @@ struct ContestEffect extern const struct ContestMove gContestMoves[]; extern struct ContestEffect gContestEffects[]; +extern const u8 *const gContestEffectDescriptionPointers[]; #endif //GUARD_CONTEST_EFFECT_H diff --git a/include/graphics.h b/include/graphics.h index 2dc5e99bf..a5acca625 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3382,4 +3382,24 @@ extern const u8 gCreditsCopyrightEnd_Gfx[]; extern const u8 gPokenavConditionMarker_Gfx[]; extern const u16 gPokenavConditionMarker_Pal[]; +extern const u8 gUnknown_08D9862C[]; +extern const u8 gUnknown_08D98CC8[]; +extern const u8 gUnknown_08D987FC[]; +extern const u8 gUnknown_08D9898C[]; +extern const u8 gUnknown_08D98B28[]; +extern const u8 gUnknown_08D9853C[]; +extern const u8 gUnknown_08D85620[]; +extern const u16 gSummaryScreenWindow_Tilemap[]; +extern const u16 gMoveTypes_Pal[]; +extern const u8 gUnknown_08D97D0C[]; + +extern const u16 gSummaryScreenPowAcc_Tilemap[]; +extern const u16 gUnknown_08DC3C34[]; + +extern const u8 gMoveTypes_Gfx[]; +extern const u8 gUnknown_08D97BEC[]; +extern const u8 gUnknown_08D97CF4[]; +extern const u8 gStatusGfx_Icons[]; +extern const u8 gStatusPal_Icons[]; + #endif //GUARD_GRAPHICS_H diff --git a/include/m4a.h b/include/m4a.h index a1f413cf5..595379495 100644 --- a/include/m4a.h +++ b/include/m4a.h @@ -17,6 +17,7 @@ void m4aMPlayFadeOutTemporarily(struct MusicPlayerInfo *mplayInfo, u16 speed); void m4aMPlayFadeIn(struct MusicPlayerInfo *mplayInfo, u16 speed); void m4aMPlayImmInit(struct MusicPlayerInfo *mplayInfo); +extern struct MusicPlayerInfo gMPlayInfo_BGM; extern struct MusicPlayerInfo gMPlayInfo_SE1; extern struct MusicPlayerInfo gMPlayInfo_SE2; extern struct MusicPlayerInfo gMPlayInfo_SE3; diff --git a/include/menu.h b/include/menu.h index 5dfd99c64..054d8cb34 100644 --- a/include/menu.h +++ b/include/menu.h @@ -85,5 +85,7 @@ void RemoveMapNamePopUpWindow(void); u8 GetMapNamePopUpWindowId(void); u8 AddMapNamePopUpWindow(void); void sub_8199F74(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing); +void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); +void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP); #endif // GUARD_MENU_H diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 387a89fdd..ee8501d18 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -2,6 +2,7 @@ #define GUARD_MENU_HELPERS_H #include "task.h" +#include "window.h" // Exported type declarations diff --git a/include/mon_markings.h b/include/mon_markings.h index 852e8b4eb..22c3f14a4 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -21,4 +21,6 @@ struct PokemonMarkMenu /*0x10B4*/ u8 tileLoadState; }; // 10b8 +struct Sprite *sub_811FF94(u16 tileTag, u16 paletteTag, const u16 *palette); + #endif //POKEEMERALD_MON_MARKINGS_H diff --git a/include/party_menu.h b/include/party_menu.h index cb2c38891..02e481200 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -57,5 +57,8 @@ u8 sub_81B1360(void); void sub_81B8904(u8 arg0, void (*callback)(void)); void OpenPartyMenuInBattle(u8 caseId); u16 ItemIdToBattleMoveId(u16 itemId); +u8 sub_81B205C(struct Pokemon* a); +u8 sub_81B6D14(u16 a); +bool8 hm_add_c3_without_phase_2(void); #endif // GUARD_PARTY_MENU_H diff --git a/include/pokeball.h b/include/pokeball.h index 84178b5b2..30a1d8b11 100644 --- a/include/pokeball.h +++ b/include/pokeball.h @@ -18,6 +18,8 @@ enum POKEBALL_COUNT }; +extern const struct SpriteTemplate gBallSpriteTemplates[]; + #define POKEBALL_PLAYER_SENDOUT 0xFF #define POKEBALL_OPPONENT_SENDOUT 0xFE diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index 03f4e0da6..a73958d90 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -83,5 +83,6 @@ void CompactPartySlots(void); u32 GetBoxMonDataFromAnyBox(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); +u8 sub_80D214C(struct BoxPokemon* a, u8 b, u8 c, u8 d); #endif // GUARD_POKEMON_STORAGE_SYSTEM_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 75caa9a3a..0580e793c 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -2,6 +2,6 @@ #define GUARD_POKEMON_SUMMARY_SCREEN_H void sub_81C4F98(u8, void(*)(void)); -void ShowSelectMovePokemonSummaryScreen(void *a, u8 b, u8 c, void *d, u16 e); +void ShowSelectMovePokemonSummaryScreen(struct Pokemon *a, u8 b, u8 c, void *d, u16 e); #endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/include/region_map.h b/include/region_map.h index af331ad81..6339f7a88 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -94,5 +94,6 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); u8 *GetMapName(u8 *, u16, u16); bool32 sub_8124668(u8 mapSecId); u8 *sub_81245DC(u8 *dest, u16 mapSecId); +u8 *sub_8124610(u8 *dest, u16 mapSecId); #endif //GUARD_REGION_MAP_H diff --git a/include/strings.h b/include/strings.h index f8b216a39..f88425b26 100644 --- a/include/strings.h +++ b/include/strings.h @@ -776,4 +776,52 @@ extern const u8 gText_TeachWhichMoveToPkmn[]; extern const u8 gText_GiveUpTeachingNewMove[]; extern const u8 gText_TeachX[]; +extern const u8 gText_LevelSymbol[]; +extern const u8 gText_PkmnInfo[]; +extern const u8 gText_PkmnSkills[]; +extern const u8 gText_BattleMoves[]; +extern const u8 gText_ContestMoves[]; +extern const u8 gText_HMMovesCantBeForgotten2[]; +extern const u8 gText_Info[]; +extern const u8 gText_Switch[]; +extern const u8 gText_RentalPkmn[]; +extern const u8 gText_TypeSlash[]; +extern const u8 gText_HP4[]; +extern const u8 gText_Attack3[]; +extern const u8 gText_Defense3[]; +extern const u8 gText_SpAtk4[]; +extern const u8 gText_SpDef4[]; +extern const u8 gText_Speed2[]; +extern const u8 gText_ExpPoints[]; +extern const u8 gText_NextLv[]; +extern const u8 gText_Status[]; +extern const u8 gText_Power[]; +extern const u8 gText_Accuracy2[]; +extern const u8 gText_Appeal[]; +extern const u8 gText_Jam[]; +extern const u8 gText_OTSlash[]; +extern const u8 gText_UnkCtrlF907F908[]; +extern const u8 gText_XNature[]; +extern const u8 gText_XNatureHatchedAtYZ[]; +extern const u8 gText_XNatureHatchedSomewhereAt[]; +extern const u8 gText_XNatureMetAtYZ[]; +extern const u8 gText_XNatureMetSomewhereAt[]; +extern const u8 gText_XNatureFatefulEncounter[]; +extern const u8 gText_XNatureProbablyMetAt[]; +extern const u8 gText_XNatureObtainedInTrade[]; +extern const u8 gText_EmptyString5[]; +extern const u8 gText_EggWillTakeALongTime[]; +extern const u8 gText_EggAboutToHatch[]; +extern const u8 gText_EggWillHatchSoon[]; +extern const u8 gText_EggWillTakeSomeTime[]; +extern const u8 gText_PeculiarEggNicePlace[]; +extern const u8 gText_PeculiarEggTrade[]; +extern const u8 gText_EggFromTraveler[]; +extern const u8 gText_EggFromHotSprings[]; +extern const u8 gText_OddEggFoundByCouple[]; +extern const u8 gText_None[]; +extern const u8 gText_RibbonsVar1[]; +extern const u8 gText_OneDash[]; +extern const u8 gText_TwoDashes[]; + #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index 5f9d35617..462af2946 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -262,7 +262,9 @@ SECTIONS { asm/fossil_specials.o(.text); src/berry_fix_program.o(.text); src/pokemon_summary_screen.o(.text); - asm/pokemon_summary_screen.o(.text); + src/unk_pokedex_area_screen_helper.o(.text); + src/battle_pyramid.o(.text); + asm/battle_pyramid.o(.text); asm/pokenav.o(.text); src/match_call.o(.text); asm/pokenav.o(.text.after.match.call); @@ -537,7 +539,8 @@ SECTIONS { src/fldeff_groundshake.o(.rodata); src/berry_fix_program.o(.rodata); src/pokemon_summary_screen.o(.rodata); - data/pokemon_summary_screen.o(.rodata); + src/unk_pokedex_area_screen_helper.o(.rodata); + data/unk_pokedex_area_screen_helper.o(.rodata); data/pokenav.o(.rodata); src/match_call.o(.rodata); data/pokenav.o(.rodata.after.match.call); diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c new file mode 100644 index 000000000..f9cc48a9a --- /dev/null +++ b/src/battle_pyramid.c @@ -0,0 +1,248 @@ +#include "global.h" +#include "main.h" +#include "battle_controllers.h" +#include "bg.h" +#include "field_effect.h" +#include "field_weather.h" +#include "gpu_regs.h" +#include "malloc.h" +#include "menu.h" +#include "menu_helpers.h" +#include "overworld.h" +#include "palette.h" +#include "party_menu.h" +#include "scanline_effect.h" +#include "script.h" +#include "task.h" +#include "constants/rgb.h" + +EWRAM_DATA struct +{ + u32 unk0; + u8 filler4[0x804 - 0x4]; + u8 unk804[11]; + u8 unk80F[5]; + u8 unk814; + u8 filler815; + s8 unk816; + u8 filler817[0x984 - 0x817]; + u16 unk984; + u8 filler986[0x98C - 0x986]; +} *gUnknown_0203CF2C = NULL; +EWRAM_DATA struct +{ + void (*callback)(void); + u8 unk4; + u16 unk6; + u16 unk8; +} gUnknown_0203CF30 = {0}; + +extern const struct BgTemplate gUnknown_0861F2B4[3]; + +void sub_81C4F98(u8 a0, void (*callback)(void)); +void sub_81C4F44(u8 taskId); +void sub_81C504C(void); +bool8 sub_81C5078(void); +void sub_81C51DC(void); +bool8 sub_81C5238(void); +void sub_81C5314(void); +void sub_81C5674(void); +void sub_81C56F8(void); +void sub_81C5924(void); +void sub_81C59BC(void); +void sub_81C5A20(void); +void sub_81C6BD8(void); +void sub_81C6EF4(void); +void sub_81C700C(void); + +void sub_81C4EEC(void) +{ + gUnknown_0203CF30.unk6 = 0; + gUnknown_0203CF30.unk8 = 0; +} + +void sub_81C4EFC(void) +{ + sub_81C4F98(0, CB2_ReturnToFieldWithOpenMenu); +} + +void sub_81C4F10(void) +{ + sub_81C4F98(1, SetCB2ToReshowScreenAfterMenu2); +} + +void sub_81C4F24(void) +{ + ScriptContext2_Enable(); + FadeScreen(1, 0); + CreateTask(sub_81C4F44, 10); +} + +void sub_81C4F44(u8 taskId) +{ + if (!gPaletteFade.active) + { + overworld_free_bg_tilemaps(); + gFieldCallback2 = hm_add_c3_without_phase_2; + sub_81C4F98(3, CB2_ReturnToField); + DestroyTask(taskId); + } +} + +void sub_81C4F84(void) +{ + sub_81C4F98(4, gUnknown_0203CF30.callback); +} + +void sub_81C4F98(u8 a0, void (*callback)(void)) +{ + gUnknown_0203CF2C = AllocZeroed(sizeof(*gUnknown_0203CF2C)); + + if (a0 != 4) + { + gUnknown_0203CF30.unk4 = a0; + } + + if (callback != NULL) + { + gUnknown_0203CF30.callback = callback; + } + + gUnknown_0203CF2C->unk0 = 0; + gUnknown_0203CF2C->unk814 = -1; + gUnknown_0203CF2C->unk816 = -1; + + memset(gUnknown_0203CF2C->unk804, 0xFF, sizeof(gUnknown_0203CF2C->unk804)); + memset(gUnknown_0203CF2C->unk80F, 0xFF, sizeof(gUnknown_0203CF2C->unk80F)); + + SetMainCallback2(sub_81C504C); +} + +void sub_81C501C(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + do_scheduled_bg_tilemap_copies_to_vram(); + UpdatePaletteFade(); +} + +void sub_81C5038(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_81C504C(void) +{ + while (sub_81221EC() != TRUE && sub_81C5078() != TRUE && sub_81221AC() != TRUE); +} + +bool8 sub_81C5078(void) +{ + switch (gMain.state) + { + case 0: + SetVBlankHBlankCallbacksToNull(); + clear_scheduled_bg_copies_to_vram(); + gMain.state++; + break; + case 1: + ScanlineEffect_Stop(); + gMain.state++; + break; + case 2: + FreeAllSpritePalettes(); + gMain.state++; + break; + case 3: + ResetPaletteFade(); + gPaletteFade.bufferTransferDisabled = TRUE; + gMain.state++; + break; + case 4: + ResetSpriteData(); + gMain.state++; + break; + case 5: + if (!sub_81221AC()) + { + ResetTasks(); + } + gMain.state++; + break; + case 6: + sub_81C51DC(); + gUnknown_0203CF2C->unk984 = 0; + gMain.state++; + break; + case 7: + if (sub_81C5238()) + { + gMain.state++; + } + break; + case 8: + sub_81C6BD8(); + gMain.state++; + break; + case 9: + sub_81C5924(); + sub_81C59BC(); + sub_81C5A20(); + gMain.state++; + break; + case 10: + sub_81C5314(); + gMain.state++; + break; + case 11: + sub_81C56F8(); + gMain.state++; + break; + case 12: + sub_81C6EF4(); + gMain.state++; + break; + case 13: + sub_81C5674(); + gMain.state++; + break; + case 14: + sub_81C700C(); + gMain.state++; + break; + case 15: + BlendPalettes(0xFFFFFFFF, 0x10, 0); + gMain.state++; + break; + case 16: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK); + gPaletteFade.bufferTransferDisabled = FALSE; + gMain.state++; + break; + default: + SetVBlankCallback(sub_81C5038); + SetMainCallback2(sub_81C501C); + return TRUE; + } + return FALSE; +} + +void sub_81C51DC(void) +{ + ResetVramOamAndBgCntRegs(); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_0861F2B4, ARRAY_COUNT(gUnknown_0861F2B4)); + SetBgTilemapBuffer(2, gUnknown_0203CF2C->filler4); + ResetAllBgsCoordinates(); + schedule_bg_copy_tilemap_to_vram(2); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_OBJ_ON); + ShowBg(0); + ShowBg(1); + ShowBg(2); + SetGpuReg(REG_OFFSET_BLDCNT, 0); +} diff --git a/src/data/text/nature_names.h b/src/data/text/nature_names.h new file mode 100644 index 000000000..d0d217d9b --- /dev/null +++ b/src/data/text/nature_names.h @@ -0,0 +1,54 @@ +static const u8 sHardyNatureName[] = _("HARDY"); +static const u8 sLonelyNatureName[] = _("LONELY"); +static const u8 sBraveNatureName[] = _("BRAVE"); +static const u8 sAdamantNatureName[] = _("ADAMANT"); +static const u8 sNaughtyNatureName[] = _("NAUGHTY"); +static const u8 sBoldNatureName[] = _("BOLD"); +static const u8 sDocileNatureName[] = _("DOCILE"); +static const u8 sRelaxedNatureName[] = _("RELAXED"); +static const u8 sImpishNatureName[] = _("IMPISH"); +static const u8 sLaxNatureName[] = _("LAX"); +static const u8 sTimidNatureName[] = _("TIMID"); +static const u8 sHastyNatureName[] = _("HASTY"); +static const u8 sSeriousNatureName[] = _("SERIOUS"); +static const u8 sJollyNatureName[] = _("JOLLY"); +static const u8 sNaiveNatureName[] = _("NAIVE"); +static const u8 sModestNatureName[] = _("MODEST"); +static const u8 sMildNatureName[] = _("MILD"); +static const u8 sQuietNatureName[] = _("QUIET"); +static const u8 sBashfulNatureName[] = _("BASHFUL"); +static const u8 sRashNatureName[] = _("RASH"); +static const u8 sCalmNatureName[] = _("CALM"); +static const u8 sGentleNatureName[] = _("GENTLE"); +static const u8 sSassyNatureName[] = _("SASSY"); +static const u8 sCarefulNatureName[] = _("CAREFUL"); +static const u8 sQuirkyNatureName[] = _("QUIRKY"); + +const u8 *const gNatureNamePointers[] = +{ + [NATURE_HARDY] = sHardyNatureName, + [NATURE_LONELY] = sLonelyNatureName, + [NATURE_BRAVE] = sBraveNatureName, + [NATURE_ADAMANT] = sAdamantNatureName, + [NATURE_NAUGHTY] = sNaughtyNatureName, + [NATURE_BOLD] = sBoldNatureName, + [NATURE_DOCILE] = sDocileNatureName, + [NATURE_RELAXED] = sRelaxedNatureName, + [NATURE_IMPISH] = sImpishNatureName, + [NATURE_LAX] = sLaxNatureName, + [NATURE_TIMID] = sTimidNatureName, + [NATURE_HASTY] = sHastyNatureName, + [NATURE_SERIOUS] = sSeriousNatureName, + [NATURE_JOLLY] = sJollyNatureName, + [NATURE_NAIVE] = sNaiveNatureName, + [NATURE_MODEST] = sModestNatureName, + [NATURE_MILD] = sMildNatureName, + [NATURE_QUIET] = sQuietNatureName, + [NATURE_BASHFUL] = sBashfulNatureName, + [NATURE_RASH] = sRashNatureName, + [NATURE_CALM] = sCalmNatureName, + [NATURE_GENTLE] = sGentleNatureName, + [NATURE_SASSY] = sSassyNatureName, + [NATURE_CAREFUL] = sCarefulNatureName, + [NATURE_QUIRKY] = sQuirkyNatureName, +}; diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 7e20a2a92..b5117d45d 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -1,364 +1,731 @@ #include "global.h" -#include "battle.h" -#include "bg.h" -#include "decompress.h" -#include "item.h" -#include "constants/items.h" -#include "link.h" -#include "m4a.h" #include "main.h" -#include "malloc.h" -#include "constants/moves.h" -#include "palette.h" -#include "pokemon.h" -#include "constants/songs.h" -#include "sound.h" -#include "constants/species.h" -#include "sprite.h" -#include "dynamic_placeholder_text_util.h" -#include "string_util.h" -#include "task.h" -#include "text.h" -#include "window.h" -#include "event_data.h" -#include "gpu_regs.h" -#include "menu.h" -#include "international_string_util.h" -#include "scanline_effect.h" -#include "menu_helpers.h" -#include "daycare.h" -#include "data2.h" +#include "battle.h" +#include "battle_anim.h" +#include "battle_frontier_2.h" +#include "battle_message.h" +#include "battle_tent.h" +#include "bg.h" #include "contest.h" #include "contest_effect.h" +#include "data2.h" +#include "daycare.h" +#include "decompress.h" +#include "dynamic_placeholder_text_util.h" +#include "event_data.h" +#include "gpu_regs.h" +#include "graphics.h" +#include "international_string_util.h" +#include "item.h" +#include "link.h" +#include "m4a.h" +#include "malloc.h" +#include "menu.h" +#include "menu_helpers.h" +#include "mon_markings.h" +#include "party_menu.h" +#include "palette.h" +#include "pokeball.h" +#include "pokemon.h" +#include "pokemon_storage_system.h" +#include "region_map.h" +#include "scanline_effect.h" +#include "sound.h" +#include "sprite.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text.h" +#include "tv.h" +#include "window.h" +#include "constants/items.h" +#include "constants/moves.h" +#include "constants/songs.h" +#include "constants/species.h" -extern struct UnkSummaryStruct* gUnknown_0203CF1C; -extern struct BgTemplate gUnknown_0861CBB4; -extern u8 gUnknown_0203CF20; -extern struct MusicPlayerInfo gMPlayInfo_BGM; -extern s8 gUnknown_0861CC1C[]; -extern u8 gUnknown_0203CF21; -extern struct UnkStruct_61CC04 gUnknown_0861CC04; -extern struct UnkStruct_61CC04 gUnknown_0861CC10; -extern struct UnkStruct_61CC04 gUnknown_0861CBEC; -extern struct UnkStruct_61CC04 gUnknown_0861CBF8; -extern u16 gSummaryScreenWindow_Tilemap[]; -extern struct ContestEffect gContestEffects[]; -extern struct WindowTemplate gUnknown_0861CC24; -extern u8 gUnknown_0861CD2C[][3]; -extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; -extern u8 gText_MaleSymbol[]; -extern u8 gText_FemaleSymbol[]; -extern u8 gUnknown_0861CDD3[]; -extern void (*const gUnknown_0861CE54[])(); -extern void (*const gUnknown_0861CE64[])(u8 taskId); -extern struct WindowTemplate gUnknown_0861CCCC; -extern u8 gUnknown_0861CE74[]; -extern u8 gUnknown_0861CE7B[]; -extern struct WindowTemplate gUnknown_0861CCEC; -extern struct WindowTemplate gUnknown_0861CD14; -extern const u8 *const gContestEffectDescriptionPointers[]; - -void sub_81C488C(u8 a); -extern u8 sub_81221EC(); -extern u8 sub_81221AC(); -extern u8 gUnknown_08D9862C; -extern u8 gUnknown_08D98CC8; -extern u8 gUnknown_08D987FC; -extern u8 gUnknown_08D9898C; -extern u8 gUnknown_08D98B28; -extern u8 gUnknown_08D9853C; -extern u8 gUnknown_08D85620; -extern struct CompressedSpriteSheet gUnknown_0861CFBC; -extern struct CompressedSpriteSheet gUnknown_0861D074; -extern struct CompressedSpriteSheet gUnknown_0861D0F8; -extern struct CompressedSpritePalette gUnknown_0861D100; -extern struct CompressedSpritePalette gUnknown_0861D07C; -extern u8 gMoveTypes_Pal; -extern u8 gUnknown_08D97D0C; -extern void sub_81C1E20(u8 taskId); -extern u8 *GetMonNickname(struct Pokemon *mon, u8 *dest); -extern u16 SpeciesToPokedexNum(u16 species); -extern u8 gText_UnkCtrlF908Clear01[]; -extern u8 gText_LevelSymbol[]; -extern u8 gText_PkmnInfo[]; -extern u8 gText_PkmnSkills[]; -extern u8 gText_BattleMoves[]; -extern u8 gText_ContestMoves[]; -extern u8 gText_HMMovesCantBeForgotten2[]; -extern u8 gText_Cancel2[]; -extern u8 gText_Info[]; -extern u8 gText_Switch[]; -extern u8 gText_RentalPkmn[]; -extern u8 gText_TypeSlash[]; -extern u8 gText_HP4[]; -extern u8 gText_Attack3[]; -extern u8 gText_Defense3[]; -extern u8 gText_SpAtk4[]; -extern u8 gText_SpDef4[]; -extern u8 gText_Speed2[]; -extern u8 gText_ExpPoints[]; -extern u8 gText_NextLv[]; -extern u8 gText_Status[]; -extern u8 gText_Power[]; -extern u8 gText_Accuracy2[]; -extern u8 gText_Appeal[]; -extern u8 gText_Jam[]; -extern u8 gText_OTSlash[]; -extern u8 gText_UnkCtrlF907F908[]; -extern u8 gText_XNature[]; -extern u8 gText_XNatureHatchedAtYZ[]; -extern u8 gText_XNatureHatchedSomewhereAt[]; -extern u8 gText_XNatureMetAtYZ[]; -extern u8 gText_XNatureMetSomewhereAt[]; -extern u8 gText_XNatureFatefulEncounter[]; -extern u8 gText_XNatureProbablyMetAt[]; -extern u8 gText_XNatureObtainedInTrade[]; -extern u8 *gNatureNamePointers[]; -extern u8 gText_EmptyString5[]; -extern u32 gBattleTypeFlags; -extern u8 gText_FiveMarks[]; -extern u8 gText_EggWillTakeALongTime[]; -extern u8 gText_EggAboutToHatch[]; -extern u8 gText_EggWillHatchSoon[]; -extern u8 gText_EggWillTakeSomeTime[]; -extern u8 gText_PeculiarEggNicePlace[]; -extern u8 gText_PeculiarEggTrade[]; -extern u8 gText_EggFromTraveler[]; -extern u8 gText_EggFromHotSprings[]; -extern u8 gText_OddEggFoundByCouple[]; -extern u8 gText_None[]; -extern u8 gText_RibbonsVar1[]; -extern u8 gUnknown_0861CE82[]; -extern u8 gUnknown_0861CE8E[]; -extern u8 gText_OneDash[]; -extern u8 gText_TwoDashes[]; -extern u8 gText_ThreeDashes[]; -extern u8 gText_Cancel[]; -extern u8 gUnknown_0861CE97[]; -extern const struct SpriteTemplate gUnknown_0861CFC4; - -extern void sub_8199C30(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f); -extern bool8 sub_81A6BF4(); -extern bool8 sub_81B9E94(); -extern void DynamicPlaceholderTextUtil_Reset(); -extern void sub_8124610(u8 *a, u8 b); -extern int GetPlayerIDAsU32(); -extern u8 GetCurrentPpToMaxPpState(u8 a, u8 b); - -void sub_81BFAE4(void); -void sub_81BFE24(); -u8 sub_81BFEB0(); -void sub_81C2554(); -void sub_81C1BA0(); -void sub_81C0098(struct Pokemon* a); -bool8 sub_81C00F0(struct Pokemon* a); -void sub_81C25E8(); -void sub_81C286C(); -void sub_81C2D9C(u8 a); -void sub_81C0348(); -void sub_81C2AFC(u8 a); -void sub_81C4190(); -void sub_81C42C8(); -u8 sub_81C45F4(void* a, u16* b); -void sub_81C4984(); -void sub_81C4A08(); -void sub_81C4A88(); -void sub_81C4280(); -void sub_81C43A0(); -void sub_81C4484(); -void sub_81C4420(); -void sub_81C0510(u8 taskId); -void sub_81C171C(u8 taskId); -void ResetAllBgsCoordinates(); -u8 sub_81B205C(struct Pokemon* a); -void sub_81C1DA4(u16 a, s16 b); -void sub_81C1EFC(u16 a, s16 b, u16 c); -void sub_81C240C(u16 a); -void sub_81C2194(u16 *a, u16 b, u8 c); -void sub_81C2074(u16 a, s16 b); -void sub_81C2524(); -void sub_81C2228(struct Pokemon* mon); -void sub_81C0484(u8 taskId); -void sub_81C4898(); -void sub_806F47C(u8 a); -u8 GetLRKeysState(); -void sub_81C0604(u8 taskId, s8 a); -void sub_81C0A8C(u8 taskId, s8 a); -void sub_81C48F0(); -void sub_81C0E48(u8 taskId); -void sub_81C0704(u8 taskId); -s8 sub_81C09B4(s8 a); -s8 sub_81C08F8(s8 a); -void sub_81C4204(u8 a, u8 b); -void sub_81C20F0(u8 taskId); -bool8 sub_81C0A50(struct Pokemon* mon); -void sub_81C49E0(); -void sub_81C0E24(); -void sub_81C2C38(u8 a); -void sub_81C0B8C(u8 taskId); -void sub_81C0CC4(u8 taskId); -void sub_81C2DE4(u8 a); -void sub_81C424C(); -void sub_81C0C68(u8 taskId); -void sub_81C0D44(u8 taskId); -void sub_81C22CC(struct Pokemon* mon); -void sub_81C0F44(u8 taskId); -void sub_81C3E9C(u16 a); -void sub_81C3F44(); -void sub_81C44F0(); -void sub_81C4AF8(u8 a); -void sub_81C1070(s16* a, s8 b, u8* c); -void sub_81C11F4(u8 a); -void sub_81C129C(u8 a); -bool8 sub_81C1040(); -void sub_81C4064(); -void sub_81C4C60(u8 a); -void sub_81C12E4(u8 taskId); -void sub_81C4C84(u8 a); -void sub_81C13B0(u8 a, u8 b); -void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); -void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); -void sub_81C40A0(u8 a, u8 b); -void sub_81C4568(u8 a, u8 b); -void sub_81C174C(u8 taskId); -bool8 sub_81C18A8(); -void sub_81C18F4(u8 a); -u8 sub_81B6D14(u16 a); -void sub_81C1940(u8 taskId); -void sub_81C4154(); -void sub_81C1F80(u8 taskId); -void sub_81C2628(); -void sub_81C2794(); -void sub_81C27DC(struct Pokemon *mon, u16 a); -void sub_81C2D68(u8 a); -void sub_81C335C(); -void sub_81C33CC(); -void sub_81C3428(); -void sub_81C349C(); -void sub_81C2EC4(); -void sub_81C2F5C(); -void sub_81C2FD8(); -void sub_81C302C(); -void sub_81C307C(); -void sub_81C3194(); -void sub_81C31C0(); -bool8 sub_81C3304(); -void sub_81C31F0(u8 *a); -u8 sub_81C3220(); -bool8 sub_81C32BC(); -void sub_81C35E4(); -void sub_81C3690(); -void sub_81C3710(); -void sub_81C37D8(); -void sub_81C3808(); -void sub_81C3890(); -void sub_81C38C0(); -void sub_81C3B08(u8 a); -void sub_81C3E2C(u8 a); -void sub_81C4D18(); - -void SetBgAttribute(u8 bg, u8 attributeId, u8 value); - -bool8 sub_81BFB10(); -u8 sub_81B1250(); - -union UnkUnion +static EWRAM_DATA struct UnkSummaryStruct { - struct Pokemon mon[6]; - struct BoxPokemon boxMon[6]; -}; - - -u8 sub_80D214C(union UnkUnion* a, u8 b, u8 c, u8 d); - -struct PokeSummary -{ - u16 species; // 0x0 - u16 species2; // 0x2 - u8 isEgg; // 0x4 - u8 level; // 0x5 - u8 ribbons; // 0x6 - 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 -}; - -struct UnkSummaryStruct -{ - /*0x00*/ union UnkUnion *unk0; - /*0x04*/ void *unk4; - /*0x08*/ void *unk8; + /*0x00*/ union + { + struct Pokemon *mons; + struct BoxPokemon *boxMons; + } monList; + /*0x04*/ void (*callback)(void); + /*0x08*/ struct Sprite *markingsSpriteId; /*0x0C*/ struct Pokemon currentMon; - /*0x70*/ struct PokeSummary summary; - u16 unkTilemap0[0x400]; - u16 unkTilemap0_1[0x400]; - u16 unkTilemap1[0x400]; - u16 unkTilemap1_1[0x400]; - u16 unkTilemap2[0x400]; - u16 unkTilemap2_1[0x400]; - u16 unkTilemap3[0x400]; - u16 unkTilemap3_1[0x400]; - u8 unk40BC; - u8 unk40BD; - u8 unk40BE; - u8 unk40BF; + /*0x70*/ struct PokeSummary + { + u16 species; // 0x0 + u16 species2; // 0x2 + u8 isEgg; // 0x4 + u8 level; // 0x5 + u8 ribbons; // 0x6 + 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 unk40C0; u8 unk40C1; u8 unk40C2; - u8 unk40C3; - u16 unk40C4; - u8 unk40C6; - u8 unk40C7; - u8 unk40C8; + bool8 unk40C3; + u16 newMove; + u8 firstMoveIndex; + u8 secondMoveIndex; + bool8 unk40C8; u8 unk40C9; - u8 unk40CA; - u8 unk40CB[8]; - u8 unk40D3[0x1C]; - u8 unk40EF; + 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}; + +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; }; +// forward declarations +bool8 sub_81B1250(void); +bool8 sub_81BFB10(void); +void sub_81BFAE4(void); +void sub_81BFE24(void); +u8 sub_81BFEB0(void); +void sub_81C0098(struct Pokemon* a); +bool8 sub_81C00F0(struct Pokemon* a); +void sub_81C0348(void); +void sub_81C0484(u8 taskId); +void sub_81C0510(u8 taskId); +void sub_81C0604(u8 taskId, s8 a); +void sub_81C0704(u8 taskId); +s8 sub_81C08F8(s8 a); +s8 sub_81C09B4(s8 a); +bool8 sub_81C0A50(struct Pokemon* mon); +void sub_81C0A8C(u8 taskId, s8 a); +void sub_81C0B8C(u8 taskId); +void sub_81C0C68(u8 taskId); +void sub_81C0CC4(u8 taskId); +void sub_81C0D44(u8 taskId); +void sub_81C0E24(void); +void sub_81C0E48(u8 taskId); +void sub_81C0F44(u8 taskId); +bool8 sub_81C1040(void); +void sub_81C1070(s16* a, s8 b, u8* c); +void sub_81C11F4(u8 a); +void sub_81C129C(u8 a); +void sub_81C12E4(u8 taskId); +void sub_81C13B0(u8 a, u8 b); +void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); +void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); +void sub_81C171C(u8 taskId); +void sub_81C174C(u8 taskId); +bool8 sub_81C18A8(void); +void sub_81C18F4(u8 a); +void sub_81C1940(u8 taskId); +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); +void sub_81C1F80(u8 taskId); +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); +void sub_81C27DC(struct Pokemon *mon, u16 a); +void sub_81C286C(void); +void sub_81C2AFC(u8 a); +void sub_81C2C38(u8 a); +void sub_81C2D68(u8 a); +void sub_81C2D9C(u8 a); +void sub_81C2DE4(u8 a); +void sub_81C2E00(void); +void sub_81C2E40(u8 taskId); +void sub_81C2EC4(void); +void sub_81C2F5C(void); +void sub_81C2FD8(void); +void sub_81C302C(void); +void sub_81C307C(void); +void sub_81C3194(void); +void sub_81C31C0(void); +void sub_81C31F0(u8 *a); +u8 sub_81C3220(void); +bool8 sub_81C32BC(void); +bool8 sub_81C3304(void); +void sub_81C335C(void); +void sub_81C33CC(void); +void sub_81C3428(void); +void sub_81C349C(void); +void sub_81C3554(u8 taskId); +void sub_81C35E4(void); +void sub_81C3530(void); +void sub_81C3690(void); +void sub_81C3710(void); +void sub_81C37D8(void); +void sub_81C3808(void); +void sub_81C3890(void); +void sub_81C38C0(void); +void sub_81C3984(void); +void sub_81C39F0(u8 taskId); +void sub_81C3B08(u8 a); +void sub_81C3D08(void); +void sub_81C3D54(u8 taskId); +void sub_81C3E2C(u8 a); +void sub_81C3E9C(u16 a); +void sub_81C3F44(void); +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 sub_81C4898(void); +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); + // const rom data #include "data/text/move_descriptions.h" +#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"); // code -void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) +void sub_81BF8EC(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) { - u8 byte; - gUnknown_0203CF1C = AllocZeroed(sizeof(struct UnkSummaryStruct)); - gUnknown_0203CF1C->unk40BC = a; - gUnknown_0203CF1C->unk0 = b; - gUnknown_0203CF1C->unk40BE = c; - gUnknown_0203CF1C->unk40BF = d; - gUnknown_0203CF1C->unk4 = e; - if (a == 2) - gUnknown_0203CF1C->unk40BD = 1; + 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 == 2) + gUnknown_0203CF1C->isBoxMon = TRUE; else - gUnknown_0203CF1C->unk40BD = 0; - switch (a) + gUnknown_0203CF1C->isBoxMon = FALSE; + + switch (mode) { case 0: case 2: @@ -368,32 +735,34 @@ void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) case 1: gUnknown_0203CF1C->unk40C1 = 0; gUnknown_0203CF1C->unk40C2 = 3; - gUnknown_0203CF1C->unk40C8 = 1; + gUnknown_0203CF1C->unk40C8 = TRUE; break; case 3: gUnknown_0203CF1C->unk40C1 = 2; gUnknown_0203CF1C->unk40C2 = 3; - gUnknown_0203CF1C->unk40C3 = 1; + gUnknown_0203CF1C->unk40C3 = TRUE; break; } - byte = gUnknown_0203CF1C->unk40C1; - gUnknown_0203CF1C->unk40C0 = byte; - sub_81C488C(0xFF); + + gUnknown_0203CF1C->unk40C0 = gUnknown_0203CF1C->unk40C1; + sub_81C488C(-1); + if (gMonSpritesGfxPtr == 0) sub_806F2AC(0, 0); + SetMainCallback2(sub_81BFAE4); } -void ShowSelectMovePokemonSummaryScreen(void *a, u8 b, u8 c, void *d, u16 e) +void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove) { - sub_81BF8EC(3, a, b, c, d); - gUnknown_0203CF1C->unk40C4 = e; + sub_81BF8EC(3, mons, monIndex, maxMonIndex, callback); + gUnknown_0203CF1C->newMove = newMove; } -void sub_81BFA80(u8 a, void *b, u8 c, u8 d, void *e) +void sub_81BFA80(u8 a, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) { - sub_81BF8EC(a, b, c, d, e); - gUnknown_0203CF1C->unk40EF = 1; + sub_81BF8EC(a, mons, monIndex, maxMonIndex, callback); + gUnknown_0203CF1C->unk40EF = TRUE; } void sub_81BFAB4(void) @@ -412,13 +781,9 @@ void sub_81BFAD0(void) TransferPlttBuffer(); } -void sub_81BFAE4() +void sub_81BFAE4(void) { - while (1) - { - if (sub_81221EC() == 1 || sub_81BFB10() == TRUE || sub_81221AC() == 1) - break; - } + while (sub_81221EC() != TRUE && sub_81BFB10() != TRUE && sub_81221AC() != TRUE); } bool8 sub_81BFB10(void) @@ -454,7 +819,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 6: - if (sub_81BFEB0() != 0) + if (sub_81BFEB0() != FALSE) gMain.state++; break; case 7: @@ -501,8 +866,8 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 17: - gUnknown_0203CF1C->unk40D3[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0); - if (gUnknown_0203CF1C->unk40D3[0] != 0xFF) + gUnknown_0203CF1C->spriteIds[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0); + if (gUnknown_0203CF1C->spriteIds[0] != 0xFF) { gUnknown_0203CF1C->unk40F0 = 0; gMain.state++; @@ -525,7 +890,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 22: - if (gUnknown_0203CF1C->unk40BC != 3) + if (gUnknown_0203CF1C->mode != 3) CreateTask(sub_81C0510, 0); else CreateTask(sub_81C171C, 0); @@ -548,13 +913,13 @@ bool8 sub_81BFB10(void) return FALSE; } -void sub_81BFE24() +void sub_81BFE24(void) { ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, &gUnknown_0861CBB4, 4); - SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap2); - SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap1); - SetBgTilemapBuffer(3, &gUnknown_0203CF1C->unkTilemap0); + InitBgsFromTemplates(0, gUnknown_0861CBB4, ARRAY_COUNT(gUnknown_0861CBB4)); + SetBgTilemapBuffer(1, &gUnknown_0203CF1C->bgTilemapBuffer3); + SetBgTilemapBuffer(2, &gUnknown_0203CF1C->bgTilemapBuffer2); + SetBgTilemapBuffer(3, &gUnknown_0203CF1C->bgTilemapBuffer1); ResetAllBgsCoordinates(); schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); @@ -567,7 +932,7 @@ void sub_81BFE24() ShowBg(3); } -u8 sub_81BFEB0() +bool8 sub_81BFEB0(void) { switch (gUnknown_0203CF1C->unk40F0) { @@ -579,24 +944,24 @@ u8 sub_81BFEB0() case 1: if (free_temp_tile_data_buffers_if_possible() != 1) { - LZDecompressWram(&gUnknown_08D9862C, gUnknown_0203CF1C->unkTilemap0); + LZDecompressWram(&gUnknown_08D9862C, &gUnknown_0203CF1C->bgTilemapBuffer1[0]); gUnknown_0203CF1C->unk40F0++; } break; case 2: - LZDecompressWram(&gUnknown_08D98CC8, gUnknown_0203CF1C->unkTilemap0_1); + LZDecompressWram(&gUnknown_08D98CC8, &gUnknown_0203CF1C->bgTilemapBuffer1[0x400]); gUnknown_0203CF1C->unk40F0++; break; case 3: - LZDecompressWram(&gUnknown_08D987FC, gUnknown_0203CF1C->unkTilemap1_1); + LZDecompressWram(&gUnknown_08D987FC, &gUnknown_0203CF1C->bgTilemapBuffer2[0x400]); gUnknown_0203CF1C->unk40F0++; break; case 4: - LZDecompressWram(&gUnknown_08D9898C, gUnknown_0203CF1C->unkTilemap2_1); + LZDecompressWram(&gUnknown_08D9898C, &gUnknown_0203CF1C->bgTilemapBuffer3[0x400]); gUnknown_0203CF1C->unk40F0++; break; case 5: - LZDecompressWram(&gUnknown_08D98B28, gUnknown_0203CF1C->unkTilemap3_1); + LZDecompressWram(&gUnknown_08D98B28, &gUnknown_0203CF1C->bgTilemapBuffer4[0x400]); gUnknown_0203CF1C->unk40F0++; break; case 6: @@ -627,22 +992,22 @@ u8 sub_81BFEB0() case 12: LoadCompressedPalette(&gMoveTypes_Pal, 0x1D0, 0x60); gUnknown_0203CF1C->unk40F0 = 0; - return 1; + return TRUE; } - return 0; + return FALSE; } void sub_81C0098(struct Pokemon *mon) { - if (gUnknown_0203CF1C->unk40BD == 0) + if (!gUnknown_0203CF1C->isBoxMon) { - struct Pokemon *partyMon = gUnknown_0203CF1C->unk0->mon; - *mon = partyMon[gUnknown_0203CF1C->unk40BE]; + struct Pokemon *partyMon = gUnknown_0203CF1C->monList.mons; + *mon = partyMon[gUnknown_0203CF1C->curMonIndex]; } else { - struct BoxPokemon *boxMon = gUnknown_0203CF1C->unk0->boxMon; - BoxMonToMon(&boxMon[gUnknown_0203CF1C->unk40BE], mon); + struct BoxPokemon *boxMon = gUnknown_0203CF1C->monList.boxMons; + BoxMonToMon(&boxMon[gUnknown_0203CF1C->curMonIndex], mon); } } @@ -675,7 +1040,7 @@ bool8 sub_81C00F0(struct Pokemon *a) sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES); break; case 2: - if ((struct Pokemon*)gUnknown_0203CF1C->unk0 == gPlayerParty || gUnknown_0203CF1C->unk40BC == 2 || gUnknown_0203CF1C->unk40EF == 1) + if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == 2 || gUnknown_0203CF1C->unk40EF == TRUE) { sum->nature = GetNature(a); sum->currentHP = GetMonData(a, MON_DATA_HP); @@ -726,14 +1091,14 @@ void sub_81C0348(void) } else { - sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); - SetBgTilemapBuffer(1, &gUnknown_0203CF1C->unkTilemap3); - SetBgTilemapBuffer(2, &gUnknown_0203CF1C->unkTilemap2); + 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); ChangeBgX(2, 0x10000, 1); - ClearWindowTilemap(0x13); - ClearWindowTilemap(0xD); + ClearWindowTilemap(19); + ClearWindowTilemap(13); } if (gUnknown_0203CF1C->summary.unk7 == 0) { @@ -742,13 +1107,13 @@ void sub_81C0348(void) else { if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) - PutWindowTilemap(0xD); + PutWindowTilemap(13); } sub_81C2524(); sub_81C2228(&gUnknown_0203CF1C->currentMon); } -void sub_81C0434() +void sub_81C0434(void) { FreeAllWindowBuffers(); Free(gUnknown_0203CF1C); @@ -764,8 +1129,8 @@ void sub_81C0484(u8 taskId) { if (sub_81221EC() != 1 && !gPaletteFade.active) { - SetMainCallback2(gUnknown_0203CF1C->unk4); - gUnknown_0203CF20 = gUnknown_0203CF1C->unk40BE; + SetMainCallback2(gUnknown_0203CF1C->callback); + gUnknown_0203CF20 = gUnknown_0203CF1C->curMonIndex; sub_81C4898(); ResetSpriteData(); FreeAllSpritePalettes(); @@ -828,9 +1193,9 @@ void sub_81C0604(u8 taskId, s8 a) { s8 r4_2; - if (gUnknown_0203CF1C->unk40C3 == 0) + if (!gUnknown_0203CF1C->unk40C3) { - if (gUnknown_0203CF1C->unk40BD == 1) + if (gUnknown_0203CF1C->isBoxMon == TRUE) { if (gUnknown_0203CF1C->unk40C0 != 0) { @@ -846,7 +1211,7 @@ void sub_81C0604(u8 taskId, s8 a) else a = 3; } - r4_2 = sub_80D214C(gUnknown_0203CF1C->unk0, gUnknown_0203CF1C->unk40BE, gUnknown_0203CF1C->unk40BF, a); + r4_2 = sub_80D214C(gUnknown_0203CF1C->monList.boxMons, gUnknown_0203CF1C->curMonIndex, gUnknown_0203CF1C->maxMonIndex, a); } else if (sub_81B1250() == 1) { @@ -867,7 +1232,7 @@ void sub_81C0604(u8 taskId, s8 a) schedule_bg_copy_tilemap_to_vram(0); sub_81C2074(0, 2); } - gUnknown_0203CF1C->unk40BE = r4_2; + gUnknown_0203CF1C->curMonIndex = r4_2; gTasks[taskId].data[0] = 0; gTasks[taskId].func = sub_81C0704; } @@ -885,10 +1250,10 @@ void sub_81C0704(u8 taskId) break; case 1: sub_81C4898(); - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3[0]]); + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[0]]); break; case 2: - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->unk40D3[1]]); + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[1]]); break; case 3: sub_81C0098(&gUnknown_0203CF1C->currentMon); @@ -911,10 +1276,10 @@ void sub_81C0704(u8 taskId) data[1] = 0; break; case 8: - gUnknown_0203CF1C->unk40D3[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]); - if (gUnknown_0203CF1C->unk40D3[0] == 0xFF) + gUnknown_0203CF1C->spriteIds[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]); + if (gUnknown_0203CF1C->spriteIds[0] == 0xFF) return; - gSprites[gUnknown_0203CF1C->unk40D3[0]].data[2] = 1; + gSprites[gUnknown_0203CF1C->spriteIds[0]].data[2] = 1; sub_81C0E24(); data[1] = 0; break; @@ -929,7 +1294,7 @@ void sub_81C0704(u8 taskId) sub_81C2524(); break; case 12: - gSprites[gUnknown_0203CF1C->unk40D3[0]].data[2] = 0; + gSprites[gUnknown_0203CF1C->spriteIds[0]].data[2] = 0; break; default: if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0) @@ -944,24 +1309,24 @@ void sub_81C0704(u8 taskId) s8 sub_81C08F8(s8 a) { - struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; + struct Pokemon *mon = gUnknown_0203CF1C->monList.mons; if (gUnknown_0203CF1C->unk40C0 == 0) { - if (a == -1 && gUnknown_0203CF1C->unk40BE == 0) + if (a == -1 && gUnknown_0203CF1C->curMonIndex == 0) return -1; - if (a == 1 && gUnknown_0203CF1C->unk40BE >= gUnknown_0203CF1C->unk40BF) + if (a == 1 && gUnknown_0203CF1C->curMonIndex >= gUnknown_0203CF1C->maxMonIndex) return -1; - return gUnknown_0203CF1C->unk40BE + a; + return gUnknown_0203CF1C->curMonIndex + a; } else { - s8 index = gUnknown_0203CF1C->unk40BE; + s8 index = gUnknown_0203CF1C->curMonIndex; do { index += a; - if (index < 0 || index > gUnknown_0203CF1C->unk40BF) + if (index < 0 || index > gUnknown_0203CF1C->maxMonIndex) return -1; } while (GetMonData(&mon[index], MON_DATA_IS_EGG) != 0); return index; @@ -970,23 +1335,23 @@ s8 sub_81C08F8(s8 a) s8 sub_81C09B4(s8 a) { - struct Pokemon *mon = gUnknown_0203CF1C->unk0->mon; + struct Pokemon *mon = gUnknown_0203CF1C->monList.mons; s8 r5 = 0; u8 i; for (i = 0; i < 6; i++) { - if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->unk40BE) + if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->curMonIndex) { r5 = i; break; } } - while (1) + while (TRUE) { int b; - s8* c = &gUnknown_0861CC1C[0]; + const s8* c = gUnknown_0861CC1C; r5 += a; if (r5 < 0 || r5 >= 6) @@ -1001,7 +1366,7 @@ bool8 sub_81C0A50(struct Pokemon* mon) { if (GetMonData(mon, MON_DATA_SPECIES) == 0) return FALSE; - else if (gUnknown_0203CF1C->unk40BE != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) + else if (gUnknown_0203CF1C->curMonIndex != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) return TRUE; else return FALSE; @@ -1014,10 +1379,11 @@ void sub_81C0A8C(u8 taskId, s8 b) if (summary->isEgg) return; - if (b == -1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C1) + else if (b == -1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C1) return; - if (b == 1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C2) + else if (b == 1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C2) return; + PlaySE(SE_SELECT); sub_81C2C38(gUnknown_0203CF1C->unk40C0); gUnknown_0203CF1C->unk40C0 += b; @@ -1122,7 +1488,7 @@ void sub_81C0D44(u8 taskId) SwitchTaskToFollowupFunc(taskId); } -void sub_81C0E24() +void sub_81C0E24(void) { if (gUnknown_0203CF1C->unk40C0 == 1) sub_81C22CC(&gUnknown_0203CF1C->currentMon); @@ -1131,20 +1497,20 @@ void sub_81C0E24() void sub_81C0E48(u8 taskId) { u16 move; - gUnknown_0203CF1C->unk40C6 = 0; - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + gUnknown_0203CF1C->firstMoveIndex = 0; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; ClearWindowTilemap(0x13); - if (gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible == 0) + if (gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible == 0) ClearWindowTilemap(0xD); sub_81C1DA4(9, -3); sub_81C1EFC(9, -3, move); - if (gUnknown_0203CF1C->unk40C8 == 0) + if (!gUnknown_0203CF1C->unk40C8) { ClearWindowTilemap(5); PutWindowTilemap(6); } - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 0); + sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 0); + sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 0); sub_81C3E9C(move); sub_81C3F44(); sub_81C44F0(); @@ -1165,17 +1531,17 @@ void sub_81C0F44(u8 taskId) if (gMain.newKeys & DPAD_UP) { data[0] = 4; - sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); + sub_81C1070(data, -1, &gUnknown_0203CF1C->firstMoveIndex); } else if (gMain.newKeys & DPAD_DOWN) { data[0] = 4; - sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); + sub_81C1070(data, 1, &gUnknown_0203CF1C->firstMoveIndex); } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->unk40C8 == 1 - || (gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + if (gUnknown_0203CF1C->unk40C8 == TRUE + || (gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) { PlaySE(SE_SELECT); sub_81C11F4(taskId); @@ -1226,7 +1592,7 @@ void sub_81C1070(s16 *a, s8 b, u8 *c) moveIndex = a[0]; if (moveIndex == 4) { - move = gUnknown_0203CF1C->unk40C4; + move = gUnknown_0203CF1C->newMove; break; } move = gUnknown_0203CF1C->summary.moves[moveIndex]; @@ -1237,16 +1603,16 @@ void sub_81C1070(s16 *a, s8 b, u8 *c) schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); sub_81C3E9C(move); - if ((*c == 4 && gUnknown_0203CF1C->unk40C4 == 0) || a[1] == 1) + if ((*c == 4 && gUnknown_0203CF1C->newMove == MOVE_NONE) || a[1] == 1) { ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible) + if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) ClearWindowTilemap(13); schedule_bg_copy_tilemap_to_vram(0); sub_81C1DA4(9, -3); sub_81C1EFC(9, -3, move); } - if (*c != 4 && moveIndex == 4 && gUnknown_0203CF1C->unk40C4 == 0) + if (*c != 4 && moveIndex == 4 && gUnknown_0203CF1C->newMove == MOVE_NONE) { ClearWindowTilemap(14); ClearWindowTilemap(15); @@ -1255,7 +1621,7 @@ void sub_81C1070(s16 *a, s8 b, u8 *c) sub_81C1EFC(0, 3, 0); } *c = moveIndex; - if (c == &gUnknown_0203CF1C->unk40C6) + if (c == &gUnknown_0203CF1C->firstMoveIndex) sub_81C4D18(8); else sub_81C4D18(18); @@ -1267,10 +1633,10 @@ void sub_81C11F4(u8 taskId) ClearWindowTilemap(6); PutWindowTilemap(5); sub_81C3E9C(0); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap2[0], 3, 1); - sub_81C2194(&gUnknown_0203CF1C->unkTilemap3[0], 1, 1); + sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 1); + sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 1); sub_81C4064(); - if (gUnknown_0203CF1C->unk40C6 != 4) + if (gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) { ClearWindowTilemap(14); ClearWindowTilemap(15); @@ -1285,7 +1651,7 @@ void sub_81C11F4(u8 taskId) void sub_81C129C(u8 taskId) { - gUnknown_0203CF1C->unk40C7 = gUnknown_0203CF1C->unk40C6; + gUnknown_0203CF1C->secondMoveIndex = gUnknown_0203CF1C->firstMoveIndex; sub_81C4C84(1); sub_81C4AF8(18); gTasks[taskId].func = sub_81C12E4; @@ -1300,16 +1666,16 @@ void sub_81C12E4(u8 taskId) if (gMain.newKeys & DPAD_UP) { data[0] = 3; - sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C7); + sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->secondMoveIndex); } else if (gMain.newKeys & DPAD_DOWN) { data[0] = 3; - sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C7); + sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->secondMoveIndex); } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->unk40C6 == gUnknown_0203CF1C->unk40C7) + if (gUnknown_0203CF1C->firstMoveIndex == gUnknown_0203CF1C->secondMoveIndex) { sub_81C13B0(taskId, 0); } @@ -1329,22 +1695,22 @@ void sub_81C13B0(u8 taskId, u8 b) sub_81C4C60(18); if (b == 1) { - if (gUnknown_0203CF1C->unk40BD == 0) + if (!gUnknown_0203CF1C->isBoxMon) { - struct Pokemon *why = gUnknown_0203CF1C->unk0->mon; - sub_81C14BC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + struct Pokemon *why = gUnknown_0203CF1C->monList.mons; + sub_81C14BC(&why[gUnknown_0203CF1C->curMonIndex], gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); } else { - struct BoxPokemon *why = gUnknown_0203CF1C->unk0->boxMon; - sub_81C15EC(&why[gUnknown_0203CF1C->unk40BE], gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); + struct BoxPokemon *why = gUnknown_0203CF1C->monList.boxMons; + sub_81C15EC(&why[gUnknown_0203CF1C->curMonIndex], gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); } sub_81C0098(&gUnknown_0203CF1C->currentMon); - sub_81C40A0(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); - sub_81C4568(gUnknown_0203CF1C->unk40C6, gUnknown_0203CF1C->unk40C7); - gUnknown_0203CF1C->unk40C6 = gUnknown_0203CF1C->unk40C7; + sub_81C40A0(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); + sub_81C4568(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); + gUnknown_0203CF1C->firstMoveIndex = gUnknown_0203CF1C->secondMoveIndex; } - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; sub_81C3E9C(move); sub_81C240C(move); schedule_bg_copy_tilemap_to_vram(1); @@ -1793,12 +2159,12 @@ void sub_81C174C(u8 taskId) if (gMain.newKeys & DPAD_UP) { data[0] = 4; - sub_81C1070(data, -1, &gUnknown_0203CF1C->unk40C6); + sub_81C1070(data, -1, &gUnknown_0203CF1C->firstMoveIndex); } else if (gMain.newKeys & DPAD_DOWN) { data[0] = 4; - sub_81C1070(data, 1, &gUnknown_0203CF1C->unk40C6); + sub_81C1070(data, 1, &gUnknown_0203CF1C->firstMoveIndex); } else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) { @@ -1814,7 +2180,7 @@ void sub_81C174C(u8 taskId) { sub_81C48F0(); PlaySE(SE_SELECT); - gUnknown_0203CF21 = gUnknown_0203CF1C->unk40C6; + gUnknown_0203CF21 = gUnknown_0203CF1C->firstMoveIndex; gSpecialVar_0x8005 = gUnknown_0203CF21; sub_81C044C(taskId); } @@ -1837,9 +2203,9 @@ void sub_81C174C(u8 taskId) } } -bool8 sub_81C18A8() +bool8 sub_81C18A8(void) { - if (gUnknown_0203CF1C->unk40C6 == 4 || gUnknown_0203CF1C->unk40C4 == 0 || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]) != 1) + if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES || gUnknown_0203CF1C->newMove == MOVE_NONE || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]) != 1) return TRUE; else return FALSE; @@ -1866,7 +2232,7 @@ void sub_81C1940(u8 taskId) { data[1] = 1; data[0] = 4; - sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->unk40C6); + sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->firstMoveIndex); data[1] = 0; gTasks[taskId].func = sub_81C174C; } @@ -1874,7 +2240,7 @@ void sub_81C1940(u8 taskId) { data[1] = 1; data[0] = 4; - sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->unk40C6); + sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->firstMoveIndex); data[1] = 0; gTasks[taskId].func = sub_81C174C; } @@ -1882,11 +2248,10 @@ void sub_81C1940(u8 taskId) { if (gUnknown_0203CF1C->unk40C0 != 2) { - ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible) + if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; gTasks[taskId].func = sub_81C174C; sub_81C0A8C(taskId, -1); sub_81C1DA4(9, -2); @@ -1898,9 +2263,9 @@ void sub_81C1940(u8 taskId) if (gUnknown_0203CF1C->unk40C0 != 3) { ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible) + if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; gTasks[taskId].func = sub_81C174C; sub_81C0A8C(taskId, 1); sub_81C1DA4(9, -2); @@ -1910,9 +2275,9 @@ void sub_81C1940(u8 taskId) else if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible) + if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; sub_81C3E9C(move); schedule_bg_copy_tilemap_to_vram(0); sub_81C1DA4(9, -3); @@ -1922,12 +2287,12 @@ void sub_81C1940(u8 taskId) } } -u8 sub_81C1B94() +u8 sub_81C1B94(void) { return gUnknown_0203CF21; } -void sub_81C1BA0() +void sub_81C1BA0(void) { u16 *alloced = Alloc(32); u8 i; @@ -1992,173 +2357,34 @@ void sub_81C1BA0() Free(alloced); } -struct UnkStruct_61CC04 +void sub_81C1CB0(const struct UnkStruct_61CC04 *unkStruct, u16 *dest, u8 c, bool8 d) { - u8 *ptr; - u8 field_4; - u8 field_5; - u8 field_6; - u8 field_7; - u8 field_8; - u8 field_9; -}; - -#ifdef NONMATCHING -void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) -{ - u8 *alloced = Alloc(a->field_6 * (a->field_7 << 1)); - CpuFill16(a->field_4, alloced, a->field_7*a->field_6); - if (a->field_6 != c) + 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) { if (!d) { - for (d;d < a->field_7; d++) + for (i = 0; i < unkStruct->field_7; i++) { - CpuCopy16(&a->ptr + ((c + a->field_6*d)), alloced + ((a->field_6*d) << 1), (a->field_6 - c) * 2); + CpuCopy16(&unkStruct->ptr[c + unkStruct->field_6 * i], &alloced[unkStruct->field_6 * i], (unkStruct->field_6 - c) * 2); } } else { - for (d = 0;d < a->field_7; d++) + for (i = 0; i < unkStruct->field_7; i++) { - CpuCopy16(&a->ptr + (a->field_6*d), alloced + ((c + a->field_6*d) << 1), (a->field_6 - c) * 2); + CpuCopy16(&unkStruct->ptr[unkStruct->field_6 * i], &alloced[c + unkStruct->field_6 * i], (unkStruct->field_6 - c) * 2); } } } - d = 0; - while (d < a->field_7) + for (i = 0; i < unkStruct->field_7; i++) { - CpuCopy16(alloced + ((a->field_6*d) << 1), b + ((((a->field_9 + d) << 5) + a->field_8) << 1), a->field_6 * 2); - d++; + CpuCopy16(&alloced[unkStruct->field_6 * i], &dest[(unkStruct->field_9 + i) * 32 + unkStruct->field_8], unkStruct->field_6 * 2); } Free(alloced); } -#else -NAKED -void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r8\n\ - push {r7}\n\ - sub sp, 0x4\n\ - adds r4, r0, 0\n\ - mov r8, r1\n\ - lsls r2, 24\n\ - lsrs r6, r2, 24\n\ - lsls r3, 24\n\ - lsrs r5, r3, 24\n\ - ldrb r1, [r4, 0x6]\n\ - ldrb r0, [r4, 0x7]\n\ - lsls r0, 1\n\ - muls r0, r1\n\ - bl Alloc\n\ - adds r7, r0, 0\n\ - mov r1, sp\n\ - ldrh r0, [r4, 0x4]\n\ - strh r0, [r1]\n\ - ldrb r1, [r4, 0x7]\n\ - ldrb r0, [r4, 0x6]\n\ - adds r2, r1, 0\n\ - muls r2, r0\n\ - movs r0, 0x80\n\ - lsls r0, 17\n\ - orrs r2, r0\n\ - mov r0, sp\n\ - adds r1, r7, 0\n\ - bl CpuSet\n\ - ldrb r0, [r4, 0x6]\n\ - cmp r0, r6\n\ - beq _081C1D60\n\ - cmp r5, 0\n\ - bne _081C1D30\n\ - movs r5, 0\n\ - ldrb r0, [r4, 0x7]\n\ - cmp r5, r0\n\ - bcs _081C1D60\n\ -_081C1D00:\n\ - ldrb r2, [r4, 0x6]\n\ - adds r1, r2, 0\n\ - muls r1, r5\n\ - adds r3, r6, r1\n\ - lsls r3, 1\n\ - ldr r0, [r4]\n\ - adds r0, r3\n\ - lsls r1, 1\n\ - adds r1, r7, r1\n\ - subs r2, r6\n\ - ldr r3, =0x001fffff\n\ - ands r2, r3\n\ - bl CpuSet\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - ldrb r3, [r4, 0x7]\n\ - cmp r5, r3\n\ - bcc _081C1D00\n\ - b _081C1D60\n\ - .pool\n\ -_081C1D30:\n\ - movs r5, 0\n\ - ldrb r0, [r4, 0x7]\n\ - cmp r5, r0\n\ - bcs _081C1D60\n\ -_081C1D38:\n\ - ldrb r2, [r4, 0x6]\n\ - adds r1, r2, 0\n\ - muls r1, r5\n\ - lsls r3, r1, 1\n\ - ldr r0, [r4]\n\ - adds r0, r3\n\ - adds r1, r6, r1\n\ - lsls r1, 1\n\ - adds r1, r7, r1\n\ - subs r2, r6\n\ - ldr r3, =0x001fffff\n\ - ands r2, r3\n\ - bl CpuSet\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ - ldrb r3, [r4, 0x7]\n\ - cmp r5, r3\n\ - bcc _081C1D38\n\ -_081C1D60:\n\ - movs r5, 0\n\ - b _081C1D8A\n\ - .pool\n\ -_081C1D68:\n\ - ldrb r2, [r4, 0x6]\n\ - adds r0, r2, 0\n\ - muls r0, r5\n\ - lsls r0, 1\n\ - adds r0, r7, r0\n\ - ldrb r1, [r4, 0x9]\n\ - adds r1, r5\n\ - lsls r1, 5\n\ - ldrb r3, [r4, 0x8]\n\ - adds r1, r3\n\ - lsls r1, 1\n\ - add r1, r8\n\ - bl CpuSet\n\ - adds r0, r5, 0x1\n\ - lsls r0, 16\n\ - lsrs r5, r0, 16\n\ -_081C1D8A:\n\ - ldrb r0, [r4, 0x7]\n\ - cmp r5, r0\n\ - bcc _081C1D68\n\ - adds r0, r7, 0\n\ - bl Free\n\ - add sp, 0x4\n\ - pop {r3}\n\ - mov r8, r3\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .syntax divided\n"); -} -#endif void sub_81C1DA4(u16 a, s16 b) { @@ -2166,7 +2392,7 @@ void sub_81C1DA4(u16 a, s16 b) b = gUnknown_0861CC04.field_6; if (b == 0 || b == gUnknown_0861CC04.field_6) { - sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], b, 1); + sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->bgTilemapBuffer3[0], b, 1); } else { @@ -2192,18 +2418,17 @@ void sub_81C1E20(u8 taskId) { data[1] = gUnknown_0861CC04.field_6; } - sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->unkTilemap2[0], data[1], 1); + sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->bgTilemapBuffer3[0], data[1], 1); if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6) { if (data[0] < 0) { if (gUnknown_0203CF1C->unk40C0 == 2) PutWindowTilemap(14); - } else { - if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible) + if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) PutWindowTilemap(13); PutWindowTilemap(19); } @@ -2219,7 +2444,7 @@ 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) - sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], b, 1); + sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->bgTilemapBuffer4[0], b, 1); else { u8 taskId = FindTaskIdByFunc(sub_81C1F80); @@ -2243,7 +2468,7 @@ void sub_81C1F80(u8 taskId) { data[1] = gUnknown_0861CC10.field_6; } - sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->unkTilemap3[0], data[1], 1); + sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->bgTilemapBuffer4[0], data[1], 1); if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6) { if (data[0] < 0) @@ -2254,7 +2479,7 @@ void sub_81C1F80(u8 taskId) } else { - if (!gSprites[gUnknown_0203CF1C->unk40D3[2]].invisible) + if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) { PutWindowTilemap(13); } @@ -2273,8 +2498,8 @@ void sub_81C2074(u16 a, s16 b) b = gUnknown_0861CBEC.field_6; if (b == 0 || b == gUnknown_0861CBEC.field_6) { - sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); - sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], b, 0); + sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->bgTilemapBuffer1[0], b, 0); + sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->bgTilemapBuffer1[0], b, 0); } else { @@ -2292,8 +2517,8 @@ void sub_81C20F0(u8 taskId) data[1] = 0; else if (data[1] > gUnknown_0861CBEC.field_6) data[1] = gUnknown_0861CBEC.field_6; - sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); - sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->unkTilemap0[0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->bgTilemapBuffer1[0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->bgTilemapBuffer1[0], data[1], 0); schedule_bg_copy_tilemap_to_vram(3); if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6) { @@ -2307,126 +2532,44 @@ void sub_81C20F0(u8 taskId) } } -// somebody send help this is a complete fucking mess -#ifdef NONMATCHING -void sub_81C2194(u16 *a, u16 b, u8 c) +void sub_81C2194(u16 *output, u16 palette, bool8 c) { u16 i; - int var; - b *= 0x1000; + u32 var; + palette <<= 12; var = 0x56A; if (c == 0) { for (i = 0; i < 20; i++) { - a[(i + var) << 1] = gSummaryScreenWindow_Tilemap[i] + b; - a[((i + var) << 1) + 0x40] = gSummaryScreenWindow_Tilemap[i] + b; - a[((i + var) << 1) + 0x80] = gSummaryScreenWindow_Tilemap[i + 20] + b; + output[var + i] = gSummaryScreenWindow_Tilemap[i] + palette; + output[var + i + 0x20] = gSummaryScreenWindow_Tilemap[i] + palette; + output[var + i + 0x40] = gSummaryScreenWindow_Tilemap[i + 20] + palette; } } else { for (i = 0; i < 20; i++) { - a[(i + var)] = gSummaryScreenWindow_Tilemap[i + 20] + b; - a[((i + var)) + 0x40] = gSummaryScreenWindow_Tilemap[i + 40] + b; - a[((i + var)) + 0x80] = gSummaryScreenWindow_Tilemap[i + 40] + b; + 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; } } } -#else -NAKED -void sub_81C2194(u16 *a, u16 b, u8 c) -{ - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - adds r6, r0, 0\n\ - lsls r2, 24\n\ - lsls r1, 28\n\ - lsrs r4, r1, 16\n\ - ldr r7, =0x0000056a\n\ - cmp r2, 0\n\ - bne _081C21E4\n\ - movs r3, 0\n\ - ldr r5, =gSummaryScreenWindow_Tilemap\n\ -_081C21A8:\n\ - adds r2, r7, r3\n\ - lsls r2, 1\n\ - adds r2, r6\n\ - lsls r0, r3, 1\n\ - adds r0, r5\n\ - ldrh r1, [r0]\n\ - adds r1, r4, r1\n\ - strh r1, [r2]\n\ - adds r0, r2, 0\n\ - adds r0, 0x40\n\ - strh r1, [r0]\n\ - adds r2, 0x80\n\ - adds r0, r3, 0\n\ - adds r0, 0x14\n\ - lsls r0, 1\n\ - adds r0, r5\n\ - ldrh r0, [r0]\n\ - adds r0, r4, r0\n\ - strh r0, [r2]\n\ - adds r0, r3, 0x1\n\ - lsls r0, 16\n\ - lsrs r3, r0, 16\n\ - cmp r3, 0x13\n\ - bls _081C21A8\n\ - b _081C221C\n\ - .pool\n\ -_081C21E4:\n\ - movs r3, 0\n\ - ldr r5, =gSummaryScreenWindow_Tilemap\n\ -_081C21E8:\n\ - adds r1, r7, r3\n\ - lsls r1, 1\n\ - adds r1, r6\n\ - adds r0, r3, 0\n\ - adds r0, 0x14\n\ - lsls r0, 1\n\ - adds r0, r5\n\ - ldrh r0, [r0]\n\ - adds r0, r4, r0\n\ - strh r0, [r1]\n\ - adds r2, r1, 0\n\ - adds r2, 0x40\n\ - adds r0, r3, 0\n\ - adds r0, 0x28\n\ - lsls r0, 1\n\ - adds r0, r5\n\ - ldrh r0, [r0]\n\ - adds r0, r4, r0\n\ - strh r0, [r2]\n\ - adds r1, 0x80\n\ - strh r0, [r1]\n\ - adds r0, r3, 0x1\n\ - lsls r0, 16\n\ - lsrs r3, r0, 16\n\ - cmp r3, 0x13\n\ - bls _081C21E8\n\ -_081C221C:\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif void sub_81C2228(struct Pokemon *mon) { if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0)) { - gUnknown_0203CF1C->unkTilemap0[0x223] = 0x2C; - gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x2C; + gUnknown_0203CF1C->bgTilemapBuffer1[0x223] = 0x2C; + gUnknown_0203CF1C->bgTilemapBuffer1[0x623] = 0x2C; } else { - gUnknown_0203CF1C->unkTilemap0[0x223] = 0x81A; - gUnknown_0203CF1C->unkTilemap0_1[0x223] = 0x81A; + gUnknown_0203CF1C->bgTilemapBuffer1[0x223] = 0x81A; + gUnknown_0203CF1C->bgTilemapBuffer1[0x623] = 0x81A; } schedule_bg_copy_tilemap_to_vram(3); } @@ -2461,7 +2604,7 @@ void sub_81C22CC(struct Pokemon *unused) r6r7 = 0; } - r9 = &gUnknown_0203CF1C->unkTilemap1_1[0x255]; + r9 = &gUnknown_0203CF1C->bgTilemapBuffer2[0x655]; for (i = 0; i < 8; i++) { if (r6r7 > 7) @@ -2473,7 +2616,7 @@ void sub_81C22CC(struct Pokemon *unused) r6r7 = 0; } - if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->unkTilemap1) + if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->bgTilemapBuffer2) schedule_bg_copy_tilemap_to_vram(1); else schedule_bg_copy_tilemap_to_vram(2); @@ -2481,7 +2624,7 @@ void sub_81C22CC(struct Pokemon *unused) void sub_81C240C(u16 move) { - u16* r5 = &gUnknown_0203CF1C->unkTilemap3_1[0]; + u16* r5 = &gUnknown_0203CF1C->bgTilemapBuffer4[0x400]; u8 i; u8 r4; if (move != MOVE_NONE) @@ -2513,7 +2656,7 @@ void sub_81C240C(u16 move) } } -void sub_81C2524() +void sub_81C2524(void) { if (gUnknown_0203CF1C->summary.isEgg != 0) ChangeBgX(3, 0x10000, 0); @@ -2521,23 +2664,23 @@ void sub_81C2524() ChangeBgX(3, 0, 0); } -void sub_81C2554() +void sub_81C2554(void) { u8 i; - InitWindows(&gUnknown_0861CC24); + InitWindows(gUnknown_0861CC24); DeactivateAllTextPrinters(); for (i = 0; i < 20; i++) FillWindowPixelBuffer(i, 0); for (i = 0; i < 8; i++) - gUnknown_0203CF1C->unk40CB[i] |= 0xFF; + gUnknown_0203CF1C->windowIds[i] |= 0xFF; } void sub_81C25A4(u8 a, const u8 *b, u8 c, u8 d, u8 e, u8 f) { - AddTextPrinterParameterized2(a, 1, c, d, 0, e, gUnknown_0861CD2C[f], 0, b); + AddTextPrinterParameterized2(a, 1, c, d, 0, e, sTextColors_861CD2C[f], 0, b); } -void sub_81C25E8() +void sub_81C25E8(void) { FillWindowPixelBuffer(17, 0); FillWindowPixelBuffer(18, 0); @@ -2549,7 +2692,7 @@ void sub_81C25E8() schedule_bg_copy_tilemap_to_vram(0); } -void sub_81C2628() +void sub_81C2628(void) { u8 strArray[16]; struct Pokemon *mon = &gUnknown_0203CF1C->currentMon; @@ -2594,7 +2737,7 @@ void sub_81C2628() PutWindowTilemap(19); } -void sub_81C2794() +void sub_81C2794(void) { GetMonNickname(&gUnknown_0203CF1C->currentMon, gStringVar1); sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); @@ -2625,7 +2768,7 @@ void sub_81C2838(u8 a, bool8 b, u32 c) BlitBitmapToWindow(a, (b) ? &gUnknown_0861CDD3[0] : &gUnknown_0861CDD3[0] - 0x80, c, 0, 16, 16); } -void sub_81C286C() +void sub_81C286C(void) { int r4; int r2; @@ -2705,9 +2848,9 @@ void sub_81C2AFC(u8 a) break; case 2: PutWindowTilemap(2); - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) PutWindowTilemap(14); } else @@ -2715,9 +2858,9 @@ void sub_81C2AFC(u8 a) break; case 3: PutWindowTilemap(3); - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) PutWindowTilemap(15); } else @@ -2726,7 +2869,7 @@ void sub_81C2AFC(u8 a) } for (i = 0; i < 8; i++) { - PutWindowTilemap(gUnknown_0203CF1C->unk40CB[i]); + PutWindowTilemap(gUnknown_0203CF1C->windowIds[i]); } schedule_bg_copy_tilemap_to_vram(0); } @@ -2748,18 +2891,18 @@ void sub_81C2C38(u8 a) ClearWindowTilemap(12); break; case 2: - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) ClearWindowTilemap(14); } else ClearWindowTilemap(5); break; case 3: - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { - if(!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) ClearWindowTilemap(15); } else @@ -2771,9 +2914,9 @@ void sub_81C2C38(u8 a) schedule_bg_copy_tilemap_to_vram(0); } -u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) +u8 sub_81C2D2C(const struct WindowTemplate *template, u8 a) { - u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]); + u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[a]); if (*windowIdPtr == 0xFF) { *windowIdPtr = AddWindow(&template[a]); @@ -2784,7 +2927,7 @@ u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) void sub_81C2D68(u8 a) { - u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]); + u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[a]); if (*windowIdPtr != 0xFF) { ClearWindowTilemap(*windowIdPtr); @@ -2798,8 +2941,8 @@ void sub_81C2D9C(u8 a) u16 i; for (i = 0; i < 8; i++) { - if (gUnknown_0203CF1C->unk40CB[i] != 0xFF) - FillWindowPixelBuffer(gUnknown_0203CF1C->unk40CB[i], 0); + if (gUnknown_0203CF1C->windowIds[i] != 0xFF) + FillWindowPixelBuffer(gUnknown_0203CF1C->windowIds[i], 0); } gUnknown_0861CE54[a](); } @@ -2809,7 +2952,7 @@ void sub_81C2DE4(u8 a) CreateTask(gUnknown_0861CE64[a], 16); } -void sub_81C2E00() +void sub_81C2E00(void) { if (gUnknown_0203CF1C->summary.isEgg) { @@ -2860,13 +3003,13 @@ void sub_81C2E40(u8 taskId) data[0]++; } -void sub_81C2EC4() +void sub_81C2EC4(void) { u8 r5; int r2; if (sub_81A6BF4() != 1 && sub_81B9E94() != 1) { - r5 = sub_81C2D2C(&gUnknown_0861CCCC, 0); + r5 = sub_81C2D2C(gUnknown_0861CCCC, 0); sub_81C25A4(r5, gText_OTSlash, 0, 1, 0, 1); r2 = GetStringWidth(1, gText_OTSlash, 0); if (gUnknown_0203CF1C->summary.OTGender == 0) @@ -2876,33 +3019,33 @@ void sub_81C2EC4() } } -void sub_81C2F5C() +void sub_81C2F5C(void) { int r4; if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE) { ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5); r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); } } -void sub_81C2FD8() +void sub_81C2FD8(void) { u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); } -void sub_81C302C() +void sub_81C302C(void) { u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); } -void sub_81C307C() +void sub_81C307C(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 *text; + const u8 *text; DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_0861CE74); DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_0861CE7B); @@ -2938,12 +3081,12 @@ void sub_81C307C() } } -void sub_81C3194() +void sub_81C3194(void) { - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); } -void sub_81C31C0() +void sub_81C31C0(void) { struct UnkSummaryStruct *sumStruct = gUnknown_0203CF1C; DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gNatureNamePointers[sumStruct->summary.nature]); @@ -2959,14 +3102,15 @@ void sub_81C31F0(u8 *a) DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, a); } -u8 sub_81C3220() +u8 sub_81C3220(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u32 r4; u8 r5; - if (gUnknown_0203CF1C->unk0 == (union UnkUnion *)&gEnemyParty) + + if (gUnknown_0203CF1C->monList.mons == gEnemyParty) { - u8 multiID = GetMultiplayerId()^1; + u8 multiID = GetMultiplayerId() ^ 1; r4 = (u16)gLinkPlayers[multiID].trainerId; r5 = gLinkPlayers[multiID].gender; StringCopy(gStringVar1, gLinkPlayers[multiID].name); @@ -2984,7 +3128,7 @@ u8 sub_81C3220() return 1; } -bool8 sub_81C32BC() +bool8 sub_81C32BC(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 r0 = sum->metGame - 1; @@ -2993,7 +3137,7 @@ bool8 sub_81C32BC() return FALSE; } -bool8 sub_81C32E0() +bool8 sub_81C32E0(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; u8 r0 = sum->metGame - 1; @@ -3002,91 +3146,36 @@ bool8 sub_81C32E0() return FALSE; } -bool8 sub_81C3304() +bool8 sub_81C3304(void) { if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle) { - if (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5) + if (gUnknown_0203CF1C->curMonIndex == 1 || gUnknown_0203CF1C->curMonIndex == 4 || gUnknown_0203CF1C->curMonIndex == 5) return TRUE; } return FALSE; } -#ifdef NONMATCHING -void sub_81C335C() +void sub_81C335C(void) { - u8 r4 = sub_81C2D2C(&gUnknown_0861CCCC, 0); - u32 r5 = GetStringWidth(1, gText_OTSlash, 0); - sub_81C25A4(r4, gText_OTSlash, 0, 1, 0, 1); - sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1); + u32 windowId = sub_81C2D2C(gUnknown_0861CCCC, 0); + u32 width = GetStringWidth(1, gText_OTSlash, 0); + sub_81C25A4(windowId, gText_OTSlash, 0, 1, 0, 1); + sub_81C25A4(windowId, gText_FiveMarks, width, 1, 0, 1); } -#else -NAKED -void sub_81C335C() -{ - asm(".syntax unified\n\ - push {r4-r6,lr}\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5,r6}\n\ - sub sp, 0x8\n\ - ldr r0, =gUnknown_0861CCCC\n\ - movs r1, 0\n\ - bl sub_81C2D2C\n\ - adds r4, r0, 0\n\ - lsls r4, 24\n\ - lsrs r4, 24\n\ - ldr r0, =gText_OTSlash\n\ - mov r8, r0\n\ - movs r0, 0x1\n\ - mov r1, r8\n\ - movs r2, 0\n\ - bl GetStringWidth\n\ - adds r5, r0, 0\n\ - movs r0, 0\n\ - mov r9, r0\n\ - str r0, [sp]\n\ - movs r6, 0x1\n\ - str r6, [sp, 0x4]\n\ - adds r0, r4, 0\n\ - mov r1, r8\n\ - movs r2, 0\n\ - movs r3, 0x1\n\ - bl sub_81C25A4\n\ - ldr r1, =gText_FiveMarks\n\ - lsls r5, 24\n\ - lsrs r5, 24\n\ - mov r0, r9\n\ - str r0, [sp]\n\ - str r6, [sp, 0x4]\n\ - adds r0, r4, 0\n\ - adds r2, r5, 0\n\ - movs r3, 0x1\n\ - bl sub_81C25A4\n\ - add sp, 0x8\n\ - pop {r3,r4}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - pop {r4-r6}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); -} -#endif -void sub_81C33CC() +void sub_81C33CC(void) { int r4; StringCopy(gStringVar1, gText_UnkCtrlF907F908); StringAppend(gStringVar1, gText_FiveMarks); r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); } -void sub_81C3428() +void sub_81C3428(void) { - u8 *text; + const u8 *text; struct PokeSummary *sum = &gUnknown_0203CF1C->summary; if (gUnknown_0203CF1C->summary.sanity == 1) text = gText_EggWillTakeALongTime; @@ -3098,12 +3187,12 @@ void sub_81C3428() text = gText_EggWillTakeSomeTime; else text = gText_EggWillTakeALongTime; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); } -void sub_81C349C() +void sub_81C349C(void) { - u8 *text; + const u8 *text; struct PokeSummary *sum = &gUnknown_0203CF1C->summary; if (gUnknown_0203CF1C->summary.sanity != 1) { @@ -3118,10 +3207,10 @@ void sub_81C349C() } else text = gText_OddEggFoundByCouple; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); } -void sub_81C3530() +void sub_81C3530(void) { sub_81C35E4(); sub_81C3690(); @@ -3166,11 +3255,11 @@ void sub_81C3554(u8 taskId) data[0]++; } -void sub_81C35E4() +void sub_81C35E4(void) { const u8 *text; int offset; - if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == 1 && (gUnknown_0203CF1C->unk40BE == 1 || gUnknown_0203CF1C->unk40BE == 4 || gUnknown_0203CF1C->unk40BE == 5)) + if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == 1 && (gUnknown_0203CF1C->curMonIndex == 1 || gUnknown_0203CF1C->curMonIndex == 4 || gUnknown_0203CF1C->curMonIndex == 5)) { text = ItemId_GetName(ITEM_ENIGMA_BERRY); } @@ -3182,12 +3271,12 @@ void sub_81C35E4() text = gStringVar1; } offset = GetStringCenterAlignXOffset(1, text, 0x48) + 6; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); } -void sub_81C3690() +void sub_81C3690(void) { - u8 *text; + const u8 *text; int offset; if (gUnknown_0203CF1C->summary.ribbons == 0) text = gText_None; @@ -3198,10 +3287,10 @@ void sub_81C3690() text = gStringVar4; } offset = GetStringCenterAlignXOffset(1, text, 0x46) + 6; - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); } -void sub_81C3710() +void sub_81C3710(void) { u8 *alloced1 = Alloc(8); u8 *alloced2 = Alloc(8); @@ -3223,12 +3312,12 @@ void sub_81C3710() Free(alloced4); } -void sub_81C37D8() +void sub_81C37D8(void) { - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); } -void sub_81C3808() +void sub_81C3808(void) { ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.spatk, 1, 3); ConvertIntToDecimalStringN(gStringVar2, gUnknown_0203CF1C->summary.spdef, 1, 3); @@ -3240,15 +3329,15 @@ void sub_81C3808() DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE8E); } -void sub_81C3890() +void sub_81C3890(void) { - sub_81C25A4(sub_81C2D2C(&gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); + sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); } -void sub_81C38C0() +void sub_81C38C0(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 r6 = sub_81C2D2C(&gUnknown_0861CCEC, 4); + u8 r6 = sub_81C2D2C(gUnknown_0861CCEC, 4); int offset; u32 expToNextLevel; ConvertIntToDecimalStringN(gStringVar1, sum->exp, 1, 7); @@ -3263,22 +3352,22 @@ void sub_81C38C0() sub_81C25A4(r6, gStringVar1, offset, 17, 0, 0); } -void sub_81C3984() +void sub_81C3984(void) { sub_81C3B08(0); sub_81C3B08(1); sub_81C3B08(2); sub_81C3B08(3); - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { sub_81C3F44(); - if (gUnknown_0203CF1C->unk40C6 == 4) + if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES) { - if (gUnknown_0203CF1C->unk40C4 != 0) - sub_81C3E9C(gUnknown_0203CF1C->unk40C4); + if (gUnknown_0203CF1C->newMove != MOVE_NONE) + sub_81C3E9C(gUnknown_0203CF1C->newMove); } else - sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]); + sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]); } } @@ -3302,22 +3391,22 @@ void sub_81C39F0(u8 taskId) sub_81C3B08(3); break; case 4: - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) sub_81C3F44(); break; case 5: - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { - if (gUnknown_0203CF1C->unk40C6 == 4) - data[1] = gUnknown_0203CF1C->unk40C4; + if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES) + data[1] = gUnknown_0203CF1C->newMove; else - data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->unk40C6]; + data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; } break; case 6: - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { - if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) + if (!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) sub_81C3E9C(data[1]); } break; @@ -3328,193 +3417,44 @@ void sub_81C39F0(u8 taskId) data[0]++; } -#ifdef NONMATCHING void sub_81C3B08(u8 a) { - struct UnkSummaryStruct *r10 = gUnknown_0203CF1C; - u8 r8 = sub_81C2D2C(&gUnknown_0861CD14, 0); - u8 sp = sub_81C2D2C(&gUnknown_0861CD14, 1); - u8 r6; - u8 r5; - u8 *text; - int offset; - u16 move; - if (r10->summary.moves[a] != 0) + u8 pp; + u32 ppState; + const u8 *text; + u32 offset; + struct UnkSummaryStruct *summaryStruct = gUnknown_0203CF1C; + u8 r8 = sub_81C2D2C(gUnknown_0861CD14, 0); + u8 sp = sub_81C2D2C(gUnknown_0861CD14, 1); + u16 move = summaryStruct->summary.moves[a]; + + if (move != 0) { - move = r10->summary.moves[a]; - r6 = CalculatePPWithBonus(move, r10->summary.ppBonuses, a); - sub_81C25A4(r8, gMoveNames[move], 0, (a<<4) + 1, 0, 1); - ConvertIntToDecimalStringN(gStringVar1, r10->summary.pp[a], 1, 2); - ConvertIntToDecimalStringN(gStringVar2, r6, 1, 2); + pp = CalculatePPWithBonus(move, summaryStruct->summary.ppBonuses, a); + sub_81C25A4(r8, gMoveNames[move], 0, a * 16 + 1, 0, 1); + ConvertIntToDecimalStringN(gStringVar1, summaryStruct->summary.pp[a], 1, 2); + ConvertIntToDecimalStringN(gStringVar2, pp, 1, 2); DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE97); text = gStringVar4; - r5 = GetCurrentPpToMaxPpState(r10->summary.pp[a], r6) + 9; + ppState = GetCurrentPpToMaxPpState(summaryStruct->summary.pp[a], pp) + 9; offset = GetStringRightAlignXOffset(1, text, 0x2C); } else { - sub_81C25A4(r8, gText_OneDash, 0, (a<<4) + 1, 0, 1); + sub_81C25A4(r8, gText_OneDash, 0, a * 16 + 1, 0, 1); text = gText_TwoDashes; - r5 = 12; + ppState = 12; offset = GetStringCenterAlignXOffset(1, text, 0x2C); } - sub_81C25A4(sp, text, offset, (a<<4), 0, r5); + sub_81C25A4(sp, text, offset, a * 16 + 1, 0, ppState); } -#else -NAKED -void sub_81C3B08(u8 a) -{ - 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, 0xC\n\ - lsls r0, 24\n\ - lsrs r7, r0, 24\n\ - ldr r0, =gUnknown_0203CF1C\n\ - ldr r0, [r0]\n\ - mov r10, r0\n\ - ldr r4, =gUnknown_0861CD14\n\ - adds r0, r4, 0\n\ - movs r1, 0\n\ - bl sub_81C2D2C\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - mov r8, r0\n\ - adds r0, r4, 0\n\ - movs r1, 0x1\n\ - bl sub_81C2D2C\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - str r0, [sp, 0x8]\n\ - lsls r1, r7, 1\n\ - mov r0, r10\n\ - adds r0, 0x84\n\ - adds r0, r1\n\ - ldrh r5, [r0]\n\ - cmp r5, 0\n\ - beq _081C3C00\n\ - mov r0, r10\n\ - adds r0, 0xA4\n\ - ldrb r1, [r0]\n\ - adds r0, r5, 0\n\ - adds r2, r7, 0\n\ - bl CalculatePPWithBonus\n\ - adds r6, r0, 0\n\ - lsls r6, 24\n\ - lsrs r6, 24\n\ - movs r0, 0xD\n\ - adds r1, r5, 0\n\ - muls r1, r0\n\ - ldr r0, =gMoveNames\n\ - adds r1, r0\n\ - lsls r0, r7, 4\n\ - mov r9, r0\n\ - mov r3, r9\n\ - adds r3, 0x1\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - movs r0, 0\n\ - str r0, [sp]\n\ - movs r0, 0x1\n\ - str r0, [sp, 0x4]\n\ - mov r0, r8\n\ - movs r2, 0\n\ - bl sub_81C25A4\n\ - ldr r0, =gStringVar1\n\ - mov r8, r0\n\ - mov r5, r10\n\ - adds r5, 0x8C\n\ - adds r5, r7\n\ - ldrb r1, [r5]\n\ - movs r2, 0x1\n\ - movs r3, 0x2\n\ - bl ConvertIntToDecimalStringN\n\ - ldr r4, =gStringVar2\n\ - adds r0, r4, 0\n\ - adds r1, r6, 0\n\ - movs r2, 0x1\n\ - movs r3, 0x2\n\ - bl ConvertIntToDecimalStringN\n\ - bl DynamicPlaceholderTextUtil_Reset\n\ - movs r0, 0\n\ - mov r1, r8\n\ - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr\n\ - movs r0, 0x1\n\ - adds r1, r4, 0\n\ - bl DynamicPlaceholderTextUtil_SetPlaceholderPtr\n\ - ldr r4, =gStringVar4\n\ - ldr r1, =gUnknown_0861CE97\n\ - adds r0, r4, 0\n\ - bl DynamicPlaceholderTextUtil_ExpandPlaceholders\n\ - adds r7, r4, 0\n\ - ldrb r0, [r5]\n\ - adds r1, r6, 0\n\ - bl GetCurrentPpToMaxPpState\n\ - lsls r0, 24\n\ - lsrs r0, 24\n\ - adds r5, r0, 0\n\ - adds r5, 0x9\n\ - movs r0, 0x1\n\ - adds r1, r7, 0\n\ - movs r2, 0x2C\n\ - bl GetStringRightAlignXOffset\n\ - mov r4, r9\n\ - b _081C3C26\n\ - .pool\n\ -_081C3C00:\n\ - ldr r1, =gText_OneDash\n\ - lsls r4, r7, 4\n\ - adds r3, r4, 0x1\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - str r5, [sp]\n\ - movs r0, 0x1\n\ - str r0, [sp, 0x4]\n\ - mov r0, r8\n\ - movs r2, 0\n\ - bl sub_81C25A4\n\ - ldr r7, =gText_TwoDashes\n\ - movs r5, 0xC\n\ - movs r0, 0x1\n\ - adds r1, r7, 0\n\ - movs r2, 0x2C\n\ - bl GetStringCenterAlignXOffset\n\ -_081C3C26:\n\ - lsls r2, r0, 24\n\ - lsrs r2, 24\n\ - adds r3, r4, 0x1\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - movs r0, 0\n\ - str r0, [sp]\n\ - lsls r0, r5, 24\n\ - lsrs r0, 24\n\ - str r0, [sp, 0x4]\n\ - ldr r0, [sp, 0x8]\n\ - adds r1, r7, 0\n\ - bl sub_81C25A4\n\ - add sp, 0xC\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_81C3C5C(u16 move) { - u8 *text; + const u8 *text; if (move != 0) { FillWindowPixelRect(14, 0, 0x35, 0, 0x13, 0x20); @@ -3537,16 +3477,16 @@ void sub_81C3C5C(u16 move) } } -void sub_81C3D08() +void sub_81C3D08(void) { sub_81C3B08(0); sub_81C3B08(1); sub_81C3B08(2); sub_81C3B08(3); - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { sub_81C3F44(); - sub_81C3E2C(gUnknown_0203CF1C->unk40C6); + sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex); } } @@ -3570,14 +3510,14 @@ void sub_81C3D54(u8 taskId) sub_81C3B08(3); break; case 4: - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) sub_81C3F44(); break; case 5: - if (gUnknown_0203CF1C->unk40BC == 3) + if (gUnknown_0203CF1C->mode == 3) { - if (!(gUnknown_0203CF1C->unk40C4 == 0 && gUnknown_0203CF1C->unk40C6 == 4)) - sub_81C3E2C(gUnknown_0203CF1C->unk40C6); + if (!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex); } break; case 6: @@ -3592,20 +3532,20 @@ void sub_81C3E2C(u8 moveSlot) u16 move; if (moveSlot == 4) - move = gUnknown_0203CF1C->unk40C4; + move = gUnknown_0203CF1C->newMove; else move = gUnknown_0203CF1C->summary.moves[moveSlot]; if (move != MOVE_NONE) { - u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 2); + u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 2); sub_81C25A4(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0); } } void sub_81C3E9C(u16 move) { - u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 2); + u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 2); FillWindowPixelBuffer(windowId, 0); if (move != MOVE_NONE) { @@ -3630,15 +3570,15 @@ void sub_81C3E9C(u16 move) void sub_81C3F44(void) { - u8 windowId1 = sub_81C2D2C(&gUnknown_0861CD14, 0); - u8 windowId2 = sub_81C2D2C(&gUnknown_0861CD14, 1); - if (gUnknown_0203CF1C->unk40C4 == MOVE_NONE) + u8 windowId1 = sub_81C2D2C(gUnknown_0861CD14, 0); + u8 windowId2 = sub_81C2D2C(gUnknown_0861CD14, 1); + if (gUnknown_0203CF1C->newMove == MOVE_NONE) { sub_81C25A4(windowId1, gText_Cancel, 0, 0x41, 0, 1); } else { - u16 move = gUnknown_0203CF1C->unk40C4; + u16 move = gUnknown_0203CF1C->newMove; if (gUnknown_0203CF1C->unk40C0 == 2) sub_81C25A4(windowId1, gMoveNames[move], 0, 0x41, 0, 6); else @@ -3655,15 +3595,15 @@ void sub_81C3F44(void) void sub_81C4064(void) { - u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 0); + u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 0); FillWindowPixelRect(windowId, 0, 0, 0x42, 0x48, 0x10); CopyWindowToVram(windowId, 2); } void sub_81C40A0(u8 a, u8 b) { - u8 windowId1 = sub_81C2D2C(&gUnknown_0861CD14, 0); - u8 windowId2 = sub_81C2D2C(&gUnknown_0861CD14, 1); + u8 windowId1 = sub_81C2D2C(gUnknown_0861CD14, 0); + u8 windowId2 = sub_81C2D2C(gUnknown_0861CD14, 1); FillWindowPixelRect(windowId1, 0, 0, a * 16, 0x48, 0x10); FillWindowPixelRect(windowId1, 0, 0, b * 16, 0x48, 0x10); @@ -3677,7 +3617,7 @@ void sub_81C40A0(u8 a, u8 b) void sub_81C4154(void) { - u8 windowId = sub_81C2D2C(&gUnknown_0861CD14, 2); + u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 2); FillWindowPixelBuffer(windowId, 0); sub_81C25A4(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0); } @@ -3687,21 +3627,21 @@ void sub_81C4190(void) u8 i; for (i = 0; i < 28; i++) - gUnknown_0203CF1C->unk40D3[i] |= 0xFF; + gUnknown_0203CF1C->spriteIds[i] |= 0xFF; } void sub_81C41C0(u8 spriteArrayId) { - if (gUnknown_0203CF1C->unk40D3[spriteArrayId] != 0xFF) + if (gUnknown_0203CF1C->spriteIds[spriteArrayId] != 0xFF) { - DestroySprite(&gSprites[gUnknown_0203CF1C->unk40D3[spriteArrayId]]); - gUnknown_0203CF1C->unk40D3[spriteArrayId] = 0xFF; + DestroySprite(&gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]]); + gUnknown_0203CF1C->spriteIds[spriteArrayId] = 0xFF; } } void sub_81C4204(u8 spriteArrayId, bool8 invisible) { - gSprites[gUnknown_0203CF1C->unk40D3[spriteArrayId]].invisible = invisible; + gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]].invisible = invisible; } void sub_81C424C(void) @@ -3710,7 +3650,7 @@ void sub_81C424C(void) for (i = 3; i < 28; i++) { - if (gUnknown_0203CF1C->unk40D3[i] != 0xFF) + if (gUnknown_0203CF1C->spriteIds[i] != 0xFF) sub_81C4204(i, TRUE); } } @@ -3739,18 +3679,16 @@ void sub_81C42C8(void) for (i = 3; i < 8; i++) { - if (gUnknown_0203CF1C->unk40D3[i] == 0xFF) - gUnknown_0203CF1C->unk40D3[i] = CreateSprite(&gUnknown_0861CFC4, 0, 0, 2); + if (gUnknown_0203CF1C->spriteIds[i] == 0xFF) + gUnknown_0203CF1C->spriteIds[i] = CreateSprite(&gUnknown_0861CFC4, 0, 0, 2); sub_81C4204(i, TRUE); } } -extern const u8 gUnknown_0861CFDC[]; - void sub_81C4318(u8 typeId, u8 x, u8 y, u8 spriteArrayId) { - struct Sprite *sprite = &gSprites[gUnknown_0203CF1C->unk40D3[spriteArrayId]]; + struct Sprite *sprite = &gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); sprite->oam.paletteNum = gUnknown_0861CFDC[typeId]; sprite->pos1.x = x + 16; @@ -3809,15 +3747,351 @@ void sub_81C4484(void) void sub_81C44F0(void) { - if (gUnknown_0203CF1C->unk40C4 == MOVE_NONE) + if (gUnknown_0203CF1C->newMove == MOVE_NONE) { sub_81C4204(7, TRUE); } else { if (gUnknown_0203CF1C->unk40C0 == 2) - sub_81C4318(gBattleMoves[gUnknown_0203CF1C->unk40C4].type, 0x55, 0x60, 7); + sub_81C4318(gBattleMoves[gUnknown_0203CF1C->newMove].type, 0x55, 0x60, 7); else - sub_81C4318(NUMBER_OF_MON_TYPES + gContestMoves[gUnknown_0203CF1C->unk40C4].contestCategory, 0x55, 0x60, 7); + 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 == 2 || gUnknown_0203CF1C->unk40EF == TRUE) + { + 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 == 2 || gUnknown_0203CF1C->unk40EF == TRUE) + { + 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 sub_81C4898(void) +{ + 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->markingsSpriteId = sprite; + + if (sprite != NULL) + { + StartSpriteAnim(sprite, GetMonData(mon, MON_DATA_MARKINGS)); + gUnknown_0203CF1C->markingsSpriteId->pos1.x = 60; + gUnknown_0203CF1C->markingsSpriteId->pos1.y = 26; + gUnknown_0203CF1C->markingsSpriteId->oam.priority = 1; + } +} + +void sub_81C49E0(struct Pokemon *mon) +{ + DestroySprite(gUnknown_0203CF1C->markingsSpriteId); + 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->unk40C0 > 1) + { + 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 + { + 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; } } diff --git a/src/unk_pokedex_area_screen_helper.c b/src/unk_pokedex_area_screen_helper.c new file mode 100644 index 000000000..3bed79a65 --- /dev/null +++ b/src/unk_pokedex_area_screen_helper.c @@ -0,0 +1,75 @@ +#include "global.h" +#include "main.h" +#include "menu.h" +#include "bg.h" +#include "malloc.h" +#include "palette.h" + +EWRAM_DATA u8 *gUnknown_0203CF28 = NULL; + +static const u16 gUnknown_0861D140[] = INCBIN_U16("graphics/interface/region_map.gbapal"); +extern const u8 gUnknown_0861D1A0[]; +extern const u8 gUnknown_0861DEF4[]; +extern const u8 gUnknown_0861E208[]; +extern const u8 gUnknown_0861EF64[]; + +struct UnkStruct_1C4D70 +{ + u32 bg:2; + u32 unk2:8; + u32 unk10:2; + u32 unk12:20; +}; + +void sub_81C4D70(struct UnkStruct_1C4D70 *template) +{ + u8 unk; + gUnknown_0203CF28 = Alloc(4); + unk = template->unk10; + + if (unk == 0) + { + SetBgAttribute(template->bg, BG_CTRL_ATTR_WRAPAROUND, 0); + decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861D1A0, 0, template->unk2, unk); + sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861DEF4, 0, 0, 1), template->unk2, 32, 32, unk); + } + else + { + SetBgAttribute(template->bg, BG_CTRL_ATTR_WRAPAROUND, 2); + SetBgAttribute(template->bg, 9, 1); + decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861E208, 0, template->unk2, 0); + sub_8199D3C(decompress_and_copy_tile_data_to_vram(template->bg, gUnknown_0861EF64, 0, 0, 1), template->unk2, 64, 64, 1); + } + + ChangeBgX(template->bg, 0, 0); + ChangeBgY(template->bg, 0, 0); + SetBgAttribute(template->bg, BG_CTRL_ATTR_SCREENSIZE, 1); + CpuCopy32(gUnknown_0861D140, &gPlttBufferUnfaded[0x70], 0x60); + *gUnknown_0203CF28 = template->bg; +} + +bool32 sub_81C4E90(void) +{ + if (!free_temp_tile_data_buffers_if_possible()) + { + ShowBg(*gUnknown_0203CF28); + return FALSE; + } + else + { + return TRUE; + } +} + +void sub_81C4EB4(void) +{ + if (gUnknown_0203CF28 != NULL) + { + FREE_AND_SET_NULL(gUnknown_0203CF28); + } +} + +void sub_81C4ED0(u32 a0) +{ + ChangeBgY(*gUnknown_0203CF28, a0 * 0x100, 0); +} diff --git a/sym_ewram.txt b/sym_ewram.txt index cf1c8b8d7..b54d52f90 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -739,30 +739,9 @@ gUnknown_0203CF00: @ 203CF00 .include "src/fossil_specials.o" .include "src/fldeff_groundshake.o" - -gUnknown_0203CF1C: @ 203CF1C - .space 0x4 - -gUnknown_0203CF20: @ 203CF20 - .space 0x1 - -gUnknown_0203CF21: @ 203CF21 - .space 0x3 - -gUnknown_0203CF24: @ 203CF24 - .space 0x4 - -gUnknown_0203CF28: @ 203CF28 - .space 0x4 - -gUnknown_0203CF2C: @ 203CF2C - .space 0x4 - -gUnknown_0203CF30: @ 203CF30 - .space 0x8 - -gUnknown_0203CF38: @ 203CF38 - .space 0x4 + .include "src/pokemon_summary_screen.o" + .include "src/unk_pokedex_area_screen_helper.o" + .include "src/battle_pyramid.o" gUnknown_0203CF3C: @ 203CF3C .space 0x4 From 332a8bcb1d6c9b01e27cc4f5a7a08ae26bf62f79 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 14 Aug 2018 22:05:48 -0700 Subject: [PATCH 13/21] Extract rodata for unk_pokedex_area_screen_helper --- ...ex_area_screen_helper.s => battle_pyramid.s} | 16 ---------------- include/pokemon_storage_system.h | 2 +- include/pokemon_summary_screen.h | 2 +- ld_script.txt | 2 +- src/pokemon_summary_screen.c | 17 ++++++++--------- src/unk_pokedex_area_screen_helper.c | 8 ++++---- 6 files changed, 15 insertions(+), 32 deletions(-) rename data/{unk_pokedex_area_screen_helper.s => battle_pyramid.s} (87%) diff --git a/data/unk_pokedex_area_screen_helper.s b/data/battle_pyramid.s similarity index 87% rename from data/unk_pokedex_area_screen_helper.s rename to data/battle_pyramid.s index 2f3881446..7327fb1f8 100644 --- a/data/unk_pokedex_area_screen_helper.s +++ b/data/battle_pyramid.s @@ -3,22 +3,6 @@ .section .rodata - .align 2 -gUnknown_0861D1A0:: @ 861D1A0 - .incbin "graphics/interface/region_map.8bpp.lz" - - .align 2 -gUnknown_0861DEF4:: @ 861DEF4 - .incbin "graphics/interface/region_map.bin.lz" - - .align 2 -gUnknown_0861E208:: @ 861E208 - .incbin "graphics/interface/region_map_affine.8bpp.lz" - - .align 2 -gUnknown_0861EF64:: @ 861EF64 - .incbin "graphics/interface/region_map_affine.bin.lz" - .align 2 gUnknown_0861F2B4:: @ 861F2B4 .4byte 0x000011f0, 0x000001e1, 0x000021de diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index a73958d90..9b5358f06 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -83,6 +83,6 @@ void CompactPartySlots(void); u32 GetBoxMonDataFromAnyBox(u8 boxId, u8 monPosition, u32 request); bool8 CheckFreePokemonStorageSpace(void); u8 StorageGetCurrentBox(void); -u8 sub_80D214C(struct BoxPokemon* a, u8 b, u8 c, u8 d); +u8 sub_80D214C(struct BoxPokemon *a, u8 b, u8 c, u8 d); #endif // GUARD_POKEMON_STORAGE_SYSTEM_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 0580e793c..b29548258 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -2,6 +2,6 @@ #define GUARD_POKEMON_SUMMARY_SCREEN_H void sub_81C4F98(u8, void(*)(void)); -void ShowSelectMovePokemonSummaryScreen(struct Pokemon *a, u8 b, u8 c, void *d, u16 e); +void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); #endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/ld_script.txt b/ld_script.txt index 462af2946..2311301b0 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -540,7 +540,7 @@ SECTIONS { src/berry_fix_program.o(.rodata); src/pokemon_summary_screen.o(.rodata); src/unk_pokedex_area_screen_helper.o(.rodata); - data/unk_pokedex_area_screen_helper.o(.rodata); + data/battle_pyramid.o(.rodata); data/pokenav.o(.rodata); src/match_call.o(.rodata); data/pokenav.o(.rodata.after.match.call); diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b5117d45d..4d194f74a 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -45,13 +45,12 @@ static EWRAM_DATA struct UnkSummaryStruct { - /*0x00*/ union - { + /*0x00*/ union { struct Pokemon *mons; struct BoxPokemon *boxMons; } monList; - /*0x04*/ void (*callback)(void); - /*0x08*/ struct Sprite *markingsSpriteId; + /*0x04*/ MainCallback callback; + /*0x08*/ struct Sprite *markingsSprite; /*0x0C*/ struct Pokemon currentMon; /*0x70*/ struct PokeSummary { @@ -3936,20 +3935,20 @@ void sub_81C4984(struct Pokemon *mon) { struct Sprite *sprite = sub_811FF94(30003, 30003, gUnknown_0861D120); - gUnknown_0203CF1C->markingsSpriteId = sprite; + gUnknown_0203CF1C->markingsSprite = sprite; if (sprite != NULL) { StartSpriteAnim(sprite, GetMonData(mon, MON_DATA_MARKINGS)); - gUnknown_0203CF1C->markingsSpriteId->pos1.x = 60; - gUnknown_0203CF1C->markingsSpriteId->pos1.y = 26; - gUnknown_0203CF1C->markingsSpriteId->oam.priority = 1; + gUnknown_0203CF1C->markingsSprite->pos1.x = 60; + gUnknown_0203CF1C->markingsSprite->pos1.y = 26; + gUnknown_0203CF1C->markingsSprite->oam.priority = 1; } } void sub_81C49E0(struct Pokemon *mon) { - DestroySprite(gUnknown_0203CF1C->markingsSpriteId); + DestroySprite(gUnknown_0203CF1C->markingsSprite); FreeSpriteTilesByTag(30003); sub_81C4984(mon); } diff --git a/src/unk_pokedex_area_screen_helper.c b/src/unk_pokedex_area_screen_helper.c index 3bed79a65..521af6dd9 100644 --- a/src/unk_pokedex_area_screen_helper.c +++ b/src/unk_pokedex_area_screen_helper.c @@ -8,10 +8,10 @@ EWRAM_DATA u8 *gUnknown_0203CF28 = NULL; static const u16 gUnknown_0861D140[] = INCBIN_U16("graphics/interface/region_map.gbapal"); -extern const u8 gUnknown_0861D1A0[]; -extern const u8 gUnknown_0861DEF4[]; -extern const u8 gUnknown_0861E208[]; -extern const u8 gUnknown_0861EF64[]; +static const u8 gUnknown_0861D1A0[] = INCBIN_U8("graphics/interface/region_map.8bpp.lz"); +static const u8 gUnknown_0861DEF4[] = INCBIN_U8("graphics/interface/region_map.bin.lz"); +static const u8 gUnknown_0861E208[] = INCBIN_U8("graphics/interface/region_map_affine.8bpp.lz"); +static const u8 gUnknown_0861EF64[] = INCBIN_U8("graphics/interface/region_map_affine.bin.lz"); struct UnkStruct_1C4D70 { From 0bc975bf57a1603d2d23265ea9fad39cc05622b9 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Wed, 15 Aug 2018 01:44:20 -0700 Subject: [PATCH 14/21] Document and cleanup pokemon_summary_screen --- asm/battle_frontier_2.s | 4 +- asm/party_menu.s | 6 +- asm/pokemon_storage_system.s | 4 +- asm/trade.s | 4 +- include/constants/region_map_sections.h | 4 + include/pokemon_summary_screen.h | 10 + src/pokemon_summary_screen.c | 984 +++++++++++++----------- 7 files changed, 554 insertions(+), 462 deletions(-) diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 8f2d7b0e0..7e72aaf76 100644 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -1244,7 +1244,7 @@ _0819AF1A: movs r0, 0x1 adds r2, r6, 0 movs r3, 0x5 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen _0819AF50: add sp, 0x4 pop {r4-r6} @@ -4373,7 +4373,7 @@ _0819C9C4: str r0, [sp] movs r0, 0 movs r3, 0x2 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen _0819C9F0: add sp, 0x4 pop {r4-r6} diff --git a/asm/party_menu.s b/asm/party_menu.s index 5c70e218e..92c4905a4 100644 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -6796,7 +6796,7 @@ sub_81B3828: @ 81B3828 ldr r0, =sub_81B3894 str r0, [sp] movs r0, 0x1 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen b _081B3880 .pool _081B3868: @@ -6810,7 +6810,7 @@ _081B3868: ldr r0, =sub_81B3894 str r0, [sp] movs r0, 0 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen _081B3880: add sp, 0x4 pop {r4} @@ -17663,7 +17663,7 @@ sub_81B968C: @ 81B968C ldr r0, =CB2_ReturnToField str r0, [sp] movs r0, 0x3 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen ldr r1, =gFieldCallback ldr r0, =sub_80AF168 str r0, [r1] diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index 2633db13f..8fb4f2dec 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -3685,7 +3685,7 @@ _080C9EB4: adds r1, r4, 0 adds r2, r7, 0 adds r3, r6, 0 - bl sub_81BFA80 + bl ShowPokemonSummaryScreenSet40EF b _080C9F56 .pool _080C9F04: @@ -3695,7 +3695,7 @@ _080C9F04: adds r1, r4, 0 adds r2, r7, 0 adds r3, r6, 0 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen b _080C9F56 .pool _080C9F1C: diff --git a/asm/trade.s b/asm/trade.s index 19dfd5ff9..958bb77ea 100644 --- a/asm/trade.s +++ b/asm/trade.s @@ -3499,7 +3499,7 @@ sub_807905C: @ 807905C ldr r0, =sub_8077B74 str r0, [sp] movs r0, 0x1 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen b _080790C0 .pool _080790A4: @@ -3515,7 +3515,7 @@ _080790A4: ldr r0, =sub_8077B74 str r0, [sp] movs r0, 0x1 - bl sub_81BF8EC + bl ShowPokemonSummaryScreen _080790C0: bl FreeAllWindowBuffers _080790C4: diff --git a/include/constants/region_map_sections.h b/include/constants/region_map_sections.h index b9c518b1b..8ff75dfa9 100644 --- a/include/constants/region_map_sections.h +++ b/include/constants/region_map_sections.h @@ -216,4 +216,8 @@ #define MAPSEC_TRAINER_HILL 0xD4 #define MAPSEC_NONE 0xD5 +#define MAPSEC_SPECIAL_EGG 0xFD +#define MAPSEC_IN_GAME_TRADE 0xFE +#define MAPSEC_FATEFUL_ENCOUNTER 0xFF + #endif //GUARD_REGIONMAPSEC_H diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index b29548258..51175a36a 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -4,4 +4,14 @@ void sub_81C4F98(u8, void(*)(void)); void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); +// The Pokemon Summary Screen can operate in different modes. Certain features, +// such as move re-ordering, are available in the different modes. +enum PokemonSummaryScreenMode +{ + PSS_MODE_NORMAL, + PSS_MODE_UNK1, + PSS_MODE_UNK2, + PSS_MODE_SELECT_MOVE, +}; + #endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 4d194f74a..347f38285 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -28,6 +28,7 @@ #include "pokeball.h" #include "pokemon.h" #include "pokemon_storage_system.h" +#include "pokemon_summary_screen.h" #include "region_map.h" #include "scanline_effect.h" #include "sound.h" @@ -40,6 +41,7 @@ #include "window.h" #include "constants/items.h" #include "constants/moves.h" +#include "constants/region_map_sections.h" #include "constants/songs.h" #include "constants/species.h" @@ -58,7 +60,7 @@ static EWRAM_DATA struct UnkSummaryStruct u16 species2; // 0x2 u8 isEgg; // 0x4 u8 level; // 0x5 - u8 ribbons; // 0x6 + u8 ribbonCount; // 0x6 u8 unk7; // 0x7 u8 altAbility; // 0x8 u8 metLocation; // 0x9 @@ -93,9 +95,9 @@ static EWRAM_DATA struct UnkSummaryStruct bool8 isBoxMon; u8 curMonIndex; u8 maxMonIndex; - u8 unk40C0; - u8 unk40C1; - u8 unk40C2; + u8 currPageIndex; + u8 minPageIndex; + u8 maxPageIndex; bool8 unk40C3; u16 newMove; u8 firstMoveIndex; @@ -131,10 +133,10 @@ struct UnkStruct_61CC04 bool8 sub_81B1250(void); bool8 sub_81BFB10(void); void sub_81BFAE4(void); -void sub_81BFE24(void); +static void InitBGs(void); u8 sub_81BFEB0(void); -void sub_81C0098(struct Pokemon* a); -bool8 sub_81C00F0(struct Pokemon* a); +void CopyMonToSummaryStruct(struct Pokemon* a); +bool8 ExtractMonDataToSummaryStruct(struct Pokemon* a); void sub_81C0348(void); void sub_81C0484(u8 taskId); void sub_81C0510(u8 taskId); @@ -156,7 +158,7 @@ void sub_81C1070(s16* a, s8 b, u8* c); void sub_81C11F4(u8 a); void sub_81C129C(u8 a); void sub_81C12E4(u8 taskId); -void sub_81C13B0(u8 a, u8 b); +void sub_81C13B0(u8 taskId, bool8 b); void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); void sub_81C171C(u8 taskId); @@ -181,7 +183,7 @@ void sub_81C25E8(void); void sub_81C2628(void); void sub_81C2794(void); void sub_81C27DC(struct Pokemon *mon, u16 a); -void sub_81C286C(void); +void PrintRentalMonStatsPage(void); void sub_81C2AFC(u8 a); void sub_81C2C38(u8 a); void sub_81C2D68(u8 a); @@ -189,38 +191,38 @@ void sub_81C2D9C(u8 a); void sub_81C2DE4(u8 a); void sub_81C2E00(void); void sub_81C2E40(u8 taskId); -void sub_81C2EC4(void); -void sub_81C2F5C(void); -void sub_81C2FD8(void); -void sub_81C302C(void); -void sub_81C307C(void); -void sub_81C3194(void); -void sub_81C31C0(void); -void sub_81C31F0(u8 *a); -u8 sub_81C3220(void); -bool8 sub_81C32BC(void); -bool8 sub_81C3304(void); -void sub_81C335C(void); -void sub_81C33CC(void); -void sub_81C3428(void); -void sub_81C349C(void); +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); void sub_81C3554(u8 taskId); -void sub_81C35E4(void); +void PrintHeldItemName(void); void sub_81C3530(void); -void sub_81C3690(void); -void sub_81C3710(void); -void sub_81C37D8(void); -void sub_81C3808(void); -void sub_81C3890(void); -void sub_81C38C0(void); +void PrintRibbonCount(void); +void BufferLeftColumnStats(void); +void PrintLeftColumnStats(void); +void BufferRightColumnStats(void); +void PrintRightColumnStats(void); +void PrintExpPointsNextLevel(void); void sub_81C3984(void); void sub_81C39F0(u8 taskId); -void sub_81C3B08(u8 a); +void PrintMoveNameAndPP(u8 a); void sub_81C3D08(void); void sub_81C3D54(u8 taskId); void sub_81C3E2C(u8 a); void sub_81C3E9C(u16 a); -void sub_81C3F44(void); +void PrintNewMoveDetailsOrCancelText(void); void sub_81C4064(void); void sub_81C40A0(u8 a, u8 b); void sub_81C4154(void); @@ -238,7 +240,7 @@ 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 sub_81C4898(void); +void DestoryUnusedTask(void); void sub_81C48F0(void); void sub_81C4984(struct Pokemon *mon); void sub_81C49E0(struct Pokemon *mon); @@ -710,7 +712,7 @@ static const struct SpriteTemplate gUnknown_0861D108 = static const u16 gUnknown_0861D120[] = INCBIN_U16("graphics/interface/summary_markings.gbapal"); // code -void sub_81BF8EC(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) +void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) { gUnknown_0203CF1C = AllocZeroed(sizeof(*gUnknown_0203CF1C)); gUnknown_0203CF1C->mode = mode; @@ -719,31 +721,31 @@ void sub_81BF8EC(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callba gUnknown_0203CF1C->maxMonIndex = maxMonIndex; gUnknown_0203CF1C->callback = callback; - if (mode == 2) + if (mode == PSS_MODE_UNK2) gUnknown_0203CF1C->isBoxMon = TRUE; else gUnknown_0203CF1C->isBoxMon = FALSE; switch (mode) { - case 0: - case 2: - gUnknown_0203CF1C->unk40C1 = 0; - gUnknown_0203CF1C->unk40C2 = 3; + case PSS_MODE_NORMAL: + case PSS_MODE_UNK2: + gUnknown_0203CF1C->minPageIndex = 0; + gUnknown_0203CF1C->maxPageIndex = 3; break; - case 1: - gUnknown_0203CF1C->unk40C1 = 0; - gUnknown_0203CF1C->unk40C2 = 3; + case PSS_MODE_UNK1: + gUnknown_0203CF1C->minPageIndex = 0; + gUnknown_0203CF1C->maxPageIndex = 3; gUnknown_0203CF1C->unk40C8 = TRUE; break; - case 3: - gUnknown_0203CF1C->unk40C1 = 2; - gUnknown_0203CF1C->unk40C2 = 3; + case PSS_MODE_SELECT_MOVE: + gUnknown_0203CF1C->minPageIndex = 2; + gUnknown_0203CF1C->maxPageIndex = 3; gUnknown_0203CF1C->unk40C3 = TRUE; break; } - gUnknown_0203CF1C->unk40C0 = gUnknown_0203CF1C->unk40C1; + gUnknown_0203CF1C->currPageIndex = gUnknown_0203CF1C->minPageIndex; sub_81C488C(-1); if (gMonSpritesGfxPtr == 0) @@ -754,13 +756,13 @@ void sub_81BF8EC(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callba void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove) { - sub_81BF8EC(3, mons, monIndex, maxMonIndex, callback); + ShowPokemonSummaryScreen(PSS_MODE_SELECT_MOVE, mons, monIndex, maxMonIndex, callback); gUnknown_0203CF1C->newMove = newMove; } -void sub_81BFA80(u8 a, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) +void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) { - sub_81BF8EC(a, mons, monIndex, maxMonIndex, callback); + ShowPokemonSummaryScreen(mode, mons, monIndex, maxMonIndex, callback); gUnknown_0203CF1C->unk40EF = TRUE; } @@ -813,7 +815,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 5: - sub_81BFE24(); + InitBGs(); gUnknown_0203CF1C->unk40F0 = 0; gMain.state++; break; @@ -830,12 +832,12 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 9: - sub_81C0098(&gUnknown_0203CF1C->currentMon); + CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon); gUnknown_0203CF1C->unk40F0 = 0; gMain.state++; break; case 10: - if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) != 0) + if (ExtractMonDataToSummaryStruct(&gUnknown_0203CF1C->currentMon) != 0) gMain.state++; break; case 11: @@ -843,11 +845,11 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 12: - sub_81C286C(); + PrintRentalMonStatsPage(); gMain.state++; break; case 13: - sub_81C2D9C(gUnknown_0203CF1C->unk40C0); + sub_81C2D9C(gUnknown_0203CF1C->currPageIndex); gMain.state++; break; case 14: @@ -855,7 +857,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 15: - sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + sub_81C2AFC(gUnknown_0203CF1C->currPageIndex); gMain.state++; break; case 16: @@ -889,7 +891,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 22: - if (gUnknown_0203CF1C->mode != 3) + if (gUnknown_0203CF1C->mode != PSS_MODE_SELECT_MOVE) CreateTask(sub_81C0510, 0); else CreateTask(sub_81C171C, 0); @@ -912,7 +914,7 @@ bool8 sub_81BFB10(void) return FALSE; } -void sub_81BFE24(void) +static void InitBGs(void) { ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_0861CBB4, ARRAY_COUNT(gUnknown_0861CBB4)); @@ -996,7 +998,7 @@ bool8 sub_81BFEB0(void) return FALSE; } -void sub_81C0098(struct Pokemon *mon) +void CopyMonToSummaryStruct(struct Pokemon *mon) { if (!gUnknown_0203CF1C->isBoxMon) { @@ -1010,7 +1012,7 @@ void sub_81C0098(struct Pokemon *mon) } } -bool8 sub_81C00F0(struct Pokemon *a) +bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) { u32 i; struct PokeSummary *sum = &gUnknown_0203CF1C->summary; @@ -1025,10 +1027,12 @@ bool8 sub_81C00F0(struct Pokemon *a) 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 != 0) - sum->isEgg = 1; + + if (sum->sanity) + sum->isEgg = TRUE; else sum->isEgg = GetMonData(a, MON_DATA_IS_EGG); + break; case 1: for (i = 0; i < 4; i++) @@ -1039,7 +1043,7 @@ bool8 sub_81C00F0(struct Pokemon *a) sum->ppBonuses = GetMonData(a, MON_DATA_PP_BONUSES); break; case 2: - if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == 2 || gUnknown_0203CF1C->unk40EF == TRUE) + if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE) { sum->nature = GetNature(a); sum->currentHP = GetMonData(a, MON_DATA_HP); @@ -1074,7 +1078,7 @@ bool8 sub_81C00F0(struct Pokemon *a) sum->friendship = GetMonData(a, MON_DATA_FRIENDSHIP); break; default: - sum->ribbons = GetMonData(a, MON_DATA_RIBBON_COUNT); + sum->ribbonCount = GetMonData(a, MON_DATA_RIBBON_COUNT); return TRUE; } gUnknown_0203CF1C->unk40F0++; @@ -1083,7 +1087,7 @@ bool8 sub_81C00F0(struct Pokemon *a) void sub_81C0348(void) { - if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) + if (gUnknown_0203CF1C->currPageIndex != 2 && gUnknown_0203CF1C->currPageIndex != 3) { sub_81C1DA4(0, 255); sub_81C1EFC(0, 255, 0); @@ -1105,7 +1109,7 @@ void sub_81C0348(void) } else { - if (gUnknown_0203CF1C->unk40C0 != 2 && gUnknown_0203CF1C->unk40C0 != 3) + if (gUnknown_0203CF1C->currPageIndex != 2 && gUnknown_0203CF1C->currPageIndex != 3) PutWindowTilemap(13); } sub_81C2524(); @@ -1130,7 +1134,7 @@ void sub_81C0484(u8 taskId) { SetMainCallback2(gUnknown_0203CF1C->callback); gUnknown_0203CF20 = gUnknown_0203CF1C->curMonIndex; - sub_81C4898(); + DestoryUnusedTask(); ResetSpriteData(); FreeAllSpritePalettes(); StopCryAndClearCrySongs(); @@ -1164,9 +1168,9 @@ void sub_81C0510(u8 taskId) } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->unk40C0 != 1) + if (gUnknown_0203CF1C->currPageIndex != 1) { - if (gUnknown_0203CF1C->unk40C0 == 0) + if (gUnknown_0203CF1C->currPageIndex == 0) { sub_81C48F0(); PlaySE(SE_SELECT); @@ -1196,7 +1200,7 @@ void sub_81C0604(u8 taskId, s8 a) { if (gUnknown_0203CF1C->isBoxMon == TRUE) { - if (gUnknown_0203CF1C->unk40C0 != 0) + if (gUnknown_0203CF1C->currPageIndex != 0) { if (a == 1) a = 0; @@ -1227,7 +1231,7 @@ void sub_81C0604(u8 taskId, s8 a) if (gUnknown_0203CF1C->summary.unk7 != 0) { sub_81C4204(2, 1); - ClearWindowTilemap(0xD); + ClearWindowTilemap(13); schedule_bg_copy_tilemap_to_vram(0); sub_81C2074(0, 2); } @@ -1248,18 +1252,18 @@ void sub_81C0704(u8 taskId) StopCryAndClearCrySongs(); break; case 1: - sub_81C4898(); + DestoryUnusedTask(); DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[0]]); break; case 2: DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[1]]); break; case 3: - sub_81C0098(&gUnknown_0203CF1C->currentMon); + CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon); gUnknown_0203CF1C->unk40F0 = 0; break; case 4: - if (sub_81C00F0(&gUnknown_0203CF1C->currentMon) == FALSE) + if (ExtractMonDataToSummaryStruct(&gUnknown_0203CF1C->currentMon) == FALSE) return; break; case 5: @@ -1289,7 +1293,7 @@ void sub_81C0704(u8 taskId) sub_81C25E8(); break; case 11: - sub_81C2D9C(gUnknown_0203CF1C->unk40C0); + sub_81C2D9C(gUnknown_0203CF1C->currPageIndex); sub_81C2524(); break; case 12: @@ -1310,7 +1314,7 @@ s8 sub_81C08F8(s8 a) { struct Pokemon *mon = gUnknown_0203CF1C->monList.mons; - if (gUnknown_0203CF1C->unk40C0 == 0) + if (gUnknown_0203CF1C->currPageIndex == 0) { if (a == -1 && gUnknown_0203CF1C->curMonIndex == 0) return -1; @@ -1378,20 +1382,20 @@ void sub_81C0A8C(u8 taskId, s8 b) if (summary->isEgg) return; - else if (b == -1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C1) + else if (b == -1 && gUnknown_0203CF1C->currPageIndex == gUnknown_0203CF1C->minPageIndex) return; - else if (b == 1 && gUnknown_0203CF1C->unk40C0 == gUnknown_0203CF1C->unk40C2) + else if (b == 1 && gUnknown_0203CF1C->currPageIndex == gUnknown_0203CF1C->maxPageIndex) return; PlaySE(SE_SELECT); - sub_81C2C38(gUnknown_0203CF1C->unk40C0); - gUnknown_0203CF1C->unk40C0 += b; + sub_81C2C38(gUnknown_0203CF1C->currPageIndex); + gUnknown_0203CF1C->currPageIndex += b; 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->unk40C0); + sub_81C2DE4(gUnknown_0203CF1C->currPageIndex); sub_81C424C(); } @@ -1415,7 +1419,7 @@ void sub_81C0B8C(u8 taskId) schedule_bg_copy_tilemap_to_vram(2); } ChangeBgX(data[1], 0, 0); - SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xBC)); + SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->currPageIndex << 12) + 0xBC)); ShowBg(1); ShowBg(2); } @@ -1432,7 +1436,7 @@ void sub_81C0C68(u8 taskId) data[1] = 0; data[0] = 0; sub_81C1BA0(); - sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + sub_81C2AFC(gUnknown_0203CF1C->currPageIndex); sub_81C4280(); sub_81C0E24(); SwitchTaskToFollowupFunc(taskId); @@ -1470,9 +1474,9 @@ void sub_81C0D44(u8 taskId) SetBgAttribute(1, 7, 2); schedule_bg_copy_tilemap_to_vram(1); } - if (gUnknown_0203CF1C->unk40C0 > 1) + if (gUnknown_0203CF1C->currPageIndex > 1) { - SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->unk40C0 << 12) + 0xFFFFF0BC)); + SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->currPageIndex << 12) + 0xFFFFF0BC)); ChangeBgX(data[1], 0x10000, 0); } ShowBg(1); @@ -1481,7 +1485,7 @@ void sub_81C0D44(u8 taskId) data[1] = 0; data[0] = 0; sub_81C1BA0(); - sub_81C2AFC(gUnknown_0203CF1C->unk40C0); + sub_81C2AFC(gUnknown_0203CF1C->currPageIndex); sub_81C4280(); sub_81C0E24(); SwitchTaskToFollowupFunc(taskId); @@ -1489,7 +1493,7 @@ void sub_81C0D44(u8 taskId) void sub_81C0E24(void) { - if (gUnknown_0203CF1C->unk40C0 == 1) + if (gUnknown_0203CF1C->currPageIndex == 1) sub_81C22CC(&gUnknown_0203CF1C->currentMon); } @@ -1511,7 +1515,7 @@ void sub_81C0E48(u8 taskId) sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 0); sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 0); sub_81C3E9C(move); - sub_81C3F44(); + PrintNewMoveDetailsOrCancelText(); sub_81C44F0(); schedule_bg_copy_tilemap_to_vram(0); schedule_bg_copy_tilemap_to_vram(1); @@ -1658,9 +1662,9 @@ void sub_81C129C(u8 taskId) void sub_81C12E4(u8 taskId) { - u8 a = taskId; s16* data = gTasks[taskId].data; - if (sub_81221EC() != 1) + + if (sub_81221EC() != TRUE) { if (gMain.newKeys & DPAD_UP) { @@ -1679,20 +1683,26 @@ void sub_81C12E4(u8 taskId) sub_81C13B0(taskId, 0); } else + { sub_81C13B0(taskId, 1); + } } else if (gMain.newKeys & B_BUTTON) - sub_81C13B0(a, 0); + { + sub_81C13B0(taskId, 0); + } } } -void sub_81C13B0(u8 taskId, u8 b) +void sub_81C13B0(u8 taskId, bool8 b) { u16 move; + PlaySE(SE_SELECT); sub_81C4C84(0); sub_81C4C60(18); - if (b == 1) + + if (b == TRUE) { if (!gUnknown_0203CF1C->isBoxMon) { @@ -1704,11 +1714,12 @@ void sub_81C13B0(u8 taskId, u8 b) struct BoxPokemon *why = gUnknown_0203CF1C->monList.boxMons; sub_81C15EC(&why[gUnknown_0203CF1C->curMonIndex], gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); } - sub_81C0098(&gUnknown_0203CF1C->currentMon); + CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon); sub_81C40A0(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); sub_81C4568(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); gUnknown_0203CF1C->firstMoveIndex = gUnknown_0203CF1C->secondMoveIndex; } + move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; sub_81C3E9C(move); sub_81C240C(move); @@ -2245,7 +2256,7 @@ void sub_81C1940(u8 taskId) } else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) { - if (gUnknown_0203CF1C->unk40C0 != 2) + if (gUnknown_0203CF1C->currPageIndex != 2) { ClearWindowTilemap(19); if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) @@ -2259,7 +2270,7 @@ void sub_81C1940(u8 taskId) } else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2) { - if (gUnknown_0203CF1C->unk40C0 != 3) + if (gUnknown_0203CF1C->currPageIndex != 3) { ClearWindowTilemap(19); if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) @@ -2298,30 +2309,30 @@ void sub_81C1BA0(void) for (i = 0; i < 4; i++) { u8 j = i << 1; - if (i < gUnknown_0203CF1C->unk40C1) + if (i < gUnknown_0203CF1C->minPageIndex) { alloced[j+0] = 0x40; alloced[j+1] = 0x40; alloced[j+8] = 0x50; alloced[j+9] = 0x50; } - else if (i > gUnknown_0203CF1C->unk40C2) + else if (i > gUnknown_0203CF1C->maxPageIndex) { alloced[j+0] = 0x4A; alloced[j+1] = 0x4A; alloced[j+8] = 0x5A; alloced[j+9] = 0x5A; } - else if (i < gUnknown_0203CF1C->unk40C0) + else if (i < gUnknown_0203CF1C->currPageIndex) { alloced[j+0] = 0x46; alloced[j+1] = 0x47; alloced[j+8] = 0x56; alloced[j+9] = 0x57; } - else if (i == gUnknown_0203CF1C->unk40C0) + else if (i == gUnknown_0203CF1C->currPageIndex) { - if (i != gUnknown_0203CF1C->unk40C2) + if (i != gUnknown_0203CF1C->maxPageIndex) { alloced[j+0] = 0x41; alloced[j+1] = 0x42; @@ -2336,7 +2347,7 @@ void sub_81C1BA0(void) alloced[j+9] = 0x5C; } } - else if (i != gUnknown_0203CF1C->unk40C2) + else if (i != gUnknown_0203CF1C->maxPageIndex) { alloced[j+0] = 0x43; alloced[j+1] = 0x44; @@ -2422,7 +2433,7 @@ void sub_81C1E20(u8 taskId) { if (data[0] < 0) { - if (gUnknown_0203CF1C->unk40C0 == 2) + if (gUnknown_0203CF1C->currPageIndex == 2) PutWindowTilemap(14); } else @@ -2472,7 +2483,7 @@ void sub_81C1F80(u8 taskId) { if (data[0] < 0) { - if (gUnknown_0203CF1C->unk40C0 == 3 && FuncIsActiveTask(sub_81C0B8C) == 0) + if (gUnknown_0203CF1C->currPageIndex == 3 && FuncIsActiveTask(sub_81C0B8C) == 0) PutWindowTilemap(15); sub_81C240C(data[2]); } @@ -2573,9 +2584,9 @@ void sub_81C2228(struct Pokemon *mon) schedule_bg_copy_tilemap_to_vram(3); } -void sub_81C228C(u8 a) +void sub_81C228C(bool8 isMonShiny) { - if (a == 0) + if (!isMonShiny) sub_8199C30(3, 1, 4, 8, 8, 0); else sub_8199C30(3, 1, 4, 8, 8, 5); @@ -2623,41 +2634,51 @@ void sub_81C22CC(struct Pokemon *unused) void sub_81C240C(u16 move) { - u16* r5 = &gUnknown_0203CF1C->bgTilemapBuffer4[0x400]; + u16* tilemap = &gUnknown_0203CF1C->bgTilemapBuffer4[0x400]; u8 i; - u8 r4; + u8 effectValue; + if (move != MOVE_NONE) { - r4 = gContestEffects[gContestMoves[move].effect].appeal; - if (r4 != 0xFF) - r4 /= 10; - for (i = 0;i < 8; i++) + effectValue = gContestEffects[gContestMoves[move].effect].appeal; + + if (effectValue != 0xFF) + effectValue /= 10; + + for (i = 0; i < 8; i++) { - if (r4 != 0xFF && i < r4) + if (effectValue != 0xFF && i < effectValue) { - r5[((i>>2)*32)+(i&3)+0x1E6] = 0x103A; + tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = 0x103A; } else - r5[((i>>2)*32)+(i&3)+0x1E6] = 0x1039; + { + tilemap[(i / 4 * 32) + (i & 3) + 0x1E6] = 0x1039; + } } - r4 = gContestEffects[gContestMoves[move].effect].jam; - if (r4 != 0xFF) - r4 /= 10; - for (i = 0;i < 8; i++) + + effectValue = gContestEffects[gContestMoves[move].effect].jam; + + if (effectValue != 0xFF) + effectValue /= 10; + + for (i = 0; i < 8; i++) { - if (r4 != 0xFF && i < r4) + if (effectValue != 0xFF && i < effectValue) { - r5[((i>>2)*32)+(i&3)+0x226] = 0x103C; + tilemap[(i / 4 * 32) + (i & 3) + 0x226] = 0x103C; } else - r5[((i>>2)*32)+(i&3)+0x226] = 0x103D; + { + tilemap[(i / 4 * 32) + (i & 3) + 0x226] = 0x103D; + } } } } void sub_81C2524(void) { - if (gUnknown_0203CF1C->summary.isEgg != 0) + if (gUnknown_0203CF1C->summary.isEgg) ChangeBgX(3, 0x10000, 0); else ChangeBgX(3, 0, 0); @@ -2668,15 +2689,20 @@ void sub_81C2554(void) u8 i; InitWindows(gUnknown_0861CC24); DeactivateAllTextPrinters(); + for (i = 0; i < 20; i++) + { FillWindowPixelBuffer(i, 0); + } for (i = 0; i < 8; i++) - gUnknown_0203CF1C->windowIds[i] |= 0xFF; + { + gUnknown_0203CF1C->windowIds[i] = 0xFF; + } } -void sub_81C25A4(u8 a, const u8 *b, u8 c, u8 d, u8 e, u8 f) +static void SummaryScreen_PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, u8 y, u8 lineSpacing, u8 colorId) { - AddTextPrinterParameterized2(a, 1, c, d, 0, e, sTextColors_861CD2C[f], 0, b); + AddTextPrinterParameterized2(windowId, 1, x, y, 0, lineSpacing, sTextColors_861CD2C[colorId], 0, string); } void sub_81C25E8(void) @@ -2684,7 +2710,7 @@ void sub_81C25E8(void) FillWindowPixelBuffer(17, 0); FillWindowPixelBuffer(18, 0); FillWindowPixelBuffer(19, 0); - if (gUnknown_0203CF1C->summary.isEgg == 0) + if (!gUnknown_0203CF1C->summary.isEgg) sub_81C2628(); else sub_81C2794(); @@ -2696,41 +2722,41 @@ void sub_81C2628(void) u8 strArray[16]; struct Pokemon *mon = &gUnknown_0203CF1C->currentMon; struct PokeSummary *summary = &gUnknown_0203CF1C->summary; - u16 r5 = SpeciesToPokedexNum(summary->species); - if (r5 != 0xFFFF) + u16 dexNum = SpeciesToPokedexNum(summary->species); + if (dexNum != 0xFFFF) { StringCopy(gStringVar1, &gText_UnkCtrlF908Clear01[0]); - ConvertIntToDecimalStringN(gStringVar2, r5, 2, 3); + ConvertIntToDecimalStringN(gStringVar2, dexNum, 2, 3); StringAppend(gStringVar1, gStringVar2); - if (IsMonShiny(mon) == 0) + if (!IsMonShiny(mon)) { - sub_81C25A4(17, gStringVar1, 0, 1, 0, 1); - sub_81C228C(0); + SummaryScreen_PrintTextOnWindow(17, gStringVar1, 0, 1, 0, 1); + sub_81C228C(FALSE); } else { - sub_81C25A4(17, gStringVar1, 0, 1, 0, 7); - sub_81C228C(1); + SummaryScreen_PrintTextOnWindow(17, gStringVar1, 0, 1, 0, 7); + sub_81C228C(TRUE); } PutWindowTilemap(17); } else { ClearWindowTilemap(17); - if (IsMonShiny(mon) == 0) - sub_81C228C(0); + if (!IsMonShiny(mon)) + sub_81C228C(FALSE); else - sub_81C228C(1); + sub_81C228C(TRUE); } StringCopy(gStringVar1, &gText_LevelSymbol[0]); ConvertIntToDecimalStringN(gStringVar2, summary->level, 0, 3); StringAppend(gStringVar1, gStringVar2); - sub_81C25A4(19, gStringVar1, 0x18, 17, 0, 1); + SummaryScreen_PrintTextOnWindow(19, gStringVar1, 0x18, 17, 0, 1); GetMonNickname(mon, gStringVar1); - sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); + SummaryScreen_PrintTextOnWindow(18, gStringVar1, 0, 1, 0, 1); strArray[0] = CHAR_SLASH; StringCopy(&strArray[1], &gSpeciesNames[summary->species2][0]); - sub_81C25A4(19, &strArray[0], 0, 1, 0, 1); + SummaryScreen_PrintTextOnWindow(19, &strArray[0], 0, 1, 0, 1); sub_81C27DC(mon, summary->species2); PutWindowTilemap(18); PutWindowTilemap(19); @@ -2739,7 +2765,7 @@ void sub_81C2628(void) void sub_81C2794(void) { GetMonNickname(&gUnknown_0203CF1C->currentMon, gStringVar1); - sub_81C25A4(18, gStringVar1, 0, 1, 0, 1); + SummaryScreen_PrintTextOnWindow(18, gStringVar1, 0, 1, 0, 1); PutWindowTilemap(18); ClearWindowTilemap(17); ClearWindowTilemap(19); @@ -2753,74 +2779,73 @@ void sub_81C27DC(struct Pokemon *mon, u16 a) switch (gender) { case 0: - sub_81C25A4(0x13, &gText_MaleSymbol[0], 0x39, 17, 0, 3); + SummaryScreen_PrintTextOnWindow(19, &gText_MaleSymbol[0], 57, 17, 0, 3); break; case 0xFE: - sub_81C25A4(0x13, &gText_FemaleSymbol[0], 0x39, 17, 0, 4); + SummaryScreen_PrintTextOnWindow(19, &gText_FemaleSymbol[0], 57, 17, 0, 4); break; } } } -void sub_81C2838(u8 a, bool8 b, u32 c) +void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x) { - BlitBitmapToWindow(a, (b) ? &gUnknown_0861CDD3[0] : &gUnknown_0861CDD3[0] - 0x80, c, 0, 16, 16); + BlitBitmapToWindow(windowId, (bButton) ? gUnknown_0861CDD3 : gUnknown_0861CDD3 - 0x80, x, 0, 16, 16); } -void sub_81C286C(void) +void PrintRentalMonStatsPage(void) { - int r4; - int r2; - int temp; - sub_81C25A4(0, gText_PkmnInfo, 2, 1, 0, 1); - sub_81C25A4(1, gText_PkmnSkills, 2, 1, 0, 1); - sub_81C25A4(2, gText_BattleMoves, 2, 1, 0, 1); - sub_81C25A4(3, gText_ContestMoves, 2, 1, 0, 1); - r4 = GetStringRightAlignXOffset(1, gText_Cancel2, 0x3E); - r2 = r4 - 16; - if (r2 < 0) - r2 = 0; - sub_81C2838(4, 0, r2); - sub_81C25A4(4, gText_Cancel2, r4, 1, 0, 0); - r4 = GetStringRightAlignXOffset(1, gText_Info, 0x3E); - r2 = r4 - 16; - if (r2 < 0) - r2 = 0; - sub_81C2838(5, 0, r2); - sub_81C25A4(5, gText_Info, r4, 1, 0, 0); - r4 = GetStringRightAlignXOffset(1, gText_Switch, 0x3E); - r2 = r4 - 16; - if (r2 < 0) - r2 = 0; - sub_81C2838(6, 0, r2); - sub_81C25A4(6, gText_Switch, r4, 1, 0, 0); - sub_81C25A4(8, gText_RentalPkmn, 0, 1, 0, 1); - sub_81C25A4(9, gText_TypeSlash, 0, 1, 0, 0); - temp = 6; - temp += GetStringCenterAlignXOffset(1, gText_HP4, 42); - sub_81C25A4(10, gText_HP4, temp, 1, 0, 1); - temp = 6; - temp += GetStringCenterAlignXOffset(1, gText_Attack3, 42); - sub_81C25A4(10, gText_Attack3, temp, 17, 0, 1); - temp = 6; - temp += GetStringCenterAlignXOffset(1, gText_Defense3, 42); - sub_81C25A4(10, gText_Defense3, temp, 33, 0, 1); - temp = 2; - temp += GetStringCenterAlignXOffset(1, gText_SpAtk4, 36); - sub_81C25A4(11, gText_SpAtk4, temp, 1, 0, 1); - temp = 2; - temp += GetStringCenterAlignXOffset(1, gText_SpDef4, 36); - sub_81C25A4(11, gText_SpDef4, temp, 17, 0, 1); - temp = 2; - temp += GetStringCenterAlignXOffset(1, gText_Speed2, 36); - sub_81C25A4(11, gText_Speed2, temp, 33, 0, 1); - sub_81C25A4(12, gText_ExpPoints, 6, 1, 0, 1); - sub_81C25A4(12, gText_NextLv, 6, 17, 0, 1); - sub_81C25A4(13, gText_Status, 2, 1, 0, 1); - sub_81C25A4(14, gText_Power, 0, 1, 0, 1); - sub_81C25A4(14, gText_Accuracy2, 0, 17, 0, 1); - sub_81C25A4(15, gText_Appeal, 0, 1, 0, 1); - sub_81C25A4(15, gText_Jam, 0, 17, 0, 1); + 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); } void sub_81C2AFC(u8 a) @@ -2847,23 +2872,27 @@ void sub_81C2AFC(u8 a) break; case 2: PutWindowTilemap(2); - if (gUnknown_0203CF1C->mode == 3) + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(14); } else + { PutWindowTilemap(5); + } break; case 3: PutWindowTilemap(3); - if (gUnknown_0203CF1C->mode == 3) + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(15); } else + { PutWindowTilemap(5); + } break; } for (i = 0; i < 8; i++) @@ -2890,22 +2919,26 @@ void sub_81C2C38(u8 a) ClearWindowTilemap(12); break; case 2: - if (gUnknown_0203CF1C->mode == 3) + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) ClearWindowTilemap(14); } else + { ClearWindowTilemap(5); + } break; case 3: - if (gUnknown_0203CF1C->mode == 3) + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - if(!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) ClearWindowTilemap(15); } else + { ClearWindowTilemap(5); + } break; } for (i = 0; i < 8; i++) @@ -2913,12 +2946,12 @@ void sub_81C2C38(u8 a) schedule_bg_copy_tilemap_to_vram(0); } -u8 sub_81C2D2C(const struct WindowTemplate *template, u8 a) +u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) { - u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[a]); + u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[templateId]); if (*windowIdPtr == 0xFF) { - *windowIdPtr = AddWindow(&template[a]); + *windowIdPtr = AddWindow(&template[templateId]); FillWindowPixelBuffer(*windowIdPtr, 0); } return *windowIdPtr; @@ -2935,7 +2968,7 @@ void sub_81C2D68(u8 a) } } -void sub_81C2D9C(u8 a) +void sub_81C2D9C(u8 pageIndex) { u16 i; for (i = 0; i < 8; i++) @@ -2943,209 +2976,219 @@ void sub_81C2D9C(u8 a) if (gUnknown_0203CF1C->windowIds[i] != 0xFF) FillWindowPixelBuffer(gUnknown_0203CF1C->windowIds[i], 0); } - gUnknown_0861CE54[a](); + gUnknown_0861CE54[pageIndex](); } -void sub_81C2DE4(u8 a) +void sub_81C2DE4(u8 pageIndex) { - CreateTask(gUnknown_0861CE64[a], 16); + CreateTask(gUnknown_0861CE64[pageIndex], 16); } void sub_81C2E00(void) { if (gUnknown_0203CF1C->summary.isEgg) { - sub_81C335C(); - sub_81C33CC(); - sub_81C3428(); - sub_81C349C(); + PrintEggOTName(); + PrintEggOTID(); + PrintEggState(); + PrintEggMemo(); } else { - sub_81C2EC4(); - sub_81C2F5C(); - sub_81C2FD8(); - sub_81C302C(); - sub_81C307C(); - sub_81C3194(); + PrintMonOTName(); + PrintMonOTID(); + PrintMonAbilityName(); + PrintMonAbilityDescription(); + BufferMonTrainerMemo(); + PrintMonTrainerMemo(); } } void sub_81C2E40(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 dataa = data[0] - 1; - switch (dataa) + switch (data[0]) { - case 0: - sub_81C2EC4(); - break; case 1: - sub_81C2F5C(); + PrintMonOTName(); break; case 2: - sub_81C2FD8(); + PrintMonOTID(); break; case 3: - sub_81C302C(); + PrintMonAbilityName(); break; case 4: - sub_81C307C(); + PrintMonAbilityDescription(); break; case 5: - sub_81C3194(); + BufferMonTrainerMemo(); break; case 6: + PrintMonTrainerMemo(); + break; + case 7: DestroyTask(taskId); return; } data[0]++; } -void sub_81C2EC4(void) +void PrintMonOTName(void) { - u8 r5; - int r2; - if (sub_81A6BF4() != 1 && sub_81B9E94() != 1) + u8 windowId; + int x; + if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE) { - r5 = sub_81C2D2C(gUnknown_0861CCCC, 0); - sub_81C25A4(r5, gText_OTSlash, 0, 1, 0, 1); - r2 = GetStringWidth(1, gText_OTSlash, 0); + windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0); + SummaryScreen_PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1); + x = GetStringWidth(1, gText_OTSlash, 0); if (gUnknown_0203CF1C->summary.OTGender == 0) - sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 5); + SummaryScreen_PrintTextOnWindow(windowId, gUnknown_0203CF1C->summary.OTName, x, 1, 0, 5); else - sub_81C25A4(r5, gUnknown_0203CF1C->summary.OTName, r2, 1, 0, 6); + SummaryScreen_PrintTextOnWindow(windowId, gUnknown_0203CF1C->summary.OTName, x, 1, 0, 6); } } -void sub_81C2F5C(void) +void PrintMonOTID(void) { - int r4; + int xPos; if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE) { ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5); - r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); + xPos = GetStringRightAlignXOffset(1, gStringVar1, 56); + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, xPos, 1, 0, 1); } } -void sub_81C2FD8(void) +void PrintMonAbilityName(void) { u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); } -void sub_81C302C(void) +void PrintMonAbilityDescription(void) { u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); } -void sub_81C307C(void) +void BufferMonTrainerMemo(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; const u8 *text; + DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gUnknown_0861CE74); DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gUnknown_0861CE7B); - sub_81C31C0(); - if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE || sub_81C3304() == TRUE) + BufferNatureString(); + + if (sub_81A6BF4() == TRUE || sub_81B9E94() == TRUE || IsInGamePartnerMon() == TRUE) + { DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gText_XNature); + } else { - u8 *alloced1 = Alloc(32); - u8 *alloced2 = Alloc(32); - sub_81C31F0(alloced1); - if (sum->metLocation <= 0xD4) + u8 *metLevelString = Alloc(32); + u8 *metLocationString = Alloc(32); + GetMetLevelString(metLevelString); + + if (sum->metLocation < MAPSEC_NONE) { - sub_8124610(alloced2, sum->metLocation); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, alloced2); + sub_8124610(metLocationString, sum->metLocation); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(4, metLocationString); } - if (sub_81C3220() == 1) + + if (DoesMonOTMatchOwner() == TRUE) { if (sum->metLevel == 0) - text = (sum->metLocation > 0xD4) ? gText_XNatureHatchedSomewhereAt : gText_XNatureHatchedAtYZ; + text = (sum->metLocation >= MAPSEC_NONE) ? gText_XNatureHatchedSomewhereAt : gText_XNatureHatchedAtYZ; else - text = (sum->metLocation > 0xD4) ? gText_XNatureMetSomewhereAt : gText_XNatureMetAtYZ; + text = (sum->metLocation >= MAPSEC_NONE) ? gText_XNatureMetSomewhereAt : gText_XNatureMetAtYZ; } - else if (sum->metLocation == 0xFF) + else if (sum->metLocation == MAPSEC_FATEFUL_ENCOUNTER) + { text = gText_XNatureFatefulEncounter; - else if (sum->metLocation != 0xFE && sub_81C32BC()) - text = (sum->metLocation > 0xD4) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt; + } + else if (sum->metLocation != MAPSEC_IN_GAME_TRADE && MonCameFromGBAGames()) + { + text = (sum->metLocation >= MAPSEC_NONE) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt; + } else + { text = gText_XNatureObtainedInTrade; + } + DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, text); - Free(alloced1); - Free(alloced2); + Free(metLevelString); + Free(metLocationString); } } -void sub_81C3194(void) +void PrintMonTrainerMemo(void) { - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); } -void sub_81C31C0(void) +void BufferNatureString(void) { struct UnkSummaryStruct *sumStruct = gUnknown_0203CF1C; DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gNatureNamePointers[sumStruct->summary.nature]); DynamicPlaceholderTextUtil_SetPlaceholderPtr(5, gText_EmptyString5); } -void sub_81C31F0(u8 *a) +void GetMetLevelString(u8 *output) { u8 level = gUnknown_0203CF1C->summary.metLevel; if (level == 0) level = EGG_HATCH_LEVEL; - ConvertIntToDecimalStringN(a, level, 0, 3); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, a); + ConvertIntToDecimalStringN(output, level, 0, 3); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, output); } -u8 sub_81C3220(void) +bool8 DoesMonOTMatchOwner(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u32 r4; - u8 r5; + u32 trainerId; + u8 gender; if (gUnknown_0203CF1C->monList.mons == gEnemyParty) { u8 multiID = GetMultiplayerId() ^ 1; - r4 = (u16)gLinkPlayers[multiID].trainerId; - r5 = gLinkPlayers[multiID].gender; + trainerId = (u16)gLinkPlayers[multiID].trainerId; + gender = gLinkPlayers[multiID].gender; StringCopy(gStringVar1, gLinkPlayers[multiID].name); } else { - r4 = GetPlayerIDAsU32() & 0xFFFF; - r5 = gSaveBlock2Ptr->playerGender; + trainerId = GetPlayerIDAsU32() & 0xFFFF; + gender = gSaveBlock2Ptr->playerGender; StringCopy(gStringVar1, gSaveBlock2Ptr->playerName); } - if (r5 != sum->OTGender || r4 != (sum->OTID & 0xFFFF) || StringCompareWithoutExtCtrlCodes(gStringVar1, sum->OTName)) + if (gender != sum->OTGender || trainerId != (sum->OTID & 0xFFFF) || StringCompareWithoutExtCtrlCodes(gStringVar1, sum->OTName)) { - return 0; + return FALSE; } - return 1; + return TRUE; } -bool8 sub_81C32BC(void) +bool8 MonCameFromGBAGames(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 r0 = sum->metGame - 1; - if (r0 <= 4) + if (sum->metGame > 0 && sum->metGame <= VERSION_LEAF_GREEN) return TRUE; return FALSE; } -bool8 sub_81C32E0(void) +bool8 MonCameFromRSE(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 r0 = sum->metGame - 1; - if (r0 <= 2) + if (sum->metGame > 0 && sum->metGame <= VERSION_EMERALD) return TRUE; return FALSE; } -bool8 sub_81C3304(void) +bool8 IsInGamePartnerMon(void) { if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle) { @@ -3155,28 +3198,29 @@ bool8 sub_81C3304(void) return FALSE; } -void sub_81C335C(void) +void PrintEggOTName(void) { - u32 windowId = sub_81C2D2C(gUnknown_0861CCCC, 0); + u32 windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0); u32 width = GetStringWidth(1, gText_OTSlash, 0); - sub_81C25A4(windowId, gText_OTSlash, 0, 1, 0, 1); - sub_81C25A4(windowId, gText_FiveMarks, width, 1, 0, 1); + SummaryScreen_PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1); + SummaryScreen_PrintTextOnWindow(windowId, gText_FiveMarks, width, 1, 0, 1); } -void sub_81C33CC(void) +void PrintEggOTID(void) { - int r4; + int x; StringCopy(gStringVar1, gText_UnkCtrlF907F908); StringAppend(gStringVar1, gText_FiveMarks); - r4 = GetStringRightAlignXOffset(1, gStringVar1, 0x38); - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 1), gStringVar1, r4, 1, 0, 1); + x = GetStringRightAlignXOffset(1, gStringVar1, 56); + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, x, 1, 0, 1); } -void sub_81C3428(void) +void PrintEggState(void) { const u8 *text; struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - if (gUnknown_0203CF1C->summary.sanity == 1) + + if (gUnknown_0203CF1C->summary.sanity == TRUE) text = gText_EggWillTakeALongTime; else if (sum->friendship <= 5) text = gText_EggAboutToHatch; @@ -3186,141 +3230,158 @@ void sub_81C3428(void) text = gText_EggWillTakeSomeTime; else text = gText_EggWillTakeALongTime; - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); + + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); } -void sub_81C349C(void) +void PrintEggMemo(void) { const u8 *text; struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + if (gUnknown_0203CF1C->summary.sanity != 1) { - if (sum->metLocation == 0xFF) + if (sum->metLocation == MAPSEC_FATEFUL_ENCOUNTER) text = gText_PeculiarEggNicePlace; - else if (sub_81C32BC() == 0 || sub_81C3220() == 0) + else if (MonCameFromGBAGames() == FALSE || DoesMonOTMatchOwner() == FALSE) text = gText_PeculiarEggTrade; - else if (sum->metLocation == 0xFD) - text = (sub_81C32E0() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler; + else if (sum->metLocation == MAPSEC_SPECIAL_EGG) + text = (MonCameFromRSE() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler; else text = gText_OddEggFoundByCouple; } else + { text = gText_OddEggFoundByCouple; - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); + } + + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); } void sub_81C3530(void) { - sub_81C35E4(); - sub_81C3690(); - sub_81C3710(); - sub_81C37D8(); - sub_81C3808(); - sub_81C3890(); - sub_81C38C0(); + PrintHeldItemName(); + PrintRibbonCount(); + BufferLeftColumnStats(); + PrintLeftColumnStats(); + BufferRightColumnStats(); + PrintRightColumnStats(); + PrintExpPointsNextLevel(); } void sub_81C3554(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 dataa = data[0] - 1; - switch (dataa) + + switch (data[0]) { - case 0: - sub_81C35E4(); - break; case 1: - sub_81C3690(); + PrintHeldItemName(); break; case 2: - sub_81C3710(); + PrintRibbonCount(); break; case 3: - sub_81C37D8(); + BufferLeftColumnStats(); break; case 4: - sub_81C3808(); + PrintLeftColumnStats(); break; case 5: - sub_81C3890(); + BufferRightColumnStats(); break; case 6: - sub_81C38C0(); + PrintRightColumnStats(); break; case 7: + PrintExpPointsNextLevel(); + break; + case 8: DestroyTask(taskId); return; } data[0]++; } -void sub_81C35E4(void) +void PrintHeldItemName(void) { const u8 *text; int offset; - if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == 1 && (gUnknown_0203CF1C->curMonIndex == 1 || gUnknown_0203CF1C->curMonIndex == 4 || gUnknown_0203CF1C->curMonIndex == 5)) + + if (gUnknown_0203CF1C->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == TRUE && (gUnknown_0203CF1C->curMonIndex == 1 || gUnknown_0203CF1C->curMonIndex == 4 || gUnknown_0203CF1C->curMonIndex == 5)) { text = ItemId_GetName(ITEM_ENIGMA_BERRY); } else if (gUnknown_0203CF1C->summary.item == ITEM_NONE) + { text = gText_None; + } else { CopyItemName(gUnknown_0203CF1C->summary.item, gStringVar1); text = gStringVar1; } - offset = GetStringCenterAlignXOffset(1, text, 0x48) + 6; - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); + + offset = GetStringCenterAlignXOffset(1, text, 72) + 6; + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); } -void sub_81C3690(void) +void PrintRibbonCount(void) { const u8 *text; int offset; - if (gUnknown_0203CF1C->summary.ribbons == 0) + + if (gUnknown_0203CF1C->summary.ribbonCount == 0) + { text = gText_None; + } else { - ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.ribbons, 1, 2); + ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.ribbonCount, 1, 2); StringExpandPlaceholders(gStringVar4, gText_RibbonsVar1); text = gStringVar4; } - offset = GetStringCenterAlignXOffset(1, text, 0x46) + 6; - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); + + offset = GetStringCenterAlignXOffset(1, text, 70) + 6; + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); } -void sub_81C3710(void) +void BufferLeftColumnStats(void) { - u8 *alloced1 = Alloc(8); - u8 *alloced2 = Alloc(8); - u8 *alloced3 = Alloc(8); - u8 *alloced4 = Alloc(8); - ConvertIntToDecimalStringN(alloced1, gUnknown_0203CF1C->summary.currentHP, 1, 3); - ConvertIntToDecimalStringN(alloced2, gUnknown_0203CF1C->summary.maxHP, 1, 3); - ConvertIntToDecimalStringN(alloced3, gUnknown_0203CF1C->summary.atk, 1, 7); - ConvertIntToDecimalStringN(alloced4, gUnknown_0203CF1C->summary.def, 1, 7); + 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, alloced1); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, alloced2); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, alloced3); - DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, alloced4); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, currentHPString); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, maxHPString); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, attackString); + DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, defenseString); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE82); - Free(alloced1); - Free(alloced2); - Free(alloced3); - Free(alloced4); + + Free(currentHPString); + Free(maxHPString); + Free(attackString); + Free(defenseString); } -void sub_81C37D8(void) +void PrintLeftColumnStats(void) { - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); } -void sub_81C3808(void) +void BufferRightColumnStats(void) { 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); @@ -3328,73 +3389,78 @@ void sub_81C3808(void) DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE8E); } -void sub_81C3890(void) +void PrintRightColumnStats(void) { - sub_81C25A4(sub_81C2D2C(gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); + SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); } -void sub_81C38C0(void) +void PrintExpPointsNextLevel(void) { struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - u8 r6 = sub_81C2D2C(gUnknown_0861CCEC, 4); + u8 windowId = AddWindowFromTemplateList(gUnknown_0861CCEC, 4); int offset; u32 expToNextLevel; + ConvertIntToDecimalStringN(gStringVar1, sum->exp, 1, 7); - offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; - sub_81C25A4(r6, gStringVar1, offset, 1, 0, 0); + offset = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2; + SummaryScreen_PrintTextOnWindow(windowId, gStringVar1, offset, 1, 0, 0); + if (sum->level < MAX_MON_LEVEL) expToNextLevel = gExperienceTables[gBaseStats[sum->species].growthRate][sum->level + 1] - sum->exp; else expToNextLevel = 0; + ConvertIntToDecimalStringN(gStringVar1, expToNextLevel, 1, 6); - offset = GetStringRightAlignXOffset(1, gStringVar1, 0x2A) + 2; - sub_81C25A4(r6, gStringVar1, offset, 17, 0, 0); + offset = GetStringRightAlignXOffset(1, gStringVar1, 42) + 2; + SummaryScreen_PrintTextOnWindow(windowId, gStringVar1, offset, 17, 0, 0); } void sub_81C3984(void) { - sub_81C3B08(0); - sub_81C3B08(1); - sub_81C3B08(2); - sub_81C3B08(3); - if (gUnknown_0203CF1C->mode == 3) + PrintMoveNameAndPP(0); + PrintMoveNameAndPP(1); + PrintMoveNameAndPP(2); + PrintMoveNameAndPP(3); + + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - sub_81C3F44(); + PrintNewMoveDetailsOrCancelText(); if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES) { if (gUnknown_0203CF1C->newMove != MOVE_NONE) sub_81C3E9C(gUnknown_0203CF1C->newMove); } else + { sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]); + } } } void sub_81C39F0(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 dataa = data[0] - 1; - switch (dataa) + switch (data[0]) { - case 0: - sub_81C3B08(0); - break; case 1: - sub_81C3B08(1); + PrintMoveNameAndPP(0); break; case 2: - sub_81C3B08(2); + PrintMoveNameAndPP(1); break; case 3: - sub_81C3B08(3); + PrintMoveNameAndPP(2); break; case 4: - if (gUnknown_0203CF1C->mode == 3) - sub_81C3F44(); + PrintMoveNameAndPP(3); break; case 5: - if (gUnknown_0203CF1C->mode == 3) + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + PrintNewMoveDetailsOrCancelText(); + break; + case 6: + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES) data[1] = gUnknown_0203CF1C->newMove; @@ -3402,89 +3468,99 @@ void sub_81C39F0(u8 taskId) data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; } break; - case 6: - if (gUnknown_0203CF1C->mode == 3) + case 7: + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - if (!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) sub_81C3E9C(data[1]); } break; - case 7: + case 8: DestroyTask(taskId); return; } data[0]++; } -void sub_81C3B08(u8 a) +void PrintMoveNameAndPP(u8 moveIndex) { u8 pp; u32 ppState; const u8 *text; u32 offset; struct UnkSummaryStruct *summaryStruct = gUnknown_0203CF1C; - u8 r8 = sub_81C2D2C(gUnknown_0861CD14, 0); - u8 sp = sub_81C2D2C(gUnknown_0861CD14, 1); - u16 move = summaryStruct->summary.moves[a]; + u8 moveNameWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 0); + u8 ppValueWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 1); + u16 move = summaryStruct->summary.moves[moveIndex]; if (move != 0) { - pp = CalculatePPWithBonus(move, summaryStruct->summary.ppBonuses, a); - sub_81C25A4(r8, gMoveNames[move], 0, a * 16 + 1, 0, 1); - ConvertIntToDecimalStringN(gStringVar1, summaryStruct->summary.pp[a], 1, 2); + 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); ConvertIntToDecimalStringN(gStringVar2, pp, 1, 2); DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); DynamicPlaceholderTextUtil_SetPlaceholderPtr(1, gStringVar2); DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE97); text = gStringVar4; - ppState = GetCurrentPpToMaxPpState(summaryStruct->summary.pp[a], pp) + 9; - offset = GetStringRightAlignXOffset(1, text, 0x2C); + ppState = GetCurrentPpToMaxPpState(summaryStruct->summary.pp[moveIndex], pp) + 9; + offset = GetStringRightAlignXOffset(1, text, 44); } else { - sub_81C25A4(r8, gText_OneDash, 0, a * 16 + 1, 0, 1); + SummaryScreen_PrintTextOnWindow(moveNameWindowId, gText_OneDash, 0, moveIndex * 16 + 1, 0, 1); text = gText_TwoDashes; ppState = 12; - offset = GetStringCenterAlignXOffset(1, text, 0x2C); + offset = GetStringCenterAlignXOffset(1, text, 44); } - sub_81C25A4(sp, text, offset, a * 16 + 1, 0, ppState); + + SummaryScreen_PrintTextOnWindow(ppValueWindowId, text, offset, moveIndex * 16 + 1, 0, ppState); } -void sub_81C3C5C(u16 move) +void PrintMovePowerAndAccuracy(u16 moveIndex) { const u8 *text; - if (move != 0) + if (moveIndex != 0) { - FillWindowPixelRect(14, 0, 0x35, 0, 0x13, 0x20); - if (gBattleMoves[move].power <= 1) + FillWindowPixelRect(14, 0, 53, 0, 19, 32); + + if (gBattleMoves[moveIndex].power < 2) + { text = gText_ThreeDashes; + } else { - ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].power, 1, 3); + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].power, 1, 3); text = gStringVar1; } - sub_81C25A4(14, text, 0x35, 1, 0, 0); - if (gBattleMoves[move].accuracy == 0) + + SummaryScreen_PrintTextOnWindow(14, text, 53, 1, 0, 0); + + if (gBattleMoves[moveIndex].accuracy == 0) + { text = gText_ThreeDashes; + } else { - ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[move].accuracy, 1, 3); + ConvertIntToDecimalStringN(gStringVar1, gBattleMoves[moveIndex].accuracy, 1, 3); text = gStringVar1; } - sub_81C25A4(14, text, 0x35, 17, 0, 0); + + SummaryScreen_PrintTextOnWindow(14, text, 53, 17, 0, 0); } } void sub_81C3D08(void) { - sub_81C3B08(0); - sub_81C3B08(1); - sub_81C3B08(2); - sub_81C3B08(3); - if (gUnknown_0203CF1C->mode == 3) + PrintMoveNameAndPP(0); + PrintMoveNameAndPP(1); + PrintMoveNameAndPP(2); + PrintMoveNameAndPP(3); + + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - sub_81C3F44(); + PrintNewMoveDetailsOrCancelText(); sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex); } } @@ -3497,25 +3573,25 @@ void sub_81C3D54(u8 taskId) switch (dataa) { case 0: - sub_81C3B08(0); + PrintMoveNameAndPP(0); break; case 1: - sub_81C3B08(1); + PrintMoveNameAndPP(1); break; case 2: - sub_81C3B08(2); + PrintMoveNameAndPP(2); break; case 3: - sub_81C3B08(3); + PrintMoveNameAndPP(3); break; case 4: - if (gUnknown_0203CF1C->mode == 3) - sub_81C3F44(); + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + PrintNewMoveDetailsOrCancelText(); break; case 5: - if (gUnknown_0203CF1C->mode == 3) + if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { - if (!(gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex); } break; @@ -3537,25 +3613,25 @@ void sub_81C3E2C(u8 moveSlot) if (move != MOVE_NONE) { - u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 2); - sub_81C25A4(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0); + u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2); + SummaryScreen_PrintTextOnWindow(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0); } } void sub_81C3E9C(u16 move) { - u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 2); + u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2); FillWindowPixelBuffer(windowId, 0); if (move != MOVE_NONE) { - if (gUnknown_0203CF1C->unk40C0 == 2) + if (gUnknown_0203CF1C->currPageIndex == 2) { - sub_81C3C5C(move); - sub_81C25A4(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); + PrintMovePowerAndAccuracy(move); + SummaryScreen_PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); } else { - sub_81C25A4(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0); + SummaryScreen_PrintTextOnWindow(windowId, gContestEffectDescriptionPointers[gContestMoves[move].effect], 6, 1, 0, 0); } PutWindowTilemap(windowId); } @@ -3567,58 +3643,60 @@ void sub_81C3E9C(u16 move) schedule_bg_copy_tilemap_to_vram(0); } -void sub_81C3F44(void) +void PrintNewMoveDetailsOrCancelText(void) { - u8 windowId1 = sub_81C2D2C(gUnknown_0861CD14, 0); - u8 windowId2 = sub_81C2D2C(gUnknown_0861CD14, 1); + u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0); + u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1); + if (gUnknown_0203CF1C->newMove == MOVE_NONE) { - sub_81C25A4(windowId1, gText_Cancel, 0, 0x41, 0, 1); + SummaryScreen_PrintTextOnWindow(windowId1, gText_Cancel, 0, 65, 0, 1); } else { u16 move = gUnknown_0203CF1C->newMove; - if (gUnknown_0203CF1C->unk40C0 == 2) - sub_81C25A4(windowId1, gMoveNames[move], 0, 0x41, 0, 6); + + if (gUnknown_0203CF1C->currPageIndex == 2) + SummaryScreen_PrintTextOnWindow(windowId1, gMoveNames[move], 0, 65, 0, 6); else - sub_81C25A4(windowId1, gMoveNames[move], 0, 0x41, 0, 5); + 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); - sub_81C25A4(windowId2, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x2C), 0x41, 0, 12); + SummaryScreen_PrintTextOnWindow(windowId2, gStringVar4, GetStringRightAlignXOffset(1, gStringVar4, 0x2C), 0x41, 0, 12); } } void sub_81C4064(void) { - u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 0); - FillWindowPixelRect(windowId, 0, 0, 0x42, 0x48, 0x10); + u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 0); + FillWindowPixelRect(windowId, 0, 0, 66, 72, 16); CopyWindowToVram(windowId, 2); } -void sub_81C40A0(u8 a, u8 b) +void sub_81C40A0(u8 moveIndex1, u8 moveIndex2) { - u8 windowId1 = sub_81C2D2C(gUnknown_0861CD14, 0); - u8 windowId2 = sub_81C2D2C(gUnknown_0861CD14, 1); + u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0); + u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1); - FillWindowPixelRect(windowId1, 0, 0, a * 16, 0x48, 0x10); - FillWindowPixelRect(windowId1, 0, 0, b * 16, 0x48, 0x10); + FillWindowPixelRect(windowId1, 0, 0, moveIndex1 * 16, 0x48, 0x10); + FillWindowPixelRect(windowId1, 0, 0, moveIndex2 * 16, 0x48, 0x10); - FillWindowPixelRect(windowId2, 0, 0, a * 16, 0x30, 0x10); - FillWindowPixelRect(windowId2, 0, 0, b * 16, 0x30, 0x10); + FillWindowPixelRect(windowId2, 0, 0, moveIndex1 * 16, 0x30, 0x10); + FillWindowPixelRect(windowId2, 0, 0, moveIndex2 * 16, 0x30, 0x10); - sub_81C3B08(a); - sub_81C3B08(b); + PrintMoveNameAndPP(moveIndex1); + PrintMoveNameAndPP(moveIndex2); } void sub_81C4154(void) { - u8 windowId = sub_81C2D2C(gUnknown_0861CD14, 2); + u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2); FillWindowPixelBuffer(windowId, 0); - sub_81C25A4(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0); + SummaryScreen_PrintTextOnWindow(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0); } void sub_81C4190(void) @@ -3656,7 +3734,7 @@ void sub_81C424C(void) void sub_81C4280(void) { - switch (gUnknown_0203CF1C->unk40C0) + switch (gUnknown_0203CF1C->currPageIndex) { case 0: sub_81C43A0(); @@ -3752,7 +3830,7 @@ void sub_81C44F0(void) } else { - if (gUnknown_0203CF1C->unk40C0 == 2) + if (gUnknown_0203CF1C->currPageIndex == 2) 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); @@ -3803,7 +3881,7 @@ u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) { if (gMonSpritesGfxPtr != NULL) { - if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == 2 || gUnknown_0203CF1C->unk40EF == TRUE) + if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE) { HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid); } @@ -3814,7 +3892,7 @@ u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) } else { - if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == 2 || gUnknown_0203CF1C->unk40EF == TRUE) + if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE) { HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], sub_806F4F8(0, 1), summary->species2, summary->pid); } @@ -3893,7 +3971,7 @@ void sub_81C488C(u8 a0) sUnusedTaskId = a0; } -void sub_81C4898(void) +void DestoryUnusedTask(void) { if (sUnusedTaskId != 0xFF) { @@ -3991,7 +4069,7 @@ void sub_81C4AF8(u8 a0) u8 i; u8 *spriteIds = &gUnknown_0203CF1C->spriteIds[a0]; - if (gUnknown_0203CF1C->unk40C0 > 1) + if (gUnknown_0203CF1C->currPageIndex > 1) { u8 subsprite = 0; if (a0 == 8) From c806992cfc5a4fac53f2c8a52b32f7a039773e41 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 15 Aug 2018 11:43:57 +0200 Subject: [PATCH 15/21] Port contest ai from pokeruby --- asm/contest.s | 24 +- asm/contest_ai.s | 5278 -------------------------------------- asm/contest_effect.s | 2 +- include/contest.h | 9 +- include/contest_ai.h | 16 + include/contest_effect.h | 4 +- src/contest.c | 10 +- src/contest_ai.c | 1758 +++++++++++++ 8 files changed, 1803 insertions(+), 5298 deletions(-) create mode 100644 include/contest_ai.h create mode 100644 src/contest_ai.c diff --git a/asm/contest.s b/asm/contest.s index 6504e7bf1..b67450eef 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -43,7 +43,7 @@ sub_80DB8B8: @ 80DB8B8 lsrs r4, r0, 24 adds r5, r4, 0 adds r0, r4, 0 - bl sub_80DBCA8 + bl Contest_IsMonsTurnDisabled lsls r0, 24 cmp r0, 0 beq _080DB8D0 @@ -55,8 +55,8 @@ _080DB8D0: cmp r4, r0 beq _080DB8F4 adds r0, r4, 0 - bl sub_81562C4 - bl sub_8156324 + bl ContestAI_ResetAI + bl ContestAI_GetActionToUse lsls r0, 24 ldr r2, =gContestMons lsrs r0, 23 @@ -533,7 +533,7 @@ _080DBC3C: ldr r0, [r3, 0x4] adds r0, r4, r0 ldrh r0, [r0, 0x6] - bl sub_80DD9F0 + bl Contest_GetMoveExcitement ldr r1, [r5] ldr r2, [r1] ldrb r1, [r2, 0x1] @@ -568,8 +568,8 @@ _080DBC3C: .pool thumb_func_end sub_80DBAA0 - thumb_func_start sub_80DBCA8 -sub_80DBCA8: @ 80DBCA8 + thumb_func_start Contest_IsMonsTurnDisabled +Contest_IsMonsTurnDisabled: @ 80DBCA8 push {lr} lsls r0, 24 lsrs r0, 24 @@ -599,7 +599,7 @@ _080DBCD8: _080DBCDA: pop {r1} bx r1 - thumb_func_end sub_80DBCA8 + thumb_func_end Contest_IsMonsTurnDisabled thumb_func_start sub_80DBCE0 sub_80DBCE0: @ 80DBCE0 @@ -3425,7 +3425,7 @@ _080DD334: ldr r0, [r0, 0x4] adds r0, r4, r0 ldrh r0, [r0, 0x6] - bl sub_80DD9F0 + bl Contest_GetMoveExcitement ldr r1, [r5] ldr r1, [r1, 0x10] strb r0, [r1] @@ -4213,8 +4213,8 @@ _080DD9C8: .pool thumb_func_end sub_80DD940 - thumb_func_start sub_80DD9F0 -sub_80DD9F0: @ 80DD9F0 + thumb_func_start Contest_GetMoveExcitement +Contest_GetMoveExcitement: @ 80DD9F0 lsls r0, 16 ldr r3, =gUnknown_085899EC ldr r1, =gContestMoves @@ -4233,7 +4233,7 @@ sub_80DD9F0: @ 80DD9F0 ldrsb r0, [r1, r0] bx lr .pool - thumb_func_end sub_80DD9F0 + thumb_func_end Contest_GetMoveExcitement thumb_func_start sub_80DDA20 sub_80DDA20: @ 80DDA20 @@ -5136,7 +5136,7 @@ _080DE146: beq _080DE1CA lsls r0, r7, 24 lsrs r0, 24 - bl sub_80DBCA8 + bl Contest_IsMonsTurnDisabled lsls r0, 24 cmp r0, 0 bne _080DE1CA diff --git a/asm/contest_ai.s b/asm/contest_ai.s index ff48661f0..e69de29bb 100644 --- a/asm/contest_ai.s +++ b/asm/contest_ai.s @@ -1,5278 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81562C4 -sub_81562C4: @ 81562C4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0, 0xC] - movs r1, 0 - movs r2, 0x44 - bl memset - movs r1, 0 - movs r3, 0x64 - adds r2, r4, 0 -_081562DE: - ldr r0, [r4] - ldr r0, [r0, 0xC] - adds r0, 0x5 - adds r0, r1 - strb r3, [r0] - adds r1, 0x1 - cmp r1, 0x3 - ble _081562DE - ldr r0, [r2] - ldr r0, [r0, 0xC] - adds r0, 0x41 - movs r1, 0 - strb r5, [r0] - ldr r0, [r2] - ldr r0, [r0, 0xC] - adds r0, 0x40 - strb r1, [r0] - ldr r0, [r2] - ldr r2, [r0, 0xC] - ldr r1, =gContestMons - adds r0, r2, 0 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, 0x18 - adds r0, r1 - ldr r0, [r0] - str r0, [r2, 0x14] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81562C4 - - thumb_func_start sub_8156324 -sub_8156324: @ 8156324 - push {r4-r6,lr} - ldr r1, =gContestResources - ldr r0, [r1] - ldr r0, [r0, 0xC] - ldr r0, [r0, 0x14] - cmp r0, 0 - beq _0815636A - adds r4, r1, 0 - movs r5, 0 -_08156336: - ldr r0, [r4] - ldr r2, [r0, 0xC] - ldr r0, [r2, 0x14] - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0815634A - strb r5, [r2] - bl sub_81563B0 -_0815634A: - ldr r0, [r4] - ldr r1, [r0, 0xC] - ldr r0, [r1, 0x14] - lsrs r0, 1 - str r0, [r1, 0x14] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] - ldr r0, [r4] - ldr r0, [r0, 0xC] - strb r5, [r0, 0x4] - ldr r0, [r4] - ldr r0, [r0, 0xC] - ldr r0, [r0, 0x14] - cmp r0, 0 - bne _08156336 -_0815636A: - movs r6, 0x3 -_0815636C: - bl Random - adds r5, r0, 0 - ands r5, r6 - ldr r4, =gContestResources - ldr r0, [r4] - ldr r1, [r0, 0xC] - adds r0, r1, 0x5 - adds r0, r5 - ldrb r3, [r0] - movs r2, 0 - ldrb r1, [r1, 0x5] - cmp r3, r1 - bcc _0815639E - adds r1, r4, 0 -_0815638A: - adds r2, 0x1 - cmp r2, 0x3 - bgt _0815639E - ldr r0, [r1] - ldr r0, [r0, 0xC] - adds r0, 0x5 - adds r0, r2 - ldrb r0, [r0] - cmp r3, r0 - bcs _0815638A -_0815639E: - cmp r2, 0x4 - bne _0815636C - adds r0, r5, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8156324 - - thumb_func_start sub_81563B0 -sub_81563B0: @ 81563B0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r5, =gContestResources - ldr r0, [r5] - ldr r0, [r0, 0xC] - ldrb r0, [r0] - adds r4, r5, 0 - cmp r0, 0x2 - beq _081564A0 - adds r7, r5, 0 - ldr r6, =gAIScriptPtr - ldr r0, =gContestMons + 30 - mov r8, r0 -_081563CC: - ldr r0, [r7] - ldr r2, [r0, 0xC] - ldrb r0, [r2] - cmp r0, 0x1 - beq _08156426 - cmp r0, 0x1 - bgt _08156496 - cmp r0, 0 - bne _08156496 - ldr r1, =gContestAIs - ldrb r0, [r2, 0x10] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [r6] - ldrb r1, [r2, 0x4] - lsls r1, 1 - adds r0, r2, 0 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - add r1, r8 - ldrh r1, [r1] - adds r0, r1, 0 - cmp r0, 0 - bne _08156418 - strh r0, [r2, 0x2] - b _0815641A - .pool -_08156418: - strh r1, [r2, 0x2] -_0815641A: - ldr r0, [r4] - ldr r1, [r0, 0xC] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _08156496 -_08156426: - ldrh r1, [r2, 0x2] - cmp r1, 0 - beq _08156444 - ldr r1, =gUnknown_085CDD00 - ldr r0, [r6] - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - bl _call_via_r0 - b _08156458 - .pool -_08156444: - adds r0, r2, 0x5 - ldrb r2, [r2, 0x4] - adds r0, r2 - strb r1, [r0] - ldr r0, [r7] - ldr r2, [r0, 0xC] - ldrb r1, [r2, 0x9] - movs r0, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] -_08156458: - ldr r2, =gContestResources - ldr r0, [r2] - ldr r3, [r0, 0xC] - ldrb r1, [r3, 0x9] - movs r0, 0x1 - ands r0, r1 - adds r4, r2, 0 - cmp r0, 0 - beq _08156496 - ldrb r0, [r3, 0x4] - adds r0, 0x1 - movs r2, 0 - strb r0, [r3, 0x4] - ldr r0, [r4] - ldr r1, [r0, 0xC] - ldrb r0, [r1, 0x4] - cmp r0, 0x3 - bhi _08156484 - strb r2, [r1] - b _0815648A - .pool -_08156484: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0815648A: - ldr r0, [r4] - ldr r2, [r0, 0xC] - ldrb r1, [r2, 0x9] - movs r0, 0xFE - ands r0, r1 - strb r0, [r2, 0x9] -_08156496: - ldr r0, [r5] - ldr r0, [r0, 0xC] - ldrb r0, [r0] - cmp r0, 0x2 - bne _081563CC -_081564A0: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81563B0 - - thumb_func_start sub_81564AC -sub_81564AC: @ 81564AC - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - ldr r3, =gContestResources - ldr r0, [r3] - ldr r0, [r0, 0x8] - b _081564CC - .pool -_081564C0: - adds r1, 0x1 - cmp r1, 0x3 - bgt _081564D2 - ldr r0, [r3] - ldr r0, [r0, 0x8] - adds r0, r1 -_081564CC: - ldrb r0, [r0] - cmp r0, r2 - bne _081564C0 -_081564D2: - lsls r0, r1, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_81564AC - - thumb_func_start sub_81564DC -sub_81564DC: @ 81564DC - push {r4,lr} - ldr r3, =gContestResources - ldr r0, [r3] - ldr r0, [r0, 0xC] - adds r1, r0, 0x5 - ldrb r0, [r0, 0x4] - adds r1, r0 - ldr r2, =gAIScriptPtr - ldr r0, [r2] - ldrb r0, [r0, 0x1] - lsls r0, 24 - asrs r0, 24 - ldrb r1, [r1] - adds r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - asrs r0, 16 - cmp r0, 0xFF - ble _08156510 - movs r4, 0xFF - b _08156516 - .pool -_08156510: - cmp r0, 0 - bge _08156516 - movs r4, 0 -_08156516: - ldr r0, [r3] - ldr r1, [r0, 0xC] - adds r0, r1, 0x5 - ldrb r1, [r1, 0x4] - adds r0, r1 - strb r4, [r0] - ldr r0, [r2] - adds r0, 0x2 - str r0, [r2] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81564DC - - thumb_func_start sub_8156530 -sub_8156530: @ 8156530 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r0, [r0] - ldrb r0, [r0, 0x1] - strh r0, [r1, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156530 - - thumb_func_start sub_8156550 -sub_8156550: @ 8156550 - push {lr} - bl sub_8156530 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _0815658C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156590 - .pool -_0815658C: - adds r0, r2, 0x5 - str r0, [r3] -_08156590: - pop {r0} - bx r0 - thumb_func_end sub_8156550 - - thumb_func_start sub_8156594 -sub_8156594: @ 8156594 - push {lr} - bl sub_8156530 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _081565D0 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081565D4 - .pool -_081565D0: - adds r0, r2, 0x5 - str r0, [r3] -_081565D4: - pop {r0} - bx r0 - thumb_func_end sub_8156594 - - thumb_func_start sub_81565D8 -sub_81565D8: @ 81565D8 - push {lr} - bl sub_8156530 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08156614 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156618 - .pool -_08156614: - adds r0, r2, 0x5 - str r0, [r3] -_08156618: - pop {r0} - bx r0 - thumb_func_end sub_81565D8 - - thumb_func_start sub_815661C -sub_815661C: @ 815661C - push {lr} - bl sub_8156530 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08156658 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815665C - .pool -_08156658: - adds r0, r2, 0x5 - str r0, [r3] -_0815665C: - pop {r0} - bx r0 - thumb_func_end sub_815661C - - thumb_func_start sub_8156660 -sub_8156660: @ 8156660 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r0, [r0] - ldrb r0, [r0, 0x13] - lsls r0, 24 - asrs r0, 24 - strh r0, [r1, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156660 - - thumb_func_start sub_8156684 -sub_8156684: @ 8156684 - push {lr} - bl sub_8156660 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _081566C0 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081566C4 - .pool -_081566C0: - adds r0, r2, 0x5 - str r0, [r3] -_081566C4: - pop {r0} - bx r0 - thumb_func_end sub_8156684 - - thumb_func_start sub_81566C8 -sub_81566C8: @ 81566C8 - push {lr} - bl sub_8156660 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _08156704 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156708 - .pool -_08156704: - adds r0, r2, 0x5 - str r0, [r3] -_08156708: - pop {r0} - bx r0 - thumb_func_end sub_81566C8 - - thumb_func_start sub_815670C -sub_815670C: @ 815670C - push {lr} - bl sub_8156660 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08156748 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815674C - .pool -_08156748: - adds r0, r2, 0x5 - str r0, [r3] -_0815674C: - pop {r0} - bx r0 - thumb_func_end sub_815670C - - thumb_func_start sub_8156750 -sub_8156750: @ 8156750 - push {lr} - bl sub_8156660 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _0815678C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156790 - .pool -_0815678C: - adds r0, r2, 0x5 - str r0, [r3] -_08156790: - pop {r0} - bx r0 - thumb_func_end sub_8156750 - - thumb_func_start sub_8156794 -sub_8156794: @ 8156794 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r0, [r0, 0x8] - adds r1, r2, 0 - adds r1, 0x41 - ldrb r1, [r1] - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156794 - - thumb_func_start sub_81567BC -sub_81567BC: @ 81567BC - push {lr} - bl sub_8156794 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _081567F8 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081567FC - .pool -_081567F8: - adds r0, r2, 0x5 - str r0, [r3] -_081567FC: - pop {r0} - bx r0 - thumb_func_end sub_81567BC - - thumb_func_start sub_8156800 -sub_8156800: @ 8156800 - push {lr} - bl sub_8156794 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _0815683C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156840 - .pool -_0815683C: - adds r0, r2, 0x5 - str r0, [r3] -_08156840: - pop {r0} - bx r0 - thumb_func_end sub_8156800 - - thumb_func_start sub_8156844 -sub_8156844: @ 8156844 - push {lr} - bl sub_8156794 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08156880 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156884 - .pool -_08156880: - adds r0, r2, 0x5 - str r0, [r3] -_08156884: - pop {r0} - bx r0 - thumb_func_end sub_8156844 - - thumb_func_start sub_8156888 -sub_8156888: @ 8156888 - push {lr} - bl sub_8156794 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _081568C4 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081568C8 - .pool -_081568C4: - adds r0, r2, 0x5 - str r0, [r3] -_081568C8: - pop {r0} - bx r0 - thumb_func_end sub_8156888 - - thumb_func_start sub_81568CC -sub_81568CC: @ 81568CC - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r4, [r0, 0xC] - adds r1, r4, 0 - adds r1, 0x41 - ldrb r1, [r1] - ldr r2, [r0, 0x4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0xD] - lsls r0, 24 - asrs r0, 24 - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - asrs r0, 24 - strh r0, [r4, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81568CC - - thumb_func_start sub_815690C -sub_815690C: @ 815690C - push {lr} - bl sub_81568CC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _08156948 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815694C - .pool -_08156948: - adds r0, r2, 0x5 - str r0, [r3] -_0815694C: - pop {r0} - bx r0 - thumb_func_end sub_815690C - - thumb_func_start sub_8156950 -sub_8156950: @ 8156950 - push {lr} - bl sub_81568CC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _0815698C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156990 - .pool -_0815698C: - adds r0, r2, 0x5 - str r0, [r3] -_08156990: - pop {r0} - bx r0 - thumb_func_end sub_8156950 - - thumb_func_start sub_8156994 -sub_8156994: @ 8156994 - push {lr} - bl sub_81568CC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _081569D0 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081569D4 - .pool -_081569D0: - adds r0, r2, 0x5 - str r0, [r3] -_081569D4: - pop {r0} - bx r0 - thumb_func_end sub_8156994 - - thumb_func_start sub_81569D8 -sub_81569D8: @ 81569D8 - push {lr} - bl sub_81568CC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08156A14 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156A18 - .pool -_08156A14: - adds r0, r2, 0x5 - str r0, [r3] -_08156A18: - pop {r0} - bx r0 - thumb_func_end sub_81569D8 - - thumb_func_start sub_8156A1C -sub_8156A1C: @ 8156A1C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r3, [r0, 0xC] - adds r1, r3, 0 - adds r1, 0x41 - ldrb r1, [r1] - ldr r2, [r0, 0x4] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrh r0, [r0, 0x4] - strh r0, [r3, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156A1C - - thumb_func_start sub_8156A48 -sub_8156A48: @ 8156A48 - push {r4,r5,lr} - bl sub_8156A1C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - bge _08156A8C - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156A90 - .pool -_08156A8C: - adds r0, r3, 0x6 - str r0, [r4] -_08156A90: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156A48 - - thumb_func_start sub_8156A98 -sub_8156A98: @ 8156A98 - push {r4,r5,lr} - bl sub_8156A1C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - ble _08156ADC - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156AE0 - .pool -_08156ADC: - adds r0, r3, 0x6 - str r0, [r4] -_08156AE0: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156A98 - - thumb_func_start sub_8156AE8 -sub_8156AE8: @ 8156AE8 - push {r4,r5,lr} - bl sub_8156A1C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - bne _08156B2C - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156B30 - .pool -_08156B2C: - adds r0, r3, 0x6 - str r0, [r4] -_08156B30: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156AE8 - - thumb_func_start sub_8156B38 -sub_8156B38: @ 8156B38 - push {r4,r5,lr} - bl sub_8156A1C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - beq _08156B7C - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156B80 - .pool -_08156B7C: - adds r0, r3, 0x6 - str r0, [r4] -_08156B80: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156B38 - - thumb_func_start sub_8156B88 -sub_8156B88: @ 8156B88 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r1, =gContestMonConditions - adds r0, r2, 0 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156B88 - - thumb_func_start sub_8156BB4 -sub_8156BB4: @ 8156BB4 - push {r4,r5,lr} - bl sub_8156B88 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - bge _08156BF8 - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156BFC - .pool -_08156BF8: - adds r0, r3, 0x6 - str r0, [r4] -_08156BFC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156BB4 - - thumb_func_start sub_8156C04 -sub_8156C04: @ 8156C04 - push {r4,r5,lr} - bl sub_8156B88 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - ble _08156C48 - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156C4C - .pool -_08156C48: - adds r0, r3, 0x6 - str r0, [r4] -_08156C4C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156C04 - - thumb_func_start sub_8156C54 -sub_8156C54: @ 8156C54 - push {r4,r5,lr} - bl sub_8156B88 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - bne _08156C98 - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156C9C - .pool -_08156C98: - adds r0, r3, 0x6 - str r0, [r4] -_08156C9C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156C54 - - thumb_func_start sub_8156CA4 -sub_8156CA4: @ 8156CA4 - push {r4,r5,lr} - bl sub_8156B88 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3] - ldrb r0, [r3, 0x1] - lsls r0, 8 - orrs r1, r0 - movs r5, 0x18 - ldrsh r0, [r2, r5] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - beq _08156CE8 - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08156CEC - .pool -_08156CE8: - adds r0, r3, 0x6 - str r0, [r4] -_08156CEC: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8156CA4 - - thumb_func_start sub_8156CF4 -sub_8156CF4: @ 8156CF4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - strh r0, [r1, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156CF4 - - thumb_func_start sub_8156D18 -sub_8156D18: @ 8156D18 - push {lr} - bl sub_8156CF4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08156D54 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156D58 - .pool -_08156D54: - adds r0, r2, 0x5 - str r0, [r3] -_08156D58: - pop {r0} - bx r0 - thumb_func_end sub_8156D18 - - thumb_func_start sub_8156D5C -sub_8156D5C: @ 8156D5C - push {lr} - bl sub_8156CF4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08156D98 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156D9C - .pool -_08156D98: - adds r0, r2, 0x5 - str r0, [r3] -_08156D9C: - pop {r0} - bx r0 - thumb_func_end sub_8156D5C - - thumb_func_start sub_8156DA0 -sub_8156DA0: @ 8156DA0 - push {r4,lr} - ldr r2, =gContestMons - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0, 0xC] - ldrb r1, [r0, 0x4] - lsls r1, 1 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - bl sub_80DD9F0 - ldr r1, [r4] - ldr r1, [r1, 0xC] - lsls r0, 24 - asrs r0, 24 - strh r0, [r1, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8156DA0 - - thumb_func_start sub_8156DE4 -sub_8156DE4: @ 8156DE4 - push {r4,lr} - bl sub_8156DA0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - movs r4, 0x18 - ldrsh r1, [r0, r4] - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r1, r0 - bge _08156E20 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156E24 - .pool -_08156E20: - adds r0, r2, 0x5 - str r0, [r3] -_08156E24: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8156DE4 - - thumb_func_start sub_8156E2C -sub_8156E2C: @ 8156E2C - push {r4,lr} - bl sub_8156DA0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - movs r4, 0x18 - ldrsh r1, [r0, r4] - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r1, r0 - ble _08156E68 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156E6C - .pool -_08156E68: - adds r0, r2, 0x5 - str r0, [r3] -_08156E6C: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8156E2C - - thumb_func_start sub_8156E74 -sub_8156E74: @ 8156E74 - push {r4,lr} - bl sub_8156DA0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - movs r4, 0x18 - ldrsh r1, [r0, r4] - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r1, r0 - bne _08156EB0 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156EB4 - .pool -_08156EB0: - adds r0, r2, 0x5 - str r0, [r3] -_08156EB4: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8156E74 - - thumb_func_start sub_8156EBC -sub_8156EBC: @ 8156EBC - push {r4,lr} - bl sub_8156DA0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - movs r4, 0x18 - ldrsh r1, [r0, r4] - movs r0, 0 - ldrsb r0, [r2, r0] - cmp r1, r0 - beq _08156EF8 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156EFC - .pool -_08156EF8: - adds r0, r2, 0x5 - str r0, [r3] -_08156EFC: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8156EBC - - thumb_func_start sub_8156F04 -sub_8156F04: @ 8156F04 - ldr r2, =gContestMons - ldr r0, =gContestResources - ldr r0, [r0] - ldr r3, [r0, 0xC] - ldrb r1, [r3, 0x4] - lsls r1, 1 - adds r0, r3, 0 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - ldr r1, =gContestMoves - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r3, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156F04 - - thumb_func_start sub_8156F44 -sub_8156F44: @ 8156F44 - push {lr} - bl sub_8156F04 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08156F80 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156F84 - .pool -_08156F80: - adds r0, r2, 0x5 - str r0, [r3] -_08156F84: - pop {r0} - bx r0 - thumb_func_end sub_8156F44 - - thumb_func_start sub_8156F88 -sub_8156F88: @ 8156F88 - push {lr} - bl sub_8156F04 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08156FC4 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08156FC8 - .pool -_08156FC4: - adds r0, r2, 0x5 - str r0, [r3] -_08156FC8: - pop {r0} - bx r0 - thumb_func_end sub_8156F88 - - thumb_func_start sub_8156FCC -sub_8156FCC: @ 8156FCC - ldr r2, =gContestMons - ldr r0, =gContestResources - ldr r0, [r0] - ldr r3, [r0, 0xC] - ldrb r1, [r3, 0x4] - lsls r1, 1 - adds r0, r3, 0 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - ldr r2, =gContestEffects - ldr r1, =gContestMoves - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0] - strh r0, [r3, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_8156FCC - - thumb_func_start sub_8157018 -sub_8157018: @ 8157018 - push {lr} - bl sub_8156FCC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08157054 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157058 - .pool -_08157054: - adds r0, r2, 0x5 - str r0, [r3] -_08157058: - pop {r0} - bx r0 - thumb_func_end sub_8157018 - - thumb_func_start sub_815705C -sub_815705C: @ 815705C - push {lr} - bl sub_8156FCC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08157098 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815709C - .pool -_08157098: - adds r0, r2, 0x5 - str r0, [r3] -_0815709C: - pop {r0} - bx r0 - thumb_func_end sub_815705C - - thumb_func_start sub_81570A0 -sub_81570A0: @ 81570A0 - push {r4-r7,lr} - ldr r2, =gContestMons - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0xC] - ldrb r0, [r1, 0x4] - lsls r0, 1 - adds r1, 0x41 - ldrb r1, [r1] - lsls r1, 6 - adds r0, r1 - adds r2, 0x1E - adds r0, r2 - ldrh r0, [r0] - ldr r3, =gContestEffects - ldr r4, =gContestMoves - lsls r0, 3 - adds r0, r4 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r3 - ldrb r7, [r0, 0x1] - movs r6, 0 - ldr r0, =gAIScriptPtr - mov r12, r0 - adds r1, r2 -_081570D4: - ldrh r0, [r1] - cmp r0, 0 - beq _081570EA - lsls r0, 3 - adds r0, r4 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x1] - cmp r7, r0 - bcc _081570F2 -_081570EA: - adds r1, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _081570D4 -_081570F2: - cmp r6, 0x4 - bne _08157114 - ldr r0, [r5] - ldr r1, [r0, 0xC] - movs r0, 0x1 - b _0815711A - .pool -_08157114: - ldr r0, [r5] - ldr r1, [r0, 0xC] - movs r0, 0 -_0815711A: - strh r0, [r1, 0x18] - mov r1, r12 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81570A0 - - thumb_func_start sub_815712C -sub_815712C: @ 815712C - push {lr} - bl sub_81570A0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157164 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815716C - .pool -_08157164: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_0815716C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_815712C - - thumb_func_start sub_8157174 -sub_8157174: @ 8157174 - push {r4-r7,lr} - ldr r2, =gContestMons - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0xC] - ldrb r0, [r1, 0x4] - lsls r0, 1 - adds r1, 0x41 - ldrb r1, [r1] - lsls r1, 6 - adds r0, r1 - adds r2, 0x1E - adds r0, r2 - ldrh r0, [r0] - ldr r3, =gContestEffects - ldr r4, =gContestMoves - lsls r0, 3 - adds r0, r4 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r3 - ldrb r7, [r0, 0x2] - movs r6, 0 - ldr r0, =gAIScriptPtr - mov r12, r0 - adds r1, r2 -_081571A8: - ldrh r0, [r1] - cmp r0, 0 - beq _081571BE - lsls r0, 3 - adds r0, r4 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x2] - cmp r7, r0 - bcc _081571C6 -_081571BE: - adds r1, 0x2 - adds r6, 0x1 - cmp r6, 0x3 - ble _081571A8 -_081571C6: - cmp r6, 0x4 - bne _081571E8 - ldr r0, [r5] - ldr r1, [r0, 0xC] - movs r0, 0x1 - b _081571EE - .pool -_081571E8: - ldr r0, [r5] - ldr r1, [r0, 0xC] - movs r0, 0 -_081571EE: - strh r0, [r1, 0x18] - mov r1, r12 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8157174 - - thumb_func_start sub_8157200 -sub_8157200: @ 8157200 - push {lr} - bl sub_8157174 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157238 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157240 - .pool -_08157238: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x5 - str r0, [r1] -_08157240: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157200 - - thumb_func_start sub_8157248 -sub_8157248: @ 8157248 - push {r4,lr} - ldr r2, =gContestMons - ldr r0, =gContestResources - ldr r0, [r0] - ldr r4, [r0, 0xC] - ldrb r1, [r4, 0x4] - lsls r1, 1 - adds r0, r4, 0 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - ldr r2, =gContestEffects - ldr r1, =gContestMoves - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1] - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157248 - - thumb_func_start sub_81572A4 -sub_81572A4: @ 81572A4 - push {lr} - bl sub_8157248 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _081572E0 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081572E4 - .pool -_081572E0: - adds r0, r2, 0x5 - str r0, [r3] -_081572E4: - pop {r0} - bx r0 - thumb_func_end sub_81572A4 - - thumb_func_start sub_81572E8 -sub_81572E8: @ 81572E8 - push {lr} - bl sub_8157248 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _08157324 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157328 - .pool -_08157324: - adds r0, r2, 0x5 - str r0, [r3] -_08157328: - pop {r0} - bx r0 - thumb_func_end sub_81572E8 - - thumb_func_start sub_815732C -sub_815732C: @ 815732C - push {lr} - bl sub_8157248 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08157368 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815736C - .pool -_08157368: - adds r0, r2, 0x5 - str r0, [r3] -_0815736C: - pop {r0} - bx r0 - thumb_func_end sub_815732C - - thumb_func_start sub_8157370 -sub_8157370: @ 8157370 - push {lr} - bl sub_8157248 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _081573AC - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081573B0 - .pool -_081573AC: - adds r0, r2, 0x5 - str r0, [r3] -_081573B0: - pop {r0} - bx r0 - thumb_func_end sub_8157370 - - thumb_func_start sub_81573B4 -sub_81573B4: @ 81573B4 - push {r4,lr} - ldr r2, =gContestMons - ldr r0, =gContestResources - ldr r0, [r0] - ldr r4, [r0, 0xC] - ldrb r1, [r4, 0x4] - lsls r1, 1 - adds r0, r4, 0 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r0, [r1] - ldr r2, =gContestEffects - ldr r1, =gContestMoves - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x2] - movs r1, 0xA - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81573B4 - - thumb_func_start sub_8157410 -sub_8157410: @ 8157410 - push {lr} - bl sub_81573B4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _0815744C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157450 - .pool -_0815744C: - adds r0, r2, 0x5 - str r0, [r3] -_08157450: - pop {r0} - bx r0 - thumb_func_end sub_8157410 - - thumb_func_start sub_8157454 -sub_8157454: @ 8157454 - push {lr} - bl sub_81573B4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _08157490 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157494 - .pool -_08157490: - adds r0, r2, 0x5 - str r0, [r3] -_08157494: - pop {r0} - bx r0 - thumb_func_end sub_8157454 - - thumb_func_start sub_8157498 -sub_8157498: @ 8157498 - push {lr} - bl sub_81573B4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _081574D4 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081574D8 - .pool -_081574D4: - adds r0, r2, 0x5 - str r0, [r3] -_081574D8: - pop {r0} - bx r0 - thumb_func_end sub_8157498 - - thumb_func_start sub_81574DC -sub_81574DC: @ 81574DC - push {lr} - bl sub_81573B4 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08157518 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815751C - .pool -_08157518: - adds r0, r2, 0x5 - str r0, [r3] -_0815751C: - pop {r0} - bx r0 - thumb_func_end sub_81574DC - - thumb_func_start sub_8157520 -sub_8157520: @ 8157520 - push {r4,r5,lr} - ldr r3, =gContestMons - ldr r5, =gContestResources - ldr r4, [r5] - ldr r1, [r4, 0xC] - ldrb r0, [r1, 0x4] - lsls r0, 1 - adds r1, 0x41 - ldrb r2, [r1] - lsls r1, r2, 6 - adds r0, r1 - adds r3, 0x1E - adds r0, r3 - ldrh r3, [r0] - ldr r1, [r4, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0, 0x8] - cmp r3, r1 - beq _08157558 - movs r1, 0 - b _08157560 - .pool -_08157558: - ldrb r0, [r0, 0xB] - lsls r0, 25 - lsrs r0, 29 - adds r1, r0, 0x1 -_08157560: - ldr r0, [r5] - ldr r0, [r0, 0xC] - strh r1, [r0, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157520 - - thumb_func_start sub_8157578 -sub_8157578: @ 8157578 - push {lr} - bl sub_8157520 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _081575B4 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081575B8 - .pool -_081575B4: - adds r0, r2, 0x5 - str r0, [r3] -_081575B8: - pop {r0} - bx r0 - thumb_func_end sub_8157578 - - thumb_func_start sub_81575BC -sub_81575BC: @ 81575BC - push {lr} - bl sub_8157520 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _081575F8 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081575FC - .pool -_081575F8: - adds r0, r2, 0x5 - str r0, [r3] -_081575FC: - pop {r0} - bx r0 - thumb_func_end sub_81575BC - - thumb_func_start sub_8157600 -sub_8157600: @ 8157600 - push {lr} - bl sub_8157520 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _0815763C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157640 - .pool -_0815763C: - adds r0, r2, 0x5 - str r0, [r3] -_08157640: - pop {r0} - bx r0 - thumb_func_end sub_8157600 - - thumb_func_start sub_8157644 -sub_8157644: @ 8157644 - push {lr} - bl sub_8157520 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08157680 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157684 - .pool -_08157680: - adds r0, r2, 0x5 - str r0, [r3] -_08157684: - pop {r0} - bx r0 - thumb_func_end sub_8157644 - - thumb_func_start sub_8157688 -sub_8157688: @ 8157688 - push {r4-r6,lr} - movs r3, 0 - ldr r2, =gContestMons - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - ldrb r1, [r0, 0x4] - lsls r1, 1 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r5, [r1] - movs r4, 0 - adds r6, r2, 0 -_081576AA: - lsls r1, r4, 1 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r1, r6 - ldrh r0, [r1] - cmp r0, 0 - beq _081576D2 - adds r1, r0, 0 - adds r0, r5, 0 - bl AreMovesContestCombo - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - bne _081576DC -_081576D2: - adds r4, 0x1 - cmp r4, 0x3 - ble _081576AA - cmp r3, 0 - beq _081576DE -_081576DC: - movs r3, 0x1 -_081576DE: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - strh r3, [r0, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157688 - - thumb_func_start sub_8157700 -sub_8157700: @ 8157700 - push {lr} - bl sub_8157688 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157738 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157740 - .pool -_08157738: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157740: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157700 - - thumb_func_start sub_8157748 -sub_8157748: @ 8157748 - push {lr} - bl sub_8157688 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08157780 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157788 - .pool -_08157780: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157788: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157748 - - thumb_func_start sub_8157790 -sub_8157790: @ 8157790 - push {r4-r6,lr} - movs r3, 0 - ldr r2, =gContestMons - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - ldrb r1, [r0, 0x4] - lsls r1, 1 - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r2, 0x1E - adds r1, r2 - ldrh r5, [r1] - movs r4, 0 - adds r6, r2, 0 -_081577B2: - lsls r1, r4, 1 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r1, r6 - ldrh r0, [r1] - cmp r0, 0 - beq _081577D8 - adds r1, r5, 0 - bl AreMovesContestCombo - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - bne _081577E2 -_081577D8: - adds r4, 0x1 - cmp r4, 0x3 - ble _081577B2 - cmp r3, 0 - beq _081577E4 -_081577E2: - movs r3, 0x1 -_081577E4: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - strh r3, [r0, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157790 - - thumb_func_start sub_8157808 -sub_8157808: @ 8157808 - push {lr} - bl sub_8157790 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157840 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157848 - .pool -_08157840: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157848: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157808 - - thumb_func_start sub_8157850 -sub_8157850: @ 8157850 - push {lr} - bl sub_8157790 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08157888 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157890 - .pool -_08157888: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157890: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157850 - - thumb_func_start sub_8157898 -sub_8157898: @ 8157898 - push {r4-r6,lr} - movs r5, 0 - ldr r3, =gContestMons - ldr r6, =gContestResources - ldr r4, [r6] - ldr r1, [r4, 0xC] - ldrb r0, [r1, 0x4] - lsls r0, 1 - adds r1, 0x41 - ldrb r2, [r1] - lsls r1, r2, 6 - adds r0, r1 - adds r3, 0x1E - adds r0, r3 - ldrh r3, [r0] - ldr r1, [r4, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r1, r0, r1 - ldrh r0, [r1, 0x8] - cmp r0, 0 - beq _081578D0 - adds r1, r3, 0 - bl AreMovesContestCombo - lsls r0, 24 - lsrs r5, r0, 24 -_081578D0: - cmp r5, 0 - beq _081578D6 - movs r5, 0x1 -_081578D6: - ldr r0, [r6] - ldr r0, [r0, 0xC] - strh r5, [r0, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157898 - - thumb_func_start sub_81578F8 -sub_81578F8: @ 81578F8 - push {lr} - bl sub_8157898 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157930 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157938 - .pool -_08157930: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157938: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81578F8 - - thumb_func_start sub_8157940 -sub_8157940: @ 8157940 - push {lr} - bl sub_8157898 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08157978 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157980 - .pool -_08157978: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157980: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157940 - - thumb_func_start sub_8157988 -sub_8157988: @ 8157988 - push {r4,r5,lr} - ldr r4, =gAIScriptPtr - ldr r0, [r4] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r5, [r1, 0xC] - ldr r2, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - movs r0, 0xD - ldrsb r0, [r1, r0] - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - asrs r0, 24 - strh r0, [r5, 0x18] - ldr r0, [r4] - adds r0, 0x2 - str r0, [r4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157988 - - thumb_func_start sub_81579CC -sub_81579CC: @ 81579CC - push {lr} - bl sub_8157988 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _08157A08 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157A0C - .pool -_08157A08: - adds r0, r2, 0x5 - str r0, [r3] -_08157A0C: - pop {r0} - bx r0 - thumb_func_end sub_81579CC - - thumb_func_start sub_8157A10 -sub_8157A10: @ 8157A10 - push {lr} - bl sub_8157988 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _08157A4C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157A50 - .pool -_08157A4C: - adds r0, r2, 0x5 - str r0, [r3] -_08157A50: - pop {r0} - bx r0 - thumb_func_end sub_8157A10 - - thumb_func_start sub_8157A54 -sub_8157A54: @ 8157A54 - push {lr} - bl sub_8157988 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08157A90 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157A94 - .pool -_08157A90: - adds r0, r2, 0x5 - str r0, [r3] -_08157A94: - pop {r0} - bx r0 - thumb_func_end sub_8157A54 - - thumb_func_start sub_8157A98 -sub_8157A98: @ 8157A98 - push {lr} - bl sub_8157988 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08157AD4 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157AD8 - .pool -_08157AD4: - adds r0, r2, 0x5 - str r0, [r3] -_08157AD8: - pop {r0} - bx r0 - thumb_func_end sub_8157A98 - - thumb_func_start sub_8157ADC -sub_8157ADC: @ 8157ADC - push {r4-r6,lr} - movs r6, 0 - ldr r5, =gAIScriptPtr - ldr r0, [r5] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_80DE1E8 - lsls r0, 24 - cmp r0, 0 - beq _08157B18 - ldr r2, =gContestMoves - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x8] - lsls r0, 3 - adds r0, r2 - ldrb r1, [r0, 0x2] - negs r0, r1 - orrs r0, r1 - lsrs r6, r0, 31 -_08157B18: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - strh r6, [r0, 0x18] - ldr r0, [r5] - adds r0, 0x2 - str r0, [r5] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157ADC - - thumb_func_start sub_8157B38 -sub_8157B38: @ 8157B38 - push {lr} - bl sub_8157ADC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _08157B74 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157B78 - .pool -_08157B74: - adds r0, r2, 0x5 - str r0, [r3] -_08157B78: - pop {r0} - bx r0 - thumb_func_end sub_8157B38 - - thumb_func_start sub_8157B7C -sub_8157B7C: @ 8157B7C - push {lr} - bl sub_8157ADC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _08157BB8 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157BBC - .pool -_08157BB8: - adds r0, r2, 0x5 - str r0, [r3] -_08157BBC: - pop {r0} - bx r0 - thumb_func_end sub_8157B7C - - thumb_func_start sub_8157BC0 -sub_8157BC0: @ 8157BC0 - push {lr} - bl sub_8157ADC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08157BFC - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157C00 - .pool -_08157BFC: - adds r0, r2, 0x5 - str r0, [r3] -_08157C00: - pop {r0} - bx r0 - thumb_func_end sub_8157BC0 - - thumb_func_start sub_8157C04 -sub_8157C04: @ 8157C04 - push {lr} - bl sub_8157ADC - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08157C40 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157C44 - .pool -_08157C40: - adds r0, r2, 0x5 - str r0, [r3] -_08157C44: - pop {r0} - bx r0 - thumb_func_end sub_8157C04 - - thumb_func_start sub_8157C48 -sub_8157C48: @ 8157C48 - push {lr} - ldr r0, =gAIScriptPtr - ldr r0, [r0] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - lsrs r0, 24 - bl sub_80DBCA8 - lsls r0, 24 - cmp r0, 0 - beq _08157C74 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - movs r0, 0 - b _08157C7C - .pool -_08157C74: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - movs r0, 0x1 -_08157C7C: - strh r0, [r1, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x2 - str r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157C48 - - thumb_func_start sub_8157C94 -sub_8157C94: @ 8157C94 - push {lr} - bl sub_8157C48 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157CCC - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157CD4 - .pool -_08157CCC: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157CD4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157C94 - - thumb_func_start sub_8157CDC -sub_8157CDC: @ 8157CDC - push {lr} - bl sub_8157C48 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08157D14 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157D1C - .pool -_08157D14: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157D1C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157CDC - - thumb_func_start sub_8157D24 -sub_8157D24: @ 8157D24 - push {r4,lr} - ldr r4, =gAIScriptPtr - ldr r0, [r4] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r3, [r1, 0xC] - ldr r2, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x15] - lsls r0, 28 - lsrs r0, 31 - strh r0, [r3, 0x18] - ldr r0, [r4] - adds r0, 0x2 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157D24 - - thumb_func_start sub_8157D60 -sub_8157D60: @ 8157D60 - push {lr} - bl sub_8157D24 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157D98 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157DA0 - .pool -_08157D98: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157DA0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157D60 - - thumb_func_start sub_8157DA8 -sub_8157DA8: @ 8157DA8 - push {lr} - bl sub_8157D24 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08157DE0 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157DE8 - .pool -_08157DE0: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157DE8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157DA8 - - thumb_func_start sub_8157DF0 -sub_8157DF0: @ 8157DF0 - push {r4,r5,lr} - ldr r4, =gAIScriptPtr - ldr r0, [r4] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r5, [r1, 0xC] - ldr r3, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r1, r3 - adds r0, r5, 0 - adds r0, 0x41 - ldrb r2, [r0] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r3 - ldrh r1, [r1, 0x4] - ldrh r0, [r0, 0x4] - subs r1, r0 - strh r1, [r5, 0x18] - ldr r0, [r4] - adds r0, 0x2 - str r0, [r4] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157DF0 - - thumb_func_start sub_8157E3C -sub_8157E3C: @ 8157E3C - push {lr} - bl sub_8157DF0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _08157E74 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157E7C - .pool -_08157E74: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157E7C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157E3C - - thumb_func_start sub_8157E84 -sub_8157E84: @ 8157E84 - push {lr} - bl sub_8157DF0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - ble _08157EBC - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157EC4 - .pool -_08157EBC: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157EC4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157E84 - - thumb_func_start sub_8157ECC -sub_8157ECC: @ 8157ECC - push {lr} - bl sub_8157DF0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08157F04 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157F0C - .pool -_08157F04: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157F0C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157ECC - - thumb_func_start sub_8157F14 -sub_8157F14: @ 8157F14 - push {lr} - bl sub_8157DF0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08157F4C - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157F54 - .pool -_08157F4C: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157F54: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157F14 - - thumb_func_start sub_8157F5C -sub_8157F5C: @ 8157F5C - push {r4,lr} - ldr r4, =gAIScriptPtr - ldr r0, [r4] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r3, [r1, 0xC] - ldr r2, =gContestMonConditions - lsrs r0, 23 - adds r0, r2 - adds r1, r3, 0 - adds r1, 0x41 - ldrb r1, [r1] - lsls r1, 1 - adds r1, r2 - ldrh r0, [r0] - ldrh r1, [r1] - subs r0, r1 - strh r0, [r3, 0x18] - ldr r0, [r4] - adds r0, 0x2 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157F5C - - thumb_func_start sub_8157FA0 -sub_8157FA0: @ 8157FA0 - push {lr} - bl sub_8157F5C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _08157FD8 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08157FE0 - .pool -_08157FD8: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08157FE0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157FA0 - - thumb_func_start sub_8157FE8 -sub_8157FE8: @ 8157FE8 - push {lr} - bl sub_8157F5C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - ble _08158020 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158028 - .pool -_08158020: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08158028: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8157FE8 - - thumb_func_start sub_8158030 -sub_8158030: @ 8158030 - push {lr} - bl sub_8157F5C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08158068 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158070 - .pool -_08158068: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08158070: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158030 - - thumb_func_start sub_8158078 -sub_8158078: @ 8158078 - push {lr} - bl sub_8157F5C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _081580B0 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081580B8 - .pool -_081580B0: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_081580B8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158078 - - thumb_func_start sub_81580C0 -sub_81580C0: @ 81580C0 - push {r4,r5,lr} - ldr r5, =gAIScriptPtr - ldr r0, [r5] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - ldr r3, [r5] - ldrb r2, [r3, 0x2] - ldr r1, =gContestResources - ldr r4, [r1] - ldr r1, [r4] - lsrs r0, 23 - lsls r2, 3 - adds r0, r2 - adds r1, 0x1C - adds r1, r0 - ldrh r0, [r1] - ldr r2, [r4, 0xC] - ldr r1, =gContestMoves - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0] - strh r0, [r2, 0x18] - adds r3, 0x3 - str r3, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81580C0 - - thumb_func_start sub_8158108 -sub_8158108: @ 8158108 - push {lr} - bl sub_81580C0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _08158144 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158148 - .pool -_08158144: - adds r0, r2, 0x5 - str r0, [r3] -_08158148: - pop {r0} - bx r0 - thumb_func_end sub_8158108 - - thumb_func_start sub_815814C -sub_815814C: @ 815814C - push {lr} - bl sub_81580C0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _08158188 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815818C - .pool -_08158188: - adds r0, r2, 0x5 - str r0, [r3] -_0815818C: - pop {r0} - bx r0 - thumb_func_end sub_815814C - - thumb_func_start sub_8158190 -sub_8158190: @ 8158190 - push {lr} - bl sub_81580C0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _081581CC - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081581D0 - .pool -_081581CC: - adds r0, r2, 0x5 - str r0, [r3] -_081581D0: - pop {r0} - bx r0 - thumb_func_end sub_8158190 - - thumb_func_start sub_81581D4 -sub_81581D4: @ 81581D4 - push {lr} - bl sub_81580C0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08158210 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158214 - .pool -_08158210: - adds r0, r2, 0x5 - str r0, [r3] -_08158214: - pop {r0} - bx r0 - thumb_func_end sub_81581D4 - - thumb_func_start sub_8158218 -sub_8158218: @ 8158218 - push {r4,r5,lr} - ldr r5, =gAIScriptPtr - ldr r0, [r5] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - lsrs r0, 24 - ldr r3, [r5] - ldrb r2, [r3, 0x2] - ldr r1, =gContestResources - ldr r4, [r1] - ldr r1, [r4] - lsls r2, 2 - adds r0, r2 - adds r1, 0x44 - adds r1, r0 - ldr r2, [r4, 0xC] - movs r0, 0 - ldrsb r0, [r1, r0] - strh r0, [r2, 0x18] - adds r3, 0x3 - str r3, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158218 - - thumb_func_start sub_8158254 -sub_8158254: @ 8158254 - push {lr} - bl sub_8158218 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bge _08158290 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158294 - .pool -_08158290: - adds r0, r2, 0x5 - str r0, [r3] -_08158294: - pop {r0} - bx r0 - thumb_func_end sub_8158254 - - thumb_func_start sub_8158298 -sub_8158298: @ 8158298 - push {lr} - bl sub_8158218 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - ble _081582D4 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081582D8 - .pool -_081582D4: - adds r0, r2, 0x5 - str r0, [r3] -_081582D8: - pop {r0} - bx r0 - thumb_func_end sub_8158298 - - thumb_func_start sub_81582DC -sub_81582DC: @ 81582DC - push {lr} - bl sub_8158218 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _08158318 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815831C - .pool -_08158318: - adds r0, r2, 0x5 - str r0, [r3] -_0815831C: - pop {r0} - bx r0 - thumb_func_end sub_81582DC - - thumb_func_start sub_8158320 -sub_8158320: @ 8158320 - push {lr} - bl sub_8158218 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _0815835C - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158360 - .pool -_0815835C: - adds r0, r2, 0x5 - str r0, [r3] -_08158360: - pop {r0} - bx r0 - thumb_func_end sub_8158320 - - thumb_func_start sub_8158364 -sub_8158364: @ 8158364 - push {r4,r5,lr} - ldr r5, =gAIScriptPtr - ldr r0, [r5] - ldrb r0, [r0, 0x1] - bl sub_81564AC - lsls r0, 24 - ldr r3, [r5] - ldrb r2, [r3, 0x2] - ldr r1, =gContestResources - ldr r4, [r1] - ldr r1, [r4] - lsrs r0, 23 - lsls r2, 3 - adds r0, r2 - adds r1, 0x1C - adds r1, r0 - ldrh r0, [r1] - ldr r4, [r4, 0xC] - ldr r2, =gContestEffects - ldr r1, =gContestMoves - lsls r0, 3 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0] - strh r0, [r4, 0x18] - adds r3, 0x3 - str r3, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158364 - - thumb_func_start sub_81583B8 -sub_81583B8: @ 81583B8 - push {lr} - bl sub_8158364 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - bne _081583F4 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081583F8 - .pool -_081583F4: - adds r0, r2, 0x5 - str r0, [r3] -_081583F8: - pop {r0} - bx r0 - thumb_func_end sub_81583B8 - - thumb_func_start sub_81583FC -sub_81583FC: @ 81583FC - push {lr} - bl sub_8158364 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - cmp r0, r1 - beq _08158438 - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _0815843C - .pool -_08158438: - adds r0, r2, 0x5 - str r0, [r3] -_0815843C: - pop {r0} - bx r0 - thumb_func_end sub_81583FC - - thumb_func_start sub_8158440 -sub_8158440: @ 8158440 - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r3, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r2, [r4] - ldrb r0, [r2, 0x1] - lsls r0, 1 - adds r1, r3, 0 - adds r1, 0x1A - adds r1, r0 - ldrh r0, [r3, 0x18] - strh r0, [r1] - adds r2, 0x2 - str r2, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158440 - - thumb_func_start sub_815846C -sub_815846C: @ 815846C - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r3, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r2, [r4] - ldrb r0, [r2, 0x1] - lsls r0, 1 - adds r3, 0x1A - adds r3, r0 - ldrb r1, [r2, 0x2] - ldrb r0, [r2, 0x3] - lsls r0, 8 - orrs r1, r0 - strh r1, [r3] - adds r2, 0x4 - str r2, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_815846C - - thumb_func_start sub_815849C -sub_815849C: @ 815849C - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r0, [r3, 0x1] - lsls r0, 1 - adds r2, 0x1A - adds r2, r0 - movs r1, 0x2 - ldrsb r1, [r3, r1] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrh r0, [r2] - adds r1, r0 - strh r1, [r2] - adds r3, 0x4 - str r3, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_815849C - - thumb_func_start sub_81584D4 -sub_81584D4: @ 81584D4 - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3, 0x1] - lsls r1, 1 - adds r2, 0x1A - adds r1, r2, r1 - ldrb r0, [r3, 0x2] - lsls r0, 1 - adds r2, r0 - ldrh r0, [r2] - ldrh r2, [r1] - adds r0, r2 - strh r0, [r1] - adds r3, 0x3 - str r3, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81584D4 - - thumb_func_start sub_8158508 -sub_8158508: @ 8158508 - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3, 0x1] - lsls r1, 1 - adds r2, 0x1A - adds r1, r2, r1 - ldrb r0, [r3, 0x2] - lsls r0, 1 - adds r2, r0 - ldrh r0, [r2] - ldrh r2, [r1] - adds r0, r2 - strh r0, [r1] - adds r3, 0x3 - str r3, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158508 - - thumb_func_start sub_815853C -sub_815853C: @ 815853C - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r0, [r3, 0x1] - lsls r0, 1 - adds r1, 0x1A - adds r1, r0 - movs r0, 0 - ldrsh r2, [r1, r0] - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - cmp r2, r1 - bge _08158580 - ldrb r1, [r3, 0x4] - ldrb r0, [r3, 0x5] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x7] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08158586 - .pool -_08158580: - adds r0, r3, 0 - adds r0, 0x8 - str r0, [r4] -_08158586: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_815853C - - thumb_func_start sub_815858C -sub_815858C: @ 815858C - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r0, [r3, 0x1] - lsls r0, 1 - adds r1, 0x1A - adds r1, r0 - movs r0, 0 - ldrsh r2, [r1, r0] - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - cmp r2, r1 - ble _081585D0 - ldrb r1, [r3, 0x4] - ldrb r0, [r3, 0x5] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x7] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _081585D6 - .pool -_081585D0: - adds r0, r3, 0 - adds r0, 0x8 - str r0, [r4] -_081585D6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_815858C - - thumb_func_start sub_81585DC -sub_81585DC: @ 81585DC - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r0, [r3, 0x1] - lsls r0, 1 - adds r1, 0x1A - adds r1, r0 - movs r0, 0 - ldrsh r2, [r1, r0] - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - cmp r2, r1 - bne _08158620 - ldrb r1, [r3, 0x4] - ldrb r0, [r3, 0x5] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x7] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08158626 - .pool -_08158620: - adds r0, r3, 0 - adds r0, 0x8 - str r0, [r4] -_08158626: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_81585DC - - thumb_func_start sub_815862C -sub_815862C: @ 815862C - push {r4,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r0, [r3, 0x1] - lsls r0, 1 - adds r1, 0x1A - adds r1, r0 - movs r0, 0 - ldrsh r2, [r1, r0] - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - cmp r2, r1 - beq _08158670 - ldrb r1, [r3, 0x4] - ldrb r0, [r3, 0x5] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x7] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08158676 - .pool -_08158670: - adds r0, r3, 0 - adds r0, 0x8 - str r0, [r4] -_08158676: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_815862C - - thumb_func_start sub_815867C -sub_815867C: @ 815867C - push {r4,r5,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3, 0x1] - lsls r1, 1 - adds r2, 0x1A - adds r1, r2, r1 - ldrb r0, [r3, 0x2] - lsls r0, 1 - adds r2, r0 - movs r0, 0 - ldrsh r1, [r1, r0] - movs r5, 0 - ldrsh r0, [r2, r5] - cmp r1, r0 - bge _081586C4 - ldrb r1, [r3, 0x3] - ldrb r0, [r3, 0x4] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _081586C8 - .pool -_081586C4: - adds r0, r3, 0x7 - str r0, [r4] -_081586C8: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_815867C - - thumb_func_start sub_81586D0 -sub_81586D0: @ 81586D0 - push {r4,r5,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3, 0x1] - lsls r1, 1 - adds r2, 0x1A - adds r1, r2, r1 - ldrb r0, [r3, 0x2] - lsls r0, 1 - adds r2, r0 - movs r0, 0 - ldrsh r1, [r1, r0] - movs r5, 0 - ldrsh r0, [r2, r5] - cmp r1, r0 - ble _08158718 - ldrb r1, [r3, 0x3] - ldrb r0, [r3, 0x4] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _0815871C - .pool -_08158718: - adds r0, r3, 0x7 - str r0, [r4] -_0815871C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81586D0 - - thumb_func_start sub_8158724 -sub_8158724: @ 8158724 - push {r4,r5,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3, 0x1] - lsls r1, 1 - adds r2, 0x1A - adds r1, r2, r1 - ldrb r0, [r3, 0x2] - lsls r0, 1 - adds r2, r0 - movs r0, 0 - ldrsh r1, [r1, r0] - movs r5, 0 - ldrsh r0, [r2, r5] - cmp r1, r0 - bne _0815876C - ldrb r1, [r3, 0x3] - ldrb r0, [r3, 0x4] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08158770 - .pool -_0815876C: - adds r0, r3, 0x7 - str r0, [r4] -_08158770: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8158724 - - thumb_func_start sub_8158778 -sub_8158778: @ 8158778 - push {r4,r5,lr} - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r1, [r3, 0x1] - lsls r1, 1 - adds r2, 0x1A - adds r1, r2, r1 - ldrb r0, [r3, 0x2] - lsls r0, 1 - adds r2, r0 - movs r0, 0 - ldrsh r1, [r1, r0] - movs r5, 0 - ldrsh r0, [r2, r5] - cmp r1, r0 - beq _081587C0 - ldrb r1, [r3, 0x3] - ldrb r0, [r3, 0x4] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x6] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _081587C4 - .pool -_081587C0: - adds r0, r3, 0x7 - str r0, [r4] -_081587C4: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8158778 - - thumb_func_start sub_81587CC -sub_81587CC: @ 81587CC - push {r4,r5,lr} - bl Random - movs r2, 0xFF - ands r2, r0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r0, [r3, 0x1] - lsls r0, 1 - adds r1, 0x1A - adds r1, r0 - movs r5, 0 - ldrsh r0, [r1, r5] - cmp r2, r0 - bge _08158810 - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08158814 - .pool -_08158810: - adds r0, r3, 0x6 - str r0, [r4] -_08158814: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81587CC - - thumb_func_start sub_815881C -sub_815881C: @ 815881C - push {r4,r5,lr} - bl Random - movs r2, 0xFF - ands r2, r0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0xC] - ldr r4, =gAIScriptPtr - ldr r3, [r4] - ldrb r0, [r3, 0x1] - lsls r0, 1 - adds r1, 0x1A - adds r1, r0 - movs r5, 0 - ldrsh r0, [r1, r5] - cmp r2, r0 - ble _08158860 - ldrb r1, [r3, 0x2] - ldrb r0, [r3, 0x3] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r3, 0x4] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r3, 0x5] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - b _08158864 - .pool -_08158860: - adds r0, r3, 0x6 - str r0, [r4] -_08158864: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_815881C - - thumb_func_start sub_815886C -sub_815886C: @ 815886C - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - bx lr - .pool - thumb_func_end sub_815886C - - thumb_func_start dp15_call -dp15_call: @ 815888C - push {r4,lr} - ldr r4, =gAIScriptPtr - ldr r0, [r4] - adds r0, 0x5 - bl sub_81588E0 - ldr r2, [r4] - ldrb r1, [r2, 0x1] - ldrb r0, [r2, 0x2] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x4] - lsls r0, 24 - orrs r1, r0 - str r1, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end dp15_call - - thumb_func_start sub_81588BC -sub_81588BC: @ 81588BC - push {lr} - bl sub_8158908 - lsls r0, 24 - cmp r0, 0 - bne _081588D6 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0xC] - ldrb r1, [r2, 0x9] - movs r0, 0x1 - orrs r0, r1 - strb r0, [r2, 0x9] -_081588D6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81588BC - - thumb_func_start sub_81588E0 -sub_81588E0: @ 81588E0 - push {r4,lr} - ldr r1, =gContestResources - ldr r1, [r1] - ldr r3, [r1, 0xC] - adds r4, r3, 0 - adds r4, 0x40 - ldrb r1, [r4] - adds r2, r1, 0x1 - strb r2, [r4] - lsls r1, 24 - lsrs r1, 22 - adds r3, 0x20 - adds r3, r1 - str r0, [r3] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81588E0 - - thumb_func_start sub_8158908 -sub_8158908: @ 8158908 - push {lr} - ldr r3, =gContestResources - ldr r0, [r3] - ldr r0, [r0, 0xC] - adds r1, r0, 0 - adds r1, 0x40 - ldrb r0, [r1] - cmp r0, 0 - bne _08158924 - movs r0, 0 - b _08158940 - .pool -_08158924: - subs r0, 0x1 - strb r0, [r1] - ldr r2, =gAIScriptPtr - ldr r0, [r3] - ldr r1, [r0, 0xC] - adds r0, r1, 0 - adds r0, 0x40 - ldrb r0, [r0] - lsls r0, 2 - adds r1, 0x20 - adds r1, r0 - ldr r0, [r1] - str r0, [r2] - movs r0, 0x1 -_08158940: - pop {r1} - bx r1 - .pool - thumb_func_end sub_8158908 - - thumb_func_start sub_8158948 -sub_8158948: @ 8158948 - push {r4-r6,lr} - movs r5, 0 - movs r4, 0 - ldr r6, =gContestMons + 30 -_08158950: - lsls r1, r4, 1 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - adds r1, r6 - ldrh r0, [r1] - cmp r0, 0 - beq _08158980 - bl sub_80DD9F0 - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x1 - bne _08158980 - movs r5, 0x1 - b _08158986 - .pool -_08158980: - adds r4, 0x1 - cmp r4, 0x3 - ble _08158950 -_08158986: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - strh r5, [r0, 0x18] - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158948 - - thumb_func_start sub_81589A4 -sub_81589A4: @ 81589A4 - push {lr} - bl sub_8158948 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _081589DC - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _081589E4 - .pool -_081589DC: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_081589E4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81589A4 - - thumb_func_start sub_81589EC -sub_81589EC: @ 81589EC - push {lr} - bl sub_8158948 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08158A24 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158A2C - .pool -_08158A24: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08158A2C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81589EC - - thumb_func_start sub_8158A34 -sub_8158A34: @ 8158A34 - push {r4-r6,lr} - movs r6, 0 - ldr r3, =gAIScriptPtr - ldr r0, [r3] - ldrb r5, [r0, 0x1] - ldrb r0, [r0, 0x2] - lsls r0, 8 - orrs r5, r0 - movs r4, 0 - ldr r0, =gContestMons - mov r12, r0 - ldr r2, =gContestResources - ldr r0, [r2] - ldr r0, [r0, 0xC] - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - mov r1, r12 - adds r1, 0x1E - adds r0, r1 - ldrh r0, [r0] - b _08158A88 - .pool -_08158A6C: - adds r4, 0x1 - cmp r4, 0x3 - bgt _08158A8E - lsls r1, r4, 1 - ldr r0, [r2] - ldr r0, [r0, 0xC] - adds r0, 0x41 - ldrb r0, [r0] - lsls r0, 6 - adds r1, r0 - mov r0, r12 - adds r0, 0x1E - adds r1, r0 - ldrh r0, [r1] -_08158A88: - cmp r0, r5 - bne _08158A6C - movs r6, 0x1 -_08158A8E: - ldr r0, [r2] - ldr r0, [r0, 0xC] - strh r6, [r0, 0x18] - ldr r0, [r3] - adds r0, 0x3 - str r0, [r3] - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8158A34 - - thumb_func_start sub_8158AA0 -sub_8158AA0: @ 8158AA0 - push {lr} - bl sub_8158A34 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _08158AD8 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158AE0 - .pool -_08158AD8: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08158AE0: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158AA0 - - thumb_func_start sub_8158AE8 -sub_8158AE8: @ 8158AE8 - push {lr} - bl sub_8158A34 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0xC] - movs r1, 0x18 - ldrsh r0, [r0, r1] - cmp r0, 0 - bne _08158B20 - ldr r3, =gAIScriptPtr - ldr r2, [r3] - ldrb r1, [r2] - ldrb r0, [r2, 0x1] - lsls r0, 8 - orrs r1, r0 - ldrb r0, [r2, 0x2] - lsls r0, 16 - orrs r1, r0 - ldrb r0, [r2, 0x3] - lsls r0, 24 - orrs r1, r0 - str r1, [r3] - b _08158B28 - .pool -_08158B20: - ldr r1, =gAIScriptPtr - ldr r0, [r1] - adds r0, 0x4 - str r0, [r1] -_08158B28: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8158AE8 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/contest_effect.s b/asm/contest_effect.s index 65a720a65..406de35d8 100644 --- a/asm/contest_effect.s +++ b/asm/contest_effect.s @@ -951,7 +951,7 @@ _080E5B00: bne _080E5B38 lsls r0, r5, 24 lsrs r0, 24 - bl sub_80DBCA8 + bl Contest_IsMonsTurnDisabled lsls r0, 24 cmp r0, 0 bne _080E5B38 diff --git a/include/contest.h b/include/contest.h index b7324e26b..761b16369 100644 --- a/include/contest.h +++ b/include/contest.h @@ -406,7 +406,7 @@ extern struct ContestResources *gContestResources; #define sContest (*gContestResources->field_0) #define sContestantStatus (gContestResources->field_4) #define shared192D0 (*gContestResources->field_8) -#define eContestAI (*gContestResources->field_C) +#define eContestAI (gContestResources->field_C) #define shared19328 (*gContestResources->field_10) #define shared19338 (*gContestResources->field_14) @@ -417,5 +417,12 @@ extern u32 gContestRngValue; bool8 IsSpeciesNotUnown(u16 species); void LoadContestBgAfterMoveAnim(void); +void SetContestantEffectStringID(u8 a, u8 b); +void SetContestantEffectStringID2(u8 a, u8 b); +void MakeContestantNervous(u8 p); +bool8 Contest_IsMonsTurnDisabled(u8 a); +bool8 sub_80DE1E8(u8 a); +void SetStartledString(u8 a, u8 b); +s8 Contest_GetMoveExcitement(u16); #endif //GUARD_CONTEST_H diff --git a/include/contest_ai.h b/include/contest_ai.h new file mode 100644 index 000000000..20b9eec10 --- /dev/null +++ b/include/contest_ai.h @@ -0,0 +1,16 @@ +#ifndef GUARD_CONTESTAI_H +#define GUARD_CONTESTAI_H + +// AI states +enum +{ + CONTESTAI_SETTING_UP, + CONTESTAI_PROCESSING, + CONTESTAI_FINISHED, + CONTESTAI_DO_NOT_PROCESS +}; + +void ContestAI_ResetAI(u8); +u8 ContestAI_GetActionToUse(void); + +#endif // GUARD_CONTESTAI_H diff --git a/include/contest_effect.h b/include/contest_effect.h index 3484ca5df..4b3b151eb 100644 --- a/include/contest_effect.h +++ b/include/contest_effect.h @@ -17,6 +17,8 @@ struct ContestEffect }; extern const struct ContestMove gContestMoves[]; -extern struct ContestEffect gContestEffects[]; +extern const struct ContestEffect gContestEffects[]; + +bool8 AreMovesContestCombo(u16 lastMove, u16 nextMove); #endif //GUARD_CONTEST_EFFECT_H diff --git a/src/contest.c b/src/contest.c index 8513fc4a9..910637387 100644 --- a/src/contest.c +++ b/src/contest.c @@ -107,7 +107,7 @@ u16 sub_80DE84C(u16); void sub_80DB89C(void); u16 sub_80DB8B8(u8); void sub_80DB918(void); -bool8 sub_80DBCA8(u8); +bool8 Contest_IsMonsTurnDisabled(u8); void sub_80DBF68(void); void sub_80DBF90(void); void sub_80DC2BC(void); @@ -721,7 +721,7 @@ void sub_80D833C(u8 taskId) sub_80DCD48(); DmaCopy32Defvars(3, gPlttBufferUnfaded, shared18000.unk18204, 0x400); ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1); - if (!sub_80DBCA8(gContestPlayerMonIndex)) + if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex)) StringCopy(gDisplayedStringBattle, gText_0827D507); else StringCopy(gDisplayedStringBattle, gText_0827D531); @@ -745,7 +745,7 @@ void sub_80D8424(u8 taskId) if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON)) { PlaySE(SE_SELECT); - if (!sub_80DBCA8(gContestPlayerMonIndex)) + if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex)) { sub_80DC490(TRUE); gTasks[taskId].func = sub_80D8490; @@ -819,7 +819,7 @@ void sub_80D8610(u8 taskId) PlaySE(SE_SELECT); sub_80DC490(FALSE); ConvertIntToDecimalStringN(gStringVar1, gContestResources->field_0->turnNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1); - if (!sub_80DBCA8(gContestPlayerMonIndex)) + if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex)) StringCopy(gDisplayedStringBattle, gText_0827D507); else StringCopy(gDisplayedStringBattle, gText_0827D531); @@ -2636,7 +2636,7 @@ void sub_80DB4E0(u16 move, u8 b) { u8 r7 = gUnknown_02039F26[b] * 5 + 2; - if (!sub_80DBCA8(b) && move != MOVE_NONE) + if (!Contest_IsMonsTurnDisabled(b) && move != MOVE_NONE) { u16 tile = sub_80DB2EC(move, b); diff --git a/src/contest_ai.c b/src/contest_ai.c new file mode 100644 index 000000000..059c351e9 --- /dev/null +++ b/src/contest_ai.c @@ -0,0 +1,1758 @@ +#include "global.h" +#include "contest.h" +#include "random.h" +#include "contest_ai.h" +#include "contest_effect.h" + +extern u16 gSpecialVar_ContestCategory; +extern u16 gContestMonConditions[]; + +extern const u8 *gAIScriptPtr; +extern const u8 *gContestAIs[]; + +static void ContestAICmd_unk_00(void); +static void ContestAICmd_get_turn(void); +static void ContestAICmd_unk_02(void); +static void ContestAICmd_unk_03(void); +static void ContestAICmd_unk_04(void); +static void ContestAICmd_unk_05(void); +static void ContestAICmd_get_excitement(void); +static void ContestAICmd_unk_07(void); +static void ContestAICmd_unk_08(void); +static void ContestAICmd_unk_09(void); +static void ContestAICmd_unk_0A(void); +static void ContestAICmd_get_user_order(void); +static void ContestAICmd_unk_0C(void); +static void ContestAICmd_unk_0D(void); +static void ContestAICmd_unk_0E(void); +static void ContestAICmd_unk_0F(void); +static void ContestAICmd_get_user_condition_maybe(void); +static void ContestAICmd_unk_11(void); +static void ContestAICmd_unk_12(void); +static void ContestAICmd_unk_13(void); +static void ContestAICmd_unk_14(void); +static void ContestAICmd_unk_15(void); +static void ContestAICmd_unk_16(void); +static void ContestAICmd_unk_17(void); +static void ContestAICmd_unk_18(void); +static void ContestAICmd_unk_19(void); +static void ContestAICmd_unk_1A(void); +static void ContestAICmd_unk_1B(void); +static void ContestAICmd_unk_1C(void); +static void ContestAICmd_unk_1D(void); +static void ContestAICmd_unk_1E(void); +static void ContestAICmd_get_contest_type(void); +static void ContestAICmd_unk_20(void); +static void ContestAICmd_unk_21(void); +static void ContestAICmd_get_move_excitement(void); +static void ContestAICmd_unk_23(void); +static void ContestAICmd_unk_24(void); +static void ContestAICmd_unk_25(void); +static void ContestAICmd_unk_26(void); +static void ContestAICmd_get_move_effect(void); +static void ContestAICmd_unk_28(void); +static void ContestAICmd_unk_29(void); +static void ContestAICmd_get_move_effect_type(void); +static void ContestAICmd_unk_2B(void); +static void ContestAICmd_unk_2C(void); +static void ContestAICmd_check_move_has_highest_appeal(void); +static void ContestAICmd_unk_2E(void); +static void ContestAICmd_unk_2F(void); +static void ContestAICmd_unk_30(void); +static void ContestAICmd_unk_31(void); +static void ContestAICmd_unk_32(void); +static void ContestAICmd_unk_33(void); +static void ContestAICmd_unk_34(void); +static void ContestAICmd_unk_35(void); +static void ContestAICmd_unk_36(void); +static void ContestAICmd_unk_37(void); +static void ContestAICmd_unk_38(void); +static void ContestAICmd_unk_39(void); +static void ContestAICmd_unk_3A(void); +static void ContestAICmd_get_move_used_count(void); +static void ContestAICmd_unk_3C(void); +static void ContestAICmd_unk_3D(void); +static void ContestAICmd_unk_3E(void); +static void ContestAICmd_unk_3F(void); +static void ContestAICmd_check_combo_starter(void); +static void ContestAICmd_unk_41(void); +static void ContestAICmd_unk_42(void); +static void ContestAICmd_check_combo_finisher(void); +static void ContestAICmd_unk_44(void); +static void ContestAICmd_unk_45(void); +static void ContestAICmd_check_would_finish_combo(void); +static void ContestAICmd_unk_47(void); +static void ContestAICmd_unk_48(void); +static void ContestAICmd_get_condition(void); +static void ContestAICmd_unk_4A(void); +static void ContestAICmd_unk_4B(void); +static void ContestAICmd_unk_4C(void); +static void ContestAICmd_unk_4D(void); +static void ContestAICmd_get_used_combo_starter(void); +static void ContestAICmd_unk_4F(void); +static void ContestAICmd_unk_50(void); +static void ContestAICmd_unk_51(void); +static void ContestAICmd_unk_52(void); +static void ContestAICmd_check_can_participate(void); +static void ContestAICmd_unk_54(void); +static void ContestAICmd_unk_55(void); +static void ContestAICmd_get_val_812A188(void); +static void ContestAICmd_unk_57(void); +static void ContestAICmd_unk_58(void); +static void ContestAICmd_unk_59(void); +static void ContestAICmd_unk_5A(void); +static void ContestAICmd_unk_5B(void); +static void ContestAICmd_unk_5C(void); +static void ContestAICmd_unk_5D(void); +static void ContestAICmd_unk_5E(void); +static void ContestAICmd_unk_5F(void); +static void ContestAICmd_unk_60(void); +static void ContestAICmd_unk_61(void); +static void ContestAICmd_unk_62(void); +static void ContestAICmd_unk_63(void); +static void ContestAICmd_unk_64(void); +static void ContestAICmd_unk_65(void); +static void ContestAICmd_unk_66(void); +static void ContestAICmd_unk_67(void); +static void ContestAICmd_unk_68(void); +static void ContestAICmd_unk_69(void); +static void ContestAICmd_unk_6A(void); +static void ContestAICmd_unk_6B(void); +static void ContestAICmd_unk_6C(void); +static void ContestAICmd_unk_6D(void); +static void ContestAICmd_unk_6E(void); +static void ContestAICmd_unk_6F(void); +static void ContestAICmd_unk_70(void); +static void ContestAICmd_unk_71(void); +static void ContestAICmd_unk_72(void); +static void ContestAICmd_unk_73(void); +static void ContestAICmd_unk_74(void); +static void ContestAICmd_unk_75(void); +static void ContestAICmd_unk_76(void); +static void ContestAICmd_unk_77(void); +static void ContestAICmd_unk_78(void); +static void ContestAICmd_unk_79(void); +static void ContestAICmd_unk_7A(void); +static void ContestAICmd_unk_7B(void); +static void ContestAICmd_unk_7C(void); +static void ContestAICmd_unk_7D(void); +static void ContestAICmd_unk_7E(void); +static void ContestAICmd_unk_7F(void); +static void ContestAICmd_unk_80(void); +static void ContestAICmd_unk_81(void); +static void ContestAICmd_check_for_exciting_move(void); +static void ContestAICmd_unk_83(void); +static void ContestAICmd_unk_84(void); +static void ContestAICmd_unk_85(void); +static void ContestAICmd_unk_86(void); +static void ContestAICmd_unk_87(void); + +typedef void (* ContestAICmdFunc)(void); + +static const ContestAICmdFunc sContestAICmdTable[] = +{ + ContestAICmd_unk_00, // 0x00 + ContestAICmd_get_turn, // 0x01 + ContestAICmd_unk_02, // 0x02 + ContestAICmd_unk_03, // 0x03 + ContestAICmd_unk_04, // 0x04 + ContestAICmd_unk_05, // 0x05 + ContestAICmd_get_excitement, // 0x06 + ContestAICmd_unk_07, // 0x07 + ContestAICmd_unk_08, // 0x08 + ContestAICmd_unk_09, // 0x09 + ContestAICmd_unk_0A, // 0x0A + ContestAICmd_get_user_order, // 0x0B + ContestAICmd_unk_0C, // 0x0C + ContestAICmd_unk_0D, // 0x0D + ContestAICmd_unk_0E, // 0x0E + ContestAICmd_unk_0F, // 0x0F + ContestAICmd_get_user_condition_maybe, // 0x10 + ContestAICmd_unk_11, // 0x11 + ContestAICmd_unk_12, // 0x12 + ContestAICmd_unk_13, // 0x13 + ContestAICmd_unk_14, // 0x14 + ContestAICmd_unk_15, // 0x15 + ContestAICmd_unk_16, // 0x16 + ContestAICmd_unk_17, // 0x17 + ContestAICmd_unk_18, // 0x18 + ContestAICmd_unk_19, // 0x19 + ContestAICmd_unk_1A, // 0x1A + ContestAICmd_unk_1B, // 0x1B + ContestAICmd_unk_1C, // 0x1C + ContestAICmd_unk_1D, // 0x1D + ContestAICmd_unk_1E, // 0x1E + ContestAICmd_get_contest_type, // 0x1F + ContestAICmd_unk_20, // 0x20 + ContestAICmd_unk_21, // 0x21 + ContestAICmd_get_move_excitement, // 0x22 + ContestAICmd_unk_23, // 0x23 + ContestAICmd_unk_24, // 0x24 + ContestAICmd_unk_25, // 0x25 + ContestAICmd_unk_26, // 0x26 + ContestAICmd_get_move_effect, // 0x27 + ContestAICmd_unk_28, // 0x28 + ContestAICmd_unk_29, // 0x29 + ContestAICmd_get_move_effect_type, // 0x2A + ContestAICmd_unk_2B, // 0x2B + ContestAICmd_unk_2C, // 0x2C + ContestAICmd_check_move_has_highest_appeal, // 0x2D + ContestAICmd_unk_2E, // 0x2E + ContestAICmd_unk_2F, // 0x2F + ContestAICmd_unk_30, // 0x30 + ContestAICmd_unk_31, // 0x31 + ContestAICmd_unk_32, // 0x32 + ContestAICmd_unk_33, // 0x33 + ContestAICmd_unk_34, // 0x34 + ContestAICmd_unk_35, // 0x35 + ContestAICmd_unk_36, // 0x36 + ContestAICmd_unk_37, // 0x37 + ContestAICmd_unk_38, // 0x38 + ContestAICmd_unk_39, // 0x39 + ContestAICmd_unk_3A, // 0x3A + ContestAICmd_get_move_used_count, // 0x3B + ContestAICmd_unk_3C, // 0x3C + ContestAICmd_unk_3D, // 0x3D + ContestAICmd_unk_3E, // 0x3E + ContestAICmd_unk_3F, // 0x3F + ContestAICmd_check_combo_starter, // 0x40 + ContestAICmd_unk_41, // 0x41 + ContestAICmd_unk_42, // 0x42 + ContestAICmd_check_combo_finisher, // 0x43 + ContestAICmd_unk_44, // 0x44 + ContestAICmd_unk_45, // 0x45 + ContestAICmd_check_would_finish_combo, // 0x46 + ContestAICmd_unk_47, // 0x47 + ContestAICmd_unk_48, // 0x48 + ContestAICmd_get_condition, // 0x49 + ContestAICmd_unk_4A, // 0x4A + ContestAICmd_unk_4B, // 0x4B + ContestAICmd_unk_4C, // 0x4C + ContestAICmd_unk_4D, // 0x4D + ContestAICmd_get_used_combo_starter, // 0x4E + ContestAICmd_unk_4F, // 0x4F + ContestAICmd_unk_50, // 0x50 + ContestAICmd_unk_51, // 0x51 + ContestAICmd_unk_52, // 0x52 + ContestAICmd_check_can_participate, // 0x53 + ContestAICmd_unk_54, // 0x54 + ContestAICmd_unk_55, // 0x55 + ContestAICmd_get_val_812A188, // 0x56 + ContestAICmd_unk_57, // 0x57 + ContestAICmd_unk_58, // 0x58 + ContestAICmd_unk_59, // 0x59 + ContestAICmd_unk_5A, // 0x5A + ContestAICmd_unk_5B, // 0x5B + ContestAICmd_unk_5C, // 0x5C + ContestAICmd_unk_5D, // 0x5D + ContestAICmd_unk_5E, // 0x5E + ContestAICmd_unk_5F, // 0x5F + ContestAICmd_unk_60, // 0x60 + ContestAICmd_unk_61, // 0x61 + ContestAICmd_unk_62, // 0x62 + ContestAICmd_unk_63, // 0x63 + ContestAICmd_unk_64, // 0x64 + ContestAICmd_unk_65, // 0x65 + ContestAICmd_unk_66, // 0x66 + ContestAICmd_unk_67, // 0x67 + ContestAICmd_unk_68, // 0x68 + ContestAICmd_unk_69, // 0x69 + ContestAICmd_unk_6A, // 0x6A + ContestAICmd_unk_6B, // 0x6B + ContestAICmd_unk_6C, // 0x6C + ContestAICmd_unk_6D, // 0x6D + ContestAICmd_unk_6E, // 0x6E + ContestAICmd_unk_6F, // 0x6F + ContestAICmd_unk_70, // 0x70 + ContestAICmd_unk_71, // 0x71 + ContestAICmd_unk_72, // 0x72 + ContestAICmd_unk_73, // 0x73 + ContestAICmd_unk_74, // 0x74 + ContestAICmd_unk_75, // 0x75 + ContestAICmd_unk_76, // 0x76 + ContestAICmd_unk_77, // 0x77 + ContestAICmd_unk_78, // 0x78 + ContestAICmd_unk_79, // 0x79 + ContestAICmd_unk_7A, // 0x7A + ContestAICmd_unk_7B, // 0x7B + ContestAICmd_unk_7C, // 0x7C + ContestAICmd_unk_7D, // 0x7D + ContestAICmd_unk_7E, // 0x7E + ContestAICmd_unk_7F, // 0x7F + ContestAICmd_unk_80, // 0x80 + ContestAICmd_unk_81, // 0x81 + ContestAICmd_check_for_exciting_move, // 0x82 + ContestAICmd_unk_83, // 0x83 + ContestAICmd_unk_84, // 0x84 + ContestAICmd_unk_85, // 0x85 + ContestAICmd_unk_86, // 0x86 + ContestAICmd_unk_87, // 0x87 +}; + +static void ContestAI_DoAIProcessing(void); +static bool8 sub_81563B0(u8); +static void AIStackPushVar(const u8 *); +static u8 AIStackPop(void); + +void ContestAI_ResetAI(u8 var) +{ + int i; + memset(eContestAI, 0, sizeof(struct ContestAIInfo)); + + for(i = 0; i < 4; i++) + eContestAI->unk5[i] = 100; + + eContestAI->unk41 = var; + eContestAI->unk40 = 0; + eContestAI->flags = gContestMons[eContestAI->unk41].flags; +} + +u8 ContestAI_GetActionToUse(void) +{ + while(eContestAI->flags != 0) + { + if (eContestAI->flags & 1) + { + eContestAI->aiState = 0; + ContestAI_DoAIProcessing(); + } + eContestAI->flags >>= 1; + eContestAI->unk10++; + eContestAI->unk4 = 0; + } + + while (1) + { + u8 rval = Random() & 3; + u8 r2 = eContestAI->unk5[rval]; + int i; + for (i = 0; i < 4; i++) + { + if (r2 < eContestAI->unk5[i]) + break; + } + if (i == 4) + return rval; + } +} + +static void ContestAI_DoAIProcessing(void) +{ + while(eContestAI->aiState != CONTESTAI_FINISHED) + { + switch(eContestAI->aiState) + { + case CONTESTAI_DO_NOT_PROCESS: + break; + case CONTESTAI_SETTING_UP: + gAIScriptPtr = gContestAIs[eContestAI->unk10]; + + if (gContestMons[eContestAI->unk41].moves[eContestAI->unk4] == 0) + eContestAI->unk2 = 0; // don't process a move that doesn't exist. + else + eContestAI->unk2 = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + eContestAI->aiState++; + break; + case CONTESTAI_PROCESSING: + if (eContestAI->unk2 != 0) + sContestAICmdTable[*gAIScriptPtr](); // run the command. + else + { + eContestAI->unk5[eContestAI->unk4] = 0; // don't consider a move that doesn't exist. + eContestAI->aiAction |= 1; + } + if (eContestAI->aiAction & 1) + { + eContestAI->unk4++; + if (eContestAI->unk4 < 4) + eContestAI->aiState = 0; + else + eContestAI->aiState++; + eContestAI->aiAction &= 0xFE; // TODO: Define action flags + } + break; + } + } +} + +static u8 sub_81563B0(u8 var) +{ + int i; + + for(i = 0; i < 4; i++) + if (shared192D0.turnOrder[i] == var) + break; + + return i; +} + +static void ContestAICmd_unk_00(void) +{ + s16 score = eContestAI->unk5[eContestAI->unk4] + (s8)gAIScriptPtr[1]; + + if (score > 255) + score = 255; + else if (score < 0) + score = 0; + + eContestAI->unk5[eContestAI->unk4] = score; + + gAIScriptPtr += 2; +} + +static void ContestAICmd_get_turn(void) +{ + eContestAI->scriptResult = sContest.turnNumber; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_02(void) +{ + ContestAICmd_get_turn(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_03(void) +{ + ContestAICmd_get_turn(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_04(void) +{ + ContestAICmd_get_turn(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_05(void) +{ + ContestAICmd_get_turn(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_excitement(void) +{ + eContestAI->scriptResult = sContest.applauseLevel; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_07(void) +{ + ContestAICmd_get_excitement(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_08(void) +{ + ContestAICmd_get_excitement(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_09(void) +{ + ContestAICmd_get_excitement(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_0A(void) +{ + ContestAICmd_get_excitement(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_user_order(void) +{ + eContestAI->scriptResult = shared192D0.turnOrder[eContestAI->unk41]; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_0C(void) +{ + ContestAICmd_get_user_order(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_0D(void) +{ + ContestAICmd_get_user_order(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_0E(void) +{ + ContestAICmd_get_user_order(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_0F(void) +{ + ContestAICmd_get_user_order(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_user_condition_maybe(void) +{ + eContestAI->scriptResult = sContestantStatus[eContestAI->unk41].condition / 10; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_11(void) +{ + ContestAICmd_get_user_condition_maybe(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_12(void) +{ + ContestAICmd_get_user_condition_maybe(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_13(void) +{ + ContestAICmd_get_user_condition_maybe(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_14(void) +{ + ContestAICmd_get_user_condition_maybe(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_15(void) +{ + eContestAI->scriptResult = sContestantStatus[eContestAI->unk41].unk4; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_16(void) +{ + ContestAICmd_unk_15(); + + if (eContestAI->scriptResult < (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_17(void) +{ + ContestAICmd_unk_15(); + + if (eContestAI->scriptResult > (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_18(void) +{ + ContestAICmd_unk_15(); + + if (eContestAI->scriptResult == (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_19(void) +{ + ContestAICmd_unk_15(); + + if (eContestAI->scriptResult != (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_1A(void) +{ + eContestAI->scriptResult = gContestMonConditions[eContestAI->unk41]; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_1B(void) +{ + ContestAICmd_unk_1A(); + + if (eContestAI->scriptResult < (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_1C(void) +{ + ContestAICmd_unk_1A(); + + if (eContestAI->scriptResult > (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_1D(void) +{ + ContestAICmd_unk_1A(); + + if (eContestAI->scriptResult == (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_1E(void) +{ + ContestAICmd_unk_1A(); + + if (eContestAI->scriptResult != (s16)T1_READ_16(gAIScriptPtr + 0)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_get_contest_type(void) +{ + eContestAI->scriptResult = gSpecialVar_ContestCategory; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_20(void) +{ + ContestAICmd_get_contest_type(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_21(void) +{ + ContestAICmd_get_contest_type(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_move_excitement(void) +{ + eContestAI->scriptResult = Contest_GetMoveExcitement(gContestMons[eContestAI->unk41].moves[eContestAI->unk4]); + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_23(void) +{ + ContestAICmd_get_move_excitement(); + + if (eContestAI->scriptResult < (s8)gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_24(void) +{ + ContestAICmd_get_move_excitement(); + + if (eContestAI->scriptResult > (s8)gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_25(void) +{ + ContestAICmd_get_move_excitement(); + + if (eContestAI->scriptResult == (s8)gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_26(void) +{ + ContestAICmd_get_move_excitement(); + + if (eContestAI->scriptResult != (s8)gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_move_effect(void) +{ + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + eContestAI->scriptResult = gContestMoves[move].effect; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_28(void) +{ + ContestAICmd_get_move_effect(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_29(void) +{ + ContestAICmd_get_move_effect(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_move_effect_type(void) +{ + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + eContestAI->scriptResult = gContestEffects[gContestMoves[move].effect].effectType; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_2B(void) +{ + ContestAICmd_get_move_effect_type(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_2C(void) +{ + ContestAICmd_get_move_effect_type(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_check_move_has_highest_appeal(void) +{ + int i; + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u8 appeal = gContestEffects[gContestMoves[move].effect].appeal; + + for(i = 0; i < 4; i++) + { + u16 newMove = gContestMons[eContestAI->unk41].moves[i]; + if (newMove != 0 && appeal < gContestEffects[gContestMoves[newMove].effect].appeal) + break; + } + + if (i == 4) + eContestAI->scriptResult = TRUE; + else + eContestAI->scriptResult = FALSE; + + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_2E(void) +{ + ContestAICmd_check_move_has_highest_appeal(); + + if (eContestAI->scriptResult != FALSE) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_2F(void) +{ + int i; + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u8 jam = gContestEffects[gContestMoves[move].effect].jam; + + for(i = 0; i < 4; i++) + { + u16 newMove = gContestMons[eContestAI->unk41].moves[i]; + if (newMove != 0 && jam < gContestEffects[gContestMoves[newMove].effect].jam) + break; + } + + if (i == 4) + eContestAI->scriptResult = TRUE; + else + eContestAI->scriptResult = FALSE; + + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_30(void) +{ + ContestAICmd_unk_2F(); + + if (eContestAI->scriptResult != FALSE) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_31(void) +{ + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + eContestAI->scriptResult = gContestEffects[gContestMoves[move].effect].appeal / 10; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_32(void) +{ + ContestAICmd_unk_31(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_33(void) +{ + ContestAICmd_unk_31(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_34(void) +{ + ContestAICmd_unk_31(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_35(void) +{ + ContestAICmd_unk_31(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_36(void) +{ + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + eContestAI->scriptResult = gContestEffects[gContestMoves[move].effect].jam / 10; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_37(void) +{ + ContestAICmd_unk_36(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_38(void) +{ + ContestAICmd_unk_36(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_39(void) +{ + ContestAICmd_unk_36(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_3A(void) +{ + ContestAICmd_unk_36(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_move_used_count(void) +{ + s16 result; + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + if (move != sContestantStatus[eContestAI->unk41].prevMove) + result = 0; // move is unique and not reused. + else + result = sContestantStatus[eContestAI->unk41].moveRepeatCount + 1; + + eContestAI->scriptResult = result; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_3C(void) +{ + ContestAICmd_get_move_used_count(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_3D(void) +{ + ContestAICmd_get_move_used_count(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_3E(void) +{ + ContestAICmd_get_move_used_count(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_3F(void) +{ + ContestAICmd_get_move_used_count(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_check_combo_starter(void) +{ + u8 result = 0; + int i; + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + for(i = 0; i < 4; i++) + { + if (gContestMons[eContestAI->unk41].moves[i]) + { + result = AreMovesContestCombo(move, gContestMons[eContestAI->unk41].moves[i]); + if (result) + { + result = 1; + break; + } + } + } + + if (result) + result = 1; + + eContestAI->scriptResult = result; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_41(void) +{ + ContestAICmd_check_combo_starter(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_42(void) +{ + ContestAICmd_check_combo_starter(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_check_combo_finisher(void) +{ + u8 result = 0; + int i; + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + for(i = 0; i < 4; i++) + { + if (gContestMons[eContestAI->unk41].moves[i]) + { + result = AreMovesContestCombo(gContestMons[eContestAI->unk41].moves[i], move); + if (result) + { + result = 1; + break; + } + } + } + + if (result) + result = 1; + + eContestAI->scriptResult = result; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_44(void) +{ + ContestAICmd_check_combo_finisher(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_45(void) +{ + ContestAICmd_check_combo_finisher(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_check_would_finish_combo(void) +{ + u8 result = 0; + u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + + if (sContestantStatus[eContestAI->unk41].prevMove) + result = AreMovesContestCombo(sContestantStatus[eContestAI->unk41].prevMove, move); + + if (result) + result = 1; + + eContestAI->scriptResult = result; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_47(void) +{ + ContestAICmd_check_would_finish_combo(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_48(void) +{ + ContestAICmd_check_would_finish_combo(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_get_condition(void) +{ + int var = sub_81563B0(gAIScriptPtr[1]); + + eContestAI->scriptResult = sContestantStatus[var].condition / 10; + gAIScriptPtr += 2; +} + +static void ContestAICmd_unk_4A(void) +{ + ContestAICmd_get_condition(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_4B(void) +{ + ContestAICmd_get_condition(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_4C(void) +{ + ContestAICmd_get_condition(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_4D(void) +{ + ContestAICmd_get_condition(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_get_used_combo_starter(void) +{ + u16 result = 0; + u8 var = sub_81563B0(gAIScriptPtr[1]); + + if (sub_80DE1E8(var)) + result = gContestMoves[sContestantStatus[var].prevMove].comboStarterId ? 1 : 0; + + eContestAI->scriptResult = result; + gAIScriptPtr += 2; +} + +static void ContestAICmd_unk_4F(void) +{ + ContestAICmd_get_used_combo_starter(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_50(void) +{ + ContestAICmd_get_used_combo_starter(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_51(void) +{ + ContestAICmd_get_used_combo_starter(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_52(void) +{ + ContestAICmd_get_used_combo_starter(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_check_can_participate(void) +{ + if (Contest_IsMonsTurnDisabled(sub_81563B0(gAIScriptPtr[1]))) + eContestAI->scriptResult = FALSE; + else + eContestAI->scriptResult = TRUE; + + gAIScriptPtr += 2; +} + +static void ContestAICmd_unk_54(void) +{ + ContestAICmd_check_can_participate(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_55(void) +{ + ContestAICmd_check_can_participate(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_get_val_812A188(void) +{ + u8 var = sub_81563B0(gAIScriptPtr[1]); + + eContestAI->scriptResult = sContestantStatus[var].unk15_3; + gAIScriptPtr += 2; +} + +static void ContestAICmd_unk_57(void) +{ + ContestAICmd_get_val_812A188(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_58(void) +{ + ContestAICmd_get_val_812A188(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_59(void) +{ + u8 var = sub_81563B0(gAIScriptPtr[1]); + + eContestAI->scriptResult = sContestantStatus[var].unk4 - sContestantStatus[eContestAI->unk41].unk4; + gAIScriptPtr += 2; +} + +static void ContestAICmd_unk_5A(void) +{ + ContestAICmd_unk_59(); + + if (eContestAI->scriptResult < 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_5B(void) +{ + ContestAICmd_unk_59(); + + if (eContestAI->scriptResult > 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_5C(void) +{ + ContestAICmd_unk_59(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_5D(void) +{ + ContestAICmd_unk_59(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_5E(void) +{ + u8 var = sub_81563B0(gAIScriptPtr[1]); + + eContestAI->scriptResult = gContestMonConditions[var] - gContestMonConditions[eContestAI->unk41]; + gAIScriptPtr += 2; +} + +static void ContestAICmd_unk_5F(void) +{ + ContestAICmd_unk_5E(); + + if (eContestAI->scriptResult < 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_60(void) +{ + ContestAICmd_unk_5E(); + + if (eContestAI->scriptResult > 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_61(void) +{ + ContestAICmd_unk_5E(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_62(void) +{ + ContestAICmd_unk_5E(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_63(void) +{ + u8 var = sub_81563B0(gAIScriptPtr[1]); + u8 var2 = gAIScriptPtr[2]; + u16 move = sContest.unk19220[var2][var]; + + eContestAI->scriptResult = gContestMoves[move].effect; + gAIScriptPtr += 3; +} + +static void ContestAICmd_unk_64(void) +{ + ContestAICmd_unk_63(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_65(void) +{ + ContestAICmd_unk_63(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_66(void) +{ + ContestAICmd_unk_63(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_67(void) +{ + ContestAICmd_unk_63(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_68(void) +{ + u8 var = sub_81563B0(gAIScriptPtr[1]); + u8 var2 = gAIScriptPtr[2]; + s8 result = sContest.unk19248[var2][var]; + + eContestAI->scriptResult = result; + gAIScriptPtr += 3; +} + +static void ContestAICmd_unk_69(void) +{ + ContestAICmd_unk_68(); + + if (eContestAI->scriptResult < gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_6A(void) +{ + ContestAICmd_unk_68(); + + if (eContestAI->scriptResult > gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_6B(void) +{ + ContestAICmd_unk_68(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_6C(void) +{ + ContestAICmd_unk_68(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_6D(void) +{ + u8 var = sub_81563B0(gAIScriptPtr[1]); + u8 var2 = gAIScriptPtr[2]; + u16 move = sContest.unk19220[var2][var]; + + eContestAI->scriptResult = gContestEffects[gContestMoves[move].effect].effectType; + gAIScriptPtr += 3; +} + +static void ContestAICmd_unk_6E(void) +{ + ContestAICmd_unk_6D(); + + if (eContestAI->scriptResult == gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_6F(void) +{ + ContestAICmd_unk_6D(); + + if (eContestAI->scriptResult != gAIScriptPtr[0]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); + else + gAIScriptPtr += 5; +} + +static void ContestAICmd_unk_70(void) +{ + eContestAI->scriptArr[gAIScriptPtr[1]] = eContestAI->scriptResult; + gAIScriptPtr += 2; +} + +static void ContestAICmd_unk_71(void) +{ + eContestAI->scriptArr[gAIScriptPtr[1]] = T1_READ_16(gAIScriptPtr + 2); + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_72(void) +{ + // wtf? shouldn't T1_READ_16 work here? why the signed 8 load by gAIScriptPtr[2]? + eContestAI->scriptArr[gAIScriptPtr[1]] += ((s8)gAIScriptPtr[2] | gAIScriptPtr[3] << 8); + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_73(void) +{ + eContestAI->scriptArr[gAIScriptPtr[1]] += eContestAI->scriptArr[gAIScriptPtr[2]]; + gAIScriptPtr += 3; +} + +static void ContestAICmd_unk_74(void) +{ + eContestAI->scriptArr[gAIScriptPtr[1]] += eContestAI->scriptArr[gAIScriptPtr[2]]; + gAIScriptPtr += 3; +} + +static void ContestAICmd_unk_75(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] < T1_READ_16(gAIScriptPtr + 2)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4); + else + gAIScriptPtr += 8; +} + +static void ContestAICmd_unk_76(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] > T1_READ_16(gAIScriptPtr + 2)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4); + else + gAIScriptPtr += 8; +} + +static void ContestAICmd_unk_77(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] == T1_READ_16(gAIScriptPtr + 2)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4); + else + gAIScriptPtr += 8; +} + +static void ContestAICmd_unk_78(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] != T1_READ_16(gAIScriptPtr + 2)) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 4); + else + gAIScriptPtr += 8; +} + +static void ContestAICmd_unk_79(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] < (eContestAI->scriptArr[gAIScriptPtr[2]])) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3); + else + gAIScriptPtr += 7; +} + +static void ContestAICmd_unk_7A(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] > (eContestAI->scriptArr[gAIScriptPtr[2]])) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3); + else + gAIScriptPtr += 7; +} + +static void ContestAICmd_unk_7B(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] == (eContestAI->scriptArr[gAIScriptPtr[2]])) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3); + else + gAIScriptPtr += 7; +} + +static void ContestAICmd_unk_7C(void) +{ + if (eContestAI->scriptArr[gAIScriptPtr[1]] != (eContestAI->scriptArr[gAIScriptPtr[2]])) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 3); + else + gAIScriptPtr += 7; +} + +static void ContestAICmd_unk_7D(void) +{ + if ((Random() & 0xFF) < eContestAI->scriptArr[gAIScriptPtr[1]]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +static void ContestAICmd_unk_7E(void) +{ + if ((Random() & 0xFF) > eContestAI->scriptArr[gAIScriptPtr[1]]) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2); + else + gAIScriptPtr += 6; +} + +// jump +static void ContestAICmd_unk_7F(void) +{ + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); +} + +static void ContestAICmd_unk_80(void) +{ + AIStackPushVar(gAIScriptPtr + 5); + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 1); +} + +static void ContestAICmd_unk_81(void) +{ + if (!AIStackPop()) + eContestAI->aiAction |= 1; +} + +static void AIStackPushVar(const u8 *ptr) +{ + eContestAI->stack[eContestAI->unk40++] = (u32)ptr; +} + +static bool8 AIStackPop(void) +{ + if (eContestAI->unk40 != 0) + { + --eContestAI->unk40; + gAIScriptPtr = (u8 *)eContestAI->stack[eContestAI->unk40]; + return TRUE; + } + else + { + return FALSE; + } +} + +static void ContestAICmd_check_for_exciting_move(void) +{ + int result = 0; + int i; + + for(i = 0; i < 4; i++) + { + if (gContestMons[eContestAI->unk41].moves[i]) + { + // why is it using gSharedMem + 0x19325? that does not exist... + if (Contest_GetMoveExcitement(gContestMons[eContestAI->unk41].moves[i]) == 1) + { + result = 1; + break; + } + } + } + + eContestAI->scriptResult = result; + gAIScriptPtr += 1; +} + +static void ContestAICmd_unk_83(void) +{ + ContestAICmd_check_for_exciting_move(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_84(void) +{ + ContestAICmd_check_for_exciting_move(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_85(void) +{ + int result = 0; + int i; + u16 arg = T1_READ_16(gAIScriptPtr + 1); + + for(i = 0; i < 4; i++) + { + u16 move = gContestMons[eContestAI->unk41].moves[i]; + if (move == arg) + { + result = 1; + break; + } + } + + eContestAI->scriptResult = result; + gAIScriptPtr += 3; +} + +static void ContestAICmd_unk_86(void) +{ + ContestAICmd_unk_85(); + + if (eContestAI->scriptResult != 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} + +static void ContestAICmd_unk_87(void) +{ + ContestAICmd_unk_85(); + + if (eContestAI->scriptResult == 0) + gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 0); + else + gAIScriptPtr += 4; +} From 92c4fc6345faf9e5c8af4035103eea26164b68bd Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 15 Aug 2018 11:50:18 +0200 Subject: [PATCH 16/21] Contest AI clean-up --- asm/contest_ai.s | 0 data/contest_ai.s | 144 ---------------------------------------------- include/contest.h | 9 +-- ld_script.txt | 4 +- src/contest_ai.c | 102 ++++++++++++++++---------------- 5 files changed, 57 insertions(+), 202 deletions(-) delete mode 100644 asm/contest_ai.s delete mode 100644 data/contest_ai.s diff --git a/asm/contest_ai.s b/asm/contest_ai.s deleted file mode 100644 index e69de29bb..000000000 diff --git a/data/contest_ai.s b/data/contest_ai.s deleted file mode 100644 index c7cb848a7..000000000 --- a/data/contest_ai.s +++ /dev/null @@ -1,144 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_085CDD00:: @ 85CDD00 - .4byte sub_81564DC - .4byte sub_8156530 - .4byte sub_8156550 - .4byte sub_8156594 - .4byte sub_81565D8 - .4byte sub_815661C - .4byte sub_8156660 - .4byte sub_8156684 - .4byte sub_81566C8 - .4byte sub_815670C - .4byte sub_8156750 - .4byte sub_8156794 - .4byte sub_81567BC - .4byte sub_8156800 - .4byte sub_8156844 - .4byte sub_8156888 - .4byte sub_81568CC - .4byte sub_815690C - .4byte sub_8156950 - .4byte sub_8156994 - .4byte sub_81569D8 - .4byte sub_8156A1C - .4byte sub_8156A48 - .4byte sub_8156A98 - .4byte sub_8156AE8 - .4byte sub_8156B38 - .4byte sub_8156B88 - .4byte sub_8156BB4 - .4byte sub_8156C04 - .4byte sub_8156C54 - .4byte sub_8156CA4 - .4byte sub_8156CF4 - .4byte sub_8156D18 - .4byte sub_8156D5C - .4byte sub_8156DA0 - .4byte sub_8156DE4 - .4byte sub_8156E2C - .4byte sub_8156E74 - .4byte sub_8156EBC - .4byte sub_8156F04 - .4byte sub_8156F44 - .4byte sub_8156F88 - .4byte sub_8156FCC - .4byte sub_8157018 - .4byte sub_815705C - .4byte sub_81570A0 - .4byte sub_815712C - .4byte sub_8157174 - .4byte sub_8157200 - .4byte sub_8157248 - .4byte sub_81572A4 - .4byte sub_81572E8 - .4byte sub_815732C - .4byte sub_8157370 - .4byte sub_81573B4 - .4byte sub_8157410 - .4byte sub_8157454 - .4byte sub_8157498 - .4byte sub_81574DC - .4byte sub_8157520 - .4byte sub_8157578 - .4byte sub_81575BC - .4byte sub_8157600 - .4byte sub_8157644 - .4byte sub_8157688 - .4byte sub_8157700 - .4byte sub_8157748 - .4byte sub_8157790 - .4byte sub_8157808 - .4byte sub_8157850 - .4byte sub_8157898 - .4byte sub_81578F8 - .4byte sub_8157940 - .4byte sub_8157988 - .4byte sub_81579CC - .4byte sub_8157A10 - .4byte sub_8157A54 - .4byte sub_8157A98 - .4byte sub_8157ADC - .4byte sub_8157B38 - .4byte sub_8157B7C - .4byte sub_8157BC0 - .4byte sub_8157C04 - .4byte sub_8157C48 - .4byte sub_8157C94 - .4byte sub_8157CDC - .4byte sub_8157D24 - .4byte sub_8157D60 - .4byte sub_8157DA8 - .4byte sub_8157DF0 - .4byte sub_8157E3C - .4byte sub_8157E84 - .4byte sub_8157ECC - .4byte sub_8157F14 - .4byte sub_8157F5C - .4byte sub_8157FA0 - .4byte sub_8157FE8 - .4byte sub_8158030 - .4byte sub_8158078 - .4byte sub_81580C0 - .4byte sub_8158108 - .4byte sub_815814C - .4byte sub_8158190 - .4byte sub_81581D4 - .4byte sub_8158218 - .4byte sub_8158254 - .4byte sub_8158298 - .4byte sub_81582DC - .4byte sub_8158320 - .4byte sub_8158364 - .4byte sub_81583B8 - .4byte sub_81583FC - .4byte sub_8158440 - .4byte sub_815846C - .4byte sub_815849C - .4byte sub_81584D4 - .4byte sub_8158508 - .4byte sub_815853C - .4byte sub_815858C - .4byte sub_81585DC - .4byte sub_815862C - .4byte sub_815867C - .4byte sub_81586D0 - .4byte sub_8158724 - .4byte sub_8158778 - .4byte sub_81587CC - .4byte sub_815881C - .4byte sub_815886C - .4byte dp15_call - .4byte sub_81588BC - .4byte sub_8158948 - .4byte sub_81589A4 - .4byte sub_81589EC - .4byte sub_8158A34 - .4byte sub_8158AA0 - .4byte sub_8158AE8 - diff --git a/include/contest.h b/include/contest.h index 761b16369..18f9ad21f 100644 --- a/include/contest.h +++ b/include/contest.h @@ -341,7 +341,8 @@ struct UnknownContestStruct7 u8 contestant; }; -struct ContestAIInfo { +struct ContestAIInfo +{ /*0x00*/ u8 aiState; /*0x02*/ u16 unk2; /*0x04*/ u8 unk4; @@ -352,9 +353,9 @@ struct ContestAIInfo { /*0x14*/ u32 flags; /*0x18*/ s16 scriptResult; /*0x1A*/ s16 scriptArr[3]; - /*0x20*/ u32 stack[8]; - /*0x40*/ u8 unk40; - /*0x41*/ u8 unk41; + /*0x20*/ const u8 *stack[8]; + /*0x40*/ u8 stackSize; + /*0x41*/ u8 contestantId; }; struct UnknownContestStruct5 diff --git a/ld_script.txt b/ld_script.txt index 5f9d35617..502515b49 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -203,7 +203,7 @@ SECTIONS { src/save.o(.text); src/mystery_event_script.o(.text); asm/field_effect_helpers.o(.text); - asm/contest_ai.o(.text); + src/contest_ai.o(.text); src/battle_anim_sound_tasks.o(.text); src/battle_controller_safari.o(.text); src/fldeff_sweetscent.o(.text); @@ -488,7 +488,7 @@ SECTIONS { data/cable_car.o(.rodata); src/save.o(.rodata); data/field_effect_helpers.o(.rodata); - data/contest_ai.o(.rodata); + src/contest_ai.o(.rodata); src/battle_controller_safari.o(.rodata); data/battle_anim_815A0D4.o(.rodata); src/learn_move.o(.rodata); diff --git a/src/contest_ai.c b/src/contest_ai.c index 059c351e9..3324ddf87 100644 --- a/src/contest_ai.c +++ b/src/contest_ai.c @@ -4,7 +4,6 @@ #include "contest_ai.h" #include "contest_effect.h" -extern u16 gSpecialVar_ContestCategory; extern u16 gContestMonConditions[]; extern const u8 *gAIScriptPtr; @@ -294,22 +293,22 @@ static bool8 sub_81563B0(u8); static void AIStackPushVar(const u8 *); static u8 AIStackPop(void); -void ContestAI_ResetAI(u8 var) +void ContestAI_ResetAI(u8 contestantAI) { int i; memset(eContestAI, 0, sizeof(struct ContestAIInfo)); - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) eContestAI->unk5[i] = 100; - eContestAI->unk41 = var; - eContestAI->unk40 = 0; - eContestAI->flags = gContestMons[eContestAI->unk41].flags; + eContestAI->contestantId = contestantAI; + eContestAI->stackSize = 0; + eContestAI->flags = gContestMons[eContestAI->contestantId].flags; } u8 ContestAI_GetActionToUse(void) { - while(eContestAI->flags != 0) + while (eContestAI->flags != 0) { if (eContestAI->flags & 1) { @@ -338,7 +337,7 @@ u8 ContestAI_GetActionToUse(void) static void ContestAI_DoAIProcessing(void) { - while(eContestAI->aiState != CONTESTAI_FINISHED) + while (eContestAI->aiState != CONTESTAI_FINISHED) { switch(eContestAI->aiState) { @@ -347,10 +346,10 @@ static void ContestAI_DoAIProcessing(void) case CONTESTAI_SETTING_UP: gAIScriptPtr = gContestAIs[eContestAI->unk10]; - if (gContestMons[eContestAI->unk41].moves[eContestAI->unk4] == 0) + if (gContestMons[eContestAI->contestantId].moves[eContestAI->unk4] == 0) eContestAI->unk2 = 0; // don't process a move that doesn't exist. else - eContestAI->unk2 = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + eContestAI->unk2 = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; eContestAI->aiState++; break; case CONTESTAI_PROCESSING: @@ -379,7 +378,7 @@ static u8 sub_81563B0(u8 var) { int i; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) if (shared192D0.turnOrder[i] == var) break; @@ -494,7 +493,7 @@ static void ContestAICmd_unk_0A(void) static void ContestAICmd_get_user_order(void) { - eContestAI->scriptResult = shared192D0.turnOrder[eContestAI->unk41]; + eContestAI->scriptResult = shared192D0.turnOrder[eContestAI->contestantId]; gAIScriptPtr += 1; } @@ -540,7 +539,7 @@ static void ContestAICmd_unk_0F(void) static void ContestAICmd_get_user_condition_maybe(void) { - eContestAI->scriptResult = sContestantStatus[eContestAI->unk41].condition / 10; + eContestAI->scriptResult = sContestantStatus[eContestAI->contestantId].condition / 10; gAIScriptPtr += 1; } @@ -586,7 +585,7 @@ static void ContestAICmd_unk_14(void) static void ContestAICmd_unk_15(void) { - eContestAI->scriptResult = sContestantStatus[eContestAI->unk41].unk4; + eContestAI->scriptResult = sContestantStatus[eContestAI->contestantId].unk4; gAIScriptPtr += 1; } @@ -632,7 +631,7 @@ static void ContestAICmd_unk_19(void) static void ContestAICmd_unk_1A(void) { - eContestAI->scriptResult = gContestMonConditions[eContestAI->unk41]; + eContestAI->scriptResult = gContestMonConditions[eContestAI->contestantId]; gAIScriptPtr += 1; } @@ -704,7 +703,7 @@ static void ContestAICmd_unk_21(void) static void ContestAICmd_get_move_excitement(void) { - eContestAI->scriptResult = Contest_GetMoveExcitement(gContestMons[eContestAI->unk41].moves[eContestAI->unk4]); + eContestAI->scriptResult = Contest_GetMoveExcitement(gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]); gAIScriptPtr += 1; } @@ -750,7 +749,7 @@ static void ContestAICmd_unk_26(void) static void ContestAICmd_get_move_effect(void) { - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; eContestAI->scriptResult = gContestMoves[move].effect; gAIScriptPtr += 1; @@ -778,7 +777,7 @@ static void ContestAICmd_unk_29(void) static void ContestAICmd_get_move_effect_type(void) { - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; eContestAI->scriptResult = gContestEffects[gContestMoves[move].effect].effectType; gAIScriptPtr += 1; @@ -807,12 +806,12 @@ static void ContestAICmd_unk_2C(void) static void ContestAICmd_check_move_has_highest_appeal(void) { int i; - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; u8 appeal = gContestEffects[gContestMoves[move].effect].appeal; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - u16 newMove = gContestMons[eContestAI->unk41].moves[i]; + u16 newMove = gContestMons[eContestAI->contestantId].moves[i]; if (newMove != 0 && appeal < gContestEffects[gContestMoves[newMove].effect].appeal) break; } @@ -838,12 +837,12 @@ static void ContestAICmd_unk_2E(void) static void ContestAICmd_unk_2F(void) { int i; - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; u8 jam = gContestEffects[gContestMoves[move].effect].jam; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - u16 newMove = gContestMons[eContestAI->unk41].moves[i]; + u16 newMove = gContestMons[eContestAI->contestantId].moves[i]; if (newMove != 0 && jam < gContestEffects[gContestMoves[newMove].effect].jam) break; } @@ -868,7 +867,7 @@ static void ContestAICmd_unk_30(void) static void ContestAICmd_unk_31(void) { - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; eContestAI->scriptResult = gContestEffects[gContestMoves[move].effect].appeal / 10; gAIScriptPtr += 1; @@ -916,7 +915,7 @@ static void ContestAICmd_unk_35(void) static void ContestAICmd_unk_36(void) { - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; eContestAI->scriptResult = gContestEffects[gContestMoves[move].effect].jam / 10; gAIScriptPtr += 1; @@ -965,12 +964,12 @@ static void ContestAICmd_unk_3A(void) static void ContestAICmd_get_move_used_count(void) { s16 result; - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; - if (move != sContestantStatus[eContestAI->unk41].prevMove) + if (move != sContestantStatus[eContestAI->contestantId].prevMove) result = 0; // move is unique and not reused. else - result = sContestantStatus[eContestAI->unk41].moveRepeatCount + 1; + result = sContestantStatus[eContestAI->contestantId].moveRepeatCount + 1; eContestAI->scriptResult = result; gAIScriptPtr += 1; @@ -1020,13 +1019,13 @@ static void ContestAICmd_check_combo_starter(void) { u8 result = 0; int i; - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - if (gContestMons[eContestAI->unk41].moves[i]) + if (gContestMons[eContestAI->contestantId].moves[i]) { - result = AreMovesContestCombo(move, gContestMons[eContestAI->unk41].moves[i]); + result = AreMovesContestCombo(move, gContestMons[eContestAI->contestantId].moves[i]); if (result) { result = 1; @@ -1066,13 +1065,13 @@ static void ContestAICmd_check_combo_finisher(void) { u8 result = 0; int i; - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - if (gContestMons[eContestAI->unk41].moves[i]) + if (gContestMons[eContestAI->contestantId].moves[i]) { - result = AreMovesContestCombo(gContestMons[eContestAI->unk41].moves[i], move); + result = AreMovesContestCombo(gContestMons[eContestAI->contestantId].moves[i], move); if (result) { result = 1; @@ -1111,10 +1110,10 @@ static void ContestAICmd_unk_45(void) static void ContestAICmd_check_would_finish_combo(void) { u8 result = 0; - u16 move = gContestMons[eContestAI->unk41].moves[eContestAI->unk4]; + u16 move = gContestMons[eContestAI->contestantId].moves[eContestAI->unk4]; - if (sContestantStatus[eContestAI->unk41].prevMove) - result = AreMovesContestCombo(sContestantStatus[eContestAI->unk41].prevMove, move); + if (sContestantStatus[eContestAI->contestantId].prevMove) + result = AreMovesContestCombo(sContestantStatus[eContestAI->contestantId].prevMove, move); if (result) result = 1; @@ -1305,7 +1304,7 @@ static void ContestAICmd_unk_59(void) { u8 var = sub_81563B0(gAIScriptPtr[1]); - eContestAI->scriptResult = sContestantStatus[var].unk4 - sContestantStatus[eContestAI->unk41].unk4; + eContestAI->scriptResult = sContestantStatus[var].unk4 - sContestantStatus[eContestAI->contestantId].unk4; gAIScriptPtr += 2; } @@ -1353,7 +1352,7 @@ static void ContestAICmd_unk_5E(void) { u8 var = sub_81563B0(gAIScriptPtr[1]); - eContestAI->scriptResult = gContestMonConditions[var] - gContestMonConditions[eContestAI->unk41]; + eContestAI->scriptResult = gContestMonConditions[var] - gContestMonConditions[eContestAI->contestantId]; gAIScriptPtr += 2; } @@ -1658,15 +1657,15 @@ static void ContestAICmd_unk_81(void) static void AIStackPushVar(const u8 *ptr) { - eContestAI->stack[eContestAI->unk40++] = (u32)ptr; + eContestAI->stack[eContestAI->stackSize++] = ptr; } static bool8 AIStackPop(void) { - if (eContestAI->unk40 != 0) + if (eContestAI->stackSize != 0) { - --eContestAI->unk40; - gAIScriptPtr = (u8 *)eContestAI->stack[eContestAI->unk40]; + --eContestAI->stackSize; + gAIScriptPtr = eContestAI->stack[eContestAI->stackSize]; return TRUE; } else @@ -1680,12 +1679,11 @@ static void ContestAICmd_check_for_exciting_move(void) int result = 0; int i; - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - if (gContestMons[eContestAI->unk41].moves[i]) + if (gContestMons[eContestAI->contestantId].moves[i]) { - // why is it using gSharedMem + 0x19325? that does not exist... - if (Contest_GetMoveExcitement(gContestMons[eContestAI->unk41].moves[i]) == 1) + if (Contest_GetMoveExcitement(gContestMons[eContestAI->contestantId].moves[i]) == 1) { result = 1; break; @@ -1723,9 +1721,9 @@ static void ContestAICmd_unk_85(void) int i; u16 arg = T1_READ_16(gAIScriptPtr + 1); - for(i = 0; i < 4; i++) + for (i = 0; i < 4; i++) { - u16 move = gContestMons[eContestAI->unk41].moves[i]; + u16 move = gContestMons[eContestAI->contestantId].moves[i]; if (move == arg) { result = 1; From dc6cf391cec2bdf1fd0717f6ece90d3b1a55fccd Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 15 Aug 2018 12:06:23 +0200 Subject: [PATCH 17/21] Make contest ai compile. --- src/pokemon_summary_screen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 7e20a2a92..53320544d 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -42,7 +42,6 @@ extern struct UnkStruct_61CC04 gUnknown_0861CC10; extern struct UnkStruct_61CC04 gUnknown_0861CBEC; extern struct UnkStruct_61CC04 gUnknown_0861CBF8; extern u16 gSummaryScreenWindow_Tilemap[]; -extern struct ContestEffect gContestEffects[]; extern struct WindowTemplate gUnknown_0861CC24; extern u8 gUnknown_0861CD2C[][3]; extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1]; From ac3f4fd99475912ce52fb88be76a0809d9b6fbed Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Wed, 15 Aug 2018 11:47:10 -0700 Subject: [PATCH 18/21] Continue documentation and cleanup of pokemon_summary_screen --- data/text/nature_names.inc | 102 -------------- include/pokemon_summary_screen.h | 8 ++ src/pokemon.c | 6 +- src/pokemon_summary_screen.c | 226 ++++++++++++++++--------------- 4 files changed, 127 insertions(+), 215 deletions(-) delete mode 100644 data/text/nature_names.inc diff --git a/data/text/nature_names.inc b/data/text/nature_names.inc deleted file mode 100644 index 31e2876e2..000000000 --- a/data/text/nature_names.inc +++ /dev/null @@ -1,102 +0,0 @@ -gHardyNatureName:: @ 861CAAC - .string "HARDY$" - -gLonelyNatureName:: @ 861CAB2 - .string "LONELY$" - -gBraveNatureName:: @ 861CAB9 - .string "BRAVE$" - -gAdamantNatureName:: @ 861CABF - .string "ADAMANT$" - -gNaughtyNatureName:: @ 861CAC7 - .string "NAUGHTY$" - -gBoldNatureName:: @ 861CACF - .string "BOLD$" - -gDocileNatureName:: @ 861CAD4 - .string "DOCILE$" - -gRelaxedNatureName:: @ 861CADB - .string "RELAXED$" - -gImpishNatureName:: @ 861CAE3 - .string "IMPISH$" - -gLaxNatureName:: @ 861CAEA - .string "LAX$" - -gTimidNatureName:: @ 861CAEE - .string "TIMID$" - -gHastyNatureName:: @ 861CAF4 - .string "HASTY$" - -gSeriousNatureName:: @ 861CAFA - .string "SERIOUS$" - -gJollyNatureName:: @ 861CB02 - .string "JOLLY$" - -gNaiveNatureName:: @ 861CB08 - .string "NAIVE$" - -gModestNatureName:: @ 861CB0E - .string "MODEST$" - -gMildNatureName:: @ 861CB15 - .string "MILD$" - -gQuietNatureName:: @ 861CB1A - .string "QUIET$" - -gBashfulNatureName:: @ 861CB20 - .string "BASHFUL$" - -gRashNatureName:: @ 861CB28 - .string "RASH$" - -gCalmNatureName:: @ 861CB2D - .string "CALM$" - -gGentleNatureName:: @ 861CB32 - .string "GENTLE$" - -gSassyNatureName:: @ 861CB39 - .string "SASSY$" - -gCarefulNatureName:: @ 861CB3F - .string "CAREFUL$" - -gQuirkyNatureName:: @ 861CB47 - .string "QUIRKY$" - - .align 2 -gNatureNamePointers:: @ 861CB50 - .4byte gHardyNatureName - .4byte gLonelyNatureName - .4byte gBraveNatureName - .4byte gAdamantNatureName - .4byte gNaughtyNatureName - .4byte gBoldNatureName - .4byte gDocileNatureName - .4byte gRelaxedNatureName - .4byte gImpishNatureName - .4byte gLaxNatureName - .4byte gTimidNatureName - .4byte gHastyNatureName - .4byte gSeriousNatureName - .4byte gJollyNatureName - .4byte gNaiveNatureName - .4byte gModestNatureName - .4byte gMildNatureName - .4byte gQuietNatureName - .4byte gBashfulNatureName - .4byte gRashNatureName - .4byte gCalmNatureName - .4byte gGentleNatureName - .4byte gSassyNatureName - .4byte gCarefulNatureName - .4byte gQuirkyNatureName diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 51175a36a..3d3b6f0e3 100755 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -14,4 +14,12 @@ enum PokemonSummaryScreenMode PSS_MODE_SELECT_MOVE, }; +enum PokemonSummaryScreenPage +{ + PSS_PAGE_INFO, + PSS_PAGE_SKILLS, + PSS_PAGE_BATTLE_MOVES, + PSS_PAGE_CONTEST_MOVES, +}; + #endif // GUARD_POKEMON_SUMMARY_SCREEN_H diff --git a/src/pokemon.c b/src/pokemon.c index 7c010cd39..76eaf65e3 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -89,7 +89,7 @@ extern u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerOpponentId); extern u8 sub_81D63C8(u16 trainerOpponentId); extern u8 GetFrontierOpponentClass(u16 trainerId); extern void GetFrontierTrainerName(u8* dest, u16 trainerId); -extern void sub_81C488C(u8); +extern void SummaryScreen_SetUnknownTaskId(u8); // this file's functions static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon); @@ -5723,7 +5723,7 @@ static void Task_PokemonSummaryAnimateAfterDelay(u8 taskId) if (--gTasks[taskId].data[3] == 0) { StartMonSummaryAnimation(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]); - sub_81C488C(0xFF); + SummaryScreen_SetUnknownTaskId(0xFF); DestroyTask(taskId); } } @@ -5790,7 +5790,7 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF STORE_PTR_IN_TASK(sprite, taskId, 0); gTasks[taskId].data[2] = sMonFrontAnimIdsTable[species - 1]; gTasks[taskId].data[3] = sMonAnimationDelayTable[species - 1]; - sub_81C488C(taskId); + SummaryScreen_SetUnknownTaskId(taskId); SetSpriteCB_MonAnimDummy(sprite); } else diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 347f38285..ef55129f4 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -87,10 +87,7 @@ static EWRAM_DATA struct UnkSummaryStruct u8 unk3E[9]; // 0x3E u32 OTID; // 0x48 } summary; - u16 bgTilemapBuffer1[0x800]; - u16 bgTilemapBuffer2[0x800]; - u16 bgTilemapBuffer3[0x800]; - u16 bgTilemapBuffer4[0x800]; + u16 bgTilemapBuffers[4][2][0x400]; u8 mode; bool8 isBoxMon; u8 curMonIndex; @@ -114,7 +111,7 @@ static EWRAM_DATA struct UnkSummaryStruct 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 sUnknownTaskId = 0; static EWRAM_DATA u8 gFiller_0203CF25[3] = {0}; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; @@ -131,8 +128,8 @@ struct UnkStruct_61CC04 // forward declarations bool8 sub_81B1250(void); -bool8 sub_81BFB10(void); -void sub_81BFAE4(void); +static bool8 SummaryScreen_LoadGraphics(void); +static void SummaryScreen_LoadingCB2(void); static void InitBGs(void); u8 sub_81BFEB0(void); void CopyMonToSummaryStruct(struct Pokemon* a); @@ -183,10 +180,10 @@ void sub_81C25E8(void); void sub_81C2628(void); void sub_81C2794(void); void sub_81C27DC(struct Pokemon *mon, u16 a); -void PrintRentalMonStatsPage(void); +static void PrintPageNamesAndStatsPage(void); void sub_81C2AFC(u8 a); void sub_81C2C38(u8 a); -void sub_81C2D68(u8 a); +void SummaryScreen_RemoveWindowByIndex(u8 a); void sub_81C2D9C(u8 a); void sub_81C2DE4(u8 a); void sub_81C2E00(void); @@ -220,8 +217,8 @@ void sub_81C39F0(u8 taskId); void PrintMoveNameAndPP(u8 a); void sub_81C3D08(void); void sub_81C3D54(u8 taskId); -void sub_81C3E2C(u8 a); -void sub_81C3E9C(u16 a); +void PrintContestMoveDescription(u8 a); +void PrintMoveDetails(u16 a); void PrintNewMoveDetailsOrCancelText(void); void sub_81C4064(void); void sub_81C40A0(u8 a, u8 b); @@ -239,13 +236,13 @@ 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); +void SummaryScreen_SetUnknownTaskId(u8 a); +void SummaryScreen_DestroyUnknownTask(void); 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 CreateMonMarkingsSprite(struct Pokemon *mon); +void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon); +void CreateCaughtBallSprite(struct Pokemon *mon); +void CreateSetStatusSprite(void); void sub_81C4AF8(u8 a); void sub_81C4BE4(struct Sprite *sprite); void sub_81C4C60(u8 a); @@ -635,7 +632,7 @@ static const struct SpriteTemplate gUnknown_0861D084 = .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; - const struct OamData gOamData_861D09C = +static const struct OamData gOamData_861D09C = { .y = 0, .affineMode = 0, @@ -679,7 +676,7 @@ static const union AnimCmd gSpriteAnim_861D0D4[] = { ANIMCMD_FRAME(24, 0, FALSE, FALSE), ANIMCMD_END }; - const union AnimCmd *const gSpriteAnimTable_861D0DC[] = { +static const union AnimCmd *const gSpriteAnimTable_861D0DC[] = { gSpriteAnim_861D0A4, gSpriteAnim_861D0AC, gSpriteAnim_861D0B4, @@ -746,12 +743,12 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, } gUnknown_0203CF1C->currPageIndex = gUnknown_0203CF1C->minPageIndex; - sub_81C488C(-1); + SummaryScreen_SetUnknownTaskId(-1); if (gMonSpritesGfxPtr == 0) sub_806F2AC(0, 0); - SetMainCallback2(sub_81BFAE4); + SetMainCallback2(SummaryScreen_LoadingCB2); } void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove) @@ -766,7 +763,7 @@ void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monInd gUnknown_0203CF1C->unk40EF = TRUE; } -void sub_81BFAB4(void) +static void SummaryScreen_MainCB2(void) { RunTasks(); AnimateSprites(); @@ -775,19 +772,19 @@ void sub_81BFAB4(void) UpdatePaletteFade(); } -void sub_81BFAD0(void) +static void SummaryScreen_VBlank(void) { LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); } -void sub_81BFAE4(void) +static void SummaryScreen_LoadingCB2(void) { - while (sub_81221EC() != TRUE && sub_81BFB10() != TRUE && sub_81221AC() != TRUE); + while (sub_81221EC() != TRUE && SummaryScreen_LoadGraphics() != TRUE && sub_81221AC() != TRUE); } -bool8 sub_81BFB10(void) +static bool8 SummaryScreen_LoadGraphics(void) { switch (gMain.state) { @@ -845,7 +842,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 12: - PrintRentalMonStatsPage(); + PrintPageNamesAndStatsPage(); gMain.state++; break; case 13: @@ -875,15 +872,15 @@ bool8 sub_81BFB10(void) } break; case 18: - sub_81C4984(&gUnknown_0203CF1C->currentMon); + CreateMonMarkingsSprite(&gUnknown_0203CF1C->currentMon); gMain.state++; break; case 19: - sub_81C4A08(&gUnknown_0203CF1C->currentMon); + CreateCaughtBallSprite(&gUnknown_0203CF1C->currentMon); gMain.state++; break; case 20: - sub_81C4A88(); + CreateSetStatusSprite(); gMain.state++; break; case 21: @@ -907,8 +904,8 @@ bool8 sub_81BFB10(void) gMain.state++; break; default: - SetVBlankCallback(sub_81BFAD0); - SetMainCallback2(sub_81BFAB4); + SetVBlankCallback(SummaryScreen_VBlank); + SetMainCallback2(SummaryScreen_MainCB2); return TRUE; } return FALSE; @@ -918,9 +915,9 @@ static void InitBGs(void) { ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_0861CBB4, ARRAY_COUNT(gUnknown_0861CBB4)); - SetBgTilemapBuffer(1, &gUnknown_0203CF1C->bgTilemapBuffer3); - SetBgTilemapBuffer(2, &gUnknown_0203CF1C->bgTilemapBuffer2); - SetBgTilemapBuffer(3, &gUnknown_0203CF1C->bgTilemapBuffer1); + SetBgTilemapBuffer(1, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]); + SetBgTilemapBuffer(2, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][0]); + SetBgTilemapBuffer(3, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0]); ResetAllBgsCoordinates(); schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); @@ -945,24 +942,24 @@ bool8 sub_81BFEB0(void) case 1: if (free_temp_tile_data_buffers_if_possible() != 1) { - LZDecompressWram(&gUnknown_08D9862C, &gUnknown_0203CF1C->bgTilemapBuffer1[0]); + LZDecompressWram(&gUnknown_08D9862C, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0]); gUnknown_0203CF1C->unk40F0++; } break; case 2: - LZDecompressWram(&gUnknown_08D98CC8, &gUnknown_0203CF1C->bgTilemapBuffer1[0x400]); + LZDecompressWram(&gUnknown_08D98CC8, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][1]); gUnknown_0203CF1C->unk40F0++; break; case 3: - LZDecompressWram(&gUnknown_08D987FC, &gUnknown_0203CF1C->bgTilemapBuffer2[0x400]); + LZDecompressWram(&gUnknown_08D987FC, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][1]); gUnknown_0203CF1C->unk40F0++; break; case 4: - LZDecompressWram(&gUnknown_08D9898C, &gUnknown_0203CF1C->bgTilemapBuffer3[0x400]); + LZDecompressWram(&gUnknown_08D9898C, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][1]); gUnknown_0203CF1C->unk40F0++; break; case 5: - LZDecompressWram(&gUnknown_08D98B28, &gUnknown_0203CF1C->bgTilemapBuffer4[0x400]); + LZDecompressWram(&gUnknown_08D98B28, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]); gUnknown_0203CF1C->unk40F0++; break; case 6: @@ -1087,7 +1084,7 @@ bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) void sub_81C0348(void) { - if (gUnknown_0203CF1C->currPageIndex != 2 && gUnknown_0203CF1C->currPageIndex != 3) + if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_BATTLE_MOVES && gUnknown_0203CF1C->currPageIndex != PSS_PAGE_CONTEST_MOVES) { sub_81C1DA4(0, 255); sub_81C1EFC(0, 255, 0); @@ -1095,10 +1092,10 @@ void sub_81C0348(void) else { 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); + sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 0); + sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 0); + SetBgTilemapBuffer(1, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0]); + SetBgTilemapBuffer(2, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]); ChangeBgX(2, 0x10000, 1); ClearWindowTilemap(19); ClearWindowTilemap(13); @@ -1109,7 +1106,7 @@ void sub_81C0348(void) } else { - if (gUnknown_0203CF1C->currPageIndex != 2 && gUnknown_0203CF1C->currPageIndex != 3) + if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_BATTLE_MOVES && gUnknown_0203CF1C->currPageIndex != PSS_PAGE_CONTEST_MOVES) PutWindowTilemap(13); } sub_81C2524(); @@ -1134,7 +1131,7 @@ void sub_81C0484(u8 taskId) { SetMainCallback2(gUnknown_0203CF1C->callback); gUnknown_0203CF20 = gUnknown_0203CF1C->curMonIndex; - DestoryUnusedTask(); + SummaryScreen_DestroyUnknownTask(); ResetSpriteData(); FreeAllSpritePalettes(); StopCryAndClearCrySongs(); @@ -1168,9 +1165,9 @@ void sub_81C0510(u8 taskId) } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->currPageIndex != 1) + if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_SKILLS) { - if (gUnknown_0203CF1C->currPageIndex == 0) + if (gUnknown_0203CF1C->currPageIndex == PSS_PAGE_INFO) { sub_81C48F0(); PlaySE(SE_SELECT); @@ -1200,7 +1197,7 @@ void sub_81C0604(u8 taskId, s8 a) { if (gUnknown_0203CF1C->isBoxMon == TRUE) { - if (gUnknown_0203CF1C->currPageIndex != 0) + if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_INFO) { if (a == 1) a = 0; @@ -1252,7 +1249,7 @@ void sub_81C0704(u8 taskId) StopCryAndClearCrySongs(); break; case 1: - DestoryUnusedTask(); + SummaryScreen_DestroyUnknownTask(); DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[0]]); break; case 2: @@ -1267,10 +1264,10 @@ void sub_81C0704(u8 taskId) return; break; case 5: - sub_81C49E0(&gUnknown_0203CF1C->currentMon); + RemoveAndCreateMonMarkingsSprite(&gUnknown_0203CF1C->currentMon); break; case 6: - sub_81C4A08(&gUnknown_0203CF1C->currentMon); + CreateCaughtBallSprite(&gUnknown_0203CF1C->currentMon); break; case 7: if (gUnknown_0203CF1C->summary.unk7) @@ -1314,13 +1311,14 @@ s8 sub_81C08F8(s8 a) { struct Pokemon *mon = gUnknown_0203CF1C->monList.mons; - if (gUnknown_0203CF1C->currPageIndex == 0) + if (gUnknown_0203CF1C->currPageIndex == PSS_PAGE_INFO) { if (a == -1 && gUnknown_0203CF1C->curMonIndex == 0) return -1; - if (a == 1 && gUnknown_0203CF1C->curMonIndex >= gUnknown_0203CF1C->maxMonIndex) + else if (a == 1 && gUnknown_0203CF1C->curMonIndex >= gUnknown_0203CF1C->maxMonIndex) return -1; - return gUnknown_0203CF1C->curMonIndex + a; + else + return gUnknown_0203CF1C->curMonIndex + a; } else { @@ -1419,7 +1417,7 @@ void sub_81C0B8C(u8 taskId) schedule_bg_copy_tilemap_to_vram(2); } ChangeBgX(data[1], 0, 0); - SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->currPageIndex << 12) + 0xBC)); + SetBgTilemapBuffer(data[1], gUnknown_0203CF1C->bgTilemapBuffers[gUnknown_0203CF1C->currPageIndex][0]); ShowBg(1); ShowBg(2); } @@ -1512,9 +1510,9 @@ void sub_81C0E48(u8 taskId) ClearWindowTilemap(5); PutWindowTilemap(6); } - sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 0); - sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 0); - sub_81C3E9C(move); + sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 0); + sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 0); + PrintMoveDetails(move); PrintNewMoveDetailsOrCancelText(); sub_81C44F0(); schedule_bg_copy_tilemap_to_vram(0); @@ -1605,7 +1603,7 @@ void sub_81C1070(s16 *a, s8 b, u8 *c) sub_81C240C(move); schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); - sub_81C3E9C(move); + PrintMoveDetails(move); if ((*c == 4 && gUnknown_0203CF1C->newMove == MOVE_NONE) || a[1] == 1) { ClearWindowTilemap(19); @@ -1635,9 +1633,9 @@ void sub_81C11F4(u8 taskId) sub_81C4C60(8); ClearWindowTilemap(6); PutWindowTilemap(5); - sub_81C3E9C(0); - sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer3[0], 3, 1); - sub_81C2194(&gUnknown_0203CF1C->bgTilemapBuffer4[0], 1, 1); + PrintMoveDetails(0); + sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 1); + sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 1); sub_81C4064(); if (gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) { @@ -1721,7 +1719,7 @@ void sub_81C13B0(u8 taskId, bool8 b) } move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; - sub_81C3E9C(move); + PrintMoveDetails(move); sub_81C240C(move); schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); @@ -2288,7 +2286,7 @@ void sub_81C1940(u8 taskId) if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) ClearWindowTilemap(13); move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; - sub_81C3E9C(move); + PrintMoveDetails(move); schedule_bg_copy_tilemap_to_vram(0); sub_81C1DA4(9, -3); sub_81C1EFC(9, -3, move); @@ -2402,7 +2400,7 @@ void sub_81C1DA4(u16 a, s16 b) b = gUnknown_0861CC04.field_6; if (b == 0 || b == gUnknown_0861CC04.field_6) { - sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->bgTilemapBuffer3[0], b, 1); + sub_81C1CB0(&gUnknown_0861CC04, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], b, 1); } else { @@ -2428,7 +2426,7 @@ void sub_81C1E20(u8 taskId) { data[1] = gUnknown_0861CC04.field_6; } - sub_81C1CB0(&gUnknown_0861CC04, &gUnknown_0203CF1C->bgTilemapBuffer3[0], data[1], 1); + sub_81C1CB0(&gUnknown_0861CC04, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], data[1], 1); if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6) { if (data[0] < 0) @@ -2454,7 +2452,7 @@ 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) - sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->bgTilemapBuffer4[0], b, 1); + sub_81C1CB0(&gUnknown_0861CC10, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], b, 1); else { u8 taskId = FindTaskIdByFunc(sub_81C1F80); @@ -2478,7 +2476,7 @@ void sub_81C1F80(u8 taskId) { data[1] = gUnknown_0861CC10.field_6; } - sub_81C1CB0(&gUnknown_0861CC10, &gUnknown_0203CF1C->bgTilemapBuffer4[0], data[1], 1); + sub_81C1CB0(&gUnknown_0861CC10, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], data[1], 1); if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6) { if (data[0] < 0) @@ -2508,8 +2506,8 @@ void sub_81C2074(u16 a, s16 b) b = gUnknown_0861CBEC.field_6; if (b == 0 || b == gUnknown_0861CBEC.field_6) { - sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->bgTilemapBuffer1[0], b, 0); - sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->bgTilemapBuffer1[0], b, 0); + sub_81C1CB0(&gUnknown_0861CBEC, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0); + sub_81C1CB0(&gUnknown_0861CBF8, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0); } else { @@ -2527,14 +2525,14 @@ void sub_81C20F0(u8 taskId) data[1] = 0; else if (data[1] > gUnknown_0861CBEC.field_6) data[1] = gUnknown_0861CBEC.field_6; - sub_81C1CB0(&gUnknown_0861CBEC, &gUnknown_0203CF1C->bgTilemapBuffer1[0], data[1], 0); - sub_81C1CB0(&gUnknown_0861CBF8, &gUnknown_0203CF1C->bgTilemapBuffer1[0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBEC, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBF8, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0); schedule_bg_copy_tilemap_to_vram(3); if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6) { if (data[0] < 0) { - sub_81C4A88(); + CreateSetStatusSprite(); PutWindowTilemap(13); schedule_bg_copy_tilemap_to_vram(0); } @@ -2573,13 +2571,13 @@ void sub_81C2228(struct Pokemon *mon) { if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0)) { - gUnknown_0203CF1C->bgTilemapBuffer1[0x223] = 0x2C; - gUnknown_0203CF1C->bgTilemapBuffer1[0x623] = 0x2C; + gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x2C; + gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x2C; } else { - gUnknown_0203CF1C->bgTilemapBuffer1[0x223] = 0x81A; - gUnknown_0203CF1C->bgTilemapBuffer1[0x623] = 0x81A; + gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x81A; + gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x81A; } schedule_bg_copy_tilemap_to_vram(3); } @@ -2614,7 +2612,7 @@ void sub_81C22CC(struct Pokemon *unused) r6r7 = 0; } - r9 = &gUnknown_0203CF1C->bgTilemapBuffer2[0x655]; + r9 = &gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255]; for (i = 0; i < 8; i++) { if (r6r7 > 7) @@ -2626,7 +2624,7 @@ void sub_81C22CC(struct Pokemon *unused) r6r7 = 0; } - if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->bgTilemapBuffer2) + if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][0]) schedule_bg_copy_tilemap_to_vram(1); else schedule_bg_copy_tilemap_to_vram(2); @@ -2634,7 +2632,7 @@ void sub_81C22CC(struct Pokemon *unused) void sub_81C240C(u16 move) { - u16* tilemap = &gUnknown_0203CF1C->bgTilemapBuffer4[0x400]; + u16 *tilemap = gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]; u8 i; u8 effectValue; @@ -2778,10 +2776,10 @@ void sub_81C27DC(struct Pokemon *mon, u16 a) u8 gender = GetMonGender(mon); switch (gender) { - case 0: + case MON_MALE: SummaryScreen_PrintTextOnWindow(19, &gText_MaleSymbol[0], 57, 17, 0, 3); break; - case 0xFE: + case MON_FEMALE: SummaryScreen_PrintTextOnWindow(19, &gText_FemaleSymbol[0], 57, 17, 0, 4); break; } @@ -2793,7 +2791,7 @@ void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x) BlitBitmapToWindow(windowId, (bButton) ? gUnknown_0861CDD3 : gUnknown_0861CDD3 - 0x80, x, 0, 16, 16); } -void PrintRentalMonStatsPage(void) +static void PrintPageNamesAndStatsPage(void) { int stringXPos; int iconXPos; @@ -2804,7 +2802,7 @@ void PrintRentalMonStatsPage(void) SummaryScreen_PrintTextOnWindow(2, gText_BattleMoves, 2, 1, 0, 1); SummaryScreen_PrintTextOnWindow(3, gText_ContestMoves, 2, 1, 0, 1); - stringXPos = GetStringRightAlignXOffset(1, gText_Cancel2, 0x3E); + stringXPos = GetStringRightAlignXOffset(1, gText_Cancel2, 62); iconXPos = stringXPos - 16; if (iconXPos < 0) iconXPos = 0; @@ -2851,10 +2849,12 @@ void PrintRentalMonStatsPage(void) void sub_81C2AFC(u8 a) { u8 i; + ClearWindowTilemap(0); ClearWindowTilemap(1); ClearWindowTilemap(2); ClearWindowTilemap(3); + switch (a) { case 0: @@ -2895,10 +2895,12 @@ void sub_81C2AFC(u8 a) } break; } + for (i = 0; i < 8; i++) { PutWindowTilemap(gUnknown_0203CF1C->windowIds[i]); } + schedule_bg_copy_tilemap_to_vram(0); } @@ -2941,8 +2943,12 @@ void sub_81C2C38(u8 a) } break; } + for (i = 0; i < 8; i++) - sub_81C2D68(i); + { + SummaryScreen_RemoveWindowByIndex(i); + } + schedule_bg_copy_tilemap_to_vram(0); } @@ -2957,9 +2963,9 @@ u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateI return *windowIdPtr; } -void sub_81C2D68(u8 a) +void SummaryScreen_RemoveWindowByIndex(u8 windowIndex) { - u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[a]); + u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[windowIndex]); if (*windowIdPtr != 0xFF) { ClearWindowTilemap(*windowIdPtr); @@ -3428,11 +3434,11 @@ void sub_81C3984(void) if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES) { if (gUnknown_0203CF1C->newMove != MOVE_NONE) - sub_81C3E9C(gUnknown_0203CF1C->newMove); + PrintMoveDetails(gUnknown_0203CF1C->newMove); } else { - sub_81C3E9C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]); + PrintMoveDetails(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]); } } } @@ -3472,7 +3478,7 @@ void sub_81C39F0(u8 taskId) if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) - sub_81C3E9C(data[1]); + PrintMoveDetails(data[1]); } break; case 8: @@ -3561,7 +3567,7 @@ void sub_81C3D08(void) if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { PrintNewMoveDetailsOrCancelText(); - sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex); + PrintContestMoveDescription(gUnknown_0203CF1C->firstMoveIndex); } } @@ -3592,7 +3598,7 @@ void sub_81C3D54(u8 taskId) if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) { if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) - sub_81C3E2C(gUnknown_0203CF1C->firstMoveIndex); + PrintContestMoveDescription(gUnknown_0203CF1C->firstMoveIndex); } break; case 6: @@ -3602,7 +3608,7 @@ void sub_81C3D54(u8 taskId) data[0]++; } -void sub_81C3E2C(u8 moveSlot) +void PrintContestMoveDescription(u8 moveSlot) { u16 move; @@ -3618,7 +3624,7 @@ void sub_81C3E2C(u8 moveSlot) } } -void sub_81C3E9C(u16 move) +void PrintMoveDetails(u16 move) { u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2); FillWindowPixelBuffer(windowId, 0); @@ -3707,7 +3713,7 @@ void sub_81C4190(void) gUnknown_0203CF1C->spriteIds[i] |= 0xFF; } -void sub_81C41C0(u8 spriteArrayId) +void DestroySpriteInArray(u8 spriteArrayId) { if (gUnknown_0203CF1C->spriteIds[spriteArrayId] != 0xFF) { @@ -3966,21 +3972,21 @@ void sub_81C4844(struct Sprite *sprite) } } -void sub_81C488C(u8 a0) +void SummaryScreen_SetUnknownTaskId(u8 a0) { - sUnusedTaskId = a0; + sUnknownTaskId = a0; } -void DestoryUnusedTask(void) +void SummaryScreen_DestroyUnknownTask(void) { - if (sUnusedTaskId != 0xFF) + if (sUnknownTaskId != 0xFF) { - DestroyTask(sUnusedTaskId); - sUnusedTaskId = 0xFF; + DestroyTask(sUnknownTaskId); + sUnknownTaskId = 0xFF; } } -bool32 sub_81C48B4(void) +bool32 DoesSpriteHaveCallback(void) { if (gSprites[gUnknown_0203CF1C->spriteIds[0]].callback == SpriteCallbackDummy) { @@ -4009,7 +4015,7 @@ void sub_81C48F0(void) } } -void sub_81C4984(struct Pokemon *mon) +void CreateMonMarkingsSprite(struct Pokemon *mon) { struct Sprite *sprite = sub_811FF94(30003, 30003, gUnknown_0861D120); @@ -4024,14 +4030,14 @@ void sub_81C4984(struct Pokemon *mon) } } -void sub_81C49E0(struct Pokemon *mon) +void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon) { DestroySprite(gUnknown_0203CF1C->markingsSprite); FreeSpriteTilesByTag(30003); - sub_81C4984(mon); + CreateMonMarkingsSprite(mon); } -void sub_81C4A08(struct Pokemon *mon) +void CreateCaughtBallSprite(struct Pokemon *mon) { u8 ball = ItemIdToBallId(GetMonData(mon, MON_DATA_POKEBALL)); @@ -4041,7 +4047,7 @@ void sub_81C4A08(struct Pokemon *mon) gSprites[gUnknown_0203CF1C->spriteIds[1]].oam.priority = 3; } -void sub_81C4A88(void) +void CreateSetStatusSprite(void) { u8 *spriteId = &gUnknown_0203CF1C->spriteIds[2]; u8 anim; @@ -4134,7 +4140,7 @@ void sub_81C4C60(u8 a0) u8 i; for (i = 0; i < 10; i++) { - sub_81C41C0(a0 + i); + DestroySpriteInArray(a0 + i); } } From 8896b54e8f45528fc6c21cd55cdace2ad03b2796 Mon Sep 17 00:00:00 2001 From: Tetrable Date: Wed, 15 Aug 2018 20:10:28 +0100 Subject: [PATCH 19/21] Add national/hoenn dex defines, update dex arrays --- include/constants/species.h | 832 +++++++++++++++++++++++ src/pokemon.c | 1250 ++++++++++++++++++++++++++++++++++- 2 files changed, 2079 insertions(+), 3 deletions(-) diff --git a/include/constants/species.h b/include/constants/species.h index f698ada14..cd9b13743 100644 --- a/include/constants/species.h +++ b/include/constants/species.h @@ -447,4 +447,836 @@ #define NUM_SPECIES SPECIES_EGG +// National Dex Index Defines + +#define NATIONAL_DEX_BULBASAUR 1 +#define NATIONAL_DEX_IVYSAUR 2 +#define NATIONAL_DEX_VENUSAUR 3 +#define NATIONAL_DEX_CHARMANDER 4 +#define NATIONAL_DEX_CHARMELEON 5 +#define NATIONAL_DEX_CHARIZARD 6 +#define NATIONAL_DEX_SQUIRTLE 7 +#define NATIONAL_DEX_WARTORTLE 8 +#define NATIONAL_DEX_BLASTOISE 9 +#define NATIONAL_DEX_CATERPIE 10 +#define NATIONAL_DEX_METAPOD 11 +#define NATIONAL_DEX_BUTTERFREE 12 +#define NATIONAL_DEX_WEEDLE 13 +#define NATIONAL_DEX_KAKUNA 14 +#define NATIONAL_DEX_BEEDRILL 15 +#define NATIONAL_DEX_PIDGEY 16 +#define NATIONAL_DEX_PIDGEOTTO 17 +#define NATIONAL_DEX_PIDGEOT 18 +#define NATIONAL_DEX_RATTATA 19 +#define NATIONAL_DEX_RATICATE 20 +#define NATIONAL_DEX_SPEAROW 21 +#define NATIONAL_DEX_FEAROW 22 +#define NATIONAL_DEX_EKANS 23 +#define NATIONAL_DEX_ARBOK 24 +#define NATIONAL_DEX_PIKACHU 25 +#define NATIONAL_DEX_RAICHU 26 +#define NATIONAL_DEX_SANDSHREW 27 +#define NATIONAL_DEX_SANDSLASH 28 +#define NATIONAL_DEX_NIDORAN_F 29 +#define NATIONAL_DEX_NIDORINA 30 +#define NATIONAL_DEX_NIDOQUEEN 31 +#define NATIONAL_DEX_NIDORAN_M 32 +#define NATIONAL_DEX_NIDORINO 33 +#define NATIONAL_DEX_NIDOKING 34 +#define NATIONAL_DEX_CLEFAIRY 35 +#define NATIONAL_DEX_CLEFABLE 36 +#define NATIONAL_DEX_VULPIX 37 +#define NATIONAL_DEX_NINETALES 38 +#define NATIONAL_DEX_JIGGLYPUFF 39 +#define NATIONAL_DEX_WIGGLYTUFF 40 +#define NATIONAL_DEX_ZUBAT 41 +#define NATIONAL_DEX_GOLBAT 42 +#define NATIONAL_DEX_ODDISH 43 +#define NATIONAL_DEX_GLOOM 44 +#define NATIONAL_DEX_VILEPLUME 45 +#define NATIONAL_DEX_PARAS 46 +#define NATIONAL_DEX_PARASECT 47 +#define NATIONAL_DEX_VENONAT 48 +#define NATIONAL_DEX_VENOMOTH 49 +#define NATIONAL_DEX_DIGLETT 50 +#define NATIONAL_DEX_DUGTRIO 51 +#define NATIONAL_DEX_MEOWTH 52 +#define NATIONAL_DEX_PERSIAN 53 +#define NATIONAL_DEX_PSYDUCK 54 +#define NATIONAL_DEX_GOLDUCK 55 +#define NATIONAL_DEX_MANKEY 56 +#define NATIONAL_DEX_PRIMEAPE 57 +#define NATIONAL_DEX_GROWLITHE 58 +#define NATIONAL_DEX_ARCANINE 59 +#define NATIONAL_DEX_POLIWAG 60 +#define NATIONAL_DEX_POLIWHIRL 61 +#define NATIONAL_DEX_POLIWRATH 62 +#define NATIONAL_DEX_ABRA 63 +#define NATIONAL_DEX_KADABRA 64 +#define NATIONAL_DEX_ALAKAZAM 65 +#define NATIONAL_DEX_MACHOP 66 +#define NATIONAL_DEX_MACHOKE 67 +#define NATIONAL_DEX_MACHAMP 68 +#define NATIONAL_DEX_BELLSPROUT 69 +#define NATIONAL_DEX_WEEPINBELL 70 +#define NATIONAL_DEX_VICTREEBEL 71 +#define NATIONAL_DEX_TENTACOOL 72 +#define NATIONAL_DEX_TENTACRUEL 73 +#define NATIONAL_DEX_GEODUDE 74 +#define NATIONAL_DEX_GRAVELER 75 +#define NATIONAL_DEX_GOLEM 76 +#define NATIONAL_DEX_PONYTA 77 +#define NATIONAL_DEX_RAPIDASH 78 +#define NATIONAL_DEX_SLOWPOKE 79 +#define NATIONAL_DEX_SLOWBRO 80 +#define NATIONAL_DEX_MAGNEMITE 81 +#define NATIONAL_DEX_MAGNETON 82 +#define NATIONAL_DEX_FARFETCHD 83 +#define NATIONAL_DEX_DODUO 84 +#define NATIONAL_DEX_DODRIO 85 +#define NATIONAL_DEX_SEEL 86 +#define NATIONAL_DEX_DEWGONG 87 +#define NATIONAL_DEX_GRIMER 88 +#define NATIONAL_DEX_MUK 89 +#define NATIONAL_DEX_SHELLDER 90 +#define NATIONAL_DEX_CLOYSTER 91 +#define NATIONAL_DEX_GASTLY 92 +#define NATIONAL_DEX_HAUNTER 93 +#define NATIONAL_DEX_GENGAR 94 +#define NATIONAL_DEX_ONIX 95 +#define NATIONAL_DEX_DROWZEE 96 +#define NATIONAL_DEX_HYPNO 97 +#define NATIONAL_DEX_KRABBY 98 +#define NATIONAL_DEX_KINGLER 99 +#define NATIONAL_DEX_VOLTORB 100 +#define NATIONAL_DEX_ELECTRODE 101 +#define NATIONAL_DEX_EXEGGCUTE 102 +#define NATIONAL_DEX_EXEGGUTOR 103 +#define NATIONAL_DEX_CUBONE 104 +#define NATIONAL_DEX_MAROWAK 105 +#define NATIONAL_DEX_HITMONLEE 106 +#define NATIONAL_DEX_HITMONCHAN 107 +#define NATIONAL_DEX_LICKITUNG 108 +#define NATIONAL_DEX_KOFFING 109 +#define NATIONAL_DEX_WEEZING 110 +#define NATIONAL_DEX_RHYHORN 111 +#define NATIONAL_DEX_RHYDON 112 +#define NATIONAL_DEX_CHANSEY 113 +#define NATIONAL_DEX_TANGELA 114 +#define NATIONAL_DEX_KANGASKHAN 115 +#define NATIONAL_DEX_HORSEA 116 +#define NATIONAL_DEX_SEADRA 117 +#define NATIONAL_DEX_GOLDEEN 118 +#define NATIONAL_DEX_SEAKING 119 +#define NATIONAL_DEX_STARYU 120 +#define NATIONAL_DEX_STARMIE 121 +#define NATIONAL_DEX_MR_MIME 122 +#define NATIONAL_DEX_SCYTHER 123 +#define NATIONAL_DEX_JYNX 124 +#define NATIONAL_DEX_ELECTABUZZ 125 +#define NATIONAL_DEX_MAGMAR 126 +#define NATIONAL_DEX_PINSIR 127 +#define NATIONAL_DEX_TAUROS 128 +#define NATIONAL_DEX_MAGIKARP 129 +#define NATIONAL_DEX_GYARADOS 130 +#define NATIONAL_DEX_LAPRAS 131 +#define NATIONAL_DEX_DITTO 132 +#define NATIONAL_DEX_EEVEE 133 +#define NATIONAL_DEX_VAPOREON 134 +#define NATIONAL_DEX_JOLTEON 135 +#define NATIONAL_DEX_FLAREON 136 +#define NATIONAL_DEX_PORYGON 137 +#define NATIONAL_DEX_OMANYTE 138 +#define NATIONAL_DEX_OMASTAR 139 +#define NATIONAL_DEX_KABUTO 140 +#define NATIONAL_DEX_KABUTOPS 141 +#define NATIONAL_DEX_AERODACTYL 142 +#define NATIONAL_DEX_SNORLAX 143 +#define NATIONAL_DEX_ARTICUNO 144 +#define NATIONAL_DEX_ZAPDOS 145 +#define NATIONAL_DEX_MOLTRES 146 +#define NATIONAL_DEX_DRATINI 147 +#define NATIONAL_DEX_DRAGONAIR 148 +#define NATIONAL_DEX_DRAGONITE 149 +#define NATIONAL_DEX_MEWTWO 150 +#define NATIONAL_DEX_MEW 151 +#define NATIONAL_DEX_CHIKORITA 152 +#define NATIONAL_DEX_BAYLEEF 153 +#define NATIONAL_DEX_MEGANIUM 154 +#define NATIONAL_DEX_CYNDAQUIL 155 +#define NATIONAL_DEX_QUILAVA 156 +#define NATIONAL_DEX_TYPHLOSION 157 +#define NATIONAL_DEX_TOTODILE 158 +#define NATIONAL_DEX_CROCONAW 159 +#define NATIONAL_DEX_FERALIGATR 160 +#define NATIONAL_DEX_SENTRET 161 +#define NATIONAL_DEX_FURRET 162 +#define NATIONAL_DEX_HOOTHOOT 163 +#define NATIONAL_DEX_NOCTOWL 164 +#define NATIONAL_DEX_LEDYBA 165 +#define NATIONAL_DEX_LEDIAN 166 +#define NATIONAL_DEX_SPINARAK 167 +#define NATIONAL_DEX_ARIADOS 168 +#define NATIONAL_DEX_CROBAT 169 +#define NATIONAL_DEX_CHINCHOU 170 +#define NATIONAL_DEX_LANTURN 171 +#define NATIONAL_DEX_PICHU 172 +#define NATIONAL_DEX_CLEFFA 173 +#define NATIONAL_DEX_IGGLYBUFF 174 +#define NATIONAL_DEX_TOGEPI 175 +#define NATIONAL_DEX_TOGETIC 176 +#define NATIONAL_DEX_NATU 177 +#define NATIONAL_DEX_XATU 178 +#define NATIONAL_DEX_MAREEP 179 +#define NATIONAL_DEX_FLAAFFY 180 +#define NATIONAL_DEX_AMPHAROS 181 +#define NATIONAL_DEX_BELLOSSOM 182 +#define NATIONAL_DEX_MARILL 183 +#define NATIONAL_DEX_AZUMARILL 184 +#define NATIONAL_DEX_SUDOWOODO 185 +#define NATIONAL_DEX_POLITOED 186 +#define NATIONAL_DEX_HOPPIP 187 +#define NATIONAL_DEX_SKIPLOOM 188 +#define NATIONAL_DEX_JUMPLUFF 189 +#define NATIONAL_DEX_AIPOM 190 +#define NATIONAL_DEX_SUNKERN 191 +#define NATIONAL_DEX_SUNFLORA 192 +#define NATIONAL_DEX_YANMA 193 +#define NATIONAL_DEX_WOOPER 194 +#define NATIONAL_DEX_QUAGSIRE 195 +#define NATIONAL_DEX_ESPEON 196 +#define NATIONAL_DEX_UMBREON 197 +#define NATIONAL_DEX_MURKROW 198 +#define NATIONAL_DEX_SLOWKING 199 +#define NATIONAL_DEX_MISDREAVUS 200 +#define NATIONAL_DEX_UNOWN 201 +#define NATIONAL_DEX_WOBBUFFET 202 +#define NATIONAL_DEX_GIRAFARIG 203 +#define NATIONAL_DEX_PINECO 204 +#define NATIONAL_DEX_FORRETRESS 205 +#define NATIONAL_DEX_DUNSPARCE 206 +#define NATIONAL_DEX_GLIGAR 207 +#define NATIONAL_DEX_STEELIX 208 +#define NATIONAL_DEX_SNUBBULL 209 +#define NATIONAL_DEX_GRANBULL 210 +#define NATIONAL_DEX_QWILFISH 211 +#define NATIONAL_DEX_SCIZOR 212 +#define NATIONAL_DEX_SHUCKLE 213 +#define NATIONAL_DEX_HERACROSS 214 +#define NATIONAL_DEX_SNEASEL 215 +#define NATIONAL_DEX_TEDDIURSA 216 +#define NATIONAL_DEX_URSARING 217 +#define NATIONAL_DEX_SLUGMA 218 +#define NATIONAL_DEX_MAGCARGO 219 +#define NATIONAL_DEX_SWINUB 220 +#define NATIONAL_DEX_PILOSWINE 221 +#define NATIONAL_DEX_CORSOLA 222 +#define NATIONAL_DEX_REMORAID 223 +#define NATIONAL_DEX_OCTILLERY 224 +#define NATIONAL_DEX_DELIBIRD 225 +#define NATIONAL_DEX_MANTINE 226 +#define NATIONAL_DEX_SKARMORY 227 +#define NATIONAL_DEX_HOUNDOUR 228 +#define NATIONAL_DEX_HOUNDOOM 229 +#define NATIONAL_DEX_KINGDRA 230 +#define NATIONAL_DEX_PHANPY 231 +#define NATIONAL_DEX_DONPHAN 232 +#define NATIONAL_DEX_PORYGON2 233 +#define NATIONAL_DEX_STANTLER 234 +#define NATIONAL_DEX_SMEARGLE 235 +#define NATIONAL_DEX_TYROGUE 236 +#define NATIONAL_DEX_HITMONTOP 237 +#define NATIONAL_DEX_SMOOCHUM 238 +#define NATIONAL_DEX_ELEKID 239 +#define NATIONAL_DEX_MAGBY 240 +#define NATIONAL_DEX_MILTANK 241 +#define NATIONAL_DEX_BLISSEY 242 +#define NATIONAL_DEX_RAIKOU 243 +#define NATIONAL_DEX_ENTEI 244 +#define NATIONAL_DEX_SUICUNE 245 +#define NATIONAL_DEX_LARVITAR 246 +#define NATIONAL_DEX_PUPITAR 247 +#define NATIONAL_DEX_TYRANITAR 248 +#define NATIONAL_DEX_LUGIA 249 +#define NATIONAL_DEX_HO_OH 250 +#define NATIONAL_DEX_CELEBI 251 + +#define NATIONAL_DEX_OLD_UNOWN_B 387 +#define NATIONAL_DEX_OLD_UNOWN_C 388 +#define NATIONAL_DEX_OLD_UNOWN_D 389 +#define NATIONAL_DEX_OLD_UNOWN_E 390 +#define NATIONAL_DEX_OLD_UNOWN_F 391 +#define NATIONAL_DEX_OLD_UNOWN_G 392 +#define NATIONAL_DEX_OLD_UNOWN_H 393 +#define NATIONAL_DEX_OLD_UNOWN_I 394 +#define NATIONAL_DEX_OLD_UNOWN_J 395 +#define NATIONAL_DEX_OLD_UNOWN_K 396 +#define NATIONAL_DEX_OLD_UNOWN_L 397 +#define NATIONAL_DEX_OLD_UNOWN_M 398 +#define NATIONAL_DEX_OLD_UNOWN_N 399 +#define NATIONAL_DEX_OLD_UNOWN_O 400 +#define NATIONAL_DEX_OLD_UNOWN_P 401 +#define NATIONAL_DEX_OLD_UNOWN_Q 402 +#define NATIONAL_DEX_OLD_UNOWN_R 403 +#define NATIONAL_DEX_OLD_UNOWN_S 404 +#define NATIONAL_DEX_OLD_UNOWN_T 405 +#define NATIONAL_DEX_OLD_UNOWN_U 406 +#define NATIONAL_DEX_OLD_UNOWN_V 407 +#define NATIONAL_DEX_OLD_UNOWN_W 408 +#define NATIONAL_DEX_OLD_UNOWN_X 409 +#define NATIONAL_DEX_OLD_UNOWN_Y 410 +#define NATIONAL_DEX_OLD_UNOWN_Z 411 + +#define NATIONAL_DEX_TREECKO 252 +#define NATIONAL_DEX_GROVYLE 253 +#define NATIONAL_DEX_SCEPTILE 254 +#define NATIONAL_DEX_TORCHIC 255 +#define NATIONAL_DEX_COMBUSKEN 256 +#define NATIONAL_DEX_BLAZIKEN 257 +#define NATIONAL_DEX_MUDKIP 258 +#define NATIONAL_DEX_MARSHTOMP 259 +#define NATIONAL_DEX_SWAMPERT 260 +#define NATIONAL_DEX_POOCHYENA 261 +#define NATIONAL_DEX_MIGHTYENA 262 +#define NATIONAL_DEX_ZIGZAGOON 263 +#define NATIONAL_DEX_LINOONE 264 +#define NATIONAL_DEX_WURMPLE 265 +#define NATIONAL_DEX_SILCOON 266 +#define NATIONAL_DEX_BEAUTIFLY 267 +#define NATIONAL_DEX_CASCOON 268 +#define NATIONAL_DEX_DUSTOX 269 +#define NATIONAL_DEX_LOTAD 270 +#define NATIONAL_DEX_LOMBRE 271 +#define NATIONAL_DEX_LUDICOLO 272 +#define NATIONAL_DEX_SEEDOT 273 +#define NATIONAL_DEX_NUZLEAF 274 +#define NATIONAL_DEX_SHIFTRY 275 +#define NATIONAL_DEX_NINCADA 290 +#define NATIONAL_DEX_NINJASK 291 +#define NATIONAL_DEX_SHEDINJA 292 +#define NATIONAL_DEX_TAILLOW 276 +#define NATIONAL_DEX_SWELLOW 277 +#define NATIONAL_DEX_SHROOMISH 285 +#define NATIONAL_DEX_BRELOOM 286 +#define NATIONAL_DEX_SPINDA 327 +#define NATIONAL_DEX_WINGULL 278 +#define NATIONAL_DEX_PELIPPER 279 +#define NATIONAL_DEX_SURSKIT 283 +#define NATIONAL_DEX_MASQUERAIN 284 +#define NATIONAL_DEX_WAILMER 320 +#define NATIONAL_DEX_WAILORD 321 +#define NATIONAL_DEX_SKITTY 300 +#define NATIONAL_DEX_DELCATTY 301 +#define NATIONAL_DEX_KECLEON 352 +#define NATIONAL_DEX_BALTOY 343 +#define NATIONAL_DEX_CLAYDOL 344 +#define NATIONAL_DEX_NOSEPASS 299 +#define NATIONAL_DEX_TORKOAL 324 +#define NATIONAL_DEX_SABLEYE 302 +#define NATIONAL_DEX_BARBOACH 339 +#define NATIONAL_DEX_WHISCASH 340 +#define NATIONAL_DEX_LUVDISC 370 +#define NATIONAL_DEX_CORPHISH 341 +#define NATIONAL_DEX_CRAWDAUNT 342 +#define NATIONAL_DEX_FEEBAS 349 +#define NATIONAL_DEX_MILOTIC 350 +#define NATIONAL_DEX_CARVANHA 318 +#define NATIONAL_DEX_SHARPEDO 319 +#define NATIONAL_DEX_TRAPINCH 328 +#define NATIONAL_DEX_VIBRAVA 329 +#define NATIONAL_DEX_FLYGON 330 +#define NATIONAL_DEX_MAKUHITA 296 +#define NATIONAL_DEX_HARIYAMA 297 +#define NATIONAL_DEX_ELECTRIKE 309 +#define NATIONAL_DEX_MANECTRIC 310 +#define NATIONAL_DEX_NUMEL 322 +#define NATIONAL_DEX_CAMERUPT 323 +#define NATIONAL_DEX_SPHEAL 363 +#define NATIONAL_DEX_SEALEO 364 +#define NATIONAL_DEX_WALREIN 365 +#define NATIONAL_DEX_CACNEA 331 +#define NATIONAL_DEX_CACTURNE 332 +#define NATIONAL_DEX_SNORUNT 361 +#define NATIONAL_DEX_GLALIE 362 +#define NATIONAL_DEX_LUNATONE 337 +#define NATIONAL_DEX_SOLROCK 338 +#define NATIONAL_DEX_AZURILL 298 +#define NATIONAL_DEX_SPOINK 325 +#define NATIONAL_DEX_GRUMPIG 326 +#define NATIONAL_DEX_PLUSLE 311 +#define NATIONAL_DEX_MINUN 312 +#define NATIONAL_DEX_MAWILE 303 +#define NATIONAL_DEX_MEDITITE 307 +#define NATIONAL_DEX_MEDICHAM 308 +#define NATIONAL_DEX_SWABLU 333 +#define NATIONAL_DEX_ALTARIA 334 +#define NATIONAL_DEX_WYNAUT 360 +#define NATIONAL_DEX_DUSKULL 355 +#define NATIONAL_DEX_DUSCLOPS 356 +#define NATIONAL_DEX_ROSELIA 315 +#define NATIONAL_DEX_SLAKOTH 287 +#define NATIONAL_DEX_VIGOROTH 288 +#define NATIONAL_DEX_SLAKING 289 +#define NATIONAL_DEX_GULPIN 316 +#define NATIONAL_DEX_SWALOT 317 +#define NATIONAL_DEX_TROPIUS 357 +#define NATIONAL_DEX_WHISMUR 293 +#define NATIONAL_DEX_LOUDRED 294 +#define NATIONAL_DEX_EXPLOUD 295 +#define NATIONAL_DEX_CLAMPERL 366 +#define NATIONAL_DEX_HUNTAIL 367 +#define NATIONAL_DEX_GOREBYSS 368 +#define NATIONAL_DEX_ABSOL 359 +#define NATIONAL_DEX_SHUPPET 353 +#define NATIONAL_DEX_BANETTE 354 +#define NATIONAL_DEX_SEVIPER 336 +#define NATIONAL_DEX_ZANGOOSE 335 +#define NATIONAL_DEX_RELICANTH 369 +#define NATIONAL_DEX_ARON 304 +#define NATIONAL_DEX_LAIRON 305 +#define NATIONAL_DEX_AGGRON 306 +#define NATIONAL_DEX_CASTFORM 351 +#define NATIONAL_DEX_VOLBEAT 313 +#define NATIONAL_DEX_ILLUMISE 314 +#define NATIONAL_DEX_LILEEP 345 +#define NATIONAL_DEX_CRADILY 346 +#define NATIONAL_DEX_ANORITH 347 +#define NATIONAL_DEX_ARMALDO 348 +#define NATIONAL_DEX_RALTS 280 +#define NATIONAL_DEX_KIRLIA 281 +#define NATIONAL_DEX_GARDEVOIR 282 +#define NATIONAL_DEX_BAGON 371 +#define NATIONAL_DEX_SHELGON 372 +#define NATIONAL_DEX_SALAMENCE 373 +#define NATIONAL_DEX_BELDUM 374 +#define NATIONAL_DEX_METANG 375 +#define NATIONAL_DEX_METAGROSS 376 +#define NATIONAL_DEX_REGIROCK 377 +#define NATIONAL_DEX_REGICE 378 +#define NATIONAL_DEX_REGISTEEL 379 +#define NATIONAL_DEX_KYOGRE 382 +#define NATIONAL_DEX_GROUDON 383 +#define NATIONAL_DEX_RAYQUAZA 384 +#define NATIONAL_DEX_LATIAS 380 +#define NATIONAL_DEX_LATIOS 381 +#define NATIONAL_DEX_JIRACHI 385 +#define NATIONAL_DEX_DEOXYS 386 +#define NATIONAL_DEX_CHIMECHO 358 + +// Hoenn Dex Index Defines + +#define HOENN_DEX_BULBASAUR 203 +#define HOENN_DEX_IVYSAUR 204 +#define HOENN_DEX_VENUSAUR 205 +#define HOENN_DEX_CHARMANDER 206 +#define HOENN_DEX_CHARMELEON 207 +#define HOENN_DEX_CHARIZARD 208 +#define HOENN_DEX_SQUIRTLE 209 +#define HOENN_DEX_WARTORTLE 210 +#define HOENN_DEX_BLASTOISE 211 +#define HOENN_DEX_CATERPIE 212 +#define HOENN_DEX_METAPOD 213 +#define HOENN_DEX_BUTTERFREE 214 +#define HOENN_DEX_WEEDLE 215 +#define HOENN_DEX_KAKUNA 216 +#define HOENN_DEX_BEEDRILL 217 +#define HOENN_DEX_PIDGEY 218 +#define HOENN_DEX_PIDGEOTTO 219 +#define HOENN_DEX_PIDGEOT 220 +#define HOENN_DEX_RATTATA 221 +#define HOENN_DEX_RATICATE 222 +#define HOENN_DEX_SPEAROW 223 +#define HOENN_DEX_FEAROW 224 +#define HOENN_DEX_EKANS 225 +#define HOENN_DEX_ARBOK 226 +#define HOENN_DEX_PIKACHU 156 +#define HOENN_DEX_RAICHU 157 +#define HOENN_DEX_SANDSHREW 112 +#define HOENN_DEX_SANDSLASH 113 +#define HOENN_DEX_NIDORAN_F 227 +#define HOENN_DEX_NIDORINA 228 +#define HOENN_DEX_NIDOQUEEN 229 +#define HOENN_DEX_NIDORAN_M 230 +#define HOENN_DEX_NIDORINO 231 +#define HOENN_DEX_NIDOKING 232 +#define HOENN_DEX_CLEFAIRY 233 +#define HOENN_DEX_CLEFABLE 234 +#define HOENN_DEX_VULPIX 153 +#define HOENN_DEX_NINETALES 154 +#define HOENN_DEX_JIGGLYPUFF 138 +#define HOENN_DEX_WIGGLYTUFF 139 +#define HOENN_DEX_ZUBAT 63 +#define HOENN_DEX_GOLBAT 64 +#define HOENN_DEX_ODDISH 88 +#define HOENN_DEX_GLOOM 89 +#define HOENN_DEX_VILEPLUME 90 +#define HOENN_DEX_PARAS 235 +#define HOENN_DEX_PARASECT 236 +#define HOENN_DEX_VENONAT 237 +#define HOENN_DEX_VENOMOTH 238 +#define HOENN_DEX_DIGLETT 239 +#define HOENN_DEX_DUGTRIO 240 +#define HOENN_DEX_MEOWTH 241 +#define HOENN_DEX_PERSIAN 242 +#define HOENN_DEX_PSYDUCK 158 +#define HOENN_DEX_GOLDUCK 159 +#define HOENN_DEX_MANKEY 243 +#define HOENN_DEX_PRIMEAPE 244 +#define HOENN_DEX_GROWLITHE 245 +#define HOENN_DEX_ARCANINE 246 +#define HOENN_DEX_POLIWAG 247 +#define HOENN_DEX_POLIWHIRL 248 +#define HOENN_DEX_POLIWRATH 249 +#define HOENN_DEX_ABRA 39 +#define HOENN_DEX_KADABRA 40 +#define HOENN_DEX_ALAKAZAM 41 +#define HOENN_DEX_MACHOP 73 +#define HOENN_DEX_MACHOKE 74 +#define HOENN_DEX_MACHAMP 75 +#define HOENN_DEX_BELLSPROUT 250 +#define HOENN_DEX_WEEPINBELL 251 +#define HOENN_DEX_VICTREEBEL 252 +#define HOENN_DEX_TENTACOOL 66 +#define HOENN_DEX_TENTACRUEL 67 +#define HOENN_DEX_GEODUDE 57 +#define HOENN_DEX_GRAVELER 58 +#define HOENN_DEX_GOLEM 59 +#define HOENN_DEX_PONYTA 253 +#define HOENN_DEX_RAPIDASH 254 +#define HOENN_DEX_SLOWPOKE 255 +#define HOENN_DEX_SLOWBRO 256 +#define HOENN_DEX_MAGNEMITE 82 +#define HOENN_DEX_MAGNETON 83 +#define HOENN_DEX_FARFETCHD 257 +#define HOENN_DEX_DODUO 92 +#define HOENN_DEX_DODRIO 93 +#define HOENN_DEX_SEEL 258 +#define HOENN_DEX_DEWGONG 259 +#define HOENN_DEX_GRIMER 106 +#define HOENN_DEX_MUK 107 +#define HOENN_DEX_SHELLDER 260 +#define HOENN_DEX_CLOYSTER 261 +#define HOENN_DEX_GASTLY 262 +#define HOENN_DEX_HAUNTER 263 +#define HOENN_DEX_GENGAR 264 +#define HOENN_DEX_ONIX 265 +#define HOENN_DEX_DROWZEE 266 +#define HOENN_DEX_HYPNO 267 +#define HOENN_DEX_KRABBY 268 +#define HOENN_DEX_KINGLER 269 +#define HOENN_DEX_VOLTORB 84 +#define HOENN_DEX_ELECTRODE 85 +#define HOENN_DEX_EXEGGCUTE 270 +#define HOENN_DEX_EXEGGUTOR 271 +#define HOENN_DEX_CUBONE 272 +#define HOENN_DEX_MAROWAK 273 +#define HOENN_DEX_HITMONLEE 274 +#define HOENN_DEX_HITMONCHAN 275 +#define HOENN_DEX_LICKITUNG 276 +#define HOENN_DEX_KOFFING 108 +#define HOENN_DEX_WEEZING 109 +#define HOENN_DEX_RHYHORN 169 +#define HOENN_DEX_RHYDON 170 +#define HOENN_DEX_CHANSEY 277 +#define HOENN_DEX_TANGELA 278 +#define HOENN_DEX_KANGASKHAN 279 +#define HOENN_DEX_HORSEA 184 +#define HOENN_DEX_SEADRA 185 +#define HOENN_DEX_GOLDEEN 50 +#define HOENN_DEX_SEAKING 51 +#define HOENN_DEX_STARYU 143 +#define HOENN_DEX_STARMIE 144 +#define HOENN_DEX_MR_MIME 280 +#define HOENN_DEX_SCYTHER 281 +#define HOENN_DEX_JYNX 282 +#define HOENN_DEX_ELECTABUZZ 283 +#define HOENN_DEX_MAGMAR 284 +#define HOENN_DEX_PINSIR 167 +#define HOENN_DEX_TAUROS 285 +#define HOENN_DEX_MAGIKARP 52 +#define HOENN_DEX_GYARADOS 53 +#define HOENN_DEX_LAPRAS 286 +#define HOENN_DEX_DITTO 287 +#define HOENN_DEX_EEVEE 288 +#define HOENN_DEX_VAPOREON 289 +#define HOENN_DEX_JOLTEON 290 +#define HOENN_DEX_FLAREON 291 +#define HOENN_DEX_PORYGON 292 +#define HOENN_DEX_OMANYTE 293 +#define HOENN_DEX_OMASTAR 294 +#define HOENN_DEX_KABUTO 295 +#define HOENN_DEX_KABUTOPS 296 +#define HOENN_DEX_AERODACTYL 297 +#define HOENN_DEX_SNORLAX 298 +#define HOENN_DEX_ARTICUNO 299 +#define HOENN_DEX_ZAPDOS 300 +#define HOENN_DEX_MOLTRES 301 +#define HOENN_DEX_DRATINI 302 +#define HOENN_DEX_DRAGONAIR 303 +#define HOENN_DEX_DRAGONITE 304 +#define HOENN_DEX_MEWTWO 305 +#define HOENN_DEX_MEW 306 +#define HOENN_DEX_CHIKORITA 307 +#define HOENN_DEX_BAYLEEF 308 +#define HOENN_DEX_MEGANIUM 309 +#define HOENN_DEX_CYNDAQUIL 310 +#define HOENN_DEX_QUILAVA 311 +#define HOENN_DEX_TYPHLOSION 312 +#define HOENN_DEX_TOTODILE 313 +#define HOENN_DEX_CROCONAW 314 +#define HOENN_DEX_FERALIGATR 315 +#define HOENN_DEX_SENTRET 316 +#define HOENN_DEX_FURRET 317 +#define HOENN_DEX_HOOTHOOT 318 +#define HOENN_DEX_NOCTOWL 319 +#define HOENN_DEX_LEDYBA 320 +#define HOENN_DEX_LEDIAN 321 +#define HOENN_DEX_SPINARAK 322 +#define HOENN_DEX_ARIADOS 323 +#define HOENN_DEX_CROBAT 65 +#define HOENN_DEX_CHINCHOU 181 +#define HOENN_DEX_LANTURN 182 +#define HOENN_DEX_PICHU 155 +#define HOENN_DEX_CLEFFA 324 +#define HOENN_DEX_IGGLYBUFF 137 +#define HOENN_DEX_TOGEPI 325 +#define HOENN_DEX_TOGETIC 326 +#define HOENN_DEX_NATU 162 +#define HOENN_DEX_XATU 163 +#define HOENN_DEX_MAREEP 327 +#define HOENN_DEX_FLAAFFY 328 +#define HOENN_DEX_AMPHAROS 329 +#define HOENN_DEX_BELLOSSOM 91 +#define HOENN_DEX_MARILL 55 +#define HOENN_DEX_AZUMARILL 56 +#define HOENN_DEX_SUDOWOODO 330 +#define HOENN_DEX_POLITOED 331 +#define HOENN_DEX_HOPPIP 332 +#define HOENN_DEX_SKIPLOOM 333 +#define HOENN_DEX_JUMPLUFF 334 +#define HOENN_DEX_AIPOM 335 +#define HOENN_DEX_SUNKERN 336 +#define HOENN_DEX_SUNFLORA 337 +#define HOENN_DEX_YANMA 338 +#define HOENN_DEX_WOOPER 339 +#define HOENN_DEX_QUAGSIRE 340 +#define HOENN_DEX_ESPEON 341 +#define HOENN_DEX_UMBREON 342 +#define HOENN_DEX_MURKROW 343 +#define HOENN_DEX_SLOWKING 344 +#define HOENN_DEX_MISDREAVUS 345 +#define HOENN_DEX_UNOWN 346 +#define HOENN_DEX_WOBBUFFET 161 +#define HOENN_DEX_GIRAFARIG 164 +#define HOENN_DEX_PINECO 347 +#define HOENN_DEX_FORRETRESS 348 +#define HOENN_DEX_DUNSPARCE 349 +#define HOENN_DEX_GLIGAR 350 +#define HOENN_DEX_STEELIX 351 +#define HOENN_DEX_SNUBBULL 352 +#define HOENN_DEX_GRANBULL 353 +#define HOENN_DEX_QWILFISH 354 +#define HOENN_DEX_SCIZOR 355 +#define HOENN_DEX_SHUCKLE 356 +#define HOENN_DEX_HERACROSS 168 +#define HOENN_DEX_SNEASEL 357 +#define HOENN_DEX_TEDDIURSA 358 +#define HOENN_DEX_URSARING 359 +#define HOENN_DEX_SLUGMA 103 +#define HOENN_DEX_MAGCARGO 104 +#define HOENN_DEX_SWINUB 360 +#define HOENN_DEX_PILOSWINE 361 +#define HOENN_DEX_CORSOLA 180 +#define HOENN_DEX_REMORAID 362 +#define HOENN_DEX_OCTILLERY 363 +#define HOENN_DEX_DELIBIRD 364 +#define HOENN_DEX_MANTINE 365 +#define HOENN_DEX_SKARMORY 115 +#define HOENN_DEX_HOUNDOUR 366 +#define HOENN_DEX_HOUNDOOM 367 +#define HOENN_DEX_KINGDRA 186 +#define HOENN_DEX_PHANPY 165 +#define HOENN_DEX_DONPHAN 166 +#define HOENN_DEX_PORYGON2 368 +#define HOENN_DEX_STANTLER 369 +#define HOENN_DEX_SMEARGLE 370 +#define HOENN_DEX_TYROGUE 371 +#define HOENN_DEX_HITMONTOP 372 +#define HOENN_DEX_SMOOCHUM 373 +#define HOENN_DEX_ELEKID 374 +#define HOENN_DEX_MAGBY 375 +#define HOENN_DEX_MILTANK 376 +#define HOENN_DEX_BLISSEY 377 +#define HOENN_DEX_RAIKOU 378 +#define HOENN_DEX_ENTEI 379 +#define HOENN_DEX_SUICUNE 380 +#define HOENN_DEX_LARVITAR 381 +#define HOENN_DEX_PUPITAR 382 +#define HOENN_DEX_TYRANITAR 383 +#define HOENN_DEX_LUGIA 384 +#define HOENN_DEX_HO_OH 385 +#define HOENN_DEX_CELEBI 386 + +#define HOENN_DEX_OLD_UNOWN_B 387 +#define HOENN_DEX_OLD_UNOWN_C 388 +#define HOENN_DEX_OLD_UNOWN_D 389 +#define HOENN_DEX_OLD_UNOWN_E 390 +#define HOENN_DEX_OLD_UNOWN_F 391 +#define HOENN_DEX_OLD_UNOWN_G 392 +#define HOENN_DEX_OLD_UNOWN_H 393 +#define HOENN_DEX_OLD_UNOWN_I 394 +#define HOENN_DEX_OLD_UNOWN_J 395 +#define HOENN_DEX_OLD_UNOWN_K 396 +#define HOENN_DEX_OLD_UNOWN_L 397 +#define HOENN_DEX_OLD_UNOWN_M 398 +#define HOENN_DEX_OLD_UNOWN_N 399 +#define HOENN_DEX_OLD_UNOWN_O 400 +#define HOENN_DEX_OLD_UNOWN_P 401 +#define HOENN_DEX_OLD_UNOWN_Q 402 +#define HOENN_DEX_OLD_UNOWN_R 403 +#define HOENN_DEX_OLD_UNOWN_S 404 +#define HOENN_DEX_OLD_UNOWN_T 405 +#define HOENN_DEX_OLD_UNOWN_U 406 +#define HOENN_DEX_OLD_UNOWN_V 407 +#define HOENN_DEX_OLD_UNOWN_W 408 +#define HOENN_DEX_OLD_UNOWN_X 409 +#define HOENN_DEX_OLD_UNOWN_Y 410 +#define HOENN_DEX_OLD_UNOWN_Z 411 + +#define HOENN_DEX_TREECKO 1 +#define HOENN_DEX_GROVYLE 2 +#define HOENN_DEX_SCEPTILE 3 +#define HOENN_DEX_TORCHIC 4 +#define HOENN_DEX_COMBUSKEN 5 +#define HOENN_DEX_BLAZIKEN 6 +#define HOENN_DEX_MUDKIP 7 +#define HOENN_DEX_MARSHTOMP 8 +#define HOENN_DEX_SWAMPERT 9 +#define HOENN_DEX_POOCHYENA 10 +#define HOENN_DEX_MIGHTYENA 11 +#define HOENN_DEX_ZIGZAGOON 12 +#define HOENN_DEX_LINOONE 13 +#define HOENN_DEX_WURMPLE 14 +#define HOENN_DEX_SILCOON 15 +#define HOENN_DEX_BEAUTIFLY 16 +#define HOENN_DEX_CASCOON 17 +#define HOENN_DEX_DUSTOX 18 +#define HOENN_DEX_LOTAD 19 +#define HOENN_DEX_LOMBRE 20 +#define HOENN_DEX_LUDICOLO 21 +#define HOENN_DEX_SEEDOT 22 +#define HOENN_DEX_NUZLEAF 23 +#define HOENN_DEX_SHIFTRY 24 +#define HOENN_DEX_NINCADA 42 +#define HOENN_DEX_NINJASK 43 +#define HOENN_DEX_SHEDINJA 44 +#define HOENN_DEX_TAILLOW 25 +#define HOENN_DEX_SWELLOW 26 +#define HOENN_DEX_SHROOMISH 34 +#define HOENN_DEX_BRELOOM 35 +#define HOENN_DEX_SPINDA 114 +#define HOENN_DEX_WINGULL 27 +#define HOENN_DEX_PELIPPER 28 +#define HOENN_DEX_SURSKIT 32 +#define HOENN_DEX_MASQUERAIN 33 +#define HOENN_DEX_WAILMER 99 +#define HOENN_DEX_WAILORD 100 +#define HOENN_DEX_SKITTY 61 +#define HOENN_DEX_DELCATTY 62 +#define HOENN_DEX_KECLEON 145 +#define HOENN_DEX_BALTOY 131 +#define HOENN_DEX_CLAYDOL 132 +#define HOENN_DEX_NOSEPASS 60 +#define HOENN_DEX_TORKOAL 105 +#define HOENN_DEX_SABLEYE 68 +#define HOENN_DEX_BARBOACH 127 +#define HOENN_DEX_WHISCASH 128 +#define HOENN_DEX_LUVDISC 183 +#define HOENN_DEX_CORPHISH 129 +#define HOENN_DEX_CRAWDAUNT 130 +#define HOENN_DEX_FEEBAS 140 +#define HOENN_DEX_MILOTIC 141 +#define HOENN_DEX_CARVANHA 97 +#define HOENN_DEX_SHARPEDO 98 +#define HOENN_DEX_TRAPINCH 116 +#define HOENN_DEX_VIBRAVA 117 +#define HOENN_DEX_FLYGON 118 +#define HOENN_DEX_MAKUHITA 48 +#define HOENN_DEX_HARIYAMA 49 +#define HOENN_DEX_ELECTRIKE 78 +#define HOENN_DEX_MANECTRIC 79 +#define HOENN_DEX_NUMEL 101 +#define HOENN_DEX_CAMERUPT 102 +#define HOENN_DEX_SPHEAL 173 +#define HOENN_DEX_SEALEO 174 +#define HOENN_DEX_WALREIN 175 +#define HOENN_DEX_CACNEA 119 +#define HOENN_DEX_CACTURNE 120 +#define HOENN_DEX_SNORUNT 171 +#define HOENN_DEX_GLALIE 172 +#define HOENN_DEX_LUNATONE 125 +#define HOENN_DEX_SOLROCK 126 +#define HOENN_DEX_AZURILL 54 +#define HOENN_DEX_SPOINK 110 +#define HOENN_DEX_GRUMPIG 111 +#define HOENN_DEX_PLUSLE 80 +#define HOENN_DEX_MINUN 81 +#define HOENN_DEX_MAWILE 69 +#define HOENN_DEX_MEDITITE 76 +#define HOENN_DEX_MEDICHAM 77 +#define HOENN_DEX_SWABLU 121 +#define HOENN_DEX_ALTARIA 122 +#define HOENN_DEX_WYNAUT 160 +#define HOENN_DEX_DUSKULL 148 +#define HOENN_DEX_DUSCLOPS 149 +#define HOENN_DEX_ROSELIA 94 +#define HOENN_DEX_SLAKOTH 36 +#define HOENN_DEX_VIGOROTH 37 +#define HOENN_DEX_SLAKING 38 +#define HOENN_DEX_GULPIN 95 +#define HOENN_DEX_SWALOT 96 +#define HOENN_DEX_TROPIUS 150 +#define HOENN_DEX_WHISMUR 45 +#define HOENN_DEX_LOUDRED 46 +#define HOENN_DEX_EXPLOUD 47 +#define HOENN_DEX_CLAMPERL 176 +#define HOENN_DEX_HUNTAIL 177 +#define HOENN_DEX_GOREBYSS 178 +#define HOENN_DEX_ABSOL 152 +#define HOENN_DEX_SHUPPET 146 +#define HOENN_DEX_BANETTE 147 +#define HOENN_DEX_SEVIPER 124 +#define HOENN_DEX_ZANGOOSE 123 +#define HOENN_DEX_RELICANTH 179 +#define HOENN_DEX_ARON 70 +#define HOENN_DEX_LAIRON 71 +#define HOENN_DEX_AGGRON 72 +#define HOENN_DEX_CASTFORM 142 +#define HOENN_DEX_VOLBEAT 86 +#define HOENN_DEX_ILLUMISE 87 +#define HOENN_DEX_LILEEP 133 +#define HOENN_DEX_CRADILY 134 +#define HOENN_DEX_ANORITH 135 +#define HOENN_DEX_ARMALDO 136 +#define HOENN_DEX_RALTS 29 +#define HOENN_DEX_KIRLIA 30 +#define HOENN_DEX_GARDEVOIR 31 +#define HOENN_DEX_BAGON 187 +#define HOENN_DEX_SHELGON 188 +#define HOENN_DEX_SALAMENCE 189 +#define HOENN_DEX_BELDUM 190 +#define HOENN_DEX_METANG 191 +#define HOENN_DEX_METAGROSS 192 +#define HOENN_DEX_REGIROCK 193 +#define HOENN_DEX_REGICE 194 +#define HOENN_DEX_REGISTEEL 195 +#define HOENN_DEX_KYOGRE 198 +#define HOENN_DEX_GROUDON 199 +#define HOENN_DEX_RAYQUAZA 200 +#define HOENN_DEX_LATIAS 196 +#define HOENN_DEX_LATIOS 197 +#define HOENN_DEX_JIRACHI 201 +#define HOENN_DEX_DEOXYS 202 +#define HOENN_DEX_CHIMECHO 151 + #endif // GUARD_CONSTANTS_SPECIES_H diff --git a/src/pokemon.c b/src/pokemon.c index 7c010cd39..585071254 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -112,9 +112,1253 @@ EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL}; #include "data/battle_moves.h" static const u8 sUnreferencedData[] = {0x34, 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00}; -const u16 gSpeciesToHoennPokedexNum[] = {203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 156, 157, 112, 113, 227, 228, 229, 230, 231, 232, 233, 234, 153, 154, 138, 139, 63, 64, 88, 89, 90, 235, 236, 237, 238, 239, 240, 241, 242, 158, 159, 243, 244, 245, 246, 247, 248, 249, 39, 40, 41, 73, 74, 75, 250, 251, 252, 66, 67, 57, 58, 59, 253, 254, 255, 256, 82, 83, 257, 92, 93, 258, 259, 106, 107, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 84, 85, 270, 271, 272, 273, 274, 275, 276, 108, 109, 169, 170, 277, 278, 279, 184, 185, 50, 51, 143, 144, 280, 281, 282, 283, 284, 167, 285, 52, 53, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 65, 181, 182, 155, 324, 137, 325, 326, 162, 163, 327, 328, 329, 91, 55, 56, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 161, 164, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 168, 357, 358, 359, 103, 104, 360, 361, 180, 362, 363, 364, 365, 115, 366, 367, 186, 165, 166, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 42, 43, 44, 25, 26, 34, 35, 114, 27, 28, 32, 33, 99, 100, 61, 62, 145, 131, 132, 60, 105, 68, 127, 128, 183, 129, 130, 140, 141, 97, 98, 116, 117, 118, 48, 49, 78, 79, 101, 102, 173, 174, 175, 119, 120, 171, 172, 125, 126, 54, 110, 111, 80, 81, 69, 76, 77, 121, 122, 160, 148, 149, 94, 36, 37, 38, 95, 96, 150, 45, 46, 47, 176, 177, 178, 152, 146, 147, 124, 123, 179, 70, 71, 72, 142, 86, 87, 133, 134, 135, 136, 29, 30, 31, 187, 188, 189, 190, 191, 192, 193, 194, 195, 198, 199, 200, 196, 197, 201, 202, 151}; -const u16 gSpeciesToNationalPokedexNum[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 290, 291, 292, 276, 277, 285, 286, 327, 278, 279, 283, 284, 320, 321, 300, 301, 352, 343, 344, 299, 324, 302, 339, 340, 370, 341, 342, 349, 350, 318, 319, 328, 329, 330, 296, 297, 309, 310, 322, 323, 363, 364, 365, 331, 332, 361, 362, 337, 338, 298, 325, 326, 311, 312, 303, 307, 308, 333, 334, 360, 355, 356, 315, 287, 288, 289, 316, 317, 357, 293, 294, 295, 366, 367, 368, 359, 353, 354, 336, 335, 369, 304, 305, 306, 351, 313, 314, 345, 346, 347, 348, 280, 281, 282, 371, 372, 373, 374, 375, 376, 377, 378, 379, 382, 383, 384, 380, 381, 385, 386, 358}; -const u16 gHoennToNationalOrder[] = {252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 63, 64, 65, 290, 291, 292, 293, 294, 295, 296, 297, 118, 119, 129, 130, 298, 183, 184, 74, 75, 76, 299, 300, 301, 41, 42, 169, 72, 73, 302, 303, 304, 305, 306, 66, 67, 68, 307, 308, 309, 310, 311, 312, 81, 82, 100, 101, 313, 314, 43, 44, 45, 182, 84, 85, 315, 316, 317, 318, 319, 320, 321, 322, 323, 218, 219, 324, 88, 89, 109, 110, 325, 326, 27, 28, 327, 227, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 174, 39, 40, 349, 350, 351, 120, 121, 352, 353, 354, 355, 356, 357, 358, 359, 37, 38, 172, 25, 26, 54, 55, 360, 202, 177, 178, 203, 231, 232, 127, 214, 111, 112, 361, 362, 363, 364, 365, 366, 367, 368, 369, 222, 170, 171, 370, 116, 117, 230, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 29, 30, 31, 32, 33, 34, 35, 36, 46, 47, 48, 49, 50, 51, 52, 53, 56, 57, 58, 59, 60, 61, 62, 69, 70, 71, 77, 78, 79, 80, 83, 86, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 102, 103, 104, 105, 106, 107, 108, 113, 114, 115, 122, 123, 124, 125, 126, 128, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 173, 175, 176, 179, 180, 181, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 220, 221, 223, 224, 225, 226, 228, 229, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411}; +const u16 gSpeciesToHoennPokedexNum[] = // Assigns all species to the Hoenn Dex Index (Summary No. for Hoenn Dex) +{ + // SPECIES_NONE + HOENN_DEX_BULBASAUR, // SPECIES_BULBASAUR + HOENN_DEX_IVYSAUR, // SPECIES_IVYSAUR + HOENN_DEX_VENUSAUR, // SPECIES_VENUSAUR + HOENN_DEX_CHARMANDER, // SPECIES_CHARMANDER + HOENN_DEX_CHARMELEON, // SPECIES_CHARMELEON + HOENN_DEX_CHARIZARD, // SPECIES_CHARIZARD + HOENN_DEX_SQUIRTLE, // SPECIES_SQUIRTLE + HOENN_DEX_WARTORTLE, // SPECIES_WARTORTLE + HOENN_DEX_BLASTOISE, // SPECIES_BLASTOISE + HOENN_DEX_CATERPIE, // SPECIES_CATERPIE + HOENN_DEX_METAPOD, // SPECIES_METAPOD + HOENN_DEX_BUTTERFREE, // SPECIES_BUTTERFREE + HOENN_DEX_WEEDLE, // SPECIES_WEEDLE + HOENN_DEX_KAKUNA, // SPECIES_KAKUNA + HOENN_DEX_BEEDRILL, // SPECIES_BEEDRILL + HOENN_DEX_PIDGEY, // SPECIES_PIDGEY + HOENN_DEX_PIDGEOTTO, // SPECIES_PIDGEOTTO + HOENN_DEX_PIDGEOT, // SPECIES_PIDGEOT + HOENN_DEX_RATTATA, // SPECIES_RATTATA + HOENN_DEX_RATICATE, // SPECIES_RATICATE + HOENN_DEX_SPEAROW, // SPECIES_SPEAROW + HOENN_DEX_FEAROW, // SPECIES_FEAROW + HOENN_DEX_EKANS, // SPECIES_EKANS + HOENN_DEX_ARBOK, // SPECIES_ARBOK + HOENN_DEX_PIKACHU, // SPECIES_PIKACHU + HOENN_DEX_RAICHU, // SPECIES_RAICHU + HOENN_DEX_SANDSHREW, // SPECIES_SANDSHREW + HOENN_DEX_SANDSLASH, // SPECIES_SANDSLASH + HOENN_DEX_NIDORAN_F, // SPECIES_NIDORAN_F + HOENN_DEX_NIDORINA, // SPECIES_NIDORINA + HOENN_DEX_NIDOQUEEN, // SPECIES_NIDOQUEEN + HOENN_DEX_NIDORAN_M, // SPECIES_NIDORAN_M + HOENN_DEX_NIDORINO, // SPECIES_NIDORINO + HOENN_DEX_NIDOKING, // SPECIES_NIDOKING + HOENN_DEX_CLEFAIRY, // SPECIES_CLEFAIRY + HOENN_DEX_CLEFABLE, // SPECIES_CLEFABLE + HOENN_DEX_VULPIX, // SPECIES_VULPIX + HOENN_DEX_NINETALES, // SPECIES_NINETALES + HOENN_DEX_JIGGLYPUFF, // SPECIES_JIGGLYPUFF + HOENN_DEX_WIGGLYTUFF, // SPECIES_WIGGLYTUFF + HOENN_DEX_ZUBAT, // SPECIES_ZUBAT + HOENN_DEX_GOLBAT, // SPECIES_GOLBAT + HOENN_DEX_ODDISH, // SPECIES_ODDISH + HOENN_DEX_GLOOM, // SPECIES_GLOOM + HOENN_DEX_VILEPLUME, // SPECIES_VILEPLUME + HOENN_DEX_PARAS, // SPECIES_PARAS + HOENN_DEX_PARASECT, // SPECIES_PARASECT + HOENN_DEX_VENONAT, // SPECIES_VENONAT + HOENN_DEX_VENOMOTH, // SPECIES_VENOMOTH + HOENN_DEX_DIGLETT, // SPECIES_DIGLETT + HOENN_DEX_DUGTRIO, // SPECIES_DUGTRIO + HOENN_DEX_MEOWTH, // SPECIES_MEOWTH + HOENN_DEX_PERSIAN, // SPECIES_PERSIAN + HOENN_DEX_PSYDUCK, // SPECIES_PSYDUCK + HOENN_DEX_GOLDUCK, // SPECIES_GOLDUCK + HOENN_DEX_MANKEY, // SPECIES_MANKEY + HOENN_DEX_PRIMEAPE, // SPECIES_PRIMEAPE + HOENN_DEX_GROWLITHE, // SPECIES_GROWLITHE + HOENN_DEX_ARCANINE, // SPECIES_ARCANINE + HOENN_DEX_POLIWAG, // SPECIES_POLIWAG + HOENN_DEX_POLIWHIRL, // SPECIES_POLIWHIRL + HOENN_DEX_POLIWRATH, // SPECIES_POLIWRATH + HOENN_DEX_ABRA, // SPECIES_ABRA + HOENN_DEX_KADABRA, // SPECIES_KADABRA + HOENN_DEX_ALAKAZAM, // SPECIES_ALAKAZAM + HOENN_DEX_MACHOP, // SPECIES_MACHOP + HOENN_DEX_MACHOKE, // SPECIES_MACHOKE + HOENN_DEX_MACHAMP, // SPECIES_MACHAMP + HOENN_DEX_BELLSPROUT, // SPECIES_BELLSPROUT + HOENN_DEX_WEEPINBELL, // SPECIES_WEEPINBELL + HOENN_DEX_VICTREEBEL, // SPECIES_VICTREEBEL + HOENN_DEX_TENTACOOL, // SPECIES_TENTACOOL + HOENN_DEX_TENTACRUEL, // SPECIES_TENTACRUEL + HOENN_DEX_GEODUDE, // SPECIES_GEODUDE + HOENN_DEX_GRAVELER, // SPECIES_GRAVELER + HOENN_DEX_GOLEM, // SPECIES_GOLEM + HOENN_DEX_PONYTA, // SPECIES_PONYTA + HOENN_DEX_RAPIDASH, // SPECIES_RAPIDASH + HOENN_DEX_SLOWPOKE, // SPECIES_SLOWPOKE + HOENN_DEX_SLOWBRO, // SPECIES_SLOWBRO + HOENN_DEX_MAGNEMITE, // SPECIES_MAGNEMITE + HOENN_DEX_MAGNETON, // SPECIES_MAGNETON + HOENN_DEX_FARFETCHD, // SPECIES_FARFETCHD + HOENN_DEX_DODUO, // SPECIES_DODUO + HOENN_DEX_DODRIO, // SPECIES_DODRIO + HOENN_DEX_SEEL, // SPECIES_SEEL + HOENN_DEX_DEWGONG, // SPECIES_DEWGONG + HOENN_DEX_GRIMER, // SPECIES_GRIMER + HOENN_DEX_MUK, // SPECIES_MUK + HOENN_DEX_SHELLDER, // SPECIES_SHELLDER + HOENN_DEX_CLOYSTER, // SPECIES_CLOYSTER + HOENN_DEX_GASTLY, // SPECIES_GASTLY + HOENN_DEX_HAUNTER, // SPECIES_HAUNTER + HOENN_DEX_GENGAR, // SPECIES_GENGAR + HOENN_DEX_ONIX, // SPECIES_ONIX + HOENN_DEX_DROWZEE, // SPECIES_DROWZEE + HOENN_DEX_HYPNO, // SPECIES_HYPNO + HOENN_DEX_KRABBY, // SPECIES_KRABBY + HOENN_DEX_KINGLER, // SPECIES_KINGLER + HOENN_DEX_VOLTORB, // SPECIES_VOLTORB + HOENN_DEX_ELECTRODE, // SPECIES_ELECTRODE + HOENN_DEX_EXEGGCUTE, // SPECIES_EXEGGCUTE + HOENN_DEX_EXEGGUTOR, // SPECIES_EXEGGUTOR + HOENN_DEX_CUBONE, // SPECIES_CUBONE + HOENN_DEX_MAROWAK, // SPECIES_MAROWAK + HOENN_DEX_HITMONLEE, // SPECIES_HITMONLEE + HOENN_DEX_HITMONCHAN, // SPECIES_HITMONCHAN + HOENN_DEX_LICKITUNG, // SPECIES_LICKITUNG + HOENN_DEX_KOFFING, // SPECIES_KOFFING + HOENN_DEX_WEEZING, // SPECIES_WEEZING + HOENN_DEX_RHYHORN, // SPECIES_RHYHORN + HOENN_DEX_RHYDON, // SPECIES_RHYDON + HOENN_DEX_CHANSEY, // SPECIES_CHANSEY + HOENN_DEX_TANGELA, // SPECIES_TANGELA + HOENN_DEX_KANGASKHAN, // SPECIES_KANGASKHAN + HOENN_DEX_HORSEA, // SPECIES_HORSEA + HOENN_DEX_SEADRA, // SPECIES_SEADRA + HOENN_DEX_GOLDEEN, // SPECIES_GOLDEEN + HOENN_DEX_SEAKING, // SPECIES_SEAKING + HOENN_DEX_STARYU, // SPECIES_STARYU + HOENN_DEX_STARMIE, // SPECIES_STARMIE + HOENN_DEX_MR_MIME, // SPECIES_MR_MIME + HOENN_DEX_SCYTHER, // SPECIES_SCYTHER + HOENN_DEX_JYNX, // SPECIES_JYNX + HOENN_DEX_ELECTABUZZ, // SPECIES_ELECTABUZZ + HOENN_DEX_MAGMAR, // SPECIES_MAGMAR + HOENN_DEX_PINSIR, // SPECIES_PINSIR + HOENN_DEX_TAUROS, // SPECIES_TAUROS + HOENN_DEX_MAGIKARP, // SPECIES_MAGIKARP + HOENN_DEX_GYARADOS, // SPECIES_GYARADOS + HOENN_DEX_LAPRAS, // SPECIES_LAPRAS + HOENN_DEX_DITTO, // SPECIES_DITTO + HOENN_DEX_EEVEE, // SPECIES_EEVEE + HOENN_DEX_VAPOREON, // SPECIES_VAPOREON + HOENN_DEX_JOLTEON, // SPECIES_JOLTEON + HOENN_DEX_FLAREON, // SPECIES_FLAREON + HOENN_DEX_PORYGON, // SPECIES_PORYGON + HOENN_DEX_OMANYTE, // SPECIES_OMANYTE + HOENN_DEX_OMASTAR, // SPECIES_OMASTAR + HOENN_DEX_KABUTO, // SPECIES_KABUTO + HOENN_DEX_KABUTOPS, // SPECIES_KABUTOPS + HOENN_DEX_AERODACTYL, // SPECIES_AERODACTYL + HOENN_DEX_SNORLAX, // SPECIES_SNORLAX + HOENN_DEX_ARTICUNO, // SPECIES_ARTICUNO + HOENN_DEX_ZAPDOS, // SPECIES_ZAPDOS + HOENN_DEX_MOLTRES, // SPECIES_MOLTRES + HOENN_DEX_DRATINI, // SPECIES_DRATINI + HOENN_DEX_DRAGONAIR, // SPECIES_DRAGONAIR + HOENN_DEX_DRAGONITE, // SPECIES_DRAGONITE + HOENN_DEX_MEWTWO, // SPECIES_MEWTWO + HOENN_DEX_MEW, // SPECIES_MEW + HOENN_DEX_CHIKORITA, // SPECIES_CHIKORITA + HOENN_DEX_BAYLEEF, // SPECIES_BAYLEEF + HOENN_DEX_MEGANIUM, // SPECIES_MEGANIUM + HOENN_DEX_CYNDAQUIL, // SPECIES_CYNDAQUIL + HOENN_DEX_QUILAVA, // SPECIES_QUILAVA + HOENN_DEX_TYPHLOSION, // SPECIES_TYPHLOSION + HOENN_DEX_TOTODILE, // SPECIES_TOTODILE + HOENN_DEX_CROCONAW, // SPECIES_CROCONAW + HOENN_DEX_FERALIGATR, // SPECIES_FERALIGATR + HOENN_DEX_SENTRET, // SPECIES_SENTRET + HOENN_DEX_FURRET, // SPECIES_FURRET + HOENN_DEX_HOOTHOOT, // SPECIES_HOOTHOOT + HOENN_DEX_NOCTOWL, // SPECIES_NOCTOWL + HOENN_DEX_LEDYBA, // SPECIES_LEDYBA + HOENN_DEX_LEDIAN, // SPECIES_LEDIAN + HOENN_DEX_SPINARAK, // SPECIES_SPINARAK + HOENN_DEX_ARIADOS, // SPECIES_ARIADOS + HOENN_DEX_CROBAT, // SPECIES_CROBAT + HOENN_DEX_CHINCHOU, // SPECIES_CHINCHOU + HOENN_DEX_LANTURN, // SPECIES_LANTURN + HOENN_DEX_PICHU, // SPECIES_PICHU + HOENN_DEX_CLEFFA, // SPECIES_CLEFFA + HOENN_DEX_IGGLYBUFF, // SPECIES_IGGLYBUFF + HOENN_DEX_TOGEPI, // SPECIES_TOGEPI + HOENN_DEX_TOGETIC, // SPECIES_TOGETIC + HOENN_DEX_NATU, // SPECIES_NATU + HOENN_DEX_XATU, // SPECIES_XATU + HOENN_DEX_MAREEP, // SPECIES_MAREEP + HOENN_DEX_FLAAFFY, // SPECIES_FLAAFFY + HOENN_DEX_AMPHAROS, // SPECIES_AMPHAROS + HOENN_DEX_BELLOSSOM, // SPECIES_BELLOSSOM + HOENN_DEX_MARILL, // SPECIES_MARILL + HOENN_DEX_AZUMARILL, // SPECIES_AZUMARILL + HOENN_DEX_SUDOWOODO, // SPECIES_SUDOWOODO + HOENN_DEX_POLITOED, // SPECIES_POLITOED + HOENN_DEX_HOPPIP, // SPECIES_HOPPIP + HOENN_DEX_SKIPLOOM, // SPECIES_SKIPLOOM + HOENN_DEX_JUMPLUFF, // SPECIES_JUMPLUFF + HOENN_DEX_AIPOM, // SPECIES_AIPOM + HOENN_DEX_SUNKERN, // SPECIES_SUNKERN + HOENN_DEX_SUNFLORA, // SPECIES_SUNFLORA + HOENN_DEX_YANMA, // SPECIES_YANMA + HOENN_DEX_WOOPER, // SPECIES_WOOPER + HOENN_DEX_QUAGSIRE, // SPECIES_QUAGSIRE + HOENN_DEX_ESPEON, // SPECIES_ESPEON + HOENN_DEX_UMBREON, // SPECIES_UMBREON + HOENN_DEX_MURKROW, // SPECIES_MURKROW + HOENN_DEX_SLOWKING, // SPECIES_SLOWKING + HOENN_DEX_MISDREAVUS, // SPECIES_MISDREAVUS + HOENN_DEX_UNOWN, // SPECIES_UNOWN + HOENN_DEX_WOBBUFFET, // SPECIES_WOBBUFFET + HOENN_DEX_GIRAFARIG, // SPECIES_GIRAFARIG + HOENN_DEX_PINECO, // SPECIES_PINECO + HOENN_DEX_FORRETRESS, // SPECIES_FORRETRESS + HOENN_DEX_DUNSPARCE, // SPECIES_DUNSPARCE + HOENN_DEX_GLIGAR, // SPECIES_GLIGAR + HOENN_DEX_STEELIX, // SPECIES_STEELIX + HOENN_DEX_SNUBBULL, // SPECIES_SNUBBULL + HOENN_DEX_GRANBULL, // SPECIES_GRANBULL + HOENN_DEX_QWILFISH, // SPECIES_QWILFISH + HOENN_DEX_SCIZOR, // SPECIES_SCIZOR + HOENN_DEX_SHUCKLE, // SPECIES_SHUCKLE + HOENN_DEX_HERACROSS, // SPECIES_HERACROSS + HOENN_DEX_SNEASEL, // SPECIES_SNEASEL + HOENN_DEX_TEDDIURSA, // SPECIES_TEDDIURSA + HOENN_DEX_URSARING, // SPECIES_URSARING + HOENN_DEX_SLUGMA, // SPECIES_SLUGMA + HOENN_DEX_MAGCARGO, // SPECIES_MAGCARGO + HOENN_DEX_SWINUB, // SPECIES_SWINUB + HOENN_DEX_PILOSWINE, // SPECIES_PILOSWINE + HOENN_DEX_CORSOLA, // SPECIES_CORSOLA + HOENN_DEX_REMORAID, // SPECIES_REMORAID + HOENN_DEX_OCTILLERY, // SPECIES_OCTILLERY + HOENN_DEX_DELIBIRD, // SPECIES_DELIBIRD + HOENN_DEX_MANTINE, // SPECIES_MANTINE + HOENN_DEX_SKARMORY, // SPECIES_SKARMORY + HOENN_DEX_HOUNDOUR, // SPECIES_HOUNDOUR + HOENN_DEX_HOUNDOOM, // SPECIES_HOUNDOOM + HOENN_DEX_KINGDRA, // SPECIES_KINGDRA + HOENN_DEX_PHANPY, // SPECIES_PHANPY + HOENN_DEX_DONPHAN, // SPECIES_DONPHAN + HOENN_DEX_PORYGON2, // SPECIES_PORYGON2 + HOENN_DEX_STANTLER, // SPECIES_STANTLER + HOENN_DEX_SMEARGLE, // SPECIES_SMEARGLE + HOENN_DEX_TYROGUE, // SPECIES_TYROGUE + HOENN_DEX_HITMONTOP, // SPECIES_HITMONTOP + HOENN_DEX_SMOOCHUM, // SPECIES_SMOOCHUM + HOENN_DEX_ELEKID, // SPECIES_ELEKID + HOENN_DEX_MAGBY, // SPECIES_MAGBY + HOENN_DEX_MILTANK, // SPECIES_MILTANK + HOENN_DEX_BLISSEY, // SPECIES_BLISSEY + HOENN_DEX_RAIKOU, // SPECIES_RAIKOU + HOENN_DEX_ENTEI, // SPECIES_ENTEI + HOENN_DEX_SUICUNE, // SPECIES_SUICUNE + HOENN_DEX_LARVITAR, // SPECIES_LARVITAR + HOENN_DEX_PUPITAR, // SPECIES_PUPITAR + HOENN_DEX_TYRANITAR, // SPECIES_TYRANITAR + HOENN_DEX_LUGIA, // SPECIES_LUGIA + HOENN_DEX_HO_OH, // SPECIES_HO-OH + HOENN_DEX_CELEBI, // SPECIES_CELEBI + HOENN_DEX_OLD_UNOWN_B, // SPECIES_OLD_UNOWN_B + HOENN_DEX_OLD_UNOWN_C, // SPECIES_OLD_UNOWN_C + HOENN_DEX_OLD_UNOWN_D, // SPECIES_OLD_UNOWN_D + HOENN_DEX_OLD_UNOWN_E, // SPECIES_OLD_UNOWN_E + HOENN_DEX_OLD_UNOWN_F, // SPECIES_OLD_UNOWN_F + HOENN_DEX_OLD_UNOWN_G, // SPECIES_OLD_UNOWN_G + HOENN_DEX_OLD_UNOWN_H, // SPECIES_OLD_UNOWN_H + HOENN_DEX_OLD_UNOWN_I, // SPECIES_OLD_UNOWN_I + HOENN_DEX_OLD_UNOWN_J, // SPECIES_OLD_UNOWN_J + HOENN_DEX_OLD_UNOWN_K, // SPECIES_OLD_UNOWN_K + HOENN_DEX_OLD_UNOWN_L, // SPECIES_OLD_UNOWN_L + HOENN_DEX_OLD_UNOWN_M, // SPECIES_OLD_UNOWN_M + HOENN_DEX_OLD_UNOWN_N, // SPECIES_OLD_UNOWN_N + HOENN_DEX_OLD_UNOWN_O, // SPECIES_OLD_UNOWN_O + HOENN_DEX_OLD_UNOWN_P, // SPECIES_OLD_UNOWN_P + HOENN_DEX_OLD_UNOWN_Q, // SPECIES_OLD_UNOWN_Q + HOENN_DEX_OLD_UNOWN_R, // SPECIES_OLD_UNOWN_R + HOENN_DEX_OLD_UNOWN_S, // SPECIES_OLD_UNOWN_S + HOENN_DEX_OLD_UNOWN_T, // SPECIES_OLD_UNOWN_T + HOENN_DEX_OLD_UNOWN_U, // SPECIES_OLD_UNOWN_U + HOENN_DEX_OLD_UNOWN_V, // SPECIES_OLD_UNOWN_V + HOENN_DEX_OLD_UNOWN_W, // SPECIES_OLD_UNOWN_W + HOENN_DEX_OLD_UNOWN_X, // SPECIES_OLD_UNOWN_X + HOENN_DEX_OLD_UNOWN_Y, // SPECIES_OLD_UNOWN_Y + HOENN_DEX_OLD_UNOWN_Z, // SPECIES_OLD_UNOWN_Z + HOENN_DEX_TREECKO, // SPECIES_TREECKO + HOENN_DEX_GROVYLE, // SPECIES_GROVYLE + HOENN_DEX_SCEPTILE, // SPECIES_SCEPTILE + HOENN_DEX_TORCHIC, // SPECIES_TORCHIC + HOENN_DEX_COMBUSKEN, // SPECIES_COMBUSKEN + HOENN_DEX_BLAZIKEN, // SPECIES_BLAZIKEN + HOENN_DEX_MUDKIP, // SPECIES_MUDKIP + HOENN_DEX_MARSHTOMP, // SPECIES_MARSHTOMP + HOENN_DEX_SWAMPERT, // SPECIES_SWAMPERT + HOENN_DEX_POOCHYENA, // SPECIES_POOCHYENA + HOENN_DEX_MIGHTYENA, // SPECIES_MIGHTYENA + HOENN_DEX_ZIGZAGOON, // SPECIES_ZIGZAGOON + HOENN_DEX_LINOONE, // SPECIES_LINOONE + HOENN_DEX_WURMPLE, // SPECIES_WURMPLE + HOENN_DEX_SILCOON, // SPECIES_SILCOON + HOENN_DEX_BEAUTIFLY, // SPECIES_BEAUTIFLY + HOENN_DEX_CASCOON, // SPECIES_CASCOON + HOENN_DEX_DUSTOX, // SPECIES_DUSTOX + HOENN_DEX_LOTAD, // SPECIES_LOTAD + HOENN_DEX_LOMBRE, // SPECIES_LOMBRE + HOENN_DEX_LUDICOLO, // SPECIES_LUDICOLO + HOENN_DEX_SEEDOT, // SPECIES_SEEDOT + HOENN_DEX_NUZLEAF, // SPECIES_NUZLEAF + HOENN_DEX_SHIFTRY, // SPECIES_SHIFTRY + HOENN_DEX_NINCADA, // SPECIES_NINCADA + HOENN_DEX_NINJASK, // SPECIES_NINJASK + HOENN_DEX_SHEDINJA, // SPECIES_SHEDINJA + HOENN_DEX_TAILLOW, // SPECIES_TAILLOW + HOENN_DEX_SWELLOW, // SPECIES_SWELLOW + HOENN_DEX_SHROOMISH, // SPECIES_SHROOMISH + HOENN_DEX_BRELOOM, // SPECIES_BRELOOM + HOENN_DEX_SPINDA, // SPECIES_SPINDA + HOENN_DEX_WINGULL, // SPECIES_WINGULL + HOENN_DEX_PELIPPER, // SPECIES_PELIPPER + HOENN_DEX_SURSKIT, // SPECIES_SURSKIT + HOENN_DEX_MASQUERAIN, // SPECIES_MASQUERAIN + HOENN_DEX_WAILMER, // SPECIES_WAILMER + HOENN_DEX_WAILORD, // SPECIES_WAILORD + HOENN_DEX_SKITTY, // SPECIES_SKITTY + HOENN_DEX_DELCATTY, // SPECIES_DELCATTY + HOENN_DEX_KECLEON, // SPECIES_KECLEON + HOENN_DEX_BALTOY, // SPECIES_BALTOY + HOENN_DEX_CLAYDOL, // SPECIES_CLAYDOL + HOENN_DEX_NOSEPASS, // SPECIES_NOSEPASS + HOENN_DEX_TORKOAL, // SPECIES_TORKOAL + HOENN_DEX_SABLEYE, // SPECIES_SABLEYE + HOENN_DEX_BARBOACH, // SPECIES_BARBOACH + HOENN_DEX_WHISCASH, // SPECIES_WHISCASH + HOENN_DEX_LUVDISC, // SPECIES_LUVDISC + HOENN_DEX_CORPHISH, // SPECIES_CORPHISH + HOENN_DEX_CRAWDAUNT, // SPECIES_CRAWDAUNT + HOENN_DEX_FEEBAS, // SPECIES_FEEBAS + HOENN_DEX_MILOTIC, // SPECIES_MILOTIC + HOENN_DEX_CARVANHA, // SPECIES_CARVANHA + HOENN_DEX_SHARPEDO, // SPECIES_SHARPEDO + HOENN_DEX_TRAPINCH, // SPECIES_TRAPINCH + HOENN_DEX_VIBRAVA, // SPECIES_VIBRAVA + HOENN_DEX_FLYGON, // SPECIES_FLYGON + HOENN_DEX_MAKUHITA, // SPECIES_MAKUHITA + HOENN_DEX_HARIYAMA, // SPECIES_HARIYAMA + HOENN_DEX_ELECTRIKE, // SPECIES_ELECTRIKE + HOENN_DEX_MANECTRIC, // SPECIES_MANECTRIC + HOENN_DEX_NUMEL, // SPECIES_NUMEL + HOENN_DEX_CAMERUPT, // SPECIES_CAMERUPT + HOENN_DEX_SPHEAL, // SPECIES_SPHEAL + HOENN_DEX_SEALEO, // SPECIES_SEALEO + HOENN_DEX_WALREIN, // SPECIES_WALREIN + HOENN_DEX_CACNEA, // SPECIES_CACNEA + HOENN_DEX_CACTURNE, // SPECIES_CACTURNE + HOENN_DEX_SNORUNT, // SPECIES_SNORUNT + HOENN_DEX_GLALIE, // SPECIES_GLALIE + HOENN_DEX_LUNATONE, // SPECIES_LUNATONE + HOENN_DEX_SOLROCK, // SPECIES_SOLROCK + HOENN_DEX_AZURILL, // SPECIES_AZURILL + HOENN_DEX_SPOINK, // SPECIES_SPOINK + HOENN_DEX_GRUMPIG, // SPECIES_GRUMPIG + HOENN_DEX_PLUSLE, // SPECIES_PLUSLE + HOENN_DEX_MINUN, // SPECIES_MINUN + HOENN_DEX_MAWILE, // SPECIES_MAWILE + HOENN_DEX_MEDITITE, // SPECIES_MEDITITE + HOENN_DEX_MEDICHAM, // SPECIES_MEDICHAM + HOENN_DEX_SWABLU, // SPECIES_SWABLU + HOENN_DEX_ALTARIA, // SPECIES_ALTARIA + HOENN_DEX_WYNAUT, // SPECIES_WYNAUT + HOENN_DEX_DUSKULL, // SPECIES_DUSKULL + HOENN_DEX_DUSCLOPS, // SPECIES_DUSCLOPS + HOENN_DEX_ROSELIA, // SPECIES_ROSELIA + HOENN_DEX_SLAKOTH, // SPECIES_SLAKOTH + HOENN_DEX_VIGOROTH, // SPECIES_VIGOROTH + HOENN_DEX_SLAKING, // SPECIES_SLAKING + HOENN_DEX_GULPIN, // SPECIES_GULPIN + HOENN_DEX_SWALOT, // SPECIES_SWALOT + HOENN_DEX_TROPIUS, // SPECIES_TROPIUS + HOENN_DEX_WHISMUR, // SPECIES_WHISMUR + HOENN_DEX_LOUDRED, // SPECIES_LOUDRED + HOENN_DEX_EXPLOUD, // SPECIES_EXPLOUD + HOENN_DEX_CLAMPERL, // SPECIES_CLAMPERL + HOENN_DEX_HUNTAIL, // SPECIES_HUNTAIL + HOENN_DEX_GOREBYSS, // SPECIES_GOREBYSS + HOENN_DEX_ABSOL, // SPECIES_ABSOL + HOENN_DEX_SHUPPET, // SPECIES_SHUPPET + HOENN_DEX_BANETTE, // SPECIES_BANETTE + HOENN_DEX_SEVIPER, // SPECIES_SEVIPER + HOENN_DEX_ZANGOOSE, // SPECIES_ZANGOOSE + HOENN_DEX_RELICANTH, // SPECIES_RELICANTH + HOENN_DEX_ARON, // SPECIES_ARON + HOENN_DEX_LAIRON, // SPECIES_LAIRON + HOENN_DEX_AGGRON, // SPECIES_AGGRON + HOENN_DEX_CASTFORM, // SPECIES_CASTFORM + HOENN_DEX_VOLBEAT, // SPECIES_VOLBEAT + HOENN_DEX_ILLUMISE, // SPECIES_ILLUMISE + HOENN_DEX_LILEEP, // SPECIES_LILEEP + HOENN_DEX_CRADILY, // SPECIES_CRADILY + HOENN_DEX_ANORITH, // SPECIES_ANORITH + HOENN_DEX_ARMALDO, // SPECIES_ARMALDO + HOENN_DEX_RALTS, // SPECIES_RALTS + HOENN_DEX_KIRLIA, // SPECIES_KIRLIA + HOENN_DEX_GARDEVOIR, // SPECIES_GARDEVOIR + HOENN_DEX_BAGON, // SPECIES_BAGON + HOENN_DEX_SHELGON, // SPECIES_SHELGON + HOENN_DEX_SALAMENCE, // SPECIES_SALAMENCE + HOENN_DEX_BELDUM, // SPECIES_BELDUM + HOENN_DEX_METANG, // SPECIES_METANG + HOENN_DEX_METAGROSS, // SPECIES_METAGROSS + HOENN_DEX_REGIROCK, // SPECIES_REGIROCK + HOENN_DEX_REGICE, // SPECIES_REGICE + HOENN_DEX_REGISTEEL, // SPECIES_REGISTEEL + HOENN_DEX_KYOGRE, // SPECIES_KYOGRE + HOENN_DEX_GROUDON, // SPECIES_GROUDON + HOENN_DEX_RAYQUAZA, // SPECIES_RAYQUAZA + HOENN_DEX_LATIAS, // SPECIES_LATIAS + HOENN_DEX_LATIOS, // SPECIES_LATIOS + HOENN_DEX_JIRACHI, // SPECIES_JIRACHI + HOENN_DEX_DEOXYS, // SPECIES_DEOXYS + HOENN_DEX_CHIMECHO // SPECIES_CHIMECHO +}; + +const u16 gSpeciesToNationalPokedexNum[] = // Assigns all species to the National Dex Index (Summary No. for National Dex) +{ + // SPECIES_NONE + NATIONAL_DEX_BULBASAUR, // SPECIES_BULBASAUR + NATIONAL_DEX_IVYSAUR, // SPECIES_IVYSAUR + NATIONAL_DEX_VENUSAUR, // SPECIES_VENUSAUR + NATIONAL_DEX_CHARMANDER, // SPECIES_CHARMANDER + NATIONAL_DEX_CHARMELEON, // SPECIES_CHARMELEON + NATIONAL_DEX_CHARIZARD, // SPECIES_CHARIZARD + NATIONAL_DEX_SQUIRTLE, // SPECIES_SQUIRTLE + NATIONAL_DEX_WARTORTLE, // SPECIES_WARTORTLE + NATIONAL_DEX_BLASTOISE, // SPECIES_BLASTOISE + NATIONAL_DEX_CATERPIE, // SPECIES_CATERPIE + NATIONAL_DEX_METAPOD, // SPECIES_METAPOD + NATIONAL_DEX_BUTTERFREE, // SPECIES_BUTTERFREE + NATIONAL_DEX_WEEDLE, // SPECIES_WEEDLE + NATIONAL_DEX_KAKUNA, // SPECIES_KAKUNA + NATIONAL_DEX_BEEDRILL, // SPECIES_BEEDRILL + NATIONAL_DEX_PIDGEY, // SPECIES_PIDGEY + NATIONAL_DEX_PIDGEOTTO, // SPECIES_PIDGEOTTO + NATIONAL_DEX_PIDGEOT, // SPECIES_PIDGEOT + NATIONAL_DEX_RATTATA, // SPECIES_RATTATA + NATIONAL_DEX_RATICATE, // SPECIES_RATICATE + NATIONAL_DEX_SPEAROW, // SPECIES_SPEAROW + NATIONAL_DEX_FEAROW, // SPECIES_FEAROW + NATIONAL_DEX_EKANS, // SPECIES_EKANS + NATIONAL_DEX_ARBOK, // SPECIES_ARBOK + NATIONAL_DEX_PIKACHU, // SPECIES_PIKACHU + NATIONAL_DEX_RAICHU, // SPECIES_RAICHU + NATIONAL_DEX_SANDSHREW, // SPECIES_SANDSHREW + NATIONAL_DEX_SANDSLASH, // SPECIES_SANDSLASH + NATIONAL_DEX_NIDORAN_F, // SPECIES_NIDORAN_F + NATIONAL_DEX_NIDORINA, // SPECIES_NIDORINA + NATIONAL_DEX_NIDOQUEEN, // SPECIES_NIDOQUEEN + NATIONAL_DEX_NIDORAN_M, // SPECIES_NIDORAN_M + NATIONAL_DEX_NIDORINO, // SPECIES_NIDORINO + NATIONAL_DEX_NIDOKING, // SPECIES_NIDOKING + NATIONAL_DEX_CLEFAIRY, // SPECIES_CLEFAIRY + NATIONAL_DEX_CLEFABLE, // SPECIES_CLEFABLE + NATIONAL_DEX_VULPIX, // SPECIES_VULPIX + NATIONAL_DEX_NINETALES, // SPECIES_NINETALES + NATIONAL_DEX_JIGGLYPUFF, // SPECIES_JIGGLYPUFF + NATIONAL_DEX_WIGGLYTUFF, // SPECIES_WIGGLYTUFF + NATIONAL_DEX_ZUBAT, // SPECIES_ZUBAT + NATIONAL_DEX_GOLBAT, // SPECIES_GOLBAT + NATIONAL_DEX_ODDISH, // SPECIES_ODDISH + NATIONAL_DEX_GLOOM, // SPECIES_GLOOM + NATIONAL_DEX_VILEPLUME, // SPECIES_VILEPLUME + NATIONAL_DEX_PARAS, // SPECIES_PARAS + NATIONAL_DEX_PARASECT, // SPECIES_PARASECT + NATIONAL_DEX_VENONAT, // SPECIES_VENONAT + NATIONAL_DEX_VENOMOTH, // SPECIES_VENOMOTH + NATIONAL_DEX_DIGLETT, // SPECIES_DIGLETT + NATIONAL_DEX_DUGTRIO, // SPECIES_DUGTRIO + NATIONAL_DEX_MEOWTH, // SPECIES_MEOWTH + NATIONAL_DEX_PERSIAN, // SPECIES_PERSIAN + NATIONAL_DEX_PSYDUCK, // SPECIES_PSYDUCK + NATIONAL_DEX_GOLDUCK, // SPECIES_GOLDUCK + NATIONAL_DEX_MANKEY, // SPECIES_MANKEY + NATIONAL_DEX_PRIMEAPE, // SPECIES_PRIMEAPE + NATIONAL_DEX_GROWLITHE, // SPECIES_GROWLITHE + NATIONAL_DEX_ARCANINE, // SPECIES_ARCANINE + NATIONAL_DEX_POLIWAG, // SPECIES_POLIWAG + NATIONAL_DEX_POLIWHIRL, // SPECIES_POLIWHIRL + NATIONAL_DEX_POLIWRATH, // SPECIES_POLIWRATH + NATIONAL_DEX_ABRA, // SPECIES_ABRA + NATIONAL_DEX_KADABRA, // SPECIES_KADABRA + NATIONAL_DEX_ALAKAZAM, // SPECIES_ALAKAZAM + NATIONAL_DEX_MACHOP, // SPECIES_MACHOP + NATIONAL_DEX_MACHOKE, // SPECIES_MACHOKE + NATIONAL_DEX_MACHAMP, // SPECIES_MACHAMP + NATIONAL_DEX_BELLSPROUT, // SPECIES_BELLSPROUT + NATIONAL_DEX_WEEPINBELL, // SPECIES_WEEPINBELL + NATIONAL_DEX_VICTREEBEL, // SPECIES_VICTREEBEL + NATIONAL_DEX_TENTACOOL, // SPECIES_TENTACOOL + NATIONAL_DEX_TENTACRUEL, // SPECIES_TENTACRUEL + NATIONAL_DEX_GEODUDE, // SPECIES_GEODUDE + NATIONAL_DEX_GRAVELER, // SPECIES_GRAVELER + NATIONAL_DEX_GOLEM, // SPECIES_GOLEM + NATIONAL_DEX_PONYTA, // SPECIES_PONYTA + NATIONAL_DEX_RAPIDASH, // SPECIES_RAPIDASH + NATIONAL_DEX_SLOWPOKE, // SPECIES_SLOWPOKE + NATIONAL_DEX_SLOWBRO, // SPECIES_SLOWBRO + NATIONAL_DEX_MAGNEMITE, // SPECIES_MAGNEMITE + NATIONAL_DEX_MAGNETON, // SPECIES_MAGNETON + NATIONAL_DEX_FARFETCHD, // SPECIES_FARFETCHD + NATIONAL_DEX_DODUO, // SPECIES_DODUO + NATIONAL_DEX_DODRIO, // SPECIES_DODRIO + NATIONAL_DEX_SEEL, // SPECIES_SEEL + NATIONAL_DEX_DEWGONG, // SPECIES_DEWGONG + NATIONAL_DEX_GRIMER, // SPECIES_GRIMER + NATIONAL_DEX_MUK, // SPECIES_MUK + NATIONAL_DEX_SHELLDER, // SPECIES_SHELLDER + NATIONAL_DEX_CLOYSTER, // SPECIES_CLOYSTER + NATIONAL_DEX_GASTLY, // SPECIES_GASTLY + NATIONAL_DEX_HAUNTER, // SPECIES_HAUNTER + NATIONAL_DEX_GENGAR, // SPECIES_GENGAR + NATIONAL_DEX_ONIX, // SPECIES_ONIX + NATIONAL_DEX_DROWZEE, // SPECIES_DROWZEE + NATIONAL_DEX_HYPNO, // SPECIES_HYPNO + NATIONAL_DEX_KRABBY, // SPECIES_KRABBY + NATIONAL_DEX_KINGLER, // SPECIES_KINGLER + NATIONAL_DEX_VOLTORB, // SPECIES_VOLTORB + NATIONAL_DEX_ELECTRODE, // SPECIES_ELECTRODE + NATIONAL_DEX_EXEGGCUTE, // SPECIES_EXEGGCUTE + NATIONAL_DEX_EXEGGUTOR, // SPECIES_EXEGGUTOR + NATIONAL_DEX_CUBONE, // SPECIES_CUBONE + NATIONAL_DEX_MAROWAK, // SPECIES_MAROWAK + NATIONAL_DEX_HITMONLEE, // SPECIES_HITMONLEE + NATIONAL_DEX_HITMONCHAN, // SPECIES_HITMONCHAN + NATIONAL_DEX_LICKITUNG, // SPECIES_LICKITUNG + NATIONAL_DEX_KOFFING, // SPECIES_KOFFING + NATIONAL_DEX_WEEZING, // SPECIES_WEEZING + NATIONAL_DEX_RHYHORN, // SPECIES_RHYHORN + NATIONAL_DEX_RHYDON, // SPECIES_RHYDON + NATIONAL_DEX_CHANSEY, // SPECIES_CHANSEY + NATIONAL_DEX_TANGELA, // SPECIES_TANGELA + NATIONAL_DEX_KANGASKHAN, // SPECIES_KANGASKHAN + NATIONAL_DEX_HORSEA, // SPECIES_HORSEA + NATIONAL_DEX_SEADRA, // SPECIES_SEADRA + NATIONAL_DEX_GOLDEEN, // SPECIES_GOLDEEN + NATIONAL_DEX_SEAKING, // SPECIES_SEAKING + NATIONAL_DEX_STARYU, // SPECIES_STARYU + NATIONAL_DEX_STARMIE, // SPECIES_STARMIE + NATIONAL_DEX_MR_MIME, // SPECIES_MR_MIME + NATIONAL_DEX_SCYTHER, // SPECIES_SCYTHER + NATIONAL_DEX_JYNX, // SPECIES_JYNX + NATIONAL_DEX_ELECTABUZZ, // SPECIES_ELECTABUZZ + NATIONAL_DEX_MAGMAR, // SPECIES_MAGMAR + NATIONAL_DEX_PINSIR, // SPECIES_PINSIR + NATIONAL_DEX_TAUROS, // SPECIES_TAUROS + NATIONAL_DEX_MAGIKARP, // SPECIES_MAGIKARP + NATIONAL_DEX_GYARADOS, // SPECIES_GYARADOS + NATIONAL_DEX_LAPRAS, // SPECIES_LAPRAS + NATIONAL_DEX_DITTO, // SPECIES_DITTO + NATIONAL_DEX_EEVEE, // SPECIES_EEVEE + NATIONAL_DEX_VAPOREON, // SPECIES_VAPOREON + NATIONAL_DEX_JOLTEON, // SPECIES_JOLTEON + NATIONAL_DEX_FLAREON, // SPECIES_FLAREON + NATIONAL_DEX_PORYGON, // SPECIES_PORYGON + NATIONAL_DEX_OMANYTE, // SPECIES_OMANYTE + NATIONAL_DEX_OMASTAR, // SPECIES_OMASTAR + NATIONAL_DEX_KABUTO, // SPECIES_KABUTO + NATIONAL_DEX_KABUTOPS, // SPECIES_KABUTOPS + NATIONAL_DEX_AERODACTYL, // SPECIES_AERODACTYL + NATIONAL_DEX_SNORLAX, // SPECIES_SNORLAX + NATIONAL_DEX_ARTICUNO, // SPECIES_ARTICUNO + NATIONAL_DEX_ZAPDOS, // SPECIES_ZAPDOS + NATIONAL_DEX_MOLTRES, // SPECIES_MOLTRES + NATIONAL_DEX_DRATINI, // SPECIES_DRATINI + NATIONAL_DEX_DRAGONAIR, // SPECIES_DRAGONAIR + NATIONAL_DEX_DRAGONITE, // SPECIES_DRAGONITE + NATIONAL_DEX_MEWTWO, // SPECIES_MEWTWO + NATIONAL_DEX_MEW, // SPECIES_MEW + NATIONAL_DEX_CHIKORITA, // SPECIES_CHIKORITA + NATIONAL_DEX_BAYLEEF, // SPECIES_BAYLEEF + NATIONAL_DEX_MEGANIUM, // SPECIES_MEGANIUM + NATIONAL_DEX_CYNDAQUIL, // SPECIES_CYNDAQUIL + NATIONAL_DEX_QUILAVA, // SPECIES_QUILAVA + NATIONAL_DEX_TYPHLOSION, // SPECIES_TYPHLOSION + NATIONAL_DEX_TOTODILE, // SPECIES_TOTODILE + NATIONAL_DEX_CROCONAW, // SPECIES_CROCONAW + NATIONAL_DEX_FERALIGATR, // SPECIES_FERALIGATR + NATIONAL_DEX_SENTRET, // SPECIES_SENTRET + NATIONAL_DEX_FURRET, // SPECIES_FURRET + NATIONAL_DEX_HOOTHOOT, // SPECIES_HOOTHOOT + NATIONAL_DEX_NOCTOWL, // SPECIES_NOCTOWL + NATIONAL_DEX_LEDYBA, // SPECIES_LEDYBA + NATIONAL_DEX_LEDIAN, // SPECIES_LEDIAN + NATIONAL_DEX_SPINARAK, // SPECIES_SPINARAK + NATIONAL_DEX_ARIADOS, // SPECIES_ARIADOS + NATIONAL_DEX_CROBAT, // SPECIES_CROBAT + NATIONAL_DEX_CHINCHOU, // SPECIES_CHINCHOU + NATIONAL_DEX_LANTURN, // SPECIES_LANTURN + NATIONAL_DEX_PICHU, // SPECIES_PICHU + NATIONAL_DEX_CLEFFA, // SPECIES_CLEFFA + NATIONAL_DEX_IGGLYBUFF, // SPECIES_IGGLYBUFF + NATIONAL_DEX_TOGEPI, // SPECIES_TOGEPI + NATIONAL_DEX_TOGETIC, // SPECIES_TOGETIC + NATIONAL_DEX_NATU, // SPECIES_NATU + NATIONAL_DEX_XATU, // SPECIES_XATU + NATIONAL_DEX_MAREEP, // SPECIES_MAREEP + NATIONAL_DEX_FLAAFFY, // SPECIES_FLAAFFY + NATIONAL_DEX_AMPHAROS, // SPECIES_AMPHAROS + NATIONAL_DEX_BELLOSSOM, // SPECIES_BELLOSSOM + NATIONAL_DEX_MARILL, // SPECIES_MARILL + NATIONAL_DEX_AZUMARILL, // SPECIES_AZUMARILL + NATIONAL_DEX_SUDOWOODO, // SPECIES_SUDOWOODO + NATIONAL_DEX_POLITOED, // SPECIES_POLITOED + NATIONAL_DEX_HOPPIP, // SPECIES_HOPPIP + NATIONAL_DEX_SKIPLOOM, // SPECIES_SKIPLOOM + NATIONAL_DEX_JUMPLUFF, // SPECIES_JUMPLUFF + NATIONAL_DEX_AIPOM, // SPECIES_AIPOM + NATIONAL_DEX_SUNKERN, // SPECIES_SUNKERN + NATIONAL_DEX_SUNFLORA, // SPECIES_SUNFLORA + NATIONAL_DEX_YANMA, // SPECIES_YANMA + NATIONAL_DEX_WOOPER, // SPECIES_WOOPER + NATIONAL_DEX_QUAGSIRE, // SPECIES_QUAGSIRE + NATIONAL_DEX_ESPEON, // SPECIES_ESPEON + NATIONAL_DEX_UMBREON, // SPECIES_UMBREON + NATIONAL_DEX_MURKROW, // SPECIES_MURKROW + NATIONAL_DEX_SLOWKING, // SPECIES_SLOWKING + NATIONAL_DEX_MISDREAVUS, // SPECIES_MISDREAVUS + NATIONAL_DEX_UNOWN, // SPECIES_UNOWN + NATIONAL_DEX_WOBBUFFET, // SPECIES_WOBBUFFET + NATIONAL_DEX_GIRAFARIG, // SPECIES_GIRAFARIG + NATIONAL_DEX_PINECO, // SPECIES_PINECO + NATIONAL_DEX_FORRETRESS, // SPECIES_FORRETRESS + NATIONAL_DEX_DUNSPARCE, // SPECIES_DUNSPARCE + NATIONAL_DEX_GLIGAR, // SPECIES_GLIGAR + NATIONAL_DEX_STEELIX, // SPECIES_STEELIX + NATIONAL_DEX_SNUBBULL, // SPECIES_SNUBBULL + NATIONAL_DEX_GRANBULL, // SPECIES_GRANBULL + NATIONAL_DEX_QWILFISH, // SPECIES_QWILFISH + NATIONAL_DEX_SCIZOR, // SPECIES_SCIZOR + NATIONAL_DEX_SHUCKLE, // SPECIES_SHUCKLE + NATIONAL_DEX_HERACROSS, // SPECIES_HERACROSS + NATIONAL_DEX_SNEASEL, // SPECIES_SNEASEL + NATIONAL_DEX_TEDDIURSA, // SPECIES_TEDDIURSA + NATIONAL_DEX_URSARING, // SPECIES_URSARING + NATIONAL_DEX_SLUGMA, // SPECIES_SLUGMA + NATIONAL_DEX_MAGCARGO, // SPECIES_MAGCARGO + NATIONAL_DEX_SWINUB, // SPECIES_SWINUB + NATIONAL_DEX_PILOSWINE, // SPECIES_PILOSWINE + NATIONAL_DEX_CORSOLA, // SPECIES_CORSOLA + NATIONAL_DEX_REMORAID, // SPECIES_REMORAID + NATIONAL_DEX_OCTILLERY, // SPECIES_OCTILLERY + NATIONAL_DEX_DELIBIRD, // SPECIES_DELIBIRD + NATIONAL_DEX_MANTINE, // SPECIES_MANTINE + NATIONAL_DEX_SKARMORY, // SPECIES_SKARMORY + NATIONAL_DEX_HOUNDOUR, // SPECIES_HOUNDOUR + NATIONAL_DEX_HOUNDOOM, // SPECIES_HOUNDOOM + NATIONAL_DEX_KINGDRA, // SPECIES_KINGDRA + NATIONAL_DEX_PHANPY, // SPECIES_PHANPY + NATIONAL_DEX_DONPHAN, // SPECIES_DONPHAN + NATIONAL_DEX_PORYGON2, // SPECIES_PORYGON2 + NATIONAL_DEX_STANTLER, // SPECIES_STANTLER + NATIONAL_DEX_SMEARGLE, // SPECIES_SMEARGLE + NATIONAL_DEX_TYROGUE, // SPECIES_TYROGUE + NATIONAL_DEX_HITMONTOP, // SPECIES_HITMONTOP + NATIONAL_DEX_SMOOCHUM, // SPECIES_SMOOCHUM + NATIONAL_DEX_ELEKID, // SPECIES_ELEKID + NATIONAL_DEX_MAGBY, // SPECIES_MAGBY + NATIONAL_DEX_MILTANK, // SPECIES_MILTANK + NATIONAL_DEX_BLISSEY, // SPECIES_BLISSEY + NATIONAL_DEX_RAIKOU, // SPECIES_RAIKOU + NATIONAL_DEX_ENTEI, // SPECIES_ENTEI + NATIONAL_DEX_SUICUNE, // SPECIES_SUICUNE + NATIONAL_DEX_LARVITAR, // SPECIES_LARVITAR + NATIONAL_DEX_PUPITAR, // SPECIES_PUPITAR + NATIONAL_DEX_TYRANITAR, // SPECIES_TYRANITAR + NATIONAL_DEX_LUGIA, // SPECIES_LUGIA + NATIONAL_DEX_HO_OH, // SPECIES_HO-OH + NATIONAL_DEX_CELEBI, // SPECIES_CELEBI + NATIONAL_DEX_OLD_UNOWN_B, // SPECIES_OLD_UNOWN_B + NATIONAL_DEX_OLD_UNOWN_C, // SPECIES_OLD_UNOWN_C + NATIONAL_DEX_OLD_UNOWN_D, // SPECIES_OLD_UNOWN_D + NATIONAL_DEX_OLD_UNOWN_E, // SPECIES_OLD_UNOWN_E + NATIONAL_DEX_OLD_UNOWN_F, // SPECIES_OLD_UNOWN_F + NATIONAL_DEX_OLD_UNOWN_G, // SPECIES_OLD_UNOWN_G + NATIONAL_DEX_OLD_UNOWN_H, // SPECIES_OLD_UNOWN_H + NATIONAL_DEX_OLD_UNOWN_I, // SPECIES_OLD_UNOWN_I + NATIONAL_DEX_OLD_UNOWN_J, // SPECIES_OLD_UNOWN_J + NATIONAL_DEX_OLD_UNOWN_K, // SPECIES_OLD_UNOWN_K + NATIONAL_DEX_OLD_UNOWN_L, // SPECIES_OLD_UNOWN_L + NATIONAL_DEX_OLD_UNOWN_M, // SPECIES_OLD_UNOWN_M + NATIONAL_DEX_OLD_UNOWN_N, // SPECIES_OLD_UNOWN_N + NATIONAL_DEX_OLD_UNOWN_O, // SPECIES_OLD_UNOWN_O + NATIONAL_DEX_OLD_UNOWN_P, // SPECIES_OLD_UNOWN_P + NATIONAL_DEX_OLD_UNOWN_Q, // SPECIES_OLD_UNOWN_Q + NATIONAL_DEX_OLD_UNOWN_R, // SPECIES_OLD_UNOWN_R + NATIONAL_DEX_OLD_UNOWN_S, // SPECIES_OLD_UNOWN_S + NATIONAL_DEX_OLD_UNOWN_T, // SPECIES_OLD_UNOWN_T + NATIONAL_DEX_OLD_UNOWN_U, // SPECIES_OLD_UNOWN_U + NATIONAL_DEX_OLD_UNOWN_V, // SPECIES_OLD_UNOWN_V + NATIONAL_DEX_OLD_UNOWN_W, // SPECIES_OLD_UNOWN_W + NATIONAL_DEX_OLD_UNOWN_X, // SPECIES_OLD_UNOWN_X + NATIONAL_DEX_OLD_UNOWN_Y, // SPECIES_OLD_UNOWN_Y + NATIONAL_DEX_OLD_UNOWN_Z, // SPECIES_OLD_UNOWN_Z + NATIONAL_DEX_TREECKO, // SPECIES_TREECKO + NATIONAL_DEX_GROVYLE, // SPECIES_GROVYLE + NATIONAL_DEX_SCEPTILE, // SPECIES_SCEPTILE + NATIONAL_DEX_TORCHIC, // SPECIES_TORCHIC + NATIONAL_DEX_COMBUSKEN, // SPECIES_COMBUSKEN + NATIONAL_DEX_BLAZIKEN, // SPECIES_BLAZIKEN + NATIONAL_DEX_MUDKIP, // SPECIES_MUDKIP + NATIONAL_DEX_MARSHTOMP, // SPECIES_MARSHTOMP + NATIONAL_DEX_SWAMPERT, // SPECIES_SWAMPERT + NATIONAL_DEX_POOCHYENA, // SPECIES_POOCHYENA + NATIONAL_DEX_MIGHTYENA, // SPECIES_MIGHTYENA + NATIONAL_DEX_ZIGZAGOON, // SPECIES_ZIGZAGOON + NATIONAL_DEX_LINOONE, // SPECIES_LINOONE + NATIONAL_DEX_WURMPLE, // SPECIES_WURMPLE + NATIONAL_DEX_SILCOON, // SPECIES_SILCOON + NATIONAL_DEX_BEAUTIFLY, // SPECIES_BEAUTIFLY + NATIONAL_DEX_CASCOON, // SPECIES_CASCOON + NATIONAL_DEX_DUSTOX, // SPECIES_DUSTOX + NATIONAL_DEX_LOTAD, // SPECIES_LOTAD + NATIONAL_DEX_LOMBRE, // SPECIES_LOMBRE + NATIONAL_DEX_LUDICOLO, // SPECIES_LUDICOLO + NATIONAL_DEX_SEEDOT, // SPECIES_SEEDOT + NATIONAL_DEX_NUZLEAF, // SPECIES_NUZLEAF + NATIONAL_DEX_SHIFTRY, // SPECIES_SHIFTRY + NATIONAL_DEX_NINCADA, // SPECIES_NINCADA + NATIONAL_DEX_NINJASK, // SPECIES_NINJASK + NATIONAL_DEX_SHEDINJA, // SPECIES_SHEDINJA + NATIONAL_DEX_TAILLOW, // SPECIES_TAILLOW + NATIONAL_DEX_SWELLOW, // SPECIES_SWELLOW + NATIONAL_DEX_SHROOMISH, // SPECIES_SHROOMISH + NATIONAL_DEX_BRELOOM, // SPECIES_BRELOOM + NATIONAL_DEX_SPINDA, // SPECIES_SPINDA + NATIONAL_DEX_WINGULL, // SPECIES_WINGULL + NATIONAL_DEX_PELIPPER, // SPECIES_PELIPPER + NATIONAL_DEX_SURSKIT, // SPECIES_SURSKIT + NATIONAL_DEX_MASQUERAIN, // SPECIES_MASQUERAIN + NATIONAL_DEX_WAILMER, // SPECIES_WAILMER + NATIONAL_DEX_WAILORD, // SPECIES_WAILORD + NATIONAL_DEX_SKITTY, // SPECIES_SKITTY + NATIONAL_DEX_DELCATTY, // SPECIES_DELCATTY + NATIONAL_DEX_KECLEON, // SPECIES_KECLEON + NATIONAL_DEX_BALTOY, // SPECIES_BALTOY + NATIONAL_DEX_CLAYDOL, // SPECIES_CLAYDOL + NATIONAL_DEX_NOSEPASS, // SPECIES_NOSEPASS + NATIONAL_DEX_TORKOAL, // SPECIES_TORKOAL + NATIONAL_DEX_SABLEYE, // SPECIES_SABLEYE + NATIONAL_DEX_BARBOACH, // SPECIES_BARBOACH + NATIONAL_DEX_WHISCASH, // SPECIES_WHISCASH + NATIONAL_DEX_LUVDISC, // SPECIES_LUVDISC + NATIONAL_DEX_CORPHISH, // SPECIES_CORPHISH + NATIONAL_DEX_CRAWDAUNT, // SPECIES_CRAWDAUNT + NATIONAL_DEX_FEEBAS, // SPECIES_FEEBAS + NATIONAL_DEX_MILOTIC, // SPECIES_MILOTIC + NATIONAL_DEX_CARVANHA, // SPECIES_CARVANHA + NATIONAL_DEX_SHARPEDO, // SPECIES_SHARPEDO + NATIONAL_DEX_TRAPINCH, // SPECIES_TRAPINCH + NATIONAL_DEX_VIBRAVA, // SPECIES_VIBRAVA + NATIONAL_DEX_FLYGON, // SPECIES_FLYGON + NATIONAL_DEX_MAKUHITA, // SPECIES_MAKUHITA + NATIONAL_DEX_HARIYAMA, // SPECIES_HARIYAMA + NATIONAL_DEX_ELECTRIKE, // SPECIES_ELECTRIKE + NATIONAL_DEX_MANECTRIC, // SPECIES_MANECTRIC + NATIONAL_DEX_NUMEL, // SPECIES_NUMEL + NATIONAL_DEX_CAMERUPT, // SPECIES_CAMERUPT + NATIONAL_DEX_SPHEAL, // SPECIES_SPHEAL + NATIONAL_DEX_SEALEO, // SPECIES_SEALEO + NATIONAL_DEX_WALREIN, // SPECIES_WALREIN + NATIONAL_DEX_CACNEA, // SPECIES_CACNEA + NATIONAL_DEX_CACTURNE, // SPECIES_CACTURNE + NATIONAL_DEX_SNORUNT, // SPECIES_SNORUNT + NATIONAL_DEX_GLALIE, // SPECIES_GLALIE + NATIONAL_DEX_LUNATONE, // SPECIES_LUNATONE + NATIONAL_DEX_SOLROCK, // SPECIES_SOLROCK + NATIONAL_DEX_AZURILL, // SPECIES_AZURILL + NATIONAL_DEX_SPOINK, // SPECIES_SPOINK + NATIONAL_DEX_GRUMPIG, // SPECIES_GRUMPIG + NATIONAL_DEX_PLUSLE, // SPECIES_PLUSLE + NATIONAL_DEX_MINUN, // SPECIES_MINUN + NATIONAL_DEX_MAWILE, // SPECIES_MAWILE + NATIONAL_DEX_MEDITITE, // SPECIES_MEDITITE + NATIONAL_DEX_MEDICHAM, // SPECIES_MEDICHAM + NATIONAL_DEX_SWABLU, // SPECIES_SWABLU + NATIONAL_DEX_ALTARIA, // SPECIES_ALTARIA + NATIONAL_DEX_WYNAUT, // SPECIES_WYNAUT + NATIONAL_DEX_DUSKULL, // SPECIES_DUSKULL + NATIONAL_DEX_DUSCLOPS, // SPECIES_DUSCLOPS + NATIONAL_DEX_ROSELIA, // SPECIES_ROSELIA + NATIONAL_DEX_SLAKOTH, // SPECIES_SLAKOTH + NATIONAL_DEX_VIGOROTH, // SPECIES_VIGOROTH + NATIONAL_DEX_SLAKING, // SPECIES_SLAKING + NATIONAL_DEX_GULPIN, // SPECIES_GULPIN + NATIONAL_DEX_SWALOT, // SPECIES_SWALOT + NATIONAL_DEX_TROPIUS, // SPECIES_TROPIUS + NATIONAL_DEX_WHISMUR, // SPECIES_WHISMUR + NATIONAL_DEX_LOUDRED, // SPECIES_LOUDRED + NATIONAL_DEX_EXPLOUD, // SPECIES_EXPLOUD + NATIONAL_DEX_CLAMPERL, // SPECIES_CLAMPERL + NATIONAL_DEX_HUNTAIL, // SPECIES_HUNTAIL + NATIONAL_DEX_GOREBYSS, // SPECIES_GOREBYSS + NATIONAL_DEX_ABSOL, // SPECIES_ABSOL + NATIONAL_DEX_SHUPPET, // SPECIES_SHUPPET + NATIONAL_DEX_BANETTE, // SPECIES_BANETTE + NATIONAL_DEX_SEVIPER, // SPECIES_SEVIPER + NATIONAL_DEX_ZANGOOSE, // SPECIES_ZANGOOSE + NATIONAL_DEX_RELICANTH, // SPECIES_RELICANTH + NATIONAL_DEX_ARON, // SPECIES_ARON + NATIONAL_DEX_LAIRON, // SPECIES_LAIRON + NATIONAL_DEX_AGGRON, // SPECIES_AGGRON + NATIONAL_DEX_CASTFORM, // SPECIES_CASTFORM + NATIONAL_DEX_VOLBEAT, // SPECIES_VOLBEAT + NATIONAL_DEX_ILLUMISE, // SPECIES_ILLUMISE + NATIONAL_DEX_LILEEP, // SPECIES_LILEEP + NATIONAL_DEX_CRADILY, // SPECIES_CRADILY + NATIONAL_DEX_ANORITH, // SPECIES_ANORITH + NATIONAL_DEX_ARMALDO, // SPECIES_ARMALDO + NATIONAL_DEX_RALTS, // SPECIES_RALTS + NATIONAL_DEX_KIRLIA, // SPECIES_KIRLIA + NATIONAL_DEX_GARDEVOIR, // SPECIES_GARDEVOIR + NATIONAL_DEX_BAGON, // SPECIES_BAGON + NATIONAL_DEX_SHELGON, // SPECIES_SHELGON + NATIONAL_DEX_SALAMENCE, // SPECIES_SALAMENCE + NATIONAL_DEX_BELDUM, // SPECIES_BELDUM + NATIONAL_DEX_METANG, // SPECIES_METANG + NATIONAL_DEX_METAGROSS, // SPECIES_METAGROSS + NATIONAL_DEX_REGIROCK, // SPECIES_REGIROCK + NATIONAL_DEX_REGICE, // SPECIES_REGICE + NATIONAL_DEX_REGISTEEL, // SPECIES_REGISTEEL + NATIONAL_DEX_KYOGRE, // SPECIES_KYOGRE + NATIONAL_DEX_GROUDON, // SPECIES_GROUDON + NATIONAL_DEX_RAYQUAZA, // SPECIES_RAYQUAZA + NATIONAL_DEX_LATIAS, // SPECIES_LATIAS + NATIONAL_DEX_LATIOS, // SPECIES_LATIOS + NATIONAL_DEX_JIRACHI, // SPECIES_JIRACHI + NATIONAL_DEX_DEOXYS, // SPECIES_DEOXYS + NATIONAL_DEX_CHIMECHO // SPECIES_CHIMECHO +}; + +const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National Dex Index) +{ + // 0 + NATIONAL_DEX_TREECKO, // HOENN_DEX_TREECKO + NATIONAL_DEX_GROVYLE, // HOENN_DEX_GROVYLE + NATIONAL_DEX_SCEPTILE, // HOENN_DEX_SCEPTILE + NATIONAL_DEX_TORCHIC, // HOENN_DEX_TORCHIC + NATIONAL_DEX_COMBUSKEN, // HOENN_DEX_COMBUSKEN + NATIONAL_DEX_BLAZIKEN, // HOENN_DEX_BLAZIKEN + NATIONAL_DEX_MUDKIP, // HOENN_DEX_MUDKIP + NATIONAL_DEX_MARSHTOMP, // HOENN_DEX_MARSHTOMP + NATIONAL_DEX_SWAMPERT, // HOENN_DEX_SWAMPERT + NATIONAL_DEX_POOCHYENA, // HOENN_DEX_POOCHYENA + NATIONAL_DEX_MIGHTYENA, // HOENN_DEX_MIGHTYENA + NATIONAL_DEX_ZIGZAGOON, // HOENN_DEX_ZIGZAGOON + NATIONAL_DEX_LINOONE, // HOENN_DEX_LINOONE + NATIONAL_DEX_WURMPLE, // HOENN_DEX_WURMPLE + NATIONAL_DEX_SILCOON, // HOENN_DEX_SILCOON + NATIONAL_DEX_BEAUTIFLY, // HOENN_DEX_BEAUTIFLY + NATIONAL_DEX_CASCOON, // HOENN_DEX_CASCOON + NATIONAL_DEX_DUSTOX, // HOENN_DEX_DUSTOX + NATIONAL_DEX_LOTAD, // HOENN_DEX_LOTAD + NATIONAL_DEX_LOMBRE, // HOENN_DEX_LOMBRE + NATIONAL_DEX_LUDICOLO, // HOENN_DEX_LUDICOLO + NATIONAL_DEX_SEEDOT, // HOENN_DEX_SEEDOT + NATIONAL_DEX_NUZLEAF, // HOENN_DEX_NUZLEAF + NATIONAL_DEX_SHIFTRY, // HOENN_DEX_SHIFTRY + NATIONAL_DEX_TAILLOW, // HOENN_DEX_TAILLOW + NATIONAL_DEX_SWELLOW, // HOENN_DEX_SWELLOW + NATIONAL_DEX_WINGULL, // HOENN_DEX_WINGULL + NATIONAL_DEX_PELIPPER, // HOENN_DEX_PELIPPER + NATIONAL_DEX_RALTS, // HOENN_DEX_RALTS + NATIONAL_DEX_KIRLIA, // HOENN_DEX_KIRLIA + NATIONAL_DEX_GARDEVOIR, // HOENN_DEX_GARDEVOIR + NATIONAL_DEX_SURSKIT, // HOENN_DEX_SURSKIT + NATIONAL_DEX_MASQUERAIN, // HOENN_DEX_MASQUERAIN + NATIONAL_DEX_SHROOMISH, // HOENN_DEX_SHROOMISH + NATIONAL_DEX_BRELOOM, // HOENN_DEX_BRELOOM + NATIONAL_DEX_SLAKOTH, // HOENN_DEX_SLAKOTH + NATIONAL_DEX_VIGOROTH, // HOENN_DEX_VIGOROTH + NATIONAL_DEX_SLAKING, // HOENN_DEX_SLAKING + NATIONAL_DEX_ABRA, // HOENN_DEX_ABRA + NATIONAL_DEX_KADABRA, // HOENN_DEX_KADABRA + NATIONAL_DEX_ALAKAZAM, // HOENN_DEX_ALAKAZAM + NATIONAL_DEX_NINCADA, // HOENN_DEX_NINCADA + NATIONAL_DEX_NINJASK, // HOENN_DEX_NINJASK + NATIONAL_DEX_SHEDINJA, // HOENN_DEX_SHEDINJA + NATIONAL_DEX_WHISMUR, // HOENN_DEX_WHISMUR + NATIONAL_DEX_LOUDRED, // HOENN_DEX_LOUDRED + NATIONAL_DEX_EXPLOUD, // HOENN_DEX_EXPLOUD + NATIONAL_DEX_MAKUHITA, // HOENN_DEX_MAKUHITA + NATIONAL_DEX_HARIYAMA, // HOENN_DEX_HARIYAMA + NATIONAL_DEX_GOLDEEN, // HOENN_DEX_GOLDEEN + NATIONAL_DEX_SEAKING, // HOENN_DEX_SEAKING + NATIONAL_DEX_MAGIKARP, // HOENN_DEX_MAGIKARP + NATIONAL_DEX_GYARADOS, // HOENN_DEX_GYARADOS + NATIONAL_DEX_AZURILL, // HOENN_DEX_AZURILL + NATIONAL_DEX_MARILL, // HOENN_DEX_MARILL + NATIONAL_DEX_AZUMARILL, // HOENN_DEX_AZUMARILL + NATIONAL_DEX_GEODUDE, // HOENN_DEX_GEODUDE + NATIONAL_DEX_GRAVELER, // HOENN_DEX_GRAVELER + NATIONAL_DEX_GOLEM, // HOENN_DEX_GOLEM + NATIONAL_DEX_NOSEPASS, // HOENN_DEX_NOSEPASS + NATIONAL_DEX_SKITTY, // HOENN_DEX_SKITTY + NATIONAL_DEX_DELCATTY, // HOENN_DEX_DELCATTY + NATIONAL_DEX_ZUBAT, // HOENN_DEX_ZUBAT + NATIONAL_DEX_GOLBAT, // HOENN_DEX_GOLBAT + NATIONAL_DEX_CROBAT, // HOENN_DEX_CROBAT + NATIONAL_DEX_TENTACOOL, // HOENN_DEX_TENTACOOL + NATIONAL_DEX_TENTACRUEL, // HOENN_DEX_TENTACRUEL + NATIONAL_DEX_SABLEYE, // HOENN_DEX_SABLEYE + NATIONAL_DEX_MAWILE, // HOENN_DEX_MAWILE + NATIONAL_DEX_ARON, // HOENN_DEX_ARON + NATIONAL_DEX_LAIRON, // HOENN_DEX_LAIRON + NATIONAL_DEX_AGGRON, // HOENN_DEX_AGGRON + NATIONAL_DEX_MACHOP, // HOENN_DEX_MACHOP + NATIONAL_DEX_MACHOKE, // HOENN_DEX_MACHOKE + NATIONAL_DEX_MACHAMP, // HOENN_DEX_MACHAMP + NATIONAL_DEX_MEDITITE, // HOENN_DEX_MEDITITE + NATIONAL_DEX_MEDICHAM, // HOENN_DEX_MEDICHAM + NATIONAL_DEX_ELECTRIKE, // HOENN_DEX_ELECTRIKE + NATIONAL_DEX_MANECTRIC, // HOENN_DEX_MANECTRIC + NATIONAL_DEX_PLUSLE, // HOENN_DEX_PLUSLE + NATIONAL_DEX_MINUN, // HOENN_DEX_MINUN + NATIONAL_DEX_MAGNEMITE, // HOENN_DEX_MAGNEMITE + NATIONAL_DEX_MAGNETON, // HOENN_DEX_MAGNETON + NATIONAL_DEX_VOLTORB, // HOENN_DEX_VOLTORB + NATIONAL_DEX_ELECTRODE, // HOENN_DEX_ELECTRODE + NATIONAL_DEX_VOLBEAT, // HOENN_DEX_VOLBEAT + NATIONAL_DEX_ILLUMISE, // HOENN_DEX_ILLUMISE + NATIONAL_DEX_ODDISH, // HOENN_DEX_ODDISH + NATIONAL_DEX_GLOOM, // HOENN_DEX_GLOOM + NATIONAL_DEX_VILEPLUME, // HOENN_DEX_VILEPLUME + NATIONAL_DEX_BELLOSSOM, // HOENN_DEX_BELLOSSOM + NATIONAL_DEX_DODUO, // HOENN_DEX_DODUO + NATIONAL_DEX_DODRIO, // HOENN_DEX_DODRIO + NATIONAL_DEX_ROSELIA, // HOENN_DEX_ROSELIA + NATIONAL_DEX_GULPIN, // HOENN_DEX_GULPIN + NATIONAL_DEX_SWALOT, // HOENN_DEX_SWALOT + NATIONAL_DEX_CARVANHA, // HOENN_DEX_CARVANHA + NATIONAL_DEX_SHARPEDO, // HOENN_DEX_SHARPEDO + NATIONAL_DEX_WAILMER, // HOENN_DEX_WAILMER + NATIONAL_DEX_WAILORD, // HOENN_DEX_WAILORD + NATIONAL_DEX_NUMEL, // HOENN_DEX_NUMEL + NATIONAL_DEX_CAMERUPT, // HOENN_DEX_CAMERUPT + NATIONAL_DEX_SLUGMA, // HOENN_DEX_SLUGMA + NATIONAL_DEX_MAGCARGO, // HOENN_DEX_MAGCARGO + NATIONAL_DEX_TORKOAL, // HOENN_DEX_TORKOAL + NATIONAL_DEX_GRIMER, // HOENN_DEX_GRIMER + NATIONAL_DEX_MUK, // HOENN_DEX_MUK + NATIONAL_DEX_KOFFING, // HOENN_DEX_KOFFING + NATIONAL_DEX_WEEZING, // HOENN_DEX_WEEZING + NATIONAL_DEX_SPOINK, // HOENN_DEX_SPOINK + NATIONAL_DEX_GRUMPIG, // HOENN_DEX_GRUMPIG + NATIONAL_DEX_SANDSHREW, // HOENN_DEX_SANDSHREW + NATIONAL_DEX_SANDSLASH, // HOENN_DEX_SANDSLASH + NATIONAL_DEX_SPINDA, // HOENN_DEX_SPINDA + NATIONAL_DEX_SKARMORY, // HOENN_DEX_SKARMORY + NATIONAL_DEX_TRAPINCH, // HOENN_DEX_TRAPINCH + NATIONAL_DEX_VIBRAVA, // HOENN_DEX_VIBRAVA + NATIONAL_DEX_FLYGON, // HOENN_DEX_FLYGON + NATIONAL_DEX_CACNEA, // HOENN_DEX_CACNEA + NATIONAL_DEX_CACTURNE, // HOENN_DEX_CACTURNE + NATIONAL_DEX_SWABLU, // HOENN_DEX_SWABLU + NATIONAL_DEX_ALTARIA, // HOENN_DEX_ALTARIA + NATIONAL_DEX_ZANGOOSE, // HOENN_DEX_ZANGOOSE + NATIONAL_DEX_SEVIPER, // HOENN_DEX_SEVIPER + NATIONAL_DEX_LUNATONE, // HOENN_DEX_LUNATONE + NATIONAL_DEX_SOLROCK, // HOENN_DEX_SOLROCK + NATIONAL_DEX_BARBOACH, // HOENN_DEX_BARBOACH + NATIONAL_DEX_WHISCASH, // HOENN_DEX_WHISCASH + NATIONAL_DEX_CORPHISH, // HOENN_DEX_CORPHISH + NATIONAL_DEX_CRAWDAUNT, // HOENN_DEX_CRAWDAUNT + NATIONAL_DEX_BALTOY, // HOENN_DEX_BALTOY + NATIONAL_DEX_CLAYDOL, // HOENN_DEX_CLAYDOL + NATIONAL_DEX_LILEEP, // HOENN_DEX_LILEEP + NATIONAL_DEX_CRADILY, // HOENN_DEX_CRADILY + NATIONAL_DEX_ANORITH, // HOENN_DEX_ANORITH + NATIONAL_DEX_ARMALDO, // HOENN_DEX_ARMALDO + NATIONAL_DEX_IGGLYBUFF, // HOENN_DEX_IGGLYBUFF + NATIONAL_DEX_JIGGLYPUFF, // HOENN_DEX_JIGGLYPUFF + NATIONAL_DEX_WIGGLYTUFF, // HOENN_DEX_WIGGLYTUFF + NATIONAL_DEX_FEEBAS, // HOENN_DEX_FEEBAS + NATIONAL_DEX_MILOTIC, // HOENN_DEX_MILOTIC + NATIONAL_DEX_CASTFORM, // HOENN_DEX_CASTFORM + NATIONAL_DEX_STARYU, // HOENN_DEX_STARYU + NATIONAL_DEX_STARMIE, // HOENN_DEX_STARMIE + NATIONAL_DEX_KECLEON, // HOENN_DEX_KECLEON + NATIONAL_DEX_SHUPPET, // HOENN_DEX_SHUPPET + NATIONAL_DEX_BANETTE, // HOENN_DEX_BANETTE + NATIONAL_DEX_DUSKULL, // HOENN_DEX_DUSKULL + NATIONAL_DEX_DUSCLOPS, // HOENN_DEX_DUSCLOPS + NATIONAL_DEX_TROPIUS, // HOENN_DEX_TROPIUS + NATIONAL_DEX_CHIMECHO, // HOENN_DEX_CHIMECHO + NATIONAL_DEX_ABSOL, // HOENN_DEX_ABSOL + NATIONAL_DEX_VULPIX, // HOENN_DEX_VULPIX + NATIONAL_DEX_NINETALES, // HOENN_DEX_NINETALES + NATIONAL_DEX_PICHU, // HOENN_DEX_PICHU + NATIONAL_DEX_PIKACHU, // HOENN_DEX_PIKACHU + NATIONAL_DEX_RAICHU, // HOENN_DEX_RAICHU + NATIONAL_DEX_PSYDUCK, // HOENN_DEX_PSYDUCK + NATIONAL_DEX_GOLDUCK, // HOENN_DEX_GOLDUCK + NATIONAL_DEX_WYNAUT, // HOENN_DEX_WYNAUT + NATIONAL_DEX_WOBBUFFET, // HOENN_DEX_WOBBUFFET + NATIONAL_DEX_NATU, // HOENN_DEX_NATU + NATIONAL_DEX_XATU, // HOENN_DEX_XATU + NATIONAL_DEX_GIRAFARIG, // HOENN_DEX_GIRAFARIG + NATIONAL_DEX_PHANPY, // HOENN_DEX_PHANPY + NATIONAL_DEX_DONPHAN, // HOENN_DEX_DONPHAN + NATIONAL_DEX_PINSIR, // HOENN_DEX_PINSIR + NATIONAL_DEX_HERACROSS, // HOENN_DEX_HERACROSS + NATIONAL_DEX_RHYHORN, // HOENN_DEX_RHYHORN + NATIONAL_DEX_RHYDON, // HOENN_DEX_RHYDON + NATIONAL_DEX_SNORUNT, // HOENN_DEX_SNORUNT + NATIONAL_DEX_GLALIE, // HOENN_DEX_GLALIE + NATIONAL_DEX_SPHEAL, // HOENN_DEX_SPHEAL + NATIONAL_DEX_SEALEO, // HOENN_DEX_SEALEO + NATIONAL_DEX_WALREIN, // HOENN_DEX_WALREIN + NATIONAL_DEX_CLAMPERL, // HOENN_DEX_CLAMPERL + NATIONAL_DEX_HUNTAIL, // HOENN_DEX_HUNTAIL + NATIONAL_DEX_GOREBYSS, // HOENN_DEX_GOREBYSS + NATIONAL_DEX_RELICANTH, // HOENN_DEX_RELICANTH + NATIONAL_DEX_CORSOLA, // HOENN_DEX_CORSOLA + NATIONAL_DEX_CHINCHOU, // HOENN_DEX_CHINCHOU + NATIONAL_DEX_LANTURN, // HOENN_DEX_LANTURN + NATIONAL_DEX_LUVDISC, // HOENN_DEX_LUVDISC + NATIONAL_DEX_HORSEA, // HOENN_DEX_HORSEA + NATIONAL_DEX_SEADRA, // HOENN_DEX_SEADRA + NATIONAL_DEX_KINGDRA, // HOENN_DEX_KINGDRA + NATIONAL_DEX_BAGON, // HOENN_DEX_BAGON + NATIONAL_DEX_SHELGON, // HOENN_DEX_SHELGON + NATIONAL_DEX_SALAMENCE, // HOENN_DEX_SALAMENCE + NATIONAL_DEX_BELDUM, // HOENN_DEX_BELDUM + NATIONAL_DEX_METANG, // HOENN_DEX_METANG + NATIONAL_DEX_METAGROSS, // HOENN_DEX_METAGROSS + NATIONAL_DEX_REGIROCK, // HOENN_DEX_REGIROCK + NATIONAL_DEX_REGICE, // HOENN_DEX_REGICE + NATIONAL_DEX_REGISTEEL, // HOENN_DEX_REGISTEEL + NATIONAL_DEX_LATIAS, // HOENN_DEX_LATIAS + NATIONAL_DEX_LATIOS, // HOENN_DEX_LATIOS + NATIONAL_DEX_KYOGRE, // HOENN_DEX_KYOGRE + NATIONAL_DEX_GROUDON, // HOENN_DEX_GROUDON + NATIONAL_DEX_RAYQUAZA, // HOENN_DEX_RAYQUAZA + NATIONAL_DEX_JIRACHI, // HOENN_DEX_JIRACHI + NATIONAL_DEX_DEOXYS, // HOENN_DEX_DEOXYS + NATIONAL_DEX_BULBASAUR, // HOENN_DEX_BULBASAUR - Pokémon from here onwards are UNSEEN in the Hoenn Dex. + NATIONAL_DEX_IVYSAUR, // HOENN_DEX_IVYSAUR + NATIONAL_DEX_VENUSAUR, // HOENN_DEX_VENUSAUR + NATIONAL_DEX_CHARMANDER, // HOENN_DEX_CHARMANDER + NATIONAL_DEX_CHARMELEON, // HOENN_DEX_CHARMELEON + NATIONAL_DEX_CHARIZARD, // HOENN_DEX_CHARIZARD + NATIONAL_DEX_SQUIRTLE, // HOENN_DEX_SQUIRTLE + NATIONAL_DEX_WARTORTLE, // HOENN_DEX_WARTORTLE + NATIONAL_DEX_BLASTOISE, // HOENN_DEX_BLASTOISE + NATIONAL_DEX_CATERPIE, // HOENN_DEX_CATERPIE + NATIONAL_DEX_METAPOD, // HOENN_DEX_METAPOD + NATIONAL_DEX_BUTTERFREE, // HOENN_DEX_BUTTERFREE + NATIONAL_DEX_WEEDLE, // HOENN_DEX_WEEDLE + NATIONAL_DEX_KAKUNA, // HOENN_DEX_KAKUNA + NATIONAL_DEX_BEEDRILL, // HOENN_DEX_BEEDRILL + NATIONAL_DEX_PIDGEY, // HOENN_DEX_PIDGEY + NATIONAL_DEX_PIDGEOTTO, // HOENN_DEX_PIDGEOTTO + NATIONAL_DEX_PIDGEOT, // HOENN_DEX_PIDGEOT + NATIONAL_DEX_RATTATA, // HOENN_DEX_RATTATA + NATIONAL_DEX_RATICATE, // HOENN_DEX_RATICATE + NATIONAL_DEX_SPEAROW, // HOENN_DEX_SPEAROW + NATIONAL_DEX_FEAROW, // HOENN_DEX_FEAROW + NATIONAL_DEX_EKANS, // HOENN_DEX_EKANS + NATIONAL_DEX_ARBOK, // HOENN_DEX_ARBOK + NATIONAL_DEX_NIDORAN_F, // HOENN_DEX_NIDORAN♀ + NATIONAL_DEX_NIDORINA, // HOENN_DEX_NIDORINA + NATIONAL_DEX_NIDOQUEEN, // HOENN_DEX_NIDOQUEEN + NATIONAL_DEX_NIDORAN_M, // HOENN_DEX_NIDORAN♂ + NATIONAL_DEX_NIDORINO, // HOENN_DEX_NIDORINO + NATIONAL_DEX_NIDOKING, // HOENN_DEX_NIDOKING + NATIONAL_DEX_CLEFAIRY, // HOENN_DEX_CLEFAIRY + NATIONAL_DEX_CLEFABLE, // HOENN_DEX_CLEFABLE + NATIONAL_DEX_PARAS, // HOENN_DEX_PARAS + NATIONAL_DEX_PARASECT, // HOENN_DEX_PARASECT + NATIONAL_DEX_VENONAT, // HOENN_DEX_VENONAT + NATIONAL_DEX_VENOMOTH, // HOENN_DEX_VENOMOTH + NATIONAL_DEX_DIGLETT, // HOENN_DEX_DIGLETT + NATIONAL_DEX_DUGTRIO, // HOENN_DEX_DUGTRIO + NATIONAL_DEX_MEOWTH, // HOENN_DEX_MEOWTH + NATIONAL_DEX_PERSIAN, // HOENN_DEX_PERSIAN + NATIONAL_DEX_MANKEY, // HOENN_DEX_MANKEY + NATIONAL_DEX_PRIMEAPE, // HOENN_DEX_PRIMEAPE + NATIONAL_DEX_GROWLITHE, // HOENN_DEX_GROWLITHE + NATIONAL_DEX_ARCANINE, // HOENN_DEX_ARCANINE + NATIONAL_DEX_POLIWAG, // HOENN_DEX_POLIWAG + NATIONAL_DEX_POLIWHIRL, // HOENN_DEX_POLIWHIRL + NATIONAL_DEX_POLIWRATH, // HOENN_DEX_POLIWRATH + NATIONAL_DEX_BELLSPROUT, // HOENN_DEX_BELLSPROUT + NATIONAL_DEX_WEEPINBELL, // HOENN_DEX_WEEPINBELL + NATIONAL_DEX_VICTREEBEL, // HOENN_DEX_VICTREEBEL + NATIONAL_DEX_PONYTA, // HOENN_DEX_PONYTA + NATIONAL_DEX_RAPIDASH, // HOENN_DEX_RAPIDASH + NATIONAL_DEX_SLOWPOKE, // HOENN_DEX_SLOWPOKE + NATIONAL_DEX_SLOWBRO, // HOENN_DEX_SLOWBRO + NATIONAL_DEX_FARFETCHD, // HOENN_DEX_FARFETCH'D + NATIONAL_DEX_SEEL, // HOENN_DEX_SEEL + NATIONAL_DEX_DEWGONG, // HOENN_DEX_DEWGONG + NATIONAL_DEX_SHELLDER, // HOENN_DEX_SHELLDER + NATIONAL_DEX_CLOYSTER, // HOENN_DEX_CLOYSTER + NATIONAL_DEX_GASTLY, // HOENN_DEX_GASTLY + NATIONAL_DEX_HAUNTER, // HOENN_DEX_HAUNTER + NATIONAL_DEX_GENGAR, // HOENN_DEX_GENGAR + NATIONAL_DEX_ONIX, // HOENN_DEX_ONIX + NATIONAL_DEX_DROWZEE, // HOENN_DEX_DROWZEE + NATIONAL_DEX_HYPNO, // HOENN_DEX_HYPNO + NATIONAL_DEX_KRABBY, // HOENN_DEX_KRABBY + NATIONAL_DEX_KINGLER, // HOENN_DEX_KINGLER + NATIONAL_DEX_EXEGGCUTE, // HOENN_DEX_EXEGGCUTE + NATIONAL_DEX_EXEGGUTOR, // HOENN_DEX_EXEGGUTOR + NATIONAL_DEX_CUBONE, // HOENN_DEX_CUBONE + NATIONAL_DEX_MAROWAK, // HOENN_DEX_MAROWAK + NATIONAL_DEX_HITMONLEE, // HOENN_DEX_HITMONLEE + NATIONAL_DEX_HITMONCHAN, // HOENN_DEX_HITMONCHAN + NATIONAL_DEX_LICKITUNG, // HOENN_DEX_LICKITUNG + NATIONAL_DEX_CHANSEY, // HOENN_DEX_CHANSEY + NATIONAL_DEX_TANGELA, // HOENN_DEX_TANGELA + NATIONAL_DEX_KANGASKHAN, // HOENN_DEX_KANGASKHAN + NATIONAL_DEX_MR_MIME, // HOENN_DEX_MR. MIME + NATIONAL_DEX_SCYTHER, // HOENN_DEX_SCYTHER + NATIONAL_DEX_JYNX, // HOENN_DEX_JYNX + NATIONAL_DEX_ELECTABUZZ, // HOENN_DEX_ELECTABUZZ + NATIONAL_DEX_MAGMAR, // HOENN_DEX_MAGMAR + NATIONAL_DEX_TAUROS, // HOENN_DEX_TAUROS + NATIONAL_DEX_LAPRAS, // HOENN_DEX_LAPRAS + NATIONAL_DEX_DITTO, // HOENN_DEX_DITTO + NATIONAL_DEX_EEVEE, // HOENN_DEX_EEVEE + NATIONAL_DEX_VAPOREON, // HOENN_DEX_VAPOREON + NATIONAL_DEX_JOLTEON, // HOENN_DEX_JOLTEON + NATIONAL_DEX_FLAREON, // HOENN_DEX_FLAREON + NATIONAL_DEX_PORYGON, // HOENN_DEX_PORYGON + NATIONAL_DEX_OMANYTE, // HOENN_DEX_OMANYTE + NATIONAL_DEX_OMASTAR, // HOENN_DEX_OMASTAR + NATIONAL_DEX_KABUTO, // HOENN_DEX_KABUTO + NATIONAL_DEX_KABUTOPS, // HOENN_DEX_KABUTOPS + NATIONAL_DEX_AERODACTYL, // HOENN_DEX_AERODACTYL + NATIONAL_DEX_SNORLAX, // HOENN_DEX_SNORLAX + NATIONAL_DEX_ARTICUNO, // HOENN_DEX_ARTICUNO + NATIONAL_DEX_ZAPDOS, // HOENN_DEX_ZAPDOS + NATIONAL_DEX_MOLTRES, // HOENN_DEX_MOLTRES + NATIONAL_DEX_DRATINI, // HOENN_DEX_DRATINI + NATIONAL_DEX_DRAGONAIR, // HOENN_DEX_DRAGONAIR + NATIONAL_DEX_DRAGONITE, // HOENN_DEX_DRAGONITE + NATIONAL_DEX_MEWTWO, // HOENN_DEX_MEWTWO + NATIONAL_DEX_MEW, // HOENN_DEX_MEW + NATIONAL_DEX_CHIKORITA, // HOENN_DEX_CHIKORITA + NATIONAL_DEX_BAYLEEF, // HOENN_DEX_BAYLEEF + NATIONAL_DEX_MEGANIUM, // HOENN_DEX_MEGANIUM + NATIONAL_DEX_CYNDAQUIL, // HOENN_DEX_CYNDAQUIL + NATIONAL_DEX_QUILAVA, // HOENN_DEX_QUILAVA + NATIONAL_DEX_TYPHLOSION, // HOENN_DEX_TYPHLOSION + NATIONAL_DEX_TOTODILE, // HOENN_DEX_TOTODILE + NATIONAL_DEX_CROCONAW, // HOENN_DEX_CROCONAW + NATIONAL_DEX_FERALIGATR, // HOENN_DEX_FERALIGATR + NATIONAL_DEX_SENTRET, // HOENN_DEX_SENTRET + NATIONAL_DEX_FURRET, // HOENN_DEX_FURRET + NATIONAL_DEX_HOOTHOOT, // HOENN_DEX_HOOTHOOT + NATIONAL_DEX_NOCTOWL, // HOENN_DEX_NOCTOWL + NATIONAL_DEX_LEDYBA, // HOENN_DEX_LEDYBA + NATIONAL_DEX_LEDIAN, // HOENN_DEX_LEDIAN + NATIONAL_DEX_SPINARAK, // HOENN_DEX_SPINARAK + NATIONAL_DEX_ARIADOS, // HOENN_DEX_ARIADOS + NATIONAL_DEX_CLEFFA, // HOENN_DEX_CLEFFA + NATIONAL_DEX_TOGEPI, // HOENN_DEX_TOGEPI + NATIONAL_DEX_TOGETIC, // HOENN_DEX_TOGETIC + NATIONAL_DEX_MAREEP, // HOENN_DEX_MAREEP + NATIONAL_DEX_FLAAFFY, // HOENN_DEX_FLAAFFY + NATIONAL_DEX_AMPHAROS, // HOENN_DEX_AMPHAROS + NATIONAL_DEX_SUDOWOODO, // HOENN_DEX_SUDOWOODO + NATIONAL_DEX_POLITOED, // HOENN_DEX_POLITOED + NATIONAL_DEX_HOPPIP, // HOENN_DEX_HOPPIP + NATIONAL_DEX_SKIPLOOM, // HOENN_DEX_SKIPLOOM + NATIONAL_DEX_JUMPLUFF, // HOENN_DEX_JUMPLUFF + NATIONAL_DEX_AIPOM, // HOENN_DEX_AIPOM + NATIONAL_DEX_SUNKERN, // HOENN_DEX_SUNKERN + NATIONAL_DEX_SUNFLORA, // HOENN_DEX_SUNFLORA + NATIONAL_DEX_YANMA, // HOENN_DEX_YANMA + NATIONAL_DEX_WOOPER, // HOENN_DEX_WOOPER + NATIONAL_DEX_QUAGSIRE, // HOENN_DEX_QUAGSIRE + NATIONAL_DEX_ESPEON, // HOENN_DEX_ESPEON + NATIONAL_DEX_UMBREON, // HOENN_DEX_UMBREON + NATIONAL_DEX_MURKROW, // HOENN_DEX_MURKROW + NATIONAL_DEX_SLOWKING, // HOENN_DEX_SLOWKING + NATIONAL_DEX_MISDREAVUS, // HOENN_DEX_MISDREAVUS + NATIONAL_DEX_UNOWN, // HOENN_DEX_UNOWN + NATIONAL_DEX_PINECO, // HOENN_DEX_PINECO + NATIONAL_DEX_FORRETRESS, // HOENN_DEX_FORRETRESS + NATIONAL_DEX_DUNSPARCE, // HOENN_DEX_DUNSPARCE + NATIONAL_DEX_GLIGAR, // HOENN_DEX_GLIGAR + NATIONAL_DEX_STEELIX, // HOENN_DEX_STEELIX + NATIONAL_DEX_SNUBBULL, // HOENN_DEX_SNUBBULL + NATIONAL_DEX_GRANBULL, // HOENN_DEX_GRANBULL + NATIONAL_DEX_QWILFISH, // HOENN_DEX_QWILFISH + NATIONAL_DEX_SCIZOR, // HOENN_DEX_SCIZOR + NATIONAL_DEX_SHUCKLE, // HOENN_DEX_SHUCKLE + NATIONAL_DEX_SNEASEL, // HOENN_DEX_SNEASEL + NATIONAL_DEX_TEDDIURSA, // HOENN_DEX_TEDDIURSA + NATIONAL_DEX_URSARING, // HOENN_DEX_URSARING + NATIONAL_DEX_SWINUB, // HOENN_DEX_SWINUB + NATIONAL_DEX_PILOSWINE, // HOENN_DEX_PILOSWINE + NATIONAL_DEX_REMORAID, // HOENN_DEX_REMORAID + NATIONAL_DEX_OCTILLERY, // HOENN_DEX_OCTILLERY + NATIONAL_DEX_DELIBIRD, // HOENN_DEX_DELIBIRD + NATIONAL_DEX_MANTINE, // HOENN_DEX_MANTINE + NATIONAL_DEX_HOUNDOUR, // HOENN_DEX_HOUNDOUR + NATIONAL_DEX_HOUNDOOM, // HOENN_DEX_HOUNDOOM + NATIONAL_DEX_PORYGON2, // HOENN_DEX_PORYGON2 + NATIONAL_DEX_STANTLER, // HOENN_DEX_STANTLER + NATIONAL_DEX_SMEARGLE, // HOENN_DEX_SMEARGLE + NATIONAL_DEX_TYROGUE, // HOENN_DEX_TYROGUE + NATIONAL_DEX_HITMONTOP, // HOENN_DEX_HITMONTOP + NATIONAL_DEX_SMOOCHUM, // HOENN_DEX_SMOOCHUM + NATIONAL_DEX_ELEKID, // HOENN_DEX_ELEKID + NATIONAL_DEX_MAGBY, // HOENN_DEX_MAGBY + NATIONAL_DEX_MILTANK, // HOENN_DEX_MILTANK + NATIONAL_DEX_BLISSEY, // HOENN_DEX_BLISSEY + NATIONAL_DEX_RAIKOU, // HOENN_DEX_RAIKOU + NATIONAL_DEX_ENTEI, // HOENN_DEX_ENTEI + NATIONAL_DEX_SUICUNE, // HOENN_DEX_SUICUNE + NATIONAL_DEX_LARVITAR, // HOENN_DEX_LARVITAR + NATIONAL_DEX_PUPITAR, // HOENN_DEX_PUPITAR + NATIONAL_DEX_TYRANITAR, // HOENN_DEX_TYRANITAR + NATIONAL_DEX_LUGIA, // HOENN_DEX_LUGIA + NATIONAL_DEX_HO_OH, // HOENN_DEX_HO-OH + NATIONAL_DEX_CELEBI, // HOENN_DEX_CELEBI + NATIONAL_DEX_OLD_UNOWN_B, // HOENN_DEX_OLD_UNOWN_B + NATIONAL_DEX_OLD_UNOWN_C, // HOENN_DEX_OLD_UNOWN_C + NATIONAL_DEX_OLD_UNOWN_D, // HOENN_DEX_OLD_UNOWN_D + NATIONAL_DEX_OLD_UNOWN_E, // HOENN_DEX_OLD_UNOWN_E + NATIONAL_DEX_OLD_UNOWN_F, // HOENN_DEX_OLD_UNOWN_F + NATIONAL_DEX_OLD_UNOWN_G, // HOENN_DEX_OLD_UNOWN_G + NATIONAL_DEX_OLD_UNOWN_H, // HOENN_DEX_OLD_UNOWN_H + NATIONAL_DEX_OLD_UNOWN_I, // HOENN_DEX_OLD_UNOWN_I + NATIONAL_DEX_OLD_UNOWN_J, // HOENN_DEX_OLD_UNOWN_J + NATIONAL_DEX_OLD_UNOWN_K, // HOENN_DEX_OLD_UNOWN_K + NATIONAL_DEX_OLD_UNOWN_L, // HOENN_DEX_OLD_UNOWN_L + NATIONAL_DEX_OLD_UNOWN_M, // HOENN_DEX_OLD_UNOWN_M + NATIONAL_DEX_OLD_UNOWN_N, // HOENN_DEX_OLD_UNOWN_N + NATIONAL_DEX_OLD_UNOWN_O, // HOENN_DEX_OLD_UNOWN_O + NATIONAL_DEX_OLD_UNOWN_P, // HOENN_DEX_OLD_UNOWN_P + NATIONAL_DEX_OLD_UNOWN_Q, // HOENN_DEX_OLD_UNOWN_Q + NATIONAL_DEX_OLD_UNOWN_R, // HOENN_DEX_OLD_UNOWN_R + NATIONAL_DEX_OLD_UNOWN_S, // HOENN_DEX_OLD_UNOWN_S + NATIONAL_DEX_OLD_UNOWN_T, // HOENN_DEX_OLD_UNOWN_T + NATIONAL_DEX_OLD_UNOWN_U, // HOENN_DEX_OLD_UNOWN_U + NATIONAL_DEX_OLD_UNOWN_V, // HOENN_DEX_OLD_UNOWN_V + NATIONAL_DEX_OLD_UNOWN_W, // HOENN_DEX_OLD_UNOWN_W + NATIONAL_DEX_OLD_UNOWN_X, // HOENN_DEX_OLD_UNOWN_X + NATIONAL_DEX_OLD_UNOWN_Y, // HOENN_DEX_OLD_UNOWN_Y + NATIONAL_DEX_OLD_UNOWN_Z // HOENN_DEX_OLD_UNOWN_Z +}; const struct SpindaSpot gSpindaSpotGraphics[] = { From e7da51438286bceaa085aad524065cbfe645faf0 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Wed, 15 Aug 2018 15:58:41 -0700 Subject: [PATCH 20/21] Finish documenting and cleaning up summary_screen Also fix remaining nonmatchings --- src/pokemon_summary_screen.c | 1692 ++++++++++++++-------------------- 1 file changed, 672 insertions(+), 1020 deletions(-) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index ef55129f4..c47ddb14c 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -107,7 +107,7 @@ static EWRAM_DATA struct UnkSummaryStruct bool8 unk40EF; s16 unk40F0; u8 unk_filler4[6]; -} *gUnknown_0203CF1C = NULL; +} *pssData = NULL; EWRAM_DATA u8 gUnknown_0203CF20 = 0; static EWRAM_DATA u8 gUnknown_0203CF21 = 0; static EWRAM_DATA u8 gFiller_0203CF22[2] = {0}; @@ -131,123 +131,123 @@ bool8 sub_81B1250(void); static bool8 SummaryScreen_LoadGraphics(void); static void SummaryScreen_LoadingCB2(void); static void InitBGs(void); -u8 sub_81BFEB0(void); -void CopyMonToSummaryStruct(struct Pokemon* a); -bool8 ExtractMonDataToSummaryStruct(struct Pokemon* a); -void sub_81C0348(void); -void sub_81C0484(u8 taskId); -void sub_81C0510(u8 taskId); -void sub_81C0604(u8 taskId, s8 a); -void sub_81C0704(u8 taskId); -s8 sub_81C08F8(s8 a); -s8 sub_81C09B4(s8 a); -bool8 sub_81C0A50(struct Pokemon* mon); -void sub_81C0A8C(u8 taskId, s8 a); -void sub_81C0B8C(u8 taskId); -void sub_81C0C68(u8 taskId); -void sub_81C0CC4(u8 taskId); -void sub_81C0D44(u8 taskId); -void sub_81C0E24(void); -void sub_81C0E48(u8 taskId); -void sub_81C0F44(u8 taskId); -bool8 sub_81C1040(void); -void sub_81C1070(s16* a, s8 b, u8* c); -void sub_81C11F4(u8 a); -void sub_81C129C(u8 a); -void sub_81C12E4(u8 taskId); -void sub_81C13B0(u8 taskId, bool8 b); -void sub_81C14BC(struct Pokemon *mon, u8 a, u8 b); -void sub_81C15EC(struct BoxPokemon *mon, u8 a, u8 b); -void sub_81C171C(u8 taskId); -void sub_81C174C(u8 taskId); -bool8 sub_81C18A8(void); -void sub_81C18F4(u8 a); -void sub_81C1940(u8 taskId); -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); -void sub_81C1F80(u8 taskId); -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); -void sub_81C27DC(struct Pokemon *mon, u16 a); -static void PrintPageNamesAndStatsPage(void); -void sub_81C2AFC(u8 a); -void sub_81C2C38(u8 a); -void SummaryScreen_RemoveWindowByIndex(u8 a); -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); -void sub_81C3554(u8 taskId); -void PrintHeldItemName(void); -void sub_81C3530(void); -void PrintRibbonCount(void); -void BufferLeftColumnStats(void); -void PrintLeftColumnStats(void); -void BufferRightColumnStats(void); -void PrintRightColumnStats(void); -void PrintExpPointsNextLevel(void); -void sub_81C3984(void); -void sub_81C39F0(u8 taskId); -void PrintMoveNameAndPP(u8 a); -void sub_81C3D08(void); -void sub_81C3D54(u8 taskId); -void PrintContestMoveDescription(u8 a); -void PrintMoveDetails(u16 a); -void PrintNewMoveDetailsOrCancelText(void); -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 *); +static bool8 SummaryScreen_DecompressGraphics(void); +static void CopyMonToSummaryStruct(struct Pokemon* a); +static bool8 ExtractMonDataToSummaryStruct(struct Pokemon* a); +static void sub_81C0348(void); +static void sub_81C0484(u8 taskId); +static void sub_81C0510(u8 taskId); +static void sub_81C0604(u8 taskId, s8 a); +static void sub_81C0704(u8 taskId); +static s8 sub_81C08F8(s8 a); +static s8 sub_81C09B4(s8 a); +static bool8 sub_81C0A50(struct Pokemon* mon); +static void sub_81C0A8C(u8 taskId, s8 a); +static void sub_81C0B8C(u8 taskId); +static void sub_81C0C68(u8 taskId); +static void sub_81C0CC4(u8 taskId); +static void sub_81C0D44(u8 taskId); +static void sub_81C0E24(void); +static void sub_81C0E48(u8 taskId); +static void sub_81C0F44(u8 taskId); +static bool8 sub_81C1040(void); +static void sub_81C1070(s16* a, s8 b, u8* c); +static void sub_81C11F4(u8 a); +static void sub_81C129C(u8 a); +static void sub_81C12E4(u8 taskId); +static void sub_81C13B0(u8 taskId, bool8 b); +static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2); +static void SwapBoxMonMoves(struct BoxPokemon *mon, u8 moveIndex1, u8 moveIndex2); +static void sub_81C171C(u8 taskId); +static void sub_81C174C(u8 taskId); +static bool8 sub_81C18A8(void); +static void sub_81C18F4(u8 a); +static void sub_81C1940(u8 taskId); +static void sub_81C1BA0(void); +static void sub_81C1DA4(u16 a, s16 b); +static void sub_81C1E20(u8 taskId); +static void sub_81C1EFC(u16 a, s16 b, u16 c); +static void sub_81C1F80(u8 taskId); +static void sub_81C2074(u16 a, s16 b); +static void sub_81C20F0(u8 taskId); +static void sub_81C2194(u16 *a, u16 b, u8 c); +static void sub_81C2228(struct Pokemon* mon); +static void sub_81C22CC(struct Pokemon* mon); +static void sub_81C240C(u16 a); +static void sub_81C2524(void); +static void sub_81C2554(void); +static void sub_81C25E8(void); +static void sub_81C2628(void); +static void sub_81C2794(void); +static void sub_81C27DC(struct Pokemon *mon, u16 a); +static void PrintPageNamesAndStatsPageToWindows(void); +static void sub_81C2AFC(u8 a); +static void sub_81C2C38(u8 a); +static void SummaryScreen_RemoveWindowByIndex(u8 a); +static void sub_81C2D9C(u8 a); +static void sub_81C2DE4(u8 a); +static void sub_81C2E00(void); +static void sub_81C2E40(u8 taskId); +static void PrintMonOTName(void); +static void PrintMonOTID(void); +static void PrintMonAbilityName(void); +static void PrintMonAbilityDescription(void); +static void BufferMonTrainerMemo(void); +static void PrintMonTrainerMemo(void); +static void BufferNatureString(void); +static void GetMetLevelString(u8 *a); +static bool8 DoesMonOTMatchOwner(void); +static bool8 DidMonComeFromGBAGames(void); +static bool8 IsInGamePartnerMon(void); +static void PrintEggOTName(void); +static void PrintEggOTID(void); +static void PrintEggState(void); +static void PrintEggMemo(void); +static void sub_81C3554(u8 taskId); +static void PrintHeldItemName(void); +static void sub_81C3530(void); +static void PrintRibbonCount(void); +static void BufferLeftColumnStats(void); +static void PrintLeftColumnStats(void); +static void BufferRightColumnStats(void); +static void PrintRightColumnStats(void); +static void PrintExpPointsNextLevel(void); +static void sub_81C3984(void); +static void sub_81C39F0(u8 taskId); +static void PrintMoveNameAndPP(u8 a); +static void sub_81C3D08(void); +static void sub_81C3D54(u8 taskId); +static void PrintContestMoveDescription(u8 a); +static void PrintMoveDetails(u16 a); +static void PrintNewMoveDetailsOrCancelText(void); +static void sub_81C4064(void); +static void sub_81C40A0(u8 a, u8 b); +static void PrintHMMovesCantBeForgotten(void); +static void sub_81C4190(void); +static void sub_81C4204(u8 a, u8 b); +static void sub_81C424C(void); +static void sub_81C4280(void); +static void sub_81C42C8(void); +static void sub_81C43A0(void); +static void sub_81C4420(void); +static void sub_81C4484(void); +static void sub_81C44F0(void); +static void sub_81C4568(u8 a, u8 b); +static u8 sub_81C45F4(struct Pokemon *a, s16 *b); +static u8 sub_81C47B4(struct Pokemon *unused); +static void sub_81C4844(struct Sprite *); void SummaryScreen_SetUnknownTaskId(u8 a); void SummaryScreen_DestroyUnknownTask(void); -void sub_81C48F0(void); -void CreateMonMarkingsSprite(struct Pokemon *mon); -void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon); -void CreateCaughtBallSprite(struct Pokemon *mon); -void CreateSetStatusSprite(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); +static void sub_81C48F0(void); +static void CreateMonMarkingsSprite(struct Pokemon *mon); +static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon); +static void CreateCaughtBallSprite(struct Pokemon *mon); +static void CreateSetStatusSprite(void); +static void sub_81C4AF8(u8 a); +static void sub_81C4BE4(struct Sprite *sprite); +static void sub_81C4C60(u8 a); +static void sub_81C4C84(u8 a); +static void sub_81C4D18(u8 a); // const rom data #include "data/text/move_descriptions.h" @@ -711,38 +711,38 @@ static const u16 gUnknown_0861D120[] = INCBIN_U16("graphics/interface/summary_ma // code void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) { - 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; + pssData = AllocZeroed(sizeof(*pssData)); + pssData->mode = mode; + pssData->monList.mons = mons; + pssData->curMonIndex = monIndex; + pssData->maxMonIndex = maxMonIndex; + pssData->callback = callback; if (mode == PSS_MODE_UNK2) - gUnknown_0203CF1C->isBoxMon = TRUE; + pssData->isBoxMon = TRUE; else - gUnknown_0203CF1C->isBoxMon = FALSE; + pssData->isBoxMon = FALSE; switch (mode) { case PSS_MODE_NORMAL: case PSS_MODE_UNK2: - gUnknown_0203CF1C->minPageIndex = 0; - gUnknown_0203CF1C->maxPageIndex = 3; + pssData->minPageIndex = 0; + pssData->maxPageIndex = 3; break; case PSS_MODE_UNK1: - gUnknown_0203CF1C->minPageIndex = 0; - gUnknown_0203CF1C->maxPageIndex = 3; - gUnknown_0203CF1C->unk40C8 = TRUE; + pssData->minPageIndex = 0; + pssData->maxPageIndex = 3; + pssData->unk40C8 = TRUE; break; case PSS_MODE_SELECT_MOVE: - gUnknown_0203CF1C->minPageIndex = 2; - gUnknown_0203CF1C->maxPageIndex = 3; - gUnknown_0203CF1C->unk40C3 = TRUE; + pssData->minPageIndex = 2; + pssData->maxPageIndex = 3; + pssData->unk40C3 = TRUE; break; } - gUnknown_0203CF1C->currPageIndex = gUnknown_0203CF1C->minPageIndex; + pssData->currPageIndex = pssData->minPageIndex; SummaryScreen_SetUnknownTaskId(-1); if (gMonSpritesGfxPtr == 0) @@ -754,13 +754,13 @@ void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void ShowSelectMovePokemonSummaryScreen(struct Pokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void), u16 newMove) { ShowPokemonSummaryScreen(PSS_MODE_SELECT_MOVE, mons, monIndex, maxMonIndex, callback); - gUnknown_0203CF1C->newMove = newMove; + pssData->newMove = newMove; } void ShowPokemonSummaryScreenSet40EF(u8 mode, struct BoxPokemon *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)) { ShowPokemonSummaryScreen(mode, mons, monIndex, maxMonIndex, callback); - gUnknown_0203CF1C->unk40EF = TRUE; + pssData->unk40EF = TRUE; } static void SummaryScreen_MainCB2(void) @@ -813,11 +813,11 @@ static bool8 SummaryScreen_LoadGraphics(void) break; case 5: InitBGs(); - gUnknown_0203CF1C->unk40F0 = 0; + pssData->unk40F0 = 0; gMain.state++; break; case 6: - if (sub_81BFEB0() != FALSE) + if (SummaryScreen_DecompressGraphics() != FALSE) gMain.state++; break; case 7: @@ -829,12 +829,12 @@ static bool8 SummaryScreen_LoadGraphics(void) gMain.state++; break; case 9: - CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon); - gUnknown_0203CF1C->unk40F0 = 0; + CopyMonToSummaryStruct(&pssData->currentMon); + pssData->unk40F0 = 0; gMain.state++; break; case 10: - if (ExtractMonDataToSummaryStruct(&gUnknown_0203CF1C->currentMon) != 0) + if (ExtractMonDataToSummaryStruct(&pssData->currentMon) != 0) gMain.state++; break; case 11: @@ -842,11 +842,11 @@ static bool8 SummaryScreen_LoadGraphics(void) gMain.state++; break; case 12: - PrintPageNamesAndStatsPage(); + PrintPageNamesAndStatsPageToWindows(); gMain.state++; break; case 13: - sub_81C2D9C(gUnknown_0203CF1C->currPageIndex); + sub_81C2D9C(pssData->currPageIndex); gMain.state++; break; case 14: @@ -854,29 +854,29 @@ static bool8 SummaryScreen_LoadGraphics(void) gMain.state++; break; case 15: - sub_81C2AFC(gUnknown_0203CF1C->currPageIndex); + sub_81C2AFC(pssData->currPageIndex); gMain.state++; break; case 16: sub_81C4190(); sub_81C42C8(); - gUnknown_0203CF1C->unk40F0 = 0; + pssData->unk40F0 = 0; gMain.state++; break; case 17: - gUnknown_0203CF1C->spriteIds[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &gUnknown_0203CF1C->unk40F0); - if (gUnknown_0203CF1C->spriteIds[0] != 0xFF) + pssData->spriteIds[0] = sub_81C45F4(&pssData->currentMon, &pssData->unk40F0); + if (pssData->spriteIds[0] != 0xFF) { - gUnknown_0203CF1C->unk40F0 = 0; + pssData->unk40F0 = 0; gMain.state++; } break; case 18: - CreateMonMarkingsSprite(&gUnknown_0203CF1C->currentMon); + CreateMonMarkingsSprite(&pssData->currentMon); gMain.state++; break; case 19: - CreateCaughtBallSprite(&gUnknown_0203CF1C->currentMon); + CreateCaughtBallSprite(&pssData->currentMon); gMain.state++; break; case 20: @@ -888,7 +888,7 @@ static bool8 SummaryScreen_LoadGraphics(void) gMain.state++; break; case 22: - if (gUnknown_0203CF1C->mode != PSS_MODE_SELECT_MOVE) + if (pssData->mode != PSS_MODE_SELECT_MOVE) CreateTask(sub_81C0510, 0); else CreateTask(sub_81C171C, 0); @@ -915,9 +915,9 @@ static void InitBGs(void) { ResetBgsAndClearDma3BusyFlags(0); InitBgsFromTemplates(0, gUnknown_0861CBB4, ARRAY_COUNT(gUnknown_0861CBB4)); - SetBgTilemapBuffer(1, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]); - SetBgTilemapBuffer(2, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][0]); - SetBgTilemapBuffer(3, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0]); + SetBgTilemapBuffer(1, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]); + SetBgTilemapBuffer(2, pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0]); + SetBgTilemapBuffer(3, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0]); ResetAllBgsCoordinates(); schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); @@ -930,90 +930,90 @@ static void InitBGs(void) ShowBg(3); } -bool8 sub_81BFEB0(void) +static bool8 SummaryScreen_DecompressGraphics(void) { - switch (gUnknown_0203CF1C->unk40F0) + switch (pssData->unk40F0) { case 0: reset_temp_tile_data_buffers(); decompress_and_copy_tile_data_to_vram(1, &gUnknown_08D97D0C, 0, 0, 0); - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; break; case 1: if (free_temp_tile_data_buffers_if_possible() != 1) { - LZDecompressWram(&gUnknown_08D9862C, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0]); - gUnknown_0203CF1C->unk40F0++; + LZDecompressWram(&gUnknown_08D9862C, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0]); + pssData->unk40F0++; } break; case 2: - LZDecompressWram(&gUnknown_08D98CC8, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][1]); - gUnknown_0203CF1C->unk40F0++; + LZDecompressWram(&gUnknown_08D98CC8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][1]); + pssData->unk40F0++; break; case 3: - LZDecompressWram(&gUnknown_08D987FC, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][1]); - gUnknown_0203CF1C->unk40F0++; + LZDecompressWram(&gUnknown_08D987FC, pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1]); + pssData->unk40F0++; break; case 4: - LZDecompressWram(&gUnknown_08D9898C, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][1]); - gUnknown_0203CF1C->unk40F0++; + LZDecompressWram(&gUnknown_08D9898C, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][1]); + pssData->unk40F0++; break; case 5: - LZDecompressWram(&gUnknown_08D98B28, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]); - gUnknown_0203CF1C->unk40F0++; + LZDecompressWram(&gUnknown_08D98B28, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]); + pssData->unk40F0++; break; case 6: LoadCompressedPalette(&gUnknown_08D9853C, 0, 0x100); LoadPalette(&gUnknown_08D85620, 0x81, 0x1E); - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; break; case 7: LoadCompressedObjectPic(&gUnknown_0861CFBC); - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; break; case 8: LoadCompressedObjectPic(&gUnknown_0861D074); - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; break; case 9: LoadCompressedObjectPic(&gUnknown_0861D0F8); - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; break; case 10: LoadCompressedObjectPalette(&gUnknown_0861D100); - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; break; case 11: LoadCompressedObjectPalette(&gUnknown_0861D07C); - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; break; case 12: LoadCompressedPalette(&gMoveTypes_Pal, 0x1D0, 0x60); - gUnknown_0203CF1C->unk40F0 = 0; + pssData->unk40F0 = 0; return TRUE; } return FALSE; } -void CopyMonToSummaryStruct(struct Pokemon *mon) +static void CopyMonToSummaryStruct(struct Pokemon *mon) { - if (!gUnknown_0203CF1C->isBoxMon) + if (!pssData->isBoxMon) { - struct Pokemon *partyMon = gUnknown_0203CF1C->monList.mons; - *mon = partyMon[gUnknown_0203CF1C->curMonIndex]; + struct Pokemon *partyMon = pssData->monList.mons; + *mon = partyMon[pssData->curMonIndex]; } else { - struct BoxPokemon *boxMon = gUnknown_0203CF1C->monList.boxMons; - BoxMonToMon(&boxMon[gUnknown_0203CF1C->curMonIndex], mon); + struct BoxPokemon *boxMon = pssData->monList.boxMons; + BoxMonToMon(&boxMon[pssData->curMonIndex], mon); } } -bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) +static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) { u32 i; - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; - switch (gUnknown_0203CF1C->unk40F0) + struct PokeSummary *sum = &pssData->summary; + switch (pssData->unk40F0) { case 0: sum->species = GetMonData(a, MON_DATA_SPECIES); @@ -1040,7 +1040,7 @@ bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) 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) + if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE) { sum->nature = GetNature(a); sum->currentHP = GetMonData(a, MON_DATA_HP); @@ -1078,59 +1078,59 @@ bool8 ExtractMonDataToSummaryStruct(struct Pokemon *a) sum->ribbonCount = GetMonData(a, MON_DATA_RIBBON_COUNT); return TRUE; } - gUnknown_0203CF1C->unk40F0++; + pssData->unk40F0++; return FALSE; } -void sub_81C0348(void) +static void sub_81C0348(void) { - if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_BATTLE_MOVES && gUnknown_0203CF1C->currPageIndex != PSS_PAGE_CONTEST_MOVES) + if (pssData->currPageIndex != PSS_PAGE_BATTLE_MOVES && pssData->currPageIndex != PSS_PAGE_CONTEST_MOVES) { sub_81C1DA4(0, 255); sub_81C1EFC(0, 255, 0); } else { - sub_81C240C(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]); - sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 0); - sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 0); - SetBgTilemapBuffer(1, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0]); - SetBgTilemapBuffer(2, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]); + sub_81C240C(pssData->summary.moves[pssData->firstMoveIndex]); + sub_81C2194(pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 0); + sub_81C2194(pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 0); + SetBgTilemapBuffer(1, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0]); + SetBgTilemapBuffer(2, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]); ChangeBgX(2, 0x10000, 1); ClearWindowTilemap(19); ClearWindowTilemap(13); } - if (gUnknown_0203CF1C->summary.unk7 == 0) + if (pssData->summary.unk7 == 0) { sub_81C2074(0, 0xFF); } else { - if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_BATTLE_MOVES && gUnknown_0203CF1C->currPageIndex != PSS_PAGE_CONTEST_MOVES) + if (pssData->currPageIndex != PSS_PAGE_BATTLE_MOVES && pssData->currPageIndex != PSS_PAGE_CONTEST_MOVES) PutWindowTilemap(13); } sub_81C2524(); - sub_81C2228(&gUnknown_0203CF1C->currentMon); + sub_81C2228(&pssData->currentMon); } -void sub_81C0434(void) +static void sub_81C0434(void) { FreeAllWindowBuffers(); - Free(gUnknown_0203CF1C); + Free(pssData); } -void sub_81C044C(u8 taskId) +static void sub_81C044C(u8 taskId) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); gTasks[taskId].func = sub_81C0484; } -void sub_81C0484(u8 taskId) +static void sub_81C0484(u8 taskId) { - if (sub_81221EC() != 1 && !gPaletteFade.active) + if (sub_81221EC() != TRUE && !gPaletteFade.active) { - SetMainCallback2(gUnknown_0203CF1C->callback); - gUnknown_0203CF20 = gUnknown_0203CF1C->curMonIndex; + SetMainCallback2(pssData->callback); + gUnknown_0203CF20 = pssData->curMonIndex; SummaryScreen_DestroyUnknownTask(); ResetSpriteData(); FreeAllSpritePalettes(); @@ -1143,9 +1143,9 @@ void sub_81C0484(u8 taskId) } } -void sub_81C0510(u8 taskId) +static void sub_81C0510(u8 taskId) { - if (sub_81221EC() != 1 && !gPaletteFade.active) + if (sub_81221EC() != TRUE && !gPaletteFade.active) { if (gMain.newKeys & DPAD_UP) { @@ -1165,9 +1165,9 @@ void sub_81C0510(u8 taskId) } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_SKILLS) + if (pssData->currPageIndex != PSS_PAGE_SKILLS) { - if (gUnknown_0203CF1C->currPageIndex == PSS_PAGE_INFO) + if (pssData->currPageIndex == PSS_PAGE_INFO) { sub_81C48F0(); PlaySE(SE_SELECT); @@ -1189,15 +1189,15 @@ void sub_81C0510(u8 taskId) } } -void sub_81C0604(u8 taskId, s8 a) +static void sub_81C0604(u8 taskId, s8 a) { s8 r4_2; - if (!gUnknown_0203CF1C->unk40C3) + if (!pssData->unk40C3) { - if (gUnknown_0203CF1C->isBoxMon == TRUE) + if (pssData->isBoxMon == TRUE) { - if (gUnknown_0203CF1C->currPageIndex != PSS_PAGE_INFO) + if (pssData->currPageIndex != PSS_PAGE_INFO) { if (a == 1) a = 0; @@ -1211,7 +1211,7 @@ void sub_81C0604(u8 taskId, s8 a) else a = 3; } - r4_2 = sub_80D214C(gUnknown_0203CF1C->monList.boxMons, gUnknown_0203CF1C->curMonIndex, gUnknown_0203CF1C->maxMonIndex, a); + r4_2 = sub_80D214C(pssData->monList.boxMons, pssData->curMonIndex, pssData->maxMonIndex, a); } else if (sub_81B1250() == 1) { @@ -1225,21 +1225,21 @@ void sub_81C0604(u8 taskId, s8 a) if (r4_2 != -1) { PlaySE(SE_SELECT); - if (gUnknown_0203CF1C->summary.unk7 != 0) + if (pssData->summary.unk7 != 0) { sub_81C4204(2, 1); ClearWindowTilemap(13); schedule_bg_copy_tilemap_to_vram(0); sub_81C2074(0, 2); } - gUnknown_0203CF1C->curMonIndex = r4_2; + pssData->curMonIndex = r4_2; gTasks[taskId].data[0] = 0; gTasks[taskId].func = sub_81C0704; } } } -void sub_81C0704(u8 taskId) +static void sub_81C0704(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -1250,36 +1250,36 @@ void sub_81C0704(u8 taskId) break; case 1: SummaryScreen_DestroyUnknownTask(); - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[0]]); + DestroySpriteAndFreeResources(&gSprites[pssData->spriteIds[0]]); break; case 2: - DestroySpriteAndFreeResources(&gSprites[gUnknown_0203CF1C->spriteIds[1]]); + DestroySpriteAndFreeResources(&gSprites[pssData->spriteIds[1]]); break; case 3: - CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon); - gUnknown_0203CF1C->unk40F0 = 0; + CopyMonToSummaryStruct(&pssData->currentMon); + pssData->unk40F0 = 0; break; case 4: - if (ExtractMonDataToSummaryStruct(&gUnknown_0203CF1C->currentMon) == FALSE) + if (ExtractMonDataToSummaryStruct(&pssData->currentMon) == FALSE) return; break; case 5: - RemoveAndCreateMonMarkingsSprite(&gUnknown_0203CF1C->currentMon); + RemoveAndCreateMonMarkingsSprite(&pssData->currentMon); break; case 6: - CreateCaughtBallSprite(&gUnknown_0203CF1C->currentMon); + CreateCaughtBallSprite(&pssData->currentMon); break; case 7: - if (gUnknown_0203CF1C->summary.unk7) + if (pssData->summary.unk7) sub_81C2074(10, -2); - sub_81C2228(&gUnknown_0203CF1C->currentMon); + sub_81C2228(&pssData->currentMon); data[1] = 0; break; case 8: - gUnknown_0203CF1C->spriteIds[0] = sub_81C45F4(&gUnknown_0203CF1C->currentMon, &data[1]); - if (gUnknown_0203CF1C->spriteIds[0] == 0xFF) + pssData->spriteIds[0] = sub_81C45F4(&pssData->currentMon, &data[1]); + if (pssData->spriteIds[0] == 0xFF) return; - gSprites[gUnknown_0203CF1C->spriteIds[0]].data[2] = 1; + gSprites[pssData->spriteIds[0]].data[2] = 1; sub_81C0E24(); data[1] = 0; break; @@ -1290,11 +1290,11 @@ void sub_81C0704(u8 taskId) sub_81C25E8(); break; case 11: - sub_81C2D9C(gUnknown_0203CF1C->currPageIndex); + sub_81C2D9C(pssData->currPageIndex); sub_81C2524(); break; case 12: - gSprites[gUnknown_0203CF1C->spriteIds[0]].data[2] = 0; + gSprites[pssData->spriteIds[0]].data[2] = 0; break; default: if (sub_81221EC() == 0 && FuncIsActiveTask(sub_81C20F0) == 0) @@ -1307,42 +1307,42 @@ void sub_81C0704(u8 taskId) data[0]++; } -s8 sub_81C08F8(s8 a) +static s8 sub_81C08F8(s8 a) { - struct Pokemon *mon = gUnknown_0203CF1C->monList.mons; + struct Pokemon *mon = pssData->monList.mons; - if (gUnknown_0203CF1C->currPageIndex == PSS_PAGE_INFO) + if (pssData->currPageIndex == PSS_PAGE_INFO) { - if (a == -1 && gUnknown_0203CF1C->curMonIndex == 0) + if (a == -1 && pssData->curMonIndex == 0) return -1; - else if (a == 1 && gUnknown_0203CF1C->curMonIndex >= gUnknown_0203CF1C->maxMonIndex) + else if (a == 1 && pssData->curMonIndex >= pssData->maxMonIndex) return -1; else - return gUnknown_0203CF1C->curMonIndex + a; + return pssData->curMonIndex + a; } else { - s8 index = gUnknown_0203CF1C->curMonIndex; + s8 index = pssData->curMonIndex; do { index += a; - if (index < 0 || index > gUnknown_0203CF1C->maxMonIndex) + if (index < 0 || index > pssData->maxMonIndex) return -1; } while (GetMonData(&mon[index], MON_DATA_IS_EGG) != 0); return index; } } -s8 sub_81C09B4(s8 a) +static s8 sub_81C09B4(s8 a) { - struct Pokemon *mon = gUnknown_0203CF1C->monList.mons; + struct Pokemon *mon = pssData->monList.mons; s8 r5 = 0; u8 i; for (i = 0; i < 6; i++) { - if (gUnknown_0861CC1C[i] == gUnknown_0203CF1C->curMonIndex) + if (gUnknown_0861CC1C[i] == pssData->curMonIndex) { r5 = i; break; @@ -1363,46 +1363,46 @@ s8 sub_81C09B4(s8 a) } } -bool8 sub_81C0A50(struct Pokemon* mon) +static bool8 sub_81C0A50(struct Pokemon* mon) { - if (GetMonData(mon, MON_DATA_SPECIES) == 0) + if (GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NONE) return FALSE; - else if (gUnknown_0203CF1C->curMonIndex != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) + else if (pssData->curMonIndex != 0 || GetMonData(mon, MON_DATA_IS_EGG) == 0) return TRUE; else return FALSE; } -void sub_81C0A8C(u8 taskId, s8 b) +static void sub_81C0A8C(u8 taskId, s8 b) { - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->summary; s16 *data = gTasks[taskId].data; if (summary->isEgg) return; - else if (b == -1 && gUnknown_0203CF1C->currPageIndex == gUnknown_0203CF1C->minPageIndex) + else if (b == -1 && pssData->currPageIndex == pssData->minPageIndex) return; - else if (b == 1 && gUnknown_0203CF1C->currPageIndex == gUnknown_0203CF1C->maxPageIndex) + else if (b == 1 && pssData->currPageIndex == pssData->maxPageIndex) return; PlaySE(SE_SELECT); - sub_81C2C38(gUnknown_0203CF1C->currPageIndex); - gUnknown_0203CF1C->currPageIndex += b; + sub_81C2C38(pssData->currPageIndex); + pssData->currPageIndex += b; 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); + sub_81C2DE4(pssData->currPageIndex); sub_81C424C(); } -void sub_81C0B8C(u8 taskId) +static void sub_81C0B8C(u8 taskId) { s16 *data = gTasks[taskId].data; if (data[0] == 0) { - if (gUnknown_0203CF1C->unk40C9 == 0) + if (pssData->unk40C9 == 0) { data[1] = 1; SetBgAttribute(1, 7, 1); @@ -1417,7 +1417,7 @@ void sub_81C0B8C(u8 taskId) schedule_bg_copy_tilemap_to_vram(2); } ChangeBgX(data[1], 0, 0); - SetBgTilemapBuffer(data[1], gUnknown_0203CF1C->bgTilemapBuffers[gUnknown_0203CF1C->currPageIndex][0]); + SetBgTilemapBuffer(data[1], pssData->bgTilemapBuffers[pssData->currPageIndex][0]); ShowBg(1); ShowBg(2); } @@ -1427,25 +1427,25 @@ void sub_81C0B8C(u8 taskId) gTasks[taskId].func = sub_81C0C68; } -void sub_81C0C68(u8 taskId) +static void sub_81C0C68(u8 taskId) { s16 *data = gTasks[taskId].data; - gUnknown_0203CF1C->unk40C9 ^= 1; + pssData->unk40C9 ^= 1; data[1] = 0; data[0] = 0; sub_81C1BA0(); - sub_81C2AFC(gUnknown_0203CF1C->currPageIndex); + sub_81C2AFC(pssData->currPageIndex); sub_81C4280(); sub_81C0E24(); SwitchTaskToFollowupFunc(taskId); } -void sub_81C0CC4(u8 taskId) +static void sub_81C0CC4(u8 taskId) { s16 *data = gTasks[taskId].data; if (data[0] == 0) { - if (gUnknown_0203CF1C->unk40C9 == 0) + if (pssData->unk40C9 == 0) data[1] = 2; else data[1] = 1; @@ -1457,10 +1457,10 @@ void sub_81C0CC4(u8 taskId) gTasks[taskId].func = sub_81C0D44; } -void sub_81C0D44(u8 taskId) +static void sub_81C0D44(u8 taskId) { s16 *data = gTasks[taskId].data; - if (gUnknown_0203CF1C->unk40C9 == 0) + if (pssData->unk40C9 == 0) { SetBgAttribute(1, 7, 1); SetBgAttribute(2, 7, 2); @@ -1472,46 +1472,46 @@ void sub_81C0D44(u8 taskId) SetBgAttribute(1, 7, 2); schedule_bg_copy_tilemap_to_vram(1); } - if (gUnknown_0203CF1C->currPageIndex > 1) + if (pssData->currPageIndex > 1) { - SetBgTilemapBuffer(data[1], (u8*)gUnknown_0203CF1C + ((gUnknown_0203CF1C->currPageIndex << 12) + 0xFFFFF0BC)); + SetBgTilemapBuffer(data[1], (u8*)pssData + ((pssData->currPageIndex << 12) + 0xFFFFF0BC)); ChangeBgX(data[1], 0x10000, 0); } ShowBg(1); ShowBg(2); - gUnknown_0203CF1C->unk40C9 ^= 1; + pssData->unk40C9 ^= 1; data[1] = 0; data[0] = 0; sub_81C1BA0(); - sub_81C2AFC(gUnknown_0203CF1C->currPageIndex); + sub_81C2AFC(pssData->currPageIndex); sub_81C4280(); sub_81C0E24(); SwitchTaskToFollowupFunc(taskId); } -void sub_81C0E24(void) +static void sub_81C0E24(void) { - if (gUnknown_0203CF1C->currPageIndex == 1) - sub_81C22CC(&gUnknown_0203CF1C->currentMon); + if (pssData->currPageIndex == 1) + sub_81C22CC(&pssData->currentMon); } -void sub_81C0E48(u8 taskId) +static void sub_81C0E48(u8 taskId) { u16 move; - gUnknown_0203CF1C->firstMoveIndex = 0; - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; + pssData->firstMoveIndex = 0; + move = pssData->summary.moves[pssData->firstMoveIndex]; ClearWindowTilemap(0x13); - if (gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible == 0) + if (gSprites[pssData->spriteIds[2]].invisible == 0) ClearWindowTilemap(0xD); sub_81C1DA4(9, -3); sub_81C1EFC(9, -3, move); - if (!gUnknown_0203CF1C->unk40C8) + if (!pssData->unk40C8) { ClearWindowTilemap(5); PutWindowTilemap(6); } - sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 0); - sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 0); + sub_81C2194(pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 0); + sub_81C2194(pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 0); PrintMoveDetails(move); PrintNewMoveDetailsOrCancelText(); sub_81C44F0(); @@ -1522,7 +1522,7 @@ void sub_81C0E48(u8 taskId) gTasks[taskId].func = sub_81C0F44; } -void sub_81C0F44(u8 taskId) +static void sub_81C0F44(u8 taskId) { u8 id = taskId; s16 *data = gTasks[taskId].data; @@ -1532,17 +1532,17 @@ void sub_81C0F44(u8 taskId) if (gMain.newKeys & DPAD_UP) { data[0] = 4; - sub_81C1070(data, -1, &gUnknown_0203CF1C->firstMoveIndex); + sub_81C1070(data, -1, &pssData->firstMoveIndex); } else if (gMain.newKeys & DPAD_DOWN) { data[0] = 4; - sub_81C1070(data, 1, &gUnknown_0203CF1C->firstMoveIndex); + sub_81C1070(data, 1, &pssData->firstMoveIndex); } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->unk40C8 == TRUE - || (gUnknown_0203CF1C->newMove == MOVE_NONE && gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES)) + if (pssData->unk40C8 == TRUE + || (pssData->newMove == MOVE_NONE && pssData->firstMoveIndex == MAX_MON_MOVES)) { PlaySE(SE_SELECT); sub_81C11F4(taskId); @@ -1565,18 +1565,18 @@ void sub_81C0F44(u8 taskId) } } -bool8 sub_81C1040(void) +static bool8 sub_81C1040(void) { u8 i; for (i = 1; i < 4; i++) { - if (gUnknown_0203CF1C->summary.moves[i] != 0) + if (pssData->summary.moves[i] != 0) return TRUE; } return FALSE; } -void sub_81C1070(s16 *a, s8 b, u8 *c) +static void sub_81C1070(s16 *a, s8 b, u8 *c) { s8 i; s8 moveIndex; @@ -1593,10 +1593,10 @@ void sub_81C1070(s16 *a, s8 b, u8 *c) moveIndex = a[0]; if (moveIndex == 4) { - move = gUnknown_0203CF1C->newMove; + move = pssData->newMove; break; } - move = gUnknown_0203CF1C->summary.moves[moveIndex]; + move = pssData->summary.moves[moveIndex]; if (move != 0) break; } @@ -1604,16 +1604,16 @@ void sub_81C1070(s16 *a, s8 b, u8 *c) schedule_bg_copy_tilemap_to_vram(1); schedule_bg_copy_tilemap_to_vram(2); PrintMoveDetails(move); - if ((*c == 4 && gUnknown_0203CF1C->newMove == MOVE_NONE) || a[1] == 1) + if ((*c == 4 && pssData->newMove == MOVE_NONE) || a[1] == 1) { ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) + if (!gSprites[pssData->spriteIds[2]].invisible) ClearWindowTilemap(13); schedule_bg_copy_tilemap_to_vram(0); sub_81C1DA4(9, -3); sub_81C1EFC(9, -3, move); } - if (*c != 4 && moveIndex == 4 && gUnknown_0203CF1C->newMove == MOVE_NONE) + if (*c != 4 && moveIndex == 4 && pssData->newMove == MOVE_NONE) { ClearWindowTilemap(14); ClearWindowTilemap(15); @@ -1622,22 +1622,22 @@ void sub_81C1070(s16 *a, s8 b, u8 *c) sub_81C1EFC(0, 3, 0); } *c = moveIndex; - if (c == &gUnknown_0203CF1C->firstMoveIndex) + if (c == &pssData->firstMoveIndex) sub_81C4D18(8); else sub_81C4D18(18); } -void sub_81C11F4(u8 taskId) +static void sub_81C11F4(u8 taskId) { sub_81C4C60(8); ClearWindowTilemap(6); PutWindowTilemap(5); PrintMoveDetails(0); - sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 1); - sub_81C2194(gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 1); + sub_81C2194(pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, 1); + sub_81C2194(pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, 1); sub_81C4064(); - if (gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) + if (pssData->firstMoveIndex != MAX_MON_MOVES) { ClearWindowTilemap(14); ClearWindowTilemap(15); @@ -1650,15 +1650,15 @@ void sub_81C11F4(u8 taskId) gTasks[taskId].func = sub_81C0510; } -void sub_81C129C(u8 taskId) +static void sub_81C129C(u8 taskId) { - gUnknown_0203CF1C->secondMoveIndex = gUnknown_0203CF1C->firstMoveIndex; + pssData->secondMoveIndex = pssData->firstMoveIndex; sub_81C4C84(1); sub_81C4AF8(18); gTasks[taskId].func = sub_81C12E4; } -void sub_81C12E4(u8 taskId) +static void sub_81C12E4(u8 taskId) { s16* data = gTasks[taskId].data; @@ -1667,16 +1667,16 @@ void sub_81C12E4(u8 taskId) if (gMain.newKeys & DPAD_UP) { data[0] = 3; - sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->secondMoveIndex); + sub_81C1070(&data[0], -1, &pssData->secondMoveIndex); } else if (gMain.newKeys & DPAD_DOWN) { data[0] = 3; - sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->secondMoveIndex); + sub_81C1070(&data[0], 1, &pssData->secondMoveIndex); } else if (gMain.newKeys & A_BUTTON) { - if (gUnknown_0203CF1C->firstMoveIndex == gUnknown_0203CF1C->secondMoveIndex) + if (pssData->firstMoveIndex == pssData->secondMoveIndex) { sub_81C13B0(taskId, 0); } @@ -1692,7 +1692,7 @@ void sub_81C12E4(u8 taskId) } } -void sub_81C13B0(u8 taskId, bool8 b) +static void sub_81C13B0(u8 taskId, bool8 b) { u16 move; @@ -1702,23 +1702,23 @@ void sub_81C13B0(u8 taskId, bool8 b) if (b == TRUE) { - if (!gUnknown_0203CF1C->isBoxMon) + if (!pssData->isBoxMon) { - struct Pokemon *why = gUnknown_0203CF1C->monList.mons; - sub_81C14BC(&why[gUnknown_0203CF1C->curMonIndex], gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); + struct Pokemon *why = pssData->monList.mons; + SwapMonMoves(&why[pssData->curMonIndex], pssData->firstMoveIndex, pssData->secondMoveIndex); } else { - struct BoxPokemon *why = gUnknown_0203CF1C->monList.boxMons; - sub_81C15EC(&why[gUnknown_0203CF1C->curMonIndex], gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); + struct BoxPokemon *why = pssData->monList.boxMons; + SwapBoxMonMoves(&why[pssData->curMonIndex], pssData->firstMoveIndex, pssData->secondMoveIndex); } - CopyMonToSummaryStruct(&gUnknown_0203CF1C->currentMon); - sub_81C40A0(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); - sub_81C4568(gUnknown_0203CF1C->firstMoveIndex, gUnknown_0203CF1C->secondMoveIndex); - gUnknown_0203CF1C->firstMoveIndex = gUnknown_0203CF1C->secondMoveIndex; + CopyMonToSummaryStruct(&pssData->currentMon); + sub_81C40A0(pssData->firstMoveIndex, pssData->secondMoveIndex); + sub_81C4568(pssData->firstMoveIndex, pssData->secondMoveIndex); + pssData->firstMoveIndex = pssData->secondMoveIndex; } - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; + move = pssData->summary.moves[pssData->firstMoveIndex]; PrintMoveDetails(move); sub_81C240C(move); schedule_bg_copy_tilemap_to_vram(1); @@ -1726,437 +1726,84 @@ void sub_81C13B0(u8 taskId, bool8 b) gTasks[taskId].func = sub_81C0F44; } - -#ifdef NONMATCHING -void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) +static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2) { - u16 localMoveTo; - u16 localMoveFrom; - u8 localPpTo; - u8 localPpFrom; - u8 localPpBonuses; - u16* moveFromPtr; - u16* moveToPtr; - u8* ppFromPtr; - u8* ppToPtr; - u8* ppBonusesPtr; + struct PokeSummary* summary = &pssData->summary; - moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; - localMoveFrom = *moveFromPtr; + u16 move1 = summary->moves[moveIndex1]; + u16 move2 = summary->moves[moveIndex2]; + u8 move1pp = summary->pp[moveIndex1]; + u8 move2pp = summary->pp[moveIndex2]; + u8 ppBonuses = summary->ppBonuses; - moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; - localMoveTo = *moveToPtr; + // Calculate PP bonuses + u8 ppUpMask1 = gUnknown_08329D22[moveIndex1]; + u8 ppBonusMove1 = (ppBonuses & ppUpMask1) >> (moveIndex1 * 2); + u8 ppUpMask2 = gUnknown_08329D22[moveIndex2]; + u8 ppBonusMove2 = (ppBonuses & ppUpMask2) >> (moveIndex2 * 2); + ppBonuses &= ~ppUpMask1; + ppBonuses &= ~ppUpMask2; + ppBonuses |= (ppBonusMove1 << (moveIndex2 * 2)) + (ppBonusMove2 << (moveIndex1 * 2)); - ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; - localPpFrom = *ppFromPtr; + // Swap the moves + SetMonData(mon, MON_DATA_MOVE1 + moveIndex1, &move2); + SetMonData(mon, MON_DATA_MOVE1 + moveIndex2, &move1); + SetMonData(mon, MON_DATA_PP1 + moveIndex1, &move2pp); + SetMonData(mon, MON_DATA_PP1 + moveIndex2, &move1pp); + SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); + + summary->moves[moveIndex1] = move2; + summary->moves[moveIndex2] = move1; - ppToPtr = &gUnknown_0203CF1C->summary.pp[swappingToId]; - localPpTo = *ppToPtr; + summary->pp[moveIndex1] = move2pp; + summary->pp[moveIndex2] = move1pp; - 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))); + summary->ppBonuses = ppBonuses; } - 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); - - SetMonData(mon, MON_DATA_PP_BONUSES, &localPpBonuses); - - *moveFromPtr = localMoveTo; - *moveToPtr = localMoveFrom; - - *ppFromPtr = localPpTo; - *ppToPtr = localPpFrom; - - *ppBonusesPtr = localPpBonuses; -} -#else -NAKED -void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId) +static void SwapBoxMonMoves(struct BoxPokemon *mon, u8 moveIndex1, u8 moveIndex2) { - 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 + struct PokeSummary* summary = &pssData->summary; -#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; + u16 move1 = summary->moves[moveIndex1]; + u16 move2 = summary->moves[moveIndex2]; + u8 move1pp = summary->pp[moveIndex1]; + u8 move2pp = summary->pp[moveIndex2]; + u8 ppBonuses = summary->ppBonuses; - moveFromPtr = &gUnknown_0203CF1C->summary.moves[swappingFromId]; - localMoveFrom = *moveFromPtr; + // Calculate PP bonuses + u8 ppUpMask1 = gUnknown_08329D22[moveIndex1]; + u8 ppBonusMove1 = (ppBonuses & ppUpMask1) >> (moveIndex1 * 2); + u8 ppUpMask2 = gUnknown_08329D22[moveIndex2]; + u8 ppBonusMove2 = (ppBonuses & ppUpMask2) >> (moveIndex2 * 2); + ppBonuses &= ~ppUpMask1; + ppBonuses &= ~ppUpMask2; + ppBonuses |= (ppBonusMove1 << (moveIndex2 * 2)) + (ppBonusMove2 << (moveIndex1 * 2)); - moveToPtr = &gUnknown_0203CF1C->summary.moves[swappingToId]; - localMoveTo = *moveToPtr; + // Swap the moves + SetBoxMonData(mon, MON_DATA_MOVE1 + moveIndex1, &move2); + SetBoxMonData(mon, MON_DATA_MOVE1 + moveIndex2, &move1); + SetBoxMonData(mon, MON_DATA_PP1 + moveIndex1, &move2pp); + SetBoxMonData(mon, MON_DATA_PP1 + moveIndex2, &move1pp); + SetBoxMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); + + summary->moves[moveIndex1] = move2; + summary->moves[moveIndex2] = move1; - ppFromPtr = &gUnknown_0203CF1C->summary.pp[swappingFromId]; - localPpFrom = *ppFromPtr; + summary->pp[moveIndex1] = move2pp; + summary->pp[moveIndex2] = move1pp; - 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))); + summary->ppBonuses = ppBonuses; } - 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 -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) +static void sub_81C171C(u8 taskId) { sub_81C44F0(); sub_81C4AF8(8); gTasks[taskId].func = sub_81C174C; } -void sub_81C174C(u8 taskId) +static void sub_81C174C(u8 taskId) { s16* data = gTasks[taskId].data; @@ -2167,12 +1814,12 @@ void sub_81C174C(u8 taskId) if (gMain.newKeys & DPAD_UP) { data[0] = 4; - sub_81C1070(data, -1, &gUnknown_0203CF1C->firstMoveIndex); + sub_81C1070(data, -1, &pssData->firstMoveIndex); } else if (gMain.newKeys & DPAD_DOWN) { data[0] = 4; - sub_81C1070(data, 1, &gUnknown_0203CF1C->firstMoveIndex); + sub_81C1070(data, 1, &pssData->firstMoveIndex); } else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) { @@ -2188,7 +1835,7 @@ void sub_81C174C(u8 taskId) { sub_81C48F0(); PlaySE(SE_SELECT); - gUnknown_0203CF21 = gUnknown_0203CF1C->firstMoveIndex; + gUnknown_0203CF21 = pssData->firstMoveIndex; gSpecialVar_0x8005 = gUnknown_0203CF21; sub_81C044C(taskId); } @@ -2211,26 +1858,26 @@ void sub_81C174C(u8 taskId) } } -bool8 sub_81C18A8(void) +static bool8 sub_81C18A8(void) { - if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES || gUnknown_0203CF1C->newMove == MOVE_NONE || sub_81B6D14(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]) != 1) + if (pssData->firstMoveIndex == MAX_MON_MOVES || pssData->newMove == MOVE_NONE || sub_81B6D14(pssData->summary.moves[pssData->firstMoveIndex]) != 1) return TRUE; else return FALSE; } -void sub_81C18F4(u8 taskId) +static 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(); + PrintHMMovesCantBeForgotten(); gTasks[taskId].func = sub_81C1940; } -void sub_81C1940(u8 taskId) +static void sub_81C1940(u8 taskId) { s16* data = gTasks[taskId].data; u16 move; @@ -2240,7 +1887,7 @@ void sub_81C1940(u8 taskId) { data[1] = 1; data[0] = 4; - sub_81C1070(&data[0], -1, &gUnknown_0203CF1C->firstMoveIndex); + sub_81C1070(&data[0], -1, &pssData->firstMoveIndex); data[1] = 0; gTasks[taskId].func = sub_81C174C; } @@ -2248,18 +1895,18 @@ void sub_81C1940(u8 taskId) { data[1] = 1; data[0] = 4; - sub_81C1070(&data[0], 1, &gUnknown_0203CF1C->firstMoveIndex); + sub_81C1070(&data[0], 1, &pssData->firstMoveIndex); data[1] = 0; gTasks[taskId].func = sub_81C174C; } else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1) { - if (gUnknown_0203CF1C->currPageIndex != 2) + if (pssData->currPageIndex != 2) { ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) + if (!gSprites[pssData->spriteIds[2]].invisible) ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; + move = pssData->summary.moves[pssData->firstMoveIndex]; gTasks[taskId].func = sub_81C174C; sub_81C0A8C(taskId, -1); sub_81C1DA4(9, -2); @@ -2268,12 +1915,12 @@ void sub_81C1940(u8 taskId) } else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2) { - if (gUnknown_0203CF1C->currPageIndex != 3) + if (pssData->currPageIndex != 3) { ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) + if (!gSprites[pssData->spriteIds[2]].invisible) ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; + move = pssData->summary.moves[pssData->firstMoveIndex]; gTasks[taskId].func = sub_81C174C; sub_81C0A8C(taskId, 1); sub_81C1DA4(9, -2); @@ -2283,9 +1930,9 @@ void sub_81C1940(u8 taskId) else if (gMain.newKeys & (A_BUTTON | B_BUTTON)) { ClearWindowTilemap(19); - if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) + if (!gSprites[pssData->spriteIds[2]].invisible) ClearWindowTilemap(13); - move = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; + move = pssData->summary.moves[pssData->firstMoveIndex]; PrintMoveDetails(move); schedule_bg_copy_tilemap_to_vram(0); sub_81C1DA4(9, -3); @@ -2300,64 +1947,66 @@ u8 sub_81C1B94(void) return gUnknown_0203CF21; } -void sub_81C1BA0(void) +static void sub_81C1BA0(void) { u16 *alloced = Alloc(32); u8 i; + for (i = 0; i < 4; i++) { - u8 j = i << 1; - if (i < gUnknown_0203CF1C->minPageIndex) + u8 j = i * 2; + + if (i < pssData->minPageIndex) { - alloced[j+0] = 0x40; - alloced[j+1] = 0x40; - alloced[j+8] = 0x50; - alloced[j+9] = 0x50; + alloced[j + 0] = 0x40; + alloced[j + 1] = 0x40; + alloced[j + 8] = 0x50; + alloced[j + 9] = 0x50; } - else if (i > gUnknown_0203CF1C->maxPageIndex) + else if (i > pssData->maxPageIndex) { - alloced[j+0] = 0x4A; - alloced[j+1] = 0x4A; - alloced[j+8] = 0x5A; - alloced[j+9] = 0x5A; + alloced[j + 0] = 0x4A; + alloced[j + 1] = 0x4A; + alloced[j + 8] = 0x5A; + alloced[j + 9] = 0x5A; } - else if (i < gUnknown_0203CF1C->currPageIndex) + else if (i < pssData->currPageIndex) { - alloced[j+0] = 0x46; - alloced[j+1] = 0x47; - alloced[j+8] = 0x56; - alloced[j+9] = 0x57; + alloced[j + 0] = 0x46; + alloced[j + 1] = 0x47; + alloced[j + 8] = 0x56; + alloced[j + 9] = 0x57; } - else if (i == gUnknown_0203CF1C->currPageIndex) + else if (i == pssData->currPageIndex) { - if (i != gUnknown_0203CF1C->maxPageIndex) + if (i != pssData->maxPageIndex) { - alloced[j+0] = 0x41; - alloced[j+1] = 0x42; - alloced[j+8] = 0x51; - alloced[j+9] = 0x52; + 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; + alloced[j + 0] = 0x4B; + alloced[j + 1] = 0x4C; + alloced[j + 8] = 0x5B; + alloced[j + 9] = 0x5C; } } - else if (i != gUnknown_0203CF1C->maxPageIndex) + else if (i != pssData->maxPageIndex) { - alloced[j+0] = 0x43; - alloced[j+1] = 0x44; - alloced[j+8] = 0x53; - alloced[j+9] = 0x54; + 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; + 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); @@ -2365,7 +2014,7 @@ void sub_81C1BA0(void) Free(alloced); } -void sub_81C1CB0(const struct UnkStruct_61CC04 *unkStruct, u16 *dest, u8 c, bool8 d) +static void sub_81C1CB0(const struct UnkStruct_61CC04 *unkStruct, u16 *dest, u8 c, bool8 d) { u16 i; u16 *alloced = Alloc(unkStruct->field_6 * 2 * unkStruct->field_7); @@ -2394,13 +2043,13 @@ void sub_81C1CB0(const struct UnkStruct_61CC04 *unkStruct, u16 *dest, u8 c, bool Free(alloced); } -void sub_81C1DA4(u16 a, s16 b) +static 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) { - sub_81C1CB0(&gUnknown_0861CC04, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], b, 1); + sub_81C1CB0(&gUnknown_0861CC04, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], b, 1); } else { @@ -2414,7 +2063,7 @@ void sub_81C1DA4(u16 a, s16 b) } } -void sub_81C1E20(u8 taskId) +static void sub_81C1E20(u8 taskId) { s16 *data = gTasks[taskId].data; data[1] += data[0]; @@ -2426,17 +2075,17 @@ void sub_81C1E20(u8 taskId) { data[1] = gUnknown_0861CC04.field_6; } - sub_81C1CB0(&gUnknown_0861CC04, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], data[1], 1); + sub_81C1CB0(&gUnknown_0861CC04, pssData->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], data[1], 1); if (data[1] <= 0 || data[1] >= gUnknown_0861CC04.field_6) { if (data[0] < 0) { - if (gUnknown_0203CF1C->currPageIndex == 2) + if (pssData->currPageIndex == 2) PutWindowTilemap(14); } else { - if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) + if (!gSprites[pssData->spriteIds[2]].invisible) PutWindowTilemap(13); PutWindowTilemap(19); } @@ -2447,12 +2096,12 @@ void sub_81C1E20(u8 taskId) schedule_bg_copy_tilemap_to_vram(2); } -void sub_81C1EFC(u16 a, s16 b, u16 move) +static 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) - sub_81C1CB0(&gUnknown_0861CC10, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], b, 1); + sub_81C1CB0(&gUnknown_0861CC10, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], b, 1); else { u8 taskId = FindTaskIdByFunc(sub_81C1F80); @@ -2464,7 +2113,7 @@ void sub_81C1EFC(u16 a, s16 b, u16 move) } } -void sub_81C1F80(u8 taskId) +static void sub_81C1F80(u8 taskId) { s16 *data = gTasks[taskId].data; data[1] += data[0]; @@ -2476,18 +2125,18 @@ void sub_81C1F80(u8 taskId) { data[1] = gUnknown_0861CC10.field_6; } - sub_81C1CB0(&gUnknown_0861CC10, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], data[1], 1); + sub_81C1CB0(&gUnknown_0861CC10, pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], data[1], 1); if (data[1] <= 0 || data[1] >= gUnknown_0861CC10.field_6) { if (data[0] < 0) { - if (gUnknown_0203CF1C->currPageIndex == 3 && FuncIsActiveTask(sub_81C0B8C) == 0) + if (pssData->currPageIndex == 3 && FuncIsActiveTask(sub_81C0B8C) == 0) PutWindowTilemap(15); sub_81C240C(data[2]); } else { - if (!gSprites[gUnknown_0203CF1C->spriteIds[2]].invisible) + if (!gSprites[pssData->spriteIds[2]].invisible) { PutWindowTilemap(13); } @@ -2500,14 +2149,14 @@ void sub_81C1F80(u8 taskId) schedule_bg_copy_tilemap_to_vram(2); } -void sub_81C2074(u16 a, s16 b) +static 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) { - sub_81C1CB0(&gUnknown_0861CBEC, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0); - sub_81C1CB0(&gUnknown_0861CBF8, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0); + sub_81C1CB0(&gUnknown_0861CBEC, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0); + sub_81C1CB0(&gUnknown_0861CBF8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], b, 0); } else { @@ -2517,7 +2166,7 @@ void sub_81C2074(u16 a, s16 b) } } -void sub_81C20F0(u8 taskId) +static void sub_81C20F0(u8 taskId) { s16 *data = gTasks[taskId].data; data[1] += data[0]; @@ -2525,8 +2174,8 @@ void sub_81C20F0(u8 taskId) data[1] = 0; else if (data[1] > gUnknown_0861CBEC.field_6) data[1] = gUnknown_0861CBEC.field_6; - sub_81C1CB0(&gUnknown_0861CBEC, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0); - sub_81C1CB0(&gUnknown_0861CBF8, gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBEC, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0); + sub_81C1CB0(&gUnknown_0861CBF8, pssData->bgTilemapBuffers[PSS_PAGE_INFO][0], data[1], 0); schedule_bg_copy_tilemap_to_vram(3); if (data[1] <= 0 || data[1] >= gUnknown_0861CBEC.field_6) { @@ -2540,11 +2189,12 @@ void sub_81C20F0(u8 taskId) } } -void sub_81C2194(u16 *output, u16 palette, bool8 c) +static void sub_81C2194(u16 *output, u16 palette, bool8 c) { u16 i; u32 var; - palette <<= 12; + + palette *= 0x1000; var = 0x56A; if (c == 0) @@ -2567,22 +2217,22 @@ void sub_81C2194(u16 *output, u16 palette, bool8 c) } } -void sub_81C2228(struct Pokemon *mon) +static void sub_81C2228(struct Pokemon *mon) { if (!CheckPartyPokerus(mon, 0) && CheckPartyHasHadPokerus(mon, 0)) { - gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x2C; - gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x2C; + pssData->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x2C; + pssData->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x2C; } else { - gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x81A; - gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x81A; + pssData->bgTilemapBuffers[PSS_PAGE_INFO][0][0x223] = 0x81A; + pssData->bgTilemapBuffers[PSS_PAGE_INFO][1][0x223] = 0x81A; } schedule_bg_copy_tilemap_to_vram(3); } -void sub_81C228C(bool8 isMonShiny) +static void sub_81C228C(bool8 isMonShiny) { if (!isMonShiny) sub_8199C30(3, 1, 4, 8, 8, 0); @@ -2591,10 +2241,10 @@ void sub_81C228C(bool8 isMonShiny) schedule_bg_copy_tilemap_to_vram(3); } -void sub_81C22CC(struct Pokemon *unused) +static void sub_81C22CC(struct Pokemon *unused) { s64 r6r7; - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->summary; u16 *r9; u8 i; @@ -2612,7 +2262,7 @@ void sub_81C22CC(struct Pokemon *unused) r6r7 = 0; } - r9 = &gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255]; + r9 = &pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255]; for (i = 0; i < 8; i++) { if (r6r7 > 7) @@ -2624,15 +2274,15 @@ void sub_81C22CC(struct Pokemon *unused) r6r7 = 0; } - if (GetBgTilemapBuffer(1) == gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_SKILLS][0]) + if (GetBgTilemapBuffer(1) == pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0]) schedule_bg_copy_tilemap_to_vram(1); else schedule_bg_copy_tilemap_to_vram(2); } -void sub_81C240C(u16 move) +static void sub_81C240C(u16 move) { - u16 *tilemap = gUnknown_0203CF1C->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]; + u16 *tilemap = pssData->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][1]; u8 i; u8 effectValue; @@ -2674,15 +2324,15 @@ void sub_81C240C(u16 move) } } -void sub_81C2524(void) +static void sub_81C2524(void) { - if (gUnknown_0203CF1C->summary.isEgg) + if (pssData->summary.isEgg) ChangeBgX(3, 0x10000, 0); else ChangeBgX(3, 0, 0); } -void sub_81C2554(void) +static void sub_81C2554(void) { u8 i; InitWindows(gUnknown_0861CC24); @@ -2694,7 +2344,7 @@ void sub_81C2554(void) } for (i = 0; i < 8; i++) { - gUnknown_0203CF1C->windowIds[i] = 0xFF; + pssData->windowIds[i] = 0xFF; } } @@ -2703,23 +2353,23 @@ static void SummaryScreen_PrintTextOnWindow(u8 windowId, const u8 *string, u8 x, AddTextPrinterParameterized2(windowId, 1, x, y, 0, lineSpacing, sTextColors_861CD2C[colorId], 0, string); } -void sub_81C25E8(void) +static void sub_81C25E8(void) { FillWindowPixelBuffer(17, 0); FillWindowPixelBuffer(18, 0); FillWindowPixelBuffer(19, 0); - if (!gUnknown_0203CF1C->summary.isEgg) + if (!pssData->summary.isEgg) sub_81C2628(); else sub_81C2794(); schedule_bg_copy_tilemap_to_vram(0); } -void sub_81C2628(void) +static void sub_81C2628(void) { u8 strArray[16]; - struct Pokemon *mon = &gUnknown_0203CF1C->currentMon; - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct Pokemon *mon = &pssData->currentMon; + struct PokeSummary *summary = &pssData->summary; u16 dexNum = SpeciesToPokedexNum(summary->species); if (dexNum != 0xFFFF) { @@ -2760,38 +2410,38 @@ void sub_81C2628(void) PutWindowTilemap(19); } -void sub_81C2794(void) +static void sub_81C2794(void) { - GetMonNickname(&gUnknown_0203CF1C->currentMon, gStringVar1); + GetMonNickname(&pssData->currentMon, gStringVar1); SummaryScreen_PrintTextOnWindow(18, gStringVar1, 0, 1, 0, 1); PutWindowTilemap(18); ClearWindowTilemap(17); ClearWindowTilemap(19); } -void sub_81C27DC(struct Pokemon *mon, u16 a) +static void sub_81C27DC(struct Pokemon *mon, u16 species) { - if (a != SPECIES_NIDORAN_M && a != SPECIES_NIDORAN_F) + if (species != SPECIES_NIDORAN_M && species != SPECIES_NIDORAN_F) { u8 gender = GetMonGender(mon); switch (gender) { case MON_MALE: - SummaryScreen_PrintTextOnWindow(19, &gText_MaleSymbol[0], 57, 17, 0, 3); + SummaryScreen_PrintTextOnWindow(19, gText_MaleSymbol, 57, 17, 0, 3); break; case MON_FEMALE: - SummaryScreen_PrintTextOnWindow(19, &gText_FemaleSymbol[0], 57, 17, 0, 4); + SummaryScreen_PrintTextOnWindow(19, gText_FemaleSymbol, 57, 17, 0, 4); break; } } } -void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x) +static void PrintAOrBButtonIcon(u8 windowId, bool8 bButton, u32 x) { BlitBitmapToWindow(windowId, (bButton) ? gUnknown_0861CDD3 : gUnknown_0861CDD3 - 0x80, x, 0, 16, 16); } -static void PrintPageNamesAndStatsPage(void) +static void PrintPageNamesAndStatsPageToWindows(void) { int stringXPos; int iconXPos; @@ -2846,7 +2496,7 @@ static void PrintPageNamesAndStatsPage(void) SummaryScreen_PrintTextOnWindow(15, gText_Jam, 0, 17, 0, 1); } -void sub_81C2AFC(u8 a) +static void sub_81C2AFC(u8 a) { u8 i; @@ -2872,9 +2522,9 @@ void sub_81C2AFC(u8 a) break; case 2: PutWindowTilemap(2); - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { - if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) + if (pssData->newMove != MOVE_NONE || pssData->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(14); } else @@ -2884,9 +2534,9 @@ void sub_81C2AFC(u8 a) break; case 3: PutWindowTilemap(3); - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { - if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) + if (pssData->newMove != MOVE_NONE || pssData->firstMoveIndex != MAX_MON_MOVES) PutWindowTilemap(15); } else @@ -2898,13 +2548,13 @@ void sub_81C2AFC(u8 a) for (i = 0; i < 8; i++) { - PutWindowTilemap(gUnknown_0203CF1C->windowIds[i]); + PutWindowTilemap(pssData->windowIds[i]); } schedule_bg_copy_tilemap_to_vram(0); } -void sub_81C2C38(u8 a) +static void sub_81C2C38(u8 a) { u8 i; switch (a) @@ -2921,9 +2571,9 @@ void sub_81C2C38(u8 a) ClearWindowTilemap(12); break; case 2: - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { - if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) + if (pssData->newMove != MOVE_NONE || pssData->firstMoveIndex != MAX_MON_MOVES) ClearWindowTilemap(14); } else @@ -2932,9 +2582,9 @@ void sub_81C2C38(u8 a) } break; case 3: - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { - if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) + if (pssData->newMove != MOVE_NONE || pssData->firstMoveIndex != MAX_MON_MOVES) ClearWindowTilemap(15); } else @@ -2952,9 +2602,9 @@ void sub_81C2C38(u8 a) schedule_bg_copy_tilemap_to_vram(0); } -u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) +static u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateId) { - u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[templateId]); + u8 *windowIdPtr = &(pssData->windowIds[templateId]); if (*windowIdPtr == 0xFF) { *windowIdPtr = AddWindow(&template[templateId]); @@ -2963,9 +2613,9 @@ u8 AddWindowFromTemplateList(const struct WindowTemplate *template, u8 templateI return *windowIdPtr; } -void SummaryScreen_RemoveWindowByIndex(u8 windowIndex) +static void SummaryScreen_RemoveWindowByIndex(u8 windowIndex) { - u8 *windowIdPtr = &(gUnknown_0203CF1C->windowIds[windowIndex]); + u8 *windowIdPtr = &(pssData->windowIds[windowIndex]); if (*windowIdPtr != 0xFF) { ClearWindowTilemap(*windowIdPtr); @@ -2974,25 +2624,25 @@ void SummaryScreen_RemoveWindowByIndex(u8 windowIndex) } } -void sub_81C2D9C(u8 pageIndex) +static void sub_81C2D9C(u8 pageIndex) { u16 i; for (i = 0; i < 8; i++) { - if (gUnknown_0203CF1C->windowIds[i] != 0xFF) - FillWindowPixelBuffer(gUnknown_0203CF1C->windowIds[i], 0); + if (pssData->windowIds[i] != 0xFF) + FillWindowPixelBuffer(pssData->windowIds[i], 0); } gUnknown_0861CE54[pageIndex](); } -void sub_81C2DE4(u8 pageIndex) +static void sub_81C2DE4(u8 pageIndex) { CreateTask(gUnknown_0861CE64[pageIndex], 16); } -void sub_81C2E00(void) +static void sub_81C2E00(void) { - if (gUnknown_0203CF1C->summary.isEgg) + if (pssData->summary.isEgg) { PrintEggOTName(); PrintEggOTID(); @@ -3010,7 +2660,7 @@ void sub_81C2E00(void) } } -void sub_81C2E40(u8 taskId) +static void sub_81C2E40(u8 taskId) { s16 *data = gTasks[taskId].data; switch (data[0]) @@ -3040,7 +2690,7 @@ void sub_81C2E40(u8 taskId) data[0]++; } -void PrintMonOTName(void) +static void PrintMonOTName(void) { u8 windowId; int x; @@ -3049,39 +2699,39 @@ void PrintMonOTName(void) windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0); SummaryScreen_PrintTextOnWindow(windowId, gText_OTSlash, 0, 1, 0, 1); x = GetStringWidth(1, gText_OTSlash, 0); - if (gUnknown_0203CF1C->summary.OTGender == 0) - SummaryScreen_PrintTextOnWindow(windowId, gUnknown_0203CF1C->summary.OTName, x, 1, 0, 5); + if (pssData->summary.OTGender == 0) + SummaryScreen_PrintTextOnWindow(windowId, pssData->summary.OTName, x, 1, 0, 5); else - SummaryScreen_PrintTextOnWindow(windowId, gUnknown_0203CF1C->summary.OTName, x, 1, 0, 6); + SummaryScreen_PrintTextOnWindow(windowId, pssData->summary.OTName, x, 1, 0, 6); } } -void PrintMonOTID(void) +static void PrintMonOTID(void) { int xPos; if (sub_81A6BF4() != TRUE && sub_81B9E94() != TRUE) { - ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)gUnknown_0203CF1C->summary.OTID, 2, 5); + ConvertIntToDecimalStringN(StringCopy(gStringVar1, gText_UnkCtrlF907F908), (u16)pssData->summary.OTID, 2, 5); xPos = GetStringRightAlignXOffset(1, gStringVar1, 56); SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, xPos, 1, 0, 1); } } -void PrintMonAbilityName(void) +static void PrintMonAbilityName(void) { - u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); + u8 ability = GetAbilityBySpecies(pssData->summary.species, pssData->summary.altAbility); SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityNames[ability], 0, 1, 0, 1); } -void PrintMonAbilityDescription(void) +static void PrintMonAbilityDescription(void) { - u8 ability = GetAbilityBySpecies(gUnknown_0203CF1C->summary.species, gUnknown_0203CF1C->summary.altAbility); + u8 ability = GetAbilityBySpecies(pssData->summary.species, pssData->summary.altAbility); SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), gAbilityDescriptionPointers[ability], 0, 17, 0, 0); } -void BufferMonTrainerMemo(void) +static void BufferMonTrainerMemo(void) { - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &pssData->summary; const u8 *text; DynamicPlaceholderTextUtil_Reset(); @@ -3116,7 +2766,7 @@ void BufferMonTrainerMemo(void) { text = gText_XNatureFatefulEncounter; } - else if (sum->metLocation != MAPSEC_IN_GAME_TRADE && MonCameFromGBAGames()) + else if (sum->metLocation != MAPSEC_IN_GAME_TRADE && DidMonComeFromGBAGames()) { text = (sum->metLocation >= MAPSEC_NONE) ? gText_XNatureObtainedInTrade : gText_XNatureProbablyMetAt; } @@ -3131,34 +2781,34 @@ void BufferMonTrainerMemo(void) } } -void PrintMonTrainerMemo(void) +static void PrintMonTrainerMemo(void) { SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), gStringVar4, 0, 1, 0, 0); } -void BufferNatureString(void) +static void BufferNatureString(void) { - struct UnkSummaryStruct *sumStruct = gUnknown_0203CF1C; + struct UnkSummaryStruct *sumStruct = pssData; DynamicPlaceholderTextUtil_SetPlaceholderPtr(2, gNatureNamePointers[sumStruct->summary.nature]); DynamicPlaceholderTextUtil_SetPlaceholderPtr(5, gText_EmptyString5); } -void GetMetLevelString(u8 *output) +static void GetMetLevelString(u8 *output) { - u8 level = gUnknown_0203CF1C->summary.metLevel; + u8 level = pssData->summary.metLevel; if (level == 0) level = EGG_HATCH_LEVEL; ConvertIntToDecimalStringN(output, level, 0, 3); DynamicPlaceholderTextUtil_SetPlaceholderPtr(3, output); } -bool8 DoesMonOTMatchOwner(void) +static bool8 DoesMonOTMatchOwner(void) { - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &pssData->summary; u32 trainerId; u8 gender; - if (gUnknown_0203CF1C->monList.mons == gEnemyParty) + if (pssData->monList.mons == gEnemyParty) { u8 multiID = GetMultiplayerId() ^ 1; trainerId = (u16)gLinkPlayers[multiID].trainerId; @@ -3178,33 +2828,33 @@ bool8 DoesMonOTMatchOwner(void) return TRUE; } -bool8 MonCameFromGBAGames(void) +static bool8 DidMonComeFromGBAGames(void) { - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &pssData->summary; if (sum->metGame > 0 && sum->metGame <= VERSION_LEAF_GREEN) return TRUE; return FALSE; } -bool8 MonCameFromRSE(void) +bool8 DidMonComeFromRSE(void) { - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &pssData->summary; if (sum->metGame > 0 && sum->metGame <= VERSION_EMERALD) return TRUE; return FALSE; } -bool8 IsInGamePartnerMon(void) +static bool8 IsInGamePartnerMon(void) { if ((gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER) && gMain.inBattle) { - if (gUnknown_0203CF1C->curMonIndex == 1 || gUnknown_0203CF1C->curMonIndex == 4 || gUnknown_0203CF1C->curMonIndex == 5) + if (pssData->curMonIndex == 1 || pssData->curMonIndex == 4 || pssData->curMonIndex == 5) return TRUE; } return FALSE; } -void PrintEggOTName(void) +static void PrintEggOTName(void) { u32 windowId = AddWindowFromTemplateList(gUnknown_0861CCCC, 0); u32 width = GetStringWidth(1, gText_OTSlash, 0); @@ -3212,7 +2862,7 @@ void PrintEggOTName(void) SummaryScreen_PrintTextOnWindow(windowId, gText_FiveMarks, width, 1, 0, 1); } -void PrintEggOTID(void) +static void PrintEggOTID(void) { int x; StringCopy(gStringVar1, gText_UnkCtrlF907F908); @@ -3221,12 +2871,12 @@ void PrintEggOTID(void) SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 1), gStringVar1, x, 1, 0, 1); } -void PrintEggState(void) +static void PrintEggState(void) { const u8 *text; - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &pssData->summary; - if (gUnknown_0203CF1C->summary.sanity == TRUE) + if (pssData->summary.sanity == TRUE) text = gText_EggWillTakeALongTime; else if (sum->friendship <= 5) text = gText_EggAboutToHatch; @@ -3240,19 +2890,19 @@ void PrintEggState(void) SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 2), text, 0, 1, 0, 0); } -void PrintEggMemo(void) +static void PrintEggMemo(void) { const u8 *text; - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &pssData->summary; - if (gUnknown_0203CF1C->summary.sanity != 1) + if (pssData->summary.sanity != 1) { if (sum->metLocation == MAPSEC_FATEFUL_ENCOUNTER) text = gText_PeculiarEggNicePlace; - else if (MonCameFromGBAGames() == FALSE || DoesMonOTMatchOwner() == FALSE) + else if (DidMonComeFromGBAGames() == FALSE || DoesMonOTMatchOwner() == FALSE) text = gText_PeculiarEggTrade; else if (sum->metLocation == MAPSEC_SPECIAL_EGG) - text = (MonCameFromRSE() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler; + text = (DidMonComeFromRSE() == TRUE) ? gText_EggFromHotSprings : gText_EggFromTraveler; else text = gText_OddEggFoundByCouple; } @@ -3264,7 +2914,7 @@ void PrintEggMemo(void) SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCCC, 3), text, 0, 1, 0, 0); } -void sub_81C3530(void) +static void sub_81C3530(void) { PrintHeldItemName(); PrintRibbonCount(); @@ -3275,7 +2925,7 @@ void sub_81C3530(void) PrintExpPointsNextLevel(); } -void sub_81C3554(u8 taskId) +static void sub_81C3554(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -3309,22 +2959,22 @@ void sub_81C3554(u8 taskId) data[0]++; } -void PrintHeldItemName(void) +static void PrintHeldItemName(void) { const u8 *text; 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)) + if (pssData->summary.item == ITEM_ENIGMA_BERRY && sub_81B1250() == TRUE && (pssData->curMonIndex == 1 || pssData->curMonIndex == 4 || pssData->curMonIndex == 5)) { text = ItemId_GetName(ITEM_ENIGMA_BERRY); } - else if (gUnknown_0203CF1C->summary.item == ITEM_NONE) + else if (pssData->summary.item == ITEM_NONE) { text = gText_None; } else { - CopyItemName(gUnknown_0203CF1C->summary.item, gStringVar1); + CopyItemName(pssData->summary.item, gStringVar1); text = gStringVar1; } @@ -3332,18 +2982,18 @@ void PrintHeldItemName(void) SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 0), text, offset, 1, 0, 0); } -void PrintRibbonCount(void) +static void PrintRibbonCount(void) { const u8 *text; int offset; - if (gUnknown_0203CF1C->summary.ribbonCount == 0) + if (pssData->summary.ribbonCount == 0) { text = gText_None; } else { - ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.ribbonCount, 1, 2); + ConvertIntToDecimalStringN(gStringVar1, pssData->summary.ribbonCount, 1, 2); StringExpandPlaceholders(gStringVar4, gText_RibbonsVar1); text = gStringVar4; } @@ -3352,17 +3002,17 @@ void PrintRibbonCount(void) SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 1), text, offset, 1, 0, 0); } -void BufferLeftColumnStats(void) +static void BufferLeftColumnStats(void) { 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); + ConvertIntToDecimalStringN(currentHPString, pssData->summary.currentHP, 1, 3); + ConvertIntToDecimalStringN(maxHPString, pssData->summary.maxHP, 1, 3); + ConvertIntToDecimalStringN(attackString, pssData->summary.atk, 1, 7); + ConvertIntToDecimalStringN(defenseString, pssData->summary.def, 1, 7); DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, currentHPString); @@ -3377,16 +3027,16 @@ void BufferLeftColumnStats(void) Free(defenseString); } -void PrintLeftColumnStats(void) +static void PrintLeftColumnStats(void) { SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 2), gStringVar4, 4, 1, 0, 0); } -void BufferRightColumnStats(void) +static void BufferRightColumnStats(void) { - ConvertIntToDecimalStringN(gStringVar1, gUnknown_0203CF1C->summary.spatk, 1, 3); - ConvertIntToDecimalStringN(gStringVar2, gUnknown_0203CF1C->summary.spdef, 1, 3); - ConvertIntToDecimalStringN(gStringVar3, gUnknown_0203CF1C->summary.speed, 1, 3); + ConvertIntToDecimalStringN(gStringVar1, pssData->summary.spatk, 1, 3); + ConvertIntToDecimalStringN(gStringVar2, pssData->summary.spdef, 1, 3); + ConvertIntToDecimalStringN(gStringVar3, pssData->summary.speed, 1, 3); DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_SetPlaceholderPtr(0, gStringVar1); @@ -3395,14 +3045,14 @@ void BufferRightColumnStats(void) DynamicPlaceholderTextUtil_ExpandPlaceholders(gStringVar4, gUnknown_0861CE8E); } -void PrintRightColumnStats(void) +static void PrintRightColumnStats(void) { SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(gUnknown_0861CCEC, 3), gStringVar4, 2, 1, 0, 0); } -void PrintExpPointsNextLevel(void) +static void PrintExpPointsNextLevel(void) { - struct PokeSummary *sum = &gUnknown_0203CF1C->summary; + struct PokeSummary *sum = &pssData->summary; u8 windowId = AddWindowFromTemplateList(gUnknown_0861CCEC, 4); int offset; u32 expToNextLevel; @@ -3421,29 +3071,29 @@ void PrintExpPointsNextLevel(void) SummaryScreen_PrintTextOnWindow(windowId, gStringVar1, offset, 17, 0, 0); } -void sub_81C3984(void) +static void sub_81C3984(void) { PrintMoveNameAndPP(0); PrintMoveNameAndPP(1); PrintMoveNameAndPP(2); PrintMoveNameAndPP(3); - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { PrintNewMoveDetailsOrCancelText(); - if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES) + if (pssData->firstMoveIndex == MAX_MON_MOVES) { - if (gUnknown_0203CF1C->newMove != MOVE_NONE) - PrintMoveDetails(gUnknown_0203CF1C->newMove); + if (pssData->newMove != MOVE_NONE) + PrintMoveDetails(pssData->newMove); } else { - PrintMoveDetails(gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]); + PrintMoveDetails(pssData->summary.moves[pssData->firstMoveIndex]); } } } -void sub_81C39F0(u8 taskId) +static void sub_81C39F0(u8 taskId) { s16 *data = gTasks[taskId].data; @@ -3462,22 +3112,22 @@ void sub_81C39F0(u8 taskId) PrintMoveNameAndPP(3); break; case 5: - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) PrintNewMoveDetailsOrCancelText(); break; case 6: - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { - if (gUnknown_0203CF1C->firstMoveIndex == MAX_MON_MOVES) - data[1] = gUnknown_0203CF1C->newMove; + if (pssData->firstMoveIndex == MAX_MON_MOVES) + data[1] = pssData->newMove; else - data[1] = gUnknown_0203CF1C->summary.moves[gUnknown_0203CF1C->firstMoveIndex]; + data[1] = pssData->summary.moves[pssData->firstMoveIndex]; } break; case 7: - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { - if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) + if (pssData->newMove != MOVE_NONE || pssData->firstMoveIndex != MAX_MON_MOVES) PrintMoveDetails(data[1]); } break; @@ -3488,13 +3138,13 @@ void sub_81C39F0(u8 taskId) data[0]++; } -void PrintMoveNameAndPP(u8 moveIndex) +static void PrintMoveNameAndPP(u8 moveIndex) { u8 pp; u32 ppState; const u8 *text; u32 offset; - struct UnkSummaryStruct *summaryStruct = gUnknown_0203CF1C; + struct UnkSummaryStruct *summaryStruct = pssData; u8 moveNameWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 0); u8 ppValueWindowId = AddWindowFromTemplateList(gUnknown_0861CD14, 1); u16 move = summaryStruct->summary.moves[moveIndex]; @@ -3524,7 +3174,7 @@ void PrintMoveNameAndPP(u8 moveIndex) SummaryScreen_PrintTextOnWindow(ppValueWindowId, text, offset, moveIndex * 16 + 1, 0, ppState); } -void PrintMovePowerAndAccuracy(u16 moveIndex) +static void PrintMovePowerAndAccuracy(u16 moveIndex) { const u8 *text; if (moveIndex != 0) @@ -3557,21 +3207,21 @@ void PrintMovePowerAndAccuracy(u16 moveIndex) } } -void sub_81C3D08(void) +static void sub_81C3D08(void) { PrintMoveNameAndPP(0); PrintMoveNameAndPP(1); PrintMoveNameAndPP(2); PrintMoveNameAndPP(3); - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { PrintNewMoveDetailsOrCancelText(); - PrintContestMoveDescription(gUnknown_0203CF1C->firstMoveIndex); + PrintContestMoveDescription(pssData->firstMoveIndex); } } -void sub_81C3D54(u8 taskId) +static void sub_81C3D54(u8 taskId) { s16 *data = gTasks[taskId].data; s16 dataa = data[0] - 1; @@ -3591,14 +3241,14 @@ void sub_81C3D54(u8 taskId) PrintMoveNameAndPP(3); break; case 4: - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) PrintNewMoveDetailsOrCancelText(); break; case 5: - if (gUnknown_0203CF1C->mode == PSS_MODE_SELECT_MOVE) + if (pssData->mode == PSS_MODE_SELECT_MOVE) { - if (gUnknown_0203CF1C->newMove != MOVE_NONE || gUnknown_0203CF1C->firstMoveIndex != MAX_MON_MOVES) - PrintContestMoveDescription(gUnknown_0203CF1C->firstMoveIndex); + if (pssData->newMove != MOVE_NONE || pssData->firstMoveIndex != MAX_MON_MOVES) + PrintContestMoveDescription(pssData->firstMoveIndex); } break; case 6: @@ -3608,14 +3258,14 @@ void sub_81C3D54(u8 taskId) data[0]++; } -void PrintContestMoveDescription(u8 moveSlot) +static void PrintContestMoveDescription(u8 moveSlot) { u16 move; if (moveSlot == 4) - move = gUnknown_0203CF1C->newMove; + move = pssData->newMove; else - move = gUnknown_0203CF1C->summary.moves[moveSlot]; + move = pssData->summary.moves[moveSlot]; if (move != MOVE_NONE) { @@ -3624,13 +3274,13 @@ void PrintContestMoveDescription(u8 moveSlot) } } -void PrintMoveDetails(u16 move) +static void PrintMoveDetails(u16 move) { u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2); FillWindowPixelBuffer(windowId, 0); if (move != MOVE_NONE) { - if (gUnknown_0203CF1C->currPageIndex == 2) + if (pssData->currPageIndex == 2) { PrintMovePowerAndAccuracy(move); SummaryScreen_PrintTextOnWindow(windowId, gMoveDescriptionPointers[move - 1], 6, 1, 0, 0); @@ -3649,20 +3299,20 @@ void PrintMoveDetails(u16 move) schedule_bg_copy_tilemap_to_vram(0); } -void PrintNewMoveDetailsOrCancelText(void) +static void PrintNewMoveDetailsOrCancelText(void) { u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0); u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1); - if (gUnknown_0203CF1C->newMove == MOVE_NONE) + if (pssData->newMove == MOVE_NONE) { SummaryScreen_PrintTextOnWindow(windowId1, gText_Cancel, 0, 65, 0, 1); } else { - u16 move = gUnknown_0203CF1C->newMove; + u16 move = pssData->newMove; - if (gUnknown_0203CF1C->currPageIndex == 2) + if (pssData->currPageIndex == 2) SummaryScreen_PrintTextOnWindow(windowId1, gMoveNames[move], 0, 65, 0, 6); else SummaryScreen_PrintTextOnWindow(windowId1, gMoveNames[move], 0, 65, 0, 5); @@ -3676,14 +3326,14 @@ void PrintNewMoveDetailsOrCancelText(void) } } -void sub_81C4064(void) +static 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) +static void sub_81C40A0(u8 moveIndex1, u8 moveIndex2) { u8 windowId1 = AddWindowFromTemplateList(gUnknown_0861CD14, 0); u8 windowId2 = AddWindowFromTemplateList(gUnknown_0861CD14, 1); @@ -3698,49 +3348,51 @@ void sub_81C40A0(u8 moveIndex1, u8 moveIndex2) PrintMoveNameAndPP(moveIndex2); } -void sub_81C4154(void) +static void PrintHMMovesCantBeForgotten(void) { u8 windowId = AddWindowFromTemplateList(gUnknown_0861CD14, 2); FillWindowPixelBuffer(windowId, 0); SummaryScreen_PrintTextOnWindow(windowId, gText_HMMovesCantBeForgotten2, 6, 1, 0, 0); } -void sub_81C4190(void) +static void sub_81C4190(void) { u8 i; for (i = 0; i < 28; i++) - gUnknown_0203CF1C->spriteIds[i] |= 0xFF; -} - -void DestroySpriteInArray(u8 spriteArrayId) -{ - if (gUnknown_0203CF1C->spriteIds[spriteArrayId] != 0xFF) { - DestroySprite(&gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]]); - gUnknown_0203CF1C->spriteIds[spriteArrayId] = 0xFF; + pssData->spriteIds[i] = 0xFF; } } -void sub_81C4204(u8 spriteArrayId, bool8 invisible) +static void DestroySpriteInArray(u8 spriteArrayId) { - gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]].invisible = invisible; + if (pssData->spriteIds[spriteArrayId] != 0xFF) + { + DestroySprite(&gSprites[pssData->spriteIds[spriteArrayId]]); + pssData->spriteIds[spriteArrayId] = 0xFF; + } } -void sub_81C424C(void) +static void sub_81C4204(u8 spriteArrayId, bool8 invisible) +{ + gSprites[pssData->spriteIds[spriteArrayId]].invisible = invisible; +} + +static void sub_81C424C(void) { u8 i; for (i = 3; i < 28; i++) { - if (gUnknown_0203CF1C->spriteIds[i] != 0xFF) + if (pssData->spriteIds[i] != 0xFF) sub_81C4204(i, TRUE); } } -void sub_81C4280(void) +static void sub_81C4280(void) { - switch (gUnknown_0203CF1C->currPageIndex) + switch (pssData->currPageIndex) { case 0: sub_81C43A0(); @@ -3756,22 +3408,22 @@ void sub_81C4280(void) } } -void sub_81C42C8(void) +static void sub_81C42C8(void) { u8 i; for (i = 3; i < 8; i++) { - if (gUnknown_0203CF1C->spriteIds[i] == 0xFF) - gUnknown_0203CF1C->spriteIds[i] = CreateSprite(&gUnknown_0861CFC4, 0, 0, 2); + if (pssData->spriteIds[i] == 0xFF) + pssData->spriteIds[i] = CreateSprite(&gUnknown_0861CFC4, 0, 0, 2); sub_81C4204(i, TRUE); } } -void sub_81C4318(u8 typeId, u8 x, u8 y, u8 spriteArrayId) +static void SetMoveTypeSpritePosAndType(u8 typeId, u8 x, u8 y, u8 spriteArrayId) { - struct Sprite *sprite = &gSprites[gUnknown_0203CF1C->spriteIds[spriteArrayId]]; + struct Sprite *sprite = &gSprites[pssData->spriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); sprite->oam.paletteNum = gUnknown_0861CFDC[typeId]; sprite->pos1.x = x + 16; @@ -3779,20 +3431,20 @@ void sub_81C4318(u8 typeId, u8 x, u8 y, u8 spriteArrayId) sub_81C4204(spriteArrayId, FALSE); } -void sub_81C43A0(void) +static void sub_81C43A0(void) { - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->summary; if (summary->isEgg) { - sub_81C4318(TYPE_MYSTERY, 0x78, 0x30, 3); + SetMoveTypeSpritePosAndType(TYPE_MYSTERY, 120, 48, 3); sub_81C4204(4, TRUE); } else { - sub_81C4318(gBaseStats[summary->species].type1, 0x78, 0x30, 3); + SetMoveTypeSpritePosAndType(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); + SetMoveTypeSpritePosAndType(gBaseStats[summary->species].type2, 0xA0, 0x30, 4); sub_81C4204(4, FALSE); } else @@ -3802,51 +3454,51 @@ void sub_81C43A0(void) } } -void sub_81C4420(void) +static void sub_81C4420(void) { u8 i; - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->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); + SetMoveTypeSpritePosAndType(gBattleMoves[summary->moves[i]].type, 0x55, 0x20 + (i * 0x10), i + 3); else sub_81C4204(i + 3, TRUE); } } -void sub_81C4484(void) +static void sub_81C4484(void) { u8 i; - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->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); + SetMoveTypeSpritePosAndType(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) +static void sub_81C44F0(void) { - if (gUnknown_0203CF1C->newMove == MOVE_NONE) + if (pssData->newMove == MOVE_NONE) { sub_81C4204(7, TRUE); } else { - if (gUnknown_0203CF1C->currPageIndex == 2) - sub_81C4318(gBattleMoves[gUnknown_0203CF1C->newMove].type, 0x55, 0x60, 7); + if (pssData->currPageIndex == 2) + SetMoveTypeSpritePosAndType(gBattleMoves[pssData->newMove].type, 85, 96, 7); else - sub_81C4318(NUMBER_OF_MON_TYPES + gContestMoves[gUnknown_0203CF1C->newMove].contestCategory, 0x55, 0x60, 7); + SetMoveTypeSpritePosAndType(NUMBER_OF_MON_TYPES + gContestMoves[pssData->newMove].contestCategory, 85, 96, 7); } } -void sub_81C4568(u8 a0, u8 a1) +static 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]]; + struct Sprite *sprite1 = &gSprites[pssData->spriteIds[a0 + 3]]; + struct Sprite *sprite2 = &gSprites[pssData->spriteIds[a1 + 3]]; u8 temp = sprite1->animNum; sprite1->animNum = sprite2->animNum; @@ -3862,10 +3514,10 @@ void sub_81C4568(u8 a0, u8 a1) sprite2->animEnded = FALSE; } -u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) +static u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) { const struct CompressedSpritePalette *pal; - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->summary; switch (*a1) { @@ -3874,7 +3526,7 @@ u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) case 0: if (gMain.inBattle) { - if (sub_80688F8(3, gUnknown_0203CF1C->curMonIndex)) + if (sub_80688F8(3, pssData->curMonIndex)) { HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid); } @@ -3887,7 +3539,7 @@ u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) { if (gMonSpritesGfxPtr != NULL) { - if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE) + if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE) { HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], gMonSpritesGfxPtr->sprites[1], summary->species2, summary->pid); } @@ -3898,7 +3550,7 @@ u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) } else { - if (gUnknown_0203CF1C->monList.mons == gPlayerParty || gUnknown_0203CF1C->mode == PSS_MODE_UNK2 || gUnknown_0203CF1C->unk40EF == TRUE) + if (pssData->monList.mons == gPlayerParty || pssData->mode == PSS_MODE_UNK2 || pssData->unk40EF == TRUE) { HandleLoadSpecialPokePic_2(&gMonFrontPicTable[summary->species2], sub_806F4F8(0, 1), summary->species2, summary->pid); } @@ -3919,12 +3571,12 @@ u8 sub_81C45F4(struct Pokemon *mon, s16 *a1) } } -void sub_81C4778(void) +static void sub_81C4778(void) { - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->summary; if (!summary->isEgg) { - if (ShouldPlayNormalMonCry(&gUnknown_0203CF1C->currentMon) == TRUE) + if (ShouldPlayNormalMonCry(&pssData->currentMon) == TRUE) { PlayCry3(summary->species2, 0, 0); } @@ -3935,9 +3587,9 @@ void sub_81C4778(void) } } -u8 sub_81C47B4(struct Pokemon *unused) +static u8 sub_81C47B4(struct Pokemon *unused) { - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->summary; u8 spriteId = CreateSprite(&gMultiuseSpriteTemplate, 40, 64, 5); struct Sprite *sprite = &gSprites[spriteId]; @@ -3960,9 +3612,9 @@ u8 sub_81C47B4(struct Pokemon *unused) return spriteId; } -void sub_81C4844(struct Sprite *sprite) +static void sub_81C4844(struct Sprite *sprite) { - struct PokeSummary *summary = &gUnknown_0203CF1C->summary; + struct PokeSummary *summary = &pssData->summary; if (!gPaletteFade.active && sprite->data[2] != 1) { @@ -3986,9 +3638,9 @@ void SummaryScreen_DestroyUnknownTask(void) } } -bool32 DoesSpriteHaveCallback(void) +static bool32 SummaryScreen_DoesSpriteHaveCallback(void) { - if (gSprites[gUnknown_0203CF1C->spriteIds[0]].callback == SpriteCallbackDummy) + if (gSprites[pssData->spriteIds[0]].callback == SpriteCallbackDummy) { return FALSE; } @@ -3998,16 +3650,16 @@ bool32 DoesSpriteHaveCallback(void) } } -void sub_81C48F0(void) +static void sub_81C48F0(void) { u16 i; u16 paletteIndex; - gSprites[gUnknown_0203CF1C->spriteIds[0]].animPaused = TRUE; - gSprites[gUnknown_0203CF1C->spriteIds[0]].callback = SpriteCallbackDummy; + gSprites[pssData->spriteIds[0]].animPaused = TRUE; + gSprites[pssData->spriteIds[0]].callback = SpriteCallbackDummy; sub_806EE98(); - paletteIndex = (gSprites[gUnknown_0203CF1C->spriteIds[0]].oam.paletteNum * 16) | 0x100; + paletteIndex = (gSprites[pssData->spriteIds[0]].oam.paletteNum * 16) | 0x100; for (i = 0; i < 16; i++) { @@ -4015,41 +3667,41 @@ void sub_81C48F0(void) } } -void CreateMonMarkingsSprite(struct Pokemon *mon) +static void CreateMonMarkingsSprite(struct Pokemon *mon) { struct Sprite *sprite = sub_811FF94(30003, 30003, gUnknown_0861D120); - gUnknown_0203CF1C->markingsSprite = sprite; + pssData->markingsSprite = sprite; 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; + pssData->markingsSprite->pos1.x = 60; + pssData->markingsSprite->pos1.y = 26; + pssData->markingsSprite->oam.priority = 1; } } -void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon) +static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon) { - DestroySprite(gUnknown_0203CF1C->markingsSprite); + DestroySprite(pssData->markingsSprite); FreeSpriteTilesByTag(30003); CreateMonMarkingsSprite(mon); } -void CreateCaughtBallSprite(struct Pokemon *mon) +static void CreateCaughtBallSprite(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; + pssData->spriteIds[1] = CreateSprite(&gBallSpriteTemplates[ball], 16, 136, 0); + gSprites[pssData->spriteIds[1]].callback = SpriteCallbackDummy; + gSprites[pssData->spriteIds[1]].oam.priority = 3; } -void CreateSetStatusSprite(void) +static void CreateSetStatusSprite(void) { - u8 *spriteId = &gUnknown_0203CF1C->spriteIds[2]; + u8 *spriteId = &pssData->spriteIds[2]; u8 anim; if (*spriteId == 0xFF) @@ -4057,7 +3709,7 @@ void CreateSetStatusSprite(void) *spriteId = CreateSprite(&gUnknown_0861D108, 64, 152, 0); } - anim = sub_81B205C(&gUnknown_0203CF1C->currentMon); + anim = sub_81B205C(&pssData->currentMon); if (anim != 0) { @@ -4070,12 +3722,12 @@ void CreateSetStatusSprite(void) } } -void sub_81C4AF8(u8 a0) +static void sub_81C4AF8(u8 a0) { u8 i; - u8 *spriteIds = &gUnknown_0203CF1C->spriteIds[a0]; + u8 *spriteIds = &pssData->spriteIds[a0]; - if (gUnknown_0203CF1C->currPageIndex > 1) + if (pssData->currPageIndex > 1) { u8 subsprite = 0; if (a0 == 8) @@ -4105,7 +3757,7 @@ void sub_81C4AF8(u8 a0) } } -void sub_81C4BE4(struct Sprite *sprite) +static void sub_81C4BE4(struct Sprite *sprite) { if (sprite->animNum > 3 && sprite->animNum < 7) { @@ -4127,15 +3779,15 @@ void sub_81C4BE4(struct Sprite *sprite) if (sprite->data[0] == 8) { - sprite->pos2.y = gUnknown_0203CF1C->firstMoveIndex * 16; + sprite->pos2.y = pssData->firstMoveIndex * 16; } else { - sprite->pos2.y = gUnknown_0203CF1C->secondMoveIndex * 16; + sprite->pos2.y = pssData->secondMoveIndex * 16; } } -void sub_81C4C60(u8 a0) +static void sub_81C4C60(u8 a0) { u8 i; for (i = 0; i < 10; i++) @@ -4144,10 +3796,10 @@ void sub_81C4C60(u8 a0) } } -void sub_81C4C84(u8 a0) +static void sub_81C4C84(u8 a0) { u8 i; - u8 *spriteIds = &gUnknown_0203CF1C->spriteIds[8]; + u8 *spriteIds = &pssData->spriteIds[8]; a0 *= 3; for (i = 0; i < 10; i++) @@ -4167,10 +3819,10 @@ void sub_81C4C84(u8 a0) } } -void sub_81C4D18(u8 a0) +static void sub_81C4D18(u8 firstSpriteId) { u8 i; - u8 *spriteIds = &gUnknown_0203CF1C->spriteIds[a0]; + u8 *spriteIds = &pssData->spriteIds[firstSpriteId]; for (i = 0; i < 10; i++) { From 2b81db7acecd8baa3e343de66fd229040ec81381 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Wed, 15 Aug 2018 18:50:56 -0700 Subject: [PATCH 21/21] Fix Task_Truck1 --- src/field_special_scene.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/field_special_scene.c b/src/field_special_scene.c index 6f33b2c9b..c6cb0741d 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -63,32 +63,24 @@ s16 GetTruckBoxMovement(int a1) // for the box movement? return 0; } -// smh STILL BROKEN IN EMERALD void Task_Truck1(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 cameraYpan; - s16 box1 = 0; - s16 box2 = 0; - s16 box3 = 0; - u8 mapNum, mapGroup; - register s16 zero asm("r4"); + s16 cameraXpan = 0, cameraYpan = 0; + s16 box1, box2, box3; box1 = GetTruckBoxMovement(data[0] + 30) * 4; // top box. - sub_808E82C(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3, box1 + 3); + sub_808E82C(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); box2 = GetTruckBoxMovement(data[0]) * 2; // bottom left box. - sub_808E82C(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 0, box2 - 3); + sub_808E82C(2, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); box3 = GetTruckBoxMovement(data[0]) * 4; // bottom right box. - mapNum = gSaveBlock1Ptr->location.mapNum; - mapGroup = gSaveBlock1Ptr->location.mapGroup; - zero = 0; - sub_808E82C(3, mapNum, mapGroup, -3, box3); + sub_808E82C(3, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); if (++data[0] == SECONDS(500)) // this will never run - data[0] = zero; // reset the timer if it gets stuck. + data[0] = 0; // reset the timer if it gets stuck. cameraYpan = GetTruckCameraBobbingY(data[0]); - SetCameraPanning(0, cameraYpan); + SetCameraPanning(cameraXpan, cameraYpan); } void Task_Truck2(u8 taskId)