Git Product home page Git Product logo

Comments (10)

mewmew avatar mewmew commented on June 15, 2024

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.

mewmew avatar mewmew commented on June 15, 2024

The drawing of automaps is now well documented, after @squidcc's work on diasurgical/devilution#299

from dgengine.

squidcc avatar squidcc commented on June 15, 2024

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.

mewmew avatar mewmew commented on June 15, 2024

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.

 avatar commented on June 15, 2024

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.

squidcc avatar squidcc commented on June 15, 2024

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.

mewmew avatar mewmew commented on June 15, 2024

i.e. zoom in/out on the automap.

from dgengine.

 avatar commented on June 15, 2024

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.

 avatar commented on June 15, 2024

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.

mewmew avatar mewmew commented on June 15, 2024

The automap looks great! Also with the zoom.

2018-11-25-142528_800x600_scrot
2018-11-25-142537_800x600_scrot

2018-11-25-142506_800x600_scrot
2018-11-25-142518_800x600_scrot

from dgengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.