Merge pull request #595 from Phlosioneer/move-tutor

Move tutor
This commit is contained in:
huderlem 2019-03-17 17:32:42 -05:00 committed by GitHub
commit 7154d2614d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 5046 additions and 4878 deletions

1654
asm/menu_specialized.s Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@ FallarborTown_House2_EventScript_2013D6:: @ 82013D6
FallarborTown_House2_EventScript_20140C:: @ 820140C
msgbox FallarborTown_House2_Text_2015C3, MSGBOX_DEFAULT
special TeachMoveTutorMove
special TeachMoveRelearnerMove
waitstate
compare VAR_0x8004, 0
goto_if_eq FallarborTown_House2_EventScript_2013D6

148
data/menu_specialized.s Normal file
View File

@ -0,0 +1,148 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_08625560:: @ 8625560
.incbin "graphics/pokenav/pokeball.4bpp"
gUnknown_08625660:: @ 8625660
.incbin "graphics/pokenav/pokeball_placeholder.4bpp"
gUnknown_08625680:: @ 8625680
.incbin "graphics/pokenav/sparkle.gbapal"
gUnknown_086256A0:: @ 86255A0
.incbin "graphics/pokenav/sparkle.4bpp"
gUnknown_08625A20:: @ 8625A20
.2byte 0
.2byte 0xC000
.2byte 0x400
.2byte 0
gUnknown_08625A28:: @ 8625A28
.2byte 0
.2byte 0x4000
.2byte 0x800
.2byte 0
gUnknown_08625A30:: @ 8625A30
.2byte 0
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625A38:: @ 8625A38
.2byte 4
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625A40:: @ 8625A40
.4byte gUnknown_08625A30
.4byte gUnknown_08625A38
gUnknown_08625A48:: @ 8625A48
.4byte NULL
.4byte 0x640800
gUnknown_08625A50:: @ 8625A50
spr_template 0x64, 0x64, gUnknown_08625A20, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_08625A68:: @ 8625A68
.4byte NULL
.4byte 0x64
gUnknown_08625A70:: @ 8625A70
.4byte gUnknown_08625560
.byte 0, 1, 0x65, 0
.4byte gUnknown_08625660
.2byte 0x20, 0x67
.4byte gPokenavConditionCancel_Gfx
.byte 0, 1, 0x66, 0
.4byte NULL, NULL
gUnknown_08625A90:: @ 8625A90
.4byte gPokenavConditionCancel_Pal + 0x0
.byte 0x65, 0, 0, 0
.4byte gPokenavConditionCancel_Pal + 0x20
.byte 0x66, 0, 0, 0
.4byte NULL, NULL
gUnknown_08625AA8:: @ 8625AA8
spr_template 0x65, 0x65, gUnknown_08625A28, gUnknown_08625A40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_08625AC0:: @ 8625AC0
.4byte gUnknown_086256A0
.byte 0x80, 3, 0x68, 0
gUnknown_08625AC8:: @ 8625AC8
.4byte gUnknown_08625680
.byte 0x68, 0, 0, 0
gUnknown_08625AD0:: @ 8625AD0
.2byte 0
.2byte 0x4000
.2byte 0
.2byte 0
gUnknown_08625AD8:: @ 8625AD8
.2byte 0
.2byte 5
.2byte 4
.2byte 5
gUnknown_08625AE0:: @ 8625AE0
.2byte 8
.2byte 5
.2byte 12
.2byte 5
gUnknown_08625AE8:: @ 8625AE8
.2byte 16
.2byte 5
.2byte 20
.2byte 5
gUnknown_08625AF0:: @ 8625AF0
.2byte 24
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625AF8:: @ 8625AF8
.4byte gUnknown_08625AD8
.4byte gUnknown_08625AE0
gUnknown_08625B00:: @ 8625B00
.4byte gUnknown_08625AE8
.4byte gUnknown_08625AF0
gUnknown_08625B08:: @ 8625B08
.4byte gUnknown_08625AF8
.4byte gUnknown_08625B00
.4byte gUnknown_08625B08
gUnknown_08625B14:: @ 8625B14
spr_template 0x68, 0x68, gUnknown_08625AD0, gUnknown_08625AF8, NULL gDummySpriteAffineAnimTable, sub_81D3564
gUnknown_08625B2C:: @ 8625B2C
.2byte 0, 0xFFDD
.2byte 20, 0xFFE4
.2byte 33, 0xFFF6
.2byte 33, 10
.2byte 20, 28
.2byte 0, 35
.2byte 0xFFEC, 28
.2byte 0xFFDF, 10
.2byte 0xFFDF, 0xFFF6
.2byte 0xFFEC, 0xFFE4
gUnknown_08625B54:: @ 8625B54
.4byte gUnknown_085EEA46
.4byte gUnknown_085EEA4E
.4byte gUnknown_085EEA55
.4byte gUnknown_085EEA63
.4byte gUnknown_085EEA6B
.4byte gUnknown_085EEA5D

View File

@ -3,200 +3,6 @@
.section .rodata
gUnknown_086253E8:: @ 86253E8
.4byte 0x8010100
.4byte 0x80F02
.4byte 0x8011500
.4byte 0x180F12
.4byte 0xB010100
.4byte 0x180F08
gUnknown_08625400:: @ 8625400
.byte 1, 2, 3
gUnknown_08625403:: @ 8625403
.byte 0xFF
gUnknown_08625404:: @ 8625404
.byte 0x40, 0, 0, 4, 1, 0, 0x60, 0xA6, 1, 0, 0, 0
gUnknown_08625410:: @ 8625410
.byte 4, 5, 6, 7, 8, 9, 9, 0xA, 0xA, 0xB, 0xB, 0xC, 0xC, 0xD, 0xD, 0xD, 0xD, 0xE, 0xE, 0xE, 0xE, 0xF, 0xF, 0xF, 0xF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1D, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x23
gUnknown_08625510:: @ 8625510
.4byte 0x10010101
.4byte 0xA0F0C
.4byte 0x10010101
.4byte 0xCA0F0C
.4byte 0xA011301
.4byte 0x18A0F0C
.4byte 0x160F0401
.4byte 0x2020F04
.4byte 0x5081600
.4byte 0x25A0F04
.4byte 0xFF
.4byte NULL
gUnknown_08625540:: @ 8625540
.4byte 0x5081600
.4byte 0x25A0F04
gUnknown_08625548:: @ 8625548
.4byte NULL
.4byte sub_81D2BD0
.4byte NULL
.2byte 0
.2byte 0
.byte 2
.byte 0
.byte 8
.byte 0
.4byte 0x1003121
gUnknown_08625560:: @ 8625560
.incbin "graphics/pokenav/pokeball.4bpp"
gUnknown_08625660:: @ 8625660
.incbin "graphics/pokenav/8625660.4bpp"
gUnknown_08625680:: @ 8625680
.incbin "graphics/pokenav/sparkle.gbapal"
gUnknown_086256A0:: @ 86255A0
.incbin "graphics/pokenav/sparkle.4bpp"
gUnknown_08625A20:: @ 8625A20
.2byte 0
.2byte 0xC000
.2byte 0x400
.2byte 0
gUnknown_08625A28:: @ 8625A28
.2byte 0
.2byte 0x4000
.2byte 0x800
.2byte 0
gUnknown_08625A30:: @ 8625A30
.2byte 0
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625A38:: @ 8625A38
.2byte 4
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625A40:: @ 8625A40
.4byte gUnknown_08625A30
.4byte gUnknown_08625A38
gUnknown_08625A48:: @ 8625A48
.4byte NULL
.4byte 0x640800
gUnknown_08625A50:: @ 8625A50
spr_template 0x64, 0x64, gUnknown_08625A20, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_08625A68:: @ 8625A68
.4byte NULL
.4byte 0x64
gUnknown_08625A70:: @ 8625A70
.4byte gUnknown_08625560
.byte 0, 1, 0x65, 0
.4byte gUnknown_08625660
.2byte 0x20, 0x67
.4byte gPokenavConditionCancel_Gfx
.byte 0, 1, 0x66, 0
.4byte NULL, NULL
gUnknown_08625A90:: @ 8625A90
.4byte gPokenavConditionCancel_Pal + 0x0
.byte 0x65, 0, 0, 0
.4byte gPokenavConditionCancel_Pal + 0x20
.byte 0x66, 0, 0, 0
.4byte NULL, NULL
gUnknown_08625AA8:: @ 8625AA8
spr_template 0x65, 0x65, gUnknown_08625A28, gUnknown_08625A40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_08625AC0:: @ 8625AC0
.4byte gUnknown_086256A0
.byte 0x80, 3, 0x68, 0
gUnknown_08625AC8:: @ 8625AC8
.4byte gUnknown_08625680
.byte 0x68, 0, 0, 0
gUnknown_08625AD0:: @ 8625AD0
.2byte 0
.2byte 0x4000
.2byte 0
.2byte 0
gUnknown_08625AD8:: @ 8625AD8
.2byte 0
.2byte 5
.2byte 4
.2byte 5
gUnknown_08625AE0:: @ 8625AE0
.2byte 8
.2byte 5
.2byte 12
.2byte 5
gUnknown_08625AE8:: @ 8625AE8
.2byte 16
.2byte 5
.2byte 20
.2byte 5
gUnknown_08625AF0:: @ 8625AF0
.2byte 24
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625AF8:: @ 8625AF8
.4byte gUnknown_08625AD8
.4byte gUnknown_08625AE0
gUnknown_08625B00:: @ 8625B00
.4byte gUnknown_08625AE8
.4byte gUnknown_08625AF0
gUnknown_08625B08:: @ 8625B08
.4byte gUnknown_08625AF8
.4byte gUnknown_08625B00
.4byte gUnknown_08625B08
gUnknown_08625B14:: @ 8625B14
spr_template 0x68, 0x68, gUnknown_08625AD0, gUnknown_08625AF8, NULL gDummySpriteAffineAnimTable, sub_81D3564
gUnknown_08625B2C:: @ 8625B2C
.2byte 0, 0xFFDD
.2byte 20, 0xFFE4
.2byte 33, 0xFFF6
.2byte 33, 10
.2byte 20, 28
.2byte 0, 35
.2byte 0xFFEC, 28
.2byte 0xFFDF, 10
.2byte 0xFFDF, 0xFFF6
.2byte 0xFFEC, 0xFFE4
gUnknown_08625B54:: @ 8625B54
.4byte gUnknown_085EEA46
.4byte gUnknown_085EEA4E
.4byte gUnknown_085EEA55
.4byte gUnknown_085EEA63
.4byte gUnknown_085EEA6B
.4byte gUnknown_085EEA5D
gUnknown_08625B6C:: @ 8625B6C
@ apparently e-reader trainer data? idk
.byte 0x6f, 0x57, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x14, 0x0c, 0x0e, 0x23, 0x10, 0x47, 0x0a, 0x1f, 0x06, 0x24, 0x0e, 0x48, 0x0a, 0x0f, 0x06

View File

@ -235,7 +235,7 @@ gSpecials:: @ 81DBA64
def_special sub_81B9770
def_special sub_81B9718
def_special sub_81B96D0
def_special TeachMoveTutorMove
def_special TeachMoveRelearnerMove
def_special GetRecordedCyclingRoadResults
def_special Special_BeginCyclingRoadChallenge
def_special GetPlayerAvatarBike

