assets use dynamic texture loading

develop
shevernitskiy 2023-08-12 16:11:42 +03:00
parent e81a90821a
commit fe8bd4fa78
8 changed files with 150 additions and 326 deletions

@ -1692,7 +1692,6 @@ bool Core::InitSimulationThread()
}
std::cerr << "Initializing textures.\n";
Textures::init(con);
Textures::initDynamic(con);
// create mutex for syncing with interactive tasks
std::cerr << "Initializing plugins.\n";
// create plugin manager
@ -2219,7 +2218,6 @@ void Core::onStateChange(color_ostream &out, state_change_event event)
}
break;
case SC_VIEWSCREEN_CHANGED:
Textures::init(out);
break;
default:
break;

@ -1710,18 +1710,7 @@ static const luaL_Reg dfhack_job_funcs[] = {
/***** Textures module *****/
static const LuaWrapper::FunctionReg dfhack_textures_module[] = {
WRAPM(Textures, getDfhackLogoTexposStart),
WRAPM(Textures, getGreenPinTexposStart),
WRAPM(Textures, getRedPinTexposStart),
WRAPM(Textures, getIconsTexposStart),
WRAPM(Textures, getOnOffTexposStart),
WRAPM(Textures, getMapUnsuspendTexposStart),
WRAPM(Textures, getControlPanelTexposStart),
WRAPM(Textures, getThinBordersTexposStart),
WRAPM(Textures, getMediumBordersTexposStart),
WRAPM(Textures, getBoldBordersTexposStart),
WRAPM(Textures, getPanelBordersTexposStart),
WRAPM(Textures, getWindowBordersTexposStart),
WRAPM(Textures, getAsset),
{ NULL, NULL }
};

@ -1,10 +1,10 @@
#pragma once
#include <vector>
#include <string>
#include <vector>
#include "Export.h"
#include "ColorText.h"
#include "Export.h"
#include <SDL_surface.h>
@ -29,7 +29,8 @@ DFHACK_EXPORT TexposHandle loadTexture(SDL_Surface* surface);
* Load tileset from image file.
* Return vector of handles to obtain valid texposes.
*/
DFHACK_EXPORT std::vector<TexposHandle> loadTileset(const std::string& file, int tile_px_w, int tile_px_h);
DFHACK_EXPORT std::vector<TexposHandle> loadTileset(const std::string& file, int tile_px_w,
int tile_px_h);
/**
* Get texpos by handle.
@ -39,15 +40,15 @@ DFHACK_EXPORT std::vector<TexposHandle> loadTileset(const std::string& file, int
DFHACK_EXPORT long getTexposByHandle(TexposHandle handle);
/**
* Call this on DFHack init and on every viewscreen change so we can reload
* and reindex textures as needed.
* Get texpos for static asset with index in tileset.
*/
void init(DFHack::color_ostream& out);
DFHACK_EXPORT long getAsset(const std::string asset, size_t index = 0);
/**
* Call this on DFHack init just once to setup interposed handlers.
* Call this on DFHack init just once to setup interposed handlers and
* init static assets.
*/
void initDynamic(DFHack::color_ostream& out);
void init(DFHack::color_ostream& out);
/**
* Call this when DFHack is being unloaded.
@ -55,51 +56,5 @@ void initDynamic(DFHack::color_ostream& out);
*/
void cleanup();
/**
* Get first texpos for the DFHack logo. This texpos and the next 11 make up the
* 4x3 grid of logo textures that can be displayed on the UI layer.
*/
DFHACK_EXPORT long getDfhackLogoTexposStart();
/**
* Get the first texpos for the UI pin tiles. Each are 2x2 grids.
*/
DFHACK_EXPORT long getGreenPinTexposStart();
DFHACK_EXPORT long getRedPinTexposStart();
/**
* Get the first texpos for the DFHack icons. It's a 5x2 grid.
*/
DFHACK_EXPORT long getIconsTexposStart();
/**
* Get the first texpos for the on and off icons. It's a 2x1 grid.
*/
DFHACK_EXPORT long getOnOffTexposStart();
/**
* Get the first texpos for the pathable 32x32 sprites. It's a 2x1 grid.
*/
DFHACK_EXPORT long getMapPathableTexposStart();
/**
* Get the first texpos for the unsuspend 32x32 sprites. It's a 5x1 grid.
*/
DFHACK_EXPORT long getMapUnsuspendTexposStart();
/**
* Get the first texpos for the control panel icons. 10x2 grid.
*/
DFHACK_EXPORT long getControlPanelTexposStart();
/**
* Get the first texpos for the DFHack borders. Each is a 7x3 grid.
*/
DFHACK_EXPORT long getThinBordersTexposStart();
DFHACK_EXPORT long getMediumBordersTexposStart();
DFHACK_EXPORT long getBoldBordersTexposStart();
DFHACK_EXPORT long getPanelBordersTexposStart();
DFHACK_EXPORT long getWindowBordersTexposStart();
}
}
} // namespace Textures
} // namespace DFHack

