diff --git a/src/bard_music.c b/src/bard_music.c index 6c2578071..1a61c25ff 100644 --- a/src/bard_music.c +++ b/src/bard_music.c @@ -25,8 +25,8 @@ const struct BardSound *GetWordSounds(u16 word) { return gBardSound_InvalidWord; } - category = word >> 9; - subword = word & 0x1ff; + category = EC_GROUP(word); + subword = EC_INDEX(word); switch (category) { case EC_GROUP_POKEMON: diff --git a/src/data/bard_music/bard_sounds.h b/src/data/bard_music/bard_sounds.h index 4a0911726..1ec1f0d97 100644 --- a/src/data/bard_music/bard_sounds.h +++ b/src/data/bard_music/bard_sounds.h @@ -24,29 +24,29 @@ #include "events.h" #include "trendysaying.h" -const struct BardSound (*const gBardSoundsTable[])[6] = { - NULL, - gBardSounds_Trainer, - gBardSounds_Status, - gBardSounds_Battle, - gBardSounds_Greetings, - gBardSounds_People, - gBardSounds_Voices, - gBardSounds_Speech, - gBardSounds_Endings, - gBardSounds_Feelings, - gBardSounds_Conditions, - gBardSounds_Actions, - gBardSounds_Lifestyle, - gBardSounds_Hobbies, - gBardSounds_Time, - gBardSounds_Misc, - gBardSounds_Adjectives, - gBardSounds_Events, - NULL, - NULL, - gBardSounds_TrendySaying, - NULL +const struct BardSound (*const gBardSoundsTable[EC_NUM_GROUPS])[6] = { + [EC_GROUP_POKEMON] = NULL, // Handled by gBardSounds_Pokemon + [EC_GROUP_TRAINER] = gBardSounds_Trainer, + [EC_GROUP_STATUS] = gBardSounds_Status, + [EC_GROUP_BATTLE] = gBardSounds_Battle, + [EC_GROUP_GREETINGS] = gBardSounds_Greetings, + [EC_GROUP_PEOPLE] = gBardSounds_People, + [EC_GROUP_VOICES] = gBardSounds_Voices, + [EC_GROUP_SPEECH] = gBardSounds_Speech, + [EC_GROUP_ENDINGS] = gBardSounds_Endings, + [EC_GROUP_FEELINGS] = gBardSounds_Feelings, + [EC_GROUP_CONDITIONS] = gBardSounds_Conditions, + [EC_GROUP_ACTIONS] = gBardSounds_Actions, + [EC_GROUP_LIFESTYLE] = gBardSounds_Lifestyle, + [EC_GROUP_HOBBIES] = gBardSounds_Hobbies, + [EC_GROUP_TIME] = gBardSounds_Time, + [EC_GROUP_MISC] = gBardSounds_Misc, + [EC_GROUP_ADJECTIVES] = gBardSounds_Adjectives, + [EC_GROUP_EVENTS] = gBardSounds_Events, + [EC_GROUP_MOVE_1] = NULL, // Handled by gBardSounds_Moves + [EC_GROUP_MOVE_2] = NULL, // Handled by gBardSounds_Moves + [EC_GROUP_TRENDY_SAYING] = gBardSounds_TrendySaying, + [EC_GROUP_POKEMON_2] = NULL // Handled by gBardSounds_Pokemon }; #endif //GUARD_BARD_SOUNDS_TABLE_H diff --git a/src/data/easy_chat/easy_chat_groups.h b/src/data/easy_chat/easy_chat_groups.h index df114d980..a89f228fe 100755 --- a/src/data/easy_chat/easy_chat_groups.h +++ b/src/data/easy_chat/easy_chat_groups.h @@ -26,112 +26,112 @@ const struct EasyChatGroup gEasyChatGroups[] = { { .wordData = {.valueList = gEasyChatGroup_Pokemon}, - .numWords = 202, - .numEnabledWords = 202, + .numWords = ARRAY_COUNT(gEasyChatGroup_Pokemon), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Pokemon), }, { .wordData = {.words = gEasyChatGroup_Trainer}, - .numWords = 27, - .numEnabledWords = 21, + .numWords = ARRAY_COUNT(gEasyChatGroup_Trainer), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Trainer) - 6, // Excludes Red, Green, Flame, Gold, Leaf, and Silver }, { .wordData = {.words = gEasyChatGroup_Status}, - .numWords = 109, - .numEnabledWords = 109, + .numWords = ARRAY_COUNT(gEasyChatGroup_Status), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Status), }, { .wordData = {.words = gEasyChatGroup_Battle}, - .numWords = 63, - .numEnabledWords = 63, + .numWords = ARRAY_COUNT(gEasyChatGroup_Battle), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Battle), }, { .wordData = {.words = gEasyChatGroup_Greetings}, - .numWords = 42, - .numEnabledWords = 42, + .numWords = ARRAY_COUNT(gEasyChatGroup_Greetings), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Greetings), }, { .wordData = {.words = gEasyChatGroup_People}, - .numWords = 75, - .numEnabledWords = 75, + .numWords = ARRAY_COUNT(gEasyChatGroup_People), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_People), }, { .wordData = {.words = gEasyChatGroup_Voices}, - .numWords = 63, - .numEnabledWords = 63, + .numWords = ARRAY_COUNT(gEasyChatGroup_Voices), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Voices), }, { .wordData = {.words = gEasyChatGroup_Speech}, - .numWords = 60, - .numEnabledWords = 60, + .numWords = ARRAY_COUNT(gEasyChatGroup_Speech), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Speech), }, { .wordData = {.words = gEasyChatGroup_Endings}, - .numWords = 69, - .numEnabledWords = 69, + .numWords = ARRAY_COUNT(gEasyChatGroup_Endings), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Endings), }, { .wordData = {.words = gEasyChatGroup_Feelings}, - .numWords = 69, - .numEnabledWords = 69, + .numWords = ARRAY_COUNT(gEasyChatGroup_Feelings), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Feelings), }, { .wordData = {.words = gEasyChatGroup_Conditions}, - .numWords = 69, - .numEnabledWords = 69, + .numWords = ARRAY_COUNT(gEasyChatGroup_Conditions), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Conditions), }, { .wordData = {.words = gEasyChatGroup_Actions}, - .numWords = 78, - .numEnabledWords = 78, + .numWords = ARRAY_COUNT(gEasyChatGroup_Actions), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Actions), }, { .wordData = {.words = gEasyChatGroup_Lifestyle}, - .numWords = 45, - .numEnabledWords = 45, + .numWords = ARRAY_COUNT(gEasyChatGroup_Lifestyle), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Lifestyle), }, { .wordData = {.words = gEasyChatGroup_Hobbies}, - .numWords = 54, - .numEnabledWords = 54, + .numWords = ARRAY_COUNT(gEasyChatGroup_Hobbies), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Hobbies), }, { .wordData = {.words = gEasyChatGroup_Time}, - .numWords = 45, - .numEnabledWords = 45, + .numWords = ARRAY_COUNT(gEasyChatGroup_Time), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Time), }, { .wordData = {.words = gEasyChatGroup_Misc}, - .numWords = 42, - .numEnabledWords = 42, + .numWords = ARRAY_COUNT(gEasyChatGroup_Misc), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Misc), }, { .wordData = {.words = gEasyChatGroup_Adjectives}, - .numWords = 36, - .numEnabledWords = 36, + .numWords = ARRAY_COUNT(gEasyChatGroup_Adjectives), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Adjectives), }, { .wordData = {.words = gEasyChatGroup_Events}, - .numWords = 29, - .numEnabledWords = 29, + .numWords = ARRAY_COUNT(gEasyChatGroup_Events), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Events), }, { .wordData = {.valueList = gEasyChatGroup_Move1}, - .numWords = 154, - .numEnabledWords = 154, + .numWords = ARRAY_COUNT(gEasyChatGroup_Move1), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Move1), }, { .wordData = {.valueList = gEasyChatGroup_Move2}, - .numWords = 200, - .numEnabledWords = 200, + .numWords = ARRAY_COUNT(gEasyChatGroup_Move2), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Move2), }, { .wordData = {.words = gEasyChatGroup_TrendySaying}, - .numWords = 33, - .numEnabledWords = 33, + .numWords = ARRAY_COUNT(gEasyChatGroup_TrendySaying), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_TrendySaying), }, { .wordData = {.valueList = gEasyChatGroup_Pokemon2}, - .numWords = 251, - .numEnabledWords = 251, + .numWords = ARRAY_COUNT(gEasyChatGroup_Pokemon2), + .numEnabledWords = ARRAY_COUNT(gEasyChatGroup_Pokemon2), }, }; diff --git a/src/data/party_menu.h b/src/data/party_menu.h index 3c3a3e1ce..daf3f4f6c 100644 --- a/src/data/party_menu.h +++ b/src/data/party_menu.h @@ -1194,62 +1194,62 @@ static const u8 *const sUnused_StatStrings[] = static const u16 sTMHMMoves[] = { - MOVE_FOCUS_PUNCH, - MOVE_DRAGON_CLAW, - MOVE_WATER_PULSE, - MOVE_CALM_MIND, - MOVE_ROAR, - MOVE_TOXIC, - MOVE_HAIL, - MOVE_BULK_UP, - MOVE_BULLET_SEED, - MOVE_HIDDEN_POWER, - MOVE_SUNNY_DAY, - MOVE_TAUNT, - MOVE_ICE_BEAM, - MOVE_BLIZZARD, - MOVE_HYPER_BEAM, - MOVE_LIGHT_SCREEN, - MOVE_PROTECT, - MOVE_RAIN_DANCE, - MOVE_GIGA_DRAIN, - MOVE_SAFEGUARD, - MOVE_FRUSTRATION, - MOVE_SOLAR_BEAM, - MOVE_IRON_TAIL, - MOVE_THUNDERBOLT, - MOVE_THUNDER, - MOVE_EARTHQUAKE, - MOVE_RETURN, - MOVE_DIG, - MOVE_PSYCHIC, - MOVE_SHADOW_BALL, - MOVE_BRICK_BREAK, - MOVE_DOUBLE_TEAM, - MOVE_REFLECT, - MOVE_SHOCK_WAVE, - MOVE_FLAMETHROWER, - MOVE_SLUDGE_BOMB, - MOVE_SANDSTORM, - MOVE_FIRE_BLAST, - MOVE_ROCK_TOMB, - MOVE_AERIAL_ACE, - MOVE_TORMENT, - MOVE_FACADE, - MOVE_SECRET_POWER, - MOVE_REST, - MOVE_ATTRACT, - MOVE_THIEF, - MOVE_STEEL_WING, - MOVE_SKILL_SWAP, - MOVE_SNATCH, - MOVE_OVERHEAT, - MOVE_CUT, - MOVE_FLY, - MOVE_SURF, - MOVE_STRENGTH, - MOVE_FLASH, - MOVE_ROCK_SMASH, - MOVE_WATERFALL, - MOVE_DIVE, + [ITEM_TM01 - ITEM_TM01] = MOVE_FOCUS_PUNCH, + [ITEM_TM02 - ITEM_TM01] = MOVE_DRAGON_CLAW, + [ITEM_TM03 - ITEM_TM01] = MOVE_WATER_PULSE, + [ITEM_TM04 - ITEM_TM01] = MOVE_CALM_MIND, + [ITEM_TM05 - ITEM_TM01] = MOVE_ROAR, + [ITEM_TM06 - ITEM_TM01] = MOVE_TOXIC, + [ITEM_TM07 - ITEM_TM01] = MOVE_HAIL, + [ITEM_TM08 - ITEM_TM01] = MOVE_BULK_UP, + [ITEM_TM09 - ITEM_TM01] = MOVE_BULLET_SEED, + [ITEM_TM10 - ITEM_TM01] = MOVE_HIDDEN_POWER, + [ITEM_TM11 - ITEM_TM01] = MOVE_SUNNY_DAY, + [ITEM_TM12 - ITEM_TM01] = MOVE_TAUNT, + [ITEM_TM13 - ITEM_TM01] = MOVE_ICE_BEAM, + [ITEM_TM14 - ITEM_TM01] = MOVE_BLIZZARD, + [ITEM_TM15 - ITEM_TM01] = MOVE_HYPER_BEAM, + [ITEM_TM16 - ITEM_TM01] = MOVE_LIGHT_SCREEN, + [ITEM_TM17 - ITEM_TM01] = MOVE_PROTECT, + [ITEM_TM18 - ITEM_TM01] = MOVE_RAIN_DANCE, + [ITEM_TM19 - ITEM_TM01] = MOVE_GIGA_DRAIN, + [ITEM_TM20 - ITEM_TM01] = MOVE_SAFEGUARD, + [ITEM_TM21 - ITEM_TM01] = MOVE_FRUSTRATION, + [ITEM_TM22 - ITEM_TM01] = MOVE_SOLAR_BEAM, + [ITEM_TM23 - ITEM_TM01] = MOVE_IRON_TAIL, + [ITEM_TM24 - ITEM_TM01] = MOVE_THUNDERBOLT, + [ITEM_TM25 - ITEM_TM01] = MOVE_THUNDER, + [ITEM_TM26 - ITEM_TM01] = MOVE_EARTHQUAKE, + [ITEM_TM27 - ITEM_TM01] = MOVE_RETURN, + [ITEM_TM28 - ITEM_TM01] = MOVE_DIG, + [ITEM_TM29 - ITEM_TM01] = MOVE_PSYCHIC, + [ITEM_TM30 - ITEM_TM01] = MOVE_SHADOW_BALL, + [ITEM_TM31 - ITEM_TM01] = MOVE_BRICK_BREAK, + [ITEM_TM32 - ITEM_TM01] = MOVE_DOUBLE_TEAM, + [ITEM_TM33 - ITEM_TM01] = MOVE_REFLECT, + [ITEM_TM34 - ITEM_TM01] = MOVE_SHOCK_WAVE, + [ITEM_TM35 - ITEM_TM01] = MOVE_FLAMETHROWER, + [ITEM_TM36 - ITEM_TM01] = MOVE_SLUDGE_BOMB, + [ITEM_TM37 - ITEM_TM01] = MOVE_SANDSTORM, + [ITEM_TM38 - ITEM_TM01] = MOVE_FIRE_BLAST, + [ITEM_TM39 - ITEM_TM01] = MOVE_ROCK_TOMB, + [ITEM_TM40 - ITEM_TM01] = MOVE_AERIAL_ACE, + [ITEM_TM41 - ITEM_TM01] = MOVE_TORMENT, + [ITEM_TM42 - ITEM_TM01] = MOVE_FACADE, + [ITEM_TM43 - ITEM_TM01] = MOVE_SECRET_POWER, + [ITEM_TM44 - ITEM_TM01] = MOVE_REST, + [ITEM_TM45 - ITEM_TM01] = MOVE_ATTRACT, + [ITEM_TM46 - ITEM_TM01] = MOVE_THIEF, + [ITEM_TM47 - ITEM_TM01] = MOVE_STEEL_WING, + [ITEM_TM48 - ITEM_TM01] = MOVE_SKILL_SWAP, + [ITEM_TM49 - ITEM_TM01] = MOVE_SNATCH, + [ITEM_TM50 - ITEM_TM01] = MOVE_OVERHEAT, + [ITEM_HM01 - ITEM_TM01] = MOVE_CUT, + [ITEM_HM02 - ITEM_TM01] = MOVE_FLY, + [ITEM_HM03 - ITEM_TM01] = MOVE_SURF, + [ITEM_HM04 - ITEM_TM01] = MOVE_STRENGTH, + [ITEM_HM05 - ITEM_TM01] = MOVE_FLASH, + [ITEM_HM06 - ITEM_TM01] = MOVE_ROCK_SMASH, + [ITEM_HM07 - ITEM_TM01] = MOVE_WATERFALL, + [ITEM_HM08 - ITEM_TM01] = MOVE_DIVE, }; diff --git a/src/party_menu.c b/src/party_menu.c index 74a23cc93..8aca27f47 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -1961,9 +1961,9 @@ static u8 CanMonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor) if (GetMonData(mon, MON_DATA_IS_EGG)) return CANNOT_LEARN_MOVE_IS_EGG; - if (item >= ITEM_TM01_FOCUS_PUNCH) + if (item >= ITEM_TM01) { - if (!CanMonLearnTMHM(mon, item - ITEM_TM01_FOCUS_PUNCH)) + if (!CanMonLearnTMHM(mon, item - ITEM_TM01)) return CANNOT_LEARN_MOVE; else move = ItemIdToBattleMoveId(item); @@ -4612,7 +4612,7 @@ void ItemUseCB_PPUp(u8 taskId, TaskFunc task) u16 ItemIdToBattleMoveId(u16 item) { - u16 tmNumber = item - ITEM_TM01_FOCUS_PUNCH; + u16 tmNumber = item - ITEM_TM01; return sTMHMMoves[tmNumber]; }