From c84f98a7ff229ab8b09053fae8d66506764ce099 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 29 Jun 2020 17:24:17 -0400 Subject: [PATCH] Document misc field control --- include/field_screen_effect.h | 2 +- src/field_control_avatar.c | 2 +- src/field_screen_effect.c | 15 ++++++++------- src/scrcmd.c | 3 ++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/field_screen_effect.h b/include/field_screen_effect.h index de472da3c3..951bf07886 100644 --- a/include/field_screen_effect.h +++ b/include/field_screen_effect.h @@ -28,7 +28,7 @@ void DoFallWarp(void); void DoEscalatorWarp(u8 metatileBehavior); void DoLavaridgeGymB1FWarp(void); void DoLavaridgeGym1FWarp(void); -void DoTeleportWarp(void); +void DoTeleportTileWarp(void); void DoMossdeepGymWarp(void); void DoPortholeWarp(void); void DoCableClubWarp(void); diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 5a47f13542..3684b53e6d 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -725,7 +725,7 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB } if (MetatileBehavior_IsAquaHideoutWarp(metatileBehavior) == TRUE) { - DoTeleportWarp(); + DoTeleportTileWarp(); return TRUE; } if (MetatileBehavior_IsWarpOrBridge(metatileBehavior) == TRUE) diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index 9bdf98d689..e14efce677 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -44,7 +44,7 @@ static void sub_808115C(u8); static void FillPalBufferWhite(void); static void Task_ExitDoor(u8); static bool32 WaitForWeatherFadeIn(void); -static void task0A_mpl_807E31C(u8 taskId); +static void Task_TeleportTileWarpExit(u8 taskId); static void Task_WarpAndLoadMap(u8 taskId); static void Task_DoDoorWarp(u8 taskId); static void Task_EnableScriptAfterMusicFade(u8 taskId); @@ -297,12 +297,12 @@ void FieldCB_WarpExitFadeFromBlack(void) ScriptContext2_Enable(); } -static void FieldCB_TeleportWarpExit(void) +static void FieldCB_TeleportTileWarpExit(void) { Overworld_PlaySpecialMapMusic(); WarpFadeInScreen(); PlaySE(SE_TK_WARPOUT); - CreateTask(task0A_mpl_807E31C, 10); + CreateTask(Task_TeleportTileWarpExit, 10); ScriptContext2_Enable(); } @@ -545,14 +545,15 @@ void DoLavaridgeGym1FWarp(void) StartLavaridgeGym1FWarp(10); } -void DoTeleportWarp(void) +// Warp from a teleporting tile, e.g. in Aqua Hideout (For the move Teleport see FldEff_TeleportWarpOut) +void DoTeleportTileWarp(void) { ScriptContext2_Enable(); TryFadeOutOldMapMusic(); WarpFadeOutScreen(); PlaySE(SE_TK_WARPIN); CreateTask(Task_WarpAndLoadMap, 10); - gFieldCallback = FieldCB_TeleportWarpExit; + gFieldCallback = FieldCB_TeleportTileWarpExit; } void DoMossdeepGymWarp(void) @@ -999,7 +1000,7 @@ void WriteBattlePyramidViewScanlineEffectBuffer(void) CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480); } -static void task0A_mpl_807E31C(u8 taskId) +static void Task_TeleportTileWarpExit(u8 taskId) { switch (gTasks[taskId].data[0]) { @@ -1056,7 +1057,7 @@ void sub_80B0244(void) { ScriptContext2_Enable(); CreateTask(Task_WarpAndLoadMap, 10); - gFieldCallback = FieldCB_TeleportWarpExit; + gFieldCallback = FieldCB_TeleportTileWarpExit; } void sub_80B0268(void) diff --git a/src/scrcmd.c b/src/scrcmd.c index 9e62c45c5f..3b5003c3bc 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -801,6 +801,7 @@ bool8 ScrCmd_warphole(struct ScriptContext *ctx) return TRUE; } +// RS mossdeep gym warp, unused in Emerald bool8 ScrCmd_warpteleport(struct ScriptContext *ctx) { u8 mapGroup = ScriptReadByte(ctx); @@ -810,7 +811,7 @@ bool8 ScrCmd_warpteleport(struct ScriptContext *ctx) u16 y = VarGet(ScriptReadHalfword(ctx)); SetWarpDestination(mapGroup, mapNum, warpId, x, y); - DoTeleportWarp(); + DoTeleportTileWarp(); ResetInitialPlayerAvatarState(); return TRUE; }