Documented/polished pokemon_summary_screen.c

Mostly variables mislabeled as global and some formerly unknown stuff.
This commit is contained in:
Ariel Antonitis 2019-02-19 04:09:42 -05:00
parent 7995cf5b61
commit 74a3c06270
10 changed files with 254 additions and 252 deletions

View File

@ -4020,22 +4020,22 @@ extern const u32 gPokenavLeftHeaderCondition_Gfx[];
extern const u32 gPokenavLeftHeaderRibbons_Gfx[]; extern const u32 gPokenavLeftHeaderRibbons_Gfx[];
extern const u32 gPokenavLeftHeaderMatchCall_Gfx[]; extern const u32 gPokenavLeftHeaderMatchCall_Gfx[];
extern const u32 gUnknown_08D9862C[]; extern const u32 gPageInfoTilemap[];
extern const u32 gUnknown_08D98CC8[]; extern const u32 gUnknown_08D98CC8[];
extern const u32 gUnknown_08D987FC[]; extern const u32 gPageSkillsTilemap[];
extern const u32 gUnknown_08D9898C[]; extern const u32 gPageBattleMovesTilemap[];
extern const u32 gUnknown_08D98B28[]; extern const u32 gPageContestMovesTilemap[];
extern const u32 gUnknown_08D9853C[]; extern const u32 gStatusScreenPalette[];
extern const u16 gUnknown_08D85620[]; extern const u16 gUnknown_08D85620[];
extern const u16 gSummaryScreenWindow_Tilemap[]; extern const u16 gSummaryScreenWindow_Tilemap[];
extern const u32 gMoveTypes_Pal[]; extern const u32 gMoveTypes_Pal[];
extern const u32 gUnknown_08D97D0C[]; extern const u32 gStatusScreenBitmap[];
extern const u16 gSummaryScreenPowAcc_Tilemap[]; extern const u16 gSummaryScreenPowAcc_Tilemap[];
extern const u16 gUnknown_08DC3C34[]; extern const u16 gUnknown_08DC3C34[];
extern const u32 gMoveTypes_Gfx[]; extern const u32 gMoveTypes_Gfx[];
extern const u32 gUnknown_08D97BEC[]; extern const u32 gMoveSelectorBitmap[];
extern const u32 gUnknown_08D97CF4[]; extern const u32 gUnknown_08D97CF4[];
extern const u32 gStatusGfx_Icons[]; extern const u32 gStatusGfx_Icons[];
extern const u32 gStatusPal_Icons[]; extern const u32 gStatusPal_Icons[];

View File

@ -431,9 +431,9 @@ extern const u8 *const gItemEffectTable[];
extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; extern const struct Evolution gEvolutionTable[][EVOS_PER_MON];
extern const u32 gExperienceTables[][MAX_LEVEL + 1]; extern const u32 gExperienceTables[][MAX_LEVEL + 1];
extern const u16 *const gLevelUpLearnsets[]; extern const u16 *const gLevelUpLearnsets[];
extern const u8 gUnknown_08329D22[]; extern const u8 gPPUpGetMask[];
extern const u8 gUnknown_08329D26[]; extern const u8 gPPUpSetMask[];
extern const u8 gUnknown_08329D2A[]; extern const u8 gPPUpAddMask[];
extern const u8 gStatStageRatios[][2]; extern const u8 gStatStageRatios[][2];
extern const u16 gUnknown_08329D54[]; extern const u16 gUnknown_08329D54[];
extern const struct SpriteTemplate gUnknown_08329D98[]; extern const struct SpriteTemplate gUnknown_08329D98[];
@ -583,7 +583,7 @@ const u8 *GetTrainerPartnerName(void);
void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3);
void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneFrame); void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneFrame);
void sub_806EE98(void); void StopPokemonAnimationDelayTask(void);
void BattleAnimateBackSprite(struct Sprite* sprite, u16 species); void BattleAnimateBackSprite(struct Sprite* sprite, u16 species);
u8 sub_806EF08(u8 arg0); u8 sub_806EF08(u8 arg0);
u8 sub_806EF84(u8 arg0, u8 arg1); u8 sub_806EF84(u8 arg0, u8 arg1);

View File

