DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.84k stars 463 forks source link

Add new map drawing functions #4703

Open tatoyoda600 opened 3 weeks ago

tatoyoda600 commented 3 weeks ago

Add new functions to handle drawing to world maps. Screen::paintTile / dfhack.screen.paintTile and the functions derived from these don't work with world map screens. They can be used, just sprites won't be sized correctly and transparency won't be applied.

Internally, Screen.cpp's doSetTile_map function is called to draw the tiles, which writes to buffers in gps->main_viewport, but for map screens it would need to instead write to gps->main_map_port instead. Most of the logic can probably be copied over with minimal modifications, but the texpos_field parameter's type would have to change to reference graphic_map_portst instead of graphic_viewportst, with the default probably being df::graphic_map_portst::screentexpos_interface.

An example of what it looks like when the correct buffer is used to draw to the world map: image