Merge pull request #1133 from GriffinRichards/doc-pblock

Document use_pokeblock
This commit is contained in:
PikalaxALT 2020-08-17 16:28:15 -04:00 committed by GitHub
commit 3372993a63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 1072 additions and 1005 deletions

View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

View File

Before

Width:  |  Height:  |  Size: 180 B

After

Width:  |  Height:  |  Size: 180 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 353 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

Before

Width:  |  Height:  |  Size: 88 B

After

Width:  |  Height:  |  Size: 88 B

View File

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

View File

@ -5,6 +5,15 @@
#include "player_pc.h"
#include "list_menu.h"
#include "pokemon.h"
#include "constants/berry.h"
#define TAG_CONDITION_MON 100
#define TAG_CONDITION_BALL 101
#define TAG_CONDITION_CANCEL 102
#define TAG_CONDITION_BALL_PLACEHOLDER 103
#define TAG_CONDITION_SPARKLE 104
#define MAX_CONDITION_SPARKLES 10
struct UnknownSubStruct_81D1ED4
{
@ -12,12 +21,12 @@ struct UnknownSubStruct_81D1ED4
u16 unk2;
};
struct UnknownStruct_81D1ED4
struct ConditionGraph
{
/*0x000*/ u8 unk0[4][5];
/*0x014*/ struct UnknownSubStruct_81D1ED4 unk14[4][5];
/*0x064*/ struct UnknownSubStruct_81D1ED4 unk64[10][5];
/*0x12C*/ struct UnknownSubStruct_81D1ED4 unk12C[5];
/*0x000*/ u8 unk0[4][FLAVOR_COUNT];
/*0x014*/ struct UnknownSubStruct_81D1ED4 unk14[4][FLAVOR_COUNT];
/*0x064*/ struct UnknownSubStruct_81D1ED4 unk64[10][FLAVOR_COUNT];
/*0x12C*/ struct UnknownSubStruct_81D1ED4 unk12C[FLAVOR_COUNT];
/*0x140*/ u16 unk140[66][2];
/*0x248*/ u16 unk248[66][2];
/*0x350*/ u16 unk350;
@ -32,35 +41,35 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page);
void sub_81D1E90(struct PlayerPCItemPageStruct *page);
void sub_81D1EC0(void);
void sub_81D1D04(u8 a0);
void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0);
void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D1ED4(struct ConditionGraph *graph);
void sub_81D2108(struct ConditionGraph *graph);
void sub_81D21DC(u8 bg);
void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0);
bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0);
bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0);
void sub_81D20AC(struct ConditionGraph *graph);
void sub_81D2230(struct ConditionGraph *graph);
bool8 sub_81D20BC(struct ConditionGraph *graph);
bool32 TransitionConditionGraph(struct ConditionGraph *graph);
void sub_81D2754(u8 *arg0, struct UnknownSubStruct_81D1ED4 *arg1);
void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2);
void sub_81D1F84(struct ConditionGraph *graph, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2);
void MoveRelearnerPrintText(u8 *str);
bool16 MoveRelearnerRunTextPrinters(void);
void MoveRelearnerCreateYesNoMenu(void);
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
void InitMoveRelearnerWindows(bool8 useContextWindow);
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst);
void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7);
void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8);
void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7);
bool8 sub_81D312C(s16 *var);
bool8 sub_81D3150(s16 *var);
bool8 sub_81D3178(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1);
bool8 sub_81D31A4(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1);
void sub_81D31D0(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal);
void sub_81D321C(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals);
void sub_81D32B0(struct SpriteSheet *sheet, struct SpritePalette *pal);
void sub_81D3464(struct Sprite **sprites);
void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2);
void sub_81D3520(struct Sprite **sprites);
void sub_81D354C(struct Sprite **sprites);
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 GetConditionMenuMonGfx(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel);
bool8 MoveConditionMonOnscreen(s16 *x);
bool8 MoveConditionMonOffscreen(s16 *x);
bool8 TryUpdateConditionMonTransitionOn(struct ConditionGraph *graph, s16 *x);
bool8 TryUpdateConditionMonTransitionOff(struct ConditionGraph *graph, s16 *x);
void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal);
void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals);
void LoadConditionSparkle(struct SpriteSheet *sheet, struct SpritePalette *pal);
void ResetConditionSparkleSprites(struct Sprite **sprites);
void CreateConditionSparkleSprites(struct Sprite **sprites, u8 monSpriteId, u8 count);
void DestroyConditionSparkleSprites(struct Sprite **sprites);
void FreeConditionSparkles(struct Sprite **sprites);
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 GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *currStats);

View File

@ -391,7 +391,7 @@ u32 sub_81CD070(void);
void sub_81CD1C0(void);
bool32 sub_81CD3C4(void);
bool32 sub_81CDD5C(void);
struct UnknownStruct_81D1ED4 *sub_81CDC70(void);
struct ConditionGraph *sub_81CDC70(void);
u16 sub_81CDC60(void);
u16 sub_81CDC50(void);
u8 sub_81CDDB0(void);

View File

