|
From: <gi...@cr...> - 2025-12-03 08:15:14
|
via c1c35e67119de8586bf5552ab7b108d2757b6898 (commit)
from 38ba4db094337e1656c5d6577936044ed2359221 (commit)
-----------------------------------------------------------------------
commit c1c35e67119de8586bf5552ab7b108d2757b6898
Author: Isaac Clancy <ik...@ya...>
Date: Wed Dec 3 20:45:27 2025 +1300
Don't special case handling of green water
Instead, use the same colour override code used for other tiles to
select the correct tiles for green and light green water.
-----------------------------------------------------------------------
Summary of changes:
crawl-ref/source/rltiles/dc-floor.txt | 8 +++++++
.../source/rltiles/tool/tile_list_processor.cc | 13 ++++-------
.../source/rltiles/tool/tile_list_processor.h | 9 ++++++--
crawl-ref/source/tilecell.cc | 16 +++-----------
crawl-ref/source/tilepick.cc | 25 +++-------------------
5 files changed, 25 insertions(+), 46 deletions(-)
diff --git a/crawl-ref/source/rltiles/dc-floor.txt b/crawl-ref/source/rltiles/dc-floor.txt
index f4d888b72b..663b51e3f5 100644
--- a/crawl-ref/source/rltiles/dc-floor.txt
+++ b/crawl-ref/source/rltiles/dc-floor.txt
@@ -1246,14 +1246,20 @@ shallow_water DNGN_SHALLOW_WATER
shallow_water2
shallow_water_disturbance DNGN_SHALLOW_WATER_DISTURBANCE
shallow_water_disturbance2
+%variation DNGN_DEEP_WATER green
+%variation DNGN_DEEP_WATER lightgreen
%weight 2
deep_water_murky DNGN_DEEP_WATER_MURKY
%weight 1
deep_water_murky2
+%variation DNGN_SHALLOW_WATER green
+%variation DNGN_SHALLOW_WATER lightgreen
%weight 3
shallow_water_murky DNGN_SHALLOW_WATER_MURKY
%weight 1
shallow_water_murky2
+%variation DNGN_SHALLOW_WATER_DISTURBANCE green
+%variation DNGN_SHALLOW_WATER_DISTURBANCE lightgreen
shallow_water_murky_disturbance DNGN_SHALLOW_WATER_MURKY_DISTURBANCE
shallow_water_murky_disturbance2
%weight 120
@@ -1293,6 +1299,8 @@ shallow_bord_bl DNGN_WAVE_SW
shallow_bord_lft DNGN_WAVE_W
shallow_bord_tl DNGN_WAVE_NW
+%variation DNGN_WAVE_N green
+%variation DNGN_WAVE_N lightgreen
murky_bord_top MURKY_WAVE_N
murky_bord_tr MURKY_WAVE_NE
murky_bord_rgt MURKY_WAVE_E
diff --git a/crawl-ref/source/rltiles/tool/tile_list_processor.cc b/crawl-ref/source/rltiles/tool/tile_list_processor.cc
index 275956007d..820b9f31e8 100644
--- a/crawl-ref/source/rltiles/tool/tile_list_processor.cc
+++ b/crawl-ref/source/rltiles/tool/tile_list_processor.cc
@@ -22,8 +22,6 @@ tile_list_processor::tile_list_processor() :
m_start_value("0"),
m_start_value_module(""),
m_texture(0),
- m_variation_idx(-1),
- m_variation_col(-1),
m_weight(1),
m_alpha(0.0),
m_domino(0)
@@ -733,8 +731,7 @@ bool tile_list_processor::process_line(char *read_line, const char *list_file,
return false;
}
- m_variation_idx = idx;
- m_variation_col = colour;
+ m_variations.push_back(variation{idx, colour});
}
else if (strcmp(arg, "reset_mirror") == 0)
{
@@ -935,11 +932,9 @@ void tile_list_processor::add_image(tile &img, const char *enumname)
if (!m_categories.empty())
m_ctg_counts[m_categories.size()-1]++;
- if (m_variation_idx != -1)
- {
- m_page.add_variation(m_last_enum, m_variation_idx, m_variation_col);
- m_variation_idx = -1;
- }
+ for (variation v : m_variations)
+ m_page.add_variation(m_last_enum, v.idx, v.col);
+ m_variations.clear();
}
void tile_list_processor::add_abstracts(
diff --git a/crawl-ref/source/rltiles/tool/tile_list_processor.h b/crawl-ref/source/rltiles/tool/tile_list_processor.h
index 738e0ada71..570bc07ac9 100644
--- a/crawl-ref/source/rltiles/tool/tile_list_processor.h
+++ b/crawl-ref/source/rltiles/tool/tile_list_processor.h
@@ -30,6 +30,12 @@ protected:
const vector<string> &uc_max_enum,
bool is_js = false);
+ struct variation
+ {
+ int idx;
+ int col;
+ };
+
string m_name;
tile_page m_page;
@@ -53,8 +59,7 @@ protected:
vector<int> m_ctg_counts;
tile m_compose;
tile* m_texture;
- int m_variation_idx;
- int m_variation_col;
+ vector<variation> m_variations;
int m_weight;
double m_alpha;
int m_domino;
diff --git a/crawl-ref/source/tilecell.cc b/crawl-ref/source/tilecell.cc
index 425521f751..6fb1c49eb9 100644
--- a/crawl-ref/source/tilecell.cc
+++ b/crawl-ref/source/tilecell.cc
@@ -395,16 +395,6 @@ static bool _is_seen_shallow(coord_def gc, crawl_view_buffer& vbuf)
return feat == DNGN_SHALLOW_WATER || feat == DNGN_MANGROVE;
}
-static tileidx_t _base_wave_tile(colour_t colour)
-{
- switch (colour)
- {
- case BLACK: return TILE_DNGN_WAVE_N;
- case GREEN: return TILE_MURKY_WAVE_N;
- default: die("no %s deep water wave tiles", colour_to_str(colour).c_str());
- }
-}
-
static void _pack_default_waves(const coord_def &gc, crawl_view_buffer& vbuf)
{
auto& cell = vbuf(gc).tile;
@@ -420,10 +410,10 @@ static void _pack_default_waves(const coord_def &gc, crawl_view_buffer& vbuf)
if (!feat_is_water(feat) && !feat_is_lava(feat))
return;
- if (feat == DNGN_DEEP_WATER && (colour == BLACK || colour == GREEN))
+ if (feat == DNGN_DEEP_WATER)
{
// +7 and -- reverse the iteration order
- int tile = _base_wave_tile(colour) + 7;
+ int tile = tile_dngn_coloured(TILE_DNGN_WAVE_N, colour) + 7;
for (adjacent_iterator ai(gc); ai; ++ai, --tile)
{
if (ai->x < 0 || ai->x >= vbuf.size().x || ai->y < 0 || ai->y >= vbuf.size().y)
@@ -437,7 +427,7 @@ static void _pack_default_waves(const coord_def &gc, crawl_view_buffer& vbuf)
bool west = _is_seen_land(coord_def(gc.x - 1, gc.y), vbuf);
bool east = _is_seen_land(coord_def(gc.x + 1, gc.y), vbuf);
- if (north || west || east && (colour == BLACK || colour == LIGHTGREEN))
+ if (north || west || east)
{
if (north)
cell.add_overlay(TILE_SHORE_N);
diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc
index 47102a98d5..46f2753640 100644
--- a/crawl-ref/source/tilepick.cc
+++ b/crawl-ref/source/tilepick.cc
@@ -995,30 +995,11 @@ static tileidx_t _tileidx_feature_no_overrides(const coord_def &gc)
case DNGN_ENTER_SHOP:
return tileidx_shop(shop_at(gc));
- case DNGN_DEEP_WATER:
- if (env.map_knowledge(gc).feat_colour() == GREEN
- || env.map_knowledge(gc).feat_colour() == LIGHTGREEN)
- {
- return TILE_DNGN_DEEP_WATER_MURKY;
- }
- return TILE_DNGN_DEEP_WATER;
case DNGN_SHALLOW_WATER:
- {
- tileidx_t t = TILE_DNGN_SHALLOW_WATER;
- if (env.map_knowledge(gc).feat_colour() == GREEN
- || env.map_knowledge(gc).feat_colour() == LIGHTGREEN)
- {
- t = TILE_DNGN_SHALLOW_WATER_MURKY;
- }
-
- if (env.map_knowledge(gc).invisible_monster())
- {
- // Add disturbance to tile.
- t += tile_dngn_count(t);
- }
+ if (env.map_knowledge(gc).invisible_monster())
+ return TILE_DNGN_SHALLOW_WATER_DISTURBANCE;
+ return TILE_DNGN_SHALLOW_WATER;
- return t;
- }
default:
return tileidx_feature_base(feat);
}
--
Dungeon Crawl Stone Soup
|