Merge pull request #2747 from myk002/myk_on_off

Add new on/off icons
develop
Myk 2023-01-29 16:55:01 -08:00 committed by GitHub
commit 274e995790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

@ -1693,6 +1693,7 @@ static const LuaWrapper::FunctionReg dfhack_textures_module[] = {
WRAPM(Textures, getGreenPinTexposStart),
WRAPM(Textures, getRedPinTexposStart),
WRAPM(Textures, getIconsTexposStart),
WRAPM(Textures, getOnOffTexposStart),
WRAPM(Textures, getThinBordersTexposStart),
WRAPM(Textures, getMediumBordersTexposStart),
WRAPM(Textures, getPanelBordersTexposStart),

@ -41,6 +41,11 @@ DFHACK_EXPORT long getRedPinTexposStart();
*/
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 DFHack borders. Each is a 7x3 grid.
*/

@ -22,6 +22,7 @@ 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_thin_borders_texpos_start = -1;
static long g_medium_borders_texpos_start = -1;
static long g_panel_borders_texpos_start = -1;
@ -124,6 +125,8 @@ void Textures::init(color_ostream &out) {
&g_red_pin_texpos_start);
g_num_dfhack_textures += load_textures(out, "hack/data/art/icons.png",
&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/border-thin.png",
&g_thin_borders_texpos_start);
g_num_dfhack_textures += load_textures(out, "hack/data/art/border-medium.png",
@ -180,6 +183,10 @@ long Textures::getIconsTexposStart() {
return g_icons_texpos_start;
}
long Textures::getOnOffTexposStart() {
return g_on_off_texpos_start;
}
long Textures::getThinBordersTexposStart() {
return g_thin_borders_texpos_start;
}

@ -1,6 +1,7 @@
#include "modules/Gui.h"
#include "modules/Maps.h"
#include "modules/Screen.h"
#include "modules/Textures.h"
#include "Debug.h"
#include "LuaTools.h"
@ -38,6 +39,11 @@ static void paintScreen(df::coord target, bool skip_unrevealed = false) {
long pathable_tile_texpos = 779;
long unpathable_tile_texpos = 782;
long on_off_texpos = Textures::getOnOffTexposStart();
if (on_off_texpos > 0) {
pathable_tile_texpos = on_off_texpos + 0;
unpathable_tile_texpos = on_off_texpos + 1;
}
auto dims = Gui::getDwarfmodeViewDims().map();
for (int y = dims.first.y; y <= dims.second.y; ++y) {