From c3f34173f7edb3ff33cf57f81dc8f3b3d1b49d62 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 27 Nov 2025 14:27:33 -0300 Subject: [PATCH 1/3] Some renames --- include/pokemon.h | 8 ++++---- src/friend_area_action_menu.c | 4 ++-- src/main_loops.c | 10 +++++----- src/party_list_menu.c | 2 +- src/pokemon.c | 26 +++++++++++++------------- src/pokemon_mail.c | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 92a003c75..a56277ec0 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -37,16 +37,16 @@ extern RecruitedMon *gRecruitedPokemonRef; void LoadMonsterParameters(void); RecruitedMon *GetRecruitedPokemon(void); void InitializeRecruitedPokemon(void); -void sub_808CE74(s16 _species, bool32 _isLeader, u8* name); +void CreateLeaderPartnerData(s16 _species, bool32 _isLeader, u8* name); void CreateLevel1Pokemon(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, const DungeonLocation *location, u16 *moves); void sub_808D0D8(Pokemon *pokemon); void ConvertStoryMonToPokemon(Pokemon *dst, const struct StoryMonData *src); Pokemon *TryAddPokemonToRecruited(Pokemon*); Pokemon *sub_808D278(s32 species); Pokemon *TryAddLevel1PokemonToRecruited(s32 species, u8 *name, u32 _itemID, const DungeonLocation *location, u16 *moveID); -void sub_808D31C(Pokemon *param_1); +void TryResetPokemonFlags(Pokemon *pokemon); Pokemon *GetPlayerPokemonStruct(void); -Pokemon *sub_808D378(void); +Pokemon *GetPartnerPokemonStruct(void); Pokemon *sub_808D3BC(void); Pokemon *sub_808D3F8(void); Pokemon *GetRecruitedMonBySpecies(s16 species_, s32 sameSpeciesCounter); @@ -113,7 +113,7 @@ bool8 CanMonLearnMove(u16 moveID, s16 _species); s32 sub_808E218(unkStruct_808E218_arg* a1, Pokemon* pokemon); s32 GetEvolutionSequence(Pokemon* pokemon, EvolveStage* a2); s32 sub_808E400(s32 _species, s16* _a2, bool32 _bodySizeCheck, bool32 _shedinjaCheck); -void sub_808E490(Move* a1, s32 species); +void InitializeLevel1MovesBySpecies(Move* moves, s32 species); char* sub_808E4FC(s32 a1); char* sub_808E51C(s32 a1); void InitShadowSprites(s32 param_1, s32 param_2); diff --git a/src/friend_area_action_menu.c b/src/friend_area_action_menu.c index 606f0db88..a3eb815ee 100644 --- a/src/friend_area_action_menu.c +++ b/src/friend_area_action_menu.c @@ -530,7 +530,7 @@ void sub_8027A78(void) else { sub_8027EB8(); - sub_808D31C(sUnknown_203B2BC->pokeStruct); + TryResetPokemonFlags(sUnknown_203B2BC->pokeStruct); } break; } @@ -550,7 +550,7 @@ void sub_8027AE4(void) break; case FRIEND_AREA_ACTION_MENU_ACTION_YES: sub_8027EB8(); - sub_808D31C(sUnknown_203B2BC->pokeStruct); + TryResetPokemonFlags(sUnknown_203B2BC->pokeStruct); break; } } diff --git a/src/main_loops.c b/src/main_loops.c index 86793c6df..5b49509a3 100644 --- a/src/main_loops.c +++ b/src/main_loops.c @@ -979,20 +979,20 @@ void sub_8001064(void) if (sTeamBasicInfo_203B040.StarterName[0] == '\0') { CopyMonsterNameToBuffer(buffer1, sTeamBasicInfo_203B040.StarterID); CopyStringtoBuffer(buffer2, buffer1); - sub_808CE74(sTeamBasicInfo_203B040.StarterID, TRUE, buffer2); + CreateLeaderPartnerData(sTeamBasicInfo_203B040.StarterID, TRUE, buffer2); } else - sub_808CE74(sTeamBasicInfo_203B040.StarterID, TRUE, sTeamBasicInfo_203B040.StarterName); + CreateLeaderPartnerData(sTeamBasicInfo_203B040.StarterID, TRUE, sTeamBasicInfo_203B040.StarterName); } - if (sub_808D378() == NULL) { + if (GetPartnerPokemonStruct() == NULL) { if (sTeamBasicInfo_203B040.PartnerNick[0] == '\0') { CopyMonsterNameToBuffer(buffer1, sTeamBasicInfo_203B040.PartnerID); CopyStringtoBuffer(buffer2, buffer1); - sub_808CE74(sTeamBasicInfo_203B040.PartnerID, FALSE, buffer2); + CreateLeaderPartnerData(sTeamBasicInfo_203B040.PartnerID, FALSE, buffer2); } else - sub_808CE74(sTeamBasicInfo_203B040.PartnerID, FALSE, sTeamBasicInfo_203B040.PartnerNick); + CreateLeaderPartnerData(sTeamBasicInfo_203B040.PartnerID, FALSE, sTeamBasicInfo_203B040.PartnerNick); } if (sTeamBasicInfo_203B040.StarterID != MONSTER_NONE) { diff --git a/src/party_list_menu.c b/src/party_list_menu.c index 7a49148b1..c412130af 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -343,7 +343,7 @@ static void HandlePartyListMenuCallback(void) break; case 9: sub_8026FA4(); - sub_808D31C(sUnknown_203B2B8->pokeStruct); + TryResetPokemonFlags(sUnknown_203B2B8->pokeStruct); sUnknown_203B2B8->unk8 = TRUE; break; case PARTY_LIST_STATE_GIVEN_ITEM: diff --git a/src/pokemon.c b/src/pokemon.c index 7f9ea1eef..eec8d791a 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -68,7 +68,7 @@ void InitializeRecruitedPokemon(void) } } -void sub_808CE74(s16 _species, bool32 _isLeader, u8* name) +void CreateLeaderPartnerData(s16 _species, bool32 _isLeader, u8* name) { struct Pokemon pokemon; u8 name_buffer[20]; @@ -102,7 +102,7 @@ void sub_808CE74(s16 _species, bool32 _isLeader, u8* name) pokemon.currExp = 0; pokemon.tacticIndex = TACTIC_LETS_GO_TOGETHER; pokemon.dungeonLocation.floor = 0; - sub_808E490(pokemon.moves, species); + InitializeLevel1MovesBySpecies(pokemon.moves, species); if (name == NULL) { CopyMonsterNameToBuffer(name_buffer, species); @@ -165,7 +165,7 @@ void CreateLevel1Pokemon(Pokemon *pokemon, s16 _species, u8* name, u32 _itemID, } } else { - sub_808E490(pokemon->moves, species); + InitializeLevel1MovesBySpecies(pokemon->moves, species); } if (name == NULL) { @@ -192,7 +192,7 @@ void sub_808D0D8(Pokemon *pokemon) pokemon->tacticIndex = TACTIC_LETS_GO_TOGETHER; pokemon->IQ = 1; SetDefaultIQSkills(&pokemon->IQSkills, FALSE); - sub_808E490(pokemon->moves, pokemon->speciesNum); + InitializeLevel1MovesBySpecies(pokemon->moves, pokemon->speciesNum); } void ConvertStoryMonToPokemon(Pokemon *dst, const struct StoryMonData *src) @@ -281,10 +281,10 @@ Pokemon *TryAddLevel1PokemonToRecruited(s32 species, u8 *name, u32 _itemID, cons return TryAddPokemonToRecruited(&pokemon); } -void sub_808D31C(Pokemon *param_1) +void TryResetPokemonFlags(Pokemon *pokemon) { - if ((!IsMonTeamLeader(param_1)) && !IsMonPartner(param_1)) - param_1->flags = 0; + if ((!IsMonTeamLeader(pokemon)) && !IsMonPartner(pokemon)) + pokemon->flags = 0; } Pokemon * GetPlayerPokemonStruct(void) @@ -302,7 +302,7 @@ Pokemon * GetPlayerPokemonStruct(void) return NULL; } -Pokemon * sub_808D378(void) +Pokemon * GetPartnerPokemonStruct(void) { s32 index; @@ -1247,13 +1247,13 @@ s32 sub_808E400(s32 _species, s16* _a2, bool32 _bodySizeCheck, bool32 _shedinjaC return count; } -void sub_808E490(Move* a1, s32 species) +void InitializeLevel1MovesBySpecies(Move* moves, s32 _species) { u16 buffer[0x10]; // of moveIDs s32 i; - s16 index_s32 = species; + s16 species = _species; - s32 count = GetMovesLearnedAtLevel(buffer, index_s32, 1, 999); + s32 count = GetMovesLearnedAtLevel(buffer, species, 1, 999); if (count == 0) { count = 1; buffer[0] = MOVE_ITEM_TOSS; @@ -1262,13 +1262,13 @@ void sub_808E490(Move* a1, s32 species) i = 0; if (i < count) { while (i < count) { - InitZeroedPPPokemonMove(&a1[i], buffer[i]); + InitZeroedPPPokemonMove(&moves[i], buffer[i]); i++; } i = count; } while (i < MAX_MON_MOVES) { - a1[i].moveFlags = 0; + moves[i].moveFlags = 0; i++; } } diff --git a/src/pokemon_mail.c b/src/pokemon_mail.c index b720bb476..8235eeddb 100644 --- a/src/pokemon_mail.c +++ b/src/pokemon_mail.c @@ -431,7 +431,7 @@ bool8 sub_803C110(s16 index) pokeStruct = GetPlayerPokemonStruct(); if (pokeStruct->speciesNum == species_s32) return FALSE; - pokeStruct = sub_808D378(); + pokeStruct = GetPartnerPokemonStruct(); if (pokeStruct->speciesNum == species_s32) return FALSE; } From 3c773fc4533d03ae0281ca59432d1c9853609fd5 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 27 Nov 2025 14:29:08 -0300 Subject: [PATCH 2/3] PokemonIsOnTeam --- include/pokemon.h | 2 +- src/code_801AFA4.c | 2 +- src/code_801D014.c | 2 +- src/debug_menu3.c | 2 +- src/dungeon_info.c | 8 ++++---- src/dungeon_misc.c | 2 +- src/friend_area_action_menu.c | 2 +- src/friend_list.c | 14 +++++++------- src/ground_script.c | 2 +- src/items.c | 2 +- src/luminous_cave.c | 2 +- src/main_loops.c | 4 ++-- src/party_list_menu.c | 4 ++-- src/pokemon.c | 18 +++++++++--------- src/run_dungeon.c | 4 ++-- 15 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index a56277ec0..5dd8fbc57 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -129,7 +129,7 @@ static inline bool8 DungeonMonExists(DungeonMon *mon) return (mon->flags & POKEMON_FLAG_EXISTS) != 0; } -static inline bool8 PokemonFlag2(Pokemon *mon) +static inline bool8 PokemonIsOnTeam(Pokemon *mon) { return (mon->flags & POKEMON_FLAG_ON_TEAM) != 0; } diff --git a/src/code_801AFA4.c b/src/code_801AFA4.c index 8586c6fce..9b7240cd5 100644 --- a/src/code_801AFA4.c +++ b/src/code_801AFA4.c @@ -221,7 +221,7 @@ UNUSED static bool8 sub_801B374(u8 id) moveID = GetItemMoveID(id); for (i = 0; i < NUM_MONSTERS; i++, pokeStruct++) { - if (PokemonFlag2(pokeStruct)) + if (PokemonIsOnTeam(pokeStruct)) if (CanMonLearnMove(moveID, pokeStruct->speciesNum)) return FALSE; } diff --git a/src/code_801D014.c b/src/code_801D014.c index 7b36fb649..2b26ac7d0 100644 --- a/src/code_801D014.c +++ b/src/code_801D014.c @@ -154,7 +154,7 @@ u32 sub_801D178(void) if ((s16) sub_80A7AE8(7) < 0) return 0; - if (PokemonFlag2(sub_808D3F8())) + if (PokemonIsOnTeam(sub_808D3F8())) return 0; return 4; diff --git a/src/debug_menu3.c b/src/debug_menu3.c index eca526f58..74bfe6b0d 100644 --- a/src/debug_menu3.c +++ b/src/debug_menu3.c @@ -219,7 +219,7 @@ static bool8 sub_803ABC8(void) Pokemon *mon = &gRecruitedPokemonRef->pokemon[i]; if (PokemonExists(mon) - && PokemonFlag2(mon) + && PokemonIsOnTeam(mon) && sUnknown_203B3F4->friendArea == GetFriendArea(mon->speciesNum)) return FALSE; diff --git a/src/dungeon_info.c b/src/dungeon_info.c index 79c88ef38..1adbe113b 100644 --- a/src/dungeon_info.c +++ b/src/dungeon_info.c @@ -2563,7 +2563,7 @@ u32 BufferDungeonRequirementsText(u8 dungeonIndex, s32 speciesId_, u8 *buffer, b for (i = 0; i < NUM_MONSTERS; i++) { struct Pokemon *mon = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(mon) && PokemonFlag2(mon)) { + if (PokemonExists(mon) && PokemonIsOnTeam(mon)) { if (mon->heldItem.id != 0) { sp_0xf0++; } @@ -2608,7 +2608,7 @@ u32 BufferDungeonRequirementsText(u8 dungeonIndex, s32 speciesId_, u8 *buffer, b for (i = 0; i < NUM_MONSTERS; i++) { struct Pokemon *mon = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(mon) && PokemonFlag2(mon)){ + if (PokemonExists(mon) && PokemonIsOnTeam(mon)){ bodySize += GetBodySize(mon->speciesNum); } } @@ -2652,7 +2652,7 @@ u32 BufferDungeonRequirementsText(u8 dungeonIndex, s32 speciesId_, u8 *buffer, b for (otherSpeciesId = 0; otherSpeciesId < NUM_MONSTERS; otherSpeciesId++) { struct Pokemon *mon = &gRecruitedPokemonRef->pokemon[otherSpeciesId]; - if (PokemonExists(mon) && PokemonFlag2(mon) + if (PokemonExists(mon) && PokemonIsOnTeam(mon) && (GetPokemonType(mon->speciesNum,0) == TYPE_WATER || GetPokemonType(mon->speciesNum,1) == TYPE_WATER)) { break; @@ -2722,7 +2722,7 @@ static bool8 TeamMonWithMove(u16 moveID) for (speciesId = 0; speciesId < NUM_MONSTERS; speciesId++) { Pokemon *pokeStruct = &gRecruitedPokemonRef->pokemon[speciesId]; - if (PokemonExists(pokeStruct) && PokemonFlag2(pokeStruct)) { + if (PokemonExists(pokeStruct) && PokemonIsOnTeam(pokeStruct)) { for (moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++) { Move *move = &pokeStruct->moves[moveIndex]; if (MoveFlagExists(move) && move->id == moveID) { diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 9274e7af1..6a5580600 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -191,7 +191,7 @@ void SetDungeonMonsFromTeam(void) for (recruitedId = 0; recruitedId < NUM_MONSTERS; recruitedId++) { Pokemon lvl1Mon; Pokemon *pokeStruct = &gRecruitedPokemonRef->pokemon[recruitedId]; - if (PokemonExists(pokeStruct) && PokemonFlag2(pokeStruct)) { + if (PokemonExists(pokeStruct) && PokemonIsOnTeam(pokeStruct)) { RecruitedPokemonToDungeonMon(&gRecruitedPokemonRef->dungeonTeam[index],recruitedId); if (IsLevelResetDungeon(gDungeon->unk644.dungeonLocation.id)) { struct DungeonLocation dungeonLoc = {.id = DUNGEON_TINY_WOODS, .floor = 1}; diff --git a/src/friend_area_action_menu.c b/src/friend_area_action_menu.c index a3eb815ee..bae42e9b9 100644 --- a/src/friend_area_action_menu.c +++ b/src/friend_area_action_menu.c @@ -242,7 +242,7 @@ void CreateFriendActionMenu(void) pokeStruct = &gRecruitedPokemonRef->pokemon[sUnknown_203B2BC->targetPoke]; MemoryFill16(sUnknown_203B2BC->unk16C,0,sizeof(sUnknown_203B2BC->unk16C)); - if (PokemonFlag2(pokeStruct)) { + if (PokemonIsOnTeam(pokeStruct)) { sUnknown_203B2BC->menuItems[loopMax].text = sStandBy; sUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_STANDBY; if(!sub_8027D9C(pokeStruct)) diff --git a/src/friend_list.c b/src/friend_list.c index 7c026a854..eb5331c79 100644 --- a/src/friend_list.c +++ b/src/friend_list.c @@ -261,7 +261,7 @@ void FriendList_ShowWindow(void) Pokemon *pokePtr = &gRecruitedPokemonRef->pokemon[id]; u8 color = 7; - if (PokemonFlag2(pokePtr)) { + if (PokemonIsOnTeam(pokePtr)) { if (IsMonPartner(pokePtr)) { color = 6; } @@ -316,7 +316,7 @@ static s32 sub_8023F8C(void) if (!sFriendList->unk16) { for (i = 0; i < NUM_MONSTERS; i++) { pokeStruct = &gRecruitedPokemonRef->pokemon[i]; - if (IsMonPartner(pokeStruct) && !pokeStruct->isTeamLeader && PokemonFlag2(pokeStruct) && PokemonExists(pokeStruct)) { + if (IsMonPartner(pokeStruct) && !pokeStruct->isTeamLeader && PokemonIsOnTeam(pokeStruct) && PokemonExists(pokeStruct)) { sFriendList->unk1A[sFriendList->unk8++] = i; break; } @@ -327,7 +327,7 @@ static s32 sub_8023F8C(void) if (!sFriendList->unk17) { for (i = 0; i < NUM_MONSTERS; i++) { pokeStruct = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonFlag2(pokeStruct) && PokemonExists(pokeStruct) && !pokeStruct->isTeamLeader && !IsMonPartner(pokeStruct)) { + if (PokemonIsOnTeam(pokeStruct) && PokemonExists(pokeStruct) && !pokeStruct->isTeamLeader && !IsMonPartner(pokeStruct)) { sFriendList->unk1A[sFriendList->unk8++] = i; if (sFriendList->unk8 >= 4) { break; @@ -340,7 +340,7 @@ static s32 sub_8023F8C(void) if (!sFriendList->unk14) { for (i = 0; i < NUM_MONSTERS; i++) { pokeStruct = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(pokeStruct) && !PokemonFlag2(&gRecruitedPokemonRef->pokemon[i])) { + if (PokemonExists(pokeStruct) && !PokemonIsOnTeam(&gRecruitedPokemonRef->pokemon[i])) { sFriendList->unk1A[sFriendList->unk8++] = i; } } @@ -358,16 +358,16 @@ bool8 sub_8024108(s32 param_1) Pokemon *pokeStruct = &gRecruitedPokemonRef->pokemon[i]; if (PokemonExists(pokeStruct)) { if (param_1 == 2) { - if (!PokemonFlag2(pokeStruct)) continue; + if (!PokemonIsOnTeam(pokeStruct)) continue; } else if (param_1 == 3) { - if (PokemonFlag2(pokeStruct)) continue; + if (PokemonIsOnTeam(pokeStruct)) continue; } else if (param_1 == 4) { if (pokeStruct->isTeamLeader) continue; if (!sub_80023E4(9)) { if (!IsMonPartner(pokeStruct)) return FALSE; - if (PokemonFlag2(pokeStruct)) continue; + if (PokemonIsOnTeam(pokeStruct)) continue; } } return FALSE; diff --git a/src/ground_script.c b/src/ground_script.c index c8af437df..738a1a0a0 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -3103,7 +3103,7 @@ static s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3) { Pokemon *ptr = sub_80A8D54((s16) r2); if (ptr) - return PokemonFlag2(ptr); + return PokemonIsOnTeam(ptr); } return 0; case 0x14: diff --git a/src/items.c b/src/items.c index d164cacd8..49dd1e1aa 100644 --- a/src/items.c +++ b/src/items.c @@ -587,7 +587,7 @@ s32 GetItemPossessionCount(u8 id) for (i = 0; i < NUM_MONSTERS; i++) { Pokemon *mon = &gRecruitedPokemonRef->pokemon[i]; if (PokemonExists(mon) - && PokemonFlag2(mon) + && PokemonIsOnTeam(mon) && (mon->heldItem.id != ITEM_NOTHING) && (mon->heldItem.id == id)) { diff --git a/src/luminous_cave.c b/src/luminous_cave.c index fe4a679ee..ed33f518c 100644 --- a/src/luminous_cave.c +++ b/src/luminous_cave.c @@ -746,7 +746,7 @@ static bool8 LuminousCave_HasOnly1Member(void) mon = &gRecruitedPokemonRef->pokemon[0]; memberCount = 0; for (i = 0; i < NUM_MONSTERS; i++, mon++) { - if (PokemonFlag2(mon)) + if (PokemonIsOnTeam(mon)) memberCount++; } diff --git a/src/main_loops.c b/src/main_loops.c index 5b49509a3..7a639d204 100644 --- a/src/main_loops.c +++ b/src/main_loops.c @@ -1071,7 +1071,7 @@ static void RemoveMoneyAndRandomItems(void) for (i = 0; i < NUM_MONSTERS; i++) { Pokemon *mon = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(mon) && PokemonFlag2(mon)) + if (PokemonExists(mon) && PokemonIsOnTeam(mon)) mon->heldItem.id = ITEM_NOTHING; } @@ -1091,7 +1091,7 @@ static void RemoveAllMoneyAndItems(void) for (i = 0; i < NUM_MONSTERS; i++) { Pokemon *mon = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(mon) && PokemonFlag2(mon)) + if (PokemonExists(mon) && PokemonIsOnTeam(mon)) mon->heldItem.id = ITEM_NOTHING; } diff --git a/src/party_list_menu.c b/src/party_list_menu.c index c412130af..629e8ce1e 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -383,7 +383,7 @@ static void PartyListMenu_CreateMenu1(void) PeekPokemonItem(sUnknown_203B2B8->pokeSpecies, &sUnknown_203B2B8->item2); - if (PokemonFlag2(pokeStruct)) + if (PokemonIsOnTeam(pokeStruct)) { sUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuStandBy; sUnknown_203B2B8->unk16C[loopMax].menuAction = PARTY_LIST_MENU_STANDBY; @@ -435,7 +435,7 @@ static void PartyListMenu_CreateMenu1(void) } loopMax += 1; - if (!PokemonFlag2(pokeStruct)) + if (!PokemonIsOnTeam(pokeStruct)) { sUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuSayFarewell; sUnknown_203B2B8->unk16C[loopMax].menuAction = PARTY_LIST_MENU_SAY_FAREWELL; diff --git a/src/pokemon.c b/src/pokemon.c index eec8d791a..58440da1e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -387,7 +387,7 @@ bool8 sub_808D4B0(void) flag = FALSE; for(index = 0; index < NUM_MONSTERS; index++, pokeStruct++) { - if(PokemonFlag2(pokeStruct) && !IsMonTeamLeader(pokeStruct) && !IsMonPartner(pokeStruct)){ + if(PokemonIsOnTeam(pokeStruct) && !IsMonTeamLeader(pokeStruct) && !IsMonPartner(pokeStruct)){ flag = TRUE; pokeStruct->flags &= 0xFFFD; } @@ -405,7 +405,7 @@ bool8 sub_808D500(void) flag = FALSE; for(index = 0; index < NUM_MONSTERS; index++, pokeStruct++) { - if(PokemonFlag2(pokeStruct) && !IsMonTeamLeader(pokeStruct)){ + if(PokemonIsOnTeam(pokeStruct) && !IsMonTeamLeader(pokeStruct)){ flag = TRUE; pokeStruct->flags &= 0xFFFD; } @@ -420,7 +420,7 @@ s32 GetUnitSum_808D544(s32 *team) count = 0; for (i = 0; i < NUM_MONSTERS; i++, mon++) { - if (PokemonFlag2(mon)) { + if (PokemonIsOnTeam(mon)) { if (team != NULL) { team[count] = i; } @@ -451,7 +451,7 @@ s32 sub_808D580(s32 *team) for(mon = gRecruitedPokemonRef->pokemon, index = 0; index < NUM_MONSTERS; index++, mon++) { - if (((IsMonPartner(mon) && !IsMonTeamLeader(mon) && PokemonFlag2(mon)) && (PokemonExists(mon))) && + if (((IsMonPartner(mon) && !IsMonTeamLeader(mon) && PokemonIsOnTeam(mon)) && (PokemonExists(mon))) && ((((team != NULL))))) { team[counter] = index; @@ -463,7 +463,7 @@ s32 sub_808D580(s32 *team) for(mon = gRecruitedPokemonRef->pokemon, index = 0; index < NUM_MONSTERS; index++, mon++) { - if ((((PokemonFlag2(mon)) && (PokemonExists(mon))) && + if ((((PokemonIsOnTeam(mon)) && (PokemonExists(mon))) && (!IsMonTeamLeader(mon))) && (((!IsMonPartner(mon) && (team != NULL))))) { team[counter] = index; @@ -481,7 +481,7 @@ s32 sub_808D654(s32 *ptr) s32 *ptr2; for (i = 0, ptr2 = ptr; i < NUM_MONSTERS; i++, mon++) { - if (PokemonFlag2(mon) && !IsMonTeamLeader(mon) && !IsMonPartner(mon)) { + if (PokemonIsOnTeam(mon) && !IsMonTeamLeader(mon) && !IsMonPartner(mon)) { if (ptr != NULL) { *ptr2 = i; } @@ -502,7 +502,7 @@ s32 sub_808D6A4(s32 *ptr) s32 *ptr2; for (i = 0, ptr2 = ptr; i < NUM_MONSTERS; i++, mon++) { - if (PokemonFlag2(mon) && !IsMonTeamLeader(mon)) { + if (PokemonIsOnTeam(mon) && !IsMonTeamLeader(mon)) { if (ptr != NULL) { *ptr2 = i; } @@ -521,7 +521,7 @@ UNUSED static bool8 sub_808D6E8(void) s32 size_count = 0; for (i = 0; i < NUM_MONSTERS; i++) { Pokemon* pokemon = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(pokemon) && PokemonFlag2(pokemon)) { + if (PokemonExists(pokemon) && PokemonIsOnTeam(pokemon)) { size_count += GetBodySize(pokemon->speciesNum); count++; } @@ -542,7 +542,7 @@ bool8 sub_808D750(s32 index_) for (i = 0; i < NUM_MONSTERS; i++) { pokemon = &gRecruitedPokemonRef->pokemon[i]; - if (PokemonExists(pokemon) && PokemonFlag2(pokemon)) { + if (PokemonExists(pokemon) && PokemonIsOnTeam(pokemon)) { size_count += GetBodySize(pokemon->speciesNum); count++; } diff --git a/src/run_dungeon.c b/src/run_dungeon.c index b95c39e0b..e92374441 100644 --- a/src/run_dungeon.c +++ b/src/run_dungeon.c @@ -819,7 +819,7 @@ static void sub_8043FD0(void) s32 i, monId, movesCount; for (monId = 0; monId < NUM_MONSTERS; monId++) { Pokemon *monStruct = &gRecruitedPokemonRef->pokemon[monId]; - if (PokemonExists(monStruct) && PokemonFlag2(monStruct)) { + if (PokemonExists(monStruct) && PokemonIsOnTeam(monStruct)) { u16 learnedMoves[16]; LevelData levelData; // I have to make the variables volatile to get matching code. I'm sure there's a solution for this, but keeping it like that for now. @@ -886,7 +886,7 @@ void EnforceMaxItemsAndMoney(void) } for (i = 0; i < NUM_MONSTERS; i++) { Pokemon *mon = (&gRecruitedPokemonRef->pokemon[i]); - if (PokemonExists(mon) && PokemonFlag2(mon)) { + if (PokemonExists(mon) && PokemonIsOnTeam(mon)) { mon->heldItem.id = 0; } } From b35329f119ca4077ef471856f728d98aaf394127 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Thu, 27 Nov 2025 14:29:52 -0300 Subject: [PATCH 3/3] DungeonMonIsOnTeam --- include/pokemon.h | 2 +- src/dungeon_misc.c | 2 +- src/dungeon_mon_spawn.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 5dd8fbc57..183b1d9c9 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -134,7 +134,7 @@ static inline bool8 PokemonIsOnTeam(Pokemon *mon) return (mon->flags & POKEMON_FLAG_ON_TEAM) != 0; } -static inline bool8 PokemonFlag2Struct2(DungeonMon *mon) +static inline bool8 DungeonMonIsOnTeam(DungeonMon *mon) { return (mon->flags & POKEMON_FLAG_ON_TEAM) != 0; } diff --git a/src/dungeon_misc.c b/src/dungeon_misc.c index 6a5580600..a7701e608 100644 --- a/src/dungeon_misc.c +++ b/src/dungeon_misc.c @@ -92,7 +92,7 @@ void LoadDungeonPokemonSprites(void) { DungeonMon *ptr = &gRecruitedPokemonRef->dungeonTeam[index]; if(DungeonMonExists(ptr)) - if(PokemonFlag2Struct2(ptr)) + if(DungeonMonIsOnTeam(ptr)) LoadPokemonSprite(ptr->speciesNum, FALSE); } if(gDungeon->fixedRoomNumber == FIXED_ROOM_RESCUE_TEAM_MAZE_BOSS) diff --git a/src/dungeon_mon_spawn.c b/src/dungeon_mon_spawn.c index 5c2547a64..069c428bc 100644 --- a/src/dungeon_mon_spawn.c +++ b/src/dungeon_mon_spawn.c @@ -191,7 +191,7 @@ UNUSED static s32 sub_806B09C(SpawnPokemonData *unkPtr, bool8 a1) for (i = 0, unk2Field = unkPtr->randNum, loopPtr = unkPtr; i < MAX_TEAM_MEMBERS; i++) { DungeonMon *monStructPtr = &gRecruitedPokemonRef->dungeonTeam[i]; - if (DungeonMonExists(monStructPtr) && PokemonFlag2Struct2(monStructPtr)) + if (DungeonMonExists(monStructPtr) && DungeonMonIsOnTeam(monStructPtr)) { for (j = 0; j < count; j++) { if (ExtractSpeciesIndex(&unkPtr[j]) == monStructPtr->speciesNum) @@ -237,7 +237,7 @@ void sub_806B168(void) count = 0; for (i = 0; i < MAX_TEAM_MEMBERS; i++) { DungeonMon *currMonPtr = &gRecruitedPokemonRef->dungeonTeam[i]; - if (DungeonMonExists(currMonPtr) && PokemonFlag2Struct2(currMonPtr)) { + if (DungeonMonExists(currMonPtr) && DungeonMonIsOnTeam(currMonPtr)) { monPtrs[count++] = currMonPtr; } } @@ -339,7 +339,7 @@ void sub_806B404(void) for (i = 0; i < MAX_TEAM_MEMBERS; i++) { DungeonMon *currMonPtr = &gRecruitedPokemonRef->dungeonTeam[i]; - if (DungeonMonExists(currMonPtr) && PokemonFlag2Struct2(currMonPtr) && currMonPtr->recruitedPokemonId == UNK_RECRUITED_POKEMON_ID_55AA) { + if (DungeonMonExists(currMonPtr) && DungeonMonIsOnTeam(currMonPtr) && currMonPtr->recruitedPokemonId == UNK_RECRUITED_POKEMON_ID_55AA) { monPtrs[count++] = currMonPtr; break; } @@ -367,7 +367,7 @@ void sub_806B404(void) s32 j; DungeonMon *currMonPtr = monPtrs[i]; - if (currMonPtr != NULL && DungeonMonExists(currMonPtr) && PokemonFlag2Struct2(currMonPtr) && currMonPtr->recruitedPokemonId == UNK_RECRUITED_POKEMON_ID_55AA) { + if (currMonPtr != NULL && DungeonMonExists(currMonPtr) && DungeonMonIsOnTeam(currMonPtr) && currMonPtr->recruitedPokemonId == UNK_RECRUITED_POKEMON_ID_55AA) { currMonPtr->recruitedPokemonId = UNK_RECRUITED_POKEMON_ID_5AA5; skipNextLoop = FALSE; j = 0;