Decompile pokemon unk 6

This commit is contained in:
DizzyEggg 2019-07-25 18:56:08 +02:00
parent 2bd5833833
commit fd07c608fc
16 changed files with 660 additions and 1774 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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);

View File

@ -187,18 +187,17 @@ void sub_81CC670(void);
// pokenav_unk_6.c
bool32 sub_81CD3C4(void);
bool32 sub_81CDD5C(void);
s8 sub_81CDC84(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);
const u8 *sub_81CDD04(u8 id);
const u8 *sub_81CDD24(u8 id);
u8 *sub_81CDD04(u8 id);
u8 *sub_81CDD24(u8 id);
u16 sub_81CDD48(void);
const void *sub_81CDCB4(u8 id);
const u16 *sub_81CDCD4(u8 id);
void *sub_81CDCB4(u8 id);
void *sub_81CDCD4(u8 id);
// pokenav_unk_7.c
u8 sub_81CEF14(void);

View File

@ -316,7 +316,7 @@ 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*);
src/pokenav_unk_6.o(.text*);
src/pokenav_unk_7.o(.text*);
asm/pokenav_unk_8.o(.text*);
asm/pokenav_unk_9.o(.text*);

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

637
src/pokenav_unk_6.c Normal file
View File

@ -0,0 +1,637 @@
#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;
};
struct PokenavSub18
{
u16 unk0;
u16 unk2;
struct
{
u8 boxId;
u8 monId;
u16 unk6;
} unk4[TOTAL_BOXES_COUNT * IN_BOX_COUNT + PARTY_SIZE];
};
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];
}

View File

@ -38,6 +38,8 @@ struct Pokenav7Struct
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);

View File

@ -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);
}