2019-03-05 12:06:20 +01:00
|
|
|
#include "global.h"
|
2019-09-09 03:07:54 +02:00
|
|
|
#include "malloc.h"
|
2019-03-08 07:56:38 +01:00
|
|
|
#include "battle_main.h"
|
|
|
|
#include "contest_effect.h"
|
2019-04-04 23:53:06 +02:00
|
|
|
#include "data.h"
|
2019-03-31 12:59:01 +02:00
|
|
|
#include "decompress.h"
|
2019-03-07 04:27:30 +01:00
|
|
|
#include "gpu_regs.h"
|
2019-03-31 12:59:01 +02:00
|
|
|
#include "graphics.h"
|
2019-03-08 07:56:38 +01:00
|
|
|
#include "menu.h"
|
2019-03-05 12:06:20 +01:00
|
|
|
#include "international_string_util.h"
|
|
|
|
#include "menu.h"
|
2019-03-08 08:17:01 +01:00
|
|
|
#include "menu_specialized.h"
|
2019-03-08 07:56:38 +01:00
|
|
|
#include "move_relearner.h"
|
|
|
|
#include "palette.h"
|
2019-03-05 12:06:20 +01:00
|
|
|
#include "player_pc.h"
|
2019-03-08 07:56:38 +01:00
|
|
|
#include "pokemon_summary_screen.h"
|
2019-03-31 12:59:01 +02:00
|
|
|
#include "pokemon_storage_system.h"
|
2019-03-07 04:27:30 +01:00
|
|
|
#include "scanline_effect.h"
|
2019-03-05 12:06:20 +01:00
|
|
|
#include "sound.h"
|
|
|
|
#include "strings.h"
|
|
|
|
#include "string_util.h"
|
2019-03-31 12:59:01 +02:00
|
|
|
#include "text.h"
|
2019-03-08 07:56:38 +01:00
|
|
|
#include "text_window.h"
|
2019-03-07 04:27:30 +01:00
|
|
|
#include "trig.h"
|
2019-03-05 12:06:20 +01:00
|
|
|
#include "window.h"
|
|
|
|
#include "constants/songs.h"
|
2019-03-07 04:27:30 +01:00
|
|
|
#include "gba/io_reg.h"
|
2019-03-05 12:06:20 +01:00
|
|
|
|
2019-03-31 12:59:01 +02:00
|
|
|
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
EWRAM_DATA static u8 sMailboxWindowIds[MAILBOXWIN_COUNT] = {0};
|
|
|
|
EWRAM_DATA static struct ListMenuItem *sMailboxList = NULL;
|
2019-03-05 12:06:20 +01:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
static void MailboxMenu_MoveCursorFunc(s32, bool8, struct ListMenu *);
|
2021-11-11 00:52:30 +01:00
|
|
|
static void ConditionGraph_CalcRightHalf(struct ConditionGraph *);
|
|
|
|
static void ConditionGraph_CalcLeftHalf(struct ConditionGraph *);
|
2021-11-10 02:02:12 +01:00
|
|
|
static void MoveRelearnerCursorCallback(s32, bool8, struct ListMenu *);
|
|
|
|
static void MoveRelearnerDummy(void);
|
|
|
|
static void SetNextConditionSparkle(struct Sprite *);
|
|
|
|
static void SpriteCB_ConditionSparkle(struct Sprite *);
|
|
|
|
static void ShowAllConditionSparkles(struct Sprite *);
|
2019-03-05 12:06:20 +01:00
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
static const struct WindowTemplate sWindowTemplates_MailboxMenu[MAILBOXWIN_COUNT] =
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
[MAILBOXWIN_TITLE] = {
|
2019-03-05 12:06:20 +01:00
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 1,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 8,
|
|
|
|
.height = 2,
|
2021-04-25 18:07:08 +02:00
|
|
|
.paletteNum = 15,
|
2019-03-05 12:06:20 +01:00
|
|
|
.baseBlock = 0x8
|
|
|
|
},
|
2021-04-25 18:07:08 +02:00
|
|
|
[MAILBOXWIN_LIST] = {
|
2019-03-05 12:06:20 +01:00
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 21,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 8,
|
|
|
|
.height = 18,
|
2021-04-25 18:07:08 +02:00
|
|
|
.paletteNum = 15,
|
2019-03-05 12:06:20 +01:00
|
|
|
.baseBlock = 0x18
|
|
|
|
},
|
2021-04-25 18:07:08 +02:00
|
|
|
[MAILBOXWIN_OPTIONS] = {
|
2019-03-05 12:06:20 +01:00
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 1,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 11,
|
|
|
|
.height = 8,
|
2021-04-25 18:07:08 +02:00
|
|
|
.paletteNum = 15,
|
2019-03-05 12:06:20 +01:00
|
|
|
.baseBlock = 0x18
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-12-10 19:48:20 +01:00
|
|
|
static const u8 sPlayerNameTextColors[] =
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
2021-04-10 04:39:34 +02:00
|
|
|
TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_LIGHT_GRAY
|
2019-03-05 12:06:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static const u8 sEmptyItemName[] = _("");
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static const struct ScanlineEffectParams sConditionGraphScanline =
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
.dmaDest = ®_WIN0H,
|
2019-03-06 04:32:28 +01:00
|
|
|
.dmaControl = SCANLINE_EFFECT_DMACNT_32BIT,
|
|
|
|
.initState = 1,
|
|
|
|
};
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
static const u8 sConditionToLineLength[MAX_CONDITION + 1] =
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
4, 5, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 13,
|
|
|
|
13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17,
|
|
|
|
17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19,
|
|
|
|
19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21,
|
|
|
|
21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23,
|
|
|
|
23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
|
|
|
24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26,
|
|
|
|
26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27,
|
|
|
|
27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
|
|
|
28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
|
|
|
29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
|
|
|
|
30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
|
|
|
|
31, 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
|
|
|
32, 32, 32, 32, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33,
|
|
|
|
33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 34, 34, 34, 34, 34,
|
|
|
|
34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 35
|
2019-03-07 04:27:30 +01:00
|
|
|
};
|
|
|
|
|
2019-03-07 04:58:05 +01:00
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
|
2019-03-07 04:58:05 +01:00
|
|
|
{
|
|
|
|
{
|
|
|
|
.bg = 1,
|
|
|
|
.tilemapLeft = 1,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 16,
|
|
|
|
.height = 12,
|
|
|
|
.paletteNum = 0xF,
|
|
|
|
.baseBlock = 0xA
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.bg = 1,
|
|
|
|
.tilemapLeft = 1,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 16,
|
|
|
|
.height = 12,
|
|
|
|
.paletteNum = 0xF,
|
|
|
|
.baseBlock = 0xCA
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.bg = 1,
|
|
|
|
.tilemapLeft = 19,
|
|
|
|
.tilemapTop = 1,
|
|
|
|
.width = 10,
|
|
|
|
.height = 12,
|
|
|
|
.paletteNum = 0xF,
|
|
|
|
.baseBlock = 0x18A
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.bg = 1,
|
|
|
|
.tilemapLeft = 4,
|
|
|
|
.tilemapTop = 15,
|
|
|
|
.width = 22,
|
|
|
|
.height = 4,
|
|
|
|
.paletteNum = 0xF,
|
|
|
|
.baseBlock = 0x202
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 22,
|
|
|
|
.tilemapTop = 8,
|
|
|
|
.width = 5,
|
|
|
|
.height = 4,
|
|
|
|
.paletteNum = 0xF,
|
|
|
|
.baseBlock = 0x25A
|
|
|
|
},
|
|
|
|
DUMMY_WIN_TEMPLATE
|
|
|
|
};
|
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
static const struct WindowTemplate sMoveRelearnerYesNoMenuTemplate =
|
2019-03-07 04:58:05 +01:00
|
|
|
{
|
|
|
|
.bg = 0,
|
|
|
|
.tilemapLeft = 22,
|
|
|
|
.tilemapTop = 8,
|
|
|
|
.width = 5,
|
|
|
|
.height = 4,
|
|
|
|
.paletteNum = 0xF,
|
|
|
|
.baseBlock = 0x25A
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate =
|
2019-03-07 04:58:05 +01:00
|
|
|
{
|
|
|
|
.items = NULL,
|
|
|
|
.moveCursorFunc = MoveRelearnerCursorCallback,
|
|
|
|
.itemPrintFunc = NULL,
|
|
|
|
.totalItems = 0,
|
|
|
|
.maxShowed = 0,
|
|
|
|
.windowId = 2,
|
|
|
|
.header_X = 0,
|
|
|
|
.item_X = 8,
|
|
|
|
.cursor_X = 0,
|
|
|
|
.upText_Y = 1,
|
|
|
|
.cursorPal = 2,
|
|
|
|
.fillValue = 1,
|
|
|
|
.cursorShadowPal = 3,
|
|
|
|
.lettersSpacing = 0,
|
|
|
|
.itemVerticalPadding = 0,
|
|
|
|
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
2021-10-30 22:47:37 +02:00
|
|
|
.fontId = FONT_NORMAL,
|
2019-03-07 04:58:05 +01:00
|
|
|
.cursorKind = 0
|
|
|
|
};
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
//--------------
|
|
|
|
// Mailbox menu
|
|
|
|
//--------------
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
bool8 MailboxMenu_Alloc(u8 count)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
u8 i;
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
// + 1 to count for 'Cancel'
|
|
|
|
sMailboxList = Alloc((count + 1) * sizeof(*sMailboxList));
|
|
|
|
if (sMailboxList == NULL)
|
2019-03-05 12:06:20 +01:00
|
|
|
return FALSE;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(sMailboxWindowIds); i++)
|
|
|
|
sMailboxWindowIds[i] = WINDOW_NONE;
|
2019-03-05 12:06:20 +01:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
u8 MailboxMenu_AddWindow(u8 windowIdx)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
if (sMailboxWindowIds[windowIdx] == WINDOW_NONE)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
if (windowIdx == MAILBOXWIN_OPTIONS)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
struct WindowTemplate template = sWindowTemplates_MailboxMenu[windowIdx];
|
2019-03-22 17:27:18 +01:00
|
|
|
template.width = GetMaxWidthInMenuTable(&gMailboxMailOptions[0], 4);
|
2021-04-25 18:07:08 +02:00
|
|
|
sMailboxWindowIds[windowIdx] = AddWindow(&template);
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
2021-04-25 18:07:08 +02:00
|
|
|
else // MAILBOXWIN_TITLE or MAILBOXWIN_LIST
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
sMailboxWindowIds[windowIdx] = AddWindow(&sWindowTemplates_MailboxMenu[windowIdx]);
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
2022-07-25 20:59:14 +02:00
|
|
|
SetStandardWindowBorderStyle(sMailboxWindowIds[windowIdx], FALSE);
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
2021-04-25 18:07:08 +02:00
|
|
|
return sMailboxWindowIds[windowIdx];
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
void MailboxMenu_RemoveWindow(u8 windowIdx)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2022-07-25 20:59:14 +02:00
|
|
|
ClearStdWindowAndFrameToTransparent(sMailboxWindowIds[windowIdx], FALSE);
|
2021-04-25 18:07:08 +02:00
|
|
|
ClearWindowTilemap(sMailboxWindowIds[windowIdx]);
|
|
|
|
RemoveWindow(sMailboxWindowIds[windowIdx]);
|
|
|
|
sMailboxWindowIds[windowIdx] = WINDOW_NONE;
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
// Unused
|
|
|
|
static u8 MailboxMenu_GetWindowId(u8 windowIdx)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
return sMailboxWindowIds[windowIdx];
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
|
|
|
|
2021-08-02 20:08:10 +02:00
|
|
|
static void MailboxMenu_ItemPrintFunc(u8 windowId, u32 itemId, u8 y)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
|
|
|
u8 buffer[30];
|
|
|
|
u16 length;
|
|
|
|
|
2019-04-03 04:18:36 +02:00
|
|
|
if (itemId == LIST_CANCEL)
|
2019-03-05 12:06:20 +01:00
|
|
|
return;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-02-20 21:15:38 +01:00
|
|
|
StringCopy(buffer, gSaveBlock1Ptr->mail[PARTY_SIZE + itemId].playerName);
|
|
|
|
ConvertInternationalPlayerName(buffer);
|
2019-03-05 12:06:20 +01:00
|
|
|
length = StringLength(buffer);
|
2021-02-20 21:15:38 +01:00
|
|
|
if (length < PLAYER_NAME_LENGTH - 1)
|
2019-03-05 12:06:20 +01:00
|
|
|
ConvertInternationalString(buffer, LANGUAGE_JAPANESE);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized4(windowId, FONT_NORMAL, 8, y, 0, 0, sPlayerNameTextColors, TEXT_SKIP_DRAW, buffer);
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
for (i = 0; i < page->count; i++)
|
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
sMailboxList[i].name = sEmptyItemName;
|
|
|
|
sMailboxList[i].id = i;
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
sMailboxList[i].name = gText_Cancel2;
|
|
|
|
sMailboxList[i].id = LIST_CANCEL;
|
2019-03-05 12:06:20 +01:00
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
gMultiuseListMenuTemplate.items = sMailboxList;
|
2019-03-05 12:06:20 +01:00
|
|
|
gMultiuseListMenuTemplate.totalItems = page->count + 1;
|
2021-04-25 18:07:08 +02:00
|
|
|
gMultiuseListMenuTemplate.windowId = sMailboxWindowIds[MAILBOXWIN_LIST];
|
2019-03-05 12:06:20 +01:00
|
|
|
gMultiuseListMenuTemplate.header_X = 0;
|
|
|
|
gMultiuseListMenuTemplate.item_X = 8;
|
|
|
|
gMultiuseListMenuTemplate.cursor_X = 0;
|
|
|
|
gMultiuseListMenuTemplate.maxShowed = 8;
|
|
|
|
gMultiuseListMenuTemplate.upText_Y = 9;
|
|
|
|
gMultiuseListMenuTemplate.cursorPal = 2;
|
|
|
|
gMultiuseListMenuTemplate.fillValue = 1;
|
|
|
|
gMultiuseListMenuTemplate.cursorShadowPal = 3;
|
2021-04-25 18:07:08 +02:00
|
|
|
gMultiuseListMenuTemplate.moveCursorFunc = MailboxMenu_MoveCursorFunc;
|
|
|
|
gMultiuseListMenuTemplate.itemPrintFunc = MailboxMenu_ItemPrintFunc;
|
2021-10-30 22:47:37 +02:00
|
|
|
gMultiuseListMenuTemplate.fontId = FONT_NORMAL;
|
2019-03-05 12:06:20 +01:00
|
|
|
gMultiuseListMenuTemplate.cursorKind = 0;
|
|
|
|
gMultiuseListMenuTemplate.lettersSpacing = 0;
|
|
|
|
gMultiuseListMenuTemplate.itemVerticalPadding = 0;
|
|
|
|
gMultiuseListMenuTemplate.scrollMultiple = LIST_NO_MULTIPLE_SCROLL;
|
|
|
|
return ListMenuInit(&gMultiuseListMenuTemplate, page->itemsAbove, page->cursorPos);
|
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
static void MailboxMenu_MoveCursorFunc(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
|
|
|
if (onInit != TRUE)
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
void MailboxMenu_AddScrollArrows(struct PlayerPCItemPageStruct *page)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-02-20 05:22:26 +01:00
|
|
|
page->scrollIndicatorTaskId = AddScrollIndicatorArrowPairParameterized(2, 0xC8, 12, 0x94, page->count - page->pageItems + 1, 0x6E, 0x6E, &page->itemsAbove);
|
2019-03-05 12:06:20 +01:00
|
|
|
}
|
|
|
|
|
2021-04-25 18:07:08 +02:00
|
|
|
void MailboxMenu_Free(void)
|
2019-03-05 12:06:20 +01:00
|
|
|
{
|
2021-04-25 18:07:08 +02:00
|
|
|
Free(sMailboxList);
|
2019-03-06 02:32:14 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
//---------------------------------------
|
|
|
|
// Condition graph
|
|
|
|
//
|
|
|
|
// This is the graph in the Pokénav and
|
|
|
|
// Pokéblock case that shows a Pokémon's
|
|
|
|
// conditions (Beauty, Tough, etc.).
|
|
|
|
// It works by using scanlines to
|
|
|
|
// selectively reveal a bg that has been
|
|
|
|
// filled with the graph color.
|
|
|
|
//---------------------------------------
|
|
|
|
|
2021-11-11 22:50:36 +01:00
|
|
|
#define SHIFT_RIGHT_ADJUSTED(n, s)(((n) >> (s)) + (((n) >> ((s) - 1)) & 1))
|
2021-11-11 00:52:30 +01:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
void ConditionGraph_Init(struct ConditionGraph *graph)
|
2019-03-06 02:32:14 +01:00
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
u8 i, j;
|
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
for (j = 0; j < CONDITION_COUNT; j++)
|
2019-03-06 02:32:14 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
for (i = 0; i < CONDITION_GRAPH_UPDATE_STEPS; i++)
|
2019-03-06 02:32:14 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->newPositions[i][j].x = 0;
|
|
|
|
graph->newPositions[i][j].y = 0;
|
2019-03-06 02:32:14 +01:00
|
|
|
}
|
2021-11-11 00:52:30 +01:00
|
|
|
|
|
|
|
for (i = 0; i < CONDITION_GRAPH_LOAD_MAX; i++)
|
2019-03-06 02:32:14 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->conditions[i][j] = 0;
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->savedPositions[i][j].x = CONDITION_GRAPH_CENTER_X;
|
|
|
|
graph->savedPositions[i][j].y = CONDITION_GRAPH_CENTER_Y;
|
2019-03-06 02:32:14 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->curPositions[j].x = 0;
|
|
|
|
graph->curPositions[j].y = 0;
|
2019-03-06 02:32:14 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->needsDraw = FALSE;
|
|
|
|
graph->updateCounter = 0;
|
2019-03-06 04:32:28 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Fills the newPositions array with incremental positions between
|
|
|
|
// old and new for the graph transition when switching between Pokémon.
|
|
|
|
void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords16 *old, struct UCoords16 *new)
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
u16 i, j;
|
2021-11-11 00:52:30 +01:00
|
|
|
s32 coord, increment;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = 0; i < CONDITION_COUNT; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
coord = old[i].x << 8;
|
|
|
|
increment = ((new[i].x - old[i].x) << 8) / CONDITION_GRAPH_UPDATE_STEPS;
|
|
|
|
for (j = 0; j < CONDITION_GRAPH_UPDATE_STEPS - 1; j++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 22:50:36 +01:00
|
|
|
graph->newPositions[j][i].x = SHIFT_RIGHT_ADJUSTED(coord, 8);
|
2021-11-11 00:52:30 +01:00
|
|
|
coord += increment;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->newPositions[j][i].x = new[i].x;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
coord = old[i].y << 8;
|
|
|
|
increment = ((new[i].y - old[i].y) << 8) / CONDITION_GRAPH_UPDATE_STEPS;
|
|
|
|
for (j = 0; j < CONDITION_GRAPH_UPDATE_STEPS - 1; j++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 22:50:36 +01:00
|
|
|
graph->newPositions[j][i].y = SHIFT_RIGHT_ADJUSTED(coord, 8);
|
2021-11-11 00:52:30 +01:00
|
|
|
coord += increment;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->newPositions[j][i].y = new[i].y;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->updateCounter = 0;
|
2019-03-06 04:32:28 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
bool8 ConditionGraph_TryUpdate(struct ConditionGraph *graph)
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
if (graph->updateCounter < CONDITION_GRAPH_UPDATE_STEPS)
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
ConditionGraph_Update(graph);
|
|
|
|
return (++graph->updateCounter != CONDITION_GRAPH_UPDATE_STEPS);
|
2019-03-06 04:32:28 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
void ConditionGraph_InitResetScanline(struct ConditionGraph *graph)
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->scanlineResetState = 0;
|
2019-03-06 04:32:28 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
bool8 ConditionGraph_ResetScanline(struct ConditionGraph *graph)
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
|
|
|
struct ScanlineEffectParams params;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
switch (graph->scanlineResetState)
|
2019-03-06 04:32:28 +01:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
ScanlineEffect_Clear();
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->scanlineResetState++;
|
2019-03-06 04:32:28 +01:00
|
|
|
return TRUE;
|
|
|
|
case 1:
|
2020-08-12 17:44:39 +02:00
|
|
|
params = sConditionGraphScanline;
|
2019-03-06 04:32:28 +01:00
|
|
|
ScanlineEffect_SetParams(params);
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->scanlineResetState++;
|
2019-03-06 04:32:28 +01:00
|
|
|
return FALSE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-03-07 04:27:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
void ConditionGraph_Draw(struct ConditionGraph *graph)
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
if (!graph->needsDraw)
|
2019-03-07 04:27:30 +01:00
|
|
|
return;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
ConditionGraph_CalcRightHalf(graph);
|
|
|
|
ConditionGraph_CalcLeftHalf(graph);
|
2019-03-07 04:27:30 +01:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = 0; i < CONDITION_GRAPH_HEIGHT; i++)
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
// Draw right half
|
|
|
|
gScanlineEffectRegBuffers[1][(i + CONDITION_GRAPH_TOP_Y - 1) * 2 + 0] = // double assignment
|
|
|
|
gScanlineEffectRegBuffers[0][(i + CONDITION_GRAPH_TOP_Y - 1) * 2 + 0] = (graph->scanlineRight[i][0] << 8) | (graph->scanlineRight[i][1]);
|
|
|
|
// Draw left half
|
|
|
|
gScanlineEffectRegBuffers[1][(i + CONDITION_GRAPH_TOP_Y - 1) * 2 + 1] = // double assignment
|
|
|
|
gScanlineEffectRegBuffers[0][(i + CONDITION_GRAPH_TOP_Y - 1) * 2 + 1] = (graph->scanlineLeft[i][0] << 8) | (graph->scanlineLeft[i][1]);
|
2019-03-07 04:27:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->needsDraw = FALSE;
|
2019-03-07 04:27:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
void ConditionGraph_InitWindow(u8 bg)
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
u32 flags;
|
2019-03-07 04:27:30 +01:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
if (bg >= NUM_BACKGROUNDS)
|
2019-03-07 04:27:30 +01:00
|
|
|
bg = 0;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2019-03-07 04:27:30 +01:00
|
|
|
// Unset the WINOUT flag for the bg.
|
|
|
|
flags = (WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ) & ~(1 << bg);
|
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
// Set limits for graph data
|
|
|
|
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE( 0, DISPLAY_WIDTH)); // Right side horizontal
|
|
|
|
SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE( 0, CONDITION_GRAPH_CENTER_X)); // Left side horizontal
|
|
|
|
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(CONDITION_GRAPH_TOP_Y, CONDITION_GRAPH_BOTTOM_Y)); // Right side vertical
|
|
|
|
SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(CONDITION_GRAPH_TOP_Y, CONDITION_GRAPH_BOTTOM_Y)); // Left side vertical
|
2019-03-07 04:27:30 +01:00
|
|
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
|
|
|
|
SetGpuReg(REG_OFFSET_WINOUT, flags);
|
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
void ConditionGraph_Update(struct ConditionGraph *graph)
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
|
|
|
u16 i;
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = 0; i < CONDITION_COUNT; i++)
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->curPositions[i] = graph->newPositions[graph->updateCounter][i];
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->needsDraw = TRUE;
|
2019-03-07 04:27:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
static void ConditionGraph_CalcLine(struct ConditionGraph *graph, u16 *scanline, struct UCoords16 *pos1, struct UCoords16 *pos2, bool8 dir, u16 *overflowScanline)
|
2019-03-23 15:46:47 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
u16 i, height, top, bottom, x2;
|
2019-07-29 16:22:50 +02:00
|
|
|
u16 *ptr;
|
2021-11-11 00:52:30 +01:00
|
|
|
s32 x, xIncrement = 0;
|
2019-03-23 15:46:47 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
if (pos1->y < pos2->y)
|
2019-03-23 15:46:47 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
top = pos1->y;
|
|
|
|
bottom = pos2->y;
|
|
|
|
x = pos1->x << 10;
|
|
|
|
x2 = pos2->x;
|
|
|
|
height = bottom - top;
|
|
|
|
if (height != 0)
|
|
|
|
xIncrement = ((x2 - pos1->x) << 10) / height;
|
2019-03-23 15:46:47 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
bottom = pos1->y;
|
|
|
|
top = pos2->y;
|
|
|
|
x = pos2->x << 10;
|
|
|
|
x2 = pos1->x;
|
|
|
|
height = bottom - top;
|
|
|
|
if (height != 0)
|
|
|
|
xIncrement = ((x2 - pos2->x) << 10) / height;
|
2019-03-23 15:46:47 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
height++;
|
|
|
|
if (overflowScanline == NULL)
|
2019-03-23 15:46:47 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
|
|
|
for (i = 0; i < height; i++)
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 22:50:36 +01:00
|
|
|
scanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
2021-11-11 00:52:30 +01:00
|
|
|
x += xIncrement;
|
|
|
|
scanline += 2;
|
2019-07-29 16:22:50 +02:00
|
|
|
}
|
2019-03-23 15:46:47 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
ptr = scanline - 2;
|
2019-03-23 15:46:47 +01:00
|
|
|
}
|
2021-11-11 00:52:30 +01:00
|
|
|
else if (xIncrement > 0)
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
overflowScanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
2019-07-29 16:22:50 +02:00
|
|
|
// Less readable than the other loops, but it has to be written this way to match.
|
2021-11-11 22:50:36 +01:00
|
|
|
for (i = 0; i < height; overflowScanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir, x += xIncrement, overflowScanline += 2, i++)
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
if (x >= (CONDITION_GRAPH_CENTER_X << 10))
|
2019-07-29 16:22:50 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->bottom = top + i;
|
|
|
|
scanline += (graph->bottom - CONDITION_GRAPH_TOP_Y) * 2;
|
|
|
|
for (; i < height; i++)
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 22:50:36 +01:00
|
|
|
scanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
2021-11-11 00:52:30 +01:00
|
|
|
x += xIncrement;
|
|
|
|
scanline += 2;
|
2019-07-29 16:22:50 +02:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
ptr = scanline - 2;
|
2019-07-29 16:22:50 +02:00
|
|
|
}
|
2021-11-11 00:52:30 +01:00
|
|
|
else if (xIncrement < 0)
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
|
|
|
for (i = 0; i < height; i++)
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 22:50:36 +01:00
|
|
|
scanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
2021-11-11 00:52:30 +01:00
|
|
|
if (x < (CONDITION_GRAPH_CENTER_X << 10))
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
scanline[dir] = CONDITION_GRAPH_CENTER_X;
|
2019-07-29 16:22:50 +02:00
|
|
|
break;
|
|
|
|
}
|
2021-11-11 00:52:30 +01:00
|
|
|
x += xIncrement;
|
|
|
|
scanline += 2;
|
2019-07-29 16:22:50 +02:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->bottom = top + i;
|
|
|
|
overflowScanline += (graph->bottom - CONDITION_GRAPH_TOP_Y) * 2;
|
|
|
|
for (; i < height; i++)
|
2019-07-29 16:22:50 +02:00
|
|
|
{
|
2021-11-11 22:50:36 +01:00
|
|
|
overflowScanline[dir] = SHIFT_RIGHT_ADJUSTED(x, 10) + dir;
|
2021-11-11 00:52:30 +01:00
|
|
|
x += xIncrement;
|
|
|
|
overflowScanline += 2;
|
2019-07-29 16:22:50 +02:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
ptr = overflowScanline - 2;
|
2019-07-29 16:22:50 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->bottom = top;
|
|
|
|
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
|
|
|
overflowScanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
|
|
|
scanline[1] = pos1->x + 1;
|
|
|
|
overflowScanline[0] = pos2->x;
|
|
|
|
overflowScanline[1] = CONDITION_GRAPH_CENTER_X;
|
2019-07-29 16:22:50 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
ptr[dir] = dir + x2;
|
2019-03-07 04:27:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
static void ConditionGraph_CalcRightHalf(struct ConditionGraph *graph)
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
u16 i, y, bottom;
|
2019-03-07 04:27:30 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Calculate Cool -> Beauty line
|
|
|
|
if (graph->curPositions[GRAPH_COOL].y < graph->curPositions[GRAPH_BEAUTY].y)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
y = graph->curPositions[GRAPH_COOL].y;
|
|
|
|
ConditionGraph_CalcLine(graph, graph->scanlineRight[0], &graph->curPositions[GRAPH_COOL], &graph->curPositions[GRAPH_BEAUTY], TRUE, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
y = graph->curPositions[GRAPH_BEAUTY].y;
|
|
|
|
ConditionGraph_CalcLine(graph, graph->scanlineRight[0], &graph->curPositions[GRAPH_BEAUTY], &graph->curPositions[GRAPH_COOL], FALSE, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Calculate Beauty -> Cute line
|
|
|
|
// No need for conditional, positions on the Beauty line are always above the Cute line
|
|
|
|
ConditionGraph_CalcLine(graph, graph->scanlineRight[0], &graph->curPositions[GRAPH_BEAUTY], &graph->curPositions[GRAPH_CUTE], TRUE, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Calculate Cute -> Tough line (includes left scanline because this crosses the halfway point)
|
|
|
|
i = (graph->curPositions[GRAPH_CUTE].y <= graph->curPositions[GRAPH_SMART].y);
|
|
|
|
ConditionGraph_CalcLine(graph, graph->scanlineRight[0], &graph->curPositions[GRAPH_CUTE], &graph->curPositions[GRAPH_SMART], i, graph->scanlineLeft[0]);
|
2021-11-12 17:13:49 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Clear down to new top
|
|
|
|
for (i = CONDITION_GRAPH_TOP_Y; i < y; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
|
|
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
for (i = graph->curPositions[GRAPH_COOL].y; i <= graph->bottom; i++)
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = CONDITION_GRAPH_CENTER_X;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Clear after new bottom
|
|
|
|
bottom = max(graph->bottom, graph->curPositions[GRAPH_CUTE].y);
|
|
|
|
for (i = bottom + 1; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
|
|
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = CONDITION_GRAPH_TOP_Y; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
if (graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] == 0
|
|
|
|
&& graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] != 0)
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = CONDITION_GRAPH_CENTER_X;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
2019-03-07 04:27:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
static void ConditionGraph_CalcLeftHalf(struct ConditionGraph *graph)
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
s32 i, y, bottom;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Calculate Cool -> Tough line
|
|
|
|
if (graph->curPositions[GRAPH_COOL].y < graph->curPositions[GRAPH_TOUGH].y)
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
y = graph->curPositions[GRAPH_COOL].y;
|
|
|
|
ConditionGraph_CalcLine(graph, graph->scanlineLeft[0], &graph->curPositions[GRAPH_COOL], &graph->curPositions[GRAPH_TOUGH], FALSE, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
y = graph->curPositions[GRAPH_TOUGH].y;
|
|
|
|
ConditionGraph_CalcLine(graph, graph->scanlineLeft[0], &graph->curPositions[GRAPH_TOUGH], &graph->curPositions[GRAPH_COOL], TRUE, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Calculate Tough -> Smart line
|
|
|
|
// No need for conditional, positions on the Tough line are always above the Smart line
|
|
|
|
ConditionGraph_CalcLine(graph, graph->scanlineLeft[0], &graph->curPositions[GRAPH_TOUGH], &graph->curPositions[GRAPH_SMART], FALSE, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Clear down to new top
|
|
|
|
for (i = CONDITION_GRAPH_TOP_Y; i < y; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
|
|
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
for (i = graph->curPositions[GRAPH_COOL].y; i <= graph->bottom; i++)
|
|
|
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][1] = CONDITION_GRAPH_CENTER_X;
|
2019-03-07 04:27:30 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Clear after new bottom
|
|
|
|
bottom = max(graph->bottom, graph->curPositions[GRAPH_SMART].y + 1);
|
|
|
|
for (i = bottom; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
|
|
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = 0; i < CONDITION_GRAPH_HEIGHT; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
if (graph->scanlineLeft[i][0] >= graph->scanlineLeft[i][1])
|
2019-03-07 04:27:30 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->scanlineLeft[i][1] = 0;
|
|
|
|
graph->scanlineLeft[i][0] = 0;
|
2019-03-07 04:27:30 +01:00
|
|
|
}
|
|
|
|
}
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
void ConditionGraph_CalcPositions(u8 *conditions, struct UCoords16 *positions)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
u8 lineLength, sinIdx;
|
|
|
|
s8 posIdx;
|
2019-03-22 17:27:18 +01:00
|
|
|
u16 i;
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
// Cool is straight up-and-down (not angled), so no need for Sin
|
|
|
|
lineLength = sConditionToLineLength[*(conditions++)];
|
|
|
|
positions[GRAPH_COOL].x = CONDITION_GRAPH_CENTER_X;
|
|
|
|
positions[GRAPH_COOL].y = CONDITION_GRAPH_CENTER_Y - lineLength;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
sinIdx = 64;
|
2021-11-11 00:52:30 +01:00
|
|
|
posIdx = GRAPH_COOL;
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = 1; i < CONDITION_COUNT; i++)
|
2019-03-22 17:27:18 +01:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
sinIdx += 51;
|
2021-11-11 00:52:30 +01:00
|
|
|
if (--posIdx < 0)
|
|
|
|
posIdx = CONDITION_COUNT - 1;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
if (posIdx == GRAPH_CUTE)
|
2021-11-10 02:02:12 +01:00
|
|
|
sinIdx++;
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
lineLength = sConditionToLineLength[*(conditions++)];
|
|
|
|
positions[posIdx].x = CONDITION_GRAPH_CENTER_X + ((lineLength * gSineTable[64 + sinIdx]) >> 8);
|
|
|
|
positions[posIdx].y = CONDITION_GRAPH_CENTER_Y - ((lineLength * gSineTable[sinIdx]) >> 8);
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
if (posIdx <= GRAPH_CUTE && (lineLength != 32 || posIdx != GRAPH_CUTE))
|
|
|
|
positions[posIdx].x++;
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
//----------------
|
|
|
|
// Move relearner
|
|
|
|
//----------------
|
|
|
|
|
2019-03-08 07:56:38 +01:00
|
|
|
void InitMoveRelearnerWindows(bool8 useContextWindow)
|
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
InitWindows(sMoveRelearnerWindowTemplates);
|
2019-03-08 07:56:38 +01:00
|
|
|
DeactivateAllTextPrinters();
|
|
|
|
LoadUserWindowBorderGfx(0, 1, 0xE0);
|
2021-10-26 22:52:23 +02:00
|
|
|
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
|
2019-03-22 17:27:18 +01:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = 0; i < ARRAY_COUNT(sMoveRelearnerWindowTemplates) - 1; i++)
|
2019-03-08 10:02:05 +01:00
|
|
|
FillWindowPixelBuffer(i, PIXEL_FILL(1));
|
2019-03-08 07:56:38 +01:00
|
|
|
|
|
|
|
if (!useContextWindow)
|
|
|
|
{
|
|
|
|
PutWindowTilemap(0);
|
2022-07-25 20:59:14 +02:00
|
|
|
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 0x1, 0xE);
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PutWindowTilemap(1);
|
2022-07-25 20:59:14 +02:00
|
|
|
DrawStdFrameWithCustomTileAndPalette(1, FALSE, 1, 0xE);
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
PutWindowTilemap(2);
|
|
|
|
PutWindowTilemap(3);
|
2022-07-25 20:59:14 +02:00
|
|
|
DrawStdFrameWithCustomTileAndPalette(2, FALSE, 1, 0xE);
|
|
|
|
DrawStdFrameWithCustomTileAndPalette(3, FALSE, 1, 0xE);
|
2021-11-10 02:02:12 +01:00
|
|
|
MoveRelearnerDummy();
|
2020-05-14 10:37:09 +02:00
|
|
|
ScheduleBgCopyTilemapToVram(1);
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
static void MoveRelearnerDummy(void)
|
2019-03-08 07:56:38 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices)
|
|
|
|
{
|
2019-03-08 08:10:44 +01:00
|
|
|
gMultiuseListMenuTemplate = sMoveRelearnerMovesListTemplate;
|
2019-03-08 07:56:38 +01:00
|
|
|
gMultiuseListMenuTemplate.totalItems = numChoices;
|
|
|
|
gMultiuseListMenuTemplate.items = items;
|
|
|
|
|
|
|
|
if (numChoices < 6)
|
|
|
|
gMultiuseListMenuTemplate.maxShowed = numChoices;
|
|
|
|
else
|
|
|
|
gMultiuseListMenuTemplate.maxShowed = 6;
|
2021-11-10 02:02:12 +01:00
|
|
|
|
2019-03-08 07:56:38 +01:00
|
|
|
return gMultiuseListMenuTemplate.maxShowed;
|
|
|
|
}
|
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
static void MoveRelearnerLoadBattleMoveDescription(u32 chosenMove)
|
2019-03-08 07:56:38 +01:00
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
s32 x;
|
2019-03-08 07:56:38 +01:00
|
|
|
const struct BattleMove *move;
|
2021-11-10 02:02:12 +01:00
|
|
|
u8 buffer[32];
|
2019-03-22 17:27:18 +01:00
|
|
|
const u8 *str;
|
2019-03-08 07:56:38 +01:00
|
|
|
|
2019-03-08 10:02:05 +01:00
|
|
|
FillWindowPixelBuffer(0, PIXEL_FILL(1));
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gText_MoveRelearnerBattleMoves;
|
2021-10-30 22:47:37 +02:00
|
|
|
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gText_MoveRelearnerPP;
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x29, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gText_MoveRelearnerPower;
|
2021-10-30 22:47:37 +02:00
|
|
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x19, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gText_MoveRelearnerAccuracy;
|
2021-10-30 22:47:37 +02:00
|
|
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x6A);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, str, x, 0x29, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
if (chosenMove == LIST_CANCEL)
|
|
|
|
{
|
2021-11-03 20:29:18 +01:00
|
|
|
CopyWindowToVram(0, COPYWIN_GFX);
|
2019-03-08 07:56:38 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
move = &gBattleMoves[chosenMove];
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gTypeNames[move->type];
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, str, 4, 0x19, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
2021-10-30 22:47:37 +02:00
|
|
|
x = 4 + GetStringWidth(FONT_NORMAL, gText_MoveRelearnerPP, 0);
|
2019-09-30 21:43:44 +02:00
|
|
|
ConvertIntToDecimalStringN(buffer, move->pp, STR_CONV_MODE_LEFT_ALIGN, 2);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, buffer, x, 0x29, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
|
|
|
if (move->power < 2)
|
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gText_ThreeDashes;
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-30 21:43:44 +02:00
|
|
|
ConvertIntToDecimalStringN(buffer, move->power, STR_CONV_MODE_LEFT_ALIGN, 3);
|
2019-03-22 17:27:18 +01:00
|
|
|
str = buffer;
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x19, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
|
|
|
if (move->accuracy == 0)
|
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gText_ThreeDashes;
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-30 21:43:44 +02:00
|
|
|
ConvertIntToDecimalStringN(buffer, move->accuracy, STR_CONV_MODE_LEFT_ALIGN, 3);
|
2019-03-22 17:27:18 +01:00
|
|
|
str = buffer;
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(0, FONT_NORMAL, str, 0x6A, 0x29, TEXT_SKIP_DRAW, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
|
|
|
|
str = gMoveDescriptionPointers[chosenMove - 1];
|
2021-10-30 22:47:37 +02:00
|
|
|
AddTextPrinterParameterized(0, FONT_NARROW, str, 0, 0x41, 0, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
static void MoveRelearnerMenuLoadContestMoveDescription(u32 chosenMove)
|
2019-03-08 07:56:38 +01:00
|
|
|
{
|
2019-03-22 17:27:18 +01:00
|
|
|
s32 x;
|
|
|
|
const u8 *str;
|
2019-03-08 07:56:38 +01:00
|
|
|
const struct ContestMove *move;
|
|
|
|
|
|
|
|
MoveRelearnerShowHideHearts(chosenMove);
|
2019-03-08 10:02:05 +01:00
|
|
|
FillWindowPixelBuffer(1, PIXEL_FILL(1));
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gText_MoveRelearnerContestMovesTitle;
|
2021-10-30 22:47:37 +02:00
|
|
|
x = GetStringCenterAlignXOffset(FONT_NORMAL, str, 0x80);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 1, TEXT_SKIP_DRAW, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
|
|
|
|
str = gText_MoveRelearnerAppeal;
|
2021-10-30 22:47:37 +02:00
|
|
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x19, TEXT_SKIP_DRAW, NULL);
|
2019-03-22 17:27:18 +01:00
|
|
|
|
|
|
|
str = gText_MoveRelearnerJam;
|
2021-10-30 22:47:37 +02:00
|
|
|
x = GetStringRightAlignXOffset(FONT_NORMAL, str, 0x5C);
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(1, FONT_NORMAL, str, x, 0x29, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
|
|
|
if (chosenMove == MENU_NOTHING_CHOSEN)
|
|
|
|
{
|
2021-11-03 20:29:18 +01:00
|
|
|
CopyWindowToVram(1, COPYWIN_GFX);
|
2019-03-08 07:56:38 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
move = &gContestMoves[chosenMove];
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gContestMoveTypeTextPointers[move->contestCategory];
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(1, FONT_NORMAL, str, 4, 0x19, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
2019-03-22 17:27:18 +01:00
|
|
|
str = gContestEffectDescriptionPointers[move->effect];
|
2021-11-03 23:29:18 +01:00
|
|
|
AddTextPrinterParameterized(1, FONT_NARROW, str, 0, 0x41, TEXT_SKIP_DRAW, NULL);
|
2019-03-08 07:56:38 +01:00
|
|
|
|
2021-11-03 20:29:18 +01:00
|
|
|
CopyWindowToVram(1, COPYWIN_GFX);
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list)
|
2019-03-08 07:56:38 +01:00
|
|
|
{
|
|
|
|
if (onInit != TRUE)
|
|
|
|
PlaySE(SE_SELECT);
|
|
|
|
MoveRelearnerLoadBattleMoveDescription(itemIndex);
|
|
|
|
MoveRelearnerMenuLoadContestMoveDescription(itemIndex);
|
|
|
|
}
|
|
|
|
|
2019-03-08 08:10:44 +01:00
|
|
|
void MoveRelearnerPrintText(u8 *str)
|
2019-03-08 07:56:38 +01:00
|
|
|
{
|
|
|
|
u8 speed;
|
|
|
|
|
2019-03-08 10:02:05 +01:00
|
|
|
FillWindowPixelBuffer(3, PIXEL_FILL(1));
|
2019-03-08 07:56:38 +01:00
|
|
|
gTextFlags.canABSpeedUpPrint = TRUE;
|
|
|
|
speed = GetPlayerTextSpeedDelay();
|
2021-10-30 22:47:37 +02:00
|
|
|
AddTextPrinterParameterized2(3, FONT_NORMAL, str, speed, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, 3);
|
2019-03-08 07:56:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool16 MoveRelearnerRunTextPrinters(void)
|
|
|
|
{
|
|
|
|
RunTextPrinters();
|
|
|
|
return IsTextPrinterActive(3);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MoveRelearnerCreateYesNoMenu(void)
|
|
|
|
{
|
2019-03-08 08:10:44 +01:00
|
|
|
CreateYesNoMenu(&sMoveRelearnerYesNoMenuTemplate, 1, 0xE, 0);
|
2019-03-22 17:27:18 +01:00
|
|
|
}
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
//----------------
|
|
|
|
// Condition menu
|
|
|
|
//----------------
|
|
|
|
|
2019-03-31 12:59:01 +02:00
|
|
|
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst)
|
|
|
|
{
|
|
|
|
s32 ret;
|
|
|
|
|
|
|
|
if (boxId == TOTAL_BOXES_COUNT) // Party mon.
|
|
|
|
{
|
|
|
|
if (request == MON_DATA_NICKNAME || request == MON_DATA_OT_NAME)
|
|
|
|
ret = GetMonData(&gPlayerParty[monId], request, dst);
|
|
|
|
else
|
|
|
|
ret = GetMonData(&gPlayerParty[monId], request);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (request == MON_DATA_NICKNAME || request == MON_DATA_OT_NAME)
|
|
|
|
ret = GetAndCopyBoxMonDataAt(boxId, monId, request, dst);
|
|
|
|
else
|
|
|
|
ret = GetBoxMonDataAt(boxId, monId, request);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
// Gets the name/gender/level string for the condition menu
|
|
|
|
static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2020-09-19 23:38:54 +02:00
|
|
|
u16 box, mon, species, level, gender;
|
2019-03-31 12:59:01 +02:00
|
|
|
struct BoxPokemon *boxMon;
|
|
|
|
u8 *str;
|
|
|
|
|
2020-09-19 23:38:54 +02:00
|
|
|
box = boxId;
|
|
|
|
mon = monId;
|
2019-03-31 12:59:01 +02:00
|
|
|
*(dst++) = EXT_CTRL_CODE_BEGIN;
|
2020-08-10 23:05:42 +02:00
|
|
|
*(dst++) = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
|
|
|
|
*(dst++) = TEXT_COLOR_BLUE;
|
|
|
|
*(dst++) = TEXT_COLOR_TRANSPARENT;
|
|
|
|
*(dst++) = TEXT_COLOR_LIGHT_BLUE;
|
2020-09-19 23:38:54 +02:00
|
|
|
if (GetBoxOrPartyMonData(box, mon, MON_DATA_IS_EGG, NULL))
|
2019-03-31 12:59:01 +02:00
|
|
|
return StringCopyPadded(dst, gText_EggNickname, 0, 12);
|
2020-09-19 23:38:54 +02:00
|
|
|
GetBoxOrPartyMonData(box, mon, MON_DATA_NICKNAME, dst);
|
2021-11-18 04:11:03 +01:00
|
|
|
StringGet_Nickname(dst);
|
2020-09-19 23:38:54 +02:00
|
|
|
species = GetBoxOrPartyMonData(box, mon, MON_DATA_SPECIES, NULL);
|
|
|
|
if (box == TOTAL_BOXES_COUNT) // Party mon.
|
2020-08-28 20:35:37 +02:00
|
|
|
{
|
2020-09-19 23:38:54 +02:00
|
|
|
level = GetMonData(&gPlayerParty[mon], MON_DATA_LEVEL);
|
|
|
|
gender = GetMonGender(&gPlayerParty[mon]);
|
2020-08-28 20:35:37 +02:00
|
|
|
}
|
2019-03-31 12:59:01 +02:00
|
|
|
else
|
|
|
|
{
|
2020-12-11 05:30:52 +01:00
|
|
|
boxMon = GetBoxedMonPtr(box, mon);
|
2020-08-28 20:35:37 +02:00
|
|
|
gender = GetBoxMonGender(boxMon);
|
|
|
|
level = GetLevelFromBoxMonExp(boxMon);
|
|
|
|
}
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-12-15 03:44:25 +01:00
|
|
|
if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(dst, gSpeciesNames[species]))
|
|
|
|
gender = MON_GENDERLESS;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-12-15 03:44:25 +01:00
|
|
|
for (str = dst; *str != EOS; str++)
|
|
|
|
;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-12-15 03:44:25 +01:00
|
|
|
*(str++) = EXT_CTRL_CODE_BEGIN;
|
|
|
|
*(str++) = EXT_CTRL_CODE_SKIP;
|
|
|
|
*(str++) = 60;
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
|
2020-12-15 03:44:25 +01:00
|
|
|
switch (gender)
|
|
|
|
{
|
|
|
|
default:
|
Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some
harmless or completely superseded PRs have been left alone, as there is not
much benefit in attempting to undo them.
Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136,
#1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179,
#1180, #1181, #1182 and #1183.
2020-09-13 09:22:50 +02:00
|
|
|
*(str++) = CHAR_SPACE;
|
2020-12-15 03:44:25 +01:00
|
|
|
break;
|
|
|
|
case MON_MALE:
|
|
|
|
*(str++) = EXT_CTRL_CODE_BEGIN;
|
|
|
|
*(str++) = EXT_CTRL_CODE_COLOR;
|
|
|
|
*(str++) = TEXT_COLOR_RED;
|
|
|
|
*(str++) = EXT_CTRL_CODE_BEGIN;
|
|
|
|
*(str++) = EXT_CTRL_CODE_SHADOW;
|
|
|
|
*(str++) = TEXT_COLOR_LIGHT_RED;
|
|
|
|
*(str++) = CHAR_MALE;
|
|
|
|
break;
|
|
|
|
case MON_FEMALE:
|
|
|
|
*(str++) = EXT_CTRL_CODE_BEGIN;
|
|
|
|
*(str++) = EXT_CTRL_CODE_COLOR;
|
|
|
|
*(str++) = TEXT_COLOR_GREEN;
|
|
|
|
*(str++) = EXT_CTRL_CODE_BEGIN;
|
|
|
|
*(str++) = EXT_CTRL_CODE_SHADOW;
|
|
|
|
*(str++) = TEXT_COLOR_LIGHT_GREEN;
|
|
|
|
*(str++) = CHAR_FEMALE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
*(str++) = EXT_CTRL_CODE_BEGIN;
|
|
|
|
*(str++) = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
|
|
|
|
*(str++) = TEXT_COLOR_BLUE;
|
|
|
|
*(str++) = TEXT_COLOR_TRANSPARENT;
|
|
|
|
*(str++) = TEXT_COLOR_LIGHT_BLUE;
|
|
|
|
*(str++) = CHAR_SLASH;
|
|
|
|
*(str++) = CHAR_EXTRA_SYMBOL;
|
|
|
|
*(str++) = CHAR_LV_2;
|
|
|
|
str = ConvertIntToDecimalStringN(str, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
|
|
|
*(str++) = CHAR_SPACE;
|
|
|
|
*str = EOS;
|
|
|
|
|
|
|
|
return str;
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
// Buffers the string in src to dest up to n chars. If src is less than n chars, fill with spaces
|
|
|
|
static u8 *BufferConditionMenuSpacedStringN(u8 *dst, const u8 *src, s16 n)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
while (*src != EOS)
|
|
|
|
{
|
|
|
|
*(dst++) = *(src++);
|
|
|
|
n--;
|
|
|
|
}
|
|
|
|
while (n-- > 0)
|
|
|
|
*(dst++) = CHAR_SPACE;
|
|
|
|
|
|
|
|
*dst = EOS;
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
u16 i;
|
2020-09-19 23:38:54 +02:00
|
|
|
u16 box = boxId;
|
|
|
|
u16 mon = monId;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
// In this and the below 2 functions, numMons is passed as the number of menu selections (which includes Cancel)
|
2020-08-10 23:05:42 +02:00
|
|
|
// To indicate that the Cancel needs to be subtracted they pass an additional bool
|
|
|
|
// Unclear why they didn't just subtract 1 when it gets passed instead
|
|
|
|
if (!excludesCancel)
|
|
|
|
numMons--;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
if (partyId != numMons)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2020-09-19 23:38:54 +02:00
|
|
|
GetConditionMenuMonString(nameDst, box, mon);
|
2020-08-10 23:05:42 +02:00
|
|
|
locationDst[0] = EXT_CTRL_CODE_BEGIN;
|
|
|
|
locationDst[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
|
|
|
|
locationDst[2] = TEXT_COLOR_BLUE;
|
|
|
|
locationDst[3] = TEXT_COLOR_TRANSPARENT;
|
|
|
|
locationDst[4] = TEXT_COLOR_LIGHT_BLUE;
|
2020-09-19 23:38:54 +02:00
|
|
|
if (box == TOTAL_BOXES_COUNT) // Party mon.
|
2020-08-10 23:05:42 +02:00
|
|
|
BufferConditionMenuSpacedStringN(&locationDst[5], gText_InParty, 8);
|
2019-03-31 12:59:01 +02:00
|
|
|
else
|
2021-09-26 22:20:39 +02:00
|
|
|
BufferConditionMenuSpacedStringN(&locationDst[5], GetBoxNamePtr(box), BOX_NAME_LENGTH);
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-10 23:05:42 +02:00
|
|
|
for (i = 0; i < POKEMON_NAME_LENGTH + 2; i++)
|
2019-03-31 12:59:01 +02:00
|
|
|
nameDst[i] = CHAR_SPACE;
|
|
|
|
nameDst[i] = EOS;
|
|
|
|
for (i = 0; i < 8; i++)
|
2020-08-10 23:05:42 +02:00
|
|
|
locationDst[i] = CHAR_SPACE;
|
|
|
|
locationDst[i] = EOS;
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
void GetConditionMenuMonConditions(struct ConditionGraph *graph, u8 *numSparkles, u16 boxId, u16 monId, u16 partyId, u16 id, u16 numMons, bool8 excludesCancel)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
if (!excludesCancel)
|
|
|
|
numMons--;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
if (partyId != numMons)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->conditions[id][CONDITION_COOL] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
|
|
|
|
graph->conditions[id][CONDITION_TOUGH] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
|
|
|
|
graph->conditions[id][CONDITION_SMART] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
|
|
|
|
graph->conditions[id][CONDITION_CUTE] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
|
|
|
|
graph->conditions[id][CONDITION_BEAUTY] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2021-11-10 02:02:12 +01:00
|
|
|
numSparkles[id] = GET_NUM_CONDITION_SPARKLES(GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL));
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
ConditionGraph_CalcPositions(graph->conditions[id], graph->savedPositions[id]);
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
for (i = 0; i < CONDITION_COUNT; i++)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2021-11-10 02:02:12 +01:00
|
|
|
graph->conditions[id][i] = 0;
|
2021-11-11 00:52:30 +01:00
|
|
|
graph->savedPositions[id][i].x = CONDITION_GRAPH_CENTER_X;
|
|
|
|
graph->savedPositions[id][i].y = CONDITION_GRAPH_CENTER_Y;
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
void GetConditionMenuMonGfx(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2020-08-10 23:05:42 +02:00
|
|
|
if (!excludesCancel)
|
|
|
|
numMons--;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
if (partyId != numMons)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
u16 species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL);
|
|
|
|
u32 trainerId = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
|
|
|
|
u32 personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL);
|
|
|
|
|
|
|
|
LoadSpecialPokePic(&gMonFrontPicTable[species], tilesDst, species, personality, TRUE);
|
2019-07-25 18:56:08 +02:00
|
|
|
LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst);
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
bool8 MoveConditionMonOnscreen(s16 *x)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
*x += 24;
|
|
|
|
if (*x > 0)
|
|
|
|
*x = 0;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
return (*x != 0);
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
bool8 MoveConditionMonOffscreen(s16 *x)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
*x -= 24;
|
|
|
|
if (*x < -80)
|
|
|
|
*x = -80;
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
return (*x != -80);
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
bool8 ConditionMenu_UpdateMonEnter(struct ConditionGraph *graph, s16 *x)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
bool8 graphUpdating = ConditionGraph_TryUpdate(graph);
|
2020-08-12 17:44:39 +02:00
|
|
|
bool8 monUpdating = MoveConditionMonOnscreen(x);
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
return (graphUpdating || monUpdating);
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
|
2021-11-11 00:52:30 +01:00
|
|
|
bool8 ConditionMenu_UpdateMonExit(struct ConditionGraph *graph, s16 *x)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2021-11-11 00:52:30 +01:00
|
|
|
bool8 graphUpdating = ConditionGraph_TryUpdate(graph);
|
2020-08-12 17:44:39 +02:00
|
|
|
bool8 monUpdating = MoveConditionMonOffscreen(x);
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
return (graphUpdating || monUpdating);
|
2019-03-31 12:59:01 +02:00
|
|
|
}
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
static const u32 sConditionPokeball_Gfx[] = INCBIN_U32("graphics/pokenav/condition/pokeball.4bpp");
|
|
|
|
static const u32 sConditionPokeballPlaceholder_Gfx[] = INCBIN_U32("graphics/pokenav/condition/pokeball_placeholder.4bpp");
|
|
|
|
static const u16 sConditionSparkle_Gfx[] = INCBIN_U16("graphics/pokenav/condition/sparkle.gbapal");
|
|
|
|
static const u32 sConditionSparkle_Pal[] = INCBIN_U32("graphics/pokenav/condition/sparkle.4bpp");
|
2019-03-31 12:59:01 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static const struct OamData sOam_ConditionMonPic =
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
.y = 0,
|
2019-12-04 21:25:13 +01:00
|
|
|
.affineMode = ST_OAM_AFFINE_OFF,
|
|
|
|
.objMode = ST_OAM_OBJ_NORMAL,
|
2022-07-30 03:27:39 +02:00
|
|
|
.mosaic = FALSE,
|
2019-12-04 21:25:13 +01:00
|
|
|
.bpp = ST_OAM_4BPP,
|
|
|
|
.shape = SPRITE_SHAPE(64x64),
|
2019-03-31 12:59:01 +02:00
|
|
|
.x = 0,
|
|
|
|
.matrixNum = 0,
|
2019-12-04 21:25:13 +01:00
|
|
|
.size = SPRITE_SIZE(64x64),
|
2019-03-31 12:59:01 +02:00
|
|
|
.tileNum = 0,
|
|
|
|
.priority = 1,
|
|
|
|
.paletteNum = 0,
|
|
|
|
.affineParam = 0
|
|
|
|
};
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static const struct OamData sOam_ConditionSelectionIcon =
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
.y = 0,
|
2019-12-04 21:25:13 +01:00
|
|
|
.affineMode = ST_OAM_AFFINE_OFF,
|
|
|
|
.objMode = ST_OAM_OBJ_NORMAL,
|
2022-07-30 03:27:39 +02:00
|
|
|
.mosaic = FALSE,
|
2019-12-04 21:25:13 +01:00
|
|
|
.bpp = ST_OAM_4BPP,
|
|
|
|
.shape = SPRITE_SHAPE(16x16),
|
2019-03-31 12:59:01 +02:00
|
|
|
.x = 0,
|
|
|
|
.matrixNum = 0,
|
2019-12-04 21:25:13 +01:00
|
|
|
.size = SPRITE_SIZE(16x16),
|
2019-03-31 12:59:01 +02:00
|
|
|
.tileNum = 0,
|
|
|
|
.priority = 2,
|
|
|
|
.paletteNum = 0,
|
|
|
|
.affineParam = 0
|
|
|
|
};
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static const union AnimCmd sAnim_ConditionSelectionIcon_Selected[] =
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_END
|
|
|
|
};
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static const union AnimCmd sAnim_ConditionSelectionIcon_Unselected[] =
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(4, 5),
|
|
|
|
ANIMCMD_END
|
|
|
|
};
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static const union AnimCmd *const sAnims_ConditionSelectionIcon[] =
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2021-11-11 22:50:36 +01:00
|
|
|
[CONDITION_ICON_SELECTED] = sAnim_ConditionSelectionIcon_Selected,
|
|
|
|
[CONDITION_ICON_UNSELECTED] = sAnim_ConditionSelectionIcon_Unselected
|
2019-03-31 12:59:01 +02:00
|
|
|
};
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
// Just loads the generic data, up to the caller to load the actual sheet/pal for the specific mon
|
|
|
|
void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2021-03-29 15:38:19 +02:00
|
|
|
struct SpriteSheet dataSheet = {NULL, MON_PIC_SIZE, TAG_CONDITION_MON};
|
2019-03-31 12:59:01 +02:00
|
|
|
|
|
|
|
struct SpriteTemplate dataTemplate =
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
.tileTag = TAG_CONDITION_MON,
|
|
|
|
.paletteTag = TAG_CONDITION_MON,
|
|
|
|
.oam = &sOam_ConditionMonPic,
|
2019-03-31 12:59:01 +02:00
|
|
|
.anims = gDummySpriteAnimTable,
|
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = SpriteCallbackDummy,
|
|
|
|
};
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
struct SpritePalette dataPal = {NULL, TAG_CONDITION_MON};
|
2019-03-31 12:59:01 +02:00
|
|
|
|
|
|
|
*sheet = dataSheet;
|
|
|
|
*template = dataTemplate;
|
|
|
|
*pal = dataPal;
|
|
|
|
}
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
|
|
|
struct SpriteSheet dataSheets[] =
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
{sConditionPokeball_Gfx, 0x100, TAG_CONDITION_BALL},
|
|
|
|
{sConditionPokeballPlaceholder_Gfx, 0x20, TAG_CONDITION_BALL_PLACEHOLDER},
|
|
|
|
{gPokenavConditionCancel_Gfx, 0x100, TAG_CONDITION_CANCEL},
|
2019-03-31 12:59:01 +02:00
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SpritePalette dataPals[] =
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
{gPokenavConditionCancel_Pal, TAG_CONDITION_BALL},
|
|
|
|
{gPokenavConditionCancel_Pal + 16, TAG_CONDITION_CANCEL},
|
2019-03-31 12:59:01 +02:00
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
// Tag is overwritten for the other selection icons
|
2019-03-31 12:59:01 +02:00
|
|
|
struct SpriteTemplate dataTemplate =
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
.tileTag = TAG_CONDITION_BALL,
|
|
|
|
.paletteTag = TAG_CONDITION_BALL,
|
|
|
|
.oam = &sOam_ConditionSelectionIcon,
|
|
|
|
.anims = sAnims_ConditionSelectionIcon,
|
2019-03-31 12:59:01 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
|
|
|
.callback = SpriteCallbackDummy,
|
|
|
|
};
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_COUNT(dataSheets); i++)
|
|
|
|
*(sheets++) = dataSheets[i];
|
|
|
|
|
|
|
|
*template = dataTemplate;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_COUNT(dataPals); i++)
|
|
|
|
*(pals++) = dataPals[i];
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
#define sSparkleId data[0]
|
|
|
|
#define sDelayTimer data[1]
|
|
|
|
#define sNumExtraSparkles data[2]
|
|
|
|
#define sCurSparkleId data[3]
|
|
|
|
#define sMonSpriteId data[4]
|
|
|
|
#define sNextSparkleSpriteId data[5]
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
void LoadConditionSparkle(struct SpriteSheet *sheet, struct SpritePalette *pal)
|
2019-03-31 12:59:01 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
struct SpriteSheet dataSheet = {sConditionSparkle_Pal, 0x380, TAG_CONDITION_SPARKLE};
|
|
|
|
struct SpritePalette dataPal = {sConditionSparkle_Gfx, TAG_CONDITION_SPARKLE};
|
2019-03-31 12:59:01 +02:00
|
|
|
|
|
|
|
*sheet = dataSheet;
|
|
|
|
*pal = dataPal;
|
|
|
|
}
|
2019-03-31 14:32:26 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static void SpriteCB_ConditionSparkle_DoNextAfterDelay(struct Sprite *sprite)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
if (++sprite->sDelayTimer > 60)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
sprite->sDelayTimer = 0;
|
|
|
|
SetNextConditionSparkle(sprite);
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static void SpriteCB_ConditionSparkle_WaitForAllAnim(struct Sprite *sprite)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
if (sprite->animEnded)
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
sprite->sDelayTimer = 0;
|
|
|
|
sprite->callback = SpriteCB_ConditionSparkle_DoNextAfterDelay;
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
static const struct OamData sOam_ConditionSparkle =
|
2019-04-04 21:24:21 +02:00
|
|
|
{
|
|
|
|
.y = 0,
|
2019-04-05 09:22:56 +02:00
|
|
|
.affineMode = ST_OAM_AFFINE_OFF,
|
|
|
|
.objMode = ST_OAM_OBJ_NORMAL,
|
|
|
|
.bpp = ST_OAM_4BPP,
|
|
|
|
.shape = SPRITE_SHAPE(16x16),
|
2019-04-04 21:24:21 +02:00
|
|
|
.x = 0,
|
2019-04-05 09:22:56 +02:00
|
|
|
.size = SPRITE_SIZE(16x16),
|
2019-04-04 21:24:21 +02:00
|
|
|
.priority = 0,
|
|
|
|
};
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
static const union AnimCmd sAnim_ConditionSparkle[] =
|
2019-04-04 21:24:21 +02:00
|
|
|
{
|
|
|
|
ANIMCMD_FRAME(0, 5),
|
|
|
|
ANIMCMD_FRAME(4, 5),
|
|
|
|
ANIMCMD_FRAME(8, 5),
|
|
|
|
ANIMCMD_FRAME(12, 5),
|
|
|
|
ANIMCMD_FRAME(16, 5),
|
|
|
|
ANIMCMD_FRAME(20, 5),
|
|
|
|
ANIMCMD_FRAME(24, 5),
|
|
|
|
ANIMCMD_END
|
|
|
|
};
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
static const union AnimCmd *const sAnims_ConditionSparkle[] =
|
2019-04-04 21:24:21 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
&sAnim_ConditionSparkle[0], // Only this entry is used
|
|
|
|
&sAnim_ConditionSparkle[2],
|
|
|
|
&sAnim_ConditionSparkle[4],
|
|
|
|
&sAnim_ConditionSparkle[6],
|
|
|
|
&sAnim_ConditionSparkle[8], // Here below OOB, will crash if used
|
|
|
|
&sAnim_ConditionSparkle[10],
|
|
|
|
&sAnim_ConditionSparkle[12],
|
2019-04-04 21:24:21 +02:00
|
|
|
};
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
static const struct SpriteTemplate sSpriteTemplate_ConditionSparkle =
|
2019-04-04 21:24:21 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
.tileTag = TAG_CONDITION_SPARKLE,
|
|
|
|
.paletteTag = TAG_CONDITION_SPARKLE,
|
2020-08-10 19:48:16 +02:00
|
|
|
.oam = &sOam_ConditionSparkle,
|
|
|
|
.anims = sAnims_ConditionSparkle,
|
2019-04-04 21:24:21 +02:00
|
|
|
.images = NULL,
|
|
|
|
.affineAnims = gDummySpriteAffineAnimTable,
|
2020-08-10 19:48:16 +02:00
|
|
|
.callback = SpriteCB_ConditionSparkle,
|
2019-04-04 21:24:21 +02:00
|
|
|
};
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static const s16 sConditionSparkleCoords[MAX_CONDITION_SPARKLES][2] =
|
|
|
|
{
|
|
|
|
{ 0, -35},
|
|
|
|
{ 20, -28},
|
|
|
|
{ 33, -10},
|
|
|
|
{ 33, 10},
|
|
|
|
{ 20, 28},
|
|
|
|
{ 0, 35},
|
|
|
|
{-20, 28},
|
|
|
|
{-33, 10},
|
|
|
|
{-33, -10},
|
|
|
|
{-20, -28},
|
2019-04-04 21:24:21 +02:00
|
|
|
};
|
2019-03-31 14:32:26 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static void SetConditionSparklePosition(struct Sprite *sprite)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
struct Sprite *mon = &gSprites[sprite->sMonSpriteId];
|
2019-03-31 14:32:26 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
if (mon != NULL)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = mon->x + mon->x2 + sConditionSparkleCoords[sprite->sSparkleId][0];
|
|
|
|
sprite->y = mon->y + mon->y2 + sConditionSparkleCoords[sprite->sSparkleId][1];
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-07-07 15:11:52 +02:00
|
|
|
sprite->x = sConditionSparkleCoords[sprite->sSparkleId][0] + 40;
|
|
|
|
sprite->y = sConditionSparkleCoords[sprite->sSparkleId][1] + 104;
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static void InitConditionSparkles(u8 count, bool8 allowFirstShowAll, struct Sprite **sprites)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
for (i = 0; i < MAX_CONDITION_SPARKLES; i++)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
if (sprites[i] != NULL)
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
sprites[i]->sSparkleId = i;
|
|
|
|
sprites[i]->sDelayTimer = (i * 16) + 1;
|
|
|
|
sprites[i]->sNumExtraSparkles = count;
|
|
|
|
sprites[i]->sCurSparkleId = i;
|
|
|
|
if (!allowFirstShowAll || count != MAX_CONDITION_SPARKLES - 1)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-10 19:48:16 +02:00
|
|
|
sprites[i]->callback = SpriteCB_ConditionSparkle;
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
SetConditionSparklePosition(sprites[i]);
|
|
|
|
ShowAllConditionSparkles(sprites[i]);
|
|
|
|
sprites[i]->callback = SpriteCB_ConditionSparkle_WaitForAllAnim;
|
2019-03-31 14:32:26 +02:00
|
|
|
sprites[i]->invisible = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static void SetNextConditionSparkle(struct Sprite *sprite)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
u16 i;
|
2020-08-12 17:44:39 +02:00
|
|
|
u8 id = sprite->sNextSparkleSpriteId;
|
|
|
|
for (i = 0; i < sprite->sNumExtraSparkles + 1; i++)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
gSprites[id].sDelayTimer = (gSprites[id].sSparkleId * 16) + 1;
|
2020-08-10 19:48:16 +02:00
|
|
|
gSprites[id].callback = SpriteCB_ConditionSparkle;
|
2020-08-12 17:44:39 +02:00
|
|
|
id = gSprites[id].sNextSparkleSpriteId;
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
void ResetConditionSparkleSprites(struct Sprite **sprites)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
u8 i;
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
for (i = 0; i < MAX_CONDITION_SPARKLES; i++)
|
2019-03-31 14:32:26 +02:00
|
|
|
sprites[i] = NULL;
|
|
|
|
}
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
void CreateConditionSparkleSprites(struct Sprite **sprites, u8 monSpriteId, u8 _count)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
u16 i, spriteId, firstSpriteId = 0;
|
2020-08-10 19:48:16 +02:00
|
|
|
u8 count = _count;
|
2019-03-31 14:32:26 +02:00
|
|
|
|
|
|
|
for (i = 0; i < count + 1; i++)
|
|
|
|
{
|
2020-08-10 19:48:16 +02:00
|
|
|
spriteId = CreateSprite(&sSpriteTemplate_ConditionSparkle, 0, 0, 0);
|
2019-03-31 14:32:26 +02:00
|
|
|
if (spriteId != MAX_SPRITES)
|
|
|
|
{
|
|
|
|
sprites[i] = &gSprites[spriteId];
|
|
|
|
sprites[i]->invisible = TRUE;
|
2020-08-12 17:44:39 +02:00
|
|
|
sprites[i]->sMonSpriteId = monSpriteId;
|
2019-03-31 14:32:26 +02:00
|
|
|
if (i != 0)
|
2020-08-12 17:44:39 +02:00
|
|
|
sprites[i - 1]->sNextSparkleSpriteId = spriteId;
|
2019-03-31 14:32:26 +02:00
|
|
|
else
|
|
|
|
firstSpriteId = spriteId;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
sprites[count]->sNextSparkleSpriteId = firstSpriteId;
|
|
|
|
InitConditionSparkles(count, TRUE, sprites);
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
void DestroyConditionSparkleSprites(struct Sprite **sprites)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
u16 i;
|
|
|
|
|
2020-08-10 23:05:42 +02:00
|
|
|
for (i = 0; i < MAX_CONDITION_SPARKLES; i++)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
if (sprites[i] != NULL)
|
|
|
|
{
|
|
|
|
DestroySprite(sprites[i]);
|
|
|
|
sprites[i] = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
void FreeConditionSparkles(struct Sprite **sprites)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-10 19:48:16 +02:00
|
|
|
DestroyConditionSparkleSprites(sprites);
|
2020-08-12 17:44:39 +02:00
|
|
|
FreeSpriteTilesByTag(TAG_CONDITION_SPARKLE);
|
|
|
|
FreeSpritePaletteByTag(TAG_CONDITION_SPARKLE);
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
|
2020-08-10 19:48:16 +02:00
|
|
|
static void SpriteCB_ConditionSparkle(struct Sprite *sprite)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
// Delay, then do sparkle anim
|
|
|
|
if (sprite->sDelayTimer != 0)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
if (--sprite->sDelayTimer != 0)
|
2019-03-31 14:32:26 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
SeekSpriteAnim(sprite, 0);
|
|
|
|
sprite->invisible = FALSE;
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
SetConditionSparklePosition(sprite);
|
|
|
|
|
|
|
|
// Set up next sparkle
|
2019-03-31 14:32:26 +02:00
|
|
|
if (sprite->animEnded)
|
|
|
|
{
|
|
|
|
sprite->invisible = TRUE;
|
2020-08-12 17:44:39 +02:00
|
|
|
if (sprite->sCurSparkleId == sprite->sNumExtraSparkles)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
if (sprite->sCurSparkleId == MAX_CONDITION_SPARKLES - 1)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
ShowAllConditionSparkles(sprite);
|
|
|
|
sprite->callback = SpriteCB_ConditionSparkle_WaitForAllAnim;
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
sprite->callback = SpriteCB_ConditionSparkle_DoNextAfterDelay;
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite->callback = SpriteCallbackDummy;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
static void ShowAllConditionSparkles(struct Sprite *sprite)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
2020-08-12 17:44:39 +02:00
|
|
|
u8 i, id = sprite->sNextSparkleSpriteId;
|
2019-03-31 14:32:26 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
for (i = 0; i < sprite->sNumExtraSparkles + 1; i++)
|
2019-03-31 14:32:26 +02:00
|
|
|
{
|
|
|
|
SeekSpriteAnim(&gSprites[id], 0);
|
|
|
|
gSprites[id].invisible = FALSE;
|
2020-08-12 17:44:39 +02:00
|
|
|
id = gSprites[id].sNextSparkleSpriteId;
|
2019-03-31 14:32:26 +02:00
|
|
|
}
|
|
|
|
}
|
2019-04-03 04:18:36 +02:00
|
|
|
|
2020-08-12 17:44:39 +02:00
|
|
|
#undef sSparkleId
|
|
|
|
#undef sDelayTimer
|
|
|
|
#undef sNumExtraSparkles
|
|
|
|
#undef sCurSparkleId
|
|
|
|
#undef sMonSpriteId
|
|
|
|
#undef sNextSparkleSpriteId
|
|
|
|
|
2019-12-10 19:48:20 +01:00
|
|
|
static const u8 *const sLvlUpStatStrings[NUM_STATS] =
|
2019-04-03 04:18:36 +02:00
|
|
|
{
|
2019-12-10 19:48:20 +01:00
|
|
|
gText_MaxHP,
|
|
|
|
gText_Attack,
|
|
|
|
gText_Defense,
|
|
|
|
gText_SpAtk,
|
|
|
|
gText_SpDef,
|
|
|
|
gText_Speed
|
2019-04-04 21:24:21 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void DrawLevelUpWindowPg1(u16 windowId, u16 *statsBefore, u16 *statsAfter, u8 bgClr, u8 fgClr, u8 shadowClr)
|
|
|
|
{
|
|
|
|
u16 i, x;
|
|
|
|
s16 statsDiff[NUM_STATS];
|
|
|
|
u8 text[12];
|
|
|
|
u8 color[3];
|
|
|
|
|
|
|
|
FillWindowPixelBuffer(windowId, PIXEL_FILL(bgClr));
|
|
|
|
|
|
|
|
statsDiff[0] = statsAfter[STAT_HP] - statsBefore[STAT_HP];
|
|
|
|
statsDiff[1] = statsAfter[STAT_ATK] - statsBefore[STAT_ATK];
|
|
|
|
statsDiff[2] = statsAfter[STAT_DEF] - statsBefore[STAT_DEF];
|
|
|
|
statsDiff[3] = statsAfter[STAT_SPATK] - statsBefore[STAT_SPATK];
|
|
|
|
statsDiff[4] = statsAfter[STAT_SPDEF] - statsBefore[STAT_SPDEF];
|
|
|
|
statsDiff[5] = statsAfter[STAT_SPEED] - statsBefore[STAT_SPEED];
|
|
|
|
|
|
|
|
color[0] = bgClr;
|
|
|
|
color[1] = fgClr;
|
|
|
|
color[2] = shadowClr;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_STATS; i++)
|
|
|
|
{
|
|
|
|
|
|
|
|
AddTextPrinterParameterized3(windowId,
|
2021-10-30 22:47:37 +02:00
|
|
|
FONT_NORMAL,
|
2019-04-04 21:24:21 +02:00
|
|
|
0,
|
|
|
|
15 * i,
|
|
|
|
color,
|
|
|
|
-1,
|
|
|
|
sLvlUpStatStrings[i]);
|
|
|
|
|
2019-12-10 19:48:20 +01:00
|
|
|
StringCopy(text, (statsDiff[i] >= 0) ? gText_Plus : gText_Dash);
|
2019-04-04 21:24:21 +02:00
|
|
|
AddTextPrinterParameterized3(windowId,
|
2021-10-30 22:47:37 +02:00
|
|
|
FONT_NORMAL,
|
2019-04-04 21:24:21 +02:00
|
|
|
56,
|
|
|
|
15 * i,
|
|
|
|
color,
|
|
|
|
-1,
|
|
|
|
text);
|
|
|
|
if (abs(statsDiff[i]) <= 9)
|
|
|
|
x = 18;
|
|
|
|
else
|
|
|
|
x = 12;
|
|
|
|
|
|
|
|
ConvertIntToDecimalStringN(text, abs(statsDiff[i]), STR_CONV_MODE_LEFT_ALIGN, 2);
|
|
|
|
AddTextPrinterParameterized3(windowId,
|
2021-10-30 22:47:37 +02:00
|
|
|
FONT_NORMAL,
|
2019-04-04 21:24:21 +02:00
|
|
|
56 + x,
|
|
|
|
15 * i,
|
|
|
|
color,
|
|
|
|
-1,
|
|
|
|
text);
|
2019-04-03 04:18:36 +02:00
|
|
|
}
|
|
|
|
}
|
2019-04-04 21:24:21 +02:00
|
|
|
|
|
|
|
void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 shadowClr)
|
|
|
|
{
|
|
|
|
u16 i, numDigits, x;
|
|
|
|
s16 stats[NUM_STATS];
|
|
|
|
u8 text[12];
|
|
|
|
u8 color[3];
|
|
|
|
|
|
|
|
FillWindowPixelBuffer(windowId, PIXEL_FILL(bgClr));
|
|
|
|
|
|
|
|
stats[0] = currStats[STAT_HP];
|
|
|
|
stats[1] = currStats[STAT_ATK];
|
|
|
|
stats[2] = currStats[STAT_DEF];
|
|
|
|
stats[3] = currStats[STAT_SPATK];
|
|
|
|
stats[4] = currStats[STAT_SPDEF];
|
|
|
|
stats[5] = currStats[STAT_SPEED];
|
|
|
|
|
|
|
|
color[0] = bgClr;
|
|
|
|
color[1] = fgClr;
|
|
|
|
color[2] = shadowClr;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_STATS; i++)
|
|
|
|
{
|
|
|
|
if (stats[i] > 99)
|
|
|
|
numDigits = 3;
|
|
|
|
else if (stats[i] > 9)
|
|
|
|
numDigits = 2;
|
|
|
|
else
|
|
|
|
numDigits = 1;
|
|
|
|
|
|
|
|
ConvertIntToDecimalStringN(text, stats[i], STR_CONV_MODE_LEFT_ALIGN, numDigits);
|
|
|
|
x = 6 * (4 - numDigits);
|
|
|
|
|
|
|
|
AddTextPrinterParameterized3(windowId,
|
2021-10-30 22:47:37 +02:00
|
|
|
FONT_NORMAL,
|
2019-04-04 21:24:21 +02:00
|
|
|
0,
|
|
|
|
15 * i,
|
|
|
|
color,
|
|
|
|
-1,
|
|
|
|
sLvlUpStatStrings[i]);
|
|
|
|
|
|
|
|
AddTextPrinterParameterized3(windowId,
|
2021-10-30 22:47:37 +02:00
|
|
|
FONT_NORMAL,
|
2019-04-04 21:24:21 +02:00
|
|
|
56 + x,
|
|
|
|
15 * i,
|
|
|
|
color,
|
|
|
|
-1,
|
|
|
|
text);
|
2019-04-03 04:18:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-04 21:24:21 +02:00
|
|
|
void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *currStats)
|
2019-04-03 04:18:36 +02:00
|
|
|
{
|
2019-04-04 21:24:21 +02:00
|
|
|
currStats[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP);
|
|
|
|
currStats[STAT_ATK] = GetMonData(mon, MON_DATA_ATK);
|
|
|
|
currStats[STAT_DEF] = GetMonData(mon, MON_DATA_DEF);
|
|
|
|
currStats[STAT_SPEED] = GetMonData(mon, MON_DATA_SPEED);
|
|
|
|
currStats[STAT_SPATK] = GetMonData(mon, MON_DATA_SPATK);
|
|
|
|
currStats[STAT_SPDEF] = GetMonData(mon, MON_DATA_SPDEF);
|
2019-04-03 04:18:36 +02:00
|
|
|
}
|