public static VTXBodyPart ReadBodyPart(BinaryReader br, int offset, BodyPart bodypart) { br.BaseStream.Seek(offset, SeekOrigin.Begin); // Read bodypart VTXBodyPart vtxbody = new VTXBodyPart(); vtxbody.num_models = br.ReadInt32(); vtxbody.model_offset = br.ReadInt32(); //// If there is more than one model, create a switch to select between them //// (it seems that only one model is supposed to be seen at a given time, //// but I don't know the mechanism in the engine that selects a desired //// model) //if (part.num_models > 1) // partSwitch = new Switch(); // Process models vtxbody.Models = new VTXModel[vtxbody.num_models]; for (int i = 0; i < vtxbody.num_models; i++) { Model currentModel = bodypart.Models[i]; vtxbody.Models[i] = ReadModel(br, offset + vtxbody.model_offset + (i * 8), currentModel); // 8 bytes for VTXModel } return vtxbody; }
private static BodyPart ReadBodyPart(BinaryReader br, int offset) { // Read bodypart struct br.BaseStream.Seek(offset, SeekOrigin.Begin); MDLBodyPart mdlbp = new MDLBodyPart(); mdlbp.mdl_name_index = br.ReadInt32(); mdlbp.num_models = br.ReadInt32(); mdlbp.body_part_base = br.ReadInt32(); mdlbp.model_offset = br.ReadInt32(); BodyPart bodypart = new BodyPart(mdlbp); // Process bodyparts the models if (mdlbp.num_models > 1) { int test = 2; } for (int i = 0; i < mdlbp.num_models; i++) { Model model = ReadModel(br, offset + mdlbp.model_offset + (i * 120)); // 120 bytes for MDLModel bodypart.Models.Add(model); } return bodypart; }