mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Add controller buffer constants, finish misc battle doc
This commit is contained in:
parent
b0598b1aef
commit
fc15b0d5f0
@ -183,7 +183,7 @@
|
||||
.byte \battler
|
||||
.endm
|
||||
|
||||
.macro atk24 ptr:req
|
||||
.macro checkteamslost ptr:req
|
||||
.byte 0x24
|
||||
.4byte \ptr
|
||||
.endm
|
||||
@ -538,7 +538,7 @@
|
||||
.byte 0x5d
|
||||
.endm
|
||||
|
||||
.macro atk5E battler:req
|
||||
.macro updatebattlermoves battler:req
|
||||
.byte 0x5e
|
||||
.byte \battler
|
||||
.endm
|
||||
|
@ -2825,37 +2825,40 @@ BattleScript_GiveExp::
|
||||
end2
|
||||
|
||||
BattleScript_HandleFaintedMon::
|
||||
atk24 BattleScript_HandleFaintedMonMultiple
|
||||
checkteamslost BattleScript_LinkHandleFaintedMonMultiple
|
||||
jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_FaintedMonEnd
|
||||
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonTryChooseAnother
|
||||
jumpifword CMP_NO_COMMON_BITS, gHitMarker, HITMARKER_PLAYER_FAINTED, BattleScript_FaintedMonTryChooseAnother
|
||||
@ Yes/No for sending out a new Pokémon, when sending out is optional
|
||||
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonTryChoose
|
||||
jumpifword CMP_NO_COMMON_BITS, gHitMarker, HITMARKER_PLAYER_FAINTED, BattleScript_FaintedMonTryChoose
|
||||
@ Yes/No for sending out a new Pokémon if one is defeated in a wild battle
|
||||
printstring STRINGID_USENEXTPKMN
|
||||
setbyte gBattleCommunication, 0
|
||||
yesnobox
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0, BattleScript_FaintedMonTryChooseAnother
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 0, BattleScript_FaintedMonTryChoose
|
||||
@ Player said no, try to run
|
||||
jumpifplayerran BattleScript_FaintedMonEnd
|
||||
printstring STRINGID_CANTESCAPE2
|
||||
BattleScript_FaintedMonTryChooseAnother::
|
||||
BattleScript_FaintedMonTryChoose::
|
||||
openpartyscreen BS_FAINTED, BattleScript_FaintedMonEnd
|
||||
switchhandleorder BS_FAINTED, 2
|
||||
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonChooseAnother
|
||||
jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonChooseAnother
|
||||
jumpifbattletype BATTLE_TYPE_RECORDED_LINK, BattleScript_FaintedMonChooseAnother
|
||||
jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_FaintedMonChooseAnother
|
||||
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonChooseAnother
|
||||
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_PLAYER_FAINTED, BattleScript_FaintedMonChooseAnother
|
||||
jumpifbyte CMP_EQUAL, sBATTLE_STYLE, OPTIONS_BATTLE_STYLE_SET, BattleScript_FaintedMonChooseAnother
|
||||
jumpifcantswitch BS_PLAYER1, BattleScript_FaintedMonChooseAnother
|
||||
jumpifnotbattletype BATTLE_TYPE_TRAINER, BattleScript_FaintedMonSendOutNew
|
||||
jumpifbattletype BATTLE_TYPE_LINK, BattleScript_FaintedMonSendOutNew
|
||||
jumpifbattletype BATTLE_TYPE_RECORDED_LINK, BattleScript_FaintedMonSendOutNew
|
||||
jumpifbattletype BATTLE_TYPE_FRONTIER, BattleScript_FaintedMonSendOutNew
|
||||
jumpifbattletype BATTLE_TYPE_DOUBLE, BattleScript_FaintedMonSendOutNew
|
||||
jumpifword CMP_COMMON_BITS, gHitMarker, HITMARKER_PLAYER_FAINTED, BattleScript_FaintedMonSendOutNew
|
||||
jumpifbyte CMP_EQUAL, sBATTLE_STYLE, OPTIONS_BATTLE_STYLE_SET, BattleScript_FaintedMonSendOutNew
|
||||
jumpifcantswitch BS_PLAYER1, BattleScript_FaintedMonSendOutNew
|
||||
@ Yes/No for sending out a new Pokémon when the opponent is switching
|
||||
printstring STRINGID_ENEMYABOUTTOSWITCHPKMN
|
||||
setbyte gBattleCommunication, 0
|
||||
yesnobox
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 1, BattleScript_FaintedMonChooseAnother
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication + 1, 1, BattleScript_FaintedMonSendOutNew
|
||||
@ Player said yes, go to party screen (note optional flag, player may exit the menu instead)
|
||||
setatktoplayer0
|
||||
openpartyscreen BS_ATTACKER | PARTY_SCREEN_OPTIONAL, BattleScript_FaintedMonChooseAnother
|
||||
openpartyscreen BS_ATTACKER | PARTY_SCREEN_OPTIONAL, BattleScript_FaintedMonSendOutNew
|
||||
switchhandleorder BS_ATTACKER, 2
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication, PARTY_SIZE, BattleScript_FaintedMonChooseAnother
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication, PARTY_SIZE, BattleScript_FaintedMonSendOutNew
|
||||
@ Switch Pokémon before opponent
|
||||
atknameinbuff1
|
||||
resetintimidatetracebits BS_ATTACKER
|
||||
hpthresholds2 BS_ATTACKER
|
||||
@ -2874,7 +2877,7 @@ BattleScript_FaintedMonTryChooseAnother::
|
||||
waitstate
|
||||
switchineffects BS_ATTACKER
|
||||
resetsentmonsvalue
|
||||
BattleScript_FaintedMonChooseAnother::
|
||||
BattleScript_FaintedMonSendOutNew::
|
||||
drawpartystatussummary BS_FAINTED
|
||||
getswitchedmondata BS_FAINTED
|
||||
switchindataupdate BS_FAINTED
|
||||
@ -2890,13 +2893,13 @@ BattleScript_FaintedMonChooseAnother::
|
||||
BattleScript_FaintedMonEnd::
|
||||
end2
|
||||
|
||||
BattleScript_HandleFaintedMonMultiple::
|
||||
openpartyscreen BS_UNK_5, BattleScript_HandleFaintedMonMultipleStart
|
||||
BattleScript_HandleFaintedMonMultipleStart::
|
||||
BattleScript_LinkHandleFaintedMonMultiple::
|
||||
openpartyscreen BS_FAINTED_LINK_MULTIPLE_1, BattleScript_LinkHandleFaintedMonMultipleStart
|
||||
BattleScript_LinkHandleFaintedMonMultipleStart::
|
||||
switchhandleorder BS_FAINTED, 0
|
||||
openpartyscreen BS_UNK_6, BattleScript_HandleFaintedMonMultipleEnd
|
||||
openpartyscreen BS_FAINTED_LINK_MULTIPLE_2, BattleScript_LinkHandleFaintedMonMultipleEnd
|
||||
switchhandleorder BS_FAINTED, 0
|
||||
BattleScript_HandleFaintedMonLoop::
|
||||
BattleScript_LinkHandleFaintedMonLoop::
|
||||
switchhandleorder BS_FAINTED, 3
|
||||
drawpartystatussummary BS_FAINTED
|
||||
getswitchedmondata BS_FAINTED
|
||||
@ -2906,9 +2909,9 @@ BattleScript_HandleFaintedMonLoop::
|
||||
hidepartystatussummary BS_FAINTED
|
||||
switchinanim BS_FAINTED, FALSE
|
||||
waitstate
|
||||
switchineffects BS_UNK_5
|
||||
jumpifbytenotequal gBattlerFainted, gBattlersCount, BattleScript_HandleFaintedMonLoop
|
||||
BattleScript_HandleFaintedMonMultipleEnd::
|
||||
switchineffects BS_FAINTED_LINK_MULTIPLE_1
|
||||
jumpifbytenotequal gBattlerFainted, gBattlersCount, BattleScript_LinkHandleFaintedMonLoop
|
||||
BattleScript_LinkHandleFaintedMonMultipleEnd::
|
||||
end2
|
||||
|
||||
BattleScript_LocalTrainerBattleWon::
|
||||
@ -3208,7 +3211,7 @@ BattleScript_DamagingWeatherLoop::
|
||||
healthbarupdate BS_ATTACKER
|
||||
datahpupdate BS_ATTACKER
|
||||
tryfaintmon BS_ATTACKER, FALSE, NULL
|
||||
atk24 BattleScript_DamagingWeatherLoopIncrement
|
||||
checkteamslost BattleScript_DamagingWeatherLoopIncrement
|
||||
BattleScript_DamagingWeatherLoopIncrement::
|
||||
jumpifbyte CMP_NOT_EQUAL, gBattleOutcome, 0, BattleScript_DamagingWeatherContinuesEnd
|
||||
addbyte gBattleCommunication, 1
|
||||
@ -3523,7 +3526,7 @@ BattleScript_DoFutureAttackHit::
|
||||
resultmessage
|
||||
waitmessage B_WAIT_TIME_LONG
|
||||
tryfaintmon BS_TARGET, FALSE, NULL
|
||||
atk24 BattleScript_FutureAttackEnd
|
||||
checkteamslost BattleScript_FutureAttackEnd
|
||||
BattleScript_FutureAttackEnd::
|
||||
moveendcase MOVEEND_RAGE
|
||||
moveendfromto MOVEEND_ITEM_EFFECTS_ALL, MOVEEND_UPDATE_LAST_MOVES
|
||||
@ -3737,7 +3740,7 @@ BattleScript_DoTurnDmg::
|
||||
healthbarupdate BS_ATTACKER
|
||||
datahpupdate BS_ATTACKER
|
||||
tryfaintmon BS_ATTACKER, FALSE, NULL
|
||||
atk24 BattleScript_DoTurnDmgEnd
|
||||
checkteamslost BattleScript_DoTurnDmgEnd
|
||||
BattleScript_DoTurnDmgEnd::
|
||||
end2
|
||||
|
||||
|
@ -145,7 +145,7 @@ struct SpecialStatus
|
||||
u32 intimidatedMon:1;
|
||||
u32 traced:1;
|
||||
u32 ppNotAffectedByPressure:1;
|
||||
u32 flag40:1;
|
||||
u32 faintedHasReplacement:1;
|
||||
u32 focusBanded:1;
|
||||
s32 dmg;
|
||||
s32 physicalDmg;
|
||||
@ -384,9 +384,9 @@ struct BattleStruct
|
||||
u8 field_52;
|
||||
u8 sentInPokes;
|
||||
bool8 selectionScriptFinished[MAX_BATTLERS_COUNT];
|
||||
u8 field_58[4];
|
||||
u8 battlerPartyIndexes[MAX_BATTLERS_COUNT];
|
||||
u8 monToSwitchIntoId[MAX_BATTLERS_COUNT];
|
||||
u8 field_60[4][3];
|
||||
u8 battlerPartyOrders[MAX_BATTLERS_COUNT][PARTY_SIZE / 2];
|
||||
u8 runTries;
|
||||
u8 caughtMonNick[POKEMON_NAME_LENGTH + 1];
|
||||
u8 unused_2;
|
||||
@ -405,7 +405,7 @@ struct BattleStruct
|
||||
u8 stringMoveType;
|
||||
u8 expGetterBattlerId;
|
||||
u8 unused_5;
|
||||
u8 field_91; // related to gAbsentBattlerFlags, possibly absent flags turn ago?
|
||||
u8 absentBattlerFlags;
|
||||
u8 palaceFlags; // First 4 bits are "is < 50% HP and not asleep" for each battler, last 4 bits are selected moves to pass to AI
|
||||
u8 field_93; // related to choosing pokemon?
|
||||
u8 wallyBattleState;
|
||||
|
@ -1,8 +1,7 @@
|
||||
#ifndef GUARD_BATTLE_CONTROLLERS_H
|
||||
#define GUARD_BATTLE_CONTROLLERS_H
|
||||
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
REQUEST_ALL_BATTLE,
|
||||
REQUEST_SPECIES_BATTLE,
|
||||
REQUEST_HELDITEM_BATTLE,
|
||||
@ -67,19 +66,36 @@ enum
|
||||
|
||||
// Special arguments for Battle Controller functions.
|
||||
|
||||
#define RESET_ACTION_MOVE_SELECTION 0
|
||||
#define RESET_ACTION_SELECTION 1
|
||||
#define RESET_MOVE_SELECTION 2
|
||||
enum { // Values given to the emit functions to choose gBattleBufferA or gBattleBufferB
|
||||
BUFFER_A,
|
||||
BUFFER_B
|
||||
};
|
||||
|
||||
#define BALL_NO_SHAKES 0
|
||||
#define BALL_1_SHAKE 1
|
||||
#define BALL_2_SHAKES 2
|
||||
#define BALL_3_SHAKES_FAIL 3
|
||||
#define BALL_3_SHAKES_SUCCESS 4
|
||||
#define BALL_TRAINER_BLOCK 5
|
||||
enum {
|
||||
RESET_ACTION_MOVE_SELECTION,
|
||||
RESET_ACTION_SELECTION,
|
||||
RESET_MOVE_SELECTION,
|
||||
};
|
||||
|
||||
enum {
|
||||
BALL_NO_SHAKES,
|
||||
BALL_1_SHAKE,
|
||||
BALL_2_SHAKES,
|
||||
BALL_3_SHAKES_FAIL,
|
||||
BALL_3_SHAKES_SUCCESS,
|
||||
BALL_TRAINER_BLOCK,
|
||||
};
|
||||
|
||||
enum {
|
||||
LINK_STANDBY_MSG_STOP_BOUNCE,
|
||||
LINK_STANDBY_STOP_BOUNCE_ONLY,
|
||||
LINK_STANDBY_MSG_ONLY,
|
||||
};
|
||||
|
||||
#define INSTANT_HP_BAR_DROP 32767
|
||||
|
||||
#define PARTY_SUMM_SKIP_DRAW_DELAY (1 << 7)
|
||||
|
||||
// Special return values in gBattleBufferB from Battle Controller functions.
|
||||
#define RET_VALUE_LEVELED_UP 11
|
||||
|
||||
@ -191,7 +207,7 @@ void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 b
|
||||
void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused
|
||||
void BtlController_EmitLoadMonSprite(u8 bufferId);
|
||||
void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
|
||||
void BtlController_EmitReturnMonToBall(u8 bufferId, u8 arg1);
|
||||
void BtlController_EmitReturnMonToBall(u8 bufferId, bool8 skipAnim);
|
||||
void BtlController_EmitDrawTrainerPic(u8 bufferId);
|
||||
void BtlController_EmitTrainerSlide(u8 bufferId);
|
||||
void BtlController_EmitTrainerSlideBack(u8 bufferId);
|
||||
@ -203,11 +219,11 @@ void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data); // unused
|
||||
void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit);
|
||||
void BtlController_EmitPrintString(u8 bufferId, u16 stringId);
|
||||
void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId);
|
||||
void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2);
|
||||
void BtlController_EmitChooseAction(u8 bufferId, u8 action, u16 itemId);
|
||||
void BtlController_EmitYesNoBox(u8 bufferId);
|
||||
void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData);
|
||||
void BtlController_EmitChooseItem(u8 bufferId, u8* arg1);
|
||||
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* data);
|
||||
void BtlController_EmitCmd23(u8 bufferId); // unused
|
||||
void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
|
||||
void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
|
||||
@ -216,7 +232,7 @@ void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
|
||||
void BtlController_EmitStatusXor(u8 bufferId, u8 b); // unused
|
||||
void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data);
|
||||
void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused
|
||||
void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused
|
||||
void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data); // unused
|
||||
void BtlController_EmitCmd32(u8 bufferId, u16 size, void *c); // unused
|
||||
void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2);
|
||||
void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c);
|
||||
@ -233,7 +249,7 @@ void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM);
|
||||
void BtlController_EmitFaintingCry(u8 bufferId);
|
||||
void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId);
|
||||
void BtlController_EmitIntroTrainerBallThrow(u8 bufferId);
|
||||
void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
|
||||
void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 flags);
|
||||
void BtlController_EmitHidePartyStatusSummary(u8 bufferId);
|
||||
void BtlController_EmitEndBounceEffect(u8 bufferId);
|
||||
void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
|
||||
|
@ -40,8 +40,8 @@
|
||||
#define BS_EFFECT_BATTLER 2
|
||||
#define BS_FAINTED 3
|
||||
#define BS_ATTACKER_WITH_PARTNER 4 // for Cmd_updatestatusicon
|
||||
#define BS_UNK_5 5
|
||||
#define BS_UNK_6 6
|
||||
#define BS_FAINTED_LINK_MULTIPLE_1 5
|
||||
#define BS_FAINTED_LINK_MULTIPLE_2 6
|
||||
#define BS_BATTLER_0 7
|
||||
#define BS_ATTACKER_SIDE 8 // for Cmd_jumpifability
|
||||
#define BS_NOT_ATTACKER_SIDE 9 // for Cmd_jumpifability
|
||||
|
@ -22,7 +22,7 @@ static bool8 ShouldSwitchIfPerishSong(void)
|
||||
&& gDisableStructs[gActiveBattler].perishSongTimer == 0)
|
||||
{
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
@ -106,7 +106,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
|
||||
{
|
||||
// We found a mon.
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -206,7 +206,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
|
||||
{
|
||||
// we found a mon.
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -226,13 +226,13 @@ static bool8 ShouldSwitchIfNaturalCure(void)
|
||||
if ((gLastLandedMoves[gActiveBattler] == 0 || gLastLandedMoves[gActiveBattler] == 0xFFFF) && Random() & 1)
|
||||
{
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
return TRUE;
|
||||
}
|
||||
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0 && Random() & 1)
|
||||
{
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ static bool8 ShouldSwitchIfNaturalCure(void)
|
||||
if (Random() & 1)
|
||||
{
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
|
||||
if (moveFlags & MOVE_RESULT_SUPER_EFFECTIVE && Random() % moduloPercent == 0)
|
||||
{
|
||||
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = i;
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -597,7 +597,7 @@ void AI_TrySwitchOrUseItem(void)
|
||||
}
|
||||
}
|
||||
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, (gActiveBattler ^ BIT_SIDE) << 8);
|
||||
}
|
||||
|
||||
static void ModulateByTypeEffectiveness(u8 atkType, u8 defType1, u8 defType2, u8 *var)
|
||||
@ -923,7 +923,7 @@ static bool8 ShouldUseItem(void)
|
||||
|
||||
if (shouldUse)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_ITEM, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_ITEM, 0);
|
||||
*(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2) = item;
|
||||
gBattleResources->battleHistory->trainerItems[i] = 0;
|
||||
return shouldUse;
|
||||
|
@ -555,7 +555,7 @@ static void LinkOpponentHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
|
@ -442,7 +442,7 @@ static void LinkPartnerHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ static void OpponentHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -875,7 +875,7 @@ static void OpponentHandleGetRawMonData(void)
|
||||
for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = src[i];
|
||||
|
||||
BtlController_EmitDataTransfer(1, gBattleBufferA[gActiveBattler][2], dst);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, gBattleBufferA[gActiveBattler][2], dst);
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1546,7 +1546,7 @@ static void OpponentHandleChooseMove(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
else
|
||||
@ -1563,13 +1563,13 @@ static void OpponentHandleChooseMove(void)
|
||||
switch (chosenMoveId)
|
||||
{
|
||||
case AI_CHOICE_WATCH:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_WATCH_CAREFULLY, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_WATCH_CAREFULLY, 0);
|
||||
break;
|
||||
case AI_CHOICE_FLEE:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_RUN, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_RUN, 0);
|
||||
break;
|
||||
case 6:
|
||||
BtlController_EmitTwoReturnValues(1, 15, gBattlerTarget);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 15, gBattlerTarget);
|
||||
break;
|
||||
default:
|
||||
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
|
||||
@ -1580,7 +1580,7 @@ static void OpponentHandleChooseMove(void)
|
||||
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
|
||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
|
||||
}
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gBattlerTarget << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8));
|
||||
break;
|
||||
}
|
||||
OpponentBufferExecCompleted();
|
||||
@ -1595,11 +1595,11 @@ static void OpponentHandleChooseMove(void)
|
||||
} while (move == MOVE_NONE);
|
||||
|
||||
if (gBattleMoves[move].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (gActiveBattler << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (gActiveBattler << 8));
|
||||
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8));
|
||||
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
@ -1608,7 +1608,7 @@ static void OpponentHandleChooseMove(void)
|
||||
|
||||
static void OpponentHandleChooseItem(void)
|
||||
{
|
||||
BtlController_EmitOneReturnValue(1, *(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2));
|
||||
BtlController_EmitOneReturnValue(BUFFER_B, *(gBattleStruct->chosenItem + (gActiveBattler / 2) * 2));
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1665,7 +1665,7 @@ static void OpponentHandleChoosePokemon(void)
|
||||
|
||||
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId;
|
||||
BtlController_EmitChosenMonReturnValue(1, chosenMonId, NULL);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, chosenMonId, NULL);
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
|
@ -248,17 +248,17 @@ static void HandleInputChooseAction(void)
|
||||
|
||||
switch (gActionSelectionCursor[gActiveBattler])
|
||||
{
|
||||
case B_ACTION_USE_MOVE:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, 0);
|
||||
case 0: // Top left
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, 0);
|
||||
break;
|
||||
case B_ACTION_USE_ITEM:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_ITEM, 0);
|
||||
case 1: // Top right
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_ITEM, 0);
|
||||
break;
|
||||
case B_ACTION_SWITCH:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SWITCH, 0);
|
||||
case 2: // Bottom left
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
|
||||
break;
|
||||
case B_ACTION_RUN:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_RUN, 0);
|
||||
case 3: // Bottom right
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_RUN, 0);
|
||||
break;
|
||||
}
|
||||
PlayerBufferExecCompleted();
|
||||
@ -319,7 +319,7 @@ static void HandleInputChooseAction(void)
|
||||
return;
|
||||
}
|
||||
PlaySE(SE_SELECT);
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_CANCEL_PARTNER, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_CANCEL_PARTNER, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
@ -365,7 +365,7 @@ static void HandleInputChooseTarget(void)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
@ -523,7 +523,7 @@ static void HandleInputChooseMove(void)
|
||||
|
||||
if (!canSelectTarget)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else
|
||||
@ -543,7 +543,7 @@ static void HandleInputChooseMove(void)
|
||||
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
BtlController_EmitTwoReturnValues(1, 10, 0xFFFF);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, 0xFFFF);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else if (JOY_NEW(DPAD_LEFT))
|
||||
@ -1174,7 +1174,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
savedActiveBattler = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBattler;
|
||||
|
||||
if (IsDoubleBattle() == TRUE
|
||||
@ -1253,7 +1253,7 @@ static void Task_GiveExpWithExpBar(u8 taskId)
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
savedActiveBattler = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBattler;
|
||||
gTasks[taskId].func = Task_LaunchLvlUpAnim;
|
||||
}
|
||||
@ -1361,9 +1361,9 @@ static void WaitForMonSelection(void)
|
||||
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||
{
|
||||
if (gPartyMenuUseExitCallback == TRUE)
|
||||
BtlController_EmitChosenMonReturnValue(1, gSelectedMonPartyId, gBattlePartyCurrentOrder);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, gSelectedMonPartyId, gBattlePartyCurrentOrder);
|
||||
else
|
||||
BtlController_EmitChosenMonReturnValue(1, PARTY_SIZE, NULL);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, PARTY_SIZE, NULL);
|
||||
|
||||
if ((gBattleBufferA[gActiveBattler][1] & 0xF) == 1)
|
||||
PrintLinkStandbyMsg();
|
||||
@ -1387,7 +1387,7 @@ static void CompleteWhenChoseItem(void)
|
||||
{
|
||||
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||
{
|
||||
BtlController_EmitOneReturnValue(1, gSpecialVar_ItemId);
|
||||
BtlController_EmitOneReturnValue(BUFFER_B, gSpecialVar_ItemId);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
@ -1439,9 +1439,9 @@ static void PlayerHandleYesNoInput(void)
|
||||
PlaySE(SE_SELECT);
|
||||
|
||||
if (gMultiUsePlayerCursor != 0)
|
||||
BtlController_EmitTwoReturnValues(1, 0xE, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 0xE, 0);
|
||||
else
|
||||
BtlController_EmitTwoReturnValues(1, 0xD, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 0xD, 0);
|
||||
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
@ -1600,7 +1600,7 @@ static void PlayerHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1920,7 +1920,7 @@ void PlayerHandleGetRawMonData(void)
|
||||
for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++)
|
||||
dst[i] = src[i];
|
||||
|
||||
BtlController_EmitDataTransfer(1, gBattleBufferA[gActiveBattler][2], dst);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, gBattleBufferA[gActiveBattler][2], dst);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -2226,13 +2226,14 @@ static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit)
|
||||
|
||||
static void PlayerHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleBufferA[gActiveBattler][1] == 0)
|
||||
if (!gBattleBufferA[gActiveBattler][1])
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skip animation, just remove battler
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
@ -2620,7 +2621,7 @@ static void PlayerChooseMoveInBattlePalace(void)
|
||||
if (--*(gBattleStruct->arenaMindPoints + gActiveBattler) == 0)
|
||||
{
|
||||
gBattlePalaceMoveSelectionRngValue = gRngValue;
|
||||
BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
@ -2670,7 +2671,7 @@ static void PlayerHandleChoosePokemon(void)
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_ARENA && (gBattleBufferA[gActiveBattler][1] & 0xF) != PARTY_ACTION_CANT_SWITCH)
|
||||
{
|
||||
BtlController_EmitChosenMonReturnValue(1, gBattlerPartyIndexes[gActiveBattler] + 1, gBattlePartyCurrentOrder);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, gBattlerPartyIndexes[gActiveBattler] + 1, gBattlePartyCurrentOrder);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
else
|
||||
@ -2827,25 +2828,25 @@ static void PlayerHandleCmd32(void)
|
||||
|
||||
static void PlayerHandleTwoReturnValues(void)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, 0, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 0, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void PlayerHandleChosenMonReturnValue(void)
|
||||
{
|
||||
BtlController_EmitChosenMonReturnValue(1, 0, NULL);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, 0, NULL);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void PlayerHandleOneReturnValue(void)
|
||||
{
|
||||
BtlController_EmitOneReturnValue(1, 0);
|
||||
BtlController_EmitOneReturnValue(BUFFER_B, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void PlayerHandleOneReturnValue_Duplicate(void)
|
||||
{
|
||||
BtlController_EmitOneReturnValue_Duplicate(1, 0);
|
||||
BtlController_EmitOneReturnValue_Duplicate(BUFFER_B, 0);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -3098,14 +3099,14 @@ static void PlayerHandleLinkStandbyMsg(void)
|
||||
RecordedBattle_RecordAllBattlerData(&gBattleBufferA[gActiveBattler][2]);
|
||||
switch (gBattleBufferA[gActiveBattler][1])
|
||||
{
|
||||
case 0:
|
||||
case LINK_STANDBY_MSG_STOP_BOUNCE:
|
||||
PrintLinkStandbyMsg();
|
||||
// fall through
|
||||
case 1:
|
||||
case LINK_STANDBY_STOP_BOUNCE_ONLY:
|
||||
EndBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX);
|
||||
EndBounceEffect(gActiveBattler, BOUNCE_MON);
|
||||
break;
|
||||
case 2:
|
||||
case LINK_STANDBY_MSG_ONLY:
|
||||
PrintLinkStandbyMsg();
|
||||
break;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ static void Task_GiveExpToMon(u8 taskId)
|
||||
gainedExp -= nextLvlExp - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
|
||||
if (IsDoubleBattle() == TRUE
|
||||
@ -411,7 +411,7 @@ static void Task_GiveExpWithExpBar(u8 taskId)
|
||||
gainedExp -= expOnNextLvl - currExp;
|
||||
savedActiveBank = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitTwoReturnValues(1, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, RET_VALUE_LEVELED_UP, gainedExp);
|
||||
gActiveBattler = savedActiveBank;
|
||||
gTasks[taskId].func = Task_LaunchLvlUpAnim;
|
||||
}
|
||||
@ -626,7 +626,7 @@ static void PlayerPartnerHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1527,7 +1527,7 @@ static void PlayerPartnerHandleChooseMove(void)
|
||||
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
|
||||
}
|
||||
|
||||
BtlController_EmitTwoReturnValues(1, 10, chosenMoveId | (gBattlerTarget << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, chosenMoveId | (gBattlerTarget << 8));
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1557,7 +1557,7 @@ static void PlayerPartnerHandleChoosePokemon(void)
|
||||
}
|
||||
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId;
|
||||
BtlController_EmitChosenMonReturnValue(1, chosenMonId, NULL);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, chosenMonId, NULL);
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ static void RecordedOpponentHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1406,7 +1406,7 @@ static void RecordedOpponentHandlePrintSelectionString(void)
|
||||
|
||||
static void RecordedOpponentHandleChooseAction(void)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, RecordedBattle_GetBattlerAction(gActiveBattler), 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, RecordedBattle_GetBattlerAction(gActiveBattler), 0);
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1419,13 +1419,13 @@ static void RecordedOpponentHandleChooseMove(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 moveId = RecordedBattle_GetBattlerAction(gActiveBattler);
|
||||
u8 target = RecordedBattle_GetBattlerAction(gActiveBattler);
|
||||
BtlController_EmitTwoReturnValues(1, 10, moveId | (target << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, moveId | (target << 8));
|
||||
}
|
||||
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
@ -1439,7 +1439,7 @@ static void RecordedOpponentHandleChooseItem(void)
|
||||
static void RecordedOpponentHandleChoosePokemon(void)
|
||||
{
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_GetBattlerAction(gActiveBattler);
|
||||
BtlController_EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL);
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,7 @@ static void RecordedPlayerHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1414,7 +1414,7 @@ static void ChooseActionInBattlePalace(void)
|
||||
{
|
||||
if (gBattleCommunication[4] >= gBattlersCount / 2)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, RecordedBattle_GetBattlerAction(gActiveBattler), 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, RecordedBattle_GetBattlerAction(gActiveBattler), 0);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
@ -1427,7 +1427,7 @@ static void RecordedPlayerHandleChooseAction(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, RecordedBattle_GetBattlerAction(gActiveBattler), 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, RecordedBattle_GetBattlerAction(gActiveBattler), 0);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
@ -1441,13 +1441,13 @@ static void RecordedPlayerHandleChooseMove(void)
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace());
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 moveId = RecordedBattle_GetBattlerAction(gActiveBattler);
|
||||
u8 target = RecordedBattle_GetBattlerAction(gActiveBattler);
|
||||
BtlController_EmitTwoReturnValues(1, 10, moveId | (target << 8));
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, moveId | (target << 8));
|
||||
}
|
||||
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
@ -1461,7 +1461,7 @@ static void RecordedPlayerHandleChooseItem(void)
|
||||
static void RecordedPlayerHandleChoosePokemon(void)
|
||||
{
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = RecordedBattle_GetBattlerAction(gActiveBattler);
|
||||
BtlController_EmitChosenMonReturnValue(1, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL);
|
||||
BtlController_EmitChosenMonReturnValue(BUFFER_B, *(gBattleStruct->monToSwitchIntoId + gActiveBattler), NULL);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
|
||||
|
@ -176,16 +176,16 @@ static void HandleInputChooseAction(void)
|
||||
switch (gActionSelectionCursor[gActiveBattler])
|
||||
{
|
||||
case 0:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_BALL, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_BALL, 0);
|
||||
break;
|
||||
case 1:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_POKEBLOCK, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_POKEBLOCK, 0);
|
||||
break;
|
||||
case 2:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_GO_NEAR, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_GO_NEAR, 0);
|
||||
break;
|
||||
case 3:
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_RUN, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SAFARI_RUN, 0);
|
||||
break;
|
||||
}
|
||||
SafariBufferExecCompleted();
|
||||
@ -280,7 +280,7 @@ static void CompleteWhenChosePokeblock(void)
|
||||
{
|
||||
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||
{
|
||||
BtlController_EmitOneReturnValue(1, gSpecialVar_ItemId);
|
||||
BtlController_EmitOneReturnValue(BUFFER_B, gSpecialVar_ItemId);
|
||||
SafariBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ static void WallyHandleActions(void)
|
||||
if (--gBattleStruct->wallyWaitFrames == 0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, 0);
|
||||
WallyBufferExecCompleted();
|
||||
gBattleStruct->wallyBattleState++;
|
||||
gBattleStruct->wallyMovesState = 0;
|
||||
@ -207,7 +207,7 @@ static void WallyHandleActions(void)
|
||||
if (--gBattleStruct->wallyWaitFrames == 0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_MOVE, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_MOVE, 0);
|
||||
WallyBufferExecCompleted();
|
||||
gBattleStruct->wallyBattleState++;
|
||||
gBattleStruct->wallyMovesState = 0;
|
||||
@ -217,7 +217,7 @@ static void WallyHandleActions(void)
|
||||
case 3:
|
||||
if (--gBattleStruct->wallyWaitFrames == 0)
|
||||
{
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_WALLY_THROW, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_WALLY_THROW, 0);
|
||||
WallyBufferExecCompleted();
|
||||
gBattleStruct->wallyBattleState++;
|
||||
gBattleStruct->wallyMovesState = 0;
|
||||
@ -238,7 +238,7 @@ static void WallyHandleActions(void)
|
||||
if (--gBattleStruct->wallyWaitFrames == 0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
BtlController_EmitTwoReturnValues(1, B_ACTION_USE_ITEM, 0);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_USE_ITEM, 0);
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
break;
|
||||
@ -278,7 +278,7 @@ static void CompleteOnChosenItem(void)
|
||||
{
|
||||
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||
{
|
||||
BtlController_EmitOneReturnValue(1, gSpecialVar_ItemId);
|
||||
BtlController_EmitOneReturnValue(BUFFER_B, gSpecialVar_ItemId);
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
@ -444,7 +444,7 @@ static void WallyHandleGetMonData(void)
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(1, size, monData);
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
|
||||
@ -1241,7 +1241,7 @@ static void WallyHandleChooseMove(void)
|
||||
if (--gBattleStruct->wallyMoveFrames == 0)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
BtlController_EmitTwoReturnValues(1, 10, 0x100);
|
||||
BtlController_EmitTwoReturnValues(BUFFER_B, 10, 0x100);
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
break;
|
||||
|
@ -660,14 +660,14 @@ static void PrepareBufferDataTransfer(u8 bufferId, u8 *data, u16 size)
|
||||
{
|
||||
switch (bufferId)
|
||||
{
|
||||
case 0:
|
||||
case BUFFER_A:
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
gBattleBufferA[gActiveBattler][i] = *data;
|
||||
data++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case BUFFER_B:
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
gBattleBufferB[gActiveBattler][i] = *data;
|
||||
@ -737,7 +737,7 @@ void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data)
|
||||
|
||||
static void Task_HandleSendLinkBuffersData(u8 taskId)
|
||||
{
|
||||
u16 var;
|
||||
u16 numPlayers;
|
||||
u16 blockSize;
|
||||
|
||||
switch (gTasks[taskId].data[11])
|
||||
@ -759,11 +759,11 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
|
||||
else
|
||||
{
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER)
|
||||
var = 2;
|
||||
numPlayers = 2;
|
||||
else
|
||||
var = (gBattleTypeFlags & BATTLE_TYPE_MULTI) ? 4 : 2;
|
||||
numPlayers = (gBattleTypeFlags & BATTLE_TYPE_MULTI) ? 4 : 2;
|
||||
|
||||
if (GetLinkPlayerCount_2() >= var)
|
||||
if (GetLinkPlayerCount_2() >= numPlayers)
|
||||
{
|
||||
if (IsLinkMaster())
|
||||
{
|
||||
@ -964,10 +964,10 @@ void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubs
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
void BtlController_EmitReturnMonToBall(u8 bufferId, u8 arg1)
|
||||
void BtlController_EmitReturnMonToBall(u8 bufferId, bool8 skipAnim)
|
||||
{
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL;
|
||||
sBattleBuffersTransferData[1] = arg1;
|
||||
sBattleBuffersTransferData[1] = skipAnim;
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
|
||||
}
|
||||
|
||||
@ -1134,12 +1134,13 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct BattleMsgData) + 4);
|
||||
}
|
||||
|
||||
void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2)
|
||||
// itemId only relevant for B_ACTION_USE_ITEM
|
||||
void BtlController_EmitChooseAction(u8 bufferId, u8 action, u16 itemId)
|
||||
{
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEACTION;
|
||||
sBattleBuffersTransferData[1] = arg1;
|
||||
sBattleBuffersTransferData[2] = arg2;
|
||||
sBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8;
|
||||
sBattleBuffersTransferData[1] = action;
|
||||
sBattleBuffersTransferData[2] = itemId;
|
||||
sBattleBuffersTransferData[3] = (itemId & 0xFF00) >> 8;
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
@ -1177,7 +1178,7 @@ void BtlController_EmitChooseItem(u8 bufferId, u8 *arg1)
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abilityId, u8 *arg4)
|
||||
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abilityId, u8 *data)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@ -1186,7 +1187,7 @@ void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abili
|
||||
sBattleBuffersTransferData[2] = slotId;
|
||||
sBattleBuffersTransferData[3] = abilityId;
|
||||
for (i = 0; i < 3; i++)
|
||||
sBattleBuffersTransferData[4 + i] = arg4[i];
|
||||
sBattleBuffersTransferData[4 + i] = data[i];
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // Only 7 bytes were written.
|
||||
}
|
||||
|
||||
@ -1280,15 +1281,19 @@ void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 7);
|
||||
}
|
||||
|
||||
void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter)
|
||||
// Unused
|
||||
void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_PLAYBGM;
|
||||
sBattleBuffersTransferData[1] = songId;
|
||||
sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
|
||||
for (i = 0; i < songId; i++) // ????
|
||||
sBattleBuffersTransferData[3 + i] = *(u8*)(unusedDumbDataParameter++);
|
||||
|
||||
// Nonsense loop using songId as a size
|
||||
// Would go out of bounds for any song id after SE_RG_BAG_POCKET (253)
|
||||
for (i = 0; i < songId; i++)
|
||||
sBattleBuffersTransferData[3 + i] = *(u8*)(data++);
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, songId + 3);
|
||||
}
|
||||
|
||||
@ -1442,8 +1447,8 @@ void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* h
|
||||
s32 i;
|
||||
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
|
||||
sBattleBuffersTransferData[1] = flags & 0x7F;
|
||||
sBattleBuffersTransferData[2] = (flags & 0x80) >> 7; // If true, skip delay after drawing. True during intro
|
||||
sBattleBuffersTransferData[1] = flags & ~PARTY_SUMM_SKIP_DRAW_DELAY; // If true, skip player side
|
||||
sBattleBuffersTransferData[2] = (flags & PARTY_SUMM_SKIP_DRAW_DELAY) >> 7; // If true, skip delay after drawing. True during intro
|
||||
sBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
|
||||
for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * PARTY_SIZE); i++)
|
||||
sBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus));
|
||||
@ -1486,11 +1491,12 @@ void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument
|
||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
|
||||
}
|
||||
|
||||
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 record)
|
||||
// mode is a LINK_STANDBY_* constant
|
||||
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 mode, bool32 record)
|
||||
{
|
||||
bool8 record_ = record;
|
||||
sBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG;
|
||||
sBattleBuffersTransferData[1] = arg1;
|
||||
sBattleBuffersTransferData[1] = mode;
|
||||
|
||||
if (record_)
|
||||
sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = RecordedBattle_BufferNewBattlerData(&sBattleBuffersTransferData[4]);
|
||||
|
@ -105,7 +105,7 @@ static void TryDoEventsBeforeFirstTurn(void);
|
||||
static void HandleTurnActionSelectionState(void);
|
||||
static void RunTurnActionsFunctions(void);
|
||||
static void SetActionsAndBattlersTurnOrder(void);
|
||||
static void sub_803CDF8(void);
|
||||
static void UpdateBattlerPartyOrdersOnSwitch(void);
|
||||
static bool8 AllAtActionConfirmed(void);
|
||||
static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void);
|
||||
static void FreeResetData_ReturnToOvOrDoEvolutions(void);
|
||||
@ -2063,7 +2063,8 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir
|
||||
return gTrainers[trainerNum].partySize;
|
||||
}
|
||||
|
||||
static void sub_8038A04(void) // unused
|
||||
// Unused
|
||||
static void HBlankCB_Battle(void)
|
||||
{
|
||||
if (REG_VCOUNT < DISPLAY_HEIGHT && REG_VCOUNT >= 111)
|
||||
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_SCREENBASE(24) | BGCNT_TXT256x512);
|
||||
@ -3348,7 +3349,7 @@ static void BattleIntroGetMonsData(void)
|
||||
{
|
||||
case 0:
|
||||
gActiveBattler = gBattleCommunication[1];
|
||||
BtlController_EmitGetMonData(0, REQUEST_ALL_BATTLE, 0);
|
||||
BtlController_EmitGetMonData(BUFFER_A, REQUEST_ALL_BATTLE, 0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
break;
|
||||
@ -3370,7 +3371,7 @@ static void BattleIntroPrepareBackgroundSlide(void)
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
{
|
||||
gActiveBattler = GetBattlerAtPosition(0);
|
||||
BtlController_EmitIntroSlide(0, gBattleTerrain);
|
||||
BtlController_EmitIntroSlide(BUFFER_A, gBattleTerrain);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattleMainFunc = BattleIntroDrawTrainersOrMonsSprites;
|
||||
gBattleCommunication[0] = 0;
|
||||
@ -3415,7 +3416,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
||||
|
||||
if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_LEFT)
|
||||
{
|
||||
BtlController_EmitDrawTrainerPic(0);
|
||||
BtlController_EmitDrawTrainerPic(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
|
||||
@ -3423,7 +3424,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
||||
{
|
||||
if (GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_LEFT)
|
||||
{
|
||||
BtlController_EmitDrawTrainerPic(0);
|
||||
BtlController_EmitDrawTrainerPic(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT
|
||||
@ -3448,7 +3449,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
||||
{
|
||||
HandleSetPokedexFlag(SpeciesToNationalPokedexNum(gBattleMons[gActiveBattler].species), FLAG_SET_SEEN, gBattleMons[gActiveBattler].personality);
|
||||
}
|
||||
BtlController_EmitLoadMonSprite(0);
|
||||
BtlController_EmitLoadMonSprite(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattleResults.lastOpponentSpecies = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES, NULL);
|
||||
}
|
||||
@ -3459,14 +3460,14 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
||||
if (GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT
|
||||
|| GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)
|
||||
{
|
||||
BtlController_EmitDrawTrainerPic(0);
|
||||
BtlController_EmitDrawTrainerPic(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS && GetBattlerPosition(gActiveBattler) == B_POSITION_OPPONENT_RIGHT)
|
||||
{
|
||||
BtlController_EmitDrawTrainerPic(0);
|
||||
BtlController_EmitDrawTrainerPic(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
|
||||
@ -3501,7 +3502,7 @@ static void BattleIntroDrawPartySummaryScreens(void)
|
||||
}
|
||||
}
|
||||
gActiveBattler = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
|
||||
BtlController_EmitDrawPartyStatusSummary(0, hpStatus, 0x80);
|
||||
BtlController_EmitDrawPartyStatusSummary(BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
@ -3519,7 +3520,7 @@ static void BattleIntroDrawPartySummaryScreens(void)
|
||||
}
|
||||
}
|
||||
gActiveBattler = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
|
||||
BtlController_EmitDrawPartyStatusSummary(0, hpStatus, 0x80);
|
||||
BtlController_EmitDrawPartyStatusSummary(BUFFER_A, hpStatus, PARTY_SUMM_SKIP_DRAW_DELAY);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
|
||||
gBattleMainFunc = BattleIntroPrintTrainerWantsToBattle;
|
||||
@ -3612,7 +3613,7 @@ static void BattleIntroOpponent2SendsOutMonAnimation(void)
|
||||
{
|
||||
if (GetBattlerPosition(gActiveBattler) == position)
|
||||
{
|
||||
BtlController_EmitIntroTrainerBallThrow(0);
|
||||
BtlController_EmitIntroTrainerBallThrow(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
@ -3646,7 +3647,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
|
||||
{
|
||||
if (GetBattlerPosition(gActiveBattler) == position)
|
||||
{
|
||||
BtlController_EmitIntroTrainerBallThrow(0);
|
||||
BtlController_EmitIntroTrainerBallThrow(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_TWO_OPPONENTS))
|
||||
{
|
||||
@ -3679,7 +3680,8 @@ static void BattleIntroRecordMonsToDex(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_803B3AC(void) // unused
|
||||
// Unused
|
||||
static void BattleIntroSkipRecordMonsToDex(void)
|
||||
{
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
gBattleMainFunc = BattleIntroPrintPlayerSendsOut;
|
||||
@ -3730,7 +3732,7 @@ static void BattleIntroPlayer2SendsOutMonAnimation(void)
|
||||
{
|
||||
if (GetBattlerPosition(gActiveBattler) == position)
|
||||
{
|
||||
BtlController_EmitIntroTrainerBallThrow(0);
|
||||
BtlController_EmitIntroTrainerBallThrow(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
@ -3765,7 +3767,7 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void)
|
||||
{
|
||||
if (GetBattlerPosition(gActiveBattler) == position)
|
||||
{
|
||||
BtlController_EmitIntroTrainerBallThrow(0);
|
||||
BtlController_EmitIntroTrainerBallThrow(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
if (gBattleTypeFlags & (BATTLE_TYPE_MULTI))
|
||||
{
|
||||
@ -3782,7 +3784,8 @@ static void BattleIntroPlayer1SendsOutMonAnimation(void)
|
||||
gBattleMainFunc = TryDoEventsBeforeFirstTurn;
|
||||
}
|
||||
|
||||
void sub_803B598(void) // unused
|
||||
// Unused
|
||||
static void BattleIntroSwitchInPlayerMons(void)
|
||||
{
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
{
|
||||
@ -3790,7 +3793,7 @@ void sub_803B598(void) // unused
|
||||
{
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
|
||||
{
|
||||
BtlController_EmitSwitchInAnim(0, gBattlerPartyIndexes[gActiveBattler], FALSE);
|
||||
BtlController_EmitSwitchInAnim(BUFFER_A, gBattlerPartyIndexes[gActiveBattler], FALSE);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
@ -3865,7 +3868,7 @@ static void TryDoEventsBeforeFirstTurn(void)
|
||||
}
|
||||
TurnValuesCleanUp(FALSE);
|
||||
SpecialStatusesClear();
|
||||
*(&gBattleStruct->field_91) = gAbsentBattlerFlags;
|
||||
*(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags;
|
||||
BattlePutTextOnWindow(gText_EmptyString3, B_WIN_MSG);
|
||||
gBattleMainFunc = HandleTurnActionSelectionState;
|
||||
ResetSentPokesToOpponentValue();
|
||||
@ -3972,7 +3975,7 @@ void BattleTurnPassed(void)
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
*(gBattleStruct->monToSwitchIntoId + i) = PARTY_SIZE;
|
||||
|
||||
*(&gBattleStruct->field_91) = gAbsentBattlerFlags;
|
||||
*(&gBattleStruct->absentBattlerFlags) = gAbsentBattlerFlags;
|
||||
BattlePutTextOnWindow(gText_EmptyString3, B_WIN_MSG);
|
||||
gBattleMainFunc = HandleTurnActionSelectionState;
|
||||
gRandomTurnNumber = Random();
|
||||
@ -4054,10 +4057,8 @@ void SwitchPartyOrder(u8 battler)
|
||||
u8 partyId1;
|
||||
u8 partyId2;
|
||||
|
||||
// gBattleStruct->field_60[battler][i]
|
||||
|
||||
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
|
||||
gBattlePartyCurrentOrder[i] = *(battler * 3 + i + (u8*)(gBattleStruct->field_60));
|
||||
gBattlePartyCurrentOrder[i] = *(battler * 3 + i + (u8*)(gBattleStruct->battlerPartyOrders));
|
||||
|
||||
partyId1 = GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battler]);
|
||||
partyId2 = GetPartyIdFromBattlePartyId(*(gBattleStruct->monToSwitchIntoId + battler));
|
||||
@ -4067,15 +4068,15 @@ void SwitchPartyOrder(u8 battler)
|
||||
{
|
||||
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
|
||||
{
|
||||
*(battler * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
|
||||
*(BATTLE_PARTNER(battler) * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
|
||||
*(battler * 3 + i + (u8*)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i];
|
||||
*(BATTLE_PARTNER(battler) * 3 + i + (u8*)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
|
||||
{
|
||||
*(battler * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
|
||||
*(battler * 3 + i + (u8*)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4111,10 +4112,10 @@ static void HandleTurnActionSelectionState(void)
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI
|
||||
|| (position & BIT_FLANK) == B_FLANK_LEFT
|
||||
|| gBattleStruct->field_91 & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(position))]
|
||||
|| gBattleStruct->absentBattlerFlags & gBitTable[GetBattlerAtPosition(BATTLE_PARTNER(position))]
|
||||
|| gBattleCommunication[GetBattlerAtPosition(BATTLE_PARTNER(position))] == STATE_WAIT_ACTION_CONFIRMED)
|
||||
{
|
||||
if (gBattleStruct->field_91 & gBitTable[gActiveBattler])
|
||||
if (gBattleStruct->absentBattlerFlags & gBitTable[gActiveBattler])
|
||||
{
|
||||
gChosenActionByBattler[gActiveBattler] = B_ACTION_NOTHING_FAINTED;
|
||||
if (!(gBattleTypeFlags & BATTLE_TYPE_MULTI))
|
||||
@ -4132,7 +4133,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
BtlController_EmitChooseAction(0, gChosenActionByBattler[0], gBattleBufferB[0][1] | (gBattleBufferB[0][2] << 8));
|
||||
BtlController_EmitChooseAction(BUFFER_A, gChosenActionByBattler[0], gBattleBufferB[0][1] | (gBattleBufferB[0][2] << 8));
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
}
|
||||
@ -4181,7 +4182,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
i);
|
||||
}
|
||||
|
||||
BtlController_EmitChooseMove(0, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0, FALSE, &moveInfo);
|
||||
BtlController_EmitChooseMove(BUFFER_A, (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) != 0, FALSE, &moveInfo);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
break;
|
||||
@ -4200,17 +4201,17 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
BtlController_EmitChooseItem(0, gBattleStruct->field_60[gActiveBattler]);
|
||||
BtlController_EmitChooseItem(BUFFER_A, gBattleStruct->battlerPartyOrders[gActiveBattler]);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
break;
|
||||
case B_ACTION_SWITCH:
|
||||
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
||||
*(gBattleStruct->battlerPartyIndexes + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
||||
if (gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)
|
||||
|| gBattleTypeFlags & BATTLE_TYPE_ARENA
|
||||
|| gStatuses3[gActiveBattler] & STATUS3_ROOTED)
|
||||
{
|
||||
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
|
||||
BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]);
|
||||
}
|
||||
else if ((i = ABILITY_ON_OPPOSING_FIELD(gActiveBattler, ABILITY_SHADOW_TAG))
|
||||
|| ((i = ABILITY_ON_OPPOSING_FIELD(gActiveBattler, ABILITY_ARENA_TRAP))
|
||||
@ -4219,16 +4220,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_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gLastUsedAbility, gBattleStruct->field_60[gActiveBattler]);
|
||||
BtlController_EmitChoosePokemon(BUFFER_A, ((i - 1) << 4) | PARTY_ACTION_ABILITY_PREVENTS, PARTY_SIZE, gLastUsedAbility, gBattleStruct->battlerPartyOrders[gActiveBattler]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gActiveBattler == 2 && gChosenActionByBattler[0] == B_ACTION_SWITCH)
|
||||
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
|
||||
BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 0), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]);
|
||||
else if (gActiveBattler == 3 && gChosenActionByBattler[1] == B_ACTION_SWITCH)
|
||||
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
|
||||
BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_MON, *(gBattleStruct->monToSwitchIntoId + 1), ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]);
|
||||
else
|
||||
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CHOOSE_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
|
||||
BtlController_EmitChoosePokemon(BUFFER_A, PARTY_ACTION_CHOOSE_MON, PARTY_SIZE, ABILITY_NONE, gBattleStruct->battlerPartyOrders[gActiveBattler]);
|
||||
}
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
break;
|
||||
@ -4243,7 +4244,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
break;
|
||||
case B_ACTION_SAFARI_POKEBLOCK:
|
||||
BtlController_EmitChooseItem(0, gBattleStruct->field_60[gActiveBattler]);
|
||||
BtlController_EmitChooseItem(BUFFER_A, gBattleStruct->battlerPartyOrders[gActiveBattler]);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
break;
|
||||
case B_ACTION_CANCEL_PARTNER:
|
||||
@ -4253,7 +4254,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
if (gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].status2 & STATUS2_MULTIPLETURNS
|
||||
|| gBattleMons[GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler)))].status2 & STATUS2_RECHARGE)
|
||||
{
|
||||
BtlController_EmitEndBounceEffect(0);
|
||||
BtlController_EmitEndBounceEffect(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
return;
|
||||
}
|
||||
@ -4281,7 +4282,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
{
|
||||
RecordedBattle_ClearBattlerAction(GetBattlerAtPosition(BATTLE_PARTNER(GetBattlerPosition(gActiveBattler))), 3);
|
||||
}
|
||||
BtlController_EmitEndBounceEffect(0);
|
||||
BtlController_EmitEndBounceEffect(BUFFER_A);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
return;
|
||||
}
|
||||
@ -4337,7 +4338,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
return;
|
||||
case 15:
|
||||
gChosenActionByBattler[gActiveBattler] = B_ACTION_SWITCH;
|
||||
sub_803CDF8();
|
||||
UpdateBattlerPartyOrdersOnSwitch();
|
||||
return;
|
||||
default:
|
||||
RecordedBattle_CheckMovesetChanges(B_RECORD_MODE_PLAYBACK);
|
||||
@ -4389,7 +4390,7 @@ static void HandleTurnActionSelectionState(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_803CDF8();
|
||||
UpdateBattlerPartyOrdersOnSwitch();
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
}
|
||||
break;
|
||||
@ -4434,15 +4435,15 @@ static void HandleTurnActionSelectionState(void)
|
||||
else
|
||||
i = FALSE;
|
||||
|
||||
if (((gBattleTypeFlags & (BATTLE_TYPE_MULTI | BATTLE_TYPE_DOUBLE)) != BATTLE_TYPE_DOUBLE)
|
||||
if (((gBattleTypeFlags & BATTLE_TYPE_MULTI) || !(gBattleTypeFlags & BATTLE_TYPE_DOUBLE))
|
||||
|| (position & BIT_FLANK) != B_FLANK_LEFT
|
||||
|| (*(&gBattleStruct->field_91) & gBitTable[GetBattlerAtPosition(position ^ BIT_FLANK)]))
|
||||
|| (*(&gBattleStruct->absentBattlerFlags) & gBitTable[GetBattlerAtPosition(position ^ BIT_FLANK)]))
|
||||
{
|
||||
BtlController_EmitLinkStandbyMsg(0, 0, i);
|
||||
BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_MSG_STOP_BOUNCE, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
BtlController_EmitLinkStandbyMsg(0, 1, i);
|
||||
BtlController_EmitLinkStandbyMsg(BUFFER_A, LINK_STANDBY_STOP_BOUNCE_ONLY, i);
|
||||
}
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gBattleCommunication[gActiveBattler]++;
|
||||
@ -4538,20 +4539,20 @@ static bool8 AllAtActionConfirmed(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_803CDF8(void)
|
||||
static void UpdateBattlerPartyOrdersOnSwitch(void)
|
||||
{
|
||||
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = gBattleBufferB[gActiveBattler][1];
|
||||
RecordedBattle_SetBattlerAction(gActiveBattler, gBattleBufferB[gActiveBattler][1]);
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_LINK && gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
*(gActiveBattler * 3 + (u8*)(gBattleStruct->field_60) + 0) &= 0xF;
|
||||
*(gActiveBattler * 3 + (u8*)(gBattleStruct->field_60) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0);
|
||||
*(gActiveBattler * 3 + (u8*)(gBattleStruct->field_60) + 1) = gBattleBufferB[gActiveBattler][3];
|
||||
*(gActiveBattler * 3 + (u8*)(gBattleStruct->battlerPartyOrders) + 0) &= 0xF;
|
||||
*(gActiveBattler * 3 + (u8*)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0);
|
||||
*(gActiveBattler * 3 + (u8*)(gBattleStruct->battlerPartyOrders) + 1) = gBattleBufferB[gActiveBattler][3];
|
||||
|
||||
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8*)(gBattleStruct->field_60) + 0) &= (0xF0);
|
||||
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8*)(gBattleStruct->field_60) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0) >> 4;
|
||||
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8*)(gBattleStruct->field_60) + 2) = gBattleBufferB[gActiveBattler][3];
|
||||
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8*)(gBattleStruct->battlerPartyOrders) + 0) &= (0xF0);
|
||||
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8*)(gBattleStruct->battlerPartyOrders) + 0) |= (gBattleBufferB[gActiveBattler][2] & 0xF0) >> 4;
|
||||
*((gActiveBattler ^ BIT_FLANK) * 3 + (u8*)(gBattleStruct->battlerPartyOrders) + 2) = gBattleBufferB[gActiveBattler][3];
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -82,7 +82,7 @@ void HandleAction_UseMove(void)
|
||||
|
||||
gBattlerAttacker = gBattlerByTurnOrder[gCurrentTurnActionNumber];
|
||||
|
||||
if (*(&gBattleStruct->field_91) & gBitTable[gBattlerAttacker])
|
||||
if (*(&gBattleStruct->absentBattlerFlags) & gBitTable[gBattlerAttacker])
|
||||
{
|
||||
gCurrentActionFuncId = B_ACTION_FINISHED;
|
||||
return;
|
||||
@ -299,7 +299,7 @@ void HandleAction_Switch(void)
|
||||
gActionSelectionCursor[gBattlerAttacker] = 0;
|
||||
gMoveSelectionCursor[gBattlerAttacker] = 0;
|
||||
|
||||
PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattlerAttacker, *(gBattleStruct->field_58 + gBattlerAttacker))
|
||||
PREPARE_MON_NICK_BUFFER(gBattleTextBuff1, gBattlerAttacker, *(gBattleStruct->battlerPartyIndexes + gBattlerAttacker))
|
||||
|
||||
gBattleScripting.battler = gBattlerAttacker;
|
||||
gBattlescriptCurrInstr = BattleScript_ActionSwitch;
|
||||
@ -708,11 +708,11 @@ u8 GetBattlerForBattleScript(u8 caseId)
|
||||
case BS_FAINTED:
|
||||
ret = gBattlerFainted;
|
||||
break;
|
||||
case BS_UNK_5:
|
||||
case BS_FAINTED_LINK_MULTIPLE_1:
|
||||
ret = gBattlerFainted;
|
||||
break;
|
||||
case BS_ATTACKER_WITH_PARTNER:
|
||||
case BS_UNK_6:
|
||||
case BS_FAINTED_LINK_MULTIPLE_2:
|
||||
case BS_ATTACKER_SIDE:
|
||||
case BS_NOT_ATTACKER_SIDE:
|
||||
case BS_PLAYER1:
|
||||
@ -753,7 +753,7 @@ void PressurePPLose(u8 target, u8 attacker, u16 move)
|
||||
if (MOVE_IS_PERMANENT(attacker, moveIndex))
|
||||
{
|
||||
gActiveBattler = attacker;
|
||||
BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + moveIndex, 0, 1, &gBattleMons[gActiveBattler].pp[moveIndex]);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + moveIndex, 0, 1, &gBattleMons[gActiveBattler].pp[moveIndex]);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
@ -785,7 +785,7 @@ void PressurePPLoseOnUsingImprison(u8 attacker)
|
||||
if (imprisonPos != MAX_MON_MOVES && MOVE_IS_PERMANENT(attacker, imprisonPos))
|
||||
{
|
||||
gActiveBattler = attacker;
|
||||
BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + imprisonPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisonPos]);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + imprisonPos, 0, 1, &gBattleMons[gActiveBattler].pp[imprisonPos]);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
@ -816,7 +816,7 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker)
|
||||
if (perishSongPos != MAX_MON_MOVES && MOVE_IS_PERMANENT(attacker, perishSongPos))
|
||||
{
|
||||
gActiveBattler = attacker;
|
||||
BtlController_EmitSetMonData(0, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[gActiveBattler].pp[perishSongPos]);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_PPMOVE1_BATTLE + perishSongPos, 0, 1, &gBattleMons[gActiveBattler].pp[perishSongPos]);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
}
|
||||
@ -887,7 +887,7 @@ bool8 WasUnableToUseMove(u8 battler)
|
||||
void PrepareStringBattle(u16 stringId, u8 battler)
|
||||
{
|
||||
gActiveBattler = battler;
|
||||
BtlController_EmitPrintString(0, stringId);
|
||||
BtlController_EmitPrintString(BUFFER_A, stringId);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
|
||||
@ -1616,7 +1616,7 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
BattleScriptExecute(BattleScript_MonWokeUpInUproar);
|
||||
gActiveBattler = gBattlerAttacker;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
break;
|
||||
}
|
||||
@ -1741,7 +1741,7 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
{
|
||||
CancelMultiTurnMoves(gActiveBattler);
|
||||
gBattleMons[gActiveBattler].status1 |= STATUS1_SLEEP_TURN((Random() & 3) + 2); // 2-5 turns of sleep
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gEffectBattler = gActiveBattler;
|
||||
BattleScriptExecute(BattleScript_YawnMakesAsleep);
|
||||
@ -2251,7 +2251,7 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||
if (effect == 2)
|
||||
{
|
||||
gActiveBattler = gBattlerAttacker;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
return effect;
|
||||
@ -2615,7 +2615,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
gBattleMons[battler].status2 &= ~STATUS2_NIGHTMARE; // fix nightmare glitch
|
||||
gBattleScripting.battler = gActiveBattler = battler;
|
||||
BattleScriptPushCursorAndCallback(BattleScript_ShedSkinActivates);
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
effect++;
|
||||
}
|
||||
@ -2926,7 +2926,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
gBattlescriptCurrInstr = BattleScript_AbilityCuredStatus;
|
||||
gBattleScripting.battler = battler;
|
||||
gActiveBattler = battler;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
return effect;
|
||||
}
|
||||
@ -3354,7 +3354,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, move);
|
||||
|
||||
BattleScriptExecute(BattleScript_BerryPPHealEnd2);
|
||||
BtlController_EmitSetMonData(0, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP);
|
||||
BtlController_EmitSetMonData(BUFFER_A, i + REQUEST_PPMOVE1_BATTLE, 0, 1, &changedPP);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
effect = ITEM_PP_CHANGE;
|
||||
}
|
||||
@ -3589,7 +3589,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
switch (effect)
|
||||
{
|
||||
case ITEM_STATUS_CHANGE:
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[battlerId].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
break;
|
||||
case ITEM_PP_CHANGE:
|
||||
@ -3740,7 +3740,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
gBattleScripting.battler = battlerId;
|
||||
gPotentialItemEffectBattler = battlerId;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
break;
|
||||
}
|
||||
|
@ -108,16 +108,13 @@ void SwitchPartyOrderInGameMulti(u8 battlerId, u8 arg1)
|
||||
if (GetBattlerSide(battlerId) != B_SIDE_OPPONENT)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
// gBattleStruct->field_60[0][i]
|
||||
|
||||
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
|
||||
gBattlePartyCurrentOrder[i] = *(0 * 3 + i + (u8*)(gBattleStruct->field_60));
|
||||
gBattlePartyCurrentOrder[i] = *(0 * 3 + i + (u8*)(gBattleStruct->battlerPartyOrders));
|
||||
|
||||
SwitchPartyMonSlots(GetPartyIdFromBattlePartyId(gBattlerPartyIndexes[battlerId]), GetPartyIdFromBattlePartyId(arg1));
|
||||
|
||||
for (i = 0; i < (int)ARRAY_COUNT(gBattlePartyCurrentOrder); i++)
|
||||
*(0 * 3 + i + (u8*)(gBattleStruct->field_60)) = gBattlePartyCurrentOrder[i];
|
||||
*(0 * 3 + i + (u8*)(gBattleStruct->battlerPartyOrders)) = gBattlePartyCurrentOrder[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +204,7 @@ u32 BattlePalace_TryEscapeStatus(u8 battlerId)
|
||||
if (effect == 2)
|
||||
{
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
}
|
||||
|
||||
|
@ -5840,7 +5840,7 @@ static void BufferBattlePartyOrder(u8 *partyBattleOrder, u8 flankId)
|
||||
|
||||
void BufferBattlePartyCurrentOrderBySide(u8 battlerId, u8 flankId)
|
||||
{
|
||||
BufferBattlePartyOrderBySide(gBattleStruct->field_60[battlerId], flankId, battlerId);
|
||||
BufferBattlePartyOrderBySide(gBattleStruct->battlerPartyOrders[battlerId], flankId, battlerId);
|
||||
}
|
||||
|
||||
// when GetBattlerSide(battlerId) == B_SIDE_PLAYER, this function is identical the one above
|
||||
@ -5920,8 +5920,8 @@ void SwitchPartyOrderLinkMulti(u8 battlerId, u8 slot, u8 slot2)
|
||||
|
||||
if (IsMultiBattle())
|
||||
{
|
||||
partyBattleOrder = gBattleStruct->field_60[battlerId];
|
||||
for (i = j = 0; i < 3; j++, i++)
|
||||
partyBattleOrder = gBattleStruct->battlerPartyOrders[battlerId];
|
||||
for (i = j = 0; i < PARTY_SIZE / 2; j++, i++)
|
||||
{
|
||||
partyIds[j] = partyBattleOrder[i] >> 4;
|
||||
j++;
|
||||
|
@ -5042,7 +5042,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
|
||||
temp2 = gActiveBattler;
|
||||
gActiveBattler = battlerId;
|
||||
BtlController_EmitGetMonData(0, REQUEST_ALL_BATTLE, 0);
|
||||
BtlController_EmitGetMonData(BUFFER_A, REQUEST_ALL_BATTLE, 0);
|
||||
MarkBattlerForControllerExec(gActiveBattler);
|
||||
gActiveBattler = temp2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user