Jump to content

Metroidvania Minimap

Overview
Creator: Moosh Updated: 04 Sep 2023 Tags: Global Downloads: 56
Rating[?]: Rating: 4.67/5 (5 ratings)
View Script Download Example
(1.47 MB)
Information

Description Setup Reviews Comments

To start with, combine MetroidvaniaMinimap_Example with your own global scripts if needed.

Essential Constants:
You'll probably want to set these to fit the map to your subscreen properly:
  • MINIMAP_LAYER: The layer to draw your maps to. If the Subscreen Draws Above Sprites rule isn't set, this should be changed to 6.
  • MINIMAP_X, MINIMAP_Y: The X and Y position for the map on the subscreen. It subtracts the 56 for top of the subscreen automatically, so you can use the editor to figure out positioning.
  • MINIMAP_SQUARESIZE: How big the map squares are. This should be 1 less than their pixel width, so they overlap each other properly.
  • MINIMAP_TILEWIDTH/MINIMAP_TILEHEIGHT: The width and height in screens of the minimap window.
Map Setup:
This script requires a reserved up to 8 consecutive maps. Four for your map layouts and then four for marker screens which get layered over those. Set MINIMAP_MAPS and MINIMAP_MARKERMAPS to the first of each set of four maps. You don't need to use all four if you don't need them, but you'll be limited by which DMaps or level numbers you can use in that case as there's 512 DMaps but only 128 screens per map.

In order for a DMap to display the minimap, it needs to have a script flag checked. Set DMF_ENABLEMINIMAP to the script flag you want this to use.

Each DMap (or level number if you're using MINIMAP_USELEVELNUM) corresponds to a screen on the four maps. The first 128 use the first map, next 128 use the second, ect. On each of these screens, you place combos in the shape of your map. They'll advance by 1 when the screen has been visited and 2 when it's the current screen Link is on. If you place a room combo on combo position 160 in its visited state, it will be treated as a background for all map squares, drastically reducing the number of combos you need to make to use the script. Background squares will inherit the CSet of the combo it's being drawn under. If you place flag 98 (or whatever you set CF_HIDDENROOM to) on a square, it will be treated as a hidden room and will not show up when you pick up the map until you visit it.

Markers:
Combos placed on the four marker maps will be treated as markers for the corresponding layout maps. You can autolayer these for your own convenience. The following combo types will produce the following kinds of map markers:
  • Chest (Normal): Item marker, triggered by item or special item.
  • Chest (Boss): Item marker, triggered by item and special item (Has 4 states instead of 2)
  • Damage (1/2): Boss marker. Triggered by the dungeon boss state. (Only one per level number)
  • Lock Block: Lock block marker.
  • Boss Lock Block: Boss lock block marker.
  • Step->Next: Secret marker.
Spacebar Map:
If the setting MINIMAP_LARGEMAP_ENABLED is enabled you can view the full minimap with spacebar. This requires a couple additional constants. You'll need to set up Screen Freeze (FFCs Only) and Screen Freeze (Except FFCs) combos and assign those to CMB_SCREENFREEZEA and CMB_SCREENFREEZEB respectively. For the most part the rest is pretty automatic, though you can further customize it with some constants.

Large Spacebar Map (Advanced):
If you want to have a larger map and are willing to dig into the script some, there's a way to assign individual maps to a group where they'll be drawn together as one. This larger map can be up to 48x48 screens big and can span up to 32 DMaps. There are also 4 slots for multiple "labyrinths" if need be. In order to set it up, find this function
//Used for defining minimap sectors on a large map
void Minimap_GetSectorDefinitions(){
In it you'll find a commented function for MiniMap_DefineSector(). Call that for each sector on your map to define all your map data. Arguments go as follows:
  • map: The map slot (0-3) to use.
  • sector: The map sector (0-31) to use
  • dmap: Which DMap this sector represents
  • xoff: The x offset from the center position in the map (16, 20)
  • yoff: The y offset from the center position in the map
Finding the right offsets to place your sectors at can be a bit computation or guesswork heavy, unfortunately. If you need a visual ruler, you can set MINIMAP_LARGEMAP_DEBUG to show the full range of the map space. Be aware if you're using an especially large map or the debug setting that you may need to tweak MINIMAP_LARGEMAP_OPENCLOSEFRAMES and MINIMAP_LARGEMAP_FRAMEDRAWCAP to allow the map time to load. It uses bitmaps with staggered loading to make up for the sheer number of draws.

FAQ:
I don't have much to put here now, but I guess I can put any common questions I encounter.

My map isn't showing up. What gives?
If the frame isn't showing either, it could be you forgot to check the DMap flag. It could also be that you didn't set MINIMAP_LAYER to the right value for your quest rules. Last but not least, double check your dmap and level numbers. It could be pointing to the wrong screen.

Why do my map tiles look broken?
Make sure the combos you're placing on your maps are all the first in a set of three (unexplored, explored, current). Alternatively if you're using background combos, place that at combo position 160 as the second of the set of three (I did it that way for readability). Also be wary of your blank space. That should all be using combo 0, else the script will interpret it as map data.

Why aren't my unexplored screens/markers showing up?
These are tied to map/compass unless you change the MINIMAP_REQUIREDUNGEONMAP and MINIMAP_REQUIRECOMPASS settings.

Does this script require any headers?
std.zh would be a good start. ;)