Merge pull request #637 from DizzyEggg/pokeblock_attempt

Use Pokeblock clean-up and some menu_specialised decomp
This commit is contained in:
huderlem 2019-03-31 08:39:18 -05:00 committed by GitHub
commit b9bf3bf072
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 893 additions and 2180 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10839,7 +10839,7 @@ sub_81CD624: @ 81CD624
adds r1, r6, 0 adds r1, r6, 0
movs r2, 0x2D movs r2, 0x2D
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
cmp r0, 0 cmp r0, 0
beq _081CD690 beq _081CD690
ldr r1, =gText_EggNickname ldr r1, =gText_EggNickname
@ -10854,14 +10854,14 @@ _081CD690:
adds r1, r6, 0 adds r1, r6, 0
movs r2, 0x2 movs r2, 0x2
adds r3, r5, 0 adds r3, r5, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
adds r0, r5, 0 adds r0, r5, 0
bl StringGetEnd10 bl StringGetEnd10
adds r0, r4, 0 adds r0, r4, 0
adds r1, r6, 0 adds r1, r6, 0
movs r2, 0xB movs r2, 0xB
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
lsls r0, 16 lsls r0, 16
lsrs r7, r0, 16 lsrs r7, r0, 16
cmp r4, 0xE cmp r4, 0xE
@ -11328,7 +11328,7 @@ _081CDA5A:
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x16 movs r2, 0x16
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
mov r1, r9 mov r1, r9
lsls r5, r1, 2 lsls r5, r1, 2
adds r4, r5, r1 adds r4, r5, r1
@ -11340,7 +11340,7 @@ _081CDA5A:
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x2F movs r2, 0x2F
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
ldr r1, =0x00006429 ldr r1, =0x00006429
add r1, r8 add r1, r8
adds r1, r4 adds r1, r4
@ -11349,7 +11349,7 @@ _081CDA5A:
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x21 movs r2, 0x21
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
ldr r1, =0x0000642a ldr r1, =0x0000642a
add r1, r8 add r1, r8
adds r1, r4 adds r1, r4
@ -11358,7 +11358,7 @@ _081CDA5A:
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x18 movs r2, 0x18
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
ldr r1, =0x0000642b ldr r1, =0x0000642b
add r1, r8 add r1, r8
adds r1, r4 adds r1, r4
@ -11367,7 +11367,7 @@ _081CDA5A:
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x17 movs r2, 0x17
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
ldr r1, =0x0000642c ldr r1, =0x0000642c
add r1, r8 add r1, r8
adds r1, r4 adds r1, r4
@ -11381,14 +11381,14 @@ _081CDA5A:
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x30 movs r2, 0x30
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
cmp r0, 0xFF cmp r0, 0xFF
beq _081CDB10 beq _081CDB10
adds r0, r6, 0 adds r0, r6, 0
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x30 movs r2, 0x30
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
movs r1, 0x1D movs r1, 0x1D
bl __udivsi3 bl __udivsi3
b _081CDB12 b _081CDB12
@ -11401,7 +11401,7 @@ _081CDB12:
adds r1, r7, 0 adds r1, r7, 0
movs r2, 0x8 movs r2, 0x8
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
ldr r1, =0x00006783 ldr r1, =0x00006783
add r1, r8 add r1, r8
add r1, r9 add r1, r9
@ -11498,7 +11498,7 @@ _081CDBD0:
adds r1, r6, 0 adds r1, r6, 0
movs r2, 0x41 movs r2, 0x41
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
adds r4, r0, 0 adds r4, r0, 0
lsls r4, 16 lsls r4, 16
lsrs r4, 16 lsrs r4, 16
@ -11506,13 +11506,13 @@ _081CDBD0:
adds r1, r6, 0 adds r1, r6, 0
movs r2, 0x1 movs r2, 0x1
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
mov r8, r0 mov r8, r0
adds r0, r5, 0 adds r0, r5, 0
adds r1, r6, 0 adds r1, r6, 0
movs r2, 0 movs r2, 0
movs r3, 0 movs r3, 0
bl sub_81D2C68 bl GetBoxOrPartyMonData
adds r5, r0, 0 adds r5, r0, 0
lsls r0, r4, 3 lsls r0, r4, 3
ldr r1, =gMonFrontPicTable ldr r1, =gMonFrontPicTable

