mirror of
https://github.com/pret/pmd-red.git
synced 2026-03-21 17:46:39 -05:00
PokemonIsOnTeam
This commit is contained in:
parent
c3f34173f7
commit
3c773fc453
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user