From 1823b1f084aa800af7837c4a2e9cdb3f9b39be7e Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 27 Apr 2024 18:43:32 -0400 Subject: [PATCH] Fix the shapes crashing on certain models This is a hack to get things working for now --- src/model.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/model.rs b/src/model.rs index 3c3e799..e3a5fc4 100755 --- a/src/model.rs +++ b/src/model.rs @@ -752,8 +752,7 @@ impl MDL { for shape_value in shape_values { let old_vertex = vertices[indices[shape_value.base_indices_index as usize] as usize]; - let new_vertex = vertices[shape_value.replacing_vertex_index as usize - - model.meshes[j as usize].start_index as usize]; + let new_vertex = vertices[(shape_value.replacing_vertex_index as usize).saturating_sub(model.meshes[j as usize].start_index as usize)]; let vertex = &mut morphed_vertices [indices[shape_value.base_indices_index as usize] as usize];