Move field effects enum to defines

This commit is contained in:
Slawter666 2018-11-13 14:19:04 +00:00
parent f639c7c309
commit 1d46507110
18 changed files with 548 additions and 553 deletions

View File

@ -1,13 +1,14 @@
#include "constants/battle_frontier.h"
#include "constants/flags.h" #include "constants/flags.h"
#include "constants/field_effects.h"
#include "constants/items.h" #include "constants/items.h"
#include "constants/heal_locations.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/moves.h" #include "constants/moves.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/species.h" #include "constants/species.h"
#include "constants/vars.h"
#include "constants/heal_locations.h"
#include "constants/trainers.h" #include "constants/trainers.h"
#include "constants/battle_frontier.h" #include "constants/vars.h"
.include "asm/macros.inc" .include "asm/macros.inc"
.include "asm/macros/event.inc" .include "asm/macros/event.inc"
.include "constants/constants.inc" .include "constants/constants.inc"
@ -434,13 +435,13 @@ gStdScripts_End:: @ 81DC2CC
EventScript_SecretBasePC:: @ 823B4BB EventScript_SecretBasePC:: @ 823B4BB
lockall lockall
playse 2 playse SE_PC_LOGIN
message Text_276805 message Text_276805
dofieldeffect 61 dofieldeffect FLDEFF_PCTURN_ON
waitstate waitstate
waitmessage waitmessage
waitbuttonpress waitbuttonpress
playse 5 playse SE_SELECT
goto EventScript_23B4D3 goto EventScript_23B4D3
end end
@ -496,12 +497,12 @@ EventScript_23B585:: @ 823B585
EventScript_RecordMixingSecretBasePC:: @ 823B589 EventScript_RecordMixingSecretBasePC:: @ 823B589
lockall lockall
message Text_276805 message Text_276805
playse 2 playse SE_PC_LOGIN
dofieldeffect 61 dofieldeffect FLDEFF_PCTURN_ON
waitstate waitstate
waitmessage waitmessage
waitbuttonpress waitbuttonpress
playse 5 playse SE_SELECT
goto EventScript_23B5A1 goto EventScript_23B5A1
end end
@ -584,7 +585,7 @@ EventScript_23B680:: @ 823B680
EventScript_SecretBaseSandOrnament:: @ 823B684 EventScript_SecretBaseSandOrnament:: @ 823B684
special sub_80EBE7C special sub_80EBE7C
dofieldeffect 52 dofieldeffect FLDEFF_SAND_PILLAR
waitstate waitstate
end end
@ -1435,8 +1436,8 @@ OldaleTown_PokemonCenter_1F_EventScript_27198D:: @ 827198D
OldaleTown_PokemonCenter_1F_EventScript_271993:: @ 8271993 OldaleTown_PokemonCenter_1F_EventScript_271993:: @ 8271993
applymovement VAR_0x800B, OldaleTown_PokemonCenter_1F_Movement_2725A4 applymovement VAR_0x800B, OldaleTown_PokemonCenter_1F_Movement_2725A4
waitmovement 0 waitmovement 0
dofieldeffect 25 dofieldeffect FLDEFF_POKECENTER_HEAL
waitfieldeffect 25 waitfieldeffect FLDEFF_POKECENTER_HEAL
applymovement VAR_0x800B, OldaleTown_PokemonCenter_1F_Movement_2725AA applymovement VAR_0x800B, OldaleTown_PokemonCenter_1F_Movement_2725AA
waitmovement 0 waitmovement 0
special HealPlayerParty special HealPlayerParty
@ -1914,7 +1915,7 @@ EventScript_UseSurf:: @ 8271EA0
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_eq EventScript_271ED5 goto_eq EventScript_271ED5
msgbox gUnknown_0827300D, 4 msgbox gUnknown_0827300D, 4
dofieldeffect 9 dofieldeffect FLDEFF_USE_SURF
EventScript_271ED5:: @ 8271ED5 EventScript_271ED5:: @ 8271ED5
releaseall releaseall
@ -4447,14 +4448,14 @@ EventScript_275A50:: @ 8275A50
goto_eq EventScript_275CDE goto_eq EventScript_275CDE
msgbox Route103_Text_290771, 4 msgbox Route103_Text_290771, 4
closemessage closemessage
dofieldeffect 11 dofieldeffect FLDEFF_USE_SECRET_POWER_CAVE
waitstate waitstate
goto EventScript_275A9B goto EventScript_275A9B
end end
EventScript_275A86:: @ 8275A86 EventScript_275A86:: @ 8275A86
lockall lockall
dofieldeffect 11 dofieldeffect FLDEFF_USE_SECRET_POWER_CAVE
waitstate waitstate
goto EventScript_275A9B goto EventScript_275A9B
end end
@ -4479,14 +4480,14 @@ EventScript_275AA9:: @ 8275AA9
goto_eq EventScript_275CDE goto_eq EventScript_275CDE
msgbox Route103_Text_290771, 4 msgbox Route103_Text_290771, 4
closemessage closemessage
dofieldeffect 26 dofieldeffect FLDEFF_USE_SECRET_POWER_TREE
waitstate waitstate
goto EventScript_275AF4 goto EventScript_275AF4
end end
EventScript_275ADF:: @ 8275ADF EventScript_275ADF:: @ 8275ADF
lockall lockall
dofieldeffect 26 dofieldeffect FLDEFF_USE_SECRET_POWER_TREE
waitstate waitstate
goto EventScript_275AF4 goto EventScript_275AF4
end end
@ -4511,14 +4512,14 @@ EventScript_275B02:: @ 8275B02
goto_eq EventScript_275CDE goto_eq EventScript_275CDE
msgbox Route103_Text_290771, 4 msgbox Route103_Text_290771, 4
closemessage closemessage
dofieldeffect 27 dofieldeffect FLDEFF_USE_SECRET_POWER_SHRUB
waitstate waitstate
goto EventScript_275B4D goto EventScript_275B4D
end end
EventScript_275B38:: @ 8275B38 EventScript_275B38:: @ 8275B38
lockall lockall
dofieldeffect 27 dofieldeffect FLDEFF_USE_SECRET_POWER_SHRUB
waitstate waitstate
goto EventScript_275B4D goto EventScript_275B4D
end end

