private void SetShadowBSPList(SharpRenderer renderer, List <Archive> OpenShadowONEFiles) { Dispose(); BSPList = new List <RenderWareModelFile>(); ShadowColBSPList = new List <RenderWareModelFile>(); ReadFileMethods.isShadow = true; foreach (Archive f in OpenShadowONEFiles) { foreach (ArchiveFile file in f.Files) { string ChunkName = Path.GetFileNameWithoutExtension(file.Name); if (ChunkName.Contains("COLI")) { ReadFileMethods.isCollision = true; RenderWareModelFile TempBSPFile = new RenderWareModelFile(file.Name); foreach (string s in ChunkName.Split('_')) { try { TempBSPFile.ChunkNumber = Convert.ToByte(s); break; } catch { TempBSPFile.ChunkNumber = -1; } } TempBSPFile.isShadowCollision = true; try { byte[] data = file.DecompressThis(); TempBSPFile.SetForRendering(renderer.Device, ReadFileMethods.ReadRenderWareFile(data), data); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error on opening " + file.Name + ": " + e.Message); } ShadowColBSPList.Add(TempBSPFile); ReadFileMethods.isCollision = false; } else { RenderWareModelFile TempBSPFile = new RenderWareModelFile(file.Name); TempBSPFile.SetChunkNumberAndName(); byte[] data = file.DecompressThis(); TempBSPFile.SetForRendering(renderer.Device, ReadFileMethods.ReadRenderWareFile(data), data); BSPList.Add(TempBSPFile); } } } }
public void SetHeroesBSPList(SharpDevice device, Archive heroesONEfile) { Dispose(); ReadFileMethods.isShadow = false; BSPList = new List <RenderWareModelFile>(heroesONEfile.Files.Count); ShadowColBSPList = new List <RenderWareModelFile>(); foreach (ArchiveFile file in heroesONEfile.Files) { if (!(new string[] { ".bsp", ".rg1", ".rx1" }.Contains(Path.GetExtension(file.Name).ToLower()))) { continue; } RenderWareModelFile TempBSPFile = new RenderWareModelFile(file.Name); TempBSPFile.SetChunkNumberAndName(); byte[] uncompressedData = file.DecompressThis(); TempBSPFile.SetForRendering(device, ReadFileMethods.ReadRenderWareFile(uncompressedData), uncompressedData); BSPList.Add(TempBSPFile); } }
public static void SetHeroesMeshStream(Archive heroesONEfile) { foreach (RenderWareModelFile r in BSPStream) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } foreach (RenderWareModelFile r in ShadowCollisionBSPStream) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } LoadTextures(currentFileNamePrefix); ReadFileMethods.isShadow = false; ShadowCollisionBSPStream = new List <RenderWareModelFile>(); BSPStream = new List <RenderWareModelFile>(heroesONEfile.Files.Count); foreach (ArchiveFile file in heroesONEfile.Files) { if (Path.GetExtension(file.Name).ToLower() != ".bsp") { continue; } RenderWareModelFile TempBSPFile = new RenderWareModelFile(file.Name); TempBSPFile.SetChunkNumberAndName(); byte[] uncompressedData = file.DecompressThis(); TempBSPFile.SetForRendering(ReadFileMethods.ReadRenderWareFile(uncompressedData), uncompressedData); BSPStream.Add(TempBSPFile); } }
public static void SetShadowMeshStream(List <Archive> OpenShadowONEFiles) { foreach (RenderWareModelFile r in BSPStream) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } foreach (RenderWareModelFile r in ShadowCollisionBSPStream) { foreach (SharpMesh mesh in r.meshList) { mesh.Dispose(); } } LoadTextures(currentShadowFolderNamePrefix); BSPStream = new List <RenderWareModelFile>(); ShadowCollisionBSPStream = new List <RenderWareModelFile>(); ReadFileMethods.isShadow = true; foreach (Archive f in OpenShadowONEFiles) { foreach (ArchiveFile file in f.Files) { string ChunkName = Path.GetFileNameWithoutExtension(file.Name); if (ChunkName.Contains("COLI")) { ReadFileMethods.isCollision = true; RenderWareModelFile TempBSPFile = new RenderWareModelFile(file.Name); try { TempBSPFile.ChunkNumber = Convert.ToByte(ChunkName.Split('_').Last()); } catch { TempBSPFile.ChunkNumber = -1; }; TempBSPFile.isShadowCollision = true; try { byte[] data = file.DecompressThis(); TempBSPFile.SetForRendering(ReadFileMethods.ReadRenderWareFile(data), data); } catch (Exception e) { System.Windows.Forms.MessageBox.Show("Error on opening " + file.Name + ": " + e.Message); } ShadowCollisionBSPStream.Add(TempBSPFile); ReadFileMethods.isCollision = false; } else { RenderWareModelFile TempBSPFile = new RenderWareModelFile(file.Name); TempBSPFile.SetChunkNumberAndName(); byte[] data = file.DecompressThis(); TempBSPFile.SetForRendering(ReadFileMethods.ReadRenderWareFile(data), data); BSPStream.Add(TempBSPFile); } } } }