From ce949ba70575c2aebac64a04153529875f9b9758 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 1 Sep 2018 18:31:53 +0200 Subject: [PATCH] document move type variables in pss --- include/contest.h | 1 + src/pokemon_summary_screen.c | 195 ++++++++++++++++++++--------------- 2 files changed, 113 insertions(+), 83 deletions(-) diff --git a/include/contest.h b/include/contest.h index 33080225b..0a8fa4436 100644 --- a/include/contest.h +++ b/include/contest.h @@ -8,6 +8,7 @@ enum CONTEST_CATEGORY_CUTE, CONTEST_CATEGORY_SMART, CONTEST_CATEGORY_TOUGH, + CONTEST_CATEGORIES_COUNT, }; enum diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 1afbaab7a..9648747e7 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -393,7 +393,10 @@ static const u8 gUnknown_0861CE7B[] = _("{COLOR WHITE}{SHADOW DARK_GREY}"); static const u8 gUnknown_0861CE82[] = _("{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}\n{SPECIAL_F7 0x03}"); static const u8 gUnknown_0861CE8E[] = _("{SPECIAL_F7 0x00}\n{SPECIAL_F7 0x01}\n{SPECIAL_F7 0x02}"); static const u8 gUnknown_0861CE97[] = _("{PP}{SPECIAL_F7 0x00}/{SPECIAL_F7 0x01}"); -static const struct OamData gOamData_861CEA0 = + +#define TAG_MOVE_TYPES 30002 + +static const struct OamData sOamData_MoveTypes = { .y = 0, .affineMode = 0, @@ -409,140 +412,166 @@ static const struct OamData gOamData_861CEA0 = .paletteNum = 0, .affineParam = 0, }; -static const union AnimCmd gSpriteAnim_861CEA8[] = { - ANIMCMD_FRAME(0, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeNormal[] = { + ANIMCMD_FRAME(TYPE_NORMAL * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEB0[] = { - ANIMCMD_FRAME(8, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeFighting[] = { + ANIMCMD_FRAME(TYPE_FIGHTING * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEB8[] = { - ANIMCMD_FRAME(16, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeFlying[] = { + ANIMCMD_FRAME(TYPE_FLYING * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEC0[] = { - ANIMCMD_FRAME(24, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypePoison[] = { + ANIMCMD_FRAME(TYPE_POISON * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEC8[] = { - ANIMCMD_FRAME(32, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeGround[] = { + ANIMCMD_FRAME(TYPE_GROUND * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CED0[] = { - ANIMCMD_FRAME(40, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeRock[] = { + ANIMCMD_FRAME(TYPE_ROCK * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CED8[] = { - ANIMCMD_FRAME(48, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeBug[] = { + ANIMCMD_FRAME(TYPE_BUG * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEE0[] = { - ANIMCMD_FRAME(56, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeGhost[] = { + ANIMCMD_FRAME(TYPE_GHOST * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEE8[] = { - ANIMCMD_FRAME(64, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeSteel[] = { + ANIMCMD_FRAME(TYPE_STEEL * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEF0[] = { - ANIMCMD_FRAME(72, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeMystery[] = { + ANIMCMD_FRAME(TYPE_MYSTERY * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CEF8[] = { - ANIMCMD_FRAME(80, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeFire[] = { + ANIMCMD_FRAME(TYPE_FIRE * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF00[] = { - ANIMCMD_FRAME(88, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeWater[] = { + ANIMCMD_FRAME(TYPE_WATER * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF08[] = { - ANIMCMD_FRAME(96, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeGrass[] = { + ANIMCMD_FRAME(TYPE_GRASS * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF10[] = { - ANIMCMD_FRAME(104, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeElectric[] = { + ANIMCMD_FRAME(TYPE_ELECTRIC * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF18[] = { - ANIMCMD_FRAME(112, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypePsychic[] = { + ANIMCMD_FRAME(TYPE_PSYCHIC * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF20[] = { - ANIMCMD_FRAME(120, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeIce[] = { + ANIMCMD_FRAME(TYPE_ICE * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF28[] = { - ANIMCMD_FRAME(128, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeDragon[] = { + ANIMCMD_FRAME(TYPE_DRAGON * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF30[] = { - ANIMCMD_FRAME(136, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_TypeDark[] = { + ANIMCMD_FRAME(TYPE_DARK * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF38[] = { - ANIMCMD_FRAME(144, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_CategoryCool[] = { + ANIMCMD_FRAME((CONTEST_CATEGORY_COOL + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF40[] = { - ANIMCMD_FRAME(152, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_CategoryBeauty[] = { + ANIMCMD_FRAME((CONTEST_CATEGORY_BEAUTY + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF48[] = { - ANIMCMD_FRAME(160, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_CategoryCute[] = { + ANIMCMD_FRAME((CONTEST_CATEGORY_CUTE + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF50[] = { - ANIMCMD_FRAME(168, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_CategorySmart[] = { + ANIMCMD_FRAME((CONTEST_CATEGORY_SMART + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd gSpriteAnim_861CF58[] = { - ANIMCMD_FRAME(176, 0, FALSE, FALSE), +static const union AnimCmd sSpriteAnim_CategoryTough[] = { + ANIMCMD_FRAME((CONTEST_CATEGORY_TOUGH + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE), ANIMCMD_END }; -static const union AnimCmd *const gSpriteAnimTable_861CF60[] = { - gSpriteAnim_861CEA8, - gSpriteAnim_861CEB0, - gSpriteAnim_861CEB8, - gSpriteAnim_861CEC0, - gSpriteAnim_861CEC8, - gSpriteAnim_861CED0, - gSpriteAnim_861CED8, - gSpriteAnim_861CEE0, - gSpriteAnim_861CEE8, - gSpriteAnim_861CEF0, - gSpriteAnim_861CEF8, - gSpriteAnim_861CF00, - gSpriteAnim_861CF08, - gSpriteAnim_861CF10, - gSpriteAnim_861CF18, - gSpriteAnim_861CF20, - gSpriteAnim_861CF28, - gSpriteAnim_861CF30, - gSpriteAnim_861CF38, - gSpriteAnim_861CF40, - gSpriteAnim_861CF48, - gSpriteAnim_861CF50, - gSpriteAnim_861CF58, +static const union AnimCmd *const sSpriteAnimTable_MoveTypes[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = { + sSpriteAnim_TypeNormal, + sSpriteAnim_TypeFighting, + sSpriteAnim_TypeFlying, + sSpriteAnim_TypePoison, + sSpriteAnim_TypeGround, + sSpriteAnim_TypeRock, + sSpriteAnim_TypeBug, + sSpriteAnim_TypeGhost, + sSpriteAnim_TypeSteel, + sSpriteAnim_TypeMystery, + sSpriteAnim_TypeFire, + sSpriteAnim_TypeWater, + sSpriteAnim_TypeGrass, + sSpriteAnim_TypeElectric, + sSpriteAnim_TypePsychic, + sSpriteAnim_TypeIce, + sSpriteAnim_TypeDragon, + sSpriteAnim_TypeDark, + sSpriteAnim_CategoryCool, + sSpriteAnim_CategoryBeauty, + sSpriteAnim_CategoryCute, + sSpriteAnim_CategorySmart, + sSpriteAnim_CategoryTough, }; -static const struct CompressedSpriteSheet gUnknown_0861CFBC = + +static const struct CompressedSpriteSheet sSpriteSheet_MoveTypes = { .data = gMoveTypes_Gfx, - .size = 0x1700, - .tag = 30002 + .size = (NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT) * 0x100, + .tag = TAG_MOVE_TYPES }; -static const struct SpriteTemplate gUnknown_0861CFC4 = +static const struct SpriteTemplate sSpriteTemplate_MoveTypes = { - .tileTag = 30002, - .paletteTag = 30002, - .oam = &gOamData_861CEA0, - .anims = gSpriteAnimTable_861CF60, + .tileTag = TAG_MOVE_TYPES, + .paletteTag = TAG_MOVE_TYPES, + .oam = &sOamData_MoveTypes, + .anims = sSpriteAnimTable_MoveTypes, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, .callback = SpriteCallbackDummy }; -static const u8 gUnknown_0861CFDC[] = {13, 13, 14, 14, 13, 13, 15, 14, 13, 15, 13, 14, 15, 13, 14, 14, 15, 13, 13, 14, 14, 15, 13}; +static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = +{ + [TYPE_NORMAL] = 13, + [TYPE_FIGHTING] = 13, + [TYPE_FLYING] = 14, + [TYPE_POISON] = 14, + [TYPE_GROUND] = 13, + [TYPE_ROCK] = 13, + [TYPE_BUG] = 15, + [TYPE_GHOST] = 14, + [TYPE_STEEL] = 13, + [TYPE_MYSTERY] = 15, + [TYPE_FIRE] = 13, + [TYPE_WATER] = 14, + [TYPE_GRASS] = 15, + [TYPE_ELECTRIC] = 13, + [TYPE_PSYCHIC] = 14, + [TYPE_ICE] = 14, + [TYPE_DRAGON] = 15, + [TYPE_DARK] = 13, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = 13, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = 14, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = 14, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = 15, + [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = 13, +}; static const struct OamData gOamData_861CFF4 = { .y = 0, @@ -968,7 +997,7 @@ static bool8 SummaryScreen_DecompressGraphics(void) pssData->unk40F0++; break; case 7: - LoadCompressedObjectPic(&gUnknown_0861CFBC); + LoadCompressedObjectPic(&sSpriteSheet_MoveTypes); pssData->unk40F0++; break; case 8: @@ -3415,7 +3444,7 @@ static void sub_81C42C8(void) for (i = 3; i < 8; i++) { if (pssData->spriteIds[i] == 0xFF) - pssData->spriteIds[i] = CreateSprite(&gUnknown_0861CFC4, 0, 0, 2); + pssData->spriteIds[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 0, 0, 2); sub_81C4204(i, TRUE); } @@ -3425,7 +3454,7 @@ static void SetMoveTypeSpritePosAndType(u8 typeId, u8 x, u8 y, u8 spriteArrayId) { struct Sprite *sprite = &gSprites[pssData->spriteIds[spriteArrayId]]; StartSpriteAnim(sprite, typeId); - sprite->oam.paletteNum = gUnknown_0861CFDC[typeId]; + sprite->oam.paletteNum = sMoveTypeToOamPaletteNum[typeId]; sprite->pos1.x = x + 16; sprite->pos1.y = y + 8; sub_81C4204(spriteArrayId, FALSE);