View File

@ -3,84 +3,8 @@
.section .rodata .section .rodata
gUnknown_08625560:: @ 8625560
.incbin "graphics/pokenav/pokeball.4bpp"
gUnknown_08625660:: @ 8625660
.incbin "graphics/pokenav/pokeball_placeholder.4bpp"
gUnknown_08625680:: @ 8625680
.incbin "graphics/pokenav/sparkle.gbapal"
gUnknown_086256A0:: @ 86255A0
.incbin "graphics/pokenav/sparkle.4bpp"
gUnknown_08625A20:: @ 8625A20
.2byte 0
.2byte 0xC000
.2byte 0x400
.2byte 0
gUnknown_08625A28:: @ 8625A28
.2byte 0
.2byte 0x4000
.2byte 0x800
.2byte 0
gUnknown_08625A30:: @ 8625A30
.2byte 0
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625A38:: @ 8625A38
.2byte 4
.2byte 5
.2byte 0xFFFF
.2byte 0
gUnknown_08625A40:: @ 8625A40
.4byte gUnknown_08625A30
.4byte gUnknown_08625A38
gUnknown_08625A48:: @ 8625A48
.4byte NULL
.4byte 0x640800
gUnknown_08625A50:: @ 8625A50
spr_template 0x64, 0x64, gUnknown_08625A20, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_08625A68:: @ 8625A68
.4byte NULL
.4byte 0x64
gUnknown_08625A70:: @ 8625A70
.4byte gUnknown_08625560
.byte 0, 1, 0x65, 0
.4byte gUnknown_08625660
.2byte 0x20, 0x67
.4byte gPokenavConditionCancel_Gfx
.byte 0, 1, 0x66, 0
.4byte NULL, NULL
gUnknown_08625A90:: @ 8625A90
.4byte gPokenavConditionCancel_Pal + 0x0
.byte 0x65, 0, 0, 0
.4byte gPokenavConditionCancel_Pal + 0x20
.byte 0x66, 0, 0, 0
.4byte NULL, NULL
gUnknown_08625AA8:: @ 8625AA8
spr_template 0x65, 0x65, gUnknown_08625A28, gUnknown_08625A40, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_08625AC0:: @ 8625AC0
.4byte gUnknown_086256A0
.byte 0x80, 3, 0x68, 0
gUnknown_08625AC8:: @ 8625AC8
.4byte gUnknown_08625680
.byte 0x68, 0, 0, 0
gUnknown_08625AD0:: @ 8625AD0 gUnknown_08625AD0:: @ 8625AD0
.2byte 0 .2byte 0
.2byte 0x4000 .2byte 0x4000

View File

@ -4917,4 +4917,8 @@ extern const u16 gLinkMiscMenu_Pal[];
extern const u32 gLinkMiscMenu_Gfx[]; extern const u32 gLinkMiscMenu_Gfx[];
extern const u32 gLinkMiscMenu_Tilemap[]; extern const u32 gLinkMiscMenu_Tilemap[];
// Pokeblock
extern const u8 gPokenavConditionCancel_Gfx[];
extern const u16 gPokenavConditionCancel_Pal[];
#endif //GUARD_GRAPHICS_H #endif //GUARD_GRAPHICS_H

View File