View File

Before

Width:  |  Height:  |  Size: 88 B

After

Width:  |  Height:  |  Size: 88 B

View File

@ -19,6 +19,7 @@ struct ContestEffect
extern const struct ContestMove gContestMoves[];
extern const struct ContestEffect gContestEffects[];
extern const u8 *const gContestEffectDescriptionPointers[];
extern const u8 *const gContestMoveTypeTextPointers[];
bool8 AreMovesContestCombo(u16 lastMove, u16 nextMove);

View File

@ -5,7 +5,7 @@ void pal_fill_for_maplights(void);
void pal_fill_black(void);
void WarpFadeScreen(void);
void sub_80AF128(void);
void sub_80AF168(void);
void FieldCallback_ReturnToEventScript2(void);
void sub_80AF188(void);
void sub_80AF214(void);
void sub_80AF2B4(u8 taskId);

View File

@ -1,7 +0,0 @@
#ifndef GUARD_LEARN_MOVE_H
#define GUARD_LEARN_MOVE_H
void TeachMoveTutorMove(void);
void ShowHideHearts(s32);
#endif //GUARD_LEARN_MOVE_H

View File

@ -4,7 +4,7 @@
#include "window.h"
#define LIST_NOTHING_CHOSEN -1
#define LIST_B_PRESSED -2
#define LIST_CANCEL -2
#define LIST_HEADER -3
#define LIST_NO_MULTIPLE_SCROLL 0

View File

@ -31,7 +31,7 @@ u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed
void PrintPlayerNameOnWindow(u8, const u8*, u16, u16);
void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram);
void SetStandardWindowBorderStyle(u8 a0, u8 a1);
void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram);
void DisplayYesNoMenuDefaultYes(void);
u32 GetPlayerTextSpeed(void);
u8 GetPlayerTextSpeedDelay(void);

View File

@ -0,0 +1,53 @@
#ifndef GUARD_MENU_SPECIALIZED_H
#define GUARD_MENU_SPECIALIZED_H
#include "player_pc.h"
#include "list_menu.h"
#include "pokemon.h"
struct UnknownSubStruct_81D1ED4
{
u16 unk0;
u16 unk2;
};
struct UnknownStruct_81D1ED4
{
u8 unk0[4][5];
struct UnknownSubStruct_81D1ED4 unk14[4][5];
struct UnknownSubStruct_81D1ED4 unk64[10][5];
struct UnknownSubStruct_81D1ED4 unk12C[5];
struct UnknownSubStruct_81D1ED4 unk13C[0x42];
struct UnknownSubStruct_81D1ED4 unk248[0x42];
u16 unk350;
u16 unk352;
u8 unk354;
u8 unk355;
u8 unk356[0x22];
};
bool8 sub_81D1C44(u8 count);
u8 sub_81D1C84(u8 a0);
u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page);
void sub_81D1E90(struct PlayerPCItemPageStruct *page);
void sub_81D1EC0(void);
void sub_81D1D04(u8 a0);
void DrawLevelUpWindowPg1(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5);
void DrawLevelUpWindowPg2(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4);
void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0);
void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0);
bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D3464(void *arg0);
void sub_81D3480(void *arg0, u8 arg1);
void sub_81D2754(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1);
void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 arg1[4][5], struct UnknownSubStruct_81D1ED4 arg2[4][5]);
void MoveRelearnerPrintText(u8 *str);
bool16 MoveRelearnerRunTextPrinters(void);
void MoveRelearnerCreateYesNoMenu(void);
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
void InitMoveRelearnerWindows(bool8 useContextWindow);
void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation);
#endif // GUARD_MENU_SPECIALIZED_H

7
include/move_relearner.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef GUARD_MOVE_RELEARNER_H
#define GUARD_MOVE_RELEARNER_H
void TeachMoveRelearnerMove(void);
void MoveRelearnerShowHideHearts(s32);
#endif //GUARD_MOVE_RELEARNER_H

View File

@ -1,7 +1,10 @@
#ifndef GUARD_POKEMON_SUMMARY_SCREEN_H
#define GUARD_POKEMON_SUMMARY_SCREEN_H
#include "main.h"
extern u8 gLastViewedMonIndex;
extern const u8 *const gMoveDescriptionPointers[];
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));
void sub_81C4F98(u8, void(*)(void));

View File

@ -1,35 +1,12 @@
#ifndef GUARD_POKENAV_H
#define GUARD_POKENAV_H
#include "player_pc.h"
#include "list_menu.h"
bool8 sub_81D20BC(void *arg0);
bool8 sub_81D312C(void *arg0);
void sub_81D1ED4(void *arg0);
void sub_81D2108(void *arg0);
void sub_81D20AC(void *arg0);
void sub_81D2230(void *arg0);
void sub_81D3464(void *arg0);
void sub_81D3480(void *arg0, u8 arg1);
void sub_81D2754(void *arg0, void *arg1);
void sub_81D1F84(void *arg0, void *arg1, void *arg2);
u8 sub_81D1C84(u8);
u8 sub_81D1DC0(struct PlayerPCItemPageStruct *);
void sub_81D1E90(struct PlayerPCItemPageStruct *);
void sub_81D1EC0(void);
void sub_81D1D04(u8);
bool8 sub_81D1C44(u8);
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);
void sub_81D2824(u16);
bool8 EventObjectIsFarawayIslandMew(struct EventObject *);
u32 sub_81D427C(void);
void sub_81D4998(void);
void sub_81D3640(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5);
void sub_81D3784(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4);
void CB2_InitPokeNav(void);
#endif //GUARD_POKENAV_H

View File

@ -859,15 +859,22 @@ 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_MoveRelearnerPkmnLearnedMove[];
extern const u8 gText_MoveRelearnerPkmnTryingToLearnMove[];
extern const u8 gText_MoveRelearnerWhichMoveToForget[];
extern const u8 gText_MoveRelearnerStopTryingToTeachMove[];
extern const u8 gText_MoveRelearnerAndPoof[];
extern const u8 gText_MoveRelearnerPkmnForgotMoveAndLearnedNew[];
extern const u8 gText_TeachWhichMoveToPkmn[];
extern const u8 gText_GiveUpTeachingNewMove[];
extern const u8 gText_TeachX[];
extern const u8 gText_MoveRelearnerGiveUp[];
extern const u8 gText_MoveRelearnerTeachMoveConfirm[];
extern const u8 gText_MoveRelearnerBattleMoves[];
extern const u8 gText_MoveRelearnerPP[];
extern const u8 gText_MoveRelearnerPower[];
extern const u8 gText_MoveRelearnerAccuracy[];
extern const u8 gText_MoveRelearnerContestMovesTitle[];
extern const u8 gText_MoveRelearnerAppeal[];
extern const u8 gText_MoveRelearnerJam[];
extern const u8 gText_Kira[];
extern const u8 gText_Amy[];

View File

@ -224,7 +224,7 @@ SECTIONS {
src/battle_controller_safari.o(.text);
src/fldeff_sweetscent.o(.text);
src/battle_anim_effects_3.o(.text);
src/learn_move.o(.text);
src/move_relearner.o(.text);
src/fldeff_softboiled.o(.text);
src/decoration_inventory.o(.text);
src/roamer.o(.text);
@ -289,6 +289,8 @@ SECTIONS {
src/pokenav.o(.text);
asm/pokenav.o(.text);
src/pokenav_match_call.o(.text);
src/menu_specialized.o(.text);
asm/menu_specialized.o(.text);
asm/rom_81D1C44.o(.text);
src/trainer_hill.o(.text);
src/rayquaza_scene.o(.text);
@ -533,7 +535,7 @@ SECTIONS {
src/contest_ai.o(.rodata);
src/battle_controller_safari.o(.rodata);
src/battle_anim_effects_3.o(.rodata);
src/learn_move.o(.rodata);
src/move_relearner.o(.rodata);
src/roamer.o(.rodata);
src/battle_tower.o(.rodata);
src/use_pokeblock.o(.rodata);
@ -592,6 +594,8 @@ SECTIONS {
src/pokenav.o(.rodata);
data/pokenav.o(.rodata);
src/pokenav_match_call.o(.rodata);
src/menu_specialized.o(.rodata);
data/menu_specialized.o(.rodata);
data/rom_81D1C44.o(.rodata);
src/trainer_hill.o(.rodata);
src/rayquaza_scene.o(.rodata);

View File

@ -576,7 +576,7 @@ static void SetBagItemsListTemplate(void)
}
StringCopy(gPyramidBagResources->itemStrings[i], gText_CloseBag);
gPyramidBagResources->bagListItems[i].name = gPyramidBagResources->itemStrings[i];
gPyramidBagResources->bagListItems[i].id = LIST_B_PRESSED;
gPyramidBagResources->bagListItems[i].id = LIST_CANCEL;
gMultiuseListMenuTemplate = gUnknown_0861F2C0;
gMultiuseListMenuTemplate.totalItems = gPyramidBagResources->listMenuCount;
gMultiuseListMenuTemplate.items = gPyramidBagResources->bagListItems;
@ -607,7 +607,7 @@ static void PyramidBagMoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMen
if (gPyramidBagResources->unk814 == 0xFF)
{
sub_81C6FF8(gPyramidBagResources->unk815 ^ 1);
if (itemIndex != LIST_B_PRESSED)
if (itemIndex != LIST_CANCEL)
ShowItemImage(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][itemIndex], gPyramidBagResources->unk815);
else
ShowItemImage(0xFFFF, gPyramidBagResources->unk815);
@ -619,7 +619,7 @@ static void PyramidBagMoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMen
static void PrintItemQuantity(u8 windowId, s32 itemIndex, u8 y)
{
s32 xAlign;
if (itemIndex == LIST_B_PRESSED)
if (itemIndex == LIST_CANCEL)
return;
if (gPyramidBagResources->unk814 != 0xFF)
@ -641,7 +641,7 @@ static void PrintItemQuantity(u8 windowId, s32 itemIndex, u8 y)
static void PrintItemDescription(s32 listMenuId)
{
const u8 *desc;
if (listMenuId != LIST_B_PRESSED)
if (listMenuId != LIST_CANCEL)
{
desc = ItemId_GetDescription(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][listMenuId]);
}
@ -859,7 +859,7 @@ static void Task_HandlePyramidBagInput(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
gSpecialVar_ItemId = 0;
sub_81C5B14(taskId);
@ -1293,7 +1293,7 @@ static void Task_ItemSwapHandleInput(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
if (gMain.newKeys & A_BUTTON)
PerformItemSwap(taskId);

View File

@ -49,14 +49,12 @@
#include "field_specials.h"
#include "pokemon_summary_screen.h"
#include "pokenav.h"
#include "menu_specialized.h"
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern const u8* const gBattleScriptsForMoveEffects[];
// functions
extern void sub_81D388C(struct Pokemon* mon, void* statStoreLocation); // pokenav.s
#define DEFENDER_IS_PROTECTED ((gProtectStructs[gBattlerTarget].protected) && (gBattleMoves[gCurrentMove].flags & FLAG_PROTECT_AFFECTED))
// this file's functions
@ -6319,16 +6317,16 @@ static void sub_804F100(void)
{
struct StatsArray currentStats;
sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], &currentStats);
sub_81D3640(0xD, gBattleResources->statsBeforeLvlUp, &currentStats, 0xE, 0xD, 0xF);
GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], &currentStats);
DrawLevelUpWindowPg1(0xD, gBattleResources->statsBeforeLvlUp, &currentStats, 0xE, 0xD, 0xF);
}
static void sub_804F144(void)
{
struct StatsArray currentStats;
sub_81D388C(&gPlayerParty[gBattleStruct->expGetterMonId], &currentStats);
sub_81D3784(0xD, &currentStats, 0xE, 0xD, 0xF);
GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], &currentStats);
DrawLevelUpWindowPg2(0xD, &currentStats, 0xE, 0xD, 0xF);
}
static void sub_804F17C(void)

