pokeemerald/include/battle_controllers.h

299 lines
9.8 KiB
C
Raw Normal View History

2017-09-20 00:28:00 +02:00
#ifndef GUARD_BATTLE_CONTROLLERS_H
#define GUARD_BATTLE_CONTROLLERS_H
enum {
REQUEST_ALL_BATTLE,
REQUEST_SPECIES_BATTLE,
REQUEST_HELDITEM_BATTLE,
REQUEST_MOVES_PP_BATTLE,
REQUEST_MOVE1_BATTLE,
REQUEST_MOVE2_BATTLE,
REQUEST_MOVE3_BATTLE,
REQUEST_MOVE4_BATTLE,
REQUEST_PP_DATA_BATTLE,
REQUEST_PPMOVE1_BATTLE,
REQUEST_PPMOVE2_BATTLE,
REQUEST_PPMOVE3_BATTLE,
REQUEST_PPMOVE4_BATTLE,
REQUEST_UNUSED_13_BATTLE,
REQUEST_UNUSED_14_BATTLE,
REQUEST_UNUSED_15_BATTLE,
REQUEST_UNUSED_16_BATTLE,
REQUEST_OTID_BATTLE,
REQUEST_EXP_BATTLE,
REQUEST_HP_EV_BATTLE,
REQUEST_ATK_EV_BATTLE,
REQUEST_DEF_EV_BATTLE,
REQUEST_SPEED_EV_BATTLE,
REQUEST_SPATK_EV_BATTLE,
REQUEST_SPDEF_EV_BATTLE,
REQUEST_FRIENDSHIP_BATTLE,
REQUEST_POKERUS_BATTLE,
REQUEST_MET_LOCATION_BATTLE,
REQUEST_MET_LEVEL_BATTLE,
REQUEST_MET_GAME_BATTLE,
REQUEST_POKEBALL_BATTLE,
REQUEST_ALL_IVS_BATTLE,
REQUEST_HP_IV_BATTLE,
REQUEST_ATK_IV_BATTLE,
REQUEST_DEF_IV_BATTLE,
REQUEST_SPEED_IV_BATTLE,
REQUEST_SPATK_IV_BATTLE,
REQUEST_SPDEF_IV_BATTLE,
REQUEST_PERSONALITY_BATTLE,
REQUEST_CHECKSUM_BATTLE,
REQUEST_STATUS_BATTLE,
REQUEST_LEVEL_BATTLE,
REQUEST_HP_BATTLE,
REQUEST_MAX_HP_BATTLE,
REQUEST_ATK_BATTLE,
REQUEST_DEF_BATTLE,
REQUEST_SPEED_BATTLE,
REQUEST_SPATK_BATTLE,
REQUEST_SPDEF_BATTLE,
REQUEST_COOL_BATTLE,
REQUEST_BEAUTY_BATTLE,
REQUEST_CUTE_BATTLE,
REQUEST_SMART_BATTLE,
REQUEST_TOUGH_BATTLE,
REQUEST_SHEEN_BATTLE,
REQUEST_COOL_RIBBON_BATTLE,
REQUEST_BEAUTY_RIBBON_BATTLE,
REQUEST_CUTE_RIBBON_BATTLE,
REQUEST_SMART_RIBBON_BATTLE,
REQUEST_TOUGH_RIBBON_BATTLE,
};
2017-10-06 17:06:45 +02:00
2018-07-07 19:57:09 +02:00
// Special arguments for Battle Controller functions.
enum { // Values given to the emit functions to choose gBattleBufferA or gBattleBufferB
BUFFER_A,
BUFFER_B
};
2017-10-06 17:06:45 +02:00
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,
};
2017-10-06 17:06:45 +02:00
2017-10-22 18:43:15 +02:00
#define INSTANT_HP_BAR_DROP 32767
#define PARTY_SUMM_SKIP_DRAW_DELAY (1 << 7)
2018-07-07 19:57:09 +02:00
// Special return values in gBattleBufferB from Battle Controller functions.
2018-07-16 20:47:30 +02:00
#define RET_VALUE_LEVELED_UP 11
2018-07-07 19:57:09 +02:00
2017-10-22 18:43:15 +02:00
struct UnusedControllerStruct
{
2020-12-29 22:51:44 +01:00
u8 unk:7;
u8 flag:1;
2017-10-22 18:43:15 +02:00
};
2017-09-25 00:09:13 +02:00
struct HpAndStatus
{
u16 hp;
u32 status;
};
2017-09-26 22:39:59 +02:00
struct MovePpInfo
{
2019-09-08 17:53:48 +02:00
u16 moves[MAX_MON_MOVES];
u8 pp[MAX_MON_MOVES];
2017-09-26 22:39:59 +02:00
u8 ppBonuses;
};
struct ChooseMoveStruct
{
2019-09-08 17:53:48 +02:00
u16 moves[MAX_MON_MOVES];
u8 currentPp[MAX_MON_MOVES];
u8 maxPp[MAX_MON_MOVES];
u16 species;
u8 monType1;
u8 monType2;
};
2017-10-13 19:46:27 +02:00
enum
{
CONTROLLER_GETMONDATA,
CONTROLLER_GETRAWMONDATA,
CONTROLLER_SETMONDATA,
CONTROLLER_SETRAWMONDATA,
CONTROLLER_LOADMONSPRITE,
CONTROLLER_SWITCHINANIM,
2017-10-14 11:34:26 +02:00
CONTROLLER_RETURNMONTOBALL,
2017-10-13 19:46:27 +02:00
CONTROLLER_DRAWTRAINERPIC,
CONTROLLER_TRAINERSLIDE,
CONTROLLER_TRAINERSLIDEBACK,
CONTROLLER_FAINTANIMATION,
CONTROLLER_PALETTEFADE,
2017-10-22 18:43:15 +02:00
CONTROLLER_SUCCESSBALLTHROWANIM,
CONTROLLER_BALLTHROWANIM,
2017-10-13 19:46:27 +02:00
CONTROLLER_PAUSE,
CONTROLLER_MOVEANIMATION,
CONTROLLER_PRINTSTRING,
CONTROLLER_PRINTSTRINGPLAYERONLY,
CONTROLLER_CHOOSEACTION,
CONTROLLER_YESNOBOX,
2017-10-14 11:34:26 +02:00
CONTROLLER_CHOOSEMOVE,
2017-10-13 19:46:27 +02:00
CONTROLLER_OPENBAG,
2017-10-14 11:34:26 +02:00
CONTROLLER_CHOOSEPOKEMON,
2017-10-13 19:46:27 +02:00
CONTROLLER_23,
CONTROLLER_HEALTHBARUPDATE,
2017-10-14 11:34:26 +02:00
CONTROLLER_EXPUPDATE,
2017-10-13 19:46:27 +02:00
CONTROLLER_STATUSICONUPDATE,
CONTROLLER_STATUSANIMATION,
CONTROLLER_STATUSXOR,
2017-10-14 11:34:26 +02:00
CONTROLLER_DATATRANSFER,
CONTROLLER_DMA3TRANSFER,
2020-12-29 22:51:44 +01:00
CONTROLLER_PLAYBGM,
2017-10-13 19:46:27 +02:00
CONTROLLER_32,
2017-10-22 18:43:15 +02:00
CONTROLLER_TWORETURNVALUES,
CONTROLLER_CHOSENMONRETURNVALUE,
CONTROLLER_ONERETURNVALUE,
CONTROLLER_ONERETURNVALUE_DUPLICATE,
2020-12-29 22:51:44 +01:00
CONTROLLER_CLEARUNKVAR,
CONTROLLER_SETUNKVAR,
CONTROLLER_CLEARUNKFLAG,
CONTROLLER_TOGGLEUNKFLAG,
2017-10-13 19:46:27 +02:00
CONTROLLER_HITANIMATION,
2021-04-03 18:38:07 +02:00
CONTROLLER_CANTSWITCH,
2020-12-29 22:51:44 +01:00
CONTROLLER_PLAYSE,
2017-10-14 11:34:26 +02:00
CONTROLLER_PLAYFANFAREORBGM,
2017-10-13 19:46:27 +02:00
CONTROLLER_FAINTINGCRY,
CONTROLLER_INTROSLIDE,
2017-10-14 11:34:26 +02:00
CONTROLLER_INTROTRAINERBALLTHROW,
CONTROLLER_DRAWPARTYSTATUSSUMMARY,
2018-06-28 21:06:32 +02:00
CONTROLLER_HIDEPARTYSTATUSSUMMARY,
2018-06-20 23:07:51 +02:00
CONTROLLER_ENDBOUNCE,
2017-10-13 19:46:27 +02:00
CONTROLLER_SPRITEINVISIBILITY,
CONTROLLER_BATTLEANIMATION,
CONTROLLER_LINKSTANDBYMSG,
CONTROLLER_RESETACTIONMOVESELECTION,
CONTROLLER_ENDLINKBATTLE,
2017-10-31 18:49:29 +01:00
/*new controllers should go here*/
CONTROLLER_TERMINATOR_NOP,
2017-10-31 18:04:08 +01:00
CONTROLLER_CMDS_COUNT
2017-10-13 19:46:27 +02:00
};
2020-12-29 22:51:44 +01:00
extern struct UnusedControllerStruct gUnusedControllerStruct;
2017-10-13 19:46:27 +02:00
2017-10-13 17:22:50 +02:00
// general functions
void HandleLinkBattleSetup(void);
void SetUpBattleVarsAndBirchZigzagoon(void);
void InitBattleControllers(void);
void TryReceiveLinkBattleData(void);
2017-10-14 11:34:26 +02:00
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
2017-10-13 17:22:50 +02:00
// emitters
2018-02-06 20:48:02 +01:00
void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck);
void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused
void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data);
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, bool8 skipAnim);
2018-02-06 20:48:02 +01:00
void BtlController_EmitDrawTrainerPic(u8 bufferId);
void BtlController_EmitTrainerSlide(u8 bufferId);
void BtlController_EmitTrainerSlideBack(u8 bufferId);
void BtlController_EmitFaintAnimation(u8 bufferId);
void BtlController_EmitPaletteFade(u8 bufferId); // unused
void BtlController_EmitSuccessBallThrowAnim(u8 bufferId); // unused
void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId);
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 action, u16 itemId);
void BtlController_EmitYesNoBox(u8 bufferId);
2018-02-06 20:48:02 +01:00
void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData);
void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder);
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abilityId, u8 *data);
2018-02-06 20:48:02 +01:00
void BtlController_EmitCmd23(u8 bufferId); // unused
void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2);
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 *data); // unused
2022-05-21 21:21:50 +02:00
void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data); // unused
void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u16 ret16);
void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder);
void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret);
void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret);
2020-12-29 22:51:44 +01:00
void BtlController_EmitClearUnkVar(u8 bufferId); // unused
void BtlController_EmitSetUnkVar(u8 bufferId, u8 b); // unused
void BtlController_EmitClearUnkFlag(u8 bufferId); // unused
void BtlController_EmitToggleUnkFlag(u8 bufferId); // unused
2018-02-06 20:48:02 +01:00
void BtlController_EmitHitAnimation(u8 bufferId);
2021-04-03 18:38:07 +02:00
void BtlController_EmitCantSwitch(u8 bufferId);
2018-02-06 20:48:02 +01:00
void BtlController_EmitPlaySE(u8 bufferId, u16 songId);
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 flags);
2018-06-28 21:06:32 +02:00
void BtlController_EmitHidePartyStatusSummary(u8 bufferId);
2018-06-20 23:07:51 +02:00
void BtlController_EmitEndBounceEffect(u8 bufferId);
2018-02-06 20:48:02 +01:00
void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
2022-05-21 21:21:50 +02:00
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 mode, bool32 record);
2018-02-06 20:48:02 +01:00
void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome);
2017-09-28 15:34:21 +02:00
2017-10-13 17:22:50 +02:00
// player controller
2017-10-26 23:12:48 +02:00
void SetControllerToPlayer(void);
void BattleControllerDummy(void);
2017-10-22 18:43:15 +02:00
void PlayerHandleGetRawMonData(void);
2021-01-23 02:03:21 +01:00
void SetBattleEndCallbacks(void);
void SpriteCB_FreePlayerSpriteLoadMonSprite(struct Sprite *sprite);
2019-10-18 01:22:03 +02:00
void CB2_SetUpReshowBattleScreenAfterMenu(void);
void CB2_SetUpReshowBattleScreenAfterMenu2(void);
2021-01-23 02:03:21 +01:00
void Task_PlayerController_RestoreBgmAfterCry(u8 taskId);
2017-10-13 17:22:50 +02:00
void ActionSelectionCreateCursorAt(u8 cursorPos, u8 unused);
void ActionSelectionDestroyCursorAt(u8 cursorPos);
2017-10-22 18:43:15 +02:00
void InitMoveSelectionsVarsAndStrings(void);
2017-10-13 17:22:50 +02:00
// recorded player controller
2017-10-26 23:12:48 +02:00
void SetControllerToRecordedPlayer(void);
2017-10-13 17:22:50 +02:00
// opponent controller
2017-10-26 23:12:48 +02:00
void SetControllerToOpponent(void);
2017-10-13 17:22:50 +02:00
// player partner controller
2017-10-26 23:12:48 +02:00
void SetControllerToPlayerPartner(void);
2017-10-13 17:22:50 +02:00
// safari controller
2017-10-26 23:12:48 +02:00
void SetControllerToSafari(void);
2017-10-13 17:22:50 +02:00
// wally controller
2017-10-26 23:12:48 +02:00
void SetControllerToWally(void);
2017-10-13 17:22:50 +02:00
// recorded opponent controller
2017-10-26 23:12:48 +02:00
void SetControllerToRecordedOpponent(void);
2017-10-13 17:22:50 +02:00
// link opponent
2017-10-26 23:12:48 +02:00
void SetControllerToLinkOpponent(void);
2017-10-13 17:22:50 +02:00
// link partner
2017-10-26 23:12:48 +02:00
void SetControllerToLinkPartner(void);
2017-10-13 17:22:50 +02:00
2017-09-20 00:28:00 +02:00
#endif // GUARD_BATTLE_CONTROLLERS_H