@ -38,15 +38,8 @@ void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0);
void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0); void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D3520(struct Sprite **);
bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0); bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0);
void sub_81D354C(struct Sprite **);
void sub_81D3464(struct Sprite **arg0);
void sub_81D3480(struct Sprite **arg0, u8 arg1, u8 arg2);
u8 sub_81D3178(struct UnknownStruct_81D1ED4*, u16*);
u8 sub_81D31A4(struct UnknownStruct_81D1ED4*, u16*);
bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0); bool32 sub_81D2074(struct UnknownStruct_81D1ED4 *a0);
u8 sub_81D3150(u16 *arg0);
void sub_81D2754(u8 *arg0, struct UnknownSubStruct_81D1ED4 *arg1); 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 UnknownStruct_81D1ED4 *arg0, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2);
void MoveRelearnerPrintText(u8 *str); void MoveRelearnerPrintText(u8 *str);
@ -55,5 +48,20 @@ void MoveRelearnerCreateYesNoMenu(void);
u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices); u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices);
void InitMoveRelearnerWindows(bool8 useContextWindow); void InitMoveRelearnerWindows(bool8 useContextWindow);
void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation); void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation);
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);
#endif // GUARD_MENU_SPECIALIZED_H #endif // GUARD_MENU_SPECIALIZED_H

View File

@ -1,8 +1,6 @@
#ifndef GUARD_POKENAV_H #ifndef GUARD_POKENAV_H
#define GUARD_POKENAV_H #define GUARD_POKENAV_H
#include "list_menu.h"
bool8 sub_81D312C(void *arg0);
void CB2_InitPokeNav(void); void CB2_InitPokeNav(void);
#endif //GUARD_POKENAV_H #endif //GUARD_POKENAV_H

View File

@ -194,6 +194,7 @@ extern const u8 gText_SeeYaDescription[];
extern const u8 gText_EggNickname[]; extern const u8 gText_EggNickname[];
extern const u8 gText_Pokemon[]; extern const u8 gText_Pokemon[];
extern const u8 gText_InParty[];
extern const u8 gText_InGameClockUsable[]; extern const u8 gText_InGameClockUsable[];
// reset rtc screen texts // reset rtc screen texts

View File

