From 711eb21d317eecba46ccfe3fb28a9ab5f0586455 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Mon, 26 May 2025 09:15:01 +0200 Subject: [PATCH] fixed some rock level rendering issues --- celldrawer.cpp | 18 ++++++++---------- flags.cpp | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/celldrawer.cpp b/celldrawer.cpp index b96809b7..6a063c7c 100644 --- a/celldrawer.cpp +++ b/celldrawer.cpp @@ -7,6 +7,7 @@ int coastvalEdge(cell *c); struct spatial_info { SIDE top, deep; int levels; + int sl; /* snake level */ }; struct celldrawer { @@ -25,7 +26,6 @@ struct celldrawer { char asciichar; shiftmatrix Vboat; shiftmatrix Vd; - int sl; spatial_info sha; color_t asciiborder; color_t asciicol1; @@ -1679,8 +1679,8 @@ void celldrawer::draw_features() { default: { wa_default: - if(sl && wmspatial) { - floorShadow(c, V, SHADOW_SL * sl); + if(sha.sl && wmspatial) { + floorShadow(c, V, SHADOW_SL * sha.sl); } else if(highwall(c)) draw_wall(); @@ -2467,8 +2467,8 @@ void celldrawer::draw_wall_full() { col1 = darkena(col1, fd, 255); } - if(lev >= int(SIDE::RED1) && lev <= int(SIDE::RED3) && sl) { - col1 = getSnakelevColor(lev - int(SIDE::RED1), sl); + if(lev >= int(SIDE::RED1) && lev <= int(SIDE::RED3) && sha.sl) { + col1 = getSnakelevColor(lev - int(SIDE::RED1), sha.sl); } if(placeSidewall(c, i, SIDE(lev), V, col1)) shab &= ~(1<monst))) { - if(WDIM == 2 && GDIM == 3 && abs(cgi.RED[sl] - cgi.FLOOR) > 1e-6) - pushdown(c, q, V, cgi.RED[sl] - cgi.FLOOR, false, false); + if(WDIM == 2 && GDIM == 3 && abs(cgi.RED[sha.sl] - cgi.FLOOR) > 1e-6) + pushdown(c, q, V, cgi.RED[sha.sl] - cgi.FLOOR, false, false); if(GDIM ==2 && abs(geom3::factor_to_lev(zlevel(tC0(Vboat.T)))) > 1e-6) pushdown(c, q, V, -geom3::factor_to_lev(zlevel(tC0(Vboat.T))), !isMultitile(c->monst), false); } @@ -2922,12 +2922,10 @@ void celldrawer::draw() { poly_outline = OUTLINE_DEFAULT; - sl = snakelevel(c); - Vd = WDIM == 3 ? V: !wmspatial ? V : - sl ? orthogonal_move_fol(V, GDIM == 3 ? cgi.RED[sl] - cgi.FLOOR : cgi.RED[sl]) : + sha.sl ? orthogonal_move_fol(V, GDIM == 3 ? cgi.RED[sha.sl] - cgi.FLOOR : cgi.RED[sha.sl]) : (highwall(c) && GDIM == 2) ? orthogonal_move_fol(V, (1+cgi.WALL)/2) : #if CAP_SHAPES (sha.top < SIDE::FLOOR) ? orthogonal_move_fol(V, GDIM == 3 ? cgi.WATERLEVEL - cgi.FLOOR : cgi.WATERLEVEL) : diff --git a/flags.cpp b/flags.cpp index 7e8db343..457e4f3b 100644 --- a/flags.cpp +++ b/flags.cpp @@ -348,29 +348,29 @@ EX bool highwall(cell *c) { EX spatial_info get_spatial_info(cell *c) { #define F(x) Flag((int) SIDE::x) if(cellUnstable(c)) - return spatial_info{SIDE::FLOOR, SIDE::FLOOR, 0}; + return spatial_info{SIDE::FLOOR, SIDE::FLOOR, 0, 0}; if(c->wall == waChasm || c->wall == waInvisibleFloor) - return spatial_info{SIDE::INFDEEP, SIDE::INFDEEP, 0}; + return spatial_info{SIDE::INFDEEP, SIDE::INFDEEP, 0, 0}; if(c->wall == waBarrier && wmescher && c->land == laOceanWall) - return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(DEEP)}; + return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(DEEP), 0}; if(c->wall == waReptile) - return spatial_info{SIDE::FLOOR, SIDE::FLOOR, F(FLOOR) | F(DEEP)}; + return spatial_info{SIDE::FLOOR, SIDE::FLOOR, F(FLOOR) | F(DEEP), 0}; if(c->wall == waShallow) - return spatial_info{SIDE::WATERLEVEL, SIDE::SHALLOW, F(SHALLOW) | F(DEEP)}; + return spatial_info{SIDE::WATERLEVEL, SIDE::SHALLOW, F(SHALLOW) | F(DEEP), 0}; if(isWateryOrBoat(c) || isChasmy(c)) - return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(DEEP)}; + return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(DEEP), 0}; if(among(c->wall, waReptileBridge, waGargoyleFloor, waGargoyleBridge, waTempFloor, waTempBridge, waPetrifiedBridge, waFrozenLake)) - return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(WATERLEVEL) | F(DEEP)}; + return spatial_info{SIDE::WATERLEVEL, SIDE::DEEP, F(WATERLEVEL) | F(DEEP), 0}; int slev = snakelevel(c); if(slev == 1) - return spatial_info{SIDE::RED1, SIDE::RED1, F(RED1) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)}; + return spatial_info{SIDE::RED1, SIDE::RED1, F(RED1) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP), 1}; if(slev == 2) - return spatial_info{SIDE::RED2, SIDE::RED2, F(RED1) | F(RED2) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)}; + return spatial_info{SIDE::RED2, SIDE::RED2, F(RED1) | F(RED2) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP), 2}; if(slev == 3) - return spatial_info{SIDE::RED3, SIDE::RED3, F(RED1) | F(RED2) | F(RED3) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)}; + return spatial_info{SIDE::RED3, SIDE::RED3, F(RED1) | F(RED2) | F(RED3) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP), 3}; if(highwall(c) && !conegraph(c) && c->wall != waRose) - return spatial_info{SIDE::WALL, SIDE::WALL, F(WALL) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)}; - return spatial_info{SIDE::FLOOR, SIDE::FLOOR, F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP)}; + return spatial_info{SIDE::WALL, SIDE::WALL, F(WALL) | F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP), 0}; + return spatial_info{SIDE::FLOOR, SIDE::FLOOR, F(FLOOR) | F(WATERLEVEL) | F(SHALLOW) | F(DEEP), 0}; #undef F }