Unit rings and shadows lie on bridge decks; beds appear only once their creature has set them up

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-04 06:17:22 +01:00
1 parent 80982b71f7
commit 468fa03db9
2 files changed
+16 -5

No files matched your search

+2 -1
View File
@@ -46,7 +46,8 @@ fn usage(g: &Game) -> Use {
if e.captive == 3 {
u.tortured.insert(e.tile());
}
if !e.hero || e.captive == 0 {
// the bed only stands once its owner has set it up (it is reserved earlier)
if (!e.hero || e.captive == 0) && e.settled {
u.beds.insert(e.id + 1, e.kind);
}
}
+14 -4
View File
@@ -1354,7 +1354,7 @@ fn draw_gear_glow(g: &Game, cam: &Cam, t: f32) {
line3(base + vec3(a0.cos() * 0.12, y, a0.sin() * 0.12), base + vec3(a1.cos() * 0.12, y, a1.sin() * 0.12), 0.025, c);
}
if e.level >= 10 {
disc(vec3(e.x, 0.015, e.y), 0.42 + 0.03 * (t * 3.0).sin(), Color::new(c.r, c.g, c.b, 0.18), 16);
disc(vec3(e.x, floor_y(g, e.x, e.y) + 0.015, e.y), 0.42 + 0.03 * (t * 3.0).sin(), Color::new(c.r, c.g, c.b, 0.18), 16);
}
}
}
@@ -2027,13 +2027,23 @@ fn draw_landmarks_glow(g: &Game, t: f32, cam_r: Vec3) {
}
}
// height of the walkable surface (bridge decks lie above the floor)
fn floor_y(g: &Game, x: f32, z: f32) -> f32 {
if g.map.get(x as i32, z as i32).map_or(false, |t| t.bridge()) {
DECK_Y
} else {
0.0
}
}
fn draw_shadows(g: &Game) {
for e in &g.ents {
if !e.alive || e.held {
continue;
}
let r = if matches!(e.kind, EK::Ogre | EK::Paladin | EK::Jailer | EK::Chainbreaker) { 0.32 } else { 0.24 };
disc(vec3(e.x, 0.012, e.y), r, Color::new(0.0, 0.0, 0.0, 0.4), 12);
let fy = floor_y(g, e.x, e.y);
disc(vec3(e.x, fy + 0.012, e.y), r, Color::new(0.0, 0.0, 0.0, 0.4), 12);
let rc = if e.captive != 0 {
Color::new(0.6, 0.6, 0.6, 0.6)
} else if e.dwarf() {
@@ -2051,7 +2061,7 @@ fn draw_shadows(g: &Game) {
} else {
Color::new(0.95, 0.3, 0.35, 0.7)
};
ring(vec3(e.x, 0.02, e.y), r + 0.03, rc);
ring(vec3(e.x, fy + 0.02, e.y), r + 0.03, rc);
}
}
@@ -2134,7 +2144,7 @@ fn draw_parts_glow(g: &Game) {
// scorch marks on the floor
for p in g.stuck.iter().filter(|p| p.kind == SCORCH) {
let fade = 1.0 - (p.t / p.max).clamp(0.0, 1.0);
disc(vec3(p.x, 0.015, p.y), p.size, Color::new(0.03, 0.02, 0.02, 0.55 * fade), 14);
disc(vec3(p.x, floor_y(g, p.x, p.y) + 0.015, p.y), p.size, Color::new(0.03, 0.02, 0.02, 0.55 * fade), 14);
}
}