@ -2,7 +2,10 @@
#include "alloc.h" #include "alloc.h"
#include "battle_main.h" #include "battle_main.h"
#include "contest_effect.h" #include "contest_effect.h"
#include "data2.h"
#include "decompress.h"
#include "gpu_regs.h" #include "gpu_regs.h"
#include "graphics.h"
#include "menu.h" #include "menu.h"
#include "international_string_util.h" #include "international_string_util.h"
#include "menu.h" #include "menu.h"
@ -11,16 +14,21 @@
#include "palette.h" #include "palette.h"
#include "player_pc.h" #include "player_pc.h"
#include "pokemon_summary_screen.h" #include "pokemon_summary_screen.h"
#include "pokemon_storage_system.h"
#include "scanline_effect.h" #include "scanline_effect.h"
#include "sound.h" #include "sound.h"
#include "strings.h" #include "strings.h"
#include "string_util.h" #include "string_util.h"
#include "text.h"
#include "text_window.h" #include "text_window.h"
#include "trig.h" #include "trig.h"
#include "window.h" #include "window.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/species.h"
#include "gba/io_reg.h" #include "gba/io_reg.h"
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0}; EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0};
EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL; EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL;
@ -29,6 +37,9 @@ static void sub_81D24A4(struct UnknownStruct_81D1ED4 *a0);
static void sub_81D2634(struct UnknownStruct_81D1ED4 *a0); static void sub_81D2634(struct UnknownStruct_81D1ED4 *a0);
static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list); static void MoveRelearnerCursorCallback(s32 itemIndex, bool8 onInit, struct ListMenu *list);
static void nullsub_79(void); 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 const struct WindowTemplate sUnknown_086253E8[] = static const struct WindowTemplate sUnknown_086253E8[] =
{ {
@ -1075,3 +1086,556 @@ void MoveRelearnerCreateYesNoMenu(void)
{ {
CreateYesNoMenu(&sMoveRelearnerYesNoMenuTemplate, 1, 0xE, 0); CreateYesNoMenu(&sMoveRelearnerYesNoMenuTemplate, 1, 0xE, 0);
} }
s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst)
{
s32 ret;
if (boxId == TOTAL_BOXES_COUNT) // Party mon.
{
if (request == MON_DATA_NICKNAME || request == MON_DATA_OT_NAME)
ret = GetMonData(&gPlayerParty[monId], request, dst);
else
ret = GetMonData(&gPlayerParty[monId], request);
}
else
{
if (request == MON_DATA_NICKNAME || request == MON_DATA_OT_NAME)
ret = GetAndCopyBoxMonDataAt(boxId, monId, request, dst);
else
ret = GetBoxMonDataAt(boxId, monId, request);
}
return ret;
}
static u8 *sub_81D2CD0(u8 *dst, u16 boxId, u16 monId)
{
u16 species, level, gender;
struct BoxPokemon *boxMon;
u8 *str;
*(dst++) = EXT_CTRL_CODE_BEGIN;
*(dst++) = 4;
*(dst++) = 8;
*(dst++) = 0;
*(dst++) = 9;
if (GetBoxOrPartyMonData(boxId, monId, MON_DATA_IS_EGG, NULL))
{
return StringCopyPadded(dst, gText_EggNickname, 0, 12);
}
else
{
GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, dst);
StringGetEnd10(dst);
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL);
if (boxId == TOTAL_BOXES_COUNT) // Party mon.
{
level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
gender = GetMonGender(&gPlayerParty[monId]);
}
else
{
// Needed to match, feel free to remove.
boxId++;boxId--;
monId++;monId--;
boxMon = GetBoxedMonPtr(boxId, monId);
gender = GetBoxMonGender(boxMon);
level = GetLevelFromBoxMonExp(boxMon);
}
if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(dst, gSpeciesNames[species]))
gender = MON_GENDERLESS;
for (str = dst; *str != EOS; str++)
;
*(str++) = EXT_CTRL_CODE_BEGIN;
*(str++) = 0x12;
*(str++) = 0x3C;
switch (gender)
{
default:
*(str++) = CHAR_SPACE;
break;
case MON_MALE:
*(str++) = EXT_CTRL_CODE_BEGIN;
*(str++) = EXT_CTRL_CODE_COLOR;
*(str++) = 4;
*(str++) = EXT_CTRL_CODE_BEGIN;
*(str++) = 3;
*(str++) = 5;
*(str++) = CHAR_MALE;
break;
case MON_FEMALE:
*(str++) = EXT_CTRL_CODE_BEGIN;
*(str++) = EXT_CTRL_CODE_COLOR;
*(str++) = 6;
*(str++) = EXT_CTRL_CODE_BEGIN;
*(str++) = 3;
*(str++) = 7;
*(str++) = CHAR_FEMALE;
break;
}
*(str++) = EXT_CTRL_CODE_BEGIN;
*(str++) = 4;
*(str++) = 8;
*(str++) = 0;
*(str++) = 9;
*(str++) = CHAR_SLASH;
*(str++) = CHAR_SPECIAL_F9;
*(str++) = 5;
str = ConvertIntToDecimalStringN(str, level, STR_CONV_MODE_LEFT_ALIGN, 3);
*(str++) = CHAR_SPACE;
*str = EOS;
return str;
}
}
static u8 *sub_81D2E7C(u8 *dst, const u8 *src, s16 n)
{
while (*src != EOS)
{
*(dst++) = *(src++);
n--;
}
while (n-- > 0)
*(dst++) = CHAR_SPACE;
*dst = EOS;
return dst;
}
void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7)
{
u16 i;
if (!arg7)
arg6--;
if (arg5 != arg6)
{
sub_81D2CD0(nameDst, boxId, monId);
dst[0] = EXT_CTRL_CODE_BEGIN;
dst[1] = 4;
dst[2] = 8;
dst[3] = 0;
dst[4] = 9;
if (boxId == TOTAL_BOXES_COUNT) // Party mon.
{
sub_81D2E7C(dst + 5, gText_InParty, 8);
}
else
{
boxId++;boxId--; // Again...Someone fix this maybe?
sub_81D2E7C(dst + 5, GetBoxNamePtr(boxId), 8);
}
}
else
{
for (i = 0; i < 12; i++)
nameDst[i] = CHAR_SPACE;
nameDst[i] = EOS;
for (i = 0; i < 8; i++)
dst[i] = CHAR_SPACE;
dst[i] = EOS;
}
}
void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8)
{
u16 i;
if (!arg8)
arg7--;
if (arg5 != arg7)
{
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);
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]);
}
else
{
for (i = 0; i < 5; i++)
{
arg0->unk0[id][i] = 0;
arg0->unk14[id][i].unk0 = 155;
arg0->unk14[id][i].unk2 = 91;
}
}
}
void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7)
{
if (!arg7)
arg6--;
if (arg5 != arg6)
{
u16 species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL);
u32 trainerId = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
u32 personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL);
LoadSpecialPokePic(&gMonFrontPicTable[species], tilesDst, species, personality, TRUE);
LZ77UnCompWram(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst);
}
}
bool8 sub_81D312C(s16 *var)
{
*var += 24;
if (*var > 0)
*var = 0;
return (*var != 0);
}
bool8 sub_81D3150(s16 *var)
{
*var -= 24;
if (*var < -80)
*var = -80;
return (*var != -80);
}
bool8 sub_81D3178(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1)
{
bool8 var1 = sub_81D2074(arg0);
bool8 var2 = sub_81D312C(arg1);
return ((var1 != 0) || (var2 != 0));
}
bool8 sub_81D31A4(struct UnknownStruct_81D1ED4 *arg0, s16 *arg1)
{
bool8 var1 = sub_81D2074(arg0);
bool8 var2 = sub_81D3150(arg1);
return ((var1 != 0) || (var2 != 0));
}
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 struct OamData sOamData_8625A20 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const struct OamData sOamData_8625A28 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 1,
.tileNum = 0,
.priority = 2,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_8625A30[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_8625A38[] =
{
ANIMCMD_FRAME(4, 5),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_8625A40[] =
{
sSpriteAnim_8625A30,
sSpriteAnim_8625A38
};
void sub_81D31D0(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal)
{
struct SpriteSheet dataSheet = {NULL, 0x800, 100};
struct SpriteTemplate dataTemplate =
{
.tileTag = 100,
.paletteTag = 100,
.oam = &sOamData_8625A20,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
struct SpritePalette dataPal = {NULL, 100};
*sheet = dataSheet;
*template = dataTemplate;
*pal = dataPal;
}
void sub_81D321C(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},
{},
};
struct SpritePalette dataPals[] =
{
{gPokenavConditionCancel_Pal, 101},
{gPokenavConditionCancel_Pal + 16, 102},
{},
};
struct SpriteTemplate dataTemplate =
{
.tileTag = 101,
.paletteTag = 101,
.oam = &sOamData_8625A28,
.anims = sSpriteAnimTable_8625A40,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
for (i = 0; i < ARRAY_COUNT(dataSheets); i++)
*(sheets++) = dataSheets[i];
*template = dataTemplate;
for (i = 0; i < ARRAY_COUNT(dataPals); i++)
*(pals++) = dataPals[i];
}
void sub_81D32B0(struct SpriteSheet *sheet, struct SpritePalette *pal)
{
struct SpriteSheet dataSheet = {gUnknown_086256A0, 0x380, 104};
struct SpritePalette dataPal = {gUnknown_08625680, 104};
*sheet = dataSheet;
*pal = dataPal;
}
static void sub_81D32D4(struct Sprite *sprite)
{
if (++sprite->data[1] > 60)
{
sprite->data[1] = 0;
sub_81D3408(sprite);
}
}
static void sub_81D32F4(struct Sprite *sprite)
{
if (sprite->animEnded)
{
sprite->data[1] = 0;
sprite->callback = sub_81D32D4;
}
}
// Todo: Move these variables to C.
extern const s16 gUnknown_08625B2C[][2];
extern const struct SpriteTemplate gUnknown_08625B14;
void sub_81D3314(struct Sprite *sprite)
{
struct Sprite *sprite2 = &gSprites[sprite->data[4]];
if (sprite2 != 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];
}
else
{
sprite->pos1.x = gUnknown_08625B2C[sprite->data[0]][0] + 40;
sprite->pos1.y = gUnknown_08625B2C[sprite->data[0]][1] + 104;
}
}
void sub_81D338C(u8 arg0, u8 arg1, struct Sprite **sprites)
{
u16 i;
for (i = 0; i < 10; 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]->callback = sub_81D3564;
}
else
{
sub_81D3314(sprites[i]);
sub_81D35E8(sprites[i]);
sprites[i]->callback = sub_81D32F4;
sprites[i]->invisible = FALSE;
}
}
}
}
static void sub_81D3408(struct Sprite *sprite)
{
u16 i;
u8 id = sprite->data[5];
for (i = 0; i < sprite->data[2] + 1; i++)
{
gSprites[id].data[1] = (gSprites[id].data[0] * 16) + 1;
gSprites[id].callback = sub_81D3564;
id = gSprites[id].data[5];
}
}
void sub_81D3464(struct Sprite **sprites)
{
u8 i;
for (i = 0; i < 10; i++)
sprites[i] = NULL;
}
void sub_81D3480(struct Sprite **sprites, u8 arg1, u8 arg2)
{
u16 i, spriteId, firstSpriteId = 0;
u8 count = arg2;
for (i = 0; i < count + 1; i++)
{
spriteId = CreateSprite(&gUnknown_08625B14, 0, 0, 0);
if (spriteId != MAX_SPRITES)
{
sprites[i] = &gSprites[spriteId];
sprites[i]->invisible = TRUE;
sprites[i]->data[4] = arg1;
if (i != 0)
sprites[i - 1]->data[5] = spriteId;
else
firstSpriteId = spriteId;
}
else
{
break;
}
}
sprites[count]->data[5] = firstSpriteId;
sub_81D338C(count, 1, sprites);
}
void sub_81D3520(struct Sprite **sprites)
{
u16 i;
for (i = 0; i < 10; i++)
{
if (sprites[i] != NULL)
{
DestroySprite(sprites[i]);
sprites[i] = NULL;
}
else
{
break;
}
}
}
void sub_81D354C(struct Sprite **sprites)
{
sub_81D3520(sprites);
FreeSpriteTilesByTag(104);
FreeSpritePaletteByTag(104);
}
/*static*/ void sub_81D3564(struct Sprite *sprite)
{
if (sprite->data[1] != 0)
{
if (--sprite->data[1] != 0)
return;
SeekSpriteAnim(sprite, 0);
sprite->invisible = FALSE;
}
sub_81D3314(sprite);
if (sprite->animEnded)
{
sprite->invisible = TRUE;
if (sprite->data[3] == sprite->data[2])
{
if (sprite->data[3] == 9)
{
sub_81D35E8(sprite);
sprite->callback = sub_81D32F4;
}
else
{
sprite->callback = sub_81D32D4;
}
}
else
{
sprite->callback = SpriteCallbackDummy;
}
}
}
static void sub_81D35E8(struct Sprite *sprite)
{
u8 i, id = sprite->data[5];
for (i = 0; i < sprite->data[2] + 1; i++)
{
SeekSpriteAnim(&gSprites[id], 0);
gSprites[id].invisible = FALSE;
id = gSprites[id].data[5];
}
}

File diff suppressed because it is too large Load Diff