View File

@ -941,7 +941,7 @@ void sub_812764C(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
SecretBasePC_SelectedDecorActions[data[11]][1](taskId);
break;

View File

@ -469,7 +469,7 @@ static void Task_EggHatch(u8 taskID)
{
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_EggHatch_0);
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
DestroyTask(taskID);
}
}

View File

@ -44,7 +44,7 @@ static void task0A_fade_n_map_maybe(u8);
static void sub_808115C(u8);
static void palette_bg_faded_fill_white(void);
static void sub_80AF438(u8);
static bool32 sub_80AF71C(void);
static bool32 WaitForWeatherFadeIn(void);
static void task0A_mpl_807E31C(u8 taskId);
static void sub_80AFA0C(u8 taskId);
static void sub_80AFA88(u8 taskId);
@ -119,7 +119,7 @@ static void sub_80AF0F4(u8 arg)
static void task0A_nop_for_a_while(u8 taskId)
{
if (sub_80AF71C() == TRUE)
if (WaitForWeatherFadeIn() == TRUE)
DestroyTask(taskId);
}
@ -133,14 +133,14 @@ void sub_80AF128(void)
static void task0A_asap_script_env_2_enable_and_set_ctx_running(u8 taskID)
{
if (sub_80AF71C() == TRUE)
if (WaitForWeatherFadeIn() == TRUE)
{
DestroyTask(taskID);
EnableBothScriptContexts();
}
}
void sub_80AF168(void)
void FieldCallback_ReturnToEventScript2(void)
{
ScriptContext2_Enable();
Overworld_PlaySpecialMapMusic();
@ -173,7 +173,7 @@ static void task_mpl_807DD60(u8 taskId)
}
break;
case 2:
if (sub_80AF71C() == TRUE)
if (WaitForWeatherFadeIn() == TRUE)
{
ScriptContext2_Disable();
DestroyTask(taskId);
@ -213,7 +213,7 @@ static void sub_80AF234(u8 taskId)
}
break;
case 2:
if (sub_80AF71C() == TRUE)
if (WaitForWeatherFadeIn() == TRUE)
{
sub_8009F18();
ScriptContext2_Disable();
@ -333,7 +333,7 @@ static void sub_80AF438(u8 taskId)
task->data[0] = 1;
break;
case 1:
if (sub_80AF71C())
if (WaitForWeatherFadeIn())
{
u8 eventObjId;
sub_80AF0F4(1);
@ -381,7 +381,7 @@ static void task_map_chg_seq_0807E20C(u8 taskId)
task->data[0] = 1;
break;
case 1:
if (sub_80AF71C())
if (WaitForWeatherFadeIn())
{
u8 eventObjId;
sub_80AF0F4(1);
@ -414,7 +414,7 @@ static void task_map_chg_seq_0807E2CC(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 1:
if (sub_80AF71C())
if (WaitForWeatherFadeIn())
{
UnfreezeEventObjects();
ScriptContext2_Disable();
@ -426,7 +426,7 @@ static void task_map_chg_seq_0807E2CC(u8 taskId)
static void sub_80AF660(u8 taskId)
{
if (sub_80AF71C() == TRUE)
if (WaitForWeatherFadeIn() == TRUE)
{
DestroyTask(taskId);
CreateTask(sub_809FA34, 80);
@ -448,7 +448,7 @@ bool8 sub_80AF6A4(void)
static void task_mpl_807E3C8(u8 taskId)
{
if (sub_80AF71C() == 1)
if (WaitForWeatherFadeIn() == 1)
{
ScriptContext2_Disable();
DestroyTask(taskId);
@ -476,7 +476,7 @@ static bool32 PaletteFadeActive(void)
return gPaletteFade.active;
}
static bool32 sub_80AF71C(void)
static bool32 WaitForWeatherFadeIn(void)
{
if (IsWeatherNotFadingIn() == TRUE)
return TRUE;
@ -1007,7 +1007,7 @@ static void task0A_mpl_807E31C(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 1:
if (sub_80AF71C() && sub_808D1B4() != TRUE)
if (WaitForWeatherFadeIn() && sub_808D1B4() != TRUE)
{
UnfreezeEventObjects();
ScriptContext2_Disable();

View File

@ -2610,7 +2610,7 @@ static void sub_813A4EC(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
gSpecialVar_Result = 0x7F;
PlaySE(SE_SELECT);
sub_813A570(taskId);
@ -2690,10 +2690,10 @@ static void sub_813A664(u8 taskId)
static void sub_813A694(u8 taskId)
{
static const struct ScrollArrowsTemplate gUnknown_085B3030 = {
.firstArrowType = 2,
.firstArrowType = SCROLL_ARROW_UP,
.firstX = 0,
.firstY = 0,
.secondArrowType = 3,
.secondArrowType = SCROLL_ARROW_DOWN,
.secondX = 0,
.secondY = 0,
.fullyUpThreshold = 0,

View File

@ -1107,7 +1107,7 @@ void Task_BagMenu(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
if (gUnknown_0203CE58.location == 5)
{
PlaySE(SE_HAZURE);
@ -1323,7 +1323,7 @@ void sub_81AC3C0(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
if (gMain.newKeys & A_BUTTON)
sub_81AC498(taskId);

View File

@ -1,833 +0,0 @@
#include "global.h"
#include "main.h"
#include "battle.h"
#include "bg.h"
#include "contest_effect.h"
#include "data2.h"
#include "event_data.h"
#include "field_screen_effect.h"
#include "gpu_regs.h"
#include "learn_move.h"
#include "list_menu.h"
#include "alloc.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"
static EWRAM_DATA struct
{
u8 state;
u8 spriteIds[16]; /*0x001*/
u16 movesToLearn[4]; /*0x012*/
u8 filler1A[0x44 - 0x1A]; /*0x01A*/
u8 partyMon; /*0x044*/
u8 moveSlot; /*0x045*/
struct ListMenuItem menuItems[20]; /*0x048*/
u8 fillerE8[0x110 - 0xE8]; /*0x0E8*/
u8 numMenuChoices; /*0x110*/
u8 numToShowAtOnce; /*0x111*/
u8 listMenuTask; /*0x112*/
u8 scrollArrowTaskId1; /*0x113*/
u8 scrollArrowTaskId2; /*0x114*/
u16 scrollOffset; /*0x116*/
} *sLearnMoveStruct = {0};
static EWRAM_DATA struct {
u16 listOffset;
u16 listRow;
u8 showContestInfo;
} 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");
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,
},
};
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 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)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
void TeachMoveTutorMove(void)
{
ScriptContext2_Enable();
CreateTask(Task_WaitForFadeOut, 0xA);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0);
}
static void Task_WaitForFadeOut(u8 taskId)
{
if (!gPaletteFade.active)
{
SetMainCallback2(CB2_InitLearnMove);
gFieldCallback = sub_80AF168;
DestroyTask(taskId);
}
}
static void CB2_InitLearnMove(void)
{
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
clear_scheduled_bg_copies_to_vram();
sLearnMoveStruct = AllocZeroed(sizeof(*sLearnMoveStruct));
sLearnMoveStruct->partyMon = gSpecialVar_0x8004;
SetVBlankCallback(VBlankCB_LearnMove);
InitBGs();
sub_81D2824(0);
sLearnMoveStruct2.listOffset = 0;
sLearnMoveStruct2.listRow = 0;
sLearnMoveStruct2.showContestInfo = FALSE;
CreateMenuItemsList();
LoadSpriteSheet(&gUnknown_085CEBB0);
LoadSpritePalette(&gUnknown_085CEBB8);
CreateHearts();
sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sLearnMoveStruct2.listOffset, sLearnMoveStruct2.listRow);
FillPalette(RGB_BLACK, 0, 2);
SetMainCallback2(CB2_Main);
}
static void CB2_InitLearnMoveReturnFromSelectMove(void)
{
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
clear_scheduled_bg_copies_to_vram();
sLearnMoveStruct = AllocZeroed(sizeof(*sLearnMoveStruct));
sLearnMoveStruct->state = 28;
sLearnMoveStruct->partyMon = gSpecialVar_0x8004;
sLearnMoveStruct->moveSlot = gSpecialVar_0x8005;
SetVBlankCallback(VBlankCB_LearnMove);
InitBGs();
sub_81D2824(sLearnMoveStruct2.showContestInfo);
CreateMenuItemsList();
LoadSpriteSheet(&gUnknown_085CEBB0);
LoadSpritePalette(&gUnknown_085CEBB8);
CreateHearts();
sLearnMoveStruct->listMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sLearnMoveStruct2.listOffset, sLearnMoveStruct2.listRow);
FillPalette(RGB_BLACK, 0, 2);
SetMainCallback2(CB2_Main);
}
static void InitBGs(void)
{
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);
}
static void CB2_Main(void)
{
LearnMoveMain();
RunTasks();
AnimateSprites();
BuildOamBuffer();
do_scheduled_bg_tilemap_copies_to_vram();
UpdatePaletteFade();
}
static void sub_816084C(const u8 *src)
{
StringExpandPlaceholders(gStringVar4, src);
sub_81D2BF4(gStringVar4);
}
static void LearnMoveMain(void)
{
switch (sLearnMoveStruct->state)
{
case 0:
sLearnMoveStruct->state++;
HideSpritesAndPrintTeachText(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:
HideSpritesAndPrintTeachText(FALSE);
sLearnMoveStruct->state++;
AddScrollArrows();
break;
case 4:
HandleInput(FALSE);
return;
case 5:
ShowTeachMoveText(FALSE);
sLearnMoveStruct->state++;
AddScrollArrows();
break;
case 6:
HandleInput(TRUE);
break;
case 8:
if (!sub_81D2C3C())
{
sub_81D2C50();
sLearnMoveStruct->state++;
}
break;
case 9:
{
s8 selection = Menu_ProcessInputNoWrapClearOnChoose();
if (selection == 0)
{
if (GiveMoveToMon(&gPlayerParty[sLearnMoveStruct->partyMon], GetCurrentItemId()) != 0xFFFF)
{
sub_816084C(gText_PkmnLearnedMove4);
gSpecialVar_0x8004 = 1;
sLearnMoveStruct->state = 31;
}
else
{
sLearnMoveStruct->state = 16;
}
}
else if (selection == -1 || selection == 1)
{
if (sLearnMoveStruct2.showContestInfo == FALSE)
{
sLearnMoveStruct->state = 3;
}
else if (sLearnMoveStruct2.showContestInfo == TRUE)
{
sLearnMoveStruct->state = 5;
}
}
}
break;
case 12:
if (!sub_81D2C3C())
{
sub_81D2C50();
sLearnMoveStruct->state++;
}
break;
case 13:
{
s8 selection = Menu_ProcessInputNoWrapClearOnChoose();
if (selection == 0)
{
gSpecialVar_0x8004 = selection;
sLearnMoveStruct->state = 14;
}
else if (selection == -1 || selection == 1)
{
if (sLearnMoveStruct2.showContestInfo == FALSE)
{
sLearnMoveStruct->state = 3;
}
else if (sLearnMoveStruct2.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_ProcessInputNoWrapClearOnChoose();
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[GetCurrentItemId()]);
sub_816084C(gText_StopTryingToTeachMove);
sLearnMoveStruct->state++;
break;
case 25:
if (!sub_81D2C3C())
{
sub_81D2C50();
sLearnMoveStruct->state++;
}
break;
case 26:
{
s8 var = Menu_ProcessInputNoWrapClearOnChoose();
if (var == 0)
{
sLearnMoveStruct->state = 27;
}
else if (var == -1 || var == 1)
{
// What's the point? It gets set to 16, anyway.
if (sLearnMoveStruct2.showContestInfo == FALSE)
{
sLearnMoveStruct->state = 3;
}
else if (sLearnMoveStruct2.showContestInfo == TRUE)
{
sLearnMoveStruct->state = 5;
}
sLearnMoveStruct->state = 16;
}
}
break;
case 27:
if (!sub_81D2C3C())
{
FillWindowPixelBuffer(3, PIXEL_FILL(1));
if (sLearnMoveStruct2.showContestInfo == FALSE)
{
sLearnMoveStruct->state = 3;
}
else if (sLearnMoveStruct2.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, CB2_InitLearnMoveReturnFromSelectMove, GetCurrentItemId());
FreeListMenuResources();
}
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)
{
FreeListMenuResources();
SetMainCallback2(CB2_ReturnToField);
}
break;
case 28:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
sLearnMoveStruct->state++;
if (sLearnMoveStruct2.showContestInfo == FALSE)
{
HideSpritesAndPrintTeachText(TRUE);
}
else if (sLearnMoveStruct2.showContestInfo == TRUE)
{
ShowTeachMoveText(TRUE);
}
RemoveScrollArrows();
CopyWindowToVram(3, 2);
break;
case 29:
if (!gPaletteFade.active)
{
if (sLearnMoveStruct->moveSlot == MAX_MON_MOVES)
{
sLearnMoveStruct->state = 24;
}
else
{
u16 moveId = GetMonData(&gPlayerParty[sLearnMoveStruct->partyMon], MON_DATA_MOVE1 + sLearnMoveStruct->moveSlot);
StringCopy(gStringVar3, gMoveNames[moveId]);
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;
}
}
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;
}
}
static void FreeListMenuResources(void)
{
RemoveScrollArrows();
DestroyListMenuTask(sLearnMoveStruct->listMenuTask, &sLearnMoveStruct2.listOffset, &sLearnMoveStruct2.listRow);
FreeAllWindowBuffers();
FREE_AND_SET_NULL(sLearnMoveStruct);
ResetSpriteData();
FreeAllSpritePalettes();
}
static void HideSpritesAndPrintTeachText(bool8 a)
{
s32 i;
for (i = 0; i < 16; i++)
{
gSprites[sLearnMoveStruct->spriteIds[i]].invisible = TRUE;
}
if (!a)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
FillWindowPixelBuffer(3, PIXEL_FILL(1));
AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL);
}
}
static void HandleInput(bool8 showContest)
{
s32 itemId = ListMenu_ProcessInput(sLearnMoveStruct->listMenuTask);
ListMenuGetScrollAndRow(sLearnMoveStruct->listMenuTask, &sLearnMoveStruct2.listOffset, &sLearnMoveStruct2.listRow);
switch (itemId)
{
case LIST_NOTHING_CHOSEN:
if (!(gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysState())
{
break;
}
PlaySE(SE_SELECT);
if (showContest == FALSE)
{
PutWindowTilemap(1);
sLearnMoveStruct->state = 5;
sLearnMoveStruct2.showContestInfo = TRUE;
}
else
{
PutWindowTilemap(0);
sLearnMoveStruct->state = 3;
sLearnMoveStruct2.showContestInfo = FALSE;
}
schedule_bg_copy_tilemap_to_vram(1);
ShowHideHearts(GetCurrentItemId());
break;
case LIST_B_PRESSED:
PlaySE(SE_SELECT);
RemoveScrollArrows();
sLearnMoveStruct->state = 12;
StringExpandPlaceholders(gStringVar4, gText_GiveUpTeachingNewMove);
sub_81D2BF4(gStringVar4);
break;
default:
PlaySE(SE_SELECT);
RemoveScrollArrows();
sLearnMoveStruct->state = 8;
StringCopy(gStringVar2, gMoveNames[itemId]);
StringExpandPlaceholders(gStringVar4, gText_TeachX);
sub_81D2BF4(gStringVar4);
break;
}
}
static s32 GetCurrentItemId(void)
{
return sLearnMoveStruct->menuItems[sLearnMoveStruct2.listRow + sLearnMoveStruct2.listOffset].id;
}
static void ShowTeachMoveText(bool8 showContest)
{
if (showContest == FALSE)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
FillWindowPixelBuffer(3, PIXEL_FILL(1));
AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL);
}
}
static void CreateHearts(void)
{
int i;
sLearnMoveStruct->scrollArrowTaskId2 = -1;
sLearnMoveStruct->scrollArrowTaskId1 = -1;
AddScrollArrows();
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;
}
}
static void AddScrollArrows(void)
{
if (sLearnMoveStruct->scrollArrowTaskId2 == 0xFF)
{
sLearnMoveStruct->scrollArrowTaskId2 = AddScrollIndicatorArrowPair(&gUnknown_085CEBC0, &sLearnMoveStruct->scrollOffset);
}
if (sLearnMoveStruct->scrollArrowTaskId1 == 0xFF)
{
gTempScrollArrowTemplate = gUnknown_085CEBD0;
gTempScrollArrowTemplate.fullyDownThreshold = sLearnMoveStruct->numMenuChoices - sLearnMoveStruct->numToShowAtOnce;
sLearnMoveStruct->scrollArrowTaskId1 = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, &sLearnMoveStruct2.listOffset);
}
}
static void RemoveScrollArrows(void)
{
if (sLearnMoveStruct->scrollArrowTaskId2 != 0xFF)
{
RemoveScrollIndicatorArrowPair(sLearnMoveStruct->scrollArrowTaskId2);
sLearnMoveStruct->scrollArrowTaskId2 = 0xFF;
}
if (sLearnMoveStruct->scrollArrowTaskId1 != 0xFF)
{
RemoveScrollIndicatorArrowPair(sLearnMoveStruct->scrollArrowTaskId1);
sLearnMoveStruct->scrollArrowTaskId1 = 0xFF;
}
}
static void CreateMenuItemsList(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->numToShowAtOnce = sub_81D28C8(sLearnMoveStruct->menuItems, sLearnMoveStruct->numMenuChoices);
}
void ShowHideHearts(s32 item)
{
u16 numHearts;
u16 i;
if (!sLearnMoveStruct2.showContestInfo || item == LIST_B_PRESSED)
{
for (i = 0; i < 16; i++)
{
gSprites[sLearnMoveStruct->spriteIds[i]].invisible = TRUE;
}
}
else
{
numHearts = (u8)(gContestEffects[gContestMoves[item].effect].appeal / 10);
if (numHearts == 0xFF)
{
numHearts = 0;
}
for (i = 0; i < 8; i++)
{
if (i < numHearts)
{
StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 1);
}
else
{
StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i]], 0);
}
gSprites[sLearnMoveStruct->spriteIds[i]].invisible = FALSE;
}
numHearts = (u8)(gContestEffects[gContestMoves[item].effect].jam / 10);
if (numHearts == 0xFF)
{
numHearts = 0;
}
for (i = 0; i < 8; i++)
{
if (i < numHearts)
{
StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i + 8]], 3);
}
else
{
StartSpriteAnim(&gSprites[sLearnMoveStruct->spriteIds[i + 8]], 2);
}
gSprites[sLearnMoveStruct->spriteIds[i + 8]].invisible = FALSE;
}
}
}

