Destroyed Adding the Map Preview Screens from FRLG (markdown)

Bivurnum 2024-10-06 13:48:56 -05:00
parent 77c81708dd
commit 0747ca5c38
1 changed files with 0 additions and 42 deletions

@ -1,42 +0,0 @@
![map_preview_example](https://github.com/Bivurnum/decomps-resources/blob/main/assets/gifs/map_preview_example.gif)
I implemented FireRed's map preview screen feature in pokeemerald and pokeemerald-expansion. This will allow you to use these map preview screens for whatever maps you want. Incidentally, I made this branch entirely from scratch before I found out that [ghoulslash had already done it](https://www.pokecommunity.com/threads/map-previews.435664/) years ago! Our code is very similar, mostly because the majority of it is just directly ported from pokefirered. Full credit to ghoulslash for beating me to the punch! However, I did make some tweaks to the code to make it generally easier for most people to use.
My repo can be found here: [https://github.com/Bivurnum/pokeemerald/tree/frlg-map-previews](https://github.com/Bivurnum/pokeemerald/tree/frlg-map-previews)
Enter the following commands into the console:
`git remote add Bivurnum https://github.com/Bivurnum/pokeemerald`
`git pull Bivurnum frlg-map-previews`
Or, if you want to apply the changes manually, you can find the comparison with all of my changes here:
[https://github.com/pret/pokeemerald/compare/master...Bivurnum:pokeemerald:frlg-map-previews](https://github.com/pret/pokeemerald/compare/master...Bivurnum:pokeemerald:frlg-map-previews)
If you are using pokeemerald-expansion version 1.9 and above, you should use my [`map-previews-expansion` branch](https://github.com/Bivurnum/pokeemerald/tree/map-previews-expansion) instead.
## Using the Map Previews
I'll be using an example of adding a map preview to Petalburg Woods for this section.
You will need to define a new map preview screen in include/map_preview_screen.h. Just add your new entry near the bottom of the list in `MapPreviewScreenId`, leaving `MPS_COUNT` at the very end. Like so:
![](https://github.com/Bivurnum/decomps-resources/blob/main/assets/images/MapPreviewScreenId_example.png)
Then, you will go to src/map_preview_screen.c and add a new section in the `sMapPreviewScreenData` list for the map preview you just defined. Keep in mind that this list has to be in the same order as the list in include/map_preview_screen.h.
![](https://github.com/Bivurnum/decomps-resources/blob/main/assets/images/sMapPreviewScreenData_example.png)
* `mapsec` is just the name of the map section your map is in. This map preview will apply to all maps within this map section (but not when traveling between maps within the same map section, similarly to the map name popups). If it doesn't have one alredy, the mapsec will need an entry in src/data/region_map/region_map_sections.json for the map name to show up in the map preview.
* `type` will be either `MPS_TYPE_BASIC`, `MPS_TYPE_CAVE` or `MPS_TYPE_WEATHER`. If it is set to `MPS_TYPE_CAVE`, the game will perform the warp animation for entering a cave at the end of the map preview. Due to some weather effects visually blending into `MPS_TYPE_BASIC`, you can use `MPS_TYPE_WEATHER` to make sure the map preview has completely faded out before the map is loaded in, ensuring there is no interaction with the weather effect.
* `flagId` is just the name of the flag you want to set when visiting this map for the first time. The flag state determines how long the map preview will last on screen; it gets a shorter duration if the player has been to that map before. A lot of Emerald maps already have associated flags, but Petalburg Woods does not have one by default, so I repurposed one of the unused flags for use in this example. If you don't want to use a flag, you can enter `MPS_FLAG_NULL` here and the duration will have its own custom value (this can be adjusted in the configs in include/map_preview_screen.h).
* `image` is the image you'd like to use for the preview screen. The full list of options can be found in include/map_preview_screen.h under `PreviewImageId`.
### Configs
In the include/map_preview_screen.h file, there are a few configs you can customize for the map previews.
* `MPS_DURATION_LONG` determines how many frames the map preview lasts on screen the first time the player enters that map.
* `MPS_DURATION_SHORT` determines how many frames the map preview lasts on screen after the map's flag has been set.
* `MPS_DURATION_NO_FLAG` determines how many frames the map preview lasts if the flag has been set to `MPS_FLAG_NULL`.
* `MPS_DURATION_ALWAYS` overrides all other duration values if it is set to anything but 0.
* `MPS_WEATHER_FADE_SPEED` determines how quickly the fade to black animation plays at the end of `MPS_TYPE_WEATHER`. A larger value makes it fade out slower. A smaller value (even a negative number) makes it fade out faster.
### Notes
* Keep in mind that ON_FRAME mapscripts may not play nice with the `MPS_TYPE_BASIC` map previews due to the mapscript running before the map preview screen has fully faded out. You could use `MPS_TYPE_WEATHER` to get around this.
* This branch appropriates some of the unused system flags. If you aren't going to use the existing map previews (specifically for the FireRed map sections), you can delete any of those sections from the two map_preview_screen files listed earlier. Or you can replace the `flagId`s with `MPS_FLAG_NULL`. This will free up those flags to be used elsewhere.