Rework arrows falling into water and lava

Hits no longer splash; glancing and spent arrows splash where they land,
drift burning on lava, and arrows on a removed bridge sink.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 14:50:24 +01:00
1 parent 5adf3d0e00
commit f0eb33a6b1
3 files changed
+135 -17

No files matched your search

+18 -1
View File
@@ -2257,7 +2257,7 @@ fn draw_projectile(f: &Fx, p: f32, t: f32) {
let c = rgba(f.col);
let sz = f.size;
match f.style {
ST_ARROW | ST_ARROW_WALL => {
ST_ARROW | ST_ARROW_WALL | ST_ARROW_FALL => {
let back = at((p - 0.08).max(0.0));
let dir = (head - back).normalize_or_zero();
line3(head - dir * 0.3, head, 0.03, Color::from_rgba(120, 84, 48, 255));
@@ -2504,6 +2504,23 @@ fn draw_parts_solid(g: &Game) {
_ => {}
}
}
// arrows drifting on lava: the shaft glows and chars, then crumbles
for p in g.parts.iter().filter(|p| p.kind == BURNING_ARROW) {
let life = (p.t / p.max).clamp(0.0, 1.0);
let k = 1.0 - life * life;
let bob = (p.t * 3.0 + p.x * 2.0).sin() * 0.01;
let mid = vec3(p.x, -LIQ_D + 0.025 + bob, p.y);
let dir = vec3(p.vx, 0.0, p.vy).normalize_or_zero();
let half = dir * (0.17 * k);
let wood = vec3(0.45, 0.31, 0.18);
let glow = vec3(1.0, 0.45, 0.1);
let char_ = vec3(0.08, 0.05, 0.04);
let c = if life < 0.5 { wood.lerp(glow, life * 2.0) } else { glow.lerp(char_, (life - 0.5) * 2.0) };
line3(mid - half, mid + half, 0.03, Color::new(c.x, c.y, c.z, 1.0));
if life < 0.6 {
draw_cube(mid + half, Vec3::splat(0.035), None, Color::from_rgba(200, 200, 210, 255));
}
}
for p in g.stuck.iter().filter(|p| p.kind == ARROW) {
let left = p.max - p.t;
let k = if left < 10.0 { left / 10.0 } else { 1.0 };