diff options
Diffstat (limited to 'apps/fparkan-game/src/projectile_render.rs')
| -rw-r--r-- | apps/fparkan-game/src/projectile_render.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/fparkan-game/src/projectile_render.rs b/apps/fparkan-game/src/projectile_render.rs index 343f0e63..c57c63a1 100644 --- a/apps/fparkan-game/src/projectile_render.rs +++ b/apps/fparkan-game/src/projectile_render.rs @@ -42,10 +42,12 @@ pub(super) struct ProjectileDrawSlot { pub(super) trail_segment: Option<[[f32; 3]; 2]>, } +pub(super) type ProjectileLoader<'a> = dyn Fn(&str, &str) -> Result<ProjectileAssets, String> + 'a; + #[allow(clippy::too_many_arguments)] pub(super) fn prepare_player_draws( root: &Path, - engine: &Engine, + load_projectile: &ProjectileLoader<'_>, weapons_by_object: impl IntoIterator<Item = (usize, fparkan_runtime::PlayerWeapons)>, first_pool: usize, mesh: &mut VulkanStaticMesh, @@ -96,7 +98,7 @@ pub(super) fn prepare_player_draws( }; let draw = match prepare_projectile_draw_into( root, - engine, + load_projectile, &archive, &name, capacity, @@ -133,7 +135,7 @@ pub(super) fn prepare_projectile_draw( ) -> Result<Option<ProjectileDraw>, String> { prepare_projectile_draw_into( root, - engine, + &|archive, name| load_player_projectile(engine, archive, name), archive, name, capacity, @@ -147,7 +149,7 @@ pub(super) fn prepare_projectile_draw( #[allow(clippy::too_many_arguments)] pub(super) fn prepare_projectile_draw_into( root: &Path, - engine: &Engine, + load_projectile: &ProjectileLoader<'_>, archive: &str, name: &str, capacity: impl FnOnce(u32) -> u32, @@ -156,7 +158,7 @@ pub(super) fn prepare_projectile_draw_into( material_animations: &mut Vec<MaterialAnimationBinding>, trail_materials: &mut EffectMaterials, ) -> Result<Option<ProjectileDraw>, String> { - let projectile = load_player_projectile(engine, archive, name)?; + let projectile = load_projectile(archive, name)?; let assets = &projectile.assets; let [id] = assets.visuals_for_object(0) else { return Err("projectile has no single visual".into()); |
