From 1d4650711071b8f142ffccea30de20d45dd87978 Mon Sep 17 00:00:00 2001 From: Slawter666 <38655737+Slawter666@users.noreply.github.com> Date: Tue, 13 Nov 2018 14:19:04 +0000 Subject: [PATCH] Move field effects enum to defines --- data/event_scripts.s | 39 +- include/constants/field_effects.h | 72 ++++ include/field_effect.h | 193 ---------- include/field_region_map.h | 6 - src/battle_transition.c | 30 +- src/braille_puzzles.c | 1 + src/event_object_movement.c | 2 + src/field_control_avatar.c | 3 +- src/field_effect.c | 603 ++++++++++++++++++------------ src/field_effect_helpers.c | 1 + src/field_player_avatar.c | 120 +++--- src/field_specials.c | 5 +- src/fldeff_cut.c | 1 + src/fldeff_strength.c | 1 + src/fldeff_sweetscent.c | 1 + src/fldeff_teleport.c | 1 + src/rom6.c | 1 + src/trainer_see.c | 21 +- 18 files changed, 548 insertions(+), 553 deletions(-) create mode 100644 include/constants/field_effects.h delete mode 100644 include/field_region_map.h diff --git a/data/event_scripts.s b/data/event_scripts.s index 49c3818c6..ed58dd416 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1,13 +1,14 @@ +#include "constants/battle_frontier.h" #include "constants/flags.h" +#include "constants/field_effects.h" #include "constants/items.h" +#include "constants/heal_locations.h" #include "constants/maps.h" #include "constants/moves.h" #include "constants/songs.h" #include "constants/species.h" -#include "constants/vars.h" -#include "constants/heal_locations.h" #include "constants/trainers.h" -#include "constants/battle_frontier.h" +#include "constants/vars.h" .include "asm/macros.inc" .include "asm/macros/event.inc" .include "constants/constants.inc" @@ -434,13 +435,13 @@ gStdScripts_End:: @ 81DC2CC EventScript_SecretBasePC:: @ 823B4BB lockall - playse 2 + playse SE_PC_LOGIN message Text_276805 - dofieldeffect 61 + dofieldeffect FLDEFF_PCTURN_ON waitstate waitmessage waitbuttonpress - playse 5 + playse SE_SELECT goto EventScript_23B4D3 end @@ -496,12 +497,12 @@ EventScript_23B585:: @ 823B585 EventScript_RecordMixingSecretBasePC:: @ 823B589 lockall message Text_276805 - playse 2 - dofieldeffect 61 + playse SE_PC_LOGIN + dofieldeffect FLDEFF_PCTURN_ON waitstate waitmessage waitbuttonpress - playse 5 + playse SE_SELECT goto EventScript_23B5A1 end @@ -584,7 +585,7 @@ EventScript_23B680:: @ 823B680 EventScript_SecretBaseSandOrnament:: @ 823B684 special sub_80EBE7C - dofieldeffect 52 + dofieldeffect FLDEFF_SAND_PILLAR waitstate end @@ -1435,8 +1436,8 @@ OldaleTown_PokemonCenter_1F_EventScript_27198D:: @ 827198D OldaleTown_PokemonCenter_1F_EventScript_271993:: @ 8271993 applymovement VAR_0x800B, OldaleTown_PokemonCenter_1F_Movement_2725A4 waitmovement 0 - dofieldeffect 25 - waitfieldeffect 25 + dofieldeffect FLDEFF_POKECENTER_HEAL + waitfieldeffect FLDEFF_POKECENTER_HEAL applymovement VAR_0x800B, OldaleTown_PokemonCenter_1F_Movement_2725AA waitmovement 0 special HealPlayerParty @@ -1914,7 +1915,7 @@ EventScript_UseSurf:: @ 8271EA0 compare VAR_RESULT, 0 goto_eq EventScript_271ED5 msgbox gUnknown_0827300D, 4 - dofieldeffect 9 + dofieldeffect FLDEFF_USE_SURF EventScript_271ED5:: @ 8271ED5 releaseall @@ -4447,14 +4448,14 @@ EventScript_275A50:: @ 8275A50 goto_eq EventScript_275CDE msgbox Route103_Text_290771, 4 closemessage - dofieldeffect 11 + dofieldeffect FLDEFF_USE_SECRET_POWER_CAVE waitstate goto EventScript_275A9B end EventScript_275A86:: @ 8275A86 lockall - dofieldeffect 11 + dofieldeffect FLDEFF_USE_SECRET_POWER_CAVE waitstate goto EventScript_275A9B end @@ -4479,14 +4480,14 @@ EventScript_275AA9:: @ 8275AA9 goto_eq EventScript_275CDE msgbox Route103_Text_290771, 4 closemessage - dofieldeffect 26 + dofieldeffect FLDEFF_USE_SECRET_POWER_TREE waitstate goto EventScript_275AF4 end EventScript_275ADF:: @ 8275ADF lockall - dofieldeffect 26 + dofieldeffect FLDEFF_USE_SECRET_POWER_TREE waitstate goto EventScript_275AF4 end @@ -4511,14 +4512,14 @@ EventScript_275B02:: @ 8275B02 goto_eq EventScript_275CDE msgbox Route103_Text_290771, 4 closemessage - dofieldeffect 27 + dofieldeffect FLDEFF_USE_SECRET_POWER_SHRUB waitstate goto EventScript_275B4D end EventScript_275B38:: @ 8275B38 lockall - dofieldeffect 27 + dofieldeffect FLDEFF_USE_SECRET_POWER_SHRUB waitstate goto EventScript_275B4D end diff --git a/include/constants/field_effects.h b/include/constants/field_effects.h new file mode 100644 index 000000000..b93b98201 --- /dev/null +++ b/include/constants/field_effects.h @@ -0,0 +1,72 @@ +#ifndef GUARD_FIELD_EFFECT_CONSTANTS_H +#define GUARD_FIELD_EFFECT_CONSTANTS_H + +#define FLDEFF_EXCLAMATION_MARK_ICON 0 +#define FLDEFF_USE_CUT_ON_GRASS 1 +#define FLDEFF_USE_CUT_ON_TREE 2 +#define FLDEFF_SHADOW 3 +#define FLDEFF_TALL_GRASS 4 +#define FLDEFF_RIPPLE 5 +#define FLDEFF_FIELD_MOVE_SHOW_MON 6 +#define FLDEFF_ASH 7 +#define FLDEFF_SURF_BLOB 8 +#define FLDEFF_USE_SURF 9 +#define FLDEFF_DUST 10 +#define FLDEFF_USE_SECRET_POWER_CAVE 11 +#define FLDEFF_JUMP_TALL_GRASS 12 +#define FLDEFF_SAND_FOOTPRINTS 13 +#define FLDEFF_JUMP_BIG_SPLASH 14 +#define FLDEFF_SPLASH 15 +#define FLDEFF_JUMP_SMALL_SPLASH 16 +#define FLDEFF_LONG_GRASS 17 +#define FLDEFF_JUMP_LONG_GRASS 18 +#define FLDEFF_UNKNOWN_19 19 +#define FLDEFF_UNKNOWN_20 20 +#define FLDEFF_UNKNOWN_21 21 +#define FLDEFF_UNKNOWN_22 22 +#define FLDEFF_BERRY_TREE_GROWTH_SPARKLE 23 +#define FLDEFF_DEEP_SAND_FOOTPRINTS 24 +#define FLDEFF_POKECENTER_HEAL 25 +#define FLDEFF_USE_SECRET_POWER_TREE 26 +#define FLDEFF_USE_SECRET_POWER_SHRUB 27 +#define FLDEFF_TREE_DISGUISE 28 +#define FLDEFF_MOUNTAIN_DISGUISE 29 +#define FLDEFF_NPCFLY_OUT 30 +#define FLDEFF_USE_FLY 31 +#define FLDEFF_FLY_IN 32 +#define FLDEFF_QUESTION_MARK_ICON 33 +#define FLDEFF_FEET_IN_FLOWING_WATER 34 +#define FLDEFF_BIKE_TIRE_TRACKS 35 +#define FLDEFF_SAND_DISGUISE 36 +#define FLDEFF_USE_ROCK_SMASH 37 +#define FLDEFF_USE_DIG 38 +#define FLDEFF_SAND_PILE 39 +#define FLDEFF_USE_STRENGTH 40 +#define FLDEFF_SHORT_GRASS 41 +#define FLDEFF_HOT_SPRINGS_WATER 42 +#define FLDEFF_USE_WATERFALL 43 +#define FLDEFF_USE_DIVE 44 +#define FLDEFF_POKEBALL 45 +#define FLDEFF_HEART_ICON 46 +#define FLDEFF_NOP_47 47 +#define FLDEFF_NOP_48 48 +#define FLDEFF_POP_OUT_OF_ASH 49 +#define FLDEFF_LAVARIDGE_GYM_WARP 50 +#define FLDEFF_SWEET_SCENT 51 +#define FLDEFF_SAND_PILLAR 52 +#define FLDEFF_BUBBLES 53 +#define FLDEFF_SPARKLE 54 +#define FLDEFF_SECRET_POWER_CAVE 55 +#define FLDEFF_SECRET_POWER_TREE 56 +#define FLDEFF_SECRET_POWER_SHRUB 57 +#define FLDEFF_CUT_GRASS 58 +#define FLDEFF_FIELD_MOVE_SHOW_MON_INIT 59 +#define FLDEFF_USE_FLY_ANCIENT_TOMB 60 +#define FLDEFF_PCTURN_ON 61 +#define FLDEFF_HALL_OF_FAME_RECORD 62 +#define FLDEFF_USE_TELEPORT 63 +#define FLDEFF_64 64 +#define FLDEFF_65 65 +#define FLDEFF_66 66 + +#endif diff --git a/include/field_effect.h b/include/field_effect.h index 2881a2cd7..7620cedcd 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -1,85 +1,12 @@ #ifndef GUARD_FIELD_EFFECTS_H #define GUARD_FIELD_EFFECTS_H -#include "task.h" - extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[2]; extern const struct SpritePalette gNewGameBirchObjectPaletteInfo; extern const struct CompressedSpriteSheet gTrainerFrontPicTable[2]; extern const struct SpriteTemplate gNewGameBirchObjectTemplate; extern const struct OamData gNewGameBirchOamAttributes; -enum FieldEffectScriptIdx -{ - FLDEFF_EXCLAMATION_MARK_ICON, - FLDEFF_USE_CUT_ON_GRASS, - FLDEFF_USE_CUT_ON_TREE, - FLDEFF_SHADOW, - FLDEFF_TALL_GRASS, - FLDEFF_RIPPLE, - FLDEFF_FIELD_MOVE_SHOW_MON, - FLDEFF_ASH, - FLDEFF_SURF_BLOB, - FLDEFF_USE_SURF, - FLDEFF_DUST, - FLDEFF_USE_SECRET_POWER_CAVE, - FLDEFF_JUMP_TALL_GRASS, - FLDEFF_SAND_FOOTPRINTS, - FLDEFF_JUMP_BIG_SPLASH, - FLDEFF_SPLASH, - FLDEFF_JUMP_SMALL_SPLASH, - FLDEFF_LONG_GRASS, - FLDEFF_JUMP_LONG_GRASS, - FLDEFF_UNKNOWN_19, - FLDEFF_UNKNOWN_20, - FLDEFF_UNKNOWN_21, - FLDEFF_UNKNOWN_22, - FLDEFF_BERRY_TREE_GROWTH_SPARKLE, - FLDEFF_DEEP_SAND_FOOTPRINTS, - FLDEFF_POKECENTER_HEAL, - FLDEFF_USE_SECRET_POWER_TREE, - FLDEFF_USE_SECRET_POWER_SHRUB, - FLDEFF_TREE_DISGUISE, - FLDEFF_MOUNTAIN_DISGUISE, - FLDEFF_NPCFLY_OUT, - FLDEFF_USE_FLY, - FLDEFF_FLY_IN, - FLDEFF_QUESTION_MARK_ICON, - FLDEFF_FEET_IN_FLOWING_WATER, - FLDEFF_BIKE_TIRE_TRACKS, - FLDEFF_SAND_DISGUISE, - FLDEFF_USE_ROCK_SMASH, - FLDEFF_USE_DIG, - FLDEFF_SAND_PILE, - FLDEFF_USE_STRENGTH, - FLDEFF_SHORT_GRASS, - FLDEFF_HOT_SPRINGS_WATER, - FLDEFF_USE_WATERFALL, - FLDEFF_USE_DIVE, - FLDEFF_POKEBALL, - FLDEFF_HEART_ICON, - FLDEFF_NOP_47, - FLDEFF_NOP_48, - FLDEFF_POP_OUT_OF_ASH, - FLDEFF_LAVARIDGE_GYM_WARP, - FLDEFF_SWEET_SCENT, - FLDEFF_SAND_PILLAR, - FLDEFF_BUBBLES, - FLDEFF_SPARKLE, - FLDEFF_SECRET_POWER_CAVE, - FLDEFF_SECRET_POWER_TREE, - FLDEFF_SECRET_POWER_SHRUB, - FLDEFF_CUT_GRASS, - FLDEFF_FIELD_MOVE_SHOW_MON_INIT, - FLDEFF_USE_FLY_ANCIENT_TOMB, - FLDEFF_PCTURN_ON, - FLDEFF_HALL_OF_FAME_RECORD, - FLDEFF_USE_TELEPORT, - FLDEFF_64, - FLDEFF_65, - FLDEFF_66, -}; - extern s32 gFieldEffectArguments[8]; extern void (*gPostMenuFieldCallback)(void); extern bool8 (*gFieldCallback2)(void); @@ -109,126 +36,6 @@ bool8 FieldEffectCmd_loadgfx_callnative(u8 **script, u32 *val); bool8 FieldEffectCmd_loadtiles_callnative(u8 **script, u32 *val); bool8 FieldEffectCmd_loadfadedpal_callnative(u8 **script, u32 *val); -void PokecenterHealEffect_0(struct Task *); -void PokecenterHealEffect_1(struct Task *); -void PokecenterHealEffect_2(struct Task *); -void PokecenterHealEffect_3(struct Task *); - -void HallOfFameRecordEffect_0(struct Task *); -void HallOfFameRecordEffect_1(struct Task *); -void HallOfFameRecordEffect_2(struct Task *); -void HallOfFameRecordEffect_3(struct Task *); - -void PokeballGlowEffect_0(struct Sprite *); -void PokeballGlowEffect_1(struct Sprite *); -void PokeballGlowEffect_2(struct Sprite *); -void PokeballGlowEffect_3(struct Sprite *); -void PokeballGlowEffect_4(struct Sprite *); -void PokeballGlowEffect_5(struct Sprite *); -void PokeballGlowEffect_6(struct Sprite *); -void PokeballGlowEffect_7(struct Sprite *); - -bool8 sub_80B6BCC(struct Task *); -bool8 sub_80B6C74(struct Task *); -bool8 sub_80B6C90(struct Task *); -bool8 sub_80B6D04(struct Task *); -bool8 sub_80B6DBC(struct Task *); -bool8 sub_80B6DD8(struct Task *); -bool8 sub_80B6E18(struct Task *); - -bool8 sub_80B6EC0(struct Task *); -bool8 sub_80B6EE0(struct Task *); -bool8 sub_80B6F50(struct Task *); -bool8 sub_80B6F74(struct Task *); -bool8 sub_80B6F84(struct Task *); -bool8 sub_80B6FA8(struct Task *); - -bool8 sub_80B7114(struct Task *); -bool8 sub_80B7190(struct Task *); -bool8 sub_80B71D0(struct Task *); -bool8 sub_80B7230(struct Task *); -bool8 sub_80B7270(struct Task *); -bool8 sub_80B72D0(struct Task *); -bool8 sub_80B72F4(struct Task *); - -bool8 sub_80B73D0(struct Task *, struct EventObject *); -bool8 waterfall_1_do_anim_probably(struct Task *, struct EventObject *); -bool8 waterfall_2_wait_anim_finish_probably(struct Task *, struct EventObject *); -bool8 sub_80B7450(struct Task *, struct EventObject *); -bool8 sub_80B7478(struct Task *, struct EventObject *); - -bool8 dive_1_lock(struct Task *); -bool8 dive_2_unknown(struct Task *); -bool8 dive_3_unknown(struct Task *); - -bool8 sub_80B764C(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7684(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B76B8(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7704(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B77F8(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7814(struct Task *, struct EventObject *, struct Sprite *); - -bool8 sub_80B78EC(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B791C(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7968(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B79BC(struct Task *, struct EventObject *, struct Sprite *); - -bool8 sub_80B7AE8(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7B18(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7B94(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7BCC(struct Task *, struct EventObject *, struct Sprite *); -bool8 sub_80B7BF4(struct Task *, struct EventObject *, struct Sprite *); - -static void EscapeRopeFieldEffect_Step0(struct Task *); -static void EscapeRopeFieldEffect_Step1(struct Task *); - -void sub_80B7EC4(struct Task *); -void sub_80B7EE8(struct Task *); - -void sub_80B8280(struct Task *); -void sub_80B830C(struct Task *); -void sub_80B8410(struct Task *); - -void sub_80B8584(struct Task *); -void sub_80B85F8(struct Task *); -void sub_80B8660(struct Task *); -void sub_80B86EC(struct Task *); -void sub_80B871C(struct Task *); -void sub_80B8770(struct Task *); -void overworld_bg_setup_2(struct Task *); - -void sub_80B88E4(struct Task *); -void sub_80B8920(struct Task *); -void sub_80B898C(struct Task *); -void sub_80B89DC(struct Task *); -void sub_80B8A0C(struct Task *); -void sub_80B8A44(struct Task *); -void sub_80B8A64(struct Task *); - -void sub_80B8DB4(struct Task *); -void sub_80B8E14(struct Task *); -void sub_80B8E60(struct Task *); -void sub_80B8EA8(struct Task *); -void sub_80B8F24(struct Task *); - -void sub_80B9204(struct Task *); -void sub_80B925C(struct Task *); -void sub_80B92A0(struct Task *); -void sub_80B92F8(struct Task *); -void sub_80B933C(struct Task *); -void sub_80B9390(struct Task *); -void sub_80B9418(struct Task *); -void sub_80B9474(struct Task *); -void sub_80B9494(struct Task *); - -void sub_80B9804(struct Task *); -void sub_80B98B8(struct Task *); -void sub_80B9924(struct Task *); -void sub_80B9978(struct Task *); -void sub_80B99F0(struct Task *); -void sub_80B9A28(struct Task *); -void sub_80B9A60(struct Task *); - void sub_80B9C28(s16*, u8); void sub_80B9C54(s16*, u8); void sub_80B9CDC(s16*, u8); diff --git a/include/field_region_map.h b/include/field_region_map.h deleted file mode 100644 index d50f1265c..000000000 --- a/include/field_region_map.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef GUARD_FIELD_REGION_MAP_H -#define GUARD_FIELD_REGION_MAP_H - -void FieldInitRegionMap(MainCallback callback); - -#endif // GUARD_FIELD_REGION_MAP_H diff --git a/src/battle_transition.c b/src/battle_transition.c index fc8c0eeee..759f15eee 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1,25 +1,25 @@ #include "global.h" #include "battle_transition.h" -#include "unk_transition.h" -#include "main.h" -#include "overworld.h" -#include "task.h" -#include "palette.h" -#include "trig.h" -#include "field_effect.h" +#include "bg.h" +#include "decompress.h" #include "field_camera.h" +#include "field_effect.h" +#include "gpu_regs.h" +#include "main.h" +#include "malloc.h" +#include "overworld.h" +#include "palette.h" #include "random.h" -#include "sprite.h" +#include "scanline_effect.h" #include "sound.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "unk_transition.h" +#include "util.h" +#include "constants/field_effects.h" #include "constants/songs.h" #include "constants/trainers.h" -#include "field_camera.h" -#include "scanline_effect.h" -#include "malloc.h" -#include "gpu_regs.h" -#include "decompress.h" -#include "bg.h" -#include "util.h" struct TransitionData { diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 76394e937..b17ffad33 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -5,6 +5,7 @@ #include "script.h" #include "sound.h" #include "task.h" +#include "constants/field_effects.h" #include "constants/flags.h" #include "constants/maps.h" #include "constants/songs.h" diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 048b02d2d..93be006ea 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -18,10 +18,12 @@ #include "random.h" #include "rom_818CFC8.h" #include "sprite.h" +#include "task.h" #include "trainer_see.h" #include "util.h" #include "constants/event_object_movement_constants.h" #include "constants/event_objects.h" +#include "constants/field_effects.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 3451ad22d..ad4c7ca3d 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -558,8 +558,7 @@ static bool8 TryStartCoordEventScript(struct MapPosition *position) static bool8 TryStartMiscWalkingScripts(u16 metatileBehavior) { - s16 x; - s16 y; + s16 x, y; if (MetatileBehavior_IsCrackedFloorHole(metatileBehavior)) { diff --git a/src/field_effect.c b/src/field_effect.c index 594d75c95..2ec5edf1e 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -2,6 +2,7 @@ #include "decompress.h" #include "event_object_movement.h" #include "field_camera.h" +#include "field_control_avatar.h" #include "field_effect.h" #include "field_effect_helpers.h" #include "field_player_avatar.h" @@ -24,6 +25,7 @@ #include "trainer_pokemon_sprites.h" #include "trig.h" #include "util.h" +#include "constants/field_effects.h" #include "constants/event_object_movement_constants.h" #include "constants/rgb.h" #include "constants/songs.h" @@ -34,13 +36,213 @@ EWRAM_DATA s32 gFieldEffectArguments[8] = {0}; // Static type declarations +static void Task_PokecenterHeal(u8 taskId); +static void PokecenterHealEffect_0(struct Task *); +static void PokecenterHealEffect_1(struct Task *); +static void PokecenterHealEffect_2(struct Task *); +static void PokecenterHealEffect_3(struct Task *); + +static void Task_HallOfFameRecord(u8 taskId); +static void HallOfFameRecordEffect_0(struct Task *); +static void HallOfFameRecordEffect_1(struct Task *); +static void HallOfFameRecordEffect_2(struct Task *); +static void HallOfFameRecordEffect_3(struct Task *); + +static u8 CreatePokeballGlowSprite(s16, s16, s16, u16); +static void SpriteCB_PokeballGlowEffect(struct Sprite *); +static void PokeballGlowEffect_0(struct Sprite *); +static void PokeballGlowEffect_1(struct Sprite *); +static void PokeballGlowEffect_2(struct Sprite *); +static void PokeballGlowEffect_3(struct Sprite *); +static void PokeballGlowEffect_4(struct Sprite *); +static void PokeballGlowEffect_5(struct Sprite *); +static void PokeballGlowEffect_6(struct Sprite *); +static void PokeballGlowEffect_7(struct Sprite *); + +static u8 PokecenterHealEffectHelper(s16, s16); +static void HallOfFameRecordEffectHelper(s16, s16, s16, u8); + +static void mapldr_080842E8(void); +static void task00_8084310(u8); +static void mapldr_08084390(void); +static void c3_080843F8(u8); + +static void sub_80B6B94(u8); +static bool8 sub_80B6BCC(struct Task *); +static bool8 sub_80B6C74(struct Task *); +static bool8 sub_80B6C90(struct Task *); +static bool8 sub_80B6D04(struct Task *); +static bool8 sub_80B6DBC(struct Task *); +static bool8 sub_80B6DD8(struct Task *); +static bool8 sub_80B6E18(struct Task *); + +static void sub_80B6E88(u8); +static bool8 sub_80B6EC0(struct Task *); +static bool8 sub_80B6EE0(struct Task *); +static bool8 sub_80B6F50(struct Task *); +static bool8 sub_80B6F74(struct Task *); +static bool8 sub_80B6F84(struct Task *); +static bool8 sub_80B6FA8(struct Task *); + +static void sub_80B6FB8(struct Task *); +static void sub_80B7004(struct Task *); +static void sub_80B7050(void); +static void sub_80B7060(void); +static void sub_80B70B4(void); +static void sub_80B70DC(u8); + +static bool8 sub_80B7114(struct Task *); +static bool8 sub_80B7190(struct Task *); +static bool8 sub_80B71D0(struct Task *); +static bool8 sub_80B7230(struct Task *); +static bool8 sub_80B7270(struct Task *); +static bool8 sub_80B72D0(struct Task *); +static bool8 sub_80B72F4(struct Task *); + +static void sub_80B7384(u8); +static bool8 sub_80B73D0(struct Task *, struct EventObject *); +static bool8 waterfall_1_do_anim_probably(struct Task *, struct EventObject *); +static bool8 waterfall_2_wait_anim_finish_probably(struct Task *, struct EventObject *); +static bool8 sub_80B7450(struct Task *, struct EventObject *); +static bool8 sub_80B7478(struct Task *, struct EventObject *); + +static void Task_Dive(u8); +static bool8 dive_1_lock(struct Task *); +static bool8 dive_2_unknown(struct Task *); +static bool8 dive_3_unknown(struct Task *); + +static void sub_80B75F0(u8); +static bool8 sub_80B764C(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7684(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B76B8(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7704(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B77F8(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7814(struct Task *, struct EventObject *, struct Sprite *); + +static void mapldr_080851BC(void); +static void sub_80B7890(u8); + +static bool8 sub_80B78EC(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B791C(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7968(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B79BC(struct Task *, struct EventObject *, struct Sprite *); + +static void sub_80B7A8C(u8); + +static bool8 sub_80B7AE8(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7B18(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7B94(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7BCC(struct Task *, struct EventObject *, struct Sprite *); +static bool8 sub_80B7BF4(struct Task *, struct EventObject *, struct Sprite *); + +static void DoEscapeRopeFieldEffect(u8); +static void EscapeRopeFieldEffect_Step0(struct Task *); +static void EscapeRopeFieldEffect_Step1(struct Task *); + +static void mapldr_080859D4(void); +static void sub_80B7E94(u8); + +static void sub_80B7EC4(struct Task *); +static void sub_80B7EE8(struct Task *); + +static void ExecuteTeleportFieldEffectTask(u8); +static void TeleportFieldEffectTask1(struct Task*); +static void TeleportFieldEffectTask2(struct Task*); +static void TeleportFieldEffectTask3(struct Task*); +static void TeleportFieldEffectTask4(struct Task*); + +static void mapldr_08085D88(void); +static void sub_80B8250(u8); + +static void sub_80B8280(struct Task *); +static void sub_80B830C(struct Task *); +static void sub_80B8410(struct Task *); + +static void sub_80B8554(u8); +static void sub_80B8584(struct Task *); +static void sub_80B85F8(struct Task *); +static void sub_80B8660(struct Task *); +static void sub_80B86EC(struct Task *); +static void sub_80B871C(struct Task *); +static void sub_80B8770(struct Task *); +static void overworld_bg_setup_2(struct Task *); + +static void sub_80B880C(void); +static void sub_80B8874(u16); + +static void sub_80B88B4(u8); +static void sub_80B88E4(struct Task *); +static void sub_80B8920(struct Task *); +static void sub_80B898C(struct Task *); +static void sub_80B89DC(struct Task *); +static void sub_80B8A0C(struct Task *); +static void sub_80B8A44(struct Task *); +static void sub_80B8A64(struct Task *); + +static void sub_80B8AE0(void); +static void sub_80B8B28(struct Task *); +static bool8 sub_80B8B38(struct Task *); +static bool8 sub_80B8BF0(struct Task *); + +static u8 sub_80B8C60(u32, u32, u32); +static void sub_80B8CC0(struct Sprite *); +static void sub_80B8D04(struct Sprite *); +static void sub_80B8D20(struct Sprite *); + +static void sub_80B8D84(u8); +static void sub_80B8DB4(struct Task *); +static void sub_80B8E14(struct Task *); +static void sub_80B8E60(struct Task *); +static void sub_80B8EA8(struct Task *); +static void sub_80B8F24(struct Task *); + +static void sub_80B9128(struct Sprite *); + +static void sub_80B91D4(u8); +static void sub_80B9204(struct Task *); +static void sub_80B925C(struct Task *); +static void sub_80B92A0(struct Task *); +static void sub_80B92F8(struct Task *); +static void sub_80B933C(struct Task *); +static void sub_80B9390(struct Task *); +static void sub_80B9418(struct Task *); +static void sub_80B9474(struct Task *); +static void sub_80B9494(struct Task *); + +static u8 sub_80B94C4(void); +static u8 sub_80B9508(u8); +static void sub_80B9524(u8); +static void sub_80B9560(u8, u8); +static void sub_80B957C(struct Sprite *); +static void sub_80B963C(struct Sprite *); + +static void sub_80B97D4(u8); +static void sub_80B9804(struct Task *); +static void sub_80B98B8(struct Task *); +static void sub_80B9924(struct Task *); +static void sub_80B9978(struct Task *); +static void sub_80B99F0(struct Task *); +static void sub_80B9A28(struct Task *); +static void sub_80B9A60(struct Task *); + +static void sub_80B9BE8(u8 taskId); +static void sub_80B9DB8(struct Sprite* sprite); +static void sub_80B9EDC(u8 taskId); + // Static RAM declarations static IWRAM_DATA u8 sActiveList[32]; -// Static ROM declarations +// External declarations extern u8 *gFieldEffectScriptPointers[]; +extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; +extern void sub_81555D8(u8, u8); +extern void pal_fill_for_maplights(void); +extern void sub_80E1558(u8); +extern void sub_80E1570(void); +extern bool8 sub_80E1584(void); +extern void sub_80AF0B4(void); // .rodata const u32 gNewGameBirchPic[] = INCBIN_U32("graphics/birch_speech/birch.4bpp"); @@ -808,10 +1010,6 @@ void MultiplyPaletteRGBComponents(u16 i, u8 r, u8 g, u8 b) } #endif -void Task_PokecenterHeal(u8 taskId); -u8 CreatePokeballGlowSprite(s16, s16, s16, u16); -u8 PokecenterHealEffectHelper(s16, s16); - bool8 FldEff_PokecenterHeal(void) { u8 nPokemon; @@ -827,21 +1025,21 @@ bool8 FldEff_PokecenterHeal(void) return FALSE; } -void Task_PokecenterHeal(u8 taskId) +static void Task_PokecenterHeal(u8 taskId) { struct Task *task; task = &gTasks[taskId]; gUnknown_0855C364[task->data[0]](task); } -void PokecenterHealEffect_0(struct Task *task) +static void PokecenterHealEffect_0(struct Task *task) { task->data[0]++; task->data[6] = CreatePokeballGlowSprite(task->data[1], task->data[2], task->data[3], 1); task->data[7] = PokecenterHealEffectHelper(task->data[4], task->data[5]); } -void PokecenterHealEffect_1(struct Task *task) +static void PokecenterHealEffect_1(struct Task *task) { if (gSprites[task->data[6]].data[0] > 1) { @@ -850,7 +1048,7 @@ void PokecenterHealEffect_1(struct Task *task) } } -void PokecenterHealEffect_2(struct Task *task) +static void PokecenterHealEffect_2(struct Task *task) { if (gSprites[task->data[6]].data[0] > 4) { @@ -858,7 +1056,7 @@ void PokecenterHealEffect_2(struct Task *task) } } -void PokecenterHealEffect_3(struct Task *task) +static void PokecenterHealEffect_3(struct Task *task) { if (gSprites[task->data[6]].data[0] > 6) { @@ -868,9 +1066,6 @@ void PokecenterHealEffect_3(struct Task *task) } } -void Task_HallOfFameRecord(u8 taskId); -void HallOfFameRecordEffectHelper(s16, s16, s16, u8); - bool8 FldEff_HallOfFameRecord(void) { u8 nPokemon; @@ -884,14 +1079,14 @@ bool8 FldEff_HallOfFameRecord(void) return FALSE; } -void Task_HallOfFameRecord(u8 taskId) +static void Task_HallOfFameRecord(u8 taskId) { struct Task *task; task = &gTasks[taskId]; gUnknown_0855C374[task->data[0]](task); } -void HallOfFameRecordEffect_0(struct Task *task) +static void HallOfFameRecordEffect_0(struct Task *task) { u8 taskId; task->data[0]++; @@ -904,7 +1099,7 @@ void HallOfFameRecordEffect_0(struct Task *task) HallOfFameRecordEffectHelper(taskId, 0xc8, 0x08, 1); } -void HallOfFameRecordEffect_1(struct Task *task) +static void HallOfFameRecordEffect_1(struct Task *task) { if (gSprites[task->data[6]].data[0] > 1) { @@ -913,7 +1108,7 @@ void HallOfFameRecordEffect_1(struct Task *task) } } -void HallOfFameRecordEffect_2(struct Task *task) +static void HallOfFameRecordEffect_2(struct Task *task) { if (gSprites[task->data[6]].data[0] > 4) { @@ -921,7 +1116,7 @@ void HallOfFameRecordEffect_2(struct Task *task) } } -void HallOfFameRecordEffect_3(struct Task *task) +static void HallOfFameRecordEffect_3(struct Task *task) { if (gSprites[task->data[6]].data[0] > 6) { @@ -931,9 +1126,8 @@ void HallOfFameRecordEffect_3(struct Task *task) } } -void SpriteCB_PokeballGlowEffect(struct Sprite *); -u8 CreatePokeballGlowSprite(s16 data6, s16 x, s16 y, u16 data5) +static u8 CreatePokeballGlowSprite(s16 data6, s16 x, s16 y, u16 data5) { u8 spriteId; struct Sprite *sprite; @@ -947,12 +1141,12 @@ u8 CreatePokeballGlowSprite(s16 data6, s16 x, s16 y, u16 data5) return spriteId; } -void SpriteCB_PokeballGlowEffect(struct Sprite *sprite) +static void SpriteCB_PokeballGlowEffect(struct Sprite *sprite) { gUnknown_0855C384[sprite->data[0]](sprite); } -void PokeballGlowEffect_0(struct Sprite *sprite) +static void PokeballGlowEffect_0(struct Sprite *sprite) { u8 endSpriteId; if (sprite->data[1] == 0 || (--sprite->data[1]) == 0) @@ -972,7 +1166,7 @@ void PokeballGlowEffect_0(struct Sprite *sprite) } } -void PokeballGlowEffect_1(struct Sprite *sprite) +static void PokeballGlowEffect_1(struct Sprite *sprite) { if ((--sprite->data[1]) == 0) { @@ -987,7 +1181,7 @@ void PokeballGlowEffect_1(struct Sprite *sprite) } } -void PokeballGlowEffect_2(struct Sprite *sprite) +static void PokeballGlowEffect_2(struct Sprite *sprite) { u8 phase; if ((--sprite->data[1]) == 0) @@ -1017,7 +1211,7 @@ void PokeballGlowEffect_2(struct Sprite *sprite) } } -void PokeballGlowEffect_3(struct Sprite *sprite) +static void PokeballGlowEffect_3(struct Sprite *sprite) { u8 phase; if ((--sprite->data[1]) == 0) @@ -1039,7 +1233,7 @@ void PokeballGlowEffect_3(struct Sprite *sprite) MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(0x1007) << 4) + 0x103, gUnknown_0855C3BC[phase], gUnknown_0855C3C0[phase], gUnknown_0855C3C4[phase]); } -void PokeballGlowEffect_4(struct Sprite *sprite) +static void PokeballGlowEffect_4(struct Sprite *sprite) { if ((--sprite->data[1]) == 0) { @@ -1047,12 +1241,12 @@ void PokeballGlowEffect_4(struct Sprite *sprite) } } -void PokeballGlowEffect_5(struct Sprite *sprite) +static void PokeballGlowEffect_5(struct Sprite *sprite) { sprite->data[0]++; } -void PokeballGlowEffect_6(struct Sprite *sprite) +static void PokeballGlowEffect_6(struct Sprite *sprite) { if (sprite->data[5] == 0 || IsFanfareTaskInactive()) { @@ -1060,7 +1254,7 @@ void PokeballGlowEffect_6(struct Sprite *sprite) } } -void PokeballGlowEffect_7(struct Sprite *sprite) +static void PokeballGlowEffect_7(struct Sprite *sprite) { } @@ -1072,7 +1266,7 @@ void SpriteCB_PokeballGlow(struct Sprite *sprite) } } -u8 PokecenterHealEffectHelper(s16 x, s16 y) +static u8 PokecenterHealEffectHelper(s16 x, s16 y) { u8 spriteIdAtEnd; struct Sprite *sprite; @@ -1098,7 +1292,7 @@ void SpriteCB_PokecenterMonitor(struct Sprite *sprite) } } -void HallOfFameRecordEffectHelper(s16 a0, s16 a1, s16 a2, u8 a3) +static void HallOfFameRecordEffectHelper(s16 a0, s16 a1, s16 a2, u8 a3) { u8 spriteIdAtEnd; if (!a3) @@ -1130,10 +1324,6 @@ void SpriteCB_HallOfFameMonitor(struct Sprite *sprite) } } -void mapldr_080842E8(void); -void mapldr_08084390(void); -void task00_8084310(u8); -void c3_080843F8(u8); void sub_80B69DC(void) { @@ -1141,7 +1331,7 @@ void sub_80B69DC(void) gFieldCallback = mapldr_080842E8; } -void mapldr_080842E8(void) +static void mapldr_080842E8(void) { pal_fill_black(); CreateTask(task00_8084310, 0); @@ -1150,7 +1340,7 @@ void mapldr_080842E8(void) gFieldCallback = NULL; } -void task00_8084310(u8 taskId) +static void task00_8084310(u8 taskId) { struct Task *task; task = &gTasks[taskId]; @@ -1178,7 +1368,7 @@ void task00_8084310(u8 taskId) } } -void mapldr_08084390(void) +static void mapldr_08084390(void) { Overworld_PlaySpecialMapMusic(); pal_fill_black(); @@ -1193,7 +1383,7 @@ void mapldr_08084390(void) gFieldCallback = NULL; } -void c3_080843F8(u8 taskId) +static void c3_080843F8(u8 taskId) { struct Task *task; task = &gTasks[taskId]; @@ -1214,11 +1404,6 @@ void c3_080843F8(u8 taskId) } } -extern void pal_fill_for_maplights(void); -void sub_80B6B94(u8); -extern void CameraObjectReset2(void); -extern void CameraObjectReset1(void); - void sub_80B6B68(void) { Overworld_PlaySpecialMapMusic(); @@ -1229,14 +1414,14 @@ void sub_80B6B68(void) gFieldCallback = NULL; } -void sub_80B6B94(u8 taskId) +static void sub_80B6B94(u8 taskId) { struct Task *task; task = &gTasks[taskId]; while (gUnknown_0855C3C8[task->data[0]](task)); // return code signifies whether to continue blocking here } -bool8 sub_80B6BCC(struct Task *task) // gUnknown_0855C3C8[0] +static bool8 sub_80B6BCC(struct Task *task) // gUnknown_0855C3C8[0] { struct EventObject *playerObject; struct Sprite *playerSprite; @@ -1254,7 +1439,7 @@ bool8 sub_80B6BCC(struct Task *task) // gUnknown_0855C3C8[0] return TRUE; } -bool8 sub_80B6C74(struct Task *task) // gUnknown_0855C3C8[1] +static bool8 sub_80B6C74(struct Task *task) // gUnknown_0855C3C8[1] { if (IsWeatherNotFadingIn()) { @@ -1263,7 +1448,7 @@ bool8 sub_80B6C74(struct Task *task) // gUnknown_0855C3C8[1] return FALSE; } -bool8 sub_80B6C90(struct Task *task) // gUnknown_0855C3C8[2] +static bool8 sub_80B6C90(struct Task *task) // gUnknown_0855C3C8[2] { struct Sprite *sprite; s16 centerToCornerVecY; @@ -1278,7 +1463,7 @@ bool8 sub_80B6C90(struct Task *task) // gUnknown_0855C3C8[2] return FALSE; } -bool8 sub_80B6D04(struct Task *task) +static bool8 sub_80B6D04(struct Task *task) { struct EventObject *eventObject; struct Sprite *sprite; @@ -1312,7 +1497,7 @@ bool8 sub_80B6D04(struct Task *task) return FALSE; } -bool8 sub_80B6DBC(struct Task *task) +static bool8 sub_80B6DBC(struct Task *task) { task->data[0]++; task->data[1] = 4; @@ -1321,7 +1506,7 @@ bool8 sub_80B6DBC(struct Task *task) return TRUE; } -bool8 sub_80B6DD8(struct Task *task) +static bool8 sub_80B6DD8(struct Task *task) { SetCameraPanning(0, task->data[1]); task->data[1] = -task->data[1]; @@ -1337,7 +1522,7 @@ bool8 sub_80B6DD8(struct Task *task) return FALSE; } -bool8 sub_80B6E18(struct Task *task) +static bool8 sub_80B6E18(struct Task *task) { gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); @@ -1348,19 +1533,6 @@ bool8 sub_80B6E18(struct Task *task) return FALSE; } -void sub_80B6E88(u8); -extern void sub_80E1558(u8); -extern void sub_80AF0B4(void); - -void sub_80B6FB8(struct Task *); -void sub_80B7004(struct Task *); -void sub_80B7050(void); -void sub_80B7060(void); -bool8 BGMusicStopped(void); -void sub_80B70B4(void); -void sub_80E1570(void); -void sub_80B70DC(u8); - void sub_80B6E4C(u8 a0, u8 priority) { u8 taskId; @@ -1372,14 +1544,14 @@ void sub_80B6E4C(u8 a0, u8 priority) } } -void sub_80B6E88(u8 taskId) +static void sub_80B6E88(u8 taskId) { struct Task *task; task = &gTasks[taskId]; while (gUnknown_0855C3E4[task->data[0]](task)); } -bool8 sub_80B6EC0(struct Task *task) +static bool8 sub_80B6EC0(struct Task *task) { FreezeEventObjects(); CameraObjectReset2(); @@ -1388,7 +1560,7 @@ bool8 sub_80B6EC0(struct Task *task) return FALSE; } -bool8 sub_80B6EE0(struct Task *task) +static bool8 sub_80B6EE0(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -1407,7 +1579,7 @@ bool8 sub_80B6EE0(struct Task *task) return FALSE; } -bool8 sub_80B6F50(struct Task *task) +static bool8 sub_80B6F50(struct Task *task) { sub_80B6FB8(task); if (task->data[2] > 3) @@ -1418,14 +1590,14 @@ bool8 sub_80B6F50(struct Task *task) return FALSE; } -bool8 sub_80B6F74(struct Task *task) +static bool8 sub_80B6F74(struct Task *task) { sub_80B6FB8(task); sub_80B7060(); return FALSE; } -bool8 sub_80B6F84(struct Task *task) +static bool8 sub_80B6F84(struct Task *task) { sub_80B7004(task); if (task->data[2] > 3) @@ -1436,14 +1608,14 @@ bool8 sub_80B6F84(struct Task *task) return FALSE; } -bool8 sub_80B6FA8(struct Task *task) +static bool8 sub_80B6FA8(struct Task *task) { sub_80B7004(task); sub_80B7060(); return FALSE; } -void sub_80B6FB8(struct Task *task) +static void sub_80B6FB8(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1456,7 +1628,7 @@ void sub_80B6FB8(struct Task *task) } } -void sub_80B7004(struct Task *task) +static void sub_80B7004(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1469,13 +1641,13 @@ void sub_80B7004(struct Task *task) } } -void sub_80B7050(void) +static void sub_80B7050(void) { music_something(); sub_80AF0B4(); } -void sub_80B7060(void) +static void sub_80B7060(void) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -1487,7 +1659,7 @@ void sub_80B7060(void) } } -void sub_80B70B4(void) +static void sub_80B70B4(void) { Overworld_PlaySpecialMapMusic(); pal_fill_for_maplights(); @@ -1496,14 +1668,14 @@ void sub_80B70B4(void) gFieldCallback = NULL; } -void sub_80B70DC(u8 taskId) +static void sub_80B70DC(u8 taskId) { struct Task *task; task = &gTasks[taskId]; while (gUnknown_0855C3FC[task->data[0]](task)); } -bool8 sub_80B7114(struct Task *task) +static bool8 sub_80B7114(struct Task *task) { struct EventObject *eventObject; s16 x; @@ -1528,7 +1700,7 @@ bool8 sub_80B7114(struct Task *task) return TRUE; } -bool8 sub_80B7190(struct Task *task) +static bool8 sub_80B7190(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1538,7 +1710,7 @@ bool8 sub_80B7190(struct Task *task) return FALSE; } -bool8 sub_80B71D0(struct Task *task) +static bool8 sub_80B71D0(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1558,7 +1730,7 @@ bool8 sub_80B71D0(struct Task *task) return FALSE; } -bool8 sub_80B7230(struct Task *task) +static bool8 sub_80B7230(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1568,7 +1740,7 @@ bool8 sub_80B7230(struct Task *task) return FALSE; } -bool8 sub_80B7270(struct Task *task) +static bool8 sub_80B7270(struct Task *task) { struct Sprite *sprite; sprite = &gSprites[gPlayerAvatar.spriteId]; @@ -1588,9 +1760,7 @@ bool8 sub_80B7270(struct Task *task) return FALSE; } -extern bool8 sub_80E1584(void); - -bool8 sub_80B72D0(struct Task *task) +static bool8 sub_80B72D0(struct Task *task) { if (sub_80E1584()) { @@ -1601,7 +1771,7 @@ bool8 sub_80B72D0(struct Task *task) return TRUE; } -bool8 sub_80B72F4(struct Task *task) +static bool8 sub_80B72F4(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -1615,8 +1785,6 @@ bool8 sub_80B72F4(struct Task *task) return FALSE; } -void sub_80B7384(u8); - bool8 FldEff_UseWaterfall(void) { u8 taskId; @@ -1626,12 +1794,12 @@ bool8 FldEff_UseWaterfall(void) return FALSE; } -void sub_80B7384(u8 taskId) +static void sub_80B7384(u8 taskId) { while (gUnknown_0855C418[gTasks[taskId].data[0]](&gTasks[taskId], &gEventObjects[gPlayerAvatar.eventObjectId])); } -bool8 sub_80B73D0(struct Task *task, struct EventObject *eventObject) +static bool8 sub_80B73D0(struct Task *task, struct EventObject *eventObject) { ScriptContext2_Enable(); gPlayerAvatar.preventStep = TRUE; @@ -1639,7 +1807,7 @@ bool8 sub_80B73D0(struct Task *task, struct EventObject *eventObject) return FALSE; } -bool8 waterfall_1_do_anim_probably(struct Task *task, struct EventObject *eventObject) +static bool8 waterfall_1_do_anim_probably(struct Task *task, struct EventObject *eventObject) { ScriptContext2_Enable(); if (!EventObjectIsMovementOverridden(eventObject)) @@ -1652,7 +1820,7 @@ bool8 waterfall_1_do_anim_probably(struct Task *task, struct EventObject *eventO return FALSE; } -bool8 waterfall_2_wait_anim_finish_probably(struct Task *task, struct EventObject *eventObject) +static bool8 waterfall_2_wait_anim_finish_probably(struct Task *task, struct EventObject *eventObject) { if (FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { @@ -1662,14 +1830,14 @@ bool8 waterfall_2_wait_anim_finish_probably(struct Task *task, struct EventObjec return TRUE; } -bool8 sub_80B7450(struct Task *task, struct EventObject *eventObject) +static bool8 sub_80B7450(struct Task *task, struct EventObject *eventObject) { EventObjectSetHeldMovement(eventObject, GetWalkSlowMovementAction(DIR_NORTH)); task->data[0]++; return FALSE; } -bool8 sub_80B7478(struct Task *task, struct EventObject *eventObject) +static bool8 sub_80B7478(struct Task *task, struct EventObject *eventObject) { if (!EventObjectClearHeldMovementIfFinished(eventObject)) { @@ -1687,9 +1855,6 @@ bool8 sub_80B7478(struct Task *task, struct EventObject *eventObject) return FALSE; } -static void Task_Dive(u8); -extern int dive_warp(struct MapPosition *, u16); - bool8 FldEff_UseDive(void) { u8 taskId; @@ -1705,14 +1870,14 @@ void Task_Dive(u8 taskId) while (gUnknown_0855C42C[gTasks[taskId].data[0]](&gTasks[taskId])); } -bool8 dive_1_lock(struct Task *task) +static bool8 dive_1_lock(struct Task *task) { gPlayerAvatar.preventStep = TRUE; task->data[0]++; return FALSE; } -bool8 dive_2_unknown(struct Task *task) +static bool8 dive_2_unknown(struct Task *task) { ScriptContext2_Enable(); gFieldEffectArguments[0] = task->data[15]; @@ -1721,7 +1886,7 @@ bool8 dive_2_unknown(struct Task *task) return FALSE; } -bool8 dive_3_unknown(struct Task *task) +static bool8 dive_3_unknown(struct Task *task) { struct MapPosition mapPosition; PlayerGetDestCoords(&mapPosition.x, &mapPosition.y); @@ -1734,20 +1899,17 @@ bool8 dive_3_unknown(struct Task *task) return FALSE; } -void sub_80B75F0(u8); -void mapldr_080851BC(void); - void sub_80B75D8(u8 priority) { CreateTask(sub_80B75F0, priority); } -void sub_80B75F0(u8 taskId) +static void sub_80B75F0(u8 taskId) { while (gUnknown_0855C438[gTasks[taskId].data[0]](&gTasks[taskId], &gEventObjects[gPlayerAvatar.eventObjectId], &gSprites[gPlayerAvatar.spriteId])); } -bool8 sub_80B764C(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B764C(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { FreezeEventObjects(); CameraObjectReset2(); @@ -1759,7 +1921,7 @@ bool8 sub_80B764C(struct Task *task, struct EventObject *eventObject, struct Spr return TRUE; } -bool8 sub_80B7684(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7684(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { SetCameraPanning(0, task->data[1]); task->data[1] = -task->data[1]; @@ -1772,7 +1934,7 @@ bool8 sub_80B7684(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B76B8(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B76B8(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { sprite->pos2.y = 0; task->data[3] = 1; @@ -1786,7 +1948,7 @@ bool8 sub_80B76B8(struct Task *task, struct EventObject *eventObject, struct Spr return TRUE; } -bool8 sub_80B7704(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7704(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { s16 centerToCornerVecY; SetCameraPanning(0, task->data[1]); @@ -1829,7 +1991,7 @@ bool8 sub_80B7704(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B77F8(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B77F8(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { music_something(); sub_80AF0B4(); @@ -1837,7 +1999,7 @@ bool8 sub_80B77F8(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B7814(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7814(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -1849,9 +2011,7 @@ bool8 sub_80B7814(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -void sub_80B7890(u8); - -void mapldr_080851BC(void) +static void mapldr_080851BC(void) { Overworld_PlaySpecialMapMusic(); pal_fill_for_maplights(); @@ -1860,12 +2020,12 @@ void mapldr_080851BC(void) CreateTask(sub_80B7890, 0); } -void sub_80B7890(u8 taskId) +static void sub_80B7890(u8 taskId) { while (gUnknown_0855C450[gTasks[taskId].data[0]](&gTasks[taskId], &gEventObjects[gPlayerAvatar.eventObjectId], &gSprites[gPlayerAvatar.spriteId])); } -bool8 sub_80B78EC(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B78EC(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { CameraObjectReset2(); FreezeEventObjects(); @@ -1875,7 +2035,7 @@ bool8 sub_80B78EC(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B791C(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B791C(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { if (IsWeatherNotFadingIn()) { @@ -1889,7 +2049,7 @@ bool8 sub_80B791C(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B7968(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7968(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { sprite = &gSprites[task->data[1]]; if (sprite->animCmdIndex > 1) @@ -1903,7 +2063,7 @@ bool8 sub_80B7968(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B79BC(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B79BC(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { if (EventObjectClearHeldMovementIfFinished(eventObject)) { @@ -1915,8 +2075,6 @@ bool8 sub_80B79BC(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[36]; - u8 FldEff_LavaridgeGymWarp(void) { u8 spriteId; @@ -1935,19 +2093,17 @@ void sub_80B7A58(struct Sprite *sprite) } } -void sub_80B7A8C(u8); - void sub_80B7A74(u8 priority) { CreateTask(sub_80B7A8C, priority); } -void sub_80B7A8C(u8 taskId) +static void sub_80B7A8C(u8 taskId) { while(gUnknown_0855C460[gTasks[taskId].data[0]](&gTasks[taskId], &gEventObjects[gPlayerAvatar.eventObjectId], &gSprites[gPlayerAvatar.spriteId])); } -bool8 sub_80B7AE8(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7AE8(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { FreezeEventObjects(); CameraObjectReset2(); @@ -1957,7 +2113,7 @@ bool8 sub_80B7AE8(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B7B18(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7B18(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { if (EventObjectClearHeldMovementIfFinished(eventObject)) { @@ -1979,7 +2135,7 @@ bool8 sub_80B7B18(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B7B94(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7B94(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { if (gSprites[task->data[1]].animCmdIndex == 2) { @@ -1989,7 +2145,7 @@ bool8 sub_80B7B94(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -bool8 sub_80B7BCC(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7BCC(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { if (!FieldEffectActiveListContains(FLDEFF_POP_OUT_OF_ASH)) { @@ -2000,10 +2156,7 @@ bool8 sub_80B7BCC(struct Task *task, struct EventObject *eventObject, struct Spr return FALSE; } -static void DoEscapeRopeFieldEffect(u8); -void mapldr_080859D4(void); - -bool8 sub_80B7BF4(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) +static bool8 sub_80B7BF4(struct Task *task, struct EventObject *eventObject, struct Sprite *sprite) { if (!gPaletteFade.active && BGMusicStopped() == TRUE) { @@ -2089,9 +2242,7 @@ void (*const gUnknown_0855C484[])(struct Task *) = { sub_80B7EE8 }; -void sub_80B7E94(u8); - -void mapldr_080859D4(void) +static void mapldr_080859D4(void) { Overworld_PlaySpecialMapMusic(); pal_fill_for_maplights(); @@ -2102,12 +2253,12 @@ void mapldr_080859D4(void) CreateTask(sub_80B7E94, 0); } -void sub_80B7E94(u8 taskId) +static void sub_80B7E94(u8 taskId) { gUnknown_0855C484[gTasks[taskId].data[0]](&gTasks[taskId]); } -void sub_80B7EC4(struct Task *task) +static void sub_80B7EC4(struct Task *task) { if (IsWeatherNotFadingIn()) { @@ -2116,7 +2267,7 @@ void sub_80B7EC4(struct Task *task) } } -void sub_80B7EE8(struct Task *task) +static void sub_80B7EE8(struct Task *task) { u8 spinDirections[5] = {1, 3, 4, 2, 1}; struct EventObject *eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -2144,13 +2295,6 @@ void sub_80B7EE8(struct Task *task) eventObject->invisible ^= 1; } -static void ExecuteTeleportFieldEffectTask(u8); -static void TeleportFieldEffectTask1(struct Task*); -static void TeleportFieldEffectTask2(struct Task*); -static void TeleportFieldEffectTask3(struct Task*); -static void TeleportFieldEffectTask4(struct Task*); -static void mapldr_08085D88(void); - void CreateTeleportFieldEffectTask(void) { CreateTask(ExecuteTeleportFieldEffectTask, 0); @@ -2246,8 +2390,6 @@ static void TeleportFieldEffectTask4(struct Task *task) } } -void sub_80B8250(u8); - static void mapldr_08085D88(void) { Overworld_PlaySpecialMapMusic(); @@ -2266,12 +2408,12 @@ void (*const gUnknown_0855C49C[])(struct Task *) = { sub_80B8410 }; -void sub_80B8250(u8 taskId) +static void sub_80B8250(u8 taskId) { gUnknown_0855C49C[gTasks[taskId].data[0]](&gTasks[taskId]); } -void sub_80B8280(struct Task *task) +static void sub_80B8280(struct Task *task) { struct Sprite *sprite; s16 centerToCornerVecY; @@ -2290,7 +2432,7 @@ void sub_80B8280(struct Task *task) } } -void sub_80B830C(struct Task *task) +static void sub_80B830C(struct Task *task) { u8 spinDirections[5] = {1, 3, 4, 2, 1}; struct EventObject *eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -2329,7 +2471,7 @@ void sub_80B830C(struct Task *task) } } -void sub_80B8410(struct Task *task) +static void sub_80B8410(struct Task *task) { u8 spinDirections[5] = {1, 3, 4, 2, 1}; struct EventObject *eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -2347,13 +2489,6 @@ void sub_80B8410(struct Task *task) } } -void sub_80B8554(u8); -void sub_80B88B4(u8); -u8 sub_80B8C60(u32, u32, u32); -void sub_80B880C(void); -void sub_80B8874(u16); -void sub_80B8CC0(struct Sprite *); - bool8 FldEff_FieldMoveShowMon(void) { u8 taskId; @@ -2392,12 +2527,12 @@ void (*const gUnknown_0855C4A8[])(struct Task *) = { overworld_bg_setup_2, }; -void sub_80B8554(u8 taskId) +static void sub_80B8554(u8 taskId) { gUnknown_0855C4A8[gTasks[taskId].data[0]](&gTasks[taskId]); } -void sub_80B8584(struct Task *task) +static void sub_80B8584(struct Task *task) { task->data[11] = REG_WININ; task->data[12] = REG_WINOUT; @@ -2414,7 +2549,7 @@ void sub_80B8584(struct Task *task) task->data[0]++; } -void sub_80B85F8(struct Task *task) +static void sub_80B85F8(struct Task *task) { u16 offset; u16 delta; @@ -2427,7 +2562,7 @@ void sub_80B85F8(struct Task *task) task->data[0]++; } -void sub_80B8660(struct Task *task) +static void sub_80B8660(struct Task *task) { s16 v0; s16 v2; @@ -2460,7 +2595,7 @@ void sub_80B8660(struct Task *task) } } -void sub_80B86EC(struct Task *task) +static void sub_80B86EC(struct Task *task) { task->data[5] -= 16; if (gSprites[task->data[15]].data[7]) @@ -2469,7 +2604,7 @@ void sub_80B86EC(struct Task *task) } } -void sub_80B871C(struct Task *task) +static void sub_80B871C(struct Task *task) { s16 v2; s16 v3; @@ -2493,7 +2628,7 @@ void sub_80B871C(struct Task *task) } } -void sub_80B8770(struct Task *task) +static void sub_80B8770(struct Task *task) { u16 bg0cnt; bg0cnt = (REG_BG0CNT >> 8) << 11; @@ -2505,7 +2640,7 @@ void sub_80B8770(struct Task *task) task->data[0]++; } -void overworld_bg_setup_2(struct Task *task) +static void overworld_bg_setup_2(struct Task *task) { IntrCallback callback; LoadWordFromTwoHalfwords((u16 *)&task->data[13], (u32 *)&callback); @@ -2516,7 +2651,7 @@ void overworld_bg_setup_2(struct Task *task) DestroyTask(FindTaskIdByFunc(sub_80B8554)); } -void sub_80B880C(void) +static void sub_80B880C(void) { struct Task *task; IntrCallback callback; @@ -2531,7 +2666,7 @@ void sub_80B880C(void) SetGpuReg(REG_OFFSET_BG0VOFS, task->data[6]); } -void sub_80B8874(u16 offs) +static void sub_80B8874(u16 offs) { u16 i; u16 *dest; @@ -2542,11 +2677,6 @@ void sub_80B8874(u16 offs) } } -void sub_80B8AE0(void); -bool8 sub_80B8B38(struct Task *); -void sub_80B8B28(struct Task *); -bool8 sub_80B8BF0(struct Task *); - void (*const gUnknown_0855C4C4[])(struct Task *) = { sub_80B88E4, sub_80B8920, @@ -2557,12 +2687,12 @@ void (*const gUnknown_0855C4C4[])(struct Task *) = { sub_80B8A64, }; -void sub_80B88B4(u8 taskId) +static void sub_80B88B4(u8 taskId) { gUnknown_0855C4C4[gTasks[taskId].data[0]](&gTasks[taskId]); } -void sub_80B88E4(struct Task *task) +static void sub_80B88E4(struct Task *task) { SetGpuReg(REG_OFFSET_BG0HOFS, task->data[1]); SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]); @@ -2571,7 +2701,7 @@ void sub_80B88E4(struct Task *task) task->data[0]++; } -void sub_80B8920(struct Task *task) +static void sub_80B8920(struct Task *task) { u16 offset; u16 delta; @@ -2584,7 +2714,7 @@ void sub_80B8920(struct Task *task) task->data[0]++; } -void sub_80B898C(struct Task *task) +static void sub_80B898C(struct Task *task) { if (sub_80B8B38(task)) { @@ -2596,7 +2726,7 @@ void sub_80B898C(struct Task *task) sub_80B8B28(task); } -void sub_80B89DC(struct Task *task) +static void sub_80B89DC(struct Task *task) { sub_80B8B28(task); if (gSprites[task->data[15]].data[7]) @@ -2605,7 +2735,7 @@ void sub_80B89DC(struct Task *task) } } -void sub_80B8A0C(struct Task *task) +static void sub_80B8A0C(struct Task *task) { sub_80B8B28(task); task->data[3] = task->data[1] & 7; @@ -2615,7 +2745,7 @@ void sub_80B8A0C(struct Task *task) task->data[0]++; } -void sub_80B8A44(struct Task *task) +static void sub_80B8A44(struct Task *task) { sub_80B8B28(task); if (sub_80B8BF0(task)) @@ -2624,7 +2754,7 @@ void sub_80B8A44(struct Task *task) } } -void sub_80B8A64(struct Task *task) +static void sub_80B8A64(struct Task *task) { IntrCallback intrCallback; u16 bg0cnt; @@ -2638,7 +2768,7 @@ void sub_80B8A64(struct Task *task) DestroyTask(FindTaskIdByFunc(sub_80B88B4)); } -void sub_80B8AE0(void) +static void sub_80B8AE0(void) { IntrCallback intrCallback; struct Task *task; @@ -2649,14 +2779,14 @@ void sub_80B8AE0(void) SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]); } -void sub_80B8B28(struct Task *task) +static void sub_80B8B28(struct Task *task) { task->data[1] -= 16; task->data[3] += 16; } #ifdef NONMATCHING -bool8 sub_80B8B38(struct Task *task) +static bool8 sub_80B8B38(struct Task *task) { u16 i; u16 srcOffs; @@ -2683,7 +2813,7 @@ bool8 sub_80B8B38(struct Task *task) } #else NAKED -bool8 sub_80B8B38(struct Task *task) +static bool8 sub_80B8B38(struct Task *task) { asm_unified("\tpush {r4-r7,lr}\n" "\tmov r7, r10\n" @@ -2783,7 +2913,7 @@ bool8 sub_80B8B38(struct Task *task) } #endif -bool8 sub_80B8BF0(struct Task *task) +static bool8 sub_80B8BF0(struct Task *task) { u16 i; u16 dstOffs; @@ -2807,7 +2937,7 @@ bool8 sub_80B8BF0(struct Task *task) return FALSE; } -u8 sub_80B8C60(u32 a0, u32 a1, u32 a2) +static u8 sub_80B8C60(u32 a0, u32 a1, u32 a2) { u16 v0; u8 monSprite; @@ -2823,9 +2953,7 @@ u8 sub_80B8C60(u32 a0, u32 a1, u32 a2) return monSprite; } -void sub_80B8D04(struct Sprite *); - -void sub_80B8CC0(struct Sprite *sprite) +static void sub_80B8CC0(struct Sprite *sprite) { if ((sprite->pos1.x -= 20) <= 0x78) { @@ -2842,9 +2970,7 @@ void sub_80B8CC0(struct Sprite *sprite) } } -void sub_80B8D20(struct Sprite *); - -void sub_80B8D04(struct Sprite *sprite) +static void sub_80B8D04(struct Sprite *sprite) { if ((--sprite->data[1]) == 0) { @@ -2852,7 +2978,7 @@ void sub_80B8D04(struct Sprite *sprite) } } -void sub_80B8D20(struct Sprite *sprite) +static void sub_80B8D20(struct Sprite *sprite) { if (sprite->pos1.x < -0x40) { @@ -2863,8 +2989,6 @@ void sub_80B8D20(struct Sprite *sprite) } } -void sub_80B8D84(u8); - u8 FldEff_UseSurf(void) { u8 taskId; @@ -2883,12 +3007,12 @@ void (*const gUnknown_0855C4E0[])(struct Task *) = { sub_80B8F24, }; -void sub_80B8D84(u8 taskId) +static void sub_80B8D84(u8 taskId) { gUnknown_0855C4E0[gTasks[taskId].data[0]](&gTasks[taskId]); } -void sub_80B8DB4(struct Task *task) +static void sub_80B8DB4(struct Task *task) { ScriptContext2_Enable(); FreezeEventObjects(); @@ -2899,7 +3023,7 @@ void sub_80B8DB4(struct Task *task) task->data[0]++; } -void sub_80B8E14(struct Task *task) +static void sub_80B8E14(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -2911,7 +3035,7 @@ void sub_80B8E14(struct Task *task) } } -void sub_80B8E60(struct Task *task) +static void sub_80B8E60(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -2923,7 +3047,7 @@ void sub_80B8E60(struct Task *task) } } -void sub_80B8EA8(struct Task *task) +static void sub_80B8EA8(struct Task *task) { struct EventObject *eventObject; if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) @@ -2940,7 +3064,7 @@ void sub_80B8EA8(struct Task *task) } } -void sub_80B8F24(struct Task *task) +static void sub_80B8F24(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -3130,8 +3254,6 @@ _080B9050:\n\ } #endif // NONMATCHING -void sub_80B9128(struct Sprite *); - u8 FldEff_NPCFlyOut(void) { u8 spriteId; @@ -3146,7 +3268,7 @@ u8 FldEff_NPCFlyOut(void) return spriteId; } -void sub_80B9128(struct Sprite *sprite) +static void sub_80B9128(struct Sprite *sprite) { struct Sprite *npcSprite; sprite->pos2.x = Cos(sprite->data[2], 0x8c); @@ -3167,15 +3289,6 @@ void sub_80B9128(struct Sprite *sprite) } } -void sub_80B91D4(u8); -extern void sub_81555D8(u8, u8); -u8 sub_80B94C4(void); -bool8 sub_80B9508(u8); -void sub_80B9524(u8); -void sub_80B9560(u8, u8); -void sub_80B957C(struct Sprite *); -void sub_80B963C(struct Sprite *); - u8 FldEff_UseFly(void) { u8 taskId; @@ -3196,12 +3309,12 @@ void (*const gUnknown_0855C4F4[])(struct Task *) = { sub_80B9494, }; -void sub_80B91D4(u8 taskId) +static void sub_80B91D4(u8 taskId) { gUnknown_0855C4F4[gTasks[taskId].data[0]](&gTasks[taskId]); } -void sub_80B9204(struct Task *task) +static void sub_80B9204(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -3216,7 +3329,7 @@ void sub_80B9204(struct Task *task) } } -void sub_80B925C(struct Task *task) +static void sub_80B925C(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -3228,7 +3341,7 @@ void sub_80B925C(struct Task *task) } } -void sub_80B92A0(struct Task *task) +static void sub_80B92A0(struct Task *task) { struct EventObject *eventObject; if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) @@ -3244,7 +3357,7 @@ void sub_80B92A0(struct Task *task) } } -void sub_80B92F8(struct Task *task) +static void sub_80B92F8(struct Task *task) { if (sub_80B9508(task->data[1])) { @@ -3255,7 +3368,7 @@ void sub_80B92F8(struct Task *task) } } -void sub_80B933C(struct Task *task) +static void sub_80B933C(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -3267,7 +3380,7 @@ void sub_80B933C(struct Task *task) } } -void sub_80B9390(struct Task *task) +static void sub_80B9390(struct Task *task) { struct EventObject *eventObject; if ((++task->data[2]) >= 8) @@ -3286,7 +3399,7 @@ void sub_80B9390(struct Task *task) } } -void sub_80B9418(struct Task *task) +static void sub_80B9418(struct Task *task) { struct EventObject *eventObject; if ((++task->data[2]) >= 10) @@ -3301,7 +3414,7 @@ void sub_80B9418(struct Task *task) } } -void sub_80B9474(struct Task *task) +static void sub_80B9474(struct Task *task) { if (sub_80B9508(task->data[1])) { @@ -3310,7 +3423,7 @@ void sub_80B9474(struct Task *task) } } -void sub_80B9494(struct Task *task) +static void sub_80B9494(struct Task *task) { if (!gPaletteFade.active) { @@ -3319,7 +3432,7 @@ void sub_80B9494(struct Task *task) } } -u8 sub_80B94C4(void) +static u8 sub_80B94C4(void) { u8 spriteId; struct Sprite *sprite; @@ -3331,12 +3444,12 @@ u8 sub_80B94C4(void) return spriteId; } -u8 sub_80B9508(u8 spriteId) +static u8 sub_80B9508(u8 spriteId) { return gSprites[spriteId].data[7]; } -void sub_80B9524(u8 spriteId) +static void sub_80B9524(u8 spriteId) { struct Sprite *sprite; sprite = &gSprites[spriteId]; @@ -3349,7 +3462,7 @@ void sub_80B9524(u8 spriteId) sprite->data[6] = 0x40; } -void sub_80B9560(u8 a0, u8 a1) +static void sub_80B9560(u8 a0, u8 a1) { gSprites[a0].data[6] = a1; } @@ -3371,7 +3484,7 @@ const union AffineAnimCmd *const gSpriteAffineAnimTable_0855C548[] = { SpriteAffineAnim_855C530 }; -void sub_80B957C(struct Sprite *sprite) +static void sub_80B957C(struct Sprite *sprite) { if (sprite->data[7] == 0) { @@ -3404,7 +3517,7 @@ void sub_80B957C(struct Sprite *sprite) } } -void sub_80B963C(struct Sprite *sprite) +static void sub_80B963C(struct Sprite *sprite) { struct Sprite *sprite1; sprite->pos2.x = Cos(sprite->data[2], 0x8c); @@ -3475,8 +3588,6 @@ void sub_80B9794(u8 spriteId) gSprites[spriteId].callback = sub_80B96B0; } -void sub_80B97D4(u8); - u8 FldEff_FlyIn(void) { CreateTask(sub_80B97D4, 0xfe); @@ -3493,12 +3604,12 @@ void (*const gUnknown_0855C550[])(struct Task *) = { sub_80B9A60, }; -void sub_80B97D4(u8 taskId) +static void sub_80B97D4(u8 taskId) { gUnknown_0855C550[gTasks[taskId].data[0]](&gTasks[taskId]); } -void sub_80B9804(struct Task *task) +static void sub_80B9804(struct Task *task) { struct EventObject *eventObject; eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -3524,7 +3635,7 @@ void sub_80B9804(struct Task *task) } } -void sub_80B98B8(struct Task *task) +static void sub_80B98B8(struct Task *task) { struct EventObject *eventObject; struct Sprite *sprite; @@ -3542,7 +3653,7 @@ void sub_80B98B8(struct Task *task) } } -void sub_80B9924(struct Task *task) +static void sub_80B9924(struct Task *task) { s16 unknown_0855C56C[18] = { -2, @@ -3572,7 +3683,7 @@ void sub_80B9924(struct Task *task) } } -void sub_80B9978(struct Task *task) +static void sub_80B9978(struct Task *task) { struct EventObject *eventObject; struct Sprite *sprite; @@ -3591,7 +3702,7 @@ void sub_80B9978(struct Task *task) } } -void sub_80B99F0(struct Task *task) +static void sub_80B99F0(struct Task *task) { if (EventObjectClearHeldMovementIfFinished(&gEventObjects[gPlayerAvatar.eventObjectId])) { @@ -3600,7 +3711,7 @@ void sub_80B99F0(struct Task *task) } } -void sub_80B9A28(struct Task *task) +static void sub_80B9A28(struct Task *task) { if (sub_80B9508(task->data[1])) { @@ -3610,7 +3721,7 @@ void sub_80B9A28(struct Task *task) } } -void sub_80B9A60(struct Task *task) +static void sub_80B9A60(struct Task *task) { u8 state; struct EventObject *eventObject; @@ -3632,8 +3743,6 @@ void sub_80B9A60(struct Task *task) } } -void sub_80B9BE8(u8 taskId); - bool8 sub_80B9ADC(void) { u8 taskId; @@ -3698,7 +3807,7 @@ void (*const gUnknown_0855C590[])(s16*, u8) = { sub_80B9CDC, }; -void sub_80B9BE8(u8 taskId) +static void sub_80B9BE8(u8 taskId) { s16 *data = gTasks[taskId].data; InstallCameraPanAheadCallback(); @@ -3743,8 +3852,6 @@ void sub_80B9CDC(s16* a0, u8 taskId) } } -void sub_80B9DB8(struct Sprite* sprite); - const struct SpriteFrameImage gSpriteImageTable_855C59C[] = { obj_frame_tiles(gUnknown_0855C170), obj_frame_tiles(gUnknown_0855C190), @@ -3807,7 +3914,7 @@ void sub_80B9D24(struct Sprite* sprite) } } -void sub_80B9DB8(struct Sprite* sprite) +static void sub_80B9DB8(struct Sprite* sprite) { switch (sprite->data[0]) { @@ -3832,8 +3939,6 @@ void sub_80B9DB8(struct Sprite* sprite) DestroySprite(sprite); } -void sub_80B9EDC(u8 taskId); - bool8 sub_80B9E28(struct Sprite* sprite) { u8 eventObjectIdBuffer; @@ -3858,7 +3963,7 @@ bool8 sub_80B9E28(struct Sprite* sprite) return FALSE; } -void sub_80B9EDC(u8 taskId) +static void sub_80B9EDC(u8 taskId) { // BUG: Possible divide by zero s16 *data = gTasks[taskId].data; diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 6f4aaabed..856f7d5ef 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -10,6 +10,7 @@ #include "sound.h" #include "sprite.h" #include "trig.h" +#include "constants/field_effects.h" #include "constants/songs.h" #define EVENT_OBJ_PAL_TAG_NONE 0x11FF // duplicate of define in event_object_movement.c diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index df714d7db..f0a8da7d7 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -4,11 +4,10 @@ #include "event_data.h" #include "event_object_movement.h" #include "field_camera.h" -#include "field_player_avatar.h" #include "field_effect.h" #include "field_effect_helpers.h" +#include "field_player_avatar.h" #include "fieldmap.h" -#include "global.fieldmap.h" #include "menu.h" #include "metatile_behavior.h" #include "overworld.h" @@ -25,6 +24,7 @@ #include "constants/abilities.h" #include "constants/event_objects.h" #include "constants/event_object_movement_constants.h" +#include "constants/field_effects.h" #include "constants/flags.h" #include "constants/maps.h" #include "constants/moves.h" @@ -35,39 +35,15 @@ static EWRAM_DATA u8 gUnknown_0203734C = 0; EWRAM_DATA struct EventObject gEventObjects[EVENT_OBJECTS_COUNT] = {}; EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {}; -static void StartStrengthAnim(u8, u8); -static bool8 ShouldJumpLedge(s16, s16, u8); -static bool8 sub_808B1BC(s16, s16, u8); -static u8 sub_808B164(struct EventObject *, s16, s16, u8, u8); -static u8 sub_808B238(s16, s16, u8); -static void check_acro_bike_metatile(s16, s16, u8, u8 *); -static void PlayerNotOnBikeCollide(u8); -static void PlayCollisionSoundIfNotFacingWarp(u8 a); -static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); -static void PlayerRun(u8); -static void MovePlayerNotOnBike(u8, u16); -static u8 CheckMovementInputNotOnBike(u8); -static void DoPlayerMatSpin(void); -static void DoPlayerMatJump(void); -static u8 CheckForPlayerAvatarCollision(u8); +// static declarations + static u8 EventObjectCB2_NoMovement2(); -static void sub_808C280(struct EventObject *); static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); static void npc_clear_strange_bits(struct EventObject *); -static void DoPlayerAvatarTransition(void); -static bool8 player_is_anim_in_certain_ranges(void); -static bool8 sub_808B618(void); -static bool8 PlayerIsAnimActive(void); -static bool8 PlayerCheckIfAnimFinishedOrInactive(void); -static bool8 TryDoMetatileBehaviorForcedMovement(); static void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); static void PlayerAllowForcedMovementIfMovingSameDirection(); -static u8 sub_808B028(u8); +static bool8 TryDoMetatileBehaviorForcedMovement(); static u8 GetForcedMovementByMetatileBehavior(); -static void PlayerNotOnBikeNotMoving(u8, u16); -static void PlayerNotOnBikeTurningInPlace(u8, u16); -static void PlayerNotOnBikeMoving(u8, u16); -static void sub_808C750(u8); static bool8 ForcedMovement_None(void); static bool8 ForcedMovement_Slip(void); @@ -87,25 +63,63 @@ static bool8 ForcedMovement_0xBB(void); static bool8 ForcedMovement_0xBC(void); static bool8 ForcedMovement_MuddySlope(void); +static void MovePlayerNotOnBike(u8, u16); +static u8 CheckMovementInputNotOnBike(u8); +static void PlayerNotOnBikeNotMoving(u8, u16); +static void PlayerNotOnBikeTurningInPlace(u8, u16); +static void PlayerNotOnBikeMoving(u8, u16); +static u8 CheckForPlayerAvatarCollision(u8); +static u8 sub_808B028(u8); +static u8 sub_808B164(struct EventObject *, s16, s16, u8, u8); +static bool8 sub_808B1BC(s16, s16, u8); +static bool8 ShouldJumpLedge(s16, s16, u8); +static u8 sub_808B238(s16, s16, u8); +static void check_acro_bike_metatile(s16, s16, u8, u8 *); + +static void DoPlayerAvatarTransition(void); +static void PlayerAvatarTransition_Dummy(struct EventObject *a); static void PlayerAvatarTransition_Normal(struct EventObject *a); static void PlayerAvatarTransition_MachBike(struct EventObject *a); static void PlayerAvatarTransition_AcroBike(struct EventObject *a); static void PlayerAvatarTransition_Surfing(struct EventObject *a); static void PlayerAvatarTransition_Underwater(struct EventObject *a); static void PlayerAvatarTransition_ReturnToField(struct EventObject *a); -static void PlayerAvatarTransition_Dummy(struct EventObject *a); +static bool8 player_is_anim_in_certain_ranges(void); +static bool8 sub_808B618(void); +static bool8 PlayerIsAnimActive(void); +static bool8 PlayerCheckIfAnimFinishedOrInactive(void); + +static void PlayerRun(u8); +static void PlayerNotOnBikeCollide(u8); +static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); + +static void PlayCollisionSoundIfNotFacingWarp(u8 a); + +static void sub_808C280(struct EventObject *); + +static void StartStrengthAnim(u8, u8); +static void Task_BumpBoulder(u8 taskId); static u8 sub_808C3A4(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); static u8 do_boulder_dust(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); static u8 sub_808C484(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); +static void DoPlayerMatJump(void); +static void DoPlayerAvatarSecretBaseMatJump(u8 taskId); static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *eventObject); +static void DoPlayerMatSpin(void); +static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId); static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject); static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *eventObject); static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject); static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject); +static void sub_808C750(u8); +static void taskFF_0805D1D4(u8 taskId); +static void sub_808C814(u8 taskId); + +static void Task_Fishing(u8 taskId); static u8 Fishing1(struct Task *task); static u8 Fishing2(struct Task *task); static u8 Fishing3(struct Task *task); @@ -122,6 +136,11 @@ static u8 Fishing13(struct Task *task); static u8 Fishing14(struct Task *task); static u8 Fishing15(struct Task *task); static u8 Fishing16(struct Task *task); +static void AlignFishingAnimationFrames(void); + +static u8 sub_808D38C(struct EventObject *object, s16 *a1); + +// .rodata static bool8 (*const sForcedMovementTestFuncs[])(u8) = { @@ -283,6 +302,7 @@ static bool8 (*const sPlayerAvatarSecretBaseMatSpin[])(struct Task *, struct Eve }; // .text + void MovementType_Player(struct Sprite *sprite) { UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2); @@ -728,18 +748,18 @@ static u8 sub_808B238(s16 x, s16 y, u8 direction) { u8 eventObjectId = GetEventObjectIdByXY(x, y); - if (eventObjectId != 16 && gEventObjects[eventObjectId].graphicsId == 0x57) + if (eventObjectId != 16 && gEventObjects[eventObjectId].graphicsId == EVENT_OBJ_GFX_PUSHABLE_BOULDER) + { + x = gEventObjects[eventObjectId].currentCoords.x; + y = gEventObjects[eventObjectId].currentCoords.y; + MoveCoords(direction, &x, &y); + if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0 + && MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0) { - x = gEventObjects[eventObjectId].currentCoords.x; - y = gEventObjects[eventObjectId].currentCoords.y; - MoveCoords(direction, &x, &y); - if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0 - && MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0) - { - StartStrengthAnim(eventObjectId, direction); - return 1; - } + StartStrengthAnim(eventObjectId, direction); + return 1; } + } } return 0; } @@ -981,7 +1001,7 @@ void PlayerGoSpeed4(u8 a) PlayerSetAnimId(GetWalkFastestMovementAction(a), 2); } -void PlayerRun(u8 a) +static void PlayerRun(u8 a) { PlayerSetAnimId(GetPlayerRunMovementAction(a), 2); } @@ -997,13 +1017,13 @@ void PlayerOnBikeCollideWithFarawayIslandMew(u8 a) PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(a), 2); } -void PlayerNotOnBikeCollide(u8 a) +static void PlayerNotOnBikeCollide(u8 a) { PlayCollisionSoundIfNotFacingWarp(a); PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2); } -void PlayerNotOnBikeCollideWithFarawayIslandMew(u8 a) +static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8 a) { PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2); } @@ -1450,8 +1470,6 @@ static void sub_808C280(struct EventObject *eventObject) /* Strength */ -static void Task_BumpBoulder(u8 taskId); - static void StartStrengthAnim(u8 a, u8 b) { u8 taskId = CreateTask(Task_BumpBoulder, 0xFF); @@ -1523,8 +1541,6 @@ static bool8 sub_808C484(struct Task *task, struct EventObject *playerObject, st /* Some field effect */ -static void DoPlayerAvatarSecretBaseMatJump(u8 taskId); - static void DoPlayerMatJump(void) { DoPlayerAvatarSecretBaseMatJump(CreateTask(DoPlayerAvatarSecretBaseMatJump, 0xFF)); @@ -1557,8 +1573,6 @@ static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject /* Some field effect */ -static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId); - static void DoPlayerMatSpin(void) { u8 taskId = CreateTask(PlayerAvatar_DoSecretBaseMatSpin, 0xFF); @@ -1632,9 +1646,6 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct Event /* Some Field effect */ -static void taskFF_0805D1D4(u8 taskId); -static void sub_808C814(u8 taskId); - static void sub_808C750(u8 a) { u8 taskId; @@ -1699,9 +1710,6 @@ static bool8 (*const sFishingStateFuncs[])(struct Task *) = Fishing16, }; -static void Task_Fishing(u8 taskId); -static void AlignFishingAnimationFrames(void); - #define tStep data[0] #define tFrameCounter data[1] #define tNumDots data[2] @@ -2082,8 +2090,6 @@ static u8 sub_808D080(void) return gUnknown_0203734C; } -static u8 sub_808D38C(struct EventObject *object, s16 *a1); - static void sub_808D094(u8 taskId) { struct EventObject *object = &gEventObjects[gPlayerAvatar.eventObjectId]; diff --git a/src/field_specials.c b/src/field_specials.c index 1834f3523..113f46922 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1,5 +1,4 @@ #include "global.h" -#include "main.h" #include "battle.h" #include "battle_tower.h" #include "cable_club.h" @@ -13,7 +12,6 @@ #include "field_effect.h" #include "field_message_box.h" #include "field_player_avatar.h" -#include "field_region_map.h" #include "field_screen.h" #include "field_specials.h" #include "field_weather.h" @@ -21,6 +19,7 @@ #include "item_icon.h" #include "link.h" #include "list_menu.h" +#include "main.h" #include "malloc.h" #include "match_call.h" #include "menu.h" @@ -46,6 +45,7 @@ #include "wallclock.h" #include "window.h" #include "constants/event_objects.h" +#include "constants/field_effects.h" #include "constants/items.h" #include "constants/maps.h" #include "constants/songs.h" @@ -80,6 +80,7 @@ extern const u16 gEventObjectPalette34[]; extern void LoadPalette(const void *src, u32 offset, u16 size); // incorrect signature, needed to match extern void BlendPalettes(u32, u8, u16); +extern void FieldInitRegionMap(MainCallback callback); void UpdateMovedLilycoveFanClubMembers(void); void sub_813BF60(void); diff --git a/src/fldeff_cut.c b/src/fldeff_cut.c index 5a9181789..230a95e0b 100644 --- a/src/fldeff_cut.c +++ b/src/fldeff_cut.c @@ -18,6 +18,7 @@ #include "trig.h" #include "constants/abilities.h" #include "constants/event_objects.h" +#include "constants/field_effects.h" #include "constants/songs.h" extern void ScriptUnfreezeEventObjects(void); diff --git a/src/fldeff_strength.c b/src/fldeff_strength.c index 74eb100bc..c9b91f97f 100644 --- a/src/fldeff_strength.c +++ b/src/fldeff_strength.c @@ -7,6 +7,7 @@ #include "script.h" #include "task.h" #include "constants/event_objects.h" +#include "constants/field_effects.h" // static functions static void FldEff_UseStrength(void); diff --git a/src/fldeff_sweetscent.c b/src/fldeff_sweetscent.c index ca95af382..9951fe581 100644 --- a/src/fldeff_sweetscent.c +++ b/src/fldeff_sweetscent.c @@ -12,6 +12,7 @@ #include "sprite.h" #include "task.h" #include "wild_encounter.h" +#include "constants/field_effects.h" #include "constants/rgb.h" #include "constants/songs.h" diff --git a/src/fldeff_teleport.c b/src/fldeff_teleport.c index ebf9aa38a..8562908bd 100644 --- a/src/fldeff_teleport.c +++ b/src/fldeff_teleport.c @@ -5,6 +5,7 @@ #include "overworld.h" #include "rom6.h" #include "task.h" +#include "constants/field_effects.h" static void FieldCallback_Teleport(void); static void StartTeleportFieldEffect(void); diff --git a/src/rom6.c b/src/rom6.c index 712ac76e0..8043730d2 100644 --- a/src/rom6.c +++ b/src/rom6.c @@ -15,6 +15,7 @@ #include "task.h" #include "constants/event_object_movement_constants.h" #include "constants/event_objects.h" +#include "constants/field_effects.h" #include "constants/map_types.h" #include "constants/songs.h" diff --git a/src/trainer_see.c b/src/trainer_see.c index f5e9c300e..726d89847 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -1,17 +1,18 @@ #include "global.h" -#include "trainer_see.h" #include "battle_setup.h" -#include "pokemon.h" -#include "sprite.h" -#include "field_effect.h" -#include "event_object_movement.h" -#include "field_player_avatar.h" -#include "pokenav.h" -#include "task.h" -#include "util.h" -#include "script.h" #include "event_data.h" +#include "event_object_movement.h" +#include "field_effect.h" +#include "field_player_avatar.h" +#include "pokemon.h" +#include "pokenav.h" +#include "script.h" #include "script_movement.h" +#include "sprite.h" +#include "task.h" +#include "trainer_see.h" +#include "util.h" +#include "constants/field_effects.h" extern bool8 InBattlePyramid(void); extern bool32 InTrainerHill(void);