diff --git a/src/load_bsp.rs b/src/load_bsp.rs index 348d34e..4bcf1a5 100644 --- a/src/load_bsp.rs +++ b/src/load_bsp.rs @@ -1,24 +1,28 @@ -pub fn generate_indexed_models(input:&mut R) -> crate::model::IndexedModelInstances{ - let mut spawn_point=crate::integer::Planar64Vec3::ZERO; - - let mut indexed_models=Vec::new(); +pub fn generate_indexed_models(input:&mut R)->Result{ let mut s=Vec::new(); match input.read_to_end(&mut s){ - Ok(guac)=>println!("readed to string {:?}", guac), - Err(e)=>println!("faile {:?}",e), + Ok(_)=>(), + Err(e)=>println!("load_bsp::generate_indexed_models read_to_end failed: {:?}",e), } + match vbsp::Bsp::read(s.as_slice()){ - Ok(guac)=>println!("we got the guac {:?}", guac), - Err(e)=>println!("rotten {:?}",e), - } + Ok(bsp)=>{ + let mut spawn_point=crate::integer::Planar64Vec3::ZERO; - crate::model::IndexedModelInstances{ - textures:Vec::new(), - models:indexed_models, - spawn_point, - modes:Vec::new(), + let mut indexed_models=Vec::new(); + Ok(crate::model::IndexedModelInstances{ + textures:Vec::new(), + models:indexed_models, + spawn_point, + modes:Vec::new(), + }) + }, + Err(e)=>{ + println!("rotten {:?}",e); + Err(e) + }, } } diff --git a/src/main.rs b/src/main.rs index f6579b5..319d585 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,7 @@ fn load_file(path: std::path::PathBuf)->Option{ }, } }, - b"VBSP"=>Some(load_bsp::generate_indexed_models(&mut input)), + b"VBSP"=>load_bsp::generate_indexed_models(&mut input).ok(), //b"SNFM"=>Some(sniffer::generate_indexed_models(input)), //b"SNFB"=>Some(sniffer::load_bot(input)), other=>{