View File

@ -341,7 +341,7 @@ s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenu
}
if (gMain.newKeys & B_BUTTON)
{
sMysteryGiftLinkMenu.currItemId = LIST_B_PRESSED;
sMysteryGiftLinkMenu.currItemId = LIST_CANCEL;
sMysteryGiftLinkMenu.state = 2;
}
if (sMysteryGiftLinkMenu.state == 2)
@ -416,7 +416,7 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
}
else if (gMain.newKeys & B_BUTTON)
{
return LIST_B_PRESSED;
return LIST_CANCEL;
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
{

2094
src/menu_specialized.c Normal file

File diff suppressed because it is too large Load Diff

976
src/move_relearner.c Normal file
View File

@ -0,0 +1,976 @@
#include "global.h"
#include "main.h"
#include "battle.h"
#include "bg.h"
#include "contest_effect.h"
#include "data2.h"
#include "event_data.h"
#include "field_screen_effect.h"
#include "gpu_regs.h"
#include "move_relearner.h"
#include "list_menu.h"
#include "alloc.h"
#include "menu.h"
#include "menu_helpers.h"
#include "menu_specialized.h"
#include "overworld.h"
#include "palette.h"
#include "pokemon_summary_screen.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"
/*
* Move relearner state machine
* ------------------------
*
* Entry point: TeachMoveRelearnerMove
*
* TeachMoveRelearnerMove
* Task_WaitForFadeOut
* CB2_InitLearnMove
* - Creates moveDisplayArrowTask to listen to right/left buttons.
* - Creates moveListScrollArrowTask to listen to up/down buttons.
* - Whenever the selected move changes (and once on init), the MoveRelearnerCursorCallback
* is called (see sMoveRelearnerMovesListTemplate). That callback will reload the contest
* display and battle display windows for the new move. Both are always loaded in
* memory, but only the currently active one is copied to VRAM. The exception to this
* is the appeal and jam hearts, which are sprites. MoveRelearnerShowHideHearts is called
* while reloading the contest display to control them.
* DoMoveRelearnerMain: MENU_STATE_FADE_TO_BLACK
* DoMoveRelearnerMain: MENU_STATE_WAIT_FOR_FADE
* - Go to MENU_STATE_IDLE_BATTLE_MODE
*
* DoMoveRelearnerMain: MENU_STATE_SETUP_BATTLE_MODE
* DoMoveRelearnerMain: MENU_STATE_IDLE_BATTLE_MODE
* - If the player selected a move (pressed A), go to MENU_STATE_PRINT_TEACH_MOVE_PROMPT.
* - If the player cancelled (pressed B), go to MENU_STATE_PRINT_GIVE_UP_PROMPT.
* - If the player pressed left or right, swap the move display window to contest mode,
* and go to MENU_STATE_SETUP_CONTEST_MODE.
*
* DoMoveRelearnerMain: MENU_STATE_SETUP_CONTEST_MODE
* DoMoveRelearnerMain: MENU_STATE_IDLE_CONTEST_MODE
* - If the player selected a move, go to MENU_STATE_PRINT_TEACH_MOVE_PROMPT.
* - If the player cancelled, go to MENU_STATE_PRINT_GIVE_UP_PROMPT
* - If the player pressed left or right, swap the move display window to battle mode,
* and go to MENU_STATE_SETUP_BATTLE_MODE.
*
* DoMoveRelearnerMain: MENU_STATE_PRINT_TEACH_MOVE_PROMPT
* DoMoveRelearnerMain: MENU_STATE_TEACH_MOVE_CONFIRM
* - Wait for the player to confirm.
* - If cancelled, go to either MENU_STATE_SETUP_BATTLE_MODE or MENU_STATE_SETUP_CONTEST_MODE.
* - If confirmed and the pokemon had an empty move slot, set VAR_0x8004 to TRUE and go to
* MENU_STATE_PRINT_TEXT_THEN_FANFARE.
* - If confirmed and the pokemon doesn't have an empty move slot, go to
* MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT.
*
* DoMoveRelearnerMain: MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT
* DoMoveRelearnerMain: MENU_STATE_WAIT_FOR_TRYING_TO_LEARN
* DoMoveRelearnerMain: MENU_STATE_CONFIRM_DELETE_OLD_MOVE
* - If the player confirms, go to MENU_STATE_PRINT_WHICH_MOVE_PROMPT.
* - If the player cancels, go to MENU_STATE_PRINT_STOP_TEACHING
*
* DoMoveRelearnerMain: MENU_STATE_PRINT_STOP_TEACHING
* DoMoveRelearnerMain: MENU_STATE_WAIT_FOR_STOP_TEACHING
* DoMoveRelearnerMain: MENU_STATE_CONFIRM_STOP_TEACHING
* - If the player confirms, go to MENU_STATE_CHOOSE_SETUP_STATE.
* - If the player cancels, go back to MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT.
*
* DoMoveRelearnerMain: MENU_STATE_PRINT_WHICH_MOVE_PROMPT
* DoMoveRelearnerMain: MENU_STATE_SHOW_MOVE_SUMMARY_SCREEN
* - Go to ShowSelectMovePokemonSummaryScreen. When done, control returns to
* CB2_InitLearnMoveReturnFromSelectMove.
*
* DoMoveRelearnerMain: MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE
* DoMoveRelearnerMain: MENU_STATE_PRINT_TEXT_THEN_FANFARE
* DoMoveRelearnerMain: MENU_STATE_WAIT_FOR_FANFARE
* DoMoveRelearnerMain: MENU_STATE_WAIT_FOR_A_BUTTON
* DoMoveRelearnerMain: MENU_STATE_FADE_AND_RETURN
* DoMoveRelearnerMain: MENU_STATE_RETURN_TO_FIELD
* - Clean up and go to CB2_ReturnToField.
*
* DoMoveRelearnerMain: MENU_STATE_PRINT_GIVE_UP_PROMPT
* DoMoveRelearnerMain: MENU_STATE_GIVE_UP_CONFIRM
* - If the player confirms, go to MENU_STATE_FADE_AND_RETURN, and set VAR_0x8004 to FALSE.
* - If the player cancels, go to either MENU_STATE_SETUP_BATTLE_MODE or
* MENU_STATE_SETUP_CONTEST_MODE.
*
* CB2_InitLearnMoveReturnFromSelectMove:
* - Do most of the same stuff as CB2_InitLearnMove.
* DoMoveRelearnerMain: MENU_STATE_FADE_FROM_SUMMARY_SCREEN
* DoMoveRelearnerMain: MENU_STATE_TRY_OVERWRITE_MOVE
* - If any of the pokemon's existing moves were chosen, overwrite the move and
* go to MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE and set VAR_0x8004 to TRUE.
* - If the chosen move is the one the player selected before the summary screen,
* go to MENU_STATE_PRINT_STOP_TEACHING.
*
*/
#define MENU_STATE_FADE_TO_BLACK 0
#define MENU_STATE_WAIT_FOR_FADE 1
#define MENU_STATE_UNREACHABLE 2
#define MENU_STATE_SETUP_BATTLE_MODE 3
#define MENU_STATE_IDLE_BATTLE_MODE 4
#define MENU_STATE_SETUP_CONTEST_MODE 5
#define MENU_STATE_IDLE_CONTEST_MODE 6
// State 7 is skipped.
#define MENU_STATE_PRINT_TEACH_MOVE_PROMPT 8
#define MENU_STATE_TEACH_MOVE_CONFIRM 9
// States 10 and 11 are skipped.
#define MENU_STATE_PRINT_GIVE_UP_PROMPT 12
#define MENU_STATE_GIVE_UP_CONFIRM 13
#define MENU_STATE_FADE_AND_RETURN 14
#define MENU_STATE_RETURN_TO_FIELD 15
#define MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT 16
#define MENU_STATE_WAIT_FOR_TRYING_TO_LEARN 17
#define MENU_STATE_CONFIRM_DELETE_OLD_MOVE 18
#define MENU_STATE_PRINT_WHICH_MOVE_PROMPT 19
#define MENU_STATE_SHOW_MOVE_SUMMARY_SCREEN 20
// States 21, 22, and 23 are skipped.
#define MENU_STATE_PRINT_STOP_TEACHING 24
#define MENU_STATE_WAIT_FOR_STOP_TEACHING 25
#define MENU_STATE_CONFIRM_STOP_TEACHING 26
#define MENU_STATE_CHOOSE_SETUP_STATE 27
#define MENU_STATE_FADE_FROM_SUMMARY_SCREEN 28
#define MENU_STATE_TRY_OVERWRITE_MOVE 29
#define MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE 30
#define MENU_STATE_PRINT_TEXT_THEN_FANFARE 31
#define MENU_STATE_WAIT_FOR_FANFARE 32
#define MENU_STATE_WAIT_FOR_A_BUTTON 33
// The different versions of hearts are selected using animation
// commands.
#define APPEAL_HEART_EMPTY 0
#define APPEAL_HEART_FULL 1
#define JAM_HEART_EMPTY 2
#define JAM_HEART_FULL 3
static EWRAM_DATA struct
{
u8 state;
u8 heartSpriteIds[16]; /*0x001*/
u16 movesToLearn[4]; /*0x012*/
u8 filler1A[0x44 - 0x1A]; /*0x01A*/
u8 partyMon; /*0x044*/
u8 moveSlot; /*0x045*/
struct ListMenuItem menuItems[20]; /*0x048*/
u8 fillerE8[0x110 - 0xE8]; /*0x0E8*/
u8 numMenuChoices; /*0x110*/
u8 numToShowAtOnce; /*0x111*/
u8 moveListMenuTask; /*0x112*/
u8 moveListScrollArrowTask; /*0x113*/
u8 moveDisplayArrowTask; /*0x114*/
u16 scrollOffset; /*0x116*/
} *sMoveRelearnerStruct = {0};
static EWRAM_DATA struct {
u16 listOffset;
u16 listRow;
bool8 showContestInfo;
} sMoveRelearnerMenuSate = {0};
static const u16 sMoveRelearnerPaletteData[] = INCBIN_U16("graphics/interface/ui_learn_move.gbapal");
// The arrow sprites in this spritesheet aren't used. The scroll-arrow system provides its own
// arrow sprites.
static const u8 sMoveRelearnerSpriteSheetData[] = INCBIN_U8("graphics/interface/ui_learn_move.4bpp");
static const struct OamData sHeartSpriteOamData =
{
.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,
};
static const struct OamData sUnusedOam1 =
{
.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,
};
static const struct OamData sUnusedOam2 =
{
.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,
};
static const struct SpriteSheet sMoveRelearnerSpriteSheet =
{
.data = sMoveRelearnerSpriteSheetData,
.size = 0x180,
.tag = 5525
};
static const struct SpritePalette sMoveRelearnerPalette =
{
.data = sMoveRelearnerPaletteData,
.tag = 5526
};
static const struct ScrollArrowsTemplate sDisplayModeArrowsTemplate =
{
.firstArrowType = SCROLL_ARROW_LEFT,
.firstX = 27,
.firstY = 16,
.secondArrowType = SCROLL_ARROW_RIGHT,
.secondX = 117,
.secondY = 16,
.fullyUpThreshold = -1,
.fullyDownThreshold = -1,
.tileTag = 5325,
.palTag = 5325,
.palNum = 0,
};
static const struct ScrollArrowsTemplate sMoveListScrollArrowsTemplate =
{
.firstArrowType = SCROLL_ARROW_UP,
.firstX = 192,
.firstY = 8,
.secondArrowType = SCROLL_ARROW_DOWN,
.secondX = 192,
.secondY = 104,
.fullyUpThreshold = 0,
.fullyDownThreshold = 0,
.tileTag = 5425,
.palTag = 5425,
.palNum = 0,
};
static const union AnimCmd sHeartSprite_AppealEmptyFrame[] =
{
ANIMCMD_FRAME(8, 5, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd sHeartSprite_AppealFullFrame[] =
{
ANIMCMD_FRAME(9, 5, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd sHeartSprite_JamEmptyFrame[] =
{
ANIMCMD_FRAME(10, 5, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd sHeartSprite_JamFullFrame[] =
{
ANIMCMD_FRAME(11, 5, FALSE, FALSE),
ANIMCMD_END
};
static const union AnimCmd *const sHeartSpriteAnimationCommands[] =
{
[APPEAL_HEART_EMPTY] = sHeartSprite_AppealEmptyFrame,
[APPEAL_HEART_FULL] = sHeartSprite_AppealFullFrame,
[JAM_HEART_EMPTY] = sHeartSprite_JamEmptyFrame,
[JAM_HEART_FULL] = sHeartSprite_JamFullFrame,
};
static const struct SpriteTemplate sConstestMoveHeartSprite =
{
.tileTag = 5525,
.paletteTag = 5526,
.oam = &sHeartSpriteOamData,
.anims = sHeartSpriteAnimationCommands,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
static const struct BgTemplate sMoveRelearnerMenuBackgroundTemplates[] =
{
{
.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,
},
};
static void DoMoveRelearnerMain(void);
static void CreateLearnableMovesList(void);
static void CreateUISprites(void);
static void CB2_MoveRelearnerMain(void);
static void Task_WaitForFadeOut(u8 taskId);
static void CB2_InitLearnMove(void);
static void CB2_InitLearnMoveReturnFromSelectMove(void);
static void InitMoveRelearnerBackgroundLayers(void);
static void AddScrollArrows(void);
static void HandleInput(u8);
static void ShowTeachMoveText(u8);
static s32 GetCurrentSelectedMove(void);
static void FreeMoveRelearnerResources(void);
static void RemoveScrollArrows(void);
static void HideHeartSpritesAndShowTeachMoveText(bool8);
static void VBlankCB_MoveRelearner(void)
{
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
// Script arguments: The pokemon to teach is in VAR_0x8004
void TeachMoveRelearnerMove(void)
{
ScriptContext2_Enable();
CreateTask(Task_WaitForFadeOut, 10);
// Fade to black
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
}
static void Task_WaitForFadeOut(u8 taskId)
{
if (!gPaletteFade.active)
{
SetMainCallback2(CB2_InitLearnMove);
gFieldCallback = FieldCallback_ReturnToEventScript2;
DestroyTask(taskId);
}
}
static void CB2_InitLearnMove(void)
{
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
clear_scheduled_bg_copies_to_vram();
sMoveRelearnerStruct = AllocZeroed(sizeof(*sMoveRelearnerStruct));
sMoveRelearnerStruct->partyMon = gSpecialVar_0x8004;
SetVBlankCallback(VBlankCB_MoveRelearner);
InitMoveRelearnerBackgroundLayers();
InitMoveRelearnerWindows(FALSE);
sMoveRelearnerMenuSate.listOffset = 0;
sMoveRelearnerMenuSate.listRow = 0;
sMoveRelearnerMenuSate.showContestInfo = FALSE;
CreateLearnableMovesList();
LoadSpriteSheet(&sMoveRelearnerSpriteSheet);
LoadSpritePalette(&sMoveRelearnerPalette);
CreateUISprites();
sMoveRelearnerStruct->moveListMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sMoveRelearnerMenuSate.listOffset, sMoveRelearnerMenuSate.listRow);
FillPalette(RGB_BLACK, 0, 2);
SetMainCallback2(CB2_MoveRelearnerMain);
}
static void CB2_InitLearnMoveReturnFromSelectMove(void)
{
ResetSpriteData();
FreeAllSpritePalettes();
ResetTasks();
clear_scheduled_bg_copies_to_vram();
sMoveRelearnerStruct = AllocZeroed(sizeof(*sMoveRelearnerStruct));
sMoveRelearnerStruct->state = MENU_STATE_FADE_FROM_SUMMARY_SCREEN;
sMoveRelearnerStruct->partyMon = gSpecialVar_0x8004;
sMoveRelearnerStruct->moveSlot = gSpecialVar_0x8005;
SetVBlankCallback(VBlankCB_MoveRelearner);
InitMoveRelearnerBackgroundLayers();
InitMoveRelearnerWindows(sMoveRelearnerMenuSate.showContestInfo);
CreateLearnableMovesList();
LoadSpriteSheet(&sMoveRelearnerSpriteSheet);
LoadSpritePalette(&sMoveRelearnerPalette);
CreateUISprites();
sMoveRelearnerStruct->moveListMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sMoveRelearnerMenuSate.listOffset, sMoveRelearnerMenuSate.listRow);
FillPalette(RGB_BLACK, 0, 2);
SetMainCallback2(CB2_MoveRelearnerMain);
}
static void InitMoveRelearnerBackgroundLayers(void)
{
ResetVramOamAndBgCntRegs();
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sMoveRelearnerMenuBackgroundTemplates, ARRAY_COUNT(sMoveRelearnerMenuBackgroundTemplates));
ResetAllBgsCoordinates();
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 |
DISPCNT_OBJ_1D_MAP |
DISPCNT_OBJ_ON);
ShowBg(0);
ShowBg(1);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
}
static void CB2_MoveRelearnerMain(void)
{
DoMoveRelearnerMain();
RunTasks();
AnimateSprites();
BuildOamBuffer();
do_scheduled_bg_tilemap_copies_to_vram();
UpdatePaletteFade();
}
static void FormatAndPrintText(const u8 *src)
{
StringExpandPlaceholders(gStringVar4, src);
MoveRelearnerPrintText(gStringVar4);
}
// See the state machine doc at the top of the file.
static void DoMoveRelearnerMain(void)
{
switch (sMoveRelearnerStruct->state)
{
case MENU_STATE_FADE_TO_BLACK:
sMoveRelearnerStruct->state++;
HideHeartSpritesAndShowTeachMoveText(FALSE);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
break;
case MENU_STATE_WAIT_FOR_FADE:
if (!gPaletteFade.active)
{
sMoveRelearnerStruct->state = MENU_STATE_IDLE_BATTLE_MODE;
}
break;
case MENU_STATE_UNREACHABLE:
sMoveRelearnerStruct->state++;
break;
case MENU_STATE_SETUP_BATTLE_MODE:
HideHeartSpritesAndShowTeachMoveText(FALSE);
sMoveRelearnerStruct->state++;
AddScrollArrows();
break;
case MENU_STATE_IDLE_BATTLE_MODE:
HandleInput(FALSE);
break;
case MENU_STATE_SETUP_CONTEST_MODE:
ShowTeachMoveText(FALSE);
sMoveRelearnerStruct->state++;
AddScrollArrows();
break;
case MENU_STATE_IDLE_CONTEST_MODE:
HandleInput(TRUE);
break;
case MENU_STATE_PRINT_TEACH_MOVE_PROMPT:
if (!MoveRelearnerRunTextPrinters())
{
MoveRelearnerCreateYesNoMenu();
sMoveRelearnerStruct->state++;
}
break;
case MENU_STATE_TEACH_MOVE_CONFIRM:
{
s8 selection = Menu_ProcessInputNoWrapClearOnChoose();
if (selection == 0)
{
if (GiveMoveToMon(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove()) != 0xFFFF)
{
FormatAndPrintText(gText_MoveRelearnerPkmnLearnedMove);
gSpecialVar_0x8004 = TRUE;
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
}
else
{
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT;
}
}
else if (selection == MENU_B_PRESSED || selection == 1)
{
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
}
else if (sMoveRelearnerMenuSate.showContestInfo == TRUE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
}
}
}
break;
case MENU_STATE_PRINT_GIVE_UP_PROMPT:
if (!MoveRelearnerRunTextPrinters())
{
MoveRelearnerCreateYesNoMenu();
sMoveRelearnerStruct->state++;
}
break;
case MENU_STATE_GIVE_UP_CONFIRM:
{
s8 selection = Menu_ProcessInputNoWrapClearOnChoose();
if (selection == 0)
{
gSpecialVar_0x8004 = FALSE;
sMoveRelearnerStruct->state = MENU_STATE_FADE_AND_RETURN;
}
else if (selection == -1 || selection == 1)
{
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
}
else if (sMoveRelearnerMenuSate.showContestInfo == TRUE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
}
}
}
break;
case MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT:
FormatAndPrintText(gText_MoveRelearnerPkmnTryingToLearnMove);
sMoveRelearnerStruct->state++;
break;
case MENU_STATE_WAIT_FOR_TRYING_TO_LEARN:
if (!MoveRelearnerRunTextPrinters())
{
MoveRelearnerCreateYesNoMenu();
sMoveRelearnerStruct->state = MENU_STATE_CONFIRM_DELETE_OLD_MOVE;
}
break;
case MENU_STATE_CONFIRM_DELETE_OLD_MOVE:
{
s8 var = Menu_ProcessInputNoWrapClearOnChoose();
if (var == 0)
{
FormatAndPrintText(gText_MoveRelearnerWhichMoveToForget);
sMoveRelearnerStruct->state = MENU_STATE_PRINT_WHICH_MOVE_PROMPT;
}
else if (var == -1 || var == 1)
{
sMoveRelearnerStruct->state = MENU_STATE_PRINT_STOP_TEACHING;
}
}
break;
case MENU_STATE_PRINT_STOP_TEACHING:
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
FormatAndPrintText(gText_MoveRelearnerStopTryingToTeachMove);
sMoveRelearnerStruct->state++;
break;
case MENU_STATE_WAIT_FOR_STOP_TEACHING:
if (!MoveRelearnerRunTextPrinters())
{
MoveRelearnerCreateYesNoMenu();
sMoveRelearnerStruct->state++;
}
break;
case MENU_STATE_CONFIRM_STOP_TEACHING:
{
s8 var = Menu_ProcessInputNoWrapClearOnChoose();
if (var == 0)
{
sMoveRelearnerStruct->state = MENU_STATE_CHOOSE_SETUP_STATE;
}
else if (var == MENU_B_PRESSED || var == 1)
{
// What's the point? It gets set to MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT, anyway.
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
}
else if (sMoveRelearnerMenuSate.showContestInfo == TRUE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
}
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT;
}
}
break;
case MENU_STATE_CHOOSE_SETUP_STATE:
if (!MoveRelearnerRunTextPrinters())
{
FillWindowPixelBuffer(3, 0x11);
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
}
else if (sMoveRelearnerMenuSate.showContestInfo == TRUE)
{
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
}
}
break;
case MENU_STATE_PRINT_WHICH_MOVE_PROMPT:
if (!MoveRelearnerRunTextPrinters())
{
sMoveRelearnerStruct->state = MENU_STATE_SHOW_MOVE_SUMMARY_SCREEN;
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
}
break;
case MENU_STATE_SHOW_MOVE_SUMMARY_SCREEN:
if (!gPaletteFade.active)
{
ShowSelectMovePokemonSummaryScreen(gPlayerParty, sMoveRelearnerStruct->partyMon, gPlayerPartyCount - 1, CB2_InitLearnMoveReturnFromSelectMove, GetCurrentSelectedMove());
FreeMoveRelearnerResources();
}
break;
case 21:
if (!MoveRelearnerRunTextPrinters())
{
sMoveRelearnerStruct->state = MENU_STATE_FADE_AND_RETURN;
}
break;
case 22:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
break;
case MENU_STATE_FADE_AND_RETURN:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
sMoveRelearnerStruct->state++;
break;
case MENU_STATE_RETURN_TO_FIELD:
if (!gPaletteFade.active)
{
FreeMoveRelearnerResources();
SetMainCallback2(CB2_ReturnToField);
}
break;
case MENU_STATE_FADE_FROM_SUMMARY_SCREEN:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB_BLACK);
sMoveRelearnerStruct->state++;
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
HideHeartSpritesAndShowTeachMoveText(TRUE);
}
else if (sMoveRelearnerMenuSate.showContestInfo == TRUE)
{
ShowTeachMoveText(TRUE);
}
RemoveScrollArrows();
CopyWindowToVram(3, 2);
break;
case MENU_STATE_TRY_OVERWRITE_MOVE:
if (!gPaletteFade.active)
{
if (sMoveRelearnerStruct->moveSlot == MAX_MON_MOVES)
{
sMoveRelearnerStruct->state = MENU_STATE_PRINT_STOP_TEACHING;
}
else
{
u16 moveId = GetMonData(&gPlayerParty[sMoveRelearnerStruct->partyMon], MON_DATA_MOVE1 + sMoveRelearnerStruct->moveSlot);
StringCopy(gStringVar3, gMoveNames[moveId]);
RemoveMonPPBonus(&gPlayerParty[sMoveRelearnerStruct->partyMon], sMoveRelearnerStruct->moveSlot);
SetMonMoveSlot(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove(), sMoveRelearnerStruct->moveSlot);
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
FormatAndPrintText(gText_MoveRelearnerAndPoof);
sMoveRelearnerStruct->state = MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE;
gSpecialVar_0x8004 = TRUE;
}
}
break;
case MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE:
if (!MoveRelearnerRunTextPrinters())
{
FormatAndPrintText(gText_MoveRelearnerPkmnForgotMoveAndLearnedNew);
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
PlayFanfare(MUS_FANFA1);
}
break;
case MENU_STATE_PRINT_TEXT_THEN_FANFARE:
if (!MoveRelearnerRunTextPrinters())
{
PlayFanfare(MUS_FANFA1);
sMoveRelearnerStruct->state = MENU_STATE_WAIT_FOR_FANFARE;
}
break;
case MENU_STATE_WAIT_FOR_FANFARE:
if (IsFanfareTaskInactive())
{
sMoveRelearnerStruct->state = MENU_STATE_WAIT_FOR_A_BUTTON;
}
break;
case MENU_STATE_WAIT_FOR_A_BUTTON:
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
sMoveRelearnerStruct->state = MENU_STATE_FADE_AND_RETURN;
}
break;
}
}
static void FreeMoveRelearnerResources(void)
{
RemoveScrollArrows();
DestroyListMenuTask(sMoveRelearnerStruct->moveListMenuTask, &sMoveRelearnerMenuSate.listOffset, &sMoveRelearnerMenuSate.listRow);
FreeAllWindowBuffers();
FREE_AND_SET_NULL(sMoveRelearnerStruct);
ResetSpriteData();
FreeAllSpritePalettes();
}
// Note: The hearts are already made invisible by MoveRelearnerShowHideHearts,
// which is called whenever the cursor in either list changes.
static void HideHeartSpritesAndShowTeachMoveText(bool8 onlyHideSprites)
{
s32 i;
for (i = 0; i < 16; i++)
{
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
}
if (!onlyHideSprites)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
FillWindowPixelBuffer(3, 0x11);
AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL);
}
}
static void HandleInput(bool8 showContest)
{
s32 itemId = ListMenu_ProcessInput(sMoveRelearnerStruct->moveListMenuTask);
ListMenuGetScrollAndRow(sMoveRelearnerStruct->moveListMenuTask, &sMoveRelearnerMenuSate.listOffset, &sMoveRelearnerMenuSate.listRow);
switch (itemId)
{
case LIST_NOTHING_CHOSEN:
if (!(gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysState())
{
break;
}
PlaySE(SE_SELECT);
if (showContest == FALSE)
{
PutWindowTilemap(1);
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
sMoveRelearnerMenuSate.showContestInfo = TRUE;
}
else
{
PutWindowTilemap(0);
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
sMoveRelearnerMenuSate.showContestInfo = FALSE;
}
schedule_bg_copy_tilemap_to_vram(1);
MoveRelearnerShowHideHearts(GetCurrentSelectedMove());
break;
case LIST_CANCEL:
PlaySE(SE_SELECT);
RemoveScrollArrows();
sMoveRelearnerStruct->state = MENU_STATE_PRINT_GIVE_UP_PROMPT;
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerGiveUp);
MoveRelearnerPrintText(gStringVar4);
break;
default:
PlaySE(SE_SELECT);
RemoveScrollArrows();
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEACH_MOVE_PROMPT;
StringCopy(gStringVar2, gMoveNames[itemId]);
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerTeachMoveConfirm);
MoveRelearnerPrintText(gStringVar4);
break;
}
}
static s32 GetCurrentSelectedMove(void)
{
return sMoveRelearnerStruct->menuItems[sMoveRelearnerMenuSate.listRow + sMoveRelearnerMenuSate.listOffset].id;
}
// Theory: This used to make the heart sprites visible again (i.e.
// this was the inverse of HideHeartsAndShowTeachMoveText), but the
// code was commented out. The bool argument would have been named
// "justShowHearts." The code for showing/hiding the heards was moved
// to MoveRelearnerShowHideHearts, which is called whenever a new move is
// selected and whenever the display mode changes.
static void ShowTeachMoveText(bool8 shouldDoNothingInstead)
{
if (shouldDoNothingInstead == FALSE)
{
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
FillWindowPixelBuffer(3, 0x11);
AddTextPrinterParameterized(3, 1, gStringVar4, 0, 1, 0, NULL);
}
}
static void CreateUISprites(void)
{
int i;
sMoveRelearnerStruct->moveDisplayArrowTask = 0xFF;
sMoveRelearnerStruct->moveListScrollArrowTask = 0xFF;
AddScrollArrows();
// These are the appeal hearts.
for (i = 0; i < 8; i++)
{
sMoveRelearnerStruct->heartSpriteIds[i] = CreateSprite(&sConstestMoveHeartSprite, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 36, 0);
}
// These are the jam harts.
// The animation is used to toggle between full/empty heart sprites.
for (i = 0; i < 8; i++)
{
sMoveRelearnerStruct->heartSpriteIds[i + 8] = CreateSprite(&sConstestMoveHeartSprite, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 52, 0);
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 2);
}
for (i = 0; i < 16; i++)
{
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
}
}
static void AddScrollArrows(void)
{
if (sMoveRelearnerStruct->moveDisplayArrowTask == 0xFF)
{
sMoveRelearnerStruct->moveDisplayArrowTask = AddScrollIndicatorArrowPair(&sDisplayModeArrowsTemplate, &sMoveRelearnerStruct->scrollOffset);
}
if (sMoveRelearnerStruct->moveListScrollArrowTask == 0xFF)
{
gTempScrollArrowTemplate = sMoveListScrollArrowsTemplate;
gTempScrollArrowTemplate.fullyDownThreshold = sMoveRelearnerStruct->numMenuChoices - sMoveRelearnerStruct->numToShowAtOnce;
sMoveRelearnerStruct->moveListScrollArrowTask = AddScrollIndicatorArrowPair(&gTempScrollArrowTemplate, &sMoveRelearnerMenuSate.listOffset);
}
}
static void RemoveScrollArrows(void)
{
if (sMoveRelearnerStruct->moveDisplayArrowTask != 0xFF)
{
RemoveScrollIndicatorArrowPair(sMoveRelearnerStruct->moveDisplayArrowTask);
sMoveRelearnerStruct->moveDisplayArrowTask = 0xFF;
}
if (sMoveRelearnerStruct->moveListScrollArrowTask != 0xFF)
{
RemoveScrollIndicatorArrowPair(sMoveRelearnerStruct->moveListScrollArrowTask);
sMoveRelearnerStruct->moveListScrollArrowTask = 0xFF;
}
}
static void CreateLearnableMovesList(void)
{
s32 i;
u8 nickname[POKEMON_NAME_LENGTH + 1];
sMoveRelearnerStruct->numMenuChoices = GetMoveRelearnerMoves(&gPlayerParty[sMoveRelearnerStruct->partyMon], sMoveRelearnerStruct->movesToLearn);
for (i = 0; i < sMoveRelearnerStruct->numMenuChoices; i++)
{
sMoveRelearnerStruct->menuItems[i].name = gMoveNames[sMoveRelearnerStruct->movesToLearn[i]];
sMoveRelearnerStruct->menuItems[i].id = sMoveRelearnerStruct->movesToLearn[i];
}
GetMonData(&gPlayerParty[sMoveRelearnerStruct->partyMon], MON_DATA_NICKNAME, nickname);
StringCopy10(gStringVar1, nickname);
sMoveRelearnerStruct->menuItems[sMoveRelearnerStruct->numMenuChoices].name = gText_Cancel;
sMoveRelearnerStruct->menuItems[sMoveRelearnerStruct->numMenuChoices].id = LIST_CANCEL;
sMoveRelearnerStruct->numMenuChoices++;
sMoveRelearnerStruct->numToShowAtOnce = LoadMoveRelearnerMovesList(sMoveRelearnerStruct->menuItems, sMoveRelearnerStruct->numMenuChoices);
}
void MoveRelearnerShowHideHearts(s32 moveId)
{
u16 numHearts;
u16 i;
if (!sMoveRelearnerMenuSate.showContestInfo || moveId == LIST_CANCEL)
{
for (i = 0; i < 16; i++)
{
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
}
}
else
{
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].appeal / 10);
if (numHearts == 0xFF)
{
numHearts = 0;
}
for (i = 0; i < 8; i++)
{
if (i < numHearts)
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 1);
}
else
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 0);
}
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = FALSE;
}
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].jam / 10);
if (numHearts == 0xFF)
{
numHearts = 0;
}
for (i = 0; i < 8; i++)
{
if (i < numHearts)
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 3);
}
else
{
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 2);
}
gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]].invisible = FALSE;
}
}
}

