summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-01-21 19:49:52 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-01-21 19:49:52 -0500
commit79b322918594737d7dc8405e2ad823335693b9ae (patch)
tree4826b774febbed88a50d22116fd896c34447997e /include
parent5ffd006acfe8ad12e88fa53a93a55b6f59e77779 (diff)
parent68a402883f780a61f54c2f0c8740429d0b2b3a81 (diff)
Merge branch 'master' into pokemon_storage_system
Diffstat (limited to 'include')
-rw-r--r--include/battle.h148
-rw-r--r--include/battle_script_commands.h65
-rw-r--r--include/battle_string_ids.h387
-rw-r--r--include/battle_util.h4
-rw-r--r--include/constants/items.h15
-rw-r--r--include/constants/songs.h708
-rw-r--r--include/constants/weather.h4
-rw-r--r--[-rwxr-xr-x]include/contest_ai.h0
-rw-r--r--include/decoration.h1
-rw-r--r--include/easy_chat.h2
-rw-r--r--[-rwxr-xr-x]include/ewram.h4
-rw-r--r--include/field_effect.h1
-rw-r--r--include/field_weather.h99
-rw-r--r--[-rwxr-xr-x]include/gba/isagbprint.h0
-rw-r--r--include/gba/macro.h53
-rw-r--r--include/global.fieldmap.h3
-rw-r--r--include/item_menu.h2
-rw-r--r--include/matsuda_debug_menu.h1
-rw-r--r--include/menu_helpers.h27
-rw-r--r--include/money.h2
-rw-r--r--include/pokedex.h2
-rw-r--r--include/pokemon.h6
-rw-r--r--include/pokemon_item_effect.h2
-rw-r--r--[-rwxr-xr-x]include/region_map_sections.h0
-rw-r--r--include/shop.h27
25 files changed, 1107 insertions, 456 deletions
diff --git a/include/battle.h b/include/battle.h
index 27ed57045..d3cbd24f5 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -4,6 +4,30 @@
#include "sprite.h"
#include "constants/battle_constants.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))
+
enum
{
BATTLE_TERRAIN_GRASS,
@@ -49,16 +73,16 @@ struct AI_Stack
struct AI_ThinkingStruct /* 0x2016800 */
{
-/* 0x00 */ u8 aiState;
-/* 0x01 */ u8 movesetIndex;
-/* 0x02 */ u16 moveConsidered;
-/* 0x04 */ s8 score[4]; // score?
-/* 0x08 */ u32 funcResult;
-/* 0x0C */ u32 aiFlags;
-/* 0x10 */ u8 aiAction;
-/* 0x11 */ u8 aiLogicId;
-/* 0x12 */ u8 filler12[6];
-/* 0x18 */ u8 simulatedRNG[4];
+ /*0x00*/ u8 aiState;
+ /*0x01*/ u8 movesetIndex;
+ /*0x02*/ u16 moveConsidered;
+ /*0x04*/ s8 score[4]; // score?
+ /*0x08*/ u32 funcResult;
+ /*0x0C*/ u32 aiFlags;
+ /*0x10*/ u8 aiAction;
+ /*0x11*/ u8 aiLogicId;
+ /*0x12*/ u8 filler12[6];
+ /*0x18*/ u8 simulatedRNG[4];
};
struct BattleStruct /* 0x2000000 */
@@ -302,6 +326,18 @@ struct BattleStruct /* 0x2000000 */
/* 0x16A00 */ struct UnkBattleStruct1 unk_2016A00_2;
};
+struct StatsArray
+{
+ u16 hp;
+ u16 atk;
+ u16 def;
+ u16 spd;
+ u16 spAtk;
+ u16 spDef;
+};
+
+#define gBattleResources_statsBeforeLvlUp ((struct StatsArray *)(gSharedMem + 0x17180))
+
struct DisableStruct
{
/*0x00*/ u32 transformedMonPersonality;
@@ -473,7 +509,7 @@ struct sideTimer
u8 lightscreenTimer; //0x1
u8 mistTimer; //0x2
u8 field3; //0x3
- u16 field4; //0x4
+ u16 field4; //0x4
u8 spikesAmount; //0x6
u8 safeguardTimer; //0x7
u8 followmeTimer; //0x8
@@ -491,7 +527,7 @@ struct WishFutureKnock
u8 wishCounter[MAX_BANKS_BATTLE];
u8 wishUserID[MAX_BANKS_BATTLE];
u8 weatherDuration;
- u16 knockedOffPokes;
+ u8 knockedOffPokes[2];
};
extern struct UnkBattleStruct1 unk_2016A00;
@@ -504,6 +540,88 @@ extern struct WishFutureKnock gWishFutureKnock;
extern struct AI_ThinkingStruct gAIThinkingSpace;
extern struct Struct20238C8 gUnknown_020238C8;
+#define GET_MOVE_TYPE(move, typeArg) \
+{ \
+ if (gBattleStruct->dynamicMoveType) \
+ typeArg = gBattleStruct->dynamicMoveType & 0x3F; \
+ else \
+ typeArg = gBattleMoves[move].type; \
+}
+
+#define MOVE_EFFECT_SLEEP 0x1
+#define MOVE_EFFECT_POISON 0x2
+#define MOVE_EFFECT_BURN 0x3
+#define MOVE_EFFECT_FREEZE 0x4
+#define MOVE_EFFECT_PARALYSIS 0x5
+#define MOVE_EFFECT_TOXIC 0x6
+#define MOVE_EFFECT_CONFUSION 0x7
+#define MOVE_EFFECT_FLINCH 0x8
+#define MOVE_EFFECT_TRI_ATTACK 0x9
+#define MOVE_EFFECT_UPROAR 0xA
+#define MOVE_EFFECT_PAYDAY 0xB
+#define MOVE_EFFECT_CHARGING 0xC
+#define MOVE_EFFECT_WRAP 0xD
+#define MOVE_EFFECT_RECOIL_25 0xE
+#define MOVE_EFFECT_ATK_PLUS_1 0xF
+#define MOVE_EFFECT_DEF_PLUS_1 0x10
+#define MOVE_EFFECT_SPD_PLUS_1 0x11
+#define MOVE_EFFECT_SP_ATK_PLUS_1 0x12
+#define MOVE_EFFECT_SP_DEF_PLUS_1 0x13
+#define MOVE_EFFECT_ACC_PLUS_1 0x14
+#define MOVE_EFFECT_EVS_PLUS_1 0x15
+#define MOVE_EFFECT_ATK_MINUS_1 0x16
+#define MOVE_EFFECT_DEF_MINUS_1 0x17
+#define MOVE_EFFECT_SPD_MINUS_1 0x18
+#define MOVE_EFFECT_SP_ATK_MINUS_1 0x19
+#define MOVE_EFFECT_SP_DEF_MINUS_1 0x1A
+#define MOVE_EFFECT_ACC_MINUS_1 0x1B
+#define MOVE_EFFECT_EVS_MINUS_1 0x1C
+#define MOVE_EFFECT_RECHARGE 0x1D
+#define MOVE_EFFECT_RAGE 0x1E
+#define MOVE_EFFECT_STEAL_ITEM 0x1F
+#define MOVE_EFFECT_PREVENT_ESCAPE 0x20
+#define MOVE_EFFECT_NIGHTMARE 0x21
+#define MOVE_EFFECT_ALL_STATS_UP 0x22
+#define MOVE_EFFECT_RAPIDSPIN 0x23
+#define MOVE_EFFECT_REMOVE_PARALYSIS 0x24
+#define MOVE_EFFECT_ATK_DEF_DOWN 0x25
+#define MOVE_EFFECT_RECOIL_33_PARALYSIS 0x26
+#define MOVE_EFFECT_ATK_PLUS_2 0x27
+#define MOVE_EFFECT_DEF_PLUS_2 0x28
+#define MOVE_EFFECT_SPD_PLUS_2 0x29
+#define MOVE_EFFECT_SP_ATK_PLUS_2 0x2A
+#define MOVE_EFFECT_SP_DEF_PLUS_2 0x2B
+#define MOVE_EFFECT_ACC_PLUS_2 0x2C
+#define MOVE_EFFECT_EVS_PLUS_2 0x2D
+#define MOVE_EFFECT_ATK_MINUS_2 0x2E
+#define MOVE_EFFECT_DEF_MINUS_2 0x2F
+#define MOVE_EFFECT_SPD_MINUS_2 0x30
+#define MOVE_EFFECT_SP_ATK_MINUS_2 0x31
+#define MOVE_EFFECT_SP_DEF_MINUS_2 0x32
+#define MOVE_EFFECT_ACC_MINUS_2 0x33
+#define MOVE_EFFECT_EVS_MINUS_2 0x34
+#define MOVE_EFFECT_THRASH 0x35
+#define MOVE_EFFECT_KNOCK_OFF 0x36
+#define MOVE_EFFECT_NOTHING_37 0x37
+#define MOVE_EFFECT_NOTHING_38 0x38
+#define MOVE_EFFECT_NOTHING_39 0x39
+#define MOVE_EFFECT_NOTHING_3A 0x3A
+#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B
+#define MOVE_EFFECT_NOTHING_3C 0x3C
+#define MOVE_EFFECT_NOTHING_3D 0x3D
+#define MOVE_EFFECT_NOTHING_3E 0x3E
+#define MOVE_EFFECT_NOTHING_3F 0x3F
+#define MOVE_EFFECT_AFFECTS_USER 0x40
+#define MOVE_EFFECT_CERTAIN 0x80
+
+#define GET_STAT_BUFF_ID(n)((n & 0xF)) // first four bits 0x1, 0x2, 0x4, 0x8
+#define GET_STAT_BUFF_VALUE(n)(((n >> 4) & 7)) // 0x10, 0x20, 0x40
+#define STAT_BUFF_NEGATIVE 0x80 // 0x80, the sign bit
+
+#define SET_STAT_BUFF_VALUE(n)(((s8)(((s8)(n) << 4)) & 0xF0))
+
+#define SET_STATCHANGER(statId, stage, goesDown)(gBattleScripting.statChanger = (statId) + (stage << 4) + (goesDown << 7))
+
// used in many battle files, it seems as though Hisashi Sogabe wrote
// some sort of macro to replace the use of actually calling memset.
// Perhaps it was thought calling memset was much slower?
@@ -540,7 +658,7 @@ struct funcStack
struct scriptsStack
{
- u8* ptr[8];
+ const u8 *ptr[8];
u8 size;
};
@@ -676,11 +794,11 @@ void nullsub_10(int);
void load_gfxc_health_bar();
u8 battle_load_something();
void sub_8031F88(u8);
-void sub_80324F8(struct Pokemon *, u8);
+void HandleLowHpMusicChange(struct Pokemon *, u8);
void sub_8032638();
void sub_8032AA8(u8, u8);
void SetBankFuncToOpponentBufferRunCommand(void);
-void BattleMusicStop(void);
+void BattleStopLowHpSound(void);
// asm/battle_9.o
void SetBankFuncToLinkOpponentBufferRunCommand(void);
diff --git a/include/battle_script_commands.h b/include/battle_script_commands.h
new file mode 100644
index 000000000..030844ec3
--- /dev/null
+++ b/include/battle_script_commands.h
@@ -0,0 +1,65 @@
+#ifndef GUARD_BATTLE_SCRIPT_COMMANDS_H
+#define GUARD_BATTLE_SCRIPT_COMMANDS_H
+
+#define NO_ACC_CALC 0xFFFE
+#define NO_ACC_CALC_CHECK_LOCK_ON 0xFFFF
+#define ACC_CURR_MOVE 0
+
+#define CMP_EQUAL 0x0
+#define CMP_NOT_EQUAL 0x1
+#define CMP_GREATER_THAN 0x2
+#define CMP_LESS_THAN 0x3
+#define CMP_COMMON_BITS 0x4
+#define CMP_NO_COMMON_BITS 0x5
+
+#define BS_ATTACKER_WITH_PARTNER 4 // for atk98_status_icon_update
+#define BS_GET_ATTACKER_SIDE 8 // for atk1E_jumpifability
+#define BS_GET_NOT_ATTACKER_SIDE 9 // for atk1E_jumpifability
+
+#define ATK48_STAT_NEGATIVE 0x1
+#define ATK48_STAT_BY_TWO 0x2
+#define ATK48_BIT_x4 0x4
+#define ATK48_LOWER_FAIL_CHECK 0x8
+
+#define ATK4F_DONT_CHECK_STATUSES 0x80
+
+#define VARIOUS_CANCEL_MULTI_TURN_MOVES 0
+#define VARIOUS_SET_MAGIC_COAT_TARGET 1
+#define VARIOUS_IS_RUNNING_IMPOSSIBLE 2
+#define VARIOUS_GET_MOVE_TARGET 3
+#define VARIOUS_RESET_INTIMIDATE_TRACE_BITS 5
+#define VARIOUS_UPDATE_CHOICE_MOVE_ON_LVL_UP 6
+#define VARIOUS_EMIT_YESNOBOX 13
+#define VARIOUS_WAIT_CRY 18
+#define VARIOUS_RETURN_OPPONENT_MON1 19
+#define VARIOUS_RETURN_OPPONENT_MON2 20
+#define VARIOUS_SET_TELEPORT_OUTCOME 25
+#define VARIOUS_PLAY_TRAINER_DEFEATED_MUSIC 26
+
+#define ATK80_DMG_CHANGE_SIGN 0
+#define ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP 1
+#define ATK80_DMG_DOUBLED 2
+
+#define STAT_CHANGE_BS_PTR 0x1
+#define STAT_CHANGE_NOT_PROTECT_AFFECTED 0x20
+
+#define STAT_CHANGE_WORKED 0
+#define STAT_CHANGE_DIDNT_WORK 1
+
+#define WINDOW_CLEAR 0x1
+#define WINDOW_x80 0x80
+
+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);
+void SetMoveEffect(bool8 primary, u8 certain);
+void BattleDestroyYesNoCursorAt(u8 cursorPosition);
+void BattleCreateYesNoCursorAt(u8 cursorPosition);
+void BufferMoveToLearnIntoBattleTextBuff2(void);
+void HandleBattleWindow(u8 xStart, u8 yStart, u8 xEnd, u8 yEnd, u8 flags);
+bool8 UproarWakeUpCheck(u8 bank);
+
+extern void (* const gBattleScriptingCommandsTable[])(void);
+
+#endif // GUARD_BATTLE_SCRIPT_COMMANDS_H
diff --git a/include/battle_string_ids.h b/include/battle_string_ids.h
new file mode 100644
index 000000000..f242284b0
--- /dev/null
+++ b/include/battle_string_ids.h
@@ -0,0 +1,387 @@
+#ifndef GUARD_BATTLE_STRING_IDS_H
+#define GUARD_BATTLE_STRING_IDS_H
+
+#define BATTLESTRINGS_COUNT 369
+
+#define BATTLESTRINGS_ID_ADDER 12 // all battlestrings have its ID + 12, because first 5 are reserved
+
+#define STRINGID_INTROMSG 0
+#define STRINGID_INTROSENDOUT 1
+#define STRINGID_RETURNMON 2
+#define STRINGID_SWITCHINMON 3
+#define STRINGID_USEDMOVE 4
+#define STRINGID_BATTLEEND 5
+
+
+// todo: make some of those names less vague: attacker/target vs pkmn, etc.
+#define STRINGID_TRAINER1LOSETEXT 12
+#define STRINGID_PKMNGAINEDEXP 13
+#define STRINGID_PKMNGREWTOLV 14
+#define STRINGID_PKMNLEARNEDMOVE 15
+#define STRINGID_TRYTOLEARNMOVE1 16
+#define STRINGID_TRYTOLEARNMOVE2 17
+#define STRINGID_TRYTOLEARNMOVE3 18
+#define STRINGID_PKMNFORGOTMOVE 19
+#define STRINGID_STOPLEARNINGMOVE 20
+#define STRINGID_DIDNOTLEARNMOVE 21
+#define STRINGID_PKMNLEARNEDMOVE2 22
+#define STRINGID_ATTACKMISSED 23
+#define STRINGID_PKMNPROTECTEDITSELF 24
+#define STRINGID_STATSWONTINCREASE2 25
+#define STRINGID_AVOIDEDDAMAGE 26
+#define STRINGID_ITDOESNTAFFECT 27
+#define STRINGID_ATTACKERFAINTED 28
+#define STRINGID_TARGETFAINTED 29
+#define STRINGID_PLAYERGOTMONEY 30
+#define STRINGID_PLAYERWHITEOUT 31
+#define STRINGID_PLAYERWHITEOUT2 32
+#define STRINGID_PREVENTSESCAPE 33
+#define STRINGID_HITXTIMES 34
+#define STRINGID_PKMNFELLASLEEP 35
+#define STRINGID_PKMNMADESLEEP 36
+#define STRINGID_PKMNALREADYASLEEP 37
+#define STRINGID_PKMNALREADYASLEEP2 38
+#define STRINGID_PKMNWASNTAFFECTED 39
+#define STRINGID_PKMNWASPOISONED 40
+#define STRINGID_PKMNPOISONEDBY 41
+#define STRINGID_PKMNHURTBYPOISON 42
+#define STRINGID_PKMNALREADYPOISONED 43
+#define STRINGID_PKMNBADLYPOISONED 44
+#define STRINGID_PKMNENERGYDRAINED 45
+#define STRINGID_PKMNWASBURNED 46
+#define STRINGID_PKMNBURNEDBY 47
+#define STRINGID_PKMNHURTBYBURN 48
+#define STRINGID_PKMNWASFROZEN 49
+#define STRINGID_PKMNFROZENBY 50
+#define STRINGID_PKMNISFROZEN 51
+#define STRINGID_PKMNWASDEFROSTED 52
+#define STRINGID_PKMNWASDEFROSTED2 53
+#define STRINGID_PKMNWASDEFROSTEDBY 54
+#define STRINGID_PKMNWASPARALYZED 55
+#define STRINGID_PKMNWASPARALYZEDBY 56
+#define STRINGID_PKMNISPARALYZED 57
+#define STRINGID_PKMNISALREADYPARALYZED 58
+#define STRINGID_PKMNHEALEDPARALYSIS 59
+#define STRINGID_PKMNDREAMEATEN 60
+#define STRINGID_STATSWONTINCREASE 61
+#define STRINGID_STATSWONTDECREASE 62
+#define STRINGID_TEAMSTOPPEDWORKING 63
+#define STRINGID_FOESTOPPEDWORKING 64
+#define STRINGID_PKMNISCONFUSED 65
+#define STRINGID_PKMNHEALEDCONFUSION 66
+#define STRINGID_PKMNWASCONFUSED 67
+#define STRINGID_PKMNALREADYCONFUSED 68
+#define STRINGID_PKMNFELLINLOVE 69
+#define STRINGID_PKMNINLOVE 70
+#define STRINGID_PKMNIMMOBILIZEDBYLOVE 71
+#define STRINGID_PKMNBLOWNAWAY 72
+#define STRINGID_PKMNCHANGEDTYPE 73
+#define STRINGID_PKMNFLINCHED 74
+#define STRINGID_PKMNREGAINEDHEALTH 75
+#define STRINGID_PKMNHPFULL 76
+#define STRINGID_PKMNRAISEDSPDEF 77
+#define STRINGID_PKMNRAISEDDEF 78
+#define STRINGID_PKMNCOVEREDBYVEIL 79
+#define STRINGID_PKMNUSEDSAFEGUARD 80
+#define STRINGID_PKMNSAFEGUARDEXPIRED 81
+#define STRINGID_PKMNWENTTOSLEEP 82
+#define STRINGID_PKMNSLEPTHEALTHY 83
+#define STRINGID_PKMNWHIPPEDWHIRLWIND 84
+#define STRINGID_PKMNTOOKSUNLIGHT 85
+#define STRINGID_PKMNLOWEREDHEAD 86
+#define STRINGID_PKMNISGLOWING 87
+#define STRINGID_PKMNFLEWHIGH 88
+#define STRINGID_PKMNDUGHOLE 89
+#define STRINGID_PKMNSQUEEZEDBYBIND 90
+#define STRINGID_PKMNTRAPPEDINVORTEX 91
+#define STRINGID_PKMNWRAPPEDBY 92
+#define STRINGID_PKMNCLAMPED 93
+#define STRINGID_PKMNHURTBY 94
+#define STRINGID_PKMNFREEDFROM 95
+#define STRINGID_PKMNCRASHED 96
+#define STRINGID_PKMNSHROUDEDINMIST 97
+#define STRINGID_PKMNPROTECTEDBYMIST 98
+#define STRINGID_PKMNGETTINGPUMPED 99
+#define STRINGID_PKMNHITWITHRECOIL 100
+#define STRINGID_PKMNPROTECTEDITSELF2 101
+#define STRINGID_PKMNBUFFETEDBYSANDSTORM 102
+#define STRINGID_PKMNPELTEDBYHAIL 103
+#define STRINGID_PKMNSEEDED 104
+#define STRINGID_PKMNEVADEDATTACK 105
+#define STRINGID_PKMNSAPPEDBYLEECHSEED 106
+#define STRINGID_PKMNFASTASLEEP 107
+#define STRINGID_PKMNWOKEUP 108
+#define STRINGID_PKMNUPROARKEPTAWAKE 109
+#define STRINGID_PKMNWOKEUPINUPROAR 110
+#define STRINGID_PKMNCAUSEDUPROAR 111
+#define STRINGID_PKMNMAKINGUPROAR 112
+#define STRINGID_PKMNCALMEDDOWN 113
+#define STRINGID_PKMNCANTSLEEPINUPROAR 114
+#define STRINGID_PKMNSTOCKPILED 115
+#define STRINGID_PKMNCANTSTOCKPILE 116
+#define STRINGID_PKMNCANTSLEEPINUPROAR2 117
+#define STRINGID_UPROARKEPTPKMNAWAKE 118
+#define STRINGID_PKMNSTAYEDAWAKEUSING 119
+#define STRINGID_PKMNSTORINGENERGY 120
+#define STRINGID_PKMNUNLEASHEDENERGY 121
+#define STRINGID_PKMNFATIGUECONFUSION 122
+#define STRINGID_PKMNPICKEDUPITEM 123
+#define STRINGID_PKMNUNAFFECTED 124
+#define STRINGID_PKMNTRANSFORMEDINTO 125
+#define STRINGID_PKMNMADESUBSTITUTE 126
+#define STRINGID_PKMNHASSUBSTITUTE 127
+#define STRINGID_SUBSTITUTEDAMAGED 128
+#define STRINGID_PKMNSUBSTITUTEFADED 129
+#define STRINGID_PKMNMUSTRECHARGE 130
+#define STRINGID_PKMNRAGEBUILDING 131
+#define STRINGID_PKMNMOVEWASDISABLED 132
+#define STRINGID_PKMNMOVEISDISABLED 133
+#define STRINGID_PKMNMOVEDISABLEDNOMORE 134
+#define STRINGID_PKMNGOTENCORE 135
+#define STRINGID_PKMNENCOREENDED 136
+#define STRINGID_PKMNTOOKAIM 137
+#define STRINGID_PKMNSKETCHEDMOVE 138
+#define STRINGID_PKMNTRYINGTOTAKEFOE 139
+#define STRINGID_PKMNTOOKFOE 140
+#define STRINGID_PKMNREDUCEDPP 141
+#define STRINGID_PKMNSTOLEITEM 142
+#define STRINGID_TARGETCANTESCAPENOW 143
+#define STRINGID_PKMNFELLINTONIGHTMARE 144
+#define STRINGID_PKMNLOCKEDINNIGHTMARE 145
+#define STRINGID_PKMNLAIDCURSE 146
+#define STRINGID_PKMNAFFLICTEDBYCURSE 147
+#define STRINGID_SPIKESSCATTERED 148
+#define STRINGID_PKMNHURTBYSPIKES 149
+#define STRINGID_PKMNIDENTIFIED 150
+#define STRINGID_PKMNPERISHCOUNTFELL 151
+#define STRINGID_PKMNBRACEDITSELF 152
+#define STRINGID_PKMNENDUREDHIT 153
+#define STRINGID_MAGNITUDESTRENGTH 154
+#define STRINGID_PKMNCUTHPMAXEDATTACK 155
+#define STRINGID_PKMNCOPIEDSTATCHANGES 156
+#define STRINGID_PKMNGOTFREE 157
+#define STRINGID_PKMNSHEDLEECHSEED 158
+#define STRINGID_PKMNBLEWAWAYSPIKES 159
+#define STRINGID_PKMNFLEDFROMBATTLE 160
+#define STRINGID_PKMNFORESAWATTACK 161
+#define STRINGID_PKMNTOOKATTACK 162
+#define STRINGID_PKMNATTACK 163
+#define STRINGID_PKMNCENTERATTENTION 164
+#define STRINGID_PKMNCHARGINGPOWER 165
+#define STRINGID_NATUREPOWERTURNEDINTO 166
+#define STRINGID_PKMNSTATUSNORMAL 167
+#define STRINGID_PKMNHASNOMOVESLEFT 168
+#define STRINGID_PKMNSUBJECTEDTOTORMENT 169
+#define STRINGID_PKMNCANTUSEMOVETORMENT 170
+#define STRINGID_PKMNTIGHTENINGFOCUS 171
+#define STRINGID_PKMNFELLFORTAUNT 172
+#define STRINGID_PKMNCANTUSEMOVETAUNT 173
+#define STRINGID_PKMNREADYTOHELP 174
+#define STRINGID_PKMNSWITCHEDITEMS 175
+#define STRINGID_PKMNCOPIEDFOE 176
+#define STRINGID_PKMNMADEWISH 177
+#define STRINGID_PKMNWISHCAMETRUE 178
+#define STRINGID_PKMNPLANTEDROOTS 179
+#define STRINGID_PKMNABSORBEDNUTRIENTS 180
+#define STRINGID_PKMNANCHOREDITSELF 181
+#define STRINGID_PKMNWASMADEDROWSY 182
+#define STRINGID_PKMNKNOCKEDOFF 183
+#define STRINGID_PKMNSWAPPEDABILITIES 184
+#define STRINGID_PKMNSEALEDOPPONENTMOVE 185
+#define STRINGID_PKMNCANTUSEMOVESEALED 186
+#define STRINGID_PKMNWANTSGRUDGE 187
+#define STRINGID_PKMNLOSTPPGRUDGE 188
+#define STRINGID_PKMNSHROUDEDITSELF 189
+#define STRINGID_PKMNMOVEBOUNCED 190
+#define STRINGID_PKMNWAITSFORTARGET 191
+#define STRINGID_PKMNSNATCHEDMOVE 192
+#define STRINGID_PKMNMADEITRAIN 193
+#define STRINGID_PKMNRAISEDSPEED 194
+#define STRINGID_PKMNPROTECTEDBY 195
+#define STRINGID_PKMNPREVENTSUSAGE 196
+#define STRINGID_PKMNRESTOREDHPUSING 197
+#define STRINGID_PKMNCHANGEDTYPEWITH 198
+#define STRINGID_PKMNPREVENTSPARALYSISWITH 199
+#define STRINGID_PKMNPREVENTSROMANCEWITH 200
+#define STRINGID_PKMNPREVENTSPOISONINGWITH 201
+#define STRINGID_PKMNPREVENTSCONFUSIONWITH 202
+#define STRINGID_PKMNRAISEDFIREPOWERWITH 203
+#define STRINGID_PKMNANCHORSITSELFWITH 204
+#define STRINGID_PKMNCUTSATTACKWITH 205
+#define STRINGID_PKMNPREVENTSSTATLOSSWITH 206
+#define STRINGID_PKMNHURTSWITH 207
+#define STRINGID_PKMNTRACED 208
+#define STRINGID_STATSHARPLY 209
+#define STRINGID_STATROSE 210
+#define STRINGID_STATHARSHLY 211
+#define STRINGID_STATFELL 212
+#define STRINGID_PKMNSSTATCHANGED 213
+#define STRINGID_PKMNSSTATCHANGED2 214
+#define STRINGID_PKMNSSTATCHANGED3 215
+#define STRINGID_PKMNSSTATCHANGED4 216
+#define STRINGID_CRITICALHIT 217
+#define STRINGID_ONEHITKO 218
+#define STRINGID_123POOF 219
+#define STRINGID_ANDELLIPSIS 220
+#define STRINGID_NOTVERYEFFECTIVE 221
+#define STRINGID_SUPEREFFECTIVE 222
+#define STRINGID_GOTAWAYSAFELY 223
+#define STRINGID_WILDPKMNFLED 224
+#define STRINGID_NORUNNINGFROMTRAINERS 225
+#define STRINGID_CANTESCAPE 226
+#define STRINGID_DONTLEAVEBIRCH 227
+#define STRINGID_BUTNOTHINGHAPPENED 228
+#define STRINGID_BUTITFAILED 229
+#define STRINGID_ITHURTCONFUSION 230
+#define STRINGID_MIRRORMOVEFAILED 231
+#define STRINGID_STARTEDTORAIN 232
+#define STRINGID_DOWNPOURSTARTED 233
+#define STRINGID_RAINCONTINUES 234
+#define STRINGID_DOWNPOURCONTINUES 235
+#define STRINGID_RAINSTOPPED 236
+#define STRINGID_SANDSTORMBREWED 237
+#define STRINGID_SANDSTORMRAGES 238
+#define STRINGID_SANDSTORMSUBSIDED 239
+#define STRINGID_SUNLIGHTGOTBRIGHT 240
+#define STRINGID_SUNLIGHTSTRONG 241
+#define STRINGID_SUNLIGHTFADED 242
+#define STRINGID_STARTEDHAIL 243
+#define STRINGID_HAILCONTINUES 244
+#define STRINGID_HAILSTOPPED 245
+#define STRINGID_FAILEDTOSPITUP 246
+#define STRINGID_FAILEDTOSWALLOW 247
+#define STRINGID_WINDBECAMEHEATWAVE 248
+#define STRINGID_STATCHANGESGONE 249
+#define STRINGID_COINSSCATTERED 250
+#define STRINGID_TOOWEAKFORSUBSTITUTE 251
+#define STRINGID_SHAREDPAIN 252
+#define STRINGID_BELLCHIMED 253
+#define STRINGID_FAINTINTHREE 254
+#define STRINGID_NOPPLEFT 255
+#define STRINGID_BUTNOPPLEFT 256
+#define STRINGID_PLAYERUSEDITEM 257
+#define STRINGID_WALLYUSEDITEM 258
+#define STRINGID_TRAINERBLOCKEDBALL 259
+#define STRINGID_DONTBEATHIEF 260
+#define STRINGID_ITDODGEDBALL 261
+#define STRINGID_YOUMISSEDPKMN 262
+#define STRINGID_PKMNBROKEFREE 263
+#define STRINGID_ITAPPEAREDCAUGHT 264
+#define STRINGID_AARGHALMOSTHADIT 265
+#define STRINGID_SHOOTSOCLOSE 266
+#define STRINGID_GOTCHAPKMNCAUGHT 267
+#define STRINGID_GOTCHAPKMNCAUGHT2 268
+#define STRINGID_GIVENICKNAMECAPTURED 269
+#define STRINGID_PKMNSENTTOPC 270
+#define STRINGID_PKMNDATAADDEDTODEX 271
+#define STRINGID_ITISRAINING 272
+#define STRINGID_SANDSTORMISRAGING 273
+#define STRINGID_CANTESCAPE2 274
+#define STRINGID_PKMNIGNORESASLEEP 275
+#define STRINGID_PKMNIGNOREDORDERS 276
+#define STRINGID_PKMNBEGANTONAP 277
+#define STRINGID_PKMNLOAFING 278
+#define STRINGID_PKMNWONTOBEY 279
+#define STRINGID_PKMNTURNEDAWAY 280
+#define STRINGID_PKMNPRETENDNOTNOTICE 281
+#define STRINGID_ENEMYABOUTTOSWITCHPKMN 282
+#define STRINGID_CREPTCLOSER 283
+#define STRINGID_CANTGETCLOSER 284
+#define STRINGID_PKMNWATCHINGCAREFULLY 285
+#define STRINGID_PKMNCURIOUSABOUTX 286
+#define STRINGID_PKMNENTHRALLEDBYX 287
+#define STRINGID_PKMNIGNOREDX 288
+#define STRINGID_THREWPOKEBLOCKATPKMN 289
+#define STRINGID_OUTOFSAFARIBALLS 290
+#define STRINGID_PKMNSITEMCUREDPARALYSIS 291
+#define STRINGID_PKMNSITEMCUREDPOISON 292
+#define STRINGID_PKMNSITEMHEALEDBURN 293
+#define STRINGID_PKMNSITEMDEFROSTEDIT 294
+#define STRINGID_PKMNSITEMWOKEIT 295
+#define STRINGID_PKMNSITEMSNAPPEDOUT 296
+#define STRINGID_PKMNSITEMCUREDPROBLEM 297
+#define STRINGID_PKMNSITEMRESTOREDHEALTH 298
+#define STRINGID_PKMNSITEMRESTOREDPP 299
+#define STRINGID_PKMNSITEMRESTOREDSTATUS 300
+#define STRINGID_PKMNSITEMRESTOREDHPALITTLE 301
+#define STRINGID_ITEMALLOWSONLYYMOVE 302
+#define STRINGID_PKMNHUNGONWITHX 303
+#define STRINGID_EMPTYSTRING3 304
+#define STRINGID_PKMNSXPREVENTSBURNS 305
+#define STRINGID_PKMNSXBLOCKSY 306
+#define STRINGID_PKMNSXRESTOREDHPALITTLE2 307
+#define STRINGID_PKMNSXWHIPPEDUPSANDSTORM 308
+#define STRINGID_PKMNSXPREVENTSYLOSS 309
+#define STRINGID_PKMNSXINFATUATEDY 310
+#define STRINGID_PKMNSXMADEYINEFFECTIVE 311
+#define STRINGID_PKMNSXCUREDYPROBLEM 312
+#define STRINGID_ITSUCKEDLIQUIDOOZE 313
+#define STRINGID_PKMNTRANSFORMED 314
+#define STRINGID_ELECTRICITYWEAKENED 315
+#define STRINGID_FIREWEAKENED 316
+#define STRINGID_PKMNHIDUNDERWATER 317
+#define STRINGID_PKMNSPRANGUP 318
+#define STRINGID_HMMOVESCANTBEFORGOTTEN 319
+#define STRINGID_XFOUNDONEY 320
+#define STRINGID_PLAYERDEFEATEDTRAINER1 321
+#define STRINGID_SOOTHINGAROMA 322
+#define STRINGID_ITEMSCANTBEUSEDNOW 323
+#define STRINGID_FORXCOMMAYZ 324
+#define STRINGID_USINGXTHEYOFZN 325
+#define STRINGID_PKMNUSEDXTOGETPUMPED 326
+#define STRINGID_PKMNSXMADEYUSELESS 327
+#define STRINGID_PKMNTRAPPEDBYSANDTOMB 328
+#define STRINGID_EMPTYSTRING4 329
+#define STRINGID_ABOOSTED 330
+#define STRINGID_PKMNSXINTENSIFIEDSUN 331
+#define STRINGID_PKMNMAKESGROUNDMISS 332
+#define STRINGID_YOUTHROWABALLNOWRIGHT 333
+#define STRINGID_PKMNSXTOOKATTACK 334
+#define STRINGID_PKMNCHOSEXASDESTINY 335
+#define STRINGID_PKMNLOSTFOCUS 336
+#define STRINGID_USENEXTPKMN 337
+#define STRINGID_PKMNFLEDUSINGITS 338
+#define STRINGID_PKMNFLEDUSING 339
+#define STRINGID_PKMNWASDRAGGEDOUT 340
+#define STRINGID_PREVENTEDFROMWORKING 341
+#define STRINGID_PKMNSITEMNORMALIZEDSTATUS 342
+#define STRINGID_TRAINER1USEDITEM 343
+#define STRINGID_BOXISFULL 344
+#define STRINGID_PKMNAVOIDEDATTACK 345
+#define STRINGID_PKMNSXMADEITINEFFECTIVE 346
+#define STRINGID_PKMNSXPREVENTSFLINCHING 347
+#define STRINGID_PKMNALREADYHASBURN 348
+#define STRINGID_STATSWONTDECREASE2 349
+#define STRINGID_PKMNSXBLOCKSY2 350
+#define STRINGID_PKMNSXWOREOFF 351
+#define STRINGID_PKMNRAISEDDEFALITTLE 352
+#define STRINGID_PKMNRAISEDSPDEFALITTLE 353
+#define STRINGID_THEWALLSHATTERED 354
+#define STRINGID_PKMNSXPREVENTSYSZ 355
+#define STRINGID_PKMNSXCUREDITSYPROBLEM 356
+#define STRINGID_ATTACKERCANTESCAPE 357
+#define STRINGID_PKMNOBTAINEDX 358
+#define STRINGID_PKMNOBTAINEDX2 359
+#define STRINGID_PKMNOBTAINEDXYOBTAINEDZ 360
+#define STRINGID_BUTNOEFFECT 361
+#define STRINGID_PKMNSXHADNOEFFECTONY 362
+#define STRINGID_TWOENEMIESDEFEATED 363
+#define STRINGID_TRAINER2LOSETEXT 364
+#define STRINGID_PKMNINCAPABLEOFPOWER 365
+#define STRINGID_GLINTAPPEARSINEYE 366
+#define STRINGID_PKMNGETTINGINTOPOSITION 367
+#define STRINGID_PKMNBEGANGROWLINGDEEPLY 368
+#define STRINGID_PKMNEAGERFORMORE 369
+#define STRINGID_DEFEATEDOPPONENTBYREFEREE 370
+#define STRINGID_LOSTTOOPPONENTBYREFEREE 371
+#define STRINGID_TIEDOPPONENTBYREFEREE 372
+#define STRINGID_QUESTIONFORFEITMATCH 373
+#define STRINGID_FORFEITEDMATCH 374
+#define STRINGID_PKMNTRANSFERREDSOMEONESPC 375
+#define STRINGID_PKMNTRANSFERREDLANETTESPC 376
+#define STRINGID_PKMNBOXSOMEONESPCFULL 377
+#define STRINGID_PKMNBOXLANETTESPCFULL 378
+#define STRINGID_TRAINER1WINTEXT 379
+#define STRINGID_TRAINER2WINTEXT 380
+
+#endif // GUARD_BATTLE_STRING_IDS_H
diff --git a/include/battle_util.h b/include/battle_util.h
index f47b00b2c..15fa39d1a 100644
--- a/include/battle_util.h
+++ b/include/battle_util.h
@@ -11,7 +11,7 @@
#define BS_GET_OPPONENT2 14
void TryClearRageStatuses(void);
-void BattleScriptPush(u8* BS_ptr);
+void BattleScriptPush(const u8* BS_ptr);
void PressurePPLoseOnUsingImprision(u8 bankAtk);
void PressurePPLoseOnUsingPerishSong(u8 bankAtk);
void sub_80155A4(u8);
@@ -22,7 +22,7 @@ void ResetSentPokesToOpponentValue(void);
void sub_8015740(u8 bank);
void sub_80157C4(u8 bank);
bool8 HandleWishPerishSongOnTurnEnd(void);
-void BattleScriptExecute(u8* BS_ptr);
+void BattleScriptExecute(const u8* BS_ptr);
void BattleScriptPushCursorAndCallback(u8* BS_ptr);
u8 IsMonDisobedient(void);
diff --git a/include/constants/items.h b/include/constants/items.h
index cde5c7141..9b88db1da 100644
--- a/include/constants/items.h
+++ b/include/constants/items.h
@@ -2,6 +2,8 @@
#define GUARD_CONSTANTS_ITEMS_H
#define ITEM_NONE 0
+
+// Balls
#define ITEM_MASTER_BALL 1
#define ITEM_ULTRA_BALL 2
#define ITEM_GREAT_BALL 3
@@ -14,6 +16,8 @@
#define ITEM_TIMER_BALL 10
#define ITEM_LUXURY_BALL 11
#define ITEM_PREMIER_BALL 12
+
+// Pokemon Items
#define ITEM_POTION 13
#define ITEM_ANTIDOTE 14
#define ITEM_BURN_HEAL 15
@@ -180,6 +184,8 @@
#define ITEM_0B0 176
#define ITEM_0B1 177
#define ITEM_0B2 178
+
+// hold items
#define ITEM_BRIGHT_POWDER 179
#define ITEM_WHITE_HERB 180
#define ITEM_MACHO_BRACE 181
@@ -260,6 +266,8 @@
#define ITEM_PINK_SCARF 256
#define ITEM_GREEN_SCARF 257
#define ITEM_YELLOW_SCARF 258
+
+// Key Items
#define ITEM_MACH_BIKE 259
#define ITEM_COIN_CASE 260
#define ITEM_ITEMFINDER 261
@@ -290,6 +298,8 @@
#define ITEM_ROOT_FOSSIL 286
#define ITEM_CLAW_FOSSIL 287
#define ITEM_DEVON_SCOPE 288
+
+// TMs/HMs
#define ITEM_TM01_FOCUS_PUNCH 289
#define ITEM_TM02_DRAGON_CLAW 290
#define ITEM_TM03_WATER_PULSE 291
@@ -348,6 +358,8 @@
#define ITEM_HM06_ROCK_SMASH 344
#define ITEM_HM07_WATERFALL 345
#define ITEM_HM08_DIVE 346
+
+// Unknown
#define ITEM_15B 347
#define ITEM_15C 348
@@ -386,4 +398,7 @@
#define NUM_TECHNICAL_MACHINES 50
#define NUM_HIDDEN_MACHINES 8
+// Check if the item is one that can be used on a Pokemon.
+#define IS_POKEMON_ITEM(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
+
#endif // GUARD_CONSTANTS_ITEMS_H
diff --git a/include/constants/songs.h b/include/constants/songs.h
index 5225f5899..920873a7c 100644
--- a/include/constants/songs.h
+++ b/include/constants/songs.h
@@ -2,371 +2,371 @@
#define GUARD_CONSTANTS_SONGS_H
#define SE_STOP 0
-#define SE_KAIFUKU 1
-#define SE_PC_LOGON 2
-#define SE_PC_OFF 3
-#define SE_PC_ON 4
-#define SE_SELECT 5
-#define SE_WIN_OPEN 6
-#define SE_WALL_HIT 7
-#define SE_DOOR 8
-#define SE_KAIDAN 9
-#define SE_DANSA 10
-#define SE_JITENSYA 11
-#define SE_KOUKA_L 12
-#define SE_KOUKA_M 13
-#define SE_KOUKA_H 14
-#define SE_BOWA2 15
-#define SE_POKE_DEAD 16
-#define SE_NIGERU 17
-#define SE_JIDO_DOA 18
-#define SE_NAMINORI 19
-#define SE_BAN 20
-#define SE_PIN 21
-#define SE_BOO 22
-#define SE_BOWA 23
-#define SE_JYUNI 24
-#define SE_A 25
-#define SE_I 26
-#define SE_U 27
-#define SE_E 28
-#define SE_O 29
-#define SE_N 30
-#define SE_SEIKAI 31
-#define SE_HAZURE 32
-#define SE_EXP 33
-#define SE_JITE_PYOKO 34
+#define SE_KAIFUKU 1 // Healing Item
+#define SE_PC_LOGON 2 // PC Logon
+#define SE_PC_OFF 3 // PC Shutdown
+#define SE_PC_ON 4 // PC Startup
+#define SE_SELECT 5 // Cursor Selection
+#define SE_WIN_OPEN 6 // Start Menu
+#define SE_WALL_HIT 7 // Wall Bump
+#define SE_DOOR 8 // Opening Door
+#define SE_KAIDAN 9 // Stairs
+#define SE_DANSA 10 // Ledge
+#define SE_JITENSYA 11 // Bicycle Bell
+#define SE_KOUKA_L 12 // Not Very Effective
+#define SE_KOUKA_M 13 // Normal Effectiveness
+#define SE_KOUKA_H 14 // Super Effective
+#define SE_BOWA2 15 // Pokémon Withdrawl
+#define SE_POKE_DEAD 16 // Pokémon Fainted
+#define SE_NIGERU 17 // Flee from Wild Battle
+#define SE_JIDO_DOA 18 // Pokémon Center Door
+#define SE_NAMINORI 19 // Briney's Ship
+#define SE_BAN 20 // Bang
+#define SE_PIN 21 // Exclamation Bubble
+#define SE_BOO 22 // Contest Jam
+#define SE_BOWA 23 // Giving Poké Ball to Nurse, Poké Ball Wiggle
+#define SE_JYUNI 24 // Places in Contest Appearing
+#define SE_A 25 // Bard A
+#define SE_I 26 // Bard I
+#define SE_U 27 // Bard U
+#define SE_E 28 // Bard E
+#define SE_O 29 // Bard O
+#define SE_N 30 // Bard N
+#define SE_SEIKAI 31 // Success
+#define SE_HAZURE 32 // Failure
+#define SE_EXP 33 // Exp. Bar
+#define SE_JITE_PYOKO 34 // Bunny Hop
#define SE_MU_PACHI 35
-#define SE_TK_KASYA 36
+#define SE_TK_KASYA 36 // Mossdeep Gym/Trick House Switch
#define SE_FU_ZAKU 37
#define SE_FU_ZAKU2 38
-#define SE_FU_ZUZUZU 39
-#define SE_RU_GASHIN 40
-#define SE_RU_GASYAN 41
-#define SE_RU_BARI 42
-#define SE_RU_HYUU 43
+#define SE_FU_ZUZUZU 39 // Lavaridge Gym Warp
+#define SE_RU_GASHIN 40 // Sootopolis Gym - Stairs Appear
+#define SE_RU_GASYAN 41 // Sootopolis Gym - Ice Breaking
+#define SE_RU_BARI 42 // Sootopolis Gym - Stepping on Ice
+#define SE_RU_HYUU 43 // Falling Down
#define SE_KI_GASYAN 44
-#define SE_TK_WARPIN 45
-#define SE_TK_WARPOUT 46
-#define SE_TU_SAA 47
-#define SE_HI_TURUN 48
-#define SE_TRACK_MOVE 49
-#define SE_TRACK_STOP 50
-#define SE_TRACK_HAIK 51
-#define SE_TRACK_DOOR 52
+#define SE_TK_WARPIN 45 // Warp In
+#define SE_TK_WARPOUT 46 // Warp Out
+#define SE_TU_SAA 47 // Repel
+#define SE_HI_TURUN 48 // Moving Obstacle in Fortree Gym
+#define SE_TRACK_MOVE 49 // Moving Truck
+#define SE_TRACK_STOP 50 // Moving Truck Stop
+#define SE_TRACK_HAIK 51 // Moving Truck Unload
+#define SE_TRACK_DOOR 52 // Moving Truck Door
#define SE_MOTER 53
#define SE_CARD 54
-#define SE_SAVE 55
-#define SE_KON 56
-#define SE_KON2 57
-#define SE_KON3 58
-#define SE_KON4 59
-#define SE_SUIKOMU 60
-#define SE_NAGERU 61
-#define SE_TOY_C 62
-#define SE_TOY_D 63
-#define SE_TOY_E 64
-#define SE_TOY_F 65
-#define SE_TOY_G 66
-#define SE_TOY_A 67
-#define SE_TOY_B 68
-#define SE_TOY_C1 69
-#define SE_MIZU 70
-#define SE_HASHI 71
-#define SE_DAUGI 72
-#define SE_PINPON 73
-#define SE_FUUSEN1 74
-#define SE_FUUSEN2 75
-#define SE_FUUSEN3 76
-#define SE_TOY_KABE 77
-#define SE_TOY_DANGO 78
-#define SE_DOKU 79
-#define SE_ESUKA 80
-#define SE_T_AME 81
-#define SE_T_AME_E 82
-#define SE_T_OOAME 83
-#define SE_T_OOAME_E 84
-#define SE_T_KOAME 85
-#define SE_T_KOAME_E 86
-#define SE_T_KAMI 87
-#define SE_T_KAMI2 88
-#define SE_ELEBETA 89
-#define SE_HINSI 90
-#define SE_EXPMAX 91
-#define SE_TAMAKORO 92
-#define SE_TAMAKORO_E 93
+#define SE_SAVE 55 // Save
+#define SE_KON 56 // Poké Ball Bounce 1
+#define SE_KON2 57 // Poké Ball Bounce 2
+#define SE_KON3 58 // Poké Ball Bounce 3
+#define SE_KON4 59 // Poké Ball Bounce 4
+#define SE_SUIKOMU 60 // Poké Ball Trade
+#define SE_NAGERU 61 // Poké Ball Throw
+#define SE_TOY_C 62 // Note C
+#define SE_TOY_D 63 // Note D
+#define SE_TOY_E 64 // Note E
+#define SE_TOY_F 65 // Note F
+#define SE_TOY_G 66 // Note G
+#define SE_TOY_A 67 // Note A
+#define SE_TOY_B 68 // Note B
+#define SE_TOY_C1 69 // Note High C
+#define SE_MIZU 70 // Puddle
+#define SE_HASHI 71 // Boardwalk
+#define SE_DAUGI 72 // Slots Credits
+#define SE_PINPON 73 // Ding-dong!
+#define SE_FUUSEN1 74 // Red Balloon
+#define SE_FUUSEN2 75 // Blue Balloon
+#define SE_FUUSEN3 76 // Yellow Balloon
+#define SE_TOY_KABE 77 // Breakable Door
+#define SE_TOY_DANGO 78 // Mud Ball
+#define SE_DOKU 79 // Overworld Poison Damage
+#define SE_ESUKA 80 // Escalator
+#define SE_T_AME 81 // Rain
+#define SE_T_AME_E 82 // Rain stop
+#define SE_T_OOAME 83 // Heavy Rain
+#define SE_T_OOAME_E 84 // Heavy Rain Stop
+#define SE_T_KOAME 85 // Light Rain
+#define SE_T_KOAME_E 86 // Light Rain Stop
+#define SE_T_KAMI 87 // Thunder
+#define SE_T_KAMI2 88 // Thunder 2
+#define SE_ELEBETA 89 // Elevator
+#define SE_HINSI 90 // Low Health
+#define SE_EXPMAX 91 // Exp. Max
+#define SE_TAMAKORO 92 // Roulette Ball
+#define SE_TAMAKORO_E 93 // Roulette Ball 2
#define SE_BASABASA 94
-#define SE_REGI 95
-#define SE_C_GAJI 96
-#define SE_C_MAKU_U 97
-#define SE_C_MAKU_D 98
+#define SE_REGI 95 // Cash Register
+#define SE_C_GAJI 96 // Contest Hearts
+#define SE_C_MAKU_U 97 // Contest Curtain rise
+#define SE_C_MAKU_D 98 // Contest Curtain fall
#define SE_C_PASI 99
#define SE_C_SYU 100
-#define SE_C_PIKON 101
-#define SE_REAPOKE 102
-#define SE_OP_BASYU 103
-#define SE_BT_START 104
-#define SE_DENDOU 105
-#define SE_JIHANKI 106
-#define SE_TAMA 107
-#define SE_Z_SCROLL 108
-#define SE_Z_PAGE 109
-#define SE_PN_ON 110
-#define SE_PN_OFF 111
-#define SE_Z_SEARCH 112
-#define SE_TAMAGO 113
-#define SE_TB_START 114
-#define SE_TB_KON 115
-#define SE_TB_KARA 116
+#define SE_C_PIKON 101 // Pokémon Appears in Contest
+#define SE_REAPOKE 102 // Shiny Pokémon
+#define SE_OP_BASYU 103 // Opening Movie -> Title Screen whoosh
+#define SE_BT_START 104 // Battle Mugshot whoosh
+#define SE_DENDOU 105 // Audience Cheering
+#define SE_JIHANKI 106 // Vending Machine
+#define SE_TAMA 107 // Orb Used
+#define SE_Z_SCROLL 108 // Pokédex Scrolling
+#define SE_Z_PAGE 109 // Pokédex Page
+#define SE_PN_ON 110 // PokéNav On
+#define SE_PN_OFF 111 // PokéNav Off
+#define SE_Z_SEARCH 112 // Pokédex Search
+#define SE_TAMAGO 113 // Egg hatch
+#define SE_TB_START 114 // Battle - Poké Ball Tray slide in
+#define SE_TB_KON 115 // Battle - Poké Ball Tray ball sound
+#define SE_TB_KARA 116 // Battle - Poké Ball Tray slide out
#define SE_BIDORO 117
-#define SE_W085 118
-#define SE_W085B 119
-#define SE_W231 120
-#define SE_W171 121
-#define SE_W233 122
-#define SE_W233B 123
-#define SE_W145 124
-#define SE_W145B 125
-#define SE_W145C 126
-#define SE_W240 127
-#define SE_W015 128
-#define SE_W081 129
-#define SE_W081B 130
-#define SE_W088 131
-#define SE_W016 132
-#define SE_W016B 133
-#define SE_W003 134
-#define SE_W104 135
-#define SE_W013 136
-#define SE_W196 137
-#define SE_W086 138
-#define SE_W004 139
-#define SE_W025 140
-#define SE_W025B 141
-#define SE_W152 142
-#define SE_W026 143
-#define SE_W172 144
-#define SE_W172B 145
-#define SE_W053 146
-#define SE_W007 147
-#define SE_W092 148
-#define SE_W221 149
-#define SE_W221B 150
-#define SE_W052 151
-#define SE_W036 152
-#define SE_W059 153
-#define SE_W059B 154
-#define SE_W010 155
-#define SE_W011 156
-#define SE_W017 157
-#define SE_W019 158
-#define SE_W028 159
-#define SE_W013B 160
-#define SE_W044 161
-#define SE_W029 162
-#define SE_W057 163
-#define SE_W056 164
-#define SE_W250 165
-#define SE_W030 166
-#define SE_W039 167
-#define SE_W054 168
-#define SE_W077 169
-#define SE_W020 170
-#define SE_W082 171
-#define SE_W047 172
-#define SE_W195 173
-#define SE_W006 174
-#define SE_W091 175
-#define SE_W146 176
-#define SE_W120 177
-#define SE_W153 178
-#define SE_W071B 179
-#define SE_W071 180
-#define SE_W103 181
-#define SE_W062 182
-#define SE_W062B 183
-#define SE_W048 184
-#define SE_W187 185
-#define SE_W118 186
-#define SE_W155 187
-#define SE_W122 188
-#define SE_W060 189
-#define SE_W185 190
-#define SE_W014 191
-#define SE_W043 192
-#define SE_W207 193
-#define SE_W207B 194
-#define SE_W215 195
-#define SE_W109 196
-#define SE_W173 197
-#define SE_W280 198
-#define SE_W202 199
-#define SE_W060B 200
-#define SE_W076 201
-#define SE_W080 202
-#define SE_W100 203
-#define SE_W107 204
-#define SE_W166 205
-#define SE_W129 206
-#define SE_W115 207
-#define SE_W112 208
-#define SE_W197 209
-#define SE_W199 210
-#define SE_W236 211
-#define SE_W204 212
-#define SE_W268 213
-#define SE_W070 214
-#define SE_W063 215
-#define SE_W127 216
-#define SE_W179 217
-#define SE_W151 218
-#define SE_W201 219
-#define SE_W161 220
-#define SE_W161B 221
-#define SE_W227 222
-#define SE_W227B 223
-#define SE_W226 224
-#define SE_W208 225
-#define SE_W213 226
-#define SE_W213B 227
-#define SE_W234 228
-#define SE_W260 229
-#define SE_W328 230
-#define SE_W320 231
-#define SE_W255 232
-#define SE_W291 233
-#define SE_W089 234
-#define SE_W239 235
-#define SE_W230 236
-#define SE_W281 237
-#define SE_W327 238
-#define SE_W287 239
-#define SE_W257 240
-#define SE_W253 241
-#define SE_W258 242
-#define SE_W322 243
-#define SE_W298 244
-#define SE_W287B 245
-#define SE_W114 246
-#define SE_W063B 247
+#define SE_W085 118 // Thunderbolt
+#define SE_W085B 119 // Thunderbolt 2
+#define SE_W231 120 // Harden
+#define SE_W171 121 // Nightmare
+#define SE_W233 122 // Vital Throw
+#define SE_W233B 123 // Vital Throw 2
+#define SE_W145 124 // Bubble
+#define SE_W145B 125 // Bubble 2
+#define SE_W145C 126 // Bubble 3
+#define SE_W240 127 // Rain Dance
+#define SE_W015 128 // Cut
+#define SE_W081 129 // String Shot
+#define SE_W081B 130 // String Shot 2
+#define SE_W088 131 // Rock Throw
+#define SE_W016 132 // Gust
+#define SE_W016B 133 // Gust 2
+#define SE_W003 134 // DoubleSlap
+#define SE_W104 135 // Double Team
+#define SE_W013 136 // Razor Wind
+#define SE_W196 137 // Icy Wind
+#define SE_W086 138 // Thunder Wave
+#define SE_W004 139 // Comet Punch
+#define SE_W025 140 // Mega Kick
+#define SE_W025B 141 // Mega Kick 2
+#define SE_W152 142 // Crabhammer
+#define SE_W026 143 // Jump Kick
+#define SE_W172 144 // Flame Wheel
+#define SE_W172B 145 // Flame Wheel 2
+#define SE_W053 146 // Flamethrower
+#define SE_W007 147 // Fire Punch
+#define SE_W092 148 // Toxic
+#define SE_W221 149 // Sacred Fire
+#define SE_W221B 150 // Sacred Fire 2
+#define SE_W052 151 // Ember
+#define SE_W036 152 // Take Down
+#define SE_W059 153 // Blizzard
+#define SE_W059B 154 // Blizzard 2
+#define SE_W010 155 // Scratch
+#define SE_W011 156 // Vicegrip
+#define SE_W017 157 // Wing Attack
+#define SE_W019 158 // Fly
+#define SE_W028 159 // Sand-Attack
+#define SE_W013B 160 // Razor Wind 2
+#define SE_W044 161 // Bite
+#define SE_W029 162 // Headbutt
+#define SE_W057 163 // Surf
+#define SE_W056 164 // Hydro Pump
+#define SE_W250 165 // Whirlpool
+#define SE_W030 166 // Horn Attack
+#define SE_W039 167 // Tail Whip
+#define SE_W054 168 // Mist
+#define SE_W077 169 // PoisonPowder
+#define SE_W020 170 // Bind
+#define SE_W082 171 // Dragon Rage
+#define SE_W047 172 // Sing
+#define SE_W195 173 // Perish Song
+#define SE_W006 174 // Pay Day
+#define SE_W091 175 // Dig
+#define SE_W146 176 // Dizzy Punch
+#define SE_W120 177 // Self-Destruct
+#define SE_W153 178 // Explosion
+#define SE_W071B 179 // Absorb 2
+#define SE_W071 180 // Absorb
+#define SE_W103 181 // Screech
+#define SE_W062 182 // BubbleBeam
+#define SE_W062B 183 // BubbleBeam 2
+#define SE_W048 184 // Supersonic
+#define SE_W187 185 // Belly Drum
+#define SE_W118 186 // Metronome
+#define SE_W155 187 // Bonemerang
+#define SE_W122 188 // Lick
+#define SE_W060 189 // Psybeam
+#define SE_W185 190 // Faint Attack
+#define SE_W014 191 // Swords Dance
+#define SE_W043 192 // Leer
+#define SE_W207 193 // Swagger
+#define SE_W207B 194 // Swagger 2
+#define SE_W215 195 // Heal Bell
+#define SE_W109 196 // Confuse Ray
+#define SE_W173 197 // Snore
+#define SE_W280 198 // Brick Break
+#define SE_W202 199 // Giga Drain
+#define SE_W060B 200 // Psybeam 2
+#define SE_W076 201 // SolarBeam
+#define SE_W080 202 // Petal Dance
+#define SE_W100 203 // Teleport
+#define SE_W107 204 // Minimize
+#define SE_W166 205 // Sketch
+#define SE_W129 206 // Swift
+#define SE_W115 207 // Reflect
+#define SE_W112 208 // Barrier
+#define SE_W197 209 // Detect
+#define SE_W199 210 // Lock-On
+#define SE_W236 211 // Moonlight
+#define SE_W204 212 // Charm
+#define SE_W268 213 // Charge
+#define SE_W070 214 // Strength
+#define SE_W063 215 // Hyper Beam
+#define SE_W127 216 // Waterfall
+#define SE_W179 217 // Reversal
+#define SE_W151 218 // Acid Armor
+#define SE_W201 219 // Sandstorm
+#define SE_W161 220 // Tri-Attack
+#define SE_W161B 221 // Tri-Attack 2
+#define SE_W227 222 // Encore
+#define SE_W227B 223 // Encore 2
+#define SE_W226 224 // Baton Pass
+#define SE_W208 225 // Milk Drink
+#define SE_W213 226 // Attract
+#define SE_W213B 227 // Attract 2
+#define SE_W234 228 // Morning Sun
+#define SE_W260 229 // Flatter
+#define SE_W328 230 // Sand Tomb
+#define SE_W320 231 // GrassWhistle
+#define SE_W255 232 // Spit Up
+#define SE_W291 233 // Dive
+#define SE_W089 234 // Earthquake
+#define SE_W239 235 // Twister
+#define SE_W230 236 // Sweet Scent
+#define SE_W281 237 // Yawn
+#define SE_W327 238 // Sky Uppercut
+#define SE_W287 239 // Stat Increased
+#define SE_W257 240 // Heat Wave
+#define SE_W253 241 // Uproar
+#define SE_W258 242 // Hail
+#define SE_W322 243 // Cosmic Power
+#define SE_W298 244 // Teeter Dance
+#define SE_W287B 245 // Stat Decreased
+#define SE_W114 246 // Haze
+#define SE_W063B 247 // Hyper Beam 2
#define BGM_STOP 349
-#define BGM_TETSUJI 350
-#define BGM_FIELD13 351
-#define BGM_KACHI22 352
-#define BGM_KACHI2 353
-#define BGM_KACHI3 354
-#define BGM_KACHI5 355
-#define BGM_PCC 356
-#define BGM_NIBI 357
-#define BGM_SUIKUN 358
-#define BGM_DOORO1 359
-#define BGM_DOORO_X1 360
-#define BGM_DOORO_X3 361
-#define BGM_MACHI_S2 362
-#define BGM_MACHI_S4 363
-#define BGM_GIM 364
-#define BGM_NAMINORI 365
-#define BGM_DAN01 366
-#define BGM_FANFA1 367
-#define BGM_ME_ASA 368
-#define BGM_ME_BACHI 369
-#define BGM_FANFA4 370
-#define BGM_FANFA5 371
-#define BGM_ME_WAZA 372
-#define BGM_BIJYUTU 373
-#define BGM_DOORO_X4 374
-#define BGM_FUNE_KAN 375
-#define BGM_ME_SHINKA 376
-#define BGM_SHINKA 377
-#define BGM_ME_WASURE 378
-#define BGM_SYOUJOEYE 379
-#define BGM_BOYEYE 380
-#define BGM_DAN02 381
-#define BGM_MACHI_S3 382
-#define BGM_ODAMAKI 383
-#define BGM_B_TOWER 384
-#define BGM_SWIMEYE 385
-#define BGM_DAN03 386
-#define BGM_ME_KINOMI 387
-#define BGM_ME_TAMA 388
-#define BGM_ME_B_BIG 389
-#define BGM_ME_B_SMALL 390
-#define BGM_ME_ZANNEN 391
-#define BGM_BD_TIME 392
-#define BGM_TEST1 393
-#define BGM_TEST2 394
-#define BGM_TEST3 395
-#define BGM_TEST4 396
-#define BGM_TEST 397
-#define BGM_GOMACHI0 398
-#define BGM_GOTOWN 399
-#define BGM_POKECEN 400
-#define BGM_NEXTROAD 401
-#define BGM_GRANROAD 402
-#define BGM_CYCLING 403
-#define BGM_FRIENDLY 404
-#define BGM_MISHIRO 405
-#define BGM_TOZAN 406
-#define BGM_GIRLEYE 407
-#define BGM_MINAMO 408
-#define BGM_ASHROAD 409
-#define BGM_EVENT0 410
-#define BGM_DEEPDEEP 411
-#define BGM_KACHI1 412
-#define BGM_TITLE3 413
-#define BGM_DEMO1 414
-#define BGM_GIRL_SUP 415
-#define BGM_HAGESHII 416
-#define BGM_KAKKOII 417
-#define BGM_KAZANBAI 418
-#define BGM_AQA_0 419
-#define BGM_TSURETEK 420
-#define BGM_BOY_SUP 421
-#define BGM_RAINBOW 422
-#define BGM_AYASII 423
-#define BGM_KACHI4 424
-#define BGM_ROPEWAY 425
-#define BGM_CASINO 426
-#define BGM_HIGHTOWN 427
-#define BGM_SAFARI 428
-#define BGM_C_ROAD 429
-#define BGM_AJITO 430
-#define BGM_M_BOAT 431
-#define BGM_M_DUNGON 432
-#define BGM_FINECITY 433
-#define BGM_MACHUPI 434
-#define BGM_P_SCHOOL 435
-#define BGM_DENDOU 436
-#define BGM_TONEKUSA 437
-#define BGM_MABOROSI 438
-#define BGM_CON_FAN 439
-#define BGM_CONTEST0 440
-#define BGM_MGM0 441
-#define BGM_T_BATTLE 442
-#define BGM_OOAME 443
-#define BGM_HIDERI 444
-#define BGM_RUNECITY 445
-#define BGM_CON_K 446
-#define BGM_EIKOU_R 447
-#define BGM_KARAKURI 448
-#define BGM_HUTAGO 449
-#define BGM_SITENNOU 450
-#define BGM_YAMA_EYE 451
-#define BGM_CONLOBBY 452
-#define BGM_INTER_V 453
-#define BGM_DAIGO 454
-#define BGM_THANKFOR 455
-#define BGM_END 456
-#define BGM_BATTLE27 457
-#define BGM_BATTLE31 458
-#define BGM_BATTLE20 459
-#define BGM_BATTLE32 460
-#define BGM_BATTLE33 461
-#define BGM_BATTLE36 462
-#define BGM_BATTLE34 463
-#define BGM_BATTLE35 464
-#define BGM_BATTLE38 465
-#define BGM_BATTLE30 466
+#define BGM_TETSUJI 350 // Littleroot Town Test 'TETSUJI'
+#define BGM_FIELD13 351 // GSC - Route 38
+#define BGM_KACHI22 352 // Wild Pokémon Defeated
+#define BGM_KACHI2 353 // Wild Pokémon Defeated with Intro
+#define BGM_KACHI3 354 // Gym Leader Defeated
+#define BGM_KACHI5 355 // Victory! Elite Four
+#define BGM_PCC 356 // Crystal - Pokémon Communication Center
+#define BGM_NIBI 357 // GSC - Viridian/Saffron/Pewter/etc
+#define BGM_SUIKUN 358 // Crystal - Battle! Legendary Beasts
+#define BGM_DOORO1 359 // Route 101
+#define BGM_DOORO_X1 360 // Route 110
+#define BGM_DOORO_X3 361 // Route 120
+#define BGM_MACHI_S2 362 // Petalburg City
+#define BGM_MACHI_S4 363 // Oldale Town
+#define BGM_GIM 364 // Gym
+#define BGM_NAMINORI 365 // Surfing
+#define BGM_DAN01 366 // Caves and Darkness
+#define BGM_FANFA1 367 // Level Up!
+#define BGM_ME_ASA 368 // Pokémon Healed
+#define BGM_ME_BACHI 369 // Obtained a Badge!
+#define BGM_FANFA4 370 // Obtained an Item!
+#define BGM_FANFA5 371 // Your Pokémon Just Evolved!
+#define BGM_ME_WAZA 372 // Obtained a TM/HM!
+#define BGM_BIJYUTU 373 // Lilycove Musseum
+#define BGM_DOORO_X4 374 // Route 122/Intro
+#define BGM_FUNE_KAN 375 // Slateport Museum
+#define BGM_ME_SHINKA 376 // Evolution Intro
+#define BGM_SHINKA 377 // Evolution
+#define BGM_ME_WASURE 378 // Move Deleted
+#define BGM_SYOUJOEYE 379 // Encounter! Tuber
+#define BGM_BOYEYE 380 // Encounter! Boy
+#define BGM_DAN02 381 // Abandoned Ship
+#define BGM_MACHI_S3 382 // Fortree City
+#define BGM_ODAMAKI 383 // Professor Birch's Lab
+#define BGM_B_TOWER 384 // Battle Tower (RS)
+#define BGM_SWIMEYE 385 // Encounter! Swimmer
+#define BGM_DAN03 386 // Meteor Falls
+#define BGM_ME_KINOMI 387 // Obtained a Berry!
+#define BGM_ME_TAMA 388 // Awakening the Super-Ancient Pokémon
+#define BGM_ME_B_BIG 389 // Slots Jackpot!
+#define BGM_ME_B_SMALL 390 // Slots Victory!
+#define BGM_ME_ZANNEN 391 // Too bad!
+#define BGM_BD_TIME 392 // Roulette!
+#define BGM_TEST1 393 // Contest Test 1
+#define BGM_TEST2 394 // Contest Test 2
+#define BGM_TEST3 395 // Contest Test 3
+#define BGM_TEST4 396 // Contest Test 4
+#define BGM_TEST 397 // Encounter! Gentleman (Test?)
+#define BGM_GOMACHI0 398 // Verdanturf Town
+#define BGM_GOTOWN 399 // Rustboro City
+#define BGM_POKECEN 400 // Pokémon Center
+#define BGM_NEXTROAD 401 // Route 104
+#define BGM_GRANROAD 402 // Route 119
+#define BGM_CYCLING 403 // Cycling
+#define BGM_FRIENDLY 404 // Pokémart
+#define BGM_MISHIRO 405 // Littleroot Town
+#define BGM_TOZAN 406 // Sky Pillar
+#define BGM_GIRLEYE 407 // Encounter! Girl
+#define BGM_MINAMO 408 // Lilycove City
+#define BGM_ASHROAD 409 // Route 111
+#define BGM_EVENT0 410 // Help me!
+#define BGM_DEEPDEEP 411 // Underwater
+#define BGM_KACHI1 412 // Victory! Trainer
+#define BGM_TITLE3 413 // Title Screen
+#define BGM_DEMO1 414 // Opening Movie
+#define BGM_GIRL_SUP 415 // Encounter! May
+#define BGM_HAGESHII 416 // Encounter! Biker
+#define BGM_KAKKOII 417 // Encounter! Electric Trainer
+#define BGM_KAZANBAI 418 // Route 113
+#define BGM_AQA_0 419 // Encounter! Team Aqua
+#define BGM_TSURETEK 420 // Follow Me!
+#define BGM_BOY_SUP 421 // Encounter! Brendan
+#define BGM_RAINBOW 422 // Ever Grande City
+#define BGM_AYASII 423 // Encounter! Psychic
+#define BGM_KACHI4 424 // Victory! Aqua/Magma Grunt
+#define BGM_ROPEWAY 425 // Cable Car
+#define BGM_CASINO 426 // Game Corner
+#define BGM_HIGHTOWN 427 // Dewford Town
+#define BGM_SAFARI 428 // Safari Zone
+#define BGM_C_ROAD 429 // Victory Toad
+#define BGM_AJITO 430 // Aqua/Magma Hideout
+#define BGM_M_BOAT 431 // Sailing
+#define BGM_M_DUNGON 432 // Mt. Pyre (Inside)
+#define BGM_FINECITY 433 // Slateport City
+#define BGM_MACHUPI 434 // Mt. Pyre (Outside)
+#define BGM_P_SCHOOL 435 // Pokémon Trainer's School
+#define BGM_DENDOU 436 // Hall of Fame
+#define BGM_TONEKUSA 437 // Lavaridge Town
+#define BGM_MABOROSI 438 // Sealed Chamber
+#define BGM_CON_FAN 439 // You are the Champion!
+#define BGM_CONTEST0 440 // Pokémon Contest
+#define BGM_MGM0 441 // Encounter! Team Magma
+#define BGM_T_BATTLE 442 // Opening Battle
+#define BGM_OOAME 443 // The Flood
+#define BGM_HIDERI 444 // The Drought
+#define BGM_RUNECITY 445 // Sootopolis City
+#define BGM_CON_K 446 // Berry Blending Results
+#define BGM_EIKOU_R 447 // Hall of Fame
+#define BGM_KARAKURI 448 // Trick House
+#define BGM_HUTAGO 449 // Encounter! Kid
+#define BGM_SITENNOU 450 // Encounter! Elite Four
+#define BGM_YAMA_EYE 451 // Encounter! Hiker
+#define BGM_CONLOBBY 452 // Contest Lobby
+#define BGM_INTER_V 453 // Encounter! Gabby and Ty
+#define BGM_DAIGO 454 // Encounter! Wallace
+#define BGM_THANKFOR 455 // Credits
+#define BGM_END 456 // The End
+#define BGM_BATTLE27 457 // Battle! Wild Pokémon
+#define BGM_BATTLE31 458 // Battle! Team Aqua/Magma
+#define BGM_BATTLE20 459 // Battle! Trainer
+#define BGM_BATTLE32 460 // Battle! Gym Leader
+#define BGM_BATTLE33 461 // Battle! Champion
+#define BGM_BATTLE36 462 // Battle! Regi Trio
+#define BGM_BATTLE34 463 // Battle! Legendary Pokémon
+#define BGM_BATTLE35 464 // Battle! Rival
+#define BGM_BATTLE38 465 // Battle! Elite Four
+#define BGM_BATTLE30 466 // Battle! Archie/Maxie
#define BGM_ROUTE_118 0x7FFF // What is this for?
diff --git a/include/constants/weather.h b/include/constants/weather.h
index 946316984..1110be7a2 100644
--- a/include/constants/weather.h
+++ b/include/constants/weather.h
@@ -12,7 +12,7 @@
#define WEATHER_SANDSTORM 8
#define WEATHER_FOG_2 9
#define WEATHER_FOG_3 10
-#define WEATHER_DARK 11
+#define WEATHER_SHADE 11
#define WEATHER_DROUGHT 12
#define WEATHER_RAIN_HEAVY 13
#define WEATHER_BUBBLES 14
@@ -31,7 +31,7 @@
#define COORD_EVENT_WEATHER_FOG_2 7
#define COORD_EVENT_WEATHER_ASH 8
#define COORD_EVENT_WEATHER_SANDSTORM 9
-#define COORD_EVENT_WEATHER_DARK 10
+#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
diff --git a/include/contest_ai.h b/include/contest_ai.h
index da143b541..da143b541 100755..100644
--- a/include/contest_ai.h
+++ b/include/contest_ai.h
diff --git a/include/decoration.h b/include/decoration.h
index 4ac26998e..d7f26bd05 100644
--- a/include/decoration.h
+++ b/include/decoration.h
@@ -146,7 +146,6 @@ extern const struct YesNoFuncTable gUnknown_083EC634[];
extern const u8 gUnknown_083EC65A[];
extern const u8 gUnknown_083EC97C[];
extern const u8 gUnknown_083EC984[];
-extern void sub_80B3068(u8); // src/shop
extern const struct YesNoFuncTable gUnknown_083EC95C;
extern const struct YesNoFuncTable gUnknown_083EC964;
extern const struct YesNoFuncTable gUnknown_083EC9CC;
diff --git a/include/easy_chat.h b/include/easy_chat.h
index c68a3fa02..58750fa92 100644
--- a/include/easy_chat.h
+++ b/include/easy_chat.h
@@ -114,8 +114,6 @@ struct Shared1000
u8 unk9F8E[7]; // unknown length
};
-extern u8 gUnknown_020388AC;
-
// const pointer to shared1000. easy_chat might be two separate files.
extern struct Shared1000 *const gEasyChatStruct;
diff --git a/include/ewram.h b/include/ewram.h
index 23812cc4f..ba376440e 100755..100644
--- a/include/ewram.h
+++ b/include/ewram.h
@@ -8,8 +8,8 @@ extern u8 gSharedMem[];
// regions overlap others but have different definitions. Until some
// dupes can be determined to be the same, they will be deliberate
// seperated.
-#define eWeatherPaletteData (*(struct WeatherPaletteData *)gSharedMem)
-#define BATTLE_STRUCT ((struct BattleStruct *) (gSharedMem + 0x0))
+#define eDroughtPaletteData (*(struct WeatherPaletteData *)gSharedMem)
+#define gBattleStruct ((struct BattleStruct *) (gSharedMem + 0x0))
#define ewram0_2 (*(struct Struct2000000 *)(gSharedMem + 0x0))
#define namingScreenData (*(struct NamingScreenData *)(gSharedMem + 0x0))
#define ewramBerryPic (gSharedMem + 0x0)
diff --git a/include/field_effect.h b/include/field_effect.h
index bb859074f..4d0e90767 100644
--- a/include/field_effect.h
+++ b/include/field_effect.h
@@ -103,7 +103,6 @@ void FieldEffectActiveListClear(void);
void FieldEffectActiveListAdd(u8 id);
void FieldEffectActiveListRemove(u8 id);
bool8 FieldEffectActiveListContains(u8 id);
-void sub_807DE38(u8 index);
void SpriteCB_PokeballGlow(struct Sprite *);
void SpriteCB_PokecenterMonitor(struct Sprite *);
diff --git a/include/field_weather.h b/include/field_weather.h
index 267650a2a..0bdebf747 100644
--- a/include/field_weather.h
+++ b/include/field_weather.h
@@ -1,7 +1,15 @@
#ifndef GUARD_WEATHER_H
#define GUARD_WEATHER_H
-struct Sprite;
+#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
{
@@ -23,21 +31,17 @@ struct Weather
struct Sprite *sandstormSprites2[5];
} s2;
} sprites;
- u8 unknown_200[2][32];
- u8 filler_240[0x460-0x240];
- u8 unk460[2][32];
- u8 filler4A0[0x6B6-0x4A0];
- s8 unknown_6B6;
- u8 filler_6B7[0xC0-0xB7];
- s8 unknown_6C0;
- s8 unknown_6C1;
- u8 unknown_6C2;
- u8 unknown_6C3;
- u16 unknown_6C4;
- u8 unknown_6C6;
- u8 unknown_6C7;
- u8 unknown_6C8;
- u8 unknown_6C9;
+ 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;
@@ -45,9 +49,9 @@ struct Weather
u8 currWeather;
u8 nextWeather;
u8 weatherGfxLoaded;
- u8 unknown_6D3;
- u8 unknown_6D4;
- u8 unknown_6D5;
+ bool8 weatherChangeComplete;
+ u8 weatherPicSpritePalIndex;
+ u8 altGammaSpritePalIndex;
u16 unknown_6D6;
u8 unknown_6D8;
u8 unknown_6D9;
@@ -70,8 +74,8 @@ struct Weather
u16 fog1ScrollPosX;
u16 unknown_6F0;
u16 unknown_6F2;
- u8 unknown_6F4[6];
- u8 unknown_6FA;
+ u8 lightenedFogSpritePals[6];
+ u8 lightenedFogSpritePalsCount;
u8 fog1SpritesCreated;
u16 unknown_6FC;
u16 unknown_6FE;
@@ -104,8 +108,8 @@ struct Weather
u16 currBlendEVB;
u16 targetBlendEVA;
u16 targetBlendEVB;
- u8 unknown_738;
- u8 unknown_739;
+ u8 blendUpdateCounter;
+ u8 blendFrameCounter;
u8 blendDelay;
u8 filler_73B[0x3C-0x3B];
s16 unknown_73C;
@@ -113,42 +117,35 @@ struct Weather
s16 unknown_740;
s16 unknown_742;
u8 filler_744[0xD-4];
- s8 unknown_74D;
- u8 unknown_74E;
+ s8 loadDroughtPalsIndex;
+ u8 loadDroughtPalsOffset;
};
void StartWeather(void);
-void DoWeatherEffect(u8 effect);
+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 sub_807CB10(void);
-void sub_807CC24(void);
-void sub_807CCAC(void);
-u8 sub_807CDC4(void);
-u8 sub_807CE24(void);
-u8 sub_807CE7C(void);
-void nullsub_39(void);
+void SetWeatherScreenFadeOut(void);
-// ASM
-void sub_807CEBC(u8, u8, s8);
-//void sub_807D1BC(u8, u8, u8, u8, u16);
-void sub_807D1BC(u8 a, u8 a2, s8 c, u8 d, u16 e);
-void sub_807D304(s8 a, u8 arg2, u16 c);
-void sub_807D424(u8, u16);
-// ...
-void fade_screen(u8, u8);
+enum
+{
+ FADE_FROM_BLACK,
+ FADE_TO_BLACK,
+ FADE_FROM_WHITE,
+ FADE_TO_WHITE,
+};
+
+void FadeScreen(u8, u8);
// ...
-void sub_807D78C(u8 tag);
-void sub_807D874(u8);
+void UpdateSpritePaletteWithWeather(u8 tag);
+void ApplyWeatherGammaShiftToPal(u8);
// ...
void Weather_SetBlendCoeffs(u8, u8);
// ...
-void sub_807DE68(void);
-// ...
void PlayRainSoundEffect(void);
// ...
void SetSav1Weather(u32);
@@ -158,10 +155,18 @@ void SetSav1WeatherFromCurrMapHeader(void);
void DoCurrentWeather(void);
void sub_8080750();
-bool8 sub_807D770(void);
-bool8 sub_807DDFC(void);
+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;
diff --git a/include/gba/isagbprint.h b/include/gba/isagbprint.h
index c5eb456c3..c5eb456c3 100755..100644
--- a/include/gba/isagbprint.h
+++ b/include/gba/isagbprint.h
diff --git a/include/gba/macro.h b/include/gba/macro.h
index 59b22758e..ab42c9da3 100644
--- a/include/gba/macro.h
+++ b/include/gba/macro.h
@@ -167,4 +167,57 @@
#define DmaFill16Defvars(dmaNum, fillval, dest, size) DmaFillDefvars(dmaNum, fillval, dest, size, 16)
#define DmaFill32Defvars(dmaNum, fillval, dest, size) DmaFillDefvars(dmaNum, fillval, dest, size, 32)
+// from pokeemerald
+// Maximum amount of data we will transfer in one operation
+#define MAX_DMA_BLOCK_SIZE 0x1000
+
+#define MAX_DMA_REQUESTS 128
+
+#define DMA_REQUEST_COPY32 1
+#define DMA_REQUEST_FILL32 2
+#define DMA_REQUEST_COPY16 3
+#define DMA_REQUEST_FILL16 4
+
+#define Dma3CopyLarge_(src, dest, size, bit) \
+{ \
+ const void *_src = src; \
+ void *_dest = dest; \
+ u32 _size = size; \
+ while (1) \
+ { \
+ if (_size <= MAX_DMA_BLOCK_SIZE) \
+ { \
+ DmaCopy##bit(3, _src, _dest, _size); \
+ break; \
+ } \
+ DmaCopy##bit(3, _src, _dest, MAX_DMA_BLOCK_SIZE); \
+ _src += MAX_DMA_BLOCK_SIZE; \
+ _dest += MAX_DMA_BLOCK_SIZE; \
+ _size -= MAX_DMA_BLOCK_SIZE; \
+ } \
+}
+
+#define Dma3CopyLarge16_(src, dest, size) Dma3CopyLarge_(src, dest, size, 16)
+#define Dma3CopyLarge32_(src, dest, size) Dma3CopyLarge_(src, dest, size, 32)
+
+#define Dma3FillLarge_(value, dest, size, bit) \
+{ \
+ void *_dest = dest; \
+ u32 _size = size; \
+ while (1) \
+ { \
+ if (_size <= MAX_DMA_BLOCK_SIZE) \
+ { \
+ DmaFill##bit(3, value, _dest, _size); \
+ break; \
+ } \
+ DmaFill##bit(3, value, _dest, MAX_DMA_BLOCK_SIZE); \
+ _dest += MAX_DMA_BLOCK_SIZE; \
+ _size -= MAX_DMA_BLOCK_SIZE; \
+ } \
+}
+
+#define Dma3FillLarge16_(value, dest, size) Dma3FillLarge_(value, dest, size, 16)
+#define Dma3FillLarge32_(value, dest, size) Dma3FillLarge_(value, dest, size, 32)
+
#endif // GUARD_GBA_MACRO_H
diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h
index a828cf131..30047c677 100644
--- a/include/global.fieldmap.h
+++ b/include/global.fieldmap.h
@@ -101,8 +101,7 @@ struct WarpEvent
struct CoordEvent
{
s16 x, y;
- u8 unk4;
- u8 filler_5;
+ u8 elevation;
u16 trigger;
u16 index;
u8 filler_A[0x2];
diff --git a/include/item_menu.h b/include/item_menu.h
index 29618f347..726d36789 100644
--- a/include/item_menu.h
+++ b/include/item_menu.h
@@ -27,7 +27,7 @@ void CleanUpItemMenuMessage(u8);
void CleanUpOverworldMessage(u8);
void ExecuteItemUseFromBlackPalette(void);
void sub_80A5D04(void);
-void sub_80A6300(void);
+void ItemMenu_LoadSellMenu(void);
void sub_80A68CC();
void sub_80A6A30(void);
bool32 sub_80A6D1C(void);
diff --git a/include/matsuda_debug_menu.h b/include/matsuda_debug_menu.h
index 60f2dc48c..ad877a014 100644
--- a/include/matsuda_debug_menu.h
+++ b/include/matsuda_debug_menu.h
@@ -3,7 +3,6 @@
#define BIT(n) (1 << (n))
-void sub_80AB184(void);
void sub_80AA280(u8);
void sub_80AA5E8(u8);
void sub_80AA658(u8);
diff --git a/include/menu_helpers.h b/include/menu_helpers.h
index 993d698bd..a1c872c73 100644
--- a/include/menu_helpers.h
+++ b/include/menu_helpers.h
@@ -9,7 +9,22 @@ struct YesNoFuncTable
void (*noFunc)(u8);
};
-void sub_80F9020(void);
+// SetVerticalScrollIndicators enums
+enum
+{
+ TOP_ARROW,
+ BOTTOM_ARROW,
+ LEFT_ARROW, // Bag arrows
+ RIGHT_ARROW
+};
+
+enum
+{
+ VISIBLE,
+ INVISIBLE
+};
+
+void ClearBGTilemapBuffers(void);
void DisplayItemMessageOnField(u8, const u8 *, TaskFunc, u16);
void DoYesNoFuncWithChoice(u8, const struct YesNoFuncTable *);
void sub_80F914C(u8, const struct YesNoFuncTable *);
@@ -19,21 +34,21 @@ bool8 sub_80F92F4(u16);
bool8 sub_80F931C(u16);
bool8 sub_80F9344(void);
void sub_80F9368(void);
-void sub_80F9438(void);
-void sub_80F944C(void);
+void ClearVideoCallbacks(void);
+void ClearVerticalScrollIndicatorPalettes(void);
void sub_80F9480(u8 *, u8);
void sub_80F94A4(u8, u8 *, s16, s16);
void sub_80F94F8(u8 *);
void sub_80F9520(u8 *, u8);
void CreateVerticalScrollIndicators(u8, u16, u16);
-void sub_80F979C(u8, bool8);
+void SetVerticalScrollIndicators(u8, bool8);
void DestroyVerticalScrollIndicator(u8);
void LoadScrollIndicatorPalette(void);
void BuyMenuFreeMemory(void);
-void sub_80F98A4(u8);
+void StopVerticalScrollIndicators(u8);
void StartVerticalScrollIndicators(u8);
void sub_80F98DC(u8);
void PauseVerticalScrollIndicator(u8);
-void sub_80F9988(u8, u8);
+void SetVerticalScrollIndicatorPriority(u8, u8);
#endif // GUARD_MENU_HELPERS_H
diff --git a/include/money.h b/include/money.h
index 9f4ef71bc..e3a3f898d 100644
--- a/include/money.h
+++ b/include/money.h
@@ -7,7 +7,7 @@ void RemoveMoney(u32 *, u32);
void GetMoneyAmountText(u8 *buffer, u32 arg1, u8 arg2);
void PrintMoneyAmount(u32 arg0, u8 arg1, u8 x, u8 y);
void sub_80B7AEC(u32, u8 left, u8 top);
-void sub_80B7B34(u8, u8, int);
+void Draw10000Sprite(u8, u8, int);
void UpdateMoneyWindow(u32, u8, u8);
void OpenMoneyWindow(u32, u8, u8);
void CloseMoneyWindow(u8, u8);
diff --git a/include/pokedex.h b/include/pokedex.h
index d8416889a..73877bead 100644
--- a/include/pokedex.h
+++ b/include/pokedex.h
@@ -23,6 +23,6 @@ s8 GetSetPokedexFlag(u16, u8);
u16 GetNationalPokedexCount(u8);
u16 GetHoennPokedexCount(u8);
bool8 CompletedHoennPokedex(void);
-u16 sub_8090FF4(void);
+bool16 CompletedNationalPokedex(void);
#endif // GUARD_POKEDEX_H
diff --git a/include/pokemon.h b/include/pokemon.h
index 47d6bcfc7..169045c0c 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -258,7 +258,6 @@ struct BoxPokemon
/*0x13*/ u8 isBadEgg:1;
u8 hasSpecies:1;
u8 isEgg:1;
- u8 unused:5;
/*0x14*/ u8 otName[OT_NAME_LENGTH];
/*0x1B*/ u8 markings;
/*0x1C*/ u16 checksum;
@@ -351,6 +350,8 @@ struct BattlePokemon
/*0x54*/ u32 otId;
};
+// Shouldn't these be the same enum?
+
enum
{
STAT_STAGE_HP, // 0
@@ -417,7 +418,6 @@ struct BattleMove
u8 target;
s8 priority;
u8 flags;
- u8 pad[3];
};
#define FLAG_MAKES_CONTACT 0x1
@@ -629,4 +629,6 @@ void PartySpreadPokerus(struct Pokemon *party);
struct Sprite *sub_80F7920(u16, u16, const u16 *);
void BoxMonRestorePP(struct BoxPokemon *);
+bool8 HealStatusConditions(struct Pokemon *mon, u32 unused, u32 healMask, u8 battleId);
+
#endif // GUARD_POKEMON_H
diff --git a/include/pokemon_item_effect.h b/include/pokemon_item_effect.h
index c09649aff..014612b05 100644
--- a/include/pokemon_item_effect.h
+++ b/include/pokemon_item_effect.h
@@ -1,6 +1,6 @@
#ifndef GUARD_POKEMON_ITEM_EFFECT_H
#define GUARD_POKEMON_ITEM_EFFECT_H
-bool8 ExecuteTableBasedItemEffect_(struct Pokemon *mon, u16, u8, u16);
+bool8 ExecuteTableBasedItemEffect_(struct Pokemon *mon, u16, u8, u8);
#endif // GUARD_POKEMON_ITEM_EFFECT_H
diff --git a/include/region_map_sections.h b/include/region_map_sections.h
index a3bd60b59..a3bd60b59 100755..100644
--- a/include/region_map_sections.h
+++ b/include/region_map_sections.h
diff --git a/include/shop.h b/include/shop.h
index b785ca764..80602e26c 100644
--- a/include/shop.h
+++ b/include/shop.h
@@ -17,6 +17,14 @@ enum
ANIM_NUM
};
+// shop options
+enum
+{
+ SHOP_BUY,
+ SHOP_SELL,
+ SHOP_EXIT
+};
+
struct MartInfo
{
/* 0x0 */ void (* callback) (void);
@@ -29,20 +37,9 @@ struct MartInfo
/* 0xD */ u8 curItemCount; // if you are selling an item, this is the count of the current item stack you have.
};
-void sub_80B2E38(u8);
-void HandleShopMenuQuit(u8);
-void sub_80B2FA0(u8);
-void BuyMenuDrawGraphics(void);
-void sub_80B3240(void);
-void sub_80B3270(void);
-void BuyMenuDrawMapGraphics(void);
-void sub_80B3764(int, int);
-void sub_80B37EC(void);
-void sub_80B40E8(u8);
-void CreatePokemartMenu(u16 *);
-void CreateDecorationShop1Menu(u16 *);
-void CreateDecorationShop2Menu(u16 *);
-void sub_80B356C(void);
-void sub_80B368C(void);
+void Shop_CreatePokemartMenu(u16 *);
+void Shop_CreateDecorationShop1Menu(u16 *);
+void Shop_CreateDecorationShop2Menu(u16 *);
+void Shop_RunExitSellMenuTask(u8 taskId);
#endif // GUARD_SHOP_H