View File

@ -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

View File

@ -1,85 +1,12 @@
#ifndef GUARD_FIELD_EFFECTS_H #ifndef GUARD_FIELD_EFFECTS_H
#define GUARD_FIELD_EFFECTS_H #define GUARD_FIELD_EFFECTS_H
#include "task.h"
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[2]; extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[2];
extern const struct SpritePalette gNewGameBirchObjectPaletteInfo; extern const struct SpritePalette gNewGameBirchObjectPaletteInfo;
extern const struct CompressedSpriteSheet gTrainerFrontPicTable[2]; extern const struct CompressedSpriteSheet gTrainerFrontPicTable[2];
extern const struct SpriteTemplate gNewGameBirchObjectTemplate; extern const struct SpriteTemplate gNewGameBirchObjectTemplate;
extern const struct OamData gNewGameBirchOamAttributes; 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 s32 gFieldEffectArguments[8];
extern void (*gPostMenuFieldCallback)(void); extern void (*gPostMenuFieldCallback)(void);
extern bool8 (*gFieldCallback2)(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_loadtiles_callnative(u8 **script, u32 *val);
bool8 FieldEffectCmd_loadfadedpal_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_80B9C28(s16*, u8);
void sub_80B9C54(s16*, u8); void sub_80B9C54(s16*, u8);
void sub_80B9CDC(s16*, u8); void sub_80B9CDC(s16*, u8);

View File

@ -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

View File

@ -1,25 +1,25 @@
#include "global.h" #include "global.h"
#include "battle_transition.h" #include "battle_transition.h"
#include "unk_transition.h" #include "bg.h"
#include "main.h" #include "decompress.h"
#include "overworld.h"
#include "task.h"
#include "palette.h"
#include "trig.h"
#include "field_effect.h"
#include "field_camera.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 "random.h"
#include "sprite.h" #include "scanline_effect.h"
#include "sound.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/songs.h"
#include "constants/trainers.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 struct TransitionData
{ {

View File

@ -5,6 +5,7 @@
#include "script.h" #include "script.h"
#include "sound.h" #include "sound.h"
#include "task.h" #include "task.h"
#include "constants/field_effects.h"
#include "constants/flags.h" #include "constants/flags.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/songs.h" #include "constants/songs.h"

View File

@ -18,10 +18,12 @@
#include "random.h" #include "random.h"
#include "rom_818CFC8.h" #include "rom_818CFC8.h"
#include "sprite.h" #include "sprite.h"
#include "task.h"
#include "trainer_see.h" #include "trainer_see.h"
#include "util.h" #include "util.h"
#include "constants/event_object_movement_constants.h" #include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_effects.h"
// this file was known as evobjmv.c in Game Freak's original source // this file was known as evobjmv.c in Game Freak's original source

View File

@ -558,8 +558,7 @@ static bool8 TryStartCoordEventScript(struct MapPosition *position)
static bool8 TryStartMiscWalkingScripts(u16 metatileBehavior) static bool8 TryStartMiscWalkingScripts(u16 metatileBehavior)
{ {
s16 x; s16 x, y;
s16 y;
if (MetatileBehavior_IsCrackedFloorHole(metatileBehavior)) if (MetatileBehavior_IsCrackedFloorHole(metatileBehavior))
{ {

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@
#include "sound.h" #include "sound.h"
#include "sprite.h" #include "sprite.h"
#include "trig.h" #include "trig.h"
#include "constants/field_effects.h"
#include "constants/songs.h" #include "constants/songs.h"
#define EVENT_OBJ_PAL_TAG_NONE 0x11FF // duplicate of define in event_object_movement.c #define EVENT_OBJ_PAL_TAG_NONE 0x11FF // duplicate of define in event_object_movement.c

View File

@ -4,11 +4,10 @@
#include "event_data.h" #include "event_data.h"
#include "event_object_movement.h" #include "event_object_movement.h"
#include "field_camera.h" #include "field_camera.h"
#include "field_player_avatar.h"
#include "field_effect.h" #include "field_effect.h"
#include "field_effect_helpers.h" #include "field_effect_helpers.h"
#include "field_player_avatar.h"
#include "fieldmap.h" #include "fieldmap.h"
#include "global.fieldmap.h"
#include "menu.h" #include "menu.h"
#include "metatile_behavior.h" #include "metatile_behavior.h"
#include "overworld.h" #include "overworld.h"
@ -25,6 +24,7 @@
#include "constants/abilities.h" #include "constants/abilities.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/event_object_movement_constants.h" #include "constants/event_object_movement_constants.h"
#include "constants/field_effects.h"
#include "constants/flags.h" #include "constants/flags.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/moves.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 EventObject gEventObjects[EVENT_OBJECTS_COUNT] = {};
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {}; EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {};
static void StartStrengthAnim(u8, u8); // static declarations
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 u8 EventObjectCB2_NoMovement2(); static u8 EventObjectCB2_NoMovement2();
static void sub_808C280(struct EventObject *);
static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8);
static void npc_clear_strange_bits(struct EventObject *); 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 MovePlayerAvatarUsingKeypadInput(u8, u16, u16);
static void PlayerAllowForcedMovementIfMovingSameDirection(); static void PlayerAllowForcedMovementIfMovingSameDirection();
static u8 sub_808B028(u8); static bool8 TryDoMetatileBehaviorForcedMovement();
static u8 GetForcedMovementByMetatileBehavior(); 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_None(void);
static bool8 ForcedMovement_Slip(void); static bool8 ForcedMovement_Slip(void);
@ -87,25 +63,63 @@ static bool8 ForcedMovement_0xBB(void);
static bool8 ForcedMovement_0xBC(void); static bool8 ForcedMovement_0xBC(void);
static bool8 ForcedMovement_MuddySlope(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_Normal(struct EventObject *a);
static void PlayerAvatarTransition_MachBike(struct EventObject *a); static void PlayerAvatarTransition_MachBike(struct EventObject *a);
static void PlayerAvatarTransition_AcroBike(struct EventObject *a); static void PlayerAvatarTransition_AcroBike(struct EventObject *a);
static void PlayerAvatarTransition_Surfing(struct EventObject *a); static void PlayerAvatarTransition_Surfing(struct EventObject *a);
static void PlayerAvatarTransition_Underwater(struct EventObject *a); static void PlayerAvatarTransition_Underwater(struct EventObject *a);
static void PlayerAvatarTransition_ReturnToField(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 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 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 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 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_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject);
static bool8 PlayerAvatar_SecretBaseMatSpinStep1(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_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject);
static bool8 PlayerAvatar_SecretBaseMatSpinStep3(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 Fishing1(struct Task *task);
static u8 Fishing2(struct Task *task); static u8 Fishing2(struct Task *task);
static u8 Fishing3(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 Fishing14(struct Task *task);
static u8 Fishing15(struct Task *task); static u8 Fishing15(struct Task *task);
static u8 Fishing16(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) = static bool8 (*const sForcedMovementTestFuncs[])(u8) =
{ {
@ -283,6 +302,7 @@ static bool8 (*const sPlayerAvatarSecretBaseMatSpin[])(struct Task *, struct Eve
}; };
// .text // .text
void MovementType_Player(struct Sprite *sprite) void MovementType_Player(struct Sprite *sprite)
{ {
UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2); 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); 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; StartStrengthAnim(eventObjectId, direction);
y = gEventObjects[eventObjectId].currentCoords.y; return 1;
MoveCoords(direction, &x, &y);
if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0
&& MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0)
{
StartStrengthAnim(eventObjectId, direction);
return 1;
}
} }
}
} }
return 0; return 0;
} }
@ -981,7 +1001,7 @@ void PlayerGoSpeed4(u8 a)
PlayerSetAnimId(GetWalkFastestMovementAction(a), 2); PlayerSetAnimId(GetWalkFastestMovementAction(a), 2);
} }
void PlayerRun(u8 a) static void PlayerRun(u8 a)
{ {
PlayerSetAnimId(GetPlayerRunMovementAction(a), 2); PlayerSetAnimId(GetPlayerRunMovementAction(a), 2);
} }
@ -997,13 +1017,13 @@ void PlayerOnBikeCollideWithFarawayIslandMew(u8 a)
PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(a), 2); PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(a), 2);
} }
void PlayerNotOnBikeCollide(u8 a) static void PlayerNotOnBikeCollide(u8 a)
{ {
PlayCollisionSoundIfNotFacingWarp(a); PlayCollisionSoundIfNotFacingWarp(a);
PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2); PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2);
} }
void PlayerNotOnBikeCollideWithFarawayIslandMew(u8 a) static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8 a)
{ {
PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2); PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2);
} }
@ -1450,8 +1470,6 @@ static void sub_808C280(struct EventObject *eventObject)
/* Strength */ /* Strength */
static void Task_BumpBoulder(u8 taskId);
static void StartStrengthAnim(u8 a, u8 b) static void StartStrengthAnim(u8 a, u8 b)
{ {
u8 taskId = CreateTask(Task_BumpBoulder, 0xFF); u8 taskId = CreateTask(Task_BumpBoulder, 0xFF);
@ -1523,8 +1541,6 @@ static bool8 sub_808C484(struct Task *task, struct EventObject *playerObject, st
/* Some field effect */ /* Some field effect */
static void DoPlayerAvatarSecretBaseMatJump(u8 taskId);
static void DoPlayerMatJump(void) static void DoPlayerMatJump(void)
{ {
DoPlayerAvatarSecretBaseMatJump(CreateTask(DoPlayerAvatarSecretBaseMatJump, 0xFF)); DoPlayerAvatarSecretBaseMatJump(CreateTask(DoPlayerAvatarSecretBaseMatJump, 0xFF));
@ -1557,8 +1573,6 @@ static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject
/* Some field effect */ /* Some field effect */
static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId);
static void DoPlayerMatSpin(void) static void DoPlayerMatSpin(void)
{ {
u8 taskId = CreateTask(PlayerAvatar_DoSecretBaseMatSpin, 0xFF); u8 taskId = CreateTask(PlayerAvatar_DoSecretBaseMatSpin, 0xFF);
@ -1632,9 +1646,6 @@ static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct Event
/* Some Field effect */ /* Some Field effect */
static void taskFF_0805D1D4(u8 taskId);
static void sub_808C814(u8 taskId);
static void sub_808C750(u8 a) static void sub_808C750(u8 a)
{ {
u8 taskId; u8 taskId;
@ -1699,9 +1710,6 @@ static bool8 (*const sFishingStateFuncs[])(struct Task *) =
Fishing16, Fishing16,
}; };
static void Task_Fishing(u8 taskId);
static void AlignFishingAnimationFrames(void);
#define tStep data[0] #define tStep data[0]
#define tFrameCounter data[1] #define tFrameCounter data[1]
#define tNumDots data[2] #define tNumDots data[2]
@ -2082,8 +2090,6 @@ static u8 sub_808D080(void)
return gUnknown_0203734C; return gUnknown_0203734C;
} }
static u8 sub_808D38C(struct EventObject *object, s16 *a1);
static void sub_808D094(u8 taskId) static void sub_808D094(u8 taskId)
{ {
struct EventObject *object = &gEventObjects[gPlayerAvatar.eventObjectId]; struct EventObject *object = &gEventObjects[gPlayerAvatar.eventObjectId];

View File

@ -1,5 +1,4 @@
#include "global.h" #include "global.h"
#include "main.h"
#include "battle.h" #include "battle.h"
#include "battle_tower.h" #include "battle_tower.h"
#include "cable_club.h" #include "cable_club.h"
@ -13,7 +12,6 @@
#include "field_effect.h" #include "field_effect.h"
#include "field_message_box.h" #include "field_message_box.h"
#include "field_player_avatar.h" #include "field_player_avatar.h"
#include "field_region_map.h"
#include "field_screen.h" #include "field_screen.h"
#include "field_specials.h" #include "field_specials.h"
#include "field_weather.h" #include "field_weather.h"
@ -21,6 +19,7 @@
#include "item_icon.h" #include "item_icon.h"
#include "link.h" #include "link.h"
#include "list_menu.h" #include "list_menu.h"
#include "main.h"
#include "malloc.h" #include "malloc.h"
#include "match_call.h" #include "match_call.h"
#include "menu.h" #include "menu.h"
@ -46,6 +45,7 @@
#include "wallclock.h" #include "wallclock.h"
#include "window.h" #include "window.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/items.h" #include "constants/items.h"
#include "constants/maps.h" #include "constants/maps.h"
#include "constants/songs.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 LoadPalette(const void *src, u32 offset, u16 size); // incorrect signature, needed to match
extern void BlendPalettes(u32, u8, u16); extern void BlendPalettes(u32, u8, u16);
extern void FieldInitRegionMap(MainCallback callback);
void UpdateMovedLilycoveFanClubMembers(void); void UpdateMovedLilycoveFanClubMembers(void);
void sub_813BF60(void); void sub_813BF60(void);

View File

@ -18,6 +18,7 @@
#include "trig.h" #include "trig.h"
#include "constants/abilities.h" #include "constants/abilities.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/songs.h" #include "constants/songs.h"
extern void ScriptUnfreezeEventObjects(void); extern void ScriptUnfreezeEventObjects(void);

View File

@ -7,6 +7,7 @@
#include "script.h" #include "script.h"
#include "task.h" #include "task.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_effects.h"
// static functions // static functions
static void FldEff_UseStrength(void); static void FldEff_UseStrength(void);

View File

@ -12,6 +12,7 @@
#include "sprite.h" #include "sprite.h"
#include "task.h" #include "task.h"
#include "wild_encounter.h" #include "wild_encounter.h"
#include "constants/field_effects.h"
#include "constants/rgb.h" #include "constants/rgb.h"
#include "constants/songs.h" #include "constants/songs.h"

View File

@ -5,6 +5,7 @@
#include "overworld.h" #include "overworld.h"
#include "rom6.h" #include "rom6.h"
#include "task.h" #include "task.h"
#include "constants/field_effects.h"
static void FieldCallback_Teleport(void); static void FieldCallback_Teleport(void);
static void StartTeleportFieldEffect(void); static void StartTeleportFieldEffect(void);

View File

@ -15,6 +15,7 @@
#include "task.h" #include "task.h"
#include "constants/event_object_movement_constants.h" #include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_effects.h"
#include "constants/map_types.h" #include "constants/map_types.h"
#include "constants/songs.h" #include "constants/songs.h"

View File

@ -1,17 +1,18 @@
#include "global.h" #include "global.h"
#include "trainer_see.h"
#include "battle_setup.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_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 "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 bool8 InBattlePyramid(void);
extern bool32 InTrainerHill(void); extern bool32 InTrainerHill(void);