summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-07-13 18:53:14 -0700
committerGitHub <noreply@github.com>2018-07-13 18:53:14 -0700
commit68cf5eb3cbff3b0eac6cd348c7e6c594c287d67b (patch)
tree6cbdbe8e87708ffca6a49d6b507ed6341b26f4e2 /src
parent9238533346fd97c67e48fee33a204d1e8e2dd0a7 (diff)
parent7dffb108b834afdee807998af24e1ddc4c85d4f9 (diff)
Merge pull request #654 from huderlem/movement_constants
Move and use movement constants
Diffstat (limited to 'src')
-rw-r--r--src/battle/battle_bg.c3
-rw-r--r--src/battle/battle_setup.c9
-rw-r--r--src/berry.c3
-rw-r--r--src/bike.c3
-rw-r--r--src/event_object_movement.c1
-rw-r--r--src/field_control_avatar.c16
-rw-r--r--src/field_effect.c1
-rw-r--r--src/field_fadetransition.c3
-rw-r--r--src/field_player_avatar.c1
-rw-r--r--src/field_specials.c9
-rw-r--r--src/fldeff_flash.c3
-rw-r--r--src/item_use.c10
-rw-r--r--src/overworld.c7
-rw-r--r--src/rom6.c2
-rw-r--r--src/secret_base.c17
-rw-r--r--src/trainer_see.c1
16 files changed, 54 insertions, 35 deletions
diff --git a/src/battle/battle_bg.c b/src/battle/battle_bg.c
index 5a2a1efa3..4928708e0 100644
--- a/src/battle/battle_bg.c
+++ b/src/battle/battle_bg.c
@@ -1,6 +1,5 @@
#include "global.h"
#include "battle.h"
-#include "constants/songs.h"
#include "decompress.h"
#include "ewram.h"
#include "graphics.h"
@@ -13,6 +12,8 @@
#include "trainer.h"
#include "trig.h"
#include "sound.h"
+#include "constants/map_types.h"
+#include "constants/songs.h"
extern u16 gBattleTypeFlags;
diff --git a/src/battle/battle_setup.c b/src/battle/battle_setup.c
index 8c5f68902..e8a3ef451 100644
--- a/src/battle/battle_setup.c
+++ b/src/battle/battle_setup.c
@@ -12,9 +12,7 @@
#include "fieldmap.h"
#include "fldeff_poison.h"
#include "main.h"
-#include "constants/maps.h"
#include "metatile_behavior.h"
-#include "constants/opponents.h"
#include "palette.h"
#include "random.h"
#include "overworld.h"
@@ -22,15 +20,18 @@
#include "script.h"
#include "script_pokemon_80C4.h"
#include "secret_base.h"
-#include "constants/songs.h"
#include "sound.h"
-#include "constants/species.h"
#include "starter_choose.h"
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "text.h"
#include "trainer.h"
+#include "constants/map_types.h"
+#include "constants/maps.h"
+#include "constants/opponents.h"
+#include "constants/songs.h"
+#include "constants/species.h"
extern u16 gSpecialVar_Result;
diff --git a/src/berry.c b/src/berry.c
index 323cb39cf..6e7d4592c 100644
--- a/src/berry.c
+++ b/src/berry.c
@@ -1,5 +1,4 @@
#include "global.h"
-#include "constants/items.h"
#include "berry.h"
#include "field_control_avatar.h"
#include "event_object_movement.h"
@@ -12,6 +11,8 @@
#include "random.h"
#include "task.h"
#include "text.h"
+#include "constants/event_object_movement_constants.h"
+#include "constants/items.h"
#ifdef ENGLISH
#define NAME_CHERI_BERRY _("CHERI")
diff --git a/src/bike.c b/src/bike.c
index 41090a375..bf61d2aed 100644
--- a/src/bike.c
+++ b/src/bike.c
@@ -7,8 +7,9 @@
#include "global.fieldmap.h"
#include "metatile_behavior.h"
#include "overworld.h"
-#include "constants/songs.h"
#include "sound.h"
+#include "constants/map_types.h"
+#include "constants/songs.h"
extern bool8 gBikeCyclingChallenge;
extern u8 gBikeCollisions;
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index 5d498c1ff..c8685bb49 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -15,6 +15,7 @@
#include "trainer_see.h"
#include "constants/field_effects.h"
#include "constants/maps.h"
+#include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h"
// this file was known as evobjmv.c in Game Freak's original source
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index ffdf926f5..7a438e100 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -24,6 +24,8 @@
#include "trainer_see.h"
#include "constants/vars.h"
#include "wild_encounter.h"
+#include "constants/bg_event_constants.h"
+#include "constants/map_types.h"
struct Coords32
{
@@ -409,34 +411,34 @@ static u8 *GetInteractedBackgroundEventScript(struct MapPosition *position, u8 m
switch (bgEvent->kind)
{
- case 0:
+ case BG_EVENT_PLAYER_FACING_ANY:
default:
return bgEvent->bgUnion.script;
- case 1:
+ case BG_EVENT_PLAYER_FACING_NORTH:
if (direction != DIR_NORTH)
return NULL;
break;
- case 2:
+ case BG_EVENT_PLAYER_FACING_SOUTH:
if (direction != DIR_SOUTH)
return NULL;
break;
- case 3:
+ case BG_EVENT_PLAYER_FACING_EAST:
if (direction != DIR_EAST)
return NULL;
break;
- case 4:
+ case BG_EVENT_PLAYER_FACING_WEST:
if (direction != DIR_WEST)
return NULL;
break;
case 5:
case 6:
- case 7:
+ case BG_EVENT_HIDDEN_ITEM:
gSpecialVar_0x8004 = ((u32)bgEvent->bgUnion.script >> 16) + FLAG_HIDDEN_ITEMS_START;
gSpecialVar_0x8005 = (u32)bgEvent->bgUnion.script;
if (FlagGet(gSpecialVar_0x8004) == TRUE)
return NULL;
return HiddenItemScript;
- case 8:
+ case BG_EVENT_SECRET_BASE:
if (direction == DIR_NORTH)
{
gSpecialVar_0x8004 = bgEvent->bgUnion.secretBaseId;
diff --git a/src/field_effect.c b/src/field_effect.c
index 90c11b8c3..cc5f9252a 100644
--- a/src/field_effect.c
+++ b/src/field_effect.c
@@ -24,6 +24,7 @@
#include "fieldmap.h"
#include "util.h"
#include "pokemon_storage_system.h"
+#include "constants/event_object_movement_constants.h"
#include "constants/field_effects.h"
#include "constants/songs.h"
diff --git a/src/field_fadetransition.c b/src/field_fadetransition.c
index c52dc98c6..670d8c54b 100644
--- a/src/field_fadetransition.c
+++ b/src/field_fadetransition.c
@@ -16,10 +16,11 @@
#include "palette.h"
#include "overworld.h"
#include "script.h"
-#include "constants/songs.h"
#include "sound.h"
#include "start_menu.h"
#include "task.h"
+#include "constants/event_object_movement_constants.h"
+#include "constants/songs.h"
void sub_8080B9C(u8);
void task_map_chg_seq_0807E20C(u8);
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index 9a4f5f6cd..47f43858b 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -22,6 +22,7 @@
#include "tv.h"
#include "wild_encounter.h"
#include "constants/field_effects.h"
+#include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h"
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {0};
diff --git a/src/field_specials.c b/src/field_specials.c
index e8c83b376..043945a2f 100644
--- a/src/field_specials.c
+++ b/src/field_specials.c
@@ -18,10 +18,6 @@
#include "string_util.h"
#include "strings.h"
#include "pokeblock.h"
-#include "constants/species.h"
-#include "constants/abilities.h"
-#include "constants/moves.h"
-#include "constants/weather.h"
#include "text.h"
#include "wallclock.h"
#include "tv.h"
@@ -36,6 +32,11 @@
#include "field_weather.h"
#include "pokemon_summary_screen.h"
#include "random.h"
+#include "constants/abilities.h"
+#include "constants/event_object_movement_constants.h"
+#include "constants/moves.h"
+#include "constants/species.h"
+#include "constants/weather.h"
#if ENGLISH
#define CHAR_DECIMAL_SEPARATOR CHAR_PERIOD
diff --git a/src/fldeff_flash.c b/src/fldeff_flash.c
index 5a04f7061..22da8e501 100644
--- a/src/fldeff_flash.c
+++ b/src/fldeff_flash.c
@@ -7,10 +7,11 @@
#include "overworld.h"
#include "rom6.h"
#include "script.h"
-#include "constants/songs.h"
#include "sound.h"
#include "sprite.h"
#include "task.h"
+#include "constants/map_types.h"
+#include "constants/songs.h"
struct MapTypeFadePairs
{
diff --git a/src/item_use.c b/src/item_use.c
index 4e76ea434..1f33144b2 100644
--- a/src/item_use.c
+++ b/src/item_use.c
@@ -34,6 +34,8 @@
#include "string_util.h"
#include "strings.h"
#include "task.h"
+#include "constants/bg_event_constants.h"
+#include "constants/map_types.h"
#include "constants/species.h"
#include "constants/vars.h"
@@ -335,12 +337,12 @@ bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId)
for (i = 0; i < events->bgEventCount; i++)
{
- if ((events -> bgEvents[i].kind == 7) && !FlagGet(events -> bgEvents[i].bgUnion.hiddenItem.hiddenItemId + FLAG_HIDDEN_ITEMS_START))
+ if ((events->bgEvents[i].kind == BG_EVENT_HIDDEN_ITEM) && !FlagGet(events->bgEvents[i].bgUnion.hiddenItem.hiddenItemId + FLAG_HIDDEN_ITEMS_START))
{
// do a distance lookup of each item so long as the index remains less than the objects on the current map.
- distanceX = (u16)events -> bgEvents[i].x + 7;
+ distanceX = (u16)events->bgEvents[i].x + 7;
newDistanceX = distanceX - x;
- distanceY = (u16)events -> bgEvents[i].y + 7;
+ distanceY = (u16)events->bgEvents[i].y + 7;
newDistanceY = distanceY - y;
// is item in range?
@@ -365,7 +367,7 @@ bool8 HiddenItemAtPos(struct MapEvents *events, s16 x, s16 y)
for (i = 0; i < bgEventCount; i++)
{
- if (bgEvent[i].kind == 7 && x == (u16)bgEvent[i].x && y == (u16)bgEvent[i].y) // hidden item and coordinates matches x and y passed?
+ if (bgEvent[i].kind == BG_EVENT_HIDDEN_ITEM && x == (u16)bgEvent[i].x && y == (u16)bgEvent[i].y) // hidden item and coordinates matches x and y passed?
{
if (!FlagGet(bgEvent[i].bgUnion.hiddenItem.hiddenItemId + FLAG_HIDDEN_ITEMS_START))
return TRUE;
diff --git a/src/overworld.c b/src/overworld.c
index f6dea1271..a7a203ca2 100644
--- a/src/overworld.c
+++ b/src/overworld.c
@@ -24,7 +24,6 @@
#include "load_save.h"
#include "main.h"
#include "m4a.h"
-#include "constants/maps.h"
#include "map_name_popup.h"
#include "menu.h"
#include "metatile_behavior.h"
@@ -38,9 +37,7 @@
#include "script.h"
#include "script_pokemon_80C4.h"
#include "secret_base.h"
-#include "constants/songs.h"
#include "sound.h"
-#include "constants/species.h"
#include "start_menu.h"
#include "task.h"
#include "tileset_anim.h"
@@ -48,6 +45,10 @@
#include "tv.h"
#include "scanline_effect.h"
#include "wild_encounter.h"
+#include "constants/map_types.h"
+#include "constants/maps.h"
+#include "constants/songs.h"
+#include "constants/species.h"
#ifdef SAPPHIRE
#define LEGENDARY_MUSIC MUS_OOAME // Heavy Rain
diff --git a/src/rom6.c b/src/rom6.c
index be14f1731..6efb1802e 100644
--- a/src/rom6.c
+++ b/src/rom6.c
@@ -13,7 +13,9 @@
#include "sound.h"
#include "sprite.h"
#include "task.h"
+#include "constants/event_object_movement_constants.h"
#include "constants/field_effects.h"
+#include "constants/map_types.h"
extern u16 gSpecialVar_LastTalked;
extern void (*gFieldCallback)(void);
diff --git a/src/secret_base.c b/src/secret_base.c
index 5bec7a06d..ca5f0c31f 100644
--- a/src/secret_base.c
+++ b/src/secret_base.c
@@ -1,10 +1,6 @@
#include "global.h"
-#include "constants/decorations.h"
#include "secret_base.h"
#include "decoration.h"
-#include "constants/species.h"
-#include "constants/items.h"
-#include "constants/moves.h"
#include "event_data.h"
#include "field_camera.h"
#include "field_effect.h"
@@ -29,11 +25,16 @@
#include "overworld.h"
#include "script.h"
#include "sound.h"
-#include "constants/species.h"
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "text.h"
+#include "constants/bg_event_constants.h"
+#include "constants/decorations.h"
+#include "constants/items.h"
+#include "constants/map_types.h"
+#include "constants/moves.h"
+#include "constants/species.h"
#include "constants/vars.h"
@@ -317,7 +318,7 @@ void sub_80BB970(struct MapEvents *events)
for (bgevidx = 0; bgevidx < events->bgEventCount; bgevidx++)
{
- if (events->bgEvents[bgevidx].kind == 8)
+ if (events->bgEvents[bgevidx].kind == BG_EVENT_SECRET_BASE)
{
for (jdx = 0; jdx < MAX_SECRET_BASES; jdx++)
{
@@ -538,7 +539,7 @@ void SetCurrentSecretBaseFromPosition(struct MapPosition *position, struct MapEv
for (i = 0; i < events->bgEventCount; i++)
{
- if (events->bgEvents[i].kind == 8 && position->x == events->bgEvents[i].x + 7
+ if (events->bgEvents[i].kind == BG_EVENT_SECRET_BASE && position->x == events->bgEvents[i].x + 7
&& position->y == events->bgEvents[i].y + 7)
{
gCurrentSecretBaseId = events->bgEvents[i].bgUnion.secretBaseId;
@@ -871,7 +872,7 @@ void sub_80BC474(void)
for (eventId = 0; eventId < mapEvents->bgEventCount; eventId++)
{
- if (mapEvents->bgEvents[eventId].kind == 8
+ if (mapEvents->bgEvents[eventId].kind == BG_EVENT_SECRET_BASE
&& gSaveBlock1.secretBases[0].secretBaseId == mapEvents->bgEvents[eventId].bgUnion.secretBaseId)
{
u16 i;
diff --git a/src/trainer_see.c b/src/trainer_see.c
index dfbab1e3a..ee4cb6e0f 100644
--- a/src/trainer_see.c
+++ b/src/trainer_see.c
@@ -8,6 +8,7 @@
#include "sprite.h"
#include "task.h"
#include "util.h"
+#include "constants/event_object_movement_constants.h"
#include "constants/field_effects.h"
static bool8 CheckTrainer(u8);