Merge pull request #3387 from myk002/myk_classic

Dynamically look up texture values instead of assuming they're constant
develop
Myk 2023-05-17 11:52:41 -07:00 committed by GitHub
commit c38e5e65e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 25 deletions

@ -44,6 +44,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `work-now`: reinstated, renamed from ``workNow``: reduce the time that dwarves are left without a task after completing a job - `work-now`: reinstated, renamed from ``workNow``: reduce the time that dwarves are left without a task after completing a job
## Fixes ## Fixes
- DFHack screen backgrounds now use appropriate tiles in DF Classic
- RemoteServer: fix crash on malformed json in ``dfhack-config/remote-server.json`` - RemoteServer: fix crash on malformed json in ``dfhack-config/remote-server.json``
- `autolabor`: work detail override warning now only appears on the work details screen - `autolabor`: work detail override warning now only appears on the work details screen

@ -9,7 +9,7 @@ local getval = utils.getval
local to_pen = dfhack.pen.parse local to_pen = dfhack.pen.parse
CLEAR_PEN = to_pen{tile=909, ch=32, fg=0, bg=0, write_to_lower=true} CLEAR_PEN = to_pen{tile=df.global.init.texpos_border_interior, ch=32, fg=0, bg=0, write_to_lower=true}
TRANSPARENT_PEN = to_pen{tile=0, ch=0} TRANSPARENT_PEN = to_pen{tile=0, ch=0}
KEEP_LOWER_PEN = to_pen{ch=32, fg=0, bg=0, keep_lower=true} KEEP_LOWER_PEN = to_pen{ch=32, fg=0, bg=0, keep_lower=true}

@ -853,7 +853,7 @@ local function scrollbar_is_visible(scrollbar)
return scrollbar.elems_per_page < scrollbar.num_elems return scrollbar.elems_per_page < scrollbar.num_elems
end end
local SBSO = 922 --Scroll Bar Spritesheet Offset / change this to point to a different spritesheet (ui themes, anyone? :p) local SBSO = df.global.init.scrollbar_texpos[0] --Scroll Bar Spritesheet Offset / change this to point to a different spritesheet (ui themes, anyone? :p)
local SCROLLBAR_UP_LEFT_PEN = to_pen{tile=SBSO+0, ch=47, fg=COLOR_CYAN, bg=COLOR_BLACK} local SCROLLBAR_UP_LEFT_PEN = to_pen{tile=SBSO+0, ch=47, fg=COLOR_CYAN, bg=COLOR_BLACK}
local SCROLLBAR_UP_RIGHT_PEN = to_pen{tile=SBSO+1, ch=92, fg=COLOR_CYAN, bg=COLOR_BLACK} local SCROLLBAR_UP_RIGHT_PEN = to_pen{tile=SBSO+1, ch=92, fg=COLOR_CYAN, bg=COLOR_BLACK}
local SCROLLBAR_DOWN_LEFT_PEN = to_pen{tile=SBSO+24, ch=92, fg=COLOR_CYAN, bg=COLOR_BLACK} local SCROLLBAR_DOWN_LEFT_PEN = to_pen{tile=SBSO+24, ch=92, fg=COLOR_CYAN, bg=COLOR_BLACK}
@ -2149,34 +2149,35 @@ function FilteredList:onFilterChar(char, text)
return true return true
end end
local TSO = df.global.init.tabs_texpos[0] -- tab spritesheet offset
local DEFAULT_ACTIVE_TAB_PENS = { local DEFAULT_ACTIVE_TAB_PENS = {
text_mode_tab_pen=to_pen{fg=COLOR_YELLOW}, text_mode_tab_pen=to_pen{fg=COLOR_YELLOW},
text_mode_label_pen=to_pen{fg=COLOR_WHITE}, text_mode_label_pen=to_pen{fg=COLOR_WHITE},
lt=to_pen{tile=1005, write_to_lower=true}, lt=to_pen{tile=TSO+5, write_to_lower=true},
lt2=to_pen{tile=1006, write_to_lower=true}, lt2=to_pen{tile=TSO+6, write_to_lower=true},
t=to_pen{tile=1007, fg=COLOR_BLACK, write_to_lower=true, top_of_text=true}, t=to_pen{tile=TSO+7, fg=COLOR_BLACK, write_to_lower=true, top_of_text=true},
rt2=to_pen{tile=1008, write_to_lower=true}, rt2=to_pen{tile=TSO+8, write_to_lower=true},
rt=to_pen{tile=1009, write_to_lower=true}, rt=to_pen{tile=TSO+9, write_to_lower=true},
lb=to_pen{tile=1015, write_to_lower=true}, lb=to_pen{tile=TSO+15, write_to_lower=true},
lb2=to_pen{tile=1016, write_to_lower=true}, lb2=to_pen{tile=TSO+16, write_to_lower=true},
b=to_pen{tile=1017, fg=COLOR_BLACK, write_to_lower=true, bottom_of_text=true}, b=to_pen{tile=TSO+17, fg=COLOR_BLACK, write_to_lower=true, bottom_of_text=true},
rb2=to_pen{tile=1018, write_to_lower=true}, rb2=to_pen{tile=TSO+18, write_to_lower=true},
rb=to_pen{tile=1019, write_to_lower=true}, rb=to_pen{tile=TSO+19, write_to_lower=true},
} }
local DEFAULT_INACTIVE_TAB_PENS = { local DEFAULT_INACTIVE_TAB_PENS = {
text_mode_tab_pen=to_pen{fg=COLOR_BROWN}, text_mode_tab_pen=to_pen{fg=COLOR_BROWN},
text_mode_label_pen=to_pen{fg=COLOR_DARKGREY}, text_mode_label_pen=to_pen{fg=COLOR_DARKGREY},
lt=to_pen{tile=1000, write_to_lower=true}, lt=to_pen{tile=TSO+0, write_to_lower=true},
lt2=to_pen{tile=1001, write_to_lower=true}, lt2=to_pen{tile=TSO+1, write_to_lower=true},
t=to_pen{tile=1002, fg=COLOR_WHITE, write_to_lower=true, top_of_text=true}, t=to_pen{tile=TSO+2, fg=COLOR_WHITE, write_to_lower=true, top_of_text=true},
rt2=to_pen{tile=1003, write_to_lower=true}, rt2=to_pen{tile=TSO+3, write_to_lower=true},
rt=to_pen{tile=1004, write_to_lower=true}, rt=to_pen{tile=TSO+4, write_to_lower=true},
lb=to_pen{tile=1010, write_to_lower=true}, lb=to_pen{tile=TSO+10, write_to_lower=true},
lb2=to_pen{tile=1011, write_to_lower=true}, lb2=to_pen{tile=TSO+11, write_to_lower=true},
b=to_pen{tile=1012, fg=COLOR_WHITE, write_to_lower=true, bottom_of_text=true}, b=to_pen{tile=TSO+12, fg=COLOR_WHITE, write_to_lower=true, bottom_of_text=true},
rb2=to_pen{tile=1013, write_to_lower=true}, rb2=to_pen{tile=TSO+13, write_to_lower=true},
rb=to_pen{tile=1014, write_to_lower=true}, rb=to_pen{tile=TSO+14, write_to_lower=true},
} }
--------- ---------

