Document party_menu first pass

This commit is contained in:
GriffinR
2019-10-17 19:22:03 -04:00
parent 60a592a2c3
commit 6db014cc32
92 changed files with 3119 additions and 2815 deletions
+12 -11
View File
@@ -31,6 +31,7 @@
#include "constants/battle_anim.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/songs.h"
#include "constants/trainers.h"
#include "constants/rgb.h"
@@ -1341,10 +1342,10 @@ static void WaitForMonSelection(void)
{
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
{
if (gUnknown_0203CEE8 == 1)
BtlController_EmitChosenMonReturnValue(1, gUnknown_0203CEE9, gUnknown_0203CF00);
if (gUnknown_0203CEE8 == TRUE)
BtlController_EmitChosenMonReturnValue(1, gUnknown_0203CEE9, gBattlePartyCurrentOrder);
else
BtlController_EmitChosenMonReturnValue(1, 6, NULL);
BtlController_EmitChosenMonReturnValue(1, PARTY_SIZE, NULL);
if ((gBattleBufferA[gActiveBattler][1] & 0xF) == 1)
PrintLinkStandbyMsg();
@@ -1531,12 +1532,12 @@ void ActionSelectionDestroyCursorAt(u8 cursorPosition)
CopyBgTilemapBufferToVram(0);
}
void SetCB2ToReshowScreenAfterMenu(void)
void CB2_SetUpReshowBattleScreenAfterMenu(void)
{
SetMainCallback2(ReshowBattleScreenAfterMenu);
}
void SetCB2ToReshowScreenAfterMenu2(void)
void CB2_SetUpReshowBattleScreenAfterMenu2(void)
{
SetMainCallback2(ReshowBattleScreenAfterMenu);
}
@@ -2632,20 +2633,20 @@ static void PlayerHandleChooseItem(void)
gBattlerControllerFuncs[gActiveBattler] = OpenBagAndChooseItem;
gBattlerInMenuId = gActiveBattler;
for (i = 0; i < 3; i++)
gUnknown_0203CF00[i] = gBattleBufferA[gActiveBattler][1 + i];
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
gBattlePartyCurrentOrder[i] = gBattleBufferA[gActiveBattler][1 + i];
}
static void PlayerHandleChoosePokemon(void)
{
s32 i;
for (i = 0; i < 3; i++)
gUnknown_0203CF00[i] = gBattleBufferA[gActiveBattler][4 + i];
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
gBattlePartyCurrentOrder[i] = gBattleBufferA[gActiveBattler][4 + i];
if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != PARTY_CANT_SWITCH)
if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != PARTY_ACTION_CANT_SWITCH)
{
BtlController_EmitChosenMonReturnValue(1, gBattlerPartyIndexes[gActiveBattler] + 1, gUnknown_0203CF00);
BtlController_EmitChosenMonReturnValue(1, gBattlerPartyIndexes[gActiveBattler] + 1, gBattlePartyCurrentOrder);
PlayerBufferExecCompleted();
}
else
+4 -4
View File
@@ -1175,13 +1175,13 @@ void BtlController_EmitChooseItem(u8 bufferId, u8 *arg1)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8 *arg4)
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abilityId, u8 *arg4)
{
s32 i;
sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEPOKEMON;
sBattleBuffersTransferData[1] = caseId;
sBattleBuffersTransferData[2] = arg2;
sBattleBuffersTransferData[2] = slotId;
sBattleBuffersTransferData[3] = abilityId;
for (i = 0; i < 3; i++)
sBattleBuffersTransferData[4 + i] = arg4[i];
@@ -1311,12 +1311,12 @@ void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2)
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c)
void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *c)
{
s32 i;
sBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE;
sBattleBuffersTransferData[1] = b;
sBattleBuffersTransferData[1] = partyId;
for (i = 0; i < 3; i++)
sBattleBuffersTransferData[2 + i] = c[i];
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5);
+1 -1
View File
@@ -2330,7 +2330,7 @@ static void GetDomeData(void)
}
break;
case 8:
sub_81B8558();
ClearSelectedPartyOrder();
gSelectedOrderFromParty[0] = gSaveBlock2Ptr->frontier.field_CB0;
gSelectedOrderFromParty[1] = gSaveBlock2Ptr->frontier.field_CB0 >> 8;
break;
+2 -2
View File
@@ -1061,8 +1061,8 @@ void HandleBattleLowHpMusicChange(void)
{
u8 playerBattler1 = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
u8 playerBattler2 = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
u8 battler1PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBattler1]);
u8 battler2PartyId = pokemon_order_func(gBattlerPartyIndexes[playerBattler2]);
u8 battler1PartyId = GetBattlerPartyId(gBattlerPartyIndexes[playerBattler1]);
u8 battler2PartyId = GetBattlerPartyId(gBattlerPartyIndexes[playerBattler2]);
if (GetMonData(&gPlayerParty[battler1PartyId], MON_DATA_HP) != 0)
HandleLowHpMusicChange(&gPlayerParty[battler1PartyId], playerBattler1);
+51 -50
View File
@@ -54,6 +54,7 @@
#include "constants/hold_effects.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
@@ -166,8 +167,8 @@ 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 gUnknown_02022FF8[3] = {0}; // what is it used for?
EWRAM_DATA struct UnknownPokemonStruct4* gUnknown_02023058 = NULL; // what is it used for?
EWRAM_DATA struct UnknownPokemonStruct4 gMultiPartnerParty[PARTY_SIZE / 2] = {0};
EWRAM_DATA static struct UnknownPokemonStruct4* sMultiPartnerPartyBuffer = NULL;
EWRAM_DATA u8 *gUnknown_0202305C = NULL;
EWRAM_DATA u8 *gUnknown_02023060 = NULL;
EWRAM_DATA u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200] = {0};
@@ -453,7 +454,7 @@ const u8 gTypeEffectiveness[336] =
TYPE_ENDTABLE, TYPE_ENDTABLE, TYPE_MUL_NO_EFFECT
};
const u8 gTypeNames[][TYPE_NAME_LENGTH + 1] =
const u8 gTypeNames[NUMBER_OF_MON_TYPES][TYPE_NAME_LENGTH + 1] =
{
_("NORMAL"),
_("FIGHT"),
@@ -1248,12 +1249,12 @@ static void CB2_HandleStartMultiPartnerBattle(void)
if (gLinkPlayers[playerMultiplayerId].id != 0)
{
memcpy(gPlayerParty, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
memcpy(gPlayerParty + 3, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2);
memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2);
}
else
{
memcpy(gPlayerParty, gBlockRecvBuffer[playerMultiplayerId], sizeof(struct Pokemon) * 2);
memcpy(gPlayerParty + 3, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[enemyMultiplayerId], sizeof(struct Pokemon) * 2);
}
gBattleCommunication[MULTIUSE_STATE]++;
}
@@ -1396,22 +1397,22 @@ static void sub_80379F8(u8 arrayIdPlus)
{
s32 i;
for (i = 0; i < 3; i++)
for (i = 0; i < (int)ARRAY_COUNT(gMultiPartnerParty); i++)
{
gUnknown_02022FF8[i].species = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_SPECIES);
gUnknown_02022FF8[i].heldItem = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_HELD_ITEM);
GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_NICKNAME, gUnknown_02022FF8[i].nickname);
gUnknown_02022FF8[i].level = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_LEVEL);
gUnknown_02022FF8[i].hp = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_HP);
gUnknown_02022FF8[i].maxhp = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_MAX_HP);
gUnknown_02022FF8[i].status = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_STATUS);
gUnknown_02022FF8[i].personality = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_PERSONALITY);
gUnknown_02022FF8[i].gender = GetMonGender(&gPlayerParty[arrayIdPlus + i]);
StripExtCtrlCodes(gUnknown_02022FF8[i].nickname);
gMultiPartnerParty[i].species = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_SPECIES);
gMultiPartnerParty[i].heldItem = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_HELD_ITEM);
GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_NICKNAME, gMultiPartnerParty[i].nickname);
gMultiPartnerParty[i].level = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_LEVEL);
gMultiPartnerParty[i].hp = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_HP);
gMultiPartnerParty[i].maxhp = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_MAX_HP);
gMultiPartnerParty[i].status = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_STATUS);
gMultiPartnerParty[i].personality = GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_PERSONALITY);
gMultiPartnerParty[i].gender = GetMonGender(&gPlayerParty[arrayIdPlus + i]);
StripExtCtrlCodes(gMultiPartnerParty[i].nickname);
if (GetMonData(&gPlayerParty[arrayIdPlus + i], MON_DATA_LANGUAGE) != LANGUAGE_JAPANESE)
PadNameString(gUnknown_02022FF8[i].nickname, CHAR_SPACE);
PadNameString(gMultiPartnerParty[i].nickname, CHAR_SPACE);
}
memcpy(gUnknown_02023058, gUnknown_02022FF8, sizeof(gUnknown_02022FF8));
memcpy(sMultiPartnerPartyBuffer, gMultiPartnerParty, sizeof(gMultiPartnerParty));
}
static void CB2_PreInitMultiBattle(void)
@@ -1443,9 +1444,9 @@ static void CB2_PreInitMultiBattle(void)
case 0:
if (gReceivedRemoteLinkPlayers != 0 && IsLinkTaskFinished())
{
gUnknown_02023058 = Alloc(sizeof(struct UnknownPokemonStruct4) * 3);
sMultiPartnerPartyBuffer = Alloc(sizeof(struct UnknownPokemonStruct4) * ARRAY_COUNT(gMultiPartnerParty));
sub_80379F8(0);
SendBlock(bitmask_all_link_players_but_self(), gUnknown_02023058, sizeof(struct UnknownPokemonStruct4) * 3);
SendBlock(bitmask_all_link_players_but_self(), sMultiPartnerPartyBuffer, sizeof(struct UnknownPokemonStruct4) * ARRAY_COUNT(gMultiPartnerParty));
gBattleCommunication[MULTIUSE_STATE]++;
}
break;
@@ -1458,24 +1459,24 @@ static void CB2_PreInitMultiBattle(void)
if (i == playerMultiplierId)
continue;
if (numPlayers == 4)
if (numPlayers == MAX_LINK_PLAYERS)
{
if ((!(gLinkPlayers[i].id & 1) && !(gLinkPlayers[playerMultiplierId].id & 1))
|| (gLinkPlayers[i].id & 1 && gLinkPlayers[playerMultiplierId].id & 1))
{
memcpy(gUnknown_02022FF8, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct4) * 3);
memcpy(gMultiPartnerParty, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct4) * ARRAY_COUNT(gMultiPartnerParty));
}
}
else
{
memcpy(gUnknown_02022FF8, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct4) * 3);
memcpy(gMultiPartnerParty, gBlockRecvBuffer[i], sizeof(struct UnknownPokemonStruct4) * ARRAY_COUNT(gMultiPartnerParty));
}
}
gBattleCommunication[MULTIUSE_STATE]++;
*savedCallback = gMain.savedCallback;
*savedBattleTypeFlags = gBattleTypeFlags;
gMain.savedCallback = CB2_PreInitMultiBattle;
sub_81B9150();
ShowPartyMenuToShowcaseMultiBattleParty();
}
break;
case 2:
@@ -1496,8 +1497,8 @@ static void CB2_PreInitMultiBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal);
Free(gUnknown_02023058);
gUnknown_02023058 = NULL;
Free(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
}
}
else if (gReceivedRemoteLinkPlayers == 0)
@@ -1505,8 +1506,8 @@ static void CB2_PreInitMultiBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal);
Free(gUnknown_02023058);
gUnknown_02023058 = NULL;
Free(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
}
break;
}
@@ -1527,13 +1528,13 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void)
switch (gBattleCommunication[MULTIUSE_STATE])
{
case 0:
gUnknown_02023058 = Alloc(sizeof(struct UnknownPokemonStruct4) * 3);
sMultiPartnerPartyBuffer = Alloc(sizeof(struct UnknownPokemonStruct4) * ARRAY_COUNT(gMultiPartnerParty));
sub_80379F8(3);
gBattleCommunication[MULTIUSE_STATE]++;
*savedCallback = gMain.savedCallback;
*savedBattleTypeFlags = gBattleTypeFlags;
gMain.savedCallback = CB2_PreInitIngamePlayerPartnerBattle;
sub_81B9150();
ShowPartyMenuToShowcaseMultiBattleParty();
break;
case 1:
if (!gPaletteFade.active)
@@ -1542,8 +1543,8 @@ static void CB2_PreInitIngamePlayerPartnerBattle(void)
gBattleTypeFlags = *savedBattleTypeFlags;
gMain.savedCallback = *savedCallback;
SetMainCallback2(CB2_InitBattleInternal);
Free(gUnknown_02023058);
gUnknown_02023058 = NULL;
Free(sMultiPartnerPartyBuffer);
sMultiPartnerPartyBuffer = NULL;
}
break;
}
@@ -1666,7 +1667,7 @@ static void CB2_HandleStartMultiBattle(void)
break;
case 1:
case 2:
memcpy(gPlayerParty + 3, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
break;
}
}
@@ -1683,7 +1684,7 @@ static void CB2_HandleStartMultiBattle(void)
break;
case 1:
case 2:
memcpy(gPlayerParty + 3, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
memcpy(gPlayerParty + PARTY_SIZE / 2, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
break;
}
}
@@ -1697,7 +1698,7 @@ static void CB2_HandleStartMultiBattle(void)
break;
case 1:
case 2:
memcpy(gEnemyParty + 3, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
memcpy(gEnemyParty + PARTY_SIZE / 2, gBlockRecvBuffer[id], sizeof(struct Pokemon) * 2);
break;
}
}
@@ -4129,26 +4130,26 @@ void sub_803BDA0(u8 battler)
// gBattleStruct->field_60[battler][i]
for (i = 0; i < 3; i++)
gUnknown_0203CF00[i] = *(battler * 3 + i + (u8*)(gBattleStruct->field_60));
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
gBattlePartyCurrentOrder[i] = *(battler * 3 + i + (u8*)(gBattleStruct->field_60));
r4 = pokemon_order_func(gBattlerPartyIndexes[battler]);
r1 = pokemon_order_func(*(gBattleStruct->monToSwitchIntoId + battler));
sub_81B8FB0(r4, r1);
r4 = GetBattlerPartyId(gBattlerPartyIndexes[battler]);
r1 = GetBattlerPartyId(*(gBattleStruct->monToSwitchIntoId + battler));
SwitchPartyMonSlots(r4, r1);
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
for (i = 0; i < 3; i++)
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
{
*(battler * 3 + i + (u8*)(gBattleStruct->field_60)) = gUnknown_0203CF00[i];
*(BATTLE_PARTNER(battler) * 3 + i + (u8*)(gBattleStruct->field_60)) = gUnknown_0203CF00[i];
*(battler * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
*(BATTLE_PARTNER(battler) * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
}
}
else
{
for (i = 0; i < 3; i++)
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
{
*(battler * 3 + i + (u8*)(gBattleStruct->field_60)) = gUnknown_0203CF00[i];
*(battler * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
}
}
}
@@ -4283,7 +4284,7 @@ static void HandleTurnActionSelectionState(void)
|| gBattleTypeFlags & BATTLE_TYPE_ARENA
|| gStatuses3[gActiveBattler] & STATUS3_ROOTED)
{
BtlController_EmitChoosePokemon(0, PARTY_CANT_SWITCH, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
}
else if ((i = ABILITY_ON_OPPOSING_FIELD(gActiveBattler, ABILITY_SHADOW_TAG))
|| ((i = ABILITY_ON_OPPOSING_FIELD(gActiveBattler, ABILITY_ARENA_TRAP))
@@ -4292,16 +4293,16 @@ static void HandleTurnActionSelectionState(void)
|| ((i = AbilityBattleEffects(ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER, gActiveBattler, ABILITY_MAGNET_PULL, 0, 0))
&& IS_BATTLER_OF_TYPE(gActiveBattler, TYPE_STEEL)))
{
BtlController_EmitChoosePokemon(0, ((i - 1) << 4) | PARTY_ABILITY_PREVENTS, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]);
}
else
{
if (gActiveBattler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH)
BtlController_EmitChoosePokemon(0, PARTY_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
else if (gActiveBattler == 3 && gChosenActionByBattler[1] == B_ACTION_SWITCH)
BtlController_EmitChoosePokemon(0, PARTY_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
else
BtlController_EmitChoosePokemon(0, PARTY_CHOOSE_MON, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CHOOSE_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
}
MarkBattlerForControllerExec(gActiveBattler);
break;
+6 -5
View File
@@ -22,6 +22,7 @@
#include "constants/trainers.h"
#include "constants/species.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/battle_pike.h"
struct PikeRoomNPC
@@ -922,7 +923,7 @@ static bool8 TryInflictRandomStatus(void)
for (i = 0; i < 3; i++)
{
mon = &gPlayerParty[indices[i]];
if (pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)) == 0
if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE
&& GetMonData(mon, MON_DATA_HP) != 0)
{
j++;
@@ -964,7 +965,7 @@ static bool8 TryInflictRandomStatus(void)
for (i = 0; i < 3; i++)
{
mon = &gPlayerParty[indices[i]];
if (pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)) == 0
if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE
&& GetMonData(mon, MON_DATA_HP) != 0)
{
j++;
@@ -996,7 +997,7 @@ static bool8 AtLeastOneHealthyMon(void)
for (i = 0; i < 3; i++)
{
struct Pokemon *mon = &gPlayerParty[i];
if (pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)) == 0
if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE
&& GetMonData(mon, MON_DATA_HP) != 0)
{
healthyMonsCount++;
@@ -1285,7 +1286,7 @@ static void TryHealMons(u8 healCount)
{
canBeHealed = TRUE;
}
else if (pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)) != 0)
else if (GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) != AILMENT_NONE)
{
canBeHealed = TRUE;
}
@@ -1556,7 +1557,7 @@ static void CanAnyPartyMonsBeHealed(void)
struct Pokemon *mon = &gPlayerParty[i];
u16 curr = GetMonData(mon, MON_DATA_HP);
u16 max = GetMonData(mon, MON_DATA_MAX_HP);
if (curr >= max && pokemon_ailments_get_primary(GetMonData(mon, MON_DATA_STATUS)) == 0)
if (curr >= max && GetAilmentFromStatus(GetMonData(mon, MON_DATA_STATUS)) == AILMENT_NONE)
{
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
for (j = 0; j < MAX_MON_MOVES; j++)
+14 -13
View File
@@ -346,12 +346,12 @@ void InitBattlePyramidBagCursorPosition(void)
void CB2_PyramidBagMenuFromStartMenu(void)
{
sub_81C4F98(0, CB2_ReturnToFieldWithOpenMenu);
GoToBattlePyramidBagMenu(0, CB2_ReturnToFieldWithOpenMenu);
}
static void sub_81C4F10(void)
{
sub_81C4F98(1, SetCB2ToReshowScreenAfterMenu2);
GoToBattlePyramidBagMenu(1, CB2_SetUpReshowBattleScreenAfterMenu2);
}
void sub_81C4F24(void)
@@ -366,18 +366,18 @@ static void sub_81C4F44(u8 taskId)
if (!gPaletteFade.active)
{
CleanupOverworldWindowsAndTilemaps();
gFieldCallback2 = hm_add_c3_without_phase_2;
sub_81C4F98(3, CB2_ReturnToField);
gFieldCallback2 = CB2_FadeFromPartyMenu;
GoToBattlePyramidBagMenu(3, CB2_ReturnToField);
DestroyTask(taskId);
}
}
void sub_81C4F84(void)
void CB2_ReturnToPyramidBagMenu(void)
{
sub_81C4F98(4, gPyramidBagCursorData.callback);
GoToBattlePyramidBagMenu(4, gPyramidBagCursorData.callback);
}
void sub_81C4F98(u8 a0, void (*callback)(void))
void GoToBattlePyramidBagMenu(u8 a0, void (*callback)(void))
{
gPyramidBagResources = AllocZeroed(sizeof(*gPyramidBagResources));
@@ -981,7 +981,7 @@ static void HandleMenuActionInput(u8 taskId)
sub_8199134(0, 1);
}
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == 1)
{
if (id & 1 && IsValidMenuAction(id - 1))
{
@@ -989,7 +989,7 @@ static void HandleMenuActionInput(u8 taskId)
sub_8199134(-1, 0);
}
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == 2)
{
if (!(id & 1) && IsValidMenuAction(id + 1))
{
@@ -1202,7 +1202,7 @@ static void BagAction_Give(u8 taskId)
}
else if (!ItemId_GetImportance(gSpecialVar_ItemId))
{
gPyramidBagResources->callback2 = sub_81B7F60;
gPyramidBagResources->callback2 = CB2_ChooseMonToGiveItem;
sub_81C5B14(taskId);
}
else
@@ -1350,7 +1350,7 @@ static void sub_81C6A14(u8 taskId)
SetTaskToMainPyramidBagInputHandler(taskId);
}
void sub_81C6A94(void)
void TryStoreHeldItemsInPyramidBag(void)
{
u8 i;
struct Pokemon *party = gPlayerParty;
@@ -1363,8 +1363,9 @@ void sub_81C6A94(void)
for (i = 0; i < 3; i++)
{
heldItem = GetMonData(&party[i], MON_DATA_HELD_ITEM);
if (heldItem != 0 && !AddBagItem(heldItem, 1))
if (heldItem != ITEM_NONE && !AddBagItem(heldItem, 1))
{
// Cant store party held items in pyramid bag because bag is full
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode], newItems, PYRAMID_BAG_ITEMS_COUNT * sizeof(u16));
memcpy(gSaveBlock2Ptr->frontier.pyramidBag.quantity[gSaveBlock2Ptr->frontier.lvlMode], newQuantities, PYRAMID_BAG_ITEMS_COUNT * sizeof(u8));
Free(newItems);
@@ -1374,7 +1375,7 @@ void sub_81C6A94(void)
}
}
heldItem = 0;
heldItem = ITEM_NONE;
for (i = 0; i < 3; i++)
{
SetMonData(&party[i], MON_DATA_HELD_ITEM, &heldItem);
+17 -16
View File
@@ -52,6 +52,7 @@
#include "menu_specialized.h"
#include "constants/rgb.h"
#include "data.h"
#include "constants/party_menu.h"
extern struct MusicPlayerInfo gMPlayInfo_BGM;
@@ -5107,13 +5108,13 @@ static void atk4F_jumpifcantswitch(void)
}
}
static void sub_804CF10(u8 arg0)
static void sub_804CF10(u8 slotId)
{
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6;
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]);
BtlController_EmitChoosePokemon(0, PARTY_MUST_CHOOSE_MON, arg0, 0, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, PARTY_ACTION_SEND_OUT, slotId, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
MarkBattlerForControllerExec(gActiveBattler);
}
@@ -5145,7 +5146,7 @@ static void atk50_openpartyscreen(void)
}
else if (!gSpecialStatuses[gActiveBattler].flag40)
{
sub_804CF10(6);
sub_804CF10(PARTY_SIZE);
gSpecialStatuses[gActiveBattler].flag40 = 1;
}
}
@@ -5352,9 +5353,9 @@ static void atk50_openpartyscreen(void)
else
{
if (gBattlescriptCurrInstr[1] & 0x80)
hitmarkerFaintBits = PARTY_CHOOSE_MON; // Used here as the caseId for the EmitChoose function.
hitmarkerFaintBits = PARTY_ACTION_CHOOSE_MON; // Used here as the caseId for the EmitChoose function.
else
hitmarkerFaintBits = PARTY_MUST_CHOOSE_MON;
hitmarkerFaintBits = PARTY_ACTION_SEND_OUT;
battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80));
if (gSpecialStatuses[battlerId].flag40)
@@ -5375,7 +5376,7 @@ static void atk50_openpartyscreen(void)
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6;
gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]);
BtlController_EmitChoosePokemon(0, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBattler ^ 2)), 0, gBattleStruct->field_60[gActiveBattler]);
BtlController_EmitChoosePokemon(0, hitmarkerFaintBits, *(gBattleStruct->monToSwitchIntoId + (gActiveBattler ^ 2)), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
MarkBattlerForControllerExec(gActiveBattler);
gBattlescriptCurrInstr += 6;
@@ -5615,15 +5616,15 @@ static void atk59_handlelearnnewmove(void)
const u8 *jumpPtr1 = T1_READ_PTR(gBattlescriptCurrInstr + 1);
const u8 *jumpPtr2 = T1_READ_PTR(gBattlescriptCurrInstr + 5);
u16 ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], gBattlescriptCurrInstr[9]);
while (ret == 0xFFFE)
ret = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], 0);
u16 learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], gBattlescriptCurrInstr[9]);
while (learnMove == MON_ALREADY_KNOWS_MOVE)
learnMove = MonTryLearningNewMove(&gPlayerParty[gBattleStruct->expGetterMonId], FALSE);
if (ret == 0)
if (learnMove == 0)
{
gBattlescriptCurrInstr = jumpPtr2;
}
else if (ret == 0xFFFF)
else if (learnMove == MON_HAS_MAX_MOVES)
{
gBattlescriptCurrInstr += 10;
}
@@ -5634,7 +5635,7 @@ static void atk59_handlelearnnewmove(void)
if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED))
{
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret);
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], learnMove);
}
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
@@ -5642,7 +5643,7 @@ static void atk59_handlelearnnewmove(void)
if (gBattlerPartyIndexes[gActiveBattler] == gBattleStruct->expGetterMonId
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_TRANSFORMED))
{
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], ret);
GiveMoveToBattleMon(&gBattleMons[gActiveBattler], learnMove);
}
}
@@ -5715,8 +5716,8 @@ static void atk5A_yesnoboxlearnmove(void)
case 4:
if (!gPaletteFade.active && gMain.callback2 == BattleMainCB2)
{
u8 movePosition = sub_81C1B94();
if (movePosition == 4)
u8 movePosition = GetMoveSlotToReplace();
if (movePosition == MAX_MON_MOVES)
{
gBattleScripting.learnMoveState = 5;
}
+1 -1
View File
@@ -3191,7 +3191,7 @@ static void FillPartnerParty(u16 trainerId)
sStevenMons[i].fixedIV,
TRUE, i, // BUG: personality was stored in the 'j' variable. As a result, Steven's pokemon do not have the intended natures.
OT_ID_PRESET, STEVEN_OTID);
for (j = 0; j < 6; j++)
for (j = 0; j < PARTY_SIZE; j++)
SetMonData(&gPlayerParty[3 + i], MON_DATA_HP_EV + j, &sStevenMons[i].evs[j]);
for (j = 0; j < MAX_MON_MOVES; j++)
SetMonMoveSlot(&gPlayerParty[3 + i], sStevenMons[i].moves[j], j);
+5 -5
View File
@@ -110,13 +110,13 @@ void sub_80571DC(u8 battlerId, u8 arg1)
// gBattleStruct->field_60[0][i]
for (i = 0; i < 3; i++)
gUnknown_0203CF00[i] = *(0 * 3 + i + (u8*)(gBattleStruct->field_60));
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
gBattlePartyCurrentOrder[i] = *(0 * 3 + i + (u8*)(gBattleStruct->field_60));
sub_81B8FB0(pokemon_order_func(gBattlerPartyIndexes[battlerId]), pokemon_order_func(arg1));
SwitchPartyMonSlots(GetBattlerPartyId(gBattlerPartyIndexes[battlerId]), GetBattlerPartyId(arg1));
for (i = 0; i < 3; i++)
*(0 * 3 + i + (u8*)(gBattleStruct->field_60)) = gUnknown_0203CF00[i];
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
*(0 * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
}
}
+9 -10
View File
@@ -2799,16 +2799,15 @@ void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame)
}
}
// GetContestAvailability?
u8 sub_80DAE0C(struct Pokemon *pkmn)
u8 GetContestEntryEligibility(struct Pokemon *pkmn)
{
u8 ribbon;
u8 retVal;
u8 contestViability;
if (GetMonData(pkmn, MON_DATA_IS_EGG))
return 3;
return CANT_ENTER_CONTEST_EGG;
if (GetMonData(pkmn, MON_DATA_HP) == 0)
return 4;
return CANT_ENTER_CONTEST_FAINTED;
switch (gSpecialVar_ContestCategory)
{
case CONTEST_CATEGORY_COOL:
@@ -2827,19 +2826,19 @@ u8 sub_80DAE0C(struct Pokemon *pkmn)
ribbon = GetMonData(pkmn, MON_DATA_TOUGH_RIBBON);
break;
default:
return 0;
return CANT_ENTER_CONTEST;
}
// Couldn't get this to match any other way.
// Returns 2, 1, or 0 respectively if ribbon's rank is above, equal, or below
// the current contest rank.
if (ribbon > gSpecialVar_ContestRank)
retVal = 2;
contestViability = CAN_ENTER_CONTEST_HIGH_RANK;
else if (ribbon >= gSpecialVar_ContestRank)
retVal = 1;
contestViability = CAN_ENTER_CONTEST_EQUAL_RANK;
else
retVal = 0;
return retVal;
contestViability = CANT_ENTER_CONTEST;
return contestViability;
}
static void DrawContestantWindowText(void)
+5 -3
View File
@@ -1935,14 +1935,16 @@ static void sub_80F7ED0(int windowId, u8 *str, int arg2)
void sub_80F7F30(void)
{
u8 result = sub_80DAE0C(&gPlayerParty[gContestMonPartyIndex]);
if (result)
u8 eligibility = GetContestEntryEligibility(&gPlayerParty[gContestMonPartyIndex]);
// Nonzero eligibility can still be non-eligibile, if mon is fainted or egg
if (eligibility)
{
sub_80DAB8C(gSpecialVar_ContestCategory, gSpecialVar_ContestRank);
sub_80DB09C(gSpecialVar_ContestCategory);
}
gSpecialVar_Result = result;
gSpecialVar_Result = eligibility;
}
u16 sub_80F7F7C(void)
+6 -9
View File
@@ -231,11 +231,8 @@ static void ApplyDaycareExperience(struct Pokemon *mon)
while ((learnedMove = MonTryLearningNewMove(mon, firstMove)) != 0)
{
firstMove = FALSE;
if (learnedMove == 0xFFFF)
{
// Mon already knows 4 moves.
if (learnedMove == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(mon, gMoveToLearn);
}
}
}
else
@@ -666,7 +663,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
{
if (sHatchedEggFatherMoves[i] == sHatchedEggEggMoves[j])
{
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == 0xFFFF)
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]);
break;
}
@@ -685,7 +682,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
{
if (sHatchedEggFatherMoves[i] == ItemIdToBattleMoveId(ITEM_TM01_FOCUS_PUNCH + j) && CanMonLearnTMHM(egg, j))
{
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == 0xFFFF)
if (GiveMoveToMon(egg, sHatchedEggFatherMoves[i]) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFatherMoves[i]);
}
}
@@ -710,7 +707,7 @@ static void BuildEggMoveset(struct Pokemon *egg, struct BoxPokemon *father, stru
{
if (sHatchedEggLevelUpMoves[j] != MOVE_NONE && sHatchedEggFinalMoves[i] == sHatchedEggLevelUpMoves[j])
{
if (GiveMoveToMon(egg, sHatchedEggFinalMoves[i]) == 0xFFFF)
if (GiveMoveToMon(egg, sHatchedEggFinalMoves[i]) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(egg, sHatchedEggFinalMoves[i]);
break;
}
@@ -755,7 +752,7 @@ static void GiveVoltTackleIfLightBall(struct Pokemon *mon, struct DayCare *dayca
if (motherItem == ITEM_LIGHT_BALL || fatherItem == ITEM_LIGHT_BALL)
{
if (GiveMoveToMon(mon, MOVE_VOLT_TACKLE) == 0xFFFF)
if (GiveMoveToMon(mon, MOVE_VOLT_TACKLE) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToMon(mon, MOVE_VOLT_TACKLE);
}
}
@@ -1295,6 +1292,6 @@ void ShowDaycareLevelMenu(void)
void ChooseSendDaycareMon(void)
{
sub_81B9328();
ChooseMonForDaycare();
gMain.savedCallback = CB2_ReturnToField;
}
+9 -9
View File
@@ -743,12 +743,12 @@ static void Task_EvolutionScene(u8 taskID)
GetMonData(mon, MON_DATA_NICKNAME, text);
StringCopy10(gBattleTextBuff1, text);
if (var == 0xFFFF) // no place to learn it
if (var == MON_HAS_MAX_MOVES)
gTasks[taskID].tState = 22;
else if (var == 0xFFFE) // it already knows that move
else if (var == MON_ALREADY_KNOWS_MOVE)
break;
else
gTasks[taskID].tState = 20; // has less than 4 moves, so it's been learned
gTasks[taskID].tState = 20; // move has been learned
}
else // no move to learn
{
@@ -909,8 +909,8 @@ static void Task_EvolutionScene(u8 taskID)
case 6:
if (!gPaletteFade.active && gMain.callback2 == CB2_EvolutionSceneUpdate)
{
var = sub_81C1B94(); // moveID
if (var == 4)
var = GetMoveSlotToReplace();
if (var == MAX_MON_MOVES)
{
gTasks[taskID].tLearnMoveState = 10;
}
@@ -1100,9 +1100,9 @@ static void Task_TradeEvolutionScene(u8 taskID)
GetMonData(mon, MON_DATA_NICKNAME, text);
StringCopy10(gBattleTextBuff1, text);
if (var == 0xFFFF)
if (var == MON_HAS_MAX_MOVES)
gTasks[taskID].tState = 20;
else if (var == 0xFFFE)
else if (var == MON_ALREADY_KNOWS_MOVE)
break;
else
gTasks[taskID].tState = 18;
@@ -1243,8 +1243,8 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 6:
if (!gPaletteFade.active && gMain.callback2 == CB2_TradeEvolutionSceneUpdate)
{
var = sub_81C1B94(); // moveID
if (var == 4)
var = GetMoveSlotToReplace();
if (var == MAX_MON_MOVES)
{
gTasks[taskID].tLearnMoveState = 9;
}
+4 -4
View File
@@ -63,7 +63,7 @@ static void PokeballGlowEffect_7(struct Sprite *);
static u8 PokecenterHealEffectHelper(s16, s16);
static void HallOfFameRecordEffectHelper(s16, s16, s16, u8);
static void mapldr_080842E8(void);
static void FieldCallback_Fly(void);
static void task00_8084310(u8);
static void mapldr_08084390(void);
static void c3_080843F8(u8);
@@ -1364,13 +1364,13 @@ void SpriteCB_HallOfFameMonitor(struct Sprite *sprite)
}
void sub_80B69DC(void)
void ReturnToFieldFromFlyMapSelect(void)
{
SetMainCallback2(CB2_ReturnToField);
gFieldCallback = mapldr_080842E8;
gFieldCallback = FieldCallback_Fly;
}
static void mapldr_080842E8(void)
static void FieldCallback_Fly(void)
{
pal_fill_black();
CreateTask(task00_8084310, 0);
+3 -2
View File
@@ -15,6 +15,7 @@
#include "task.h"
#include "trainer_hill.h"
#include "constants/field_poison.h"
#include "constants/party_menu.h"
#include "constants/species.h"
static bool32 IsMonValidSpecies(struct Pokemon *pokemon)
@@ -56,7 +57,7 @@ static void FaintFromFieldPoison(u8 partyIdx)
static bool32 MonFaintedFromPoison(u8 partyIdx)
{
struct Pokemon *pokemon = gPlayerParty + partyIdx;
if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
if (IsMonValidSpecies(pokemon) && GetMonData(pokemon, MON_DATA_HP) == 0 && GetAilmentFromStatus(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
{
return TRUE;
}
@@ -124,7 +125,7 @@ s32 DoPoisonFieldEffect(void)
u32 numFainted = 0;
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && pokemon_ailments_get_primary(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
if (GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES) && GetAilmentFromStatus(GetMonData(pokemon, MON_DATA_STATUS)) == AILMENT_PSN)
{
hp = GetMonData(pokemon, MON_DATA_HP);
if (hp == 0 || --hp == 0)
+1
View File
@@ -60,6 +60,7 @@
#include "constants/songs.h"
#include "constants/species.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/vars.h"
#include "constants/battle_frontier.h"
#include "constants/weather.h"
+46 -44
View File
@@ -7,12 +7,13 @@
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "constants/party_menu.h"
#include "constants/songs.h"
static void sub_816166C(u8 taskId);
static void sub_81616C0(u8 taskId);
static void sub_8161724(u8 taskId);
static void sub_81617B8(u8 taskId);
static void Task_SoftboiledRestoreHealth(u8 taskId);
static void Task_DisplayHPRestoredMessage(u8 taskId);
static void Task_FinishSoftboiled(u8 taskId);
static void CantUseSoftboiledOnMon(u8 taskId);
bool8 SetUpFieldMove_SoftBoiled(void)
{
@@ -29,81 +30,82 @@ bool8 SetUpFieldMove_SoftBoiled(void)
return FALSE;
}
void sub_8161560(u8 taskId)
void ChooseMonForSoftboiled(u8 taskId)
{
gUnknown_0203CEC8.unkB = 0xA;
gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.slotId;
sub_81B0FCC(GetCursorSelectionMonId(), 0x1);
DisplayPartyMenuStdMessage(5);
gTasks[taskId].func = sub_81B1370;
gPartyMenu.action = PARTY_ACTION_SOFTBOILED;
gPartyMenu.slotId2 = gPartyMenu.slotId;
AnimatePartySlot(GetCursorSelectionMonId(), 1);
DisplayPartyMenuStdMessage(PARTY_MSG_USE_ON_WHICH_MON);
gTasks[taskId].func = Task_HandleChooseMonInput;
}
void sub_81615A8(u8 taskId)
void Task_TryUseSoftboiledOnPartyMon(u8 taskId)
{
u16 hp;
u8 slotId = gUnknown_0203CEC8.slotId;
u8 pokemonIndex = gUnknown_0203CEC8.unkA;
if(pokemonIndex > 6)
u8 userPartyId = gPartyMenu.slotId;
u8 recipientPartyId = gPartyMenu.slotId2;
if(recipientPartyId > PARTY_SIZE)
{
gUnknown_0203CEC8.unkB = 0;
DisplayPartyMenuStdMessage(0);
gTasks[taskId].func = sub_81B1370;
gPartyMenu.action = 0;
DisplayPartyMenuStdMessage(PARTY_MSG_CHOOSE_MON);
gTasks[taskId].func = Task_HandleChooseMonInput;
return;
}
hp = GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_HP);
if(hp == 0 || slotId == pokemonIndex || GetMonData(&gPlayerParty[pokemonIndex], MON_DATA_MAX_HP) == hp)
hp = GetMonData(&gPlayerParty[recipientPartyId], MON_DATA_HP);
if(hp == 0 || userPartyId == recipientPartyId || GetMonData(&gPlayerParty[recipientPartyId], MON_DATA_MAX_HP) == hp)
{
sub_81617B8(taskId);
CantUseSoftboiledOnMon(taskId);
return;
}
// Take away Softboiled user's health first (-1)
PlaySE(SE_KAIFUKU);
sub_81B1F18(taskId, slotId, -1, GetMonData(&gPlayerParty[slotId], MON_DATA_MAX_HP)/5, sub_816166C);
PartyMenuModifyHP(taskId, userPartyId, -1, GetMonData(&gPlayerParty[userPartyId], MON_DATA_MAX_HP)/5, Task_SoftboiledRestoreHealth);
}
static void sub_816166C(u8 taskId)
static void Task_SoftboiledRestoreHealth(u8 taskId)
{
PlaySE(SE_KAIFUKU);
sub_81B1F18(taskId, gUnknown_0203CEC8.unkA, 1, GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_MAX_HP)/5, sub_81616C0);
PartyMenuModifyHP(taskId, gPartyMenu.slotId2, 1, GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_MAX_HP)/5, Task_DisplayHPRestoredMessage);
}
static void sub_81616C0(u8 taskId)
static void Task_DisplayHPRestoredMessage(u8 taskId)
{
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1);
GetMonNickname(&gPlayerParty[gPartyMenu.slotId2], gStringVar1);
StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2);
DisplayPartyMenuMessage(gStringVar4, 0);
DisplayPartyMenuMessage(gStringVar4, FALSE);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_8161724;
gTasks[taskId].func = Task_FinishSoftboiled;
}
static void sub_8161724(u8 taskId)
static void Task_FinishSoftboiled(u8 taskId)
{
if(sub_81B1BD4() == 1)
if(IsPartyMenuTextPrinterActive() == TRUE)
return;
gUnknown_0203CEC8.unkB = 0x0;
sub_81B0FCC(gUnknown_0203CEC8.slotId, 0);
gUnknown_0203CEC8.slotId = gUnknown_0203CEC8.unkA;
sub_81B0FCC(gUnknown_0203CEC8.unkA, 1);
ClearStdWindowAndFrameToTransparent(0x6, FALSE);
ClearWindowTilemap(0x6);
DisplayPartyMenuStdMessage(0);
gTasks[taskId].func = sub_81B1370;
gPartyMenu.action = 0;
AnimatePartySlot(gPartyMenu.slotId, 0);
gPartyMenu.slotId = gPartyMenu.slotId2;
AnimatePartySlot(gPartyMenu.slotId2, 1);
ClearStdWindowAndFrameToTransparent(6, FALSE);
ClearWindowTilemap(6);
DisplayPartyMenuStdMessage(PARTY_MSG_CHOOSE_MON);
gTasks[taskId].func = Task_HandleChooseMonInput;
}
static void sub_8161784(u8 taskId)
static void Task_ChooseNewMonForSoftboiled(u8 taskId)
{
if(sub_81B1BD4() == 1)
if(IsPartyMenuTextPrinterActive() == TRUE)
return;
DisplayPartyMenuStdMessage(5);
gTasks[taskId].func = sub_81B1370;
DisplayPartyMenuStdMessage(PARTY_MSG_USE_ON_WHICH_MON);
gTasks[taskId].func = Task_HandleChooseMonInput;
}
static void sub_81617B8(u8 taskId)
static void CantUseSoftboiledOnMon(u8 taskId)
{
PlaySE(SE_SELECT);
DisplayPartyMenuMessage(gText_CantBeUsedOnPkmn, 0);
DisplayPartyMenuMessage(gText_CantBeUsedOnPkmn, FALSE);
schedule_bg_copy_tilemap_to_vram(2);
gTasks[taskId].func = sub_8161784;
gTasks[taskId].func = Task_ChooseNewMonForSoftboiled;
}
+1 -1
View File
@@ -884,7 +884,7 @@ static void sub_81A1AD4(void)
{
s32 i;
sub_81B8558();
ClearSelectedPartyOrder();
for (i = 0; i < gSpecialVar_0x8005; i++)
gSelectedOrderFromParty[i] = gSaveBlock2Ptr->frontier.selectedPartyMons[i];
ReducePlayerPartyToSelectedMons();
+3 -3
View File
@@ -1138,9 +1138,9 @@ const u32 gBattleAnimSpritePal_Slash2[] = INCBIN_U32("graphics/battle_anims/spri
const u32 gBattleAnimSpriteGfx_WhiteShadow[] = INCBIN_U32("graphics/battle_anims/sprites/white_shadow.4bpp.lz");
const u32 gBattleAnimSpritePal_WhiteShadow[] = INCBIN_U32("graphics/battle_anims/sprites/white_shadow.gbapal.lz");
const u32 gPartyMenuMisc_Gfx[] = INCBIN_U32("graphics/interface/party_menu_misc.4bpp.lz");
const u32 gPartyMenuMisc_Pal[] = INCBIN_U32("graphics/interface/party_menu_misc.gbapal.lz");
const u32 gPartyMenuMisc_Tilemap[] = INCBIN_U32("graphics/interface/party_menu_misc.bin.lz");
const u32 gPartyMenuBg_Gfx[] = INCBIN_U32("graphics/interface/party_menu_bg.4bpp.lz");
const u32 gPartyMenuBg_Pal[] = INCBIN_U32("graphics/interface/party_menu_bg.gbapal.lz");
const u32 gPartyMenuBg_Tilemap[] = INCBIN_U32("graphics/interface/party_menu_bg.bin.lz");
const u32 gPartyMenuPokeball_Gfx[] = INCBIN_U32("graphics/interface/party_menu_pokeball.4bpp.lz");
const u32 gPartyMenuPokeballSmall_Gfx[] = INCBIN_U32("graphics/interface/party_menu_pokeball_small.4bpp.lz"); //unused
+4 -4
View File
@@ -142,7 +142,7 @@ bool8 CheckBagHasItem(u16 itemId, u16 count)
if (ItemId_GetPocket(itemId) == 0)
return FALSE;
if (InBattlePyramid() || FlagGet(FLAG_SPECIAL_FLAG_0x4004) == TRUE)
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
return CheckPyramidBagHasItem(itemId, count);
pocket = ItemId_GetPocket(itemId) - 1;
// Check for item slots that contain the item
@@ -189,7 +189,7 @@ bool8 CheckBagHasSpace(u16 itemId, u16 count)
if (ItemId_GetPocket(itemId) == POCKET_NONE)
return FALSE;
if (InBattlePyramid() || FlagGet(FLAG_SPECIAL_FLAG_0x4004) == TRUE)
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
{
return CheckPyramidBagHasSpace(itemId, count);
}
@@ -404,7 +404,7 @@ bool8 AddBagItem(u16 itemId, u16 count)
return FALSE;
// check Battle Pyramid Bag
if (InBattlePyramid() || FlagGet(FLAG_SPECIAL_FLAG_0x4004) == TRUE)
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
{
return AddPyramidBagItem(itemId, count);
}
@@ -517,7 +517,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count)
return FALSE;
// check Battle Pyramid Bag
if (InBattlePyramid() || FlagGet(FLAG_SPECIAL_FLAG_0x4004) == TRUE)
if (InBattlePyramid() || FlagGet(FLAG_STORING_ITEMS_IN_PYRAMID_BAG) == TRUE)
{
return RemovePyramidBagItem(itemId, count);
}
+10 -9
View File
@@ -4,6 +4,7 @@
#include "battle_controllers.h"
#include "battle_pyramid.h"
#include "frontier_util.h"
#include "battle_pyramid_bag.h"
#include "berry_tag_screen.h"
#include "bg.h"
#include "constants/items.h"
@@ -466,9 +467,9 @@ void CB2_BagMenuFromStartMenu(void)
void sub_81AABB0(void)
{
if (!InBattlePyramid())
GoToBagMenu(RETURN_LOCATION_BATTLE, POCKETS_COUNT, SetCB2ToReshowScreenAfterMenu2);
GoToBagMenu(RETURN_LOCATION_BATTLE, POCKETS_COUNT, CB2_SetUpReshowBattleScreenAfterMenu2);
else
sub_81C4F98(1, SetCB2ToReshowScreenAfterMenu2);
GoToBattlePyramidBagMenu(1, CB2_SetUpReshowBattleScreenAfterMenu2);
}
void CB2_ChooseBerry(void)
@@ -1148,13 +1149,13 @@ u8 GetSwitchBagPocketDirection(void)
u8 LRKeys;
if (gBagMenu->unk81B != 0)
return 0;
LRKeys = GetLRKeysState();
if ((gMain.newKeys & DPAD_LEFT) || LRKeys == 1)
LRKeys = GetLRKeysPressed();
if ((gMain.newKeys & DPAD_LEFT) || LRKeys == MENU_L_PRESSED)
{
PlaySE(SE_SELECT);
return 1;
}
if ((gMain.newKeys & DPAD_RIGHT) || LRKeys == 2)
if ((gMain.newKeys & DPAD_RIGHT) || LRKeys == MENU_R_PRESSED)
{
PlaySE(SE_SELECT);
return 2;
@@ -1581,7 +1582,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
sub_8199134(0, 1);
}
}
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysState() == 1)
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
{
if ((cursorPos & 1) && sub_81ACDFC(cursorPos - 1))
{
@@ -1589,7 +1590,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
sub_8199134(-1, 0);
}
}
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysState() == 2)
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
{
if (!(cursorPos & 1) && sub_81ACDFC(cursorPos + 1))
{
@@ -1782,7 +1783,7 @@ void ItemMenu_Give(u8 taskId)
BagMenu_PrintThereIsNoPokemon(taskId);
else
{
gBagMenu->mainCallback2 = sub_81B7F60;
gBagMenu->mainCallback2 = CB2_ChooseMonToGiveItem;
unknown_ItemMenu_Confirm(taskId);
}
}
@@ -2157,7 +2158,7 @@ void DoWallyTutorialBagMenu(void)
PrepareBagForWallyTutorial();
AddBagItem(ITEM_POTION, 1);
AddBagItem(ITEM_POKE_BALL, 1);
GoToBagMenu(RETURN_LOCATION_BATTLE_2, ITEMS_POCKET, SetCB2ToReshowScreenAfterMenu2);
GoToBagMenu(RETURN_LOCATION_BATTLE_2, ITEMS_POCKET, CB2_SetUpReshowBattleScreenAfterMenu2);
}
void Task_WallyTutorialBagMenu(u8 taskId)
+35 -34
View File
@@ -64,10 +64,10 @@ void sub_80FDC00(u8 taskId);
void sub_80FDD74(u8 taskId);
void sub_80FDE08(u8 taskId);
void sub_80FDE7C(u8 taskId);
void sub_80FDF90(u8 taskId);
void task08_0809AD8C(u8 taskId);
void sub_80FE024(u8 taskId);
void sub_80FE03C(u8 taskId);
static void BootUpSoundTMHM(u8 taskId);
static void Task_ShowTMHMContainedMessage(u8 taskId);
static void UseTMHMYesNo(u8 taskId);
static void UseTMHM(u8 taskId);
void sub_80FE124(u8 taskId);
void sub_80FE164(u8 taskId);
@@ -91,16 +91,16 @@ EWRAM_DATA static void(*gUnknown_0203A0F4)(u8 taskId) = NULL;
static const MainCallback gUnknown_085920D8[] =
{
sub_81B617C,
CB2_ShowPartyMenuForItemUse,
CB2_ReturnToField,
NULL,
};
static const u8 gUnknown_085920E4[] = {DIR_NORTH, DIR_EAST, DIR_SOUTH, DIR_WEST};
static const struct YesNoFuncTable gUnknown_085920E8 =
static const struct YesNoFuncTable sUseTMHMYesNoFuncTable =
{
.yesFunc = sub_80FE03C,
.yesFunc = UseTMHM,
.noFunc = BagMenu_InitListsMenu,
};
@@ -722,72 +722,72 @@ void sub_80FDE7C(u8 taskId)
void ItemUseOutOfBattle_Medicine(u8 taskId)
{
gUnknown_03006328 = ItemUseCB_Medicine;
gItemUseCB = ItemUseCB_Medicine;
SetUpItemUseCallback(taskId);
}
void ItemUseOutOfBattle_ReduceEV(u8 taskId)
{
gUnknown_03006328 = sub_81B67C8;
gItemUseCB = ItemUseCB_ReduceEV;
SetUpItemUseCallback(taskId);
}
void ItemUseOutOfBattle_SacredAsh(u8 taskId)
{
gUnknown_03006328 = sub_81B79E8;
gItemUseCB = ItemUseCB_SacredAsh;
SetUpItemUseCallback(taskId);
}
void ItemUseOutOfBattle_PPRecovery(u8 taskId)
{
gUnknown_03006328 = dp05_ether;
gItemUseCB = ItemUseCB_PPRecovery;
SetUpItemUseCallback(taskId);
}
void ItemUseOutOfBattle_PPUp(u8 taskId)
{
gUnknown_03006328 = dp05_pp_up;
gItemUseCB = ItemUseCB_PPUp;
SetUpItemUseCallback(taskId);
}
void ItemUseOutOfBattle_RareCandy(u8 taskId)
{
gUnknown_03006328 = dp05_rare_candy;
gItemUseCB = ItemUseCB_RareCandy;
SetUpItemUseCallback(taskId);
}
void ItemUseOutOfBattle_TMHM(u8 taskId)
{
if (gSpecialVar_ItemId >= ITEM_HM01_CUT)
DisplayItemMessage(taskId, 1, gText_BootedUpHM, sub_80FDF90); // HM
DisplayItemMessage(taskId, 1, gText_BootedUpHM, BootUpSoundTMHM); // HM
else
DisplayItemMessage(taskId, 1, gText_BootedUpTM, sub_80FDF90); // TM
DisplayItemMessage(taskId, 1, gText_BootedUpTM, BootUpSoundTMHM); // TM
}
void sub_80FDF90(u8 taskId)
static void BootUpSoundTMHM(u8 taskId)
{
PlaySE(SE_PC_LOGIN);
gTasks[taskId].func = task08_0809AD8C;
gTasks[taskId].func = Task_ShowTMHMContainedMessage;
}
void task08_0809AD8C(u8 taskId)
static void Task_ShowTMHMContainedMessage(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]);
StringExpandPlaceholders(gStringVar4, gText_TMHMContainedVar1);
DisplayItemMessage(taskId, 1, gStringVar4, sub_80FE024);
DisplayItemMessage(taskId, 1, gStringVar4, UseTMHMYesNo);
}
}
void sub_80FE024(u8 taskId)
static void UseTMHMYesNo(u8 taskId)
{
BagMenu_YesNo(taskId, 6, &gUnknown_085920E8);
BagMenu_YesNo(taskId, 6, &sUseTMHMYesNoFuncTable);
}
void sub_80FE03C(u8 taskId)
static void UseTMHM(u8 taskId)
{
gUnknown_03006328 = sub_81B6DC4;
gItemUseCB = ItemUseCB_TMHM;
SetUpItemUseCallback(taskId);
}
@@ -912,7 +912,7 @@ void ItemUseOutOfBattle_EscapeRope(u8 taskId)
void ItemUseOutOfBattle_EvolutionStone(u8 taskId)
{
gUnknown_03006328 = sub_81B7C74;
gItemUseCB = ItemUseCB_EvolutionStone;
SetUpItemUseCallback(taskId);
}
@@ -976,36 +976,37 @@ void ItemUseInBattle_StatIncrease(u8 taskId)
}
}
void sub_80FE54C(u8 taskId)
static void ItemUseInBattle_ShowPartyMenu(u8 taskId)
{
if (!InBattlePyramid())
{
gBagMenu->mainCallback2 = sub_81B89F0;
gBagMenu->mainCallback2 = ChooseMonForInBattleItem;
unknown_ItemMenu_Confirm(taskId);
}
else
{
gPyramidBagResources->callback2 = sub_81B89F0;
gPyramidBagResources->callback2 = ChooseMonForInBattleItem;
sub_81C5B14(taskId);
}
}
void ItemUseInBattle_Medicine(u8 taskId)
{
gUnknown_03006328 = ItemUseCB_Medicine;
sub_80FE54C(taskId);
gItemUseCB = ItemUseCB_Medicine;
ItemUseInBattle_ShowPartyMenu(taskId);
}
void sub_80FE5AC(u8 taskId)
// Unused. Sacred Ash cannot be used in battle
void ItemUseInBattle_SacredAsh(u8 taskId)
{
gUnknown_03006328 = sub_81B79E8;
sub_80FE54C(taskId);
gItemUseCB = ItemUseCB_SacredAsh;
ItemUseInBattle_ShowPartyMenu(taskId);
}
void ItemUseInBattle_PPRecovery(u8 taskId)
{
gUnknown_03006328 = dp05_ether;
sub_80FE54C(taskId);
gItemUseCB = ItemUseCB_PPRecovery;
ItemUseInBattle_ShowPartyMenu(taskId);
}
void ItemUseInBattle_Escape(u8 taskId)
+1 -1
View File
@@ -63,7 +63,7 @@ u8 GiveMailToMon(struct Pokemon *mon, u16 itemId)
gSaveBlock1Ptr->mail[id].playerName[i] = EOS;
PadNameString(gSaveBlock1Ptr->mail[id].playerName, CHAR_SPACE);
for (i = 0; i < 4; i++)
for (i = 0; i < TRAINER_ID_LENGTH; i++)
gSaveBlock1Ptr->mail[id].trainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
species = GetBoxMonData(&mon->box, MON_DATA_SPECIES);
+10 -10
View File
@@ -1433,13 +1433,13 @@ s8 sub_8199284(void)
sub_8199134(0, 1);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
{
PlaySE(SE_SELECT);
sub_8199134(-1, 0);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
{
PlaySE(SE_SELECT);
sub_8199134(1, 0);
@@ -1474,13 +1474,13 @@ s8 Menu_ProcessInputGridLayout(void)
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
{
if (oldPos != sub_81991F8(-1, 0))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
{
if (oldPos != sub_81991F8(1, 0))
PlaySE(SE_SELECT);
@@ -1513,13 +1513,13 @@ s8 sub_81993D8(void)
sub_8199134(0, 1);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || sub_812210C() == 1)
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
{
PlaySE(SE_SELECT);
sub_8199134(-1, 0);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || sub_812210C() == 2)
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
{
PlaySE(SE_SELECT);
sub_8199134(1, 0);
@@ -1554,13 +1554,13 @@ s8 sub_8199484(void)
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || sub_812210C() == 1)
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
{
if (oldPos != sub_81991F8(-1, 0))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || sub_812210C() == 2)
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
{
if (oldPos != sub_81991F8(1, 0))
PlaySE(SE_SELECT);
@@ -1883,7 +1883,7 @@ void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette)
}
}
void sub_8199CBC(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height)
void CopyToBufferFromBgTilemap(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height)
{
u8 i;
u8 j;
@@ -2159,7 +2159,7 @@ void sub_819A344(u8 a0, u8 *dest, u8 color)
ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
break;
case 3:
sub_81245DC(string, gMapHeader.regionMapSectionId);
GetMapNameGeneric(string, gMapHeader.regionMapSectionId);
break;
case 4:
for (curFlag = FLAG_BADGE01_GET, flagCount = 0, endOfString = string + 1; curFlag <= FLAG_BADGE08_GET; curFlag++)
+6 -6
View File
@@ -251,27 +251,27 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
return FALSE;
}
u8 GetLRKeysState(void)
u8 GetLRKeysPressed(void)
{
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.newKeys & L_BUTTON)
return 1;
return MENU_L_PRESSED;
if (gMain.newKeys & R_BUTTON)
return 2;
return MENU_R_PRESSED;
}
return 0;
}
u8 sub_812210C(void)
u8 GetLRKeysPressedAndHeld(void)
{
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.newAndRepeatedKeys & L_BUTTON)
return 1;
return MENU_L_PRESSED;
if (gMain.newAndRepeatedKeys & R_BUTTON)
return 2;
return MENU_R_PRESSED;
}
return 0;
+2 -2
View File
@@ -513,7 +513,7 @@ static void DoMoveRelearnerMain(void)
if (selection == 0)
{
if (GiveMoveToMon(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove()) != 0xFFFF)
if (GiveMoveToMon(&gPlayerParty[sMoveRelearnerStruct->partyMon], GetCurrentSelectedMove()) != MON_HAS_MAX_MOVES)
{
FormatAndPrintText(gText_MoveRelearnerPkmnLearnedMove);
gSpecialVar_0x8004 = TRUE;
@@ -778,7 +778,7 @@ static void HandleInput(bool8 showContest)
switch (itemId)
{
case LIST_NOTHING_CHOSEN:
if (!(gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysState())
if (!(gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysPressed())
{
break;
}
+2287 -2078
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -824,7 +824,7 @@ static void Mailbox_DoGiveMailPokeMenu(u8 taskId)
{
sub_81D1EC0();
CleanupOverworldWindowsAndTilemaps();
sub_81B8448();
ChooseMonToGiveMailFromMailbox();
DestroyTask(taskId);
}
}
+1 -1
View File
@@ -462,7 +462,7 @@ void OpenPokeblockCase(u8 caseId, void (*callback)(void))
void OpenPokeblockCaseInBattle(void)
{
OpenPokeblockCase(PBLOCK_CASE_BATTLE, SetCB2ToReshowScreenAfterMenu2);
OpenPokeblockCase(PBLOCK_CASE_BATTLE, CB2_SetUpReshowBattleScreenAfterMenu2);
}
void OpenPokeblockCaseOnFeeder(void)
+9 -8
View File
@@ -60,6 +60,7 @@ static void EncryptBoxMon(struct BoxPokemon *boxMon);
static void DecryptBoxMon(struct BoxPokemon *boxMon);
static void sub_806E6CC(u8 taskId);
static bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
// EWRAM vars
EWRAM_DATA static u8 sLearningMoveTableID = 0;
@@ -2879,22 +2880,22 @@ u16 GiveMoveToMon(struct Pokemon *mon, u16 move)
return GiveMoveToBoxMon(&mon->box, move);
}
u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
{
s32 i;
for (i = 0; i < MAX_MON_MOVES; i++)
{
u16 existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL);
if (!existingMove)
if (existingMove == MOVE_NONE)
{
SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &move);
SetBoxMonData(boxMon, MON_DATA_PP1 + i, &gBattleMoves[move].pp);
return move;
}
if (existingMove == move)
return -2;
return MON_ALREADY_KNOWS_MOVE;
}
return 0xFFFF;
return MON_HAS_MAX_MOVES;
}
u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move)
@@ -2949,7 +2950,7 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon)
move = (gLevelUpLearnsets[species][i] & 0x1FF);
if (GiveMoveToBoxMon(boxMon, move) == 0xFFFF)
if (GiveMoveToBoxMon(boxMon, move) == MON_HAS_MAX_MOVES)
DeleteFirstMoveAndGiveMoveToBoxMon(boxMon, move);
}
}
@@ -4860,7 +4861,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
if (battlerId != 4)
{
gAbsentBattlerFlags &= ~gBitTable[battlerId];
CopyPlayerPartyMonToBattleData(battlerId, pokemon_order_func(gBattlerPartyIndexes[battlerId]));
CopyPlayerPartyMonToBattleData(battlerId, GetBattlerPartyId(gBattlerPartyIndexes[battlerId]));
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER && gBattleResults.numRevivesUsed < 255)
gBattleResults.numRevivesUsed++;
}
@@ -6439,11 +6440,11 @@ void SetMonPreventsSwitchingString(void)
gBattleTextBuff1[4] = B_BUFF_EOS;
if (GetBattlerSide(gBattleStruct->battlerPreventingSwitchout) == B_SIDE_PLAYER)
gBattleTextBuff1[3] = pokemon_order_func(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]);
gBattleTextBuff1[3] = GetBattlerPartyId(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]);
else
gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout];
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, pokemon_order_func(gBattlerPartyIndexes[gBattlerInMenuId]))
PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, GetBattlerPartyId(gBattlerPartyIndexes[gBattlerInMenuId]))
BattleStringExpandPlaceholders(gText_PkmnsXPreventsSwitching, gStringVar4);
}
+14 -13
View File
@@ -42,6 +42,7 @@
#include "window.h"
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/party_menu.h"
#include "constants/region_map_sections.h"
#include "constants/rgb.h"
#include "constants/songs.h"
@@ -162,7 +163,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData
u8 unk_filler4[6];
} *sMonSummaryScreen = NULL;
EWRAM_DATA u8 gLastViewedMonIndex = 0;
static EWRAM_DATA u8 sUnknown_0203CF21 = 0;
static EWRAM_DATA u8 sMoveSlotToReplace = 0;
ALIGNED(4) static EWRAM_DATA u8 sUnknownTaskId = 0;
struct UnkStruct_61CC04
@@ -1491,11 +1492,11 @@ static void HandleInput(u8 taskId)
{
ChangeSummaryPokemon(taskId, 1);
}
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysState() == 1)
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
{
ChangePage(taskId, -1);
}
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysState() == 2)
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
{
ChangePage(taskId, 1);
}
@@ -2159,11 +2160,11 @@ static void HandleReplaceMoveInput(u8 taskId)
data[0] = 4;
sub_81C1070(data, 1, &sMonSummaryScreen->firstMoveIndex);
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
{
ChangePage(taskId, -1);
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
{
ChangePage(taskId, 1);
}
@@ -2173,8 +2174,8 @@ static void HandleReplaceMoveInput(u8 taskId)
{
StopPokemonAnimations();
PlaySE(SE_SELECT);
sUnknown_0203CF21 = sMonSummaryScreen->firstMoveIndex;
gSpecialVar_0x8005 = sUnknown_0203CF21;
sMoveSlotToReplace = sMonSummaryScreen->firstMoveIndex;
gSpecialVar_0x8005 = sMoveSlotToReplace;
BeginCloseSummaryScreen(taskId);
}
else
@@ -2188,8 +2189,8 @@ static void HandleReplaceMoveInput(u8 taskId)
u32 var1;
StopPokemonAnimations();
PlaySE(SE_SELECT);
sUnknown_0203CF21 = 4;
gSpecialVar_0x8005 = 4;
sMoveSlotToReplace = MAX_MON_MOVES;
gSpecialVar_0x8005 = MAX_MON_MOVES;
BeginCloseSummaryScreen(taskId);
}
}
@@ -2238,7 +2239,7 @@ static void HandleHMMovesCantBeForgottenInput(u8 taskId)
data[1] = 0;
gTasks[taskId].func = HandleReplaceMoveInput;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
{
if (sMonSummaryScreen->currPageIndex != 2)
{
@@ -2252,7 +2253,7 @@ static void HandleHMMovesCantBeForgottenInput(u8 taskId)
sub_81C1EFC(9, -2, move);
}
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
{
if (sMonSummaryScreen->currPageIndex != 3)
{
@@ -2281,9 +2282,9 @@ static void HandleHMMovesCantBeForgottenInput(u8 taskId)
}
}
u8 sub_81C1B94(void)
u8 GetMoveSlotToReplace(void)
{
return sUnknown_0203CF21;
return sMoveSlotToReplace;
}
static void DrawPagination(void) // Updates the pagination dots at the top of the summary screen
+9 -8
View File
@@ -55,7 +55,7 @@ static EWRAM_DATA struct {
/*0x008*/ struct RegionMap regionMap;
/*0x88c*/ u8 unk_88c[0x1c0];
/*0xa4c*/ u8 unk_a4c[0x26];
/*0xa72*/ bool8 unk_a72;
/*0xa72*/ bool8 choseFlyLocation;
} *sFlyMap = NULL; // a74
static bool32 gUnknown_03001180;
@@ -1605,7 +1605,8 @@ u8 *GetMapName(u8 *dest, u16 regionMapId, u16 padLength)
return str;
}
u8 *sub_81245DC(u8 *dest, u16 mapSecId)
// TODO: probably needs a better name
u8 *GetMapNameGeneric(u8 *dest, u16 mapSecId)
{
switch (mapSecId)
{
@@ -1626,7 +1627,7 @@ u8 *sub_8124610(u8 *dest, u16 mapSecId)
}
else
{
return sub_81245DC(dest, mapSecId);
return GetMapNameGeneric(dest, mapSecId);
}
}
@@ -1972,13 +1973,13 @@ static void sub_8124D64(void)
if (sFlyMap->regionMap.iconDrawType == MAPSECTYPE_CITY_CANFLY || sFlyMap->regionMap.iconDrawType == MAPSECTYPE_BATTLE_FRONTIER)
{
m4aSongNumStart(SE_SELECT);
sFlyMap->unk_a72 = TRUE;
sFlyMap->choseFlyLocation = TRUE;
sub_81248F4(sub_8124E0C);
}
break;
case INPUT_EVENT_B_BUTTON:
m4aSongNumStart(SE_SELECT);
sFlyMap->unk_a72 = FALSE;
sFlyMap->choseFlyLocation = FALSE;
sub_81248F4(sub_8124E0C);
break;
}
@@ -1997,7 +1998,7 @@ static void sub_8124E0C(void)
if (!UpdatePaletteFade())
{
FreeRegionMapIconResources();
if (sFlyMap->unk_a72)
if (sFlyMap->choseFlyLocation)
{
switch (sFlyMap->regionMap.mapSecId)
{
@@ -2024,11 +2025,11 @@ static void sub_8124E0C(void)
}
break;
}
sub_80B69DC();
ReturnToFieldFromFlyMapSelect();
}
else
{
SetMainCallback2(sub_81B58A8);
SetMainCallback2(CB2_ReturnToPartyMenuFromFlyMap);
}
if (sFlyMap != NULL)
{
+1 -2
View File
@@ -39,7 +39,6 @@
#include "script_menu.h"
#include "script_movement.h"
#include "script_pokemon_80F8.h"
#include "script_pokemon_81B9.h"
#include "shop.h"
#include "slot_machine.h"
#include "sound.h"
@@ -1938,7 +1937,7 @@ bool8 ScrCmd_getpricereduction(struct ScriptContext *ctx)
bool8 ScrCmd_choosecontestmon(struct ScriptContext *ctx)
{
sub_81B9404();
ChooseContestMon();
ScriptContext1_Stop();
return TRUE;
}
+1 -1
View File
@@ -646,7 +646,7 @@ void ScriptSetMonMoveSlot(u8 monIndex, u16 move, u8 slot)
void ChooseHalfPartyForBattle(void)
{
gMain.savedCallback = CB2_ReturnFromChooseHalfParty;
VarSet(VAR_FRONTIER_FACILITY, FRONTIER_FACILITY_DOUBLE_COLOSSEUM);
VarSet(VAR_FRONTIER_FACILITY, FACILITY_MULTI_OR_EREADER);
InitChooseHalfPartyForBattle(0);
}
+2 -2
View File
@@ -388,7 +388,7 @@ const u8 gText_PCMailboxFull[] = _("Your PC's MAILBOX is full.{PAUSE_UNTIL_PRESS
const u8 gText_MailMessageWillBeLost[] = _("If the MAIL is removed, the\nmessage will be lost. Okay?");
const u8 gText_RemoveMailBeforeItem[] = _("MAIL must be removed before\nholding an item.{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnWasGivenItem[] = _("{STR_VAR_1} was given the\n{STR_VAR_2} to hold.{PAUSE_UNTIL_PRESS}");
const u8 gText_SwitchPkmnItem[] = _("{STR_VAR_1} is already holding\none {STR_VAR_2}.\pWould you like to switch the\ntwo items?");
const u8 gText_PkmnAlreadyHoldingItemSwitch[] = _("{STR_VAR_1} is already holding\none {STR_VAR_2}.\pWould you like to switch the\ntwo items?");
const u8 gText_PkmnNotHolding[] = _("{STR_VAR_1} isn't holding\nanything.{PAUSE_UNTIL_PRESS}");
const u8 gText_ReceivedItemFromPkmn[] = _("Received the {STR_VAR_2}\nfrom {STR_VAR_1}.{PAUSE_UNTIL_PRESS}");
const u8 gText_MailTakenFromPkmn[] = _("MAIL was taken from the\nPOKéMON.{PAUSE_UNTIL_PRESS}");
@@ -471,7 +471,7 @@ const u8 gText_CancelChallenge[] = _("Cancel the challenge?");
const u8 gText_EscapeFromHere[] = _("Want to escape from here and return\nto {STR_VAR_1}?");
const u8 gText_ReturnToHealingSpot[] = _("Want to return to the healing spot\nused last in {STR_VAR_1}?");
const u8 gText_PauseUntilPress[] = _("{PAUSE_UNTIL_PRESS}");
const u8 gJPText_PutVar1IntoSpinner[] = _("{STR_VAR_1}を ぐるぐるこうかんに\nだして よろしいですか?");
const u8 gJPText_AreYouSureYouWantToSpinTradeMon[] = _("{STR_VAR_1}を ぐるぐるこうかんに\nだして よろしいですか?");
ALIGNED(4) const u8 gText_OnlyPkmnForBattle[] = _("That's your only\nPOKéMON for battle.");
ALIGNED(4) const u8 gText_PkmnCantBeTradedNow[] = _("That POKéMON can't be traded\nnow.");
ALIGNED(4) const u8 gText_EggCantBeTradedNow[] = _("An EGG can't be traded now.");
+9 -7
View File
@@ -1439,8 +1439,8 @@ static void TradeMenuProcessInput_SelectedMon(void)
QueueAction(QUEUE_DELAY_MSG, QUEUE_MON_CANT_BE_TRADED);
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_REDRAW_MAIN_MENU;
break;
case CANT_TRADE_EGG:
case CANT_TRADE_EGG2:
case CANT_TRADE_EGG_YET:
case CANT_TRADE_EGG_YET2:
QueueAction(QUEUE_DELAY_MSG, QUEUE_EGG_CANT_BE_TRADED);
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_REDRAW_MAIN_MENU;
break;
@@ -2352,7 +2352,7 @@ static u32 CanTradeSelectedMon(struct Pokemon *playerParty, int partyCount, int
if (!IsNationalPokedexEnabled())
{
if (species2[monIdx] == SPECIES_EGG)
return CANT_TRADE_EGG;
return CANT_TRADE_EGG_YET;
if (!IsSpeciesInHoennDex(species2[monIdx]))
return CANT_TRADE_NATIONAL;
@@ -2366,7 +2366,7 @@ static u32 CanTradeSelectedMon(struct Pokemon *playerParty, int partyCount, int
if (!(player->progressFlagsCopy & 0xF))
{
if (species2[monIdx] == SPECIES_EGG)
return CANT_TRADE_EGG2;
return CANT_TRADE_EGG_YET2;
if (!IsSpeciesInHoennDex(species2[monIdx]))
return CANT_TRADE_INVALID_MON;
@@ -2542,8 +2542,10 @@ int CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct rfuP
}
// r6/r7 flip. Ugh.
// Spin Trade wasnt fully implemented, but this checks if a mon would be valid to Spin Trade
// Unlike later generations, this version of Spin Trade isnt only for Eggs
#ifdef NONMATCHING
int CanTradeSelectedPartyMenuMon(struct Pokemon *mon, u16 monIdx)
int CanSpinTradeMon(struct Pokemon *mon, u16 monIdx)
{
int i, version, versions, canTradeAnyMon, numMonsLeft;
int speciesArray[PARTY_SIZE];
@@ -2592,7 +2594,7 @@ int CanTradeSelectedPartyMenuMon(struct Pokemon *mon, u16 monIdx)
return CANT_TRADE_NATIONAL;
if (speciesArray[monIdx] == SPECIES_NONE)
return CANT_TRADE_EGG;
return CANT_TRADE_EGG_YET;
}
numMonsLeft = 0;
@@ -2611,7 +2613,7 @@ int CanTradeSelectedPartyMenuMon(struct Pokemon *mon, u16 monIdx)
}
#else
NAKED
int CanTradeSelectedPartyMenuMon(struct Pokemon *mon, u16 a1)
int CanSpinTradeMon(struct Pokemon *mon, u16 a1)
{
asm_unified("push {r4-r7,lr}\n\
mov r7, r8\n\
+6 -3
View File
@@ -47,6 +47,7 @@
#include "constants/cable_club.h"
#include "constants/game_stat.h"
#include "constants/maps.h"
#include "constants/party_menu.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/species.h"
@@ -2308,7 +2309,9 @@ void sub_80156E0(u8 taskId)
data->state = 3;
break;
case 3:
if ((sub_81B1360() == 8 || sub_81B1360() == 9) && sUnionRoomTrade.field_0 != 0)
if ((GetPartyMenuType() == PARTY_MENU_TYPE_UNION_ROOM_REGISTER
|| GetPartyMenuType() == PARTY_MENU_TYPE_UNION_ROOM_TRADE)
&& sUnionRoomTrade.field_0 != 0)
{
id = GetCursorSelectionMonId();
switch (sUnionRoomTrade.field_0)
@@ -2876,7 +2879,7 @@ void sub_80156E0(u8 taskId)
{
sUnionRoomTrade.field_0 = 1;
gFieldCallback = sub_80AF128;
sub_81B8904(8, CB2_ReturnToField);
ChooseMonForTradingBoard(PARTY_MENU_TYPE_UNION_ROOM_REGISTER, CB2_ReturnToField);
}
break;
case 52:
@@ -2988,7 +2991,7 @@ void sub_80156E0(u8 taskId)
gUnionRoomRequestedMonType = data->field_0->arr[taskData[1]].unk.field_0.type;
gUnionRoomOfferedSpecies = data->field_0->arr[taskData[1]].unk.field_0.species;
gFieldCallback = sub_80AF128;
sub_81B8904(9, CB2_ReturnToField);
ChooseMonForTradingBoard(PARTY_MENU_TYPE_UNION_ROOM_TRADE, CB2_ReturnToField);
sub_80156B0(data);
sUnionRoomTrade.field_8 = taskData[1];
}