Pointers in the Right Direction

Now that movement works I’d like to have a bit more convenience when navigating the map. So I want to add a minimap to the square area next to the character portraits.

I would like to have it slowly reveal when walking through the dungeon as well as a pointer indicating the player orientation.

First of all the process of getting the minimap data is pretty similar to the one for the view. I take the player x and y position as origin and decrease that by three (the minimap size is seven chars so the center minus three would be the starting point) in both directions to get the top left char of the minimap.

That done I simply traverse through all the maptiles until I reach the minimap width or height to fill it.

Copy to Clipboard

The whole affair is pretty straightforward. I get the data from the map address and store it at the corresponding address for the minimap.

Copy to Clipboard

Drawing the map

To draw the map on screen I simply traverse through all the stored minimap tiles. First I rotate the bits for every tile to the left to check if it has been allready explored. If not I break out of the code and simply draw the symbol for unexplored space.

If it is explored I load the original tile data again and this time rotate to the left until the carry is set to find out what type of tile is stored here.

Once that is done I load the starting address of the selected char and using my previously written routines draw it on screen.

Copy to Clipboard
Copy to Clipboard

Adding the pointer

To indicate the player position and direction on the minimap I create a simple hires sprite in SpritePad and display it in the center of the minimap.

that gets displayed at the center of the minimap. The sprite changes based on the direction the player is currently facing.

Copy to Clipboard

Updating old code

I have to add a bit of new code to the view routine as I have to somehow indicate when a map tile has been allready seen by the player. To do that I set bit 7 of every map tile that has been viewed.

Copy to Clipboard

Compiling the code

Now that makes navigation quite a bit easier…

The complete code listing.

Copy to Clipboard

build_mapview.asm

Copy to Clipboard

build_strips.asm

Copy to Clipboard

draw_view.asm

Copy to Clipboard