@ -1,7 +1,7 @@
#ifndef GUARD_POKEMON_SUMMARY_SCREEN_H #ifndef GUARD_POKEMON_SUMMARY_SCREEN_H
#define GUARD_POKEMON_SUMMARY_SCREEN_H #define GUARD_POKEMON_SUMMARY_SCREEN_H
extern u8 gUnknown_0203CF20; extern u8 gLastViewedMonIndex;
void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void)); void ShowPokemonSummaryScreen(u8 mode, void *mons, u8 monIndex, u8 maxMonIndex, void (*callback)(void));
void sub_81C4F98(u8, void(*)(void)); void sub_81C4F98(u8, void(*)(void));

View File

@ -1183,7 +1183,7 @@ static void CB2_InitSelectScreen(void)
break; break;
case 5: case 5:
if (sFactorySelectScreen->fromSummaryScreen == TRUE) if (sFactorySelectScreen->fromSummaryScreen == TRUE)
sFactorySelectScreen->cursorPos = gUnknown_0203CF20; sFactorySelectScreen->cursorPos = gLastViewedMonIndex;
Select_InitMonsData(); Select_InitMonsData();
Select_InitAllSprites(); Select_InitAllSprites();
if (sFactorySelectScreen->fromSummaryScreen == TRUE) if (sFactorySelectScreen->fromSummaryScreen == TRUE)
@ -3172,7 +3172,7 @@ static void CB2_InitSwapScreen(void)
break; break;
case 5: case 5:
if (sFactorySwapScreen->fromSummaryScreen == TRUE) if (sFactorySwapScreen->fromSummaryScreen == TRUE)
sFactorySwapScreen->cursorPos = gUnknown_0203CF20; sFactorySwapScreen->cursorPos = gLastViewedMonIndex;
gMain.state++; gMain.state++;
break; break;
case 6: case 6:

View File

