From 4bac8800429b616ceb1ddfe2d3a8ca216da733dc Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 25 Nov 2022 16:55:53 -0300 Subject: [PATCH] Removed Unown hack --- include/constants/species.h | 4 +- include/contest.h | 1 - include/mail.h | 2 - src/battle_anim.c | 27 +++--- src/battle_anim_effects_3.c | 28 +----- src/battle_anim_mons.c | 91 ++----------------- src/battle_factory.c | 6 +- src/battle_main.c | 7 +- src/contest.c | 13 +-- src/data/bard_music/pokemon.h | 2 +- src/data/easy_chat/easy_chat_group_pokemon2.h | 2 +- .../easy_chat/easy_chat_words_by_letter.h | 2 +- src/data/pokemon/base_stats.h | 2 +- .../pokemon/form_species_table_pointers.h | 2 +- src/data/pokemon/form_species_tables.h | 2 +- src/data/pokemon/level_up_learnset_pointers.h | 2 +- .../pokemon/teachable_learnset_pointers.h | 2 +- .../pokemon_graphics/back_pic_coordinates.h | 2 +- src/data/pokemon_graphics/back_pic_table.h | 2 +- .../pokemon_graphics/enemy_mon_elevation.h | 2 +- src/data/pokemon_graphics/footprint_table.h | 2 +- src/data/pokemon_graphics/front_pic_anims.h | 4 +- .../pokemon_graphics/front_pic_coordinates.h | 2 +- src/data/pokemon_graphics/front_pic_table.h | 2 +- src/data/pokemon_graphics/palette_table.h | 2 +- .../pokemon_graphics/shiny_palette_table.h | 2 +- src/data/text/species_names.h | 2 +- src/decompress.c | 11 +-- src/mail.c | 4 +- src/mail_data.c | 32 +------ src/pokedex.c | 4 +- src/pokemon.c | 47 ++++++++-- src/pokemon_animation.c | 29 +++++- src/pokemon_icon.c | 31 ++----- 34 files changed, 126 insertions(+), 249 deletions(-) diff --git a/include/constants/species.h b/include/constants/species.h index 18e3138ce..5dd3b6225 100644 --- a/include/constants/species.h +++ b/include/constants/species.h @@ -204,7 +204,7 @@ #define SPECIES_MURKROW 198 #define SPECIES_SLOWKING 199 #define SPECIES_MISDREAVUS 200 -#define SPECIES_UNOWN 201 +#define SPECIES_UNOWN_A 201 #define SPECIES_WOBBUFFET 202 #define SPECIES_GIRAFARIG 203 #define SPECIES_PINECO 204 @@ -1375,4 +1375,6 @@ #define NUM_SPECIES SPECIES_EGG +#define SPECIES_UNOWN NUM_SPECIES + 1 // Used for random Unown form based on personality. + #endif // GUARD_CONSTANTS_SPECIES_H diff --git a/include/contest.h b/include/contest.h index 21e2530c2..a79ad03ce 100644 --- a/include/contest.h +++ b/include/contest.h @@ -338,7 +338,6 @@ void SetContestants(u8 contestType, u8 rank); void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame); u8 GetContestEntryEligibility(struct Pokemon *pkmn); void CalculateRound1Points(u8 contestCategory); -bool8 IsSpeciesNotUnown(u16 species); bool8 Contest_IsMonsTurnDisabled(u8 contestant); void SaveLinkContestResults(void); void SortContestants(bool8 useRanking); diff --git a/include/mail.h b/include/mail.h index f4590a70e..00fe3425a 100644 --- a/include/mail.h +++ b/include/mail.h @@ -22,8 +22,6 @@ void ClearAllMail(void); void ClearMail(struct Mail *mail); bool8 MonHasMail(struct Pokemon *mon); u8 GiveMailToMonByItemId(struct Pokemon *mon, u16 itemId); -u16 SpeciesToMailSpecies(u16 species, u32 personality); -u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer); u8 GiveMailToMon(struct Pokemon *mon, struct Mail *mail); void TakeMailFromMon(struct Pokemon *mon); void ClearMailItemId(u8 mailId); diff --git a/src/battle_anim.c b/src/battle_anim.c index 509369789..12d36d6cb 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -740,7 +740,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) battlerSpriteId = gBattlerSpriteIds[battlerId]; gBattle_BG1_X = -(gSprites[battlerSpriteId].x + gSprites[battlerSpriteId].x2) + 0x20; - if (IsContest() && IsSpeciesNotUnown(gContestResources->moveAnim->species)) + if (IsContest()) gBattle_BG1_X--; gBattle_BG1_Y = -(gSprites[battlerSpriteId].y + gSprites[battlerSpriteId].y2) + 0x20; @@ -798,24 +798,21 @@ static void FlipBattlerBgTiles(void) struct BattleAnimBgData animBg; u16 *ptr; - if (IsSpeciesNotUnown(gContestResources->moveAnim->species)) + GetBattleAnimBg1Data(&animBg); + ptr = animBg.bgTilemap; + for (i = 0; i < 8; i++) { - GetBattleAnimBg1Data(&animBg); - ptr = animBg.bgTilemap; - for (i = 0; i < 8; i++) + for (j = 0; j < 4; j++) { - for (j = 0; j < 4; j++) - { - u16 temp; - SWAP(ptr[j + i * 32], ptr[7 - j + i * 32], temp); - } - } - for (i = 0; i < 8; i++) - { - for (j = 0; j < 8; j++) - ptr[j + i * 32] ^= 0x400; + u16 temp; + SWAP(ptr[j + i * 32], ptr[7 - j + i * 32], temp); } } + for (i = 0; i < 8; i++) + { + for (j = 0; j < 8; j++) + ptr[j + i * 32] ^= 0x400; + } } void RelocateBattleBgPal(u16 paletteNum, u16 *dest, u32 offset, bool8 largeScreen) diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 552fcf517..ace78bc88 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -2378,33 +2378,7 @@ void AnimTask_TransformMon(u8 taskId) LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset); if (IsContest()) { - if (IsSpeciesNotUnown(gContestResources->moveAnim->species) != IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies)) - { - bgTilemap = (u16 *)animBg.bgTilemap; - for (i = 0; i < 8; i++) - { - for (j = 0; j < 4; j++) - { - u16 temp = bgTilemap[j + i * 0x20]; - bgTilemap[j + i * 0x20] = bgTilemap[(7 - j) + i * 0x20]; - bgTilemap[(7 - j) + i * 0x20] = temp; - } - } - - for (i = 0; i < 8; i++) - { - for (j = 0; j < 8; j++) - { - bgTilemap[j + i * 0x20] ^= 0x400; - } - } - } - - if (IsSpeciesNotUnown(gContestResources->moveAnim->targetSpecies)) - gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteContest; - else - gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteOpponentSide; - + gSprites[gBattlerSpriteIds[gBattleAnimAttacker]].affineAnims = gAffineAnims_BattleSpriteContest; StartSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattleAnimAttacker]], BATTLER_AFFINE_NORMAL); } diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index 104c77885..8c522d259 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -185,64 +185,21 @@ u8 GetBattlerYDelta(u8 battlerId, u16 species) if (GetBattlerSide(battlerId) == B_SIDE_PLAYER || IsContest()) { - if (species == SPECIES_UNOWN) - { - if (IsContest()) - { - if (gContestResources->moveAnim->hasTargetAnim) - personality = gContestResources->moveAnim->targetPersonality; - else - personality = gContestResources->moveAnim->personality; - } - else - { - spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) - personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY); - else - personality = gTransformedPersonalities[battlerId]; - } - coordSpecies = GetUnownSpeciesId(personality); - ret = gMonBackPicCoords[coordSpecies].y_offset; - } - else if (species == SPECIES_CASTFORM) - { + if (species == SPECIES_CASTFORM) ret = sCastformBackSpriteYCoords[gBattleMonForms[battlerId]]; - } else if (species > NUM_SPECIES) - { ret = gMonBackPicCoords[0].y_offset; - } else - { ret = gMonBackPicCoords[species].y_offset; - } } else { - if (species == SPECIES_UNOWN) - { - spriteInfo = gBattleSpritesDataPtr->battlerData; - if (!spriteInfo[battlerId].transformSpecies) - personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[battlerId]], MON_DATA_PERSONALITY); - else - personality = gTransformedPersonalities[battlerId]; - - coordSpecies = GetUnownSpeciesId(personality); - ret = gMonFrontPicCoords[coordSpecies].y_offset; - } - else if (species == SPECIES_CASTFORM) - { + if (species == SPECIES_CASTFORM) ret = gCastformFrontSpriteCoords[gBattleMonForms[battlerId]].y_offset; - } else if (species > NUM_SPECIES) - { ret = gMonFrontPicCoords[0].y_offset; - } else - { ret = gMonFrontPicCoords[species].y_offset; - } } return ret; } @@ -1325,17 +1282,7 @@ void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation) // Pokémon in Contests (except Unown) should be flipped. static bool8 ShouldRotScaleSpeciesBeFlipped(void) { - if (IsContest()) - { - if (gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].data[2] == SPECIES_UNOWN) - return FALSE; - else - return TRUE; - } - else - { - return FALSE; - } + return IsContest(); } void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode) @@ -2205,12 +2152,8 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) species = gContestResources->moveAnim->species; personality = gContestResources->moveAnim->personality; } - if (species == SPECIES_UNOWN) - { - species = GetUnownSpeciesId(personality); - coords = &gMonBackPicCoords[species]; - } - else if (species == SPECIES_CASTFORM) + + if (species == SPECIES_CASTFORM) { coords = &gCastformFrontSpriteCoords[gBattleMonForms[battlerId]]; } @@ -2239,19 +2182,10 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) personality = gTransformedPersonalities[battlerId]; } - if (species == SPECIES_UNOWN) - { - species = GetUnownSpeciesId(personality); - coords = &gMonBackPicCoords[species]; - } - else if (species > NUM_SPECIES) - { + if (species > NUM_SPECIES) coords = &gMonBackPicCoords[0]; - } else - { coords = &gMonBackPicCoords[species]; - } } else { @@ -2267,23 +2201,12 @@ s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr) personality = gTransformedPersonalities[battlerId]; } - if (species == SPECIES_UNOWN) - { - species = GetUnownSpeciesId(personality); - coords = &gMonFrontPicCoords[species]; - } - else if (species == SPECIES_CASTFORM) - { + if (species == SPECIES_CASTFORM) coords = &gCastformFrontSpriteCoords[gBattleMonForms[battlerId]]; - } else if (species > NUM_SPECIES) - { coords = &gMonFrontPicCoords[0]; - } else - { coords = &gMonFrontPicCoords[species]; - } } } diff --git a/src/battle_factory.c b/src/battle_factory.c index 12e477e32..fcef27ea2 100644 --- a/src/battle_factory.c +++ b/src/battle_factory.c @@ -334,7 +334,7 @@ static void GenerateOpponentMons(void) u16 monId = GetFactoryMonId(lvlMode, challengeNum, FALSE); // Unown (FRONTIER_MON_UNOWN) is forbidden on opponent Factory teams. - if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN) + if (GET_BASE_SPECIES_ID(gFacilityTrainerMons[monId].species) == SPECIES_UNOWN_A) continue; // Ensure none of the opponent's pokemon are the same as the potential rental pokemon for the player @@ -559,7 +559,7 @@ static void GenerateInitialRentalMons(void) else monId = GetFactoryMonId(factoryLvlMode, challengeNum, FALSE); - if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN) + if (GET_BASE_SPECIES_ID(gFacilityTrainerMons[monId].species) == SPECIES_UNOWN_A) continue; // Cannot have two pokemon of the same species. @@ -771,7 +771,7 @@ void FillFactoryBrainParty(void) { u16 monId = GetFactoryMonId(lvlMode, challengeNum, FALSE); - if (gFacilityTrainerMons[monId].species == SPECIES_UNOWN) + if (GET_BASE_SPECIES_ID(gFacilityTrainerMons[monId].species) == SPECIES_UNOWN_A) continue; if (monLevel == FRONTIER_MAX_LEVEL_50 && monId > FRONTIER_MONS_HIGH_TIER) continue; diff --git a/src/battle_main.c b/src/battle_main.c index 9790810a1..40ea00270 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -2663,12 +2663,7 @@ void SpriteCB_FaintOpponentMon(struct Sprite *sprite) GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); // Unused return value. - if (species == SPECIES_UNOWN) - { - species = GetUnownSpeciesId(personality); - yOffset = gMonFrontPicCoords[species].y_offset; - } - else if (species == SPECIES_CASTFORM) + if (species == SPECIES_CASTFORM) { yOffset = gCastformFrontSpriteCoords[gBattleMonForms[battler]].y_offset; } diff --git a/src/contest.c b/src/contest.c index 463b66449..fa20ac04e 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3136,23 +3136,12 @@ static u8 CreateContestantSprite(u16 species, u32 otId, u32 personality, u32 ind gSprites[spriteId].callback = SpriteCallbackDummy; gSprites[spriteId].data[0] = gSprites[spriteId].oam.paletteNum; gSprites[spriteId].data[2] = species; - if (IsSpeciesNotUnown(species)) - gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteContest; - else - gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteOpponentSide; + gSprites[spriteId].affineAnims = gAffineAnims_BattleSpriteContest; StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_NORMAL); return spriteId; } -bool8 IsSpeciesNotUnown(u16 species) -{ - if (species == SPECIES_UNOWN) - return FALSE; - else - return TRUE; -} - // The contestant info windows and general-purpose text box are drawn on one half, while // the moves and move description windows are drawn on another screen. Only the first 32 * 20 // tiles are actually drawn on screen. diff --git a/src/data/bard_music/pokemon.h b/src/data/bard_music/pokemon.h index 7d378da6f..420c59845 100644 --- a/src/data/bard_music/pokemon.h +++ b/src/data/bard_music/pokemon.h @@ -1612,7 +1612,7 @@ const struct BardSound gBardSounds_Pokemon[NUM_SPECIES][6] = { NULL_BARD_SOUND, NULL_BARD_SOUND, }, - [SPECIES_UNOWN] = { + [SPECIES_UNOWN_A] = { { .songLengthId = 42 }, { .songLengthId = 26 }, { .songLengthId = 51 }, diff --git a/src/data/easy_chat/easy_chat_group_pokemon2.h b/src/data/easy_chat/easy_chat_group_pokemon2.h index 331c5ac6c..fe332c1c0 100755 --- a/src/data/easy_chat/easy_chat_group_pokemon2.h +++ b/src/data/easy_chat/easy_chat_group_pokemon2.h @@ -229,7 +229,7 @@ const u16 gEasyChatGroup_Pokemon2[] = { SPECIES_TYRANITAR, SPECIES_TYROGUE, SPECIES_UMBREON, - SPECIES_UNOWN, + SPECIES_UNOWN_A, SPECIES_URSARING, SPECIES_VAPOREON, SPECIES_VENOMOTH, diff --git a/src/data/easy_chat/easy_chat_words_by_letter.h b/src/data/easy_chat/easy_chat_words_by_letter.h index 8bfe23729..14a4fa4fb 100755 --- a/src/data/easy_chat/easy_chat_words_by_letter.h +++ b/src/data/easy_chat/easy_chat_words_by_letter.h @@ -1770,7 +1770,7 @@ const u16 gEasyChatWordsByLetter_U[] = { EC_WORD_UNDERSTANDS, EC_WORD_UNDERSTOOD, EC_WORD_UNION, - EC_POKEMON_NATIONAL(UNOWN), + EC_POKEMON_NATIONAL(UNOWN_A), EC_WORD_UNTIL, EC_WORD_UP, EC_WORD_UPBEAT, diff --git a/src/data/pokemon/base_stats.h b/src/data/pokemon/base_stats.h index a161fbf90..847c810c2 100644 --- a/src/data/pokemon/base_stats.h +++ b/src/data/pokemon/base_stats.h @@ -5941,7 +5941,7 @@ const struct BaseStats gBaseStats[] = .noFlip = FALSE, }, - [SPECIES_UNOWN] = UNOWN_BASE_STATS(FLIP), + [SPECIES_UNOWN_A] = UNOWN_BASE_STATS(FLIP), [SPECIES_WOBBUFFET] = { diff --git a/src/data/pokemon/form_species_table_pointers.h b/src/data/pokemon/form_species_table_pointers.h index 73b1b07d7..a6ebaea7a 100644 --- a/src/data/pokemon/form_species_table_pointers.h +++ b/src/data/pokemon/form_species_table_pointers.h @@ -51,7 +51,7 @@ const u16 *const gFormSpeciesIdTables[NUM_SPECIES] = [SPECIES_SLOWKING] = sSlowkingFormSpeciesIdTable, [SPECIES_QWILFISH] = sQwilfishFormSpeciesIdTable, [SPECIES_SNEASEL] = sSneaselFormSpeciesIdTable, - [SPECIES_UNOWN] = sUnownFormSpeciesIdTable, + [SPECIES_UNOWN_A] = sUnownFormSpeciesIdTable, [SPECIES_STEELIX] = sSteelixFormSpeciesIdTable, [SPECIES_SCIZOR] = sScizorFormSpeciesIdTable, [SPECIES_HERACROSS] = sHeracrossFormSpeciesIdTable, diff --git a/src/data/pokemon/form_species_tables.h b/src/data/pokemon/form_species_tables.h index 545201c5a..5ae41331b 100644 --- a/src/data/pokemon/form_species_tables.h +++ b/src/data/pokemon/form_species_tables.h @@ -322,7 +322,7 @@ static const u16 sSneaselFormSpeciesIdTable[] = { }; static const u16 sUnownFormSpeciesIdTable[] = { - SPECIES_UNOWN, + SPECIES_UNOWN_A, SPECIES_UNOWN_B, SPECIES_UNOWN_C, SPECIES_UNOWN_D, diff --git a/src/data/pokemon/level_up_learnset_pointers.h b/src/data/pokemon/level_up_learnset_pointers.h index 0ecfa59cc..2d5912cd9 100644 --- a/src/data/pokemon/level_up_learnset_pointers.h +++ b/src/data/pokemon/level_up_learnset_pointers.h @@ -201,7 +201,7 @@ const struct LevelUpMove *const gLevelUpLearnsets[NUM_SPECIES] = [SPECIES_MURKROW] = sMurkrowLevelUpLearnset, [SPECIES_SLOWKING] = sSlowkingLevelUpLearnset, [SPECIES_MISDREAVUS] = sMisdreavusLevelUpLearnset, - [SPECIES_UNOWN] = sUnownLevelUpLearnset, + [SPECIES_UNOWN_A] = sUnownLevelUpLearnset, [SPECIES_WOBBUFFET] = sWobbuffetLevelUpLearnset, [SPECIES_GIRAFARIG] = sGirafarigLevelUpLearnset, [SPECIES_PINECO] = sPinecoLevelUpLearnset, diff --git a/src/data/pokemon/teachable_learnset_pointers.h b/src/data/pokemon/teachable_learnset_pointers.h index 28998aae1..55f86bc58 100644 --- a/src/data/pokemon/teachable_learnset_pointers.h +++ b/src/data/pokemon/teachable_learnset_pointers.h @@ -201,7 +201,7 @@ const u16 *const gTeachableLearnsets[NUM_SPECIES] = [SPECIES_MURKROW] = sMurkrowTeachableLearnset, [SPECIES_SLOWKING] = sSlowkingTeachableLearnset, [SPECIES_MISDREAVUS] = sMisdreavusTeachableLearnset, - [SPECIES_UNOWN] = sUnownTeachableLearnset, + [SPECIES_UNOWN_A] = sUnownTeachableLearnset, [SPECIES_WOBBUFFET] = sWobbuffetTeachableLearnset, [SPECIES_GIRAFARIG] = sGirafarigTeachableLearnset, [SPECIES_PINECO] = sPinecoTeachableLearnset, diff --git a/src/data/pokemon_graphics/back_pic_coordinates.h b/src/data/pokemon_graphics/back_pic_coordinates.h index 8dbc2d2a9..b8f783e7c 100644 --- a/src/data/pokemon_graphics/back_pic_coordinates.h +++ b/src/data/pokemon_graphics/back_pic_coordinates.h @@ -224,7 +224,7 @@ const struct MonCoords gMonBackPicCoords[] = [SPECIES_MURKROW] = { .size = MON_COORDS_SIZE(40, 56), .y_offset = 10 }, [SPECIES_SLOWKING] = { .size = MON_COORDS_SIZE(56, 64), .y_offset = 3 }, [SPECIES_MISDREAVUS] = { .size = MON_COORDS_SIZE(56, 48), .y_offset = 9 }, - [SPECIES_UNOWN] = { .size = MON_COORDS_SIZE(24, 48), .y_offset = 8 }, + [SPECIES_UNOWN_A] = { .size = MON_COORDS_SIZE(24, 48), .y_offset = 8 }, [SPECIES_WOBBUFFET] = { .size = MON_COORDS_SIZE(56, 56), .y_offset = 10 }, [SPECIES_GIRAFARIG] = { .size = MON_COORDS_SIZE(64, 64), .y_offset = 1 }, [SPECIES_PINECO] = { .size = MON_COORDS_SIZE(56, 40), .y_offset = 13 }, diff --git a/src/data/pokemon_graphics/back_pic_table.h b/src/data/pokemon_graphics/back_pic_table.h index 398cf2875..4dbb8df81 100644 --- a/src/data/pokemon_graphics/back_pic_table.h +++ b/src/data/pokemon_graphics/back_pic_table.h @@ -201,7 +201,7 @@ const struct CompressedSpriteSheet gMonBackPicTable[] = SPECIES_SPRITE(MURKROW, gMonBackPic_Murkrow), SPECIES_SPRITE(SLOWKING, gMonBackPic_Slowking), SPECIES_SPRITE(MISDREAVUS, gMonBackPic_Misdreavus), - SPECIES_SPRITE(UNOWN, gMonBackPic_Unown), + SPECIES_SPRITE(UNOWN_A, gMonBackPic_Unown), SPECIES_SPRITE(WOBBUFFET, gMonBackPic_Wobbuffet), SPECIES_SPRITE(GIRAFARIG, gMonBackPic_Girafarig), SPECIES_SPRITE(PINECO, gMonBackPic_Pineco), diff --git a/src/data/pokemon_graphics/enemy_mon_elevation.h b/src/data/pokemon_graphics/enemy_mon_elevation.h index 64bd433fa..4f97aa1bf 100644 --- a/src/data/pokemon_graphics/enemy_mon_elevation.h +++ b/src/data/pokemon_graphics/enemy_mon_elevation.h @@ -27,7 +27,7 @@ const u8 gEnemyMonElevation[NUM_SPECIES] = [SPECIES_YANMA] = 13, [SPECIES_MURKROW] = 12, [SPECIES_MISDREAVUS] = 12, - [SPECIES_UNOWN] = 8, + [SPECIES_UNOWN_A] = 8, [SPECIES_GLIGAR] = 8, [SPECIES_MANTINE] = 6, [SPECIES_PORYGON2] = 9, diff --git a/src/data/pokemon_graphics/footprint_table.h b/src/data/pokemon_graphics/footprint_table.h index 2b0dd0a4f..7bbf56700 100644 --- a/src/data/pokemon_graphics/footprint_table.h +++ b/src/data/pokemon_graphics/footprint_table.h @@ -201,7 +201,7 @@ const u8 *const gMonFootprintTable[] = [SPECIES_MURKROW] = gMonFootprint_Murkrow, [SPECIES_SLOWKING] = gMonFootprint_Slowking, [SPECIES_MISDREAVUS] = gMonFootprint_Misdreavus, - [SPECIES_UNOWN] = gMonFootprint_Unown, + [SPECIES_UNOWN_A] = gMonFootprint_Unown, [SPECIES_WOBBUFFET] = gMonFootprint_Wobbuffet, [SPECIES_GIRAFARIG] = gMonFootprint_Girafarig, [SPECIES_PINECO] = gMonFootprint_Pineco, diff --git a/src/data/pokemon_graphics/front_pic_anims.h b/src/data/pokemon_graphics/front_pic_anims.h index b152a0d6d..923d7b790 100644 --- a/src/data/pokemon_graphics/front_pic_anims.h +++ b/src/data/pokemon_graphics/front_pic_anims.h @@ -11731,7 +11731,7 @@ static const union AnimCmd *const sAnims_MISDREAVUS[] = sAnim_MISDREAVUS_1, }; -static const union AnimCmd *const sAnims_UNOWN[] = +static const union AnimCmd *const sAnims_UNOWN_A[] = { sAnim_GeneralFrame0, sAnim_UNOWN_1, @@ -17335,7 +17335,7 @@ const union AnimCmd *const *const gMonFrontAnimsPtrTable[] = ANIM_CMD(MURKROW), ANIM_CMD(SLOWKING), ANIM_CMD(MISDREAVUS), - ANIM_CMD(UNOWN), + ANIM_CMD(UNOWN_A), ANIM_CMD(WOBBUFFET), ANIM_CMD(GIRAFARIG), ANIM_CMD(PINECO), diff --git a/src/data/pokemon_graphics/front_pic_coordinates.h b/src/data/pokemon_graphics/front_pic_coordinates.h index a484b8596..bf6447f2b 100644 --- a/src/data/pokemon_graphics/front_pic_coordinates.h +++ b/src/data/pokemon_graphics/front_pic_coordinates.h @@ -205,7 +205,7 @@ const struct MonCoords gMonFrontPicCoords[] = [SPECIES_MURKROW] = { .size = MON_COORDS_SIZE(48, 40), .y_offset = 15 }, [SPECIES_SLOWKING] = { .size = MON_COORDS_SIZE(48, 64), .y_offset = 1 }, [SPECIES_MISDREAVUS] = { .size = MON_COORDS_SIZE(48, 48), .y_offset = 13 }, - [SPECIES_UNOWN] = { .size = MON_COORDS_SIZE(24, 40), .y_offset = 15 }, + [SPECIES_UNOWN_A] = { .size = MON_COORDS_SIZE(24, 40), .y_offset = 15 }, [SPECIES_WOBBUFFET] = { .size = MON_COORDS_SIZE(64, 56), .y_offset = 5 }, [SPECIES_GIRAFARIG] = { .size = MON_COORDS_SIZE(56, 64), .y_offset = 0 }, [SPECIES_PINECO] = { .size = MON_COORDS_SIZE(40, 40), .y_offset = 12 }, diff --git a/src/data/pokemon_graphics/front_pic_table.h b/src/data/pokemon_graphics/front_pic_table.h index 7629834ad..6f74ffe27 100644 --- a/src/data/pokemon_graphics/front_pic_table.h +++ b/src/data/pokemon_graphics/front_pic_table.h @@ -201,7 +201,7 @@ const struct CompressedSpriteSheet gMonFrontPicTable[] = SPECIES_SPRITE(MURKROW, gMonFrontPic_Murkrow), SPECIES_SPRITE(SLOWKING, gMonFrontPic_Slowking), SPECIES_SPRITE(MISDREAVUS, gMonFrontPic_Misdreavus), - SPECIES_SPRITE(UNOWN, gMonFrontPic_Unown), + SPECIES_SPRITE(UNOWN_A, gMonFrontPic_Unown), SPECIES_SPRITE(WOBBUFFET, gMonFrontPic_Wobbuffet), SPECIES_SPRITE(GIRAFARIG, gMonFrontPic_Girafarig), SPECIES_SPRITE(PINECO, gMonFrontPic_Pineco), diff --git a/src/data/pokemon_graphics/palette_table.h b/src/data/pokemon_graphics/palette_table.h index 8ef3b3231..6dc3eb224 100644 --- a/src/data/pokemon_graphics/palette_table.h +++ b/src/data/pokemon_graphics/palette_table.h @@ -201,7 +201,7 @@ const struct CompressedSpritePalette gMonPaletteTable[] = SPECIES_PAL(MURKROW, gMonPalette_Murkrow), SPECIES_PAL(SLOWKING, gMonPalette_Slowking), SPECIES_PAL(MISDREAVUS, gMonPalette_Misdreavus), - SPECIES_PAL(UNOWN, gMonPalette_Unown), + SPECIES_PAL(UNOWN_A, gMonPalette_Unown), SPECIES_PAL(WOBBUFFET, gMonPalette_Wobbuffet), SPECIES_PAL(GIRAFARIG, gMonPalette_Girafarig), SPECIES_PAL(PINECO, gMonPalette_Pineco), diff --git a/src/data/pokemon_graphics/shiny_palette_table.h b/src/data/pokemon_graphics/shiny_palette_table.h index 64a999c49..a18002b15 100644 --- a/src/data/pokemon_graphics/shiny_palette_table.h +++ b/src/data/pokemon_graphics/shiny_palette_table.h @@ -201,7 +201,7 @@ const struct CompressedSpritePalette gMonShinyPaletteTable[] = SPECIES_SHINY_PAL(MURKROW, gMonShinyPalette_Murkrow), SPECIES_SHINY_PAL(SLOWKING, gMonShinyPalette_Slowking), SPECIES_SHINY_PAL(MISDREAVUS, gMonShinyPalette_Misdreavus), - SPECIES_SHINY_PAL(UNOWN, gMonShinyPalette_Unown), + SPECIES_SHINY_PAL(UNOWN_A, gMonShinyPalette_Unown), SPECIES_SHINY_PAL(WOBBUFFET, gMonShinyPalette_Wobbuffet), SPECIES_SHINY_PAL(GIRAFARIG, gMonShinyPalette_Girafarig), SPECIES_SHINY_PAL(PINECO, gMonShinyPalette_Pineco), diff --git a/src/data/text/species_names.h b/src/data/text/species_names.h index ec452b31b..f8e8da16e 100644 --- a/src/data/text/species_names.h +++ b/src/data/text/species_names.h @@ -200,7 +200,7 @@ const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1] = { [SPECIES_MURKROW] = _("Murkrow"), [SPECIES_SLOWKING] = _("Slowking"), [SPECIES_MISDREAVUS] = _("Misdreavus"), - [SPECIES_UNOWN] = _("Unown"), + [SPECIES_UNOWN_A] = _("Unown"), [SPECIES_WOBBUFFET] = _("Wobbuffet"), [SPECIES_GIRAFARIG] = _("Girafarig"), [SPECIES_PINECO] = _("Pineco"), diff --git a/src/decompress.c b/src/decompress.c index f5d4ff233..20f8897e8 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -83,16 +83,7 @@ void HandleLoadSpecialPokePic(bool32 isFrontPic, void *dest, s32 species, u32 pe void LoadSpecialPokePic(void *dest, s32 species, u32 personality, bool8 isFrontPic) { - if (species == SPECIES_UNOWN) - { - u32 id = GetUnownSpeciesId(personality); - - if (!isFrontPic) - LZ77UnCompWram(gMonBackPicTable[id].data, dest); - else - LZ77UnCompWram(gMonFrontPicTable[id].data, dest); - } - else if (species > NUM_SPECIES) // is species unknown? draw the ? icon + if (species > NUM_SPECIES) // is species unknown? draw the ? icon { if (isFrontPic) LZ77UnCompWram(gMonFrontPicTable[0].data, dest); diff --git a/src/mail.c b/src/mail.c index e20a53cba..1461521e9 100644 --- a/src/mail.c +++ b/src/mail.c @@ -445,7 +445,6 @@ static const struct MailLayout sMailLayouts_Tall[] = { void ReadMail(struct Mail *mail, void (*exitCallback)(void), bool8 hasText) { - u16 buffer[2]; u16 species; sMailRead = AllocZeroed(sizeof(*sMailRead)); @@ -473,8 +472,7 @@ void ReadMail(struct Mail *mail, void (*exitCallback)(void), bool8 hasText) sMailRead->layout = &sMailLayouts_Tall[sMailRead->mailType]; break; } - species = MailSpeciesToSpecies(mail->species, buffer); - if (species > SPECIES_NONE && species < NUM_SPECIES) + if (mail->species > SPECIES_NONE && mail->species < NUM_SPECIES) { switch (sMailRead->mailType) { diff --git a/src/mail_data.c b/src/mail_data.c index 99cf1f9ed..c6748f83f 100644 --- a/src/mail_data.c +++ b/src/mail_data.c @@ -67,9 +67,7 @@ u8 GiveMailToMonByItemId(struct Pokemon *mon, u16 itemId) for (i = 0; i < TRAINER_ID_LENGTH; i++) gSaveBlock1Ptr->mail[id].trainerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; - species = GetBoxMonData(&mon->box, MON_DATA_SPECIES); - personality = GetBoxMonData(&mon->box, MON_DATA_PERSONALITY); - gSaveBlock1Ptr->mail[id].species = SpeciesToMailSpecies(species, personality); + gSaveBlock1Ptr->mail[id].species = GetBoxMonData(&mon->box, MON_DATA_SPECIES); gSaveBlock1Ptr->mail[id].itemId = itemId; SetMonData(mon, MON_DATA_MAIL, &id); SetMonData(mon, MON_DATA_HELD_ITEM, heldItem); @@ -80,34 +78,6 @@ u8 GiveMailToMonByItemId(struct Pokemon *mon, u16 itemId) return MAIL_NONE; } -u16 SpeciesToMailSpecies(u16 species, u32 personality) -{ - if (species == SPECIES_UNOWN) - { - u32 species = GetUnownLetterByPersonality(personality) + UNOWN_OFFSET; - return species; - } - - return species; -} - -u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer) -{ - u16 result; - - if (mailSpecies >= UNOWN_OFFSET && mailSpecies < UNOWN_OFFSET + NUM_UNOWN_FORMS) - { - result = SPECIES_UNOWN; - *buffer = mailSpecies - UNOWN_OFFSET; - } - else - { - result = mailSpecies; - } - - return result; -} - u8 GiveMailToMon(struct Pokemon *mon, struct Mail *mail) { u8 heldItem[2]; diff --git a/src/pokedex.c b/src/pokedex.c index de7f186a5..fd93b5065 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4592,9 +4592,9 @@ static u16 GetNextPosition(u8 direction, u16 position, u16 min, u16 max) // All others use personality 0 static u32 GetPokedexMonPersonality(u16 species) { - if (species == SPECIES_UNOWN || species == SPECIES_SPINDA) + if (species == SPECIES_UNOWN_A || species == SPECIES_SPINDA) { - if (species == SPECIES_UNOWN) + if (species == SPECIES_UNOWN_A) return gSaveBlock2Ptr->pokedex.unownPersonality; else return gSaveBlock2Ptr->pokedex.spindaPersonality; diff --git a/src/pokemon.c b/src/pokemon.c index 9478e7baf..7d26c6fa5 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -539,7 +539,7 @@ static const u16 sSpeciesToNationalPokedexNum[NUM_SPECIES - 1] = SPECIES_TO_NATIONAL(MURKROW), SPECIES_TO_NATIONAL(SLOWKING), SPECIES_TO_NATIONAL(MISDREAVUS), - SPECIES_TO_NATIONAL(UNOWN), + [SPECIES_UNOWN_A - 1] = NATIONAL_DEX_UNOWN, SPECIES_TO_NATIONAL(WOBBUFFET), SPECIES_TO_NATIONAL(GIRAFARIG), SPECIES_TO_NATIONAL(PINECO), @@ -2168,7 +2168,34 @@ static const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] = [SPECIES_MURKROW - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_SLOWKING - 1] = ANIM_SHRINK_GROW, [SPECIES_MISDREAVUS - 1] = ANIM_V_SLIDE_WOBBLE, - [SPECIES_UNOWN - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_A - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_B - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_C - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_D - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_E - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_F - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_G - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_H - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_I - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_J - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_K - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_L - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_M - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_N - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_O - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_P - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_Q - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_R - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_S - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_T - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_U - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_V - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_W - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_X - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_Y - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_Z - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_EMARK - 1] = ANIM_ZIGZAG_FAST, + [SPECIES_UNOWN_QMARK - 1] = ANIM_ZIGZAG_FAST, [SPECIES_WOBBUFFET - 1] = ANIM_GROW_VIBRATE, [SPECIES_GIRAFARIG - 1] = ANIM_V_SQUISH_AND_BOUNCE, [SPECIES_PINECO - 1] = ANIM_SWING_CONCAVE, @@ -3443,6 +3470,9 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV, else personality = Random32(); + if (species == SPECIES_UNOWN) + species = GetUnownSpeciesId(personality); + // Determine original trainer ID if (otIdType == OT_ID_RANDOM_NO_SHINY) { @@ -4453,7 +4483,7 @@ u32 GetUnownSpeciesId(u32 personality) u16 unownLetter = GetUnownLetterByPersonality(personality); if (unownLetter == 0) - return SPECIES_UNOWN; + return SPECIES_UNOWN_A; return unownLetter + SPECIES_UNOWN_B - 1; } @@ -8217,7 +8247,7 @@ void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality) if (!GetSetPokedexFlag(nationalNum, getFlagCaseId)) // don't set if it's already set { GetSetPokedexFlag(nationalNum, caseId); - if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_UNOWN) + if (GET_BASE_SPECIES_ID(NationalPokedexNumToSpecies(nationalNum)) == SPECIES_UNOWN_A) gSaveBlock2Ptr->pokedex.unownPersonality = personality; if (NationalPokedexNumToSpecies(nationalNum) == SPECIES_SPINDA) gSaveBlock2Ptr->pokedex.spindaPersonality = personality; @@ -8240,13 +8270,12 @@ const u8 *GetTrainerNameFromId(u16 trainerId) bool8 HasTwoFramesAnimation(u16 species) { + species = GET_BASE_SPECIES_ID(species); + return (species != SPECIES_CASTFORM && species != SPECIES_SPINDA - && species != SPECIES_UNOWN - && species != SPECIES_CHERRIM - && species != SPECIES_CASTFORM_SUNNY - && species != SPECIES_CASTFORM_RAINY - && species != SPECIES_CASTFORM_SNOWY); + && species != SPECIES_UNOWN_A + && species != SPECIES_CHERRIM); } static bool8 ShouldSkipFriendshipChange(void) diff --git a/src/pokemon_animation.c b/src/pokemon_animation.c index 936ef037d..b55b79162 100644 --- a/src/pokemon_animation.c +++ b/src/pokemon_animation.c @@ -414,7 +414,34 @@ static const u8 sSpeciesToBackAnimSet[NUM_SPECIES] = [SPECIES_MURKROW] = BACK_ANIM_CONCAVE_ARC_SMALL, [SPECIES_SLOWKING] = BACK_ANIM_DIP_RIGHT_SIDE, [SPECIES_MISDREAVUS] = BACK_ANIM_H_VIBRATE, - [SPECIES_UNOWN] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_A] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_B] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_C] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_D] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_E] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_F] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_G] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_H] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_I] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_J] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_K] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_L] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_M] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_N] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_O] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_P] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_Q] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_R] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_S] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_T] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_U] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_V] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_W] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_X] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_Y] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_Z] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_EMARK] = BACK_ANIM_SHRINK_GROW_VIBRATE, + [SPECIES_UNOWN_QMARK] = BACK_ANIM_SHRINK_GROW_VIBRATE, [SPECIES_WOBBUFFET] = BACK_ANIM_V_STRETCH, [SPECIES_GIRAFARIG] = BACK_ANIM_SHRINK_GROW_VIBRATE, [SPECIES_PINECO] = BACK_ANIM_H_SHAKE, diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index c9dae5343..24bb18ffd 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -227,7 +227,7 @@ const u8 *const gMonIconTable[] = [SPECIES_MURKROW] = gMonIcon_Murkrow, [SPECIES_SLOWKING] = gMonIcon_Slowking, [SPECIES_MISDREAVUS] = gMonIcon_Misdreavus, - [SPECIES_UNOWN] = gMonIcon_Unown, + [SPECIES_UNOWN_A] = gMonIcon_Unown, [SPECIES_WOBBUFFET] = gMonIcon_Wobbuffet, [SPECIES_GIRAFARIG] = gMonIcon_Girafarig, [SPECIES_PINECO] = gMonIcon_Pineco, @@ -1527,7 +1527,7 @@ const u8 gMonIconPaletteIndices[] = [SPECIES_MURKROW] = 2, [SPECIES_SLOWKING] = 0, [SPECIES_MISDREAVUS] = 0, - [SPECIES_UNOWN] = 0, + [SPECIES_UNOWN_A] = 0, [SPECIES_WOBBUFFET] = 0, [SPECIES_GIRAFARIG] = 1, [SPECIES_PINECO] = 0, @@ -2732,17 +2732,10 @@ u16 GetIconSpecies(u16 species, u32 personality) { u16 result; - if (species == SPECIES_UNOWN) - { - result = GetUnownSpeciesId(personality); - } + if (species > NUM_SPECIES) + result = INVALID_ICON_SPECIES; else - { - if (species > NUM_SPECIES) - result = INVALID_ICON_SPECIES; - else - result = species; - } + result = species; return result; } @@ -2759,18 +2752,10 @@ u16 GetIconSpeciesNoPersonality(u16 species) { u16 value; - if (MailSpeciesToSpecies(species, &value) == SPECIES_UNOWN) - { - value += SPECIES_UNOWN_B; // TODO - return value; - } - else - { - if (species > NUM_SPECIES) - species = INVALID_ICON_SPECIES; + if (species > NUM_SPECIES) + species = INVALID_ICON_SPECIES; - return GetIconSpecies(species, 0); - } + return GetIconSpecies(species, 0); } const u8 *GetMonIconPtr(u16 species, u32 personality)