Co-op campaign matches and command markers: mission relay, allied masters, temporary flags

This commit is contained in:
Richard Zink committed 2026-11-04 20:07:06 +01:00
1 parent dc22e27184
commit 5928acf7f6
12 files changed
+433 -27

No files matched your search

+77
View File
@@ -1121,6 +1121,7 @@ impl R3d {
if let Some(f) = g.flag {
draw_flag(f, t);
}
draw_marks(g, t);
draw_overlay(&g.map, ov, self.wall_sub);
draw_entry_warnings(g, t, self.wall_sub);
// translucent glows and effects last (they write depth, see glow_material)
@@ -2165,6 +2166,82 @@ fn draw_flag(f: usize, t: f32) {
draw_mesh(&Mesh { vertices: v, indices: vec![0, 1, 2], texture: None });
}
fn mark_color(kind: u8) -> Color {
match kind {
MARK_DIG => Color::new(0.45, 0.95, 0.55, 1.0),
MARK_ROOM => Color::new(0.35, 0.85, 1.0, 1.0),
MARK_SELL => Color::new(0.95, 0.78, 0.22, 1.0),
MARK_BRIDGE => Color::new(0.70, 0.48, 0.24, 1.0),
MARK_STEEL => Color::new(0.78, 0.84, 0.92, 1.0),
MARK_TOWER => Color::new(0.74, 0.42, 0.95, 1.0),
MARK_TRAP => Color::new(1.0, 0.58, 0.18, 1.0),
MARK_SPELL => Color::new(0.42, 0.88, 0.98, 1.0),
MARK_LIGHTNING => Color::new(0.98, 0.94, 0.35, 1.0),
MARK_HEAL => Color::new(0.48, 0.96, 0.66, 1.0),
MARK_SUMMON => Color::new(0.95, 0.36, 0.24, 1.0),
MARK_FLAG => Color::new(0.88, 0.18, 0.18, 1.0),
MARK_PICKUP => Color::new(0.72, 0.76, 0.82, 1.0),
MARK_DROP => Color::new(0.72, 0.76, 0.82, 1.0),
MARK_SLAP => Color::new(1.0, 0.46, 0.24, 1.0),
MARK_ATTACK => Color::new(0.94, 0.18, 0.20, 1.0),
MARK_GUARD => Color::new(0.98, 0.82, 0.22, 1.0),
MARK_CANCEL => Color::new(0.58, 0.64, 0.78, 1.0),
_ => Color::new(0.88, 0.18, 0.18, 1.0),
}
}
fn flag_rgba(c: Color) -> [u8; 4] {
[
(c.r.clamp(0.0, 1.0) * 255.0) as u8,
(c.g.clamp(0.0, 1.0) * 255.0) as u8,
(c.b.clamp(0.0, 1.0) * 255.0) as u8,
(c.a.clamp(0.0, 1.0) * 255.0) as u8,
]
}
fn mark_side_color(side: u8) -> Color {
match side {
0 => Color::new(1.0, 0.85, 0.45, 1.0),
1 => Color::new(0.85, 0.55, 0.25, 1.0),
2 => Color::new(0.35, 0.95, 0.40, 1.0),
3 => Color::new(0.40, 0.60, 1.00, 1.0),
4 => Color::new(0.85, 0.75, 0.30, 1.0),
_ => Color::new(0.82, 0.84, 0.88, 1.0),
}
}
fn draw_command_flag(x: f32, z: f32, cloth: Color, pole: Color, t: f32) {
let base = vec3(x - 0.04, 0.0, z);
draw_cube(base + vec3(0.0, 0.65, 0.0), vec3(0.035, 1.30, 0.035), None, Color::new(pole.r, pole.g, pole.b, pole.a));
let wave = (t * 6.0).sin() * 0.07;
let p1 = base + vec3(0.0, 1.28, 0.0);
let p2 = base + vec3(0.48, 1.14 + wave, 0.08);
let p3 = base + vec3(0.0, 0.92, 0.0);
let col = flag_rgba(cloth);
let v = vec![
Vertex { position: p1, uv: Vec2::ZERO, color: col, normal: Vec4::Y },
Vertex { position: p2, uv: Vec2::ZERO, color: col, normal: Vec4::Y },
Vertex { position: p3, uv: Vec2::ZERO, color: col, normal: Vec4::Y },
];
draw_mesh(&Mesh { vertices: v, indices: vec![0, 1, 2], texture: None });
}
fn draw_marks(g: &Game, t: f32) {
if g.marks.is_empty() {
return;
}
for m in &g.marks {
let left = m.until.saturating_sub(g.sim_steps) as f32 * STEP;
if left <= 0.0 {
continue;
}
let a = (left / 2.0).min(1.0).max(0.18);
let base = mark_color(m.kind);
let side = mark_side_color(m.side);
draw_command_flag(m.x, m.y, Color::new(base.r, base.g, base.b, a), Color::new(side.r, side.g, side.b, a), t);
}
}
// projectiles with a look of their own (styles in particles.rs)
fn draw_projectile(f: &Fx, p: f32, t: f32) {
use crate::particles::*;