@ -1152,16 +1152,16 @@ const u32 gStatusPal_Icons[] = INCBIN_U32("graphics/interface/status_icons.gbapa
const u32 gMoveTypes_Gfx[] = INCBIN_U32("graphics/types/move_types.4bpp.lz"); const u32 gMoveTypes_Gfx[] = INCBIN_U32("graphics/types/move_types.4bpp.lz");
const u32 gMoveTypes_Pal[] = INCBIN_U32("graphics/types/move_types.gbapal.lz"); const u32 gMoveTypes_Pal[] = INCBIN_U32("graphics/types/move_types.gbapal.lz");
const u32 gUnknown_08D97BEC[] = INCBIN_U32("graphics/interface/summary_frames.4bpp.lz"); const u32 gMoveSelectorBitmap[] = INCBIN_U32("graphics/interface/summary_frames.4bpp.lz");
const u32 gUnknown_08D97CF4[] = INCBIN_U32("graphics/interface/summary_frames.gbapal.lz"); const u32 gUnknown_08D97CF4[] = INCBIN_U32("graphics/interface/summary_frames.gbapal.lz");
const u32 gUnknown_08D97D0C[] = INCBIN_U32("graphics/interface/status_screen.4bpp.lz"); const u32 gStatusScreenBitmap[] = INCBIN_U32("graphics/interface/status_screen.4bpp.lz");
const u32 gUnknown_08D9853C[] = INCBIN_U32("graphics/interface/status_screen.gbapal.lz"); const u32 gStatusScreenPalette[] = INCBIN_U32("graphics/interface/status_screen.gbapal.lz");
const u32 gUnknown_08D9862C[] = INCBIN_U32("graphics/interface/status_screen.bin.lz"); const u32 gPageInfoTilemap[] = INCBIN_U32("graphics/interface/status_screen.bin.lz");
const u32 gUnknown_08D987FC[] = INCBIN_U32("graphics/interface/status_tilemap1.bin.lz"); const u32 gPageSkillsTilemap[] = INCBIN_U32("graphics/interface/status_tilemap1.bin.lz");
const u32 gUnknown_08D9898C[] = INCBIN_U32("graphics/interface/status_tilemap2.bin.lz"); const u32 gPageBattleMovesTilemap[] = INCBIN_U32("graphics/interface/status_tilemap2.bin.lz");
const u32 gUnknown_08D98B28[] = INCBIN_U32("graphics/interface/status_tilemap3.bin.lz"); const u32 gPageContestMovesTilemap[] = INCBIN_U32("graphics/interface/status_tilemap3.bin.lz");
const u32 gUnknown_08D98CC8[] = INCBIN_U32("graphics/interface/status_tilemap0.bin.lz"); const u32 gUnknown_08D98CC8[] = INCBIN_U32("graphics/interface/status_tilemap0.bin.lz");
const u32 gBagMaleTiles[] = INCBIN_U32("graphics/misc/bag_male.4bpp.lz"); const u32 gBagMaleTiles[] = INCBIN_U32("graphics/misc/bag_male.4bpp.lz");

View File

@ -3833,7 +3833,7 @@ static void sub_81B3828(void)
static void sub_81B3894(void) static void sub_81B3894(void)
{ {
gPaletteFade.bufferTransferDisabled = TRUE; gPaletteFade.bufferTransferDisabled = TRUE;
gUnknown_0203CEC8.unk9 = gUnknown_0203CF20; gUnknown_0203CEC8.unk9 = gLastViewedMonIndex;
InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.exitCallback); InitPartyMenu(gUnknown_0203CEC8.unk8_0, 0xFF, gUnknown_0203CEC8.unkB, 1, 21, sub_81B36FC, gUnknown_0203CEC8.exitCallback);
} }
@ -7319,9 +7319,9 @@ static void sub_81B97DC(struct Pokemon *mon, u8 slotTo, u8 slotFrom)
u8 pp1 = GetMonData(mon, MON_DATA_PP1 + slotTo); u8 pp1 = GetMonData(mon, MON_DATA_PP1 + slotTo);
u8 pp0 = GetMonData(mon, MON_DATA_PP1 + slotFrom); u8 pp0 = GetMonData(mon, MON_DATA_PP1 + slotFrom);
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES); u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
u8 ppBonusMask1 = gUnknown_08329D22[slotTo]; u8 ppBonusMask1 = gPPUpGetMask[slotTo];
u8 ppBonusMove1 = (ppBonuses & ppBonusMask1) >> (slotTo * 2); u8 ppBonusMove1 = (ppBonuses & ppBonusMask1) >> (slotTo * 2);
u8 ppBonusMask2 = gUnknown_08329D22[slotFrom]; u8 ppBonusMask2 = gPPUpGetMask[slotFrom];
u8 ppBonusMove2 = (ppBonuses & ppBonusMask2) >> (slotFrom * 2); u8 ppBonusMove2 = (ppBonuses & ppBonusMask2) >> (slotFrom * 2);
ppBonuses &= ~ppBonusMask1; ppBonuses &= ~ppBonusMask1;
ppBonuses &= ~ppBonusMask2; ppBonuses &= ~ppBonusMask2;

View File

