summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/battle_setup.h4
-rw-r--r--include/berry.h33
-rw-r--r--include/coins.h4
-rw-r--r--include/config.h4
-rw-r--r--include/constants/battle_setup.h14
-rw-r--r--include/constants/berry.h32
-rwxr-xr-xinclude/constants/event_object_movement.h2
-rw-r--r--include/constants/event_objects.h3
-rw-r--r--include/constants/field_weather.h24
-rw-r--r--include/constants/flags.h6
-rw-r--r--include/constants/global.h92
-rw-r--r--include/constants/items.h14
-rw-r--r--include/constants/map_scripts.h11
-rw-r--r--include/constants/pokemon.h4
-rw-r--r--include/constants/script_menu.h34
-rw-r--r--include/constants/songs.h740
-rw-r--r--include/constants/vars.h10
-rw-r--r--include/decoration_inventory.h2
-rw-r--r--include/easy_chat.h2
-rw-r--r--include/field_fadetransition.h2
-rw-r--r--include/field_specials.h2
-rw-r--r--include/fieldmap.h3
-rw-r--r--include/gba/m4a_internal.h100
-rw-r--r--include/global.h105
-rw-r--r--include/link.h2
-rw-r--r--include/macros/event.inc622
-rw-r--r--include/macros/movement.inc6
-rw-r--r--include/pokemon.h2
-rw-r--r--include/record_mixing.h1
-rw-r--r--include/script.h12
-rw-r--r--include/script_menu.h4
-rw-r--r--include/secret_base.h1
-rw-r--r--include/sprite.h2
-rw-r--r--include/start_menu.h2
-rw-r--r--include/trainer_see.h1
35 files changed, 1046 insertions, 856 deletions
diff --git a/include/battle_setup.h b/include/battle_setup.h
index f0608cb21..1676ddde1 100644
--- a/include/battle_setup.h
+++ b/include/battle_setup.h
@@ -59,7 +59,6 @@ void TrainerWantsBattle(u8, const u8 *);
bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
//u8 ScrSpecial_GetTrainerBattleMode(void);
-//u8 ScrSpecial_HasTrainerBeenFought(void);
//void sub_808257C(void);
//void unref_sub_8082590(void); // unused
u8 HasTrainerAlreadyBeenFought(u16);
@@ -68,8 +67,6 @@ void ClearTrainerFlag(u16);
void BattleSetup_StartTrainerBattle(void);
void CB2_EndTrainerBattle(void);
void do_choose_name_or_words_screen(void);
-//void ScrSpecial_StartTrainerEyeRematch(void);
-//void ScrSpecial_ShowTrainerIntroSpeech(void);
u8 *BattleSetup_GetScriptAddrAfterBattle(void);
u8 *BattleSetup_GetTrainerPostBattleScript(void);
//void ScrSpecial_ShowTrainerNonBattlingSpeech(void);
@@ -94,6 +91,5 @@ void TryUpdateRandomTrainerRematches(u16, u16);
s32 DoesSomeoneWantRematchIn(u16 mapGroup, u16 mapNum);
s32 IsRematchTrainerIn(u16 mapGroup, u16 mapNum);
u16 GetRematchTrainerId(u16 a1);
-//u8 ScrSpecial_GetTrainerEyeRematchFlag(void);
#endif // GUARD_BATTLE_SETUP_H
diff --git a/include/berry.h b/include/berry.h
index 9a7773779..0a84ed1c2 100644
--- a/include/berry.h
+++ b/include/berry.h
@@ -1,39 +1,6 @@
#ifndef GUARD_BERRY_H
#define GUARD_BERRY_H
-#define BERRY_NAME_LENGTH 6
-#define BERRY_REGROW_LIMIT 10
-#define MAX_BERRY_TREES 128
-
-#define BERRY_NONE 0
-#define FIRST_BERRY ITEM_CHERI_BERRY
-#define LAST_BERRY ITEM_ENIGMA_BERRY
-
-#define GETBERRYID(berry) ((berry - FIRST_BERRY) + 1)
-#define GETITEMID(berry) ((berry + FIRST_BERRY) - 1)
-
-enum
-{
- BERRY_FIRMNESS_UNKNOWN,
- BERRY_FIRMNESS_VERY_SOFT,
- BERRY_FIRMNESS_SOFT,
- BERRY_FIRMNESS_HARD,
- BERRY_FIRMNESS_VERY_HARD,
- BERRY_FIRMNESS_SUPER_HARD,
-};
-
-// berry stages
-enum
-{
- BERRY_STAGE_NO_BERRY, // there is no tree planted and the soil is completely flat.
- BERRY_STAGE_PLANTED,
- BERRY_STAGE_SPROUTED,
- BERRY_STAGE_TALLER,
- BERRY_STAGE_FLOWERING,
- BERRY_STAGE_BERRIES,
- BERRY_STAGE_SPARKLING = 0xFF,
-};
-
void ClearEnigmaBerries(void);
void debug_sub_80C2C18(const u8 *name, u8 holdEffect, u8 holdEffectParam);
void SetEnigmaBerry(u8 *src);
diff --git a/include/coins.h b/include/coins.h
index d066c2422..5af56d81c 100644
--- a/include/coins.h
+++ b/include/coins.h
@@ -6,7 +6,7 @@ void ShowCoinsWindow(u32 a, u8 b, u8 c);
void HideCoinsWindow(u8 a, u8 b);
void PrintCoins(s32 a, u8 b, u8 c, u8 d);
u16 GetCoins(void);
-bool8 GiveCoins(u16 coins);
-bool8 TakeCoins(u16 coins);
+bool8 AddCoins(u16 coins);
+bool8 RemoveCoins(u16 coins);
#endif // GUARD_COINS_H
diff --git a/include/config.h b/include/config.h
index 57154e8e2..947b0d553 100644
--- a/include/config.h
+++ b/include/config.h
@@ -61,4 +61,8 @@
// Fixed in Emerald.
// #define BUGFIX_SETMONIVS
+#if MODERN
+#define UBFIX
+#endif //MODERN
+
#endif // GUARD_CONFIG_H
diff --git a/include/constants/battle_setup.h b/include/constants/battle_setup.h
new file mode 100644
index 000000000..e1a663e44
--- /dev/null
+++ b/include/constants/battle_setup.h
@@ -0,0 +1,14 @@
+#ifndef GUARD_CONSTANTS_BATTLE_SETUP_H
+#define GUARD_CONSTANTS_BATTLE_SETUP_H
+
+#define TRAINER_BATTLE_SINGLE 0
+#define TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC 1
+#define TRAINER_BATTLE_CONTINUE_SCRIPT 2
+#define TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT 3
+#define TRAINER_BATTLE_DOUBLE 4
+#define TRAINER_BATTLE_REMATCH 5
+#define TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE 6
+#define TRAINER_BATTLE_REMATCH_DOUBLE 7
+#define TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC 8
+
+#endif // GUARD_CONSTANTS_BATTLE_SETUP_H
diff --git a/include/constants/berry.h b/include/constants/berry.h
new file mode 100644
index 000000000..9dc8474f1
--- /dev/null
+++ b/include/constants/berry.h
@@ -0,0 +1,32 @@
+#ifndef GUARD_CONSTANTS_BERRY_H
+#define GUARD_CONSTANTS_BERRY_H
+
+#define BERRY_NAME_LENGTH 6
+#define BERRY_REGROW_LIMIT 10
+#define MAX_BERRY_TREES 128
+
+#define BERRY_NONE 0
+
+#define BERRY_FIRMNESS_UNKNOWN 0
+#define BERRY_FIRMNESS_VERY_SOFT 1
+#define BERRY_FIRMNESS_SOFT 2
+#define BERRY_FIRMNESS_HARD 3
+#define BERRY_FIRMNESS_VERY_HARD 4
+#define BERRY_FIRMNESS_SUPER_HARD 5
+
+#define FLAVOR_SPICY 0
+#define FLAVOR_DRY 1
+#define FLAVOR_SWEET 2
+#define FLAVOR_BITTER 3
+#define FLAVOR_SOUR 4
+#define FLAVOR_COUNT 5
+
+#define BERRY_STAGE_NO_BERRY 0 // there is no tree planted and the soil is completely flat.
+#define BERRY_STAGE_PLANTED 1
+#define BERRY_STAGE_SPROUTED 2
+#define BERRY_STAGE_TALLER 3
+#define BERRY_STAGE_FLOWERING 4
+#define BERRY_STAGE_BERRIES 5
+#define BERRY_STAGE_SPARKLING 255
+
+#endif // GUARD_CONSTANTS_BERRY_H
diff --git a/include/constants/event_object_movement.h b/include/constants/event_object_movement.h
index a93a2ac05..81826c6fc 100755
--- a/include/constants/event_object_movement.h
+++ b/include/constants/event_object_movement.h
@@ -218,4 +218,6 @@
#define MOVEMENT_ACTION_ACRO_END_WHEELIE_MOVE_LEFT 0x88
#define MOVEMENT_ACTION_ACRO_END_WHEELIE_MOVE_RIGHT 0x89
+#define MOVEMENT_ACTION_STEP_END 0xFE
+
#endif // GUARD_CONSTANTS_EVENT_OBJECT_MOVEMENT_H
diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h
index 21cb3f7f4..f28f315b5 100644
--- a/include/constants/event_objects.h
+++ b/include/constants/event_objects.h
@@ -252,4 +252,7 @@
#define TRACKS_FOOT 1
#define TRACKS_BIKE_TIRE 2
+#define OBJ_EVENT_ID_PLAYER 0xFF
+#define OBJ_EVENT_ID_CAMERA 0x7F
+
#endif // GUARD_CONSTANTS_EVENT_OBJECTS_H
diff --git a/include/constants/field_weather.h b/include/constants/field_weather.h
new file mode 100644
index 000000000..e84dbc48c
--- /dev/null
+++ b/include/constants/field_weather.h
@@ -0,0 +1,24 @@
+#ifndef GUARD_CONSTANTS_FIELD_WEATHER_H
+#define GUARD_CONSTANTS_FIELD_WEATHER_H
+
+#define MAX_RAIN_SPRITES 24
+#define NUM_CLOUD_SPRITES 3
+#define NUM_FOG_HORIZONTAL_SPRITES 20
+#define NUM_ASH_SPRITES 20
+#define NUM_FOG_DIAGONAL_SPRITES 20
+#define NUM_SANDSTORM_SPRITES 20
+#define NUM_SWIRL_SANDSTORM_SPRITES 5
+
+// Controls how the weather should be changing the screen palettes.
+#define WEATHER_PAL_STATE_CHANGING_WEATHER 0
+#define WEATHER_PAL_STATE_SCREEN_FADING_IN 1
+#define WEATHER_PAL_STATE_SCREEN_FADING_OUT 2
+#define WEATHER_PAL_STATE_IDLE 3
+
+// Modes for FadeScreen
+#define FADE_FROM_BLACK 0
+#define FADE_TO_BLACK 1
+#define FADE_FROM_WHITE 2
+#define FADE_TO_WHITE 3
+
+#endif // GUARD_CONSTANTS_FIELD_WEATHER_H
diff --git a/include/constants/flags.h b/include/constants/flags.h
index a6fa4c806..0fadd7d93 100644
--- a/include/constants/flags.h
+++ b/include/constants/flags.h
@@ -219,7 +219,7 @@
#define FLAG_RECEIVED_TM41 0x109
#define FLAG_RECEIVED_LAVARIDGE_EGG 0x10A
#define FLAG_RECEIVED_FOSSIL_MON 0x10B
-#define FLAG_DECORATION_16 0x10C
+#define FLAG_SECRET_BASE_REGISTRY_ENABLED 0x10C
#define FLAG_RECEIVED_TM46 0x10D
#define FLAG_CONTEST_SKETCH_CREATED 0x10E
#define FLAG_EVIL_TEAM_ESCAPED_STERN_SPOKE 0x10F
@@ -744,7 +744,7 @@
#define FLAG_ITEM_MT_PYRE_4F_1 0x46A
#define FLAG_ITEM_SAFARI_ZONE_SOUTHWEST 0x46B
#define FLAG_ITEM_AQUA_HIDEOUT_B1F_3 0x46C
-#define FLAG_ITEM_MOSSDEEP_STEVENS_HOUSE_1 0x46D
+#define FLAG_ITEM_MOSSDEEP_STEVENS_HOUSE_HM08 0x46D
#define FLAG_ITEM_MAGMA_HIDEOUT_B1F_3 0x46E
#define FLAG_ITEM_ROUTE104_4 0x46F
@@ -901,6 +901,6 @@
// SPECIAL FLAGS (unknown purpose)
#define FLAG_SPECIAL_FLAG_0 0x4000
-#define FLAG_SPECIAL_FLAG_1 0x4001
+#define FLAG_DONT_TRANSITION_MUSIC 0x4001
#endif // GUARD_CONSTANTS_FLAGS_H
diff --git a/include/constants/global.h b/include/constants/global.h
new file mode 100644
index 000000000..cd60f0be4
--- /dev/null
+++ b/include/constants/global.h
@@ -0,0 +1,92 @@
+#ifndef GUARD_CONSTANTS_GLOBAL_H
+#define GUARD_CONSTANTS_GLOBAL_H
+// Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen.
+// In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen.
+// In Gen 4 only, migrated Pokemon with Diamond, Pearl, or Platinum's ID show as "----------".
+// Gen 5 and up read Diamond, Pearl, or Platinum's ID as "Sinnoh".
+// In Gen 4 and up, migrated Pokemon with HeartGold or SoulSilver's ID show the otherwise unused "Johto" string.
+#define VERSION_SAPPHIRE 1
+#define VERSION_RUBY 2
+#define VERSION_EMERALD 3
+#define VERSION_FIRE_RED 4
+#define VERSION_LEAF_GREEN 5
+#define VERSION_HEART_GOLD 7
+#define VERSION_SOUL_SILVER 8
+#define VERSION_DIAMOND 10
+#define VERSION_PEARL 11
+#define VERSION_PLATINUM 12
+#define VERSION_GAMECUBE 15
+
+#define LANGUAGE_JAPANESE 1
+#define LANGUAGE_ENGLISH 2
+#define LANGUAGE_FRENCH 3
+#define LANGUAGE_ITALIAN 4
+#define LANGUAGE_GERMAN 5
+#define LANGUAGE_KOREAN 6 // 6 goes unused but the theory is it was meant to be Korean
+#define LANGUAGE_SPANISH 7
+#define NUM_LANGUAGES 7
+
+#if defined(ENGLISH)
+#define GAME_LANGUAGE (LANGUAGE_ENGLISH)
+#elif defined(GERMAN)
+#define GAME_LANGUAGE (LANGUAGE_GERMAN)
+#endif
+
+#if defined(SAPPHIRE)
+#define GAME_VERSION (VERSION_SAPPHIRE)
+#elif defined(RUBY)
+#define GAME_VERSION (VERSION_RUBY)
+#endif
+
+// capacities of various saveblock objects
+#define DAYCARE_MON_COUNT 2
+#define POKEBLOCKS_COUNT 40
+#define OBJECT_EVENTS_COUNT 16
+#define BERRY_TREES_COUNT 128
+#define FLAGS_COUNT 288
+#define VARS_COUNT 256
+#define MAIL_COUNT 16
+#define SECRET_BASES_COUNT 20
+#define TV_SHOWS_COUNT 25
+#define POKE_NEWS_COUNT 16
+#define PC_ITEMS_COUNT 50
+#define BAG_ITEMS_COUNT 20
+#define BAG_KEYITEMS_COUNT 20
+#define BAG_POKEBALLS_COUNT 16
+#define BAG_TMHM_COUNT 64
+#define BAG_BERRIES_COUNT 46
+#define OBJECT_EVENT_TEMPLATES_COUNT 64
+#define DECOR_MAX_SECRET_BASE 16
+#define DECOR_MAX_PLAYERS_HOUSE 12
+#define MAX_REMATCH_ENTRIES 100
+
+#define TRAINER_ID_LENGTH 4
+#define MAX_MON_MOVES 4
+#define NUM_STATS 6
+#define PARTY_SIZE 6
+
+#define MALE 0
+#define FEMALE 1
+#define GENDER_COUNT 2
+
+#define OPTIONS_BUTTON_MODE_NORMAL 0
+#define OPTIONS_BUTTON_MODE_LR 1
+#define OPTIONS_BUTTON_MODE_L_EQUALS_A 2
+
+#define OPTIONS_TEXT_SPEED_SLOW 0
+#define OPTIONS_TEXT_SPEED_MID 1
+#define OPTIONS_TEXT_SPEED_FAST 2
+
+#define OPTIONS_SOUND_MONO 0
+#define OPTIONS_SOUND_STEREO 1
+
+#define OPTIONS_BATTLE_STYLE_SHIFT 0
+#define OPTIONS_BATTLE_STYLE_SET 1
+
+#define BAG_ITEMS 1
+#define BAG_POKEBALLS 2
+#define BAG_TMsHMs 3
+#define BAG_BERRIES 4
+#define BAG_KEYITEMS 5
+
+#endif // GUARD_CONSTANTS_GLOBAL_H
diff --git a/include/constants/items.h b/include/constants/items.h
index a52c72599..9dd381076 100644
--- a/include/constants/items.h
+++ b/include/constants/items.h
@@ -363,11 +363,23 @@
#define ITEM_15B 347
#define ITEM_15C 348
+#define ITEMS_COUNT 349
+#define ITEM_FIELD_ARROW ITEMS_COUNT
+
#define NUM_TECHNICAL_MACHINES 50
#define NUM_HIDDEN_MACHINES 8
+#define MAX_BAG_ITEM_CAPACITY 99
+#define MAX_PC_ITEM_CAPACITY 999
+#define MAX_BERRY_CAPACITY 999
+
+#define FIRST_BERRY_INDEX ITEM_CHERI_BERRY
+#define LAST_BERRY_INDEX ITEM_ENIGMA_BERRY
+
+#define ITEM_TO_BERRY(itemId)(((itemId - FIRST_BERRY_INDEX) + 1))
+
// Check if the item is one that can be used on a Pokemon.
-#define IS_POKEMON_ITEM(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
+#define ITEM_HAS_EFFECT(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2)
#define IS_ITEM_MAIL(item) ((item) >= ITEM_ORANGE_MAIL && (item) <= ITEM_RETRO_MAIL)
diff --git a/include/constants/map_scripts.h b/include/constants/map_scripts.h
new file mode 100644
index 000000000..d096edb90
--- /dev/null
+++ b/include/constants/map_scripts.h
@@ -0,0 +1,11 @@
+#ifndef GUARD_CONSTANTS_MAP_SCRIPTS_H
+#define GUARD_CONSTANTS_MAP_SCRIPTS_H
+
+#define MAP_SCRIPT_ON_LOAD 1
+#define MAP_SCRIPT_ON_FRAME_TABLE 2
+#define MAP_SCRIPT_ON_TRANSITION 3
+#define MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE 4
+#define MAP_SCRIPT_ON_RESUME 5
+#define MAP_SCRIPT_ON_DIVE_WARP 6
+
+#endif // GUARD_CONSTANTS_MAP_SCRIPTS_H
diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h
index 8e7c01eb5..5d1539179 100644
--- a/include/constants/pokemon.h
+++ b/include/constants/pokemon.h
@@ -141,4 +141,8 @@
#define NUM_STATS 6
#define UNOWN_FORM_COUNT 28
+#define PLAYER_HAS_TWO_USABLE_MONS 0
+#define PLAYER_HAS_ONE_MON 1
+#define PLAYER_HAS_ONE_USABLE_MON 2
+
#endif // GUARD_CONSTANTS_POKEMON_H
diff --git a/include/constants/script_menu.h b/include/constants/script_menu.h
new file mode 100644
index 000000000..fc429b620
--- /dev/null
+++ b/include/constants/script_menu.h
@@ -0,0 +1,34 @@
+#ifndef GUARD_SCRIPT_MENU_CONSTANTS_H
+#define GUARD_SCRIPT_MENU_CONSTANTS_H
+
+#define MULTICHOICE(name) {name, ARRAY_COUNT(name)}
+
+#define MAX_MULTICHOICE_WIDTH 28
+
+#define MULTI_B_PRESSED 127
+
+// Multichoice Ids
+// TODO
+
+// Std String Ids
+#define STDSTRING_COOL 0
+#define STDSTRING_BEAUTY 1
+#define STDSTRING_CUTE 2
+#define STDSTRING_SMART 3
+#define STDSTRING_TOUGH 4
+#define STDSTRING_NORMAL 5
+#define STDSTRING_SUPER 6
+#define STDSTRING_HYPER 7
+#define STDSTRING_MASTER 8
+#define STDSTRING_COOL2 9
+#define STDSTRING_BEAUTY2 10
+#define STDSTRING_CUTE2 11
+#define STDSTRING_SMART2 12
+#define STDSTRING_TOUGH2 13
+#define STDSTRING_ITEMS 14
+#define STDSTRING_KEYITEMS 15
+#define STDSTRING_POKEBALLS 16
+#define STDSTRING_TMHMS 17
+#define STDSTRING_BERRIES 18
+
+#endif //GUARD_SCRIPT_MENU_CONSTANTS_H
diff --git a/include/constants/songs.h b/include/constants/songs.h
index 45e3d335a..9a268f966 100644
--- a/include/constants/songs.h
+++ b/include/constants/songs.h
@@ -1,373 +1,379 @@
#ifndef GUARD_CONSTANTS_SONGS_H
#define GUARD_CONSTANTS_SONGS_H
-#define SE_STOP 0
-#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 // Mossdeep Gym/Trick House Switch
-#define SE_FU_ZAKU 37
-#define SE_FU_ZAKU2 38
-#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 // 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 // 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 // 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 // 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 // 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 MUS_STOP 349
-#define MUS_TETSUJI 350 // Littleroot Town Test 'TETSUJI'
-#define MUS_FIELD13 351 // GSC - Route 38
-#define MUS_KACHI22 352 // Wild Pokémon Defeated
-#define MUS_KACHI2 353 // Wild Pokémon Defeated with Intro
-#define MUS_KACHI3 354 // Gym Leader Defeated
-#define MUS_KACHI5 355 // Victory! Elite Four
-#define MUS_PCC 356 // Crystal - Pokémon Communication Center
-#define MUS_NIBI 357 // GSC - Viridian/Saffron/Pewter/etc
-#define MUS_SUIKUN 358 // Crystal - Battle! Legendary Beasts
-#define MUS_DOORO1 359 // Route 101
-#define MUS_DOORO_X1 360 // Route 110
-#define MUS_DOORO_X3 361 // Route 120
-#define MUS_MACHI_S2 362 // Petalburg City
-#define MUS_MACHI_S4 363 // Oldale Town
-#define MUS_GIM 364 // Gym
-#define MUS_NAMINORI 365 // Surfing
-#define MUS_DAN01 366 // Caves and Darkness
-#define MUS_FANFA1 367 // Level Up!
-#define MUS_ME_ASA 368 // Pokémon Healed
-#define MUS_ME_BACHI 369 // Obtained a Badge!
-#define MUS_FANFA4 370 // Obtained an Item!
-#define MUS_FANFA5 371 // Your Pokémon Just Evolved!
-#define MUS_ME_WAZA 372 // Obtained a TM/HM!
-#define MUS_BIJYUTU 373 // Lilycove Musseum
-#define MUS_DOORO_X4 374 // Route 122/Intro
-#define MUS_FUNE_KAN 375 // Slateport Museum
-#define MUS_ME_SHINKA 376 // Evolution Intro
-#define MUS_SHINKA 377 // Evolution
-#define MUS_ME_WASURE 378 // Move Deleted
-#define MUS_SYOUJOEYE 379 // Encounter! Tuber
-#define MUS_BOYEYE 380 // Encounter! Boy
-#define MUS_DAN02 381 // Abandoned Ship
-#define MUS_MACHI_S3 382 // Fortree City
-#define MUS_ODAMAKI 383 // Professor Birch's Lab
-#define MUS_B_TOWER 384 // Battle Tower (RS)
-#define MUS_SWIMEYE 385 // Encounter! Swimmer
-#define MUS_DAN03 386 // Meteor Falls
-#define MUS_ME_KINOMI 387 // Obtained a Berry!
-#define MUS_ME_TAMA 388 // Awakening the Super-Ancient Pokémon
-#define MUS_ME_B_BIG 389 // Slots Jackpot!
-#define MUS_ME_B_SMALL 390 // Slots Victory!
-#define MUS_ME_ZANNEN 391 // Too bad!
-#define MUS_BD_TIME 392 // Roulette!
-#define MUS_TEST1 393 // Contest Test 1
-#define MUS_TEST2 394 // Contest Test 2
-#define MUS_TEST3 395 // Contest Test 3
-#define MUS_TEST4 396 // Contest Test 4
-#define MUS_TEST 397 // Encounter! Gentleman (Test?)
-#define MUS_GOMACHI0 398 // Verdanturf Town
-#define MUS_GOTOWN 399 // Rustboro City
-#define MUS_POKECEN 400 // Pokémon Center
-#define MUS_NEXTROAD 401 // Route 104
-#define MUS_GRANROAD 402 // Route 119
-#define MUS_CYCLING 403 // Cycling
-#define MUS_FRIENDLY 404 // Pokémart
-#define MUS_MISHIRO 405 // Littleroot Town
-#define MUS_TOZAN 406 // Sky Pillar
-#define MUS_GIRLEYE 407 // Encounter! Girl
-#define MUS_MINAMO 408 // Lilycove City
-#define MUS_ASHROAD 409 // Route 111
-#define MUS_EVENT0 410 // Help me!
-#define MUS_DEEPDEEP 411 // Underwater
-#define MUS_KACHI1 412 // Victory! Trainer
-#define MUS_TITLE3 413 // Title Screen
-#define MUS_DEMO1 414 // Opening Movie
-#define MUS_GIRL_SUP 415 // Encounter! May
-#define MUS_HAGESHII 416 // Encounter! Biker
-#define MUS_KAKKOII 417 // Encounter! Electric Trainer
-#define MUS_KAZANBAI 418 // Route 113
-#define MUS_AQA_0 419 // Encounter! Team Aqua
-#define MUS_TSURETEK 420 // Follow Me!
-#define MUS_BOY_SUP 421 // Encounter! Brendan
-#define MUS_RAINBOW 422 // Ever Grande City
-#define MUS_AYASII 423 // Encounter! Psychic
-#define MUS_KACHI4 424 // Victory! Aqua/Magma Grunt
-#define MUS_ROPEWAY 425 // Cable Car
-#define MUS_CASINO 426 // Game Corner
-#define MUS_HIGHTOWN 427 // Dewford Town
-#define MUS_SAFARI 428 // Safari Zone
-#define MUS_C_ROAD 429 // Victory Toad
-#define MUS_AJITO 430 // Aqua/Magma Hideout
-#define MUS_M_BOAT 431 // Sailing
-#define MUS_M_DUNGON 432 // Mt. Pyre (Inside)
-#define MUS_FINECITY 433 // Slateport City
-#define MUS_MACHUPI 434 // Mt. Pyre (Outside)
-#define MUS_P_SCHOOL 435 // Pokémon Trainer's School
-#define MUS_DENDOU 436 // Hall of Fame
-#define MUS_TONEKUSA 437 // Lavaridge Town
-#define MUS_MABOROSI 438 // Sealed Chamber
-#define MUS_CON_FAN 439 // You are the Champion!
-#define MUS_CONTEST0 440 // Pokémon Contest
-#define MUS_MGM0 441 // Encounter! Team Magma
-#define MUS_T_BATTLE 442 // Opening Battle
-#define MUS_OOAME 443 // The Flood
-#define MUS_HIDERI 444 // The Drought
-#define MUS_RUNECITY 445 // Sootopolis City
-#define MUS_CON_K 446 // Berry Blending Results
-#define MUS_EIKOU_R 447 // Hall of Fame
-#define MUS_KARAKURI 448 // Trick House
-#define MUS_HUTAGO 449 // Encounter! Kid
-#define MUS_SITENNOU 450 // Encounter! Elite Four
-#define MUS_YAMA_EYE 451 // Encounter! Hiker
-#define MUS_CONLOBBY 452 // Contest Lobby
-#define MUS_INTER_V 453 // Encounter! Gabby and Ty
-#define MUS_DAIGO 454 // Encounter! Wallace
-#define MUS_THANKFOR 455 // Credits
-#define MUS_END 456 // The End
-#define MUS_BATTLE27 457 // Battle! Wild Pokémon
-#define MUS_BATTLE31 458 // Battle! Team Aqua/Magma
-#define MUS_BATTLE20 459 // Battle! Trainer
-#define MUS_BATTLE32 460 // Battle! Gym Leader
-#define MUS_BATTLE33 461 // Battle! Champion
-#define MUS_BATTLE36 462 // Battle! Regi Trio
-#define MUS_BATTLE34 463 // Battle! Legendary Pokémon
-#define MUS_BATTLE35 464 // Battle! Rival
-#define MUS_BATTLE38 465 // Battle! Elite Four
-#define MUS_BATTLE30 466 // Battle! Archie/Maxie
+// Original JP names listed on right, along with any additional notes
-#define MUS_ROUTE_118 0x7FFF // What is this for?
+#define MUS_DUMMY 0 // MUS_DUMMY
+#define SE_USE_ITEM 1 // SE_KAIFUKU
+#define SE_PC_LOGIN 2 // SE_PC_LOGIN
+#define SE_PC_OFF 3 // SE_PC_OFF
+#define SE_PC_ON 4 // SE_PC_ON
+#define SE_SELECT 5 // SE_SELECT
+#define SE_WIN_OPEN 6 // SE_WIN_OPEN
+#define SE_WALL_HIT 7 // SE_WALL_HIT
+#define SE_DOOR 8 // SE_DOOR
+#define SE_EXIT 9 // SE_KAIDAN
+#define SE_LEDGE 10 // SE_DANSA
+#define SE_BIKE_BELL 11 // SE_JITENSYA
+#define SE_NOT_EFFECTIVE 12 // SE_KOUKA_L
+#define SE_EFFECTIVE 13 // SE_KOUKA_M
+#define SE_SUPER_EFFECTIVE 14 // SE_KOUKA_H
+#define SE_BALL_OPEN 15 // SE_BOWA2
+#define SE_FAINT 16 // SE_POKE_DEAD
+#define SE_FLEE 17 // SE_NIGERU
+#define SE_SLIDING_DOOR 18 // SE_JIDO_DOA
+#define SE_SHIP 19 // SE_NAMINORI
+#define SE_BANG 20 // SE_BAN
+#define SE_PIN 21 // SE_PIN (General "good", commonly for "!")
+#define SE_BOO 22 // SE_BOO (General "bad")
+#define SE_BALL 23 // SE_BOWA (Giving Poké Ball to nurse, Poké Ball shake, etc)
+#define SE_CONTEST_PLACE 24 // SE_JYUNI
+#define SE_A 25 // SE_A (Bard sounds)
+#define SE_I 26 // SE_I
+#define SE_U 27 // SE_U
+#define SE_E 28 // SE_E
+#define SE_O 29 // SE_O
+#define SE_N 30 // SE_N
+#define SE_SUCCESS 31 // SE_SEIKAI
+#define SE_FAILURE 32 // SE_HAZURE
+#define SE_EXP 33 // SE_EXP
+#define SE_BIKE_HOP 34 // SE_JITE_PYOKO
+#define SE_SWITCH 35 // SE_MU_PACHI
+#define SE_CLICK 36 // SE_TK_KASYA
+#define SE_FU_ZAKU 37 // SE_FU_ZAKU (Unknown purpose, unused)
+#define SE_CONTEST_CONDITION_LOSE 38 // SE_FU_ZAKU2
+#define SE_LAVARIDGE_FALL_WARP 39 // SE_FU_ZUZUZU
+#define SE_ICE_STAIRS 40 // SE_RU_GASHIN
+#define SE_ICE_BREAK 41 // SE_RU_GASYAN
+#define SE_ICE_CRACK 42 // SE_RU_BARI
+#define SE_FALL 43 // SE_RU_HYUU
+#define SE_UNLOCK 44 // SE_KI_GASYAN
+#define SE_WARP_IN 45 // SE_TK_WARPIN
+#define SE_WARP_OUT 46 // SE_TK_WARPOUT
+#define SE_REPEL 47 // SE_TU_SAA
+#define SE_ROTATING_GATE 48 // SE_HI_TURUN
+#define SE_TRUCK_MOVE 49 // SE_TRACK_MOVE
+#define SE_TRUCK_STOP 50 // SE_TRACK_STOP
+#define SE_TRUCK_UNLOAD 51 // SE_TRACK_HAIKI
+#define SE_TRUCK_DOOR 52 // SE_TRACK_DOOR
+#define SE_BERRY_BLENDER 53 // SE_MOTER
+#define SE_CARD 54 // SE_CARD
+#define SE_SAVE 55 // SE_SAVE
+#define SE_BALL_BOUNCE_1 56 // SE_KON
+#define SE_BALL_BOUNCE_2 57 // SE_KON2
+#define SE_BALL_BOUNCE_3 58 // SE_KON3
+#define SE_BALL_BOUNCE_4 59 // SE_KON4
+#define SE_BALL_TRADE 60 // SE_SUIKOMU
+#define SE_BALL_THROW 61 // SE_NAGERU
+#define SE_NOTE_C 62 // SE_TOY_C
+#define SE_NOTE_D 63 // SE_TOY_D
+#define SE_NOTE_E 64 // SE_TOY_E
+#define SE_NOTE_F 65 // SE_TOY_F
+#define SE_NOTE_G 66 // SE_TOY_G
+#define SE_NOTE_A 67 // SE_TOY_A
+#define SE_NOTE_B 68 // SE_TOY_B
+#define SE_NOTE_C_HIGH 69 // SE_TOY_C1
+#define SE_PUDDLE 70 // SE_MIZU
+#define SE_BRIDGE_WALK 71 // SE_HASHI
+#define SE_ITEMFINDER 72 // SE_DAUGI
+#define SE_DING_DONG 73 // SE_PINPON
+#define SE_BALLOON_RED 74 // SE_FUUSEN1
+#define SE_BALLOON_BLUE 75 // SE_FUUSEN2
+#define SE_BALLOON_YELLOW 76 // SE_FUUSEN3
+#define SE_BREAKABLE_DOOR 77 // SE_TOY_KABE
+#define SE_MUD_BALL 78 // SE_TOY_DANGO
+#define SE_FIELD_POISON 79 // SE_DOKU
+#define SE_ESCALATOR 80 // SE_ESUKA
+#define SE_THUNDERSTORM 81 // SE_T_AME
+#define SE_THUNDERSTORM_STOP 82 // SE_T_AME_E
+#define SE_DOWNPOUR 83 // SE_T_OOAME
+#define SE_DOWNPOUR_STOP 84 // SE_T_OOAME_E
+#define SE_RAIN 85 // SE_T_KOAME
+#define SE_RAIN_STOP 86 // SE_T_KOAME_E
+#define SE_THUNDER 87 // SE_T_KAMI
+#define SE_THUNDER2 88 // SE_T_KAMI2
+#define SE_ELEVATOR 89 // SE_ELEBETA
+#define SE_LOW_HEALTH 90 // SE_HINSI
+#define SE_EXP_MAX 91 // SE_EXPMAX
+#define SE_ROULETTE_BALL 92 // SE_TAMAKORO
+#define SE_ROULETTE_BALL2 93 // SE_TAMAKORO_E
+#define SE_TAILLOW_WING_FLAP 94 // SE_BASABASA
+#define SE_SHOP 95 // SE_REGI
+#define SE_CONTEST_HEART 96 // SE_C_GAJI
+#define SE_CONTEST_CURTAIN_RISE 97 // SE_C_MAKU_U
+#define SE_CONTEST_CURTAIN_FALL 98 // SE_C_MAKU_D
+#define SE_CONTEST_ICON_CHANGE 99 // SE_C_PASI
+#define SE_CONTEST_ICON_CLEAR 100 // SE_C_SYU
+#define SE_CONTEST_MONS_TURN 101 // SE_C_PIKON
+#define SE_SHINY 102 // SE_REAPOKE
+#define SE_INTRO_BLAST 103 // SE_OP_BASYU
+#define SE_MUGSHOT 104 // SE_BT_START
+#define SE_APPLAUSE 105 // SE_DENDOU
+#define SE_VEND 106 // SE_JIHANKI
+#define SE_ORB 107 // SE_TAMA
+#define SE_DEX_SCROLL 108 // SE_Z_SCROLL
+#define SE_DEX_PAGE 109 // SE_Z_PAGE
+#define SE_POKENAV_ON 110 // SE_PN_ON
+#define SE_POKENAV_OFF 111 // SE_PN_OFF
+#define SE_DEX_SEARCH 112 // SE_Z_SEARCH
+#define SE_EGG_HATCH 113 // SE_TAMAGO
+#define SE_BALL_TRAY_ENTER 114 // SE_TB_START
+#define SE_BALL_TRAY_BALL 115 // SE_TB_KON
+#define SE_BALL_TRAY_EXIT 116 // SE_TB_KARA
+#define SE_GLASS_FLUTE 117 // SE_BIDORO
+// Move SFX
+#define SE_M_THUNDERBOLT 118 // SE_W085
+#define SE_M_THUNDERBOLT2 119 // SE_W085B
+#define SE_M_HARDEN 120 // SE_W231
+#define SE_M_NIGHTMARE 121 // SE_W171
+#define SE_M_VITAL_THROW 122 // SE_W233
+#define SE_M_VITAL_THROW2 123 // SE_W233B
+#define SE_M_BUBBLE 124 // SE_W145
+#define SE_M_BUBBLE2 125 // SE_W145B
+#define SE_M_BUBBLE3 126 // SE_W145C
+#define SE_M_RAIN_DANCE 127 // SE_W240
+#define SE_M_CUT 128 // SE_W015
+#define SE_M_STRING_SHOT 129 // SE_W081
+#define SE_M_STRING_SHOT2 130 // SE_W081B
+#define SE_M_ROCK_THROW 131 // SE_W088
+#define SE_M_GUST 132 // SE_W016
+#define SE_M_GUST2 133 // SE_W016B
+#define SE_M_DOUBLE_SLAP 134 // SE_W003
+#define SE_M_DOUBLE_TEAM 135 // SE_W104
+#define SE_M_RAZOR_WIND 136 // SE_W013
+#define SE_M_ICY_WIND 137 // SE_W196
+#define SE_M_THUNDER_WAVE 138 // SE_W086
+#define SE_M_COMET_PUNCH 139 // SE_W004
+#define SE_M_MEGA_KICK 140 // SE_W025
+#define SE_M_MEGA_KICK2 141 // SE_W025B
+#define SE_M_CRABHAMMER 142 // SE_W152
+#define SE_M_JUMP_KICK 143 // SE_W026
+#define SE_M_FLAME_WHEEL 144 // SE_W172
+#define SE_M_FLAME_WHEEL2 145 // SE_W172B
+#define SE_M_FLAMETHROWER 146 // SE_W053
+#define SE_M_FIRE_PUNCH 147 // SE_W007
+#define SE_M_TOXIC 148 // SE_W092
+#define SE_M_SACRED_FIRE 149 // SE_W221
+#define SE_M_SACRED_FIRE2 150 // SE_W221B
+#define SE_M_EMBER 151 // SE_W052
+#define SE_M_TAKE_DOWN 152 // SE_W036
+#define SE_M_BLIZZARD 153 // SE_W059
+#define SE_M_BLIZZARD2 154 // SE_W059B
+#define SE_M_SCRATCH 155 // SE_W010
+#define SE_M_VICEGRIP 156 // SE_W011
+#define SE_M_WING_ATTACK 157 // SE_W017
+#define SE_M_FLY 158 // SE_W019
+#define SE_M_SAND_ATTACK 159 // SE_W028
+#define SE_M_RAZOR_WIND2 160 // SE_W013B
+#define SE_M_BITE 161 // SE_W044
+#define SE_M_HEADBUTT 162 // SE_W029
+#define SE_M_SURF 163 // SE_W057
+#define SE_M_HYDRO_PUMP 164 // SE_W056
+#define SE_M_WHIRLPOOL 165 // SE_W250
+#define SE_M_HORN_ATTACK 166 // SE_W030
+#define SE_M_TAIL_WHIP 167 // SE_W039
+#define SE_M_MIST 168 // SE_W054
+#define SE_M_POISON_POWDER 169 // SE_W077
+#define SE_M_BIND 170 // SE_W020
+#define SE_M_DRAGON_RAGE 171 // SE_W082
+#define SE_M_SING 172 // SE_W047
+#define SE_M_PERISH_SONG 173 // SE_W195
+#define SE_M_PAY_DAY 174 // SE_W006
+#define SE_M_DIG 175 // SE_W091
+#define SE_M_DIZZY_PUNCH 176 // SE_W146
+#define SE_M_SELF_DESTRUCT 177 // SE_W120
+#define SE_M_EXPLOSION 178 // SE_W153
+#define SE_M_ABSORB_2 179 // SE_W071B
+#define SE_M_ABSORB 180 // SE_W071
+#define SE_M_SCREECH 181 // SE_W103
+#define SE_M_BUBBLE_BEAM 182 // SE_W062
+#define SE_M_BUBBLE_BEAM2 183 // SE_W062B
+#define SE_M_SUPERSONIC 184 // SE_W048
+#define SE_M_BELLY_DRUM 185 // SE_W187
+#define SE_M_METRONOME 186 // SE_W118
+#define SE_M_BONEMERANG 187 // SE_W155
+#define SE_M_LICK 188 // SE_W122
+#define SE_M_PSYBEAM 189 // SE_W060
+#define SE_M_FAINT_ATTACK 190 // SE_W185
+#define SE_M_SWORDS_DANCE 191 // SE_W014
+#define SE_M_LEER 192 // SE_W043
+#define SE_M_SWAGGER 193 // SE_W207
+#define SE_M_SWAGGER2 194 // SE_W207B
+#define SE_M_HEAL_BELL 195 // SE_W215
+#define SE_M_CONFUSE_RAY 196 // SE_W109
+#define SE_M_SNORE 197 // SE_W173
+#define SE_M_BRICK_BREAK 198 // SE_W280
+#define SE_M_GIGA_DRAIN 199 // SE_W202
+#define SE_M_PSYBEAM2 200 // SE_W060B
+#define SE_M_SOLAR_BEAM 201 // SE_W076
+#define SE_M_PETAL_DANCE 202 // SE_W080
+#define SE_M_TELEPORT 203 // SE_W100
+#define SE_M_MINIMIZE 204 // SE_W107
+#define SE_M_SKETCH 205 // SE_W166
+#define SE_M_SWIFT 206 // SE_W129
+#define SE_M_REFLECT 207 // SE_W115
+#define SE_M_BARRIER 208 // SE_W112
+#define SE_M_DETECT 209 // SE_W197
+#define SE_M_LOCK_ON 210 // SE_W199
+#define SE_M_MOONLIGHT 211 // SE_W236
+#define SE_M_CHARM 212 // SE_W204
+#define SE_M_CHARGE 213 // SE_W268
+#define SE_M_STRENGTH 214 // SE_W070
+#define SE_M_HYPER_BEAM 215 // SE_W063
+#define SE_M_WATERFALL 216 // SE_W127
+#define SE_M_REVERSAL 217 // SE_W179
+#define SE_M_ACID_ARMOR 218 // SE_W151
+#define SE_M_SANDSTORM 219 // SE_W201
+#define SE_M_TRI_ATTACK 220 // SE_W161
+#define SE_M_TRI_ATTACK2 221 // SE_W161B
+#define SE_M_ENCORE 222 // SE_W227
+#define SE_M_ENCORE2 223 // SE_W227B
+#define SE_M_BATON_PASS 224 // SE_W226
+#define SE_M_MILK_DRINK 225 // SE_W208
+#define SE_M_ATTRACT 226 // SE_W213
+#define SE_M_ATTRACT2 227 // SE_W213B
+#define SE_M_MORNING_SUN 228 // SE_W234
+#define SE_M_FLATTER 229 // SE_W260
+#define SE_M_SAND_TOMB 230 // SE_W328
+#define SE_M_GRASSWHISTLE 231 // SE_W320
+#define SE_M_SPIT_UP 232 // SE_W255
+#define SE_M_DIVE 233 // SE_W291
+#define SE_M_EARTHQUAKE 234 // SE_W089
+#define SE_M_TWISTER 235 // SE_W239
+#define SE_M_SWEET_SCENT 236 // SE_W230
+#define SE_M_YAWN 237 // SE_W281
+#define SE_M_SKY_UPPERCUT 238 // SE_W327
+#define SE_M_STAT_INCREASE 239 // SE_W287
+#define SE_M_HEAT_WAVE 240 // SE_W257
+#define SE_M_UPROAR 241 // SE_W253
+#define SE_M_HAIL 242 // SE_W258
+#define SE_M_COSMIC_POWER 243 // SE_W322
+#define SE_M_TEETER_DANCE 244 // SE_W298
+#define SE_M_STAT_DECREASE 245 // SE_W287B
+#define SE_M_HAZE 246 // SE_W114
+#define SE_M_HYPER_BEAM2 247 // SE_W063B
+
+// Music
+#define MUS_STOP 349 // MUS_STOP
+#define MUS_LITTLEROOT_TEST 350 // MUS_TETSUJI
+#define MUS_GSC_ROUTE38 351 // MUS_FIELD13
+#define MUS_CAUGHT 352 // MUS_KACHI22
+#define MUS_VICTORY_WILD 353 // MUS_KACHI2
+#define MUS_VICTORY_GYM_LEADER 354 // MUS_KACHI3
+#define MUS_VICTORY_LEAGUE 355 // MUS_KACHI5
+#define MUS_C_COMM_CENTER 356 // MUS_PCC
+#define MUS_GSC_PEWTER 357 // MUS_NIBI
+#define MUS_C_VS_LEGEND_BEAST 358 // MUS_SUIKUN
+#define MUS_ROUTE101 359 // MUS_DOORO1
+#define MUS_ROUTE110 360 // MUS_DOORO_X1
+#define MUS_ROUTE120 361 // MUS_DOORO_X3
+#define MUS_PETALBURG 362 // MUS_MACHI_S2
+#define MUS_OLDALE 363 // MUS_MACHI_S4
+#define MUS_GYM 364 // MUS_GIM
+#define MUS_SURF 365 // MUS_NAMINORI
+#define MUS_PETALBURG_WOODS 366 // MUS_DAN01
+#define MUS_LEVEL_UP 367 // MUS_FANFA1
+#define MUS_HEAL 368 // MUS_ME_ASA
+#define MUS_OBTAIN_BADGE 369 // MUS_ME_BACHI
+#define MUS_OBTAIN_ITEM 370 // MUS_FANFA4
+#define MUS_EVOLVED 371 // MUS_FANFA5
+#define MUS_OBTAIN_TMHM 372 // MUS_ME_WAZA
+#define MUS_LILYCOVE_MUSEUM 373 // MUS_BIJYUTU
+#define MUS_ROUTE122 374 // MUS_DOORO_X4
+#define MUS_OCEANIC_MUSEUM 375 // MUS_FUNE_KAN
+#define MUS_EVOLUTION_INTRO 376 // MUS_ME_SHINKA
+#define MUS_EVOLUTION 377 // MUS_SHINKA
+#define MUS_MOVE_DELETED 378 // MUS_ME_WASURE
+#define MUS_ENCOUNTER_GIRL 379 // MUS_SYOUJOEYE
+#define MUS_ENCOUNTER_MALE 380 // MUS_BOYEYE
+#define MUS_ABANDONED_SHIP 381 // MUS_DAN02
+#define MUS_FORTREE 382 // MUS_MACHI_S3
+#define MUS_BIRCH_LAB 383 // MUS_ODAMAKI
+#define MUS_B_TOWER 384 // MUS_B_TOWER
+#define MUS_ENCOUNTER_SWIMMER 385 // MUS_SWIMEYE
+#define MUS_CAVE_OF_ORIGIN 386 // MUS_DAN03
+#define MUS_OBTAIN_BERRY 387 // MUS_ME_KINOMI
+#define MUS_AWAKEN_LEGEND 388 // MUS_ME_TAMA
+#define MUS_SLOTS_JACKPOT 389 // MUS_ME_B_BIG
+#define MUS_SLOTS_WIN 390 // MUS_ME_B_SMALL
+#define MUS_TOO_BAD 391 // MUS_ME_ZANNEN
+#define MUS_ROULETTE 392 // MUS_BD_TIME
+#define MUS_LINK_CONTEST_P1 393 // MUS_TEST1
+#define MUS_LINK_CONTEST_P2 394 // MUS_TEST2
+#define MUS_LINK_CONTEST_P3 395 // MUS_TEST3
+#define MUS_LINK_CONTEST_P4 396 // MUS_TEST4
+#define MUS_ENCOUNTER_RICH 397 // MUS_TEST
+#define MUS_VERDANTURF 398 // MUS_GOMACHI0
+#define MUS_RUSTBORO 399 // MUS_GOTOWN
+#define MUS_POKE_CENTER 400 // MUS_POKECEN
+#define MUS_ROUTE104 401 // MUS_NEXTROAD
+#define MUS_ROUTE119 402 // MUS_GRANROAD
+#define MUS_CYCLING 403 // MUS_CYCLING
+#define MUS_POKE_MART 404 // MUS_FRIENDLY
+#define MUS_LITTLEROOT 405 // MUS_MISHIRO
+#define MUS_MT_CHIMNEY 406 // MUS_TOZAN
+#define MUS_ENCOUNTER_FEMALE 407 // MUS_GIRLEYE
+#define MUS_LILYCOVE 408 // MUS_MINAMO
+#define MUS_ROUTE111 409 // MUS_ASHROAD
+#define MUS_HELP 410 // MUS_EVENT0
+#define MUS_UNDERWATER 411 // MUS_DEEPDEEP
+#define MUS_VICTORY_TRAINER 412 // MUS_KACHI1
+#define MUS_TITLE 413 // MUS_TITLE3
+#define MUS_INTRO 414 // MUS_DEMO1
+#define MUS_ENCOUNTER_MAY 415 // MUS_GIRL_SUP
+#define MUS_ENCOUNTER_INTENSE 416 // MUS_HAGESHII
+#define MUS_ENCOUNTER_COOL 417 // MUS_KAKKOII
+#define MUS_ROUTE113 418 // MUS_KAZANBAI
+#define MUS_ENCOUNTER_AQUA 419 // MUS_AQA_0
+#define MUS_FOLLOW_ME 420 // MUS_TSURETEK
+#define MUS_ENCOUNTER_BRENDAN 421 // MUS_BOY_SUP
+#define MUS_EVER_GRANDE 422 // MUS_RAINBOW
+#define MUS_ENCOUNTER_SUSPICIOUS 423 // MUS_AYASII
+#define MUS_VICTORY_AQUA_MAGMA 424 // MUS_KACHI4
+#define MUS_CABLE_CAR 425 // MUS_ROPEWAY
+#define MUS_GAME_CORNER 426 // MUS_CASINO
+#define MUS_DEWFORD 427 // MUS_HIGHTOWN
+#define MUS_SAFARI_ZONE 428 // MUS_SAFARI
+#define MUS_VICTORY_ROAD 429 // MUS_C_ROAD
+#define MUS_AQUA_MAGMA_HIDEOUT 430 // MUS_AJITO
+#define MUS_SAILING 431 // MUS_M_BOAT
+#define MUS_MT_PYRE 432 // MUS_M_DUNGON
+#define MUS_SLATEPORT 433 // MUS_FINECITY
+#define MUS_MT_PYRE_EXTERIOR 434 // MUS_MACHUPI
+#define MUS_SCHOOL 435 // MUS_P_SCHOOL
+#define MUS_HALL_OF_FAME 436 // MUS_DENDOU
+#define MUS_FALLARBOR 437 // MUS_TONEKUSA
+#define MUS_SEALED_CHAMBER 438 // MUS_MABOROSI
+#define MUS_CONTEST_WINNER 439 // MUS_CON_FAN
+#define MUS_CONTEST 440 // MUS_CONTEST0
+#define MUS_ENCOUNTER_MAGMA 441 // MUS_MGM0
+#define MUS_INTRO_BATTLE 442 // MUS_T_BATTLE
+#define MUS_WEATHER_KYOGRE 443 // MUS_OOAME
+#define MUS_WEATHER_GROUDON 444 // MUS_HIDERI
+#define MUS_SOOTOPOLIS 445 // MUS_RUNECITY
+#define MUS_CONTEST_RESULTS 446 // MUS_CON_K
+#define MUS_HALL_OF_FAME_ROOM 447 // MUS_EIKOU_R
+#define MUS_TRICK_HOUSE 448 // MUS_KARAKURI
+#define MUS_ENCOUNTER_TWINS 449 // MUS_HUTAGO
+#define MUS_ENCOUNTER_ELITE_FOUR 450 // MUS_SITENNOU
+#define MUS_ENCOUNTER_HIKER 451 // MUS_YAMA_EYE
+#define MUS_CONTEST_LOBBY 452 // MUS_CONLOBBY
+#define MUS_ENCOUNTER_INTERVIEWER 453 // MUS_INTER_V
+#define MUS_ENCOUNTER_CHAMPION 454 // MUS_DAIGO
+#define MUS_CREDITS 455 // MUS_THANKFOR
+#define MUS_END 456 // MUS_END
+#define MUS_VS_WILD 457 // MUS_BATTLE27
+#define MUS_VS_AQUA_MAGMA 458 // MUS_BATTLE31
+#define MUS_VS_TRAINER 459 // MUS_BATTLE20
+#define MUS_VS_GYM_LEADER 460 // MUS_BATTLE32
+#define MUS_VS_CHAMPION 461 // MUS_BATTLE33
+#define MUS_VS_REGI 462 // MUS_BATTLE36
+#define MUS_VS_KYOGRE_GROUDON 463 // MUS_BATTLE34
+#define MUS_VS_RIVAL 464 // MUS_BATTLE35
+#define MUS_VS_ELITE_FOUR 465 // MUS_BATTLE38
+#define MUS_VS_AQUA_MAGMA_LEADER 466 // MUS_BATTLE30
+#define MUS_GSC_RADIO_TOWER_TAKEOVER 467
+
+#define MUS_ROUTE_118 0x7FFF // Map is split into 2 music sections. controlled by GetCurrLocationDefaultMusic().
#endif // GUARD_CONSTANTS_SONGS_H
diff --git a/include/constants/vars.h b/include/constants/vars.h
index 795498212..e7917ee0f 100644
--- a/include/constants/vars.h
+++ b/include/constants/vars.h
@@ -1,8 +1,6 @@
#ifndef GUARD_CONSTANTS_VARS_H
#define GUARD_CONSTANTS_VARS_H
-#define VAR_0x3F20 0x3F20
-
#define VARS_START 0x4000
// temporary vars
@@ -110,7 +108,7 @@
#define VAR_LINK_CONTEST_ROOM_STATE 0x4086
#define VAR_CABLE_CLUB_STATE 0x4087
#define VAR_CONTEST_LOCATION 0x4088
-#define VAR_0x4089 0x4089 // TODO: related to decorations
+#define VAR_SECRET_BASE_INITIALIZED 0x4089
#define VAR_CONTEST_PRIZE_PICKUP 0x408A
#define VAR_LITTLEROOT_HOUSES_STATE_2 0x408C // TODO: needs more investigation
@@ -124,7 +122,7 @@
#define VAR_LILYCOVE_MUSEUM_2F_STATE 0x4094
#define VAR_LILYCOVE_FAN_CLUB_STATE 0x4095
#define VAR_BRINEY_LOCATION 0x4096
-#define VAR_0x4097 0x4097 // TODO: related to creating new secret base
+#define VAR_INIT_SECRET_BASE 0x4097
#define VAR_PETALBURG_WOODS_STATE 0x4098
#define VAR_LILYCOVE_CONTEST_LOBBY_STATE 0x4099
#define VAR_RUSTURF_TUNNEL_STATE 0x409a
@@ -172,6 +170,8 @@
#define VAR_STEVENS_HOUSE_STATE 0x40C6
#define VAR_OLDALE_STATE 0x40C7
+#define VARS_END 0x40FF
+
#define SPECIAL_VARS_START 0x8000
// special vars
// They are commonly used as parameters to commands, or return values from commands.
@@ -194,4 +194,6 @@
#define VAR_CONTEST_RANK 0x8010
#define VAR_CONTEST_CATEGORY 0x8011
+#define SPECIAL_VARS_END 0x8015
+
#endif // GUARD_CONSTANTS_VARS_H
diff --git a/include/decoration_inventory.h b/include/decoration_inventory.h
index 65bfcc8c0..abe95aef4 100644
--- a/include/decoration_inventory.h
+++ b/include/decoration_inventory.h
@@ -4,7 +4,7 @@
void ClearDecorationInventories(void);
s8 FindFreeDecorationInventorySlot(u8);
u8 InventoryContainsDecoration(u8);
-u8 GiveDecoration(u8);
+u8 AddDecoration(u8);
u8 CheckDecorationInventoryHasSpace(u8);
s8 RemoveDecorationFromInventory(u8);
void SortDecorationInventory(u8);
diff --git a/include/easy_chat.h b/include/easy_chat.h
index b86b166aa..729bc0b62 100644
--- a/include/easy_chat.h
+++ b/include/easy_chat.h
@@ -117,7 +117,7 @@ struct Shared1000
// const pointer to shared1000. easy_chat might be two separate files.
extern struct Shared1000 *const gEasyChatStruct;
-void sub_80E60D8(void);
+void ShowEasyChatScreen(void);
void sub_80E62A0(u8 arg0, u16 *arg1, void (*arg2)(void), u8 arg3);
u16 sub_80EB72C(u16 group);
void sub_80EB6FC(u16 *, u16);
diff --git a/include/field_fadetransition.h b/include/field_fadetransition.h
index 04538753a..0b33b4a72 100644
--- a/include/field_fadetransition.h
+++ b/include/field_fadetransition.h
@@ -20,7 +20,7 @@ bool32 sub_8080E70(void);
void sub_8080E88(void);
void sp13E_warp_to_last_warp(void);
void sub_8080EF0(void);
-void sp13F_fall_to_last_warp(void);
+void DoFallWarp(void);
void sub_8080F2C(u8);
void sub_8080F48(void);
void sub_8080F58(void);
diff --git a/include/field_specials.h b/include/field_specials.h
index a74ff6381..083883866 100644
--- a/include/field_specials.h
+++ b/include/field_specials.h
@@ -30,7 +30,7 @@ void ResetFanClub(void);
u8 sub_810FB10(u8 a0);
void sub_810FEFC(void);
u16 GetSlotMachineId(void);
-void sub_810FAA0(void);
+void UpdateTrainerFanClubGameClear(void);
int sub_810FB9C(void);
int sub_810FC18(void);
diff --git a/include/fieldmap.h b/include/fieldmap.h
index cdac9f79c..0579547e8 100644
--- a/include/fieldmap.h
+++ b/include/fieldmap.h
@@ -8,8 +8,9 @@
#define NUM_METATILES_TOTAL 1024
#define NUM_PALS_IN_PRIMARY 6
#define NUM_PALS_TOTAL 12
+#define MAX_MAP_DATA_SIZE 0x2800
-extern struct BackupMapLayout gUnknown_03004870;
+extern struct BackupMapLayout gBackupMapLayout;
struct MapHeader *mapconnection_get_mapheader(struct MapConnection *connection);
int GetMapBorderIdAt(int x, int y);
int CanCameraMoveInDirection(int direction);
diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h
index 488ccfbdc..3f1b25a19 100644
--- a/include/gba/m4a_internal.h
+++ b/include/gba/m4a_internal.h
@@ -1,5 +1,5 @@
-#ifndef GUARD_M4A_INTERNAL_H
-#define GUARD_M4A_INTERNAL_H
+#ifndef GUARD_GBA_M4A_INTERNAL_H
+#define GUARD_GBA_M4A_INTERNAL_H
#include "gba/gba.h"
@@ -100,7 +100,7 @@ struct CgbChannel
u8 le;
u8 sw;
u32 fr;
- u32* wp;
+ u32 *wp;
u32 cp;
u32 tp;
u32 pp;
@@ -140,55 +140,13 @@ struct SoundChannel
struct WaveData *wav;
u32 cp;
struct MusicPlayerTrack *track;
- u32 pp;
- u32 np;
- u32 d4;
+ void *pp;
+ void *np;
+ void *d4;
u16 xpi;
u16 xpc;
};
-#define MAX_DIRECTSOUND_CHANNELS 12
-
-#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer
-
-struct SoundInfo
-{
- // This field is normally equal to ID_NUMBER but it is set to other
- // values during sensitive operations for locking purposes.
- // This field should be volatile but isn't. This could potentially cause
- // race conditions.
- u32 ident;
-
- vu8 pcmDmaCounter;
-
- // Direct Sound
- u8 reverb;
- u8 maxChans;
- u8 masterVolume;
- u8 freq;
-
- u8 mode;
- u8 c15;
- u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
- u8 maxLines;
- u8 gap[3];
- s32 pcmSamplesPerVBlank;
- s32 pcmFreq;
- s32 divFreq;
- struct CgbChannel *cgbChans;
- u32 func;
- u32 intp;
- void (*CgbSound)(void);
- void (*CgbOscOff)(u8);
- u32 (*MidiKeyToCgbFreq)(u8, u8, u8);
- u32 MPlayJumpTable;
- u32 plynote;
- u32 ExtVolPit;
- u8 gap2[16];
- struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
- s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
-};
-
struct SongHeader
{
u8 trackCount;
@@ -312,7 +270,7 @@ struct MusicPlayerInfo
struct MusicPlayerTrack *tracks;
struct ToneData *tone;
u32 ident;
- u32 func;
+ void (*func)();
u32 intp;
};
@@ -334,7 +292,47 @@ struct Song
extern const struct MusicPlayer gMPlayTable[];
extern const struct Song gSongTable[];
+#define MAX_DIRECTSOUND_CHANNELS 12
+
+#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer
+
+struct SoundInfo
+{
+ // This field is normally equal to ID_NUMBER but it is set to other
+ // values during sensitive operations for locking purposes.
+ // This field should be volatile but isn't. This could potentially cause
+ // race conditions.
+ u32 ident;
+
+ vu8 pcmDmaCounter;
+
+ // Direct Sound
+ u8 reverb;
+ u8 maxChans;
+ u8 masterVolume;
+ u8 freq;
+ u8 mode;
+ u8 c15;
+ u8 pcmDmaPeriod; // number of V-blanks per PCM DMA
+ u8 maxLines;
+ u8 gap[3];
+ s32 pcmSamplesPerVBlank;
+ s32 pcmFreq;
+ s32 divFreq;
+ struct CgbChannel *cgbChans;
+ void (*func)();
+ u32 intp;
+ void (*CgbSound)();
+ void (*CgbOscOff)(u8);
+ u32 (*MidiKeyToCgbFreq)(u8, u8, u8);
+ void (**MPlayJumpTable)();
+ void (*plynote)(u8, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
+ void (*ExtVolPit)(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
+ u32 gap2[4];
+ struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS];
+ s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2];
+};
extern u8 gMPlayMemAccArea[];
@@ -443,7 +441,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
-void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
+void ply_note(u8, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
// extended sound command handler functions
void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
@@ -460,4 +458,4 @@ void ply_xswee(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_xcmd_0C(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
void ply_xcmd_0D(struct MusicPlayerInfo *, struct MusicPlayerTrack *);
-#endif // GUARD_M4A_INTERNAL_H
+#endif // GUARD_GBA_M4A_INTERNAL_H
diff --git a/include/global.h b/include/global.h
index 4ca22ff32..d207f1cd4 100644
--- a/include/global.h
+++ b/include/global.h
@@ -6,6 +6,7 @@
#include <limits.h>
#include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines.
#include "gba/gba.h"
+#include "constants/global.h"
// IDE support
#if defined(__APPLE__) || defined(__CYGWIN__)
@@ -97,91 +98,11 @@ enum
f; \
})
-enum
-{
- VERSION_SAPPHIRE = 1,
- VERSION_RUBY = 2,
- VERSION_EMERALD = 3,
-};
-
-enum LanguageId
-{
- LANGUAGE_JAPANESE = 1,
- LANGUAGE_ENGLISH = 2,
- LANGUAGE_GERMAN = 5,
-};
-
-#if defined(ENGLISH)
-#define GAME_LANGUAGE (LANGUAGE_ENGLISH)
-#elif defined(GERMAN)
-#define GAME_LANGUAGE (LANGUAGE_GERMAN)
-#endif
-
-// capacities of various saveblock objects
-#define DAYCARE_MON_COUNT 2
-#define POKEBLOCKS_COUNT 40
-#define PARTY_SIZE 6
-#define OBJECT_EVENTS_COUNT 16
-#define BERRY_TREES_COUNT 128
-#define FLAGS_COUNT 288
-#define VARS_COUNT 256
-#define MAIL_COUNT 16
-#define SECRET_BASES_COUNT 20
-#define TV_SHOWS_COUNT 25
-#define POKE_NEWS_COUNT 16
-#define PC_ITEMS_COUNT 50
-#define BAG_ITEMS_COUNT 20
-#define BAG_KEYITEMS_COUNT 20
-#define BAG_POKEBALLS_COUNT 16
-#define BAG_TMHM_COUNT 64
-#define BAG_BERRIES_COUNT 46
-
#define TEST_BUTTON(value, button) ({(value) & (button);})
#define JOY_NEW(button) (TEST_BUTTON(gMain.newKeys, button))
#define JOY_HELD(button) (TEST_BUTTON(gMain.heldKeys, button))
#define JOY_REPT(button) (TEST_BUTTON(gMain.newAndRepeatedKeys, button))
-enum
-{
- MALE,
- FEMALE
-};
-
-enum
-{
- OPTIONS_BUTTON_MODE_NORMAL,
- OPTIONS_BUTTON_MODE_LR,
- OPTIONS_BUTTON_MODE_L_EQUALS_A
-};
-
-enum
-{
- OPTIONS_TEXT_SPEED_SLOW,
- OPTIONS_TEXT_SPEED_MID,
- OPTIONS_TEXT_SPEED_FAST
-};
-
-enum
-{
- OPTIONS_SOUND_MONO,
- OPTIONS_SOUND_STEREO
-};
-
-enum
-{
- OPTIONS_BATTLE_STYLE_SHIFT,
- OPTIONS_BATTLE_STYLE_SET
-};
-
-enum
-{
- BAG_ITEMS = 1,
- BAG_POKEBALLS,
- BAG_TMsHMs,
- BAG_BERRIES,
- BAG_KEYITEMS
-};
-
struct Coords16
{
s16 x;
@@ -206,14 +127,14 @@ struct SecretBaseRecord
/*0x1A16*/ u16 sbr_field_e;
/*0x1A18*/ u8 sbr_field_10;
/*0x1A19*/ u8 sbr_field_11;
- /*0x1A1A*/ u8 decorations[16];
- /*0x1A2A*/ u8 decorationPos[16];
- /*0x1A3C*/ u32 partyPersonality[6];
- /*0x1A54*/ u16 partyMoves[6 * 4];
- /*0x1A84*/ u16 partySpecies[6];
- /*0x1A90*/ u16 partyHeldItems[6];
- /*0x1A9C*/ u8 partyLevels[6];
- /*0x1AA2*/ u8 partyEVs[6];
+ /*0x1A1A*/ u8 decorations[DECOR_MAX_SECRET_BASE];
+ /*0x1A2A*/ u8 decorationPos[DECOR_MAX_SECRET_BASE];
+ /*0x1A3C*/ u32 partyPersonality[PARTY_SIZE];
+ /*0x1A54*/ u16 partyMoves[PARTY_SIZE * 4];
+ /*0x1A84*/ u16 partySpecies[PARTY_SIZE];
+ /*0x1A90*/ u16 partyHeldItems[PARTY_SIZE];
+ /*0x1A9C*/ u8 partyLevels[PARTY_SIZE];
+ /*0x1AA2*/ u8 partyEVs[PARTY_SIZE];
};
#include "constants/game_stat.h"
@@ -699,16 +620,16 @@ struct SaveBlock1 /* 0x02025734 */
/*0x96C*/ u16 berryBlenderRecords[3];
/*0x972*/ u8 filler_972[0x6];
/*0x978*/ u16 trainerRematchStepCounter;
- /*0x97A*/ u8 trainerRematches[100];
+ /*0x97A*/ u8 trainerRematches[MAX_REMATCH_ENTRIES];
/*0x9E0*/ struct ObjectEvent objectEvents[OBJECT_EVENTS_COUNT];
- /*0xC20*/ struct ObjectEventTemplate objectEventTemplates[64];
+ /*0xC20*/ struct ObjectEventTemplate objectEventTemplates[OBJECT_EVENT_TEMPLATES_COUNT];
/*0x1220*/ u8 flags[FLAGS_COUNT];
/*0x1340*/ u16 vars[VARS_COUNT];
/*0x1540*/ u32 gameStats[NUM_GAME_STATS];
/*0x1608*/ struct BerryTree berryTrees[BERRY_TREES_COUNT];
/*0x1A08*/ struct SecretBaseRecord secretBases[SECRET_BASES_COUNT];
- /*0x2688*/ u8 playerRoomDecor[12];
- /*0x2694*/ u8 playerRoomDecorPos[12];
+ /*0x2688*/ u8 playerRoomDecor[DECOR_MAX_PLAYERS_HOUSE];
+ /*0x2694*/ u8 playerRoomDecorPos[DECOR_MAX_PLAYERS_HOUSE];
/*0x26A0*/ u8 decorDesk[10];
/*0x26AA*/ u8 decorChair[10];
/*0x26B4*/ u8 decorPlant[10];
diff --git a/include/link.h b/include/link.h
index 58e28f42d..6c9c25202 100644
--- a/include/link.h
+++ b/include/link.h
@@ -147,7 +147,7 @@ extern u16 word_3002910[];
extern bool8 gReceivedRemoteLinkPlayers;
extern bool8 gLinkOpen;
extern bool8 gLinkPlayerPending[MAX_LINK_PLAYERS];
-void (*gLinkCallback)(void);
+extern void (*gLinkCallback)(void);
extern u8 gUnknown_Debug_30030E0;
void Task_DestroySelf(u8);
diff --git a/include/macros/event.inc b/include/macros/event.inc
index 7250ec5ca..c516e993f 100644
--- a/include/macros/event.inc
+++ b/include/macros/event.inc
@@ -19,52 +19,58 @@
.endm
@ Jumps to destination and continues script execution from there. The location of the calling script is remembered and can be returned to later.
- .macro call destination
+ .macro call destination:req
.byte 0x04
.4byte \destination
.endm
@ Jumps to destination and continues script execution from there.
- .macro goto destination
+ .macro goto destination:req
.byte 0x05
.4byte \destination
.endm
@ If the result of the last comparison matches condition (see Comparison operators), jumps to destination and continues script execution from there.
- .macro goto_if condition, destination
+ .macro goto_if condition:req, destination:req
.byte 0x06
.byte \condition
.4byte \destination
.endm
@ If the result of the last comparison matches condition (see Comparison operators), calls destination.
- .macro call_if condition, destination
+ .macro call_if condition:req, destination:req
.byte 0x07
.byte \condition
.4byte \destination
.endm
@ Jumps to the standard function at index function.
- .macro gotostd function
+ .macro gotostd function:req
.byte 0x08
.byte \function
.endm
+ @ callstd function names
+ STD_OBTAIN_ITEM = 0
+ STD_FIND_ITEM = 1
+ STD_OBTAIN_DECORATION = 7
+ STD_REGISTER_MATCH_CALL = 8
+
@ Calls the standard function at index function.
- .macro callstd function
+ .macro callstd function:req
.byte 0x09
.byte \function
.endm
@ If the result of the last comparison matches condition (see Comparison operators), jumps to the standard function at index function.
- .macro gotostd_if condition, function
+ .macro gotostd_if condition:req, function:req
.byte 0x0a
.byte \condition
.byte \function
.endm
@ If the result of the last comparison matches condition (see Comparison operators), calls the standard function at index function.
- .macro callstd_if condition, function
+ .macro callstd_if condition:req, function:req
.byte 0x0b
.byte \condition
.byte \function
@@ -81,183 +87,181 @@
.endm
@ Sets some status related to Mystery Event.
- .macro setmysteryeventstatus value
+ .macro setmysteryeventstatus value:req
.byte 0x0e
.byte \value
.endm
@ Sets the specified script bank to value.
- .macro loadword destination, value
+ .macro loadword destination:req, value:req
.byte 0x0f
.byte \destination
.4byte \value
.endm
@ Sets the specified script bank to value.
- .macro loadbyte destination, value
+ .macro loadbyte destination:req, value:req
.byte 0x10
.byte \destination
.byte \value
.endm
@ Sets the byte at offset to value.
- .macro writebytetoaddr value, offset
+ .macro writebytetoaddr value:req, offset:req
.byte 0x11
.byte \value
.4byte \offset
.endm
@ Copies the byte value at source into the specified script bank.
- .macro loadbytefromaddr destination, source
+ .macro loadbytefromaddr destination:req, source:req
.byte 0x12
.byte \destination
.4byte \source
.endm
@ Not sure. Judging from XSE's description I think it takes the least-significant byte in bank source and writes it to destination.
- .macro setptrbyte source, destination
+ .macro setptrbyte source:req, destination:req
.byte 0x13
.byte \source
.4byte \destination
.endm
@ Copies the contents of bank source into bank destination.
- .macro copylocal destination, source
+ .macro copylocal destination:req, source:req
.byte 0x14
.byte \destination
.byte \source
.endm
@ Copies the byte at source to destination, replacing whatever byte was previously there.
- .macro copybyte destination, source
+ .macro copybyte destination:req, source:req
.byte 0x15
.4byte \destination
.4byte \source
.endm
@ Changes the value of destination to value.
- .macro setvar destination, value
+ .macro setvar destination:req, value:req
.byte 0x16
.2byte \destination
.2byte \value
.endm
@ Changes the value of destination by adding value to it. Overflow is not prevented (0xFFFF + 1 = 0x0000).
- .macro addvar destination, value
+ .macro addvar destination:req, value:req
.byte 0x17
.2byte \destination
.2byte \value
.endm
@ Changes the value of destination by subtracting value to it. Overflow is not prevented (0x0000 - 1 = 0xFFFF).
- .macro subvar destination, value
+ .macro subvar destination:req, value:req
.byte 0x18
.2byte \destination
.2byte \value
.endm
@ Copies the value of source into destination.
- .macro copyvar destination, source
+ .macro copyvar destination:req, source:req
.byte 0x19
.2byte \destination
.2byte \source
.endm
@ If source is not a variable, then this function acts like setvar. Otherwise, it acts like copyvar.
- .macro setorcopyvar destination, source
+ .macro setorcopyvar destination:req, source:req
.byte 0x1a
.2byte \destination
.2byte \source
.endm
@ Compares the values of script banks a and b, after forcing the values to bytes.
- .macro compare_local_to_local byte1, byte2
+ .macro compare_local_to_local byte1:req, byte2:req
.byte 0x1b
.byte \byte1
.byte \byte2
.endm
@ Compares the least-significant byte of the value of script bank a to a fixed byte value (b).
- .macro compare_local_to_value a, b
+ .macro compare_local_to_value a:req, b:req
.byte 0x1c
.byte \a
.byte \b
.endm
@ Compares the least-significant byte of the value of script bank a to the byte located at offset b.
- .macro compare_local_to_addr a, b
+ .macro compare_local_to_addr a:req, b:req
.byte 0x1d
.byte \a
.4byte \b
.endm
@ Compares the byte located at offset a to the least-significant byte of the value of script bank b.
- .macro compare_addr_to_local a, b
+ .macro compare_addr_to_local a:req, b:req
.byte 0x1e
.4byte \a
.byte \b
.endm
@ Compares the byte located at offset a to a fixed byte value (b).
- .macro compare_addr_to_value a, b
+ .macro compare_addr_to_value a:req, b:req
.byte 0x1f
.4byte \a
.byte \b
.endm
@ Compares the byte located at offset a to the byte located at offset b.
- .macro compare_addr_to_addr a, b
+ .macro compare_addr_to_addr a:req, b:req
.byte 0x20
.4byte \a
.4byte \b
.endm
@ Compares the value of `var` to a fixed word value (b).
- .macro compare_var_to_value var, value
+ .macro compare_var_to_value var:req, value:req
.byte 0x21
.2byte \var
.2byte \value
.endm
@ Compares the value of `var1` to the value of `var2`.
- .macro compare_var_to_var var1, var2
+ .macro compare_var_to_var var1:req, var2:req
.byte 0x22
.2byte \var1
.2byte \var2
.endm
@ Generic compare macro which attempts to deduce argument types based on their values
- @ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers
- .macro compare arg1, arg2
- .if (((\arg1) >> 12) == 4 || ((\arg1) >> 12) == 8) && (((\arg2) >> 12) == 4 || ((\arg2) >> 12) == 8)
- compare_var_to_var (\arg1), (\arg2)
- .elseif (((\arg1) >> 12) == 4 || ((\arg1) >> 12) == 8) && ((\arg2) >= -0xFFFF && (\arg2) <= 0xFFFF)
- compare_var_to_value (\arg1), ((\arg2) & 0xFFFF)
+ @ Any values between 0x4000 to 0x40FF and 0x8000 to 0x8015 are considered event variable identifiers
+ .macro compare var:req, arg:req
+ .if ((\arg >= VARS_START && \arg <= VARS_END) || (\arg >= SPECIAL_VARS_START && \arg <= SPECIAL_VARS_END))
+ compare_var_to_var \var, \arg
.else
- .error "Invalid arguments for 'compare'"
+ compare_var_to_value \var, \arg
.endif
.endm
@ Calls the native C function stored at `func`.
- .macro callnative func
+ .macro callnative func:req
.byte 0x23
.4byte \func
.endm
@ Replaces the script with the function stored at `func`. Execution returns to the bytecode script when func returns TRUE.
- .macro gotonative func
+ .macro gotonative func:req
.byte 0x24
.4byte \func
.endm
@ Calls a special function; that is, a function designed for use by scripts and listed in a table of pointers.
- .macro special function
+ .macro special function:req
.byte 0x25
.2byte SPECIAL_\function
.endm
@ Calls a special function. That function's output (if any) will be written to the variable you specify.
- .macro specialvar output, function
+ .macro specialvar output:req, function:req
.byte 0x26
.2byte \output
.2byte SPECIAL_\function
@@ -269,38 +273,38 @@
.endm
@ Blocks script execution for time (frames? milliseconds?).
- .macro delay time
+ .macro delay time:req
.byte 0x28
.2byte \time
.endm
@ Sets a to 1.
- .macro setflag a
+ .macro setflag a:req
.byte 0x29
.2byte \a
.endm
@ Sets a to 0.
- .macro clearflag a
+ .macro clearflag a:req
.byte 0x2a
.2byte \a
.endm
@ Compares a to 1.
- .macro checkflag a
+ .macro checkflag a:req
.byte 0x2b
.2byte \a
.endm
@ Initializes the RTC`s local time offset to the given hour and minute. In FireRed, this command is a nop.
- .macro initclock hour, minute
+ .macro initclock hour:req, minute:req
.byte 0x2c
.2byte \hour
.2byte \minute
.endm
@ Runs time based events. In FireRed, this command is a nop.
- .macro dodailyevents
+ .macro dotimebasedevents
.byte 0x2d
.endm
@@ -310,7 +314,7 @@
.endm
@ Plays the specified (sound_number) sound. Only one sound may play at a time, with newer ones interrupting older ones.
- .macro playse sound_number
+ .macro playse sound_number:req
.byte 0x2f
.2byte \sound_number
.endm
@@ -321,7 +325,7 @@
.endm
@ Plays the specified (fanfare_number) fanfare.
- .macro playfanfare fanfare_number
+ .macro playfanfare fanfare_number:req
.byte 0x31
.2byte \fanfare_number
.endm
@@ -332,14 +336,14 @@
.endm
@ Plays the specified (song_number) song. The byte is apparently supposed to be 0x00.
- .macro playbgm song_number, unknown
+ .macro playbgm song_number:req, unknown:req
.byte 0x33
.2byte \song_number
.byte \unknown
.endm
@ Saves the specified (song_number) song to be played later.
- .macro savebgm song_number
+ .macro savebgm song_number:req
.byte 0x34
.2byte \song_number
.endm
@@ -350,25 +354,25 @@
.endm
@ Crossfades the currently-playng song into the specified (song_number) song.
- .macro fadenewbgm song_number
+ .macro fadenewbgm song_number:req
.byte 0x36
.2byte \song_number
.endm
@ Fades out the currently-playing song.
- .macro fadeoutbgm speed
+ .macro fadeoutbgm speed:req
.byte 0x37
.byte \speed
.endm
@ Fades the previously-playing song back in.
- .macro fadeinbgm speed
+ .macro fadeinbgm speed:req
.byte 0x38
.byte \speed
.endm
@ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (X, Y) on the map.
- .macro warp map, warp, X, Y
+ .macro warp map:req, warp:req, X:req, Y:req
.byte 0x39
map \map
.byte \warp
@@ -377,7 +381,7 @@
.endm
@ Clone of warp that does not play a sound effect.
- .macro warpsilent map, warp, X, Y
+ .macro warpsilent map:req, warp:req, X:req, Y:req
.byte 0x3a
map \map
.byte \warp
@@ -386,7 +390,7 @@
.endm
@ Clone of warp that plays a door opening animation before stepping upwards into it.
- .macro warpdoor map, warp, X, Y
+ .macro warpdoor map:req, warp:req, X:req, Y:req
.byte 0x3b
map \map
.byte \warp
@@ -395,13 +399,13 @@
.endm
@ Warps the player to another map using a hole animation.
- .macro warphole map
+ .macro warphole map:req
.byte 0x3c
map \map
.endm
@ Clone of warp that uses a teleport effect. It is apparently only used in R/S/E.
- .macro warpteleport map, warp, X, Y
+ .macro warpteleport map:req, warp:req, X:req, Y:req
.byte 0x3d
map \map
.byte \warp
@@ -410,7 +414,7 @@
.endm
@ Sets the warp destination to be used later.
- .macro setwarp map, warp, X, Y
+ .macro setwarp map:req, warp:req, X:req, Y:req
.byte 0x3e
map \map
.byte \warp
@@ -419,7 +423,7 @@
.endm
@ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
- .macro setdynamicwarp map, warp, X, Y
+ .macro setdynamicwarp map:req, warp:req, X:req, Y:req
.byte 0x3f
map \map
.byte \warp
@@ -428,7 +432,7 @@
.endm
@ Sets the destination that diving or emerging from a dive will take the player to.
- .macro setdivewarp map, warp, X, Y
+ .macro setdivewarp map:req, warp:req, X:req, Y:req
.byte 0x40
map \map
.byte \warp
@@ -437,7 +441,7 @@
.endm
@ Sets the destination that falling into a hole will take the player to.
- .macro setholewarp map, warp, X, Y
+ .macro setholewarp map:req, warp:req, X:req, Y:req
.byte 0x41
map \map
.byte \warp
@@ -446,93 +450,93 @@
.endm
@ Retrieves the player's zero-indexed X- and Y-coordinates in the map, and stores them in the specified variables.
- .macro getplayerxy X, Y
+ .macro getplayerxy X:req, Y:req
.byte 0x42
.2byte \X
.2byte \Y
.endm
- @ Retrieves the number of Pokemon in the player's party, and stores that number in variable 0x800D (LASTRESULT).
+ @ Retrieves the number of Pokemon in the player's party, and stores that number in VAR_RESULT.
.macro getpartysize
.byte 0x43
.endm
- @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and variable 0x800D (LASTRESULT) will be set to 0x0001; otherwise, LASTRESULT is set to 0x0000.
- .macro giveitem index, quantity
+ @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
+ .macro additem index:req, quantity=1
.byte 0x44
.2byte \index
.2byte \quantity
.endm
@ Removes quantity of item index from the player's Bag.
- .macro takeitem index, quantity
+ .macro removeitem index:req, quantity=1
.byte 0x45
.2byte \index
.2byte \quantity
.endm
- @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets variable 0x800D (LASTRESULT) to 0x0001 if there is room, or 0x0000 is there is no room.
- .macro checkitemspace index, quantity
+ @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room.
+ .macro checkitemspace index:req, quantity=1
.byte 0x46
.2byte \index
.2byte \quantity
.endm
- @ Checks if the player has quantity or more of item index in their Bag. Sets variable 0x800D (LASTRESULT) to 0x0001 if the player has enough of the item, or 0x0000 if they have fewer than quantity of the item.
- .macro checkitem index, quantity
+ @ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has enough of the item, or FALSE if they have fewer than quantity of the item.
+ .macro checkitem index:req, quantity=1
.byte 0x47
.2byte \index
.2byte \quantity
.endm
- @ Checks which Bag pocket the specified (index) item belongs in, and writes the value to variable 0x800D (LASTRESULT). This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
- .macro checkitemtype index
+ @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
+ .macro checkitemtype index:req
.byte 0x48
.2byte \index
.endm
@ Adds a quantity amount of item index to the player's PC. Both arguments can be variables.
- .macro givepcitem index, quantity
+ .macro addpcitem index:req, quantity=1
.byte 0x49
.2byte \index
.2byte \quantity
.endm
@ Checks for quantity amount of item index in the player's PC. Both arguments can be variables.
- .macro checkpcitem index, quantity
+ .macro checkpcitem index:req, quantity=1
.byte 0x4a
.2byte \index
.2byte \quantity
.endm
@ Adds decoration to the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro givedecoration decoration
+ .macro adddecoration decoration:req
.byte 0x4b
.2byte \decoration
.endm
@ Removes a decoration from the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro takedecoration decoration
+ .macro removedecoration decoration:req
.byte 0x4c
.2byte \decoration
.endm
@ Checks for decoration in the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro checkdecor decoration
+ .macro checkdecor decoration:req
.byte 0x4d
.2byte \decoration
.endm
- @ Checks if the player has enough space in their PC to hold decoration. Sets variable 0x800D (LASTRESULT) to 0x0001 if there is room, or 0x0000 is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
- .macro checkdecorspace decoration
+ @ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
+ .macro checkdecorspace decoration:req
.byte 0x4e
.2byte \decoration
.endm
- @ Applies the movement data at movements to the specified (index) Object event. Also closes any standard message boxes that are still open.
- @ This command in fact uses variables to access the Object event ID. So, for example, if you setvar 0x8000 to 0x3, and then use applymovementpos 0x8000 @move1, Object event 3 will have the movements at @move1 applied to them.
- .macro applymovement index, movements, mapGroup, mapNum
- .ifb \mapGroup
+ @ Applies the movement data at movements to the specified (index) Object. Also closes any standard message boxes that are still open.
+ @ If no map is specified, then the current map is used.
+ .macro applymovement index:req, movements:req, map
+ .ifb \map
.byte 0x4f
.2byte \index
.4byte \movements
@@ -540,117 +544,116 @@
.byte 0x50
.2byte \index
.4byte \movements
- .byte \mapGroup
- .byte \mapNum
+ map \map
.endif
.endm
@ Blocks script execution until the movements being applied to the specified (index) Object event finish. If the specified Object event is 0x0000, then the command will block script execution until all Object events affected by applymovement finish their movements. If the specified Object event is not currently being manipulated with applymovement, then this command does nothing.
- .macro waitmovement index, mapBank, mapNum
- .ifb \mapBank
+ @ If no map is specified, then the current map is used.
+ .macro waitmovement index:req, map
+ .ifb \map
.byte 0x51
.2byte \index
.else
.byte 0x52
.2byte \index
- .byte \mapBank
- .byte \mapNum
+ map \map
.endif
.endm
- @ Attempts to hide the specified (local_ID, a local ID) Object event on the specified map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
+ @ Attempts to hide the specified (index) Object event on the specified map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
@ If no map is specified, then the current map is used
- .macro removeobject localId, mapGroup, mapNum
- .ifb \mapGroup
+ .macro removeobject index:req, map
+ .ifb \map
.byte 0x53
- .2byte \localId
+ .2byte \index
.else
.byte 0x54
- .2byte \localId
- .byte \mapGroup
- .byte \mapNum
+ .2byte \index
+ map \map
.endif
.endm
- .macro addobject localId, mapGroup, mapNum
- .ifb \mapGroup
+ @ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
+ @ If no map is specified, then the current map is used.
+ .macro addobject index:req, map
+ .ifb \map
.byte 0x55
- .2byte \localId
+ .2byte \index
.else
.byte 0x56
- .2byte \localId
- .byte \mapGroup
- .byte \mapNum
+ .2byte \index
+ map \map
.endif
.endm
@ Sets the specified (index) Object's position on the current map.
- .macro setobjectxy index, x, y
+ .macro setobjectxy index:req, x:req, y:req
.byte 0x57
.2byte \index
.2byte \x
.2byte \y
.endm
- .macro showobjectat index, map
+ .macro showobjectat index:req, map:req
.byte 0x58
.2byte \index
map \map
.endm
- .macro hideobjectat index, map
+ .macro hideobjectat index:req, map:req
.byte 0x59
.2byte \index
map \map
.endm
- @ If the script was called by a Object event, then that Object will turn to face toward the tile that the player is stepping off of.
+ @ If the script was called by an Object, then that Object will turn to face toward the metatile that the player is standing on.
.macro faceplayer
.byte 0x5a
.endm
- .macro turnobject index, direction
+ .macro turnobject index:req, direction:req
.byte 0x5b
.2byte \index
.byte \direction
.endm
@ If the Trainer flag for Trainer index is not set, this command does absolutely nothing.
- .macro trainerbattle type, trainer, word, pointer1, pointer2, pointer3, pointer4
+ .macro trainerbattle type:req, trainer:req, local_id:req, pointer1:req, pointer2, pointer3, pointer4
.byte 0x5c
.byte \type
.2byte \trainer
- .2byte \word
- .if \type == 0
+ .2byte \local_id
+ .if \type == TRAINER_BATTLE_SINGLE
.4byte \pointer1 @ text
.4byte \pointer2 @ text
- .elseif \type == 1
+ .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ event script
- .elseif \type == 2
+ .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ event script
- .elseif \type == 3
+ .elseif \type == TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT
.4byte \pointer1 @ text
- .elseif \type == 4
+ .elseif \type == TRAINER_BATTLE_DOUBLE
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
- .elseif \type == 5
+ .elseif \type == TRAINER_BATTLE_REMATCH
.4byte \pointer1 @ text
.4byte \pointer2 @ text
- .elseif \type == 6
+ .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
.4byte \pointer4 @ event script
- .elseif \type == 7
+ .elseif \type == TRAINER_BATTLE_REMATCH_DOUBLE
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
- .elseif \type == 8
+ .elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
@@ -658,6 +661,45 @@
.endif
.endm
+ @ Starts a single trainer battle, takes a trainer, intro text, loss text, and an optional event script
+ @ when used with an event script, you can also pass in an optional flag to disable music
+ .macro trainerbattle_single trainer:req, intro_text:req, lose_text:req, event_script=FALSE, music=TRUE
+ .if \event_script == FALSE
+ trainerbattle TRAINER_BATTLE_SINGLE, \trainer, 0, \intro_text, \lose_text
+ .elseif \music == TRUE
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, \trainer, 0, \intro_text, \lose_text, \event_script
+ .else
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \event_script
+ .endif
+ .endm
+
+ @ Starts a double trainer battle, takes a trainer, intro text, loss text, text for when you have too few pokemon
+ @ and an optional event script, when used with an event script you can pass in an optional flag to disable music
+ .macro trainerbattle_double trainer:req, intro_text:req, lose_text:req, not_enough_pkmn_text:req, event_script=FALSE, music=TRUE
+ .if \event_script == FALSE
+ trainerbattle TRAINER_BATTLE_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text
+ .elseif \music == TRUE
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script
+ .else
+ trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script
+ .endif
+ .endm
+
+ @ Starts a rematch battle, takes a trainer, intro text and loss text
+ .macro trainerbattle_rematch trainer:req, intro_text:req, lose_text:req
+ trainerbattle TRAINER_BATTLE_REMATCH, \trainer, 0, \intro_text, \lose_text
+ .endm
+
+ @ Starts a rematch double battle, takes a trainer, intro text, loss text, and text for when you have too few pokemon
+ .macro trainerbattle_rematch_double trainer:req, intro_text:req, lose_text:req, not_enough_pkmn_text:req
+ trainerbattle TRAINER_BATTLE_REMATCH_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text
+ .endm
+
+ @ Starts a trainer battle, skipping intro text, takes a trainer and loss text
+ .macro trainerbattle_no_intro trainer:req, lose_text:req
+ trainerbattle TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT, \trainer, 0, \lose_text
+ .endm
+
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
.macro trainerbattlebegin
.byte 0x5d
@@ -674,36 +716,36 @@
.endm
@ Compares Flag (trainer + 0x500) to 1. (If the flag is set, then the trainer has been defeated by the player.)
- .macro checktrainerflag trainer
+ .macro checktrainerflag trainer:req
.byte 0x60
.2byte \trainer
.endm
@ Sets Flag (trainer + 0x500).
- .macro settrainerflag trainer
+ .macro settrainerflag trainer:req
.byte 0x61
.2byte \trainer
.endm
@ Clears Flag (trainer + 0x500).
- .macro cleartrainerflag trainer
+ .macro cleartrainerflag trainer:req
.byte 0x62
.2byte \trainer
.endm
- .macro setobjectxyperm index, x, y
+ .macro setobjectxyperm index:req, x:req, y:req
.byte 0x63
.2byte \index
.2byte \x
.2byte \y
.endm
- .macro moveobjectoffscreen index
+ .macro moveobjectoffscreen index:req
.byte 0x64
.2byte \index
.endm
- .macro setobjectmovementtype word, byte
+ .macro setobjectmovementtype word:req, byte:req
.byte 0x65
.2byte \word
.byte \byte
@@ -715,7 +757,7 @@
.endm
@ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
- .macro message text
+ .macro message text:req
.byte 0x67
.4byte \text
.endm
@@ -750,15 +792,15 @@
.byte 0x6d
.endm
- @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in variable 0x800D (LASTRESULT); 0x0000 for "NO" or if the user pressed B, and 0x0001 for "YES".
- .macro yesnobox x, y
+ @ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
+ .macro yesnobox x:req, y:req
.byte 0x6e
.byte \x
.byte \y
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
- .macro multichoice x, y, list, b
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
+ .macro multichoice x:req, y:req, list:req, b:req
.byte 0x6f
.byte \x
.byte \y
@@ -766,8 +808,8 @@
.byte \b
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
- .macro multichoicedefault x, y, list, default, b
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
+ .macro multichoicedefault x:req, y:req, list:req, default:req, b:req
.byte 0x70
.byte \x
.byte \y
@@ -776,8 +818,8 @@
.byte \b
.endm
- @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
- .macro multichoicegrid x, y, list, per_row, B
+ @ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (sMultichoiceLists) and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
+ .macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req
.byte 0x71
.byte \x
.byte \y
@@ -786,7 +828,7 @@
.byte \B
.endm
- .macro drawbox byte1, byte2, byte3, byte4
+ .macro drawbox byte1:req, byte2:req, byte3:req, byte4:req
.byte 0x72
.byte \byte1
.byte \byte2
@@ -794,7 +836,7 @@
.byte \byte4
.endm
- .macro erasebox byte1, byte2, byte3, byte4
+ .macro erasebox byte1:req, byte2:req, byte3:req, byte4:req
.byte 0x73
.byte \byte1
.byte \byte2
@@ -802,7 +844,7 @@
.byte \byte4
.endm
- .macro drawboxtext byte1, byte2, byte3, byte4
+ .macro drawboxtext byte1:req, byte2:req, byte3:req, byte4:req
.byte 0x74
.byte \byte1
.byte \byte2
@@ -811,147 +853,147 @@
.endm
@ Displays a box containing the front sprite for the specified (species) Pokemon species.
- .macro drawmonpic species, x, y
+ .macro showmonpic species:req, x:req, y:req
.byte 0x75
.2byte \species
.byte \x
.byte \y
.endm
- @ Hides all boxes displayed with drawmonpic.
- .macro erasemonpic
+ @ Hides all boxes displayed with showmonpic.
+ .macro hidemonpic
.byte 0x76
.endm
@ Draws an image of the winner of the contest. In FireRed, this command is a nop. (The argument is discarded.)
- .macro drawcontestwinner a
+ .macro showcontestwinner a:req
.byte 0x77
.byte \a
.endm
@ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille characters.
- .macro braillemessage text
+ .macro braillemessage text:req
.byte 0x78
.4byte \text
.endm
- @ Gives the player one of the specified (species) Pokemon at level level holding item. The unknown arguments should all be zeroes.
- .macro givemon species, level, item, unknown1, unknown2, unknown3
+ @ Gives the player one of the specified (species) Pokemon at level level holding item. The trailing 0s are unused parameters
+ .macro givemon species:req, level:req, item:req
.byte 0x79
.2byte \species
.byte \level
.2byte \item
- .4byte \unknown1
- .4byte \unknown2
- .byte \unknown3
+ .4byte 0x0
+ .4byte 0x0
+ .byte 0
.endm
- .macro giveegg species
+ .macro giveegg species:req
.byte 0x7a
.2byte \species
.endm
- .macro setmonmove index, slot, move
+ .macro setmonmove index:req, slot:req, move:req
.byte 0x7b
.byte \index
.byte \slot
.2byte \move
.endm
- @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, variable 0x800D (LASTRESULT) is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, LASTRESULT is set to 0x0006. Variable 0x8004 is also set to this Pokemon's species.
- .macro checkpartymove index
+ @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE. VAR_0x8004 is also set to this Pokemon's species.
+ .macro checkpartymove index:req
.byte 0x7c
.2byte \index
.endm
@ Writes the name of the Pokemon at index species to the specified buffer.
- .macro bufferspeciesname out, species
+ .macro bufferspeciesname out:req, species:req
.byte 0x7d
.byte \out
.2byte \species
.endm
@ Writes the name of the species of the first Pokemon in the player's party to the specified buffer.
- .macro bufferleadmonspeciesname out
+ .macro bufferleadmonspeciesname out:req
.byte 0x7e
.byte \out
.endm
@ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer. If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
- .macro bufferpartymonnick out, slot
+ .macro bufferpartymonnick out:req, slot:req
.byte 0x7f
.byte \out
.2byte \slot
.endm
@ Writes the name of the item at index item to the specified buffer. If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
- .macro bufferitemname out, item
+ .macro bufferitemname out:req, item:req
.byte 0x80
.byte \out
.2byte \item
.endm
@ Writes the name of the decoration at index decoration to the specified buffer. In FireRed, this command is a nop.
- .macro bufferdecorationname out, decoration
+ .macro bufferdecorationname out:req, decoration:req
.byte 0x81
.byte \out
.2byte \decoration
.endm
@ Writes the name of the move at index move to the specified buffer.
- .macro buffermovename out, move
+ .macro buffermovename out:req, move:req
.byte 0x82
.byte \out
.2byte \move
.endm
@ Converts the value of input to a decimal string, and writes that string to the specified buffer.
- .macro buffernumberstring out, input
+ .macro buffernumberstring out:req, input:req
.byte 0x83
.byte \out
.2byte \input
.endm
@ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all, so specifying an invalid standard string (e.x. 0x2B) can and usually will cause data corruption.
- .macro bufferstdstring out, index
+ .macro bufferstdstring out:req, index:req
.byte 0x84
.byte \out
.2byte \index
.endm
@ Copies the string at offset to the specified buffer.
- .macro bufferstring out, offset
+ .macro bufferstring out:req, offset:req
.byte 0x85
.byte \out
.4byte \offset
.endm
@ Opens the Pokemart system, offering the specified products for sale.
- .macro pokemart products
+ .macro pokemart products:req
.byte 0x86
.4byte \products
.endm
@ Opens the Pokemart system and treats the list of items as decorations.
- .macro pokemartdecoration products
+ .macro pokemartdecoration products:req
.byte 0x87
.4byte \products
.endm
@ Apparent clone of pokemartdecoration.
- .macro pokemartdecoration2 products
+ .macro pokemartdecoration2 products:req
.byte 0x88
.4byte \products
.endm
@ Starts up the slot machine minigame.
- .macro playslotmachine word
+ .macro playslotmachine word:req
.byte 0x89
.2byte \word
.endm
@ Sets a berry tree's specific berry and growth stage. In FireRed, this command is a nop.
- .macro setberrytree tree_id, berry, growth_stage
+ .macro setberrytree tree_id:req, berry:req, growth_stage:req
.byte 0x8a
.byte \tree_id
.byte \berry
@@ -978,132 +1020,132 @@
.byte 0x8e
.endm
- @ Stores a random integer between 0 and limit in variable 0x800D (LASTRESULT).
- .macro random limit
+ @ Stores a random integer between 0 and limit in VAR_RESULT.
+ .macro random limit:req
.byte 0x8f
.2byte \limit
.endm
@ If check is 0x00, this command adds value to the player's money.
- .macro givemoney value, check
+ .macro addmoney value:req, check:req
.byte 0x90
.4byte \value
.byte \check
.endm
@ If check is 0x00, this command subtracts value from the player's money.
- .macro takemoney value, check
+ .macro removemoney value:req, check:req
.byte 0x91
.4byte \value
.byte \check
.endm
- @ If check is 0x00, this command will check if the player has value or more money; script variable 0x800D (LASTRESULT) is set to 0x0001 if the player has enough money, or 0x0000 if the do not.
- .macro checkmoney value, check
+ @ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player has enough money, or FALSE if they do not.
+ .macro checkmoney value:req, check:req
.byte 0x92
.4byte \value
.byte \check
.endm
@ Spawns a secondary box showing how much money the player has.
- .macro showmoneybox x, y
+ .macro showmoneybox x:req, y:req
.byte 0x93
.byte \x
.byte \y
.endm
@ Hides the secondary box spawned by showmoney.
- .macro hidemoneybox x, y
+ .macro hidemoneybox x:req, y:req
.byte 0x94
.byte \x
.byte \y
.endm
@ Updates the secondary box spawned by showmoney. Consumes but does not use arguments.
- .macro updatemoneybox x, y
+ .macro updatemoneybox x:req, y:req
.byte 0x95
.byte \x
.byte \y
.endm
@ Gets the price reduction for the index given. In FireRed, this command is a nop.
- .macro getpricereduction index
+ .macro getpricereduction index:req
.byte 0x96
.2byte \index
.endm
@ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white.
- .macro fadescreen effect
+ .macro fadescreen mode:req
.byte 0x97
- .byte \effect
+ .byte \mode
.endm
@ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white. Other modes may exist.
- .macro fadescreenspeed effect, speed
+ .macro fadescreenspeed mode:req, speed:req
.byte 0x98
- .byte \effect
+ .byte \mode
.byte \speed
.endm
- .macro setflashradius word
+ .macro setflashradius word:req
.byte 0x99
.2byte \word
.endm
- .macro animateflash byte
+ .macro animateflash byte:req
.byte 0x9a
.byte \byte
.endm
- .macro messageautoscroll pointer
+ .macro messageautoscroll pointer:req
.byte 0x9b
.4byte \pointer
.endm
@ Executes the specified field move animation.
- .macro dofieldeffect animation
+ .macro dofieldeffect animation:req
.byte 0x9c
.2byte \animation
.endm
@ Sets up the field effect argument argument with the value value.
- .macro setfieldeffectargument argument, param
+ .macro setfieldeffectargument argument:req, param:req
.byte 0x9d
.byte \argument
.2byte \param
.endm
@ Blocks script execution until all playing field move animations complete.
- .macro waitfieldeffect animation
+ .macro waitfieldeffect animation:req
.byte 0x9e
.2byte \animation
.endm
@ Sets which healing place the player will return to if all of the Pokemon in their party faint.
- .macro setrespawn heallocation
+ .macro setrespawn heallocation:req
.byte 0x9f
.2byte \heallocation
.endm
- @ Checks the player's gender. If male, then 0x0000 is stored in variable 0x800D (LASTRESULT). If female, then 0x0001 is stored in LASTRESULT.
+ @ Checks the player's gender. If male, then MALE (0) is stored in VAR_RESULT. If female, then FEMALE (1) is stored in VAR_RESULT.
.macro checkplayergender
.byte 0xa0
.endm
@ Plays the specified (species) Pokemon's cry. You can use waitcry to block script execution until the sound finishes.
- .macro playmoncry species, effect
+ .macro playmoncry species:req, effect:req
.byte 0xa1
.2byte \species
.2byte \effect
.endm
@ Changes the metatile at (x, y) on the current map.
- .macro setmetatile x, y, metatile_number, tile_attrib
+ .macro setmetatile x:req, y:req, metatile_number:req, has_collision:req
.byte 0xa2
.2byte \x
.2byte \y
.2byte \metatile_number
- .2byte \tile_attrib
+ .2byte \has_collision
.endm
@ Queues a weather change to the default weather for the map.
@@ -1112,7 +1154,7 @@
.endm
@ Queues a weather change to type weather.
- .macro setweather type
+ .macro setweather type:req
.byte 0xa4
.2byte \type
.endm
@@ -1123,30 +1165,30 @@
.endm
@ This command manages cases in which maps have tiles that change state when stepped on (specifically, cracked/breakable floors).
- .macro setstepcallback subroutine
+ .macro setstepcallback subroutine:req
.byte 0xa6
.byte \subroutine
.endm
- .macro setmaplayoutindex index
+ .macro setmaplayoutindex index:req
.byte 0xa7
.2byte \index
.endm
- .macro setobjectpriority index, map, priority
+ .macro setobjectpriority index:req, map:req, priority:req
.byte 0xa8
.2byte \index
map \map
.byte \priority
.endm
- .macro resetobjectpriority index, map
+ .macro resetobjectpriority index:req, map:req
.byte 0xa9
.2byte \index
map \map
.endm
- .macro createvobject sprite, byte2, x, y, elevation, direction
+ .macro createvobject sprite:req, byte2:req, x:req, y:req, elevation, direction
.byte 0xaa
.byte \sprite
.byte \byte2
@@ -1156,21 +1198,21 @@
.byte \direction
.endm
- .macro turnvobject index, direction
+ .macro turnvobject index:req, direction:req
.byte 0xab
.byte \index
.byte \direction
.endm
@ Opens the door metatile at (X, Y) with an animation.
- .macro opendoor x, y
+ .macro opendoor x:req, y:req
.byte 0xac
.2byte \x
.2byte \y
.endm
@ Closes the door metatile at (X, Y) with an animation.
- .macro closedoor x, y
+ .macro closedoor x:req, y:req
.byte 0xad
.2byte \x
.2byte \y
@@ -1182,14 +1224,14 @@
.endm
@ Sets the door tile at (x, y) to be open without an animation.
- .macro setdooropen x, y
+ .macro setdooropen x:req, y:req
.byte 0xaf
.2byte \x
.2byte \y
.endm
@ Sets the door tile at (x, y) to be closed without an animation.
- .macro setdoorclosed x, y
+ .macro setdoorclosed x:req, y:req
.byte 0xb0
.2byte \x
.2byte \y
@@ -1205,23 +1247,23 @@
.byte 0xb2
.endm
- .macro checkcoins out
+ .macro checkcoins count:req
.byte 0xb3
- .2byte \out
+ .2byte \count
.endm
- .macro givecoins count
+ .macro addcoins count:req
.byte 0xb4
.2byte \count
.endm
- .macro takecoins count
+ .macro removecoins count:req
.byte 0xb5
.2byte \count
.endm
@ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
- .macro setwildbattle species, level, item
+ .macro setwildbattle species:req, level:req, item:req
.byte 0xb6
.2byte \species
.byte \level
@@ -1233,78 +1275,78 @@
.byte 0xb7
.endm
- .macro setvaddress addr
+ .macro setvaddress pointer:req
.byte 0xb8
- .4byte \addr
+ .4byte \pointer
.endm
- .macro vgoto pointer
+ .macro vgoto pointer:req
.byte 0xb9
.4byte \pointer
.endm
- .macro vcall pointer
+ .macro vcall pointer:req
.byte 0xba
.4byte \pointer
.endm
- .macro vgoto_if byte, pointer
+ .macro vgoto_if byte:req, pointer:req
.byte 0xbb
.byte \byte
.4byte \pointer
.endm
- .macro vcall_if byte, pointer
+ .macro vcall_if byte:req, pointer:req
.byte 0xbc
.byte \byte
.4byte \pointer
.endm
- .macro vmessage pointer
+ .macro vmessage pointer:req
.byte 0xbd
.4byte \pointer
.endm
- .macro vloadptr pointer
+ .macro vloadptr pointer:req
.byte 0xbe
.4byte \pointer
.endm
- .macro vbufferstring byte, pointer
+ .macro vbufferstring byte:req, pointer:req
.byte 0xbf
.byte \byte
.4byte \pointer
.endm
@ Spawns a secondary box showing how many Coins the player has.
- .macro showcoinsbox x, y
+ .macro showcoinsbox x:req, y:req
.byte 0xc0
.byte \x
.byte \y
.endm
@ Hides the secondary box spawned by showcoins. It consumes its arguments but doesn't use them.
- .macro hidecoinsbox x, y
+ .macro hidecoinsbox x:req, y:req
.byte 0xc1
.byte \x
.byte \y
.endm
@ Updates the secondary box spawned by showcoins. It consumes its arguments but doesn't use them.
- .macro updatecoinsbox x, y
+ .macro updatecoinsbox x:req, y:req
.byte 0xc2
.byte \x
.byte \y
.endm
@ Increases the value of the specified game stat by 1. The stat's value will not be allowed to exceed 0x00FFFFFF.
- .macro incrementgamestat stat
+ .macro incrementgamestat stat:req
.byte 0xc3
.byte \stat
.endm
@ Sets the destination that using an Escape Rope or Dig will take the player to.
- .macro setescapewarp map, warp, x, y
+ .macro setescapewarp map:req, warp:req, x:req, y:req
.byte 0xc4
map \map
.byte \warp
@@ -1318,20 +1360,20 @@
.endm
@ Writes the name of the specified (box) PC box to the specified buffer.
- .macro bufferboxname out, box
+ .macro bufferboxname out:req, box:req
.byte 0xc6
.byte \out
.2byte \box
.endm
@ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text, 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
- .macro textcolor color
+ .macro textcolor color:req
.byte 0xc7
.byte \color
.endm
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
- .macro loadhelp pointer
+ .macro loadhelp pointer:req
.byte 0xc8
.4byte \pointer
.endm
@@ -1352,7 +1394,7 @@
.endm
@ Compares the value of a hidden variable to a dword.
- .macro comparehiddenvar a, value
+ .macro comparehiddenvar a:req, value:req
.byte 0xcc
.byte \a
.4byte \value
@@ -1360,121 +1402,149 @@
@ Supplementary
- .macro goto_if_trainer_not_defeated opponent, dest
- checktrainerflag \opponent
- goto_if 0, \dest
- .endm
-
- .macro goto_if_trainer_defeated opponent, dest
- checktrainerflag \opponent
- goto_if 1, \dest
- .endm
-
- .macro call_if_trainer_not_defeated opponent, dest
- checktrainerflag \opponent
- call_if 0, \dest
- .endm
-
- .macro call_if_trainer_defeated opponent, dest
- checktrainerflag \opponent
- call_if 1, \dest
- .endm
-
- .macro goto_if_unset flag, dest
+ .macro goto_if_unset flag:req, dest:req
checkflag \flag
- goto_if 0, \dest
+ goto_if FALSE, \dest
.endm
- .macro goto_if_set flag, dest
+ .macro goto_if_set flag:req, dest:req
checkflag \flag
- goto_if 1, \dest
+ goto_if TRUE, \dest
.endm
- .macro goto_if_lt dest @ LESS THAN
+ .macro goto_if_lt dest:req @ LESS THAN
goto_if 0, \dest
.endm
- .macro goto_if_eq dest @ EQUAL
+ .macro goto_if_eq dest:req @ EQUAL
goto_if 1, \dest
.endm
- .macro goto_if_gt dest @ GREATER THAN
+ .macro goto_if_gt dest:req @ GREATER THAN
goto_if 2, \dest
.endm
- .macro goto_if_le dest @ LESS THAN OR EQUAL
+ .macro goto_if_le dest:req @ LESS THAN OR EQUAL
goto_if 3, \dest
.endm
- .macro goto_if_ge dest @ GREATER THAN OR EQUAL
+ .macro goto_if_ge dest:req @ GREATER THAN OR EQUAL
goto_if 4, \dest
.endm
- .macro goto_if_ne dest @ NOT EQUAL
+ .macro goto_if_ne dest:req @ NOT EQUAL
goto_if 5, \dest
.endm
- .macro call_if_unset flag, dest
+ .macro call_if_unset flag:req, dest:req
checkflag \flag
- call_if 0, \dest
+ call_if FALSE, \dest
.endm
- .macro call_if_set flag, dest
+ .macro call_if_set flag:req, dest:req
checkflag \flag
- call_if 1, \dest
+ call_if TRUE, \dest
.endm
- .macro call_if_lt dest @ LESS THAN
+ .macro call_if_lt dest:req @ LESS THAN
call_if 0, \dest
.endm
- .macro call_if_eq dest @ EQUAL
+ .macro call_if_eq dest:req @ EQUAL
call_if 1, \dest
.endm
- .macro call_if_gt dest @ GREATER THAN
+ .macro call_if_gt dest:req @ GREATER THAN
call_if 2, \dest
.endm
- .macro call_if_le dest @ LESS THAN OR EQUAL
+ .macro call_if_le dest:req @ LESS THAN OR EQUAL
call_if 3, \dest
.endm
- .macro call_if_ge dest @ GREATER THAN OR EQUAL
+ .macro call_if_ge dest:req @ GREATER THAN OR EQUAL
call_if 4, \dest
.endm
- .macro call_if_ne dest @ NOT EQUAL
+ .macro call_if_ne dest:req @ NOT EQUAL
call_if 5, \dest
.endm
- .macro switch var
- copyvar VAR_0x8000, \var
+ .macro vgoto_if_eq dest:req
+ vgoto_if TRUE, \dest
.endm
- .macro case condition, dest
- compare_var_to_value VAR_0x8000, \condition
- goto_if_eq \dest
+ .macro vgoto_if_ne dest:req
+ vgoto_if FALSE, \dest
.endm
- .macro msgbox text, type=4
- loadword 0, \text
- callstd \type
+ .macro vgoto_if_unset flag:req, dest:req
+ checkflag \flag
+ vgoto_if FALSE, \dest
+ .endm
+
+ .macro vgoto_if_set flag:req, dest:req
+ checkflag \flag
+ vgoto_if TRUE, \dest
+ .endm
+
+ .macro goto_if_defeated trainer:req, dest:req
+ checktrainerflag \trainer
+ goto_if TRUE, \dest
+ .endm
+
+ .macro goto_if_not_defeated trainer:req, dest:req
+ checktrainerflag \trainer
+ goto_if FALSE, \dest
+ .endm
+
+ .macro call_if_defeated trainer:req, dest:req
+ checktrainerflag \trainer
+ call_if TRUE, \dest
+ .endm
+
+ .macro call_if_not_defeated trainer:req, dest:req
+ checktrainerflag \trainer
+ call_if FALSE, \dest
+ .endm
+
+ .macro switch var:req
+ copyvar VAR_0x8000, \var
+ .endm
+
+ .macro case condition:req, dest:req
+ compare VAR_0x8000, \condition
+ goto_if_eq \dest
.endm
@ Message box types
+ MSGBOX_NPC = 2
+ MSGBOX_SIGN = 3
+ MSGBOX_DEFAULT = 4
MSGBOX_YESNO = 5
+ MSGBOX_AUTOCLOSE = 6
YES = 1
NO = 0
- .macro giveitem_std item, amount=1, function=0
+ .macro msgbox text:req, type=MSGBOX_DEFAULT
+ loadword 0, \text
+ callstd \type
+ .endm
+
+ .macro giveitem item:req, amount=1
+ setorcopyvar VAR_0x8000, \item
+ setorcopyvar VAR_0x8001, \amount
+ callstd STD_OBTAIN_ITEM
+ .endm
+
+ .macro finditem item:req, amount=1
setorcopyvar VAR_0x8000, \item
setorcopyvar VAR_0x8001, \amount
- callstd \function
+ callstd STD_FIND_ITEM
.endm
- .macro givedecoration_std decoration
+ .macro givedecoration decoration
setorcopyvar VAR_0x8000, \decoration
- callstd 7
+ callstd STD_OBTAIN_DECORATION
.endm
diff --git a/include/macros/movement.inc b/include/macros/movement.inc
index 80a5b5dca..ba59792b0 100644
--- a/include/macros/movement.inc
+++ b/include/macros/movement.inc
@@ -102,8 +102,8 @@
create_movement_action clear_fixed_priority
create_movement_action init_affine_anim
create_movement_action clear_affine_anim
- create_movement_action walk_down_affine_0
- create_movement_action walk_down_affine_1
+ create_movement_action walk_down_start_affine
+ create_movement_action walk_down_affine
enum_start 0xfe
- create_movement_action end_movement
+ create_movement_action step_end
diff --git a/include/pokemon.h b/include/pokemon.h
index cb02268a8..c8e7ce719 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -440,7 +440,7 @@ u8 GiveMonToPlayer(struct Pokemon *mon);
u8 SendMonToPC(struct Pokemon *mon);
u8 CalculatePlayerPartyCount(void);
u8 CalculateEnemyPartyCount(void);
-u8 sub_803DAA0(void);
+u8 GetMonsStateToDoubles(void);
u8 GetAbilityBySpecies(u16 species, bool8 altAbility);
u8 GetMonAbility(struct Pokemon *mon);
void CreateSecretBaseEnemyParty(struct SecretBaseRecord *secretBaseRecord);
diff --git a/include/record_mixing.h b/include/record_mixing.h
index 2e6b048a6..089a7337f 100644
--- a/include/record_mixing.h
+++ b/include/record_mixing.h
@@ -3,7 +3,6 @@
#include <stddef.h>
-void sub_80B929C(void);
void RecordMixing_PrepareExchangePacket(void);
void RecordMixing_ReceiveExchangePacket(u32 a);
void Task_RecordMixing_SoundEffect(u8 taskId);
diff --git a/include/script.h b/include/script.h
index 17effd358..28fb54878 100644
--- a/include/script.h
+++ b/include/script.h
@@ -42,12 +42,12 @@ void ScriptContext1_SetupScript(const u8 *ptr);
void ScriptContext1_Stop(void);
void EnableBothScriptContexts(void);
void ScriptContext2_RunNewScript(const u8 *ptr);
-void mapheader_run_script_with_tag_x1(void);
-void mapheader_run_script_with_tag_x3(void);
-void mapheader_run_script_with_tag_x5(void);
-void mapheader_run_script_with_tag_x6(void);
-bool8 mapheader_run_first_tag2_script_list_match(void);
-void mapheader_run_first_tag4_script_list_match(void);
+void RunOnLoadMapScript(void);
+void RunOnTransitionMapScript(void);
+void RunOnResumeMapScript(void);
+void RunOnDiveWarpMapScript(void);
+bool8 TryRunOnFrameMapScript(void);
+void TryRunOnWarpIntoMapScript(void);
void ClearRamScript(void);
bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId);
const u8 *GetRamScript(u8 objectId, const u8 *script);
diff --git a/include/script_menu.h b/include/script_menu.h
index dca8c26a7..9556603cb 100644
--- a/include/script_menu.h
+++ b/include/script_menu.h
@@ -3,14 +3,14 @@
struct MenuAction;
-extern const u8 *const gUnknown_083CE048[];
+extern const u8 *const gStdStrings[];
bool8 ScriptMenu_Multichoice(u8 left, u8 top, u8 var3, u8 var4);
bool8 ScriptMenu_MultichoiceWithDefault(u8 left, u8 top, u8 var3, u8 var4, u8 var5);
bool8 Multichoice(u8 var1, u8 var2, u8 var3, u8 var4);
bool8 ScriptMenu_YesNo(u8 var1, u8 var2);
bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 a4, u8 columnCount);
-bool8 ScrSpecial_CreatePCMenu(void);
+bool8 ScriptMenu_CreatePCMultichoice(void);
void ScriptMenu_CreatePCMenu(void);
void ScriptMenu_DisplayPCStartupPrompt(void);
bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3);
diff --git a/include/secret_base.h b/include/secret_base.h
index a9a205bc4..dafbca085 100644
--- a/include/secret_base.h
+++ b/include/secret_base.h
@@ -16,7 +16,6 @@ void sub_80BC038(struct MapPosition *, struct MapEvents *);
u8 sub_80BC050();
u8 *GetSecretBaseMapName(u8 *dest);
void SetPlayerSecretBaseRecordMixingParty();
-u8 sub_80BCCA4(u8 secretBaseIndex);
const u8 *GetSecretBaseTrainerLoseText(void);
void sub_80BCF1C(u8 taskId);
void sub_80BD674(void *playerRecords, u32 size, u8 c);
diff --git a/include/sprite.h b/include/sprite.h
index e278f3c3d..f7a21ef46 100644
--- a/include/sprite.h
+++ b/include/sprite.h
@@ -208,7 +208,7 @@ struct Sprite
/*0x3E*/ u16 inUse:1; //1
u16 coordOffsetEnabled:1; //2
- u16 invisible:1; //4
+ bool16 invisible:1; //4
u16 flags_3:1; //8
u16 flags_4:1; //0x10
u16 flags_5:1; //0x20
diff --git a/include/start_menu.h b/include/start_menu.h
index 3f69604f1..f73fd9e72 100644
--- a/include/start_menu.h
+++ b/include/start_menu.h
@@ -7,7 +7,7 @@ extern u8 (*gMenuCallback)(void);
void CreateStartMenuTask(void (*func)(u8));
void sub_80712B4(u8 taskId);
void sub_8071310(void);
-void ScrSpecial_DoSaveDialog(void);
+void SaveGame(void);
void sub_8071B28(void);
void debug_sub_8075DB4(struct BattleTowerEReaderTrainer *ereaderTrainer, const u8 *b, u32 trainerId);
bool8 debug_sub_8075C30(void);
diff --git a/include/trainer_see.h b/include/trainer_see.h
index 78487aa57..5c65cb313 100644
--- a/include/trainer_see.h
+++ b/include/trainer_see.h
@@ -6,6 +6,5 @@
bool8 CheckTrainers(void);
void sub_8084794(struct ObjectEvent *var);
-void ScrSpecial_EndTrainerApproach(void);
#endif // GUARD_TRAINER_SEE_H