aboutsummaryrefslogtreecommitdiff
path: root/apps/fparkan-game/src/projectile_trail.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-26 19:09:41 +0300
committerValentin Popov <valentin@popov.link>2026-11-26 19:09:41 +0300
commit2e0a4571af587f28ba5ea580f177a225d0d352e2 (patch)
treeaf456896c423edd6bc8b45666e64f46689cd7bcf /apps/fparkan-game/src/projectile_trail.rs
parent4367287f9e07aca6a173a5eaef641a75918d66e0 (diff)
downloadfparkan-2e0a4571af587f28ba5ea580f177a225d0d352e2.tar.xz
fparkan-2e0a4571af587f28ba5ea580f177a225d0d352e2.zip
fix(audio): attach the engine loop to the player's missile
Prepare velocity-driven Op2 sounds with the projectile's CTL attachment. Move their source with the active flight and stop it when the flight ends or its slot is reused. Keep launch as a separate one-shot. The GOG phase function confirms the missile's 0 to 1 phase range. In the stock Firing Line window the engine loop began at the tail and stopped on terrain contact.
Diffstat (limited to 'apps/fparkan-game/src/projectile_trail.rs')
-rw-r--r--apps/fparkan-game/src/projectile_trail.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/apps/fparkan-game/src/projectile_trail.rs b/apps/fparkan-game/src/projectile_trail.rs
index bcadb7ba..4e01afc5 100644
--- a/apps/fparkan-game/src/projectile_trail.rs
+++ b/apps/fparkan-game/src/projectile_trail.rs
@@ -1,9 +1,9 @@
use super::{
ambient_effect_pipeline_state, append_environment_range, environment_vertex,
- prepare_effect_material, quad_indices, EnvironmentGpuRange, PreparedEffectMaterial,
- StaticPreviewScene,
+ prepare_effect_material, projectile_render::ProjectileEffect, quad_indices,
+ EnvironmentGpuRange, PreparedEffectMaterial, StaticPreviewScene,
};
-use fparkan_fx::{op5::TrailLayer, FxDocument, FxOpcode};
+use fparkan_fx::{op5::TrailLayer, FxOpcode};
use std::{collections::HashMap, path::Path};
pub(super) struct ProjectileTrail {
@@ -14,13 +14,18 @@ pub(super) struct ProjectileTrail {
pub(super) fn prepare(
root: &Path,
- effects: &[(String, FxDocument)],
+ effects: &[ProjectileEffect<'_>],
name: &str,
preview: &mut StaticPreviewScene,
cache: &mut HashMap<String, PreparedEffectMaterial>,
) -> Vec<(TrailLayer, usize, fparkan_render::LegacyPipelineState)> {
let mut layers = Vec::new();
- for (effect, document) in effects {
+ for ProjectileEffect {
+ resource: effect,
+ document,
+ ..
+ } in effects
+ {
let header = document.header();
let [scale, sy, sz] = header.scale;
for command in document