diff --git a/include/constants/species.h b/include/constants/species.h index 3bc20725c..65d64f632 100644 --- a/include/constants/species.h +++ b/include/constants/species.h @@ -865,6 +865,36 @@ #define NUM_SPECIES SPECIES_EGG +// Unown forms, not actual species +#define SPECIES_UNOWN_A NUM_SPECIES + 1 +#define SPECIES_UNOWN_B NUM_SPECIES + 2 +#define SPECIES_UNOWN_C NUM_SPECIES + 3 +#define SPECIES_UNOWN_D NUM_SPECIES + 4 +#define SPECIES_UNOWN_E NUM_SPECIES + 5 +#define SPECIES_UNOWN_F NUM_SPECIES + 6 +#define SPECIES_UNOWN_G NUM_SPECIES + 7 +#define SPECIES_UNOWN_H NUM_SPECIES + 8 +#define SPECIES_UNOWN_I NUM_SPECIES + 9 +#define SPECIES_UNOWN_J NUM_SPECIES + 10 +#define SPECIES_UNOWN_K NUM_SPECIES + 11 +#define SPECIES_UNOWN_L NUM_SPECIES + 12 +#define SPECIES_UNOWN_M NUM_SPECIES + 13 +#define SPECIES_UNOWN_N NUM_SPECIES + 14 +#define SPECIES_UNOWN_O NUM_SPECIES + 15 +#define SPECIES_UNOWN_P NUM_SPECIES + 16 +#define SPECIES_UNOWN_Q NUM_SPECIES + 17 +#define SPECIES_UNOWN_R NUM_SPECIES + 18 +#define SPECIES_UNOWN_S NUM_SPECIES + 19 +#define SPECIES_UNOWN_T NUM_SPECIES + 20 +#define SPECIES_UNOWN_U NUM_SPECIES + 21 +#define SPECIES_UNOWN_V NUM_SPECIES + 22 +#define SPECIES_UNOWN_W NUM_SPECIES + 23 +#define SPECIES_UNOWN_X NUM_SPECIES + 24 +#define SPECIES_UNOWN_Y NUM_SPECIES + 25 +#define SPECIES_UNOWN_Z NUM_SPECIES + 26 +#define SPECIES_UNOWN_EMARK NUM_SPECIES + 27 +#define SPECIES_UNOWN_QMARK NUM_SPECIES + 28 + // National Dex Index Defines #define NATIONAL_DEX_NONE 0 diff --git a/include/data.h b/include/data.h index 9ed84550e..7f8158138 100644 --- a/include/data.h +++ b/include/data.h @@ -92,7 +92,6 @@ extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AnimCmd *const gUnknown_082FF70C[]; extern const struct MonCoords gMonFrontPicCoords[]; -extern const struct CompressedSpriteSheet gMonStillFrontPicTable[]; extern const struct MonCoords gMonBackPicCoords[]; extern const struct CompressedSpriteSheet gMonBackPicTable[]; extern const struct CompressedSpritePalette gMonPaletteTable[]; diff --git a/include/pokemon.h b/include/pokemon.h index c8bbd1629..ae8306d40 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -503,6 +503,7 @@ u8 GetDefaultMoveTarget(u8 battlerId); u8 GetMonGender(struct Pokemon *mon); u8 GetBoxMonGender(struct BoxPokemon *boxMon); u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality); +u32 GetUnownSpeciesId(u32 personality); void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition); void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition); void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition); diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 10db03214..78a6c0da6 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -17,13 +17,6 @@ #include "constants/battle_anim.h" #include "constants/species.h" -#define GET_UNOWN_LETTER(personality) (( \ - (((personality & 0x03000000) >> 24) << 6) \ - | (((personality & 0x00030000) >> 16) << 4) \ - | (((personality & 0x00000300) >> 8) << 2) \ - | (((personality & 0x00000003) >> 0) << 0) \ -) % 28) - #define IS_DOUBLE_BATTLE() ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) extern const struct OamData gUnknown_0852497C; @@ -177,7 +170,6 @@ u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) u8 GetBattlerYDelta(u8 battlerId, u16 species) { - u16 letter; u32 personality; struct BattleSpriteInfo *spriteInfo; u8 ret; @@ -187,7 +179,6 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) { if (species == SPECIES_UNOWN) { - /* if (IsContest()) { if (gContestResources->field_18->unk4_0) @@ -203,13 +194,8 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) else personality = gTransformedPersonalities[battlerId]; } - letter = GET_UNOWN_LETTER(personality); - if (!letter) - coordSpecies = species; - else - coordSpecies = letter + SPECIES_UNOWN_B - 1; + coordSpecies = GetUnownSpeciesId(personality); ret = gMonBackPicCoords[coordSpecies].y_offset; - */ } else if (species == SPECIES_CASTFORM) { @@ -228,19 +214,14 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) { if (species == SPECIES_UNOWN) { - /* spriteInfo = gBattleSpritesDataPtr->battlerData; if (!spriteInfo[battlerId].transformSpecies) personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY); else personality = gTransformedPersonalities[battlerId]; - letter = GET_UNOWN_LETTER(personality); - if (!letter) - coordSpecies = species; - else - coordSpecies = letter + SPECIES_UNOWN_B - 1; + + coordSpecies = GetUnownSpeciesId(personality); ret = gMonFrontPicCoords[coordSpecies].y_offset; - */ } else if (species == SPECIES_CASTFORM) { @@ -2097,8 +2078,6 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) { u16 species; u32 personality; - u16 letter; - u16 unownSpecies; int ret; const struct MonCoords *coords; struct BattleSpriteInfo *spriteInfo; @@ -2117,14 +2096,8 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) } if (species == SPECIES_UNOWN) { - /* - letter = GET_UNOWN_LETTER(personality); - if (!letter) - unownSpecies = SPECIES_UNOWN; - else - unownSpecies = letter + SPECIES_UNOWN_B - 1; - coords = &gMonBackPicCoords[unownSpecies]; - */ + species = GetUnownSpeciesId(personality); + coords = &gMonBackPicCoords[species]; } else if (species == SPECIES_CASTFORM) { @@ -2157,14 +2130,8 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) if (species == SPECIES_UNOWN) { - /* - letter = GET_UNOWN_LETTER(personality); - if (!letter) - unownSpecies = SPECIES_UNOWN; - else - unownSpecies = letter + SPECIES_UNOWN_B - 1; - coords = &gMonBackPicCoords[unownSpecies]; - */ + species = GetUnownSpeciesId(personality); + coords = &gMonBackPicCoords[species]; } else if (species > NUM_SPECIES) { @@ -2191,14 +2158,8 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) if (species == SPECIES_UNOWN) { - /* - letter = GET_UNOWN_LETTER(personality); - if (!letter) - unownSpecies = SPECIES_UNOWN; - else - unownSpecies = letter + SPECIES_UNOWN_B - 1; - coords = &gMonFrontPicCoords[unownSpecies]; - */ + species = GetUnownSpeciesId(personality); + coords = &gMonFrontPicCoords[species]; } else if (species == SPECIES_CASTFORM) { diff --git a/src/battle_main.c b/src/battle_main.c index 7e564ce7f..ab356f246 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -591,9 +591,9 @@ static const u8 sPkblToEscapeFactor[][3] = {{0, 0, 0}, {3, 5, 0}, {2, 3, 0}, {1, static const u8 sGoNearCounterToCatchFactor[] = {4, 3, 2, 1}; static const u8 sGoNearCounterToEscapeFactor[] = {4, 4, 4, 4}; -// code void CB2_InitBattle(void) { + u32 i; MoveSaveBlocks_ResetHeap(); AllocateBattleResources(); AllocateBattleSpritesData(); @@ -2728,6 +2728,7 @@ extern const struct MonCoords gCastformFrontSpriteCoords[]; void SpriteCB_FaintOpponentMon(struct Sprite *sprite) { u8 battler = sprite->sBattler; + u32 personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); u16 species; u8 yOffset; @@ -2740,16 +2741,8 @@ void SpriteCB_FaintOpponentMon(struct Sprite *sprite) if (species == SPECIES_UNOWN) { - u32 personalityValue = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); - u16 unownForm = ((((personalityValue & 0x3000000) >> 18) | ((personalityValue & 0x30000) >> 12) | ((personalityValue & 0x300) >> 6) | (personalityValue & 3)) % 0x1C); - u16 unownSpecies; - - if (unownForm == 0) - unownSpecies = SPECIES_UNOWN; // Use the A Unown form. - else - unownSpecies = NUM_SPECIES + unownForm; // Use one of the other Unown letters. - - yOffset = gMonFrontPicCoords[unownSpecies].y_offset; + species = GetUnownSpeciesId(personality); + yOffset = gMonFrontPicCoords[species].y_offset; } else if (species == SPECIES_CASTFORM) { diff --git a/src/data/pokemon_graphics/back_pic_coordinates.h b/src/data/pokemon_graphics/back_pic_coordinates.h index 69cb951db..11d60f1c0 100644 --- a/src/data/pokemon_graphics/back_pic_coordinates.h +++ b/src/data/pokemon_graphics/back_pic_coordinates.h @@ -1005,11 +1005,6 @@ const struct MonCoords gMonBackPicCoords[] = .size = 0x66, .y_offset = 0xb, }, - [SPECIES_UNOWN] = - { - .size = 0x36, - .y_offset = 0x8, - }, [SPECIES_WOBBUFFET] = { .size = 0x75, @@ -3250,4 +3245,149 @@ const struct MonCoords gMonBackPicCoords[] = .size = 0x64, .y_offset = 0x8, }, + [SPECIES_EGG] = + { + .size = 0x36, + .y_offset = 0x0a, + }, + [SPECIES_UNOWN_A] = + { + .size = 0x36, + .y_offset = 0x8, + }, + [SPECIES_UNOWN_B] = + { + .size = 0x56, + .y_offset = 0x09, + }, + [SPECIES_UNOWN_C] = + { + .size = 0x67, + .y_offset = 0x06, + }, + [SPECIES_UNOWN_D] = + { + .size = 0x56, + .y_offset = 0x08, + }, + [SPECIES_UNOWN_E] = + { + .size = 0x56, + .y_offset = 0x0a, + }, + [SPECIES_UNOWN_F] = + { + .size = 0x66, + .y_offset = 0x0a, + }, + [SPECIES_UNOWN_G] = + { + .size = 0x57, + .y_offset = 0x05, + }, + [SPECIES_UNOWN_H] = + { + .size = 0x66, + .y_offset = 0x08, + }, + [SPECIES_UNOWN_I] = + { + .size = 0x37, + .y_offset = 0x07, + }, + [SPECIES_UNOWN_J] = + { + .size = 0x46, + .y_offset = 0x09, + }, + [SPECIES_UNOWN_K] = + { + .size = 0x57, + .y_offset = 0x07, + }, + [SPECIES_UNOWN_L] = + { + .size = 0x46, + .y_offset = 0x0a, + }, + [SPECIES_UNOWN_M] = + { + .size = 0x65, + .y_offset = 0x0d, + }, + [SPECIES_UNOWN_N] = + { + .size = 0x65, + .y_offset = 0x0d, + }, + [SPECIES_UNOWN_O] = + { + .size = 0x66, + .y_offset = 0x08, + }, + [SPECIES_UNOWN_P] = + { + .size = 0x46, + .y_offset = 0x0a, + }, + [SPECIES_UNOWN_Q] = + { + .size = 0x55, + .y_offset = 0x0f, + }, + [SPECIES_UNOWN_R] = + { + .size = 0x45, + .y_offset = 0x0c, + }, + [SPECIES_UNOWN_S] = + { + .size = 0x57, + .y_offset = 0x04, + }, + [SPECIES_UNOWN_T] = + { + .size = 0x45, + .y_offset = 0x0d, + }, + [SPECIES_UNOWN_U] = + { + .size = 0x65, + .y_offset = 0x0d, + }, + [SPECIES_UNOWN_V] = + { + .size = 0x56, + .y_offset = 0x0b, + }, + [SPECIES_UNOWN_W] = + { + .size = 0x55, + .y_offset = 0x0d, + }, + [SPECIES_UNOWN_X] = + { + .size = 0x55, + .y_offset = 0x0f, + }, + [SPECIES_UNOWN_Y] = + { + .size = 0x46, + .y_offset = 0x0a, + }, + [SPECIES_UNOWN_Z] = + { + .size = 0x46, + .y_offset = 0x0a, + }, + [SPECIES_UNOWN_EMARK] = + { + .size = 0x37, + .y_offset = 0x06, + }, + [SPECIES_UNOWN_QMARK] = + { + .size = 0x47, + .y_offset = 0x06, + }, }; diff --git a/src/data/pokemon_graphics/back_pic_table.h b/src/data/pokemon_graphics/back_pic_table.h index d6f63ff93..8757ab7a3 100644 --- a/src/data/pokemon_graphics/back_pic_table.h +++ b/src/data/pokemon_graphics/back_pic_table.h @@ -809,4 +809,33 @@ const struct CompressedSpriteSheet gMonBackPicTable[] = SPECIES_SPRITE(BLACEPHALON, gMonBackPic_Blacephalon), SPECIES_SPRITE(ZERAORA, gMonBackPic_Zeraora), SPECIES_SPRITE(EGG, gMonFrontPic_Egg), + + SPECIES_SPRITE(UNOWN_A, gMonBackPic_UnownA), + SPECIES_SPRITE(UNOWN_B, gMonBackPic_UnownB), + SPECIES_SPRITE(UNOWN_C, gMonBackPic_UnownC), + SPECIES_SPRITE(UNOWN_D, gMonBackPic_UnownD), + SPECIES_SPRITE(UNOWN_E, gMonBackPic_UnownE), + SPECIES_SPRITE(UNOWN_F, gMonBackPic_UnownF), + SPECIES_SPRITE(UNOWN_G, gMonBackPic_UnownG), + SPECIES_SPRITE(UNOWN_H, gMonBackPic_UnownH), + SPECIES_SPRITE(UNOWN_I, gMonBackPic_UnownI), + SPECIES_SPRITE(UNOWN_J, gMonBackPic_UnownJ), + SPECIES_SPRITE(UNOWN_K, gMonBackPic_UnownK), + SPECIES_SPRITE(UNOWN_L, gMonBackPic_UnownL), + SPECIES_SPRITE(UNOWN_M, gMonBackPic_UnownM), + SPECIES_SPRITE(UNOWN_N, gMonBackPic_UnownN), + SPECIES_SPRITE(UNOWN_O, gMonBackPic_UnownO), + SPECIES_SPRITE(UNOWN_P, gMonBackPic_UnownP), + SPECIES_SPRITE(UNOWN_Q, gMonBackPic_UnownQ), + SPECIES_SPRITE(UNOWN_R, gMonBackPic_UnownR), + SPECIES_SPRITE(UNOWN_S, gMonBackPic_UnownS), + SPECIES_SPRITE(UNOWN_T, gMonBackPic_UnownT), + SPECIES_SPRITE(UNOWN_U, gMonBackPic_UnownU), + SPECIES_SPRITE(UNOWN_V, gMonBackPic_UnownV), + SPECIES_SPRITE(UNOWN_W, gMonBackPic_UnownW), + SPECIES_SPRITE(UNOWN_X, gMonBackPic_UnownX), + SPECIES_SPRITE(UNOWN_Y, gMonBackPic_UnownY), + SPECIES_SPRITE(UNOWN_Z, gMonBackPic_UnownZ), + SPECIES_SPRITE(UNOWN_EMARK, gMonBackPic_UnownExclamationMark), + SPECIES_SPRITE(UNOWN_QMARK, gMonBackPic_UnownQuestionMark), }; diff --git a/src/data/pokemon_graphics/front_pic_coordinates.h b/src/data/pokemon_graphics/front_pic_coordinates.h index b1711e06a..17336f96d 100644 --- a/src/data/pokemon_graphics/front_pic_coordinates.h +++ b/src/data/pokemon_graphics/front_pic_coordinates.h @@ -1005,11 +1005,6 @@ const struct MonCoords gMonFrontPicCoords[] = .size = 0x55, .y_offset = 0xd, }, - [SPECIES_UNOWN] = - { - .size = 0x35, - .y_offset = 0xf, - }, [SPECIES_WOBBUFFET] = { .size = 0x77, @@ -3250,4 +3245,149 @@ const struct MonCoords gMonFrontPicCoords[] = .size = 0x45, .y_offset = 0x0, }, + [SPECIES_EGG] = + { + .size = 0x33, + .y_offset = 0x14, + }, + [SPECIES_UNOWN_A] = + { + .size = 0x35, + .y_offset = 0xf, + }, + [SPECIES_UNOWN_B] = + { + .size = 0x34, + .y_offset = 0x10, + }, + [SPECIES_UNOWN_C] = + { + .size = 0x44, + .y_offset = 0x10, + }, + [SPECIES_UNOWN_D] = + { + .size = 0x44, + .y_offset = 0x10, + }, + [SPECIES_UNOWN_E] = + { + .size = 0x44, + .y_offset = 0x11, + }, + [SPECIES_UNOWN_F] = + { + .size = 0x44, + .y_offset = 0x11, + }, + [SPECIES_UNOWN_G] = + { + .size = 0x35, + .y_offset = 0x0e, + }, + [SPECIES_UNOWN_H] = + { + .size = 0x44, + .y_offset = 0x10, + }, + [SPECIES_UNOWN_I] = + { + .size = 0x34, + .y_offset = 0x10, + }, + [SPECIES_UNOWN_J] = + { + .size = 0x34, + .y_offset = 0x11, + }, + [SPECIES_UNOWN_K] = + { + .size = 0x44, + .y_offset = 0x11, + }, + [SPECIES_UNOWN_L] = + { + .size = 0x34, + .y_offset = 0x13, + }, + [SPECIES_UNOWN_M] = + { + .size = 0x44, + .y_offset = 0x13, + }, + [SPECIES_UNOWN_N] = + { + .size = 0x43, + .y_offset = 0x14, + }, + [SPECIES_UNOWN_O] = + { + .size = 0x44, + .y_offset = 0x10, + }, + [SPECIES_UNOWN_P] = + { + .size = 0x34, + .y_offset = 0x13, + }, + [SPECIES_UNOWN_Q] = + { + .size = 0x43, + .y_offset = 0x15, + }, + [SPECIES_UNOWN_R] = + { + .size = 0x34, + .y_offset = 0x13, + }, + [SPECIES_UNOWN_S] = + { + .size = 0x45, + .y_offset = 0x0c, + }, + [SPECIES_UNOWN_T] = + { + .size = 0x34, + .y_offset = 0x12, + }, + [SPECIES_UNOWN_U] = + { + .size = 0x44, + .y_offset = 0x12, + }, + [SPECIES_UNOWN_V] = + { + .size = 0x44, + .y_offset = 0x12, + }, + [SPECIES_UNOWN_W] = + { + .size = 0x44, + .y_offset = 0x13, + }, + [SPECIES_UNOWN_X] = + { + .size = 0x33, + .y_offset = 0x15, + }, + [SPECIES_UNOWN_Y] = + { + .size = 0x34, + .y_offset = 0x11, + }, + [SPECIES_UNOWN_Z] = + { + .size = 0x34, + .y_offset = 0x10, + }, + [SPECIES_UNOWN_EMARK] = + { + .size = 0x35, + .y_offset = 0x0f, + }, + [SPECIES_UNOWN_QMARK] = + { + .size = 0x35, + .y_offset = 0x0d, + }, }; diff --git a/src/data/pokemon_graphics/front_pic_table.h b/src/data/pokemon_graphics/front_pic_table.h index 5d2d3f899..60bcd2255 100644 --- a/src/data/pokemon_graphics/front_pic_table.h +++ b/src/data/pokemon_graphics/front_pic_table.h @@ -809,4 +809,33 @@ const struct CompressedSpriteSheet gMonFrontPicTable[] = SPECIES_SPRITE(BLACEPHALON, gMonFrontPic_Blacephalon), SPECIES_SPRITE(ZERAORA, gMonFrontPic_Zeraora), SPECIES_SPRITE(EGG, gMonFrontPic_Egg), + + SPECIES_SPRITE(UNOWN_A, gMonFrontPic_UnownA), + SPECIES_SPRITE(UNOWN_B, gMonFrontPic_UnownB), + SPECIES_SPRITE(UNOWN_C, gMonFrontPic_UnownC), + SPECIES_SPRITE(UNOWN_D, gMonFrontPic_UnownD), + SPECIES_SPRITE(UNOWN_E, gMonFrontPic_UnownE), + SPECIES_SPRITE(UNOWN_F, gMonFrontPic_UnownF), + SPECIES_SPRITE(UNOWN_G, gMonFrontPic_UnownG), + SPECIES_SPRITE(UNOWN_H, gMonFrontPic_UnownH), + SPECIES_SPRITE(UNOWN_I, gMonFrontPic_UnownI), + SPECIES_SPRITE(UNOWN_J, gMonFrontPic_UnownJ), + SPECIES_SPRITE(UNOWN_K, gMonFrontPic_UnownK), + SPECIES_SPRITE(UNOWN_L, gMonFrontPic_UnownL), + SPECIES_SPRITE(UNOWN_M, gMonFrontPic_UnownM), + SPECIES_SPRITE(UNOWN_N, gMonFrontPic_UnownN), + SPECIES_SPRITE(UNOWN_O, gMonFrontPic_UnownO), + SPECIES_SPRITE(UNOWN_P, gMonFrontPic_UnownP), + SPECIES_SPRITE(UNOWN_Q, gMonFrontPic_UnownQ), + SPECIES_SPRITE(UNOWN_R, gMonFrontPic_UnownR), + SPECIES_SPRITE(UNOWN_S, gMonFrontPic_UnownS), + SPECIES_SPRITE(UNOWN_T, gMonFrontPic_UnownT), + SPECIES_SPRITE(UNOWN_U, gMonFrontPic_UnownU), + SPECIES_SPRITE(UNOWN_V, gMonFrontPic_UnownV), + SPECIES_SPRITE(UNOWN_W, gMonFrontPic_UnownW), + SPECIES_SPRITE(UNOWN_X, gMonFrontPic_UnownX), + SPECIES_SPRITE(UNOWN_Y, gMonFrontPic_UnownY), + SPECIES_SPRITE(UNOWN_Z, gMonFrontPic_UnownZ), + SPECIES_SPRITE(UNOWN_EMARK, gMonFrontPic_UnownExclamationMark), + SPECIES_SPRITE(UNOWN_QMARK, gMonFrontPic_UnownQuestionMark), }; diff --git a/src/data/pokemon_graphics/palette_table.h b/src/data/pokemon_graphics/palette_table.h index b626f234b..b3875eefc 100644 --- a/src/data/pokemon_graphics/palette_table.h +++ b/src/data/pokemon_graphics/palette_table.h @@ -809,4 +809,32 @@ const struct CompressedSpritePalette gMonPaletteTable[] = SPECIES_PAL(BLACEPHALON, gMonPalette_Blacephalon), SPECIES_PAL(ZERAORA, gMonPalette_Zeraora), SPECIES_PAL(EGG, gMonPalette_Egg), + SPECIES_PAL(UNOWN_A, gMonPalette_Unown), + SPECIES_PAL(UNOWN_B, gMonPalette_Unown), + SPECIES_PAL(UNOWN_C, gMonPalette_Unown), + SPECIES_PAL(UNOWN_D, gMonPalette_Unown), + SPECIES_PAL(UNOWN_E, gMonPalette_Unown), + SPECIES_PAL(UNOWN_F, gMonPalette_Unown), + SPECIES_PAL(UNOWN_G, gMonPalette_Unown), + SPECIES_PAL(UNOWN_H, gMonPalette_Unown), + SPECIES_PAL(UNOWN_I, gMonPalette_Unown), + SPECIES_PAL(UNOWN_J, gMonPalette_Unown), + SPECIES_PAL(UNOWN_K, gMonPalette_Unown), + SPECIES_PAL(UNOWN_L, gMonPalette_Unown), + SPECIES_PAL(UNOWN_M, gMonPalette_Unown), + SPECIES_PAL(UNOWN_N, gMonPalette_Unown), + SPECIES_PAL(UNOWN_O, gMonPalette_Unown), + SPECIES_PAL(UNOWN_P, gMonPalette_Unown), + SPECIES_PAL(UNOWN_Q, gMonPalette_Unown), + SPECIES_PAL(UNOWN_R, gMonPalette_Unown), + SPECIES_PAL(UNOWN_S, gMonPalette_Unown), + SPECIES_PAL(UNOWN_T, gMonPalette_Unown), + SPECIES_PAL(UNOWN_U, gMonPalette_Unown), + SPECIES_PAL(UNOWN_V, gMonPalette_Unown), + SPECIES_PAL(UNOWN_W, gMonPalette_Unown), + SPECIES_PAL(UNOWN_X, gMonPalette_Unown), + SPECIES_PAL(UNOWN_Y, gMonPalette_Unown), + SPECIES_PAL(UNOWN_Z, gMonPalette_Unown), + SPECIES_PAL(UNOWN_EMARK, gMonPalette_Unown), + SPECIES_PAL(UNOWN_QMARK, gMonPalette_Unown), }; diff --git a/src/data/pokemon_graphics/shiny_palette_table.h b/src/data/pokemon_graphics/shiny_palette_table.h index 20c076f34..e48812d57 100644 --- a/src/data/pokemon_graphics/shiny_palette_table.h +++ b/src/data/pokemon_graphics/shiny_palette_table.h @@ -809,4 +809,32 @@ const struct CompressedSpritePalette gMonShinyPaletteTable[] = SPECIES_SHINY_PAL(BLACEPHALON, gMonShinyPalette_Blacephalon), SPECIES_SHINY_PAL(ZERAORA, gMonShinyPalette_Zeraora), SPECIES_SHINY_PAL(EGG, gMonPalette_Egg), + SPECIES_SHINY_PAL(UNOWN_A, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_B, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_C, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_D, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_E, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_F, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_G, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_H, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_I, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_J, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_K, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_L, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_M, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_N, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_O, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_P, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_Q, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_R, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_S, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_T, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_U, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_V, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_W, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_X, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_Y, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_Z, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_EMARK, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_QMARK, gMonShinyPalette_Unown), }; diff --git a/src/decompress.c b/src/decompress.c index c2df09bac..36da5ac0e 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -85,23 +85,16 @@ void HandleLoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *des void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic) { - /* if (species == SPECIES_UNOWN) { - u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C; - - // The other Unowns are separate from Unown A. - if (i == 0) - i = SPECIES_UNOWN; - else - i += SPECIES_UNOWN_B - 1; + u32 id = GetUnownSpeciesId(personality); if (!isFrontPic) - LZ77UnCompWram(gMonBackPicTable[i].data, dest); + LZ77UnCompWram(gMonBackPicTable[id].data, dest); else - LZ77UnCompWram(gMonFrontPicTable[i].data, dest); + LZ77UnCompWram(gMonFrontPicTable[id].data, dest); } - else*/ if (species > NUM_SPECIES) // is species unknown? draw the ? icon + else if (species > NUM_SPECIES) // is species unknown? draw the ? icon LZ77UnCompWram(gMonFrontPicTable[0].data, dest); else LZ77UnCompWram(src->data, dest); @@ -507,23 +500,16 @@ void DecompressPicFromTable_2(const struct CompressedSpriteSheet *src, void* buf void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic) // a copy of LoadSpecialPokePic { - /* if (species == SPECIES_UNOWN) { - u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C; - - // The other Unowns are separate from Unown A. - if (i == 0) - i = SPECIES_UNOWN; - else - i += SPECIES_UNOWN_B - 1; + u32 id = GetUnownSpeciesId(personality); if (!isFrontPic) - LZ77UnCompWram(gMonBackPicTable[i].data, dest); + LZ77UnCompWram(gMonBackPicTable[id].data, dest); else - LZ77UnCompWram(gMonFrontPicTable[i].data, dest); + LZ77UnCompWram(gMonFrontPicTable[id].data, dest); } - else*/ if (species > NUM_SPECIES) // is species unknown? draw the ? icon + else if (species > NUM_SPECIES) // is species unknown? draw the ? icon LZ77UnCompWram(gMonFrontPicTable[0].data, dest); else LZ77UnCompWram(src->data, dest); @@ -566,23 +552,16 @@ void HandleLoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteShee void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic) { - /* if (species == SPECIES_UNOWN) { - u16 i = (((personality & 0x3000000) >> 18) | ((personality & 0x30000) >> 12) | ((personality & 0x300) >> 6) | (personality & 3)) % 0x1C; - - // The other Unowns are separate from Unown A. - if (i == 0) - i = SPECIES_UNOWN; - else - i += SPECIES_UNOWN_B - 1; + u32 id = GetUnownSpeciesId(personality); if (!isFrontPic) - LZ77UnCompWram(gMonBackPicTable[i].data, dest); + LZ77UnCompWram(gMonBackPicTable[id].data, dest); else - LZ77UnCompWram(gMonFrontPicTable[i].data, dest); + LZ77UnCompWram(gMonFrontPicTable[id].data, dest); } - else*/ if (species > NUM_SPECIES) // is species unknown? draw the ? icon + else if (species > NUM_SPECIES) // is species unknown? draw the ? icon LZ77UnCompWram(gMonFrontPicTable[0].data, dest); else LZ77UnCompWram(src->data, dest); diff --git a/src/pokemon.c b/src/pokemon.c index 6e0c4565b..fa897ea55 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -24,6 +24,7 @@ #include "pokeblock.h" #include "pokemon.h" #include "pokemon_animation.h" +#include "pokemon_icon.h" #include "pokemon_summary_screen.h" #include "pokemon_storage_system.h" #include "random.h" @@ -3385,6 +3386,11 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality) return MON_MALE; } +u32 GetUnownSpeciesId(u32 personality) +{ + return GetUnownLetterByPersonality(personality) + SPECIES_UNOWN_A; +} + void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition) { if (gMonSpritesGfxPtr != NULL) diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index b68ef3d74..25f5a5cab 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -762,11 +762,41 @@ const u8 *const gMonIconTable[] = [SPECIES_BLACEPHALON] = gMonIcon_Blacephalon, [SPECIES_ZERAORA] = gMonIcon_Zeraora, [SPECIES_EGG] = gMonIcon_Egg, + [SPECIES_UNOWN_A] = gMonIcon_UnownA, + [SPECIES_UNOWN_B] = gMonIcon_UnownB, + [SPECIES_UNOWN_C] = gMonIcon_UnownC, + [SPECIES_UNOWN_D] = gMonIcon_UnownD, + [SPECIES_UNOWN_E] = gMonIcon_UnownE, + [SPECIES_UNOWN_F] = gMonIcon_UnownF, + [SPECIES_UNOWN_G] = gMonIcon_UnownG, + [SPECIES_UNOWN_H] = gMonIcon_UnownH, + [SPECIES_UNOWN_I] = gMonIcon_UnownI, + [SPECIES_UNOWN_J] = gMonIcon_UnownJ, + [SPECIES_UNOWN_K] = gMonIcon_UnownK, + [SPECIES_UNOWN_L] = gMonIcon_UnownL, + [SPECIES_UNOWN_M] = gMonIcon_UnownM, + [SPECIES_UNOWN_N] = gMonIcon_UnownN, + [SPECIES_UNOWN_O] = gMonIcon_UnownO, + [SPECIES_UNOWN_P] = gMonIcon_UnownP, + [SPECIES_UNOWN_Q] = gMonIcon_UnownQ, + [SPECIES_UNOWN_R] = gMonIcon_UnownR, + [SPECIES_UNOWN_S] = gMonIcon_UnownS, + [SPECIES_UNOWN_T] = gMonIcon_UnownT, + [SPECIES_UNOWN_U] = gMonIcon_UnownU, + [SPECIES_UNOWN_V] = gMonIcon_UnownV, + [SPECIES_UNOWN_W] = gMonIcon_UnownW, + [SPECIES_UNOWN_X] = gMonIcon_UnownX, + [SPECIES_UNOWN_Y] = gMonIcon_UnownY, + [SPECIES_UNOWN_Z] = gMonIcon_UnownZ, + [SPECIES_UNOWN_EMARK] = gMonIcon_UnownExclamationMark, + [SPECIES_UNOWN_QMARK] = gMonIcon_UnownQuestionMark, + }; -const u8 gMonIconPaletteIndices[NUM_SPECIES + 1] = +const u8 gMonIconPaletteIndices[] = { [0 ... SPECIES_EGG] = 1, + [SPECIES_UNOWN_A ... SPECIES_UNOWN_QMARK] = 0, }; const struct SpritePalette gMonIconPaletteTable[] = @@ -937,14 +967,7 @@ u16 GetIconSpecies(u16 species, u32 personality) if (species == SPECIES_UNOWN) { - /* - u16 letter = GetUnownLetterByPersonality(personality); - if (letter == 0) - letter = SPECIES_UNOWN; - else - letter += (SPECIES_UNOWN_B - 1); - result = letter; - */ + result = GetUnownSpeciesId(personality); } else { @@ -971,20 +994,14 @@ u16 sub_80D2E84(u16 species) if (MailSpeciesToSpecies(species, &value) == SPECIES_UNOWN) { - /* - if (value == 0) - value += SPECIES_UNOWN; - else - value += (SPECIES_UNOWN_B - 1); + value += SPECIES_UNOWN_A; return value; - */ } else { - /* - if (species > (SPECIES_UNOWN_B - 1)) - species = SPECIES_OLD_UNOWN_J; // That's an oddly specific species. - */ + if (species > NUM_SPECIES) + species = 0; + return GetIconSpecies(species, 0); } }