Comments (10)
The automap functions are contained within the address range 0x401DA4-0x40311A and their signatures have been documented in http://sanctuary.github.io/notes/#fileData/automap.h, where the addresses refers to the 1.09b release of Diablo.exe (note that the addresses of the 1.09 and 1.09b are identical, so both versions work).
The automap_init_types
function initializes the mapping between tile IDs and automap type by parsing the *.AMP file (e.g. Levels/L1Data/L1.AMP
) , where the types include:
- HorzArch
- VertArch
- HorzDoor
- VertDoor
- HorzGrate
- VertGrate
- Square
- Stairs
No specific CEL file is used to draw these automap types. Instead pixels are drawn manually to the screen in a specified colour (that corresponds to an index into the active palette); see for instance automap_draw_type
which draws the specified automap type at a given screen coordinate.
Keep in mind that the parameters screen_x
and screen_y
are not X- and Y-coordinates on the screen, but must first be translated. For more info, see https://github.com/sanctuary/notes/blob/master/name_desc.md
x = screen_x - 64
y = screen_y - 160
To render pixels on screen, several different functions from engine.cpp
are used. One such function is engine_set_pixel(int screen_x, int screen_y, uint8_t pixel)
which sets the given screen coordinate to the specified pixel value (index into the active palette).
I know this is not enough information to implement the automap rendering, however it's hopefully helpful to get started.
from dgengine.
The drawing of automaps is now well documented, after @squidcc's work on diasurgical/devilution#299
from dgengine.
I don't know if I'd say "well" documented - I made up my own flag names (didn't know the ones mentioned above existed) and the caves handling part is a bit vague; I think it's done that way because cave tiles can have walls on two opposite sides but that's a guess. Drawing the walls using different colours helps figure things out if anyone is curious.
from dgengine.
Drawing the walls using different colours helps figure things out if anyone is curious.
That's a good idea. Thanks for the tip.
from dgengine.
Thanks. The automap code was one of the first things I looked at in devilution. My approach will be a bit different (I might skip the SOL files and use something else that works for other resources, like flare's), but I'll try to have the same final result.
I'm thinking to have a texture with the automap tiles and just draw them by indexing each tile to an automap tile. This way you could have different automaps by just changing a texture. I can't use the SOL for this because there's some logic in the code for wall edges, so I'll have to create a new mapping file similar to the SOL file.
from dgengine.
Something to keep in mind is that the map can be scaled, so if you were using textures the lines/dots would also get scaled and look very different to the original.
from dgengine.
i.e. zoom in/out on the automap.
from dgengine.
Yes, I know. It's not a requirement I intend to do. Zoom, yes, but if it doesn't look 100% like the original, that's OK.
from dgengine.
In this last commit I added my implementation. You can still simulate zoom. I added 2 levels of zoom to show that it can be done as it takes some work to do each zoom for all level types (dungeons, caves,..).
As it is right now I would say it's good. The caves and nest levels are the ones I didn't do as in the original. Some pillar id mappings may be missing when loading levels with textures indexes not in the current commit's levels.
from dgengine.
The automap looks great! Also with the zoom.
from dgengine.
Related Issues (20)
- Dungeon generation of Cathedral HOT 2
- Mismatch of tile IDs when using FLARE resources HOT 3
- Any updates? HOT 2
- Compile error for v0.3.0 HOT 1
- Understanding Flare's level object's drawing offsets HOT 2
- Compilation warnings in release v0.3.6 HOT 8
- Loading... message never fades HOT 1
- Blending Modes
- Diablo 2 Font drawing
- Diablo 2 COF animation drawing order HOT 9
- Diablo 2 DT1 image decoder HOT 1
- Fix D2 tiles offsets and other D2 maps issues
- Fix lighting HOT 3
- Diablo 2 game files HOT 2
- Discord? HOT 24
- unable to create character when using gamefilesd2 HOT 21
- build error: Dun.cpp, error: storage class specifiers invalid in friend function HOT 2
- building on linux HOT 11
- Steam Deck packaging request HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dgengine.