summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/battle.h79
-rw-r--r--include/battle_anim.h8
-rw-r--r--include/battle_arena.h1
-rw-r--r--include/battle_controllers.h48
-rw-r--r--include/battle_gfx_sfx_util.h1
-rw-r--r--include/battle_main.h14
-rw-r--r--include/battle_pyramid_bag.h1
-rw-r--r--include/battle_script_commands.h6
-rw-r--r--include/battle_transition.h107
-rw-r--r--include/battle_util.h58
-rw-r--r--include/constants/battle.h52
-rw-r--r--include/constants/battle_anim.h5
-rw-r--r--include/constants/battle_script_commands.h79
-rw-r--r--include/contest.h2
-rw-r--r--include/gym_leader_rematch.h6
-rw-r--r--include/pokemon.h13
-rw-r--r--include/recorded_battle.h12
17 files changed, 297 insertions, 195 deletions
diff --git a/include/battle.h b/include/battle.h
index e32e621cc..9434b9aa8 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -17,6 +17,11 @@
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
+// Used to exclude moves learned temporarily by Transform or Mimic
+#define MOVE_IS_PERMANENT(battler, moveSlot) \
+ (!(gBattleMons[battler].status2 & STATUS2_TRANSFORMED) \
+ && !(gDisableStructs[battler].mimickedMoves & gBitTable[moveSlot]))
+
// Battle Actions
// These determine what each battler will do in a turn
#define B_ACTION_USE_MOVE 0
@@ -32,32 +37,21 @@
#define B_ACTION_EXEC_SCRIPT 10
#define B_ACTION_TRY_FINISH 11
#define B_ACTION_FINISHED 12
-
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
#define B_ACTION_NONE 0xFF
-// array entries for battle communication
-#define MULTIUSE_STATE 0
-#define CURSOR_POSITION 1
-#define TASK_ID 1 // task Id and cursor position share the same field
-#define SPRITES_INIT_STATE1 1 // shares the Id as well
-#define SPRITES_INIT_STATE2 2
-#define MOVE_EFFECT_BYTE 3
-#define ACTIONS_CONFIRMED_COUNT 4
-#define MULTISTRING_CHOOSER 5
-#define MISS_TYPE 6
-#define MSG_DISPLAY 7
-#define BATTLE_COMMUNICATION_ENTRIES_COUNT 8
-
-#define MOVE_TARGET_SELECTED 0x0
-#define MOVE_TARGET_DEPENDS 0x1
-#define MOVE_TARGET_USER_OR_SELECTED 0x2
-#define MOVE_TARGET_RANDOM 0x4
-#define MOVE_TARGET_BOTH 0x8
-#define MOVE_TARGET_USER 0x10
-#define MOVE_TARGET_FOES_AND_ALLY 0x20
-#define MOVE_TARGET_OPPONENTS_FIELD 0x40
+#define MOVE_TARGET_SELECTED 0
+#define MOVE_TARGET_DEPENDS (1 << 0)
+#define MOVE_TARGET_USER_OR_SELECTED (1 << 1)
+#define MOVE_TARGET_RANDOM (1 << 2)
+#define MOVE_TARGET_BOTH (1 << 3)
+#define MOVE_TARGET_USER (1 << 4)
+#define MOVE_TARGET_FOES_AND_ALLY (1 << 5)
+#define MOVE_TARGET_OPPONENTS_FIELD (1 << 6)
+
+// For the second argument of GetMoveTarget, when no target override is needed
+#define NO_TARGET_OVERRIDE 0
#define BATTLE_BUFFER_LINK_SIZE 0x1000
@@ -115,7 +109,7 @@ struct ProtectStruct
u32 confusionSelfDmg:1;
u32 targetNotAffected:1;
u32 chargingTurn:1;
- u32 fleeFlag:2; // For RunAway and Smoke Ball.
+ u32 fleeType:2; // 0: Normal, 1: FLEE_ITEM, 2: FLEE_ABILITY
u32 usedImprisonedMove:1;
u32 loveImmobility:1;
u32 usedDisabledMove:1;
@@ -138,7 +132,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;
@@ -377,9 +371,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;
@@ -398,7 +392,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;
@@ -426,7 +420,7 @@ struct BattleStruct
u8 unused_6[3];
u8 givenExpMons; // Bits for enemy party's pokemon that gave exp to player's party.
u8 lastTakenMoveFrom[MAX_BATTLERS_COUNT * MAX_BATTLERS_COUNT * 2]; // a 3-D array [target][attacker][byte]
- u16 castformPalette[MAX_BATTLERS_COUNT][16];
+ u16 castformPalette[NUM_CASTFORM_FORMS][16];
union {
struct LinkBattlerHeader linkBattlerHeader;
u32 battleVideo[2];
@@ -447,12 +441,16 @@ struct BattleStruct
u8 alreadyStatusedMoveAttempt; // As bits for battlers; For example when using Thunder Wave on an already paralyzed pokemon.
};
-#define GET_MOVE_TYPE(move, typeArg) \
-{ \
- if (gBattleStruct->dynamicMoveType) \
- typeArg = gBattleStruct->dynamicMoveType & 0x3F; \
- else \
- typeArg = gBattleMoves[move].type; \
+#define F_DYNAMIC_TYPE_1 (1 << 6)
+#define F_DYNAMIC_TYPE_2 (1 << 7)
+#define DYNAMIC_TYPE_MASK (F_DYNAMIC_TYPE_1 - 1)
+
+#define GET_MOVE_TYPE(move, typeArg) \
+{ \
+ if (gBattleStruct->dynamicMoveType) \
+ typeArg = gBattleStruct->dynamicMoveType & DYNAMIC_TYPE_MASK; \
+ else \
+ typeArg = gBattleMoves[move].type; \
}
#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
@@ -476,6 +474,8 @@ struct BattleStruct
#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7))
+// NOTE: The members of this struct have hard-coded offsets
+// in include/constants/battle_script_commands.h
struct BattleScripting
{
s32 painSplitHp;
@@ -498,18 +498,15 @@ struct BattleScripting
u8 battleStyle;
u8 drawlvlupboxState;
u8 learnMoveState;
- u8 field_20;
+ u8 pursuitDoublesAttacker;
u8 reshowMainState;
u8 reshowHelperState;
u8 levelUpHP;
- u8 windowsType; // 0 - normal, 1 - battle arena
+ u8 windowsType; // B_WIN_TYPE_*
u8 multiplayerId;
u8 specialTrainerBattleType;
};
-// rom_80A5C6C
-
-
struct BattleSpriteInfo
{
u16 invisible:1; // 0x1
@@ -624,8 +621,8 @@ extern u8 gBattleTextBuff3[TEXT_BUFF_ARRAY_COUNT];
extern u32 gBattleTypeFlags;
extern u8 gBattleTerrain;
extern u32 gUnusedFirstBattleVar1;
-extern u8 *gUnknown_0202305C;
-extern u8 *gUnknown_02023060;
+extern u8 *gBattleAnimBgTileBuffer;
+extern u8 *gBattleAnimBgTilemapBuffer;
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
extern u8 gActiveBattler;
diff --git a/include/battle_anim.h b/include/battle_anim.h
index ad160e74d..3f73f1daf 100644
--- a/include/battle_anim.h
+++ b/include/battle_anim.h
@@ -64,12 +64,12 @@ s8 BattleAnimAdjustPanning(s8 pan);
s8 BattleAnimAdjustPanning2(s8 pan);
s16 KeepPanInRange(s16 a, int oldPan);
s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan);
-void sub_80A4720(u16 a, u16 *b, u32 c, u8 d);
+void RelocateBattleBgPal(u16 paletteNum, u16 *dest, u32 offset, bool8 largeScreen);
void ResetBattleAnimBg(bool8);
// battle_intro.c
void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value);
-void sub_8118FBC(int bgId, u8 arg1, u8 arg2, u8 battlerPosition, u8 arg4, u8 *arg5, u16 *arg6, u16 arg7);
+void DrawBattlerOnBg(int bgId, u8 x, u8 y, u8 battlerPosition, u8 paletteId, u8 *tiles, u16 *tilemap, u16 tilesOffset);
void HandleIntroSlide(u8 terrainId);
int GetAnimBgAttribute(u8 bgId, u8 attributeId);
@@ -107,7 +107,7 @@ void AnimTranslateLinear_WaitEnd(struct Sprite *sprite);
u8 GetBattlerSpriteBGPriority(u8 battlerId);
void *LoadPointerFromVars(s16 bottom, s16 top);
void StorePointerInVars(s16 *bottom, s16 *top, const void *ptr);
-void sub_80A8278(void);
+void InitPrioritiesForVisibleBattlers(void);
void GetBattleAnimBg1Data(struct BattleAnimBgData*);
void GetBattleAnimBgData(struct BattleAnimBgData*, u32 arg1);
u8 GetBattlerSpriteSubpriority(u8 battlerId);
@@ -125,7 +125,7 @@ u8 AnimDummyReturnArg(u8 battler);
s16 CloneBattlerSpriteWithBlend(u8);
void obj_delete_but_dont_free_vram(struct Sprite*);
u8 CreateInvisibleSpriteCopy(int, u8, int);
-void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData*, const void*, u32);
+void AnimLoadCompressedBgTilemapHandleContest(struct BattleAnimBgData*, const void*, bool32);
void AnimLoadCompressedBgGfx(u32, const u32*, u32);
void UpdateAnimBg3ScreenSize(bool8);
void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *);
diff --git a/include/battle_arena.h b/include/battle_arena.h
index b55fc39b0..c9a18ef61 100644
--- a/include/battle_arena.h
+++ b/include/battle_arena.h
@@ -7,7 +7,6 @@ void BattleArena_InitPoints(void);
void BattleArena_AddMindPoints(u8 battler);
void BattleArena_AddSkillPoints(u8 battler);
void BattleArena_DeductMindPoints(u8 battler, u16 stringId);
-void sub_81A586C(u8 battler);
void DrawArenaRefereeTextBox(void);
void EraseArenaRefereeTextBox(void);
diff --git a/include/battle_controllers.h b/include/battle_controllers.h
index 34e916b0f..9d9fba1b4 100644
--- a/include/battle_controllers.h
+++ b/include/battle_controllers.h
@@ -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);
diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h
index a367bc043..383facd69 100644
--- a/include/battle_gfx_sfx_util.h
+++ b/include/battle_gfx_sfx_util.h
@@ -18,7 +18,6 @@ void DecompressTrainerFrontPic(u16 frontPicId, u8 battlerId);
void DecompressTrainerBackPic(u16 backPicId, u8 battlerId);
void BattleGfxSfxDummy3(u8 gender);
void FreeTrainerFrontPicPalette(u16 frontPicId);
-void sub_805DFFC(void);
bool8 BattleLoadAllHealthBoxesGfx(u8 state);
void LoadBattleBarGfx(u8 arg0);
bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId);
diff --git a/include/battle_main.h b/include/battle_main.h
index 78cf353df..f3e961b7b 100644
--- a/include/battle_main.h
+++ b/include/battle_main.h
@@ -7,7 +7,8 @@ struct TrainerMoney
u8 value;
};
-struct UnknownPokemonStruct4
+// For displaying a multi battle partner's Pokémon in the party menu
+struct MultiPartnerMenuPokemon
{
/*0x00*/ u16 species;
/*0x02*/ u16 heldItem;
@@ -46,8 +47,6 @@ struct UnknownPokemonStruct4
void CB2_InitBattle(void);
void BattleMainCB2(void);
void CB2_QuitRecordedBattle(void);
-void sub_8038528(struct Sprite* sprite);
-void sub_8038A04(void); // unused
void VBlankCB_Battle(void);
void SpriteCB_VsLetterDummy(struct Sprite *sprite);
void SpriteCB_VsLetterInit(struct Sprite *sprite);
@@ -59,13 +58,12 @@ void SpriteCallbackDummy_2(struct Sprite *sprite);
void SpriteCB_FaintOpponentMon(struct Sprite *sprite);
void SpriteCb_ShowAsMoveTarget(struct Sprite *sprite);
void SpriteCb_HideAsMoveTarget(struct Sprite *sprite);
-void SpriteCb_OpponentMonFromBall(struct Sprite *sprite);
+void SpriteCB_OpponentMonFromBall(struct Sprite *sprite);
void SpriteCB_BattleSpriteStartSlideLeft(struct Sprite *sprite);
void SpriteCB_FaintSlideAnim(struct Sprite *sprite);
void DoBounceEffect(u8 battlerId, u8 b, s8 c, s8 d);
void EndBounceEffect(u8 battlerId, bool8 b);
-void SpriteCb_PlayerMonFromBall(struct Sprite *sprite);
-void sub_8039E60(struct Sprite *sprite);
+void SpriteCB_PlayerMonFromBall(struct Sprite *sprite);
void SpriteCB_TrainerThrowObject(struct Sprite *sprite);
void sub_8039E9C(struct Sprite *sprite);
void BeginBattleIntroDummy(void);
@@ -82,9 +80,9 @@ void RunBattleScriptCommands(void);
bool8 TryRunFromBattle(u8 battlerId);
void SpecialStatusesClear(void);
-extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE];
+extern struct MultiPartnerMenuPokemon gMultiPartnerParty[MULTI_PARTY_SIZE];
-extern const struct SpriteTemplate gUnknown_0831AC88;
+extern const struct SpriteTemplate gUnusedBattleInitSprite;
extern const struct OamData gOamData_BattleSpriteOpponentSide;
extern const struct OamData gOamData_BattleSpritePlayerSide;
extern const u8 gTypeEffectiveness[336];
diff --git a/include/battle_pyramid_bag.h b/include/battle_pyramid_bag.h
index b8b3eb20f..258ca56b2 100644
--- a/include/battle_pyramid_bag.h
+++ b/include/battle_pyramid_bag.h
@@ -63,7 +63,6 @@ void CB2_PyramidBagMenuFromStartMenu(void);
void CB2_ReturnToPyramidBagMenu(void);
void UpdatePyramidBagList(void);
void UpdatePyramidBagCursorPos(void);
-void sub_81C4EFC(void);
void GoToBattlePyramidBagMenu(u8 location, void (*exitCallback)(void));
void Task_CloseBattlePyramidBagMessage(u8 taskId);
void TryStoreHeldItemsInPyramidBag(void);
diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h
index ee3676463..cb81ad812 100644
--- a/include/battle_script_commands.h
+++ b/include/battle_script_commands.h
@@ -2,9 +2,11 @@
#define GUARD_BATTLE_SCRIPT_COMMANDS_H
#include "constants/pokemon.h"
+#include "constants/battle_script_commands.h"
-#define WINDOW_CLEAR 0x1
-#define WINDOW_x80 0x80
+// Arguments for 'flags' in HandleBattleWindow
+#define WINDOW_CLEAR (1 << 0)
+#define WINDOW_BG1 (1 << 7)
void AI_CalcDmg(u8 battlerIdAtk, u8 battlerIdDef);
u8 TypeCalc(u16 move, u8 battlerIdAtk, u8 battlerIdDef);
diff --git a/include/battle_transition.h b/include/battle_transition.h
index a33032fb4..784c5f968 100644
--- a/include/battle_transition.h
+++ b/include/battle_transition.h
@@ -11,8 +11,7 @@ void GetBg0TilesDst(u16 **tilemap, u16 **tileset);
extern const struct SpritePalette gSpritePalette_Pokeball;
-enum // TRANSITION_MUGSHOT
-{
+enum {
MUGSHOT_SIDNEY,
MUGSHOT_PHOEBE,
MUGSHOT_GLACIA,
@@ -21,52 +20,64 @@ enum // TRANSITION_MUGSHOT
MUGSHOTS_COUNT
};
-// credits for the names go to Dyskinesia, Tetrable and Farore
-// names are naturally subject to change
+enum {
+ B_TRANSITION_BLUR,
+ B_TRANSITION_SWIRL,
+ B_TRANSITION_SHUFFLE,
+ B_TRANSITION_BIG_POKEBALL,
+ B_TRANSITION_POKEBALLS_TRAIL,
+ B_TRANSITION_CLOCKWISE_BLACKFADE,
+ B_TRANSITION_RIPPLE,
+ B_TRANSITION_WAVE,
+ B_TRANSITION_SLICE,
+ B_TRANSITION_WHITEFADE,
+ B_TRANSITION_GRID_SQUARES,
+ B_TRANSITION_SHARDS,
+ B_TRANSITION_SIDNEY,
+ B_TRANSITION_PHOEBE,
+ B_TRANSITION_GLACIA,
+ B_TRANSITION_DRAKE,
+ B_TRANSITION_CHAMPION,
+ B_TRANSITION_AQUA, // Here below added in Emerald
+ B_TRANSITION_MAGMA,
+ B_TRANSITION_REGICE,
+ B_TRANSITION_REGISTEEL,
+ B_TRANSITION_REGIROCK,
+ B_TRANSITION_KYOGRE,
+ B_TRANSITION_GROUDON,
+ B_TRANSITION_RAYQUAZA,
+ B_TRANSITION_SHRED_SPLIT,
+ B_TRANSITION_BLACKHOLE1,
+ B_TRANSITION_BLACKHOLE2,
+ B_TRANSITION_RECTANGULAR_SPIRAL,
+ B_TRANSITION_FRONTIER_LOGO_WIGGLE,
+ B_TRANSITION_FRONTIER_LOGO_WAVE,
+ B_TRANSITION_FRONTIER_SQUARES,
+ B_TRANSITION_FRONTIER_SQUARES_SCROLL,
+ B_TRANSITION_FRONTIER_SQUARES_SPIRAL,
+ B_TRANSITION_FRONTIER_CIRCLES_MEET,
+ B_TRANSITION_FRONTIER_CIRCLES_CROSS,
+ B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL,
+ B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL,
+ B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ,
+ B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ,
+ B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ,
+ B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ,
+ B_TRANSITION_COUNT
+};
-#define B_TRANSITION_BLUR 0
-#define B_TRANSITION_SWIRL 1
-#define B_TRANSITION_SHUFFLE 2
-#define B_TRANSITION_BIG_POKEBALL 3
-#define B_TRANSITION_POKEBALLS_TRAIL 4
-#define B_TRANSITION_CLOCKWISE_BLACKFADE 5
-#define B_TRANSITION_RIPPLE 6
-#define B_TRANSITION_WAVE 7
-#define B_TRANSITION_SLICE 8
-#define B_TRANSITION_WHITEFADE 9
-#define B_TRANSITION_GRID_SQUARES 10
-#define B_TRANSITION_SHARDS 11
-#define B_TRANSITION_SIDNEY 12
-#define B_TRANSITION_PHOEBE 13
-#define B_TRANSITION_GLACIA 14
-#define B_TRANSITION_DRAKE 15
-#define B_TRANSITION_CHAMPION 16
-// added in Emerald
-#define B_TRANSITION_AQUA 17
-#define B_TRANSITION_MAGMA 18
-#define B_TRANSITION_REGICE 19
-#define B_TRANSITION_REGISTEEL 20
-#define B_TRANSITION_REGIROCK 21
-#define B_TRANSITION_KYOGRE 22
-#define B_TRANSITION_GROUDON 23
-#define B_TRANSITION_RAYQUAZA 24
-#define B_TRANSITION_SHRED_SPLIT 25
-#define B_TRANSITION_BLACKHOLE1 26
-#define B_TRANSITION_BLACKHOLE2 27
-#define B_TRANSITION_RECTANGULAR_SPIRAL 28
-#define B_TRANSITION_FRONTIER_LOGO_WIGGLE 29
-#define B_TRANSITION_FRONTIER_LOGO_WAVE 30
-#define B_TRANSITION_FRONTIER_SQUARES 31
-#define B_TRANSITION_FRONTIER_SQUARES_SCROLL 32
-#define B_TRANSITION_FRONTIER_SQUARES_SPIRAL 33
-#define B_TRANSITION_FRONTIER_CIRCLES_MEET 34
-#define B_TRANSITION_FRONTIER_CIRCLES_CROSS 35
-#define B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL 36
-#define B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL 37
-#define B_TRANSITION_FRONTIER_CIRCLES_MEET_IN_SEQ 38
-#define B_TRANSITION_FRONTIER_CIRCLES_CROSS_IN_SEQ 39
-#define B_TRANSITION_FRONTIER_CIRCLES_ASYMMETRIC_SPIRAL_IN_SEQ 40
-#define B_TRANSITION_FRONTIER_CIRCLES_SYMMETRIC_SPIRAL_IN_SEQ 41
-#define B_TRANSITION_COUNT 42
+// IDs for GetSpecialBattleTransition
+enum {
+ B_TRANSITION_GROUP_B_TOWER,
+ B_TRANSITION_GROUP_B_DOME = 3,
+ B_TRANSITION_GROUP_B_PALACE,
+ B_TRANSITION_GROUP_B_ARENA,
+ B_TRANSITION_GROUP_B_FACTORY,
+ B_TRANSITION_GROUP_B_PIKE,
+ B_TRANSITION_GROUP_B_PYRAMID = 10,
+ B_TRANSITION_GROUP_TRAINER_HILL,
+ B_TRANSITION_GROUP_SECRET_BASE,
+ B_TRANSITION_GROUP_E_READER,
+};
#endif // GUARD_BATTLE_TRANSITION_H
diff --git a/include/battle_util.h b/include/battle_util.h
index d4e2a23f8..914e44c04 100644
--- a/include/battle_util.h
+++ b/include/battle_util.h
@@ -6,39 +6,43 @@
#define MOVE_LIMITATION_DISABLED (1 << 2)
#define MOVE_LIMITATION_TORMENTED (1 << 3)
#define MOVE_LIMITATION_TAUNT (1 << 4)
-#define MOVE_LIMITATION_IMPRISON (1 << 5)
+#define MOVE_LIMITATION_IMPRISON (1 << 5)
+#define MOVE_LIMITATIONS_ALL 0xFF
-#define ABILITYEFFECT_ON_SWITCHIN 0x0
-#define ABILITYEFFECT_ENDTURN 0x1
-#define ABILITYEFFECT_MOVES_BLOCK 0x2
-#define ABILITYEFFECT_ABSORBING 0x3
-#define ABILITYEFFECT_ON_DAMAGE 0x4
-#define ABILITYEFFECT_IMMUNITY 0x5
-#define ABILITYEFFECT_FORECAST 0x6
-#define ABILITYEFFECT_SYNCHRONIZE 0x7
-#define ABILITYEFFECT_ATK_SYNCHRONIZE 0x8
-#define ABILITYEFFECT_INTIMIDATE1 0x9
-#define ABILITYEFFECT_INTIMIDATE2 0xA
-#define ABILITYEFFECT_TRACE 0xB
-#define ABILITYEFFECT_CHECK_OTHER_SIDE 0xC
-#define ABILITYEFFECT_CHECK_BATTLER_SIDE 0xD
-#define ABILITYEFFECT_FIELD_SPORT 0xE
-#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER 0xF
-#define ABILITYEFFECT_COUNT_OTHER_SIDE 0x10
-#define ABILITYEFFECT_COUNT_BATTLER_SIDE 0x11
-#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
-#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
-#define ABILITYEFFECT_MUD_SPORT 0xFD
-#define ABILITYEFFECT_WATER_SPORT 0xFE
-#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
+#define ABILITYEFFECT_ON_SWITCHIN 0
+#define ABILITYEFFECT_ENDTURN 1
+#define ABILITYEFFECT_MOVES_BLOCK 2
+#define ABILITYEFFECT_ABSORBING 3
+#define ABILITYEFFECT_ON_DAMAGE 4
+#define ABILITYEFFECT_IMMUNITY 5
+#define ABILITYEFFECT_FORECAST 6
+#define ABILITYEFFECT_SYNCHRONIZE 7
+#define ABILITYEFFECT_ATK_SYNCHRONIZE 8
+#define ABILITYEFFECT_INTIMIDATE1 9
+#define ABILITYEFFECT_INTIMIDATE2 10
+#define ABILITYEFFECT_TRACE 11
+#define ABILITYEFFECT_CHECK_OTHER_SIDE 12
+#define ABILITYEFFECT_CHECK_BATTLER_SIDE 13
+#define ABILITYEFFECT_FIELD_SPORT 14
+#define ABILITYEFFECT_CHECK_FIELD_EXCEPT_BATTLER 15
+#define ABILITYEFFECT_COUNT_OTHER_SIDE 16
+#define ABILITYEFFECT_COUNT_BATTLER_SIDE 17
+#define ABILITYEFFECT_COUNT_ON_FIELD 18
+#define ABILITYEFFECT_CHECK_ON_FIELD 19
+#define ABILITYEFFECT_MUD_SPORT 253
+#define ABILITYEFFECT_WATER_SPORT 254
+#define ABILITYEFFECT_SWITCH_IN_WEATHER 255
#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0))
#define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0))
#define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0))
-#define ITEMEFFECT_ON_SWITCH_IN 0x0
-#define ITEMEFFECT_MOVE_END 0x3
-#define ITEMEFFECT_KINGSROCK_SHELLBELL 0x4
+// For the first argument of ItemBattleEffects, to deteremine which block of item effects to try
+#define ITEMEFFECT_ON_SWITCH_IN 0
+#define ITEMEFFECT_NORMAL 1
+#define ITEMEFFECT_DUMMY 2 // Unused, empty
+#define ITEMEFFECT_MOVE_END 3
+#define ITEMEFFECT_KINGSROCK_SHELLBELL 4
#define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK)))
#define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK)))
diff --git a/include/constants/battle.h b/include/constants/battle.h
index f1ce757e7..2534ade4b 100644
--- a/include/constants/battle.h
+++ b/include/constants/battle.h
@@ -306,4 +306,56 @@
#define B_WAIT_TIME_MED 48
#define B_WAIT_TIME_SHORT 32
+#define CASTFORM_NORMAL 0
+#define CASTFORM_FIRE 1
+#define CASTFORM_WATER 2
+#define CASTFORM_ICE 3
+#define NUM_CASTFORM_FORMS 4
+#define CASTFORM_SUBSTITUTE (1 << 7)
+
+#define FLEE_ITEM 1
+#define FLEE_ABILITY 2
+
+#define B_WIN_TYPE_NORMAL 0
+#define B_WIN_TYPE_ARENA 1
+
+// Window Ids for gStandardBattleWindowTemplates / gBattleArenaWindowTemplates
+#define B_WIN_MSG 0
+#define B_WIN_ACTION_PROMPT 1 // "What will {x} do?"
+#define B_WIN_ACTION_MENU 2 // "Fight/Pokémon/Bag/Run" menu
+#define B_WIN_MOVE_NAME_1 3 // Top left
+#define B_WIN_MOVE_NAME_2 4 // Top right
+#define B_WIN_MOVE_NAME_3 5 // Bottom left
+#define B_WIN_MOVE_NAME_4 6 // Bottom right
+#define B_WIN_PP 7
+#define B_WIN_DUMMY 8
+#define B_WIN_PP_REMAINING 9
+#define B_WIN_MOVE_TYPE 10
+#define B_WIN_SWITCH_PROMPT 11 // "Switch which?"
+#define B_WIN_YESNO 12
+#define B_WIN_LEVEL_UP_BOX 13
+#define B_WIN_LEVEL_UP_BANNER 14
+#define B_WIN_VS_PLAYER 15
+#define B_WIN_VS_OPPONENT 16
+#define B_WIN_VS_MULTI_PLAYER_1 17
+#define B_WIN_VS_MULTI_PLAYER_2 18
+#define B_WIN_VS_MULTI_PLAYER_3 19
+#define B_WIN_VS_MULTI_PLAYER_4 20
+#define B_WIN_VS_OUTCOME_DRAW 21
+#define B_WIN_VS_OUTCOME_LEFT 22
+#define B_WIN_VS_OUTCOME_RIGHT 23
+
+// The following are duplicate id values for windows that Battle Arena uses differently.
+#define ARENA_WIN_PLAYER_NAME 15
+#define ARENA_WIN_VS 16
+#define ARENA_WIN_OPPONENT_NAME 17
+#define ARENA_WIN_MIND 18
+#define ARENA_WIN_SKILL 19
+#define ARENA_WIN_BODY 20
+#define ARENA_WIN_JUDGEMENT_TITLE 21
+#define ARENA_WIN_JUDGEMENT_TEXT 22
+
+// Flag for BattlePutTextOnWindow. Never set
+#define B_WIN_COPYTOVRAM (1 << 7)
+
#endif // GUARD_CONSTANTS_BATTLE_H
diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h
index 4622876cc..48de594e2 100644
--- a/include/constants/battle_anim.h
+++ b/include/constants/battle_anim.h
@@ -318,7 +318,7 @@
#define SOUND_PAN_TARGET 63
// move background ids
-#define BG_DARK_ 0 // the same as BG_DARK but is unused
+#define BG_NONE 0 // the same as BG_DARK but is unused
#define BG_DARK 1
#define BG_GHOST 2
#define BG_PSYCHIC 3
@@ -395,6 +395,9 @@
// Tasks with return values often assign them to gBattleAnimArgs[7].
#define ARG_RET_ID 7
+// For createsprite macro to use internally
+#define ANIMSPRITE_IS_TARGET (1 << 7)
+
// Trapping Wrap-like moves end turn animation.
#define TRAP_ANIM_BIND 0
#define TRAP_ANIM_WRAP 0
diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h
index d5e3eb7bb..83aacf316 100644
--- a/include/constants/battle_script_commands.h
+++ b/include/constants/battle_script_commands.h
@@ -1,38 +1,51 @@
#ifndef GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H
#define GUARD_CONSTANTS_BATTLE_SCRIPT_COMMANDS_H
-// Battle Scripting and BattleCommunication addresses
-#define sPAINSPLIT_HP gBattleScripting
-#define sBIDE_DMG gBattleScripting + 4
-#define sMULTIHIT_STRING gBattleScripting + 8
-#define sDMG_MULTIPLIER gBattleScripting + 0xE
-#define sTWOTURN_STRINGID gBattleScripting + 0xF
-#define sB_ANIM_ARG1 gBattleScripting + 0x10
-#define sB_ANIM_ARG2 gBattleScripting + 0x11
-#define sTRIPLE_KICK_POWER gBattleScripting + 0x12
-#define sMOVEEND_STATE gBattleScripting + 0x14
-#define sBATTLER_WITH_ABILITY gBattleScripting + 0x15
-#define sMULTIHIT_EFFECT gBattleScripting + 0x16
-#define sBATTLER gBattleScripting + 0x17
-#define sB_ANIM_TURN gBattleScripting + 0x18
-#define sB_ANIM_TARGETS_HIT gBattleScripting + 0x19
-#define sSTATCHANGER gBattleScripting + 0x1A
-#define sSTAT_ANIM_PLAYED gBattleScripting + 0x1B
-#define sGIVEEXP_STATE gBattleScripting + 0x1C
-#define sBATTLE_STYLE gBattleScripting + 0x1D
-#define sLVLBOX_STATE gBattleScripting + 0x1E
-#define sLEARNMOVE_STATE gBattleScripting + 0x1F
-#define sFIELD_20 gBattleScripting + 0x20
-#define sRESHOW_MAIN_STATE gBattleScripting + 0x21
-#define sRESHOW_HELPER_STATE gBattleScripting + 0x22
-#define sFIELD_23 gBattleScripting + 0x23
-#define sWINDOWS_TYPE gBattleScripting + 0x24
-#define sMULTIPLAYER_ID gBattleScripting + 0x25
-#define sSPECIAL_TRAINER_BATTLE_TYPE gBattleScripting + 0x26
+// The following correspond to the struct members of BattleScripting by adding their offset
+#define sPAINSPLIT_HP (gBattleScripting + 0x00) // painSplitHp
+#define sBIDE_DMG (gBattleScripting + 0x04) // bideDmg
+#define sMULTIHIT_STRING (gBattleScripting + 0x08) // multihitString
+#define sDMG_MULTIPLIER (gBattleScripting + 0x0E) // dmgMultiplier
+#define sTWOTURN_STRINGID (gBattleScripting + 0x0F) // twoTurnsMoveStringId
+#define sB_ANIM_ARG1 (gBattleScripting + 0x10) // animArg1
+#define sB_ANIM_ARG2 (gBattleScripting + 0x11) // animArg2
+#define sTRIPLE_KICK_POWER (gBattleScripting + 0x12) // tripleKickPower
+#define sMOVEEND_STATE (gBattleScripting + 0x14) // moveendState
+#define sBATTLER_WITH_ABILITY (gBattleScripting + 0x15) // battlerWithAbility
+#define sMULTIHIT_EFFECT (gBattleScripting + 0x16) // multihitMoveEffect
+#define sBATTLER (gBattleScripting + 0x17) // battler
+#define sB_ANIM_TURN (gBattleScripting + 0x18) // animTurn
+#define sB_ANIM_TARGETS_HIT (gBattleScripting + 0x19) // animTargetsHit
+#define sSTATCHANGER (gBattleScripting + 0x1A) // statChanger
+#define sSTAT_ANIM_PLAYED (gBattleScripting + 0x1B) // statAnimPlayed
+#define sGIVEEXP_STATE (gBattleScripting + 0x1C) // getexpState
+#define sBATTLE_STYLE (gBattleScripting + 0x1D) // battleStyle
+#define sLVLBOX_STATE (gBattleScripting + 0x1E) // drawlvlupboxState
+#define sLEARNMOVE_STATE (gBattleScripting + 0x1F) // learnMoveState
+#define sPURSUIT_DOUBLES_ATTACKER (gBattleScripting + 0x20) // pursuitDoublesAttacker
+#define sRESHOW_MAIN_STATE (gBattleScripting + 0x21) // reshowMainState
+#define sRESHOW_HELPER_STATE (gBattleScripting + 0x22) // reshowHelperState
+#define sLVLUP_HP (gBattleScripting + 0x23) // levelUpHP
+#define sWINDOWS_TYPE (gBattleScripting + 0x24) // windowsType
+#define sMULTIPLAYER_ID (gBattleScripting + 0x25) // multiplayerId
+#define sSPECIAL_TRAINER_BATTLE_TYPE (gBattleScripting + 0x26) // specialTrainerBattleType
-#define cEFFECT_CHOOSER gBattleCommunication + 3
-#define cMULTISTRING_CHOOSER gBattleCommunication + 5
-#define cMISS_TYPE gBattleCommunication + 6
+// Array entries for battle communication
+#define MULTIUSE_STATE 0
+#define CURSOR_POSITION 1
+#define TASK_ID 1 // task Id and cursor position share the same field
+#define SPRITES_INIT_STATE1 1 // shares the Id as well
+#define SPRITES_INIT_STATE2 2
+#define MOVE_EFFECT_BYTE 3
+#define ACTIONS_CONFIRMED_COUNT 4
+#define MULTISTRING_CHOOSER 5
+#define MISS_TYPE 6
+#define MSG_DISPLAY 7
+#define BATTLE_COMMUNICATION_ENTRIES_COUNT 8
+
+#define cEFFECT_CHOOSER (gBattleCommunication + MOVE_EFFECT_BYTE)
+#define cMULTISTRING_CHOOSER (gBattleCommunication + MULTISTRING_CHOOSER)
+#define cMISS_TYPE (gBattleCommunication + MISS_TYPE)
// Battle Script defines for getting the wanted battler
#define BS_TARGET 0
@@ -40,8 +53,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
diff --git a/include/contest.h b/include/contest.h
index 9bac63eda..e7acb5a11 100644
--- a/include/contest.h
+++ b/include/contest.h
@@ -294,7 +294,7 @@ struct ContestResources
u8 * contestBgTilemaps[CONTESTANT_COUNT];
void * boxBlinkTiles1;
void * boxBlinkTiles2;
- void * field_3c;
+ void * animBgTileBuffer;
};
#define eContest (*gContestResources->contest)
diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h
index dd9ead8b7..b31fb5e22 100644
--- a/include/gym_leader_rematch.h
+++ b/include/gym_leader_rematch.h
@@ -66,7 +66,7 @@ enum {
REMATCH_TRENT,
REMATCH_SAWYER,
REMATCH_KIRA_AND_DAN,
- REMATCH_WALLY_3, // Entries above WALLY are considered normal trainers, from Wally below are special trainers
+ REMATCH_WALLY_VR, // Entries above WALLY are considered normal trainers, from Wally below are special trainers
REMATCH_ROXANNE,
REMATCH_BRAWLY,
REMATCH_WATTSON,
@@ -75,7 +75,7 @@ enum {
REMATCH_WINONA,
REMATCH_TATE_AND_LIZA,
REMATCH_JUAN,
- REMATCH_SIDNEY, // Entries below SIDNEY are considered part of REMATCH_ELITE_FOUR_ENTRIES.
+ REMATCH_SIDNEY, // Entries from SIDNEY below are considered part of REMATCH_ELITE_FOUR_ENTRIES.
REMATCH_PHOEBE,
REMATCH_GLACIA,
REMATCH_DRAKE,
@@ -83,7 +83,7 @@ enum {
REMATCH_TABLE_ENTRIES // The total number of rematch entries. Must be last in enum
};
-#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_3
+#define REMATCH_SPECIAL_TRAINER_START REMATCH_WALLY_VR
#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY
void UpdateGymLeaderRematch(void);
diff --git a/include/pokemon.h b/include/pokemon.h
index 229898d71..315416c38 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -76,13 +76,22 @@ struct PokemonSubstruct3
/* 0x0B */ u32 eventLegal:1; // controls Mew & Deoxys obedience; if set, Pokémon is a fateful encounter in Gen 4+; set for in-game event island legendaries, some distributed events, and Pokémon from XD: Gale of Darkness.
};
+// Number of bytes in the largest Pokémon substruct.
+// They are assumed to be the same size, and will be padded to
+// the largest size by the union.
+// By default they are all 12 bytes.
+#define NUM_SUBSTRUCT_BYTES (max(sizeof(struct PokemonSubstruct0), \
+ max(sizeof(struct PokemonSubstruct1), \
+ max(sizeof(struct PokemonSubstruct2), \
+ sizeof(struct PokemonSubstruct3)))))
+
union PokemonSubstruct
{
struct PokemonSubstruct0 type0;
struct PokemonSubstruct1 type1;
struct PokemonSubstruct2 type2;
struct PokemonSubstruct3 type3;
- u16 raw[6];
+ u16 raw[NUM_SUBSTRUCT_BYTES / 2]; // /2 because it's u16, not u8
};
struct BoxPokemon
@@ -102,7 +111,7 @@ struct BoxPokemon
union
{
- u32 raw[12];
+ u32 raw[(NUM_SUBSTRUCT_BYTES * 4) / 4]; // *4 because there are 4 substructs, /4 because it's u32, not u8
union PokemonSubstruct substructs[4];
} secure;
};
diff --git a/include/recorded_battle.h b/include/recorded_battle.h
index 5ae4ac12d..9b8939403 100644
--- a/include/recorded_battle.h
+++ b/include/recorded_battle.h
@@ -8,8 +8,8 @@ extern u8 gRecordedBattleMultiplayerId;
#define B_RECORD_MODE_RECORDING 1
#define B_RECORD_MODE_PLAYBACK 2
-void RecordedBattle_Init(u8 arg0);
-void sub_8184E58(void);
+void RecordedBattle_Init(u8 mode);
+void RecordedBattle_SetTrainerInfo(void);
void RecordedBattle_SetBattlerAction(u8 battlerId, u8 action);
void RecordedBattle_ClearBattlerAction(u8 battlerId, u8 bytesToClear);
u8 RecordedBattle_GetBattlerAction(u8 battlerId);
@@ -23,15 +23,15 @@ u8 GetRecordedBattleFronterBrainSymbol(void);
void RecordedBattle_SaveParties(void);
u8 GetActiveBattlerLinkPlayerGender(void);
void RecordedBattle_ClearFrontierPassFlag(void);
-void RecordedBattle_SetFrontierPassFlagFromHword(u16 arg0);
+void RecordedBattle_SetFrontierPassFlagFromHword(u16 flags);
u8 RecordedBattle_GetFrontierPassFlag(void);
u8 GetBattleSceneInRecordedBattle(void);
u8 GetTextSpeedInRecordedBattle(void);
void RecordedBattle_CopyBattlerMoves(void);
-void sub_818603C(u8 arg0);
+void RecordedBattle_CheckMovesetChanges(u8 mode);
u32 GetAiScriptsInRecordedBattle(void);
-void sub_8186444(void);
-bool8 sub_8186450(void);
+void RecordedBattle_SetPlaybackFinished(void);
+bool8 RecordedBattle_CanStopPlayback(void);
void GetRecordedBattleRecordMixFriendName(u8 *dst);
u8 GetRecordedBattleRecordMixFriendClass(void);
u8 GetRecordedBattleApprenticeId(void);