Monster eye marks the camera on the minimap; middle double click resets the view angle; creatures by beds up to 100

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 10:06:51 +01:00
1 parent 0b2d327791
commit ac22351cdf
22 files changed
+147 -5

No files matched your search

+38 -2
View File
@@ -741,7 +741,7 @@ impl Ui {
Gap,
}
let txt = |s: String, c: Color| Part::T(s, c);
let cap = g.counts[1].min(30);
let cap = g.creature_cap();
let wave_col = if g.wave_timer < 30.0 { RED } else { TXT };
let vol = if settings.muted { tr("hud.off") } else { format!("{}%", (settings.volume * 100.0).round() as i32) };
let mut gold_seg = vec![txt(tr("hud.gold"), GOLD), Part::Gap, txt(format!("{}/{}", g.gold as i32, g.gold_cap() as i32), TXT)];
@@ -1026,6 +1026,42 @@ impl Ui {
draw_line(mrx + a.x * ms, mry + a.y * ms, mrx + b.x * ms, mry + b.y * ms, px, WHITE);
}
}
// the camera: a monster's eye on the viewer's side of the footprint, looking in
{
let near = (corners[2] + corners[3]) * 0.5;
let look = vec2(-cam.yaw.sin(), -cam.yaw.cos()); // from the eye towards the target (map units)
let r = (4.0 * px).max(ms * 2.5);
let (ex, ey) = (mrx + near.x * ms - look.x * r * 1.6, mry + near.y * ms - look.y * r * 1.6);
let (ex, ey) = (ex.clamp(mrx + r, mrx + map_w - r), ey.clamp(mry + r, mry + map_h - r));
let side = vec2(-look.y, look.x);
// the lids: an almond across the view direction
let lid = |t: f32, w: f32| vec2(ex, ey) + side * (t * r * 1.25) + look * w;
let n = 8;
let mut upper = Vec::new();
let mut lower = Vec::new();
for k in 0..=n {
let t = k as f32 / n as f32 * 2.0 - 1.0;
let h = (1.0 - t * t).max(0.0).sqrt() * r * 0.75;
upper.push(lid(t, h));
lower.push(lid(t, -h));
}
let c = vec2(ex, ey);
let sclera = Color::new(0.95, 0.85, 0.35, 1.0);
for k in 0..n {
draw_triangle(c, upper[k], upper[k + 1], sclera);
draw_triangle(c, lower[k], lower[k + 1], sclera);
}
// the iris looks towards the target, with a slit pupil across it
let iris = c + look * (r * 0.2);
draw_circle(iris.x, iris.y, r * 0.55, Color::new(0.85, 0.3, 0.08, 1.0));
let a = iris + side * (r * 0.45);
let b = iris - side * (r * 0.45);
draw_line(a.x, a.y, b.x, b.y, (r * 0.22).max(px), Color::new(0.05, 0.0, 0.02, 1.0));
for k in 0..n {
draw_line(upper[k].x, upper[k].y, upper[k + 1].x, upper[k + 1].y, px.max(1.0), Color::new(0.2, 0.05, 0.08, 1.0));
draw_line(lower[k].x, lower[k].y, lower[k + 1].x, lower[k + 1].y, px.max(1.0), Color::new(0.2, 0.05, 0.08, 1.0));
}
}
// ---------------- mission goals (campaign)
if let Some(m) = &g.mission {
@@ -1327,7 +1363,7 @@ impl Ui {
let controls: &[&str] = if touch_ui() {
&["help.t_tap", "help.t_drag", "help.t_two", "help.t_long", "help.t_double", "help.t_tools"]
} else {
&["help.k_left", "help.k_right", "help.k_slap", "help.k_pan", "help.k_rot", "help.k_zoom", "help.k_tools", "help.k_misc", "help.k_misc2"]
&["help.k_left", "help.k_right", "help.k_slap", "help.k_pan", "help.k_rot", "help.k_reset", "help.k_zoom", "help.k_tools", "help.k_misc", "help.k_misc2"]
};
let mut keys: Vec<(&str, Color)> = vec![("help.goal", GOLD), ("", TXT)];
keys.extend(controls.iter().map(|k| (*k, TXT)));