Fix invisible torch flames (halo hid them); thin wisp of torch smoke

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 16:13:37 +01:00
1 parent c5378d0774
commit 77fa142d9d
2 files changed
+23 -6

No files matched your search

+16 -5
View File
@@ -25,6 +25,7 @@ pub const FLASH: u8 = 8; // expanding fireball
pub const RING: u8 = 9; // shock wave
pub const SPLASH: u8 = 10; // liquid droplets, bounce on the river surface
pub const BURNING_ARROW: u8 = 11; // arrow drifting on lava until it burns up (vx, vy = its direction)
pub const WISP: u8 = 12; // torch smoke: a small pixel that rises in a gentle wave and fades
// projectile styles (Fx::style)
pub const ST_PLAIN: u8 = 0;
@@ -210,6 +211,13 @@ impl Game {
p.h += p.vh * dt;
}
FLASH | RING => {}
WISP => {
// rises and sways a little from side to side
p.h += p.vh * dt;
let sway = (p.t * 3.0 + p.vx * 50.0).sin() * 0.06 * dt;
p.x += sway;
p.y += sway * 0.6;
}
BURNING_ARROW => {
// drifts slowly with the lava
p.x += p.vx * 0.05 * dt;
@@ -400,13 +408,16 @@ impl Game {
fn spawn_torch_smoke(&mut self, dt: f32) {
let spots: Vec<(f32, f32, f32)> = self.torches.iter().filter(|t| self.map.shown(t.wall)).map(|t| (t.pos().0, t.pos().1, t.flame_h())).collect();
for (x, y, fh) in spots {
if self.parts.len() >= PARTS_MAX - 100 {
// torch smoke takes at most half of the particles: explosions and splashes come first
if self.parts.len() >= PARTS_MAX / 2 {
break;
}
if self.vrng.f() < 1.1 * dt {
let v = ((self.vrng.f() - 0.5) * 0.08, (self.vrng.f() - 0.5) * 0.08, 0.32 + self.vrng.f() * 0.12);
let life = 1.8 + self.vrng.f() * 0.6;
self.part(SMOKE, (x, y, fh + 0.28), v, life, abgr(70, 62, 58), 0.05);
if self.vrng.f() < 3.0 * dt {
// vx only seeds the sway (see WISP in the update)
let v = (self.vrng.f(), 0.0, 0.3 + self.vrng.f() * 0.1);
let life = 1.2 + self.vrng.f() * 0.5;
let size = 0.025 + self.vrng.f() * 0.012;
self.part(WISP, (x, y, fh + 0.3), v, life, abgr(150, 140, 132), size);
}
if self.vrng.f() < 0.25 * dt {
let v = ((self.vrng.f() - 0.5) * 0.3, (self.vrng.f() - 0.5) * 0.3, 0.9);