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 000000000..2abf39366 Binary files /dev/null and b/graphics/pokedex/arrows.png differ diff --git a/include/learn_move.h b/include/learn_move.h new file mode 100644 index 000000000..951cd6cb0 --- /dev/null +++ b/include/learn_move.h @@ -0,0 +1,36 @@ +#ifndef GUARD_LEAN_MOVE_H +#define GUARD_LEAN_MOVE_H + +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; + +void sub_8160624(void); +void sub_8160638(void); + +const struct SpritePalette gUnknown_08402D88 = {gDexArrows_Pal, 5526}; + +#endif //GUARD_LEAN_MOVE_H diff --git a/src/learn_move.c b/src/learn_move.c new file mode 100644 index 000000000..3a1ac72f4 --- /dev/null +++ b/src/learn_move.c @@ -0,0 +1,83 @@ +#include "global.h" +#include "main.h" +#include "task.h" +#include "script.h" +#include "sprite.h" +#include "palette.h" +#include "menu.h" +#include "list_menu.h" +#include "malloc.h" +#include "field_screen.h" +#include "event_data.h" +#include "learn_move.h" + +extern void (*gFieldCallback)(void); +extern struct LearnMoveStruct *gUnknown_0203BC34; + +// Ew, just copied from poeruby... +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 + +void sub_8160624(void) //VBlankCB_LearnMove +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_8160638(void) //TeachMoveTutorMove +{ + ScriptContext2_Enable(); + CreateTask(sub_8160664, 0xA); + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); +} + +void sub_8160664(u8 taskId) +{ + if (!gPaletteFade.active) + { + SetMainCallback2(sub_81606A0); + gFieldCallback = sub_80AF168; + DestroyTask(taskId); + } +} + +void sub_81606A0(void) //CB2_InitLearnMove +{ + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + clear_scheduled_bg_copies_to_vram(); + + + //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->partyMon = 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); +}