diff --git a/data-de/event_scripts.s b/data-de/event_scripts.s index 2210e0fa7..e76fca923 100644 --- a/data-de/event_scripts.s +++ b/data-de/event_scripts.s @@ -1641,46 +1641,7 @@ MauvilleCity_GameCorner_EventScript_1C40DA:: @ 81C40DA .include "data/text/berries.inc" .include "data/text/shoal_cave.inc" .include "data/text/check_furniture.inc" - -GraniteCave_B1F_MapScript2_1C6BB5:: @ 81C6BB5 -MtPyre_2F_MapScript2_1C6BB5:: @ 81C6BB5 -SkyPillar_2F_MapScript2_1C6BB5:: @ 81C6BB5 -SkyPillar_4F_MapScript2_1C6BB5:: @ 81C6BB5 - map_script_2 VAR_ICE_STEP_COUNT, 0, S_FallDownHole - .2byte 0 - -GraniteCave_B1F_MapScript1_1C6BBF:: @ 81C6BBF -MtPyre_2F_MapScript1_1C6BBF:: @ 81C6BBF -SkyPillar_2F_MapScript1_1C6BBF:: @ 81C6BBF -SkyPillar_4F_MapScript1_1C6BBF:: @ 81C6BBF - copyvar VAR_ICE_STEP_COUNT, 0x1 - end - -S_FallDownHole:: @ 81C6BC5 - lockall - delay 20 - applymovement OBJ_EVENT_ID_PLAYER, GraniteCave_B1F_Movement_1C6BF7 - waitmovement 0 - playse SE_RU_HYUU - delay 60 - warphole MAP_UNDEFINED - waitstate - end - -gUnknown_081C6BDE:: @ 81C6BDE - lockall - delay 20 - applymovement OBJ_EVENT_ID_PLAYER, GraniteCave_B1F_Movement_1C6BF7 - waitmovement 0 - playse SE_RU_HYUU - delay 60 - special sp13F_fall_to_last_warp - waitstate - end - -GraniteCave_B1F_Movement_1C6BF7:: @ 81C6BF7 - set_invisible - step_end + .include "data/scripts/cave_hole.inc" @ 81C6BF9 msgbox Text_1C6C2B, MSGBOX_NPC diff --git a/data/event_scripts.s b/data/event_scripts.s index 9df3adcdb..83e558714 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -1634,46 +1634,7 @@ MauvilleCity_GameCorner_EventScript_1C40DA:: @ 81C40DA .include "data/text/berries.inc" .include "data/text/shoal_cave.inc" .include "data/text/check_furniture.inc" - -GraniteCave_B1F_MapScript2_1C6BB5:: @ 81C6BB5 -MtPyre_2F_MapScript2_1C6BB5:: @ 81C6BB5 -SkyPillar_2F_MapScript2_1C6BB5:: @ 81C6BB5 -SkyPillar_4F_MapScript2_1C6BB5:: @ 81C6BB5 - map_script_2 VAR_ICE_STEP_COUNT, 0, S_FallDownHole - .2byte 0 - -GraniteCave_B1F_MapScript1_1C6BBF:: @ 81C6BBF -MtPyre_2F_MapScript1_1C6BBF:: @ 81C6BBF -SkyPillar_2F_MapScript1_1C6BBF:: @ 81C6BBF -SkyPillar_4F_MapScript1_1C6BBF:: @ 81C6BBF - copyvar VAR_ICE_STEP_COUNT, 0x1 - end - -S_FallDownHole:: @ 81C6BC5 - lockall - delay 20 - applymovement OBJ_EVENT_ID_PLAYER, GraniteCave_B1F_Movement_1C6BF7 - waitmovement 0 - playse SE_RU_HYUU - delay 60 - warphole MAP_UNDEFINED - waitstate - end - -gUnknown_081C6BDE:: @ 81C6BDE - lockall - delay 20 - applymovement OBJ_EVENT_ID_PLAYER, GraniteCave_B1F_Movement_1C6BF7 - waitmovement 0 - playse SE_RU_HYUU - delay 60 - special sp13F_fall_to_last_warp - waitstate - end - -GraniteCave_B1F_Movement_1C6BF7:: @ 81C6BF7 - set_invisible - step_end + .include "data/scripts/cave_hole.inc" @ 81C6BF9 msgbox Text_1C6C2B, MSGBOX_NPC diff --git a/data/maps/GraniteCave_B1F/scripts.inc b/data/maps/GraniteCave_B1F/scripts.inc index 46877cbd4..1f2615436 100644 --- a/data/maps/GraniteCave_B1F/scripts.inc +++ b/data/maps/GraniteCave_B1F/scripts.inc @@ -1,6 +1,6 @@ GraniteCave_B1F_MapScripts:: @ 815CBDD - map_script MAP_SCRIPT_ON_FRAME_TABLE, GraniteCave_B1F_MapScript2_1C6BB5 - map_script MAP_SCRIPT_ON_TRANSITION, GraniteCave_B1F_MapScript1_1C6BBF + map_script MAP_SCRIPT_ON_FRAME_TABLE, CaveHole_CheckFallDownHole + map_script MAP_SCRIPT_ON_TRANSITION, CaveHole_FixCrackedGround map_script MAP_SCRIPT_ON_RESUME, GraniteCave_B1F_MapScript1_15CBED .byte 0 diff --git a/data/maps/MtPyre_2F/scripts.inc b/data/maps/MtPyre_2F/scripts.inc index 2a4d5004b..3a42c7d0d 100644 --- a/data/maps/MtPyre_2F/scripts.inc +++ b/data/maps/MtPyre_2F/scripts.inc @@ -1,6 +1,6 @@ MtPyre_2F_MapScripts:: @ 815D36E - map_script MAP_SCRIPT_ON_FRAME_TABLE, MtPyre_2F_MapScript2_1C6BB5 - map_script MAP_SCRIPT_ON_TRANSITION, MtPyre_2F_MapScript1_1C6BBF + map_script MAP_SCRIPT_ON_FRAME_TABLE, CaveHole_CheckFallDownHole + map_script MAP_SCRIPT_ON_TRANSITION, CaveHole_FixCrackedGround map_script MAP_SCRIPT_ON_RESUME, MtPyre_2F_MapScript1_15D37E .byte 0 diff --git a/data/maps/SkyPillar_2F/scripts.inc b/data/maps/SkyPillar_2F/scripts.inc index c393dd287..696293619 100644 --- a/data/maps/SkyPillar_2F/scripts.inc +++ b/data/maps/SkyPillar_2F/scripts.inc @@ -1,6 +1,6 @@ SkyPillar_2F_MapScripts:: @ 815F2C9 - map_script MAP_SCRIPT_ON_FRAME_TABLE, SkyPillar_2F_MapScript2_1C6BB5 - map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_2F_MapScript1_1C6BBF + map_script MAP_SCRIPT_ON_FRAME_TABLE, CaveHole_CheckFallDownHole + map_script MAP_SCRIPT_ON_TRANSITION, CaveHole_FixCrackedGround map_script MAP_SCRIPT_ON_RESUME, SkyPillar_2F_MapScript1_15F2D9 .byte 0 diff --git a/data/maps/SkyPillar_4F/scripts.inc b/data/maps/SkyPillar_4F/scripts.inc index cc67e912c..993873cdc 100644 --- a/data/maps/SkyPillar_4F/scripts.inc +++ b/data/maps/SkyPillar_4F/scripts.inc @@ -1,6 +1,6 @@ SkyPillar_4F_MapScripts:: @ 815F2E5 - map_script MAP_SCRIPT_ON_FRAME_TABLE, SkyPillar_4F_MapScript2_1C6BB5 - map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_4F_MapScript1_1C6BBF + map_script MAP_SCRIPT_ON_FRAME_TABLE, CaveHole_CheckFallDownHole + map_script MAP_SCRIPT_ON_TRANSITION, CaveHole_FixCrackedGround map_script MAP_SCRIPT_ON_RESUME, SkyPillar_4F_MapScript1_15F2F5 .byte 0 diff --git a/data/scripts/cave_hole.inc b/data/scripts/cave_hole.inc new file mode 100644 index 000000000..0bc876575 --- /dev/null +++ b/data/scripts/cave_hole.inc @@ -0,0 +1,33 @@ +CaveHole_CheckFallDownHole:: @ 81C6BB5 + map_script_2 VAR_ICE_STEP_COUNT, 0, EventScript_FallDownHole + .2byte 0 + +CaveHole_FixCrackedGround:: @ 81C6BBF + copyvar VAR_ICE_STEP_COUNT, 1 + end + +EventScript_FallDownHole:: @ 81C6BC5 + lockall + delay 20 + applymovement OBJ_EVENT_ID_PLAYER, Movement_SetInvisible + waitmovement 0 + playse SE_RU_HYUU + delay 60 + warphole MAP_UNDEFINED + waitstate + end + +EventScript_FallDownHoleMtPyre:: @ 81C6BDE + lockall + delay 20 + applymovement OBJ_EVENT_ID_PLAYER, Movement_SetInvisible + waitmovement 0 + playse SE_RU_HYUU + delay 60 + special DoFallWarp + waitstate + end + +Movement_SetInvisible:: @ 81C6BF7 + set_invisible + step_end diff --git a/data/specials.inc b/data/specials.inc index 419bf1045..a511742e3 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -327,7 +327,7 @@ gSpecials:: def_special FoundBlackGlasses def_special sub_807E25C def_special sp13E_warp_to_last_warp - def_special sp13F_fall_to_last_warp + def_special DoFallWarp def_special ShowContestEntryMonPic def_special sub_80C5164 def_special SetEReaderTrainerGfxId diff --git a/include/field_fadetransition.h b/include/field_fadetransition.h index 04538753a..0b33b4a72 100644 --- a/include/field_fadetransition.h +++ b/include/field_fadetransition.h @@ -20,7 +20,7 @@ bool32 sub_8080E70(void); void sub_8080E88(void); void sp13E_warp_to_last_warp(void); void sub_8080EF0(void); -void sp13F_fall_to_last_warp(void); +void DoFallWarp(void); void sub_8080F2C(u8); void sub_8080F48(void); void sub_8080F58(void); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index b0b56ac13..6e9858cc5 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -75,11 +75,11 @@ extern u8 S_UseWaterfall[]; extern u8 S_CannotUseWaterfall[]; extern u8 UseDiveScript[]; extern u8 S_UseDiveUnderwater[]; -extern u8 S_FallDownHole[]; +extern u8 EventScript_FallDownHole[]; extern u8 gUnknown_081A14B8[]; extern u8 S_EggHatch[]; extern u8 gUnknown_0815FD0D[]; -extern u8 gUnknown_081C6BDE[]; +extern u8 EventScript_FallDownHoleMtPyre[]; static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); @@ -563,7 +563,7 @@ bool8 TryStartCrackedFloorHoleScript(u16 metatileBehavior) { if (MetatileBehavior_IsCrackedFloorHole(metatileBehavior)) { - ScriptContext1_SetupScript(S_FallDownHole); + ScriptContext1_SetupScript(EventScript_FallDownHole); return TRUE; } return FALSE; @@ -717,7 +717,7 @@ bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileBehavior } if (MetatileBehavior_IsMtPyreHole(metatileBehavior) == TRUE) { - ScriptContext1_SetupScript(gUnknown_081C6BDE); + ScriptContext1_SetupScript(EventScript_FallDownHoleMtPyre); return TRUE; } sub_8080E88(); diff --git a/src/field_fadetransition.c b/src/field_fadetransition.c index ee1b334a8..a4959703e 100644 --- a/src/field_fadetransition.c +++ b/src/field_fadetransition.c @@ -401,7 +401,7 @@ void sub_8080EF0(void) CreateTask(sub_808115C, 10); } -void sp13F_fall_to_last_warp(void) +void DoFallWarp(void) { sp13E_warp_to_last_warp(); gFieldCallback = sub_8086748; diff --git a/src/scrcmd.c b/src/scrcmd.c index 4d3f7ca2c..1a2d55f2e 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -770,7 +770,7 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx) SetFixedHoleWarpAsDestination(x - 7, y - 7); else Overworld_SetWarpDestination(mapGroup, mapNum, -1, x - 7, y - 7); - sp13F_fall_to_last_warp(); + DoFallWarp(); ResetInitialPlayerAvatarState(); return TRUE; }