Minor labelling

This commit is contained in:
Slawter666
2018-09-02 13:47:12 +01:00
parent 4418189d4c
commit ef4695a72c
+326 -67
View File
@@ -172,7 +172,7 @@ static void sub_81C2074(u16 a, s16 b);
static void sub_81C20F0(u8 taskId); static void sub_81C20F0(u8 taskId);
static void sub_81C2194(u16 *a, u16 b, u8 c); static void sub_81C2194(u16 *a, u16 b, u8 c);
static void sub_81C2228(struct Pokemon* mon); 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_81C240C(u16 a);
static void sub_81C2524(void); static void sub_81C2524(void);
static void sub_81C2554(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 s8 gUnknown_0861CC1C[] = {0, 2, 3, 1, 4, 5};
static const struct WindowTemplate gUnknown_0861CC24[] = static const struct WindowTemplate gUnknown_0861CC24[] =
{ {
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0001 }, {
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0017 }, .priority = 0,
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x002d }, .tilemapLeft = 0,
{ 0x00, 0x00, 0x00, 0x0b, 0x02, 0x06, 0x0043 }, .tilemapTop = 0,
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0059 }, .width = 11,
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0069 }, .height = 2,
{ 0x00, 0x16, 0x00, 0x08, 0x02, 0x07, 0x0079 }, .paletteNum = 6,
{ 0x00, 0x0b, 0x04, 0x00, 0x02, 0x06, 0x0089 }, .baseBlock = 1,
{ 0x00, 0x0b, 0x04, 0x12, 0x02, 0x06, 0x0089 }, },
{ 0x00, 0x0b, 0x06, 0x12, 0x02, 0x06, 0x00ad }, {
{ 0x00, 0x0a, 0x07, 0x06, 0x06, 0x06, 0x00d1 }, .priority = 0,
{ 0x00, 0x16, 0x07, 0x05, 0x06, 0x06, 0x00f5 }, .tilemapLeft = 0,
{ 0x00, 0x0a, 0x0e, 0x0b, 0x04, 0x06, 0x0113 }, .tilemapTop = 0,
{ 0x00, 0x00, 0x12, 0x06, 0x02, 0x06, 0x013f }, .width = 11,
{ 0x00, 0x01, 0x0f, 0x09, 0x04, 0x06, 0x014b }, .height = 2,
{ 0x00, 0x01, 0x0f, 0x05, 0x04, 0x06, 0x016f }, .paletteNum = 6,
{ 0x00, 0x16, 0x04, 0x00, 0x02, 0x06, 0x0183 }, .baseBlock = 23,
{ 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 = 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 DUMMY_WIN_TEMPLATE
}; };
static const struct WindowTemplate gUnknown_0861CCCC[] = static const struct WindowTemplate gUnknown_0861CCCC[] =
{ {
{ 0x00, 0x0b, 0x04, 0x0b, 0x02, 0x06, 0x01c1 }, {
{ 0x00, 0x16, 0x04, 0x07, 0x02, 0x06, 0x01d7 }, .priority = 0,
{ 0x00, 0x0b, 0x09, 0x12, 0x04, 0x06, 0x01e5 }, .tilemapLeft = 11,
{ 0x00, 0x0b, 0x0e, 0x12, 0x06, 0x06, 0x022d }, .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[] = static const struct WindowTemplate gUnknown_0861CCEC[] =
{ {
{ 0x00, 0x0a, 0x04, 0x0a, 0x02, 0x06, 0x01c1 }, {
{ 0x00, 0x14, 0x04, 0x0a, 0x02, 0x06, 0x01d5 }, .priority = 0,
{ 0x00, 0x10, 0x07, 0x06, 0x06, 0x06, 0x01e9 }, .tilemapLeft = 10,
{ 0x00, 0x1b, 0x07, 0x03, 0x06, 0x06, 0x020d }, .tilemapTop = 4,
{ 0x00, 0x18, 0x0e, 0x06, 0x04, 0x06, 0x021f }, .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[] = static const struct WindowTemplate gUnknown_0861CD14[] =
{ {
{ 0x00, 0x0f, 0x04, 0x09, 0x0a, 0x06, 0x01c1 }, {
{ 0x00, 0x18, 0x04, 0x06, 0x0a, 0x08, 0x021b }, .priority = 0,
{ 0x00, 0x0a, 0x0f, 0x14, 0x04, 0x06, 0x0257 }, .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] = static const u8 sTextColors_861CD2C[][3] =
{ {
@@ -661,7 +917,7 @@ static const struct SpriteTemplate gUnknown_0861D084 =
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
static const struct OamData gOamData_861D09C = static const struct OamData sOamData_StatusCondition =
{ {
.y = 0, .y = 0,
.affineMode = 0, .affineMode = 0,
@@ -677,42 +933,42 @@ static const struct OamData gOamData_861D09C =
.paletteNum = 0, .paletteNum = 0,
.affineParam = 0, .affineParam = 0,
}; };
static const union AnimCmd gSpriteAnim_861D0A4[] = { static const union AnimCmd sSpriteAnim_StatusPoison[] = {
ANIMCMD_FRAME(0, 0, FALSE, FALSE), ANIMCMD_FRAME(0, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0AC[] = { static const union AnimCmd sSpriteAnim_StatusParalyzed[] = {
ANIMCMD_FRAME(4, 0, FALSE, FALSE), ANIMCMD_FRAME(4, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0B4[] = { static const union AnimCmd sSpriteAnim_StatusSleep[] = {
ANIMCMD_FRAME(8, 0, FALSE, FALSE), ANIMCMD_FRAME(8, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0BC[] = { static const union AnimCmd sSpriteAnim_StatusFrozen[] = {
ANIMCMD_FRAME(12, 0, FALSE, FALSE), ANIMCMD_FRAME(12, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0C4[] = { static const union AnimCmd sSpriteAnim_StatusBurn[] = {
ANIMCMD_FRAME(16, 0, FALSE, FALSE), ANIMCMD_FRAME(16, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0CC[] = { static const union AnimCmd sSpriteAnim_StatusPokerus[] = {
ANIMCMD_FRAME(20, 0, FALSE, FALSE), ANIMCMD_FRAME(20, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd gSpriteAnim_861D0D4[] = { static const union AnimCmd sSpriteAnim_StatusFaint[] = {
ANIMCMD_FRAME(24, 0, FALSE, FALSE), ANIMCMD_FRAME(24, 0, FALSE, FALSE),
ANIMCMD_END ANIMCMD_END
}; };
static const union AnimCmd *const gSpriteAnimTable_861D0DC[] = { static const union AnimCmd *const sSpriteAnimTable_StatusCondition[] = {
gSpriteAnim_861D0A4, sSpriteAnim_StatusPoison,
gSpriteAnim_861D0AC, sSpriteAnim_StatusParalyzed,
gSpriteAnim_861D0B4, sSpriteAnim_StatusSleep,
gSpriteAnim_861D0BC, sSpriteAnim_StatusFrozen,
gSpriteAnim_861D0C4, sSpriteAnim_StatusBurn,
gSpriteAnim_861D0CC, sSpriteAnim_StatusPokerus,
gSpriteAnim_861D0D4, sSpriteAnim_StatusFaint,
}; };
static const struct CompressedSpriteSheet gUnknown_0861D0F8 = static const struct CompressedSpriteSheet gUnknown_0861D0F8 =
{ {
@@ -725,12 +981,12 @@ static const struct CompressedSpritePalette gUnknown_0861D100 =
.data = gStatusPal_Icons, .data = gStatusPal_Icons,
.tag = 30001 .tag = 30001
}; };
static const struct SpriteTemplate gUnknown_0861D108 = static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
{ {
.tileTag = 30001, .tileTag = 30001,
.paletteTag = 30001, .paletteTag = 30001,
.oam = &gOamData_861D09C, .oam = &sOamData_StatusCondition,
.anims = gSpriteAnimTable_861D0DC, .anims = sSpriteAnimTable_StatusCondition,
.images = NULL, .images = NULL,
.affineAnims = gDummySpriteAffineAnimTable, .affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
@@ -1521,7 +1777,7 @@ static void sub_81C0D44(u8 taskId)
static void sub_81C0E24(void) static void sub_81C0E24(void)
{ {
if (pssData->currPageIndex == 1) if (pssData->currPageIndex == 1)
sub_81C22CC(&pssData->currentMon); DrawExperienceProgressBar(&pssData->currentMon);
} }
static void sub_81C0E48(u8 taskId) static void sub_81C0E48(u8 taskId)
@@ -2270,37 +2526,40 @@ static void sub_81C228C(bool8 isMonShiny)
schedule_bg_copy_tilemap_to_vram(3); 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; struct PokeSummary *summary = &pssData->summary;
u16 *r9; u16 *r9;
u8 i; u8 i;
if (summary->level < MAX_MON_LEVEL) if (summary->level < MAX_MON_LEVEL)
{ {
u32 r1 = gExperienceTables[gBaseStats[summary->species].growthRate][summary->level + 1] - 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 r4 = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level]; u32 expSinceLastLevel = summary->exp - gExperienceTables[gBaseStats[summary->species].growthRate][summary->level];
r6r7 = r4 * 64 / r1; // Calculate the number of 1-pixel "ticks" to illuminate in the experience progress bar.
if (r6r7 == 0 && r4 != 0) // There are 8 tiles that make up the bar, and each tile has 8 "ticks". Hence, the numerator
r6r7 = 1; // is multiplied by 64.
numExpProgressBarTicks = expSinceLastLevel * 64 / expBetweenLevels;
if (numExpProgressBarTicks == 0 && expSinceLastLevel != 0)
numExpProgressBarTicks = 1;
} }
else else
{ {
r6r7 = 0; numExpProgressBarTicks = 0;
} }
r9 = &pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255]; r9 = &pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][1][0x255];
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
if (r6r7 > 7) if (numExpProgressBarTicks > 7)
r9[i] = 0x206A; r9[i] = 0x206A;
else else
r9[i] = 0x2062 + (r6r7 % 8); r9[i] = 0x2062 + (numExpProgressBarTicks % 8);
r6r7 -= 8; numExpProgressBarTicks -= 8;
if (r6r7 < 0) if (numExpProgressBarTicks < 0)
r6r7 = 0; numExpProgressBarTicks = 0;
} }
if (GetBgTilemapBuffer(1) == pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0]) if (GetBgTilemapBuffer(1) == pssData->bgTilemapBuffers[PSS_PAGE_SKILLS][0])
@@ -3735,7 +3994,7 @@ static void CreateSetStatusSprite(void)
if (*spriteId == 0xFF) if (*spriteId == 0xFF)
{ {
*spriteId = CreateSprite(&gUnknown_0861D108, 64, 152, 0); *spriteId = CreateSprite(&sSpriteTemplate_StatusCondition, 64, 152, 0);
} }
anim = sub_81B205C(&pssData->currentMon); anim = sub_81B205C(&pssData->currentMon);