summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSlawter666 <38655737+Slawter666@users.noreply.github.com>2018-09-02 13:47:12 +0100
committerSlawter666 <38655737+Slawter666@users.noreply.github.com>2018-09-02 13:47:12 +0100
commitef4695a72cb89eb18f31057fd86a9e00091ebf20 (patch)
tree92e7e33c52ab3d0c11c3892138d2cf19ff8859b7 /src
parent4418189d4cf94bd5f837611da2dcb6147709d653 (diff)
Minor labelling
Diffstat (limited to 'src')
-rw-r--r--src/pokemon_summary_screen.c393
1 files changed, 326 insertions, 67 deletions
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index 9648747e7..2c59cb57b 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -172,7 +172,7 @@ static void sub_81C2074(u16 a, s16 b);
static void sub_81C20F0(u8 taskId);
static void sub_81C2194(u16 *a, u16 b, u8 c);
static void sub_81C2228(struct Pokemon* mon);
-static void sub_81C22CC(struct Pokemon* mon);
+static void DrawExperienceProgressBar(struct Pokemon* mon);
static void sub_81C240C(u16 a);
static void sub_81C2524(void);
static void sub_81C2554(void);
@@ -313,48 +313,304 @@ static const struct UnkStruct_61CC04 gUnknown_0861CC10 =
static const s8 gUnknown_0861CC1C[] = {0, 2, 3, 1, 4, 5};
static const struct WindowTemplate gUnknown_0861CC24[] =
{
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0001 },
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0017 },
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x002d },
- { 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0043 },
- { 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0059 },
- { 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0069 },
- { 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0079 },
- { 0x00, 0x0b, 0x04, 0x00, 0x02, 0x06, 0x0089 },
- { 0x00, 0x0b, 0x04, 0x12, 0x02, 0x06, 0x0089 },
- { 0x00, 0x0b, 0x06, 0x12, 0x02, 0x06, 0x00ad },
- { 0x00, 0x0a, 0x07, 0x06, 0x06, 0x06, 0x00d1 },
- { 0x00, 0x16, 0x07, 0x05, 0x06, 0x06, 0x00f5 },
- { 0x00, 0x0a, 0x0e, 0x0b, 0x04, 0x06, 0x0113 },
- { 0x00, 0x00, 0x12, 0x06, 0x02, 0x06, 0x013f },
- { 0x00, 0x01, 0x0f, 0x09, 0x04, 0x06, 0x014b },
- { 0x00, 0x01, 0x0f, 0x05, 0x04, 0x06, 0x016f },
- { 0x00, 0x16, 0x04, 0x00, 0x02, 0x06, 0x0183 },
- { 0x00, 0x01, 0x02, 0x04, 0x02, 0x07, 0x0183 },
- { 0x00, 0x01, 0x0c, 0x09, 0x02, 0x06, 0x018b },
- { 0x00, 0x01, 0x0e, 0x09, 0x04, 0x06, 0x019d },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 1,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 23,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 45,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 0,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 67,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 0,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 89,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 0,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 105,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 0,
+ .width = 8,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 121,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 4,
+ .width = 0,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 137,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 4,
+ .width = 18,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 137,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 6,
+ .width = 18,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 173,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 7,
+ .width = 6,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 209,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 7,
+ .width = 5,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 245,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 14,
+ .width = 11,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 275,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 0,
+ .tilemapTop = 18,
+ .width = 6,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 319,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 15,
+ .width = 9,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 331,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 15,
+ .width = 5,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 367,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 4,
+ .width = 0,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 387,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 2,
+ .width = 4,
+ .height = 2,
+ .paletteNum = 7,
+ .baseBlock = 387,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 12,
+ .width = 9,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 395,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 1,
+ .tilemapTop = 14,
+ .width = 9,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 413,
+ },
DUMMY_WIN_TEMPLATE
};
static const struct WindowTemplate gUnknown_0861CCCC[] =
{
- { 0x00, 0x0b, 0x04, 0x0b, 0x02, 0x06, 0x01c1 },
- { 0x00, 0x16, 0x04, 0x07, 0x02, 0x06, 0x01d7 },
- { 0x00, 0x0b, 0x09, 0x12, 0x04, 0x06, 0x01e5 },
- { 0x00, 0x0b, 0x0e, 0x12, 0x06, 0x06, 0x022d },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 4,
+ .width = 11,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 449,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 22,
+ .tilemapTop = 4,
+ .width = 7,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 471,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 9,
+ .width = 18,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 485,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 11,
+ .tilemapTop = 14,
+ .width = 18,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 557,
+ },
};
static const struct WindowTemplate gUnknown_0861CCEC[] =
{
- { 0x00, 0x0a, 0x04, 0x0a, 0x02, 0x06, 0x01c1 },
- { 0x00, 0x14, 0x04, 0x0a, 0x02, 0x06, 0x01d5 },
- { 0x00, 0x10, 0x07, 0x06, 0x06, 0x06, 0x01e9 },
- { 0x00, 0x1b, 0x07, 0x03, 0x06, 0x06, 0x020d },
- { 0x00, 0x18, 0x0e, 0x06, 0x04, 0x06, 0x021f },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 4,
+ .width = 10,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 449,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 20,
+ .tilemapTop = 4,
+ .width = 10,
+ .height = 2,
+ .paletteNum = 6,
+ .baseBlock = 469,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 16,
+ .tilemapTop = 7,
+ .width = 6,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 489,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 27,
+ .tilemapTop = 7,
+ .width = 3,
+ .height = 6,
+ .paletteNum = 6,
+ .baseBlock = 525,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 24,
+ .tilemapTop = 14,
+ .width = 6,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 543,
+ },
};
static const struct WindowTemplate gUnknown_0861CD14[] =
{
- { 0x00, 0x0f, 0x04, 0x09, 0x0a, 0x06, 0x01c1 },
- { 0x00, 0x18, 0x04, 0x06, 0x0a, 0x08, 0x021b },
- { 0x00, 0x0a, 0x0f, 0x14, 0x04, 0x06, 0x0257 },
+ {
+ .priority = 0,
+ .tilemapLeft = 15,
+ .tilemapTop = 4,
+ .width = 9,
+ .height = 10,
+ .paletteNum = 6,
+ .baseBlock = 449,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 24,
+ .tilemapTop = 4,
+ .width = 6,
+ .height = 10,
+ .paletteNum = 8,
+ .baseBlock = 539,
+ },
+ {
+ .priority = 0,
+ .tilemapLeft = 10,
+ .tilemapTop = 15,
+ .width = 20,
+ .height = 4,
+ .paletteNum = 6,
+ .baseBlock = 599,
+ },
};
static const u8 sTextColors_861CD2C[][3] =
{
@@ -661,7 +917,7 @@ static const struct SpriteTemplate gUnknown_0861D084 =
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
};
-static const struct OamData gOamData_861D09C =
+static const struct OamData sOamData_StatusCondition =
{
.y = 0,
.affineMode = 0,
@@ -677,42 +933,42 @@ static const struct OamData gOamData_861D09C =
.paletteNum = 0,
.affineParam = 0,
};
-static const union AnimCmd gSpriteAnim_861D0A4[] = {
+static const union AnimCmd sSpriteAnim_StatusPoison[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0AC[] = {
+static const union AnimCmd sSpriteAnim_StatusParalyzed[] = {
ANIMCMD_FRAME(4, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0B4[] = {
+static const union AnimCmd sSpriteAnim_StatusSleep[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0BC[] = {
+static const union AnimCmd sSpriteAnim_StatusFrozen[] = {
ANIMCMD_FRAME(12, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0C4[] = {
+static const union AnimCmd sSpriteAnim_StatusBurn[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0CC[] = {
+static const union AnimCmd sSpriteAnim_StatusPokerus[] = {
ANIMCMD_FRAME(20, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd gSpriteAnim_861D0D4[] = {
+static const union AnimCmd sSpriteAnim_StatusFaint[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END
};
-static const union AnimCmd *const gSpriteAnimTable_861D0DC[] = {
- gSpriteAnim_861D0A4,
- gSpriteAnim_861D0AC,
- gSpriteAnim_861D0B4,
- gSpriteAnim_861D0BC,
- gSpriteAnim_861D0C4,
- gSpriteAnim_861D0CC,
- gSpriteAnim_861D0D4,
+static const union AnimCmd *const sSpriteAnimTable_StatusCondition[] = {
+ sSpriteAnim_StatusPoison,
+ sSpriteAnim_StatusParalyzed,
+ sSpriteAnim_StatusSleep,
+ sSpriteAnim_StatusFrozen,
+ sSpriteAnim_StatusBurn,
+ sSpriteAnim_StatusPokerus,
+ sSpriteAnim_StatusFaint,
};
static const struct CompressedSpriteSheet gUnknown_0861D0F8 =
{
@@ -725,12 +981,12 @@ static const struct CompressedSpritePalette gUnknown_0861D100 =
.data = gStatusPal_Icons,
.tag = 30001
};
-static const struct SpriteTemplate gUnknown_0861D108 =
+static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
{
.tileTag = 30001,
.paletteTag = 30001,
- .oam = &gOamData_861D09C,
- .anims = gSpriteAnimTable_861D0DC,
+ .oam = &sOamData_StatusCondition,
+ .anims = sSpriteAnimTable_StatusCondition,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy
@@ -1521,7 +1777,7 @@ static void sub_81C0D44(u8 taskId)
static void sub_81C0E24(void)
{
if (pssData->currPageIndex == 1)
- sub_81C22CC(&pssData->currentMon);
+ DrawExperienceProgressBar(&pssData->currentMon);
}
static void sub_81C0E48(u8 taskId)
@@ -2270,37 +2526,40 @@ static void sub_81C228C(bool8 isMonShiny)
schedule_bg_copy_tilemap_to_vram(3);
}
-static void sub_81C22CC(struct Pokemon *unused)
+static void DrawExperienceProgressBar(struct Pokemon *unused)
{
- s64 r6r7;
+ s64 numExpProgressBarTicks;
struct PokeSummary *summary = &pssData->summary;
u16 *r9;
u8 i;
if (summary->level < MAX_MON_LEVEL)
{
- u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
- u32 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
+ u32 expBetweenLevels = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
+ u32 expSinceLastLevel = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
- r6r7 = r4 * 64 / r1;
- if (r6r7 == 0 && r4 != 0)
- r6r7 = 1;
+ // Calculate the number of 1-pixel "ticks" to illuminate in the experience progress bar.
+ // There are 8 tiles that make up the bar, and each tile has 8 "ticks". Hence, the numerator
+ // is multiplied by 64.
+ numExpProgressBarTicks = expSinceLastLevel * 64 / expBetweenLevels;
+ if (numExpProgressBarTicks == 0 && expSinceLastLevel != 0)
+ numExpProgressBarTicks = 1;
}
else
{
- r6r7 = 0;
+ numExpProgressBarTicks = 0;
}
r9 = &pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255];
for (i = 0; i < 8; i++)
{
- if (r6r7 > 7)
+ if (numExpProgressBarTicks > 7)
r9[i] = 0x206A;
else
- r9[i] = 0x2062 + (r6r7 % 8);
- r6r7 -= 8;
- if (r6r7 < 0)
- r6r7 = 0;
+ r9[i] = 0x2062 + (numExpProgressBarTicks % 8);
+ numExpProgressBarTicks -= 8;
+ if (numExpProgressBarTicks < 0)
+ numExpProgressBarTicks = 0;
}
if (GetBgTilemapBuffer(1) == pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0])
@@ -3735,7 +3994,7 @@ static void CreateSetStatusSprite(void)
if (*spriteId == 0xFF)
{
- *spriteId = CreateSprite(&gUnknown_0861D108, 64, 152, 0);
+ *spriteId = CreateSprite(&sSpriteTemplate_StatusCondition, 64, 152, 0);
}
anim = sub_81B205C(&pssData->currentMon);