alternate drawing designation and priority

develop
Myk Taylor 2023-09-10 12:29:31 -07:00
parent 24b27c79b6
commit a02d14bb5f
No known key found for this signature in database
1 changed files with 28 additions and 4 deletions

@ -11,6 +11,7 @@
#include "df/init.h"
#include "df/map_block.h"
#include "df/tile_designation.h"
#include "df/block_square_event_designation_priorityst.h"
#include <functional>
@ -276,12 +277,35 @@ static bool blink(int delay) {
return (Core::getInstance().p->getTickCount()/delay) % 2 == 0;
}
static char get_tile_char(const df::coord &pos, char desig_char, bool draw_priority) {
if (!draw_priority)
return desig_char;
std::vector<df::block_square_event_designation_priorityst *> priorities;
Maps::SortBlockEvents(Maps::getTileBlock(pos), NULL, NULL, NULL, NULL, NULL, NULL, NULL, &priorities);
if (priorities.empty())
return '4';
switch (priorities[0]->priority[pos.x % 16][pos.y % 16] / 1000) {
case 1: return '1';
case 2: return '2';
case 3: return '3';
case 4: return '4';
case 5: return '5';
case 6: return '6';
case 7: return '7';
default:
return '0';
}
}
static void paintScreenCarve() {
DEBUG(log).print("entering paintScreenCarve\n");
if (Screen::inGraphicsMode() || blink(500))
return;
bool draw_priority = blink(1000);
auto dims = Gui::getDwarfmodeViewDims().map();
for (int y = dims.first.y; y <= dims.second.y; ++y) {
for (int x = dims.first.x; x <= dims.second.x; ++x) {
@ -303,15 +327,15 @@ static void paintScreenCarve() {
if (is_designated_for_smoothing(map_pos)) {
if (is_smooth_wall(map_pos))
cur_tile.ch = (char)206; // hash, indicating a fortification designation
cur_tile.ch = get_tile_char(map_pos, 206, draw_priority); // hash, indicating a fortification designation
else
cur_tile.ch = (char)219; // solid block, indicating a smoothing designation
cur_tile.ch = get_tile_char(map_pos, 219, draw_priority); // solid block, indicating a smoothing designation
}
else if (is_designated_for_engraving(map_pos)) {
cur_tile.ch = (char)10; // solid block with a circle on it
cur_tile.ch = get_tile_char(map_pos, 10, draw_priority); // solid block with a circle on it
}
else if (is_designated_for_track_carving(map_pos)) {
cur_tile.ch = get_track_char(map_pos); // directional track
cur_tile.ch = get_tile_char(map_pos, get_track_char(map_pos), draw_priority); // directional track
}
else {
TRACE(log).print("skipping tile with no carving designation\n");