From 940238a456564d031dc2e4ce5d10ef7a3ea8b4c0 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Wed, 16 Jun 2021 09:58:33 -0600 Subject: [PATCH] Created Remove Warp Fadescreen (markdown) --- Remove-Warp-Fadescreen.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Remove-Warp-Fadescreen.md diff --git a/Remove-Warp-Fadescreen.md b/Remove-Warp-Fadescreen.md new file mode 100644 index 0000000..dc26d4b --- /dev/null +++ b/Remove-Warp-Fadescreen.md @@ -0,0 +1,37 @@ +## Remove Warp Fadescreen + +credits to ghoulslash + +There might come a day where you want to fade the screen to black in a script and play a fanfare, print a message, or do something else, and immediately warp. If you try this in vanilla emerald, the screen will fade FROM black, and then back TO black. Instead, let's create a flag that removes the fadescreen part of the warp script commands and we can do something like this: + + +### 1. Define a flag + +Add or replace a flag with `FLAG_REMOVE_WARP_FADE` in `include/constants/flags.h` + +### 2. Give the flag a purpose + +1) Find `WarpFadeOutScreen` in [field_screen_effect.c](../blob/master/src/field_screen_effect.c#L102) and replace the entire function with: + + +```c +void WarpFadeOutScreen(void) +{ + u8 currentMapType = GetCurrentMapType(); + if (!FlagGet(FLAG_REMOVE_WARP_FADE)) // fadescreen if flag not set + { + switch (GetMapPairFadeToType(currentMapType, GetDestinationWarpMapHeader()->mapType)) + { + case 0: + FadeScreen(FADE_TO_BLACK, 0); + break; + case 1: + FadeScreen(FADE_TO_WHITE, 0); + } + } + else + { + FlagClear(FLAG_REMOVE_WARP_FADE); // reset flag internally + } +} +``` \ No newline at end of file