mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
commit
136da953d6
1752
asm/pokenav_unk_6.s
1752
asm/pokenav_unk_6.s
File diff suppressed because it is too large
Load Diff
2001
asm/pokenav_unk_7.s
2001
asm/pokenav_unk_7.s
File diff suppressed because it is too large
Load Diff
@ -5,219 +5,7 @@
|
||||
|
||||
@ File centered around AllocSubstruct(7)
|
||||
|
||||
thumb_func_start sub_81CEF3C
|
||||
sub_81CEF3C: @ 81CEF3C
|
||||
push {r4,lr}
|
||||
movs r0, 0x7
|
||||
movs r1, 0x24
|
||||
bl AllocSubstruct
|
||||
adds r4, r0, 0
|
||||
cmp r4, 0
|
||||
beq _081CEF90
|
||||
ldr r1, =0x000006ac
|
||||
movs r0, 0x12
|
||||
bl AllocSubstruct
|
||||
str r0, [r4, 0x20]
|
||||
cmp r0, 0
|
||||
beq _081CEF90
|
||||
ldr r0, =sub_81CF010
|
||||
str r0, [r4]
|
||||
ldr r0, =sub_81CF11C
|
||||
movs r1, 0x1
|
||||
bl CreateLoopedTask
|
||||
str r0, [r4, 0x4]
|
||||
movs r0, 0
|
||||
str r0, [r4, 0x18]
|
||||
bl sub_81C76AC
|
||||
ldr r1, =gUnknown_086233A0
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
str r0, [r4, 0x14]
|
||||
movs r0, 0x1
|
||||
b _081CEF92
|
||||
.pool
|
||||
_081CEF90:
|
||||
movs r0, 0
|
||||
_081CEF92:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CEF3C
|
||||
|
||||
thumb_func_start sub_81CEF98
|
||||
sub_81CEF98: @ 81CEF98
|
||||
push {r4,lr}
|
||||
movs r0, 0x7
|
||||
movs r1, 0x24
|
||||
bl AllocSubstruct
|
||||
adds r4, r0, 0
|
||||
cmp r4, 0
|
||||
beq _081CEFD4
|
||||
movs r0, 0x12
|
||||
bl GetSubstructPtr
|
||||
str r0, [r4, 0x20]
|
||||
ldr r0, =sub_81CF030
|
||||
str r0, [r4]
|
||||
movs r0, 0x1
|
||||
str r0, [r4, 0x18]
|
||||
bl sub_81C76AC
|
||||
ldr r1, =gUnknown_086233A0
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
str r0, [r4, 0x14]
|
||||
movs r0, 0x1
|
||||
b _081CEFD6
|
||||
.pool
|
||||
_081CEFD4:
|
||||
movs r0, 0
|
||||
_081CEFD6:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CEF98
|
||||
|
||||
thumb_func_start sub_81CEFDC
|
||||
sub_81CEFDC: @ 81CEFDC
|
||||
push {lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
ldr r1, [r0]
|
||||
bl _call_via_r1
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CEFDC
|
||||
|
||||
thumb_func_start sub_81CEFF0
|
||||
sub_81CEFF0: @ 81CEFF0
|
||||
push {lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
ldr r0, [r0, 0x1C]
|
||||
cmp r0, 0
|
||||
bne _081CF004
|
||||
movs r0, 0x12
|
||||
bl FreePokenavSubstruct
|
||||
_081CF004:
|
||||
movs r0, 0x7
|
||||
bl FreePokenavSubstruct
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81CEFF0
|
||||
|
||||
thumb_func_start sub_81CF010
|
||||
sub_81CF010: @ 81CF010
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r4, 0x4]
|
||||
bl IsLoopedTaskActive
|
||||
cmp r0, 0
|
||||
bne _081CF022
|
||||
ldr r0, =sub_81CF030
|
||||
str r0, [r4]
|
||||
_081CF022:
|
||||
movs r0, 0
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81CF010
|
||||
|
||||
thumb_func_start sub_81CF030
|
||||
sub_81CF030: @ 81CF030
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r2, =gMain
|
||||
ldrh r1, [r2, 0x30]
|
||||
movs r0, 0x40
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081CF048
|
||||
movs r0, 0x1
|
||||
b _081CF0A6
|
||||
.pool
|
||||
_081CF048:
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081CF054
|
||||
movs r0, 0x2
|
||||
b _081CF0A6
|
||||
_081CF054:
|
||||
ldrh r1, [r2, 0x2E]
|
||||
movs r0, 0x20
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081CF062
|
||||
movs r0, 0x3
|
||||
b _081CF0A6
|
||||
_081CF062:
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
lsls r0, 16
|
||||
lsrs r2, r0, 16
|
||||
cmp r2, 0
|
||||
beq _081CF072
|
||||
movs r0, 0x4
|
||||
b _081CF0A6
|
||||
_081CF072:
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081CF088
|
||||
str r2, [r4, 0x1C]
|
||||
ldr r0, =sub_81CF0B0
|
||||
str r0, [r4]
|
||||
movs r0, 0x5
|
||||
b _081CF0A6
|
||||
.pool
|
||||
_081CF088:
|
||||
movs r5, 0x1
|
||||
adds r0, r5, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _081CF096
|
||||
movs r0, 0
|
||||
b _081CF0A6
|
||||
_081CF096:
|
||||
bl GetSelectedMatchCall
|
||||
ldr r1, [r4, 0x20]
|
||||
strh r0, [r1, 0x2]
|
||||
str r5, [r4, 0x1C]
|
||||
ldr r0, =sub_81CF0B8
|
||||
str r0, [r4]
|
||||
movs r0, 0x6
|
||||
_081CF0A6:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81CF030
|
||||
|
||||
thumb_func_start sub_81CF0B0
|
||||
sub_81CF0B0: @ 81CF0B0
|
||||
ldr r0, =0x000186a3
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_81CF0B0
|
||||
|
||||
thumb_func_start sub_81CF0B8
|
||||
sub_81CF0B8: @ 81CF0B8
|
||||
ldr r0, =0x000186a9
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_81CF0B8
|
||||
|
||||
thumb_func_start sub_81CF0C0
|
||||
sub_81CF0C0: @ 81CF0C0
|
||||
push {lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
ldr r0, [r0, 0x18]
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF0C0
|
||||
|
||||
thumb_func_start sub_81CF0D0
|
||||
sub_81CF0D0: @ 81CF0D0
|
||||
|
@ -4006,6 +4006,12 @@ extern const u32 gBerryPic_Enigma[];
|
||||
extern const u32 gBerryPalette_Enigma[];
|
||||
|
||||
//pokenav
|
||||
extern const u16 gPokenavCondition_Pal[];
|
||||
extern const u32 gPokenavCondition_Gfx[];
|
||||
extern const u32 gPokenavCondition_Tilemap[];
|
||||
extern const u16 gPokenavOptions_Tilemap[];
|
||||
extern const u32 gPokenavOptions_Gfx[];
|
||||
extern const u16 gPokenavOptions_Pal[];
|
||||
extern const u8 gPokenavConditionMarker_Gfx[];
|
||||
extern const u16 gPokenavConditionMarker_Pal[];
|
||||
extern const u16 gPokenavLeftHeader_Pal[];
|
||||
|
@ -34,6 +34,7 @@ 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_81D21DC(u8 bg);
|
||||
void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0);
|
||||
void sub_81D2230(struct UnknownStruct_81D1ED4 *arg0);
|
||||
bool8 sub_81D20BC(struct UnknownStruct_81D1ED4 *arg0);
|
||||
|
@ -563,7 +563,7 @@ void PlayBattleBGM(void);
|
||||
void PlayMapChosenOrBattleBGM(u16 songId);
|
||||
void sub_806E694(u16 songId);
|
||||
const u32 *GetMonFrontSpritePal(struct Pokemon *mon);
|
||||
const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality);
|
||||
const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality);
|
||||
const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *mon);
|
||||
const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality);
|
||||
bool32 IsHMMove2(u16 move);
|
||||
|
@ -3,9 +3,22 @@
|
||||
|
||||
#include "bg.h"
|
||||
#include "main.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
|
||||
typedef u32 (*LoopedTask)(s32 state);
|
||||
|
||||
struct PokenavSub18
|
||||
{
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
struct
|
||||
{
|
||||
u8 boxId;
|
||||
u8 monId;
|
||||
u16 unk6;
|
||||
} unk4[TOTAL_BOXES_COUNT * IN_BOX_COUNT + PARTY_SIZE];
|
||||
};
|
||||
|
||||
// Return values of LoopedTask functions.
|
||||
#define LT_INC_AND_PAUSE 0
|
||||
#define LT_INC_AND_CONTINUE 1
|
||||
@ -43,7 +56,7 @@ enum
|
||||
|
||||
// pokenav.c
|
||||
void sub_81C7694(u32);
|
||||
u16 sub_81C76AC(void);
|
||||
u32 sub_81C76AC(void);
|
||||
|
||||
void CB2_InitPokeNav(void);
|
||||
u32 CreateLoopedTask(LoopedTask loopedTask, u32 priority);
|
||||
@ -184,4 +197,22 @@ void sub_81CC62C(int);
|
||||
u32 sub_81CC65C(void);
|
||||
void sub_81CC670(void);
|
||||
|
||||
#endif //GUARD_POKENAV_H
|
||||
// pokenav_unk_6.c
|
||||
bool32 sub_81CD3C4(void);
|
||||
bool32 sub_81CDD5C(void);
|
||||
struct UnknownStruct_81D1ED4 *sub_81CDC70(void);
|
||||
u16 sub_81CDC60(void);
|
||||
u16 sub_81CDC50(void);
|
||||
u8 sub_81CDDB0(void);
|
||||
bool32 sub_81CD548(u8 arg0);
|
||||
u8 sub_81CDD7C(void);
|
||||
u8 *sub_81CDD04(u8 id);
|
||||
u8 *sub_81CDD24(u8 id);
|
||||
u16 sub_81CDD48(void);
|
||||
void *sub_81CDCB4(u8 id);
|
||||
void *sub_81CDCD4(u8 id);
|
||||
|
||||
// pokenav_unk_7.c
|
||||
u8 sub_81CEF14(void);
|
||||
|
||||
#endif // GUARD_POKENAV_H
|
||||
|
@ -1022,6 +1022,7 @@ extern const u8 gText_PokenavMatchCall_CheckTrainerButtons[];
|
||||
extern const u8 gText_PokenavRibbons_MonListButtons[];
|
||||
extern const u8 gText_PokenavRibbons_RibbonListButtons[];
|
||||
extern const u8 gText_PokenavRibbons_RibbonCheckButtons[];
|
||||
extern const u8 gText_Number2[];
|
||||
|
||||
extern const u8 gUnknown_085EAD37[];
|
||||
extern const u8 gUnknown_085EAD41[];
|
||||
|
@ -316,8 +316,9 @@ SECTIONS {
|
||||
src/pokenav_unk_3.o(.text*);
|
||||
src/pokenav_unk_4.o(.text*);
|
||||
src/pokenav_unk_5.o(.text*);
|
||||
asm/pokenav_unk_6.o(.text*);
|
||||
asm/pokenav_unk_7.o(.text*);
|
||||
src/pokenav_unk_6.o(.text*);
|
||||
src/pokenav_unk_7.o(.text*);
|
||||
src/pokenav_unk_8.o(.text*);
|
||||
asm/pokenav_unk_8.o(.text*);
|
||||
asm/pokenav_unk_9.o(.text*);
|
||||
asm/pokenav_unk_10.o(.text*);
|
||||
|
@ -2037,7 +2037,7 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority
|
||||
gMonSpritesGfxPtr->field_17C = AllocZeroed(0x2000);
|
||||
if (!isBackpic)
|
||||
{
|
||||
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
|
||||
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
|
||||
if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0)
|
||||
LoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
|
||||
gMonSpritesGfxPtr->field_17C,
|
||||
@ -2053,7 +2053,7 @@ u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
|
||||
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
|
||||
if (a10 == 1 || sub_80688F8(5, battlerId) == 1 || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0)
|
||||
LoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species],
|
||||
gMonSpritesGfxPtr->field_17C,
|
||||
|
@ -534,7 +534,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
||||
lzPaletteData = GetMonFrontSpritePal(mon);
|
||||
else
|
||||
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
||||
|
||||
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
||||
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
|
||||
@ -597,7 +597,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
|
||||
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
|
||||
lzPaletteData = GetMonFrontSpritePal(mon);
|
||||
else
|
||||
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
|
||||
|
||||
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
||||
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
|
||||
@ -918,7 +918,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
|
||||
dst = (void *)(VRAM + 0x10000 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
|
||||
DmaCopy32(3, src, dst, 0x800);
|
||||
paletteOffset = 0x100 + battlerAtk * 16;
|
||||
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
|
||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
|
||||
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
|
||||
LoadPalette(gDecompressionBuffer, paletteOffset, 32);
|
||||
|
||||
|
@ -2973,7 +2973,7 @@ static u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index)
|
||||
else
|
||||
HandleLoadSpecialPokePic_DontHandleDeoxys(gMonBackPicTable + species, gMonSpritesGfxPtr->sprites[0], species, personality);
|
||||
|
||||
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20);
|
||||
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20);
|
||||
SetMultiuseSpriteTemplateToPokemon(species, 0);
|
||||
|
||||
spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, GetBattlerSpriteFinal_Y(2, species, FALSE), 30);
|
||||
|
@ -362,7 +362,7 @@ static void VBlankCB_ContestPainting(void)
|
||||
|
||||
void sub_81302E8(u16 species, u8 arg1)
|
||||
{
|
||||
const void *pal = GetFrontSpritePalFromSpeciesAndPersonality(species, gUnknown_030061C0->trainerId, gUnknown_030061C0->personality);
|
||||
const void *pal = GetMonSpritePalFromSpeciesAndPersonality(species, gUnknown_030061C0->trainerId, gUnknown_030061C0->personality);
|
||||
LZDecompressVram(pal, gContestPaintingMonPalette);
|
||||
if (!arg1)
|
||||
{
|
||||
|
@ -1290,7 +1290,7 @@ void sub_81D3094(void *tilesDst, void *palDst, u16 boxId, u16 monId, u16 arg5, u
|
||||
u32 personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL);
|
||||
|
||||
LoadSpecialPokePic(&gMonFrontPicTable[species], tilesDst, species, personality, TRUE);
|
||||
LZ77UnCompWram(GetFrontSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst);
|
||||
LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), palDst);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3855,7 +3855,7 @@ void blockset_load_palette_to_gpu(u8 taskId)
|
||||
otId = ((u16)gTasks[taskId].data[13] << 16) | (u16)gTasks[taskId].data[12];
|
||||
personality = ((u16)gTasks[taskId].data[15] << 16) | (u16)gTasks[taskId].data[14];
|
||||
paletteNum = gSprites[gTasks[taskId].data[3]].oam.paletteNum;
|
||||
lzPaletteData = GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality);
|
||||
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality);
|
||||
LoadCompressedPalette(lzPaletteData, 0x100 | paletteNum * 16, 32);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
@ -6321,10 +6321,10 @@ const u32 *GetMonFrontSpritePal(struct Pokemon *mon)
|
||||
u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0);
|
||||
u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0);
|
||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0);
|
||||
return GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality);
|
||||
return GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality);
|
||||
}
|
||||
|
||||
const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality)
|
||||
const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality)
|
||||
{
|
||||
u32 shinyValue;
|
||||
|
||||
|
@ -2248,7 +2248,7 @@ void sub_802C9D4(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon
|
||||
spriteSheet.size = 0x800;
|
||||
LoadSpriteSheet(&spriteSheet);
|
||||
|
||||
spritePalette.data = GetFrontSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality);
|
||||
spritePalette.data = GetMonSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality);
|
||||
spritePalette.tag = multiplayerId;
|
||||
LoadCompressedSpritePalette(&spritePalette);
|
||||
|
||||
|
@ -6827,7 +6827,7 @@ static void SetCursorMonData(void *pokemon, u8 mode)
|
||||
sPSSData->cursorMonLevel = GetLevelFromBoxMonExp(boxMon);
|
||||
sPSSData->cursorMonMarkings = GetBoxMonData(boxMon, MON_DATA_MARKINGS);
|
||||
sPSSData->cursorMonPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY);
|
||||
sPSSData->cursorMonPalette = GetFrontSpritePalFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, otId, sPSSData->cursorMonPersonality);
|
||||
sPSSData->cursorMonPalette = GetMonSpritePalFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, otId, sPSSData->cursorMonPersonality);
|
||||
gender = GetGenderFromSpeciesAndPersonality(sPSSData->cursorMonSpecies, sPSSData->cursorMonPersonality);
|
||||
sPSSData->cursorMonItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM);
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ void Task_RunLoopedTask_LinkMode(u8 taskId)
|
||||
|
||||
if (sub_8087598())
|
||||
return;
|
||||
|
||||
|
||||
task = (LoopedTask)GetWordTaskArg(taskId, 1);
|
||||
state = &gTasks[taskId].data[0];
|
||||
action = task(*state);
|
||||
@ -605,7 +605,7 @@ void sub_81C7694(u32 a0)
|
||||
gPokenavResources->fieldA = value;
|
||||
}
|
||||
|
||||
u16 sub_81C76AC(void)
|
||||
u32 sub_81C76AC(void)
|
||||
{
|
||||
return gPokenavResources->fieldA;
|
||||
}
|
||||
|
625
src/pokenav_unk_6.c
Normal file
625
src/pokenav_unk_6.c
Normal file
@ -0,0 +1,625 @@
|
||||
#include "global.h"
|
||||
#include "data.h"
|
||||
#include "decompress.h"
|
||||
#include "main.h"
|
||||
#include "menu_specialized.h"
|
||||
#include "mon_markings.h"
|
||||
#include "pokenav.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "sound.h"
|
||||
#include "string_util.h"
|
||||
#include "strings.h"
|
||||
#include "text.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
struct PokenavSub11
|
||||
{
|
||||
u32 monPal[3][0x20];
|
||||
u8 fill[0x180];
|
||||
u32 monPicGfx[3][0x800];
|
||||
u8 unk6300;
|
||||
s16 unk6302;
|
||||
u32 (*unk6304)(struct PokenavSub11 *);
|
||||
u8 fill2[0x6320 - 0x6308];
|
||||
u8 unk6320[3][24];
|
||||
u8 unk6368[3][64];
|
||||
struct UnknownStruct_81D1ED4 unk6428;
|
||||
u8 unk6780[3];
|
||||
u8 unk6783[3];
|
||||
s8 unk6786;
|
||||
s8 unk6787;
|
||||
s8 unk6788;
|
||||
s8 unk6789;
|
||||
u8 unk678A;
|
||||
};
|
||||
|
||||
void sub_81CD970(void);
|
||||
void sub_81CD9F8(void);
|
||||
u32 sub_81CD08C(struct PokenavSub11 *structPtr);
|
||||
u32 sub_81CD19C(struct PokenavSub11 *structPtr);
|
||||
u32 sub_81CD110(struct PokenavSub11 *structPtr);
|
||||
u8 sub_81CD1E4(struct PokenavSub11 *structPtr);
|
||||
u8 sub_81CD258(u8 arg0);
|
||||
void sub_81CD824(s16 arg0, u8 arg1);
|
||||
void sub_81CDA1C(s16 arg0, u8 arg1);
|
||||
void sub_81CDB98(s16 arg0, u8 arg1);
|
||||
|
||||
// code
|
||||
bool32 sub_81CCFD8(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = AllocSubstruct(11, sizeof(struct PokenavSub11));
|
||||
|
||||
if (structPtr == NULL)
|
||||
return FALSE;
|
||||
|
||||
sub_81D1ED4(&structPtr->unk6428);
|
||||
sub_81CD970();
|
||||
gKeyRepeatStartDelay = 20;
|
||||
structPtr->unk6304 = sub_81CD08C;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_81CD024(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = AllocSubstruct(11, sizeof(struct PokenavSub11));
|
||||
|
||||
if (structPtr == NULL)
|
||||
return FALSE;
|
||||
|
||||
sub_81D1ED4(&structPtr->unk6428);
|
||||
sub_81CD9F8();
|
||||
gKeyRepeatStartDelay = 20;
|
||||
structPtr->unk6304 = sub_81CD08C;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_81CD070(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
|
||||
return structPtr->unk6304(structPtr);
|
||||
}
|
||||
|
||||
u32 sub_81CD08C(struct PokenavSub11 *structPtr)
|
||||
{
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
u32 ret = sub_81CD1E4(structPtr);
|
||||
|
||||
if (ret == 0)
|
||||
{
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
structPtr->unk6304 = sub_81CD19C;
|
||||
ret = 2;
|
||||
}
|
||||
else if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (structPtr->unk6300 == 0)
|
||||
{
|
||||
if (unkPtr->unk2 == unkPtr->unk0 - 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
structPtr->unk6304 = sub_81CD19C;
|
||||
ret = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ret = 5;
|
||||
structPtr->unk6304 = sub_81CD110;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 sub_81CD110(struct PokenavSub11 *structPtr)
|
||||
{
|
||||
struct PokenavSub18 *unkPtr;
|
||||
u8 markings;
|
||||
u32 ret = 0, boxId, monId;
|
||||
|
||||
if (!sub_811FBA4())
|
||||
{
|
||||
structPtr->unk6783[structPtr->unk6786] = sub_81CEF14();
|
||||
unkPtr = GetSubstructPtr(18);
|
||||
boxId = unkPtr->unk4[unkPtr->unk2].boxId;
|
||||
monId = unkPtr->unk4[unkPtr->unk2].monId;
|
||||
markings = structPtr->unk6783[structPtr->unk6786];
|
||||
|
||||
if (boxId == TOTAL_BOXES_COUNT)
|
||||
SetMonData(&gPlayerParty[monId], MON_DATA_MARKINGS, &markings);
|
||||
else
|
||||
SetBoxMonDataAt(boxId, monId, MON_DATA_MARKINGS, &markings);
|
||||
|
||||
structPtr->unk6304 = sub_81CD08C;
|
||||
ret = 6;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u32 sub_81CD19C(struct PokenavSub11 *structPtr)
|
||||
{
|
||||
if (structPtr->unk6300 == 0)
|
||||
return 0x186A2;
|
||||
else
|
||||
return 0x186AA;
|
||||
}
|
||||
|
||||
void sub_81CD1C0(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
if (structPtr->unk6300 == 0)
|
||||
FreePokenavSubstruct(18);
|
||||
|
||||
FreePokenavSubstruct(11);
|
||||
}
|
||||
|
||||
u8 sub_81CD1E4(struct PokenavSub11 *structPtr)
|
||||
{
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
u8 ret = 0;
|
||||
|
||||
if (gMain.heldKeys & DPAD_UP)
|
||||
{
|
||||
if (structPtr->unk6300 == 0 || unkPtr->unk2 != 0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ret = sub_81CD258(1);
|
||||
}
|
||||
}
|
||||
else if (gMain.heldKeys & DPAD_DOWN)
|
||||
{
|
||||
if (structPtr->unk6300 == 0 || unkPtr->unk2 < unkPtr->unk0 - 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
ret = sub_81CD258(0);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
u8 sub_81CD258(u8 arg0)
|
||||
{
|
||||
u16 r7;
|
||||
bool8 r6, r0;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
|
||||
r7 = (arg0) ? structPtr->unk6788 : structPtr->unk6787;
|
||||
sub_81D1F84(&structPtr->unk6428, structPtr->unk6428.unk14[structPtr->unk6786], structPtr->unk6428.unk14[r7]);
|
||||
r6 = (unkPtr->unk2 != ((sub_81CDD5C() != 0) ? unkPtr->unk0 : unkPtr->unk0 - 1));
|
||||
if (arg0)
|
||||
{
|
||||
structPtr->unk6788 = structPtr->unk6787;
|
||||
structPtr->unk6787 = structPtr->unk6786;
|
||||
structPtr->unk6786 = r7;
|
||||
structPtr->unk6789 = structPtr->unk6788;
|
||||
|
||||
unkPtr->unk2 = (unkPtr->unk2 == 0) ? unkPtr->unk0 - 1 : unkPtr->unk2 - 1;
|
||||
structPtr->unk6302 = (unkPtr->unk2 != 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk6787 = structPtr->unk6788;
|
||||
structPtr->unk6788 = structPtr->unk6786;
|
||||
structPtr->unk6786 = r7;
|
||||
structPtr->unk6789 = structPtr->unk6787;
|
||||
|
||||
unkPtr->unk2 = (unkPtr->unk2 < unkPtr->unk0 - 1) ? unkPtr->unk2 + 1 : 0;
|
||||
structPtr->unk6302 = (unkPtr->unk2 < unkPtr->unk0 - 1) ? unkPtr->unk2 + 1 : 0;
|
||||
}
|
||||
|
||||
r0 = (unkPtr->unk2 != ((sub_81CDD5C() != 0) ? unkPtr->unk0 : unkPtr->unk0 - 1));
|
||||
|
||||
if (!r6)
|
||||
return 3;
|
||||
else if (!r0)
|
||||
return 4;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool32 sub_81CD3C4(void)
|
||||
{
|
||||
s32 var;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
|
||||
switch (structPtr->unk678A)
|
||||
{
|
||||
case 0:
|
||||
sub_81CD824(unkPtr->unk2, 0);
|
||||
break;
|
||||
case 1:
|
||||
sub_81CDA1C(unkPtr->unk2, 0);
|
||||
break;
|
||||
case 2:
|
||||
sub_81CDB98(unkPtr->unk2, 0);
|
||||
break;
|
||||
case 3:
|
||||
if (unkPtr->unk0 == 1)
|
||||
{
|
||||
structPtr->unk6786 = 0;
|
||||
structPtr->unk6787 = 0;
|
||||
structPtr->unk6788 = 0;
|
||||
structPtr->unk678A = 0;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk6786 = 0;
|
||||
structPtr->unk6787 = 1;
|
||||
structPtr->unk6788 = 2;
|
||||
}
|
||||
break;
|
||||
// These were probably ternaries just like cases 7-9, but couldn't match it any other way.
|
||||
case 4:
|
||||
var = unkPtr->unk2 + 1;
|
||||
if (var >= unkPtr->unk0)
|
||||
var = 0;
|
||||
sub_81CD824(var, 1);
|
||||
break;
|
||||
case 5:
|
||||
var = unkPtr->unk2 + 1;
|
||||
if (var >= unkPtr->unk0)
|
||||
var = 0;
|
||||
sub_81CDA1C(var, 1);
|
||||
break;
|
||||
case 6:
|
||||
var = unkPtr->unk2 + 1;
|
||||
if (var >= unkPtr->unk0)
|
||||
var = 0;
|
||||
sub_81CDB98(var, 1);
|
||||
break;
|
||||
case 7:
|
||||
sub_81CD824((unkPtr->unk2 - 1 >= 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1, 2);
|
||||
break;
|
||||
case 8:
|
||||
sub_81CDA1C((unkPtr->unk2 - 1 >= 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1, 2);
|
||||
break;
|
||||
case 9:
|
||||
sub_81CDB98((unkPtr->unk2 - 1 >= 0) ? unkPtr->unk2 - 1 : unkPtr->unk0 - 1, 2);
|
||||
structPtr->unk678A = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
structPtr->unk678A++;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 sub_81CD548(u8 arg0)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
|
||||
switch (arg0)
|
||||
{
|
||||
case 0:
|
||||
sub_81CD824(structPtr->unk6302, structPtr->unk6789);
|
||||
break;
|
||||
case 1:
|
||||
sub_81CDA1C(structPtr->unk6302, structPtr->unk6789);
|
||||
break;
|
||||
case 2:
|
||||
sub_81CDB98(structPtr->unk6302, structPtr->unk6789);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u8 *sub_81CD5CC(u8 *dst, const u8 *src, s16 n)
|
||||
{
|
||||
while (*src != EOS)
|
||||
*dst++ = *src++, n--;
|
||||
|
||||
while (n-- > 0)
|
||||
*dst++ = CHAR_SPACE;
|
||||
|
||||
*dst = EOS;
|
||||
return dst;
|
||||
}
|
||||
|
||||
u8 *sub_81CD624(u8 *str, u16 id, bool8 arg3)
|
||||
{
|
||||
u16 boxId, monId, gender, species, level, lvlDigits;
|
||||
struct BoxPokemon *boxMon;
|
||||
u8 *txtPtr, *str_;
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
|
||||
boxId = unkPtr->unk4[id].boxId;
|
||||
monId = unkPtr->unk4[id].monId;
|
||||
*(str++) = EXT_CTRL_CODE_BEGIN;
|
||||
*(str++) = 4;
|
||||
*(str++) = 8;
|
||||
*(str++) = 0;
|
||||
*(str++) = 9;
|
||||
|
||||
if (GetBoxOrPartyMonData(boxId, monId, MON_DATA_IS_EGG, NULL))
|
||||
return StringCopyPadded(str, gText_EggNickname, CHAR_SPACE, 12);
|
||||
|
||||
GetBoxOrPartyMonData(boxId, monId, MON_DATA_NICKNAME, str);
|
||||
StringGetEnd10(str);
|
||||
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES, NULL);
|
||||
if (boxId == TOTAL_BOXES_COUNT)
|
||||
{
|
||||
level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
|
||||
gender = GetMonGender(&gPlayerParty[monId]);
|
||||
}
|
||||
else
|
||||
{
|
||||
boxMon = GetBoxedMonPtr(boxId, monId);
|
||||
gender = GetBoxMonGender(boxMon);
|
||||
level = GetLevelFromBoxMonExp(boxMon);
|
||||
}
|
||||
|
||||
if ((species == SPECIES_NIDORAN_F || species == SPECIES_NIDORAN_M) && !StringCompare(str, gSpeciesNames[species]))
|
||||
gender = MON_GENDERLESS;
|
||||
|
||||
str_ = str; // For some reason, a variable is needed to match.
|
||||
while (*str_ != EOS)
|
||||
*(str_++);
|
||||
|
||||
*(str_++) = EXT_CTRL_CODE_BEGIN;
|
||||
*(str_++) = 0x12;
|
||||
*(str_++) = 0x3C;
|
||||
switch (gender)
|
||||
{
|
||||
default:
|
||||
*(str_++) = 0x77;
|
||||
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;
|
||||
txtPtr = str_;
|
||||
str_ = ConvertIntToDecimalStringN(str_, level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
lvlDigits = str_ - txtPtr;
|
||||
*(str_++) = CHAR_SPACE;
|
||||
if (!arg3)
|
||||
{
|
||||
lvlDigits = 3 - lvlDigits;
|
||||
while (lvlDigits-- != 0)
|
||||
*(str_++) = CHAR_SPACE;
|
||||
}
|
||||
|
||||
*str_ = EOS;
|
||||
return str_;
|
||||
}
|
||||
|
||||
void sub_81CD824(s16 arg0, u8 arg1)
|
||||
{
|
||||
u16 boxId, i;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
|
||||
if (arg0 != (sub_81CDD5C() != 0 ? unkPtr->unk0 : unkPtr->unk0 - 1))
|
||||
{
|
||||
sub_81CD624(structPtr->unk6368[arg1], arg0, FALSE);
|
||||
boxId = unkPtr->unk4[arg0].boxId;
|
||||
structPtr->unk6320[arg1][0] = EXT_CTRL_CODE_BEGIN;
|
||||
structPtr->unk6320[arg1][1] = 4;
|
||||
structPtr->unk6320[arg1][2] = 8;
|
||||
structPtr->unk6320[arg1][3] = 0;
|
||||
structPtr->unk6320[arg1][4] = 9;
|
||||
if (boxId == TOTAL_BOXES_COUNT)
|
||||
sub_81CD5CC(&structPtr->unk6320[arg1][5], gText_InParty, 8);
|
||||
else
|
||||
sub_81CD5CC(&structPtr->unk6320[arg1][5], GetBoxNamePtr(boxId), 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 12; i++)
|
||||
structPtr->unk6368[arg1][i] = CHAR_SPACE;
|
||||
structPtr->unk6368[arg1][i] = EOS;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
structPtr->unk6320[arg1][i] = CHAR_SPACE;
|
||||
structPtr->unk6320[arg1][i] = EOS;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81CD970(void)
|
||||
{
|
||||
u16 i, count;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
struct PokenavSub18 *unkPtr = AllocSubstruct(18, sizeof(struct PokenavSub18));
|
||||
|
||||
structPtr->unk6300 = 0;
|
||||
for (i = 0, count = 0; i < CalculatePlayerPartyCount(); i++)
|
||||
{
|
||||
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
|
||||
{
|
||||
unkPtr->unk4[count].boxId = TOTAL_BOXES_COUNT;
|
||||
unkPtr->unk4[count].monId = i;
|
||||
unkPtr->unk4[count].unk6 = 0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
unkPtr->unk4[count].boxId = 0;
|
||||
unkPtr->unk4[count].monId = 0;
|
||||
unkPtr->unk4[count].unk6 = 0;
|
||||
unkPtr->unk2 = 0;
|
||||
unkPtr->unk0 = count + 1;
|
||||
structPtr->unk678A = 0;
|
||||
}
|
||||
|
||||
void sub_81CD9F8(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
structPtr->unk6300 = 1;
|
||||
structPtr->unk678A = 0;
|
||||
}
|
||||
|
||||
void sub_81CDA1C(s16 arg0, u8 arg1)
|
||||
{
|
||||
u16 boxId, monId, i;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
|
||||
if (arg0 != (sub_81CDD5C() != 0 ? unkPtr->unk0 : unkPtr->unk0 - 1))
|
||||
{
|
||||
boxId = unkPtr->unk4[arg0].boxId;
|
||||
monId = unkPtr->unk4[arg0].monId;
|
||||
structPtr->unk6428.unk0[arg1][0] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_COOL, NULL);
|
||||
structPtr->unk6428.unk0[arg1][1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_TOUGH, NULL);
|
||||
structPtr->unk6428.unk0[arg1][2] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SMART, NULL);
|
||||
structPtr->unk6428.unk0[arg1][3] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_CUTE, NULL);
|
||||
structPtr->unk6428.unk0[arg1][4] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_BEAUTY, NULL);
|
||||
structPtr->unk6780[arg1] = (GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) != 255)
|
||||
? GetBoxOrPartyMonData(boxId, monId, MON_DATA_SHEEN, NULL) / 29u
|
||||
: 9;
|
||||
structPtr->unk6783[arg1] = GetBoxOrPartyMonData(boxId, monId, MON_DATA_MARKINGS, NULL);
|
||||
sub_81D2754(structPtr->unk6428.unk0[arg1], structPtr->unk6428.unk14[arg1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
structPtr->unk6428.unk0[arg1][i] = 0;
|
||||
structPtr->unk6428.unk14[arg1][i].unk0 = 155;
|
||||
structPtr->unk6428.unk14[arg1][i].unk2 = 91;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81CDB98(s16 arg0, u8 arg1)
|
||||
{
|
||||
u16 boxId, monId, species;
|
||||
u32 personality, tid;
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
|
||||
if (arg0 == (sub_81CDD5C() != 0 ? unkPtr->unk0 : unkPtr->unk0 - 1))
|
||||
return;
|
||||
|
||||
boxId = unkPtr->unk4[arg0].boxId;
|
||||
monId = unkPtr->unk4[arg0].monId;
|
||||
species = GetBoxOrPartyMonData(boxId, monId, MON_DATA_SPECIES2, NULL);
|
||||
tid = GetBoxOrPartyMonData(boxId, monId, MON_DATA_OT_ID, NULL);
|
||||
personality = GetBoxOrPartyMonData(boxId, monId, MON_DATA_PERSONALITY, NULL);
|
||||
LoadSpecialPokePic(&gMonFrontPicTable[species], structPtr->monPicGfx[arg1], species, personality, TRUE);
|
||||
LZ77UnCompWram(GetMonSpritePalFromSpeciesAndPersonality(species, tid, personality), structPtr->monPal[arg1]);
|
||||
}
|
||||
|
||||
u16 sub_81CDC50(void)
|
||||
{
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
return unkPtr->unk0;
|
||||
}
|
||||
|
||||
u16 sub_81CDC60(void)
|
||||
{
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
return unkPtr->unk2;
|
||||
}
|
||||
|
||||
struct UnknownStruct_81D1ED4 *sub_81CDC70(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return &structPtr->unk6428;
|
||||
}
|
||||
|
||||
u8 sub_81CDC84(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->unk6786;
|
||||
}
|
||||
|
||||
u8 sub_81CDC9C(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->unk6302;
|
||||
}
|
||||
|
||||
void *sub_81CDCB4(u8 id)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->monPicGfx[id];
|
||||
}
|
||||
|
||||
void *sub_81CDCD4(u8 id)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->monPal[id];
|
||||
}
|
||||
|
||||
u8 sub_81CDCEC(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->unk6789;
|
||||
}
|
||||
|
||||
u8 *sub_81CDD04(u8 id)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->unk6368[id];
|
||||
}
|
||||
|
||||
u8 *sub_81CDD24(u8 id)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->unk6320[id];
|
||||
}
|
||||
|
||||
u16 sub_81CDD48(void)
|
||||
{
|
||||
struct PokenavSub18 *unkPtr = GetSubstructPtr(18);
|
||||
return unkPtr->unk4[unkPtr->unk2].unk6;
|
||||
}
|
||||
|
||||
bool32 sub_81CDD5C(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
if (structPtr->unk6300 == 1)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u8 sub_81CDD7C(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
if (structPtr->unk6300 == 1)
|
||||
return structPtr->unk6783[structPtr->unk6786];
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 sub_81CDDB0(void)
|
||||
{
|
||||
struct PokenavSub11 *structPtr = GetSubstructPtr(11);
|
||||
return structPtr->unk6780[structPtr->unk6786];
|
||||
}
|
@ -1,3 +1,796 @@
|
||||
#include "global.h"
|
||||
#include "bg.h"
|
||||
#include "decompress.h"
|
||||
#include "gpu_regs.h"
|
||||
#include "graphics.h"
|
||||
#include "menu.h"
|
||||
#include "menu_specialized.h"
|
||||
#include "mon_markings.h"
|
||||
#include "palette.h"
|
||||
#include "pokenav.h"
|
||||
#include "scanline_effect.h"
|
||||
#include "string_util.h"
|
||||
#include "strings.h"
|
||||
#include "text.h"
|
||||
|
||||
BSS_DATA u8 gUnknown_030012BC;
|
||||
static u8 gUnknown_030012BC;
|
||||
|
||||
struct Pokenav7Struct
|
||||
{
|
||||
u32 loopedTaskId;
|
||||
u8 tilemapBuffers[3][BG_SCREEN_SIZE];
|
||||
u8 filler[2];
|
||||
u8 unk1806[10];
|
||||
u32 (*unk1810)(void);
|
||||
s16 unk1814;
|
||||
u8 unk1816;
|
||||
u16 unk1818;
|
||||
u16 unk181A;
|
||||
void *unk181C;
|
||||
u8 unk1820;
|
||||
u8 unk1821;
|
||||
u8 unk1822;
|
||||
u8 unk1823;
|
||||
struct PokemonMarkMenu monMarks;
|
||||
struct Sprite *unk28dc;
|
||||
struct Sprite *unk28e0[10];
|
||||
u8 unk2908;
|
||||
u8 filler2[0x38ac - 0x2909];
|
||||
};
|
||||
|
||||
extern s8 sub_81CDC84(void); // This function's declaration here is different than its definition in pokenav_unk_6. u8/s8
|
||||
|
||||
u32 sub_81CDE94(s32 state);
|
||||
u32 sub_81CDE80(void);
|
||||
void sub_81CED30(u8 var);
|
||||
void sub_81CE9E4(void);
|
||||
void sub_81CE934(void);
|
||||
bool32 sub_81CE754(u8 a0, u16 a1, bool8 a2);
|
||||
void sub_81CEE44(void);
|
||||
void sub_81CEE90(void);
|
||||
void sub_81CEEC8(void);
|
||||
void sub_81CEE68(void);
|
||||
void sub_81CEE74(bool8 showBg);
|
||||
|
||||
// const data
|
||||
extern const LoopedTask gUnknown_08623384[];
|
||||
extern const struct BgTemplate gUnknown_08623358[3];
|
||||
extern const u32 gUnknown_08623228[];
|
||||
extern const u32 gUnknown_0862323C[];
|
||||
extern const u16 gUnknown_086231E8[];
|
||||
extern const u16 gUnknown_08623338[];
|
||||
extern const u16 gUnknown_08623208[];
|
||||
extern const struct WindowTemplate gUnknown_08623364;
|
||||
extern const struct WindowTemplate gUnknown_0862336C;
|
||||
extern const struct WindowTemplate gUnknown_08623374;
|
||||
extern const struct WindowTemplate gUnknown_0862337C;
|
||||
|
||||
// code
|
||||
bool32 sub_81CDDD4(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = AllocSubstruct(0xC, sizeof(struct Pokenav7Struct));
|
||||
|
||||
if (structPtr == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->unk1816 = 0xFF;
|
||||
structPtr->loopedTaskId = CreateLoopedTask(sub_81CDE94, 1);
|
||||
structPtr->unk1810 = sub_81CDE80;
|
||||
structPtr->unk2908 = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81CDE2C(int id)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
structPtr->loopedTaskId = CreateLoopedTask(gUnknown_08623384[id], 1);
|
||||
structPtr->unk1810 = sub_81CDE80;
|
||||
}
|
||||
|
||||
u32 sub_81CDE64(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
return structPtr->unk1810();
|
||||
}
|
||||
|
||||
u32 sub_81CDE80(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
return IsLoopedTaskActive(structPtr->loopedTaskId);
|
||||
}
|
||||
|
||||
u32 sub_81CDE94(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
if (sub_81CD3C4() != TRUE)
|
||||
return 2;
|
||||
return 0;
|
||||
case 1:
|
||||
InitBgTemplates(gUnknown_08623358, ARRAY_COUNT(gUnknown_08623358));
|
||||
ChangeBgX(1, 0, 0);
|
||||
ChangeBgY(1, 0, 0);
|
||||
ChangeBgX(2, 0, 0);
|
||||
ChangeBgY(2, 0, 0);
|
||||
ChangeBgX(3, 0, 0);
|
||||
ChangeBgY(3, 0, 0);
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON);
|
||||
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3);
|
||||
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4));
|
||||
decompress_and_copy_tile_data_to_vram(3, gPokenavCondition_Gfx, 0, 0, 0);
|
||||
return 0;
|
||||
case 2:
|
||||
if (free_temp_tile_data_buffers_if_possible())
|
||||
return 2;
|
||||
decompress_and_copy_tile_data_to_vram(2, gUnknown_08623228, 0, 0, 0);
|
||||
return 0;
|
||||
case 3:
|
||||
if (free_temp_tile_data_buffers_if_possible())
|
||||
return 2;
|
||||
|
||||
LZ77UnCompVram(gPokenavCondition_Tilemap, structPtr->tilemapBuffers[0]);
|
||||
SetBgTilemapBuffer(3, structPtr->tilemapBuffers[0]);
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
CopyToBgTilemapBufferRect(3, gPokenavOptions_Tilemap, 0, 5, 9, 4);
|
||||
|
||||
CopyBgTilemapBufferToVram(3);
|
||||
CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, 0x10, 0x20);
|
||||
CopyPaletteIntoBufferUnfaded(gUnknown_08623208, 0xF0, 0x20);
|
||||
structPtr->unk1814 = -80;
|
||||
return 0;
|
||||
case 4:
|
||||
if (free_temp_tile_data_buffers_if_possible())
|
||||
return 2;
|
||||
|
||||
LZ77UnCompVram(gUnknown_0862323C, structPtr->tilemapBuffers[2]);
|
||||
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]);
|
||||
CopyBgTilemapBufferToVram(2);
|
||||
CopyPaletteIntoBufferUnfaded(gUnknown_086231E8, 0x30, 0x20);
|
||||
sub_81D21DC(2);
|
||||
return 0;
|
||||
case 5:
|
||||
sub_8199DF0(1, 0, 0, 1);
|
||||
sub_8199DF0(1, 17, 1, 1);
|
||||
CpuFill32(0, structPtr->tilemapBuffers[1], BG_SCREEN_SIZE);
|
||||
SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]);
|
||||
return 0;
|
||||
case 6:
|
||||
if (free_temp_tile_data_buffers_if_possible())
|
||||
return 2;
|
||||
|
||||
structPtr->unk1820 = AddWindow(&gUnknown_08623364);
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
{
|
||||
structPtr->unk1821 = AddWindow(&gUnknown_0862336C);
|
||||
structPtr->unk1822 = AddWindow(&gUnknown_08623374);
|
||||
structPtr->unk1823 = AddWindow(&gUnknown_0862337C);
|
||||
}
|
||||
DeactivateAllTextPrinters();
|
||||
return 0;
|
||||
case 7:
|
||||
sub_81CED30(0);
|
||||
return 0;
|
||||
case 8:
|
||||
sub_81CE9E4();
|
||||
return 0;
|
||||
case 9:
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
sub_81CE934();
|
||||
return 0;
|
||||
case 10:
|
||||
sub_81CE754(0, sub_81CDC84(), TRUE);
|
||||
return 0;
|
||||
case 11:
|
||||
sub_81CE754(1, sub_81CDC84(), TRUE);
|
||||
return 0;
|
||||
case 12:
|
||||
sub_81CE754(2, sub_81CDC84(), TRUE);
|
||||
return 0;
|
||||
case 13:
|
||||
if (sub_81CE754(3, sub_81CDC84(), TRUE) != TRUE)
|
||||
return 2;
|
||||
PutWindowTilemap(structPtr->unk1820);
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
{
|
||||
PutWindowTilemap(structPtr->unk1821);
|
||||
PutWindowTilemap(structPtr->unk1822);
|
||||
PutWindowTilemap(structPtr->unk1823);
|
||||
}
|
||||
return 0;
|
||||
case 14:
|
||||
ShowBg(1);
|
||||
HideBg(2);
|
||||
ShowBg(3);
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
sub_81C7BA4(4);
|
||||
return 0;
|
||||
case 15:
|
||||
sub_81C7AC0(1);
|
||||
if (!sub_81CDD5C())
|
||||
{
|
||||
LoadLeftHeaderGfxForIndex(6);
|
||||
sub_81C7FA0(1, TRUE, 0);
|
||||
sub_81C7FA0(6, TRUE, 0);
|
||||
}
|
||||
return 0;
|
||||
case 16:
|
||||
if (IsPaletteFadeActive())
|
||||
return 2;
|
||||
if (!sub_81CDD5C() && sub_81C8010())
|
||||
return 2;
|
||||
SetVBlankCallback_(sub_81CEE44);
|
||||
return 0;
|
||||
case 17:
|
||||
sub_81CEE90();
|
||||
sub_81D20AC(sub_81CDC70());
|
||||
return 0;
|
||||
case 18:
|
||||
if (sub_81D20BC(sub_81CDC70()))
|
||||
return 2;
|
||||
return 0;
|
||||
case 19:
|
||||
sub_81CEE74(TRUE);
|
||||
return 0;
|
||||
case 20:
|
||||
if (!sub_81D3178(sub_81CDC70(), &structPtr->unk1814))
|
||||
{
|
||||
sub_81D3464(structPtr->unk28e0);
|
||||
if (sub_81CDD5C() == TRUE || sub_81CDC60() != sub_81CDC50())
|
||||
sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
|
||||
|
||||
return 4;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CE2D0(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_81CEEC8();
|
||||
sub_81D3520(structPtr->unk28e0);
|
||||
return 1;
|
||||
case 1:
|
||||
if (sub_81D31A4(sub_81CDC70(), &structPtr->unk1814))
|
||||
return 2;
|
||||
sub_81CEE74(FALSE);
|
||||
return 1;
|
||||
case 2:
|
||||
sub_81C7AC0(0);
|
||||
if (!sub_81CDD5C())
|
||||
sub_81C78A0();
|
||||
return 0;
|
||||
case 3:
|
||||
if (IsPaletteFadeActive() || MainMenuLoopedTaskIsBusy())
|
||||
return 2;
|
||||
sub_81D354C(structPtr->unk28e0);
|
||||
HideBg(1);
|
||||
HideBg(2);
|
||||
HideBg(3);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CE37C(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
struct UnknownStruct_81D1ED4 *unkPtr = sub_81CDC70();
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_81CD548(0);
|
||||
return 1;
|
||||
case 1:
|
||||
sub_81CD548(1);
|
||||
return 1;
|
||||
case 2:
|
||||
sub_81CD548(2);
|
||||
sub_81D3520(structPtr->unk28e0);
|
||||
return 1;
|
||||
case 3:
|
||||
sub_81D2074(unkPtr);
|
||||
return 1;
|
||||
case 4:
|
||||
if (!sub_81D3150(&structPtr->unk1814))
|
||||
{
|
||||
sub_81CED30(sub_81CDC84());
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
case 5:
|
||||
sub_81CE754(0, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 6:
|
||||
sub_81CE754(1, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 7:
|
||||
sub_81CE754(2, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 8:
|
||||
if (sub_81CE754(3, sub_81CDC84(), FALSE) == TRUE)
|
||||
return 1;
|
||||
return 2;
|
||||
case 9:
|
||||
unkPtr = sub_81CDC70();
|
||||
if (!sub_81D3178(unkPtr, &structPtr->unk1814))
|
||||
{
|
||||
sub_81D3464(structPtr->unk28e0);
|
||||
if (sub_81CDD5C() != TRUE && sub_81CDC60() == sub_81CDC50())
|
||||
return 1;
|
||||
|
||||
sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CE4D8(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_81CD548(0);
|
||||
return 1;
|
||||
case 1:
|
||||
sub_81CD548(1);
|
||||
return 1;
|
||||
case 2:
|
||||
sub_81CD548(2);
|
||||
return 1;
|
||||
case 3:
|
||||
sub_81CED30(sub_81CDC84());
|
||||
return 1;
|
||||
case 4:
|
||||
sub_81CE754(0, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 5:
|
||||
sub_81CE754(1, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 6:
|
||||
sub_81CE754(2, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 7:
|
||||
if (sub_81CE754(3, sub_81CDC84(), FALSE) == TRUE)
|
||||
return 1;
|
||||
return 2;
|
||||
case 8:
|
||||
if (!sub_81D3178(sub_81CDC70(), &structPtr->unk1814))
|
||||
{
|
||||
sub_81D3464(structPtr->unk28e0);
|
||||
sub_81D3480(structPtr->unk28e0, structPtr->unk1816, sub_81CDDB0());
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CE5E4(s32 state)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_81CD548(0);
|
||||
return 1;
|
||||
case 1:
|
||||
sub_81CD548(1);
|
||||
return 1;
|
||||
case 2:
|
||||
sub_81CD548(2);
|
||||
sub_81D3520(structPtr->unk28e0);
|
||||
return 1;
|
||||
case 3:
|
||||
if (!sub_81D31A4(sub_81CDC70(), &structPtr->unk1814))
|
||||
return 1;
|
||||
return 2;
|
||||
case 4:
|
||||
sub_81CE754(0, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 5:
|
||||
sub_81CE754(1, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 6:
|
||||
sub_81CE754(2, sub_81CDC84(), FALSE);
|
||||
return 1;
|
||||
case 7:
|
||||
if (sub_81CE754(3, sub_81CDC84(), FALSE) == TRUE)
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CE6BC(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_811FAA4(sub_81CDD7C(), 0xb0, 0x20);
|
||||
return 1;
|
||||
case 1:
|
||||
sub_81C7BA4(5);
|
||||
return 1;
|
||||
case 2:
|
||||
if (IsDma3ManagerBusyWithBgCopy_() == TRUE)
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u32 sub_81CE700(s32 state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
sub_811FAF8();
|
||||
return 1;
|
||||
case 1:
|
||||
sub_81C7BA4(4);
|
||||
return 1;
|
||||
case 2:
|
||||
if (IsDma3ManagerBusyWithBgCopy_() == TRUE)
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
u8 *sub_81CE738(u8 *dst, u16 num)
|
||||
{
|
||||
u8 *txtPtr = ConvertIntToDecimalStringN(dst, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
|
||||
txtPtr = StringCopy(txtPtr, gText_Number2);
|
||||
|
||||
return txtPtr;
|
||||
}
|
||||
|
||||
bool32 sub_81CE754(u8 a0, u16 a1, bool8 a2)
|
||||
{
|
||||
u8 text[32];
|
||||
const u8 *str;
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
switch (a0)
|
||||
{
|
||||
case 0:
|
||||
FillWindowPixelBuffer(structPtr->unk1820, 0);
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
FillWindowPixelBuffer(structPtr->unk1821, 0);
|
||||
break;
|
||||
case 1:
|
||||
if (sub_81CDC60() != sub_81CDC50() - 1 || sub_81CDD5C() == TRUE)
|
||||
{
|
||||
str = sub_81CDD04(a1);
|
||||
AddTextPrinterParameterized(structPtr->unk1820, 1, str, 0, 1, 0, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
{
|
||||
str = sub_81CDD24(a1);
|
||||
AddTextPrinterParameterized(structPtr->unk1820, 1, str, 0, 17, 0, NULL);
|
||||
text[0] = EXT_CTRL_CODE_BEGIN;
|
||||
text[1] = 4;
|
||||
text[2] = 8;
|
||||
text[3] = 0;
|
||||
text[4] = 9;
|
||||
StringCopy(text + 5, gText_Number2);
|
||||
AddTextPrinterParameterized(structPtr->unk1821, 1, text, 4, 1, 0, NULL);
|
||||
ConvertIntToDecimalStringN(text + 5, sub_81CDD48(), STR_CONV_MODE_RIGHT_ALIGN, 4);
|
||||
AddTextPrinterParameterized(structPtr->unk1821, 1, text, 28, 1, 0, NULL);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (structPtr->unk2908)
|
||||
{
|
||||
case 0:
|
||||
if (a2)
|
||||
CopyWindowToVram(structPtr->unk1820, 3);
|
||||
else
|
||||
CopyWindowToVram(structPtr->unk1820, 2);
|
||||
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
{
|
||||
structPtr->unk2908++;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk2908 = 0;
|
||||
return TRUE;
|
||||
}
|
||||
case 1:
|
||||
if (a2)
|
||||
CopyWindowToVram(structPtr->unk1821, 3);
|
||||
else
|
||||
CopyWindowToVram(structPtr->unk1821, 2);
|
||||
|
||||
structPtr->unk2908 = 0;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_81CE934(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
CopyWindowToVram(structPtr->unk1822, 3);
|
||||
CopyWindowToVram(structPtr->unk1823, 3);
|
||||
}
|
||||
|
||||
void sub_81CE964(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data[0] == sub_81CDC60())
|
||||
StartSpriteAnim(sprite, 0);
|
||||
else
|
||||
StartSpriteAnim(sprite, 1);
|
||||
}
|
||||
|
||||
void sub_81CE990(struct Sprite *sprite)
|
||||
{
|
||||
if (sub_81CDC60() == sub_81CDC50() - 1)
|
||||
sprite->oam.paletteNum = IndexOfSpritePaletteTag(0x65);
|
||||
else
|
||||
sprite->oam.paletteNum = IndexOfSpritePaletteTag(0x66);
|
||||
}
|
||||
|
||||
void sub_81CE9C8(struct Sprite *sprite)
|
||||
{
|
||||
StartSpriteAnim(sprite, sub_81CDD7C());
|
||||
}
|
||||
|
||||
void sub_81CE9E4(void)
|
||||
{
|
||||
struct SpriteSheet sprSheets[4];
|
||||
struct SpriteTemplate sprTemplate;
|
||||
struct SpritePalette sprPals[3];
|
||||
struct SpriteSheet sprSheet;
|
||||
struct Sprite *sprite;
|
||||
u16 i, spriteId;
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
sub_81D321C(sprSheets, &sprTemplate, sprPals);
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
{
|
||||
structPtr->monMarks.baseTileTag = 0x6A;
|
||||
structPtr->monMarks.basePaletteTag = 0x6A;
|
||||
sub_811F90C(&structPtr->monMarks);
|
||||
sub_811FA90();
|
||||
sprite = sub_811FF94(0x69, 0x69, gUnknown_08623338);
|
||||
sprite->oam.priority = 3;
|
||||
sprite->pos1.x = 192;
|
||||
sprite->pos1.y = 32;
|
||||
sprite->callback = sub_81CE9C8;
|
||||
structPtr->unk28dc = sprite;
|
||||
sub_81C7990(IndexOfSpritePaletteTag(0x69), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadSpriteSheets(sprSheets);
|
||||
Pokenav_AllocAndLoadPalettes(sprPals);
|
||||
for (i = 0; i < sub_81CDC50() - 1; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&sprTemplate, 226, (i * 20) + 8, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
structPtr->unk1806[i] = spriteId;
|
||||
gSprites[spriteId].data[0] = i;
|
||||
gSprites[spriteId].callback = sub_81CE964;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk1806[i] = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
sprTemplate.tileTag = 0x67;
|
||||
sprTemplate.callback = SpriteCallbackDummy;
|
||||
for (; i < 6; i++)
|
||||
{
|
||||
spriteId = CreateSprite(&sprTemplate, 230, (i * 20) + 8, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
structPtr->unk1806[i] = spriteId;
|
||||
gSprites[spriteId].oam.size = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk1806[i] = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
sprTemplate.tileTag = 0x66;
|
||||
sprTemplate.callback = sub_81CE990;
|
||||
spriteId = CreateSprite(&sprTemplate, 222, (i * 20) + 8, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
structPtr->unk1806[i] = spriteId;
|
||||
gSprites[spriteId].oam.shape = 1;
|
||||
gSprites[spriteId].oam.size = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk1806[i] = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
sub_81D32B0(&sprSheet, &sprPals[0]);
|
||||
LoadSpriteSheet(&sprSheet);
|
||||
sprPals[1].data = NULL;
|
||||
Pokenav_AllocAndLoadPalettes(sprPals);
|
||||
}
|
||||
|
||||
void sub_81CEBF4(struct Pokenav7Struct *structPtr)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
{
|
||||
DestroySprite(structPtr->unk28dc);
|
||||
FreeSpriteTilesByTag(0x6A);
|
||||
FreeSpriteTilesByTag(0x69);
|
||||
FreeSpritePaletteByTag(0x6A);
|
||||
FreeSpritePaletteByTag(0x69);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 7; i++)
|
||||
DestroySprite(&gSprites[structPtr->unk1806[i]]);
|
||||
|
||||
FreeSpriteTilesByTag(0x65);
|
||||
FreeSpriteTilesByTag(0x66);
|
||||
FreeSpriteTilesByTag(0x67);
|
||||
FreeSpritePaletteByTag(0x65);
|
||||
FreeSpritePaletteByTag(0x66);
|
||||
}
|
||||
|
||||
if (structPtr->unk1816 != 0xFF)
|
||||
{
|
||||
DestroySprite(&gSprites[structPtr->unk1816]);
|
||||
FreeSpriteTilesByTag(0x64);
|
||||
FreeSpritePaletteByTag(0x64);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81CECA0(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
RemoveWindow(structPtr->unk1820);
|
||||
if (sub_81CDD5C() == TRUE)
|
||||
{
|
||||
RemoveWindow(structPtr->unk1821);
|
||||
RemoveWindow(structPtr->unk1822);
|
||||
RemoveWindow(structPtr->unk1823);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_81C7FDC();
|
||||
}
|
||||
|
||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP);
|
||||
sub_81CEBF4(structPtr);
|
||||
sub_81CEE68();
|
||||
FreePokenavSubstruct(0xC);
|
||||
}
|
||||
|
||||
void sub_81CED10(struct Sprite *sprite)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
sprite->pos1.x = structPtr->unk1814 + 38;
|
||||
}
|
||||
|
||||
void sub_81CED30(u8 var)
|
||||
{
|
||||
struct SpriteTemplate sprTemplate;
|
||||
struct SpriteSheet sprSheet;
|
||||
struct SpritePalette sprPal;
|
||||
u8 spriteId;
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
if (structPtr->unk1816 == 0xFF)
|
||||
{
|
||||
sub_81D31D0(&sprSheet, &sprTemplate, &sprPal);
|
||||
sprSheet.data = sub_81CDCB4(var);
|
||||
sprPal.data = sub_81CDCD4(var);
|
||||
structPtr->unk1818 = LoadSpritePalette(&sprPal);
|
||||
structPtr->unk181A = LoadSpriteSheet(&sprSheet);
|
||||
spriteId = CreateSprite(&sprTemplate, 38, 104, 0);
|
||||
structPtr->unk1816 = spriteId;
|
||||
if (spriteId == MAX_SPRITES)
|
||||
{
|
||||
FreeSpriteTilesByTag(0x64);
|
||||
FreeSpritePaletteByTag(0x64);
|
||||
structPtr->unk1816 = 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
structPtr->unk1816 = spriteId;
|
||||
gSprites[structPtr->unk1816].callback = sub_81CED10;
|
||||
structPtr->unk181C = (void*)(VRAM) + 0x10000 + (structPtr->unk181A * 32);
|
||||
structPtr->unk1818 = (structPtr->unk1818 * 16) + 0x100;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DmaCopy16Defvars(3, sub_81CDCB4(var), structPtr->unk181C, 0x800);
|
||||
LoadPalette(sub_81CDCD4(var), structPtr->unk1818, 0x20);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81CEE44(void)
|
||||
{
|
||||
struct UnknownStruct_81D1ED4 *unk = sub_81CDC70();
|
||||
LoadOam();
|
||||
ProcessSpriteCopyRequests();
|
||||
TransferPlttBuffer();
|
||||
sub_81D2108(unk);
|
||||
ScanlineEffect_InitHBlankDmaTransfer();
|
||||
}
|
||||
|
||||
void sub_81CEE68(void)
|
||||
{
|
||||
SetPokenavVBlankCallback();
|
||||
}
|
||||
|
||||
void sub_81CEE74(bool8 showBg)
|
||||
{
|
||||
if (showBg)
|
||||
ShowBg(2);
|
||||
else
|
||||
HideBg(2);
|
||||
}
|
||||
|
||||
void sub_81CEE90(void)
|
||||
{
|
||||
struct UnknownStruct_81D1ED4 *unk = sub_81CDC70();
|
||||
u8 id = sub_81CDC84();
|
||||
|
||||
gUnknown_030012BC = id;
|
||||
sub_81D1F84(unk, unk->unk14[3], unk->unk14[id]);
|
||||
sub_81D2074(unk);
|
||||
}
|
||||
|
||||
void sub_81CEEC8(void)
|
||||
{
|
||||
struct UnknownStruct_81D1ED4 *unk = sub_81CDC70();
|
||||
|
||||
if (sub_81CDD5C() || sub_81CDC60() != sub_81CDC50() - 1)
|
||||
sub_81D1F84(unk, unk->unk14[sub_81CDC84()], unk->unk14[3]);
|
||||
}
|
||||
|
||||
u8 sub_81CEF14(void)
|
||||
{
|
||||
struct Pokenav7Struct *structPtr = GetSubstructPtr(0xC);
|
||||
|
||||
if (sub_81CDD5C() == 1)
|
||||
return structPtr->monMarks.markings;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
115
src/pokenav_unk_8.c
Normal file
115
src/pokenav_unk_8.c
Normal file
@ -0,0 +1,115 @@
|
||||
#include "global.h"
|
||||
#include "pokenav.h"
|
||||
|
||||
struct PokenavSub7
|
||||
{
|
||||
u32 (*unk0)(struct PokenavSub7 *);
|
||||
u32 loopedTaskId;
|
||||
u8 fill1[12];
|
||||
u32 unk14;
|
||||
u32 unk18;
|
||||
u32 unk1C;
|
||||
struct PokenavSub18 *unkPtr;
|
||||
};
|
||||
|
||||
extern const u32 gUnknown_086233A0[];
|
||||
|
||||
u32 sub_81CF010(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF030(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF0B8(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF0B0(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF11C(s32 state);
|
||||
|
||||
bool32 sub_81CEF3C(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7));
|
||||
if (structPtr == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->unkPtr = AllocSubstruct(18, sizeof(struct PokenavSub18));
|
||||
if (structPtr->unkPtr == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->unk0 = sub_81CF010;
|
||||
structPtr->loopedTaskId = CreateLoopedTask(sub_81CF11C, 1);
|
||||
structPtr->unk18 = 0;
|
||||
structPtr->unk14 = gUnknown_086233A0[sub_81C76AC()];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_81CEF98(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7));
|
||||
if (structPtr == NULL)
|
||||
return FALSE;
|
||||
|
||||
structPtr->unkPtr = GetSubstructPtr(18);
|
||||
structPtr->unk0 = sub_81CF030;
|
||||
structPtr->unk18 = 1;
|
||||
structPtr->unk14 = gUnknown_086233A0[sub_81C76AC()];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_81CEFDC(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = GetSubstructPtr(7);
|
||||
return structPtr->unk0(structPtr);
|
||||
}
|
||||
|
||||
void sub_81CEFF0(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = GetSubstructPtr(7);
|
||||
if (structPtr->unk1C == 0)
|
||||
FreePokenavSubstruct(18);
|
||||
FreePokenavSubstruct(7);
|
||||
}
|
||||
|
||||
bool32 sub_81CF010(struct PokenavSub7 *structPtr)
|
||||
{
|
||||
if (!IsLoopedTaskActive(structPtr->loopedTaskId))
|
||||
structPtr->unk0 = sub_81CF030;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 sub_81CF030(struct PokenavSub7 *structPtr)
|
||||
{
|
||||
if (gMain.newAndRepeatedKeys & DPAD_UP)
|
||||
return 1;
|
||||
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
|
||||
return 2;
|
||||
else if (gMain.newKeys & DPAD_LEFT)
|
||||
return 3;
|
||||
else if (gMain.newKeys & DPAD_RIGHT)
|
||||
return 4;
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
structPtr->unk1C = 0;
|
||||
structPtr->unk0 = sub_81CF0B0;
|
||||
return 5;
|
||||
}
|
||||
else if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
structPtr->unkPtr->unk2 = GetSelectedMatchCall();
|
||||
structPtr->unk1C = 1;
|
||||
structPtr->unk0 = sub_81CF0B8;
|
||||
return 6;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 sub_81CF0B0(struct PokenavSub7 *structPtr)
|
||||
{
|
||||
return 0x186A3;
|
||||
}
|
||||
|
||||
u32 sub_81CF0B8(struct PokenavSub7 *structPtr)
|
||||
{
|
||||
return 0x186A9;
|
||||
}
|
||||
|
||||
u32 sub_81CF0C0(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = GetSubstructPtr(7);
|
||||
return structPtr->unk18;
|
||||
}
|
@ -104,7 +104,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8
|
||||
if (paletteTag == 0xFFFF)
|
||||
{
|
||||
sCreatingSpriteTemplate.paletteTag = 0xFFFF;
|
||||
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20);
|
||||
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x100 + paletteSlot * 0x10, 0x20);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -130,7 +130,7 @@ static void LoadPicPaletteByTagOrSlot(u16 species, u32 otId, u32 personality, u8
|
||||
static void LoadPicPaletteBySlot(u16 species, u32 otId, u32 personality, u8 paletteSlot, bool8 isTrainer)
|
||||
{
|
||||
if (!isTrainer)
|
||||
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), paletteSlot * 0x10, 0x20);
|
||||
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), paletteSlot * 0x10, 0x20);
|
||||
else
|
||||
LoadCompressedPalette(gTrainerFrontPicPaletteTable[species].data, paletteSlot * 0x10, 0x20);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user