From 00e977b3dbb8f447b034b7be387ee1a1cce0598c Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 25 Feb 2011 22:08:57 +0100 Subject: start of a brres writer --- NW4RTools/Models/OpenGL/GLModel.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'NW4RTools/Models/OpenGL') diff --git a/NW4RTools/Models/OpenGL/GLModel.cs b/NW4RTools/Models/OpenGL/GLModel.cs index 315415e..8ca3f31 100644 --- a/NW4RTools/Models/OpenGL/GLModel.cs +++ b/NW4RTools/Models/OpenGL/GLModel.cs @@ -17,7 +17,11 @@ namespace NW4RTools.Models.OpenGL { SourceModel = rf.GetGroup("3DModels(NW4R)")[modelName]; // cache some stuff - m_textureGroup = rf.GetGroup("Textures(NW4R)"); + try { + m_textureGroup = rf.GetGroup("Textures(NW4R)"); + } catch (KeyNotFoundException) { + // boo + } } @@ -162,9 +166,11 @@ namespace NW4RTools.Models.OpenGL { //CalculateNodes(); - foreach (var insn in SourceModel.Bytecode["DrawOpa"].Instructions) { - if (insn is ByteCode.DrawShapeInstruction) { - DrawShape(insn as ByteCode.DrawShapeInstruction); + if (SourceModel.Bytecode.ContainsKey("DrawOpa")) { + foreach (var insn in SourceModel.Bytecode["DrawOpa"].Instructions) { + if (insn is ByteCode.DrawShapeInstruction) { + DrawShape(insn as ByteCode.DrawShapeInstruction); + } } } -- cgit v1.2.3