syncronized staircases on multiple levels and removed elevators as redundant

This commit is contained in:
grimsace
2026-04-27 10:57:31 -05:00
parent 182e2fe0a9
commit 277f8f5391
5 changed files with 225 additions and 163 deletions
+16 -35
View File
@@ -826,51 +826,32 @@ pub fn build_svg(layout: &DungeonLayout, settings: &UiSettings) -> String {
settings.colorblind_mode,
);
// Draw stairs and elevators.
// Draw stairs.
for stair in &layout.stairs {
let x = g.left() + stair.cell.0 as f32 * g.cell;
let y = g.top() + stair.cell.1 as f32 * g.cell;
let w = stair.size as f32 * g.cell;
let h = stair.size as f32 * g.cell;
if stair.is_elevator {
let fill = if settings.colorblind_mode {
"rgb(180,180,180)"
} else {
"rgb(100,150,200)"
};
let _ = writeln!(
s,
"<rect x='{x}' y='{y}' width='{w}' height='{h}' fill='{fill}' fill-opacity='0.35' stroke='rgb(100,150,200)' stroke-width='2'/>"
);
let _ = writeln!(
s,
"<text x='{cx}' y='{cy}' text-anchor='middle' dominant-baseline='middle' fill='white' font-size='{fs}'>E</text>",
cx = x + w / 2.0,
cy = y + h / 2.0,
fs = (g.cell * stair.size as f32 * 0.4).clamp(14.0, 48.0)
);
let fill = if settings.colorblind_mode {
"rgb(180,180,180)"
} else {
let fill = if settings.colorblind_mode {
"rgb(180,180,180)"
} else {
"rgb(200,150,50)"
};
"rgb(200,150,50)"
};
let _ = writeln!(
s,
"<rect x='{x}' y='{y}' width='{w}' height='{h}' fill='{fill}' fill-opacity='0.35' stroke='rgb(150,100,30)' stroke-width='2'/>"
);
let steps = (stair.size as f32 * 2.0).round() as usize;
let step_h = h / steps as f32;
for i in 0..steps {
let sy = y + (i as f32 * step_h) + step_h * 0.5;
let _ = writeln!(
s,
"<rect x='{x}' y='{y}' width='{w}' height='{h}' fill='{fill}' fill-opacity='0.35' stroke='rgb(150,100,30)' stroke-width='2'/>"
"<line x1='{x1}' y1='{sy}' x2='{x2}' y2='{sy}' stroke='rgb(150,100,30)' stroke-width='1.5'/>",
x1 = x + 2.0,
x2 = x + w - 2.0
);
let steps = (stair.size as f32 * 2.0).round() as usize;
let step_h = h / steps as f32;
for i in 0..steps {
let sy = y + (i as f32 * step_h) + step_h * 0.5;
let _ = writeln!(
s,
"<line x1='{x1}' y1='{sy}' x2='{x2}' y2='{sy}' stroke='rgb(150,100,30)' stroke-width='1.5'/>",
x1 = x + 2.0,
x2 = x + w - 2.0
);
}
}
}