diff --git a/asm/field_ground_effect.s b/asm/field_ground_effect.s index 2152a5c5b..05f8ffce0 100644 --- a/asm/field_ground_effect.s +++ b/asm/field_ground_effect.s @@ -5,114 +5,6 @@ .text - thumb_func_start GetAllGroundEffectFlags_OnSpawn -@ void GetAllGroundEffectFlags_OnSpawn(struct npc_state *fieldObject, u32 *flags) -GetAllGroundEffectFlags_OnSpawn: @ 8096638 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl FieldObjectUpdateMetatileBehaviors - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_Reflection - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_TallGrassOnSpawn - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_LongGrassOnSpawn - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_SandHeap - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_ShallowFlowingWater - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_ShortGrass - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_HotSprings - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end GetAllGroundEffectFlags_OnSpawn - - thumb_func_start GetAllGroundEffectFlags_OnBeginStep -@ void GetAllGroundEffectFlags_OnBeginStep(struct npc_state *fieldObject, u32 *flags) -GetAllGroundEffectFlags_OnBeginStep: @ 8096680 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl FieldObjectUpdateMetatileBehaviors - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_Reflection - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_TallGrassOnBeginStep - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_LongGrassOnBeginStep - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_Tracks - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_SandHeap - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_ShallowFlowingWater - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_Puddle - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_ShortGrass - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_HotSprings - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end GetAllGroundEffectFlags_OnBeginStep - - thumb_func_start GetAllGroundEffectFlags_OnFinishStep -@ void GetAllGroundEffectFlags_OnFinishStep(struct npc_state *fieldObject, u32 *flags) -GetAllGroundEffectFlags_OnFinishStep: @ 80966D8 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - bl FieldObjectUpdateMetatileBehaviors - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_ShallowFlowingWater - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_SandHeap - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_Puddle - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_Ripple - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_ShortGrass - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_HotSprings - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_Seaweed - adds r0, r4, 0 - adds r1, r5, 0 - bl GetGroundEffectFlags_JumpLanding - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end GetAllGroundEffectFlags_OnFinishStep - thumb_func_start FieldObjectUpdateMetatileBehaviors @ void FieldObjectUpdateMetatileBehaviors(struct npc_state *fieldObject) FieldObjectUpdateMetatileBehaviors: @ 8096728 diff --git a/data/field_map_obj.s b/data/event_object_movement.s similarity index 100% rename from data/field_map_obj.s rename to data/event_object_movement.s diff --git a/data/map_obj_8097404.s b/data/map_obj_8097404.s index 719a78266..b30e4b6d7 100644 --- a/data/map_obj_8097404.s +++ b/data/map_obj_8097404.s @@ -106,7 +106,7 @@ gUnknown_0850E84A:: @ 850E84A gUnknown_0850E850:: @ 850E850 .byte 0x01, 0x01, 0x02, 0x00 -// referenced in data/field_map_obj.s +// referenced in data/event_object_movement.s .align 2 gUnknown_0850E854:: .4byte sub_8097E50 diff --git a/include/field_map_obj.h b/include/event_object_movement.h similarity index 100% rename from include/field_map_obj.h rename to include/event_object_movement.h diff --git a/include/field_map_obj_helpers.h b/include/event_object_movement_helpers.h similarity index 100% rename from include/field_map_obj_helpers.h rename to include/event_object_movement_helpers.h diff --git a/ld_script.txt b/ld_script.txt index f7e531fce..51e641fd1 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -92,9 +92,9 @@ SECTIONS { src/field_camera.o(.text); src/field_door.o(.text); asm/field_player_avatar.o(.text); - src/field_map_obj.o(.text); + src/event_object_movement.o(.text); asm/field_ground_effect.o(.text); - src/field_map_obj_helpers.o(.text); + src/event_object_movement_helpers.o(.text); src/field_message_box.o(.text); src/map_obj_lock.o(.text); src/text_window.o(.text); @@ -397,7 +397,7 @@ SECTIONS { src/metatile_behavior.o(.rodata); src/field_door.o(.rodata); data/field_player_avatar.o(.rodata); - data/field_map_obj.o(.rodata); + data/event_object_movement.o(.rodata); data/field_ground_effect.o(.rodata); data/map_obj_8097404.o(.rodata); src/text_window.o(.rodata); diff --git a/src/battle_setup.c b/src/battle_setup.c index 48a2ef257..5411551f7 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -21,7 +21,7 @@ #include "constants/items.h" #include "palette.h" #include "window.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "event_scripts.h" #include "trainer_see.h" #include "field_message_box.h" @@ -32,7 +32,7 @@ #include "overworld.h" #include "field_weather.h" #include "gym_leader_rematch.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement_helpers.h" enum { diff --git a/src/berry_tag_screen.c b/src/berry_tag_screen.c index 9a6e78c81..a755f4f44 100644 --- a/src/berry_tag_screen.c +++ b/src/berry_tag_screen.c @@ -2,7 +2,7 @@ #include "berry_tag_screen.h" #include "berry.h" #include "decompress.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "item_menu.h" #include "constants/items.h" #include "item.h" diff --git a/src/bike.c b/src/bike.c index e827707cd..d413989f0 100644 --- a/src/bike.c +++ b/src/bike.c @@ -1,6 +1,6 @@ #include "global.h" #include "bike.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "field_player_avatar.h" #include "fieldmap.h" #include "constants/flags.h" diff --git a/src/decoration.c b/src/decoration.c index 08287a3cc..2fbd247a6 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -17,7 +17,7 @@ #include "field_player_avatar.h" #include "field_camera.h" #include "field_screen.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "list_menu.h" #include "menu_helpers.h" #include "menu.h" diff --git a/src/field_map_obj.c b/src/event_object_movement.c similarity index 98% rename from src/field_map_obj.c rename to src/event_object_movement.c index af018eb16..d847599b8 100644 --- a/src/field_map_obj.c +++ b/src/event_object_movement.c @@ -14,7 +14,7 @@ #include "rom_818CFC8.h" #include "rom_81BE66C.h" #include "field_ground_effect.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement_helpers.h" #include "mauville_old_man.h" #include "metatile_behavior.h" #include "field_effect.h" @@ -22,7 +22,7 @@ #include "field_camera.h" #include "trainer_see.h" #include "decoration.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #define NUM_FIELD_MAP_OBJECT_TEMPLATES 0x51 @@ -175,6 +175,24 @@ extern u8 (*const gUnknown_0850DEE8[5])(u8); extern const s16 gUnknown_0850DFBC[3]; extern const s16 gUnknown_0850DFC2[3]; +/*static*/ void FieldObjectUpdateMetatileBehaviors(struct MapObject*); +/*static*/ void GetAllGroundEffectFlags_OnBeginStep(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_Reflection(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_TallGrassOnSpawn(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_LongGrassOnSpawn(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_SandHeap(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_ShallowFlowingWater(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_ShortGrass(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_HotSprings(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_TallGrassOnBeginStep(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_LongGrassOnBeginStep(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_Tracks(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_Puddle(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_Ripple(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_Seaweed(struct MapObject*, u32*); +/*static*/ void GetGroundEffectFlags_JumpLanding(struct MapObject*, u32*); + + // Code static void npc_clear_ids_and_state(struct MapObject *mapObject) @@ -5117,3 +5135,42 @@ static void npc_update_obj_anim_flag(struct MapObject *mapObject, struct Sprite sprite->invisible = TRUE; } } + +/*static*/ void GetAllGroundEffectFlags_OnSpawn(struct MapObject *eventObj, u32 *flags) +{ + FieldObjectUpdateMetatileBehaviors(eventObj); + GetGroundEffectFlags_Reflection(eventObj, flags); + GetGroundEffectFlags_TallGrassOnSpawn(eventObj, flags); + GetGroundEffectFlags_LongGrassOnSpawn(eventObj, flags); + GetGroundEffectFlags_SandHeap(eventObj, flags); + GetGroundEffectFlags_ShallowFlowingWater(eventObj, flags); + GetGroundEffectFlags_ShortGrass(eventObj, flags); + GetGroundEffectFlags_HotSprings(eventObj, flags); +} + +/*static*/ void GetAllGroundEffectFlags_OnBeginStep(struct MapObject *eventObj, u32 *flags) +{ + FieldObjectUpdateMetatileBehaviors(eventObj); + GetGroundEffectFlags_Reflection(eventObj, flags); + GetGroundEffectFlags_TallGrassOnBeginStep(eventObj, flags); + GetGroundEffectFlags_LongGrassOnBeginStep(eventObj, flags); + GetGroundEffectFlags_Tracks(eventObj, flags); + GetGroundEffectFlags_SandHeap(eventObj, flags); + GetGroundEffectFlags_ShallowFlowingWater(eventObj, flags); + GetGroundEffectFlags_Puddle(eventObj, flags); + GetGroundEffectFlags_ShortGrass(eventObj, flags); + GetGroundEffectFlags_HotSprings(eventObj, flags); +} + +/*static*/ void GetAllGroundEffectFlags_OnFinishStep(struct MapObject *eventObj, u32 *flags) +{ + FieldObjectUpdateMetatileBehaviors(eventObj); + GetGroundEffectFlags_ShallowFlowingWater(eventObj, flags); + GetGroundEffectFlags_SandHeap(eventObj, flags); + GetGroundEffectFlags_Puddle(eventObj, flags); + GetGroundEffectFlags_Ripple(eventObj, flags); + GetGroundEffectFlags_ShortGrass(eventObj, flags); + GetGroundEffectFlags_HotSprings(eventObj, flags); + GetGroundEffectFlags_Seaweed(eventObj, flags); + GetGroundEffectFlags_JumpLanding(eventObj, flags); +} diff --git a/src/field_map_obj_helpers.c b/src/event_object_movement_helpers.c similarity index 99% rename from src/field_map_obj_helpers.c rename to src/event_object_movement_helpers.c index b8efcfe72..48f3b9052 100755 --- a/src/field_map_obj_helpers.c +++ b/src/event_object_movement_helpers.c @@ -1,8 +1,8 @@ #include "global.h" #include "field_ground_effect.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "field_effect.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement_helpers.h" #include "malloc.h" #include "task.h" #include "util.h" diff --git a/src/field_camera.c b/src/field_camera.c index 95167ee10..b937f704b 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -4,7 +4,7 @@ #include "field_camera.h" #include "field_player_avatar.h" #include "fieldmap.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "gpu_regs.h" #include "menu.h" #include "overworld.h" diff --git a/src/field_effect.c b/src/field_effect.c index 692090779..79753f027 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -6,8 +6,8 @@ #include "decompress.h" #include "field_camera.h" #include "field_effect_helpers.h" -#include "field_map_obj.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement.h" +#include "event_object_movement_helpers.h" #include "field_player_avatar.h" #include "field_screen.h" #include "field_weather.h" diff --git a/src/field_special_scene.c b/src/field_special_scene.c index a704beaab..2d9973488 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -1,7 +1,7 @@ #include "global.h" #include "task.h" #include "sprite.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "constants/songs.h" #include "sound.h" #include "palette.h" diff --git a/src/fldeff_groundshake.c b/src/fldeff_groundshake.c index bee4d2c4b..6da529d00 100644 --- a/src/fldeff_groundshake.c +++ b/src/fldeff_groundshake.c @@ -4,7 +4,7 @@ #include "constants/songs.h" #include "event_data.h" #include "field_camera.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "malloc.h" #include "random.h" #include "roulette_util.h" diff --git a/src/fossil_specials.c b/src/fossil_specials.c index 060915fa6..49db0f5b6 100644 --- a/src/fossil_specials.c +++ b/src/fossil_specials.c @@ -4,7 +4,7 @@ #include "bg.h" #include "event_data.h" #include "field_camera.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "fieldmap.h" #include "global.fieldmap.h" #include "gpu_regs.h" diff --git a/src/item_menu.c b/src/item_menu.c index c4b4b15b1..75465e298 100755 --- a/src/item_menu.c +++ b/src/item_menu.c @@ -9,7 +9,7 @@ #include "constants/songs.h" #include "decompress.h" #include "event_data.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement_helpers.h" #include "field_player_avatar.h" #include "field_specials.h" #include "graphics.h" diff --git a/src/item_use.c b/src/item_use.c index d036da6d3..4318a930b 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -12,12 +12,12 @@ #include "data2.h" #include "event_data.h" #include "fieldmap.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "field_player_avatar.h" #include "field_screen.h" #include "field_weather.h" #include "item.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement_helpers.h" #include "mail.h" #include "metatile_behavior.h" #include "overworld.h" diff --git a/src/map_obj_lock.c b/src/map_obj_lock.c index 688d0594d..3a67950de 100644 --- a/src/map_obj_lock.c +++ b/src/map_obj_lock.c @@ -1,7 +1,7 @@ #include "global.h" #include "event_data.h" -#include "field_map_obj.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement.h" +#include "event_object_movement_helpers.h" #include "field_player_avatar.h" #include "map_obj_lock.h" #include "script_movement.h" diff --git a/src/naming_screen.c b/src/naming_screen.c index 0e350aa35..9ad1a9742 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -11,7 +11,7 @@ #include "pokemon.h" #include "field_specials.h" #include "field_player_avatar.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "event_data.h" #include "constants/vars.h" #include "constants/songs.h" diff --git a/src/overworld.c b/src/overworld.c index 3d9a1bdc2..b895ba43e 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -11,8 +11,8 @@ #include "field_effect.h" #include "field_fadetransition.h" #include "field_ground_effect.h" -#include "field_map_obj.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement.h" +#include "event_object_movement_helpers.h" #include "field_message_box.h" #include "field_player_avatar.h" #include "field_screen_effect.h" diff --git a/src/player_pc.c b/src/player_pc.c index c10c63dda..48be0633f 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -4,7 +4,7 @@ #include "decoration.h" #include "event_scripts.h" #include "field_fadetransition.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "field_screen.h" #include "field_weather.h" #include "international_string_util.h" diff --git a/src/rom6.c b/src/rom6.c index 4a5c506b6..9b505a205 100644 --- a/src/rom6.c +++ b/src/rom6.c @@ -6,7 +6,7 @@ #include "event_data.h" #include "event_scripts.h" #include "field_effect.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "field_player_avatar.h" #include "item_use.h" #include "party_menu.h" diff --git a/src/rotating_gate.c b/src/rotating_gate.c index b07814f58..1f5ef165f 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -1,7 +1,7 @@ #include "global.h" #include "bike.h" #include "event_data.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "constants/maps.h" #include "constants/songs.h" #include "sound.h" diff --git a/src/scrcmd.c b/src/scrcmd.c index a29e64979..68bcd4936 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -13,8 +13,8 @@ #include "field_door.h" #include "field_effect.h" #include "field_fadetransition.h" -#include "field_map_obj.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement.h" +#include "event_object_movement_helpers.h" #include "field_message_box.h" #include "field_player_avatar.h" #include "field_screen_effect.h" diff --git a/src/script_movement.c b/src/script_movement.c index bbeb0eedc..4d1e77d4a 100644 --- a/src/script_movement.c +++ b/src/script_movement.c @@ -1,7 +1,7 @@ #include "global.h" #include "script_movement.h" -#include "field_map_obj.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement.h" +#include "event_object_movement_helpers.h" #include "task.h" #include "util.h" diff --git a/src/secret_base.c b/src/secret_base.c index 44e980c43..71cf3f1a6 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -20,7 +20,7 @@ #include "field_player_avatar.h" #include "field_screen.h" #include "field_weather.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "field_effect.h" #include "fldeff_80F9BCC.h" #include "metatile_behavior.h" diff --git a/src/start_menu.c b/src/start_menu.c index c248ca86b..355d0fa22 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -15,7 +15,7 @@ #include "battle_frontier_2.h" #include "rom_818CFC8.h" #include "field_specials.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement_helpers.h" #include "script.h" #include "main.h" #include "sound.h" diff --git a/src/trainer_see.c b/src/trainer_see.c index 7706da703..28fe0064b 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -4,9 +4,9 @@ #include "pokemon.h" #include "sprite.h" #include "field_effect.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "field_player_avatar.h" -#include "field_map_obj_helpers.h" +#include "event_object_movement_helpers.h" #include "pokenav.h" #include "task.h" #include "util.h" diff --git a/src/tv.c b/src/tv.c index e69f6f411..5c1037293 100644 --- a/src/tv.c +++ b/src/tv.c @@ -26,7 +26,7 @@ #include "lilycove_lady.h" #include "rom6.h" #include "pokedex.h" -#include "field_map_obj.h" +#include "event_object_movement.h" #include "text.h" #include "script_menu.h" #include "naming_screen.h"