mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Finish condition graph doc
This commit is contained in:
parent
4590887359
commit
7efdc0902b
@ -7,6 +7,14 @@
|
|||||||
#include "pokemon.h"
|
#include "pokemon.h"
|
||||||
#include "constants/berry.h"
|
#include "constants/berry.h"
|
||||||
|
|
||||||
|
// Window IDs for the Player PC Mailbox
|
||||||
|
enum {
|
||||||
|
MAILBOXWIN_TITLE,
|
||||||
|
MAILBOXWIN_LIST,
|
||||||
|
MAILBOXWIN_OPTIONS,
|
||||||
|
MAILBOXWIN_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TAG_CONDITION_MON = 100,
|
TAG_CONDITION_MON = 100,
|
||||||
TAG_CONDITION_BALL,
|
TAG_CONDITION_BALL,
|
||||||
@ -18,34 +26,19 @@ enum {
|
|||||||
TAG_CONDITION_MARKINGS_MENU_2, // Used implicitly by CreateMonMarkingsMenuSprites
|
TAG_CONDITION_MARKINGS_MENU_2, // Used implicitly by CreateMonMarkingsMenuSprites
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define MAX_CONDITION_SPARKLES 10
|
#define MAX_CONDITION_SPARKLES 10
|
||||||
|
|
||||||
// The number of extra sparkles shown on a Pokémon's condition screen.
|
// The number of extra sparkles shown on a Pokémon's condition screen.
|
||||||
// All Pokémon start with 1, so the max here is MAX_CONDITION_SPARKLES - 1
|
// All Pokémon start with 1, so the max here is MAX_CONDITION_SPARKLES - 1
|
||||||
#define GET_NUM_CONDITION_SPARKLES(sheen)((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1;
|
#define GET_NUM_CONDITION_SPARKLES(sheen)((sheen) != MAX_SHEEN) ? (sheen) / ((u32)MAX_SHEEN / (MAX_CONDITION_SPARKLES - 1) + 1) : MAX_CONDITION_SPARKLES - 1;
|
||||||
|
|
||||||
// Window IDs for the Player PC Mailbox
|
#define CONDITION_GRAPH_TOP_Y 56
|
||||||
enum {
|
|
||||||
MAILBOXWIN_TITLE,
|
|
||||||
MAILBOXWIN_LIST,
|
|
||||||
MAILBOXWIN_OPTIONS,
|
|
||||||
MAILBOXWIN_COUNT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UnknownSubStruct_81D1ED4
|
|
||||||
{
|
|
||||||
u16 unk0;
|
|
||||||
u16 unk2;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define CONDITION_GRAPH_CENTER_X 155
|
|
||||||
#define CONDITION_GRAPH_TOP_Y 56
|
|
||||||
#define CONDITION_GRAPH_BOTTOM_Y 121
|
#define CONDITION_GRAPH_BOTTOM_Y 121
|
||||||
#define CONDITION_GRAPH_HEIGHT (CONDITION_GRAPH_BOTTOM_Y - CONDITION_GRAPH_TOP_Y + 1)
|
#define CONDITION_GRAPH_HEIGHT (CONDITION_GRAPH_BOTTOM_Y - CONDITION_GRAPH_TOP_Y + 1)
|
||||||
#define CONDITION_GRAPH_UNK_1 10
|
#define CONDITION_GRAPH_CENTER_X 155
|
||||||
#define CONDITION_GRAPH_UNK_2 9
|
#define CONDITION_GRAPH_CENTER_Y ((CONDITION_GRAPH_BOTTOM_Y + CONDITION_GRAPH_TOP_Y) / 2 + 3)
|
||||||
#define CONDITION_GRAPH_UNK 91
|
#define CONDITION_GRAPH_UPDATE_STEPS 10
|
||||||
|
#define CONDITION_GRAPH_LOAD_MAX 4
|
||||||
|
|
||||||
// Equivalent to flavor and contest values, but in a different order.
|
// Equivalent to flavor and contest values, but in a different order.
|
||||||
enum {
|
enum {
|
||||||
@ -57,55 +50,75 @@ enum {
|
|||||||
CONDITION_COUNT
|
CONDITION_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ConditionGraph
|
// Yet another order. This one is the same (by coincidence) as the contest categories
|
||||||
{
|
enum {
|
||||||
/*0x000*/ u8 conditions[4][CONDITION_COUNT];
|
GRAPH_COOL,
|
||||||
/*0x014*/ struct UnknownSubStruct_81D1ED4 unk14[4][CONDITION_COUNT];
|
GRAPH_BEAUTY,
|
||||||
/*0x064*/ struct UnknownSubStruct_81D1ED4 unk64[CONDITION_GRAPH_UNK_1][CONDITION_COUNT];
|
GRAPH_CUTE,
|
||||||
/*0x12C*/ struct UnknownSubStruct_81D1ED4 unk12C[CONDITION_COUNT];
|
GRAPH_SMART,
|
||||||
/*0x140*/ u16 scanlineRight[CONDITION_GRAPH_HEIGHT][2];
|
GRAPH_TOUGH,
|
||||||
/*0x248*/ u16 scanlineLeft[CONDITION_GRAPH_HEIGHT][2];
|
|
||||||
/*0x350*/ u16 unk350;
|
|
||||||
/*0x352*/ u16 unk352;
|
|
||||||
/*0x354*/ bool8 unk354;
|
|
||||||
/*0x355*/ u8 state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ConditionGraph
|
||||||
|
{
|
||||||
|
/*0x000*/ u8 conditions[CONDITION_GRAPH_LOAD_MAX][CONDITION_COUNT];
|
||||||
|
/*0x014*/ struct UCoords16 savedPositions[CONDITION_GRAPH_LOAD_MAX][CONDITION_COUNT];
|
||||||
|
/*0x064*/ struct UCoords16 newPositions[CONDITION_GRAPH_UPDATE_STEPS][CONDITION_COUNT];
|
||||||
|
/*0x12C*/ struct UCoords16 curPositions[CONDITION_COUNT];
|
||||||
|
/*0x140*/ u16 scanlineRight[CONDITION_GRAPH_HEIGHT][2];
|
||||||
|
/*0x248*/ u16 scanlineLeft[CONDITION_GRAPH_HEIGHT][2];
|
||||||
|
/*0x350*/ u16 bottom;
|
||||||
|
/*0x352*/ u16 updateCounter;
|
||||||
|
/*0x354*/ bool8 needsDraw;
|
||||||
|
/*0x355*/ u8 scanlineResetState;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Mailbox menu
|
||||||
bool8 MailboxMenu_Alloc(u8 count);
|
bool8 MailboxMenu_Alloc(u8 count);
|
||||||
u8 MailboxMenu_AddWindow(u8 windowIdx);
|
u8 MailboxMenu_AddWindow(u8 windowIdx);
|
||||||
u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page);
|
u8 MailboxMenu_CreateList(struct PlayerPCItemPageStruct *page);
|
||||||
void MailboxMenu_AddScrollArrows(struct PlayerPCItemPageStruct *page);
|
void MailboxMenu_AddScrollArrows(struct PlayerPCItemPageStruct *page);
|
||||||
void MailboxMenu_Free(void);
|
void MailboxMenu_Free(void);
|
||||||
void MailboxMenu_RemoveWindow(u8 windowIdx);
|
void MailboxMenu_RemoveWindow(u8 windowIdx);
|
||||||
|
|
||||||
|
// Condition graph
|
||||||
void ConditionGraph_Init(struct ConditionGraph *graph);
|
void ConditionGraph_Init(struct ConditionGraph *graph);
|
||||||
void sub_81D2108(struct ConditionGraph *graph);
|
void ConditionGraph_InitWindow(u8 bg);
|
||||||
void SetConditionGraphIOWindows(u8 bg);
|
void ConditionGraph_InitResetScanline(struct ConditionGraph *graph);
|
||||||
void InitConditionGraphState(struct ConditionGraph *graph);
|
bool8 ConditionGraph_ResetScanline(struct ConditionGraph *graph);
|
||||||
void sub_81D2230(struct ConditionGraph *graph);
|
void ConditionGraph_Draw(struct ConditionGraph *graph);
|
||||||
bool8 SetupConditionGraphScanlineParams(struct ConditionGraph *graph);
|
bool8 ConditionGraph_TryUpdate(struct ConditionGraph *graph);
|
||||||
bool8 TransitionConditionGraph(struct ConditionGraph *graph);
|
void ConditionGraph_Update(struct ConditionGraph *graph);
|
||||||
void sub_81D2754(u8 *arg0, struct UnknownSubStruct_81D1ED4 *arg1);
|
void ConditionGraph_CalcPositions(u8 *conditions, struct UCoords16 *positions);
|
||||||
void sub_81D1F84(struct ConditionGraph *graph, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2);
|
void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords16 *arg1, struct UCoords16 *arg2);
|
||||||
void MoveRelearnerPrintText(u8 *str);
|
|
||||||
bool16 MoveRelearnerRunTextPrinters(void);
|
// Condition menu
|
||||||
void MoveRelearnerCreateYesNoMenu(void);
|
bool8 ConditionMenu_UpdateMonEnter(struct ConditionGraph *graph, s16 *x);
|
||||||
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
|
bool8 ConditionMenu_UpdateMonExit(struct ConditionGraph *graph, s16 *x);
|
||||||
void InitMoveRelearnerWindows(bool8 useContextWindow);
|
bool8 MoveConditionMonOnscreen(s16 *x);
|
||||||
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst);
|
bool8 MoveConditionMonOffscreen(s16 *x);
|
||||||
void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel);
|
void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel);
|
||||||
void GetConditionMenuMonConditions(struct ConditionGraph *graph, u8 *sheen, u16 boxId, u16 monId, u16 partyId, u16 id, u16 numMons, bool8 excludesCancel);
|
void GetConditionMenuMonConditions(struct ConditionGraph *graph, u8 *sheen, u16 boxId, u16 monId, u16 partyId, u16 id, u16 numMons, bool8 excludesCancel);
|
||||||
void GetConditionMenuMonGfx(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel);
|
void GetConditionMenuMonGfx(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel);
|
||||||
bool8 MoveConditionMonOnscreen(s16 *x);
|
|
||||||
bool8 MoveConditionMonOffscreen(s16 *x);
|
|
||||||
bool8 ConditionGraph_UpdateMonEnter(struct ConditionGraph *graph, s16 *x);
|
|
||||||
bool8 ConditionGraph_UpdateMonExit(struct ConditionGraph *graph, s16 *x);
|
|
||||||
void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal);
|
void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal);
|
||||||
void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals);
|
void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals);
|
||||||
|
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst);
|
||||||
|
|
||||||
|
// Condition sparkles
|
||||||
void LoadConditionSparkle(struct SpriteSheet *sheet, struct SpritePalette *pal);
|
void LoadConditionSparkle(struct SpriteSheet *sheet, struct SpritePalette *pal);
|
||||||
void ResetConditionSparkleSprites(struct Sprite **sprites);
|
void ResetConditionSparkleSprites(struct Sprite **sprites);
|
||||||
void CreateConditionSparkleSprites(struct Sprite **sprites, u8 monSpriteId, u8 count);
|
void CreateConditionSparkleSprites(struct Sprite **sprites, u8 monSpriteId, u8 count);
|
||||||
void DestroyConditionSparkleSprites(struct Sprite **sprites);
|
void DestroyConditionSparkleSprites(struct Sprite **sprites);
|
||||||
void FreeConditionSparkles(struct Sprite **sprites);
|
void FreeConditionSparkles(struct Sprite **sprites);
|
||||||
|
|
||||||
|
// Move relearner
|
||||||
|
void MoveRelearnerPrintText(u8 *str);
|
||||||
|
bool16 MoveRelearnerRunTextPrinters(void);
|
||||||
|
void MoveRelearnerCreateYesNoMenu(void);
|
||||||
|
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
|
||||||
|
void InitMoveRelearnerWindows(bool8 useContextWindow);
|
||||||
|
|
||||||
|
// 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);
|
||||||
void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 shadowClr);
|
void DrawLevelUpWindowPg2(u16 windowId, u16 *currStats, u8 bgClr, u8 fgClr, u8 shadowClr);
|
||||||
void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *currStats);
|
void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *currStats);
|
||||||
|
@ -437,7 +437,7 @@ u32 GetPartyConditionCallback(void);
|
|||||||
void FreePartyConditionSubstruct1(void);
|
void FreePartyConditionSubstruct1(void);
|
||||||
bool32 LoadPartyConditionMenuGfx(void);
|
bool32 LoadPartyConditionMenuGfx(void);
|
||||||
bool32 IsConditionMenuSearchMode(void);
|
bool32 IsConditionMenuSearchMode(void);
|
||||||
struct ConditionGraph *GetConditionGraphDataPtr(void);
|
struct ConditionGraph *GetConditionGraphPtr(void);
|
||||||
u16 GetConditionGraphCurrentMonIndex(void);
|
u16 GetConditionGraphCurrentMonIndex(void);
|
||||||
u16 GetMonListCount(void);
|
u16 GetMonListCount(void);
|
||||||
u8 GetNumConditionMonSparkles(void);
|
u8 GetNumConditionMonSparkles(void);
|
||||||
|
@ -32,8 +32,8 @@ EWRAM_DATA static u8 sMailboxWindowIds[MAILBOXWIN_COUNT] = {0};
|
|||||||
EWRAM_DATA static struct ListMenuItem *sMailboxList = NULL;
|
EWRAM_DATA static struct ListMenuItem *sMailboxList = NULL;
|
||||||
|
|
||||||
static void MailboxMenu_MoveCursorFunc(s32, bool8, struct ListMenu *);
|
static void MailboxMenu_MoveCursorFunc(s32, bool8, struct ListMenu *);
|
||||||
static void sub_81D24A4(struct ConditionGraph *);
|
static void ConditionGraph_CalcRightHalf(struct ConditionGraph *);
|
||||||
static void sub_81D2634(struct ConditionGraph *);
|
static void ConditionGraph_CalcLeftHalf(struct ConditionGraph *);
|
||||||
static void MoveRelearnerCursorCallback(s32, bool8, struct ListMenu *);
|
static void MoveRelearnerCursorCallback(s32, bool8, struct ListMenu *);
|
||||||
static void MoveRelearnerDummy(void);
|
static void MoveRelearnerDummy(void);
|
||||||
static void SetNextConditionSparkle(struct Sprite *);
|
static void SetNextConditionSparkle(struct Sprite *);
|
||||||
@ -85,7 +85,7 @@ static const struct ScanlineEffectParams sConditionGraphScanline =
|
|||||||
.initState = 1,
|
.initState = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sUnknown_08625410[MAX_CONDITION + 1] =
|
static const u8 sConditionToLineLength[MAX_CONDITION + 1] =
|
||||||
{
|
{
|
||||||
4, 5, 6, 7, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 13,
|
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,
|
13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 17,
|
||||||
@ -190,6 +190,10 @@ static const struct ListMenuTemplate sMoveRelearnerMovesListTemplate =
|
|||||||
.cursorKind = 0
|
.cursorKind = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------
|
||||||
|
// Mailbox menu
|
||||||
|
//--------------
|
||||||
|
|
||||||
bool8 MailboxMenu_Alloc(u8 count)
|
bool8 MailboxMenu_Alloc(u8 count)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
@ -303,67 +307,83 @@ void MailboxMenu_Free(void)
|
|||||||
Free(sMailboxList);
|
Free(sMailboxList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------
|
||||||
|
// 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.
|
||||||
|
//---------------------------------------
|
||||||
|
|
||||||
|
#define UNK_VAL(n, s)(((n) >> (s)) + (((n) >> ((s) - 1)) & 1))
|
||||||
|
|
||||||
void ConditionGraph_Init(struct ConditionGraph *graph)
|
void ConditionGraph_Init(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
u8 i, j;
|
u8 i, j;
|
||||||
|
|
||||||
for (j = 0; j < CONDITION_COUNT; j++)
|
for (j = 0; j < CONDITION_COUNT; j++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < CONDITION_GRAPH_UNK_1; i++)
|
for (i = 0; i < CONDITION_GRAPH_UPDATE_STEPS; i++)
|
||||||
{
|
{
|
||||||
graph->unk64[i][j].unk0 = 0;
|
graph->newPositions[i][j].x = 0;
|
||||||
graph->unk64[i][j].unk2 = 0;
|
graph->newPositions[i][j].y = 0;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 4; i++)
|
|
||||||
|
for (i = 0; i < CONDITION_GRAPH_LOAD_MAX; i++)
|
||||||
{
|
{
|
||||||
graph->conditions[i][j] = 0;
|
graph->conditions[i][j] = 0;
|
||||||
graph->unk14[i][j].unk0 = CONDITION_GRAPH_CENTER_X;
|
graph->savedPositions[i][j].x = CONDITION_GRAPH_CENTER_X;
|
||||||
graph->unk14[i][j].unk2 = CONDITION_GRAPH_UNK;
|
graph->savedPositions[i][j].y = CONDITION_GRAPH_CENTER_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->unk12C[j].unk0 = 0;
|
graph->curPositions[j].x = 0;
|
||||||
graph->unk12C[j].unk2 = 0;
|
graph->curPositions[j].y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->unk354 = FALSE;
|
graph->needsDraw = FALSE;
|
||||||
graph->unk352 = 0;
|
graph->updateCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81D1F84(struct ConditionGraph *graph, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2)
|
// 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)
|
||||||
{
|
{
|
||||||
u16 i, j;
|
u16 i, j;
|
||||||
s32 r5, r6;
|
s32 coord, increment;
|
||||||
|
|
||||||
for (i = 0; i < CONDITION_COUNT; i++)
|
for (i = 0; i < CONDITION_COUNT; i++)
|
||||||
{
|
{
|
||||||
r5 = arg1[i].unk0 << 8;
|
coord = old[i].x << 8;
|
||||||
r6 = ((arg2[i].unk0 - arg1[i].unk0) << 8) / CONDITION_GRAPH_UNK_1;
|
increment = ((new[i].x - old[i].x) << 8) / CONDITION_GRAPH_UPDATE_STEPS;
|
||||||
for (j = 0; j < CONDITION_GRAPH_UNK_2; j++)
|
for (j = 0; j < CONDITION_GRAPH_UPDATE_STEPS - 1; j++)
|
||||||
{
|
{
|
||||||
graph->unk64[j][i].unk0 = (r5 >> 8) + ((r5 >> 7) & 1);
|
graph->newPositions[j][i].x = UNK_VAL(coord, 8);
|
||||||
r5 += r6;
|
coord += increment;
|
||||||
}
|
}
|
||||||
graph->unk64[j][i].unk0 = arg2[i].unk0;
|
graph->newPositions[j][i].x = new[i].x;
|
||||||
|
|
||||||
r5 = arg1[i].unk2 << 8;
|
coord = old[i].y << 8;
|
||||||
r6 = ((arg2[i].unk2 - arg1[i].unk2) << 8) / CONDITION_GRAPH_UNK_1;
|
increment = ((new[i].y - old[i].y) << 8) / CONDITION_GRAPH_UPDATE_STEPS;
|
||||||
for (j = 0; j < CONDITION_GRAPH_UNK_2; j++)
|
for (j = 0; j < CONDITION_GRAPH_UPDATE_STEPS - 1; j++)
|
||||||
{
|
{
|
||||||
graph->unk64[j][i].unk2 = (r5 >> 8) + ((r5 >> 7) & 1);
|
graph->newPositions[j][i].y = UNK_VAL(coord, 8);
|
||||||
r5 += r6;
|
coord += increment;
|
||||||
}
|
}
|
||||||
graph->unk64[j][i].unk2 = arg2[i].unk2;
|
graph->newPositions[j][i].y = new[i].y;
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->unk352 = 0;
|
graph->updateCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 TransitionConditionGraph(struct ConditionGraph *graph)
|
bool8 ConditionGraph_TryUpdate(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
if (graph->unk352 < CONDITION_GRAPH_UNK_1)
|
if (graph->updateCounter < CONDITION_GRAPH_UPDATE_STEPS)
|
||||||
{
|
{
|
||||||
sub_81D2230(graph);
|
ConditionGraph_Update(graph);
|
||||||
return (++graph->unk352 != CONDITION_GRAPH_UNK_1);
|
return (++graph->updateCounter != CONDITION_GRAPH_UPDATE_STEPS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -371,51 +391,55 @@ bool8 TransitionConditionGraph(struct ConditionGraph *graph)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitConditionGraphState(struct ConditionGraph *graph)
|
void ConditionGraph_InitResetScanline(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
graph->state = 0;
|
graph->scanlineResetState = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 SetupConditionGraphScanlineParams(struct ConditionGraph *graph)
|
bool8 ConditionGraph_ResetScanline(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
struct ScanlineEffectParams params;
|
struct ScanlineEffectParams params;
|
||||||
|
|
||||||
switch (graph->state)
|
switch (graph->scanlineResetState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ScanlineEffect_Clear();
|
ScanlineEffect_Clear();
|
||||||
graph->state++;
|
graph->scanlineResetState++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case 1:
|
case 1:
|
||||||
params = sConditionGraphScanline;
|
params = sConditionGraphScanline;
|
||||||
ScanlineEffect_SetParams(params);
|
ScanlineEffect_SetParams(params);
|
||||||
graph->state++;
|
graph->scanlineResetState++;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81D2108(struct ConditionGraph *graph)
|
void ConditionGraph_Draw(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
if (!graph->unk354)
|
if (!graph->needsDraw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sub_81D24A4(graph);
|
ConditionGraph_CalcRightHalf(graph);
|
||||||
sub_81D2634(graph);
|
ConditionGraph_CalcLeftHalf(graph);
|
||||||
|
|
||||||
for (i = 0; i < CONDITION_GRAPH_HEIGHT; i++)
|
for (i = 0; i < CONDITION_GRAPH_HEIGHT; i++)
|
||||||
{
|
{
|
||||||
gScanlineEffectRegBuffers[1][(i + 55) * 2] = gScanlineEffectRegBuffers[0][(i + 55) * 2] = (graph->scanlineRight[i][0] << 8) | (graph->scanlineRight[i][1]);
|
// Draw right half
|
||||||
gScanlineEffectRegBuffers[1][(i + 55) * 2 + 1] = gScanlineEffectRegBuffers[0][(i + 55) * 2 + 1] = (graph->scanlineLeft[i][0] << 8) | (graph->scanlineLeft[i][1]);
|
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]);
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->unk354 = FALSE;
|
graph->needsDraw = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetConditionGraphIOWindows(u8 bg)
|
void ConditionGraph_InitWindow(u8 bg)
|
||||||
{
|
{
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
|
||||||
@ -434,146 +458,153 @@ void SetConditionGraphIOWindows(u8 bg)
|
|||||||
SetGpuReg(REG_OFFSET_WINOUT, flags);
|
SetGpuReg(REG_OFFSET_WINOUT, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81D2230(struct ConditionGraph *graph)
|
void ConditionGraph_Update(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
u16 i;
|
u16 i;
|
||||||
for (i = 0; i < CONDITION_COUNT; i++)
|
for (i = 0; i < CONDITION_COUNT; i++)
|
||||||
graph->unk12C[i] = graph->unk64[graph->unk352][i];
|
graph->curPositions[i] = graph->newPositions[graph->updateCounter][i];
|
||||||
|
|
||||||
graph->unk354 = TRUE;
|
graph->needsDraw = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81D2278(struct ConditionGraph *graph, u16 *arg1, struct UnknownSubStruct_81D1ED4 *arg2, struct UnknownSubStruct_81D1ED4 *arg3, u8 arg4, u16 *arg5)
|
static void ConditionGraph_CalcLine(struct ConditionGraph *graph, u16 *scanline, struct UCoords16 *pos1, struct UCoords16 *pos2, bool8 dir, u16 *overflowScanline)
|
||||||
{
|
{
|
||||||
u16 i, r8, r10, r0, var_30;
|
u16 i, height, top, bottom, x2;
|
||||||
u16 *ptr;
|
u16 *ptr;
|
||||||
s32 r4, var_2C = 0;
|
s32 x, xIncrement = 0;
|
||||||
|
|
||||||
if (arg2->unk2 < arg3->unk2)
|
if (pos1->y < pos2->y)
|
||||||
{
|
{
|
||||||
r10 = arg2->unk2;
|
top = pos1->y;
|
||||||
r0 = arg3->unk2;
|
bottom = pos2->y;
|
||||||
r4 = arg2->unk0 << 10;
|
x = pos1->x << 10;
|
||||||
var_30 = arg3->unk0;
|
x2 = pos2->x;
|
||||||
r8 = r0 - r10;
|
height = bottom - top;
|
||||||
if (r8 != 0)
|
if (height != 0)
|
||||||
var_2C = ((var_30 - arg2->unk0) << 10) / r8;
|
xIncrement = ((x2 - pos1->x) << 10) / height;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r0 = arg2->unk2;
|
bottom = pos1->y;
|
||||||
r10 = arg3->unk2;
|
top = pos2->y;
|
||||||
r4 = arg3->unk0 << 10;
|
x = pos2->x << 10;
|
||||||
var_30 = arg2->unk0;
|
x2 = pos1->x;
|
||||||
r8 = r0 - r10;
|
height = bottom - top;
|
||||||
if (r8 != 0)
|
if (height != 0)
|
||||||
var_2C = ((var_30 - arg3->unk0) << 10) / r8;
|
xIncrement = ((x2 - pos2->x) << 10) / height;
|
||||||
}
|
}
|
||||||
|
|
||||||
r8++;
|
height++;
|
||||||
if (arg5 == NULL)
|
if (overflowScanline == NULL)
|
||||||
{
|
{
|
||||||
arg1 += (r10 - CONDITION_GRAPH_TOP_Y) * 2;
|
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||||
for (i = 0; i < r8; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
arg1[arg4] = (r4 >> 10) + ((r4 >> 9) & 1) + arg4;
|
scanline[dir] = UNK_VAL(x, 10) + dir;
|
||||||
r4 += var_2C;
|
x += xIncrement;
|
||||||
arg1 += 2;
|
scanline += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = arg1 - 2;
|
ptr = scanline - 2;
|
||||||
}
|
}
|
||||||
else if (var_2C > 0)
|
else if (xIncrement > 0)
|
||||||
{
|
{
|
||||||
arg5 += (r10 - CONDITION_GRAPH_TOP_Y) * 2;
|
overflowScanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||||
// Less readable than the other loops, but it has to be written this way to match.
|
// Less readable than the other loops, but it has to be written this way to match.
|
||||||
for (i = 0; i < r8; arg5[arg4] = (r4 >> 10) + ((r4 >> 9) & 1) + arg4, r4 += var_2C, arg5 += 2, i++)
|
for (i = 0; i < height; overflowScanline[dir] = UNK_VAL(x, 10) + dir, x += xIncrement, overflowScanline += 2, i++)
|
||||||
{
|
{
|
||||||
if (r4 >= (CONDITION_GRAPH_CENTER_X << 10))
|
if (x >= (CONDITION_GRAPH_CENTER_X << 10))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->unk350 = r10 + i;
|
graph->bottom = top + i;
|
||||||
arg1 += (graph->unk350 - CONDITION_GRAPH_TOP_Y) * 2;
|
scanline += (graph->bottom - CONDITION_GRAPH_TOP_Y) * 2;
|
||||||
for (; i < r8; i++)
|
for (; i < height; i++)
|
||||||
{
|
{
|
||||||
arg1[arg4] = (r4 >> 10) + ((r4 >> 9) & 1) + arg4;
|
scanline[dir] = UNK_VAL(x, 10) + dir;
|
||||||
r4 += var_2C;
|
x += xIncrement;
|
||||||
arg1 += 2;
|
scanline += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = arg1 - 2;
|
ptr = scanline - 2;
|
||||||
}
|
}
|
||||||
else if (var_2C < 0)
|
else if (xIncrement < 0)
|
||||||
{
|
{
|
||||||
arg1 += (r10 - CONDITION_GRAPH_TOP_Y) * 2;
|
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||||
for (i = 0; i < r8; i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
arg1[arg4] = (r4 >> 10) + ((r4 >> 9) & 1) + arg4;
|
scanline[dir] = UNK_VAL(x, 10) + dir;
|
||||||
if (r4 < (CONDITION_GRAPH_CENTER_X << 10))
|
if (x < (CONDITION_GRAPH_CENTER_X << 10))
|
||||||
{
|
{
|
||||||
arg1[arg4] = CONDITION_GRAPH_CENTER_X;
|
scanline[dir] = CONDITION_GRAPH_CENTER_X;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r4 += var_2C;
|
x += xIncrement;
|
||||||
arg1 += 2;
|
scanline += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
graph->unk350 = r10 + i;
|
graph->bottom = top + i;
|
||||||
arg5 += (graph->unk350 - CONDITION_GRAPH_TOP_Y) * 2;
|
overflowScanline += (graph->bottom - CONDITION_GRAPH_TOP_Y) * 2;
|
||||||
for (; i < r8; i++)
|
for (; i < height; i++)
|
||||||
{
|
{
|
||||||
arg5[arg4] = (r4 >> 10) + ((r4 >> 9) & 1) + arg4;
|
overflowScanline[dir] = UNK_VAL(x, 10) + dir;
|
||||||
r4 += var_2C;
|
x += xIncrement;
|
||||||
arg5 += 2;
|
overflowScanline += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = arg5 - 2;
|
ptr = overflowScanline - 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
graph->unk350 = r10;
|
graph->bottom = top;
|
||||||
arg1 += (r10 - CONDITION_GRAPH_TOP_Y) * 2;
|
scanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||||
arg5 += (r10 - CONDITION_GRAPH_TOP_Y) * 2;
|
overflowScanline += (top - CONDITION_GRAPH_TOP_Y) * 2;
|
||||||
arg1[1] = arg2->unk0 + 1;
|
scanline[1] = pos1->x + 1;
|
||||||
arg5[0] = arg3->unk0;
|
overflowScanline[0] = pos2->x;
|
||||||
arg5[1] = CONDITION_GRAPH_CENTER_X;
|
overflowScanline[1] = CONDITION_GRAPH_CENTER_X;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr[arg4] = arg4 + var_30;
|
ptr[dir] = dir + x2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81D24A4(struct ConditionGraph *graph)
|
static void ConditionGraph_CalcRightHalf(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
u16 i, r6, varMax;
|
u16 i, y, bottom;
|
||||||
|
|
||||||
if (graph->unk12C[0].unk2 < graph->unk12C[1].unk2)
|
// Calculate Cool -> Beauty line
|
||||||
|
if (graph->curPositions[GRAPH_COOL].y < graph->curPositions[GRAPH_BEAUTY].y)
|
||||||
{
|
{
|
||||||
r6 = graph->unk12C[0].unk2;
|
y = graph->curPositions[GRAPH_COOL].y;
|
||||||
sub_81D2278(graph, graph->scanlineRight[0], &graph->unk12C[0], &graph->unk12C[1], 1, NULL);
|
ConditionGraph_CalcLine(graph, graph->scanlineRight[0], &graph->curPositions[GRAPH_COOL], &graph->curPositions[GRAPH_BEAUTY], TRUE, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r6 = graph->unk12C[1].unk2;
|
y = graph->curPositions[GRAPH_BEAUTY].y;
|
||||||
sub_81D2278(graph, graph->scanlineRight[0], &graph->unk12C[1], &graph->unk12C[0], 0, NULL);
|
ConditionGraph_CalcLine(graph, graph->scanlineRight[0], &graph->curPositions[GRAPH_BEAUTY], &graph->curPositions[GRAPH_COOL], FALSE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_81D2278(graph, graph->scanlineRight[0], &graph->unk12C[1], &graph->unk12C[2], 1, NULL);
|
// 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);
|
||||||
|
|
||||||
i = (graph->unk12C[2].unk2 <= graph->unk12C[3].unk2);
|
// Calculate Cute -> Tough line (includes left scanline because this crosses the halfway point)
|
||||||
sub_81D2278(graph, graph->scanlineRight[0], &graph->unk12C[2], &graph->unk12C[3], i, graph->scanlineLeft[0]);
|
i = (graph->curPositions[GRAPH_CUTE].y <= graph->curPositions[GRAPH_SMART].y);
|
||||||
for (i = CONDITION_GRAPH_TOP_Y; i < r6; i++)
|
ConditionGraph_CalcLine(graph, graph->scanlineRight[0], &graph->curPositions[GRAPH_CUTE], &graph->curPositions[GRAPH_SMART], i, graph->scanlineLeft[0]);
|
||||||
|
|
||||||
|
// Clear down to new top
|
||||||
|
for (i = CONDITION_GRAPH_TOP_Y; i < y; i++)
|
||||||
{
|
{
|
||||||
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
||||||
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = graph->unk12C[0].unk2; i <= graph->unk350; i++)
|
for (i = graph->curPositions[GRAPH_COOL].y; i <= graph->bottom; i++)
|
||||||
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = CONDITION_GRAPH_CENTER_X;
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = CONDITION_GRAPH_CENTER_X;
|
||||||
|
|
||||||
varMax = max(graph->unk350, graph->unk12C[2].unk2);
|
// Clear after new bottom
|
||||||
for (i = varMax + 1; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
bottom = max(graph->bottom, graph->curPositions[GRAPH_CUTE].y);
|
||||||
|
for (i = bottom + 1; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
||||||
{
|
{
|
||||||
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
||||||
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
||||||
@ -581,42 +612,48 @@ static void sub_81D24A4(struct ConditionGraph *graph)
|
|||||||
|
|
||||||
for (i = CONDITION_GRAPH_TOP_Y; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
for (i = CONDITION_GRAPH_TOP_Y; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
||||||
{
|
{
|
||||||
if (graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] == 0 && graph->scanlineRight[i - 56][1] != 0)
|
if (graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] == 0
|
||||||
|
&& graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][1] != 0)
|
||||||
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = CONDITION_GRAPH_CENTER_X;
|
graph->scanlineRight[i - CONDITION_GRAPH_TOP_Y][0] = CONDITION_GRAPH_CENTER_X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81D2634(struct ConditionGraph *graph)
|
static void ConditionGraph_CalcLeftHalf(struct ConditionGraph *graph)
|
||||||
{
|
{
|
||||||
s32 i, r6, varMax;
|
s32 i, y, bottom;
|
||||||
|
|
||||||
if (graph->unk12C[0].unk2 < graph->unk12C[4].unk2)
|
// Calculate Cool -> Tough line
|
||||||
|
if (graph->curPositions[GRAPH_COOL].y < graph->curPositions[GRAPH_TOUGH].y)
|
||||||
{
|
{
|
||||||
r6 = graph->unk12C[0].unk2;
|
y = graph->curPositions[GRAPH_COOL].y;
|
||||||
sub_81D2278(graph, graph->scanlineLeft[0], &graph->unk12C[0], &graph->unk12C[4], 0, NULL);
|
ConditionGraph_CalcLine(graph, graph->scanlineLeft[0], &graph->curPositions[GRAPH_COOL], &graph->curPositions[GRAPH_TOUGH], FALSE, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
r6 = graph->unk12C[4].unk2;
|
y = graph->curPositions[GRAPH_TOUGH].y;
|
||||||
sub_81D2278(graph, graph->scanlineLeft[0], &graph->unk12C[4], &graph->unk12C[0], 1, NULL);
|
ConditionGraph_CalcLine(graph, graph->scanlineLeft[0], &graph->curPositions[GRAPH_TOUGH], &graph->curPositions[GRAPH_COOL], TRUE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_81D2278(graph, graph->scanlineLeft[0], &graph->unk12C[4], &graph->unk12C[3], 0, NULL);
|
// 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);
|
||||||
|
|
||||||
for (i = CONDITION_GRAPH_TOP_Y; i < r6; i++)
|
// Clear down to new top
|
||||||
|
for (i = CONDITION_GRAPH_TOP_Y; i < y; i++)
|
||||||
{
|
{
|
||||||
graph->scanlineRight[i + CONDITION_GRAPH_UNK_1][0] = 0;
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
||||||
graph->scanlineRight[i + CONDITION_GRAPH_UNK_1][1] = 0;
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = graph->unk12C[0].unk2; i <= graph->unk350; i++)
|
for (i = graph->curPositions[GRAPH_COOL].y; i <= graph->bottom; i++)
|
||||||
graph->scanlineRight[i + CONDITION_GRAPH_UNK_1][1] = CONDITION_GRAPH_CENTER_X;
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][1] = CONDITION_GRAPH_CENTER_X;
|
||||||
|
|
||||||
varMax = max(graph->unk350, graph->unk12C[3].unk2 + 1);
|
// Clear after new bottom
|
||||||
for (i = varMax; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
bottom = max(graph->bottom, graph->curPositions[GRAPH_SMART].y + 1);
|
||||||
|
for (i = bottom; i <= CONDITION_GRAPH_BOTTOM_Y; i++)
|
||||||
{
|
{
|
||||||
graph->scanlineRight[i + CONDITION_GRAPH_UNK_1][0] = 0;
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][0] = 0;
|
||||||
graph->scanlineRight[i + CONDITION_GRAPH_UNK_1][1] = 0;
|
graph->scanlineLeft[i - CONDITION_GRAPH_TOP_Y][1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < CONDITION_GRAPH_HEIGHT; i++)
|
for (i = 0; i < CONDITION_GRAPH_HEIGHT; i++)
|
||||||
@ -629,36 +666,41 @@ static void sub_81D2634(struct ConditionGraph *graph)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_81D2754(u8 *conditions, struct UnknownSubStruct_81D1ED4 *arg1)
|
void ConditionGraph_CalcPositions(u8 *conditions, struct UCoords16 *positions)
|
||||||
{
|
{
|
||||||
u8 r2, sinIdx;
|
u8 lineLength, sinIdx;
|
||||||
s8 r12;
|
s8 posIdx;
|
||||||
u16 i;
|
u16 i;
|
||||||
|
|
||||||
r2 = sUnknown_08625410[*(conditions++)];
|
// Cool is straight up-and-down (not angled), so no need for Sin
|
||||||
arg1->unk0 = CONDITION_GRAPH_CENTER_X;
|
lineLength = sConditionToLineLength[*(conditions++)];
|
||||||
arg1->unk2 = CONDITION_GRAPH_UNK - r2;
|
positions[GRAPH_COOL].x = CONDITION_GRAPH_CENTER_X;
|
||||||
|
positions[GRAPH_COOL].y = CONDITION_GRAPH_CENTER_Y - lineLength;
|
||||||
|
|
||||||
sinIdx = 64;
|
sinIdx = 64;
|
||||||
r12 = 0;
|
posIdx = GRAPH_COOL;
|
||||||
for (i = 1; i < CONDITION_COUNT; i++)
|
for (i = 1; i < CONDITION_COUNT; i++)
|
||||||
{
|
{
|
||||||
sinIdx += 51;
|
sinIdx += 51;
|
||||||
if (--r12 < 0)
|
if (--posIdx < 0)
|
||||||
r12 = 4;
|
posIdx = CONDITION_COUNT - 1;
|
||||||
|
|
||||||
if (r12 == 2)
|
if (posIdx == GRAPH_CUTE)
|
||||||
sinIdx++;
|
sinIdx++;
|
||||||
|
|
||||||
r2 = sUnknown_08625410[*(conditions++)];
|
lineLength = sConditionToLineLength[*(conditions++)];
|
||||||
arg1[r12].unk0 = CONDITION_GRAPH_CENTER_X + ((r2 * gSineTable[64 + sinIdx]) >> 8);
|
positions[posIdx].x = CONDITION_GRAPH_CENTER_X + ((lineLength * gSineTable[64 + sinIdx]) >> 8);
|
||||||
arg1[r12].unk2 = CONDITION_GRAPH_UNK - ((r2 * gSineTable[sinIdx]) >> 8);
|
positions[posIdx].y = CONDITION_GRAPH_CENTER_Y - ((lineLength * gSineTable[sinIdx]) >> 8);
|
||||||
|
|
||||||
if (r12 < 3 && (r2 != 32 || r12 != 2))
|
if (posIdx <= GRAPH_CUTE && (lineLength != 32 || posIdx != GRAPH_CUTE))
|
||||||
arg1[r12].unk0 = CONDITION_GRAPH_CENTER_X + 1 + ((r2 * gSineTable[64 + sinIdx]) >> 8);
|
positions[posIdx].x++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------
|
||||||
|
// Move relearner
|
||||||
|
//----------------
|
||||||
|
|
||||||
void InitMoveRelearnerWindows(bool8 useContextWindow)
|
void InitMoveRelearnerWindows(bool8 useContextWindow)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
@ -834,6 +876,10 @@ void MoveRelearnerCreateYesNoMenu(void)
|
|||||||
CreateYesNoMenu(&sMoveRelearnerYesNoMenuTemplate, 1, 0xE, 0);
|
CreateYesNoMenu(&sMoveRelearnerYesNoMenuTemplate, 1, 0xE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------
|
||||||
|
// Condition menu
|
||||||
|
//----------------
|
||||||
|
|
||||||
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst)
|
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst)
|
||||||
{
|
{
|
||||||
s32 ret;
|
s32 ret;
|
||||||
@ -1005,15 +1051,15 @@ void GetConditionMenuMonConditions(struct ConditionGraph *graph, u8 *numSparkles
|
|||||||
|
|
||||||
numSparkles[id] = GET_NUM_CONDITION_SPARKLES(GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL));
|
numSparkles[id] = GET_NUM_CONDITION_SPARKLES(GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL));
|
||||||
|
|
||||||
sub_81D2754(graph->conditions[id], graph->unk14[id]);
|
ConditionGraph_CalcPositions(graph->conditions[id], graph->savedPositions[id]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < CONDITION_COUNT; i++)
|
for (i = 0; i < CONDITION_COUNT; i++)
|
||||||
{
|
{
|
||||||
graph->conditions[id][i] = 0;
|
graph->conditions[id][i] = 0;
|
||||||
graph->unk14[id][i].unk0 = CONDITION_GRAPH_CENTER_X;
|
graph->savedPositions[id][i].x = CONDITION_GRAPH_CENTER_X;
|
||||||
graph->unk14[id][i].unk2 = CONDITION_GRAPH_UNK;
|
graph->savedPositions[id][i].y = CONDITION_GRAPH_CENTER_Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1052,17 +1098,17 @@ bool8 MoveConditionMonOffscreen(s16 *x)
|
|||||||
return (*x != -80);
|
return (*x != -80);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ConditionGraph_UpdateMonEnter(struct ConditionGraph *graph, s16 *x)
|
bool8 ConditionMenu_UpdateMonEnter(struct ConditionGraph *graph, s16 *x)
|
||||||
{
|
{
|
||||||
bool8 graphUpdating = TransitionConditionGraph(graph);
|
bool8 graphUpdating = ConditionGraph_TryUpdate(graph);
|
||||||
bool8 monUpdating = MoveConditionMonOnscreen(x);
|
bool8 monUpdating = MoveConditionMonOnscreen(x);
|
||||||
|
|
||||||
return (graphUpdating || monUpdating);
|
return (graphUpdating || monUpdating);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ConditionGraph_UpdateMonExit(struct ConditionGraph *graph, s16 *x)
|
bool8 ConditionMenu_UpdateMonExit(struct ConditionGraph *graph, s16 *x)
|
||||||
{
|
{
|
||||||
bool8 graphUpdating = TransitionConditionGraph(graph);
|
bool8 graphUpdating = ConditionGraph_TryUpdate(graph);
|
||||||
bool8 monUpdating = MoveConditionMonOffscreen(x);
|
bool8 monUpdating = MoveConditionMonOffscreen(x);
|
||||||
|
|
||||||
return (graphUpdating || monUpdating);
|
return (graphUpdating || monUpdating);
|
||||||
|
@ -24,7 +24,7 @@ struct PokenavSub11
|
|||||||
u8 fill2[0x6320 - 0x6308];
|
u8 fill2[0x6320 - 0x6308];
|
||||||
u8 locationText[NUM_CONDITION_MONS][24];
|
u8 locationText[NUM_CONDITION_MONS][24];
|
||||||
u8 nameText[NUM_CONDITION_MONS][64];
|
u8 nameText[NUM_CONDITION_MONS][64];
|
||||||
struct ConditionGraph conditionData;
|
struct ConditionGraph graph;
|
||||||
u8 numSparkles[NUM_CONDITION_MONS];
|
u8 numSparkles[NUM_CONDITION_MONS];
|
||||||
u8 monMarks[NUM_CONDITION_MONS];
|
u8 monMarks[NUM_CONDITION_MONS];
|
||||||
s8 mark;
|
s8 mark;
|
||||||
@ -52,7 +52,7 @@ bool32 PokenavCallback_Init_PartyCondition(void)
|
|||||||
if (structPtr == NULL)
|
if (structPtr == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ConditionGraph_Init(&structPtr->conditionData);
|
ConditionGraph_Init(&structPtr->graph);
|
||||||
InitPartyConditionListParameters();
|
InitPartyConditionListParameters();
|
||||||
gKeyRepeatStartDelay = 20;
|
gKeyRepeatStartDelay = 20;
|
||||||
structPtr->callback = HandlePartyConditionInput;
|
structPtr->callback = HandlePartyConditionInput;
|
||||||
@ -66,7 +66,7 @@ bool32 PokenavCallback_Init_ConditionGraphFromSearch(void)
|
|||||||
if (structPtr == NULL)
|
if (structPtr == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ConditionGraph_Init(&structPtr->conditionData);
|
ConditionGraph_Init(&structPtr->graph);
|
||||||
InitSearchResultsConditionList();
|
InitSearchResultsConditionList();
|
||||||
gKeyRepeatStartDelay = 20;
|
gKeyRepeatStartDelay = 20;
|
||||||
structPtr->callback = HandlePartyConditionInput;
|
structPtr->callback = HandlePartyConditionInput;
|
||||||
@ -192,7 +192,7 @@ static u8 SwitchConditionSummaryIndex(u8 moveUp)
|
|||||||
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
struct PokenavSub18 *monListPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_LIST);
|
||||||
|
|
||||||
r7 = (moveUp) ? structPtr->unk6788 : structPtr->unk6787;
|
r7 = (moveUp) ? structPtr->unk6788 : structPtr->unk6787;
|
||||||
sub_81D1F84(&structPtr->conditionData, structPtr->conditionData.unk14[structPtr->mark], structPtr->conditionData.unk14[r7]);
|
ConditionGraph_SetNewPositions(&structPtr->graph, structPtr->graph.savedPositions[structPtr->mark], structPtr->graph.savedPositions[r7]);
|
||||||
wasNotLastMon = (monListPtr->currIndex != ((IsConditionMenuSearchMode() != 0) ? monListPtr->listCount : monListPtr->listCount - 1));
|
wasNotLastMon = (monListPtr->currIndex != ((IsConditionMenuSearchMode() != 0) ? monListPtr->listCount : monListPtr->listCount - 1));
|
||||||
if (moveUp)
|
if (moveUp)
|
||||||
{
|
{
|
||||||
@ -491,22 +491,22 @@ static void GetMonConditionGraphData(s16 listId, u8 loadId)
|
|||||||
{
|
{
|
||||||
boxId = monListPtr->monData[listId].boxId;
|
boxId = monListPtr->monData[listId].boxId;
|
||||||
monId = monListPtr->monData[listId].monId;
|
monId = monListPtr->monData[listId].monId;
|
||||||
structPtr->conditionData.conditions[loadId][CONDITION_COOL] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
|
structPtr->graph.conditions[loadId][CONDITION_COOL] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
|
||||||
structPtr->conditionData.conditions[loadId][CONDITION_TOUGH] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
|
structPtr->graph.conditions[loadId][CONDITION_TOUGH] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
|
||||||
structPtr->conditionData.conditions[loadId][CONDITION_SMART] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
|
structPtr->graph.conditions[loadId][CONDITION_SMART] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
|
||||||
structPtr->conditionData.conditions[loadId][CONDITION_CUTE] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
|
structPtr->graph.conditions[loadId][CONDITION_CUTE] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
|
||||||
structPtr->conditionData.conditions[loadId][CONDITION_BEAUTY] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
|
structPtr->graph.conditions[loadId][CONDITION_BEAUTY] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
|
||||||
structPtr->numSparkles[loadId] = GET_NUM_CONDITION_SPARKLES(GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL));
|
structPtr->numSparkles[loadId] = GET_NUM_CONDITION_SPARKLES(GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL));
|
||||||
structPtr->monMarks[loadId] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_MARKINGS, NULL);
|
structPtr->monMarks[loadId] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_MARKINGS, NULL);
|
||||||
sub_81D2754(structPtr->conditionData.conditions[loadId], structPtr->conditionData.unk14[loadId]);
|
ConditionGraph_CalcPositions(structPtr->graph.conditions[loadId], structPtr->graph.savedPositions[loadId]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (i = 0; i < CONDITION_COUNT; i++)
|
for (i = 0; i < CONDITION_COUNT; i++)
|
||||||
{
|
{
|
||||||
structPtr->conditionData.conditions[loadId][i] = 0;
|
structPtr->graph.conditions[loadId][i] = 0;
|
||||||
structPtr->conditionData.unk14[loadId][i].unk0 = CONDITION_GRAPH_CENTER_X;
|
structPtr->graph.savedPositions[loadId][i].x = CONDITION_GRAPH_CENTER_X;
|
||||||
structPtr->conditionData.unk14[loadId][i].unk2 = CONDITION_GRAPH_UNK;
|
structPtr->graph.savedPositions[loadId][i].y = CONDITION_GRAPH_CENTER_Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -542,10 +542,10 @@ u16 GetConditionGraphCurrentMonIndex(void)
|
|||||||
return monListPtr->currIndex;
|
return monListPtr->currIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ConditionGraph *GetConditionGraphDataPtr(void)
|
struct ConditionGraph *GetConditionGraphPtr(void)
|
||||||
{
|
{
|
||||||
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
struct PokenavSub11 *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_CONDITION_GRAPH);
|
||||||
return &structPtr->conditionData;
|
return &structPtr->graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetMonMarkIndex(void)
|
u8 GetMonMarkIndex(void)
|
||||||
|
@ -147,7 +147,7 @@ static void CreateConditionMonPic(u8 var);
|
|||||||
static void CreateMonMarkingsOrPokeballIndicators(void);
|
static void CreateMonMarkingsOrPokeballIndicators(void);
|
||||||
static void CopyUnusedConditionWindowsToVram(void);
|
static void CopyUnusedConditionWindowsToVram(void);
|
||||||
static bool32 UpdateConditionGraphWindows(u8 a0, u16 a1, bool8 a2);
|
static bool32 UpdateConditionGraphWindows(u8 a0, u16 a1, bool8 a2);
|
||||||
static void sub_81CEE44(void);
|
static void VBlankCB_PokenavConditionGraph(void);
|
||||||
static void DoConditionGraphTransition(void);
|
static void DoConditionGraphTransition(void);
|
||||||
static void sub_81CEEC8(void);
|
static void sub_81CEEC8(void);
|
||||||
static void sub_81CEE68(void);
|
static void sub_81CEE68(void);
|
||||||
@ -237,7 +237,7 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
|||||||
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]);
|
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]);
|
||||||
CopyBgTilemapBufferToVram(2);
|
CopyBgTilemapBufferToVram(2);
|
||||||
CopyPaletteIntoBufferUnfaded(gConditionGraphData_Pal, 0x30, 0x20);
|
CopyPaletteIntoBufferUnfaded(gConditionGraphData_Pal, 0x30, 0x20);
|
||||||
SetConditionGraphIOWindows(2);
|
ConditionGraph_InitWindow(2);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 5:
|
case 5:
|
||||||
BgDmaFill(1, 0, 0, 1);
|
BgDmaFill(1, 0, 0, 1);
|
||||||
@ -309,21 +309,21 @@ static u32 LoopedTask_OpenPartyConditionGraph(s32 state)
|
|||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
if (!IsConditionMenuSearchMode() && AreLeftHeaderSpritesMoving())
|
if (!IsConditionMenuSearchMode() && AreLeftHeaderSpritesMoving())
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
SetVBlankCallback_(sub_81CEE44);
|
SetVBlankCallback_(VBlankCB_PokenavConditionGraph);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 17:
|
case 17:
|
||||||
DoConditionGraphTransition();
|
DoConditionGraphTransition();
|
||||||
InitConditionGraphState(GetConditionGraphDataPtr());
|
ConditionGraph_InitResetScanline(GetConditionGraphPtr());
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 18:
|
case 18:
|
||||||
if (SetupConditionGraphScanlineParams(GetConditionGraphDataPtr()))
|
if (ConditionGraph_ResetScanline(GetConditionGraphPtr()))
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 19:
|
case 19:
|
||||||
ToggleGraphData(TRUE);
|
ToggleGraphData(TRUE);
|
||||||
return LT_INC_AND_PAUSE;
|
return LT_INC_AND_PAUSE;
|
||||||
case 20:
|
case 20:
|
||||||
if (!ConditionGraph_UpdateMonEnter(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
|
if (!ConditionMenu_UpdateMonEnter(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||||
{
|
{
|
||||||
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||||
if (IsConditionMenuSearchMode() == TRUE || GetConditionGraphCurrentMonIndex() != GetMonListCount())
|
if (IsConditionMenuSearchMode() == TRUE || GetConditionGraphCurrentMonIndex() != GetMonListCount())
|
||||||
@ -348,7 +348,7 @@ static u32 LoopedTask_ExitPartyConditionMenu(s32 state)
|
|||||||
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
case 1:
|
case 1:
|
||||||
if (ConditionGraph_UpdateMonExit(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
|
if (ConditionMenu_UpdateMonExit(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||||
return 2;
|
return 2;
|
||||||
ToggleGraphData(FALSE);
|
ToggleGraphData(FALSE);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
@ -373,7 +373,7 @@ static u32 LoopedTask_ExitPartyConditionMenu(s32 state)
|
|||||||
static u32 LoopedTask_TransitionMons(s32 state)
|
static u32 LoopedTask_TransitionMons(s32 state)
|
||||||
{
|
{
|
||||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
|
||||||
struct ConditionGraph *graph = GetConditionGraphDataPtr();
|
struct ConditionGraph *graph = GetConditionGraphPtr();
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
@ -388,7 +388,7 @@ static u32 LoopedTask_TransitionMons(s32 state)
|
|||||||
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
case 3:
|
case 3:
|
||||||
TransitionConditionGraph(graph);
|
ConditionGraph_TryUpdate(graph);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
case 4:
|
case 4:
|
||||||
if (!MoveConditionMonOffscreen(&structPtr->monTransitionX))
|
if (!MoveConditionMonOffscreen(&structPtr->monTransitionX))
|
||||||
@ -411,8 +411,8 @@ static u32 LoopedTask_TransitionMons(s32 state)
|
|||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 9:
|
case 9:
|
||||||
graph = GetConditionGraphDataPtr();
|
graph = GetConditionGraphPtr();
|
||||||
if (!ConditionGraph_UpdateMonEnter(graph, &structPtr->monTransitionX))
|
if (!ConditionMenu_UpdateMonEnter(graph, &structPtr->monTransitionX))
|
||||||
{
|
{
|
||||||
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||||
if (IsConditionMenuSearchMode() != TRUE && GetConditionGraphCurrentMonIndex() == GetMonListCount())
|
if (IsConditionMenuSearchMode() != TRUE && GetConditionGraphCurrentMonIndex() == GetMonListCount())
|
||||||
@ -459,7 +459,7 @@ static u32 LoopedTask_MoveCursorNoTransition(s32 state)
|
|||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 8:
|
case 8:
|
||||||
if (!ConditionGraph_UpdateMonEnter(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
|
if (!ConditionMenu_UpdateMonEnter(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||||
{
|
{
|
||||||
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||||
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetNumConditionMonSparkles());
|
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetNumConditionMonSparkles());
|
||||||
@ -488,7 +488,7 @@ static u32 LoopedTask_SlideMonOut(s32 state)
|
|||||||
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
case 3:
|
case 3:
|
||||||
if (!ConditionGraph_UpdateMonExit(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
|
if (!ConditionMenu_UpdateMonExit(GetConditionGraphPtr(), &structPtr->monTransitionX))
|
||||||
return LT_INC_AND_CONTINUE;
|
return LT_INC_AND_CONTINUE;
|
||||||
return LT_PAUSE;
|
return LT_PAUSE;
|
||||||
case 4:
|
case 4:
|
||||||
@ -833,13 +833,13 @@ static void CreateConditionMonPic(u8 id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81CEE44(void)
|
static void VBlankCB_PokenavConditionGraph(void)
|
||||||
{
|
{
|
||||||
struct ConditionGraph *graph = GetConditionGraphDataPtr();
|
struct ConditionGraph *graph = GetConditionGraphPtr();
|
||||||
LoadOam();
|
LoadOam();
|
||||||
ProcessSpriteCopyRequests();
|
ProcessSpriteCopyRequests();
|
||||||
TransferPlttBuffer();
|
TransferPlttBuffer();
|
||||||
sub_81D2108(graph);
|
ConditionGraph_Draw(graph);
|
||||||
ScanlineEffect_InitHBlankDmaTransfer();
|
ScanlineEffect_InitHBlankDmaTransfer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,20 +858,20 @@ static void ToggleGraphData(bool8 showBg)
|
|||||||
|
|
||||||
static void DoConditionGraphTransition(void)
|
static void DoConditionGraphTransition(void)
|
||||||
{
|
{
|
||||||
struct ConditionGraph *conditionPtr = GetConditionGraphDataPtr();
|
struct ConditionGraph *graph = GetConditionGraphPtr();
|
||||||
u8 id = GetMonMarkIndex();
|
u8 id = GetMonMarkIndex();
|
||||||
|
|
||||||
sUnknown_030012BC = id;
|
sUnknown_030012BC = id;
|
||||||
sub_81D1F84(conditionPtr, conditionPtr->unk14[3], conditionPtr->unk14[id]);
|
ConditionGraph_SetNewPositions(graph, graph->savedPositions[CONDITION_GRAPH_LOAD_MAX - 1], graph->savedPositions[id]);
|
||||||
TransitionConditionGraph(conditionPtr);
|
ConditionGraph_TryUpdate(graph);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_81CEEC8(void)
|
static void sub_81CEEC8(void)
|
||||||
{
|
{
|
||||||
struct ConditionGraph *conditionPtr = GetConditionGraphDataPtr();
|
struct ConditionGraph *graph = GetConditionGraphPtr();
|
||||||
|
|
||||||
if (IsConditionMenuSearchMode() || GetConditionGraphCurrentMonIndex() != GetMonListCount() - 1)
|
if (IsConditionMenuSearchMode() || GetConditionGraphCurrentMonIndex() != GetMonListCount() - 1)
|
||||||
sub_81D1F84(conditionPtr, conditionPtr->unk14[GetMonMarkIndex()], conditionPtr->unk14[3]);
|
ConditionGraph_SetNewPositions(graph, graph->savedPositions[GetMonMarkIndex()], graph->savedPositions[CONDITION_GRAPH_LOAD_MAX - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetMonMarkingsData(void)
|
u8 GetMonMarkingsData(void)
|
||||||
|
@ -471,7 +471,7 @@ static void VBlankCB_UsePokeblockMenu(void)
|
|||||||
LoadOam();
|
LoadOam();
|
||||||
ProcessSpriteCopyRequests();
|
ProcessSpriteCopyRequests();
|
||||||
TransferPlttBuffer();
|
TransferPlttBuffer();
|
||||||
sub_81D2108(&sMenu->graph);
|
ConditionGraph_Draw(&sMenu->graph);
|
||||||
ScanlineEffect_InitHBlankDmaTransfer();
|
ScanlineEffect_InitHBlankDmaTransfer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,19 +537,19 @@ static void LoadUsePokeblockMenu(void)
|
|||||||
sInfo->mainState++;
|
sInfo->mainState++;
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
sub_81D2754(sMenu->graph.conditions[0], sMenu->graph.unk14[0]);
|
ConditionGraph_CalcPositions(sMenu->graph.conditions[0], sMenu->graph.savedPositions[0]);
|
||||||
InitConditionGraphState(&sMenu->graph);
|
ConditionGraph_InitResetScanline(&sMenu->graph);
|
||||||
sInfo->mainState++;
|
sInfo->mainState++;
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
if (!SetupConditionGraphScanlineParams(&sMenu->graph))
|
if (!ConditionGraph_ResetScanline(&sMenu->graph))
|
||||||
{
|
{
|
||||||
sub_81D1F84(&sMenu->graph, sMenu->graph.unk14[0], sMenu->graph.unk14[0]);
|
ConditionGraph_SetNewPositions(&sMenu->graph, sMenu->graph.savedPositions[0], sMenu->graph.savedPositions[0]);
|
||||||
sInfo->mainState++;
|
sInfo->mainState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
sub_81D2230(&sMenu->graph);
|
ConditionGraph_Update(&sMenu->graph);
|
||||||
sInfo->mainState++;
|
sInfo->mainState++;
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
@ -781,13 +781,13 @@ static void ShowPokeblockResults(void)
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
CalculateConditionEnhancements();
|
CalculateConditionEnhancements();
|
||||||
sub_81D2754(sInfo->conditionsAfterBlock, sMenu->graph.unk14[3]);
|
ConditionGraph_CalcPositions(sInfo->conditionsAfterBlock, sMenu->graph.savedPositions[CONDITION_GRAPH_LOAD_MAX - 1]);
|
||||||
sub_81D1F84(&sMenu->graph, sMenu->graph.unk14[sMenu->curLoadId], sMenu->graph.unk14[3]);
|
ConditionGraph_SetNewPositions(&sMenu->graph, sMenu->graph.savedPositions[sMenu->curLoadId], sMenu->graph.savedPositions[CONDITION_GRAPH_LOAD_MAX - 1]);
|
||||||
LoadAndCreateUpDownSprites();
|
LoadAndCreateUpDownSprites();
|
||||||
sInfo->mainState++;
|
sInfo->mainState++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (!TransitionConditionGraph(&sMenu->graph))
|
if (!ConditionGraph_TryUpdate(&sMenu->graph))
|
||||||
{
|
{
|
||||||
CalculateNumAdditionalSparkles(GetPartyIdFromSelectionId(sMenu->info.curSelection));
|
CalculateNumAdditionalSparkles(GetPartyIdFromSelectionId(sMenu->info.curSelection));
|
||||||
if (sMenu->info.curSelection != sMenu->info.numSelections - 1)
|
if (sMenu->info.curSelection != sMenu->info.numSelections - 1)
|
||||||
@ -1365,7 +1365,7 @@ static bool8 LoadUsePokeblockMenuGfx(void)
|
|||||||
LoadBgTilemap(2, sMenu->tilemapBuffer, 1280, 0);
|
LoadBgTilemap(2, sMenu->tilemapBuffer, 1280, 0);
|
||||||
LoadPalette(gConditionGraphData_Pal, 48, 32);
|
LoadPalette(gConditionGraphData_Pal, 48, 32);
|
||||||
LoadPalette(gConditionText_Pal, 240, 32);
|
LoadPalette(gConditionText_Pal, 240, 32);
|
||||||
SetConditionGraphIOWindows(2);
|
ConditionGraph_InitWindow(2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sMenu->info.helperState = 0;
|
sMenu->info.helperState = 0;
|
||||||
@ -1416,7 +1416,7 @@ static void UpdateSelection(bool8 up)
|
|||||||
else
|
else
|
||||||
newLoadId = sMenu->nextLoadId;
|
newLoadId = sMenu->nextLoadId;
|
||||||
|
|
||||||
sub_81D1F84(&sMenu->graph, sMenu->graph.unk14[sMenu->curLoadId], sMenu->graph.unk14[newLoadId]);
|
ConditionGraph_SetNewPositions(&sMenu->graph, sMenu->graph.savedPositions[sMenu->curLoadId], sMenu->graph.savedPositions[newLoadId]);
|
||||||
|
|
||||||
if (sMenu->info.curSelection == sMenu->info.numSelections - 1)
|
if (sMenu->info.curSelection == sMenu->info.numSelections - 1)
|
||||||
startedOnMon = FALSE; // moving off of Cancel
|
startedOnMon = FALSE; // moving off of Cancel
|
||||||
@ -1484,7 +1484,7 @@ static bool8 LoadNewSelection_CancelToMon(void)
|
|||||||
sMenu->info.helperState++;
|
sMenu->info.helperState++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!ConditionGraph_UpdateMonEnter(&sMenu->graph, &sMenu->curMonXOffset))
|
if (!ConditionMenu_UpdateMonEnter(&sMenu->graph, &sMenu->curMonXOffset))
|
||||||
{
|
{
|
||||||
// Load the new adjacent pokemon (not the one being shown)
|
// Load the new adjacent pokemon (not the one being shown)
|
||||||
LoadMonInfo(sMenu->toLoadSelection, sMenu->toLoadId);
|
LoadMonInfo(sMenu->toLoadSelection, sMenu->toLoadId);
|
||||||
@ -1511,7 +1511,7 @@ static bool8 LoadNewSelection_MonToCancel(void)
|
|||||||
switch (sMenu->info.helperState)
|
switch (sMenu->info.helperState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (!ConditionGraph_UpdateMonExit(&sMenu->graph, &sMenu->curMonXOffset))
|
if (!ConditionMenu_UpdateMonExit(&sMenu->graph, &sMenu->curMonXOffset))
|
||||||
sMenu->info.helperState++;
|
sMenu->info.helperState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@ -1535,7 +1535,7 @@ static bool8 LoadNewSelection_MonToMon(void)
|
|||||||
switch (sMenu->info.helperState)
|
switch (sMenu->info.helperState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
TransitionConditionGraph(&sMenu->graph);
|
ConditionGraph_TryUpdate(&sMenu->graph);
|
||||||
if (!MoveConditionMonOffscreen(&sMenu->curMonXOffset))
|
if (!MoveConditionMonOffscreen(&sMenu->curMonXOffset))
|
||||||
{
|
{
|
||||||
UpdateMonPic(sMenu->curLoadId);
|
UpdateMonPic(sMenu->curLoadId);
|
||||||
@ -1547,7 +1547,7 @@ static bool8 LoadNewSelection_MonToMon(void)
|
|||||||
sMenu->info.helperState++;
|
sMenu->info.helperState++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!ConditionGraph_UpdateMonEnter(&sMenu->graph, &sMenu->curMonXOffset))
|
if (!ConditionMenu_UpdateMonEnter(&sMenu->graph, &sMenu->curMonXOffset))
|
||||||
{
|
{
|
||||||
// Load the new adjacent pokemon (not the one being shown)
|
// Load the new adjacent pokemon (not the one being shown)
|
||||||
LoadMonInfo(sMenu->toLoadSelection, sMenu->toLoadId);
|
LoadMonInfo(sMenu->toLoadSelection, sMenu->toLoadId);
|
||||||
|
Loading…
Reference in New Issue
Block a user