mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
Use window constants for move relearner
This commit is contained in:
parent
f254df9a1a
commit
16be1e8447
@ -15,6 +15,15 @@ enum {
|
|||||||
MAILBOXWIN_COUNT
|
MAILBOXWIN_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Window IDs for the move relearner
|
||||||
|
enum {
|
||||||
|
RELEARNERWIN_DESC_BATTLE,
|
||||||
|
RELEARNERWIN_DESC_CONTEST,
|
||||||
|
RELEARNERWIN_MOVE_LIST,
|
||||||
|
RELEARNERWIN_MSG,
|
||||||
|
RELEARNERWIN_YESNO,
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TAG_CONDITION_MON = 100,
|
TAG_CONDITION_MON = 100,
|
||||||
TAG_CONDITION_BALL,
|
TAG_CONDITION_BALL,
|
||||||
@ -117,11 +126,11 @@ void DestroyConditionSparkleSprites(struct Sprite **sprites);
|
|||||||
void FreeConditionSparkles(struct Sprite **sprites);
|
void FreeConditionSparkles(struct Sprite **sprites);
|
||||||
|
|
||||||
// Move relearner
|
// Move relearner
|
||||||
void MoveRelearnerPrintText(u8 *str);
|
void MoveRelearnerPrintMessage(u8 *str);
|
||||||
bool16 MoveRelearnerRunTextPrinters(void);
|
bool16 MoveRelearnerRunTextPrinters(void);
|
||||||
void MoveRelearnerCreateYesNoMenu(void);
|
void MoveRelearnerCreateYesNoMenu(void);
|
||||||
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
|
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
|
||||||
void InitMoveRelearnerWindows(bool8 useContextWindow);
|
void InitMoveRelearnerWindows(bool8 useContestWindow);
|
||||||
|
|
||||||
// Level up window
|
// Level up window
|
||||||
void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bgClr, u8 fgClr, u8 shadowClr);
|
void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bgClr, u8 fgClr, u8 shadowClr);
|
||||||
|
@ -105,10 +105,9 @@ static const u8 sConditionToLineLength[MAX_CONDITION + 1] =
|
|||||||
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35
|
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
|
static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
|
||||||
{
|
{
|
||||||
{
|
[RELEARNERWIN_DESC_BATTLE] = {
|
||||||
.bg = 1,
|
.bg = 1,
|
||||||
.tilemapLeft = 1,
|
.tilemapLeft = 1,
|
||||||
.tilemapTop = 1,
|
.tilemapTop = 1,
|
||||||
@ -117,7 +116,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
|
|||||||
.paletteNum = 0xF,
|
.paletteNum = 0xF,
|
||||||
.baseBlock = 0xA
|
.baseBlock = 0xA
|
||||||
},
|
},
|
||||||
{
|
[RELEARNERWIN_DESC_CONTEST] = {
|
||||||
.bg = 1,
|
.bg = 1,
|
||||||
.tilemapLeft = 1,
|
.tilemapLeft = 1,
|
||||||
.tilemapTop = 1,
|
.tilemapTop = 1,
|
||||||
@ -126,7 +125,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
|
|||||||
.paletteNum = 0xF,
|
.paletteNum = 0xF,
|
||||||
.baseBlock = 0xCA
|
.baseBlock = 0xCA
|
||||||
},
|
},
|
||||||
{
|
[RELEARNERWIN_MOVE_LIST] = {
|
||||||
.bg = 1,
|
.bg = 1,
|
||||||
.tilemapLeft = 19,
|
.tilemapLeft = 19,
|
||||||
.tilemapTop = 1,
|
.tilemapTop = 1,
|
||||||
@ -135,7 +134,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
|
|||||||
.paletteNum = 0xF,
|
.paletteNum = 0xF,
|
||||||
.baseBlock = 0x18A
|
.baseBlock = 0x18A
|
||||||
},
|
},
|
||||||
{
|
[RELEARNERWIN_MSG] = {
|
||||||
.bg = 1,
|
.bg = 1,
|
||||||
.tilemapLeft = 4,
|
.tilemapLeft = 4,
|
||||||
.tilemapTop = 15,
|
.tilemapTop = 15,
|
||||||
@ -144,7 +143,8 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
|
|||||||
.paletteNum = 0xF,
|
.paletteNum = 0xF,
|
||||||
.baseBlock = 0x202
|
.baseBlock = 0x202
|
||||||
},
|
},
|
||||||
{
|
// Unused. Identical to sMoveRelearnerYesNoMenuTemplate
|
||||||
|
[RELEARNERWIN_YESNO] = {
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
.tilemapLeft = 22,
|
.tilemapLeft = 22,
|
||||||
.tilemapTop = 8,
|
.tilemapTop = 8,
|
||||||
@ -175,7 +175,7 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate =
|
|||||||
.itemPrintFunc = NULL,
|
.itemPrintFunc = NULL,
|
||||||
.totalItems = 0,
|
.totalItems = 0,
|
||||||
.maxShowed = 0,
|
.maxShowed = 0,
|
||||||
.windowId = 2,
|
.windowId = RELEARNERWIN_MOVE_LIST,
|
||||||
.header_X = 0,
|
.header_X = 0,
|
||||||
.item_X = 8,
|
.item_X = 8,
|
||||||
.cursor_X = 0,
|
.cursor_X = 0,
|
||||||
@ -701,7 +701,7 @@ void ConditionGraph_CalcPositions(u8 *conditions, struct UCoords16 *positions)
|
|||||||
// Move relearner
|
// Move relearner
|
||||||
//----------------
|
//----------------
|
||||||
|
|
||||||
void InitMoveRelearnerWindows(bool8 useContextWindow)
|
void InitMoveRelearnerWindows(bool8 useContestWindow)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
@ -713,20 +713,20 @@ void InitMoveRelearnerWindows(bool8 useContextWindow)
|
|||||||
for (i = 0; i < ARRAY_COUNT(sMoveRelearnerWindowTemplates) - 1; i++)
|
for (i = 0; i < ARRAY_COUNT(sMoveRelearnerWindowTemplates) - 1; i++)
|
||||||
FillWindowPixelBuffer(i, PIXEL_FILL(1));
|
FillWindowPixelBuffer(i, PIXEL_FILL(1));
|
||||||
|
|
||||||
if (!useContextWindow)
|
if (!useContestWindow)
|
||||||
{
|
{
|
||||||
PutWindowTilemap(0);
|
PutWindowTilemap(RELEARNERWIN_DESC_BATTLE);
|
||||||
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x1, 0xE);
|
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_DESC_BATTLE, FALSE, 0x1, 0xE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PutWindowTilemap(1);
|
PutWindowTilemap(RELEARNERWIN_DESC_CONTEST);
|
||||||
DrawStdFrameWithCustomTileAndPalette(1, FALSE, 1, 0xE);
|
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_DESC_CONTEST, FALSE, 1, 0xE);
|
||||||
}
|
}
|
||||||
PutWindowTilemap(2);
|
PutWindowTilemap(RELEARNERWIN_MOVE_LIST);
|
||||||
PutWindowTilemap(3);
|
PutWindowTilemap(RELEARNERWIN_MSG);
|
||||||
DrawStdFrameWithCustomTileAndPalette(2, FALSE, 1, 0xE);
|
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_MOVE_LIST, FALSE, 1, 0xE);
|
||||||
DrawStdFrameWithCustomTileAndPalette(3, FALSE, 1, 0xE);
|
DrawStdFrameWithCustomTileAndPalette(RELEARNERWIN_MSG, FALSE, 1, 0xE);
|
||||||
MoveRelearnerDummy();
|
MoveRelearnerDummy();
|
||||||
ScheduleBgCopyTilemapToVram(1);
|
ScheduleBgCopyTilemapToVram(1);
|
||||||
}
|
}
|
||||||
@ -757,33 +757,34 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
|
|||||||
u8 buffer[32];
|
u8 buffer[32];
|
||||||
const u8 *str;
|
const u8 *str;
|
||||||
|
|
||||||
FillWindowPixelBuffer(0, PIXEL_FILL(1));
|
FillWindowPixelBuffer(RELEARNERWIN_DESC_BATTLE, PIXEL_FILL(1));
|
||||||
str = gText_MoveRelearnerBattleMoves;
|
str = gText_MoveRelearnerBattleMoves;
|
||||||
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80);
|
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 128);
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
str = gText_MoveRelearnerPP;
|
str = gText_MoveRelearnerPP;
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x29, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 4, 41, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
str = gText_MoveRelearnerPower;
|
str = gText_MoveRelearnerPower;
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 106);
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x19, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, x, 25, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
str = gText_MoveRelearnerAccuracy;
|
str = gText_MoveRelearnerAccuracy;
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 106);
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x29, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, x, 41, TEXT_SKIP_DRAW, NULL);
|
||||||
if (chosenMove == LIST_CANCEL)
|
if (chosenMove == LIST_CANCEL)
|
||||||
{
|
{
|
||||||
CopyWindowToVram(0, COPYWIN_GFX);
|
// On "Cancel", skip printing move data
|
||||||
|
CopyWindowToVram(RELEARNERWIN_DESC_BATTLE, COPYWIN_GFX);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
move = &gBattleMoves[chosenMove];
|
move = &gBattleMoves[chosenMove];
|
||||||
str = gTypeNames[move->type];
|
str = gTypeNames[move->type];
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x19, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 4, 25, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
x = 4 + GetStringWidth(FONT_NORMAL, gText_MoveRelearnerPP, 0);
|
x = 4 + GetStringWidth(FONT_NORMAL, gText_MoveRelearnerPP, 0);
|
||||||
ConvertIntToDecimalStringN(buffer, move->pp, STR_CONV_MODE_LEFT_ALIGN, 2);
|
ConvertIntToDecimalStringN(buffer, move->pp, STR_CONV_MODE_LEFT_ALIGN, 2);
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, buffer, x, 0x29, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, buffer, x, 41, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
if (move->power < 2)
|
if (move->power < 2)
|
||||||
{
|
{
|
||||||
@ -794,7 +795,7 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
|
|||||||
ConvertIntToDecimalStringN(buffer, move->power, STR_CONV_MODE_LEFT_ALIGN, 3);
|
ConvertIntToDecimalStringN(buffer, move->power, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||||
str = buffer;
|
str = buffer;
|
||||||
}
|
}
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x19, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 106, 25, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
if (move->accuracy == 0)
|
if (move->accuracy == 0)
|
||||||
{
|
{
|
||||||
@ -805,10 +806,10 @@ static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
|
|||||||
ConvertIntToDecimalStringN(buffer, move->accuracy, STR_CONV_MODE_LEFT_ALIGN, 3);
|
ConvertIntToDecimalStringN(buffer, move->accuracy, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||||
str = buffer;
|
str = buffer;
|
||||||
}
|
}
|
||||||
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x29, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NORMAL, str, 106, 41, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
str = gMoveDescriptionPointers[chosenMove - 1];
|
str = gMoveDescriptionPointers[chosenMove - 1];
|
||||||
AddTextPrinterParameterized(0, FONT_NARROW, str, 0, 0x41, 0, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_BATTLE, FONT_NARROW, str, 0, 65, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove)
|
static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove)
|
||||||
@ -818,33 +819,33 @@ static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove)
|
|||||||
const struct ContestMove *move;
|
const struct ContestMove *move;
|
||||||
|
|
||||||
MoveRelearnerShowHideHearts(chosenMove);
|
MoveRelearnerShowHideHearts(chosenMove);
|
||||||
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
FillWindowPixelBuffer(RELEARNERWIN_DESC_CONTEST, PIXEL_FILL(1));
|
||||||
str = gText_MoveRelearnerContestMovesTitle;
|
str = gText_MoveRelearnerContestMovesTitle;
|
||||||
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80);
|
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 128);
|
||||||
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
str = gText_MoveRelearnerAppeal;
|
str = gText_MoveRelearnerAppeal;
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 92);
|
||||||
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x19, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, x, 25, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
str = gText_MoveRelearnerJam;
|
str = gText_MoveRelearnerJam;
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 92);
|
||||||
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x29, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, x, 41, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
if (chosenMove == MENU_NOTHING_CHOSEN)
|
if (chosenMove == MENU_NOTHING_CHOSEN)
|
||||||
{
|
{
|
||||||
CopyWindowToVram(1, COPYWIN_GFX);
|
CopyWindowToVram(RELEARNERWIN_DESC_CONTEST, COPYWIN_GFX);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
move = &gContestMoves[chosenMove];
|
move = &gContestMoves[chosenMove];
|
||||||
str = gContestMoveTypeTextPointers[move->contestCategory];
|
str = gContestMoveTypeTextPointers[move->contestCategory];
|
||||||
AddTextPrinterParameterized(1, FONT_NORMAL, str, 4, 0x19, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NORMAL, str, 4, 25, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
str = gContestEffectDescriptionPointers[move->effect];
|
str = gContestEffectDescriptionPointers[move->effect];
|
||||||
AddTextPrinterParameterized(1, FONT_NARROW, str, 0, 0x41, TEXT_SKIP_DRAW, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_DESC_CONTEST, FONT_NARROW, str, 0, 65, TEXT_SKIP_DRAW, NULL);
|
||||||
|
|
||||||
CopyWindowToVram(1, COPYWIN_GFX);
|
CopyWindowToVram(RELEARNERWIN_DESC_CONTEST, COPYWIN_GFX);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
||||||
@ -855,20 +856,20 @@ static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct List
|
|||||||
MoveRelearnerMenuLoadContestMoveDescription(itemIndex);
|
MoveRelearnerMenuLoadContestMoveDescription(itemIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveRelearnerPrintText(u8 *str)
|
void MoveRelearnerPrintMessage(u8 *str)
|
||||||
{
|
{
|
||||||
u8 speed;
|
u8 speed;
|
||||||
|
|
||||||
FillWindowPixelBuffer(3, PIXEL_FILL(1));
|
FillWindowPixelBuffer(RELEARNERWIN_MSG, PIXEL_FILL(1));
|
||||||
gTextFlags.canABSpeedUpPrint = TRUE;
|
gTextFlags.canABSpeedUpPrint = TRUE;
|
||||||
speed = GetPlayerTextSpeedDelay();
|
speed = GetPlayerTextSpeedDelay();
|
||||||
AddTextPrinterParameterized2(3, FONT_NORMAL, str, speed, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, 3);
|
AddTextPrinterParameterized2(RELEARNERWIN_MSG, FONT_NORMAL, str, speed, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool16 MoveRelearnerRunTextPrinters(void)
|
bool16 MoveRelearnerRunTextPrinters(void)
|
||||||
{
|
{
|
||||||
RunTextPrinters();
|
RunTextPrinters();
|
||||||
return IsTextPrinterActive(3);
|
return IsTextPrinterActive(RELEARNERWIN_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveRelearnerCreateYesNoMenu(void)
|
void MoveRelearnerCreateYesNoMenu(void)
|
||||||
|
@ -458,10 +458,10 @@ static void CB2_MoveRelearnerMain(void)
|
|||||||
UpdatePaletteFade();
|
UpdatePaletteFade();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FormatAndPrintText(const u8 *src)
|
static void PrintMessageWithPlaceholders(const u8 *src)
|
||||||
{
|
{
|
||||||
StringExpandPlaceholders(gStringVar4, src);
|
StringExpandPlaceholders(gStringVar4, src);
|
||||||
MoveRelearnerPrintText(gStringVar4);
|
MoveRelearnerPrintMessage(gStringVar4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See the state machine doc at the top of the file.
|
// See the state machine doc at the top of the file.
|
||||||
@ -515,7 +515,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
{
|
{
|
||||||
if (GiveMoveToMon(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove()) != MON_HAS_MAX_MOVES)
|
if (GiveMoveToMon(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove()) != MON_HAS_MAX_MOVES)
|
||||||
{
|
{
|
||||||
FormatAndPrintText(gText_MoveRelearnerPkmnLearnedMove);
|
PrintMessageWithPlaceholders(gText_MoveRelearnerPkmnLearnedMove);
|
||||||
gSpecialVar_0x8004 = TRUE;
|
gSpecialVar_0x8004 = TRUE;
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
|
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
|
||||||
}
|
}
|
||||||
@ -567,7 +567,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT:
|
case MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT:
|
||||||
FormatAndPrintText(gText_MoveRelearnerPkmnTryingToLearnMove);
|
PrintMessageWithPlaceholders(gText_MoveRelearnerPkmnTryingToLearnMove);
|
||||||
sMoveRelearnerStruct->state++;
|
sMoveRelearnerStruct->state++;
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_WAIT_FOR_TRYING_TO_LEARN:
|
case MENU_STATE_WAIT_FOR_TRYING_TO_LEARN:
|
||||||
@ -583,7 +583,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
|
|
||||||
if (var == 0)
|
if (var == 0)
|
||||||
{
|
{
|
||||||
FormatAndPrintText(gText_MoveRelearnerWhichMoveToForget);
|
PrintMessageWithPlaceholders(gText_MoveRelearnerWhichMoveToForget);
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_PRINT_WHICH_MOVE_PROMPT;
|
sMoveRelearnerStruct->state = MENU_STATE_PRINT_WHICH_MOVE_PROMPT;
|
||||||
}
|
}
|
||||||
else if (var == -1 || var == 1)
|
else if (var == -1 || var == 1)
|
||||||
@ -594,7 +594,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
break;
|
break;
|
||||||
case MENU_STATE_PRINT_STOP_TEACHING:
|
case MENU_STATE_PRINT_STOP_TEACHING:
|
||||||
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
|
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
|
||||||
FormatAndPrintText(gText_MoveRelearnerStopTryingToTeachMove);
|
PrintMessageWithPlaceholders(gText_MoveRelearnerStopTryingToTeachMove);
|
||||||
sMoveRelearnerStruct->state++;
|
sMoveRelearnerStruct->state++;
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_WAIT_FOR_STOP_TEACHING:
|
case MENU_STATE_WAIT_FOR_STOP_TEACHING:
|
||||||
@ -630,7 +630,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
case MENU_STATE_CHOOSE_SETUP_STATE:
|
case MENU_STATE_CHOOSE_SETUP_STATE:
|
||||||
if (!MoveRelearnerRunTextPrinters())
|
if (!MoveRelearnerRunTextPrinters())
|
||||||
{
|
{
|
||||||
FillWindowPixelBuffer(3, 0x11);
|
FillWindowPixelBuffer(RELEARNERWIN_MSG, 0x11);
|
||||||
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
|
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
|
||||||
{
|
{
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
|
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
|
||||||
@ -687,7 +687,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
ShowTeachMoveText(TRUE);
|
ShowTeachMoveText(TRUE);
|
||||||
}
|
}
|
||||||
RemoveScrollArrows();
|
RemoveScrollArrows();
|
||||||
CopyWindowToVram(3, COPYWIN_GFX);
|
CopyWindowToVram(RELEARNERWIN_MSG, COPYWIN_GFX);
|
||||||
break;
|
break;
|
||||||
case MENU_STATE_TRY_OVERWRITE_MOVE:
|
case MENU_STATE_TRY_OVERWRITE_MOVE:
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
@ -704,7 +704,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
RemoveMonPPBonus(&gPlayerParty[sMoveRelearnerStruct->partyMon], sMoveRelearnerStruct->moveSlot);
|
RemoveMonPPBonus(&gPlayerParty[sMoveRelearnerStruct->partyMon], sMoveRelearnerStruct->moveSlot);
|
||||||
SetMonMoveSlot(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove(), sMoveRelearnerStruct->moveSlot);
|
SetMonMoveSlot(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove(), sMoveRelearnerStruct->moveSlot);
|
||||||
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
|
StringCopy(gStringVar2, gMoveNames[GetCurrentSelectedMove()]);
|
||||||
FormatAndPrintText(gText_MoveRelearnerAndPoof);
|
PrintMessageWithPlaceholders(gText_MoveRelearnerAndPoof);
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE;
|
sMoveRelearnerStruct->state = MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE;
|
||||||
gSpecialVar_0x8004 = TRUE;
|
gSpecialVar_0x8004 = TRUE;
|
||||||
}
|
}
|
||||||
@ -713,7 +713,7 @@ static void DoMoveRelearnerMain(void)
|
|||||||
case MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE:
|
case MENU_STATE_DOUBLE_FANFARE_FORGOT_MOVE:
|
||||||
if (!MoveRelearnerRunTextPrinters())
|
if (!MoveRelearnerRunTextPrinters())
|
||||||
{
|
{
|
||||||
FormatAndPrintText(gText_MoveRelearnerPkmnForgotMoveAndLearnedNew);
|
PrintMessageWithPlaceholders(gText_MoveRelearnerPkmnForgotMoveAndLearnedNew);
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
|
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEXT_THEN_FANFARE;
|
||||||
PlayFanfare(MUS_LEVEL_UP);
|
PlayFanfare(MUS_LEVEL_UP);
|
||||||
}
|
}
|
||||||
@ -758,15 +758,13 @@ static void HideHeartSpritesAndShowTeachMoveText(bool8 onlyHideSprites)
|
|||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
|
||||||
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
|
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
if (!onlyHideSprites)
|
if (!onlyHideSprites)
|
||||||
{
|
{
|
||||||
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
|
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
|
||||||
FillWindowPixelBuffer(3, 0x11);
|
FillWindowPixelBuffer(RELEARNERWIN_MSG, 0x11);
|
||||||
AddTextPrinterParameterized(3, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_MSG, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,21 +777,19 @@ static void HandleInput(bool8 showContest)
|
|||||||
{
|
{
|
||||||
case LIST_NOTHING_CHOSEN:
|
case LIST_NOTHING_CHOSEN:
|
||||||
if (!(JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysPressed())
|
if (!(JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysPressed())
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
|
|
||||||
if (showContest == FALSE)
|
if (showContest == FALSE)
|
||||||
{
|
{
|
||||||
PutWindowTilemap(1);
|
PutWindowTilemap(RELEARNERWIN_DESC_CONTEST);
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
|
sMoveRelearnerStruct->state = MENU_STATE_SETUP_CONTEST_MODE;
|
||||||
sMoveRelearnerMenuSate.showContestInfo = TRUE;
|
sMoveRelearnerMenuSate.showContestInfo = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PutWindowTilemap(0);
|
PutWindowTilemap(RELEARNERWIN_DESC_BATTLE);
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
|
sMoveRelearnerStruct->state = MENU_STATE_SETUP_BATTLE_MODE;
|
||||||
sMoveRelearnerMenuSate.showContestInfo = FALSE;
|
sMoveRelearnerMenuSate.showContestInfo = FALSE;
|
||||||
}
|
}
|
||||||
@ -806,7 +802,7 @@ static void HandleInput(bool8 showContest)
|
|||||||
RemoveScrollArrows();
|
RemoveScrollArrows();
|
||||||
sMoveRelearnerStruct->state = MENU_STATE_PRINT_GIVE_UP_PROMPT;
|
sMoveRelearnerStruct->state = MENU_STATE_PRINT_GIVE_UP_PROMPT;
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerGiveUp);
|
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerGiveUp);
|
||||||
MoveRelearnerPrintText(gStringVar4);
|
MoveRelearnerPrintMessage(gStringVar4);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
@ -814,7 +810,7 @@ static void HandleInput(bool8 showContest)
|
|||||||
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEACH_MOVE_PROMPT;
|
sMoveRelearnerStruct->state = MENU_STATE_PRINT_TEACH_MOVE_PROMPT;
|
||||||
StringCopy(gStringVar2, gMoveNames[itemId]);
|
StringCopy(gStringVar2, gMoveNames[itemId]);
|
||||||
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerTeachMoveConfirm);
|
StringExpandPlaceholders(gStringVar4, gText_MoveRelearnerTeachMoveConfirm);
|
||||||
MoveRelearnerPrintText(gStringVar4);
|
MoveRelearnerPrintMessage(gStringVar4);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -835,8 +831,8 @@ static void ShowTeachMoveText(bool8 shouldDoNothingInstead)
|
|||||||
if (shouldDoNothingInstead == FALSE)
|
if (shouldDoNothingInstead == FALSE)
|
||||||
{
|
{
|
||||||
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
|
StringExpandPlaceholders(gStringVar4, gText_TeachWhichMoveToPkmn);
|
||||||
FillWindowPixelBuffer(3, 0x11);
|
FillWindowPixelBuffer(RELEARNERWIN_MSG, 0x11);
|
||||||
AddTextPrinterParameterized(3, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
|
AddTextPrinterParameterized(RELEARNERWIN_MSG, FONT_NORMAL, gStringVar4, 0, 1, 0, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -850,9 +846,7 @@ static void CreateUISprites(void)
|
|||||||
|
|
||||||
// These are the appeal hearts.
|
// These are the appeal hearts.
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
|
||||||
sMoveRelearnerStruct->heartSpriteIds[i] = CreateSprite(&sConstestMoveHeartSprite, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 36, 0);
|
sMoveRelearnerStruct->heartSpriteIds[i] = CreateSprite(&sConstestMoveHeartSprite, (i - (i / 4) * 4) * 8 + 104, (i / 4) * 8 + 36, 0);
|
||||||
}
|
|
||||||
|
|
||||||
// These are the jam harts.
|
// These are the jam harts.
|
||||||
// The animation is used to toggle between full/empty heart sprites.
|
// The animation is used to toggle between full/empty heart sprites.
|
||||||
@ -863,17 +857,13 @@ static void CreateUISprites(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
|
||||||
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
|
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddScrollArrows(void)
|
static void AddScrollArrows(void)
|
||||||
{
|
{
|
||||||
if (sMoveRelearnerStruct->moveDisplayArrowTask == TASK_NONE)
|
if (sMoveRelearnerStruct->moveDisplayArrowTask == TASK_NONE)
|
||||||
{
|
|
||||||
sMoveRelearnerStruct->moveDisplayArrowTask = AddScrollIndicatorArrowPair(&sDisplayModeArrowsTemplate, &sMoveRelearnerStruct->scrollOffset);
|
sMoveRelearnerStruct->moveDisplayArrowTask = AddScrollIndicatorArrowPair(&sDisplayModeArrowsTemplate, &sMoveRelearnerStruct->scrollOffset);
|
||||||
}
|
|
||||||
|
|
||||||
if (sMoveRelearnerStruct->moveListScrollArrowTask == TASK_NONE)
|
if (sMoveRelearnerStruct->moveListScrollArrowTask == TASK_NONE)
|
||||||
{
|
{
|
||||||
@ -927,49 +917,35 @@ void MoveRelearnerShowHideHearts(s32 moveId)
|
|||||||
if (!sMoveRelearnerMenuSate.showContestInfo || moveId == LIST_CANCEL)
|
if (!sMoveRelearnerMenuSate.showContestInfo || moveId == LIST_CANCEL)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
|
||||||
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
|
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].appeal / 10);
|
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].appeal / 10);
|
||||||
|
|
||||||
if (numHearts == 0xFF)
|
if (numHearts == 0xFF)
|
||||||
{
|
|
||||||
numHearts = 0;
|
numHearts = 0;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (i < numHearts)
|
if (i < numHearts)
|
||||||
{
|
|
||||||
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 1);
|
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 1);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 0);
|
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i]], 0);
|
||||||
}
|
|
||||||
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = FALSE;
|
gSprites[sMoveRelearnerStruct->heartSpriteIds[i]].invisible = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].jam / 10);
|
numHearts = (u8)(gContestEffects[gContestMoves[moveId].effect].jam / 10);
|
||||||
|
|
||||||
if (numHearts == 0xFF)
|
if (numHearts == 0xFF)
|
||||||
{
|
|
||||||
numHearts = 0;
|
numHearts = 0;
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (i < numHearts)
|
if (i < numHearts)
|
||||||
{
|
|
||||||
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 3);
|
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 3);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 2);
|
StartSpriteAnim(&gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]], 2);
|
||||||
}
|
|
||||||
gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]].invisible = FALSE;
|
gSprites[sMoveRelearnerStruct->heartSpriteIds[i + 8]].invisible = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user