@ -2227,9 +2227,9 @@ static const u8 sMonAnimationDelayTable[] =
[SPECIES_CHIMECHO - 1] = 0x00, [SPECIES_CHIMECHO - 1] = 0x00,
}; };
const u8 gUnknown_08329D22[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up count, also PP Max values const u8 gPPUpGetMask[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up count, also PP Max values
const u8 gUnknown_08329D26[] = {0xfc, 0xf3, 0xcf, 0x3f}; // Masks for setting PP Up count const u8 gPPUpSetMask[] = {0xfc, 0xf3, 0xcf, 0x3f}; // Masks for setting PP Up count
const u8 gUnknown_08329D2A[] = {0x01, 0x04, 0x10, 0x40}; // Values added to PP Up count const u8 gPPUpAddMask[] = {0x01, 0x04, 0x10, 0x40}; // Values added to PP Up count
const u8 gStatStageRatios[][2] = const u8 gStatStageRatios[][2] =
{ {
@ -4914,19 +4914,19 @@ void GetSpeciesName(u8 *name, u16 species)
u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex) u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex)
{ {
u8 basePP = gBattleMoves[move].pp; u8 basePP = gBattleMoves[move].pp;
return basePP + ((basePP * 20 * ((gUnknown_08329D22[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100); return basePP + ((basePP * 20 * ((gPPUpGetMask[moveIndex] & ppBonuses) >> (2 * moveIndex))) / 100);
} }
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex) void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex)
{ {
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
ppBonuses &= gUnknown_08329D26[moveIndex]; ppBonuses &= gPPUpSetMask[moveIndex];
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses); SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses);
} }
void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex) void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex)
{ {
mon->ppBonuses &= gUnknown_08329D26[moveIndex]; mon->ppBonuses &= gPPUpSetMask[moveIndex];
} }
void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex) void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
@ -5169,11 +5169,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (r10 & 0x20) if (r10 & 0x20)
{ {
r10 &= ~0x20; r10 &= ~0x20;
dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gUnknown_08329D22[moveIndex]) >> (moveIndex * 2); dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
var_38 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); var_38 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (dataUnsigned <= 2 && var_38 > 4) if (dataUnsigned <= 2 && var_38 > 4)
{ {
dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gUnknown_08329D2A[moveIndex]; dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gPPUpAddMask[moveIndex];
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned); SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - var_38; dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - var_38;
@ -5429,13 +5429,13 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
var_3C++; var_3C++;
break; break;
case 4: case 4:
dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gUnknown_08329D22[moveIndex]) >> (moveIndex * 2); dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
r5 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex); r5 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
if (dataUnsigned < 3 && r5 > 4) if (dataUnsigned < 3 && r5 > 4)
{ {
dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL); dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
dataUnsigned &= gUnknown_08329D26[moveIndex]; dataUnsigned &= gPPUpSetMask[moveIndex];
dataUnsigned += gUnknown_08329D2A[moveIndex] * 3; dataUnsigned += gPPUpAddMask[moveIndex] * 3;
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned); SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - r5; dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - r5;
@ -7025,7 +7025,7 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF
} }
} }
void sub_806EE98(void) void StopPokemonAnimationDelayTask(void)
{ {
u8 delayTaskId = FindTaskIdByFunc(Task_PokemonSummaryAnimateAfterDelay); u8 delayTaskId = FindTaskIdByFunc(Task_PokemonSummaryAnimateAfterDelay);
if (delayTaskId != 0xFF) if (delayTaskId != 0xFF)

View File

@ -1218,7 +1218,7 @@ static const u16 gWallpaperPalettes_Plain[][16] =
static const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz"); static const u32 gWallpaperTiles_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.4bpp.lz");
static const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz"); static const u32 gWallpaperTilemap_Plain[] = INCBIN_U32("graphics/pokemon_storage/plain.bin.lz");
// 12×18 tilemap // 12<EFBFBD>18 tilemap
static const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin"); static const u32 gUnknown_085773C4[] = INCBIN_U32("graphics/unused/tilemap_5773C4.bin");
static const u16 gUnknown_08577574[][2] = static const u16 gUnknown_08577574[][2] =
@ -6654,7 +6654,7 @@ static void sub_80CE8E4(void)
if (sIsMonBeingMoved) if (sIsMonBeingMoved)
sub_80CE790(); sub_80CE790();
else else
sBoxCursorPosition = gUnknown_0203CF20; sBoxCursorPosition = gLastViewedMonIndex;
} }
s16 CompactPartySlots(void) s16 CompactPartySlots(void)

File diff suppressed because it is too large Load Diff

View File

@ -1834,9 +1834,9 @@ static void sub_8077B74(void)
} }
if (gUnknown_0203229C->tradeMenuCursorPosition < PARTY_SIZE) if (gUnknown_0203229C->tradeMenuCursorPosition < PARTY_SIZE)
gUnknown_0203229C->tradeMenuCursorPosition = gUnknown_0203CF20; gUnknown_0203229C->tradeMenuCursorPosition = gLastViewedMonIndex;
else else
gUnknown_0203229C->tradeMenuCursorPosition = gUnknown_0203CF20 + PARTY_SIZE; gUnknown_0203229C->tradeMenuCursorPosition = gLastViewedMonIndex + PARTY_SIZE;
gUnknown_0203229C->tradeMenuCursorSpriteIdx = CreateSprite(&gSpriteTemplate_832DC94, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][0] * 8 + 32, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][1] * 8, 2); gUnknown_0203229C->tradeMenuCursorSpriteIdx = CreateSprite(&gSpriteTemplate_832DC94, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][0] * 8 + 32, gTradeMonSpriteCoords[gUnknown_0203229C->tradeMenuCursorPosition][1] * 8, 2);
gMain.state = 16; gMain.state = 16;