public void UpdateTrainTrackUI() { if (Track == null) { //TrainTrackFilePanel.Enabled = false; TrainTrackFilenameTextBox.Text = string.Empty; TrainTrackConfigNameTextBox.Text = string.Empty; TrainTrackIsPingPongCheckBox.Checked = false; TrainTrackStopsAtStationsCheckBox.Checked = false; TrainTrackMPStopsAtStationsCheckBox.Checked = false; TrainTrackSpeedTextBox.Text = string.Empty; TrainTrackBrakingDistTextBox.Text = string.Empty; TrainTrackRpfPathTextBox.Text = string.Empty; TrainTrackFilePathTextBox.Text = string.Empty; TrainTrackProjectPathTextBox.Text = string.Empty; TrainTrackInfoLabel.Text = string.Empty; } else { //populatingui = true; //TrainTrackFilePanel.Enabled = true; TrainTrackFilenameTextBox.Text = Track.filename; TrainTrackConfigNameTextBox.Text = Track.trainConfigName; TrainTrackIsPingPongCheckBox.Checked = Track.isPingPongTrack; TrainTrackStopsAtStationsCheckBox.Checked = Track.stopsAtStations; TrainTrackMPStopsAtStationsCheckBox.Checked = Track.MPstopsAtStations; TrainTrackSpeedTextBox.Text = FloatUtil.ToString(Track.speed); TrainTrackBrakingDistTextBox.Text = FloatUtil.ToString(Track.brakingDist); TrainTrackRpfPathTextBox.Text = Track.RpfFileEntry?.Path ?? string.Empty; TrainTrackFilePathTextBox.Text = Track.FilePath; TrainTrackProjectPathTextBox.Text = string.Empty; //todo TrainTrackInfoLabel.Text = Track.StationCount.ToString() + " stations"; //populatingui = false; } }
public void WriteXml(StringBuilder sb, int indent, byte[] allHeightmapData) { Vector2 p = new Vector2(); p.X = PositionX / 4.0f; p.Y = PositionY / 4.0f; float minz = MinZ / 32.0f; float maxz = MaxZ / 32.0f; YndXml.SelfClosingTag(sb, indent, "Position " + FloatUtil.GetVector2XmlString(p)); YndXml.ValueTag(sb, indent, "MinZ", FloatUtil.ToString(minz)); YndXml.ValueTag(sb, indent, "MaxZ", FloatUtil.ToString(maxz)); YndXml.ValueTag(sb, indent, "SizeX", HeightmapDimX.ToString()); YndXml.ValueTag(sb, indent, "SizeY", HeightmapDimY.ToString()); byte[] hmdata = null; int hmbcount = HeightmapDimX * HeightmapDimY; if (hmbcount > 0) { hmdata = new byte[hmbcount]; Buffer.BlockCopy(allHeightmapData, HeightmapPtr, hmdata, 0, hmbcount); } YndXml.WriteRawArray(sb, hmdata, indent, "Heightmap", "", RelXml.FormatHexByte, Math.Max(HeightmapDimX, (byte)1)); }
public void LoadListView() { MainListView.BeginUpdate(); // performance foreach (var entry in yvr.Records.Entries.data_items) { string[] row = { FloatUtil.ToString(entry.Position.X), FloatUtil.ToString(entry.Position.Y), FloatUtil.ToString(entry.Position.Z), entry.Time.ToString(), FloatUtil.ToString(entry.Velocity.X), FloatUtil.ToString(entry.Velocity.Y), FloatUtil.ToString(entry.Velocity.Z), FloatUtil.ToString(entry.Right.X), FloatUtil.ToString(entry.Right.Y), FloatUtil.ToString(entry.Right.Z), FloatUtil.ToString(entry.Forward.X), FloatUtil.ToString(entry.Forward.Y), FloatUtil.ToString(entry.Forward.Z), FloatUtil.ToString(entry.Steering), FloatUtil.ToString(entry.GasPedal), FloatUtil.ToString(entry.BrakePedal), entry.Handbrake.ToString(), }; MainListView.Items.Add(new ListViewItem(row)); } MainListView.EndUpdate(); }
public void LoadListView() { MainListView.BeginUpdate(); // performance foreach (var entry in yvr.Records.Entries.data_items) { string[] row = { FloatUtil.ToString(entry.PositionX), FloatUtil.ToString(entry.PositionY), FloatUtil.ToString(entry.PositionZ), entry.Time.ToString(), entry.VelocityX.ToString(), entry.VelocityY.ToString(), entry.VelocityZ.ToString(), entry.RightX.ToString(), entry.RightY.ToString(), entry.RightZ.ToString(), entry.TopX.ToString(), entry.TopY.ToString(), entry.TopZ.ToString(), entry.SteeringAngle.ToString(), entry.GasPedalPower.ToString(), entry.BrakePedalPower.ToString(), entry.HandbrakeUsed.ToString(), }; MainListView.Items.Add(new ListViewItem(row)); } MainListView.EndUpdate(); }
public void WriteXml(StringBuilder sb, int indent) { YpdbXml.StringTag(sb, indent, "ClipSet", YpdbXml.HashString(ClipSet)); YpdbXml.StringTag(sb, indent, "Clip", YpdbXml.HashString(Clip)); YpdbXml.ValueTag(sb, indent, "Offset", FloatUtil.ToString(Offset)); PointCloud?.WriteXml(sb, indent); }
private void UpdateUI() { if (CurrentRoom == null) { //AddToProjectButton.Enabled = false; DeleteButton.Enabled = false; populatingui = true; NameTextBox.Text = string.Empty; MloRoomTextBox.Text = string.Empty; Hash1TextBox.Text = string.Empty; Unk02TextBox.Text = string.Empty; Unk03TextBox.Text = string.Empty; Unk04TextBox.Text = string.Empty; Unk05TextBox.Text = string.Empty; Unk06TextBox.Text = string.Empty; Unk07TextBox.Text = string.Empty; Unk08TextBox.Text = string.Empty; Unk09TextBox.Text = string.Empty; Unk10TextBox.Text = string.Empty; Unk11TextBox.Text = string.Empty; Unk12TextBox.Text = string.Empty; Unk13TextBox.Text = string.Empty; Unk14TextBox.Text = string.Empty; Flags0TextBox.Text = string.Empty; populatingui = false; } else { //AddToProjectButton.Enabled = CurrentZoneList?.Rel != null ? !ProjectForm.AudioFileExistsInProject(CurrentZoneList.Rel) : false; DeleteButton.Enabled = !(CurrentRoom?.Rel != null ? !ProjectForm.AudioFileExistsInProject(CurrentRoom.Rel) : false);// AddToProjectButton.Enabled; populatingui = true; var cr = CurrentRoom; NameTextBox.Text = cr.NameHash.ToString(); MloRoomTextBox.Text = cr.MloRoom.ToString(); Hash1TextBox.Text = cr.Hash1.ToString(); Unk02TextBox.Text = cr.Unk02.ToString(); Unk03TextBox.Text = FloatUtil.ToString(cr.Unk03); Unk04TextBox.Text = FloatUtil.ToString(cr.Unk04); Unk05TextBox.Text = FloatUtil.ToString(cr.Unk05); Unk06TextBox.Text = cr.Unk06.ToString(); Unk07TextBox.Text = FloatUtil.ToString(cr.Unk07); Unk08TextBox.Text = FloatUtil.ToString(cr.Unk08); Unk09TextBox.Text = FloatUtil.ToString(cr.Unk09); Unk10TextBox.Text = FloatUtil.ToString(cr.Unk10); Unk11TextBox.Text = FloatUtil.ToString(cr.Unk11); Unk12TextBox.Text = FloatUtil.ToString(cr.Unk12); Unk13TextBox.Text = cr.Unk13.ToString(); Unk14TextBox.Text = cr.Unk14.ToString(); Flags0TextBox.Text = cr.Flags0.Hex; populatingui = false; } }
public void WriteXml(StringBuilder sb, int indent) { YvrXml.ValueTag(sb, indent, "Time", Time.ToString()); YvrXml.SelfClosingTag(sb, indent, "Position " + FloatUtil.GetVector3XmlString(Position)); YvrXml.SelfClosingTag(sb, indent, "Velocity " + FloatUtil.GetVector3XmlString(Velocity)); YvrXml.SelfClosingTag(sb, indent, "Forward " + FloatUtil.GetVector3XmlString(Forward)); YvrXml.SelfClosingTag(sb, indent, "Right " + FloatUtil.GetVector3XmlString(Right)); YvrXml.ValueTag(sb, indent, "Steering", FloatUtil.ToString(Steering)); YvrXml.ValueTag(sb, indent, "GasPedal", FloatUtil.ToString(GasPedal)); YvrXml.ValueTag(sb, indent, "BrakePedal", FloatUtil.ToString(BrakePedal)); YvrXml.ValueTag(sb, indent, "Handbrake", Handbrake.ToString()); }
private void UpdateControls() { if (CurrentArchetype != null) { ArchetypeDeleteButton.Enabled = ProjectForm.YtypExistsInProject(CurrentArchetype.Ytyp); ArchetypeNameTextBox.Text = CurrentArchetype.Name; AssetNameTextBox.Text = CurrentArchetype.AssetName; LodDistNumericUpDown.Value = (decimal)CurrentArchetype._BaseArchetypeDef.lodDist; HDTextureDistNumericUpDown.Value = (decimal)CurrentArchetype._BaseArchetypeDef.hdTextureDist; SpecialAttributeNumericUpDown.Value = CurrentArchetype._BaseArchetypeDef.specialAttribute; ArchetypeFlagsTextBox.Text = CurrentArchetype._BaseArchetypeDef.flags.ToString(); TextureDictTextBox.Text = CurrentArchetype._BaseArchetypeDef.textureDictionary.ToCleanString(); ClipDictionaryTextBox.Text = CurrentArchetype._BaseArchetypeDef.clipDictionary.ToCleanString(); PhysicsDictionaryTextBox.Text = CurrentArchetype._BaseArchetypeDef.physicsDictionary.ToCleanString(); AssetTypeComboBox.Text = CurrentArchetype._BaseArchetypeDef.assetType.ToString(); BBMinTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMin); BBMaxTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bbMax); BSCenterTextBox.Text = FloatUtil.GetVector3String(CurrentArchetype._BaseArchetypeDef.bsCentre); BSRadiusTextBox.Text = FloatUtil.ToString(CurrentArchetype._BaseArchetypeDef.bsRadius); if (CurrentArchetype is MloArchetype MloArchetype) { if (!TabControl.TabPages.Contains(MloArchetypeTabPage)) { TabControl.TabPages.Add(MloArchetypeTabPage); } //MloInstanceData mloinstance = ProjectForm.TryGetMloInstance(MloArchetype); //nothing to see here right now } else { TabControl.TabPages.Remove(MloArchetypeTabPage); } if (CurrentArchetype is TimeArchetype TimeArchetype) { if (!TabControl.TabPages.Contains(TimeArchetypeTabPage)) { TabControl.TabPages.Add(TimeArchetypeTabPage); } TimeFlagsTextBox.Text = TimeArchetype.TimeFlags.ToString(); } else { TabControl.TabPages.Remove(TimeArchetypeTabPage); } } }
private string GenerateText() { StringBuilder sb = new StringBuilder(); sb.AppendLine("PositionX, PositionY, PositionZ, Time, VelocityX, VelocityY, VelocityZ, RightX, RightY, RightZ, ForwardX, ForwardY, ForwardZ, SteeringAngle, GasPedalPower, BrakePedalPower, HandbrakeUsed"); foreach (var entry in yvr.Records.Entries.data_items) { sb.Append(FloatUtil.ToString(entry.Position.X)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Position.Y)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Position.Z)); sb.Append(", "); sb.Append(entry.Time.ToString()); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Velocity.X)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Velocity.Y)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Velocity.Z)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Right.X)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Right.Y)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Right.Z)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Forward.X)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Forward.Y)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Forward.Z)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Steering)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.GasPedal)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.BrakePedal)); sb.Append(", "); sb.Append(entry.Handbrake.ToString()); sb.AppendLine(); } return(sb.ToString()); }
private string GenerateText() { StringBuilder sb = new StringBuilder(); sb.AppendLine("PositionX, PositionY, PositionZ, Time, VelocityX, VelocityY, VelocityZ, RightX, RightY, RightZ, TopX, TopY, TopZ, SteeringAngle, GasPedalPower, BrakePedalPower, HandbrakeUsed"); foreach (var entry in yvr.Records.Entries.data_items) { sb.Append(FloatUtil.ToString(entry.PositionX)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.PositionY)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.PositionZ)); sb.Append(", "); sb.Append(entry.Time.ToString()); sb.Append(", "); sb.Append(entry.VelocityX.ToString()); sb.Append(", "); sb.Append(entry.VelocityY.ToString()); sb.Append(", "); sb.Append(entry.VelocityZ.ToString()); sb.Append(", "); sb.Append(entry.RightX.ToString()); sb.Append(", "); sb.Append(entry.RightY.ToString()); sb.Append(", "); sb.Append(entry.RightZ.ToString()); sb.Append(", "); sb.Append(entry.TopX.ToString()); sb.Append(", "); sb.Append(entry.TopY.ToString()); sb.Append(", "); sb.Append(entry.TopZ.ToString()); sb.Append(", "); sb.Append(entry.SteeringAngle.ToString()); sb.Append(", "); sb.Append(entry.GasPedalPower.ToString()); sb.Append(", "); sb.Append(entry.BrakePedalPower.ToString()); sb.Append(", "); sb.Append(entry.HandbrakeUsed.ToString()); sb.AppendLine(); } return(sb.ToString()); }
private void LoadListView() { MainListView.BeginUpdate(); MainListView.Items.Clear(); foreach (var entry in ywr.Waypoints.Entries) { string[] row = { FloatUtil.ToString(entry.Position.X), FloatUtil.ToString(entry.Position.Y), FloatUtil.ToString(entry.Position.Z), entry.Unk0.ToString(), entry.Unk1.ToString(), entry.Unk2.ToString(), entry.Unk3.ToString() }; MainListView.Items.Add(new ListViewItem(row)); } MainListView.EndUpdate(); }
public void LoadYwr(YwrFile ywr) { fileName = ywr?.Name; if (string.IsNullOrEmpty(fileName)) { fileName = ywr?.RpfFileEntry?.Name; } UpdateFormTitle(); StringBuilder sb = new StringBuilder(); if ((ywr != null) && (ywr.Waypoints != null) && (ywr.Waypoints.Entries != null)) { sb.AppendLine("PositionX, PositionY, PositionZ, Unk0, Unk1, Unk2, Unk3"); foreach (var entry in ywr.Waypoints.Entries) { sb.Append(FloatUtil.ToString(entry.PositionX)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.PositionY)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.PositionZ)); sb.Append(", "); sb.Append(entry.Unk0.ToString()); sb.Append(", "); sb.Append(entry.Unk1.ToString()); sb.Append(", "); sb.Append(entry.Unk2.ToString()); sb.Append(", "); sb.Append(entry.Unk3.ToString()); sb.AppendLine(); } } else { sb.AppendLine("Unable to load Waypoint Records."); } MainTextBox.Text = sb.ToString(); }
private void UpdateControls() { if (CurrentRoom != null) { populatingui = true; NameTextBox.Text = CurrentRoom.RoomName; MinBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMin); MaxBoundsTextBox.Text = FloatUtil.GetVector3String(CurrentRoom.BBMax); FlagsTextBox.Text = CurrentRoom._Data.flags.ToString(); for (int i = 0; i < FlagsCheckedListBox.Items.Count; i++) { var c = ((CurrentRoom._Data.flags & (1u << i)) > 0); FlagsCheckedListBox.SetItemCheckState(i, c ? CheckState.Checked : CheckState.Unchecked); } BlendTextBox.Text = FloatUtil.ToString(CurrentRoom._Data.blend); TimecycleTextBox.Text = CurrentRoom._Data.timecycleName.ToCleanString(); Timecycle2TextBox.Text = CurrentRoom._Data.secondaryTimecycleName.ToCleanString(); PortalCountTextBox.Text = CurrentRoom._Data.portalCount.ToString(); FloorIDTextBox.Text = CurrentRoom._Data.floorId.ToString(); ExteriorVisDepthTextBox.Text = CurrentRoom._Data.exteriorVisibiltyDepth.ToString(); populatingui = false; } else { NameTextBox.Text = string.Empty; MinBoundsTextBox.Text = string.Empty; MaxBoundsTextBox.Text = string.Empty; FlagsTextBox.Text = string.Empty; BlendTextBox.Text = string.Empty; TimecycleTextBox.Text = string.Empty; Timecycle2TextBox.Text = string.Empty; PortalCountTextBox.Text = string.Empty; FloorIDTextBox.Text = string.Empty; ExteriorVisDepthTextBox.Text = string.Empty; } }
private string GenerateText() { var sb = new StringBuilder(); sb.AppendLine("PositionX, PositionY, PositionZ, Unk0, Unk1, Unk2, Unk3"); foreach (var entry in ywr.Waypoints.Entries) { sb.Append(FloatUtil.ToString(entry.Position.X)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Position.Y)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.Position.Z)); sb.Append(", "); sb.Append(entry.Unk0.ToString()); sb.Append(", "); sb.Append(entry.Unk1.ToString()); sb.Append(", "); sb.Append(entry.Unk2.ToString()); sb.Append(", "); sb.Append(entry.Unk3.ToString()); sb.AppendLine(); } return(sb.ToString()); }
public void UpdateUI() { var b = CollisionBounds; if (b == null) { AddToProjectButton.Enabled = false; DeleteButton.Enabled = false; BBMinTextBox.Text = string.Empty; BBMaxTextBox.Text = string.Empty; BBCenterTextBox.Text = string.Empty; BSCenterTextBox.Text = string.Empty; BSRadiusTextBox.Text = string.Empty; MarginTextBox.Text = string.Empty; VolumeTextBox.Text = string.Empty; UnkVectorTextBox.Text = string.Empty; MaterialColourUpDown.Value = 0; MaterialCombo.Text = ""; ProceduralIDUpDown.Value = 0; RoomIDUpDown.Value = 0; PedDensityUpDown.Value = 0; PolyFlagsUpDown.Value = 0; UnkFlagsUpDown.Value = 0; UnkTypeUpDown.Value = 0; BoundsTabControl.TabPages.Remove(GeometryTabPage); CenterGeomTextBox.Text = string.Empty; QuantumTextBox.Text = string.Empty; UnkFloat1TextBox.Text = string.Empty; UnkFloat2TextBox.Text = string.Empty; VertexCountLabel.Text = "0 vertices"; PolyCountLabel.Text = "0 polygons"; } else { populatingui = true; BBMinTextBox.Text = FloatUtil.GetVector3String(b.BoxMin); BBMaxTextBox.Text = FloatUtil.GetVector3String(b.BoxMax); BBCenterTextBox.Text = FloatUtil.GetVector3String(b.BoxCenter); BSCenterTextBox.Text = FloatUtil.GetVector3String(b.SphereCenter); BSRadiusTextBox.Text = FloatUtil.ToString(b.SphereRadius); MarginTextBox.Text = FloatUtil.ToString(b.Margin); VolumeTextBox.Text = FloatUtil.ToString(b.Volume); UnkVectorTextBox.Text = FloatUtil.GetVector3String(b.Unknown_60h); MaterialColourUpDown.Value = b.MaterialColorIndex; MaterialCombo.SelectedIndex = b.MaterialIndex; ProceduralIDUpDown.Value = b.ProceduralId; RoomIDUpDown.Value = b.RoomId; PedDensityUpDown.Value = b.PedDensity; PolyFlagsUpDown.Value = b.PolyFlags; UnkFlagsUpDown.Value = b.UnkFlags; UnkTypeUpDown.Value = b.Unknown_3Ch; if (b is BoundGeometry bg) { if (!BoundsTabControl.TabPages.Contains(GeometryTabPage)) { BoundsTabControl.TabPages.Add(GeometryTabPage); } CenterGeomTextBox.Text = FloatUtil.GetVector3String(bg.CenterGeom); QuantumTextBox.Text = FloatUtil.GetVector3String(bg.Quantum); UnkFloat1TextBox.Text = FloatUtil.ToString(bg.Unknown_9Ch); UnkFloat2TextBox.Text = FloatUtil.ToString(bg.Unknown_ACh); VertexCountLabel.Text = bg.VerticesCount.ToString() + ((bg.VerticesCount == 1) ? " vertex" : " vertices"); PolyCountLabel.Text = bg.PolygonsCount.ToString() + ((bg.PolygonsCount == 1) ? " polygon" : " polygons"); } else { BoundsTabControl.TabPages.Remove(GeometryTabPage); CenterGeomTextBox.Text = string.Empty; QuantumTextBox.Text = string.Empty; UnkFloat1TextBox.Text = string.Empty; UnkFloat2TextBox.Text = string.Empty; VertexCountLabel.Text = "0 vertices"; PolyCountLabel.Text = "0 polygons"; } var ybn = b.GetRootYbn(); AddToProjectButton.Enabled = (ybn != null) ? !ProjectForm.YbnExistsInProject(ybn) : false; DeleteButton.Enabled = !AddToProjectButton.Enabled; populatingui = false; } }
private static void WriteNode(StringBuilder sb, int indent, PsoCont cont, int blockId, int offset, XmlTagMode tagMode = XmlTagMode.None, MetaName structName = 0) { var block = cont.Pso.GetBlock(blockId); if (block == null) { ErrorXml(sb, indent, "Couldn't find block " + blockId + "!"); return; } var boffset = offset + block.Offset; if (structName == 0) { structName = (MetaName)block.NameHash; } var name = HashString(structName); var data = cont.Pso.DataSection.Data; var structInfo = cont.GetStructureInfo(structName); if (structInfo == null) { ErrorXml(sb, indent, "Couldn't find structure info " + name + "!"); return; } if (structInfo.Entries == null) { ErrorXml(sb, indent, "Couldn't find structure info entries for " + name + "!"); return; } switch (tagMode) { case XmlTagMode.Structure: OpenTag(sb, indent, name); break; case XmlTagMode.Item: OpenTag(sb, indent, "Item"); break; case XmlTagMode.ItemAndType: OpenTag(sb, indent, "Item type=\"" + name + "\""); break; } var cind = indent + 1; for (int i = 0; i < structInfo.Entries.Count; i++) { var entry = structInfo.Entries[i]; if ((MetaName)entry.EntryNameHash == MetaName.ARRAYINFO) { continue; } var ename = HashString((MetaName)entry.EntryNameHash); var eoffset = boffset + entry.DataOffset; switch (entry.Type) { default: ErrorXml(sb, cind, ename + ": Unexpected entry DataType: " + entry.Type.ToString()); break; case RageLib.GTA5.PSO.DataType.Array: WriteArrayNode(sb, cind, cont, blockId, offset, entry, structInfo, ename); break; case RageLib.GTA5.PSO.DataType.Bool: var boolVal = BitConverter.ToBoolean(data, eoffset); ValueTag(sb, cind, ename, boolVal ? "true" : "false"); break; case RageLib.GTA5.PSO.DataType.SByte: //was LONG_01h //signed byte? //var long1Val = MetaUtils.SwapBytes(BitConverter.ToUInt64(data, eoffset)); //ValueTag(sb, cind, ename, long1Val.ToString()); var byte1Val = (sbyte)data[eoffset]; ValueTag(sb, cind, ename, byte1Val.ToString()); break; case RageLib.GTA5.PSO.DataType.UByte: var byte2Val = data[eoffset]; ValueTag(sb, cind, ename, byte2Val.ToString()); break; case RageLib.GTA5.PSO.DataType.Enum: var enumInfo = cont.GetEnumInfo((MetaName)entry.ReferenceKey); switch (entry.Unk_5h) { default: ErrorXml(sb, cind, ename + ": Unexpected Enum subtype: " + entry.Unk_5h.ToString()); break; case 0: //int enum var intEVal = MetaUtils.SwapBytes(BitConverter.ToInt32(data, eoffset)); var intE = enumInfo.FindEntry(intEVal); StringTag(sb, cind, ename, HashString((MetaName)(intE?.EntryNameHash ?? 0))); break; case 2: //byte enum var byteEVal = data[eoffset]; var byteE = enumInfo.FindEntry(byteEVal); StringTag(sb, cind, ename, HashString((MetaName)(byteE?.EntryNameHash ?? 0))); break; } break; case RageLib.GTA5.PSO.DataType.Flags: uint fCount = ((uint)entry.ReferenceKey >> 16) & 0x0000FFFF; uint fEntry = ((uint)entry.ReferenceKey & 0xFFFF); var fEnt = structInfo.GetEntry((int)fEntry); PsoEnumInfo flagsInfo = null; if ((fEnt != null) && ((MetaName)fEnt.EntryNameHash == MetaName.ARRAYINFO)) { flagsInfo = cont.GetEnumInfo((MetaName)fEnt.ReferenceKey); } if (flagsInfo == null) { flagsInfo = cont.GetEnumInfo((MetaName)entry.EntryNameHash); } uint?flagsVal = null; switch (entry.Unk_5h) { default: ErrorXml(sb, cind, ename + ": Unexpected Flags subtype: " + entry.Unk_5h.ToString()); break; case 0: //int flags flagsVal = MetaUtils.SwapBytes(BitConverter.ToUInt32(data, eoffset)); break; case 1: //short flags flagsVal = MetaUtils.SwapBytes(BitConverter.ToUInt16(data, eoffset)); break; case 2: //byte flags flagsVal = data[eoffset]; break; } if (flagsVal.HasValue) { uint fv = flagsVal.Value; if (flagsInfo != null) { string fstr = ""; for (int n = 0; n < flagsInfo.EntriesCount; n++) { var fentry = flagsInfo.Entries[n]; var fmask = (1 << fentry.EntryKey); if ((fv & fmask) > 0) { if (fstr != "") { fstr += " "; } fstr += HashString((MetaName)fentry.EntryNameHash); } } StringTag(sb, cind, ename, fstr); } else { if (fv != 0) { ValueTag(sb, cind, ename, fv.ToString()); } else { SelfClosingTag(sb, cind, ename); } } } break; case RageLib.GTA5.PSO.DataType.Float: var floatVal = MetaUtils.SwapBytes(BitConverter.ToSingle(data, eoffset)); ValueTag(sb, cind, ename, FloatUtil.ToString(floatVal)); break; case RageLib.GTA5.PSO.DataType.Float2: var v2 = MetaUtils.SwapBytes(MetaUtils.ConvertData <Vector2>(data, eoffset)); SelfClosingTag(sb, cind, ename + " x=\"" + FloatUtil.ToString(v2.X) + "\" y=\"" + FloatUtil.ToString(v2.Y) + "\""); break; case RageLib.GTA5.PSO.DataType.Float3: var v3 = MetaUtils.SwapBytes(MetaUtils.ConvertData <Vector3>(data, eoffset)); SelfClosingTag(sb, cind, ename + " x=\"" + FloatUtil.ToString(v3.X) + "\" y=\"" + FloatUtil.ToString(v3.Y) + "\" z=\"" + FloatUtil.ToString(v3.Z) + "\""); break; case RageLib.GTA5.PSO.DataType.Float3a: //TODO: check this! var v3a = MetaUtils.SwapBytes(MetaUtils.ConvertData <Vector3>(data, eoffset)); SelfClosingTag(sb, cind, ename + " x=\"" + FloatUtil.ToString(v3a.X) + "\" y=\"" + FloatUtil.ToString(v3a.Y) + "\" z=\"" + FloatUtil.ToString(v3a.Z) + "\""); break; case RageLib.GTA5.PSO.DataType.Float4a: //TODO: check this! //...why are there 3 different types of float3? var v3b = MetaUtils.SwapBytes(MetaUtils.ConvertData <Vector3>(data, eoffset)); SelfClosingTag(sb, cind, ename + " x=\"" + FloatUtil.ToString(v3b.X) + "\" y=\"" + FloatUtil.ToString(v3b.Y) + "\" z=\"" + FloatUtil.ToString(v3b.Z) + "\""); break; case RageLib.GTA5.PSO.DataType.Float4: var v4 = MetaUtils.SwapBytes(MetaUtils.ConvertData <Vector4>(data, eoffset)); SelfClosingTag(sb, cind, ename + " x=\"" + FloatUtil.ToString(v4.X) + "\" y=\"" + FloatUtil.ToString(v4.Y) + "\" z=\"" + FloatUtil.ToString(v4.Z) + "\" w=\"" + FloatUtil.ToString(v4.W) + "\""); break; case RageLib.GTA5.PSO.DataType.SInt: //TODO: convert hashes? var int5Val = MetaUtils.SwapBytes(BitConverter.ToInt32(data, eoffset)); ValueTag(sb, cind, ename, int5Val.ToString()); break; case RageLib.GTA5.PSO.DataType.UInt: switch (entry.Unk_5h) { default: ErrorXml(sb, cind, ename + ": Unexpected Integer subtype: " + entry.Unk_5h.ToString()); break; case 0: //signed int var int6aVal = MetaUtils.SwapBytes(BitConverter.ToInt32(data, eoffset)); ValueTag(sb, cind, ename, int6aVal.ToString()); break; case 1: //unsigned int var int6bVal = MetaUtils.SwapBytes(BitConverter.ToUInt32(data, eoffset)); ValueTag(sb, cind, ename, "0x" + int6bVal.ToString("X").PadLeft(8, '0')); break; } break; case RageLib.GTA5.PSO.DataType.Long: var long2Val = MetaUtils.SwapBytes(BitConverter.ToUInt64(data, eoffset)); ValueTag(sb, cind, ename, long2Val.ToString()); break; case RageLib.GTA5.PSO.DataType.Map: WriteMapNode(sb, indent, cont, eoffset, entry, structInfo, ename); break; case RageLib.GTA5.PSO.DataType.SShort: var short3Val = (short)MetaUtils.SwapBytes(BitConverter.ToUInt16(data, eoffset)); ValueTag(sb, cind, ename, short3Val.ToString()); break; case RageLib.GTA5.PSO.DataType.UShort: var short4Val = MetaUtils.SwapBytes(BitConverter.ToUInt16(data, eoffset)); ValueTag(sb, cind, ename, short4Val.ToString()); break; case RageLib.GTA5.PSO.DataType.HFloat: //half float? var short1EVal = MetaUtils.SwapBytes(BitConverter.ToUInt16(data, eoffset)); ValueTag(sb, cind, ename, short1EVal.ToString()); break; case RageLib.GTA5.PSO.DataType.String: var str0 = GetStringValue(cont.Pso, entry, data, eoffset); if (str0 == null) { ErrorXml(sb, cind, ename + ": Unexpected String subtype: " + entry.Unk_5h.ToString()); } else { StringTag(sb, cind, ename, str0); } break; case RageLib.GTA5.PSO.DataType.Structure: switch (entry.Unk_5h) { default: ErrorXml(sb, cind, ename + ": Unexpected Structure subtype: " + entry.Unk_5h.ToString()); break; case 0: //default structure OpenTag(sb, cind, ename); WriteNode(sb, cind, cont, blockId, offset + entry.DataOffset, XmlTagMode.None, (MetaName)entry.ReferenceKey); CloseTag(sb, cind, ename); break; case 3: //structure pointer... case 4: //also pointer? what's the difference? var ptrVal = MetaUtils.ConvertData <PsoPOINTER>(data, eoffset); ptrVal.SwapEnd(); var pbid = ptrVal.BlockID; bool pbok = true; if (pbid <= 0) { pbok = false; //no block specified? } if (pbid > cont.Pso.DataMappingSection.EntriesCount) { pbok = false; //bad pointer? different type..? should output an error message here? } if (pbok) { WriteNode(sb, cind, cont, ptrVal.BlockID, (int)ptrVal.ItemOffset, XmlTagMode.None, (MetaName)entry.ReferenceKey); } else { SelfClosingTag(sb, cind, ename); } break; } break; } } switch (tagMode) { case XmlTagMode.Structure: CloseTag(sb, indent, name); break; case XmlTagMode.Item: case XmlTagMode.ItemAndType: CloseTag(sb, indent, "Item"); break; } }
private static void WriteParsedArrayOfBytesNode(StringBuilder sb, int indent, byte[] data, string ename, int eoffset, StructureEntryInfo entry, StructureEntryInfo arrEntry) { OpenTag(sb, indent, ename, false); var byteArrLen = ((int)entry.ReferenceKey); switch (arrEntry.DataType) { default: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n; byte b = ((bidx >= 0) && (bidx < data.Length)) ? data[bidx] : (byte)0; sb.Append(b.ToString("X").PadLeft(2, '0')); } break; case StructureEntryDataType.SignedByte: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n; sbyte b = ((bidx >= 0) && (bidx < data.Length)) ? (sbyte)data[bidx] : (sbyte)0; sb.Append(b.ToString()); //sb.Append(b.ToString("X").PadLeft(2, '0')); to show HEX values if (n < byteArrLen - 1) { sb.Append(" "); } } break; case StructureEntryDataType.UnsignedByte: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n; byte b = ((bidx >= 0) && (bidx < data.Length)) ? data[bidx] : (byte)0; sb.Append(b.ToString()); if (n < byteArrLen - 1) { sb.Append(" "); } } break; case StructureEntryDataType.SignedShort: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n * 2; short b = ((bidx >= 0) && (bidx < data.Length)) ? BitConverter.ToInt16(data, bidx) : (short)0; sb.Append(b.ToString()); if (n < byteArrLen - 1) { sb.Append(" "); } } break; case StructureEntryDataType.UnsignedShort: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n * 2; ushort b = ((bidx >= 0) && (bidx < data.Length)) ? BitConverter.ToUInt16(data, bidx) : (ushort)0; sb.Append(b.ToString()); if (n < byteArrLen - 1) { sb.Append(" "); } } break; case StructureEntryDataType.SignedInt: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n * 4; int b = ((bidx >= 0) && (bidx < data.Length)) ? BitConverter.ToInt32(data, bidx) : (int)0; sb.Append(b.ToString()); if (n < byteArrLen - 1) { sb.Append(" "); } } break; case StructureEntryDataType.UnsignedInt: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n * 4; uint b = ((bidx >= 0) && (bidx < data.Length)) ? BitConverter.ToUInt32(data, bidx) : (uint)0; sb.Append(b.ToString()); if (n < byteArrLen - 1) { sb.Append(" "); } } break; case StructureEntryDataType.Float: for (int n = 0; n < byteArrLen; n++) { var bidx = eoffset + n * 4; float b = ((bidx >= 0) && (bidx < data.Length)) ? BitConverter.ToSingle(data, bidx) : (float)0; sb.Append(FloatUtil.ToString(b)); if (n < byteArrLen - 1) { sb.Append(" "); } } break; } CloseTag(sb, 0, ename); }
private void LoadCarGen() { if (CurrentCarGen == null) { //CarGenPanel.Enabled = false; CarAddToProjectButton.Enabled = false; CarDeleteButton.Enabled = false; CarModelTextBox.Text = string.Empty; CarModelHashLabel.Text = "Hash: 0"; CarPopGroupTextBox.Text = string.Empty; CarPopGroupHashLabel.Text = "Hash: 0"; CarFlagsTextBox.Text = string.Empty; CarPositionTextBox.Text = string.Empty; CarOrientXTextBox.Text = string.Empty; CarOrientYTextBox.Text = string.Empty; CarPerpendicularLengthTextBox.Text = string.Empty; CarBodyColorRemap1TextBox.Text = string.Empty; CarBodyColorRemap2TextBox.Text = string.Empty; CarBodyColorRemap3TextBox.Text = string.Empty; CarBodyColorRemap4TextBox.Text = string.Empty; CarLiveryTextBox.Text = string.Empty; foreach (int i in CarFlagsCheckedListBox.CheckedIndices) { CarFlagsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } } else { populatingui = true; var c = CurrentCarGen.CCarGen; //CarGenPanel.Enabled = true; CarAddToProjectButton.Enabled = !ProjectForm.YmapExistsInProject(CurrentCarGen.Ymap); CarDeleteButton.Enabled = !CarAddToProjectButton.Enabled; CarModelTextBox.Text = c.carModel.ToString(); CarModelHashLabel.Text = "Hash: " + c.carModel.Hash.ToString(); CarPopGroupTextBox.Text = c.popGroup.ToString(); CarPopGroupHashLabel.Text = "Hash: " + c.popGroup.Hash.ToString(); CarFlagsTextBox.Text = c.flags.ToString(); CarPositionTextBox.Text = FloatUtil.GetVector3String(c.position); CarOrientXTextBox.Text = FloatUtil.ToString(c.orientX); CarOrientYTextBox.Text = FloatUtil.ToString(c.orientY); CarPerpendicularLengthTextBox.Text = FloatUtil.ToString(c.perpendicularLength); CarBodyColorRemap1TextBox.Text = c.bodyColorRemap1.ToString(); CarBodyColorRemap2TextBox.Text = c.bodyColorRemap2.ToString(); CarBodyColorRemap3TextBox.Text = c.bodyColorRemap3.ToString(); CarBodyColorRemap4TextBox.Text = c.bodyColorRemap4.ToString(); CarLiveryTextBox.Text = c.livery.ToString(); for (int i = 0; i < CarFlagsCheckedListBox.Items.Count; i++) { var cv = ((c.flags & (1u << i)) > 0); CarFlagsCheckedListBox.SetItemCheckState(i, cv ? CheckState.Checked : CheckState.Unchecked); } populatingui = false; if (ProjectForm.WorldForm != null) { ProjectForm.WorldForm.SelectCarGen(CurrentCarGen); } ////struct CCarGen: //Vector3 position { get; set; } //16 16: Float_XYZ: 0: position //float orientX { get; set; } //32 32: Float: 0: orientX=735213009 //float orientY { get; set; } //36 36: Float: 0: orientY=979440342 //float perpendicularLength { get; set; } //40 40: Float: 0: perpendicularLength=124715667 //MetaHash carModel { get; set; } //44 44: Hash: 0: carModel //uint flags { get; set; } //48 48: UnsignedInt: 0: flags //int bodyColorRemap1 { get; set; } //52 52: SignedInt: 0: bodyColorRemap1=1429703670 //int bodyColorRemap2 { get; set; } //56 56: SignedInt: 0: bodyColorRemap2=1254848286 //int bodyColorRemap3 { get; set; } //60 60: SignedInt: 0: bodyColorRemap3=1880965569 //int bodyColorRemap4 { get; set; } //64 64: SignedInt: 0: bodyColorRemap4=1719152247 //MetaHash popGroup { get; set; } //68 68: Hash: 0: popGroup=911358791 //sbyte livery { get; set; } //72 72: SignedByte: 0: livery } }
private void UpdateUI() { if (CurrentEmitter?.AudioEmitter == null) { AddToProjectButton.Enabled = false; DeleteButton.Enabled = false; populatingui = true; NameTextBox.Text = string.Empty; PositionTextBox.Text = string.Empty; InnerRadTextBox.Text = string.Empty; OuterRadTextBox.Text = string.Empty; ChildSoundTextBox.Text = string.Empty; CategoryTextBox.Text = string.Empty; Unk01TextBox.Text = string.Empty; StartTimeUpDown.Value = 0; EndTimeUpDown.Value = 0; Unk06UpDown.Value = 0; Unk07UpDown.Value = 0; Unk08UpDown.Value = 0; Unk09UpDown.Value = 0; Unk10UpDown.Value = 0; Unk11UpDown.Value = 0; Unk12UpDown.Value = 0; Unk13UpDown.Value = 0; Flags0TextBox.Text = string.Empty; Flags1TextBox.Text = string.Empty; Flags2TextBox.Text = string.Empty; Flags3TextBox.Text = string.Empty; Flags4TextBox.Text = string.Empty; Flags5TextBox.Text = string.Empty; ExtParamsTextBox.Text = string.Empty; populatingui = false; } else { AddToProjectButton.Enabled = CurrentEmitter?.RelFile != null ? !ProjectForm.AudioFileExistsInProject(CurrentEmitter.RelFile) : false; DeleteButton.Enabled = !AddToProjectButton.Enabled; populatingui = true; var e = CurrentEmitter.AudioEmitter; NameTextBox.Text = e.NameHash.ToString(); PositionTextBox.Text = FloatUtil.GetVector3String(e.Position); InnerRadTextBox.Text = FloatUtil.ToString(e.InnerRad); OuterRadTextBox.Text = FloatUtil.ToString(e.OuterRad); ChildSoundTextBox.Text = e.ChildSound.ToString(); CategoryTextBox.Text = e.Category.ToString(); Unk01TextBox.Text = FloatUtil.ToString(e.Unk01); StartTimeUpDown.Value = e.StartTime; EndTimeUpDown.Value = e.EndTime; Unk06UpDown.Value = e.Unk06.Value; Unk07UpDown.Value = e.Unk07.Value; Unk08UpDown.Value = e.Unk08.Value; Unk09UpDown.Value = e.Unk09.Value; Unk10UpDown.Value = e.Unk10.Value; Unk11UpDown.Value = e.Unk11.Value; Unk12UpDown.Value = e.Unk12.Value; Unk13UpDown.Value = e.Unk13.Value; Flags0TextBox.Text = e.Flags0.Hex; Flags1TextBox.Text = e.Flags1.Hex; Flags2TextBox.Text = e.Flags2.Hex; Flags3TextBox.Text = e.Flags3.Hex; Flags4TextBox.Text = e.Flags4.Hex; Flags5TextBox.Text = e.Flags5.Hex; StringBuilder sb = new StringBuilder(); if (e.ExtParams != null) { foreach (var extparam in e.ExtParams) { sb.Append(extparam.Hash.ToString()); sb.Append(", "); sb.Append(FloatUtil.ToString(extparam.Value)); sb.Append(", "); sb.Append(extparam.Flags.ToString()); sb.AppendLine(); } } ExtParamsTextBox.Text = sb.ToString(); populatingui = false; if (ProjectForm.WorldForm != null) { ProjectForm.WorldForm.SelectObject(CurrentEmitter); } } }
private void SynthsComboBox_SelectedIndexChanged(object sender, EventArgs e) { Dat10Synth synth = (Dat10Synth)SynthsComboBox.SelectedItem; if (synth == null) { return; } loadingSynth = true; SynthTextBox.Text = Dat10Synth.Disassemble(synth.Bytecode, synth.Constants, synth.Variables, false).Disassembly; SynthTextBox.ClearUndo(); SynthAssemblySyntaxHighlight(SynthTextBox.Range); SynthVariablesTextBox.Clear(); SynthVariablesTextBox.Text = string.Join(Environment.NewLine, synth.Variables.Select(v => $"{RelXml.HashString(v.Name)} {FloatUtil.ToString(v.Value)}")); SynthOutputsTextBox.Clear(); SynthOutputsTextBox.Text = string.Join(" ", synth.OutputsIndices.Take(synth.OutputsCount).Select(bufferIdx => $"B{bufferIdx}")); currentSynth = synth; loadingSynth = false; }
public override string ToString() { return(name + ": " + FloatUtil.ToString(value1) + ", " + FloatUtil.ToString(value2)); }
private void UpdateUI() { if (CurrentZone?.AudioZone == null) { AddToProjectButton.Enabled = false; DeleteButton.Enabled = false; populatingui = true; NameTextBox.Text = string.Empty; ShapeComboBox.Text = string.Empty; InnerPosTextBox.Text = string.Empty; InnerSizeTextBox.Text = string.Empty; InnerAngleTextBox.Text = string.Empty; InnerVec1TextBox.Text = string.Empty; InnerVec2TextBox.Text = string.Empty; InnerVec3TextBox.Text = string.Empty; OuterPosTextBox.Text = string.Empty; OuterSizeTextBox.Text = string.Empty; OuterAngleTextBox.Text = string.Empty; OuterVec1TextBox.Text = string.Empty; OuterVec2TextBox.Text = string.Empty; OuterVec3TextBox.Text = string.Empty; UnkVec1TextBox.Text = string.Empty; UnkVec2TextBox.Text = string.Empty; UnkVec3TextBox.Text = string.Empty; UnkBytesTextBox.Text = string.Empty; Flags0TextBox.Text = string.Empty; Flags1TextBox.Text = string.Empty; Flags2TextBox.Text = string.Empty; Hash0TextBox.Text = string.Empty; Hash1TextBox.Text = string.Empty; HashesTextBox.Text = string.Empty; ExtParamsTextBox.Text = string.Empty; populatingui = false; } else { AddToProjectButton.Enabled = CurrentZone?.RelFile != null ? !ProjectForm.AudioFileExistsInProject(CurrentZone.RelFile) : false; DeleteButton.Enabled = !AddToProjectButton.Enabled; populatingui = true; var z = CurrentZone.AudioZone; NameTextBox.Text = z.NameHash.ToString(); ShapeComboBox.Text = z.Shape.ToString(); InnerPosTextBox.Text = FloatUtil.GetVector3String(z.PlaybackZonePosition); InnerSizeTextBox.Text = FloatUtil.GetVector3String(z.PlaybackZoneSize); InnerAngleTextBox.Text = z.PlaybackZoneAngle.ToString(); InnerVec1TextBox.Text = FloatUtil.GetVector4String(z.PlaybackZoneVec1); InnerVec2TextBox.Text = FloatUtil.GetVector4String(z.PlaybackZoneVec2); InnerVec3TextBox.Text = FloatUtil.GetVector3String(z.PlaybackZoneVec3); OuterPosTextBox.Text = FloatUtil.GetVector3String(z.ActivationZonePosition); OuterSizeTextBox.Text = FloatUtil.GetVector3String(z.ActivationZoneSize); OuterAngleTextBox.Text = z.ActivationZoneAngle.ToString(); OuterVec1TextBox.Text = FloatUtil.GetVector4String(z.ActivationZoneVec1); OuterVec2TextBox.Text = FloatUtil.GetVector4String(z.ActivationZoneVec2); OuterVec3TextBox.Text = FloatUtil.GetVector3String(z.ActivationZoneVec3); UnkVec1TextBox.Text = FloatUtil.GetVector4String(z.UnkVec1); UnkVec2TextBox.Text = FloatUtil.GetVector4String(z.UnkVec2); UnkVec3TextBox.Text = FloatUtil.GetVector2String(z.UnkVec3); UnkBytesTextBox.Text = string.Format("{0}, {1}, {2}", z.Unk14, z.Unk15, z.Unk16); Flags0TextBox.Text = z.Flags0.Hex; Flags1TextBox.Text = z.Flags1.Hex; Flags2TextBox.Text = z.Flags2.Hex; Hash0TextBox.Text = z.UnkHash0.ToString(); Hash1TextBox.Text = z.UnkHash1.ToString(); StringBuilder sb = new StringBuilder(); if (z.Rules != null) { foreach (var hash in z.Rules) { sb.AppendLine(hash.ToString()); } } HashesTextBox.Text = sb.ToString(); sb.Clear(); if (z.ExtParams != null) { foreach (var extparam in z.ExtParams) { sb.Append(extparam.Hash.ToString()); sb.Append(", "); sb.Append(FloatUtil.ToString(extparam.Value)); sb.AppendLine(); } } ExtParamsTextBox.Text = sb.ToString(); populatingui = false; if (ProjectForm.WorldForm != null) { ProjectForm.WorldForm.SelectObject(CurrentZone); } } }
public override string ToString() { return(CenterX.ToString() + ", " + CenterY.ToString() + ", " + SizeX.ToString() + ", " + SizeY.ToString() + ", " + NodeIndex.ToString() + ", " + NodeCount.ToString() + ", " + Short7.ToString() + ", " + Short8.ToString() + ", " + FloatUtil.ToString(Float1) + ", " + Byte1.ToString() + ", " + Byte2.ToString() + ", " + Byte3.ToString() + ", " + Byte4.ToString()); }
public void LoadYvr(YvrFile yvr) { fileName = yvr?.Name; if (string.IsNullOrEmpty(fileName)) { fileName = yvr?.RpfFileEntry?.Name; } UpdateFormTitle(); StringBuilder sb = new StringBuilder(); if ((yvr != null) && (yvr.Records != null) && (yvr.Records.Entries != null) && (yvr.Records.Entries.data_items != null)) { sb.AppendLine("PositionX, PositionY, PositionZ, Time, VelocityX, VelocityY, VelocityZ, RightX, RightY, RightZ, TopX, TopY, TopZ, SteeringAngle, GasPedalPower, BrakePedalPower, HandbrakeUsed"); foreach (var entry in yvr.Records.Entries.data_items) { sb.Append(FloatUtil.ToString(entry.PositionX)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.PositionY)); sb.Append(", "); sb.Append(FloatUtil.ToString(entry.PositionZ)); sb.Append(", "); sb.Append(entry.Time.ToString()); sb.Append(", "); sb.Append(entry.VelocityX.ToString()); sb.Append(", "); sb.Append(entry.VelocityY.ToString()); sb.Append(", "); sb.Append(entry.VelocityZ.ToString()); sb.Append(", "); sb.Append(entry.RightX.ToString()); sb.Append(", "); sb.Append(entry.RightY.ToString()); sb.Append(", "); sb.Append(entry.RightZ.ToString()); sb.Append(", "); sb.Append(entry.TopX.ToString()); sb.Append(", "); sb.Append(entry.TopY.ToString()); sb.Append(", "); sb.Append(entry.TopZ.ToString()); sb.Append(", "); sb.Append(entry.SteeringAngle.ToString()); sb.Append(", "); sb.Append(entry.GasPedalPower.ToString()); sb.Append(", "); sb.Append(entry.BrakePedalPower.ToString()); sb.Append(", "); sb.Append(entry.HandbrakeUsed.ToString()); sb.AppendLine(); } } else { sb.AppendLine("Unable to load Vehicle Records."); } MainTextBox.Text = sb.ToString(); }
private void LoadEntity(bool sameEntity) { if (CurrentEntity == null) { //EntityPanel.Enabled = false; EntityAddToProjectButton.Enabled = false; EntityDeleteButton.Enabled = false; EntityArchetypeTextBox.Text = string.Empty; EntityArchetypeHashLabel.Text = "Hash: 0"; EntityFlagsTextBox.Text = string.Empty; EntityGuidTextBox.Text = string.Empty; EntityPositionTextBox.Text = string.Empty; EntityRotationQuatBox.Value = Quaternion.Identity; EntityScaleXYTextBox.Text = string.Empty; EntityScaleZTextBox.Text = string.Empty; EntityParentIndexTextBox.Text = string.Empty; EntityLodDistTextBox.Text = string.Empty; EntityChildLodDistTextBox.Text = string.Empty; EntityLodLevelComboBox.SelectedIndex = 0; // Math.Max(EntityLodLevelComboBox.FindString(), 0); EntityNumChildrenTextBox.Text = string.Empty; EntityPriorityLevelComboBox.SelectedIndex = 0; //Math.Max(.. EntityAOMultiplierTextBox.Text = string.Empty; EntityArtificialAOTextBox.Text = string.Empty; EntityTintValueTextBox.Text = string.Empty; EntityPivotEditCheckBox.Checked = false; EntityPivotPositionTextBox.Text = string.Empty; EntityPivotRotationQuatBox.Value = Quaternion.Identity; foreach (int i in EntityFlagsCheckedListBox.CheckedIndices) { EntityFlagsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } } else { populatingui = true; var e = CurrentEntity._CEntityDef; var po = CurrentEntity.PivotOrientation; var rot = new Quaternion(e.rotation); var rotupd = (EntityRotationQuatBox.Value != rot); //EntityPanel.Enabled = true; EntityAddToProjectButton.Enabled = CurrentEntity.Ymap != null ? !ProjectForm.YmapExistsInProject(CurrentEntity.Ymap) : !ProjectForm.YtypExistsInProject(CurrentEntity.MloParent?.Archetype?.Ytyp); EntityDeleteButton.Enabled = !EntityAddToProjectButton.Enabled; EntityArchetypeTextBox.Text = e.archetypeName.ToString(); EntityArchetypeHashLabel.Text = "Hash: " + e.archetypeName.Hash.ToString(); EntityFlagsTextBox.Text = e.flags.ToString(); EntityGuidTextBox.Text = e.guid.ToString(); EntityPositionTextBox.Text = FloatUtil.GetVector3String(e.position); EntityRotationQuatBox.Value = rot; EntityScaleXYTextBox.Text = FloatUtil.ToString(e.scaleXY); EntityScaleZTextBox.Text = FloatUtil.ToString(e.scaleZ); EntityParentIndexTextBox.Text = e.parentIndex.ToString(); EntityLodDistTextBox.Text = FloatUtil.ToString(e.lodDist); EntityChildLodDistTextBox.Text = FloatUtil.ToString(e.childLodDist); EntityLodLevelComboBox.SelectedIndex = Math.Max(EntityLodLevelComboBox.FindString(e.lodLevel.ToString()), 0); EntityNumChildrenTextBox.Text = e.numChildren.ToString(); EntityPriorityLevelComboBox.SelectedIndex = Math.Max(EntityPriorityLevelComboBox.FindString(e.priorityLevel.ToString()), 0); EntityAOMultiplierTextBox.Text = e.ambientOcclusionMultiplier.ToString(); EntityArtificialAOTextBox.Text = e.artificialAmbientOcclusion.ToString(); EntityTintValueTextBox.Text = e.tintValue.ToString(); EntityPivotPositionTextBox.Text = FloatUtil.GetVector3String(CurrentEntity.PivotPosition); EntityPivotRotationQuatBox.Value = po; for (int i = 0; i < EntityFlagsCheckedListBox.Items.Count; i++) { var cv = ((e.flags & (1u << i)) > 0); EntityFlagsCheckedListBox.SetItemCheckState(i, cv ? CheckState.Checked : CheckState.Unchecked); } MiloEntitySetsListBox.Items.Clear(); if (CurrentEntity.MloInstance != null) { var milo = CurrentEntity.MloInstance._Instance; MiloGroupIDTextBox.Text = milo.groupId.ToString(); MiloFloorIDTextBox.Text = milo.floorId.ToString(); MiloNumExitPortalsTextBox.Text = milo.numExitPortals.ToString(); MiloFlagsTextBox.Text = milo.MLOInstflags.ToString(); if (CurrentEntity.MloInstance.EntitySets != null) { foreach (var set in CurrentEntity.MloInstance.EntitySets) { if (set?.EntitySet != null) { MiloEntitySetsListBox.Items.Add(set.EntitySet.ToString(), set.Visible); } } } } else { MiloGroupIDTextBox.Text = string.Empty; MiloFloorIDTextBox.Text = string.Empty; MiloNumExitPortalsTextBox.Text = string.Empty; MiloFlagsTextBox.Text = string.Empty; } populatingui = false; UpdateTabVisibility(); if (rotupd && sameEntity) { UpdateRotationFlag(); } var ms = ProjectForm.WorldForm?.CurrentMapSelection; if ((ms?.EntityDef != CurrentEntity) && (ms?.MloEntityDef != CurrentEntity)) { ProjectForm.WorldForm?.SelectObject(CurrentEntity); //hopefully the drawable is already loaded - this will try get from cache } ////struct CEntityDef: //MetaHash archetypeName { get; set; } //8 8: Hash: 0: archetypeName //uint flags { get; set; } //12 12: UnsignedInt: 0: flags //uint guid { get; set; } //16 16: UnsignedInt: 0: guid //Vector3 position { get; set; } //32 32: Float_XYZ: 0: position //Vector4 rotation { get; set; } //48 48: Float_XYZW: 0: rotation //float scaleXY { get; set; } //64 64: Float: 0: 2627937847 //float scaleZ { get; set; } //68 68: Float: 0: 284916802 //int parentIndex { get; set; } //72 72: SignedInt: 0: parentIndex //float lodDist { get; set; } //76 76: Float: 0: lodDist //float childLodDist { get; set; } //80 80: Float: 0: childLodDist//3398912973 //rage__eLodType lodLevel { get; set; } //84 84: IntEnum: 1264241711: lodLevel //LODTYPES_DEPTH_ //uint numChildren { get; set; } //88 88: UnsignedInt: 0: numChildren//2793909385 //rage__ePriorityLevel priorityLevel { get; set; } //92 92: IntEnum: 648413703: priorityLevel//647098393 //Array_StructurePointer extensions { get; set; } //96 96: Array: 0: extensions {0: StructurePointer: 0: 256} //int ambientOcclusionMultiplier { get; set; } //112 112: SignedInt: 0: ambientOcclusionMultiplier//415356295 //int artificialAmbientOcclusion { get; set; } //116 116: SignedInt: 0: artificialAmbientOcclusion//599844163 //uint tintValue { get; set; } //120 120: UnsignedInt: 0: tintValue//1015358759 } }
public override string ToString() { return(string.Format("{0}, {1}, {2}", FloatUtil.ToString(minX), FloatUtil.ToString(minY), FloatUtil.ToString(z), FloatUtil.ToString(maxX), FloatUtil.ToString(maxY))); }
private void LoadLodLight() { if (CurrentLodLight == null) { ////Panel.Enabled = false; AddToProjectButton.Enabled = false; DeleteButton.Enabled = false; PositionTextBox.Text = string.Empty; DirectionTextBox.Text = string.Empty; TypeComboBox.SelectedItem = LightType.Point; IntensityUpDown.Value = 0; ColourRUpDown.Value = 0; ColourGUpDown.Value = 0; ColourBUpDown.Value = 0; ColourLabel.BackColor = System.Drawing.Color.White; FalloffTextBox.Text = ""; FalloffExponentTextBox.Text = ""; HashTextBox.Text = ""; InnerAngleUpDown.Value = 0; OuterAngleUpDown.Value = 0; CoronaIntensityUpDown.Value = 0; TimeStateFlagsTextBox.Text = ""; foreach (int i in TimeFlagsAMCheckedListBox.CheckedIndices) { TimeFlagsAMCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in TimeFlagsPMCheckedListBox.CheckedIndices) { TimeFlagsPMCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in StateFlags1CheckedListBox.CheckedIndices) { StateFlags1CheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } foreach (int i in StateFlags2CheckedListBox.CheckedIndices) { StateFlags2CheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } } else { populatingui = true; var l = CurrentLodLight; ////Panel.Enabled = true; AddToProjectButton.Enabled = !ProjectForm.YmapExistsInProject(CurrentLodLight.Ymap); DeleteButton.Enabled = !AddToProjectButton.Enabled; PositionTextBox.Text = FloatUtil.GetVector3String(l.Position); DirectionTextBox.Text = FloatUtil.GetVector3String(l.Direction); TypeComboBox.SelectedItem = l.Type; IntensityUpDown.Value = l.Colour.A; ColourRUpDown.Value = l.Colour.R; ColourGUpDown.Value = l.Colour.G; ColourBUpDown.Value = l.Colour.B; ColourLabel.BackColor = System.Drawing.Color.FromArgb(l.Colour.R, l.Colour.G, l.Colour.B); FalloffTextBox.Text = FloatUtil.ToString(l.Falloff); FalloffExponentTextBox.Text = FloatUtil.ToString(l.FalloffExponent); HashTextBox.Text = l.Hash.ToString(); InnerAngleUpDown.Value = l.ConeInnerAngle; OuterAngleUpDown.Value = l.ConeOuterAngleOrCapExt; CoronaIntensityUpDown.Value = l.CoronaIntensity; TimeStateFlagsTextBox.Text = l.TimeAndStateFlags.ToString(); UpdateFlagsCheckBoxes(); populatingui = false; if (ProjectForm.WorldForm != null) { ProjectForm.WorldForm.SelectObject(CurrentLodLight); } } }
public void UpdateUI() { var light = selectedLight; if (light == null) { DeleteLightButton.Enabled = false; EditDeleteLightMenu.Enabled = false; populatingui = true; PositionTextBox.Text = ""; DirectionTextBox.Text = ""; TangentTextBox.Text = ""; TypeComboBox.SelectedItem = "Point"; ColourRUpDown.Value = 0; ColourGUpDown.Value = 0; ColourBUpDown.Value = 0; IntensityTextBox.Text = ""; FlagsTextBox.Text = ""; FlashinessUpDown.Value = 0; BoneIDUpDown.Value = 0; GroupIDUpDown.Value = 0; FalloffTextBox.Text = ""; FalloffExponentTextBox.Text = ""; InnerAngleTextBox.Text = ""; OuterAngleTextBox.Text = ""; CoronaSizeTextBox.Text = ""; CoronaIntensityTextBox.Text = ""; ExtentTextBox.Text = ""; ShadowBlurUpDown.Value = 0; LightFadeDistanceUpDown.Value = 0; CoronaZBiasTextBox.Text = ""; TextureHashTextBox.Text = ""; VolumeIntensityTextBox.Text = ""; VolumeSizeScaleTextBox.Text = ""; VolumeColorRUpDown.Value = 0; VolumeColorGUpDown.Value = 0; VolumeColorBUpDown.Value = 0; VolumeOuterExponentTextBox.Text = ""; ShadowFadeDistanceUpDown.Value = 0; SpecularFadeDistanceUpDown.Value = 0; VolumetricFadeDistanceUpDown.Value = 0; ShadowNearClipTextBox.Text = ""; CullingPlaneNormalTextBox.Text = ""; CullingPlaneOffsetTextBox.Text = ""; TimeFlagsTextBox.Text = ""; populatingui = false; } else { DeleteLightButton.Enabled = true; EditDeleteLightMenu.Enabled = true; populatingui = true; PositionTextBox.Text = FloatUtil.GetVector3String(light.Position); DirectionTextBox.Text = FloatUtil.GetVector3String(light.Direction); TangentTextBox.Text = FloatUtil.GetVector3String(light.Tangent); TypeComboBox.SelectedItem = light.Type.ToString(); ColourRUpDown.Value = light.ColorR; ColourGUpDown.Value = light.ColorG; ColourBUpDown.Value = light.ColorB; ColourLabel.BackColor = System.Drawing.Color.FromArgb(light.ColorR, light.ColorG, light.ColorB); IntensityTextBox.Text = FloatUtil.ToString(light.Intensity); FlagsTextBox.Text = light.Flags.ToString(); FlashinessUpDown.Value = light.Flashiness; BoneIDUpDown.Value = light.BoneId; GroupIDUpDown.Value = light.GroupId; FalloffTextBox.Text = FloatUtil.ToString(light.Falloff); FalloffExponentTextBox.Text = FloatUtil.ToString(light.FalloffExponent); InnerAngleTextBox.Text = FloatUtil.ToString(light.ConeInnerAngle); OuterAngleTextBox.Text = FloatUtil.ToString(light.ConeOuterAngle); CoronaSizeTextBox.Text = FloatUtil.ToString(light.CoronaSize); CoronaIntensityTextBox.Text = FloatUtil.ToString(light.CoronaIntensity); ExtentTextBox.Text = FloatUtil.GetVector3String(light.Extent); ShadowBlurUpDown.Value = light.ShadowBlur; LightFadeDistanceUpDown.Value = light.LightFadeDistance; CoronaZBiasTextBox.Text = FloatUtil.ToString(light.CoronaZBias); TextureHashTextBox.Text = light.ProjectedTextureHash.ToCleanString(); VolumeIntensityTextBox.Text = FloatUtil.ToString(light.VolumeIntensity); VolumeSizeScaleTextBox.Text = FloatUtil.ToString(light.VolumeSizeScale); VolumeColorRUpDown.Value = light.VolumeOuterColorR; VolumeColorGUpDown.Value = light.VolumeOuterColorG; VolumeColorBUpDown.Value = light.VolumeOuterColorB; VolumeColorLabel.BackColor = System.Drawing.Color.FromArgb(light.VolumeOuterColorR, light.VolumeOuterColorG, light.VolumeOuterColorB); VolumeOuterExponentTextBox.Text = FloatUtil.ToString(light.VolumeOuterExponent); ShadowFadeDistanceUpDown.Value = light.ShadowFadeDistance; SpecularFadeDistanceUpDown.Value = light.SpecularFadeDistance; VolumetricFadeDistanceUpDown.Value = light.VolumetricFadeDistance; ShadowNearClipTextBox.Text = FloatUtil.ToString(light.ShadowNearClip); CullingPlaneNormalTextBox.Text = FloatUtil.GetVector3String(light.CullingPlaneNormal); CullingPlaneOffsetTextBox.Text = FloatUtil.ToString(light.CullingPlaneOffset); TimeFlagsTextBox.Text = light.TimeFlags.ToString(); UpdateFlagsCheckBoxes(); populatingui = false; } }
private void LoadEntity() { if (CurrentEntity == null) { //EntityPanel.Enabled = false; EntityAddToProjectButton.Enabled = false; EntityDeleteButton.Enabled = false; EntityArchetypeTextBox.Text = string.Empty; EntityArchetypeHashLabel.Text = "Hash: 0"; EntityFlagsTextBox.Text = string.Empty; EntityGuidTextBox.Text = string.Empty; EntityPositionTextBox.Text = string.Empty; EntityRotationTextBox.Text = string.Empty; EntityScaleXYTextBox.Text = string.Empty; EntityScaleZTextBox.Text = string.Empty; EntityParentIndexTextBox.Text = string.Empty; EntityLodDistTextBox.Text = string.Empty; EntityChildLodDistTextBox.Text = string.Empty; EntityLodLevelComboBox.SelectedIndex = 0; // Math.Max(EntityLodLevelComboBox.FindString(), 0); EntityNumChildrenTextBox.Text = string.Empty; EntityPriorityLevelComboBox.SelectedIndex = 0; //Math.Max(.. EntityAOMultiplierTextBox.Text = string.Empty; EntityArtificialAOTextBox.Text = string.Empty; EntityTintValueTextBox.Text = string.Empty; EntityPivotEditCheckBox.Checked = false; EntityPivotPositionTextBox.Text = string.Empty; EntityPivotRotationTextBox.Text = string.Empty; foreach (int i in EntityFlagsCheckedListBox.CheckedIndices) { EntityFlagsCheckedListBox.SetItemCheckState(i, CheckState.Unchecked); } } else { populatingui = true; var e = CurrentEntity.CEntityDef; var po = CurrentEntity.PivotOrientation; //EntityPanel.Enabled = true; EntityAddToProjectButton.Enabled = !ProjectForm.YmapExistsInProject(CurrentEntity.Ymap); EntityDeleteButton.Enabled = !EntityAddToProjectButton.Enabled; EntityArchetypeTextBox.Text = e.archetypeName.ToString(); EntityArchetypeHashLabel.Text = "Hash: " + e.archetypeName.Hash.ToString(); EntityFlagsTextBox.Text = e.flags.ToString(); EntityGuidTextBox.Text = e.guid.ToString(); EntityPositionTextBox.Text = FloatUtil.GetVector3String(e.position); EntityRotationTextBox.Text = FloatUtil.GetVector4String(e.rotation); EntityScaleXYTextBox.Text = FloatUtil.ToString(e.scaleXY); EntityScaleZTextBox.Text = FloatUtil.ToString(e.scaleZ); EntityParentIndexTextBox.Text = e.parentIndex.ToString(); EntityLodDistTextBox.Text = FloatUtil.ToString(e.lodDist); EntityChildLodDistTextBox.Text = FloatUtil.ToString(e.childLodDist); EntityLodLevelComboBox.SelectedIndex = Math.Max(EntityLodLevelComboBox.FindString(e.lodLevel.ToString()), 0); EntityNumChildrenTextBox.Text = e.numChildren.ToString(); EntityPriorityLevelComboBox.SelectedIndex = Math.Max(EntityPriorityLevelComboBox.FindString(e.priorityLevel.ToString()), 0); EntityAOMultiplierTextBox.Text = e.ambientOcclusionMultiplier.ToString(); EntityArtificialAOTextBox.Text = e.artificialAmbientOcclusion.ToString(); EntityTintValueTextBox.Text = e.tintValue.ToString(); EntityPivotPositionTextBox.Text = FloatUtil.GetVector3String(CurrentEntity.PivotPosition); EntityPivotRotationTextBox.Text = FloatUtil.GetVector4String(new Vector4(po.X, po.Y, po.Z, po.W)); for (int i = 0; i < EntityFlagsCheckedListBox.Items.Count; i++) { var cv = ((e.flags & (1u << i)) > 0); EntityFlagsCheckedListBox.SetItemCheckState(i, cv ? CheckState.Checked : CheckState.Unchecked); } populatingui = false; ProjectForm.WorldForm?.SelectEntity(CurrentEntity); //hopefully the drawable is already loaded - this will try get from cache ////struct CEntityDef: //MetaHash archetypeName { get; set; } //8 8: Hash: 0: archetypeName //uint flags { get; set; } //12 12: UnsignedInt: 0: flags //uint guid { get; set; } //16 16: UnsignedInt: 0: guid //Vector3 position { get; set; } //32 32: Float_XYZ: 0: position //Vector4 rotation { get; set; } //48 48: Float_XYZW: 0: rotation //float scaleXY { get; set; } //64 64: Float: 0: 2627937847 //float scaleZ { get; set; } //68 68: Float: 0: 284916802 //int parentIndex { get; set; } //72 72: SignedInt: 0: parentIndex //float lodDist { get; set; } //76 76: Float: 0: lodDist //float childLodDist { get; set; } //80 80: Float: 0: childLodDist//3398912973 //Unk_1264241711 lodLevel { get; set; } //84 84: IntEnum: 1264241711: lodLevel //LODTYPES_DEPTH_ //uint numChildren { get; set; } //88 88: UnsignedInt: 0: numChildren//2793909385 //Unk_648413703 priorityLevel { get; set; } //92 92: IntEnum: 648413703: priorityLevel//647098393 //Array_StructurePointer extensions { get; set; } //96 96: Array: 0: extensions {0: StructurePointer: 0: 256} //int ambientOcclusionMultiplier { get; set; } //112 112: SignedInt: 0: ambientOcclusionMultiplier//415356295 //int artificialAmbientOcclusion { get; set; } //116 116: SignedInt: 0: artificialAmbientOcclusion//599844163 //uint tintValue { get; set; } //120 120: UnsignedInt: 0: tintValue//1015358759 } }
public void UpdateUI() { if (CollisionPoly == null) { AddToProjectButton.Enabled = false; DeleteButton.Enabled = false; PolyTabControl.TabPages.Clear(); TriVertex1TextBox.Text = string.Empty; TriVertex2TextBox.Text = string.Empty; TriVertex3TextBox.Text = string.Empty; TriAreaTextBox.Text = string.Empty; TriEdge1UpDown.Value = 0; TriEdge2UpDown.Value = 0; TriEdge3UpDown.Value = 0; TriFlag1CheckBox.Checked = false; TriFlag2CheckBox.Checked = false; TriFlag3CheckBox.Checked = false; SphPositionTextBox.Text = string.Empty; SphRadiusTextBox.Text = string.Empty; CapVertex1TextBox.Text = string.Empty; CapVertex2TextBox.Text = string.Empty; CapRadiusTextBox.Text = string.Empty; BoxVertex1TextBox.Text = string.Empty; BoxVertex2TextBox.Text = string.Empty; BoxVertex3TextBox.Text = string.Empty; BoxVertex4TextBox.Text = string.Empty; CylVertex1TextBox.Text = string.Empty; CylVertex2TextBox.Text = string.Empty; CylRadiusTextBox.Text = string.Empty; MatTypeCombo.Text = string.Empty; MatColourUpDown.Value = 0; MatProceduralIDUpDown.Value = 0; MatRoomIDUpDown.Value = 0; MatPedDensityUpDown.Value = 0; MatUnkUpDown.Value = 0; SetCheckedListBoxValues(MatFlagsCheckedListBox, 0); } else { populatingui = true; if (CollisionTriangle != null) { TriVertex1TextBox.Text = FloatUtil.GetVector3String(CollisionTriangle.Vertex1); TriVertex2TextBox.Text = FloatUtil.GetVector3String(CollisionTriangle.Vertex2); TriVertex3TextBox.Text = FloatUtil.GetVector3String(CollisionTriangle.Vertex3); TriAreaTextBox.Text = FloatUtil.ToString(CollisionTriangle.triArea); TriEdge1UpDown.Value = CollisionTriangle.edgeIndex1; TriEdge2UpDown.Value = CollisionTriangle.edgeIndex2; TriEdge3UpDown.Value = CollisionTriangle.edgeIndex3; TriFlag1CheckBox.Checked = CollisionTriangle.vertFlag1; TriFlag2CheckBox.Checked = CollisionTriangle.vertFlag2; TriFlag3CheckBox.Checked = CollisionTriangle.vertFlag3; if (!PolyTabControl.TabPages.Contains(TriangleTabPage)) { PolyTabControl.TabPages.Add(TriangleTabPage); } } else { PolyTabControl.TabPages.Remove(TriangleTabPage); } if (CollisionSphere != null) { SphPositionTextBox.Text = FloatUtil.GetVector3String(CollisionSphere.Position); SphRadiusTextBox.Text = FloatUtil.ToString(CollisionSphere.sphereRadius); if (!PolyTabControl.TabPages.Contains(SphereTabPage)) { PolyTabControl.TabPages.Add(SphereTabPage); } } else { PolyTabControl.TabPages.Remove(SphereTabPage); } if (CollisionCapsule != null) { CapVertex1TextBox.Text = FloatUtil.GetVector3String(CollisionCapsule.Vertex1); CapVertex2TextBox.Text = FloatUtil.GetVector3String(CollisionCapsule.Vertex2); CapRadiusTextBox.Text = FloatUtil.ToString(CollisionCapsule.capsuleRadius); if (!PolyTabControl.TabPages.Contains(CapsuleTabPage)) { PolyTabControl.TabPages.Add(CapsuleTabPage); } } else { PolyTabControl.TabPages.Remove(CapsuleTabPage); } if (CollisionBox != null) { BoxVertex1TextBox.Text = FloatUtil.GetVector3String(CollisionBox.Vertex1); BoxVertex2TextBox.Text = FloatUtil.GetVector3String(CollisionBox.Vertex2); BoxVertex3TextBox.Text = FloatUtil.GetVector3String(CollisionBox.Vertex3); BoxVertex4TextBox.Text = FloatUtil.GetVector3String(CollisionBox.Vertex4); if (!PolyTabControl.TabPages.Contains(BoxTabPage)) { PolyTabControl.TabPages.Add(BoxTabPage); } } else { PolyTabControl.TabPages.Remove(BoxTabPage); } if (CollisionCylinder != null) { CylVertex1TextBox.Text = FloatUtil.GetVector3String(CollisionCylinder.Vertex1); CylVertex2TextBox.Text = FloatUtil.GetVector3String(CollisionCylinder.Vertex2); CylRadiusTextBox.Text = FloatUtil.ToString(CollisionCylinder.cylinderRadius); if (!PolyTabControl.TabPages.Contains(CylinderTabPage)) { PolyTabControl.TabPages.Add(CylinderTabPage); } } else { PolyTabControl.TabPages.Remove(CylinderTabPage); } var m = CollisionPoly.Material; MatTypeCombo.SelectedIndex = m.Type.Index; MatColourUpDown.Value = m.MaterialColorIndex; MatProceduralIDUpDown.Value = m.ProceduralId; MatRoomIDUpDown.Value = m.RoomId; MatPedDensityUpDown.Value = m.PedDensity; MatUnkUpDown.Value = m.Unk4; SetCheckedListBoxValues(MatFlagsCheckedListBox, (ushort)m.Flags); var ybn = CollisionPoly.Owner?.GetRootYbn(); AddToProjectButton.Enabled = (ybn != null) ? !ProjectForm.YbnExistsInProject(ybn) : false; DeleteButton.Enabled = !AddToProjectButton.Enabled; populatingui = false; } }