diff options
author | DizzyEggg <jajkodizzy@wp.pl> | 2018-07-07 19:57:09 +0200 |
---|---|---|
committer | DizzyEggg <jajkodizzy@wp.pl> | 2018-07-07 19:57:09 +0200 |
commit | 008d961b2a3d2d145f9ff8e7515cfb4f5e04128c (patch) | |
tree | 91fa8c967a0ff63da316cfd9b9bd7c5bc396cfce /src | |
parent | 1c48e585747de0a2273c4b3eb4be114d5214b8a2 (diff) |
add party menu defines
Diffstat (limited to 'src')
-rw-r--r-- | src/battle_controller_player.c | 26 | ||||
-rw-r--r-- | src/battle_controllers.c | 4 | ||||
-rw-r--r-- | src/battle_main.c | 31 | ||||
-rw-r--r-- | src/battle_script_commands.c | 7 | ||||
-rw-r--r-- | src/battle_util.c | 4 | ||||
-rw-r--r-- | src/pokemon.c | 12 |
6 files changed, 43 insertions, 41 deletions
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 992d8656c..8f69dab06 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -30,6 +30,7 @@ #include "battle_setup.h" #include "item_use.h" #include "recorded_battle.h" +#include "party_menu.h" extern u8 gUnknown_0203CEE8; extern u8 gUnknown_0203CEE9; @@ -45,7 +46,6 @@ extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[]; extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[]; extern void sub_8172EF0(u8 battlerId, struct Pokemon *mon); -extern void sub_81B89AC(u8 arg0); extern void sub_81AABB0(void); extern void sub_81A57E4(u8 battlerId, u16 stringId); extern void sub_81851A8(u8 *); @@ -120,7 +120,7 @@ static void MoveSelectionDisplayMoveType(void); static void MoveSelectionDisplayMoveNames(void); static void HandleMoveSwitchting(void); static void sub_8058FC0(void); -static void sub_8059828(void); +static void WaitForMonSelection(void); static void CompleteWhenChoseItem(void); static void Task_LaunchLvlUpAnim(u8 taskId); static void Task_PrepareToGiveExpWithExpBar(u8 taskId); @@ -1337,21 +1337,21 @@ static void CompleteOnInactiveTextPrinter2(void) PlayerBufferExecCompleted(); } -static void sub_80597CC(void) +static void OpenPartyMenuToChooseMon(void) { if (!gPaletteFade.active) { - u8 r4; + u8 caseId; - gBattlerControllerFuncs[gActiveBattler] = sub_8059828; - r4 = gTasks[gUnknown_03005D7C[gActiveBattler]].data[0]; + gBattlerControllerFuncs[gActiveBattler] = WaitForMonSelection; + caseId = gTasks[gUnknown_03005D7C[gActiveBattler]].data[0]; DestroyTask(gUnknown_03005D7C[gActiveBattler]); FreeAllWindowBuffers(); - sub_81B89AC(r4); + OpenPartyMenuInBattle(caseId); } } -static void sub_8059828(void) +static void WaitForMonSelection(void) { if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active) { @@ -2655,7 +2655,7 @@ static void PlayerHandleChoosePokemon(void) for (i = 0; i < 3; i++) gUnknown_0203CF00[i] = gBattleBufferA[gActiveBattler][4 + i]; - if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != 2) + if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != PARTY_CANT_SWITCH) { BtlController_EmitChosenMonReturnValue(1, gBattlerPartyIndexes[gActiveBattler] + 1, gUnknown_0203CF00); PlayerBufferExecCompleted(); @@ -2664,11 +2664,11 @@ static void PlayerHandleChoosePokemon(void) { gUnknown_03005D7C[gActiveBattler] = CreateTask(TaskDummy, 0xFF); gTasks[gUnknown_03005D7C[gActiveBattler]].data[0] = gBattleBufferA[gActiveBattler][1] & 0xF; - *(&gBattleStruct->field_49) = gBattleBufferA[gActiveBattler][1] >> 4; + *(&gBattleStruct->battlerPreventingSwitchout) = gBattleBufferA[gActiveBattler][1] >> 4; *(&gBattleStruct->field_8B) = gBattleBufferA[gActiveBattler][2]; - *(&gBattleStruct->field_B0) = gBattleBufferA[gActiveBattler][3]; - BeginNormalPaletteFade(-1, 0, 0, 16, 0); - gBattlerControllerFuncs[gActiveBattler] = sub_80597CC; + *(&gBattleStruct->abilityPreventingSwitchout) = gBattleBufferA[gActiveBattler][3]; + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gBattlerControllerFuncs[gActiveBattler] = OpenPartyMenuToChooseMon; gBattlerInMenuId = gActiveBattler; } } diff --git a/src/battle_controllers.c b/src/battle_controllers.c index c841aaa03..1ce5d3099 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1181,7 +1181,7 @@ 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 arg2, u8 abilityId, u8 *arg4) { s32 i; @@ -1191,7 +1191,7 @@ void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 ability sBattleBuffersTransferData[3] = abilityId; for (i = 0; i < 3; i++) sBattleBuffersTransferData[4 + i] = arg4[i]; - PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // but only 7 bytes were written + PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // Only 7 bytes were written. } void BtlController_EmitCmd23(u8 bufferId) diff --git a/src/battle_main.c b/src/battle_main.c index 591c299d7..fe6e62c5d 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -51,6 +51,7 @@ #include "decompress.h" #include "international_string_util.h" #include "pokeball.h" +#include "party_menu.h" struct UnknownPokemonStruct4 { @@ -3232,7 +3233,7 @@ void FaintClearSetData(void) gProtectStructs[gActiveBattler].protected = 0; gProtectStructs[gActiveBattler].endured = 0; - gProtectStructs[gActiveBattler].onlyStruggle = 0; + gProtectStructs[gActiveBattler].noValidMoves = 0; gProtectStructs[gActiveBattler].helpingHand = 0; gProtectStructs[gActiveBattler].bounceMove = 0; gProtectStructs[gActiveBattler].stealMove = 0; @@ -4141,11 +4142,11 @@ static void HandleTurnActionSelectionState(void) u8 position = GetBattlerPosition(gActiveBattler); switch (gBattleCommunication[gActiveBattler]) { - case STATE_TURN_START_RECORD: // recorded battle related on start of every turn + case STATE_TURN_START_RECORD: // Recorded battle related action on start of every turn. RecordedBattle_CopyBattlerMoves(); gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN; break; - case STATE_BEFORE_ACTION_CHOSEN: // choose an action + case STATE_BEFORE_ACTION_CHOSEN: // Choose an action. *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE; if (gBattleTypeFlags & BATTLE_TYPE_MULTI || (position & BIT_FLANK) == B_FLANK_LEFT @@ -4177,7 +4178,7 @@ static void HandleTurnActionSelectionState(void) } } break; - case STATE_WAIT_ACTION_CHOSEN: // try to perform an action + case STATE_WAIT_ACTION_CHOSEN: // Try to perform an action. if (!(gBattleControllerExecFlags & ((gBitTable[gActiveBattler]) | (0xF0000000) | (gBitTable[gActiveBattler] << 4) | (gBitTable[gActiveBattler] << 8) | (gBitTable[gActiveBattler] << 0xC)))) { RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]); @@ -4248,7 +4249,7 @@ static void HandleTurnActionSelectionState(void) || gBattleTypeFlags & BATTLE_TYPE_ARENA || gStatuses3[gActiveBattler] & STATUS3_ROOTED) { - BtlController_EmitChoosePokemon(0, 2, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, PARTY_CANT_SWITCH, 6, 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)) @@ -4257,16 +4258,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) | 4, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, ((i - 1) << 4) | PARTY_ABILITY_PREVENTS, 6, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]); } else { if (gActiveBattler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH) - BtlController_EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, PARTY_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); else if (gActiveBattler == 3 && gChosenActionByBattler[1] == B_ACTION_SWITCH) - BtlController_EmitChoosePokemon(0, 0, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, PARTY_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); else - BtlController_EmitChoosePokemon(0, 0, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, PARTY_CHOOSE_MON, 6, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]); } MarkBattlerForControllerExec(gActiveBattler); break; @@ -4304,7 +4305,7 @@ static void HandleTurnActionSelectionState(void) RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 1); } else if (gChosenActionByBattler[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))] == B_ACTION_USE_MOVE - && (gProtectStructs[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].onlyStruggle + && (gProtectStructs[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].noValidMoves || gDisableStructs[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].encoredMove)) { RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 1); @@ -4705,7 +4706,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) { if (gChosenActionByBattler[battler1] == B_ACTION_USE_MOVE) { - if (gProtectStructs[battler1].onlyStruggle) + if (gProtectStructs[battler1].noValidMoves) moveBattler1 = MOVE_STRUGGLE; else moveBattler1 = gBattleMons[battler1].moves[*(gBattleStruct->chosenMovePositions + battler1)]; @@ -4715,7 +4716,7 @@ u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) if (gChosenActionByBattler[battler2] == B_ACTION_USE_MOVE) { - if (gProtectStructs[battler2].onlyStruggle) + if (gProtectStructs[battler2].noValidMoves) moveBattler2 = MOVE_STRUGGLE; else moveBattler2 = gBattleMons[battler2].moves[*(gBattleStruct->chosenMovePositions + battler2)]; @@ -4917,7 +4918,7 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) if (gChosenMoveByBattler[gActiveBattler] == MOVE_FOCUS_PUNCH && !(gBattleMons[gActiveBattler].status1 & STATUS1_SLEEP) && !(gDisableStructs[gBattlerAttacker].truantCounter) - && !(gProtectStructs[gActiveBattler].onlyStruggle)) + && !(gProtectStructs[gActiveBattler].noValidMoves)) { BattleScriptExecute(BattleScript_FocusPunchSetUp); return; @@ -5290,9 +5291,9 @@ static void HandleAction_UseMove(void) gCurrMovePos = gChosenMovePos = *(gBattleStruct->chosenMovePositions + gBattlerAttacker); // choose move - if (gProtectStructs[gBattlerAttacker].onlyStruggle) + if (gProtectStructs[gBattlerAttacker].noValidMoves) { - gProtectStructs[gBattlerAttacker].onlyStruggle = 0; + gProtectStructs[gBattlerAttacker].noValidMoves = 0; gCurrentMove = gChosenMove = MOVE_STRUGGLE; gHitMarker |= HITMARKER_NO_PPDEDUCT; *(gBattleStruct->moveTarget + gBattlerAttacker) = GetMoveTarget(MOVE_STRUGGLE, 0); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bacaf2bac..eb6feb2a0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -40,6 +40,7 @@ #include "constants/battle_string_ids.h" #include "battle_setup.h" #include "overworld.h" +#include "party_menu.h" extern u16 gBattle_BG1_X; extern u16 gBattle_BG1_Y; @@ -5143,7 +5144,7 @@ static void sub_804CF10(u8 arg0) *(gBattleStruct->monToSwitchIntoId + gActiveBattler) = 6; gBattleStruct->field_93 &= ~(gBitTable[gActiveBattler]); - BtlController_EmitChoosePokemon(0, 1, arg0, 0, gBattleStruct->field_60[gActiveBattler]); + BtlController_EmitChoosePokemon(0, PARTY_MUST_CHOOSE_MON, arg0, 0, gBattleStruct->field_60[gActiveBattler]); MarkBattlerForControllerExec(gActiveBattler); } @@ -5382,9 +5383,9 @@ static void atk50_openpartyscreen(void) else { if (gBattlescriptCurrInstr[1] & 0x80) - hitmarkerFaintBits = 0; // used here as the caseId for the EmitChoose function + hitmarkerFaintBits = PARTY_CHOOSE_MON; // Used here as the caseId for the EmitChoose function. else - hitmarkerFaintBits = 1; + hitmarkerFaintBits = PARTY_MUST_CHOOSE_MON; battlerId = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(0x80)); if (gSpecialStatuses[battlerId].flag40) diff --git a/src/battle_util.c b/src/battle_util.c index 5d2ec62a9..6e3fc3e7f 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -455,12 +455,12 @@ bool8 AreAllMovesUnusable(void) if (unusable == 0xF) // All moves are unusable. { - gProtectStructs[gActiveBattler].onlyStruggle = 1; + gProtectStructs[gActiveBattler].noValidMoves = 1; gSelectionBattleScripts[gActiveBattler] = BattleScript_NoMovesLeft; } else { - gProtectStructs[gActiveBattler].onlyStruggle = 0; + gProtectStructs[gActiveBattler].noValidMoves = 0; } return (unusable == 0xF); diff --git a/src/pokemon.c b/src/pokemon.c index 80c1ab784..5406cfee9 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5582,19 +5582,19 @@ void BoxMonRestorePP(struct BoxPokemon *boxMon) } } -void sub_806E994(void) +void SetMonPreventsSwitchingString(void) { - gLastUsedAbility = gBattleStruct->field_B0; + gLastUsedAbility = gBattleStruct->abilityPreventingSwitchout; gBattleTextBuff1[0] = B_BUFF_PLACEHOLDER_BEGIN; gBattleTextBuff1[1] = B_BUFF_MON_NICK_WITH_PREFIX; - gBattleTextBuff1[2] = gBattleStruct->field_49; + gBattleTextBuff1[2] = gBattleStruct->battlerPreventingSwitchout; gBattleTextBuff1[4] = B_BUFF_EOS; - if (!GetBattlerSide(gBattleStruct->field_49)) - gBattleTextBuff1[3] = pokemon_order_func(gBattlerPartyIndexes[gBattleStruct->field_49]); + if (GetBattlerSide(gBattleStruct->battlerPreventingSwitchout) == B_SIDE_PLAYER) + gBattleTextBuff1[3] = pokemon_order_func(gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]); else - gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->field_49]; + gBattleTextBuff1[3] = gBattlerPartyIndexes[gBattleStruct->battlerPreventingSwitchout]; PREPARE_MON_NICK_WITH_PREFIX_BUFFER(gBattleTextBuff2, gBattlerInMenuId, pokemon_order_func(gBattlerPartyIndexes[gBattlerInMenuId])) |