@ -913,10 +913,10 @@ local BASE_FRAME = {
}
local function make_frame(name, double_line)
local texpos = dfhack.textures['get'..name..'BordersTexposStart']()
local tp = function(offset)
local texpos = dfhack.textures.getAsset('hack/data/art/border-'..name:lower()..'.png', offset)
if texpos == -1 then return nil end
return texpos + offset
return texpos
end
local frame = copyall(BASE_FRAME)
@ -951,8 +951,40 @@ BOLD_FRAME = FRAME_BOLD
INTERIOR_FRAME = FRAME_INTERIOR
INTERIOR_MEDIUM_FRAME = FRAME_INTERIOR_MEDIUM
-- for compatibility with dynamic textures
local function choose_frame_style(style)
if style == FRAME_WINDOW then return make_frame('Window', true) end
if style == FRAME_PANEL then return make_frame('Panel', true) end
if style == FRAME_MEDIUM then return make_frame('Medium', true) end
if style == FRAME_BOLD then return make_frame('Bold', true) end
if style == FRAME_INTERIOR then
local frame = make_frame('Thin', true)
frame.signature_pen = false
return frame
end
if style == FRAME_INTERIOR_MEDIUM then
local frame = make_frame('Medium', true)
frame.signature_pen = false
return frame
end
if style == GREY_LINE_FRAME then return make_frame('Panel', true) end
if style == WINDOW_FRAME then return make_frame('Window', true) end
if style == PANEL_FRAME then return make_frame('Panel', true) end
if style == MEDIUM_FRAME then return make_frame('Medium', true) end
if style == INTERIOR_FRAME then
local frame = make_frame('Thin', true)
frame.signature_pen = false
return frame
end
if style == INTERIOR_MEDIUM_FRAME then
local frame = make_frame('Medium', true)
frame.signature_pen = false
return frame
end
end
function paint_frame(dc, rect, style, title, inactive, pause_forced, resizable)
style = choose_frame_style(style)
local pen = style.frame_pen
local x1,y1,x2,y2 = dc.x1+rect.x1, dc.y1+rect.y1, dc.x1+rect.x2, dc.y1+rect.y2
dscreen.paintTile(style.lt_frame_pen or pen, x1, y1)