View File

@ -1688,7 +1688,7 @@ void CB2_ReturnToFieldContinueScript(void)
void CB2_ReturnToFieldContinueScriptPlayMapMusic(void)
{
FieldClearVBlankHBlankCallbacks();
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
CB2_ReturnToField();
}

View File

@ -37,15 +37,16 @@
#include "main.h"
#include "menu.h"
#include "menu_helpers.h"
#include "menu_specialized.h"
#include "metatile_behavior.h"
#include "overworld.h"
#include "palette.h"
#include "party_menu.h"
#include "player_pc.h"
#include "pokemon.h"
#include "pokemon_icon.h"
#include "pokemon_storage_system.h"
#include "pokemon_summary_screen.h"
#include "pokenav.h"
#include "region_map.h"
#include "reshow_battle_screen.h"
#include "rom_8011DC0.h"
@ -6006,7 +6007,7 @@ static void sub_81B767C(u8 taskId)
s16 *arrayPtr = gUnknown_0203CEC4->data;
arrayPtr[12] = sub_81B3364();
sub_81D3640(arrayPtr[12], arrayPtr, &arrayPtr[6], 1, 2, 3);
DrawLevelUpWindowPg1(arrayPtr[12], arrayPtr, &arrayPtr[6], 1, 2, 3);
CopyWindowToVram(arrayPtr[12], 2);
schedule_bg_copy_tilemap_to_vram(2);
}
@ -6015,7 +6016,7 @@ static void sub_81B76C8(u8 taskId)
{
s16 *arrayPtr = gUnknown_0203CEC4->data;
sub_81D3784(arrayPtr[12], &arrayPtr[6], 1, 2, 3);
DrawLevelUpWindowPg2(arrayPtr[12], &arrayPtr[6], 1, 2, 3);
CopyWindowToVram(arrayPtr[12], 2);
schedule_bg_copy_tilemap_to_vram(2);
}
@ -7288,7 +7289,7 @@ static void sub_81B9640(u8 taskId)
void sub_81B968C(void)
{
ShowPokemonSummaryScreen(PSS_MODE_SELECT_MOVE, gPlayerParty, gSpecialVar_0x8004, gPlayerPartyCount - 1, CB2_ReturnToField);
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
}
void sub_81B96D0(void)

