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.
The whole affair is pretty straightforward. I get the data from the map address and store it at the corresponding address for the minimap.
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.
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.
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.
The complete code listing.
build_mapview.asm
build_strips.asm
draw_view.asm
Ich lese zu oft “simply”, das verstoert mich, wenn ich danach 100 Zeilen Assembler Code sehe :D
Gleichzeitig bekomme ich richtig Lust, mich vor den Brotkasten zu hocken und selbst was zu machen.
Es macht auf alle Faelle Spass die Fortschritte hier zu verfolgen! :)
Na ja, viel Code heißt ja nicht unbedingt komplexer Code. Eher das Gegenteil 😉
Im Moment bin ich ja noch dabei Assembler und die Architektur des C64 überhaupt erst einmal zu verstehen und durchdringen. Ich hoffe doch mal das der Code am Ende um einiges kürzer und eleganter wird 😅