Light for towers and traps; other masters' traps stay dark until sprung
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a13abf63f3
commit
6c16bc7b18
2 files changed
+70
-8
No files matched your search
+36
-5
@@ -1142,11 +1142,42 @@ impl R3d {
|
||||
for &(ex, ey) in &g.planned_entries {
|
||||
push(vec3(ex as f32 + 0.5, 1.2, ey as f32 + 0.5), 5.0, vec3(1.0, 0.12, 0.08), 0.6 + 1.0 * pulse, 30.0);
|
||||
}
|
||||
for tw in &g.towers {
|
||||
if tw.kind == TowerKind::Magic {
|
||||
let (x, z) = tw.pos();
|
||||
push(vec3(x, tower_height(tw) + 0.6, z), 4.5, vec3(0.75, 0.4, 1.0), 0.8 + tw.flash * 3.0, 10.0);
|
||||
// towers: the dungeon's glow red from their joints, the knights' carry a cold lantern;
|
||||
// magic and rune towers shine in their colour; every shot flares up
|
||||
for tw in g.towers.iter().filter(|tw| g.map.shown(tw.tile)) {
|
||||
let (x, z) = tw.pos();
|
||||
let top = tower_height(tw);
|
||||
let (c, i, r) = match tw.kind {
|
||||
TowerKind::Magic => (vec3(0.75, 0.4, 1.0), 0.9, 4.5),
|
||||
TowerKind::Rune => (vec3(0.4, 0.8, 1.0), 1.0, 5.0),
|
||||
_ if tw.hero => (vec3(0.85, 0.9, 1.0), 0.8, 4.0),
|
||||
_ => (vec3(1.0, 0.3, 0.12), 0.85, 4.0),
|
||||
};
|
||||
let pulse = 0.9 + 0.1 * (t * 2.0 + tw.id as f32).sin();
|
||||
push(vec3(x, top + 0.4, z), r, c, i * pulse + tw.flash * 3.0, 10.0);
|
||||
}
|
||||
// traps: each kind in its colour, brighter while it goes off. Another master's traps
|
||||
// stay dark until they have gone off once (so the light does not betray them)
|
||||
for tr in g.traps.iter().filter(|tr| tr.stage == crate::traps::ARMED && g.map.shown(tr.tile)) {
|
||||
use crate::traps::TrapKind as K;
|
||||
if !g.trap_glows(tr) {
|
||||
continue;
|
||||
}
|
||||
let fresh = (1.0 - tr.fired / 0.8).clamp(0.0, 1.0); // just went off
|
||||
let (c, i, r) = match tr.kind {
|
||||
K::Poison => (vec3(0.35, 1.0, 0.3), 0.55, 2.5),
|
||||
K::Fire => (vec3(1.0, 0.5, 0.12), 0.6, 3.0),
|
||||
K::Alarm => (vec3(1.0, 0.15, 0.1), 0.35 + 0.35 * (0.5 + 0.5 * (t * 4.0).sin()), 3.0),
|
||||
K::Mine => (vec3(0.7, 0.4, 1.0), 0.5, 2.5),
|
||||
K::Frost => (vec3(0.5, 0.85, 1.0), 0.65, 3.0),
|
||||
K::Spikes | K::Roller => (vec3(1.0, 0.85, 0.6), 0.0, 2.5),
|
||||
_ => continue, // doors
|
||||
};
|
||||
if i + fresh <= 0.0 {
|
||||
continue;
|
||||
}
|
||||
let (x, z) = xy(tr.tile);
|
||||
push(vec3(x as f32 + 0.5, 0.35, z as f32 + 0.5), r + fresh, c, i + 2.5 * fresh, 5.0);
|
||||
}
|
||||
// effects light up their surroundings: lightning, explosions, glowing projectiles, spells
|
||||
let tint = |c: u32| {
|
||||
@@ -2602,7 +2633,7 @@ fn draw_traps_glow(g: &Game, t: f32) {
|
||||
line3(c + vec3(-0.35, y, 0.0), c + vec3(-0.35 + 0.7 * f, y, 0.0), 0.08, Color::new(1.0, 0.7, 0.3, 0.8));
|
||||
continue;
|
||||
}
|
||||
if tr.stage != ARMED {
|
||||
if tr.stage != ARMED || !g.trap_glows(tr) {
|
||||
continue;
|
||||
}
|
||||
if tr.revealed && !tr.kind.door() {
|
||||
|
||||
Reference in new issue
Block a user