View File

@ -20,7 +20,6 @@
#include "overworld.h"
#include "palette.h"
#include "party_menu.h"
#include "pokenav.h"
#include "player_pc.h"
#include "script.h"
#include "sound.h"
@ -29,6 +28,7 @@
#include "strings.h"
#include "task.h"
#include "window.h"
#include "menu_specialized.h"
// structures
struct Struct203BCC4
@ -645,7 +645,7 @@ static void Mailbox_ProcessInput(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
RemoveScrollIndicatorArrowPair(playerPCItemPageInfo.scrollIndicatorId);
Mailbox_ReturnToPlayerPC(taskId);
@ -1151,7 +1151,7 @@ static void ItemStorage_ProcessInput(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
ItemStorage_GoBackToPlayerPCMenu(taskId);
break;
@ -1226,7 +1226,7 @@ static void sub_816C4FC(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
if (gMain.newKeys & A_BUTTON)
{
ItemStorage_DoItemSwap(taskId, FALSE);

View File

@ -709,7 +709,7 @@ static void HandlePokeblockListMenuItems(void)
StringCopy(sPokeblockMenu->menuItemsStrings[i], gText_StowCase);
sPokeblockMenu->items[i].name = sPokeblockMenu->menuItemsStrings[i];
sPokeblockMenu->items[i].id = LIST_B_PRESSED;
sPokeblockMenu->items[i].id = LIST_CANCEL;
gMultiuseListMenuTemplate = sPokeblockListMenuTemplate;
gMultiuseListMenuTemplate.fontId = 7;
@ -751,7 +751,7 @@ static void sub_8135FCC(s32 pkblId)
FillWindowPixelBuffer(7, PIXEL_FILL(0));
if (pkblId != LIST_B_PRESSED)
if (pkblId != LIST_CANCEL)
{
pokeblock = &gSaveBlock1Ptr->pokeblocks[pkblId];
rectTilemapSrc[0] = 0x17;
@ -959,7 +959,7 @@ static void Task_FreeDataAndExitPokeblockCase(u8 taskId)
if (!gPaletteFade.active)
{
if (sPokeblockMenu->caseId == PBLOCK_CASE_FEEDER || sPokeblockMenu->caseId == PBLOCK_CASE_GIVE)
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
DestroyListMenuTask(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
sub_8136418();
@ -1011,7 +1011,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
gSpecialVar_Result = 0xFFFF;
gSpecialVar_ItemId = 0;
@ -1066,7 +1066,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED: // same id as STOW CASE field
case LIST_CANCEL: // same id as STOW CASE field
PlaySE(SE_SELECT);
if (gMain.newKeys & A_BUTTON)
HandlePokeblocksSwap(taskId, FALSE);

View File

@ -1984,7 +1984,7 @@ static void sub_8141E7C(u8 taskId) // end roulette ?
ResetPaletteFade();
ResetSpriteData();
sub_8140418();
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
SetMainCallback2(CB2_ReturnToField);
DestroyTask(taskId);
}

View File

@ -389,7 +389,7 @@ void sub_80E8FD0(u8 taskId)
}
sub_80E8F9C();
WarpIntoMap();
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
SetMainCallback2(CB2_LoadMap);
DestroyTask(taskId);
break;
@ -957,7 +957,7 @@ void sub_80E9E90(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
DestroyListMenuTask(data[5], NULL, NULL);
RemoveScrollIndicatorArrowPair(data[8]);

View File

@ -918,7 +918,7 @@ static void Task_BuyMenu(u8 taskId)
{
case LIST_NOTHING_CHOSEN:
break;
case LIST_B_PRESSED:
case LIST_CANCEL:
PlaySE(SE_SELECT);
ExitBuyMenu(taskId);
break;

View File

@ -1742,23 +1742,23 @@ const u8 gText_TrainerHill2F[] = _("2F");
const u8 gText_TrainerHill3F[] = _("3F");
const u8 gText_TrainerHill4F[] = _("4F");
const u8 gText_TeachWhichMoveToPkmn[] = _("Teach which move to {STR_VAR_1}?");
const u8 gText_TeachX[] = _("Teach {STR_VAR_2}?");
const u8 gText_PkmnLearnedMove4[] = _("{STR_VAR_1} learned\n{STR_VAR_2}!");
const u8 gText_PkmnTryingToLearnMove[] = _("{STR_VAR_1} is trying to learn\n{STR_VAR_2}.\pBut {STR_VAR_1} can't learn more\nthan four moves.\pDelete an older move to make\nroom for {STR_VAR_2}?");
const u8 gText_StopTryingToTeachMove[] = _("Stop trying to teach\n{STR_VAR_2}?");
const u8 gText_12AndPoof[] = _("{PAUSE 32}1, {PAUSE 15}2, and {PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE 0x0038}Poof!\p");
const u8 gText_PkmnForgotMoveAndLearnedNew[] = _("{STR_VAR_1} forgot {STR_VAR_3}.\pAnd…\p{STR_VAR_1} learned {STR_VAR_2}.");
const u8 gText_MoveRelearnerTeachMoveConfirm[] = _("Teach {STR_VAR_2}?");
const u8 gText_MoveRelearnerPkmnLearnedMove[] = _("{STR_VAR_1} learned\n{STR_VAR_2}!");
const u8 gText_MoveRelearnerPkmnTryingToLearnMove[] = _("{STR_VAR_1} is trying to learn\n{STR_VAR_2}.\pBut {STR_VAR_1} can't learn more\nthan four moves.\pDelete an older move to make\nroom for {STR_VAR_2}?");
const u8 gText_MoveRelearnerStopTryingToTeachMove[] = _("Stop trying to teach\n{STR_VAR_2}?");
const u8 gText_MoveRelearnerAndPoof[] = _("{PAUSE 32}1, {PAUSE 15}2, and {PAUSE 15}… {PAUSE 15}… {PAUSE 15}… {PAUSE 15}{PLAY_SE 0x0038}Poof!\p");
const u8 gText_MoveRelearnerPkmnForgotMoveAndLearnedNew[] = _("{STR_VAR_1} forgot {STR_VAR_3}.\pAnd…\p{STR_VAR_1} learned {STR_VAR_2}.");
const u8 gUnknown_085EF9C8[] = _("{STR_VAR_1} did not learn the\nmove {STR_VAR_2}.");
const u8 gText_GiveUpTeachingNewMove[] = _("Give up trying to teach a new\nmove to {STR_VAR_1}?");
const u8 gText_WhichMoveToForget2[] = _("Which move should be\nforgotten?\p");
const u8 gText_BattleMoves2[] = _("BATTLE MOVES");
const u8 gText_ContestMoves2[] = _("CONTEST MOVES");
const u8 gText_MoveRelearnerGiveUp[] = _("Give up trying to teach a new\nmove to {STR_VAR_1}?");
const u8 gText_MoveRelearnerWhichMoveToForget[] = _("Which move should be\nforgotten?\p");
const u8 gText_MoveRelearnerBattleMoves[] = _("BATTLE MOVES");
const u8 gText_MoveRelearnerContestMovesTitle[] = _("CONTEST MOVES");
const u8 gUnknown_085EFA4C[] = _("TYPE/");
const u8 gText_PPSlash[] = _("PP/");
const u8 gText_PowerSlash[] = _("POWER/");
const u8 gText_AccuracySlash[] = _("ACCURACY/");
const u8 gText_Appeal2[] = _("APPEAL");
const u8 gText_Jam2[] = _("JAM");
const u8 gText_MoveRelearnerPP[] = _("PP/");
const u8 gText_MoveRelearnerPower[] = _("POWER/");
const u8 gText_MoveRelearnerAccuracy[] = _("ACCURACY/");
const u8 gText_MoveRelearnerAppeal[] = _("APPEAL");
const u8 gText_MoveRelearnerJam[] = _("JAM");
const u8 gText_Kira[] = _("KIRA");
const u8 gText_Amy[] = _("AMY");
const u8 gText_John[] = _("JOHN");

View File

@ -6141,7 +6141,7 @@ static void sub_807F110(u8 taskId)
if (!gPaletteFade.active)
{
SetMainCallback2(sub_807B270);
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
DestroyTask(taskId);
}
}

View File

@ -4,6 +4,7 @@
#include "alloc.h"
#include "palette.h"
#include "pokenav.h"
#include "menu_specialized.h"
#include "scanline_effect.h"
#include "text.h"
#include "bg.h"
@ -33,7 +34,7 @@ struct UsePokeblockSubStruct
struct UsePokeblockStruct
{
u8 field_0[0x7C58];
u8 field_7C58[0x378];
struct UnknownStruct_81D1ED4 field_7C58;
struct UsePokeblockSubStruct info;
};
@ -130,7 +131,7 @@ void sub_8166340(void)
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
sub_81D2108(gUnknown_0203BCAC->field_7C58);
sub_81D2108(&gUnknown_0203BCAC->field_7C58);
ScanlineEffect_InitHBlankDmaTransfer();
}
@ -146,7 +147,7 @@ void sub_8166380(void)
{
case 0:
gUnknown_0203BCAC->field_0[0x7B10] = 0xFF;
sub_81D1ED4(gUnknown_0203BCAC->field_7C58);
sub_81D1ED4(&gUnknown_0203BCAC->field_7C58);
gUnknown_0203BC90->field_50++;
break;
case 1:
@ -202,19 +203,19 @@ void sub_8166380(void)
gUnknown_0203BC90->field_50++;
break;
case 11:
sub_81D2754(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_0[0x7C6C]);
sub_81D20AC(gUnknown_0203BCAC->field_7C58);
sub_81D2754(&gUnknown_0203BCAC->field_7C58, gUnknown_0203BCAC->field_7C58.unk14[0]);
sub_81D20AC(&gUnknown_0203BCAC->field_7C58);
gUnknown_0203BC90->field_50++;
break;
case 12:
if (!sub_81D20BC(gUnknown_0203BCAC->field_7C58))
if (!sub_81D20BC(&gUnknown_0203BCAC->field_7C58))
{
sub_81D1F84(gUnknown_0203BCAC->field_7C58, &gUnknown_0203BCAC->field_7C58[0x14], &gUnknown_0203BCAC->field_7C58[0x14]);
sub_81D1F84(&gUnknown_0203BCAC->field_7C58, gUnknown_0203BCAC->field_7C58.unk14, gUnknown_0203BCAC->field_7C58.unk14);
gUnknown_0203BC90->field_50++;
}
break;
case 13:
sub_81D2230(gUnknown_0203BCAC->field_7C58);
sub_81D2230(&gUnknown_0203BCAC->field_7C58);
gUnknown_0203BC90->field_50++;
break;
case 14:

View File

@ -70,7 +70,7 @@ static void CB2_HandleGivenWaldaPhrase(void)
}
StringCopy(gStringVar1, GetWaldaPhrasePtr());
gFieldCallback = sub_80AF168;
gFieldCallback = FieldCallback_ReturnToEventScript2;
SetMainCallback2(CB2_ReturnToField);
}

View File

@ -180,10 +180,10 @@ gPlayerFacingPosition: @ 203AB40
.include "src/pokeblock.o"
.include "src/field_specials.o"
.include "src/battle_records.o"
.include "src/pokedex_area_screen.o"
.include "src/evolution_scene.o"
.include "src/roulette.o"
.include "src/battle_records.o"
.include "src/pokedex_area_screen.o"
.include "src/evolution_scene.o"
.include "src/roulette.o"
.include "src/pokedex_cry_screen.o"
.include "src/coins.o"
.include "src/battle_transition.o"
@ -192,7 +192,7 @@ gPlayerFacingPosition: @ 203AB40
.include "src/rom_81520A8.o"
.include "src/save.o"
.include "src/mystery_event_script.o"
.include "src/learn_move.o"
.include "src/move_relearner.o"
.include "src/decoration_inventory.o"
.include "src/roamer.o"
.include "src/battle_tower.o"
@ -237,11 +237,7 @@ gUnknown_0203CF40: @ 203CF40
gUnknown_0203CF44: @ 203CF44
.space 0x4
gUnknown_0203CF48: @ 203CF48
.space 0x4
gUnknown_0203CF4C: @ 203CF4C
.space 0x4
.include "src/menu_specialized.o"
gUnknown_0203CF50: @ 203CF50
.space 0x4