@ -1313,10 +1313,9 @@ const u16 gContestResults_Tilemap[] = INCBIN_U16("graphics/contest/results_scree
// pokenav
const u16 gPokenavCondition_Pal[] = INCBIN_U16("graphics/pokenav/condition.gbapal");
const u32 gPokenavCondition_Gfx[] = INCBIN_U32("graphics/pokenav/condition.4bpp.lz");
const u32 gPokenavCondition_Tilemap[] = INCBIN_U32("graphics/pokenav/condition.bin.lz");
const u16 gPokenavCondition_Pal[] = INCBIN_U16("graphics/pokenav/condition/graph.gbapal");
const u32 gPokenavCondition_Gfx[] = INCBIN_U32("graphics/pokenav/condition/graph.4bpp.lz");
const u32 gPokenavCondition_Tilemap[] = INCBIN_U32("graphics/pokenav/condition/graph.bin.lz");
const u16 gPokenavOptions_Tilemap[] = INCBIN_U16("graphics/pokenav/options/options.bin");
const u32 gPokenavOptions_Gfx[] = INCBIN_U32("graphics/pokenav/options/options.4bpp.lz");
@ -1347,11 +1346,11 @@ const u32 gPokenavMessageBox_Tilemap[] = INCBIN_U32("graphics/pokenav/message.bi
const u16 gRegionMapCityZoomTiles_Pal[] = INCBIN_U16("graphics/pokenav/zoom_tiles.gbapal");
const u32 gRegionMapCityZoomText_Gfx[] = INCBIN_U32("graphics/pokenav/city_zoom_text.4bpp.lz");
const u16 gPokenavConditionCancel_Pal[] = INCBIN_U16("graphics/pokenav/cancel.gbapal");
const u8 gPokenavConditionCancel_Gfx[] = INCBIN_U8("graphics/pokenav/cancel.4bpp");
const u16 gPokenavConditionCancel_Pal[] = INCBIN_U16("graphics/pokenav/condition/cancel.gbapal");
const u8 gPokenavConditionCancel_Gfx[] = INCBIN_U8("graphics/pokenav/condition/cancel.4bpp");
const u16 gPokenavConditionMarker_Pal[] = INCBIN_U16("graphics/pokenav/marker.gbapal");
const u8 gPokenavConditionMarker_Gfx[] = INCBIN_U8("graphics/pokenav/marker.4bpp");
const u16 gPokenavConditionMarker_Pal[] = INCBIN_U16("graphics/pokenav/condition/marker.gbapal");
const u8 gPokenavConditionMarker_Gfx[] = INCBIN_U8("graphics/pokenav/condition/marker.4bpp");
const u16 gBerryBlenderMiscPalette[] = INCBIN_U16("graphics/berry_blender/misc.gbapal");

View File

@ -23,6 +23,7 @@
#include "text_window.h"
#include "trig.h"
#include "window.h"
#include "constants/berry.h"
#include "constants/songs.h"
#include "constants/species.h"
#include "gba/io_reg.h"
@ -33,13 +34,13 @@ EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0};
EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL;
static void sub_81D1E7C(s32 itemIndex, bool8 onInit, struct ListMenu *list);
static void sub_81D24A4(struct UnknownStruct_81D1ED4 *a0);
static void sub_81D2634(struct UnknownStruct_81D1ED4 *a0);
static void sub_81D24A4(struct ConditionGraph *a0);
static void sub_81D2634(struct ConditionGraph *a0);
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list);
static void nullsub_79(void);
static void sub_81D3408(struct Sprite *sprite);
static void sub_81D3564(struct Sprite *sprite);
static void sub_81D35E8(struct Sprite *sprite);
static void SetNextConditionSparkle(struct Sprite *sprite);
static void SpriteCB_ConditionSparkle(struct Sprite *sprite);
static void ShowAllConditionSparkles(struct Sprite *sprite);
static const struct WindowTemplate sUnknown_086253E8[] =
{
@ -79,7 +80,7 @@ static const u8 sPlayerNameTextColors[] =
static const u8 sEmptyItemName[] = _("");
static const struct ScanlineEffectParams sUnknown_08625404 =
static const struct ScanlineEffectParams sConditionGraphScanline =
{
.dmaDest = (void*)REG_ADDR_WIN0H,
.dmaControl = SCANLINE_EFFECT_DMACNT_32BIT,
@ -319,11 +320,11 @@ void sub_81D1EC0(void)
Free(sUnknown_0203CF4C);
}
void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0)
void sub_81D1ED4(struct ConditionGraph *a0)
{
u8 i, j;
for (j = 0; j < 5; j++)
for (j = 0; j < FLAVOR_COUNT; j++)
{
for (i = 0; i < 10; i++)
{
@ -345,7 +346,7 @@ void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0)
a0->unk352 = 0;
}
void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2)
void sub_81D1F84(struct ConditionGraph *graph, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2)
{
u16 i, j;
s32 r5, r6;
@ -356,30 +357,30 @@ void sub_81D1F84(struct UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D
r6 = ((arg2[i].unk0 - arg1[i].unk0) << 8) / 10;
for (j = 0; j < 9; j++)
{
arg0->unk64[j][i].unk0 = (r5 >> 8) + ((r5 >> 7) & 1);
graph->unk64[j][i].unk0 = (r5 >> 8) + ((r5 >> 7) & 1);
r5 += r6;
}
arg0->unk64[j][i].unk0 = arg2[i].unk0;
graph->unk64[j][i].unk0 = arg2[i].unk0;
r5 = arg1[i].unk2 << 8;
r6 = ((arg2[i].unk2 - arg1[i].unk2) << 8) / 10;
for (j = 0; j < 9; j++)
{
arg0->unk64[j][i].unk2 = (r5 >> 8) + ((r5 >> 7) & 1);
graph->unk64[j][i].unk2 = (r5 >> 8) + ((r5 >> 7) & 1);
r5 += r6;
}
arg0->unk64[j][i].unk2 = arg2[i].unk2;
graph->unk64[j][i].unk2 = arg2[i].unk2;
}
arg0->unk352 = 0;
graph->unk352 = 0;
}
bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0)
bool32 TransitionConditionGraph(struct ConditionGraph *graph)
{
if (a0->unk352 < 10)
if (graph->unk352 < 10)
{
sub_81D2230(a0);
return (++a0->unk352 != 10);
sub_81D2230(graph);
return (++graph->unk352 != 10);
}
else
{
@ -387,48 +388,48 @@ bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0)
}
}
void sub_81D20AC(struct UnknownStruct_81D1ED4 *a0)
void sub_81D20AC(struct ConditionGraph *a0)
{
a0->unk355 = 0;
}
bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0)
bool8 sub_81D20BC(struct ConditionGraph *graph)
{
struct ScanlineEffectParams params;
switch (arg0->unk355)
switch (graph->unk355)
{
case 0:
ScanlineEffect_Clear();
arg0->unk355++;
graph->unk355++;
return TRUE;
case 1:
params = sUnknown_08625404;
params = sConditionGraphScanline;
ScanlineEffect_SetParams(params);
arg0->unk355++;
graph->unk355++;
return FALSE;
default:
return FALSE;
}
}
void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0)
void sub_81D2108(struct ConditionGraph *graph)
{
u16 i;
if (arg0->unk354 == 0)
if (graph->unk354 == 0)
return;
sub_81D24A4(arg0);
sub_81D2634(arg0);
sub_81D24A4(graph);
sub_81D2634(graph);
for (i = 0; i < 66; i++)
{
gScanlineEffectRegBuffers[1][(i + 55) * 2] = gScanlineEffectRegBuffers[0][(i + 55) * 2] = (arg0->unk140[i][0] << 8) | (arg0->unk140[i][1]);
gScanlineEffectRegBuffers[1][(i + 55) * 2 + 1] = gScanlineEffectRegBuffers[0][(i + 55) * 2 + 1] = (arg0->unk248[i][0] << 8) | (arg0->unk248[i][1]);
gScanlineEffectRegBuffers[1][(i + 55) * 2] = gScanlineEffectRegBuffers[0][(i + 55) * 2] = (graph->unk140[i][0] << 8) | (graph->unk140[i][1]);
gScanlineEffectRegBuffers[1][(i + 55) * 2 + 1] = gScanlineEffectRegBuffers[0][(i + 55) * 2 + 1] = (graph->unk248[i][0] << 8) | (graph->unk248[i][1]);
}
arg0->unk354 = 0;
graph->unk354 = 0;
}
void sub_81D21DC(u8 bg)
@ -441,24 +442,24 @@ void sub_81D21DC(u8 bg)
// Unset the WINOUT flag for the bg.
flags = (WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ) & ~(1 << bg);
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 0xF0));
SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(0, 0x9B));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0x38, 0x79));
SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(0x38, 0x79));
SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE( 0, DISPLAY_WIDTH));
SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE( 0, 155));
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(56, 121));
SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(56, 121));
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);
}
void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0)
void sub_81D2230(struct ConditionGraph *graph)
{
u16 i;
for (i = 0; i < 5; i++)
arg0->unk12C[i] = arg0->unk64[arg0->unk352][i];
for (i = 0; i < FLAVOR_COUNT; i++)
graph->unk12C[i] = graph->unk64[graph->unk352][i];
arg0->unk354 = 1;
graph->unk354 = 1;
}
static void sub_81D2278(struct UnknownStruct_81D1ED4 *arg0, u16 *arg1, struct UnknownSubStruct_81D1ED4 *arg2, struct UnknownSubStruct_81D1ED4 *arg3, u8 arg4, u16 *arg5)
static void sub_81D2278(struct ConditionGraph *graph, u16 *arg1, struct UnknownSubStruct_81D1ED4 *arg2, struct UnknownSubStruct_81D1ED4 *arg3, u8 arg4, u16 *arg5)
{
u16 i, r8, r10, r0, var_30;
u16 *ptr;
@ -509,8 +510,8 @@ static void sub_81D2278(struct UnknownStruct_81D1ED4 *arg0, u16 *arg1, struct Un
break;
}
arg0->unk350 = r10 + i;
arg1 += (arg0->unk350 - 56) * 2;
graph->unk350 = r10 + i;
arg1 += (graph->unk350 - 56) * 2;
for (; i < r8; i++)
{
arg1[arg4] = (r4 >> 10) + ((r4 >> 9) & 1) + arg4;
@ -535,8 +536,8 @@ static void sub_81D2278(struct UnknownStruct_81D1ED4 *arg0, u16 *arg1, struct Un
arg1 += 2;
}
arg0->unk350 = r10 + i;
arg5 += (arg0->unk350 - 56) * 2;
graph->unk350 = r10 + i;
arg5 += (graph->unk350 - 56) * 2;
for (; i < r8; i++)
{
arg5[arg4] = (r4 >> 10) + ((r4 >> 9) & 1) + arg4;
@ -548,7 +549,7 @@ static void sub_81D2278(struct UnknownStruct_81D1ED4 *arg0, u16 *arg1, struct Un
}
else
{
arg0->unk350 = r10;
graph->unk350 = r10;
arg1 += (r10 - 56) * 2;
arg5 += (r10 - 56) * 2;
arg1[1] = arg2->unk0 + 1;
@ -560,87 +561,87 @@ static void sub_81D2278(struct UnknownStruct_81D1ED4 *arg0, u16 *arg1, struct Un
ptr[arg4] = arg4 + var_30;
}
static void sub_81D24A4(struct UnknownStruct_81D1ED4 *arg0)
static void sub_81D24A4(struct ConditionGraph *graph)
{
u16 i, r6, varMax;
if (arg0->unk12C[0].unk2 < arg0->unk12C[1].unk2)
if (graph->unk12C[0].unk2 < graph->unk12C[1].unk2)
{
r6 = arg0->unk12C[0].unk2;
sub_81D2278(arg0, arg0->unk140[0], &arg0->unk12C[0], &arg0->unk12C[1], 1, NULL);
r6 = graph->unk12C[0].unk2;
sub_81D2278(graph, graph->unk140[0], &graph->unk12C[0], &graph->unk12C[1], 1, NULL);
}
else
{
r6 = arg0->unk12C[1].unk2;
sub_81D2278(arg0, arg0->unk140[0], &arg0->unk12C[1], &arg0->unk12C[0], 0, NULL);
r6 = graph->unk12C[1].unk2;
sub_81D2278(graph, graph->unk140[0], &graph->unk12C[1], &graph->unk12C[0], 0, NULL);
}
sub_81D2278(arg0, arg0->unk140[0], &arg0->unk12C[1], &arg0->unk12C[2], 1, NULL);
sub_81D2278(graph, graph->unk140[0], &graph->unk12C[1], &graph->unk12C[2], 1, NULL);
i = (arg0->unk12C[2].unk2 <= arg0->unk12C[3].unk2);
sub_81D2278(arg0, arg0->unk140[0], &arg0->unk12C[2], &arg0->unk12C[3], i, arg0->unk248[0]);
i = (graph->unk12C[2].unk2 <= graph->unk12C[3].unk2);
sub_81D2278(graph, graph->unk140[0], &graph->unk12C[2], &graph->unk12C[3], i, graph->unk248[0]);
for (i = 56; i < r6; i++)
{
arg0->unk140[i - 56][0] = 0;
arg0->unk140[i - 56][1] = 0;
graph->unk140[i - 56][0] = 0;
graph->unk140[i - 56][1] = 0;
}
for (i = arg0->unk12C[0].unk2; i <= arg0->unk350; i++)
arg0->unk140[i - 56][0] = 155;
for (i = graph->unk12C[0].unk2; i <= graph->unk350; i++)
graph->unk140[i - 56][0] = 155;
varMax = max(arg0->unk350, arg0->unk12C[2].unk2);
varMax = max(graph->unk350, graph->unk12C[2].unk2);
for (i = varMax + 1; i < 122; i++)
{
arg0->unk140[i - 56][0] = 0;
arg0->unk140[i - 56][1] = 0;
graph->unk140[i - 56][0] = 0;
graph->unk140[i - 56][1] = 0;
}
for (i = 56; i < 122; i++)
{
if (arg0->unk140[i - 56][0] == 0 && arg0->unk140[i - 56][1] != 0)
arg0->unk140[i - 56][0] = 155;
if (graph->unk140[i - 56][0] == 0 && graph->unk140[i - 56][1] != 0)
graph->unk140[i - 56][0] = 155;
}
}
static void sub_81D2634(struct UnknownStruct_81D1ED4 *arg0)
static void sub_81D2634(struct ConditionGraph *graph)
{
s32 i, r6, varMax;
if (arg0->unk12C[0].unk2 < arg0->unk12C[4].unk2)
if (graph->unk12C[0].unk2 < graph->unk12C[4].unk2)
{
r6 = arg0->unk12C[0].unk2;
sub_81D2278(arg0, arg0->unk248[0], &arg0->unk12C[0], &arg0->unk12C[4], 0, NULL);
r6 = graph->unk12C[0].unk2;
sub_81D2278(graph, graph->unk248[0], &graph->unk12C[0], &graph->unk12C[4], 0, NULL);
}
else
{
r6 = arg0->unk12C[4].unk2;
sub_81D2278(arg0, arg0->unk248[0], &arg0->unk12C[4], &arg0->unk12C[0], 1, NULL);
r6 = graph->unk12C[4].unk2;
sub_81D2278(graph, graph->unk248[0], &graph->unk12C[4], &graph->unk12C[0], 1, NULL);
}
sub_81D2278(arg0, arg0->unk248[0], &arg0->unk12C[4], &arg0->unk12C[3], 0, NULL);
sub_81D2278(graph, graph->unk248[0], &graph->unk12C[4], &graph->unk12C[3], 0, NULL);
for (i = 56; i < r6; i++)
{
arg0->unk140[i + 10][0] = 0;
arg0->unk140[i + 10][1] = 0;
graph->unk140[i + 10][0] = 0;
graph->unk140[i + 10][1] = 0;
}
for (i = arg0->unk12C[0].unk2; i <= arg0->unk350; i++)
arg0->unk140[i + 10][1] = 155;
for (i = graph->unk12C[0].unk2; i <= graph->unk350; i++)
graph->unk140[i + 10][1] = 155;
varMax = max(arg0->unk350, arg0->unk12C[3].unk2 + 1);
varMax = max(graph->unk350, graph->unk12C[3].unk2 + 1);
for (i = varMax; i < 122; i++)
{
arg0->unk140[i + 10][0] = 0;
arg0->unk140[i + 10][1] = 0;
graph->unk140[i + 10][0] = 0;
graph->unk140[i + 10][1] = 0;
}
for (i = 0; i < 66; i++)
{
if (arg0->unk248[i][0] >= arg0->unk248[i][1])
if (graph->unk248[i][0] >= graph->unk248[i][1])
{
arg0->unk248[i][1] = 0;
arg0->unk248[i][0] = 0;
graph->unk248[i][1] = 0;
graph->unk248[i][0] = 0;
}
}
}
@ -877,7 +878,8 @@ s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst)
return ret;
}
static u8 *sub_81D2CD0(u8 *dst, u16 boxId, u16 monId)
// Gets the name/gender/level string for the condition menu
static u8 *GetConditionMenuMonString(u8 *dst, u16 boxId, u16 monId)
{
u16 species, level, gender;
struct BoxPokemon *boxMon;
@ -964,7 +966,8 @@ static u8 *sub_81D2CD0(u8 *dst, u16 boxId, u16 monId)
}
}
static u8 *sub_81D2E7C(u8 *dst, const u8 *src, s16 n)
// 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)
{
while (*src != EOS)
{
@ -978,80 +981,83 @@ static u8 *sub_81D2E7C(u8 *dst, const u8 *src, s16 n)
return dst;
}
void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7)
void GetConditionMenuMonNameAndLocString(u8 *locationDst, u8 *nameDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel)
{
u16 i;
if (!arg7)
arg6--;
// In this and the below 2 functions, numMons is passed as the number of menu selections (which includes Cancel)
// 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--;
if (arg5 != arg6)
if (partyId != numMons)
{
sub_81D2CD0(nameDst, boxId, monId);
dst[0] = EXT_CTRL_CODE_BEGIN;
dst[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
dst[2] = TEXT_COLOR_BLUE;
dst[3] = TEXT_COLOR_TRANSPARENT;
dst[4] = TEXT_COLOR_LIGHT_BLUE;
GetConditionMenuMonString(nameDst, boxId, monId);
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;
if (boxId == TOTAL_BOXES_COUNT) // Party mon.
{
sub_81D2E7C(dst + 5, gText_InParty, 8);
BufferConditionMenuSpacedStringN(&locationDst[5], gText_InParty, 8);
}
else
{
boxId++;boxId--; // Again...Someone fix this maybe?
sub_81D2E7C(dst + 5, GetBoxNamePtr(boxId), 8);
BufferConditionMenuSpacedStringN(&locationDst[5], GetBoxNamePtr(boxId), 8);
}
}
else
{
for (i = 0; i < 12; i++)
for (i = 0; i < POKEMON_NAME_LENGTH + 2; i++)
nameDst[i] = CHAR_SPACE;
nameDst[i] = EOS;
for (i = 0; i < 8; i++)
dst[i] = CHAR_SPACE;
dst[i] = EOS;
locationDst[i] = CHAR_SPACE;
locationDst[i] = EOS;
}
}
void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8)
void GetConditionMenuMonConditions(struct ConditionGraph *graph, u8 *sheen, u16 boxId, u16 monId, u16 partyId, u16 id, u16 numMons, bool8 excludesCancel)
{
u16 i;
if (!arg8)
arg7--;
if (!excludesCancel)
numMons--;
if (arg5 != arg7)
if (partyId != numMons)
{
arg0->unk0[id][0] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
arg0->unk0[id][1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
arg0->unk0[id][2] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
arg0->unk0[id][3] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
arg0->unk0[id][4] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
graph->unk0[id][0] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
graph->unk0[id][1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
graph->unk0[id][2] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
graph->unk0[id][3] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
graph->unk0[id][4] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
sheen[id] = (GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) != 0xFF)
? GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) / 29u
: 9;
sub_81D2754(arg0->unk0[id], arg0->unk14[id]);
sub_81D2754(graph->unk0[id], graph->unk14[id]);
}
else
{
for (i = 0; i < 5; i++)
for (i = 0; i < FLAVOR_COUNT; i++)
{
arg0->unk0[id][i] = 0;
arg0->unk14[id][i].unk0 = 155;
arg0->unk14[id][i].unk2 = 91;
graph->unk0[id][i] = 0;
graph->unk14[id][i].unk0 = 155;
graph->unk14[id][i].unk2 = 91;
}
}
}
void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7)
void GetConditionMenuMonGfx(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 partyId, u16 numMons, bool8 excludesCancel)
{
if (!arg7)
arg6--;
if (!excludesCancel)
numMons--;
if (arg5 != arg6)
if (partyId != numMons)
{
u16 species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL);
u32 trainerId = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
@ -1062,46 +1068,46 @@ void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u
}
}
bool8 sub_81D312C(s16 *var)
bool8 MoveConditionMonOnscreen(s16 *x)
{
*var += 24;
if (*var > 0)
*var = 0;
*x += 24;
if (*x > 0)
*x = 0;
return (*var != 0);
return (*x != 0);
}
bool8 sub_81D3150(s16 *var)
bool8 MoveConditionMonOffscreen(s16 *x)
{
*var -= 24;
if (*var < -80)
*var = -80;
*x -= 24;
if (*x < -80)
*x = -80;
return (*var != -80);
return (*x != -80);
}
bool8 sub_81D3178(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1)
bool8 TryUpdateConditionMonTransitionOn(struct ConditionGraph *graph, s16 *x)
{
bool8 var1 = sub_81D2074(arg0);
bool8 var2 = sub_81D312C(arg1);
bool8 graphUpdating = TransitionConditionGraph(graph);
bool8 monUpdating = MoveConditionMonOnscreen(x);
return ((var1 != 0) || (var2 != 0));
return (graphUpdating || monUpdating);
}
bool8 sub_81D31A4(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1)
bool8 TryUpdateConditionMonTransitionOff(struct ConditionGraph *graph, s16 *x)
{
bool8 var1 = sub_81D2074(arg0);
bool8 var2 = sub_81D3150(arg1);
bool8 graphUpdating = TransitionConditionGraph(graph);
bool8 monUpdating = MoveConditionMonOffscreen(x);
return ((var1 != 0) || (var2 != 0));
return (graphUpdating || monUpdating);
}
static const u32 gUnknown_08625560[] = INCBIN_U32("graphics/pokenav/pokeball.4bpp");
static const u32 gUnknown_08625660[] = INCBIN_U32("graphics/pokenav/pokeball_placeholder.4bpp");
static const u16 gUnknown_08625680[] = INCBIN_U16("graphics/pokenav/sparkle.gbapal");
static const u32 gUnknown_086256A0[] = INCBIN_U32("graphics/pokenav/sparkle.4bpp");
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");
static const struct OamData sOamData_8625A20 =
static const struct OamData sOam_ConditionMonPic =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -1118,7 +1124,7 @@ static const struct OamData sOamData_8625A20 =
.affineParam = 0
};
static const struct OamData sOamData_8625A28 =
static const struct OamData sOam_ConditionSelectionIcon =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -1135,71 +1141,73 @@ static const struct OamData sOamData_8625A28 =
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_8625A30[] =
static const union AnimCmd sAnim_ConditionSelectionIcon_Selected[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_8625A38[] =
static const union AnimCmd sAnim_ConditionSelectionIcon_Unselected[] =
{
ANIMCMD_FRAME(4, 5),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_8625A40[] =
static const union AnimCmd *const sAnims_ConditionSelectionIcon[] =
{
sSpriteAnim_8625A30,
sSpriteAnim_8625A38
sAnim_ConditionSelectionIcon_Selected,
sAnim_ConditionSelectionIcon_Unselected
};
void sub_81D31D0(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal)
// 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)
{
struct SpriteSheet dataSheet = {NULL, 0x800, 100};
struct SpriteSheet dataSheet = {NULL, 0x800, TAG_CONDITION_MON};
struct SpriteTemplate dataTemplate =
{
.tileTag = 100,
.paletteTag = 100,
.oam = &sOamData_8625A20,
.tileTag = TAG_CONDITION_MON,
.paletteTag = TAG_CONDITION_MON,
.oam = &sOam_ConditionMonPic,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
struct SpritePalette dataPal = {NULL, 100};
struct SpritePalette dataPal = {NULL, TAG_CONDITION_MON};
*sheet = dataSheet;
*template = dataTemplate;
*pal = dataPal;
}
void sub_81D321C(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals)
void LoadConditionSelectionIcons(struct SpriteSheet *sheets, struct SpriteTemplate * template, struct SpritePalette *pals)
{
u8 i;
struct SpriteSheet dataSheets[] =
{
{gUnknown_08625560, 0x100, 101},
{gUnknown_08625660, 0x20, 103},
{gPokenavConditionCancel_Gfx, 0x100, 102},
{sConditionPokeball_Gfx, 0x100, TAG_CONDITION_BALL},
{sConditionPokeballPlaceholder_Gfx, 0x20, TAG_CONDITION_BALL_PLACEHOLDER},
{gPokenavConditionCancel_Gfx, 0x100, TAG_CONDITION_CANCEL},
{},
};
struct SpritePalette dataPals[] =
{
{gPokenavConditionCancel_Pal, 101},
{gPokenavConditionCancel_Pal + 16, 102},
{gPokenavConditionCancel_Pal, TAG_CONDITION_BALL},
{gPokenavConditionCancel_Pal + 16, TAG_CONDITION_CANCEL},
{},
};
// Tag is overwritten for the other selection icons
struct SpriteTemplate dataTemplate =
{
.tileTag = 101,
.paletteTag = 101,
.oam = &sOamData_8625A28,
.anims = sSpriteAnimTable_8625A40,
.tileTag = TAG_CONDITION_BALL,
.paletteTag = TAG_CONDITION_BALL,
.oam = &sOam_ConditionSelectionIcon,
.anims = sAnims_ConditionSelectionIcon,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
@ -1214,34 +1222,41 @@ void sub_81D321C(struct SpriteSheet *sheets, struct SpriteTemplate * template, s
*(pals++) = dataPals[i];
}
void sub_81D32B0(struct SpriteSheet *sheet, struct SpritePalette *pal)
#define sSparkleId data[0]
#define sDelayTimer data[1]
#define sNumExtraSparkles data[2]
#define sCurSparkleId data[3]
#define sMonSpriteId data[4]
#define sNextSparkleSpriteId data[5]
void LoadConditionSparkle(struct SpriteSheet *sheet, struct SpritePalette *pal)
{
struct SpriteSheet dataSheet = {gUnknown_086256A0, 0x380, 104};
struct SpritePalette dataPal = {gUnknown_08625680, 104};
struct SpriteSheet dataSheet = {sConditionSparkle_Pal, 0x380, TAG_CONDITION_SPARKLE};
struct SpritePalette dataPal = {sConditionSparkle_Gfx, TAG_CONDITION_SPARKLE};
*sheet = dataSheet;
*pal = dataPal;
}
static void sub_81D32D4(struct Sprite *sprite)
static void SpriteCB_ConditionSparkle_DoNextAfterDelay(struct Sprite *sprite)
{
if (++sprite->data[1] > 60)
if (++sprite->sDelayTimer > 60)
{
sprite->data[1] = 0;
sub_81D3408(sprite);
sprite->sDelayTimer = 0;
SetNextConditionSparkle(sprite);
}
}
static void sub_81D32F4(struct Sprite *sprite)
static void SpriteCB_ConditionSparkle_WaitForAllAnim(struct Sprite *sprite)
{
if (sprite->animEnded)
{
sprite->data[1] = 0;
sprite->callback = sub_81D32D4;
sprite->sDelayTimer = 0;
sprite->callback = SpriteCB_ConditionSparkle_DoNextAfterDelay;
}
}
static const struct OamData sOamData_8625AD0 =
static const struct OamData sOam_ConditionSparkle =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
@ -1253,7 +1268,7 @@ static const struct OamData sOamData_8625AD0 =
.priority = 0,
};
static const union AnimCmd sSpriteAnim_8625AD8[] =
static const union AnimCmd sAnim_ConditionSparkle[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(4, 5),
@ -1265,133 +1280,120 @@ static const union AnimCmd sSpriteAnim_8625AD8[] =
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_8625AF8[] =
static const union AnimCmd *const sAnims_ConditionSparkle[] =
{
sSpriteAnim_8625AD8,
sSpriteAnim_8625AD8 + 2,
&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],
};
// unused
static const union AnimCmd *const sSpriteAnimTable_8625B00[] =
static const struct SpriteTemplate sSpriteTemplate_ConditionSparkle =
{
sSpriteAnim_8625AD8 + 4,
sSpriteAnim_8625AD8 + 6,
};
// unused
static const union AnimCmd *const sSpriteAnimTable_8625B08[] =
{
sSpriteAnim_8625AD8 + 8,
sSpriteAnim_8625AD8 + 10,
};
// unused
static const union AnimCmd *const *const sUnknown_08625B10 = sSpriteAnimTable_8625B08;
const struct SpriteTemplate gUnknown_08625B14 =
{
.tileTag = 104,
.paletteTag = 104,
.oam = &sOamData_8625AD0,
.anims = sSpriteAnimTable_8625AF8,
.tileTag = TAG_CONDITION_SPARKLE,
.paletteTag = TAG_CONDITION_SPARKLE,
.oam = &sOam_ConditionSparkle,
.anims = sAnims_ConditionSparkle,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_81D3564,
.callback = SpriteCB_ConditionSparkle,
};
static const s16 gUnknown_08625B2C[][2] =
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},
{ 0, -35},
{ 20, -28},
{ 33, -10},
{ 33, 10},
{ 20, 28},
{ 0, 35},
{-20, 28},
{-33, 10},
{-33, -10},
{-20, -28},
};
void sub_81D3314(struct Sprite *sprite)
static void SetConditionSparklePosition(struct Sprite *sprite)
{
struct Sprite *sprite2 = &gSprites[sprite->data[4]];
struct Sprite *mon = &gSprites[sprite->sMonSpriteId];
if (sprite2 != NULL)
if (mon != NULL)
{
sprite->pos1.x = sprite2->pos1.x + sprite2->pos2.x + gUnknown_08625B2C[sprite->data[0]][0];
sprite->pos1.y = sprite2->pos1.y + sprite2->pos2.y + gUnknown_08625B2C[sprite->data[0]][1];
sprite->pos1.x = mon->pos1.x + mon->pos2.x + sConditionSparkleCoords[sprite->sSparkleId][0];
sprite->pos1.y = mon->pos1.y + mon->pos2.y + sConditionSparkleCoords[sprite->sSparkleId][1];
}
else
{
sprite->pos1.x = gUnknown_08625B2C[sprite->data[0]][0] + 40;
sprite->pos1.y = gUnknown_08625B2C[sprite->data[0]][1] + 104;
sprite->pos1.x = sConditionSparkleCoords[sprite->sSparkleId][0] + 40;
sprite->pos1.y = sConditionSparkleCoords[sprite->sSparkleId][1] + 104;
}
}
void sub_81D338C(u8 arg0, u8 arg1, struct Sprite **sprites)
static void InitConditionSparkles(u8 count, bool8 allowFirstShowAll, struct Sprite **sprites)
{
u16 i;
for (i = 0; i < 10; i++)
for (i = 0; i < MAX_CONDITION_SPARKLES; i++)
{
if (sprites[i] != NULL)
{
sprites[i]->data[0] = i;
sprites[i]->data[1] = (i * 16) + 1;
sprites[i]->data[2] = arg0;
sprites[i]->data[3] = i;
if (arg1 == 0 || arg0 != 9)
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)
{
sprites[i]->callback = sub_81D3564;
sprites[i]->callback = SpriteCB_ConditionSparkle;
}
else
{
sub_81D3314(sprites[i]);
sub_81D35E8(sprites[i]);
sprites[i]->callback = sub_81D32F4;
SetConditionSparklePosition(sprites[i]);
ShowAllConditionSparkles(sprites[i]);
sprites[i]->callback = SpriteCB_ConditionSparkle_WaitForAllAnim;
sprites[i]->invisible = FALSE;
}
}
}
}
static void sub_81D3408(struct Sprite *sprite)
static void SetNextConditionSparkle(struct Sprite *sprite)
{
u16 i;
u8 id = sprite->data[5];
for (i = 0; i < sprite->data[2] + 1; i++)
u8 id = sprite->sNextSparkleSpriteId;
for (i = 0; i < sprite->sNumExtraSparkles + 1; i++)
{
gSprites[id].data[1] = (gSprites[id].data[0] * 16) + 1;
gSprites[id].callback = sub_81D3564;
id = gSprites[id].data[5];
gSprites[id].sDelayTimer = (gSprites[id].sSparkleId * 16) + 1;
gSprites[id].callback = SpriteCB_ConditionSparkle;
id = gSprites[id].sNextSparkleSpriteId;
}
}
void sub_81D3464(struct Sprite **sprites)
void ResetConditionSparkleSprites(struct Sprite **sprites)
{
u8 i;
for (i = 0; i < 10; i++)
for (i = 0; i < MAX_CONDITION_SPARKLES; i++)
sprites[i] = NULL;
}
void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2)
void CreateConditionSparkleSprites(struct Sprite **sprites, u8 monSpriteId, u8 _count)
{
u16 i, spriteId, firstSpriteId = 0;
u8 count = arg2;
u8 count = _count;
for (i = 0; i < count + 1; i++)
{
spriteId = CreateSprite(&gUnknown_08625B14, 0, 0, 0);
spriteId = CreateSprite(&sSpriteTemplate_ConditionSparkle, 0, 0, 0);
if (spriteId != MAX_SPRITES)
{
sprites[i] = &gSprites[spriteId];
sprites[i]->invisible = TRUE;
sprites[i]->data[4] = arg1;
sprites[i]->sMonSpriteId = monSpriteId;
if (i != 0)
sprites[i - 1]->data[5] = spriteId;
sprites[i - 1]->sNextSparkleSpriteId = spriteId;
else
firstSpriteId = spriteId;
}
@ -1401,15 +1403,15 @@ void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2)
}
}
sprites[count]->data[5] = firstSpriteId;
sub_81D338C(count, 1, sprites);
sprites[count]->sNextSparkleSpriteId = firstSpriteId;
InitConditionSparkles(count, TRUE, sprites);
}
void sub_81D3520(struct Sprite **sprites)
void DestroyConditionSparkleSprites(struct Sprite **sprites)
{
u16 i;
for (i = 0; i < 10; i++)
for (i = 0; i < MAX_CONDITION_SPARKLES; i++)
{
if (sprites[i] != NULL)
{
@ -1423,38 +1425,41 @@ void sub_81D3520(struct Sprite **sprites)
}
}
void sub_81D354C(struct Sprite **sprites)
void FreeConditionSparkles(struct Sprite **sprites)
{
sub_81D3520(sprites);
FreeSpriteTilesByTag(104);
FreeSpritePaletteByTag(104);
DestroyConditionSparkleSprites(sprites);
FreeSpriteTilesByTag(TAG_CONDITION_SPARKLE);
FreeSpritePaletteByTag(TAG_CONDITION_SPARKLE);
}
static void sub_81D3564(struct Sprite *sprite)
static void SpriteCB_ConditionSparkle(struct Sprite *sprite)
{
if (sprite->data[1] != 0)
// Delay, then do sparkle anim
if (sprite->sDelayTimer != 0)
{
if (--sprite->data[1] != 0)
if (--sprite->sDelayTimer != 0)
return;
SeekSpriteAnim(sprite, 0);
sprite->invisible = FALSE;
}
sub_81D3314(sprite);
SetConditionSparklePosition(sprite);
// Set up next sparkle
if (sprite->animEnded)
{
sprite->invisible = TRUE;
if (sprite->data[3] == sprite->data[2])
if (sprite->sCurSparkleId == sprite->sNumExtraSparkles)
{
if (sprite->data[3] == 9)
if (sprite->sCurSparkleId == MAX_CONDITION_SPARKLES - 1)
{
sub_81D35E8(sprite);
sprite->callback = sub_81D32F4;
ShowAllConditionSparkles(sprite);
sprite->callback = SpriteCB_ConditionSparkle_WaitForAllAnim;
}
else
{
sprite->callback = sub_81D32D4;
sprite->callback = SpriteCB_ConditionSparkle_DoNextAfterDelay;
}
}
else
@ -1464,18 +1469,25 @@ static void sub_81D3564(struct Sprite *sprite)
}
}
static void sub_81D35E8(struct Sprite *sprite)
static void ShowAllConditionSparkles(struct Sprite *sprite)
{
u8 i, id = sprite->data[5];
u8 i, id = sprite->sNextSparkleSpriteId;
for (i = 0; i < sprite->data[2] + 1; i++)
for (i = 0; i < sprite->sNumExtraSparkles + 1; i++)
{
SeekSpriteAnim(&gSprites[id], 0);
gSprites[id].invisible = FALSE;
id = gSprites[id].data[5];
id = gSprites[id].sNextSparkleSpriteId;
}
}
#undef sSparkleId
#undef sDelayTimer
#undef sNumExtraSparkles
#undef sCurSparkleId
#undef sMonSpriteId
#undef sNextSparkleSpriteId
static const u8 *const sLvlUpStatStrings[NUM_STATS] =
{
gText_MaxHP,

View File

@ -25,7 +25,7 @@ struct PokenavSub11
u8 fill2[0x6320 - 0x6308];
u8 unk6320[3][24];
u8 unk6368[3][64];
struct UnknownStruct_81D1ED4 unk6428;
struct ConditionGraph unk6428;
u8 unk6780[3];
u8 unk6783[3];
s8 unk6786;
@ -546,7 +546,7 @@ u16 sub_81CDC60(void)
return unkPtr->unk2;
}
struct UnknownStruct_81D1ED4 *sub_81CDC70(void)
struct ConditionGraph *sub_81CDC70(void)
{
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
return &structPtr->unk6428;

View File

@ -24,8 +24,8 @@ u32 sub_81CE700(s32);
BSS_DATA u8 gUnknown_030012BC;
const u16 gUnknown_086231E8[] = INCBIN_U16("graphics/pokenav/86231E8.gbapal");
const u16 gUnknown_08623208[] = INCBIN_U16("graphics/pokenav/8623208.gbapal");
const u16 gConditionGraphData_Pal[] = INCBIN_U16("graphics/pokenav/condition/graph_data.gbapal");
const u16 gConditionText_Pal[] = INCBIN_U16("graphics/pokenav/condition/text.gbapal");
const u32 gUnknown_08623228[] = INCBIN_U32("graphics/pokenav/8623228.4bpp.lz");
const u32 gUnknown_0862323C[] = INCBIN_U32("graphics/pokenav/862323C.bin.lz");
const u16 gUnknown_08623338[] = INCBIN_U16("graphics/pokenav/8623338.gbapal");
@ -134,7 +134,7 @@ struct Pokenav7Struct
u8 unk1823;
struct PokemonMarkMenu monMarks;
struct Sprite *unk28dc;
struct Sprite *unk28e0[10];
struct Sprite *unk28e0[MAX_CONDITION_SPARKLES];
u8 unk2908;
u8 filler2[0x38ac - 0x2909];
};
@ -226,7 +226,7 @@ u32 sub_81CDE94(s32 state)
CopyBgTilemapBufferToVram(3);
CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gUnknown_08623208, 0xF0, 0x20);
CopyPaletteIntoBufferUnfaded(gConditionText_Pal, 0xF0, 0x20);
structPtr->unk1814 = -80;
return LT_INC_AND_PAUSE;
case 4:
@ -236,7 +236,7 @@ u32 sub_81CDE94(s32 state)
LZ77UnCompVram(gUnknown_0862323C, structPtr->tilemapBuffers[2]);
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]);
CopyBgTilemapBufferToVram(2);
CopyPaletteIntoBufferUnfaded(gUnknown_086231E8, 0x30, 0x20);
CopyPaletteIntoBufferUnfaded(gConditionGraphData_Pal, 0x30, 0x20);
sub_81D21DC(2);
return LT_INC_AND_PAUSE;
case 5:
@ -323,11 +323,11 @@ u32 sub_81CDE94(s32 state)
sub_81CEE74(TRUE);
return LT_INC_AND_PAUSE;
case 20:
if (!sub_81D3178(sub_81CDC70(), &structPtr->unk1814))
if (!TryUpdateConditionMonTransitionOn(sub_81CDC70(), &structPtr->unk1814))
{
sub_81D3464(structPtr->unk28e0);
ResetConditionSparkleSprites(structPtr->unk28e0);
if (sub_81CDD5C() == TRUE || sub_81CDC60() != sub_81CDC50())
sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
CreateConditionSparkleSprites(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
return LT_FINISH;
}
@ -345,10 +345,10 @@ u32 sub_81CE2D0(s32 state)
{
case 0:
sub_81CEEC8();
sub_81D3520(structPtr->unk28e0);
DestroyConditionSparkleSprites(structPtr->unk28e0);
return 1;
case 1:
if (sub_81D31A4(sub_81CDC70(), &structPtr->unk1814))
if (TryUpdateConditionMonTransitionOff(sub_81CDC70(), &structPtr->unk1814))
return 2;
sub_81CEE74(FALSE);
return 1;
@ -360,7 +360,7 @@ u32 sub_81CE2D0(s32 state)
case 3:
if (IsPaletteFadeActive() || MainMenuLoopedTaskIsBusy())
return 2;
sub_81D354C(structPtr->unk28e0);
FreeConditionSparkles(structPtr->unk28e0);
HideBg(1);
HideBg(2);
HideBg(3);
@ -373,7 +373,7 @@ u32 sub_81CE2D0(s32 state)
u32 sub_81CE37C(s32 state)
{
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
struct UnknownStruct_81D1ED4 *unkPtr = sub_81CDC70();
struct ConditionGraph *unkPtr = sub_81CDC70();
switch (state)
{
@ -385,13 +385,13 @@ u32 sub_81CE37C(s32 state)
return 1;
case 2:
sub_81CD548(2);
sub_81D3520(structPtr->unk28e0);
DestroyConditionSparkleSprites(structPtr->unk28e0);
return 1;
case 3:
sub_81D2074(unkPtr);
TransitionConditionGraph(unkPtr);
return 1;
case 4:
if (!sub_81D3150(&structPtr->unk1814))
if (!MoveConditionMonOffscreen(&structPtr->unk1814))
{
sub_81CED30(sub_81CDC84());
return 1;
@ -412,13 +412,13 @@ u32 sub_81CE37C(s32 state)
return 2;
case 9:
unkPtr = sub_81CDC70();
if (!sub_81D3178(unkPtr, &structPtr->unk1814))
if (!TryUpdateConditionMonTransitionOn(unkPtr, &structPtr->unk1814))
{
sub_81D3464(structPtr->unk28e0);
ResetConditionSparkleSprites(structPtr->unk28e0);
if (sub_81CDD5C() != TRUE && sub_81CDC60() == sub_81CDC50())
return 1;
sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
CreateConditionSparkleSprites(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
return 1;
}
return 2;
@ -459,10 +459,10 @@ u32 sub_81CE4D8(s32 state)
return 1;
return 2;
case 8:
if (!sub_81D3178(sub_81CDC70(), &structPtr->unk1814))
if (!TryUpdateConditionMonTransitionOn(sub_81CDC70(), &structPtr->unk1814))
{
sub_81D3464(structPtr->unk28e0);
sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
ResetConditionSparkleSprites(structPtr->unk28e0);
CreateConditionSparkleSprites(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
return 1;
}
return 2;
@ -485,10 +485,10 @@ u32 sub_81CE5E4(s32 state)
return 1;
case 2:
sub_81CD548(2);
sub_81D3520(structPtr->unk28e0);
DestroyConditionSparkleSprites(structPtr->unk28e0);
return 1;
case 3:
if (!sub_81D31A4(sub_81CDC70(), &structPtr->unk1814))
if (!TryUpdateConditionMonTransitionOff(sub_81CDC70(), &structPtr->unk1814))
return 1;
return 2;
case 4:
@ -663,7 +663,7 @@ void sub_81CE9E4(void)
u16 i, spriteId;
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
sub_81D321C(sprSheets, &sprTemplate, sprPals);
LoadConditionSelectionIcons(sprSheets, &sprTemplate, sprPals);
if (sub_81CDD5C() == TRUE)
{
structPtr->monMarks.baseTileTag = 0x6A;
@ -728,7 +728,7 @@ void sub_81CE9E4(void)
}
}
sub_81D32B0(&sprSheet, &sprPals[0]);
LoadConditionSparkle(&sprSheet, &sprPals[0]);
LoadSpriteSheet(&sprSheet);
sprPals[1].data = NULL;
Pokenav_AllocAndLoadPalettes(sprPals);
@ -804,7 +804,7 @@ void sub_81CED30(u8 var)
if (structPtr->unk1816 == 0xFF)
{
sub_81D31D0(&sprSheet, &sprTemplate, &sprPal);
LoadConditionMonPicTemplate(&sprSheet, &sprTemplate, &sprPal);
sprSheet.data = sub_81CDCB4(var);
sprPal.data = sub_81CDCD4(var);
structPtr->unk1818 = LoadSpritePalette(&sprPal);
@ -834,7 +834,7 @@ void sub_81CED30(u8 var)
void sub_81CEE44(void)
{
struct UnknownStruct_81D1ED4 *unk = sub_81CDC70();
struct ConditionGraph *unk = sub_81CDC70();
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
@ -857,17 +857,17 @@ void sub_81CEE74(bool8 showBg)
void sub_81CEE90(void)
{
struct UnknownStruct_81D1ED4 *unk = sub_81CDC70();
struct ConditionGraph *unk = sub_81CDC70();
u8 id = sub_81CDC84();
gUnknown_030012BC = id;
sub_81D1F84(unk, unk->unk14[3], unk->unk14[id]);
sub_81D2074(unk);
TransitionConditionGraph(unk);
}
void sub_81CEEC8(void)
{
struct UnknownStruct_81D1ED4 *unk = sub_81CDC70();
struct ConditionGraph *unk = sub_81CDC70();
if (sub_81CDD5C() || sub_81CDC60() != sub_81CDC50() - 1)
sub_81D1F84(unk, unk->unk14[sub_81CDC84()], unk->unk14[3]);

File diff suppressed because it is too large Load Diff