summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/battle.h329
-rw-r--r--include/battle_ai_script_commands.h4
-rw-r--r--include/battle_anim.h16
-rw-r--r--include/battle_controllers.h112
-rw-r--r--include/battle_frontier_1.h7
-rw-r--r--include/battle_gfx_sfx_util.h4
-rw-r--r--include/battle_interface.h4
-rw-r--r--include/battle_link_817C95C.h2
-rw-r--r--include/battle_main.h (renamed from include/battle_2.h)6
-rw-r--r--include/battle_script_commands.h2
-rw-r--r--include/battle_util.h4
-rw-r--r--include/berry_fix_program.h6
-rw-r--r--include/berry_tag_screen.h6
-rw-r--r--include/blend_palette.h10
-rw-r--r--include/clear_save_data_menu.h6
-rw-r--r--include/constants/items.h3
-rw-r--r--include/constants/rgb.h16
-rw-r--r--include/constants/weather.h39
-rw-r--r--include/coord_event_weather.h6
-rw-r--r--include/field_map_obj_helpers.h30
-rw-r--r--include/field_weather.h167
-rw-r--r--include/gba/defines.h5
-rw-r--r--include/global.h22
-rw-r--r--include/graphics.h34
-rw-r--r--include/intro.h8
-rw-r--r--include/item.h1
-rw-r--r--include/item_icon.h15
-rw-r--r--include/item_menu.h13
-rw-r--r--include/item_menu_icons.h6
-rw-r--r--include/item_use.h54
-rw-r--r--include/link.h8
-rw-r--r--include/main_menu.h6
-rw-r--r--include/map_obj_8097404.h34
-rw-r--r--include/menu.h2
-rw-r--r--include/menu_helpers.h1
-rw-r--r--include/mystery_event_menu.h6
-rw-r--r--include/overworld.h2
-rw-r--r--include/palette.h1
-rw-r--r--include/pokemon.h3
-rw-r--r--include/pokemon_animation.h7
-rw-r--r--include/rayquaza_scene.h17
-rw-r--r--include/recorded_battle.h6
-rw-r--r--include/reset_rtc_screen.h6
-rw-r--r--include/scanline_effect.h47
-rw-r--r--include/sprite.h1
-rw-r--r--include/strings.h34
-rw-r--r--include/time_events.h8
-rw-r--r--include/title_screen.h8
-rw-r--r--include/unknown_task.h22
49 files changed, 838 insertions, 318 deletions
diff --git a/include/battle.h b/include/battle.h
index 4fd252676..81c1d341d 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -4,35 +4,59 @@
// should they be included here or included individually by every file?
#include "battle_util.h"
#include "battle_script_commands.h"
-#include "battle_2.h"
+#include "battle_main.h"
#include "battle_ai_switch_items.h"
#include "battle_gfx_sfx_util.h"
#include "battle_util2.h"
#include "battle_bg.h"
/*
- Banks are a name given to what could be called a 'battlerId' or 'monControllerId'.
- Each bank has a value consisting of two bits.
- 0x1 bit is responsible for the side, 0 = player's side, 1 = opponent's side.
- 0x2 bit is responsible for the id of sent out pokemon. 0 means it's the first sent out pokemon, 1 it's the second one. (Triple battle didn't exist at the time yet.)
-*/
-
-#define BATTLE_BANKS_COUNT 4
-
-#define IDENTITY_PLAYER_MON1 0
-#define IDENTITY_OPPONENT_MON1 1
-#define IDENTITY_PLAYER_MON2 2
-#define IDENTITY_OPPONENT_MON2 3
-
-#define SIDE_PLAYER 0x0
-#define SIDE_OPPONENT 0x1
-
-#define BIT_SIDE 0x1
-#define BIT_MON 0x2
-
-#define GET_BANK_IDENTITY(bank)((gBanksByIdentity[bank]))
-#define GET_BANK_SIDE(bank)((GetBankIdentity(bank) & BIT_SIDE))
-#define GET_BANK_SIDE2(bank)((GET_BANK_IDENTITY(bank) & BIT_SIDE))
+ * A battler may be in one of four positions on the field. The first bit determines
+ * what side the battler is on, either the player's side or the opponent's side.
+ * The second bit determines what flank the battler is on, either the left or right.
+ * Note that the opponent's flanks are drawn corresponding to their perspective, so
+ * their right mon appears on the left, and their left mon appears on the right.
+ * The battler ID is usually the same as the position, except in the case of link battles.
+ *
+ * + ------------------------- +
+ * | Opponent's side |
+ * | Right Left |
+ * | 3 1 |
+ * | |
+ * | Player's side |
+ * | Left Right |
+ * | 0 2 |
+ * ----------------------------+
+ * | |
+ * | |
+ * +---------------------------+
+ */
+
+#define MAX_BATTLERS_COUNT 4
+
+#define B_POSITION_PLAYER_LEFT 0
+#define B_POSITION_OPPONENT_LEFT 1
+#define B_POSITION_PLAYER_RIGHT 2
+#define B_POSITION_OPPONENT_RIGHT 3
+
+// These macros can be used with either battler ID or positions to get the partner or the opposite mon
+#define BATTLE_OPPOSITE(id) ((id) ^ 1)
+#define BATTLE_PARTNER(id) ((id) ^ 2)
+
+#define B_SIDE_PLAYER 0
+#define B_SIDE_OPPONENT 1
+
+#define B_FLANK_LEFT 0
+#define B_FLANK_RIGHT 1
+
+#define BIT_SIDE 1
+#define BIT_FLANK 2
+
+#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
+#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
+#define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE)
+
+// Battle Type Flags
#define BATTLE_TYPE_DOUBLE 0x0001
#define BATTLE_TYPE_LINK 0x0002
@@ -66,6 +90,10 @@
#define BATTLE_TYPE_KYOGRE 0x20000000
#define BATTLE_TYPE_RAYQUAZA 0x40000000
#define BATTLE_TYPE_x80000000 0x80000000
+#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
+#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
+
+extern u32 gBattleTypeFlags;
#define TRAINER_OPPONENT_3FE 0x3FE
#define TRAINER_OPPONENT_C00 0xC00
@@ -73,56 +101,58 @@
#define STEVEN_PARTNER_ID 0xC03
#define SECRET_BASE_OPPONENT 0x400
-#define BATTLE_TYPE_FRONTIER (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE | BATTLE_TYPE_PYRAMID)
-#define BATTLE_TYPE_FRONTIER_NO_PYRAMID (BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_DOME | BATTLE_TYPE_PALACE | BATTLE_TYPE_ARENA | BATTLE_TYPE_FACTORY | BATTLE_TYPE_PIKE)
+#define B_OUTCOME_WON 0x1
+#define B_OUTCOME_LOST 0x2
+#define B_OUTCOME_DREW 0x3
+#define B_OUTCOME_RAN 0x4
+#define B_OUTCOME_PLAYER_TELEPORTED 0x5
+#define B_OUTCOME_POKE_FLED 0x6
+#define B_OUTCOME_CAUGHT_POKE 0x7
+#define B_OUTCOME_NO_SAFARI_BALLS 0x8
+#define B_OUTCOME_FORFEITED 0x9
+#define B_OUTCOME_POKE_TELEPORTED 0xA
+#define B_OUTCOME_LINK_BATTLE_RAN 0x80
-#define BATTLE_WON 0x1
-#define BATTLE_LOST 0x2
-#define BATTLE_DREW 0x3
-#define BATTLE_RAN 0x4
-#define BATTLE_PLAYER_TELEPORTED 0x5
-#define BATTLE_POKE_FLED 0x6
-#define BATTLE_CAUGHT 0x7
-#define BATTLE_SAFARI_OUT_OF_BALLS 0x8
-#define BATTLE_FORFEITED 0x9
-#define BATTLE_OPPONENT_TELEPORTED 0xA
-
-#define OUTCOME_LINK_BATTLE_RUN 0x80
-
-#define STATUS_NONE 0x0
-#define STATUS_SLEEP 0x7
-#define STATUS_POISON 0x8
-#define STATUS_BURN 0x10
-#define STATUS_FREEZE 0x20
-#define STATUS_PARALYSIS 0x40
-#define STATUS_TOXIC_POISON 0x80
-#define STATUS_TOXIC_COUNTER 0xF00
-
-#define STATUS_PSN_ANY ((STATUS_POISON | STATUS_TOXIC_POISON))
-#define STATUS_ANY ((STATUS_SLEEP | STATUS_POISON | STATUS_BURN | STATUS_FREEZE | STATUS_PARALYSIS | STATUS_TOXIC_POISON))
-
-#define STATUS2_CONFUSION 0x00000007
-#define STATUS2_FLINCHED 0x00000008
-#define STATUS2_UPROAR 0x00000070
-#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
-#define STATUS2_LOCK_CONFUSE 0x00000C00
-#define STATUS2_MULTIPLETURNS 0x00001000
-#define STATUS2_WRAPPED 0x0000E000
-#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every bank
-#define STATUS2_INFATUATED_WITH(bank)((gBitTable[bank] << 16))
-#define STATUS2_FOCUS_ENERGY 0x00100000
-#define STATUS2_TRANSFORMED 0x00200000
-#define STATUS2_RECHARGE 0x00400000
-#define STATUS2_RAGE 0x00800000
-#define STATUS2_SUBSTITUTE 0x01000000
-#define STATUS2_DESTINY_BOND 0x02000000
-#define STATUS2_ESCAPE_PREVENTION 0x04000000
-#define STATUS2_NIGHTMARE 0x08000000
-#define STATUS2_CURSED 0x10000000
-#define STATUS2_FORESIGHT 0x20000000
-#define STATUS2_DEFENSE_CURL 0x40000000
-#define STATUS2_TORMENT 0x80000000
+extern u8 gBattleOutcome;
+// Non-volatile status conditions
+// These persist remain outside of battle and after switching out
+#define STATUS1_NONE 0x0
+#define STATUS1_SLEEP 0x7
+#define STATUS1_POISON 0x8
+#define STATUS1_BURN 0x10
+#define STATUS1_FREEZE 0x20
+#define STATUS1_PARALYSIS 0x40
+#define STATUS1_TOXIC_POISON 0x80
+#define STATUS1_TOXIC_COUNTER 0xF00
+#define STATUS1_PSN_ANY (STATUS1_POISON | STATUS1_TOXIC_POISON)
+#define STATUS1_ANY (STATUS1_SLEEP | STATUS1_POISON | STATUS1_BURN | STATUS1_FREEZE | STATUS1_PARALYSIS | STATUS1_TOXIC_POISON)
+
+// Volatile status ailments
+// These are removed after exiting the battle or switching out
+#define STATUS2_CONFUSION 0x00000007
+#define STATUS2_FLINCHED 0x00000008
+#define STATUS2_UPROAR 0x00000070
+#define STATUS2_BIDE 0x00000300 // two bits 0x100, 0x200
+#define STATUS2_LOCK_CONFUSE 0x00000C00
+#define STATUS2_MULTIPLETURNS 0x00001000
+#define STATUS2_WRAPPED 0x0000E000
+#define STATUS2_INFATUATION 0x000F0000 // 4 bits, one for every battler
+#define STATUS2_INFATUATED_WITH(battler) (gBitTable[battler] << 16)
+#define STATUS2_FOCUS_ENERGY 0x00100000
+#define STATUS2_TRANSFORMED 0x00200000
+#define STATUS2_RECHARGE 0x00400000
+#define STATUS2_RAGE 0x00800000
+#define STATUS2_SUBSTITUTE 0x01000000
+#define STATUS2_DESTINY_BOND 0x02000000
+#define STATUS2_ESCAPE_PREVENTION 0x04000000
+#define STATUS2_NIGHTMARE 0x08000000
+#define STATUS2_CURSED 0x10000000
+#define STATUS2_FORESIGHT 0x20000000
+#define STATUS2_DEFENSE_CURL 0x40000000
+#define STATUS2_TORMENT 0x80000000
+
+// Seems like per-battler statuses. Not quite sure how to categorize these
#define STATUS3_LEECHSEED_BANK 0x3
#define STATUS3_LEECHSEED 0x4
#define STATUS3_ALWAYS_HITS 0x18 // two bits
@@ -141,8 +171,11 @@
#define STATUS3_UNDERWATER 0x40000
#define STATUS3_INTIMIDATE_POKES 0x80000
#define STATUS3_TRACE 0x100000
+#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)
+
+extern u32 gStatuses3[MAX_BATTLERS_COUNT];
-#define STATUS3_SEMI_INVULNERABLE ((STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER))
+// Not really sure what a "hitmarker" is.
#define HITMARKER_x10 0x00000010
#define HITMARKER_x20 0x00000020
@@ -168,8 +201,12 @@
#define HITMARKER_OBEYS 0x02000000
#define HITMARKER_x4000000 0x04000000
#define HITMARKER_x8000000 0x08000000
-#define HITMARKER_FAINTED(bank) ((gBitTable[bank] << 0x1C))
-#define HITMARKER_UNK(bank) ((0x10000000 << bank))
+#define HITMARKER_FAINTED(battler) (gBitTable[battler] << 0x1C)
+#define HITMARKER_UNK(battler) (0x10000000 << battler)
+
+extern u32 gHitMarker;
+
+// Per-side statuses that affect an entire party
#define SIDE_STATUS_REFLECT (1 << 0)
#define SIDE_STATUS_LIGHTSCREEN (1 << 1)
@@ -180,49 +217,57 @@
#define SIDE_STATUS_MIST (1 << 8)
#define SIDE_STATUS_SPIKES_DAMAGED (1 << 9)
-#define ACTION_USE_MOVE 0
-#define ACTION_USE_ITEM 1
-#define ACTION_SWITCH 2
-#define ACTION_RUN 3
-#define ACTION_WATCHES_CAREFULLY 4
-#define ACTION_SAFARI_ZONE_BALL 5
-#define ACTION_POKEBLOCK_CASE 6
-#define ACTION_GO_NEAR 7
-#define ACTION_SAFARI_ZONE_RUN 8
-#define ACTION_9 9
-#define ACTION_RUN_BATTLESCRIPT 10 // when executing an action
-#define ACTION_CANCEL_PARTNER 12 // when choosing an action
-#define ACTION_FINISHED 12 // when executing an action
-#define ACTION_NOTHING_FAINTED 13 // when choosing an action
-#define ACTION_INIT_VALUE 0xFF
-
-#define MOVESTATUS_MISSED (1 << 0)
-#define MOVESTATUS_SUPEREFFECTIVE (1 << 1)
-#define MOVESTATUS_NOTVERYEFFECTIVE (1 << 2)
-#define MOVESTATUS_NOTAFFECTED (1 << 3)
-#define MOVESTATUS_ONEHITKO (1 << 4)
-#define MOVESTATUS_FAILED (1 << 5)
-#define MOVESTATUS_ENDURED (1 << 6)
-#define MOVESTATUS_HUNGON (1 << 7)
-
-#define MOVESTATUS_NOEFFECT ((MOVESTATUS_MISSED | MOVESTATUS_NOTAFFECTED | MOVESTATUS_FAILED))
+extern u16 gSideStatuses[2];
+
+// Battle Actions
+// These determine what each battler will do in a turn
+#define B_ACTION_USE_MOVE 0
+#define B_ACTION_USE_ITEM 1
+#define B_ACTION_SWITCH 2
+#define B_ACTION_RUN 3
+#define B_ACTION_SAFARI_WATCH_CAREFULLY 4
+#define B_ACTION_SAFARI_BALL 5
+#define B_ACTION_SAFARI_POKEBLOCK 6
+#define B_ACTION_SAFARI_GO_NEAR 7
+#define B_ACTION_SAFARI_RUN 8
+// The exact purposes of these are unclear
+#define B_ACTION_UNKNOWN9 9
+#define B_ACTION_EXEC_SCRIPT 10 // when executing an action
+#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
+#define B_ACTION_FINISHED 12 // when executing an action
+#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
+#define B_ACTION_NONE 0xFF
+
+#define MOVE_RESULT_MISSED (1 << 0)
+#define MOVE_RESULT_SUPER_EFFECTIVE (1 << 1)
+#define MOVE_RESULT_NOT_VERY_EFFECTIVE (1 << 2)
+#define MOVE_RESULT_DOESNT_AFFECT_FOE (1 << 3)
+#define MOVE_RESULT_ONE_HIT_KO (1 << 4)
+#define MOVE_RESULT_FAILED (1 << 5)
+#define MOVE_RESULT_FOE_ENDURED (1 << 6)
+#define MOVE_RESULT_FOE_HUNG_ON (1 << 7)
+#define MOVE_RESULT_NO_EFFECT (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE | MOVE_RESULT_FAILED)
#define MAX_TRAINER_ITEMS 4
#define MAX_MON_MOVES 4
+// Battle Weather flags
+
#define WEATHER_RAIN_TEMPORARY (1 << 0)
-#define WEATHER_RAIN_DOWNPOUR (1 << 1)
+#define WEATHER_RAIN_DOWNPOUR (1 << 1) // unused
#define WEATHER_RAIN_PERMANENT (1 << 2)
-#define WEATHER_RAIN_ANY ((WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT))
+#define WEATHER_RAIN_ANY (WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT)
#define WEATHER_SANDSTORM_TEMPORARY (1 << 3)
#define WEATHER_SANDSTORM_PERMANENT (1 << 4)
-#define WEATHER_SANDSTORM_ANY ((WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT))
+#define WEATHER_SANDSTORM_ANY (WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT)
#define WEATHER_SUN_TEMPORARY (1 << 5)
#define WEATHER_SUN_PERMANENT (1 << 6)
-#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT))
+#define WEATHER_SUN_ANY (WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT)
#define WEATHER_HAIL (1 << 7)
-#define WEATHER_HAIL_ANY ((WEATHER_HAIL))
-#define WEATHER_ANY ((WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY))
+#define WEATHER_HAIL_ANY (WEATHER_HAIL)
+#define WEATHER_ANY (WEATHER_RAIN_ANY | WEATHER_SANDSTORM_ANY | WEATHER_SUN_ANY | WEATHER_HAIL_ANY)
+
+extern u16 gBattleWeather;
#define BATTLE_TERRAIN_GRASS 0
#define BATTLE_TERRAIN_LONG_GRASS 1
@@ -235,6 +280,8 @@
#define BATTLE_TERRAIN_BUILDING 8
#define BATTLE_TERRAIN_PLAIN 9
+extern u8 gBattleTerrain;
+
// array entries for battle communication
#define MULTIUSE_STATE 0x0
#define CURSOR_POSITION 0x1
@@ -299,7 +346,7 @@ struct TrainerMonNoItemDefaultMoves
u16 species;
};
-u8 GetBankSide(u8 bank);
+u8 GetBattlerSide(u8 battler);
struct TrainerMonItemDefaultMoves
{
@@ -382,8 +429,8 @@ struct DisableStruct
/*0x12*/ u8 chargeTimer2 : 4;
/*0x13*/ u8 tauntTimer1:4;
/*0x13*/ u8 tauntTimer2:4;
- /*0x14*/ u8 bankPreventingEscape;
- /*0x15*/ u8 bankWithSureHit;
+ /*0x14*/ u8 battlerPreventingEscape;
+ /*0x15*/ u8 battlerWithSureHit;
/*0x16*/ u8 isFirstTurn;
/*0x17*/ u8 unk17;
/*0x18*/ u8 truantCounter : 1;
@@ -394,7 +441,7 @@ struct DisableStruct
/*0x1A*/ u8 unk1A[2];
};
-extern struct DisableStruct gDisableStructs[BATTLE_BANKS_COUNT];
+extern struct DisableStruct gDisableStructs[MAX_BATTLERS_COUNT];
struct ProtectStruct
{
@@ -434,7 +481,7 @@ struct ProtectStruct
/* field_E */ u16 fieldE;
};
-extern struct ProtectStruct gProtectStructs[BATTLE_BANKS_COUNT];
+extern struct ProtectStruct gProtectStructs[MAX_BATTLERS_COUNT];
struct SpecialStatus
{
@@ -456,7 +503,7 @@ struct SpecialStatus
u8 field13;
};
-extern struct SpecialStatus gSpecialStatuses[BATTLE_BANKS_COUNT];
+extern struct SpecialStatus gSpecialStatuses[MAX_BATTLERS_COUNT];
struct SideTimer
{
@@ -478,12 +525,12 @@ extern struct SideTimer gSideTimers[];
struct WishFutureKnock
{
- u8 futureSightCounter[BATTLE_BANKS_COUNT];
- u8 futureSightAttacker[BATTLE_BANKS_COUNT];
- s32 futureSightDmg[BATTLE_BANKS_COUNT];
- u16 futureSightMove[BATTLE_BANKS_COUNT];
- u8 wishCounter[BATTLE_BANKS_COUNT];
- u8 wishUserID[BATTLE_BANKS_COUNT];
+ u8 futureSightCounter[MAX_BATTLERS_COUNT];
+ u8 futureSightAttacker[MAX_BATTLERS_COUNT];
+ s32 futureSightDmg[MAX_BATTLERS_COUNT];
+ u16 futureSightMove[MAX_BATTLERS_COUNT];
+ u8 wishCounter[MAX_BATTLERS_COUNT];
+ u8 wishUserID[MAX_BATTLERS_COUNT];
u8 weatherDuration;
u8 knockedOffPokes[2];
};
@@ -506,16 +553,16 @@ struct AI_ThinkingStruct
struct UsedMoves
{
- u16 moves[BATTLE_BANKS_COUNT];
- u16 unknown[BATTLE_BANKS_COUNT];
+ u16 moves[MAX_BATTLERS_COUNT];
+ u16 unknown[MAX_BATTLERS_COUNT];
};
struct BattleHistory
{
- struct UsedMoves usedMoves[BATTLE_BANKS_COUNT];
- u8 abilities[BATTLE_BANKS_COUNT];
- u8 itemEffects[BATTLE_BANKS_COUNT];
- u16 trainerItems[BATTLE_BANKS_COUNT];
+ struct UsedMoves usedMoves[MAX_BATTLERS_COUNT];
+ u8 abilities[MAX_BATTLERS_COUNT];
+ u8 itemEffects[MAX_BATTLERS_COUNT];
+ u16 trainerItems[MAX_BATTLERS_COUNT];
u8 itemsNo;
};
@@ -555,10 +602,6 @@ struct BattleResources
extern struct BattleResources* gBattleResources;
-#define BATTLESCRIPTS_STACK (gBattleResources->battleScriptsStack)
-#define BATTLE_CALLBACKS_STACK (gBattleResources->battleCallbackStack)
-#define BATTLE_LVLUP_STATS (gBattleResources->statsBeforeLvlUp)
-
struct BattleResults
{
u8 playerFaintCounter; // 0x0
@@ -621,9 +664,9 @@ struct BattleStruct
u16 expValue;
u8 field_52;
u8 sentInPokes;
- bool8 selectionScriptFinished[BATTLE_BANKS_COUNT];
+ bool8 selectionScriptFinished[MAX_BATTLERS_COUNT];
u8 field_58[4];
- u8 monToSwitchIntoId[BATTLE_BANKS_COUNT];
+ u8 monToSwitchIntoId[MAX_BATTLERS_COUNT];
u8 field_60[4][3];
u8 runTries;
u8 caughtMonNick[11];
@@ -635,8 +678,8 @@ struct BattleStruct
u8 field_7D;
u8 field_7E;
u8 formToChangeInto;
- u8 chosenMovePositions[BATTLE_BANKS_COUNT];
- u8 stateIdAfterSelScript[BATTLE_BANKS_COUNT];
+ u8 chosenMovePositions[MAX_BATTLERS_COUNT];
+ u8 stateIdAfterSelScript[MAX_BATTLERS_COUNT];
u8 field_88;
u8 field_89;
u8 field_8A;
@@ -669,12 +712,12 @@ struct BattleStruct
u8 synchronizeMoveEffect;
u8 field_B3;
void (*savedCallback)(void);
- u16 usedHeldItems[BATTLE_BANKS_COUNT];
+ u16 usedHeldItems[MAX_BATTLERS_COUNT];
u8 chosenItem[4]; // why is this an u8?
u8 AI_itemType[2];
u8 AI_itemFlags[2];
- u16 choicedMove[BATTLE_BANKS_COUNT];
- u16 changedItems[BATTLE_BANKS_COUNT];
+ u16 choicedMove[MAX_BATTLERS_COUNT];
+ u16 changedItems[MAX_BATTLERS_COUNT];
u8 intimidateBank;
u8 switchInItemsCounter;
u8 field_DA;
@@ -682,7 +725,7 @@ struct BattleStruct
u8 fillerDC[0xDF-0xDC];
u8 field_DF;
u8 mirrorMoveArrays[32];
- u16 castformPalette[BATTLE_BANKS_COUNT][16];
+ u16 castformPalette[MAX_BATTLERS_COUNT][16];
u8 field_180;
u8 field_181;
u8 field_182;
@@ -695,7 +738,7 @@ struct BattleStruct
u8 field_1A4[96];
u8 field_204[104];
u8 field_26C[40];
- u8 AI_monToSwitchIntoId[BATTLE_BANKS_COUNT];
+ u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
u8 field_298[8];
u8 field_2A0;
u8 field_2A1;
@@ -797,9 +840,9 @@ struct BattleScripting
u8 animArg2;
u16 tripleKickPower;
u8 atk49_state;
- u8 bankWithAbility;
+ u8 battlerWithAbility;
u8 multihitMoveEffect;
- u8 bank;
+ u8 battler;
u8 animTurn;
u8 animTargetsHit;
u8 statChanger;
@@ -831,9 +874,9 @@ enum
};
// rom_80A5C6C
-u8 GetBankSide(u8 bank);
-u8 GetBankIdentity(u8 bank);
-u8 GetBankByIdentity(u8 bank);
+u8 GetBattlerSide(u8 bank);
+u8 GetBattlerPosition(u8 bank);
+u8 GetBattlerAtPosition(u8 bank);
struct BattleSpriteInfo
{
@@ -907,7 +950,7 @@ struct BattleBarInfo
struct BattleSpriteData
{
- struct BattleSpriteInfo *bankData;
+ struct BattleSpriteInfo *battlerData;
struct BattleHealthboxInfo *healthBoxesData;
struct BattleAnimationInfo *animationData;
struct BattleBarInfo *battleBars;
diff --git a/include/battle_ai_script_commands.h b/include/battle_ai_script_commands.h
index 5fb422b41..316f76de6 100644
--- a/include/battle_ai_script_commands.h
+++ b/include/battle_ai_script_commands.h
@@ -4,9 +4,9 @@
void BattleAI_HandleItemUseBeforeAISetup(u8 defaultScoreMoves);
void BattleAI_SetupAIData(u8 defaultScoreMoves);
u8 BattleAI_ChooseMoveOrAction(void);
-void ClearBankMoveHistory(u8 bank);
+void ClearBattlerMoveHistory(u8 bank);
void RecordAbilityBattle(u8 bank, u8 abilityId);
-void ClearBankAbilityHistory(u8 bank);
+void ClearBattlerAbilityHistory(u8 bank);
void RecordItemEffectBattle(u8 bank, u8 itemEffect);
void ClearBankItemEffectHistory(u8 bank);
diff --git a/include/battle_anim.h b/include/battle_anim.h
index 4046f7051..cc864b024 100644
--- a/include/battle_anim.h
+++ b/include/battle_anim.h
@@ -45,9 +45,9 @@ extern u8 gAnimFriendship;
extern u16 gWeatherMoveAnim;
extern s16 gBattleAnimArgs[ANIM_ARGS_COUNT];
extern u8 gAnimMoveTurn;
-extern u8 gAnimBankAttacker;
-extern u8 gAnimBankTarget;
-extern u16 gAnimSpeciesByBanks[BATTLE_BANKS_COUNT];
+extern u8 gBattleAnimAttacker;
+extern u8 gBattleAnimTarget;
+extern u16 gAnimSpeciesByBanks[MAX_BATTLERS_COUNT];
extern u8 gUnknown_02038440;
void ClearBattleAnimationVars(void);
@@ -56,7 +56,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
void DestroyAnimSprite(struct Sprite *sprite);
void DestroyAnimVisualTask(u8 taskId);
void DestroyAnimSoundTask(u8 taskId);
-bool8 IsAnimBankSpriteVisible(u8 bank);
+bool8 IsBattlerSpriteVisible(u8 bank);
void sub_80A438C(u8 bank, bool8 toBG_2, bool8 setSpriteInvisible);
bool8 IsContest(void);
s8 BattleAnimAdjustPanning(s8 pan);
@@ -85,17 +85,17 @@ enum
BANK_Y_POS,
};
-u8 GetBankPosition(u8 bank, u8 attributeId);
+u8 GetBattlerSpriteCoord(u8 bank, u8 attributeId);
-bool8 IsBankSpritePresent(u8 bank);
+bool8 IsBattlerSpritePresent(u8 bank);
void sub_80A6C68(u8 arg0);
-u8 GetAnimBankSpriteId(u8 wantedBank);
+u8 GetAnimBattlerSpriteId(u8 wantedBank);
bool8 IsDoubleBattle(void);
u8 sub_80A6D94(void);
u8 sub_80A8364(u8);
void StoreSpriteCallbackInData6(struct Sprite *sprite, void (*spriteCallback)(struct Sprite*));
void oamt_add_pos2_onto_pos1(struct Sprite *sprite);
-u8 GetBankSpriteDefault_Y(u8 bank);
+u8 GetBattlerSpriteDefault_Y(u8 bank);
u8 sub_80A82E4(u8 bank);
u8 GetSubstituteSpriteDefault_Y(u8 bank);
diff --git a/include/battle_controllers.h b/include/battle_controllers.h
index c69cb1017..a0fc41b52 100644
--- a/include/battle_controllers.h
+++ b/include/battle_controllers.h
@@ -181,62 +181,62 @@ void sub_8033648(void);
void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data);
// emitters
-void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck);
-void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused
-void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data);
-void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused
-void EmitLoadMonSprite(u8 bufferId);
-void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
-void EmitReturnMonToBall(u8 bufferId, u8 arg1);
-void EmitDrawTrainerPic(u8 bufferId);
-void EmitTrainerSlide(u8 bufferId);
-void EmitTrainerSlideBack(u8 bufferId);
-void EmitFaintAnimation(u8 bufferId);
-void EmitPaletteFade(u8 bufferId); // unused
-void EmitSuccessBallThrowAnim(u8 bufferId); // unused
-void EmitBallThrowAnim(u8 bufferId, u8 caseId);
-void EmitPause(u8 bufferId, u8 toWait, void *data); // unused
-void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit);
-void EmitPrintString(u8 bufferId, u16 stringId);
-void EmitPrintSelectionString(u8 bufferId, u16 stringId);
-void EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2);
-void EmitUnknownYesNoBox(u8 bufferId);
-void EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData);
-void EmitChooseItem(u8 bufferId, u8* arg1);
-void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4);
-void EmitCmd23(u8 bufferId); // unused
-void EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
-void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
-void EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2);
-void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
-void EmitStatusXor(u8 bufferId, u8 b); // unused
-void EmitDataTransfer(u8 bufferId, u16 size, void *data);
-void EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused
-void EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter); // unused
-void EmitCmd32(u8 bufferId, u16 size, void *c); // unused
-void EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2);
-void EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c);
-void EmitOneReturnValue(u8 bufferId, u16 arg1);
-void EmitOneReturnValue_Duplicate(u8 bufferId, u16 b);
-void EmitCmd37(u8 bufferId); // unused
-void EmitCmd38(u8 bufferId, u8 b); // unused
-void EmitCmd39(u8 bufferId); // unused
-void EmitCmd40(u8 bufferId); // unused
-void EmitHitAnimation(u8 bufferId);
-void EmitCmd42(u8 bufferId);
-void EmitPlaySE(u8 bufferId, u16 songId);
-void EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM);
-void EmitFaintingCry(u8 bufferId);
-void EmitIntroSlide(u8 bufferId, u8 terrainId);
-void EmitIntroTrainerBallThrow(u8 bufferId);
-void EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
-void EmitCmd49(u8 bufferId);
-void EmitCmd50(u8 bufferId);
-void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
-void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
-void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
-void EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
-void EmitCmd55(u8 bufferId, u8 arg1);
+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, u8 arg1);
+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 arg1, u16 arg2);
+void BtlController_EmitUnknownYesNoBox(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_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 *unusedDumbDataParameter); // 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);
+void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1);
+void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b);
+void BtlController_EmitCmd37(u8 bufferId); // unused
+void BtlController_EmitCmd38(u8 bufferId, u8 b); // unused
+void BtlController_EmitCmd39(u8 bufferId); // unused
+void BtlController_EmitCmd40(u8 bufferId); // unused
+void BtlController_EmitHitAnimation(u8 bufferId);
+void BtlController_EmitCmd42(u8 bufferId);
+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 arg2);
+void BtlController_EmitCmd49(u8 bufferId);
+void BtlController_EmitCmd50(u8 bufferId);
+void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
+void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
+void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
+void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
+void BtlController_EmitCmd55(u8 bufferId, u8 arg1);
// player controller
void SetControllerToPlayer(void);
diff --git a/include/battle_frontier_1.h b/include/battle_frontier_1.h
new file mode 100644
index 000000000..5483b28ef
--- /dev/null
+++ b/include/battle_frontier_1.h
@@ -0,0 +1,7 @@
+#ifndef GUARD_BATTLE_FRONTIER_1_H
+#define GUARD_BATTLE_FRONTIER_1_H
+
+bool32 sub_8196094(void);
+void sub_8196080(const u8 *str);
+
+#endif // GUARD_BATTLE_FRONTIER_1_H
diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h
index 313a29811..75bc3e003 100644
--- a/include/battle_gfx_sfx_util.h
+++ b/include/battle_gfx_sfx_util.h
@@ -39,8 +39,8 @@ void sub_805EAE8(void);
void sub_805EB9C(u8 affineMode);
void LoadAndCreateEnemyShadowSprites(void);
void SpriteCB_SetInvisible(struct Sprite *sprite);
-void SetBankEnemyShadowSpriteCallback(u8 bank, u16 species);
-void EnemyShadowCallbackToSetInvisible(u8 bank);
+void SetBattlerShadowSpriteCallback(u8 bank, u16 species);
+void HideBattlerShadowSprite(u8 bank);
void sub_805EF14(void);
void ClearTemporarySpeciesSpriteData(u8 bank, bool8 dontClearSubstitute);
void AllocateMonSpritesGfx(void);
diff --git a/include/battle_interface.h b/include/battle_interface.h
index b2d3b1b97..fe8c03f70 100644
--- a/include/battle_interface.h
+++ b/include/battle_interface.h
@@ -54,7 +54,7 @@ enum
HEALTHBOX_SAFARI_BALLS_TEXT
};
-u8 CreateBankHealthboxSprites(u8 bank);
+u8 CreateBattlerHealthboxSprites(u8 bank);
u8 CreateSafariPlayerHealthboxSprites(void);
void SetBattleBarStruct(u8 bank, u8 healthboxSpriteId, s32 maxVal, s32 currVal, s32 receivedValue);
void SetHealthboxSpriteInvisible(u8 healthboxSpriteId);
@@ -62,7 +62,7 @@ void SetHealthboxSpriteVisible(u8 healthboxSpriteId);
void DestoryHealthboxSprite(u8 healthboxSpriteId);
void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly);
void UpdateOamPriorityInAllHealthboxes(u8 priority);
-void SetBankHealthboxSpritePos(u8 bank);
+void InitBattlerHealthboxCoords(u8 bank);
void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent);
void SwapHpBarsWithHpText(void);
u8 CreatePartyStatusSummarySprites(u8 bank, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart);
diff --git a/include/battle_link_817C95C.h b/include/battle_link_817C95C.h
index 815c1f058..cb2cb0b27 100644
--- a/include/battle_link_817C95C.h
+++ b/include/battle_link_817C95C.h
@@ -6,6 +6,6 @@ void sub_817E0FC(u16 move, u16 weatherFlags, struct DisableStruct *disableStruct
void sub_817E32C(u8 animationId);
void sub_817E3F4(void);
void sub_817F2A8(void);
-u8 GetBankMoveSlotId(u8 bank, u16 move);
+u8 GetBattlerMoveSlotId(u8 bank, u16 move);
#endif // GUARD_BATTLE_LINK_817C95C_H
diff --git a/include/battle_2.h b/include/battle_main.h
index ee61efd9b..54b5e7da6 100644
--- a/include/battle_2.h
+++ b/include/battle_main.h
@@ -1,5 +1,5 @@
-#ifndef GUARD_BATTLE_2_H
-#define GUARD_BATTLE_2_H
+#ifndef GUARD_BATTLE_MAIN_H
+#define GUARD_BATTLE_MAIN_H
void CB2_InitBattle(void);
void BattleMainCB2(void);
@@ -52,4 +52,4 @@ extern const u8 gStatusConditionString_LoveJpn[8];
extern const u8 * const gStatusConditionStringsTable[7][2];
-#endif // GUARD_BATTLE_2_H
+#endif // GUARD_BATTLE_MAIN_H
diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h
index 80fabaa64..26659ff20 100644
--- a/include/battle_script_commands.h
+++ b/include/battle_script_commands.h
@@ -52,7 +52,7 @@
void AI_CalcDmg(u8 bankAtk, u8 bankDef);
u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef);
u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility);
-u8 BankGetTurnOrder(u8 bank);
+u8 GetBattlerTurnOrderNum(u8 bank);
void SetMoveEffect(bool8 primary, u8 certain);
void BattleDestroyYesNoCursorAt(u8 cursorPosition);
void BattleCreateYesNoCursorAt(u8 cursorPosition);
diff --git a/include/battle_util.h b/include/battle_util.h
index 81eb85dc7..56628c11d 100644
--- a/include/battle_util.h
+++ b/include/battle_util.h
@@ -48,8 +48,8 @@ u8 GetBattleBank(u8 caseId);
void PressurePPLose(u8 bankDef, u8 bankAtk, u16 move);
void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
void PressurePPLoseOnUsingImprision(u8 bankAtk);
-void MarkAllBufferBanksForExecution(void); // unused
-void MarkBufferBankForExecution(u8 bank);
+void MarkAllBattlersForControllerExec(void); // unused
+void MarkBattlerForControllerExec(u8 bank);
void sub_803F850(u8 arg0);
void CancelMultiTurnMoves(u8 bank);
bool8 WasUnableToUseMove(u8 bank);
diff --git a/include/berry_fix_program.h b/include/berry_fix_program.h
new file mode 100644
index 000000000..6c31a0c8b
--- /dev/null
+++ b/include/berry_fix_program.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_BERRY_FIX_PROGRAM_H
+#define GUARD_BERRY_FIX_PROGRAM_H
+
+void CB2_InitBerryFixProgram(void);
+
+#endif // GUARD_BERRY_FIX_PROGRAM_H
diff --git a/include/berry_tag_screen.h b/include/berry_tag_screen.h
new file mode 100644
index 000000000..26664bea6
--- /dev/null
+++ b/include/berry_tag_screen.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_BERRY_TAG_SCREEN_H
+#define GUARD_BERRY_TAG_SCREEN_H
+
+void DoBerryTagScreen(void);
+
+#endif // GUARD_BERRY_TAG_SCREEN_H
diff --git a/include/blend_palette.h b/include/blend_palette.h
index 1db3f4eb0..a00847bc3 100644
--- a/include/blend_palette.h
+++ b/include/blend_palette.h
@@ -1,12 +1,6 @@
#ifndef GUARD_BLEND_PALETTE_H
#define GUARD_BLEND_PALETTE_H
-// Exported type declarations
+void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor);
-// Exported RAM declarations
-
-// Exported ROM declarations
-
-void BlendPalette(u16, u16, u8, u16);
-
-#endif //GUARD_BLEND_PALETTE_H
+#endif // GUARD_BLEND_PALETTE_H
diff --git a/include/clear_save_data_menu.h b/include/clear_save_data_menu.h
new file mode 100644
index 000000000..86ba99849
--- /dev/null
+++ b/include/clear_save_data_menu.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_CLEAR_SAVE_DATA_MENU_H
+#define GUARD_CLEAR_SAVE_DATA_MENU_H
+
+void CB2_InitClearSaveDataScreen(void);
+
+#endif // GUARD_CLEAR_SAVE_DATA_MENU_H
diff --git a/include/constants/items.h b/include/constants/items.h
index 6135b8d6f..41d63c4a3 100644
--- a/include/constants/items.h
+++ b/include/constants/items.h
@@ -383,6 +383,9 @@
#define ITEM_MAGMA_EMBLEM 375
#define ITEM_OLD_SEA_MAP 376
+#define ITEM_LAST_ID 376
+#define ITEM_FIELD_ARROW ITEM_LAST_ID + 1
+
#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY
#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY
#define ITEM_TO_BERRY(itemId)(((itemId - FIRST_BERRY_INDEX) + 1))
diff --git a/include/constants/rgb.h b/include/constants/rgb.h
new file mode 100644
index 000000000..8b323799f
--- /dev/null
+++ b/include/constants/rgb.h
@@ -0,0 +1,16 @@
+#ifndef GUARD_RGB_H
+#define GUARD_RGB_H
+
+#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
+#define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F))
+
+#define RGB_BLACK RGB(0, 0, 0)
+#define RGB_WHITE RGB(31, 31, 31)
+#define RGB_RED RGB(31, 0, 0)
+#define RGB_GREEN RGB(0, 31, 0)
+#define RGB_BLUE RGB(0, 0, 31)
+#define RGB_YELLOW RGB(31, 31, 0)
+#define RGB_MAGENTA RGB(31, 0, 31)
+#define RGB_CYAN RGB(0, 31, 31)
+
+#endif // GUARD_RGB_H
diff --git a/include/constants/weather.h b/include/constants/weather.h
new file mode 100644
index 000000000..953cc2753
--- /dev/null
+++ b/include/constants/weather.h
@@ -0,0 +1,39 @@
+#ifndef GUARD_CONSTANTS_WEATHER_H
+#define GUARD_CONSTANTS_WEATHER_H
+
+#define WEATHER_NONE 0
+#define WEATHER_CLOUDS 1
+#define WEATHER_SUNNY 2
+#define WEATHER_RAIN_LIGHT 3
+#define WEATHER_SNOW 4
+#define WEATHER_RAIN_MED 5
+#define WEATHER_FOG_1 6
+#define WEATHER_ASH 7
+#define WEATHER_SANDSTORM 8
+#define WEATHER_FOG_2 9
+#define WEATHER_FOG_3 10
+#define WEATHER_SHADE 11
+#define WEATHER_DROUGHT 12
+#define WEATHER_RAIN_HEAVY 13
+#define WEATHER_BUBBLES 14
+#define WEATHER_ROUTE119_CYCLE 20
+#define WEATHER_ROUTE123_CYCLE 21
+
+// These are used in maps' coord_weather_event entries.
+// They are not a one-to-one mapping with the engine's
+// internal weather constants above.
+#define COORD_EVENT_WEATHER_CLOUDS 1
+#define COORD_EVENT_WEATHER_SUNNY 2
+#define COORD_EVENT_WEATHER_RAIN_LIGHT 3
+#define COORD_EVENT_WEATHER_SNOW 4
+#define COORD_EVENT_WEATHER_RAIN_MED 5
+#define COORD_EVENT_WEATHER_FOG_1 6
+#define COORD_EVENT_WEATHER_FOG_2 7
+#define COORD_EVENT_WEATHER_ASH 8
+#define COORD_EVENT_WEATHER_SANDSTORM 9
+#define COORD_EVENT_WEATHER_SHADE 10
+#define COORD_EVENT_WEATHER_DROUGHT 11
+#define COORD_EVENT_WEATHER_ROUTE119_CYCLE 20
+#define COORD_EVENT_WEATHER_ROUTE123_CYCLE 21
+
+#endif // GUARD_CONSTANTS_WEATHER_H
diff --git a/include/coord_event_weather.h b/include/coord_event_weather.h
new file mode 100644
index 000000000..86fb48793
--- /dev/null
+++ b/include/coord_event_weather.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_COORD_EVENT_WEATHER_H
+#define GUARD_COORD_EVENT_WEATHER_H
+
+void DoCoordEventWeather(u8);
+
+#endif // GUARD_COORD_EVENT_WEATHER_H
diff --git a/include/field_map_obj_helpers.h b/include/field_map_obj_helpers.h
index ba797ec98..031c7a8ab 100644
--- a/include/field_map_obj_helpers.h
+++ b/include/field_map_obj_helpers.h
@@ -1,7 +1,31 @@
-#ifndef GUARD_FIELDMAPOBJHELP_H
-#define GUARD_FIELDMAPOBJHELP_H
+#ifndef GUARD_FIELD_MAP_OBJ_HELPERS_H
+#define GUARD_FIELD_MAP_OBJ_HELPERS_H
+// Exported type declarations
+
+// Exported RAM declarations
+extern u8 *gUnknown_020375B8;
+
+// Exported ROM declarations
+void sub_8097AC8(struct Sprite *);
+void npc_sync_anim_pause_bits(struct MapObject *);
+void oamt_npc_ministep_reset(struct Sprite *, u8, u8);
+u8 sub_8097F78(struct MapObject *);
+bool8 obj_npc_ministep(struct Sprite *sprite);
+bool8 sub_80976EC(struct Sprite *sprite);
+void sub_80976DC(struct Sprite *, u8);
+void sub_809783C(struct Sprite *, u8, u8, u8);
+void DoShadowFieldEffect(struct MapObject *);
+u8 sub_809785C(struct Sprite *);
+u8 sub_80978E4(struct Sprite *);
+void obj_anim_image_set_and_seek(struct Sprite *, u8, u8);
+bool8 sub_80979BC(struct Sprite *);
+void sub_8097750(struct Sprite *);
+bool8 sub_8097758(struct Sprite *);
+void sub_8097FA4(struct MapObject *);
+void sub_8098044(u8);
void UnfreezeMapObjects(void);
+void FreezeMapObjectsExceptOne(u8 mapObjectId);
void sub_8097B78(u8, u8);
-#endif
+#endif //GUARD_FIELD_MAP_OBJ_HELPERS_H
diff --git a/include/field_weather.h b/include/field_weather.h
index e12107e70..7ad8d21e7 100644
--- a/include/field_weather.h
+++ b/include/field_weather.h
@@ -1,12 +1,177 @@
#ifndef GUARD_WEATHER_H
#define GUARD_WEATHER_H
-void fade_screen(u8, s8);
+#include "sprite.h"
+// Controls how the weather should be changing the screen palettes.
+enum {
+ WEATHER_PAL_STATE_CHANGING_WEATHER,
+ WEATHER_PAL_STATE_SCREEN_FADING_IN,
+ WEATHER_PAL_STATE_SCREEN_FADING_OUT,
+ WEATHER_PAL_STATE_IDLE,
+};
+
+struct Weather
+{
+ union
+ {
+ struct
+ {
+ struct Sprite *rainSprites[24];
+ struct Sprite *snowflakeSprites[101];
+ struct Sprite *cloudSprites[3];
+ } s1;
+ struct
+ {
+ u8 filler0[0xA0];
+ struct Sprite *fog1Sprites[20];
+ struct Sprite *ashSprites[20];
+ struct Sprite *fog2Sprites[20];
+ struct Sprite *sandstormSprites1[20];
+ struct Sprite *sandstormSprites2[5];
+ } s2;
+ } sprites;
+ u8 gammaShifts[19][32];
+ u8 altGammaShifts[19][32];
+ s8 gammaIndex;
+ s8 gammaTargetIndex;
+ u8 gammaStepDelay;
+ u8 gammaStepFrameCounter;
+ u16 fadeDestColor;
+ u8 palProcessingState;
+ u8 fadeScreenCounter;
+ bool8 readyForInit;
+ u8 taskId;
+ u8 unknown_6CA;
+ u8 unknown_6CB;
+ u16 initStep;
+ u16 finishStep;
+ u8 currWeather;
+ u8 nextWeather;
+ u8 weatherGfxLoaded;
+ bool8 weatherChangeComplete;
+ u8 weatherPicSpritePalIndex;
+ u8 altGammaSpritePalIndex;
+ u16 unknown_6D6;
+ u8 unknown_6D8;
+ u8 unknown_6D9;
+ u8 rainSpriteCount;
+ u8 unknown_6DB;
+ u8 unknown_6DC;
+ u8 rainStrength;
+ /*0x6DE*/ u8 cloudSpritesCreated;
+ u8 filler_6DF[1];
+ u16 unknown_6E0;
+ u16 unknown_6E2;
+ u8 snowflakeSpriteCount;
+ u8 unknown_6E5;
+ u16 unknown_6E6;
+ u16 thunderCounter;
+ u8 unknown_6EA;
+ u8 unknown_6EB;
+ u8 unknown_6EC;
+ u8 unknown_6ED;
+ u16 fog1ScrollPosX;
+ u16 unknown_6F0;
+ u16 unknown_6F2;
+ u8 lightenedFogSpritePals[6];
+ u8 lightenedFogSpritePalsCount;
+ u8 fog1SpritesCreated;
+ u16 unknown_6FC;
+ u16 unknown_6FE;
+ u8 ashSpritesCreated;
+ u8 filler_701[3];
+ u32 unknown_704;
+ u32 unknown_708;
+ u8 filler_70C[2];
+ u16 unknown_70E;
+ u16 unknown_710;
+ u16 unknown_712;
+ u16 unknown_714;
+ u8 sandstormSprites1Created;
+ u8 sandstormSprites2Created;
+ u16 unknown_718;
+ u16 unknown_71A;
+ u16 unknown_71C;
+ u16 unknown_71E;
+ u16 unknown_720;
+ u16 unknown_722;
+ u8 fog2SpritesCreated;
+ u8 filler_725[1];
+ u16 unknown_726;
+ u16 unknown_728;
+ u16 unknown_72A;
+ u16 unknown_72C;
+ u8 unknown_72E;
+ u8 filler_72F;
+ u16 currBlendEVA;
+ u16 currBlendEVB;
+ u16 targetBlendEVA;
+ u16 targetBlendEVB;
+ u8 blendUpdateCounter;
+ u8 blendFrameCounter;
+ u8 blendDelay;
+ u8 filler_73B[0x3C-0x3B];
+ s16 unknown_73C;
+ s16 unknown_73E;
+ s16 unknown_740;
+ s16 unknown_742;
+ u8 filler_744[0xD-4];
+ s8 loadDroughtPalsIndex;
+ u8 loadDroughtPalsOffset;
+};
+
+void StartWeather(void);
+void ChangeWeather(u8 weather);
+void sub_807C988(u8 effect);
+void sub_807C9B4(u8 effect);
+void Task_WeatherInit(u8);
+void Task_WeatherMain(u8);
+void sub_807CAE8(void);
+void nullsub_38(void);
+void SetWeatherScreenFadeOut(void);
+
+enum
+{
+ FADE_FROM_BLACK,
+ FADE_TO_BLACK,
+ FADE_FROM_WHITE,
+ FADE_TO_WHITE,
+};
+
+void FadeScreen(u8, s8);
+// ...
+void UpdateSpritePaletteWithWeather(u8 tag);
+void ApplyWeatherGammaShiftToPal(u8);
+// ...
+void Weather_SetBlendCoeffs(u8, u8);
+// ...
+void PlayRainSoundEffect(void);
+// ...
void SetSav1Weather(u32);
u8 GetSav1Weather(void);
void sub_80AEDBC(void);
+void SetSav1WeatherFromCurrMapHeader(void);
+// ...
void DoCurrentWeather(void);
+void sub_8080750();
+
+bool8 IsWeatherNotFadingIn(void);
+bool8 IsWeatherChangeComplete(void);
+void SetWeather(u32);
+void UpdateWeatherPerDay(u16);
+void PreservePaletteInWeather(u8 index);
+void ResetPreservedPalettesInWeather(void);
+extern void ResetDroughtWeatherPaletteLoading(void);
+void ResetDroughtWeatherPaletteLoading(void);
+bool8 LoadDroughtWeatherPalettes(void);
+u8 GetCurrentWeather(void);
+void LoadCustomWeatherSpritePalette(const u16 *palette);
+
+
+extern struct Weather gWeather;
+
+extern struct Weather *const gWeatherPtr;
#endif // GUARD_WEATHER_H
diff --git a/include/gba/defines.h b/include/gba/defines.h
index 6925864a2..1eed6303d 100644
--- a/include/gba/defines.h
+++ b/include/gba/defines.h
@@ -63,11 +63,6 @@
#define TOTAL_OBJ_TILE_COUNT 1024
-#define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10))
-
-#define RGB_BLACK RGB(0, 0, 0)
-#define RGB_WHITE RGB(31, 31, 31)
-
#define WIN_RANGE(a, b) (((a) << 8) | (b))
#endif // GUARD_GBA_DEFINES
diff --git a/include/global.h b/include/global.h
index 21e468515..0e5615eb0 100644
--- a/include/global.h
+++ b/include/global.h
@@ -34,9 +34,14 @@
// Converts a number to Q4.12 fixed-point format
#define Q_4_12(n) ((s16)((n) * 4096))
+#define PARTY_SIZE 6
+
#define POKEMON_NAME_LENGTH 10
#define OT_NAME_LENGTH 7
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#define max(a, b) ((a) >= (b) ? (a) : (b))
+
#define HEAP_SIZE 0x1C000
extern u8 gStringVar1[];
@@ -292,6 +297,16 @@ struct SaveBlock2
extern struct SaveBlock2 *gSaveBlock2Ptr;
+struct SecretBaseParty
+{
+ u32 personality[PARTY_SIZE];
+ u16 moves[PARTY_SIZE * 4];
+ u16 species[PARTY_SIZE];
+ u16 heldItems[PARTY_SIZE];
+ u8 levels[PARTY_SIZE];
+ u8 EVs[PARTY_SIZE];
+};
+
struct SecretBaseRecord
{
/*0x1A9C*/ u8 secretBaseId;
@@ -307,12 +322,7 @@ struct SecretBaseRecord
/*0x1AAD*/ u8 sbr_field_11;
/*0x1AAE*/ u8 decorations[16];
/*0x1ABE*/ u8 decorationPos[16];
- /*0x1AD0*/ u32 partyPersonality[6];
- /*0x1AE8*/ u16 partyMoves[6 * 4];
- /*0x1B18*/ u16 partySpecies[6];
- /*0x1B24*/ u16 partyHeldItems[6];
- /*0x1B2E*/ u8 partyLevels[6];
- /*0x1B34*/ u8 partyEVs[6];
+ /*0x1AD0*/ struct SecretBaseParty party;
};
#include "constants/game_stat.h"
diff --git a/include/graphics.h b/include/graphics.h
index bebf1724b..39662c8c1 100644
--- a/include/graphics.h
+++ b/include/graphics.h
@@ -2654,6 +2654,12 @@ extern const u8 gBattleTerrainPalette_StadiumWallace[];
extern const u8 gPokedexMenu2_Gfx[];
extern const u8 gPokedexText_Pal[];
+// berry tag screen
+extern const u8 gUnknown_08D9BB44[];
+extern const u8 gUnknown_08D9BF98[];
+extern const u8 gUnknown_08D9C13C[];
+extern const u8 gUnknown_08D9BEF0[];
+
// rayquaza scene gfx
extern const u8 gRaySceneGroudon_Gfx[];
extern const u8 gRaySceneGroudon2_Gfx[];
@@ -2673,11 +2679,39 @@ extern const u8 gRaySceneGroudonTail_Gfx[];
extern const u8 gRaySceneKyogreRight_Gfx[];
extern const u8 gRaySceneRayquazaHover_Gfx[];
extern const u8 gRaySceneRayquazaFlyIn_Gfx[];
+extern const u8 gRaySceneOvercast_Gfx[];
+extern const u8 gRaySceneOvercast_Tilemap[];
+extern const u8 gRaySceneRayquaza_Gfx[];
+extern const u8 gRaySceneRayquaza_Tilemap[];
extern const u8 gRaySceneSplash_Gfx[];
extern const u8 gRaySceneGroudonLeft_Pal[];
extern const u8 gRaySceneKyogreRight_Pal[];
extern const u8 gRaySceneRayquazaHover_Pal[];
extern const u8 gRaySceneSplash_Pal[];
+extern const u8 gRaySceneClouds_Gfx[];
+extern const u8 gRaySceneClouds_Pal[];
+extern const u8 gRaySceneClouds2_Tilemap[];
+extern const u8 gRaySceneClouds1_Tilemap[];
+extern const u8 gRaySceneClouds3_Tilemap[];
+extern const u8 gRaySceneRayquazaLight_Gfx[];
+extern const u8 gRaySceneRayquazaLight_Tilemap[];
+extern const u8 gRaySceneOvercast2_Gfx[];
+extern const u8 gRaySceneOvercast2_Tilemap[];
+extern const u8 gRaySceneOvercast2_Pal[];
+extern const u8 gRaySceneRayquazaChase_Gfx[];
+extern const u8 gRaySceneChaseStreaks_Gfx[];
+extern const u8 gRaySceneChaseBg_Gfx[];
+extern const u8 gRayChaseRayquazaChase2_Tilemap[];
+extern const u8 gRayChaseRayquazaChase_Tilemap[];
+extern const u8 gRaySceneChaseStreaks_Tilemap[];
+extern const u8 gRaySceneChaseBg_Tilemap[];
+extern const u8 gRaySceneChase_Pal[];
+extern const u8 gRaySceneHushRing_Tilemap[];
+extern const u8 gRaySceneHushBg_Tilemap[];
+extern const u8 gRaySceneHushRing_Map[];
+extern const u8 gRaySceneHushBg_Pal[];
+extern const u8 gRaySceneHushBg_Gfx[];
+extern const u8 gRaySceneHushRing_Gfx[];
//menu graphics
extern const u16 gFireRedMenuElements1_Pal[16];
diff --git a/include/intro.h b/include/intro.h
new file mode 100644
index 000000000..53a446418
--- /dev/null
+++ b/include/intro.h
@@ -0,0 +1,8 @@
+#ifndef GUARD_INTRO_H
+#define GUARD_INTRO_H
+
+void CB2_InitCopyrightScreenAfterBootup(void);
+void CB2_InitCopyrightScreenAfterTitleScreen(void);
+void sub_816F2A8(u16, u16, u16, u16);
+
+#endif // GUARD_INTRO_H
diff --git a/include/item.h b/include/item.h
index a136f03ec..06eb08046 100644
--- a/include/item.h
+++ b/include/item.h
@@ -60,5 +60,6 @@ u8 ItemId_GetBattleUsage(u16 itemId);
ItemUseFunc ItemId_GetBattleFunc(u16 itemId);
u8 ItemId_GetSecondaryId(u16 itemId);
u16 itemid_get_market_price(u16 itemId);
+u16 BagGetItemIdByPocketPosition(u8 pocketId, u16 pocketPos);
#endif // ITEM_H
diff --git a/include/item_icon.h b/include/item_icon.h
index a43b72f39..b702b2045 100644
--- a/include/item_icon.h
+++ b/include/item_icon.h
@@ -1,17 +1,16 @@
-//
-// Created by scott on 10/20/2017.
-//
-
#ifndef GUARD_ITEM_ICON_H
#define GUARD_ITEM_ICON_H
-extern EWRAM_DATA void *gUnknown_0203CEBC;
-extern EWRAM_DATA void *gUnknown_0203CEC0;
+extern void *gItemIconDecompressionBuffer;
+extern void *gItemIcon4x4Buffer;
-extern const struct SpriteTemplate gUnknown_08614FF4;
+extern const struct SpriteTemplate gItemIconSpriteTemplate;
bool8 AllocItemIconTemporaryBuffers(void);
-void CopyItemIconPicTo4x4Buffer(void *src, void *dest);
void FreeItemIconTemporaryBuffers(void);
+void CopyItemIconPicTo4x4Buffer(const void *src, void *dest);
+u8 AddItemIconSprite(u16 tilesTag, u16 paletteTag, u16 itemId);
+u8 AddCustomItemIconSprite(struct SpriteTemplate *customSpriteTemplate, u16 tilesTag, u16 paletteTag, u16 itemId);
+const void *GetItemIconPicOrPalette(u16 itemId, u8 which);
#endif //GUARD_ITEM_ICON_H
diff --git a/include/item_menu.h b/include/item_menu.h
index 85655e9d5..0ddd6766b 100644
--- a/include/item_menu.h
+++ b/include/item_menu.h
@@ -2,11 +2,24 @@
#define GUARD_item_menu_H
// Exported type declarations
+struct BagStruct
+{
+ void *func;
+ u8 unk4;
+ u8 pocket;
+ u8 unk6[2];
+ u16 unk8[5];
+ u16 unk12[5];
+ void *unk1C;
+};
+
+extern struct BagStruct gUnknown_0203CE58;
// Exported RAM declarations
// Exported ROM declarations
void sub_81AAC50(void);
void sub_81AAC70(void);
+void bag_menu_mail_related(void);
#endif //GUARD_item_menu_H
diff --git a/include/item_menu_icons.h b/include/item_menu_icons.h
index 553e7c262..c3932390c 100644
--- a/include/item_menu_icons.h
+++ b/include/item_menu_icons.h
@@ -1,6 +1,12 @@
#ifndef GUARD_ITEM_MENU_ICONS
#define GUARD_ITEM_MENU_ICONS
+extern const struct CompressedSpriteSheet gUnknown_0857FDEC;
+extern const struct CompressedSpritePalette gUnknown_0857FDF4;
+
u8 sub_80D511C(u8 a0, u8 a1, u8 a2, u8 a3);
+u8 CreateBerryTagSprite(u8 id, s16 x, s16 y);
+void FreeBerryTagSpritePalette(void);
+u8 CreateBerryFlavorCircleSprite(s16 x);
#endif // GUARD_ITEM_MENU_ICONS
diff --git a/include/item_use.h b/include/item_use.h
new file mode 100644
index 000000000..ee7939824
--- /dev/null
+++ b/include/item_use.h
@@ -0,0 +1,54 @@
+#ifndef GUARD_ITEM_USE_H
+#define GUARD_ITEM_USE_H
+
+extern u16 gSpecialVar_ItemId;
+
+void ItemUseOutOfBattle_Mail(u8);
+void ItemUseOutOfBattle_Bike(u8);
+void ItemUseOnFieldCB_Bike(u8);
+void ItemUseOutOfBattle_Rod(u8);
+void ItemUseOnFieldCB_Rod(u8);
+void ItemUseOutOfBattle_Itemfinder(u8);
+void ItemUseOnFieldCB_Itemfinder(u8);
+void RunItemfinderResults(u8);
+void ExitItemfinder(u8);
+bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8);
+void sub_80C9720(u8);
+void sub_80C9838(u8, s16, s16);
+u8 GetPlayerDirectionTowardsHiddenItem(s16, s16);
+void SetPlayerDirectionTowardsItem(u8);
+void DisplayItemRespondingMessageAndExitItemfinder(u8);
+void RotatePlayerAndExitItemfinder(u8);
+void ItemUseOutOfBattle_PokeblockCase(u8);
+void ItemUseOutOfBattle_CoinCase(u8);
+void ItemUseOutOfBattle_SSTicket(u8);
+void sub_80C9D00(u8);
+void ItemUseOutOfBattle_WailmerPail(u8);
+void sub_80C9D74(u8);
+void ItemUseOutOfBattle_Medicine(u8);
+void ItemUseOutOfBattle_SacredAsh(u8);
+void ItemUseOutOfBattle_PPRecovery(u8);
+void ItemUseOutOfBattle_PPUp(u8);
+void ItemUseOutOfBattle_RareCandy(u8);
+void ItemUseOutOfBattle_TMHM(u8);
+void sub_80C9EE4(u8);
+void sub_80C9F10(u8);
+void sub_80C9F80(u8);
+void sub_80C9FC0(u8);
+void ItemUseOutOfBattle_Repel(u8);
+void ItemUseOutOfBattle_BlackWhiteFlute(u8);
+void task08_080A1C44(u8);
+u8 CanUseEscapeRopeOnCurrMap(void);
+void ItemUseOutOfBattle_EscapeRope(u8);
+void ItemUseOutOfBattle_EvolutionStone(u8);
+void ItemUseInBattle_PokeBall(u8);
+void ItemUseInBattle_StatIncrease(u8);
+void ItemUseInBattle_Medicine(u8);
+void ItemUseInBattle_PPRecovery(u8);
+void ItemUseInBattle_Escape(u8);
+void ItemUseOutOfBattle_EnigmaBerry(u8);
+void ItemUseInBattle_EnigmaBerry(u8);
+void ItemUseOutOfBattle_CannotUse(u8);
+u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId);
+
+#endif // GUARD_ITEM_USE_H
diff --git a/include/link.h b/include/link.h
index fe5429497..1c9795d29 100644
--- a/include/link.h
+++ b/include/link.h
@@ -143,8 +143,9 @@ extern struct LinkPlayer gLinkPlayers[];
extern u16 word_3002910[];
extern bool8 gReceivedRemoteLinkPlayers;
extern bool8 gLinkVSyncDisabled;
+extern u32 gLinkStatus;
-void Task_DestroySelf(u8);
+void Task_DestroySelf(u8 taskId);
void OpenLink(void);
void CloseLink(void);
u16 LinkMain2(u16 *);
@@ -188,11 +189,10 @@ bool8 sub_8010500(void);
void sub_800DFB4(u8, u8);
void sub_800ADF8(void);
void sub_800B488(void);
-void sub_8009734(void);
+void OpenLink(void);
void sub_800A620(void);
void sub_8011BD0(void);
-u8 sub_800ABAC(void);
-u8 sub_800ABBC(void);
void sub_800AC34(void);
+u8 sub_800A0C8(s32, s32);
#endif // GUARD_LINK_H
diff --git a/include/main_menu.h b/include/main_menu.h
new file mode 100644
index 000000000..08cd913dc
--- /dev/null
+++ b/include/main_menu.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_MAIN_MENU_H
+#define GUARD_MAIN_MENU_H
+
+void CB2_InitMainMenu(void);
+
+#endif // GUARD_MAIN_MENU_H
diff --git a/include/map_obj_8097404.h b/include/map_obj_8097404.h
deleted file mode 100644
index 0800b15b0..000000000
--- a/include/map_obj_8097404.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Created by scott on 9/7/2017.
-//
-
-#ifndef GUARD_MAP_OBJ_8097404_H
-#define GUARD_MAP_OBJ_8097404_H
-
-// Exported type declarations
-
-// Exported RAM declarations
-extern void *gUnknown_020375B8;
-
-// Exported ROM declarations
-void sub_8097AC8(struct Sprite *);
-void npc_sync_anim_pause_bits(struct MapObject *);
-void oamt_npc_ministep_reset(struct Sprite *, u8, u8);
-u8 sub_8097F78(struct MapObject *);
-bool8 obj_npc_ministep(struct Sprite *sprite);
-bool8 sub_80976EC(struct Sprite *sprite);
-void sub_80976DC(struct Sprite *, u8);
-void sub_809783C(struct Sprite *, u8, u8, u8);
-void DoShadowFieldEffect(struct MapObject *);
-u8 sub_809785C(struct Sprite *);
-u8 sub_80978E4(struct Sprite *);
-void obj_anim_image_set_and_seek(struct Sprite *, u8, u8);
-bool8 sub_80979BC(struct Sprite *);
-void sub_8097750(struct Sprite *);
-bool8 sub_8097758(struct Sprite *);
-void sub_8097FA4(struct MapObject *);
-void sub_8098044(u8);
-void UnfreezeMapObjects(void);
-void sub_80974D0(u8 mapObjectId);
-
-#endif //GUARD_MAP_OBJ_8097404_H
diff --git a/include/menu.h b/include/menu.h
index 98b323e42..2046f7d2b 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -19,6 +19,7 @@ struct MenuAction
void sub_81971D0(void);
void sub_8197200(void);
+u16 sub_8197224(void);
void sub_81973A4(void);
void NewMenuHelpers_DrawDialogueFrame(u8, u8);
void sub_819746C(u8 windowId, bool8 copyToVram);
@@ -57,5 +58,6 @@ void sub_8197DF8(u8 windowId, bool8 copyToVram);
u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16);
void *malloc_and_decompress(const void *src, int *sizeOut);
u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode);
+void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress);
#endif // GUARD_MENU_H
diff --git a/include/menu_helpers.h b/include/menu_helpers.h
index 7fae43e9c..048a4aa43 100644
--- a/include/menu_helpers.h
+++ b/include/menu_helpers.h
@@ -19,6 +19,7 @@ void sub_812225C(u16 *, u16 *, u8, u8);
void sub_8122298(u16 *, u16 *, u8, u8, u8);
void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data);
bool8 sub_81221AC(void);
+bool8 sub_81221EC(void);
void ResetVramOamAndBgCntRegs(void);
void SetVBlankHBlankCallbacksToNull(void);
void ResetAllBgsCoordinates(void);
diff --git a/include/mystery_event_menu.h b/include/mystery_event_menu.h
new file mode 100644
index 000000000..8801789d9
--- /dev/null
+++ b/include/mystery_event_menu.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_MYSTERY_EVENT_MENU_H
+#define GUARD_MYSTERY_EVENT_MENU_H
+
+void CB2_InitMysteryEventMenu(void);
+
+#endif // GUARD_MYSTERY_EVENT_MENU_H
diff --git a/include/overworld.h b/include/overworld.h
index 597a160ed..974f8f091 100644
--- a/include/overworld.h
+++ b/include/overworld.h
@@ -70,6 +70,8 @@ void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpNum);
void c2_load_new_map(void);
void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused);
void mapldr_default(void);
+u8 get_map_light_from_warp0(void);
+bool8 is_light_level_1_2_3_5_or_6(u8 a1);
void IncrementGameStat(u8);
u32 GetGameStat(u8);
diff --git a/include/palette.h b/include/palette.h
index cb03699a6..41cef4048 100644
--- a/include/palette.h
+++ b/include/palette.h
@@ -67,5 +67,6 @@ void BeginFastPaletteFade(u8);
void BeginHardwarePaletteFade(u8, u8, u8, u8, u8);
void BlendPalettes(u32, u8, u16);
void BlendPalettesUnfaded(u32, u8, u16);
+void sub_80A2C44(u32 a1, s8 a2, u8 a3, u8 a4, u16 a5, u8 a6, u8 a7);
#endif // GUARD_PALETTE_H
diff --git a/include/pokemon.h b/include/pokemon.h
index cdab96687..f5d1683a2 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -128,7 +128,6 @@
#define NUMBER_OF_MON_TYPES 0x12
-#define PARTY_SIZE 6
#define MAX_TOTAL_EVS 510
#define NUM_STATS 6
#define UNOWN_FORM_COUNT 28
@@ -631,7 +630,7 @@ bool8 IsShinyOtIdPersonality(u32 otId, u32 personality);
void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies);
bool8 IsTradedMon(struct Pokemon *mon);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
-s32 GetBankMultiplayerId(u16 a1);
+s32 GetBattlerMultiplayerId(u16 a1);
bool16 sub_806D82C(u8 id);
u16 MonTryLearningNewMove(struct Pokemon* mon, bool8);
void sub_8068AA4(void); // sets stats for deoxys
diff --git a/include/pokemon_animation.h b/include/pokemon_animation.h
index 42fc10809..c1ab8d817 100644
--- a/include/pokemon_animation.h
+++ b/include/pokemon_animation.h
@@ -1,7 +1,10 @@
#ifndef GUARD_POKEMON_ANIMATION_H
#define GUARD_POKEMON_ANIMATION_H
-void LaunchAnimationTaskForFrontSprite(struct Sprite* sprite, u8 frontAnimId);
-void LaunchAnimationTaskForBackSprite(struct Sprite* sprite, u8 backAnimId);
+u8 GetSpeciesBackAnimSet(u16 species);
+void LaunchAnimationTaskForFrontSprite(struct Sprite *sprite, u8 frontAnimId);
+void StartMonSummaryAnimation(struct Sprite *sprite, u8 frontAnimId);
+void LaunchAnimationTaskForBackSprite(struct Sprite *sprite, u8 backAnimSet);
+void SetSpriteCB_MonAnimDummy(struct Sprite *sprite);
#endif // GUARD_POKEMON_ANIMATION_H
diff --git a/include/rayquaza_scene.h b/include/rayquaza_scene.h
new file mode 100644
index 000000000..fe66b3df0
--- /dev/null
+++ b/include/rayquaza_scene.h
@@ -0,0 +1,17 @@
+#ifndef GUARD_RAYQUAZA_SCENE_H
+#define GUARD_RAYQUAZA_SCENE_H
+
+void DoRayquazaScene(u8 animId, bool8 onlyOneAnim, void (*callback)(void));
+
+enum
+{
+ RAY_ANIM_DUO_FIGHT_PRE,
+ RAY_ANIM_DUO_FIGHT,
+ RAY_ANIM_TAKES_FLIGHT,
+ RAY_ANIM_DESCENDS,
+ RAY_ANIM_CHARGES,
+ RAY_ANIM_CHACES_AWAY,
+ RAY_ANIM_END
+};
+
+#endif // GUARD_RAYQUAZA_SCENE_H
diff --git a/include/recorded_battle.h b/include/recorded_battle.h
index adc4c6c85..296245a24 100644
--- a/include/recorded_battle.h
+++ b/include/recorded_battle.h
@@ -7,9 +7,9 @@ extern u8 gUnknown_0203C7B4;
void sub_8184DA4(u8 arg0);
void sub_8184E58(void);
-void RecordedBattle_SetBankAction(u8 bank, u8 action);
-void RecordedBattle_ClearBankAction(u8 bank, u8 bytesToClear);
-u8 RecordedBattle_ReadBankAction(u8 bank);
+void RecordedBattle_SetBattlerAction(u8 bank, u8 action);
+void RecordedBattle_ClearBattlerAction(u8 bank, u8 bytesToClear);
+u8 RecordedBattle_GetBattlerAction(u8 bank);
u8 sub_81850D0(void);
u8 sub_81850DC(u8 *arg0);
void sub_81851A8(u8 *arg0);
diff --git a/include/reset_rtc_screen.h b/include/reset_rtc_screen.h
new file mode 100644
index 000000000..5807dec99
--- /dev/null
+++ b/include/reset_rtc_screen.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_RESET_RTC_SCREEN_H
+#define GUARD_RESET_RTC_SCREEN_H
+
+void CB2_InitResetRtcScreen(void);
+
+#endif // GUARD_RESET_RTC_SCREEN_H
diff --git a/include/scanline_effect.h b/include/scanline_effect.h
new file mode 100644
index 000000000..eb837e7e2
--- /dev/null
+++ b/include/scanline_effect.h
@@ -0,0 +1,47 @@
+#ifndef GUARD_SCANLINE_EFFECT_H
+#define GUARD_SCANLINE_EFFECT_H
+
+// DMA control value to transfer a single 16-bit value at HBlank
+#define SCANLINE_EFFECT_DMACNT_16BIT (((DMA_ENABLE | DMA_START_HBLANK | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_INC | DMA_16BIT | DMA_DEST_RELOAD) << 16) | 1)
+
+#define SCANLINE_EFFECT_REG_BG0HOFS (REG_ADDR_BG0HOFS - REG_ADDR_BG0HOFS)
+#define SCANLINE_EFFECT_REG_BG0VOFS (REG_ADDR_BG0VOFS - REG_ADDR_BG0HOFS)
+#define SCANLINE_EFFECT_REG_BG1HOFS (REG_ADDR_BG1HOFS - REG_ADDR_BG0HOFS)
+#define SCANLINE_EFFECT_REG_BG1VOFS (REG_ADDR_BG1VOFS - REG_ADDR_BG0HOFS)
+#define SCANLINE_EFFECT_REG_BG2HOFS (REG_ADDR_BG2HOFS - REG_ADDR_BG0HOFS)
+#define SCANLINE_EFFECT_REG_BG2VOFS (REG_ADDR_BG2VOFS - REG_ADDR_BG0HOFS)
+#define SCANLINE_EFFECT_REG_BG3HOFS (REG_ADDR_BG3HOFS - REG_ADDR_BG0HOFS)
+#define SCANLINE_EFFECT_REG_BG3VOFS (REG_ADDR_BG3VOFS - REG_ADDR_BG0HOFS)
+
+struct ScanlineEffectParams
+{
+ volatile void *dmaDest;
+ u32 dmaControl;
+ u8 initState;
+ u8 unused9;
+};
+
+struct ScanlineEffect
+{
+ void *dmaSrcBuffers[2];
+ volatile void *dmaDest;
+ u32 dmaControl;
+ void (*setFirstScanlineReg)(void);
+ u8 srcBuffer;
+ u8 state;
+ u8 unused16;
+ u8 unused17;
+ u8 waveTaskId;
+};
+
+extern struct ScanlineEffect gScanlineEffect;
+
+extern u16 gScanlineEffectRegBuffers[2][0x3C0];
+
+void ScanlineEffect_Stop(void);
+void ScanlineEffect_Clear(void);
+void ScanlineEffect_SetParams(struct ScanlineEffectParams);
+void ScanlineEffect_InitHBlankDmaTransfer(void);
+u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 a7);
+
+#endif // GUARD_SCANLINE_EFFECT_H
diff --git a/include/sprite.h b/include/sprite.h
index d5c6bc402..b5a1b6ae5 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -233,6 +233,7 @@ extern s16 gSpriteCoordOffsetX;
extern s16 gSpriteCoordOffsetY;
extern struct Sprite gSprites[];
+extern struct OamMatrix gOamMatrices[];
void ResetSpriteData(void);
void AnimateSprites(void);
diff --git a/include/strings.h b/include/strings.h
index 3bd69bb12..6d569e57a 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -152,6 +152,19 @@ extern const u8 gText_EggNickname[];
extern const u8 gText_Pokemon[];
extern const u8 gText_InGameClockUsable[];
+// reset rtc screen texts
+extern const u8 gText_Day[];
+extern const u8 gText_Colon3[];
+extern const u8 gText_Confirm2[];
+extern const u8 gText_PresentTime[];
+extern const u8 gText_PreviousTime[];
+extern const u8 gText_ResetRTCConfirmCancel[];
+extern const u8 gText_NoSaveFileCantSetTime[];
+extern const u8 gText_PleaseResetTime[];
+extern const u8 gText_ClockHasBeenReset[];
+extern const u8 gText_SaveCompleted[];
+extern const u8 gText_SaveFailed[];
+
// menu texts
extern const u8 gText_MenuPokedex[];
extern const u8 gText_MenuPokemon[];
@@ -205,4 +218,25 @@ extern const u8 gText_FemaleSymbol[];
extern const u8 gText_SelectorArrow3[];
extern const u8 gText_YesNo[];
+// mystery event menu text
+extern const u8 gText_EventSafelyLoaded[];
+extern const u8 gText_LoadErrorEndingSession[];
+extern const u8 gText_PressAToLoadEvent[];
+extern const u8 gText_LoadingEvent[];
+extern const u8 gText_DontRemoveCableTurnOff[];
+extern const u8 gText_LinkStandby2[];
+
+// berry tag screen text
+extern const u8 gBerryFirmnessString_VerySoft[];
+extern const u8 gBerryFirmnessString_Soft[];
+extern const u8 gBerryFirmnessString_Hard[];
+extern const u8 gBerryFirmnessString_VeryHard[];
+extern const u8 gBerryFirmnessString_SuperHard[];
+extern const u8 gText_BerryTag[];
+extern const u8 gText_UnkF908Var1Var2[];
+extern const u8 gText_SizeSlash[];
+extern const u8 gText_Var1DotVar2[];
+extern const u8 gText_ThreeMarks[];
+extern const u8 gText_FirmSlash[];
+
#endif //GUARD_STRINGS_H
diff --git a/include/time_events.h b/include/time_events.h
new file mode 100644
index 000000000..fd6d29f39
--- /dev/null
+++ b/include/time_events.h
@@ -0,0 +1,8 @@
+#ifndef GUARD_TIME_EVENTS_H
+#define GUARD_TIME_EVENTS_H
+
+void UpdateMirageRnd(u16);
+u8 IsMirageIslandPresent(void);
+void UpdateBirchState(u16);
+
+#endif // GUARD_TIME_EVENTS_H
diff --git a/include/title_screen.h b/include/title_screen.h
new file mode 100644
index 000000000..b660792fc
--- /dev/null
+++ b/include/title_screen.h
@@ -0,0 +1,8 @@
+#ifndef GUARD_TITLE_SCREEN_H
+#define GUARD_TITLE_SCREEN_H
+
+extern const u16 gUnknown_0853FF70[];
+
+void CB2_InitTitleScreen(void);
+
+#endif // GUARD_TITLE_SCREEN_H
diff --git a/include/unknown_task.h b/include/unknown_task.h
deleted file mode 100644
index 906fed3e0..000000000
--- a/include/unknown_task.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef GUARD_unknown_task_H
-#define GUARD_unknown_task_H
-
-// Exported type declarations
-struct UnknownTaskStruct
-{
- volatile void *dest;
- u32 control;
- u8 unk8;
- u8 unk9;
-};
-
-extern struct UnknownTaskStruct gUnknown_0831AC70;
-
-// Exported RAM declarations
-
-// Exported ROM declarations
-void ScanlineEffect_Stop(void);
-void sub_80BA038(struct UnknownTaskStruct arg0);
-void sub_80BA0A8(void);
-
-#endif // GUARD_unknown_task_H