VisualObjectData ParseSaveCrystalObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("crystal.lmp", "book.vif", "book.tex")); return(obj); }
public void RemoveObjectFromList(VisualObjectData vod) { if (_visualObjects.Contains(vod)) { _visualObjects.Remove(vod); } }
public VisualObjectData Parse(VisualObjectData obj) { if (_objectDefinitions.TryGetValue(obj.ObjectData.Name, out var del)) { return(del(obj)); } // Didn't match anything return(ParseBaseObject(obj)); }
public VisualObjectData Parse(VisualObjectData obj) { ParseObjectDelegate del; if (_objectDefinitions.TryGetValue(obj.ObjectData.Name, out del)) { return del(obj); } // Didn't match anything return ParseBaseObject(obj); }
private VisualObjectData ParseDirectionalObject(VisualObjectData obj) { obj.Offset = new Vector3D(0, 0, 0); if (obj.ObjectData.Name.EndsWith("D") || obj.ObjectData.Name.EndsWith("D2")) { return(null); } string dName = obj.ObjectData.Name; dName = dName.EndsWith("2") ? dName.Substring(0, dName.Length - 1) + "D2" : dName + "D"; var directionObj = _manager.GetObjectByName(dName); if (directionObj == null) { Debug.Fail("Cannot find direction object"); return(null); } var color = ColorFromArray(obj.ObjectData.Floats); // Black light, don't show so that we can see actual colors if (color.R == 0 && color.G == 0 && color.B == 0) { return(null); } var point1 = new Point3D(0, 0, 0); var point2 = new Point3D(directionObj.Floats[0] * 10, directionObj.Floats[1] * 10, directionObj.Floats[2] * 10); obj.Model = new ModelVisual3D(); obj.Model.Children.Add(new SphereVisual3D { Center = point2, Radius = 1.0, Fill = new SolidColorBrush(color) }); obj.Model.Children.Add(new ArrowVisual3D { Point1 = point2, Point2 = point1, Diameter = 0.5, Fill = new SolidColorBrush(color) }); //obj.Model = sphere; return(obj); }
public VisualObjectData ParseObject(ObjectData obj) { var vod = new VisualObjectData(); vod.ObjectData = obj; vod.Offset = new Vector3D(obj.Floats[0] / 4, obj.Floats[1] / 4, obj.Floats[2] / 4); vod.zRotation = 22.5 * (obj.I6 >> 12); vod = _defs.Parse(vod); if (vod != null) { _visualObjects.Add(vod); } return(vod); }
private VisualObjectData ParsePushTriggerObject(VisualObjectData obj) { var sphere = new SphereVisual3D(); if (!double.TryParse(obj.ObjectData.GetProperty("radius"), out var tempRadius)) { tempRadius = 2.5 * 4; } tempRadius = tempRadius / 4; sphere.Radius = tempRadius; obj.Offset.Z += tempRadius / 2; sphere.Material = new DiffuseMaterial(new SolidColorBrush(Color.FromArgb(128, 255, 171, 0))); obj.Model = sphere; return(obj); }
// Ambient_Light private VisualObjectData ParseLightObject(VisualObjectData obj) { obj.Offset = new Vector3D(0, 0, 0); var sphere = new SphereVisual3D(); sphere.Radius = 2.5; var color = ColorFromArray(obj.ObjectData.Floats); // Black light, don't show so that we can see actual colors if (color.R == 0 && color.G == 0 && color.B == 0) { return(null); } sphere.Material = new DiffuseMaterial(new SolidColorBrush(color)); obj.Model = sphere; return(obj); }
private VisualObjectData ParseTriggerObject(VisualObjectData obj) { var box = new BoxVisual3D(); if (!double.TryParse(obj.ObjectData.GetProperty("w"), out var tempValue)) { tempValue = 2.5 * 4; } box.Width = tempValue / 4; box.Length = tempValue / 4; if (!double.TryParse(obj.ObjectData.GetProperty("h"), out tempValue)) { tempValue = 2.5 * 4; } box.Height = tempValue / 4; box.Material = new DiffuseMaterial(new SolidColorBrush(Color.FromArgb(128, 255, 171, 0))); obj.Model = box; return(obj); }
VisualObjectData ParseHoochieObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("hoochie.lmp", "hoochie.vif", "hoochie.tex")); return obj; }
VisualObjectData ParseHoochieObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("hoochie.lmp", "hoochie.vif", "hoochie.tex")); return(obj); }
VisualObjectData ParseGarikObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("garik.lmp", "garik.vif", "garik.tex")); return obj; }
private void ObjectSelected(VisualObjectData obj) { if (obj == null) { ResetValues(); editor_ElementGrid.Visibility = Visibility.Collapsed; editor_ObjectGrid.Visibility = Visibility.Collapsed; return; } _selectedElement = null; _selectedObject = obj; editor_NameText.Text = "Object"; editor_Obj_NameBox.Text = obj.ObjectData.Name; editor_Obj_I6Box.Text = "0x" + obj.ObjectData.I6.ToString("X4"); editor_Obj_Float1Box.Text = obj.ObjectData.Floats[0].ToString(CultureInfo.InvariantCulture); editor_Obj_Float2Box.Text = obj.ObjectData.Floats[1].ToString(CultureInfo.InvariantCulture); editor_Obj_Float3Box.Text = obj.ObjectData.Floats[2].ToString(CultureInfo.InvariantCulture); if (obj.ObjectData.Properties != null && obj.ObjectData.Properties.Count > 0) { editor_Obj_PropertiesBox.Text = string.Join("\n", obj.ObjectData.Properties); } else { editor_Obj_PropertiesBox.Text = null; } editor_ElementGrid.Visibility = Visibility.Collapsed; editor_ObjectGrid.Visibility = Visibility.Visible; // Expand after values have changed if (!editorExpander.IsExpanded) editorExpander.IsExpanded = true; }
public void RemoveObjectFromList(VisualObjectData vod) { if (_visualObjects.Contains(vod)) _visualObjects.Remove(vod); }
private VisualObjectData ParsePushTriggerObject(VisualObjectData obj) { var sphere = new SphereVisual3D(); double tempRadius = 0; if (!double.TryParse(obj.ObjectData.GetProperty("radius"), out tempRadius)) { tempRadius = 2.5 * 4; } tempRadius = tempRadius / 4; sphere.Radius = tempRadius; obj.Offset.Z += tempRadius / 2; sphere.Material = new DiffuseMaterial(new SolidColorBrush(Color.FromArgb(128,255,171,0))); obj.Model = sphere; return obj; }
VisualObjectData ParseShopKeepObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("bartley.lmp", "shopkeep1.vif", "shopkeep1.tex")); return obj; }
VisualObjectData ParseBartenderObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("bartend.lmp", "bartender.vif", "bartender.tex")); return(obj); }
private void ApplyChangesClicked(object sender, RoutedEventArgs e) { if (_selectedElement == null && _selectedObject == null) return; int tempIntValue; double tempDoubleValue; var levelViewModel = (LevelViewModel)DataContext; if (_selectedElement != null) { _selectedElement.WorldElement.usesRotFlags = editor_UseRotFlagsBox.IsChecked.GetValueOrDefault(); // Uses Rot Flags if (GetIntHex(editor_XYZRotFlagsBox.Text, out tempIntValue)) // XYZ Rot Flags _selectedElement.WorldElement.xyzRotFlags = tempIntValue; if (GetDouble(editor_CosBox.Text, out tempDoubleValue)) // Cos _selectedElement.WorldElement.cosAlpha = tempDoubleValue; if (GetDouble(editor_SinBox.Text, out tempDoubleValue)) // Sin _selectedElement.WorldElement.sinAlpha = tempDoubleValue; if (GetDouble(editor_PosXBox.Text, out tempDoubleValue)) // X _selectedElement.WorldElement.pos.X = tempDoubleValue; if (GetDouble(editor_PosYBox.Text, out tempDoubleValue)) // Y _selectedElement.WorldElement.pos.Y = tempDoubleValue; if (GetDouble(editor_PosZBox.Text, out tempDoubleValue)) // Z _selectedElement.WorldElement.pos.Z = tempDoubleValue; levelViewModel.RebuildScene(); } else if (_selectedObject != null) { _selectedObject.ObjectData.Name = editor_Obj_NameBox.Text; // Name if (GetIntHex(editor_Obj_I6Box.Text, out tempIntValue)) // I6 _selectedObject.ObjectData.I6 = (short)tempIntValue; if (GetDouble(editor_Obj_Float1Box.Text, out tempDoubleValue)) // Float 1 _selectedObject.ObjectData.Floats[0] = (float)tempDoubleValue; if (GetDouble(editor_Obj_Float2Box.Text, out tempDoubleValue)) // Float 2 _selectedObject.ObjectData.Floats[1] = (float)tempDoubleValue; if (GetDouble(editor_Obj_Float3Box.Text, out tempDoubleValue)) // Float 3 _selectedObject.ObjectData.Floats[2] = (float)tempDoubleValue; _selectedObject.ObjectData.Properties.Clear(); _selectedObject.ObjectData.Properties.AddRange(editor_Obj_PropertiesBox.Text.Split(new []{'\n', '\r'}, StringSplitOptions.RemoveEmptyEntries)); levelViewModel.ObjectManager.RemoveObjectFromList(_selectedObject); var newObject = levelViewModel.ObjectManager.ParseObject(_selectedObject.ObjectData); _selectedObject = newObject; levelViewModel.RebuildScene(); } }
VisualObjectData ParseLecherObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("nebbish.lmp", "nebbish.vif", "nebbish.tex")); return(obj); }
private VisualObjectData ParseBaseObject(VisualObjectData obj) { obj.Model = CreateBox(5, Color.FromArgb(255, 255, 247, 0)); return(obj); }
VisualObjectData ParseShopKeepObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("bartley.lmp", "shopkeep1.vif", "shopkeep1.tex")); return(obj); }
VisualObjectData ParseEthonObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("ethon.lmp", "ethon.vif", "ethon.tex")); return(obj); }
VisualObjectData ParseCaravanGuardObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("cguard.lmp", "caravang.vif", "caravang.tex")); return(obj); }
VisualObjectData ParseLecherObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("nebbish.lmp", "nebbish.vif", "nebbish.tex")); return obj; }
VisualObjectData ParseBartenderObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("bartend.lmp", "bartender.vif", "bartender.tex")); return obj; }
// Ambient_Light private VisualObjectData ParseLightObject(VisualObjectData obj) { obj.Offset = new Vector3D(0, 0, 0); var sphere = new SphereVisual3D(); sphere.Radius = 2.5; var color = ColorFromArray(obj.ObjectData.Floats); // Black light, don't show so that we can see actual colors if (color.R == 0 && color.G == 0 && color.B == 0) return null; sphere.Material = new DiffuseMaterial(new SolidColorBrush(color)); obj.Model = sphere; return obj; }
private VisualObjectData ParseBaseObject(VisualObjectData obj) { obj.Model = CreateBox(5, Color.FromArgb(255, 255, 247, 0)); return obj; }
VisualObjectData ParseSaveCrystalObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("crystal.lmp", "book.vif", "book.tex")); return obj; }
VisualObjectData ParseCaravanGuardObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("cguard.lmp", "caravang.vif", "caravang.tex")); return obj; }
private VisualObjectData ParseTriggerObject(VisualObjectData obj) { var box = new BoxVisual3D(); double tempValue = 0; if (!double.TryParse(obj.ObjectData.GetProperty("w"), out tempValue)) { tempValue = 2.5 * 4; } box.Width = tempValue/4; box.Length = tempValue / 4; if (!double.TryParse(obj.ObjectData.GetProperty("h"), out tempValue)) { tempValue = 2.5 * 4; } box.Height = tempValue/4; box.Material = new DiffuseMaterial(new SolidColorBrush(Color.FromArgb(128, 255, 171, 0))); obj.Model = box; return obj; }
private VisualObjectData ParseDirectionalObject(VisualObjectData obj) { obj.Offset = new Vector3D(0, 0, 0); if (obj.ObjectData.Name.EndsWith("D") || obj.ObjectData.Name.EndsWith("D2")) return null; string dName = obj.ObjectData.Name; dName = dName.EndsWith("2") ? dName.Substring(0, dName.Length - 1) + "D2" : dName + "D"; var directionObj = _manager.GetObjectByName(dName); if (directionObj == null) { Debug.Fail("Cannot find direction object"); return null; } var color = ColorFromArray(obj.ObjectData.Floats); // Black light, don't show so that we can see actual colors if (color.R == 0 && color.G == 0 && color.B == 0) return null; var point1 = new Point3D(0, 0, 0); var point2 = new Point3D(directionObj.Floats[0] * 10, directionObj.Floats[1] * 10, directionObj.Floats[2] * 10); obj.Model = new ModelVisual3D(); obj.Model.Children.Add(new SphereVisual3D { Center = point2, Radius = 1.0, Fill = new SolidColorBrush(color) }); obj.Model.Children.Add(new ArrowVisual3D { Point1 = point2, Point2 = point1, Diameter = 0.5, Fill = new SolidColorBrush(color) }); //obj.Model = sphere; return obj; }
private void ElementSelected(WorldElementTreeViewModel ele) { if (ele == null) { ResetValues(); editor_ElementGrid.Visibility = Visibility.Collapsed; editor_ObjectGrid.Visibility = Visibility.Collapsed; return; } _selectedObject = null; _selectedElement = ele; editor_NameText.Text = ele.Text; editor_UseRotFlagsBox.IsChecked = ele.WorldElement.usesRotFlags; editor_XYZRotFlagsBox.Text = "0x"+ele.WorldElement.xyzRotFlags.ToString("X4"); editor_CosBox.Text = ele.WorldElement.cosAlpha.ToString(CultureInfo.InvariantCulture); editor_SinBox.Text = ele.WorldElement.sinAlpha.ToString(CultureInfo.InvariantCulture); editor_PosXBox.Text = ele.WorldElement.pos.X.ToString(CultureInfo.InvariantCulture); editor_PosYBox.Text = ele.WorldElement.pos.Y.ToString(CultureInfo.InvariantCulture); editor_PosZBox.Text = ele.WorldElement.pos.Z.ToString(CultureInfo.InvariantCulture); editor_ElementGrid.Visibility = Visibility.Visible; editor_ObjectGrid.Visibility = Visibility.Collapsed; // Expand after values have changed if (!editorExpander.IsExpanded) editorExpander.IsExpanded = true; }
VisualObjectData ParseEthonObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("ethon.lmp", "ethon.vif", "ethon.tex")); return obj; }
public VisualObjectData ParseObject(ObjectData obj) { var vod = new VisualObjectData(); vod.ObjectData = obj; vod.Offset = new Vector3D(obj.Floats[0] / 4, obj.Floats[1] / 4, obj.Floats[2] / 4); vod.zRotation = 22.5 * (obj.I6 >> 12); vod = _defs.Parse(vod); if (vod != null) { _visualObjects.Add(vod); } return vod; }
VisualObjectData ParseDrunkObject(VisualObjectData obj) { obj.Model = new ModelVisual3D(); obj.Model.Children.Add(LoadModelFromOtherLmp("drunk.lmp", "drunk.vif", "drunk.tex")); return(obj); }