@ -209,7 +209,7 @@ static bool doSetTile_default(const Pen &pen, int x, int y, bool map)
} }
} else if (pen.ch) { } else if (pen.ch) {
screen[0] = uint8_t(pen.ch); screen[0] = uint8_t(pen.ch);
*texpos_lower = 909; // basic black background *texpos_lower = df::global::init->texpos_border_interior; // basic black background
} }
auto rgb_fg = &gps->uccolor[fg][0]; auto rgb_fg = &gps->uccolor[fg][0];

@ -7,6 +7,8 @@
#include "LuaTools.h" #include "LuaTools.h"
#include "PluginManager.h" #include "PluginManager.h"
#include "df/init.h"
using namespace DFHack; using namespace DFHack;
DFHACK_PLUGIN("pathable"); DFHACK_PLUGIN("pathable");
@ -37,8 +39,8 @@ static void paintScreen(df::coord target, bool skip_unrevealed = false) {
int selected_tile_texpos = 0; int selected_tile_texpos = 0;
Screen::findGraphicsTile("CURSORS", 4, 3, &selected_tile_texpos); Screen::findGraphicsTile("CURSORS", 4, 3, &selected_tile_texpos);
long pathable_tile_texpos = 779; long pathable_tile_texpos = df::global::init->load_bar_texpos[1];
long unpathable_tile_texpos = 782; long unpathable_tile_texpos = df::global::init->load_bar_texpos[4];
long on_off_texpos = Textures::getOnOffTexposStart(); long on_off_texpos = Textures::getOnOffTexposStart();
if (on_off_texpos > 0) { if (on_off_texpos > 0) {
pathable_tile_texpos = on_off_texpos + 0; pathable_tile_texpos = on_off_texpos + 0;