diff --git a/data/art/pathable.png b/data/art/pathable.png new file mode 100644 index 000000000..00f7f831d Binary files /dev/null and b/data/art/pathable.png differ diff --git a/library/include/modules/Textures.h b/library/include/modules/Textures.h index 95e628d5a..8aa43e5c1 100644 --- a/library/include/modules/Textures.h +++ b/library/include/modules/Textures.h @@ -46,6 +46,11 @@ DFHACK_EXPORT long getIconsTexposStart(); */ DFHACK_EXPORT long getOnOffTexposStart(); +/** + * Get the first texpos for the pathable 32x32 sprites. It's a 2x1 grid. + */ +DFHACK_EXPORT long getPathableTexposStart(); + /** * Get the first texpos for the control panel icons. 10x2 grid. */ diff --git a/library/modules/Textures.cpp b/library/modules/Textures.cpp index e31e37426..6cc262764 100644 --- a/library/modules/Textures.cpp +++ b/library/modules/Textures.cpp @@ -25,6 +25,7 @@ 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_control_panel_texpos_start = -1; static long g_thin_borders_texpos_start = -1; static long g_medium_borders_texpos_start = -1; @@ -74,7 +75,9 @@ const uint32_t TILE_WIDTH_PX = 8; const uint32_t TILE_HEIGHT_PX = 12; static size_t load_textures(color_ostream & out, const char * fname, - long *texpos_start) { + 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); @@ -82,20 +85,20 @@ static size_t load_textures(color_ostream & out, const char * fname, } s = canonicalize_format(s); - int dimx = s->w / TILE_WIDTH_PX; - int dimy = s->h / TILE_HEIGHT_PX; + 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_WIDTH_PX, TILE_HEIGHT_PX, 32, + tile_w, tile_h, 32, s->format->Rmask, s->format->Gmask, s->format->Bmask, s->format->Amask); SDL_Rect vp; - vp.x = TILE_WIDTH_PX * x; - vp.y = TILE_HEIGHT_PX * y; - vp.w = TILE_WIDTH_PX; - vp.h = TILE_HEIGHT_PX; + 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(); @@ -137,6 +140,8 @@ void Textures::init(color_ostream &out) { &g_icons_texpos_start); g_num_dfhack_textures += load_textures(out, "hack/data/art/on-off.png", &g_on_off_texpos_start); + g_num_dfhack_textures += load_textures(out, "hack/data/art/pathable.png", + &g_pathable_texpos_start, 32, 32); g_num_dfhack_textures += load_textures(out, "hack/data/art/control-panel.png", &g_control_panel_texpos_start); g_num_dfhack_textures += load_textures(out, "hack/data/art/border-thin.png", @@ -201,6 +206,10 @@ long Textures::getOnOffTexposStart() { return g_on_off_texpos_start; } +long Textures::getPathableTexposStart() { + return g_pathable_texpos_start; +} + long Textures::getControlPanelTexposStart() { return g_control_panel_texpos_start; } diff --git a/plugins/pathable.cpp b/plugins/pathable.cpp index 06394f838..916db4a72 100644 --- a/plugins/pathable.cpp +++ b/plugins/pathable.cpp @@ -41,7 +41,7 @@ static void paintScreen(df::coord target, bool skip_unrevealed = false) { long pathable_tile_texpos = df::global::init->load_bar_texpos[1]; long unpathable_tile_texpos = df::global::init->load_bar_texpos[4]; - long on_off_texpos = Textures::getOnOffTexposStart(); + long on_off_texpos = Textures::getPathableTexposStart(); if (on_off_texpos > 0) { pathable_tile_texpos = on_off_texpos + 0; unpathable_tile_texpos = on_off_texpos + 1;