summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGriffinR <griffin.richards@comcast.net>2019-10-31 21:33:01 -0400
committerGriffinR <griffin.richards@comcast.net>2019-10-31 21:33:01 -0400
commit27169f634b27a8985945e8b592f3f4ce0a38c53e (patch)
tree0b1dcafcd7c13cc11744b2cc9afbc33917040888
parentb1ea2592c30a2e5af547dfc69cef56eb65ae85ba (diff)
Review changes for party menu doc
-rw-r--r--include/battle_main.h2
-rw-r--r--include/constants/global.h2
-rw-r--r--include/global.h12
-rw-r--r--include/party_menu.h1
-rw-r--r--src/battle_main.c12
-rwxr-xr-xsrc/party_menu.c18
6 files changed, 24 insertions, 23 deletions
diff --git a/include/battle_main.h b/include/battle_main.h
index fe88204bf..e04db17bb 100644
--- a/include/battle_main.h
+++ b/include/battle_main.h
@@ -84,7 +84,7 @@ void RunBattleScriptCommands_PopCallbacksStack(void);
void RunBattleScriptCommands(void);
bool8 TryRunFromBattle(u8 battlerId);
-extern struct UnknownPokemonStruct4 gMultiPartnerParty[PARTY_SIZE / 2];
+extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE];
extern const struct SpriteTemplate gUnknown_0831AC88;
extern const struct OamData gOamData_831ACA8;
diff --git a/include/constants/global.h b/include/constants/global.h
index ca48c1d2a..4ade1c823 100644
--- a/include/constants/global.h
+++ b/include/constants/global.h
@@ -54,6 +54,8 @@
#define TRAINER_ID_LENGTH 4
#define PARTY_SIZE 6
+#define FRONTIER_PARTY_SIZE 3
+#define MULTI_PARTY_SIZE PARTY_SIZE / 2
#define MAX_MON_MOVES 4
// string lengths
diff --git a/include/global.h b/include/global.h
index 5fd49f773..94dfebc28 100644
--- a/include/global.h
+++ b/include/global.h
@@ -220,7 +220,7 @@ struct Apprentice
u8 lvlMode:2; // + 1
u8 field_1;
u8 number;
- struct ApprenticeMon party[3];
+ struct ApprenticeMon party[MULTI_PARTY_SIZE];
u16 easyChatWords[6];
u8 playerId[TRAINER_ID_LENGTH];
u8 playerName[PLAYER_NAME_LENGTH];
@@ -282,7 +282,7 @@ struct BattleTowerEReaderTrainer
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 farewellPlayerLost[6];
/*0x28*/ u16 farewellPlayerWon[6];
- /*0x34*/ struct BattleTowerPokemon party[3];
+ /*0x34*/ struct BattleTowerPokemon party[FRONTIER_PARTY_SIZE];
/*0xB8*/ u32 checksum;
};
@@ -329,7 +329,7 @@ struct BattleFrontier
/*0xCA9*/ u8 field_CA9_d:1; // 0x20
/*0xCA9*/ u8 field_CA9_e:1; // 0x40
/*0xCA9*/ u8 field_CA9_f:1; // 0x80
- /*0xCAA*/ u16 selectedPartyMons[3];
+ /*0xCAA*/ u16 selectedPartyMons[FRONTIER_PARTY_SIZE];
/*0xCB0*/ u16 field_CB0;
/*0xCB2*/ u16 curChallengeBattleNum; // In case of battle pyramid, the floor.
/*0xCB4*/ u16 trainerIds[20];
@@ -356,7 +356,7 @@ struct BattleFrontier
/*0xD14*/ u16 domeRecordWinStreaks[2][2];
/*0xD1C*/ u16 domeTotalChampionships[2][2];
/*0xD24*/ struct BattleDomeTrainer domeTrainers[DOME_TOURNAMENT_TRAINERS_COUNT];
- /*0xD64*/ u16 domeMonIds[DOME_TOURNAMENT_TRAINERS_COUNT][3];
+ /*0xD64*/ u16 domeMonIds[DOME_TOURNAMENT_TRAINERS_COUNT][FRONTIER_PARTY_SIZE];
/*0xDC4*/ u16 field_DC4;
/*0xDC6*/ u16 field_DC6;
/*0xDC8*/ u16 palaceWinStreaks[2][2];
@@ -375,7 +375,7 @@ struct BattleFrontier
/*0xE10*/ u8 pikeHintedRoomIndex:3;
/*0xE10*/ u8 pikeHintedRoomType:4;
/*0xE10*/ u8 pikeHealingRoomsDisabled:1;
- /*0xE12*/ u16 pikeHeldItemsBackup[3];
+ /*0xE12*/ u16 pikeHeldItemsBackup[FRONTIER_PARTY_SIZE];
/*0xE18*/ u16 pyramidRewardItem;
/*0xE1A*/ u16 pyramidWinStreaks[2];
/*0xE1E*/ u16 pyramidRecordStreaks[2];
@@ -419,7 +419,7 @@ struct PlayersApprentice
/*0xB2*/ u8 field_B2_0:3;
/*0xB2*/ u8 field_B2_1:2;
/*0xB3*/ u8 field_B3;
- /*0xB4*/ u8 monIds[3];
+ /*0xB4*/ u8 monIds[MULTI_PARTY_SIZE];
/*0xB8*/ struct Sav2_B8 field_B8[9];
};
diff --git a/include/party_menu.h b/include/party_menu.h
index 0140901c1..126931762 100644
--- a/include/party_menu.h
+++ b/include/party_menu.h
@@ -12,7 +12,6 @@ struct PartyMenu
TaskFunc task;
u8 menuType:4;
u8 layout:2;
- u8 unused:2;
s8 slotId;
s8 slotId2;
u8 action;
diff --git a/src/battle_main.c b/src/battle_main.c
index 7ae8d5c46..8a4479119 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -167,7 +167,7 @@ EWRAM_DATA static u32 sUnusedUnknownArray[25] = {0};
EWRAM_DATA u32 gBattleTypeFlags = 0;
EWRAM_DATA u8 gBattleTerrain = 0;
EWRAM_DATA u32 gUnknown_02022FF4 = 0;
-EWRAM_DATA struct UnknownPokemonStruct4 gMultiPartnerParty[PARTY_SIZE / 2] = {0};
+EWRAM_DATA struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE] = {0};
EWRAM_DATA static struct UnknownPokemonStruct4* sMultiPartnerPartyBuffer = NULL;
EWRAM_DATA u8 *gUnknown_0202305C = NULL;
EWRAM_DATA u8 *gUnknown_02023060 = NULL;
@@ -1249,12 +1249,12 @@ static void CB2_HandleStartMultiPartnerBattle(void)
if (gLinkPlayers[playerMultiplayerId].id != 0)
{
memcpy(gPlayerParty, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
- memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2);
+ memcpy(gPlayerParty + MULTI_PARTY_SIZE, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2);
}
else
{
memcpy(gPlayerParty, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2);
- memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
+ memcpy(gPlayerParty + MULTI_PARTY_SIZE, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
}
gBattleCommunication[MULTIUSE_STATE]++;
}
@@ -1667,7 +1667,7 @@ static void CB2_HandleStartMultiBattle(void)
break;
case 1:
case 2:
- memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
+ memcpy(gPlayerParty + MULTI_PARTY_SIZE, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
break;
}
}
@@ -1684,7 +1684,7 @@ static void CB2_HandleStartMultiBattle(void)
break;
case 1:
case 2:
- memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
+ memcpy(gPlayerParty + MULTI_PARTY_SIZE, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
break;
}
}
@@ -1698,7 +1698,7 @@ static void CB2_HandleStartMultiBattle(void)
break;
case 1:
case 2:
- memcpy(gEnemyParty + PARTY_SIZE / 2, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
+ memcpy(gEnemyParty + MULTI_PARTY_SIZE, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
break;
}
}
diff --git a/src/party_menu.c b/src/party_menu.c
index 55243c1cf..c711881b0 100755
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -155,7 +155,7 @@ static EWRAM_DATA u16 *sSlot2TilemapBuffer = 0; //
EWRAM_DATA u8 gSelectedOrderFromParty[4] = {0};
static EWRAM_DATA u16 sPartyMenuItemId = 0;
static EWRAM_DATA u16 sUnused_0203CEFE = 0;
-EWRAM_DATA u8 gBattlePartyCurrentOrder[3] = {0}; // bits 0-3 are the current pos of Slot 1, 4-7 are Slot 2, and so on
+EWRAM_DATA u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2] = {0}; // bits 0-3 are the current pos of Slot 1, 4-7 are Slot 2, and so on
// IWRAM common
void (*gItemUseCB)(u8, TaskFunc);
@@ -750,10 +750,10 @@ static void InitPartyMenuBoxes(u8 layout)
static void RenderPartyMenuBox(u8 slot)
{
- if (gPartyMenu.menuType == PARTY_MENU_TYPE_MULTI_SHOWCASE && slot > 2)
+ if (gPartyMenu.menuType == PARTY_MENU_TYPE_MULTI_SHOWCASE && slot >= MULTI_PARTY_SIZE)
{
DisplayPartyPokemonDataForMultiBattle(slot);
- if (gMultiPartnerParty[slot - 3].species == SPECIES_NONE)
+ if (gMultiPartnerParty[slot - MULTI_PARTY_SIZE].species == SPECIES_NONE)
LoadPartyBoxPalette(&sPartyMenuBoxes[slot], PARTY_PAL_NO_MON);
else
LoadPartyBoxPalette(&sPartyMenuBoxes[slot], PARTY_PAL_MULTI_ALT);
@@ -986,10 +986,10 @@ static void CreatePartyMonSprites(u8 slot)
{
u8 actualSlot;
- if (gPartyMenu.menuType == PARTY_MENU_TYPE_MULTI_SHOWCASE && slot > 2)
+ if (gPartyMenu.menuType == PARTY_MENU_TYPE_MULTI_SHOWCASE && slot >= MULTI_PARTY_SIZE)
{
u8 status;
- actualSlot = slot - 3;
+ actualSlot = slot - MULTI_PARTY_SIZE;
if (gMultiPartnerParty[actualSlot].species != SPECIES_NONE)
{
@@ -1117,7 +1117,7 @@ static bool8 PartyBoxPal_ParnterOrDisqualifiedInArena(u8 slot)
if (gPartyMenu.layout == PARTY_LAYOUT_MULTI && (slot == 1 || slot == 4 || slot == 5))
return TRUE;
- if (slot < 3 && (gBattleTypeFlags & BATTLE_TYPE_ARENA) && gMain.inBattle && (gBattleStruct->arenaLostPlayerMons >> GetPartyIdFromBattleSlot(slot) & 1))
+ if (slot < MULTI_PARTY_SIZE && (gBattleTypeFlags & BATTLE_TYPE_ARENA) && gMain.inBattle && (gBattleStruct->arenaLostPlayerMons >> GetPartyIdFromBattleSlot(slot) & 1))
return TRUE;
return FALSE;
@@ -6076,7 +6076,7 @@ static void Task_MultiPartnerPartySlideIn(u8 taskId)
{
for (i = 3; i < PARTY_SIZE; i++)
{
- if (gMultiPartnerParty[i - 3].species != SPECIES_NONE)
+ if (gMultiPartnerParty[i - MULTI_PARTY_SIZE].species != SPECIES_NONE)
AnimateSelectedPartyIcon(sPartyMenuBoxes[i].monSpriteId, 0);
}
PlaySE(SE_W231); // The Harden SE plays once the partners party mons have slid on screen
@@ -6107,7 +6107,7 @@ static void SlideMultiPartyMenuBoxSpritesOneStep(u8 taskId)
for (i = 3; i < PARTY_SIZE; i++)
{
- if (gMultiPartnerParty[i - 3].species != SPECIES_NONE)
+ if (gMultiPartnerParty[i - MULTI_PARTY_SIZE].species != SPECIES_NONE)
{
MoveMultiPartyMenuBoxSprite(sPartyMenuBoxes[i].monSpriteId, tXPos - 8);
MoveMultiPartyMenuBoxSprite(sPartyMenuBoxes[i].itemSpriteId, tXPos - 8);
@@ -6236,7 +6236,7 @@ void DoBattlePyramidMonsHaveHeldItem(void)
u8 i;
gSpecialVar_Result = FALSE;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM) != ITEM_NONE)
{