@ -13,8 +13,8 @@
#include "df/enabler.h"
#include "df/viewscreen_adopt_regionst.h"
#include "df/viewscreen_loadgamest.h"
#include "df/viewscreen_new_regionst.h"
#include "df/viewscreen_new_arenast.h"
#include "df/viewscreen_new_regionst.h"
using df::global::enabler;
using namespace DFHack;
@ -24,22 +24,6 @@ namespace DFHack {
DBG_DECLARE(core, textures, DebugCategory::LINFO);
}
static bool g_loaded = false;
static long g_num_dfhack_textures = 0;
static long g_dfhack_logo_texpos_start = -1;
static long g_green_pin_texpos_start = -1;
static long g_red_pin_texpos_start = -1;
static long g_icons_texpos_start = -1;
static long g_on_off_texpos_start = -1;
static long g_pathable_texpos_start = -1;
static long g_unsuspend_texpos_start = -1;
static long g_control_panel_texpos_start = -1;
static long g_thin_borders_texpos_start = -1;
static long g_medium_borders_texpos_start = -1;
static long g_bold_borders_texpos_start = -1;
static long g_panel_borders_texpos_start = -1;
static long g_window_borders_texpos_start = -1;
static std::unordered_map<TexposHandle, long> g_handle_to_texpos;
static std::unordered_map<TexposHandle, SDL_Surface*> g_handle_to_surface;
static std::mutex g_adding_mutex;
@ -47,6 +31,16 @@ static std::mutex g_adding_mutex;
const uint32_t TILE_WIDTH_PX = 8;
const uint32_t TILE_HEIGHT_PX = 12;
static std::vector<TexposHandle> empty{};
static std::unordered_map<std::string, std::vector<TexposHandle>> g_static_assets{
{"hack/data/art/dfhack.png", empty}, {"hack/data/art/green-pin.png", empty},
{"hack/data/art/red-pin.png", empty}, {"hack/data/art/icons.png", empty},
{"hack/data/art/on-off.png", empty}, {"hack/data/art/pathable.png", empty},
{"hack/data/art/unsuspend.png", empty}, {"hack/data/art/control-panel.png", empty},
{"hack/data/art/border-thin.png", empty}, {"hack/data/art/border-medium.png", empty},
{"hack/data/art/border-bold.png", empty}, {"hack/data/art/border-panel.png", empty},
{"hack/data/art/border-window.png", empty}};
// Converts an arbitrary Surface to something like the display format
// (32-bit RGBA), and converts magenta to transparency if convert_magenta is set
// and the source surface didn't already have an alpha channel.
@ -61,9 +55,15 @@ SDL_Surface* canonicalize_format(SDL_Surface* src) {
fmt.BytesPerPixel = 4;
fmt.Rloss = fmt.Gloss = fmt.Bloss = fmt.Aloss = 0;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
fmt.Rshift = 24; fmt.Gshift = 16; fmt.Bshift = 8; fmt.Ashift = 0;
fmt.Rshift = 24;
fmt.Gshift = 16;
fmt.Bshift = 8;
fmt.Ashift = 0;
#else
fmt.Rshift = 0; fmt.Gshift = 8; fmt.Bshift = 16; fmt.Ashift = 24;
fmt.Rshift = 0;
fmt.Gshift = 8;
fmt.Bshift = 16;
fmt.Ashift = 24;
#endif
fmt.Rmask = 255 << fmt.Rshift;
fmt.Gmask = 255 << fmt.Gshift;
@ -97,7 +97,7 @@ TexposHandle Textures::loadTexture(SDL_Surface* surface) {
if (!surface)
return 0; // should be some error, i guess
auto handle = reinterpret_cast<TexposHandle>(surface);
auto handle = reinterpret_cast<TexposHandle>(surface); // not the best way? but cheap
g_handle_to_surface.emplace(handle, surface);
surface->refcount++; // prevent destruct on next FreeSurface by game
auto texpos = add_texture(surface);
@ -121,8 +121,8 @@ std::vector<TexposHandle> Textures::loadTileset(const std::string& file,
int dimy = surface->h / tile_px_h;
for (int y = 0; y < dimy; y++) {
for (int x = 0; x < dimx; x++) {
SDL_Surface* tile = DFSDL_CreateRGBSurface(0, tile_px_w, tile_px_h, 32,
surface->format->Rmask, surface->format->Gmask,
SDL_Surface* tile = DFSDL_CreateRGBSurface(
0, tile_px_w, tile_px_h, 32, surface->format->Rmask, surface->format->Gmask,
surface->format->Bmask, surface->format->Amask);
SDL_Rect vp{tile_px_w * x, tile_px_h * y, tile_px_w, tile_px_h};
DFSDL_UpperBlit(surface, &vp, tile, NULL);
@ -154,6 +154,14 @@ long Textures::getTexposByHandle(TexposHandle handle) {
return -1;
}
long Textures::getAsset(const std::string asset, size_t index) {
if (!g_static_assets.contains(asset))
return -1;
if (g_static_assets[asset].size() <= index)
return -1;
return Textures::getTexposByHandle(g_static_assets[asset][index]);
}
static void reset_texpos() {
g_handle_to_texpos.clear();
}
@ -190,7 +198,7 @@ struct tracking_stage_adopt_region : df::viewscreen_adopt_regionst {
DEFINE_VMETHOD_INTERPOSE(void, logic, ()) {
if (this->m_cur_step != this->cur_step) {
this->m_cur_step = this->cur_step;
if (this->m_cur_step == df::viewscreen_adopt_regionst::T_cur_step::ProcessingRawData)
if (this->m_cur_step == 2)
reset_texpos();
}
INTERPOSE_NEXT(logic)();
@ -208,7 +216,7 @@ struct tracking_stage_load_region : df::viewscreen_loadgamest {
DEFINE_VMETHOD_INTERPOSE(void, logic, ()) {
if (this->m_cur_step != this->cur_step) {
this->m_cur_step = this->cur_step;
if (this->m_cur_step == df::viewscreen_loadgamest::T_cur_step::ProcessingRawData)
if (this->m_cur_step == 1)
reset_texpos();
}
INTERPOSE_NEXT(logic)();
@ -251,180 +259,19 @@ static void uninstall_reset_point() {
INTERPOSE_HOOK(tracking_stage_new_arena, logic).remove();
}
static size_t load_tiles_from_image(color_ostream& out, const char* fname,
long* texpos_start,
int tile_w = TILE_WIDTH_PX,
int tile_h = TILE_HEIGHT_PX) {
SDL_Surface* s = DFIMG_Load(fname);
if (!s) {
out.printerr("unable to load textures from '%s'\n", fname);
return 0;
}
s = canonicalize_format(s);
int dimx = s->w / tile_w;
int dimy = s->h / tile_h;
long count = 0;
for (int y = 0; y < dimy; y++) {
for (int x = 0; x < dimx; x++) {
SDL_Surface* tile = DFSDL_CreateRGBSurface(0, // SDL_SWSURFACE
tile_w, tile_h, 32,
s->format->Rmask, s->format->Gmask, s->format->Bmask,
s->format->Amask);
SDL_Rect vp;
vp.x = tile_w * x;
vp.y = tile_h * y;
vp.w = tile_w;
vp.h = tile_h;
DFSDL_UpperBlit(s, &vp, tile, NULL);
if (!count++)
*texpos_start = enabler->textures.raws.size();
enabler->textures.raws.push_back(tile);
}
}
DFSDL_FreeSurface(s);
DEBUG(textures,out).print("loaded %ld textures from '%s'\n", count, fname);
return count;
}
void Textures::initDynamic(color_ostream& out) {
void Textures::init(color_ostream& out) {
install_reset_point();
DEBUG(textures, out).print("dynamic texture reset points installed");
DEBUG(textures, out).print("dynamic texture loading ready");
for (auto& [key, value] : g_static_assets) {
g_static_assets[key] = Textures::loadTileset(key);
}
// DFHack could conceivably be loaded at any time, so we need to be able to
// handle loading textures before or after a world is loaded.
// If a world is already loaded, then append our textures to the raws. they'll
// be freed when the world is unloaded and we'll reload when we get to the title
// screen. If it's pre-world, append our textures and then adjust the "init"
// texture count so our textures will no longer be freed when worlds are
// unloaded.
//
void Textures::init(color_ostream& out) {
if (!enabler)
return;
auto& textures = enabler->textures;
long num_textures = textures.raws.size();
if (num_textures <= g_dfhack_logo_texpos_start)
g_loaded = false;
if (g_loaded)
return;
bool is_pre_world = num_textures == textures.init_texture_size;
g_num_dfhack_textures = load_tiles_from_image(out, "hack/data/art/dfhack.png",
&g_dfhack_logo_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/green-pin.png",
&g_green_pin_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/red-pin.png",
&g_red_pin_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/icons.png",
&g_icons_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/on-off.png",
&g_on_off_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/pathable.png",
&g_pathable_texpos_start, 32, 32);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/unsuspend.png",
&g_unsuspend_texpos_start, 32, 32);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/control-panel.png",
&g_control_panel_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/border-thin.png",
&g_thin_borders_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/border-medium.png",
&g_medium_borders_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/border-bold.png",
&g_bold_borders_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/border-panel.png",
&g_panel_borders_texpos_start);
g_num_dfhack_textures += load_tiles_from_image(out, "hack/data/art/border-window.png",
&g_window_borders_texpos_start);
DEBUG(textures,out).print("loaded %ld textures\n", g_num_dfhack_textures);
if (is_pre_world)
textures.init_texture_size += g_num_dfhack_textures;
// NOTE: when GL modes are supported, we'll have to re-upload textures here
g_loaded = true;
DEBUG(textures, out).print("assets loaded");
}
// It's ok to leave NULLs in the raws list (according to usage in g_src)
void Textures::cleanup() {
reset_texpos();
reset_surface();
uninstall_reset_point();
if (!g_loaded)
return;
auto& textures = enabler->textures;
auto& raws = textures.raws;
size_t texpos_end = g_dfhack_logo_texpos_start + g_num_dfhack_textures - 1;
for (size_t idx = g_dfhack_logo_texpos_start; idx <= texpos_end; ++idx) {
DFSDL_FreeSurface((SDL_Surface *)raws[idx]);
raws[idx] = NULL;
}
if (g_dfhack_logo_texpos_start == textures.init_texture_size - g_num_dfhack_textures)
textures.init_texture_size -= g_num_dfhack_textures;
g_loaded = false;
g_num_dfhack_textures = 0;
g_dfhack_logo_texpos_start = -1;
}
long Textures::getDfhackLogoTexposStart() {
return g_dfhack_logo_texpos_start;
}
long Textures::getGreenPinTexposStart() {
return g_green_pin_texpos_start;
}
long Textures::getRedPinTexposStart() {
return g_red_pin_texpos_start;
}
long Textures::getIconsTexposStart() {
return g_icons_texpos_start;
}
long Textures::getOnOffTexposStart() {
return g_on_off_texpos_start;
}
long Textures::getMapPathableTexposStart() {
return g_pathable_texpos_start;
}
long Textures::getMapUnsuspendTexposStart() {
return g_unsuspend_texpos_start;
}
long Textures::getControlPanelTexposStart() {
return g_control_panel_texpos_start;
}
long Textures::getThinBordersTexposStart() {
return g_thin_borders_texpos_start;
}
long Textures::getMediumBordersTexposStart() {
return g_medium_borders_texpos_start;
}
long Textures::getBoldBordersTexposStart() {
return g_bold_borders_texpos_start;
}
long Textures::getPanelBordersTexposStart() {
return g_panel_borders_texpos_start;
}
long Textures::getWindowBordersTexposStart() {
return g_window_borders_texpos_start;
}

@ -9,29 +9,30 @@ MINI_TEXT_PEN, MINI_TEXT_HPEN, MINI_BUTT_PEN, MINI_BUTT_HPEN = nil, nil, nil, ni
local to_pen = dfhack.pen.parse
local tp = function(base, offset)
if base == -1 then return nil end
return base + offset
local tp = function(asset, offset)
local texpos = dfhack.textures.getAsset(asset, offset)
if texpos == -1 then return nil end
return texpos
end
function reload_pens()
GOOD_TILE_PEN = to_pen{ch='o', fg=COLOR_GREEN, tile=dfhack.screen.findGraphicsTile('CURSORS', 1, 2)}
BAD_TILE_PEN = to_pen{ch='X', fg=COLOR_RED, tile=dfhack.screen.findGraphicsTile('CURSORS', 3, 0)}
local tb_texpos = dfhack.textures.getThinBordersTexposStart()
VERT_TOP_PEN = to_pen{tile=tp(tb_texpos, 10), ch=194, fg=COLOR_GREY, bg=COLOR_BLACK}
VERT_MID_PEN = to_pen{tile=tp(tb_texpos, 4), ch=179, fg=COLOR_GREY, bg=COLOR_BLACK}
VERT_BOT_PEN = to_pen{tile=tp(tb_texpos, 11), ch=193, fg=COLOR_GREY, bg=COLOR_BLACK}
local tb = "hack/data/art/border-thin.png"
VERT_TOP_PEN = to_pen { tile = tp(tb, 10), ch = 194, fg = COLOR_GREY, bg = COLOR_BLACK }
VERT_MID_PEN = to_pen { tile = tp(tb, 4), ch = 179, fg = COLOR_GREY, bg = COLOR_BLACK }
VERT_BOT_PEN = to_pen { tile = tp(tb, 11), ch = 193, fg = COLOR_GREY, bg = COLOR_BLACK }
local mb_texpos = dfhack.textures.getMediumBordersTexposStart()
HORI_LEFT_PEN = to_pen{tile=tp(mb_texpos, 12), ch=195, fg=COLOR_GREY, bg=COLOR_BLACK}
HORI_MID_PEN = to_pen{tile=tp(mb_texpos, 5), ch=196, fg=COLOR_GREY, bg=COLOR_BLACK}
HORI_RIGHT_PEN = to_pen{tile=tp(mb_texpos, 13), ch=180, fg=COLOR_GREY, bg=COLOR_BLACK}
local mb = "hack/data/art/border-medium.png"
HORI_LEFT_PEN = to_pen { tile = tp(mb, 12), ch = 195, fg = COLOR_GREY, bg = COLOR_BLACK }
HORI_MID_PEN = to_pen { tile = tp(mb, 5), ch = 196, fg = COLOR_GREY, bg = COLOR_BLACK }
HORI_RIGHT_PEN = to_pen { tile = tp(mb, 13), ch = 180, fg = COLOR_GREY, bg = COLOR_BLACK }
local cp_texpos = dfhack.textures.getControlPanelTexposStart()
BUTTON_START_PEN = to_pen{tile=tp(cp_texpos, 13), ch='[', fg=COLOR_YELLOW}
BUTTON_END_PEN = to_pen{tile=tp(cp_texpos, 15), ch=']', fg=COLOR_YELLOW}
SELECTED_ITEM_PEN = to_pen{tile=tp(cp_texpos, 9), ch=string.char(251), fg=COLOR_YELLOW}
local cp = "hack/data/art/control-panel.png"
BUTTON_START_PEN = to_pen { tile = tp(cp, 13), ch = '[', fg = COLOR_YELLOW }
BUTTON_END_PEN = to_pen { tile = tp(cp, 15), ch = ']', fg = COLOR_YELLOW }
SELECTED_ITEM_PEN = to_pen { tile = tp(cp, 9), ch = string.char(251), fg = COLOR_YELLOW }
MINI_TEXT_PEN = to_pen{fg=COLOR_BLACK, bg=COLOR_GREY}
MINI_TEXT_HPEN = to_pen{fg=COLOR_BLACK, bg=COLOR_WHITE}

@ -68,28 +68,30 @@ end
local dscreen = dfhack.screen
function HotspotMenuWidget:onRenderBody(dc)
local tpos = dfhack.textures.getDfhackLogoTexposStart()
local x, y = dc.x, dc.y
local tp = function(offset)
return dfhack.textures.getAsset("hack/data/art/dfhack.png", offset)
end
if tpos == -1 then
if tp(0) == -1 then
dscreen.paintString(COLOR_WHITE, x, y + 0, '!DF!')
dscreen.paintString(COLOR_WHITE, x, y + 1, '!Ha!')
dscreen.paintString(COLOR_WHITE, x, y + 2, '!ck!')
else
dscreen.paintTile(COLOR_WHITE, x+0, y+0, '!', tpos+0)
dscreen.paintTile(COLOR_WHITE, x+1, y+0, 'D', tpos+1)
dscreen.paintTile(COLOR_WHITE, x+2, y+0, 'F', tpos+2)
dscreen.paintTile(COLOR_WHITE, x+3, y+0, '!', tpos+3)
dscreen.paintTile(COLOR_WHITE, x+0, y+1, '!', tpos+4)
dscreen.paintTile(COLOR_WHITE, x+1, y+1, 'H', tpos+5)
dscreen.paintTile(COLOR_WHITE, x+2, y+1, 'a', tpos+6)
dscreen.paintTile(COLOR_WHITE, x+3, y+1, '!', tpos+7)
dscreen.paintTile(COLOR_WHITE, x+0, y+2, '!', tpos+8)
dscreen.paintTile(COLOR_WHITE, x+1, y+2, 'c', tpos+9)
dscreen.paintTile(COLOR_WHITE, x+2, y+2, 'k', tpos+10)
dscreen.paintTile(COLOR_WHITE, x+3, y+2, '!', tpos+11)
dscreen.paintTile(COLOR_WHITE, x + 0, y + 0, '!', tp(0))
dscreen.paintTile(COLOR_WHITE, x + 1, y + 0, 'D', tp(1))
dscreen.paintTile(COLOR_WHITE, x + 2, y + 0, 'F', tp(2))
dscreen.paintTile(COLOR_WHITE, x + 3, y + 0, '!', tp(3))
dscreen.paintTile(COLOR_WHITE, x + 0, y + 1, '!', tp(4))
dscreen.paintTile(COLOR_WHITE, x + 1, y + 1, 'H', tp(5))
dscreen.paintTile(COLOR_WHITE, x + 2, y + 1, 'a', tp(6))
dscreen.paintTile(COLOR_WHITE, x + 3, y + 1, '!', tp(7))
dscreen.paintTile(COLOR_WHITE, x + 0, y + 2, '!', tp(8))
dscreen.paintTile(COLOR_WHITE, x + 1, y + 2, 'c', tp(9))
dscreen.paintTile(COLOR_WHITE, x + 2, y + 2, 'k', tp(10))
dscreen.paintTile(COLOR_WHITE, x + 3, y + 2, '!', tp(11))
end
end

@ -44,10 +44,10 @@ static void paintScreenPathable(df::coord target, bool show_hidden = false) {
long pathable_tile_texpos = init->load_bar_texpos[1];
long unpathable_tile_texpos = init->load_bar_texpos[4];
long on_off_texpos = Textures::getMapPathableTexposStart();
long on_off_texpos = Textures::getAsset("hack/data/art/pathable.png", 0);
if (on_off_texpos > 0) {
pathable_tile_texpos = on_off_texpos + 0;
unpathable_tile_texpos = on_off_texpos + 1;
pathable_tile_texpos = on_off_texpos;
unpathable_tile_texpos = Textures::getAsset("hack/data/art/pathable.png", 1);
}
auto dims = Gui::getDwarfmodeViewDims().map();